PageSourceSearch

https://market-source.vercel.app/_next/static/chunks/9609.030fd65d227029d8.js

js market-source.vercel.app collected 2026-10-03 07:18:40 UTC 1,029,294 bytes, 2,672 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9609],{70782:function(e,t,r){"use strict";r.d(t,{t:function(){return c}});var i=r(2265),n=r(21276),a=r(72079),o=r(24573);class s extends a.jyz{constructor(){super({uniforms:{time:{value:0},fade:{value:1}},vertexShader:`
2      uniform float time;
3      attribute float size;
4      varying vec3 vColor;
5      void main() {
6        vColor = color;
7        vec4 mvPosition = modelViewMatrix * vec4(position, 0.5);
8        gl_PointSize = size * (30.0 / -mvPosition.z) * (3.0 + sin(time + 100.0));
9        gl_Position = projectionMatrix * mvPosition;
10      }`,fragmentShader:`
11      uniform sampler2D pointTexture;
12      uniform float fade;
13      varying vec3 vColor;
14      void main() {
15        float opacity = 1.0;
16        if (fade == 1.0) {
17          float d = distance(gl_PointCoord, vec2(0.5, 0.5));
18          opacity = 1.0 / (1.0 + exp(16.0 * (d - 0.25)));
19        }
20        gl_FragColor = vec4(vColor, opacity);
21
22        #include <tonemapping_fragment>
23	      #include <${o.i>=154?"colorspace_fragment":"encodings_fragment"}>
24      }`})}}let l=e=>new a.Pa4().setFromSpherical(new a.$V(e,Math.acos(1-2*Math.random()),2*Math.random()*Math.PI)),c=i.forwardRef(({radius:e=100,depth:t=50,count:r=5e3,saturation:o=0,factor:c=4,fade:u=!1,speed:h=1},A)=>{let d=i.useRef(),[m,f,p]=i.useMemo(()=>{let i=[],n=[],s=Array.from({length:r},()=>(.5+.5*Math.random())*c),u=new a.Ilk,h=e+t,A=t/r;for(let e=0;e<r;e++)h-=A*Math.random(),i.push(...l(h).toArray()),u.setHSL(e/r,o,.9),n.push(u.r,u.g,u.b);return[new Float32Array(i),new Float32Array(n),new Float32Array(s)]},[r,t,c,e,o]);(0,n.F)(e=>d.current&&(d.current.uniforms.time.value=e.clock.elapsedTime*h));let[g]=i.useState(()=>new s);return i.createElement("points",{ref:A},i.createElement("bufferGeometry",null,i.createElement("bufferAttribute",{attach:"attributes-position",args:[m,3]}),i.createElement("bufferAttribute",{attach:"attributes-color",args:[f,3]}),i.createElement("bufferAttribute",{attach:"attributes-size",args:[p,1]})),i.createElement("primitive",{ref:d,object:g,attach:"material",blending:a.WMw,"uniforms-fade-value":u,depthWrite:!1,transparent:!0,vertexColors:!0}))})},24573:function(e,t,r){"use strict";r.d(t,{i:function(){return i}});let i=parseInt(r(72079).UZH.replace(/\D+/g,""))},10959:function(e,t,r){"use strict";let i,n,a,o,s,l,c,u,h,A,d,m,f,p,g,y,v,E,x,C,w,B,I,_,b,M,S,D,P,T,R,F,Q,z,k,L,O,U,G,N,H,j,J,V,K,Y;r.r(t),r.d(t,{AccumulativeShadows:function(){return gU},AdaptiveDpr:function(){return yq},AdaptiveEvents:function(){return yX},ArcballControls:function(){return c3},AsciiRenderer:function(){return l7},BBAnchor:function(){return fm},Backdrop:function(){return gK},BakeShadows:function(){return yj},Billboard:function(){return or},Bounds:function(){return pZ},Box:function(){return pB},Bvh:function(){return fi},CameraControls:function(){return uU},CameraShake:function(){return p4},Capsule:function(){return pG},CatmullRomLine:function(){return oO},Caustics:function(){return g1},Center:function(){return fv},Circle:function(){return pI},Clone:function(){return s1},Cloud:function(){return yi.ZJ},CloudInstance:function(){return yi.Zk},Clouds:function(){return yi.lc},ComputedAttribute:function(){return sZ},Cone:function(){return p_},ContactShadows:function(){return gk},CubeCamera:function(){return cm},CubeTexture:function(){return hp},CubicBezierLine:function(){return oL},CurveModifier:function(){return f0},CycleRaycast:function(){return ej},Cylinder:function(){return pb},Decal:function(){return lt},Detailed:function(){return yN},DetectGPU:function(){return df},DeviceOrientationControls:function(){return cw},Dodecahedron:function(){return pL},DragControls:function(){return t7},Edges:function(){return sP},Effects:function(){return sE},Environment:function(){return gF},EnvironmentCube:function(){return gP},EnvironmentMap:function(){return gD},EnvironmentPortal:function(){return gT},Example:function(){return fE},Extrude:function(){return pO},FaceControls:function(){return E_},FaceLandmarker:function(){return Ex},FaceLandmarkerDefaults:function(){return EE},Facemesh:function(){return Ef},FacemeshDatas:function(){return Ey},FacemeshEye:function(){return Eg},FacemeshEyeDefaults:function(){return Ep},Fbo:function(){return cl},Fbx:function(){return Ap},FirstPersonControls:function(){return ug}
24,Fisheye:function(){return y8},Float:function(){return p5},FlyControls:function(){return cS},GizmoHelper:function(){return u5},GizmoViewcube:function(){return hc},GizmoViewport:function(){return hA},Gltf:function(){return l8},GradientTexture:function(){return sC},GradientType:function(){return sx},Grid:function(){return hm},Helper:function(){return A2},Html:function(){return eH},Hud:function(){return uK},Icosahedron:function(){return pz},Image:function(){return sD},Instance:function(){return fL},InstancedAttribute:function(){return fN},Instances:function(){return fO},IsObject:function(){return sB.ci},KeyboardControls:function(){return aG},Ktx2:function(){return Aj},Lathe:function(){return pU},Lightformer:function(){return ye},Line:function(){return oQ},Loader:function(){return e0},MapControls:function(){return cO},MarchingCube:function(){return s6},MarchingCubes:function(){return s5},MarchingPlane:function(){return s8},Mask:function(){return y5},MatcapTexture:function(){return yA},Merged:function(){return fU},MeshDiscardMaterial:function(){return pf},MeshDistortMaterial:function(){return f3},MeshPortalMaterial:function(){return ve},MeshReflectorMaterial:function(){return f7},MeshRefractionMaterial:function(){return ph},MeshTransmissionMaterial:function(){return pm},MeshWobbleMaterial:function(){return f5},MotionPathControls:function(){return uJ},MultiMaterial:function(){return pp},NormalTexture:function(){return ym},Octahedron:function(){return pk},OrbitControls:function(){return cU}
24,OrthographicCamera:function(){return cu},Outlines:function(){return sR},PerformanceMonitor:function(){return y$},PerspectiveCamera:function(){return cA},PivotControls:function(){return Eu},Plane:function(){return pS},Point:function(){return yF},PointMaterial:function(){return pv},PointMaterialImpl:function(){return py},PointerLockControls:function(){return uh},Points:function(){return yz},PointsBuffer:function(){return yQ},Polyhedron:function(){return pQ},PositionMesh:function(){return fS},PositionPoint:function(){return yS},PositionalAudio:function(){return oU},Preload:function(){return yH},PresentationControls:function(){return aL},Progress:function(){return e$},QuadraticBezierLine:function(){return ok},RandomizedLight:function(){return gG},Reflector:function(){return g0},RenderCubeTexture:function(){return y3},RenderTexture:function(){return y0},Resize:function(){return pV},Ring:function(){return pF},RoundedBox:function(){return pH},Sampler:function(){return sX},ScreenQuad:function(){return pJ},ScreenSizer:function(){return oh},ScreenSpace:function(){return oi},ScreenVideoTexture:function(){return Eh},Scroll:function(){return r0},ScrollControls:function(){return rZ},Segment:function(){return yG},SegmentObject:function(){return yO},Segments:function(){return yL},Select:function(){return oe},Shadow:function(){return gY},ShadowAlpha:function(){return yB},Shape:function(){return pN},Sky:function(){return yt.q},SoftShadows:function(){return pC},Sparkles:function(){return yu},Sphere:function(){return pM},Splat:function(){return co},SpotLight:function(){return g7},SpotLightShadow:function(){return g9},SpriteAnimator:function(){return fV},Stage:function(){return gJ},Stars:function(){return yr.t},Stats:function(){return A6},StatsGl:function(){return A7},Svg:function(){return li},Tetrahedron:function(){return pR},Text:function(){return oH},Text3D:function(){return o4},Texture:function(){return sB.xE},Torus:function(){return pP},TorusKnot:function(){return pT},TrackballControls:function(){return cJ},Trail:function(){return sV},TrailTexture:function(){return fy},TransformControls:function(){return ue},Tube:function(){return pD},VideoTexture:function(){return Aq},View:function(){return vw},WebcamVideoTexture:function(){return EA},Wireframe:function(){return yw},accumulativeContext:function(){return gL},calcPosFromAngles:function(){return yt.a},calculateScaleFactor:function(){return oc},checkIfFrameIsEmpty:function(){return A$},createInstances:function(){return fG},getFirstFrame:function(){return AZ},isWebGL2Available:function(){return sv},meshBounds:function(){return yW},shaderMaterial:function(){return sw},useAnimations:function(){return fa},useAspect:function(){return dt},useBVH:function(){return fr},useBounds:function(){return p$},useBoxProjectedEnv:function(){return fh},useCamera:function(){return dr},useContextBridge:function(){return fn},useCubeCamera:function(){return cd},useCubeTexture:function(){return hf},useCursor:function(){return eJ},useDepthBuffer:function(){return de},useDetectGPU:function(){return dm},useEnvironment:function(){return gx},useFBO:function(){return cs},useFBX:function(){return Af},useFaceControls:function(){return Eb},useFaceLandmarker:function(){return EC},useFont:function(){return o0},useGLTF:function(){return l6},useGizmoContext:function(){return uW},useHelper:function(){return A0},useIntersect:function(){return fo},useKTX2:function(){return AH},useKeyboardControls:function(){return aN},useMask:function(){return y6},useMatcapTexture:function(){return yh},useMotion:function(){return uH},useNormalTexture:function(){return yd},usePerformanceMonitor:function(){return y1},useProgress:function(){return eZ},useScroll:function(){return rX},useSelect:function(){return ot},useSpriteAnimator:function(){return fj},useSpriteLoader:function(){return A1},useSurfaceSampler:function(){return sq},useTexture:function(){return sB.mE},useTrail:function(){return sJ},useTrailTexture:function(){return fg},useVideoTexture:function(){return AW}});var W,q,X,Z,$,ee,et,er,ei,en,ea,eo,es,el,ec,eu,eh,eA,ed,em,ef,ep,eg,ey,ev,eE,ex,eC,ew,eB,eI,e_,eb,eM,eS=r(1119),eD=r(2265),eP=r(34040),eT=r(72079),eR=r(21276);let eF=new eT.Pa4,eQ=new eT.Pa4,ez=new eT.Pa4,ek=new eT.FM8;function eL(e,t,r){let i=eF.setFromMatrixPosition(e.matrixWorld);i.project(t);let n=r.width/2,a=r.height/2;return[i.x*n+n,-(i.y*a)+a]}let eO=e=>1e-10>Math.abs(e)?0:e;function eU(e,t,r=""){let i="matrix3d(";for(let r=0;16!==r;r++)i+=eO(t[r]*e.elements[r])+(15!==r?",":")");return r+i}let eG=(J=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>eU(e,J)),eN=(V=e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1],(e,t)=>eU(e,V(t),"translate(-50%,-50%)")),eH=eD.forwardRef(({children:e,eps:t=.001,style:r,className:i,prepend:n,center:a,fullscreen:o,portal:s,distanceFactor:l,sprite:c=!1,transform:u=!1,occlude:h,onOcclude:A,castShadow:d,receiveShadow:m,material:f,geometry:p,zIndexRange:g=[16777271,0],calculatePosition:y=eL,as:v="div",wrapperClass:E,pointerEvents:x="auto",...C},w)=>{let{gl:B,camera:I,scene:_,size:b,raycaster:M,events:S,viewport:D}=(0,eR.D)(),[P]=eD.useState(()=>document.createElement(v)),T=eD.useRef(),R=eD.useRef(null),F=eD.useRef(0),Q=eD.useRef([0,0]),z=eD.useRef(null),k=eD.useRef(null),L=(null==s?void 0:s.current)||S.connected||B.domElement.parentNode,O=eD.useRef(null),U=eD.useRef(!1),G=eD.useMemo(()=>{var e;return h&&"blending"!==h||Array.isArray(h)&&h.length&&(e=h[0])&&"object"==typeof e&&"current"in e},[h]);eD.useLayoutEffect(()=>{let e=B.domElement;h&&"blending"===h?(e.style.zIndex=`${Math.floor(g[0]/2)}`,e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[h]),eD.useLayoutEffect(()=>{if(R.current){let e=T.current=eP.createRoot(P);if(_.updateMatrixWorld(),u)P.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{let e=y(R.current,I,b);P.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return L&&(n?L.prepend(P):L.appendChild(P)),()=>{L&&L.removeChild(P),e.unmount()}}},[L,u]),eD.useLayoutEffect(()=>{E&&(P.className=E)},[E]);let N=eD.useMemo(()=>
24u?{position:"absolute",top:0,left:0,width:b.width,height:b.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:a?"translate3d(-50%,-50%,0)":"none",...o&&{top:-b.height/2,left:-b.width/2,width:b.width,height:b.height},...r},[r,a,o,b,u]),H=eD.useMemo(()=>({position:"absolute",pointerEvents:x}),[x]);eD.useLayoutEffect(()=>{var t,n;U.current=!1,u?null==(t=T.current)||t.render(eD.createElement("div",{ref:z,style:N},eD.createElement("div",{ref:k,style:H},eD.createElement("div",{ref:w,className:i,style:r,children:e})))):null==(n=T.current)||n.render(eD.createElement("div",{ref:w,style:N,className:i,children:e}))});let j=eD.useRef(!0);(0,eR.F)(e=>{if(R.current){I.updateMatrixWorld(),R.current.updateWorldMatrix(!0,!1);let e=u?Q.current:y(R.current,I,b);if(u||Math.abs(F.current-I.zoom)>t||Math.abs(Q.current[0]-e[0])>t||Math.abs(Q.current[1]-e[1])>t){let t=function(e,t){let r=eF.setFromMatrixPosition(e.matrixWorld),i=eQ.setFromMatrixPosition(t.matrixWorld),n=r.sub(i),a=t.getWorldDirection(ez);return n.angleTo(a)>Math.PI/2}(R.current,I),r=!1;G&&(Array.isArray(h)?r=h.map(e=>e.current):"blending"!==h&&(r=[_]));let i=j.current;if(r){let e=function(e,t,r,i){let n=eF.setFromMatrixPosition(e.matrixWorld),a=n.clone();a.project(t),ek.set(a.x,a.y),r.setFromCamera(ek,t);let o=r.intersectObjects(i,!0);if(o.length){let e=o[0].distance;return n.distanceTo(r.ray.origin)<e}return!0}(R.current,I,M,r);j.current=e&&!t}else j.current=!t;i!==j.current&&(A?A(!j.current):P.style.display=j.current?"block":"none");let n=Math.floor(g[0]/2),a=h?G?[g[0],n]:[n-1,0]:g;if(P.style.zIndex=`${function(e,t,r){if(t instanceof eT.cPb||t instanceof eT.iKG){let i=eF.setFromMatrixPosition(e.matrixWorld),n=eQ.setFromMatrixPosition(t.matrixWorld),a=i.distanceTo(n),o=(r[1]-r[0])/(t.far-t.near),s=r[1]-o*t.far;return Math.round(o*a+s)}}(R.current,I,a)}`,u){let[e,t]=[b.width/2,b.height/2],r=I.projectionMatrix.elements[5]*t,{isOrthographicCamera:i,top:n,left:a,bottom:o,right:s}=I,u=eG(I.matrixWorldInverse),h=i?`scale(${r})translate(${eO(-(s+a)/2)}px,${eO((n+o)/2)}
24px)`:`translateZ(${r}px)`,A=R.current.matrixWorld;c&&((A=I.matrixWorldInverse.clone().transpose().copyPosition(A).scale(R.current.scale)).elements[3]=A.elements[7]=A.elements[11]=0,A.elements[15]=1),P.style.width=b.width+"px",P.style.height=b.height+"px",P.style.perspective=i?"":`${r}px`,z.current&&k.current&&(z.current.style.transform=`${h}${u}translate(${e}px,${t}px)`,k.current.style.transform=eN(A,1/((l||10)/400)))}else{let t=void 0===l?1:function(e,t){if(t instanceof eT.iKG)return t.zoom;if(!(t instanceof eT.cPb))return 1;{let r=eF.setFromMatrixPosition(e.matrixWorld),i=eQ.setFromMatrixPosition(t.matrixWorld);return 1/(2*Math.tan(t.fov*Math.PI/180/2)*r.distanceTo(i))}}(R.current,I)*l;P.style.transform=`translate3d(${e[0]}px,${e[1]}px,0) scale(${t})`}Q.current=e,F.current=I.zoom}}if(!G&&O.current&&!U.current){if(u){if(z.current){let e=z.current.children[0];if(null!=e&&e.clientWidth&&null!=e&&e.clientHeight){let{isOrthographicCamera:t}=I;if(t||p)C.scale&&(Array.isArray(C.scale)?C.scale instanceof eT.Pa4?O.current.scale.copy(C.scale.clone().divideScalar(1)):O.current.scale.set(1/C.scale[0],1/C.scale[1],1/C.scale[2]):O.current.scale.setScalar(1/C.scale));else{let t=(l||10)/400,r=e.clientWidth*t,i=e.clientHeight*t;O.current.scale.set(r,i,1)}U.current=!0}}}else{let t=P.children[0];if(null!=t&&t.clientWidth&&null!=t&&t.clientHeight){let e=1/D.factor,r=t.clientWidth*e,i=t.clientHeight*e;O.current.scale.set(r,i,1),U.current=!0}O.current.lookAt(e.camera.position)}}});let J=eD.useMemo(()=>({vertexShader:u?void 0:`
25          /*
26            This shader is from the THREE's SpriteMaterial.
27            We need to turn the backing plane into a Sprite
28            (make it always face the camera) if "transfrom"
29            is false.
30          */
31          #include <common>
32
33          void main() {
34            vec2 center = vec2(0., 1.);
35            float rotation = 0.0;
36
37            // This is somewhat arbitrary, but it seems to work well
38            // Need to figure out how to derive this dynamically if it even matters
39            float size = 0.03;
40
41            vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
42            vec2 scale;
43            scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
44            scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
45
46            bool isPerspective = isPerspectiveMatrix( projectionMatrix );
47            if ( isPerspective ) scale *= - mvPosition.z;
48
49            vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;
50            vec2 rotatedPosition;
51            rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
52            rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
53            mvPosition.xy += rotatedPosition;
54
55            gl_Position = projectionMatrix * mvPosition;
56          }
57      `,fragmentShader:`
58        void main() {
59          gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
60        }
61      `}),[u]);return eD.createElement("group",(0,eS.Z)({},C,{ref:R}),h&&!G&&eD.createElement("mesh",{castShadow:d,receiveShadow:m,ref:O},p||eD.createElement("planeGeometry",null),f||eD.createElement("shaderMaterial",{side:eT.ehD,vertexShader:J.vertexShader,fragmentShader:J.fragmentShader})))});function ej({onChanged:e,portal:t,preventDefault:r=!0,scroll:i=!0,keyCode:n=9}){let a=eD.useRef(0),o=(0,eR.D)(e=>e.setEvents),s=(0,eR.D)(e=>e.get),l=(0,eR.D)(e=>e.gl);return eD.useEffect(()=>{var c;let u;let h=[],A=s().events.filter,d=null!==(c=null==t?void 0:t.current)&&void 0!==c?c:l.domElement.parentNode,m=()=>d&&e&&e(h,Math.round(a.current)%h.length);o({filter:(e,t)=>{let r=[...e];r.length===h.length&&h.every(e=>r.map(e=>e.object.uuid).includes(e.object.uuid))||(a.current=0,h=r,m()),A&&(r=A(r,t));for(let e=0;e<Math.round(a.current)%r.length;e++){let e=r.shift();r=[...r,e]}return r}});let f=e=>{var t,r;a.current=e(a.current),null==(t=s().events.handlers)||t.onPointerCancel(void 0),null==(r=s().events.handlers)||r.onPointerMove(u),m()},p=e=>{(e.keyCode||e.which)===n&&(r&&e.preventDefault(),h.length>1&&f(e=>e+1))},g=e=>{r&&e.preventDefault();let t=0;e||(e=window.event),e.wheelDelta?t=e.wheelDelta/120:e.detail&&(t=-e.detail/3),h.length>1&&f(e=>Math.abs(e-t))},y=e=>u=e;return document.addEventListener("pointermove",y,{passive:!0}),i&&document.addEventListener("wheel",g),void 0!==n&&document.addEventListener("keydown",p),()=>{o({filter:A}),void 0!==n&&document.removeEventListener("keydown",p),i&&document.removeEventListener("wheel",g),document.removeEventListener("pointermove",y)}},[l,s,o,r,i,n]),null}function eJ(e,t="pointer",r="auto",i=document.body){eD.useEffect(()=>{if(e)return i.style.cursor=t,()=>void(i.style.cursor=r)},[e])}let eV=e=>{let t;let r=new Set,i=(e,i)=>{let n="function"==typeof e?e(t):e;if(!Object.is(n,t)){let e=t;t=(null!=i?i:"object"!=typeof n||null===n)?n:Object.assign({},t,n),r.forEach(r=>r(t,e))}},n=()=>t,a={setState:i,getState:n,getInitialState:()=>o,subscribe:e=>(r.add(e),()=>r.delete(e))},o=t=e(i,n,a);return a},eK=e=>e?eV(e):eV,eY=e=>e,eW=e=>{let t=eK(e),r=e=>(function(e,t=eY){let r=eD.useSyncExternalStore(e.subscribe,eD.useCallback(()=>t(e.getState()),[e,t]),eD.useCallback(()=>t(e.getInitialState()),[e,t]));return eD.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},eq=e=>e?eW(e):eW,eX=0,eZ=eq(e=>(eT.tEQ.onStart=(t,r,i)=>{e({active:!0,item:t,loaded:r,total:i,progress:(r-eX)/(i-eX)*100})},eT.tEQ.onLoad=()=>{e({active:!1})},eT.tEQ.onError=t=>e(e=>({errors:[...e.errors,t]})),eT.tEQ.onProgress=(t,r,i)=>{r===i&&(eX=i),e({active:!0,item:t,loaded:r,total:i,progress:(r-eX)/(i-eX)*100||100})},{errors:[],active:!1,progress:0,item:"",loaded:0,total:0}));function e$({children:e}){let t=eZ();return eD.createElement(eD.Fragment,null,null==e?void 0:e(t))}let e1=e=>`Loading ${e.toFixed(2)}%`;function e0({containerStyles:e,innerStyles:t,barStyles:r,dataStyles:i,dataInterpolation:n=e1,initialState:a=e=>e}){let{active:o,progress:s}=eZ(),l=eD.useRef(0),c=eD.useRef(0),u=eD.useRef(null),[h,A]=eD.useState(a(o));eD.useEffect(()=>{let e;return o!==h&&(e=setTimeout(()=>A(o),300)),()=>clearTimeout(e)},[h,o]);let d=eD.useCallback(()=>{u.current&&(l.current+=(s-l.current)/2,(l.current>
61.95*s||100===s)&&(l.current=s),u.current.innerText=n(l.current),l.current<s&&(c.current=requestAnimationFrame(d)))},[n,s]);return eD.useEffect(()=>(d(),()=>cancelAnimationFrame(c.current)),[d]),h?eD.createElement("div",{style:{...e2.container,opacity:o?1:0,...e}},eD.createElement("div",null,eD.createElement("div",{style:{...e2.inner,...t}},eD.createElement("div",{style:{...e2.bar,transform:`scaleX(${s/100})`,...r}}),eD.createElement("span",{ref:u,style:{...e2.data,...i}})))):null}let e2={container:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:"#171717",display:"flex",alignItems:"center",justifyContent:"center",transition:"opacity 300ms ease",zIndex:1e3},inner:{width:100,height:3,background:"#272727",textAlign:"center"},bar:{height:3,width:"100%",background:"white",transition:"transform 200ms",transformOrigin:"left center"},data:{display:"inline-block",position:"relative",fontVariantNumeric:"tabular-nums",marginTop:"0.8em",color:"#f0f0f0",fontSize:"0.6em",fontFamily:'-apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Helvetica Neue", Helvetica, Arial, Roboto, Ubuntu, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',whiteSpace:"nowrap"}},e3={toVector:(e,t)=>(void 0===e&&(e=t),Array.isArray(e)?e:[e,e]),add:(e,t)=>[e[0]+t[0],e[1]+t[1]],sub:(e,t)=>[e[0]-t[0],e[1]-t[1]],addTo(e,t){e[0]+=t[0],e[1]+=t[1]},subTo(e,t){e[0]-=t[0],e[1]-=t[1]}};function e4(e,t,r){return 0===t||Math.abs(t)===1/0?Math.pow(e,5*r):e*t*r/(t+r*e)}function e5(e,t,r,i=.15){return 0===i?Math.max(t,Math.min(e,r)):e<t?-e4(t-e,r-t,i)+t:e>r?+e4(e-r,r-t,i)+r:e}function e6(e,t,r){var i;return(t="symbol"==typeof(i=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?i:String(i))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function e8(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function e9(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?e8(Object(r),!0).forEach(function(t){e6(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):e8(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}let e7={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function te(e){return e?e[0].toUpperCase()+e.slice(1):""}let tt=["enter","leave"],tr=["gotpointercapture","lostpointercapture"];function ti(e){return"touches"in e}function tn(e){return ti(e)?"touch":"pointerType"in e?e.pointerType:"mouse"}function ta(e){return ti(e)?("touchend"===e.type||"touchcancel"===e.type?e.changedTouches:e.targetTouches)[0]:e}function to(e,t){try{let r=t.clientX-e.clientX,i=t.clientY-e.clientY,n=(t.clientX+e.clientX)/2,a=(t.clientY+e.clientY)/2;return{angle:-(180*Math.atan2(r,i))/Math.PI,distance:Math.hypot(r,i),origin:[n,a]}}catch(e){}return null}function ts(e,t){let[r,i]=Array.from(e.touches).filter(e=>t.includes(e.identifier));return to(r,i)}function tl(e){let t=ta(e);return ti(e)?t.identifier:t.pointerId}function tc(e){let t=ta(e);return[t.clientX,t.clientY]}function tu(e){let{deltaX:t,deltaY:r,deltaMode:i}=e;return 1===i?(t*=40,r*=40):2===i&&(t*=800,r*=800),[t,r]}function th(e,...t){return"function"==typeof e?e(...t):e}function tA(){}function td(e,t){return Object.assign({},t,e||{})}class tm{constructor(e,t,r){this.ctrl=e,this.args=t,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}
61get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){let{state:e,shared:t,ingKey:r,args:i}=this;t[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=i,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){let t=this.state,r=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=r.from?th(r.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){let t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){let e=this.state;e._initial=e._values,e.initial=e.values}compute(e){let{state:t,config:r,shared:i}=this;t.args=this.args;let n=0;if(e&&(t.event=e,r.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,function(e){let t={};if("buttons"in e&&(t.buttons=e.buttons),"shiftKey"in e){let{shiftKey:r,altKey:i,metaKey:n,ctrlKey:a}=e;Object.assign(t,{shiftKey:r,altKey:i,metaKey:n,ctrlKey:a})}return t}(e)),i.down=i.pressed=i.buttons%2==1||i.touches>0,n=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){let e=t._delta.map(Math.abs);e3.addTo(t._distance,e)}this.axisIntent&&this.axisIntent(e);let[a,o]=t._movement,[s,l]=r.threshold,{_step:c,values:u}=t;if(r.hasCustomTransform?(!1===c[0]&&(c[0]=Math.abs(a)>=s&&u[0]),!1===c[1]&&(c[1]=Math.abs(o)>=l&&u[1])):(!1===c[0]&&(c[0]=Math.abs(a)>=s&&Math.sign(a)*s),!1===c[1]&&(c[1]=Math.abs(o)>=l&&Math.sign(o)*l)),t.intentional=!1!==c[0]||!1!==c[1],!t.intentional)return;let h=[0,0];if(r.hasCustomTransform){let[e,t]=u;h[0]=!1!==c[0]?e-c[0]:0,h[1]=!1!==c[1]?t-c[1]:0}else h[0]=!1!==c[0]?a-c[0]:0,h[1]=!1!==c[1]?o-c[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(h);let A=t.offset,d=t._active&&!t._blocked||t.active;d&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=i[this.ingKey]=t._active,e&&(t.first&&("bounds"in r&&(t._bounds=th(r.bounds,t)),this.setup&&this.setup()),t.movement=h,this.computeOffset()));let[m,f]=t.offset,[[p,g],[y,v]]=t._bounds;t.overflow=[m<p?-1:m>g?1:0,f<y?-1:f>v?1:0],t._movementBound[0]=!!t.overflow[0]&&(!1===t._movementBound[0]?t._movement[0]:t._movementBound[0]),t._movementBound[1]=!!t.overflow[1]&&(!1===t._movementBound[1]?t._movement[1]:t._movementBound[1]);let E=t._active&&r.rubberband||[0,0];if(t.offset=function(e,[t,r],[i,n]){let[[a,o],[s,l]]=e;return[e5(t,a,o,i),e5(r,s,l,n)]}(t._bounds,t.offset,E),t.delta=e3.sub(t.offset,A),this.computeMovement(),d&&(!t.last||n>32)){t.delta=e3.sub(t.offset,A);let e=t.delta.map(Math.abs);e3.addTo(t.distance,e),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&n>0&&(t.velocity=[e[0]/n,e[1]/n],t.timeDelta=n)}}emit(){let e=this.state,t=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;let i=this.handler(e9(e9(e9({},t),e),{},{[this.aliasKey]:e.values}));void 0!==i&&(e.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}class tf extends tm{constructor(...e){super(...e),e6(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=e3.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=e3.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){let t=this.state,r=this.config;if(!t.axis&&e){let i="object"==typeof r.axisThreshold?r.axisThreshold[tn(e)]:r.axisThreshold;t.axis=function([e,t],r){let i=Math.abs(e),n=Math.abs(t);return i>n&&i>r?"x":n>i&&n>r?"y":void 0}(t._movement,i)}t._blocked=(r.lockDirection||!!r.axis)&&!t.axis||!!r.axis&&r.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0}}}let tp=e=>
61e,tg={enabled:(e=!0)=>e,eventOptions:(e,t,r)=>e9(e9({},r.shared.eventOptions),e),preventDefault:(e=!1)=>e,triggerAllEvents:(e=!1)=>e,rubberband(e=0){switch(e){case!0:return[.15,.15];case!1:return[0,0];default:return e3.toVector(e)}},from:e=>"function"==typeof e?e:null!=e?e3.toVector(e):void 0,transform(e,t,r){let i=e||r.shared.transform;return this.hasCustomTransform=!!i,i||tp},threshold:e=>e3.toVector(e,0)},ty=0,tv=e9(e9({},tg),{},{axis(e,t,{axis:r}){if(this.lockDirection="lock"===r,!this.lockDirection)return r},axisThreshold:(e=ty)=>e,bounds(e={}){if("function"==typeof e)return t=>tv.bounds(e(t));if("current"in e)return()=>e.current;if("function"==typeof HTMLElement&&e instanceof HTMLElement)return e;let{left:t=-1/0,right:r=1/0,top:i=-1/0,bottom:n=1/0}=e;return[[t,r],[i,n]]}}),tE={ArrowRight:(e,t=1)=>[e*t,0],ArrowLeft:(e,t=1)=>[-1*e*t,0],ArrowUp:(e,t=1)=>[0,-1*e*t],ArrowDown:(e,t=1)=>[0,e*t]};class tx extends tf{constructor(...e){super(...e),e6(this,"ingKey","dragging")}reset(){super.reset();let e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){let e=this.state;if(e._bounds instanceof HTMLElement){let t=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),i={left:t.left-r.left+e.offset[0],right:t.right-r.right+e.offset[0],top:t.top-r.top+e.offset[1],bottom:t.bottom-r.bottom+e.offset[1]};e._bounds=tv.bounds(i)}}cancel(){let e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){let t=this.config,r=this.state;if(null!=e.buttons&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):-1!==t.pointerButtons&&t.pointerButtons!==e.buttons))return;let i=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),i&&i.size>1&&r._pointerActive||(this.start(e),this.setupPointer(e),r._pointerId=tl(e),r._pointerActive=!0,this.computeValues(tc(e)),this.computeInitial(),t.preventScrollAxis&&"mouse"!==tn(e)?(r._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){let t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){let t=this.state,r=this.config;if(!t._pointerActive)return;let i=tl(e);if(void 0!==t._pointerId&&i!==t._pointerId)return;let n=tc(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=e3.sub(n,t._values),this.computeValues(n)),e3.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(r.preventScrollAxis&&!t._preventScroll){if(!t.axis)return;if(t.axis===r.preventScrollAxis||"xy"===r.preventScrollAxis){t._active=!1,this.clean();return}this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch(e){}let t=this.state,r=this.config;if(!t._active||!t._pointerActive)return;let i=tl(e);if(void 0!==t._pointerId&&i!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);let[n,a]=t._distance;if(t.tap=n<=r.tapsThreshold&&a<=r.tapsThreshold,t.tap&&r.filterTaps)t._force=!0;else{let[e,i]=t._delta,[n,a]=t._movement,[o,s]=r.swipe.velocity,[l,c]=r.swipe.distance,u=r.swipe.duration;if(t.elapsedTime<u){let r=Math.abs(e/t.timeDelta),u=Math.abs(i/t.timeDelta);r>o&&Math.abs(n)>l&&(t.swipe[0]=Math.sign(e)),u>s&&Math.abs(a)>c&&(t.swipe[1]=Math.sign(i))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){let t=this.config,r=t.device;t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,"persist"in e&&"function"==typeof e.persist&&e.persist();let t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){let t=tE[e.key];if(t){let r=this.state,i=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=t(this.config.keyboardDisplacement,i),r._keyboardActive=!0,e3.addTo(r._movement,r._delta),this.compute(e),this.emit
61()}}keyUp(e){e.key in tE&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){let t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}let tC="undefined"!=typeof window&&window.document&&window.document.createElement;function tw(){return tC&&"ontouchstart"in window}let tB={isBrowser:tC,gesture:function(){try{return"constructor"in GestureEvent}catch(e){return!1}}(),touch:tw(),touchscreen:tw()||tC&&window.navigator.maxTouchPoints>1,pointer:tC&&"onpointerdown"in window,pointerLock:tC&&"exitPointerLock"in window.document},tI=10,t_={mouse:0,touch:0,pen:8},tb=e9(e9({},tv),{},{device(e,t,{pointer:{touch:r=!1,lock:i=!1,mouse:n=!1}={}}){return(this.pointerLock=i&&tB.pointerLock,tB.touch&&r)?"touch":this.pointerLock?"mouse":tB.pointer&&!n?"pointer":tB.touch?"touch":"mouse"},preventScrollAxis(e,t,{preventScroll:r}){if(this.preventScrollDelay="number"==typeof r?r:r||void 0===r&&e?250:void 0,tB.touchscreen&&!1!==r)return e||(void 0!==r?"y":void 0)},pointerCapture(e,t,{pointer:{capture:r=!0,buttons:i=1,keys:n=!0}={}}){return this.pointerButtons=i,this.keys=n,!this.pointerLock&&"pointer"===this.device&&r},threshold(e,t,{filterTaps:r=!1,tapsThreshold:i=3,axis:n}){let a=e3.toVector(e,r?i:n?1:0);return this.filterTaps=r,this.tapsThreshold=i,a},swipe({velocity:e=.5,distance:t=50,duration:r=250}={}){return{velocity:this.transform(e3.toVector(e)),distance:this.transform(e3.toVector(t)),duration:r}},delay(e=0){switch(e){case!0:return 180;case!1:return 0;default:return e}},axisThreshold:e=>e?e9(e9({},t_),e):t_,keyboardDisplacement:(e=tI)=>e});function tM(e){let[t,r]=e.overflow,[i,n]=e._delta,[a,o]=e._direction;(t<0&&i>0&&a<0||t>0&&i<0&&a>0)&&(e._movement[0]=e._movementBound[0]),(r<0&&n>0&&o<0||r>0&&n<0&&o>0)&&(e._movement[1]=e._movementBound[1])}class tS extends tm{constructor(...e){super(...e),e6(this,"ingKey","pinching"),e6(this,"aliasKey","da")}init(){this.state.offset=[1,0],this.state.lastOffset=[1,0],this.state._pointerEvents=new Map}reset(){super.reset();let e=this.state;e._touchIds=[],e.canceled=!1,e.cancel=this.cancel.bind(this),e.turns=0}computeOffset(){let{type:e,movement:t,lastOffset:r}=this.state;"wheel"===e?this.state.offset=e3.add(t,r):this.state.offset=[(1+t[0])*r[0],t[1]+r[1]]}computeMovement(){let{offset:e,lastOffset:t}=this.state;this.state.movement=[e[0]/t[0],e[1]-t[1]]}axisIntent(){let e=this.state,[t,r]=e._movement;if(!e.axis){let i=30*Math.abs(t)-Math.abs(r);i<0?e.axis="angle":i>0&&(e.axis="scale")}}restrictToAxis(e){this.config.lockDirection&&("scale"===this.state.axis?e[1]=0:"angle"===this.state.axis&&(e[0]=0))}cancel(){let e=this.state;e.canceled||setTimeout(()=>{e.canceled=!0,e._active=!1,this.compute(),this.emit()},0)}touchStart(e){this.ctrl.setEventIds(e);let t=this.state,r=this.ctrl.touchIds;if(t._active&&t._touchIds.every(e=>r.has(e))||r.size<2)return;this.start(e),t._touchIds=Array.from(r).slice(0,2);let i=ts(e,t._touchIds);i&&this.pinchStart(e,i)}pointerStart(e){if(null!=e.buttons&&e.buttons%2!=1)return;this.ctrl.setEventIds(e),e.target.setPointerCapture(e.pointerId);let t=this.state,r=t._pointerEvents,i=this.ctrl.pointerIds;if(t._active&&Array.from(r.keys()).every(e=>i.has(e))||(r.size<2&&r.set(e.pointerId,e),t._pointerEvents.size<2))return;this.start(e);
61let n=to(...Array.from(r.values()));n&&this.pinchStart(e,n)}pinchStart(e,t){this.state.origin=t.origin,this.computeValues([t.distance,t.angle]),this.computeInitial(),this.compute(e),this.emit()}touchMove(e){if(!this.state._active)return;let t=ts(e,this.state._touchIds);t&&this.pinchMove(e,t)}pointerMove(e){let t=this.state._pointerEvents;if(t.has(e.pointerId)&&t.set(e.pointerId,e),!this.state._active)return;let r=to(...Array.from(t.values()));r&&this.pinchMove(e,r)}pinchMove(e,t){let r=this.state,i=r._values[1],n=t.angle-i,a=0;Math.abs(n)>270&&(a+=Math.sign(n)),this.computeValues([t.distance,t.angle-360*a]),r.origin=t.origin,r.turns=a,r._movement=[r._values[0]/r._initial[0]-1,r._values[1]-r._initial[1]],this.compute(e),this.emit()}touchEnd(e){this.ctrl.setEventIds(e),this.state._active&&this.state._touchIds.some(e=>!this.ctrl.touchIds.has(e))&&(this.state._active=!1,this.compute(e),this.emit())}pointerEnd(e){let t=this.state;this.ctrl.setEventIds(e);try{e.target.releasePointerCapture(e.pointerId)}catch(e){}t._pointerEvents.has(e.pointerId)&&t._pointerEvents.delete(e.pointerId),t._active&&t._pointerEvents.size<2&&(t._active=!1,this.compute(e),this.emit())}gestureStart(e){e.cancelable&&e.preventDefault();let t=this.state;t._active||(this.start(e),this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY],this.compute(e),this.emit())}gestureMove(e){if(e.cancelable&&e.preventDefault(),!this.state._active)return;let t=this.state;this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY];let r=t._movement;t._movement=[e.scale-1,e.rotation],t._delta=e3.sub(t._movement,r),this.compute(e),this.emit()}gestureEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}wheel(e){let t=this.config.modifierKey;(!t||(Array.isArray(t)?t.find(t=>e[t]):e[t]))&&(this.state._active?this.wheelChange(e):this.wheelStart(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this)))}wheelStart(e){this.start(e),this.wheelChange(e)}wheelChange(e){"uv"in e||!e.cancelable||e.preventDefault();let t=this.state;t._delta=[-tu(e)[1]/100*t.offset[0],0],e3.addTo(t._movement,t._delta),tM(t),this.state.origin=[e.clientX,e.clientY],this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){let t=this.config.device;t&&(e(t,"start",this[t+"Start"].bind(this)),e(t,"change",this[t+"Move"].bind(this)),e(t,"end",this[t+"End"].bind(this)),e(t,"cancel",this[t+"End"].bind(this)),e("lostPointerCapture","",this[t+"End"].bind(this))),this.config.pinchOnWheel&&e("wheel","",this.wheel.bind(this),{passive:!1})}}let tD=e9(e9({},tg),{},{device(e,t,{shared:r,pointer:{touch:i=!1}={}}){if(r.target&&!tB.touch&&tB.gesture)return"gesture";if(tB.touch&&i)return"touch";if(tB.touchscreen){if(tB.pointer)return"pointer";if(tB.touch)return"touch"}},bounds(e,t,{scaleBounds:r={},angleBounds:i={}}){let n=e=>{let t=td(th(r,e),{min:-1/0,max:1/0});return[t.min,t.max]},a=e=>{let t=td(th(i,e),{min:-1/0,max:1/0});return[t.min,t.max]};return"function"!=typeof r&&"function"!=typeof i?[n(),a()]:e=>[n(e),a(e)]},threshold(e,t,r){return this.lockDirection="lock"===r.axis,e3.toVector(e,this.lockDirection?[.1,3]:0)},modifierKey:e=>void 0===e?"ctrlKey":e,pinchOnWheel:(e=!0)=>e});class tP extends tf{constructor(...e){super(...e),e6(this,"ingKey","moving")}move(e){this.config.mouseOnly&&"mouse"!==e.pointerType||(this.state._active?this.moveChange(e):this.moveStart(e),this.timeoutStore.add("moveEnd",this.moveEnd.bind(this)))}moveStart(e){this.start(e),this.computeValues(tc(e)),this.compute(e),this.computeInitial(),this.emit()}moveChange(e){if(!this.state._active)return;let t=tc(e),r=this.state;r._delta=e3.sub(t,r._values),e3.addTo(r._movement,r._delta),this.computeValues(t),this.compute(e),this.emit()}moveEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}bind(e){e("pointer","change",this.move.bind(this)),e("pointer","leave",this.moveEnd.bind(this))}}let tT=e9(e9({},tv),{},{mouseOnly:(e=!0)=>e});class tR extends tf{constructor(...e){super(...e),e6(this,"ingKey","scrolling")}scroll(e){this.state._active||this.start(e),this.scrollChange(e),this.timeoutStore.add("scrollEnd",this.scrollEnd.bind(this))}scrollChange(e){e.cancelable&&e.preventDefault();let t=this.state,r=function(e){var t,r;let{scrollX:i,scrollY:n,scrollLeft:a,scrollTop:o}=e.currentTarget;return[null!==(t=null!=i?i:a)&&void 0!==t?t:0,null!==(r=null!=n?n:o)&&void 0!==r?r:0]}(e);t._delta=e3.sub(r,t._values),e3.addTo(t._movement,t._delta),this.computeValues(r),this.compute(e),this.emit
61()}scrollEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("scroll","",this.scroll.bind(this))}}class tF extends tf{constructor(...e){super(...e),e6(this,"ingKey","wheeling")}wheel(e){this.state._active||this.start(e),this.wheelChange(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(e){let t=this.state;t._delta=tu(e),e3.addTo(t._movement,t._delta),tM(t),this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("wheel","",this.wheel.bind(this))}}class tQ extends tf{constructor(...e){super(...e),e6(this,"ingKey","hovering")}enter(e){this.config.mouseOnly&&"mouse"!==e.pointerType||(this.start(e),this.computeValues(tc(e)),this.compute(e),this.emit())}leave(e){if(this.config.mouseOnly&&"mouse"!==e.pointerType)return;let t=this.state;if(!t._active)return;t._active=!1;let r=tc(e);t._movement=t._delta=e3.sub(r,t._values),this.computeValues(r),this.compute(e),t.delta=t.movement,this.emit()}bind(e){e("pointer","enter",this.enter.bind(this)),e("pointer","leave",this.leave.bind(this))}}let tz=e9(e9({},tv),{},{mouseOnly:(e=!0)=>e}),tk=new Map,tL=new Map;function tO(e){tk.set(e.key,e.engine),tL.set(e.key,e.resolver)}let tU={key:"drag",engine:tx,resolver:tb},tG={key:"hover",engine:tQ,resolver:tz},tN={key:"move",engine:tP,resolver:tT},tH={key:"pinch",engine:tS,resolver:tD},tj={key:"scroll",engine:tR,resolver:tv},tJ={key:"wheel",engine:tF,resolver:tv},tV={target(e){if(e)return()=>"current"in e?e.current:e},enabled:(e=!0)=>e,window:(e=tB.isBrowser?window:void 0)=>e,eventOptions:({passive:e=!0,capture:t=!1}={})=>({passive:e,capture:t}),transform:e=>e},tK=["target","eventOptions","window","enabled","transform"];function tY(e={},t){let r={};for(let[i,n]of Object.entries(t))switch(typeof n){case"function":r[i]=n.call(r,e[i],i,e);break;case"object":r[i]=tY(e[i],n);break;case"boolean":n&&(r[i]=e[i])}return r}class tW{constructor(e,t){e6(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,r,i,n){let a=this._listeners,o=function(e,t=""){let r=e7[e];return e+(r&&r[t]||t)}(t,r),s=e9(e9({},this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{}),n);e.addEventListener(o,i,s);let l=()=>{e.removeEventListener(o,i,s),a.delete(l)};return a.add(l),l}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class tq{constructor(){e6(this,"_timeouts",new Map)}add(e,t,r=140,...i){this.remove(e),this._timeouts.set(e,window.setTimeout(t,r,...i))}remove(e){let t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}class tX{constructor(e){e6(this,"gestures",new Set),e6(this,"_targetEventStore",new tW(this)),e6(this,"gestureEventStores",{}),e6(this,"gestureTimeoutStores",{}),e6(this,"handlers",{}),e6(this,"config",{}),e6(this,"pointerIds",new Set),e6(this,"touchIds",new Set),e6(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),e.drag&&tZ(this,"drag"),e.wheel&&tZ(this,"wheel"),e.scroll&&tZ(this,"scroll"),e.move&&tZ(this,"move"),e.pinch&&tZ(this,"pinch"),e.hover&&tZ(this,"hover")}setEventIds(e){return ti(e)?(this.touchIds=new Set(Array.from(e.touches).filter(t=>{var r,i;return t.target===e.currentTarget||(null===(r=e.currentTarget)||void 0===r||null===(i=r.contains)||void 0===i?void 0:i.call(r,t.target))}).map(e=>e.identifier)),this.touchIds):"pointerId"in e?("pointerup"===e.type||"pointercancel"===e.type?this.pointerIds.delete(e.pointerId):"pointerdown"===e.type&&this.pointerIds.add(e.pointerId),this.pointerIds):void 0}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=function(e,t,r={}){let{target:i,eventOptions:n,window:a,enabled:o,transform:s}=e,l=function(e,t){if(null==e)return{};var r,i,n=function(e,t){if(null==e)return{};var r,i,n={},a=Object.keys(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}(e,tK);if(r.shared=tY({target:i,eventOptions:n,window:a,enabled:o,transform:s},tV),t){let e=tL.get(t);r[t]=tY(e9({shared:r.shared},l),e)}else for(let e in l){let t=tL.get(e);t&&(r[e]=tY(e9({shared:r.shared},l[e]),t))}return r}(e,t,this.config)}clean(){for(let e of(this._targetEventStore.clean(),this.gestures))this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){let t;let r=this.config.shared,i={};if(!r.target||(t=r.target())){if(r.enabled){for(let r of this.gestures){let n=this.config[r],a=t$(i,n.eventOptions,!!t);n.enabled&&new(tk.get(r))(this,e,r).bind(a)}let n=t$(i,r.eventOptions,!!t);for(let t in this.nativeHandlers)n(t,"",r=>this.nativeHandlers[t](e9(e9({},this.state.shared),{},{event:r,args:e})),void 0,!0)}for(let e in i)i[e]=function(...e){return 0===e.length?tA:1===e.length?e[0]:function(){let t;for(let r of e)t=r.apply(this,arguments)||t;return t}}(...i[e]);if(!t)return i;for(let e in i){let{device:r,capture:n,passive:a}=function(e){let t=e.substring(2).toLowerCase(),r=!!~t.indexOf("passive");r&&(t=t.replace("passive",""));let i=tr.includes(t)?"capturecapture":"capture",n=!!~t.indexOf(i);return n&&(t=t.replace("capture","")),{device:t,capture:n,passive:r}}(e);this._targetEventStore.add(t,r,"",i[e],{capture:n,passive:a})}}}}function tZ(e,t){e.gestures.add(t),e.gestureEventStores[t]=new tW(e,t),e.gestureTimeoutStores[t]=new tq}let t$=(e,t,r)=>(i,n,a,o={},s=!1)=>{var l,c;let u=null!==(l=o.capture)&&void 0!==l?l:t.capture,h=null!==(c=o.passive)&&void 0!==c?c:t.passive,A=s?i:function(e,t="",r=!1){let i=e7[e],n=i&&i[t]||t;return"on"+te(e)+te(n)+(!function(e=!1,t){return e&&!tt.includes(t)}(r,n)?"":"Capture")}(i,n,u);r&&h&&(A+="Passive"),e[A]=e[A]||[],e[A].push(a)},t1=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function t0(e,t,r,i,n,a){if(!e.has(r)||!tk.has(i))return;let o=r+"Start",s=r+"End";n[i]=e=>{let i;return e.first&&o in t&&t[o](e),r in t&&(i=t[r](e)),e.last&&s in t&&t[s](e),i},a[i]=a[i]||{}}function t2(e,t){return([tU,tH,tj,tJ,tN,tG].forEach(tO),function(e,t){let{handlers:r,nativeHandlers:i,config:n}=function(e,t){let[r,i,n]=function(e){let t={},r={},i=new Set;for(let n in e)t1.test(n)?(i.add(RegExp.lastMatch),r[n]=e[n]):t[n]=e[n];return[r,t,i]}(e),a={};
61return t0(n,r,"onDrag","drag",a,t),t0(n,r,"onWheel","wheel",a,t),t0(n,r,"onScroll","scroll",a,t),t0(n,r,"onPinch","pinch",a,t),t0(n,r,"onMove","move",a,t),t0(n,r,"onHover","hover",a,t),{handlers:a,config:t,nativeHandlers:i}}(e,t||{});return function(e,t={},r,i){let n=eD.useMemo(()=>new tX(e),[]);if(n.applyHandlers(e,i),n.applyConfig(t,r),eD.useEffect(n.effect.bind(n)),eD.useEffect(()=>n.clean.bind(n),[]),void 0===t.target)return n.bind.bind(n)}(r,n,void 0,i)})(e,t||{})}let t3=new eT.Pa4,t4=new eT.FM8,t5=new eT.Pa4,t6=new eT.Pa4,t8=new eT.Pa4,t9=new eT.JOQ,t7=eD.forwardRef(({autoTransform:e=!0,matrix:t,axisLock:r,dragLimits:i,onHover:n,onDragStart:a,onDrag:o,onDragEnd:s,children:l,dragConfig:c,...u},h)=>{let A=(0,eR.D)(e=>e.controls),{camera:d,size:m,raycaster:f,invalidate:p}=(0,eR.D)(),g=eD.useRef(null),y=t2({onHover:({hovering:e})=>n&&n(null!=e&&e),onDragStart:({event:e})=>{A&&(A.enabled=!1);let{point:t}=e;g.current.matrix.decompose(t3,new eT._fP,new eT.Pa4),t5.copy(t),t6.copy(t5).sub(t3),a&&a(t3),p()},onDrag:({xy:[t,n],intentional:a})=>{if(!a)return;let s=(t-m.left)/m.width*2-1,l=-((n-m.top)/m.height*2)+1;if(t4.set(s,l),f.setFromCamera(t4,d),r)switch(r){case"x":t8.set(1,0,0);break;case"y":t8.set(0,1,0);break;case"z":t8.set(0,0,1)}else d.getWorldDirection(t8).negate();t9.setFromNormalAndCoplanarPoint(t8,t5),f.ray.intersectPlane(t9,t5);let c=g.current.matrix.clone(),u=g.current.matrixWorld.clone(),h=new eT.Pa4(t5.x-t6.x,t5.y-t6.y,t5.z-t6.z);if(i&&(h.x=i[0]?Math.max(Math.min(h.x,i[0][1]),i[0][0]):h.x,h.y=i[1]?Math.max(Math.min(h.y,i[1][1]),i[1][0]):h.y,h.z=i[2]?Math.max(Math.min(h.z,i[2][1]),i[2][0]):h.z),e){g.current.matrix.setPosition(h);let e=g.current.matrix.clone().multiply(c.invert()),t=g.current.matrix.clone().multiply(u.invert());o&&o(g.current.matrix,e,g.current.matrixWorld,t)}else{let e=new eT.yGw().copy(g.current.matrix);e.setPosition(h);let t=e.clone().multiply(c.invert()),r=e.clone().multiply(u.invert());o&&o(e,t,g.current.matrixWorld,r)}p()},onDragEnd:()=>{A&&(A.enabled=!0),s&&s(),p()}},{drag:{filterTaps:!0,threshold:1,..."object"==typeof c?c:{}}});return eD.useImperativeHandle(h,()=>g.current,[]),eD.useLayoutEffect(()=>{t&&(g.current.matrix=t)},[t]),eD.createElement("group",(0,eS.Z)({ref:g},y(),{matrix:t,matrixAutoUpdate:!1},u),l)});function re(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rt(e,t){return(rt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function rr(e,t){for(var r=[],i=e.toArray(),n=t.toArray(),a=0;a<i.length;a++)r[a]=i[a]+n[a];return new eT.Vkp().fromArray(r)}function ri(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function rn(e,t){if(e){if("string"==typeof e)return ri(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ri(e,t)}}function ra(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,i,n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||rn(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ro(e){return function(e){if(Array.isArray(e))return ri(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||rn(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rs(e,t,r){return(rs=!function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}()?function(e,t,r){var i=[null];i.push.apply(i,t);var n=new(Function.bind.apply(e,i));return r&&rt(n,r.prototype),n}:Reflect.construct).apply(null,arguments)}var rl=new eT.FM8,rc=new eT.FM8;function ru(e){var t,r,i,n,a,o,s,l,c=ra(e.map(function(e){return Array.isArray(e)?rs(eT.FM8,ro(e)):e}),3),u=c[0],h=c[1],A=c[2];if(0===(i=(r=ra((t=e)[0],2))[0],n=r[1],o=(a=ra(t[1],2))[0],s=a[1],function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8];return i*s*h+n*l*c+a*o*u-a*s*c-n*o*h-i*l*u}(i,n,1,o,s,1,(l=ra(t[2],2))[0],l[1],1)))return!1;var d=rl.subVectors(h,u);return rc.subVectors(A,u).cross(d)>0}function rh(e,t,r){return Math.max(t,Math.min(r,e))}function rA(e,t){return rh(e-Math.floor(e/t)*t,0,t)}function rd(e,t){var r=rA(t-e,2*Math.PI);return r>Math.PI&&(r-=2*Math.PI),r}function rm(e,t){return e.x===t.x?void 0!==e.z&&e.y===t.y?e.z-t.z:e.y-t.y:e.x-t.x}function rf(e,t,r){return(r-e)/(t-e)}function rp(e,t){var r=new eT.Pa4().crossVectors(e,t),i=e.dot(t),n=new eT.Vkp().identity(),a=new eT.Vkp().set(0,-r.z,r.y,r.z,0,-r.x,-r.y,r.x,0),o=new eT.Vkp().multiplyMatrices(a,a).multiplyScalar(1/(1+i));return rr(rr(n,a),o)}var rg=Object.freeze({__proto__:null,clamp:rh,repeat:rA,deltaAngle:rd,degToRad:function(e){return e/180*Math.PI},radToDeg:function(e){return 180*e/Math.PI},fibonacciOnSphere:function(e,t){for(var r=t.radius,i=void 0===r?1:r,n=e.length/3,a=2/n,o=Math.PI*(3-2.2360679775),s=0;s<e.length;s+=3){var l=s*a-1+a/2,c=Math.sqrt(1-Math.pow(l,2)),u=s%n*o,h=Math.cos(u)*c,A=Math.sin(u)*c;e[s]=h*i,e[s+1]=l*i,e[s+2]=A*i}},vectorEquals:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.EPSILON;return Math.abs(e.x-t.x)<r&&Math.abs(e.y-t.y)<r&&Math.abs(e.z-t.z)<r},lexicographic:rm,convexHull:function(e){for(var t=e.sort(rm),r=[t[0],t[1]],i=2;i<t.length;i++)for(r.push(t[i]);r.length>2&&ru(ro(r.slice(-3)));)r.splice(r.length-2,1);for(var n=[t[t.length-1],t[t.length-2]],a=t.length-3;a>=0;a--)for(n.push(t[a]);n.length>2&&ru(ro(n.slice(-3)));)n.splice(n.length-2,1);return n.splice(0,1),n.splice(n.length-1,1),[].concat(r,n)},remap:function(e,t,r){var i=ra(t,2),n=i[0],a=i[1],o=ra(r,2),s=o[0];return s+(e-n)*(o[1]-s)/(a-n)},fade:function(e){return e*e*e*(e*(6*e-15)+10)},lerp:function(e,t,r){return e*(1-r)+t*r},inverseLerp:rf,normalize:function(e,t,r){var i=Math.sqrt(e*e+t*t+r*r);return[e/i,t/i,r/i]},pointOnCubeToPointOnSphere:function(e,t,r){var i=e*e,n=t*t,a=r*r;return[e*Math.sqrt(1-(n+a)/2+n*a/3),t*Math.sqrt(1-(a+i)/2+a*i/3),r*Math.sqrt(1-(i+n)/2+i*n/3)]},rotateVectorOnVector:rp,pointToCoordinate:function(e,t,r){return[Math.asin(t),Math.atan2(e,-r)]},coordinateToPoint:function(e,t){var r=Math.cos(e);return[Math.sin(t)*r,Math.sin(e),-Math.cos(t)*r]},planeSegmentIntersection:function(e,t){var r=ra(t,2),i=r[0],n=r[1],a=rp(e.normal,new eT.Pa4(0,1,0)),o=rf(i.clone().applyMatrix3(a).y,n.clone().applyMatrix3(a).y,0);return new eT.Pa4().lerpVectors(i,n,o)},pointToPlaneDistance:function(e,t){return t.normal.dot(e)},getIndexFrom3D:function(e,t){var r=ra(e,3),i=r[0],n=r[1],a=r[2],o=ra(t,2),s=o[0];
61return a*s*o[1]+n*s+i},get3DFromIndex:function(e,t){var r=ra(t,2),i=r[0],n=i*r[1],a=e/n,o=e-n*a;return[o%i,o/i,a]},getIndexFrom2D:function(e,t){return e[0]+t[0]*e[1]},get2DFromIndex:function(e,t){return[e%t,Math.floor(e/t)]}});function ry(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}var rv=function e(t,r,i){var n=this;ry(this,e),re(this,"dot2",function(e,t){return n.x*e+n.y*t}),re(this,"dot3",function(e,t,r){return n.x*e+n.y*t+n.z*r}),this.x=t,this.y=r,this.z=i},rE=[new rv(1,1,0),new rv(-1,1,0),new rv(1,-1,0),new rv(-1,-1,0),new rv(1,0,1),new rv(-1,0,1),new rv(1,0,-1),new rv(-1,0,-1),new rv(0,1,1),new rv(0,-1,1),new rv(0,1,-1),new rv(0,-1,-1)],rx=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180],rC=Array(512),rw=Array(512);function rB(e){var t=function(e){if("number"==typeof e)e=Math.abs(e);else if("string"==typeof e){var t=e;e=0;for(var r=0;r<t.length;r++)e=(e+t.charCodeAt(r)%96*(r+1))%2147483647}return 0===e&&(e=311),e}(e);return function(){var e=48271*t%2147483647;return t=e,e/2147483647}}!function(e){e>0&&e<1&&(e*=65536),(e=Math.floor(e))<256&&(e|=e<<8);for(var t,r=0;r<256;r++)t=1&r?rx[r]^255&e:rx[r]^e>>8&255,rC[r]=rC[r+256]=t,rw[r]=rw[r+256]=rE[t%12]}(0),new function e(t){var r=this;ry(this,e),re(this,"seed",0),re(this,"init",function(e){r.seed=e,r.value=rB(e)}),re(this,"value",rB(this.seed)),this.init(t)}(Math.random());var rI=function(e){return 1/(1+e+.48*e*e+.235*e*e*e)};function r_(e,t,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.25,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.01,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1/0,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:rI,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:.001,l="velocity_"+t;if(void 0===e.__damp&&(e.__damp={}),void 0===e.__damp[l]&&(e.__damp[l]=0),Math.abs(e[t]-r)<=s)return e[t]=r,!1;var c=2/(i=Math.max(1e-4,i)),u=o(c*n),h=e[t]-r,A=r,d=a*i;h=Math.min(Math.max(h,-d),d),r=e[t]-h;var m=(e.__damp[l]+c*h)*n;e.__damp[l]=(e.__damp[l]-c*m)*u;var f=r+(h+m)*u;return A-e[t]>0==f>A&&(f=A,e.__damp[l]=(f-A)/n),e[t]=f,!0}var rb=new eT.Pa4,rM=new eT._fP,rS=new eT._fP,rD=new eT.yGw,rP=new eT.Pa4;function rT(e,t,r,i,n,a,o,s){return r_(e,t,e[t]+rd(e[t],r),i,n,a,o,s)}var rR=new eT.FM8,rF=new eT.Pa4;function rQ(e,t,r,i,n,a,o){return"number"==typeof t?rF.setScalar(t):Array.isArray(t)?rF.set(t[0],t[1],t[2]):rF.copy(t),ee=r_(e,"x",rF.x,r,i,n,a,o),et=r_(e,"y",rF.y,r,i,n,a,o),er=r_(e,"z",rF.z,r,i,n,a,o),ee||et||er}var rz=new eT.Ltg,rk=new eT.USm,rL=new eT.Ilk,rO=new eT._fP,rU=new eT.Ltg,rG=new eT.Ltg,rN=new eT.Ltg;function rH(e,t,r,i,n,a,o){Array.isArray(t)?rO.set(t[0],t[1],t[2],t[3]):rO.copy(t);var s=e.dot(rO)>0?1:-1;return rO.x*=s,rO.y*=s,rO.z*=s,rO.w*=s,ed=r_(e,"x",rO.x,r,i,n,a,o),em=r_(e,"y",rO.y,r,i,n,a,o),ef=r_(e,"z",rO.z,r,i,n,a,o),ep=r_(e,"w",rO.w,r,i,n,a,o),rU.set(e.x,e.y,e.z,e.w).normalize(),rG.set(e.__damp.velocity_x,e.__damp.velocity_y,e.__damp.velocity_z,e.__damp.velocity_w),rN.copy(rU).multiplyScalar(rG.dot(rU)/rU.dot(rU)),e.__damp.velocity_x-=rN.x,e.__damp.velocity_y-=rN.y,e.__damp.velocity_z-=rN.z,e.__damp.velocity_w-=rN.w,e.set(rU.x,rU.y,rU.z,rU.w),ed||em||ef||ep}var rj=new eT.$V,rJ=new eT.yGw,rV=new eT.Pa4,rK=new eT._fP,rY=new eT.Pa4,rW=Object.freeze({__proto__:null,rsqw:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.01,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/(2*Math.PI);return r/Math.atan(1/t)*Math.atan(Math.sin(2*Math.PI*e*i)/t)}
61,exp:rI,linear:function(e){return e},sine:{in:function(e){return 1-Math.cos(e*Math.PI/2)},out:function(e){return Math.sin(e*Math.PI/2)},inOut:function(e){return-(Math.cos(Math.PI*e)-1)/2}},cubic:{in:function(e){return e*e*e},out:function(e){return 1-Math.pow(1-e,3)},inOut:function(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}},quint:{in:function(e){return e*e*e*e*e},out:function(e){return 1-Math.pow(1-e,5)},inOut:function(e){return e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2}},circ:{in:function(e){return 1-Math.sqrt(1-Math.pow(e,2))},out:function(e){return Math.sqrt(1-Math.pow(e-1,2))},inOut:function(e){return e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2}},quart:{in:function(e){return e*e*e*e},out:function(e){return 1- --e*e*e*e},inOut:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e}},expo:{in:function(e){return 0===e?0:Math.pow(2,10*e-10)},out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},inOut:function(e){return 0===e?0:1===e?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2}},damp:r_,dampLookAt:function(e,t,r,i,n,a,o){"number"==typeof t?rb.setScalar(t):Array.isArray(t)?rb.set(t[0],t[1],t[2]):rb.copy(t);var s=e.parent;(e.updateWorldMatrix(!0,!1),rP.setFromMatrixPosition(e.matrixWorld),e&&e.isCamera||e&&e.isLight)?rD.lookAt(rP,rb,e.up):rD.lookAt(rb,rP,e.up),rH(e.quaternion,rS.setFromRotationMatrix(rD),r,i,n,a,o),s&&(rD.extractRotation(s.matrixWorld),rM.setFromRotationMatrix(rD),rH(e.quaternion,rS.copy(e.quaternion).premultiply(rM.invert()),r,i,n,a,o))},dampAngle:rT,damp2:function(e,t,r,i,n,a,o){return"number"==typeof t?rR.setScalar(t):Array.isArray(t)?rR.set(t[0],t[1]):rR.copy(t),Z=r_(e,"x",rR.x,r,i,n,a,o),$=r_(e,"y",rR.y,r,i,n,a,o),Z||$},damp3:rQ,damp4:function(e,t,r,i,n,a,o){return"number"==typeof t?rz.setScalar(t):Array.isArray(t)?rz.set(t[0],t[1],t[2],t[3]):rz.copy(t),ei=r_(e,"x",rz.x,r,i,n,a,o),en=r_(e,"y",rz.y,r,i,n,a,o),ea=r_(e,"z",rz.z,r,i,n,a,o),eo=r_(e,"w",rz.w,r,i,n,a,o),ei||en||ea||eo},dampE:function(e,t,r,i,n,a,o){return Array.isArray(t)?rk.set(t[0],t[1],t[2],t[3]):rk.copy(t),es=rT(e,"x",rk.x,r,i,n,a,o),el=rT(e,"y",rk.y,r,i,n,a,o),ec=rT(e,"z",rk.z,r,i,n,a,o),es||el||ec},dampC:function(e,t,r,i,n,a,o){return t instanceof eT.Ilk?rL.copy(t):Array.isArray(t)?rL.setRGB(t[0],t[1],t[2]):rL.set(t),eu=r_(e,"r",rL.r,r,i,n,a,o),eh=r_(e,"g",rL.g,r,i,n,a,o),eA=r_(e,"b",rL.b,r,i,n,a,o),eu||eh||eA},dampQ:rH,dampS:function(e,t,r,i,n,a,o){return Array.isArray(t)?rj.set(t[0],t[1],t[2]):rj.c
61opy(t),eg=r_(e,"radius",rj.radius,r,i,n,a,o),ey=rT(e,"phi",rj.phi,r,i,n,a,o),ev=rT(e,"theta",rj.theta,r,i,n,a,o),eg||ey||ev},dampM:function(e,t,r,i,n,a,o){return void 0===e.__damp&&(e.__damp={position:new eT.Pa4,rotation:new eT._fP,scale:new eT.Pa4},e.decompose(e.__damp.position,e.__damp.rotation,e.__damp.scale)),Array.isArray(t)?rJ.set.apply(rJ,ro(t)):rJ.copy(t),rJ.decompose(rV,rK,rY),eE=rQ(e.__damp.position,rV,r,i,n,a,o),ex=rH(e.__damp.rotation,rK,r,i,n,a,o),eC=rQ(e.__damp.scale,rY,r,i,n,a,o),e.compose(e.__damp.position,e.__damp.rotation,e.__damp.scale),eE||ex||eC}});eT.u9r;let rq=eD.createContext(null);function rX(){return eD.useContext(rq)}function rZ({eps:e=1e-5,enabled:t=!0,infinite:r,horizontal:i,pages:n=1,distance:a=1,damping:o=.25,maxSpeed:s=1/0,prepend:l=!1,style:c={},children:u}){let{get:h,setEvents:A,gl:d,size:m,invalidate:f,events:p}=(0,eR.D)(),[g]=eD.useState(()=>document.createElement("div")),[y]=eD.useState(()=>document.createElement("div")),[v]=eD.useState(()=>document.createElement("div")),E=d.domElement.parentNode,x=eD.useRef(0),C=eD.useMemo(()=>({el:g,eps:e,fill:y,fixed:v,horizontal:i,damping:o,offset:0,delta:0,scroll:x,pages:n,range(e,t,r=0){let i=e-r,n=i+t+2*r;return this.offset<i?0:this.offset>n?1:(this.offset-i)/(n-i)},curve(e,t,r=0){return Math.sin(this.range(e,t,r)*Math.PI)},visible(e,t,r=0){let i=e-r;return this.offset>=i&&this.offset<=i+t+2*r}}),[e,o,i,n]);eD.useEffect(()=>{for(let e in g.style.position="absolute",g.style.width="100%",g.style.height="100%",g.style[i?"overflowX":"overflowY"]="auto",g.style[i?"overflowY":"overflowX"]="hidden",g.style.top="0px",g.style.left="0px",c)g.style[e]=c[e];v.style.position="sticky",v.style.top="0px",v.style.left="0px",v.style.width="100%",v.style.height="100%",v.style.overflow="hidden",g.appendChild(v),y.style.height=i?"100%":`${n*a*100}%`,y.style.width=i?`${n*a*100}%`:"100%",y.style.pointerEvents="none",g.appendChild(y),l?E.prepend(g):E.appendChild(g),g[i?"scrollLeft":"scrollTop"]=1;let e=p.connected||d.domElement;requestAnimationFrame(()=>null==p.connect?void 0:p.connect(g));let t=h().events.compute;return A({compute(e,t){let{left:r,top:i}=E.getBoundingClientRect(),n=e.clientX-r,a=e.clientY-i;t.pointer.set(n/t.size.width*2-1,-(a/t.size.height*2)+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),()=>{E.removeChild(g),A({compute:t}),null==p.connect||p.connect(e)}},[n,a,i,g,y,v,E]),eD.useEffect(()=>{if(p.connected===g){let e=m[i?"width":"height"],n=g[i?"scrollWidth":"scrollHeight"],a=n-e,o=0,s=!0,l=!0,c=()=>{if(t&&!l&&(f(),o=g[i?"scrollLeft":"scrollTop"],x.current=o/a,r)){if(!s){if(o>=a){let e=1-C.offset;g[i?"scrollLeft":"scrollTop"]=1,x.current=C.offset=-e,s=!0}else if(o<=0){let e=1+C.offset;g[i?"scrollLeft":"scrollTop"]=n,x.current=C.offset=e,s=!0}}s&&setTimeout(()=>s=!1,40)}};g.addEventListener("scroll",c,{passive:!0}),requestAnimationFrame(()=>l=!1);let u=e=>g.scrollLeft+=e.deltaY/2;return i&&g.addEventListener("wheel",u,{passive:!0}),()=>{g.removeEventListener("scroll",c),i&&g.removeEventListener("wheel",u)}}},[g,p,m,r,C,f,i,t]);let w=0;return(0,eR.F)((t,r)=>{w=C.offset,rW.damp(C,"offset",x.current,o,r,s,void 0,e),rW.damp(C,"delta",Math.abs(w-C.offset),o,r,s,void 0,e),C.delta>e&&f()}),eD.createElement(rq.Provider,{value:C},u)}let r$=eD.forwardRef(({children:e},t)=>{let r=eD.useRef(null);eD.useImperativeHandle(t,()=>r.current,[]);let i=rX(),{width:n,height:a}=(0,eR.D)(e=>e.viewport);return(0,eR.F)(()=>{r.current.position.x=i.horizontal?-n*(i.pages-1)*i.offset:0,r.current.position.y=i.horizontal?0:a*(i.pages-1)*i.offset}),eD.createElement("group",{ref:r},e)}),r1=eD.forwardRef(({children:e,style:t,...r},i)=>{let n=rX(),a=eD.useRef(null);eD.useImperativeHandle(i,()=>a.current,[]);let{width:o,height:s}=(0,eR.D)(e=>e.size),l=eD.useContext(eR.g),c=eD.useMemo(()=>eP.createRoot(n.fixed),[n.fixed]);return(0,eR.F)(()=>{n.delta>n.eps&&(a.current.style.transform=`translate3d(${n.horizontal?-o*(n.pages-1)*n.offset:0}px,${n.horizontal?0:-(s*(n.pages-1)*n.offset)}px,0)`)}),c.render(eD.createElement("div",(0,eS.Z)({ref:a,style:{...t,position:"absolute",top:0,left:0,willChange:"transform"}},r),eD.createElement(rq.Provider,{value:n},eD.createElement(eR.g.Provider,{value:l},e)))),null}),r0=eD.forwardRef(({html:e,...t},r)=>eD.createElement(e?r1:r$,(0,eS.Z)({ref:r},t)));var r2=ic(),r3=e=>ia(e,r2),r4=ic();r3.write=e=>ia(e,r4);var r5=ic();r3.onStart=e=>ia(e,r5);var r6=ic();r3.onFrame=e=>ia(e,r6);var r8=ic();r3.onFinish=e=>ia(e,r8);var r9=[];r3.setTimeout=(e,t)=>{let r=r3.now()+t,i=()=>{let e=r9.findIndex(e=>e.cancel==i);~e&&r9.splice(e,1),ir-=~e?1:0},n={time:r,handler:e,cancel:i};return r9.splice(r7(r),0,n),ir+=1,io(),n};var r7=e=>~(~r9.findIndex(t=>t.time>e)||~r9.length);r3.cancel=e=>{r5.delete(e),r6.delete(e),r8.delete(e),r2.delete(e),r4.delete(e)},r3.sync=e=>{ii=!0,r3.batchedUpdates(e),ii=!1},r3.throttle=e=>{let t;function r(){try{e(...t)}finally{t=null}}function i(...e){t=e,r3.onStart(r)}return i.handler=e,i.cancel=()=>{r5.delete(r),t=null},i};var ie="undefined"!=typeof window?window.requestAnimationFrame:()=>{};r3.use=e=>ie=e,r3.now="undefined"!=typeof performance?()=>performance.now():Date.now,r3.batchedUpdates=e=>e(),r3.catch=console.error,r3.frameLoop="always",r3.advance=()=>{"demand"!==r3.frameLoop?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):il()};var it=-1,ir=0,ii=!1;function ia(e,t){ii?(t.delete(e),e(0)):(t.add(e),io())}function io(){it<0&&(it=0,"demand"!==r3.frameLoop&&ie(is))}function is(){~it&&(ie(is),r3.batchedUpdates(il))}function il(){let e=it,t=r7(it=r3.now());if(t&&(iu(r9.splice(0,t),e=>e.handler()),ir-=t),!ir){it=-1;return}r5.flush(),r2.flush(e?Math.min(64,it-e):16.667),r6.flush(),r4.flush(),r8.flush()}function ic(){let e=new Set,t=e;return{add(r){ir+=t!=e||e.has(r)?0:1,e.add(r)},delete:r=>(ir-=t==e&&e.has(r)?1:0,e.delete(r)),flush(r){t.size&&(e=new Set,ir-=t.size,iu(t,t=>t(r)&&e.add(t)),ir+=e.size,t=e)}}}
61function iu(e,t){e.forEach(e=>{try{t(e)}catch(e){r3.catch(e)}})}var ih=Object.defineProperty,iA={};function id(){}((e,t)=>{for(var r in t)ih(e,r,{get:t[r],enumerable:!0})})(iA,{assign:()=>ib,colors:()=>iB,createStringInterpolator:()=>ew,skipAnimation:()=>iI,to:()=>eB,willAdvance:()=>i_});var im=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0}),ip={arr:Array.isArray,obj:e=>!!e&&"Object"===e.constructor.name,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,und:e=>void 0===e};function ig(e,t){if(ip.arr(e)){if(!ip.arr(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return e===t}var iy=(e,t)=>e.forEach(t);function iv(e,t,r){if(ip.arr(e)){for(let i=0;i<e.length;i++)t.call(r,e[i],`${i}`);return}for(let i in e)e.hasOwnProperty(i)&&t.call(r,e[i],i)}var iE=e=>ip.und(e)?[]:ip.arr(e)?e:[e];function ix(e,t){if(e.size){let r=Array.from(e);e.clear(),iy(r,t)}}var iC=(e,...t)=>ix(e,e=>e(...t)),iw=()=>"undefined"==typeof window||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),iB=null,iI=!1,i_=id,ib=e=>{e.to&&(eB=e.to),e.now&&(r3.now=e.now),void 0!==e.colors&&(iB=e.colors),null!=e.skipAnimation&&(iI=e.skipAnimation),e.createStringInterpolator&&(ew=e.createStringInterpolator),e.requestAnimationFrame&&r3.use(e.requestAnimationFrame),e.batchedUpdates&&(r3.batchedUpdates=e.batchedUpdates),e.willAdvance&&(i_=e.willAdvance),e.frameLoop&&(r3.frameLoop=e.frameLoop)},iM=new Set,iS=[],iD=[],iP=0,iT={get idle(){return!iM.size&&!iS.length},start(e){iP>e.priority?(iM.add(e),r3.onStart(iR)):(iF(e),r3(iz))},advance:iz,sort(e){if(iP)r3.onFrame(()=>iT.sort(e));else{let t=iS.indexOf(e);~t&&(iS.splice(t,1),iQ(e))}},clear(){iS=[],iM.clear()}};function iR(){iM.forEach(iF),iM.clear(),r3(iz)}function iF(e){iS.includes(e)||iQ(e)}function iQ(e){iS.splice(function(e,t){let r=e.findIndex(t);return r<0?e.length:r}(iS,t=>t.priority>e.priority),0,e)}function iz(e){let t=iD;for(let r=0;r<iS.length;r++){let i=iS[r];iP=i.priority,i.idle||(i_(i),i.advance(e),i.idle||t.push(i))}return iP=0,(iD=iS).length=0,(iS=t).length>0}var ik="[-+]?\\d*\\.?\\d+",iL=ik+"%";function iO(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var iU=RegExp("rgb"+iO(ik,ik,ik)),iG=RegExp("rgba"+iO(ik,ik,ik,ik)),iN=RegExp("hsl"+iO(ik,iL,iL)),iH=RegExp("hsla"+iO(ik,iL,iL,ik)),ij=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,iJ=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,iV=/^#([0-9a-fA-F]{6})$/,iK=/^#([0-9a-fA-F]{8})$/;function iY(e,t,r){return(r<0&&(r+=1),r>1&&(r-=1),r<1/6)?e+(t-e)*6*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function iW(e,t,r){let i=r<.5?r*(1+t):r+t-r*t,n=2*r-i;return Math.round(255*iY(n,i,e+1/3))<<24|Math.round(255*iY(n,i,e))<<16|Math.round(255*iY(n,i,e-1/3))<<8}function iq(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function iX(e){return(parseFloat(e)%360+360)%360/360}function iZ(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function i$(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function i1(e){let t;let r="number"==typeof e?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=iV.exec(e))?parseInt(t[1]+"ff",16)>>>0:iB&&void 0!==iB[e]?iB[e]:(t=iU.exec(e))?(iq(t[1])<<24|iq(t[2])<<16|iq(t[3])<<8|255)>>>0:(t=iG.exec(e))?(iq(t[1])<<24|iq(t[2])<<16|iq(t[3])<<8|iZ(t[4]))>>>0:(t=ij.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=iK.exec(e))?parseInt(t[1],16)>>>0:(t=iJ.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=iN.exec(e))?(255|iW(iX(t[1]),i$(t[2]),i$(t[3])))>>>0:(t=iH.exec(e))?(iW(iX(t[1]),i$(t[2]),i$(t[3]))|iZ(t[4]))>>>0:null;if(null===r)return e;let i=(4278190080&(r=r||0))>>>24,n=(16711680&r)>>>16,a=(65280&r)>>>8,o=(255&r)/255;return`rgba(${i}, ${n}, ${a}, ${o})`}var i0=(e,t,r)=>{if(ip.fun(e))return e;if(ip.arr(e))return i0({range:e,output:t,extrapolate:r});if(ip.str(e.output[0]))return ew(e);let i=e.output,n=e.range||[0,1],a=e.extrapolateLeft||e.extrapolate||"extend",o=e.extrapolateRight||e.extrapolate||"extend",s=e.easing||(e=>e);return t=>{let r=function(e,t){for(var r=1;r<t.length-1&&!(t[r]>=e);++r);return r-1}(t,n);return function(e,t,r,i,n,a,o,s,l){let c=l?l(e):e;if(c<t){if("identity"===o)return c;"clamp"===o&&(c=t)}if(c>r){if("identity"===s)return c;"clamp"===s&&(c=r)}return i===n?i:t===r?e<=t?i:n:(t===-1/0?c=-c:r===1/0?c-=t:c=(c-t)/(r-t),c=a(c),i===-1/0?c=-c:n===1/0?c+=i:c=c*(n-i)+i,c)}(t,n[r],n[r+1],i[r],i[r+1],s,a,o,e.map)}},i2=Symbol.for("FluidValue.get"),i3=Symbol.for("FluidValue.observers"),i4=e=>!!(e&&e[i2]),i5=e=>e&&e[i2]?e[i2]():e,i6=e=>e[i3]||null;function i8(e,t){let r=e[i3];
61r&&r.forEach(e=>{e.eventObserved?e.eventObserved(t):e(t)})}var i9=class{constructor(e){if(!e&&!(e=this.get))throw Error("Unknown getter");i7(this,e)}},i7=(e,t)=>nr(e,i2,t);function ne(e,t){if(e[i2]){let r=e[i3];r||nr(e,i3,r=new Set),!r.has(t)&&(r.add(t),e.observerAdded&&e.observerAdded(r.size,t))}return t}function nt(e,t){let r=e[i3];if(r&&r.has(t)){let i=r.size-1;i?r.delete(t):e[i3]=null,e.observerRemoved&&e.observerRemoved(i,t)}}var nr=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0}),ni=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,nn=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,na=RegExp(`(${ni.source})(%|[a-z]+)`,"i"),no=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,ns=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,nl=e=>{let[t,r]=nc(e);if(!t||iw())return e;let i=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(i)return i.trim();if(r&&r.startsWith("--")){let e=window.getComputedStyle(document.documentElement).getPropertyValue(r);if(e)return e}else if(r&&ns.test(r))return nl(r);else if(r)return r;return e},nc=e=>{let t=ns.exec(e);if(!t)return[,];let[,r,i]=t;return[r,i]},nu=(e,t,r,i,n)=>`rgba(${Math.round(t)}, ${Math.round(r)}, ${Math.round(i)}, ${n})`,nh=e=>{eI||(eI=iB?RegExp(`(${Object.keys(iB).join("|")})(?!\\w)`,"g"):/^\b$/);let t=e.output.map(e=>i5(e).replace(ns,nl).replace(nn,i1).replace(eI,i1)),r=t.map(e=>e.match(ni).map(Number)),i=r[0].map((e,t)=>r.map(e=>{if(!(t in e))throw Error('The arity of each "output" value must be equal');return e[t]})).map(t=>i0({...e,output:t}));return e=>{let r=!na.test(t[0])&&t.find(e=>na.test(e))?.replace(ni,""),n=0;return t[0].replace(ni,()=>`${i[n++](e)}${r||""}`).replace(no,nu)}},nA="react-spring: ",nd=e=>{let t=!1;if("function"!=typeof e)throw TypeError(`${nA}once requires a function parameter`);return(...r)=>{t||(e(...r),t=!0)}},nm=nd(console.warn),nf=nd(console.warn);function np(e){return ip.str(e)&&("#"==e[0]||/\d/.test(e)||!iw()&&ns.test(e)||e in(iB||{}))}var ng=iw()?eD.useEffect:eD.useLayoutEffect,ny=()=>{let e=(0,eD.useRef)(!1);return ng(()=>(e.current=!0,()=>{e.current=!1}),[]),e};function nv(){let e=(0,eD.useState)()[1],t=ny();return()=>{t.current&&e(Math.random())}}var nE=e=>(0,eD.useEffect)(e,nx),nx=[];function nC(e){let t=(0,eD.useRef)();return(0,eD.useEffect)(()=>{t.current=e}),t.current}var nw=Symbol.for("Animated:node"),nB=e=>!!e&&e[nw]===e,nI=e=>e&&e[nw],n_=(e,t)=>im(e,nw,t),nb=e=>e&&e[nw]&&e[nw].getPayload(),nM=class{constructor(){n_(this,this)}getPayload(){return this.payload||[]}},nS=class extends nM{constructor(e){super(),this._value=e,this.done=!0,this.durationProgress=0,ip.num(this._value)&&(this.lastPosition=this._value)}static create(e){return new nS(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return ip.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value!==e&&(this._value=e,!0)}reset(){let{done:e}=this;this.done=!1,ip.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}},nD=class extends nS{constructor(e){super(0),this._string=null,this._toString=i0({output:[e,e]})}static create(e){return new nD(e)}getValue(){let e=this._string;return null==e?this._string=this._toString(this._value):e}setValue(e){if(ip.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else{if(!super.setValue(e))return!1;this._string=null}return!0}reset(e){e&&(this._toString=i0({output:[this.getValue(),e]})),this._value=0,super.reset()}},nP={dependencies:null},nT=class extends nM{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){let t={};return iv(this.source,(r,i)=>{nB(r)?t[i]=r.getValue(e):i4(r)?t[i]=i5(r):e||(t[i]=r)}),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&iy(this.payload,e=>e.reset())}_makePayload(e){if(e){let t=new Set;return iv(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){nP.dependencies&&i4(e)&&nP.dependencies.add(e);let t=nb(e);t&&iy(t,e=>this.add(e))}},nR=class extends nT{constructor(e){super(e)}static create(e){return new nR(e)}getValue(){return this.source.map(e=>e.getValue())}setValue(e){let t=this.getPayload();return e.length==t.length?t.map((t,r)=>t.setValue(e[r])).some(Boolean):(super.setValue(e.map(nF)),!0)}};function nF(e){return(np(e)?nD:nS).create(e)}function nQ(e){let t=nI(e);return t?t.constructor:ip.arr(e)?nR:np(e)?nD:nS}var nz=(e,t)=>
61{let r=!ip.fun(e)||e.prototype&&e.prototype.isReactComponent;return(0,eD.forwardRef)((i,n)=>{let a=(0,eD.useRef)(null),o=r&&(0,eD.useCallback)(e=>{a.current=(n&&(ip.fun(n)?n(e):n.current=e),e)},[n]),[s,l]=function(e,t){let r=new Set;return nP.dependencies=r,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new nT(e),nP.dependencies=null,[e,r]}(i,t),c=nv(),u=()=>{let e=a.current;(!r||e)&&!1===(!!e&&t.applyAnimatedValues(e,s.getValue(!0)))&&c()},h=new nk(u,l),A=(0,eD.useRef)();ng(()=>(A.current=h,iy(l,e=>ne(e,h)),()=>{A.current&&(iy(A.current.deps,e=>nt(e,A.current)),r3.cancel(A.current.update))})),(0,eD.useEffect)(u,[]),nE(()=>()=>{let e=A.current;iy(e.deps,t=>nt(t,e))});let d=t.getComponentProps(s.getValue());return eD.createElement(e,{...d,ref:o})})},nk=class{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){"change"==e.type&&r3.write(this.update)}},nL=Symbol.for("AnimatedComponent"),nO=e=>ip.str(e)?e:e&&ip.str(e.displayName)?e.displayName:ip.fun(e)&&e.name||null;function nU(e,...t){return ip.fun(e)?e(...t):e}var nG=(e,t)=>!0===e||!!(t&&e&&(ip.fun(e)?e(t):iE(e).includes(t))),nN=(e,t)=>ip.obj(e)?t&&e[t]:e,nH=(e,t)=>!0===e.default?e[t]:e.default?e.default[t]:void 0,nj=e=>e,nJ=(e,t=nj)=>{let r=nV;e.default&&!0!==e.default&&(r=Object.keys(e=e.default));let i={};for(let n of r){let r=t(e[n],n);ip.und(r)||(i[n]=r)}return i},nV=["config","onProps","onStart","onChange","onPause","onResume","onRest"],nK={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function nY(e){let t=function(e){let t={},r=0;if(iv(e,(e,i)=>{!nK[i]&&(t[i]=e,r++)}),r)return t}(e);if(t){let r={to:t};return iv(e,(e,i)=>i in t||(r[i]=e)),r}return{...e}}function nW(e){return e=i5(e),ip.arr(e)?e.map(nW):np(e)?iA.createStringInterpolator({range:[0,1],output:[e,e]})(1):e}function nq(e){return ip.fun(e)||ip.arr(e)&&ip.obj(e[0])}var nX={tension:170,friction:26,mass:1,damping:1,easing:e=>e,clamp:!1},nZ=class{constructor(){this.velocity=0,Object.assign(this,nX)}};function n$(e,t){if(ip.und(t.decay)){let r=!ip.und(t.tension)||!ip.und(t.friction);!r&&ip.und(t.frequency)&&ip.und(t.damping)&&ip.und(t.mass)||(e.duration=void 0,e.decay=void 0),r&&(e.frequency=void 0)}else e.duration=void 0}var n1=[],n0=class{constructor(){this.changed=!1,this.values=n1,this.toValues=null,this.fromValues=n1,this.config=new nZ,this.immediate=!1}};function n2(e,{key:t,props:r,defaultProps:i,state:n,actions:a}){return new Promise((o,s)=>{let l,c;let u=nG(r.cancel??i?.cancel,t);if(u)d();else{ip.und(r.pause)||(n.paused=nG(r.pause,t));let e=i?.pause;!0!==e&&(e=n.paused||nG(e,t)),l=nU(r.delay||0,t),e?(n.resumeQueue.add(A),a.pause()):(a.resume(),A())}function h(){n.resumeQueue.add(A),n.timeouts.delete(c),c.cancel(),l=c.time-r3.now()}function A(){l>0&&!iA.skipAnimation?(n.delayed=!0,c=r3.setTimeout(d,l),n.pauseQueue.add(h),n.timeouts.add(c)):d()}function d(){n.delayed&&(n.delayed=!1),n.pauseQueue.delete(h),n.timeouts.delete(c),e<=(n.cancelId||0)&&(u=!0);try{a.start({...r,callId:e,cancel:u},o)}catch(e){s(e)}}})}var n3=(e,t)=>1==t.length?t[0]:t.some(e=>e.cancelled)?n6(e.get()):t.every(e=>e.noop)?n4(e.get()):n5(e.get(),t.every(e=>e.finished)),n4=e=>({value:e,noop:!0,finished:!0,cancelled:!1}),n5=(e,t,r=!1)=>({value:e,finished:t,cancelled:r}),n6=e=>({value:e,cancelled:!0,finished:!1});function n8(e,t,r,i){let{callId:n,parentId:a,onRest:o}=t,{asyncTo:s,promise:l}=r;return a||e!==s||t.reset?r.promise=(async()=>{let c,u,h;r.asyncId=n,r.asyncTo=e;let A=nJ(t,(e,t)=>"onRest"===t?void 0:e),d=new Promise((e,t)=>(c=e,u=t)),m=e=>{let t=n<=(r.cancelId||0)&&n6(i)||n!==r.asyncId&&n5(i,!1);if(t)throw e.result=t,u(e),e},f=(e,t)=>{let a=new n7,o=new ae;return(async()=>{if(iA.skipAnimation)throw n9(r),o.result=n5(i,!1),u(o),o;m(a);let s=ip.obj(e)?{...e}:{...t,to:e};s.parentId=n,iv(A,(e,t)=>{ip.und(s[t])&&(s[t]=e)});let l=await i.start(s);return m(a),r.paused&&await new Promise(e=>{r.resumeQueue.add(e)}),l})()};if(iA.skipAnimation)return n9(r),n5(i,!1);try{let t;t=ip.arr(e)?(async e=>{for(let t of e)await f(t)})(e):Promise.resolve(e(f,i.stop.bind(i))),await Promise.all([t.then(c),d]),h=n5(i.get(),!0,!1)}catch(e){if(e instanceof n7)h=e.result;
61else if(e instanceof ae)h=e.result;else throw e}finally{n==r.asyncId&&(r.asyncId=a,r.asyncTo=a?s:void 0,r.promise=a?l:void 0)}return ip.fun(o)&&r3.batchedUpdates(()=>{o(h,i,i.item)}),h})():l}function n9(e,t){ix(e.timeouts,e=>e.cancel()),e.pauseQueue.clear(),e.resumeQueue.clear(),e.asyncId=e.asyncTo=e.promise=void 0,t&&(e.cancelId=t)}var n7=class extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},ae=class extends Error{constructor(){super("SkipAnimationSignal")}},at=e=>e instanceof ai,ar=1,ai=class extends i9{constructor(){super(...arguments),this.id=ar++,this._priority=0}get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){let e=nI(this);return e&&e.getValue()}to(...e){return iA.to(this,e)}interpolate(...e){return nm(`${nA}The "interpolate" function is deprecated in v9 (use "to" instead)`),iA.to(this,e)}toJSON(){return this.get()}observerAdded(e){1==e&&this._attach()}observerRemoved(e){0==e&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){i8(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||iT.sort(this),i8(this,{type:"priority",parent:this,priority:e})}},an=Symbol.for("SpringPhase"),aa=e=>(1&e[an])>0,ao=e=>(2&e[an])>0,as=e=>(4&e[an])>0,al=(e,t)=>t?e[an]|=3:e[an]&=-3,ac=(e,t)=>t?e[an]|=4:e[an]&=-5,au=class extends ai{constructor(e,t){if(super(),this.animation=new n0,this.defaultProps={},this._state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!ip.und(e)||!ip.und(t)){let r=ip.obj(e)?{...e}:{...t,from:e};ip.und(r.default)&&(r.default=!0),this.start(r)}}get idle(){return!(ao(this)||this._state.asyncTo)||as(this)}get goal(){return i5(this.animation.to)}get velocity(){let e=nI(this);return e instanceof nS?e.lastVelocity||0:e.getPayload().map(e=>e.lastVelocity||0)}get hasAnimated(){return aa(this)}get isAnimating(){return ao(this)}get isPaused(){return as(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,r=!1,i=this.animation,{toValues:n}=i,{config:a}=i,o=nb(i.to);!o&&i4(i.to)&&(n=iE(i5(i.to))),i.values.forEach((s,l)=>{if(s.done)return;let c=s.constructor==nD?1:o?o[l].lastPosition:n[l],u=i.immediate,h=c;if(!u){let t;if(h=s.lastPosition,a.tension<=0){s.done=!0;return}let r=s.elapsedTime+=e,n=i.fromValues[l],o=null!=s.v0?s.v0:s.v0=ip.arr(a.velocity)?a.velocity[l]:a.velocity,A=a.precision||(n==c?.005:Math.min(1,.001*Math.abs(c-n)));if(ip.und(a.duration)){if(a.decay){let e=!0===a.decay?.998:a.decay,i=Math.exp(-(1-e)*r);h=n+o/(1-e)*(1-i),u=Math.abs(s.lastPosition-h)<=A,t=o*i}else{t=null==s.lastVelocity?o:s.lastVelocity;let r=a.restVelocity||A/10,i=a.clamp?0:a.bounce,l=!ip.und(i),d=n==c?s.v0>0:n<c,m=Math.ceil(e/1);for(let e=0;e<m&&!(!(Math.abs(t)>r)&&(u=Math.abs(c-h)<=A));++e){l&&(h==c||h>c==d)&&(t=-t*i,h=c);let e=(-(1e-6*a.tension)*(h-c)+-(.001*a.friction)*t)/a.mass;t+=1*e,h+=1*t}}}else{let i=1;a.duration>0&&(this._memoizedDuration!==a.duration&&(this._memoizedDuration=a.duration,s.durationProgress>0&&(s.elapsedTime=a.duration*s.durationProgress,r=s.elapsedTime+=e)),i=(i=(a.progress||0)+r/this._memoizedDuration)>1?1:i<0?0:i,s.durationProgress=i),t=((h=n+a.easing(i)*(c-n))-s.lastPosition)/e,u=1==i}s.lastVelocity=t,Number.isNaN(h)&&(console.warn("Got NaN while animating:",this),u=!0)}o&&!o[l].done&&(u=!1),u?s.done=!0:t=!1,s.setValue(h,a.round)&&(r=!0)});let s=nI(this),l=s.getValue();if(t){let e=i5(i.to);(l!==e||r)&&!a.decay?(s.setValue(e),this._onChange(e)):r&&a.decay&&this._onChange(l),this._stop()}else r&&this._onChange(l)}set(e){return r3.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(ao(this)){let{to:e,config:t}=this.animation;r3.batchedUpdates(()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,t){let r;return ip.und(e)?(r=this.queue||[],this.queue=[]):r=[ip.obj(e)?e:{...t,to:e}],Promise.all(r.map(e=>this._update(e))).then(e=>n3(this,e))}stop(e){let{to:t}=this.animation;return this._focus(this.get()),n9(this._state,e&&this._lastCallId),r3.batchedUpdates(()=>this._stop(t,e)),this}reset(){this._update({reset:!0})}eventObserved(e){"change"==e.type?this._start():"priority"==e.type&&(this.priority=e.priority+1)}_prepareNode(e){let t=this.key||"",{to:r,from:i}=e;(null==(r=ip.obj(r)?r[t]:r)||nq(r))&&(r=void 0),null==(i=ip.obj(i)?i[t]:i)&&(i=void 0);let n={to:r,from:i};return aa(this)||(e.reverse&&([r,i]=[i,r]),i=i5(i),ip.und(i)?nI(this)||this._set(r):this._set(i)),n}_update({...e},t){let{key:r,defaultProps:i}=this;e.default&&Object.assign(i,nJ(e,(e,t)=>/^on/.test(t)?nN(e,r):e)),ap(this,e,"onProps"),ag(this,"onProps",e,this);let n=this._prepareNode(e);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did 
61you forget to pass your component to `animated(...)` before animating its props?");let a=this._state;return n2(++this._lastCallId,{key:r,props:e,defaultProps:i,state:a,actions:{pause:()=>{as(this)||(ac(this,!0),iC(a.pauseQueue),ag(this,"onPause",n5(this,ah(this,this.animation.to)),this))},resume:()=>{as(this)&&(ac(this,!1),ao(this)&&this._resume(),iC(a.resumeQueue),ag(this,"onResume",n5(this,ah(this,this.animation.to)),this))},start:this._merge.bind(this,n)}}).then(r=>{if(e.loop&&r.finished&&!(t&&r.noop)){let t=aA(e);if(t)return this._update(t,!0)}return r})}_merge(e,t,r){if(t.cancel)return this.stop(!0),r(n6(this));let i=!ip.und(e.to),n=!ip.und(e.from);if(i||n){if(!(t.callId>this._lastToId))return r(n6(this));this._lastToId=t.callId}let{key:a,defaultProps:o,animation:s}=this,{to:l,from:c}=s,{to:u=l,from:h=c}=e;n&&!i&&(!t.default||ip.und(u))&&(u=h),t.reverse&&([u,h]=[h,u]);let A=!ig(h,c);A&&(s.from=h),h=i5(h);let d=!ig(u,l);d&&this._focus(u);let m=nq(t.to),{config:f}=s,{decay:p,velocity:g}=f;(i||n)&&(f.velocity=0),t.config&&!m&&function(e,t,r){for(let i in r&&(n$(r={...r},t),t={...r,...t}),n$(e,t),Object.assign(e,t),nX)null==e[i]&&(e[i]=nX[i]);let{frequency:i,damping:n}=e,{mass:a}=e;ip.und(i)||(i<.01&&(i=.01),n<0&&(n=0),e.tension=Math.pow(2*Math.PI/i,2)*a,e.friction=4*Math.PI*n*a/i)}(f,nU(t.config,a),t.config!==o.config?nU(o.config,a):void 0);let y=nI(this);if(!y||ip.und(u))return r(n5(this,!0));let v=ip.und(t.reset)?n&&!t.default:!ip.und(h)&&nG(t.reset,a),E=v?h:this.get(),x=nW(u),C=ip.num(x)||ip.arr(x)||np(x),w=!m&&(!C||nG(o.immediate||t.immediate,a));if(d){let e=nQ(u);if(e!==y.constructor){if(w)y=this._set(x);else throw Error(`Cannot animate between ${y.constructor.name} and ${e.name}, as the "to" prop suggests`)}}let B=y.constructor,I=i4(u),_=!1;if(!I){let e=v||!aa(this)&&A;(d||e)&&(I=!(_=ig(nW(E),x))),(ig(s.immediate,w)||w)&&ig(f.decay,p)&&ig(f.velocity,g)||(I=!0)}if(_&&ao(this)&&(s.changed&&!v?I=!0:I||this._stop(l)),!m&&((I||i4(l))&&(s.values=y.getPayload(),s.toValues=i4(u)?null:B==nD?[1]:iE(x)),s.immediate==w||(s.immediate=w,w||v||this._set(l)),I)){let{onRest:e}=s;iy(af,e=>ap(this,t,e));let i=n5(this,ah(this,l));iC(this._pendingCalls,i),this._pendingCalls.add(r),s.changed&&r3.batchedUpdates(()=>{s.changed=!v,e?.(i,this),v?nU(o.onRest,i):s.onStart?.(i,this)})}v&&this._set(E),m?r(n8(t.to,t,this._state,this)):I?this._start():ao(this)&&!d?this._pendingCalls.add(r):r(n4(E))}_focus(e){let t=this.animation;e!==t.to&&(i6(this)&&this._detach(),t.to=e,i6(this)&&this._attach())}_attach(){let e=0,{to:t}=this.animation;i4(t)&&(ne(t,this),at(t)&&(e=t.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;i4(e)&&nt(e,this)}_set(e,t=!0){let r=i5(e);if(!ip.und(r)){let e=nI(this);if(!e||!ig(r,e.getValue())){let i=nQ(r);e&&e.constructor==i?e.setValue(r):n_(this,i.create(r)),e&&r3.batchedUpdates(()=>{this._onChange(r,t)})}}return nI(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,ag(this,"onStart",n5(this,ah(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),nU(this.animation.onChange,e,this)),nU(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){let e=this.animation;nI(this).reset(i5(e.to)),e.immediate||(e.fromValues=e.values.map(e=>e.lastPosition)),ao(this)||(al(this,!0),as(this)||this._resume())}_resume(){iA.skipAnimation?this.finish():iT.start(this)}_stop(e,t){if(ao(this)){al(this,!1);let r=this.animation;iy(r.values,e=>{e.done=!0}),r.toValues&&(r.onChange=r.onPause=r.onResume=void 0),i8(this,{type:"idle",parent:this});let i=t?n6(this.get()):n5(this.get(),ah(this,e??r.to));iC(this._pendingCalls,i),r.changed&&(r.changed=!1,ag(this,"onRest",i,this))}}};function ah(e,t){let r=nW(t);return ig(nW(e.get()),r)}function aA(e,t=e.loop,r=e.to){let i=nU(t);if(i){let n=!0!==i&&nY(i),a=(n||e).reverse,o=!n||n.reset;return ad({...e,loop:t,default:!1,pause:void 0,to:!a||nq(r)?r:void 0,from:o?e.from:void 0,reset:o,...n})}}function ad(e){let{to:t,from:r}=e=nY(e),i=new Set;return ip.obj(t)&&am(t,i),ip.obj(r)&&am(r,i),e.keys=i.size?Array.from(i):null,e}function am(e,t){iv(e,(e,r)=>null!=e&&t.add(r))}var af=["onStart","onRest","onChange","onPause","onResume"];function ap(e,t,r){e.animation[r]=t[r]!==nH(t,r)?nN(t[r],e.key):void 0}function ag(e,t,...r){e.animation[t]?.(...r),e.defaultProps[t]?.(...r)}var ay=["onStart","onChange","onRest"],av=1,aE=class{constructor(e,t){this.id=av++,this.springs={},this.queue=[],this._lastAsyncId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){let e={};return this.each((t,r)=>e[r]=t.get()),e}set(e){for(let t in e){let r=e[t];ip.und(r)||this.springs[t].set(r)}}update(e){return e&&this.queue.push(ad(e)),this}start(e){let{queue:t}=this;return(e?t=iE(e).map(ad):this.queue=[],this._flush)?this._flush(this,t):(ab(this,t),ax(this,t))}stop(e,t){if(!!e!==e&&(t=e),t){let r=this.springs;iy(iE(t),t=>r[t].stop(!!e))}else n9(this._state,this._lastAsyncId),this.each(t=>t.stop(!!e));return this}pause(e){if(ip.und(e))this.start({pause:!0});else{let t=this.springs;iy(iE(e),e=>t[e].pause())}return this}resume(e){if(ip.und(e))this.start({pause:!1});else{let t=this.springs;iy(iE(e),e=>t[e].resume())}return this}each(e){iv(this.springs,e)}_onFrame(){let{onStart:e,onChange:t,onRest:r}=this._events,i=this._active.size>0,n=this._changed.size>0;(i&&!this._started||n&&!this._started)&&(this._started=!0,ix(e,([e,t])=>{t.value=this.get(),e(t,this,this._item)}));let a=!i&&this._started,o=n||a&&r.size?this.get():null;n&&t.size&&ix(t,([e,t])=>{t.value=o,e(t,this,this._item)}),a&&(this._started=!1,ix(r,([e,t])=>{t.value=o,e(t,this,this._item)}))}eventObserved(e){if("change"==e.type)this._changed.add(e.parent),e.idle||this._active.add(e.parent);else{if("idle"!=e.type)return;this._active.delete(e.parent)}r3.onFrame(this._onFrame)}};function ax(e,t){return Promise.all(t.map(t=>aC(e,t))).then(t=>n3(e,t))}async function aC(e,t,r){let{keys:i,to:n,from:a,loop:o,onRest:s,onResolve:l}=t,c=ip.obj(t.default)&&t.default;o&&(t.loop=!1),!1===n&&(t.to=null),!1===a&&(t.from=null);let u=ip.arr(n)||ip.fun(n)?n:void 0;u?(t.to=void 0,t.onRest=void 0,c&&(c.onRest=void 0)):iy(ay,r=>{let i=t[r];
61if(ip.fun(i)){let n=e._events[r];t[r]=({finished:e,cancelled:t})=>{let r=n.get(i);r?(e||(r.finished=!1),t&&(r.cancelled=!0)):n.set(i,{value:null,finished:e||!1,cancelled:t||!1})},c&&(c[r]=t[r])}});let h=e._state;!h.paused===t.pause?(h.paused=t.pause,iC(t.pause?h.pauseQueue:h.resumeQueue)):h.paused&&(t.pause=!0);let A=(i||Object.keys(e.springs)).map(r=>e.springs[r].start(t)),d=!0===t.cancel||!0===nH(t,"cancel");(u||d&&h.asyncId)&&A.push(n2(++e._lastAsyncId,{props:t,state:h,actions:{pause:id,resume:id,start(t,r){d?(n9(h,e._lastAsyncId),r(n6(e))):(t.onRest=s,r(n8(u,t,h,e)))}}})),h.paused&&await new Promise(e=>{h.resumeQueue.add(e)});let m=n3(e,await Promise.all(A));if(o&&m.finished&&!(r&&m.noop)){let r=aA(t,o,n);if(r)return ab(e,[r]),aC(e,r,!0)}return l&&r3.batchedUpdates(()=>l(m,e,e.item)),m}function aw(e,t){let r={...e.springs};return t&&iy(iE(t),e=>{ip.und(e.keys)&&(e=ad(e)),ip.obj(e.to)||(e={...e,to:void 0}),a_(r,e,e=>aI(e))}),aB(e,r),r}function aB(e,t){iv(t,(t,r)=>{e.springs[r]||(e.springs[r]=t,ne(t,e))})}function aI(e,t){let r=new au;return r.key=e,t&&ne(r,t),r}function a_(e,t,r){t.keys&&iy(t.keys,i=>{(e[i]||(e[i]=r(i)))._prepareNode(t)})}function ab(e,t){iy(t,t=>{a_(e.springs,t,t=>aI(t,e))})}var aM=({children:e,...t})=>{let r=(0,eD.useContext)(aS),i=t.pause||!!r.pause,n=t.immediate||!!r.immediate;t=function(e,t){let[r]=(0,eD.useState)(()=>({inputs:t,result:e()})),i=(0,eD.useRef)(),n=i.current,a=n;return a?t&&a.inputs&&function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}(t,a.inputs)||(a={inputs:t,result:e()}):a=r,(0,eD.useEffect)(()=>{i.current=a,n==r&&(r.inputs=r.result=void 0)},[a]),a.result}(()=>({pause:i,immediate:n}),[i,n]);let{Provider:a}=aS;return eD.createElement(a,{value:t},e)},aS=(W={},Object.assign(aM,eD.createContext(W)),aM.Provider._context=aM,aM.Consumer._context=aM,aM);aM.Provider=aS.Provider,aM.Consumer=aS.Consumer;var aD=()=>{let e=[],t=function(t){nf(`${nA}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`);let i=[];return iy(e,(e,n)=>{if(ip.und(t))i.push(e.start());else{let a=r(t,e,n);a&&i.push(e.start(a))}}),i};t.current=e,t.add=function(t){e.includes(t)||e.push(t)},t.delete=function(t){let r=e.indexOf(t);~r&&e.splice(r,1)},t.pause=function(){return iy(e,e=>e.pause(...arguments)),this},t.resume=function(){return iy(e,e=>e.resume(...arguments)),this},t.set=function(t){iy(e,(e,r)=>{let i=ip.fun(t)?t(r,e):t;i&&e.set(i)})},t.start=function(t){let r=[];return iy(e,(e,i)=>{if(ip.und(t))r.push(e.start());else{let n=this._getProps(t,e,i);n&&r.push(e.start(n))}}),r},t.stop=function(){return iy(e,e=>e.stop(...arguments)),this},t.update=function(t){return iy(e,(e,r)=>e.update(this._getProps(t,e,r))),this};let r=function(e,t,r){return ip.fun(e)?e(r,t):e};return t._getProps=r,t},aP=class extends ai{constructor(e,t){super(),this.source=e,this.idle=!0,this._active=new Set,this.calc=i0(...t);let r=this._get();n_(this,nQ(r).create(r))}advance(e){let t=this._get();ig(t,this.get())||(nI(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&aR(this._active)&&aF(this)}_get(){let e=ip.arr(this.source)?this.source.map(i5):iE(i5(this.source));return this.calc(...e)}_start(){this.idle&&!aR(this._active)&&(this.idle=!1,iy(nb(this),e=>{e.done=!1}),iA.skipAnimation?(r3.batchedUpdates(()=>this.advance()),aF(this)):iT.start(this))}_attach(){let e=1;iy(iE(this.source),t=>{i4(t)&&ne(t,this),at(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))}),this.priority=e,this._start()}_detach(){iy(iE(this.source),e=>{i4(e)&&nt(e,this)}),this._active.clear(),aF(this)}eventObserved(e){"change"==e.type?e.idle?this.advance():(this._active.add(e.parent),this._start()):"idle"==e.type?this._active.delete(e.parent):"priority"==e.type&&(this.priority=iE(this.source).reduce((e,t)=>Math.max(e,(at(t)?t.priority:0)+1),0))}};function aT(e){return!1!==e.idle}function aR(e){return!e.size||Array.from(e).every(aT)}function aF(e){e.idle||(e.idle=!0,iy(nb(e),e=>{e.done=!0}),i8(e,{type:"idle",parent:e}))}iA.assign({createStringInterpolator:nh,to:(e,t)=>new aP(e,t)}),iT.advance;var aQ=r(51448),az=["primitive"].concat(Object.keys(aQ).filter(e=>/^[A-Z]/.test(e)).map(e=>e[0].toLowerCase()+e.slice(1)));iA.assign({createStringInterpolator:nh,colors:{transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,dar
61kgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},frameLoop:"demand"}),(0,eR.o)(()=>{r3.advance()});var ak=((e,{applyAnimatedValues:t=()=>!1,createAnimatedStyle:r=e=>new nT(e),getComponentProps:i=e=>e}={})=>{let n={applyAnimatedValues:t,createAnimatedStyle:r,getComponentProps:i},a=e=>{let t=nO(e)||"Anonymous";return(e=ip.str(e)?a[e]||(a[e]=nz(e,n)):e[nL]||(e[nL]=nz(e,n))).displayName=`Animated(${t})`,e};return iv(e,(t,r)=>{ip.arr(e)&&(r=nO(t)),a[r]=a(t)}),{animated:a}})(az,{applyAnimatedValues:eR.k}).animated;function aL({enabled:e=!0,snap:t,global:r,domElement:i,cursor:n=!0,children:a,speed:o=1,rotation:s=[0,0,0],zoom:l=1,polar:c=[0,Math.PI/2],azimuth:u=[-1/0,1/0],config:h={mass:1,tension:170,friction:26}}){let A=(0,eR.D)(e=>e.events),d=(0,eR.D)(e=>e.gl),m=i||A.connected||d.domElement,{size:f}=(0,eR.D)(),p=eD.useMemo(()=>[s[0]+c[0],s[0]+c[1]],[s[0],c[0],c[1]]),g=eD.useMemo(()=>[s[1]+u[0],s[1]+u[1]],[s[1],u[0],u[1]]),y=eD.useMemo(()=>[eT.M8C.clamp(s[0],...p),eT.M8C.clamp(s[1],...g),s[2]],[s[0],s[1],s[2],p,g]),[v,E]=function(e,t){let r=ip.fun(e),[[i],n]=function(e,t,r){let i=ip.fun(t)&&t;i&&!r&&(r=[]);let n=(0,eD.useMemo)(()=>i||3==arguments.length?aD():void 0,[]),a=(0,eD.useRef)(0),o=nv(),s=(0,eD.useMemo)(()=>({ctrls:[],queue:[],flush(e,t){let r=aw(e,t);return!(a.current>0)||s.queue.length||Object.keys(r).some(t=>!e.springs[t])?new Promise(i=>{aB(e,r),s.queue.push(()=>{i(ax(e,t))}),o()}):ax(e,t)}}
61),[]),l=(0,eD.useRef)([...s.ctrls]),c=[],u=nC(e)||0;function h(e,r){for(let n=e;n<r;n++){let e=l.current[n]||(l.current[n]=new aE(null,s.flush)),r=i?i(n,e):t[n];r&&(c[n]=function(e){let t=ad(e);return ip.und(t.default)&&(t.default=nJ(t)),t}(r))}}(0,eD.useMemo)(()=>{iy(l.current.slice(e,u),e=>{e.ref?.delete(e),n?.delete(e),e.stop(!0)}),l.current.length=e,h(u,e)},[e]),(0,eD.useMemo)(()=>{h(0,Math.min(u,e))},r);let A=l.current.map((e,t)=>aw(e,c[t])),d=(0,eD.useContext)(aM),m=nC(d),f=d!==m&&function(e){for(let t in e)return!0;return!1}(d);ng(()=>{a.current++,s.ctrls=l.current;let{queue:e}=s;e.length&&(s.queue=[],iy(e,e=>e())),iy(l.current,(e,t)=>{n?.add(e),f&&e.start({default:d});let r=c[t];if(r){var i;(i=r.ref)&&e.ref!==i&&(e.ref?.delete(e),i.add(e),e.ref=i),e.ref?e.queue.push(r):e.start(r)}})}),nE(()=>()=>{iy(s.ctrls,e=>e.stop(!0))});let p=A.map(e=>({...e}));return n?[p,n]:p}(1,r?e:[e],r?t||[]:t);return r||2==arguments.length?[i,n]:i}(()=>({scale:1,rotation:y,config:h}));eD.useEffect(()=>void E.start({scale:1,rotation:y,config:h}),[y]),eD.useEffect(()=>{if(r&&n&&e)return m.style.cursor="grab",d.domElement.style.cursor="",()=>{m.style.cursor="default",d.domElement.style.cursor="default"}},[r,n,m,e]);let x=t2({onHover:({last:t})=>{n&&!r&&e&&(m.style.cursor=t?"auto":"grab")},onDrag:({down:r,delta:[i,a],memo:[s,c]=v.rotation.animation.to||y})=>{if(!e)return[a,i];n&&(m.style.cursor=r?"grabbing":"grab"),i=eT.M8C.clamp(c+i/f.width*Math.PI*o,...g),a=eT.M8C.clamp(s+a/f.height*Math.PI*o,...p);let u=t&&!r&&"boolean"!=typeof t?t:h;return E.start({scale:r&&a>p[1]/2?l:1,rotation:t&&!r?y:[a,i,0],config:e=>"scale"===e?{...u,friction:3*u.friction}:u}),[a,i]}},{target:r?m:void 0});return eD.createElement(ak.group,(0,eS.Z)({},null==x?void 0:x(),v),a)}let aO=e=>(t,r,i)=>{let n=i.subscribe;return i.subscribe=(e,t,r)=>{let a=e;if(t){let n=(null==r?void 0:r.equalityFn)||Object.is,o=e(i.getState());a=r=>{let i=e(r);if(!n(o,i)){let e=o;t(o=i,e)}},(null==r?void 0:r.fireImmediately)&&t(o,o)}return n(a)},e(t,r,i)},aU=eD.createContext(null);function aG({map:e,children:t,onChange:r,domElement:i}){let n=e.map(e=>e.name+e.keys).join("-"),a=eD.useMemo(()=>eq(aO(()=>e.reduce((e,t)=>({...e,[t.name]:!1}),{}))),[n]),o=eD.useMemo(()=>[a.subscribe,a.getState,a],[n]),s=a.setState;return eD.useEffect(()=>{let t=e.map(({name:e,keys:t,up:i})=>({keys:t,up:i,fn:t=>{s({[e]:t}),r&&r(e,t,o[1]())}})).reduce((e,{keys:t,fn:r,up:i=!0})=>(t.forEach(t=>e[t]={fn:r,pressed:!1,up:i}),e),{}),n=({key:e,code:r})=>{let i=t[e]||t[r];if(!i)return;let{fn:n,pressed:a,up:o}=i;i.pressed=!0,(o||!a)&&n(!0)},a=({key:e,code:r})=>{let i=t[e]||t[r];if(!i)return;let{fn:n,up:a}=i;i.pressed=!1,a&&n(!1)},l=i||window;return l.addEventListener("keydown",n,{passive:!0}),l.addEventListener("keyup",a,{passive:!0}),()=>{l.removeEventListener("keydown",n),l.removeEventListener("keyup",a)}},[i,n]),eD.createElement(aU.Provider,{value:o,children:t})}function aN(e){let[t,r,i]=eD.useContext(aU);return e?i(e):[t,r]}let aH=new eT.iWj,aj=new eT.Pa4,aJ=new eT.Pa4,aV=new eT.Pa4,aK=new eT.Pa4,aY=new eT.Pa4,aW=new eT.Pa4,aq=new eT.Pa4,aX=new eT.Pa4,aZ=new eT.Pa4,a$=new eT.Pa4,a1=new eT.Pa4,a0=new eT.Pa4,a2=new eT.Pa4,a3=new eT.Pa4;class a4{constructor(e,t,r){this.camera=e,this.scene=t,this.startPoint=new eT.Pa4,this.endPoint=new eT.Pa4,this.collection=[],this.deep=r||Number.MAX_VALUE}select(e,t){return this.startPoint=e||this.startPoint,this.endPoint=t||this.endPoint,this.collection=[],this.updateFrustum(this.startPoint,this.endPoint),this.searchChildInFrustum(aH,this.scene),this.collection}updateFrustum(e,t){if(e=e||this.startPoint,t=t||this.endPoint,e.x===t.x&&(t.x+=Number.EPSILON),e.y===t.y&&(t.y+=Number.EPSILON),this.camera.updateProjectionMatrix(),this.camera.updateMatrixWorld(),this.camera.isPerspectiveCamera){aJ.copy(e),aJ.x=Math.min(e.x,t.x),aJ.y=Math.max(e.y,t.y),t.x=Math.max(e.x,t.x),t.y=Math.min(e.y,t.y),aV.setFromMatrixPosition(this.camera.matrixWorld),aK.copy(aJ),aY.set(t.x,aJ.y,0),aW.copy(t),aq.set(aJ.x,t.y,0),aK.unproject(this.camera),aY.unproject(this.camera),aW.unproject(this.camera),aq.unproject(this.camera),a0.copy(aK).sub(aV),a2.copy(aY).sub(aV),a3.copy(aW).sub(aV),a0.normalize(),a2.normalize(),a3.normalize(),a0.multiplyScalar(this.deep),a2.multiplyScalar(this.deep),a3.multiplyScalar(this.deep),a0.add(aV),a2.add(aV),a3.add(aV);var r=aH.planes;r[0].setFromCoplanarPoints(aV,aK,aY),r[1].setFromCoplanarPoints(aV,aY,aW),r[2].setFromCoplanarPoints(aW,aq,aV),r[3].setFromCoplanarPoints(aq,aK,aV),r[4].setFromCoplanarPoints(aY,aW,aq),r[5].setFromCoplanarPoints(a3,a2,a0),r[5].normal.multiplyScalar(-1)}else if(this.camera.isOrthographicCamera){let i=Math.min(e.x,t.x),n=Math.max(e.y,t.y),a=Math.max(e.x,t.x),o=Math.min(e.y,t.y);aK.set(i,n,-1),aY.set(a,n,-1),aW.set(a,o,-1),aq.set(i,o,-1),aX.set(i,n,1),aZ.set(a,n,1),a$.set(a,o,1),a1.set(i,o,1),aK.unproject(this.camera),aY.unproject(this.camera),aW.unproject(this.camera),aq.unproject(this.camera),aX.unproject(this.camera),aZ.unproject(this.camera),a$.unproject(this.camera),a1.unproject(this.camera);var r=aH.planes;r[0].setFromCoplanarPoints(aK,aX,aZ),r[1].setFromCoplanarPoints(aY,aZ,a$),r[2].setFromCoplanarPoints(a$,a1,aq),r[3].setFromCoplanarPoints(a1,aX,aK),r[4].setFromCoplanarPoints(aY,aW,aq),r[5].setFromCoplanarPoints(a$,aZ,aX),r[5].normal.multiplyScalar(-1)}else console.error("THREE.SelectionBox: Unsupported camera type.")}searchChildInFrustum(e,t){if((t.isMesh||t.isLine||t.isPoints)&&void 0!==t.material&&(null===t.geometry.boundingSphere&&t.geometry.computeBoundingSphere(),aj.copy(t.geometry.boundingSphere.center),aj.applyMatrix4(t.matrixWorld),e.containsPoint(aj)&&this.collection.push(t)),t.children.length>0)for(let r=0;r<t.children.length;r++)this.searchChildInFrustum(e,t.children[r])}}let a5=e=>Symbol.iterator in e,a6=e=>"entries"in e,a8=(e,t)=>{let r=e instanceof Map?e:new Map(e.entries()),i=t instanceof Map?t
61:new Map(t.entries());if(r.size!==i.size)return!1;for(let[e,t]of r)if(!i.has(e)||!Object.is(t,i.get(e)))return!1;return!0},a9=(e,t)=>{let r=e[Symbol.iterator](),i=t[Symbol.iterator](),n=r.next(),a=i.next();for(;!n.done&&!a.done;){if(!Object.is(n.value,a.value))return!1;n=r.next(),a=i.next()}return!!n.done&&!!a.done},a7=eD.createContext([]);function oe({box:e,multiple:t,children:r,onChange:i,onChangePointerUp:n,border:a="1px solid #55aaff",backgroundColor:o="rgba(75, 160, 255, 0.1)",filter:s=e=>e,...l}){let[c,u]=eD.useState(!1),{setEvents:h,camera:A,raycaster:d,gl:m,controls:f,size:p,get:g}=(0,eR.D)(),[y,v]=eD.useState(!1),[E,x]=eD.useReducer((e,{object:t,shift:r})=>void 0===t?[]:Array.isArray(t)?t:r?e.includes(t)?e.filter(e=>e!==t):[t,...e]:e[0]===t?[]:[t],[]);eD.useEffect(()=>{c?null==i||i(E):null==n||n(E)},[E,c]);let C=eD.useCallback(e=>{e.stopPropagation(),x({object:s([e.object])[0],shift:t&&e.shiftKey})},[]),w=eD.useCallback(e=>!y&&x({}),[y]),B=eD.useRef(null);return eD.useEffect(()=>{if(!e||!t)return;let r=new a4(A,B.current),i=document.createElement("div");i.style.pointerEvents="none",i.style.border=a,i.style.backgroundColor=o,i.style.position="fixed";let n=new eT.FM8,l=new eT.FM8,c=new eT.FM8,d=g().events.enabled,y=null==f?void 0:f.enabled,v=!1;function E(e,t){let{offsetX:r,offsetY:i}=e,{width:n,height:a}=p;t.set(r/n*2-1,-(i/a*2)+1)}function C(e){if(e.shiftKey){var t;f&&(f.enabled=!1),h({enabled:!1}),u(v=!0),null==(t=m.domElement.parentElement)||t.appendChild(i),i.style.left=`${e.clientX}px`,i.style.top=`${e.clientY}px`,i.style.width="0px",i.style.height="0px",n.x=e.clientX,n.y=e.clientY,E(e,r.startPoint)}}let w=[];function I(e){if(v){var t;c.x=Math.max(n.x,e.clientX),c.y=Math.max(n.y,e.clientY),l.x=Math.min(n.x,e.clientX),l.y=Math.min(n.y,e.clientY),i.style.left=`${l.x}px`,i.style.top=`${l.y}px`,i.style.width=`${c.x-l.x}px`,i.style.height=`${c.y-l.y}px`,E(e,r.endPoint);let a=r.select().sort(e=>e.uuid).filter(e=>e.isMesh);Object.is(a,t=w)||"object"==typeof a&&null!==a&&"object"==typeof t&&null!==t&&Object.getPrototypeOf(a)===Object.getPrototypeOf(t)&&(a5(a)&&a5(t)?a6(a)&&a6(t)?a8(a,t):a9(a,t):a8({entries:()=>Object.entries(a)},{entries:()=>Object.entries(t)}))||(w=a,x({object:s(a)}))}}function _(e){v&&function(){if(v){var e;f&&(f.enabled=y),h({enabled:d}),u(v=!1),null==(e=i.parentElement)||e.removeChild(i)}}()}return document.addEventListener("pointerdown",C,{passive:!0}),document.addEventListener("pointermove",I,{passive:!0,capture:!0}),document.addEventListener("pointerup",_,{passive:!0}),()=>{document.removeEventListener("pointerdown",C),document.removeEventListener("pointermove",I,!0),document.removeEventListener("pointerup",_)}},[p.width,p.height,d,A,f,m]),eD.createElement("group",(0,eS.Z)({ref:B,onClick:C,onPointerOver:()=>v(!0),onPointerOut:()=>v(!1),onPointerMissed:w},l),eD.createElement(a7.Provider,{value:E},r))}function ot(){return eD.useContext(a7)}let or=eD.forwardRef(function({children:e,follow:t=!0,lockX:r=!1,lockY:i=!1,lockZ:n=!1,...a},o){let s=eD.useRef(null),l=eD.useRef(null),c=new eT._fP;return(0,eR.F)(({camera:e})=>{if(!t||!l.current)return;let a=s.current.rotation.clone();l.current.updateMatrix(),l.current.updateWorldMatrix(!1,!1),l.current.getWorldQuaternion(c),e.getWorldQuaternion(s.current.quaternion).premultiply(c.invert()),r&&(s.current.rotation.x=a.x),i&&(s.current.rotation.y=a.y),n&&(s.current.rotation.z=a.z)}),eD.useImperativeHandle(o,()=>l.current,[]),eD.createElement("group",(0,eS.Z)({ref:l},a),eD.createElement("group",{ref:s},e))}),oi=eD.forwardRef(({children:e,depth:t=-1,...r},i)=>{let n=eD.useRef(null);return eD.useImperativeHandle(i,()=>n.current,[]),(0,eR.F)(({camera:e})=>{n.current.quaternion.copy(e.quaternion),n.current.position.copy(e.position)}),eD.createElement("group",(0,eS.Z)({ref:n},r),eD.createElement("group",{"position-z":-t},e))}),on=new eT.Pa4,oa=new eT.Pa4,oo=new eT.Pa4,os=(e,t,r)=>{let i=r.width/2,n=r.height/2;t.updateMatrixWorld(!1);let a=e.project(t);return a.x=a.x*i+i,a.y=-(a.y*n)+n,a},ol=(e,t,r,i=1)=>{let n=on.set(e.x/r.width*2-1,-(e.y/r.height*2)+1,i);return n.unproject(t),n},oc=(e,t,r,i)=>{let n=os(oo.copy(e),r,i),a=0;for(let o=0;o<2;++o){let s=oa.copy(n).setComponent(o,n.getComponent(o)+t),l=ol(s,r,i,s.z);a=Math.max(a,e.distanceTo(l))}return a},ou=new eT.Pa4,oh=(0,eD.forwardRef)(({scale:e=1,...t},r)=>{let i=(0,eD.useRef)(null);return eD.useImperativeHandle(r,()=>i.current,[]),(0,eR.F)(t=>{let r=i.current;if(!r)return;let n=oc(r.getWorldPosition(ou),e,t.camera,t.size);r.scale.setScalar(n*e)}),eD.createElement("object3D",(0,eS.Z)({ref:i},t))}),oA=new eT.ZzF,od=new eT.Pa4;class om extends eT.L5s{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry",this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new eT.a$l([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new eT.a$l([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){let t=this.attributes.instanceStart,r=this.attributes.instanceEnd;
61return void 0!==t&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let r=new eT.$TI(t,6,1);return this.setAttribute("instanceStart",new eT.kB5(r,3,0)),this.setAttribute("instanceEnd",new eT.kB5(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e,t=3){let r;e instanceof Float32Array?r=e:Array.isArray(e)&&(r=new Float32Array(e));let i=new eT.$TI(r,2*t,1);return this.setAttribute("instanceColorStart",new eT.kB5(i,t,0)),this.setAttribute("instanceColorEnd",new eT.kB5(i,t,t)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new eT.Uk6(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new eT.ZzF);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),oA.setFromBufferAttribute(t),this.boundingBox.union(oA))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new eT.aLr),null===this.boundingBox&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){let r=this.boundingSphere.center;this.boundingBox.getCenter(r);let i=0;for(let n=0,a=e.count;n<a;n++)od.fromBufferAttribute(e,n),i=Math.max(i,r.distanceToSquared(od)),od.fromBufferAttribute(t,n),i=Math.max(i,r.distanceToSquared(od));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}var of=r(49074);class op extends eT.jyz{constructor(e){super({type:"LineMaterial",uniforms:eT.rDY.clone(eT.rDY.merge([aQ.UniformsLib.common,aQ.UniformsLib.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new eT.FM8(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}}])),vertexShader:`
62				#include <common>
63				#include <fog_pars_vertex>
64				#include <logdepthbuf_pars_vertex>
65				#include <clipping_planes_pars_vertex>
66
67				uniform float linewidth;
68				uniform vec2 resolution;
69
70				attribute vec3 instanceStart;
71				attribute vec3 instanceEnd;
72
73				#ifdef USE_COLOR
74					#ifdef USE_LINE_COLOR_ALPHA
75						varying vec4 vLineColor;
76						attribute vec4 instanceColorStart;
77						attribute vec4 instanceColorEnd;
78					#else
79						varying vec3 vLineColor;
80						attribute vec3 instanceColorStart;
81						attribute vec3 instanceColorEnd;
82					#endif
83				#endif
84
85				#ifdef WORLD_UNITS
86
87					varying vec4 worldPos;
88					varying vec3 worldStart;
89					varying vec3 worldEnd;
90
91					#ifdef USE_DASH
92
93						varying vec2 vUv;
94
95					#endif
96
97				#else
98
99					varying vec2 vUv;
100
101				#endif
102
103				#ifdef USE_DASH
104
105					uniform float dashScale;
106					attribute float instanceDistanceStart;
107					attribute float instanceDistanceEnd;
108					varying float vLineDistance;
109
110				#endif
111
112				void trimSegment( const in vec4 start, inout vec4 end ) {
113
114					// trim end segment so it terminates between the camera plane and the near plane
115
116					// conservative estimate of the near plane
117					float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
118					float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
119					float nearEstimate = - 0.5 * b / a;
120
121					float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
122
123					end.xyz = mix( start.xyz, end.xyz, alpha );
124
125				}
126
127				void main() {
128
129					#ifdef USE_COLOR
130
131						vLineColor = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
132
133					#endif
134
135					#ifdef USE_DASH
136
137						vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
138						vUv = uv;
139
140					#endif
141
142					float aspect = resolution.x / resolution.y;
143
144					// camera space
145					vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
146					vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
147
148					#ifdef WORLD_UNITS
149
150						worldStart = start.xyz;
151						worldEnd = end.xyz;
152
153					#else
154
155						vUv = uv;
156
157					#endif
158
159					// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
160					// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
161					// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
162					// perhaps there is a more elegant solution -- WestLangley
163
164					bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
165
166					if ( perspective ) {
167
168						if ( start.z < 0.0 && end.z >= 0.0 ) {
169
170							trimSegment( start, end );
171
172						} else if ( end.z < 0.0 && start.z >= 0.0 ) {
173
174							trimSegment( end, start );
175
176						}
177
178					}
179
180					// clip space
181					vec4 clipStart = projectionMatrix * start;
182					vec4 clipEnd = projectionMatrix * end;
183
184					// ndc space
185					vec3 ndcStart = clipStart.xyz / clipStart.w;
186					vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
187
188					// direction
189					vec2 dir = ndcEnd.xy - ndcStart.xy;
190
191					// account for clip-space aspect ratio
192					dir.x *= aspect;
193					dir = normalize( dir );
194
195					#ifdef WORLD_UNITS
196
197						// get the offset direction as perpendicular to the view vector
198						vec3 worldDir = normalize( end.xyz - start.xyz );
199						vec3 offset;
200						if ( position.y < 0.5 ) {
201
202							offset = normalize( cross( start.xyz, worldDir ) );
203
204						} else {
205
206							offset = normalize( cross( end.xyz, worldDir ) );
207
208						}
209
210						// sign flip
211						if ( position.x < 0.0 ) offset *= - 1.0;
212
213						float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );
214
215						// don't extend the line if we're rendering dashes because we
216						// won't be rendering the endcaps
217						#ifndef USE_DASH
218
219							// extend the line bounds to encompass  endcaps
220							start.xyz += - worldDir * linewidth * 0.5;
221							end.xyz += worldDir * linewidth * 0.5;
222
223							// shift the position of the quad so it hugs the forward edge of the line
224							offset.xy -= dir * forwardOffset;
225							offset.z += 0.5;
226
227						#endif
228
229						// endcaps
230						if ( position.y > 1.0 || position.y < 0.0 ) {
231
232							offset.xy += dir * 2.0 * forwardOffset;
233
234						}
235
236						// adjust for linewidth
237						offset *= linewidth * 0.5;
238
239						// set the world position
240						worldPos = ( position.y < 0.5 ) ? start : end;
241						worldPos.xyz += offset;
242
243						// project the worldpos
244						vec4 clip = projectionMatrix * worldPos;
245
246						// shift the depth of the projected points so the line
247						// segments overlap neatly
248						vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
249						clip.z = clipPose.z * clip.w;
250
251					#else
252
253						vec2 offset = vec2( dir.y, - dir.x );
254						// undo aspect ratio adjustment
255						dir.x /= aspect;
256						offset.x /= aspect;
257
258						// sign flip
259						if ( position.x < 0.0 ) offset *= - 1.0;
260
261						// endcaps
262						if ( position.y < 0.0 ) {
263
264							offset += - dir;
265
266						} else if ( position.y > 1.0 ) {
267
268							offset += dir;
269
270						}
271
272						// adjust for linewidth
273						offset *= linewidth;
274
275						// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
276						offset /= resolution.y;
277
278						// select end
279						vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
280
281						// back to clip space
282						offset *= clip.w;
283
284						clip.xy += offset;
285
286					#endif
287
288					gl_Position = clip;
289
290					vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
291
292					#include <logdepthbuf_vertex>
293					#include <clipping_planes_vertex>
294					#include <fog_vertex>
295
296				}
297			`,fragmentShader:`
298				uniform vec3 diffuse;
299				uniform float opacity;
300				uniform float linewidth;
301
302				#ifdef USE_DASH
303
304					uniform float dashOffset;
305					uniform float dashSize;
306					uniform float gapSize;
307
308				#endif
309
310				varying float vLineDistance;
311
312				#ifdef WORLD_UNITS
313
314					varying vec4 worldPos;
315					varying vec3 worldStart;
316					varying vec3 worldEnd;
317
318					#ifdef USE_DASH
319
320						varying vec2 vUv;
321
322					#endif
323
324				#else
325
326					varying vec2 vUv;
327
328				#endif
329
330				#include <common>
331				#include <fog_pars_fragment>
332				#include <logdepthbuf_pars_fragment>
333				#include <clipping_planes_pars_fragment>
334
335				#ifdef USE_COLOR
336					#ifdef USE_LINE_COLOR_ALPHA
337						varying vec4 vLineColor;
338					#else
339						varying vec3 vLineColor;
340					#endif
341				#endif
342
343				vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
344
345					float mua;
346					float mub;
347
348					vec3 p13 = p1 - p3;
349					vec3 p43 = p4 - p3;
350
351					vec3 p21 = p2 - p1;
352
353					float d1343 = dot( p13, p43 );
354					float d4321 = dot( p43, p21 );
355					float d1321 = dot( p13, p21 );
356					float d4343 = dot( p43, p43 );
357					float d2121 = dot( p21, p21 );
358
359					float denom = d2121 * d4343 - d4321 * d4321;
360
361					float numer = d1343 * d4321 - d1321 * d4343;
362
363					mua = numer / denom;
364					mua = clamp( mua, 0.0, 1.0 );
365					mub = ( d1343 + d4321 * ( mua ) ) / d4343;
366					mub = clamp( mub, 0.0, 1.0 );
367
368					return vec2( mua, mub );
369
370				}
371
372				void main() {
373
374					#include <clipping_planes_fragment>
375
376					#ifdef USE_DASH
377
378						if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
379
380						if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
381
382					#endif
383
384					float alpha = opacity;
385
386					#ifdef WORLD_UNITS
387
388						// Find the closest points on the view ray and the line segment
389						vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
390						vec3 lineDir = worldEnd - worldStart;
391						vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
392
393						vec3 p1 = worldStart + lineDir * params.x;
394						vec3 p2 = rayEnd * params.y;
395						vec3 delta = p1 - p2;
396						float len = length( delta );
397						float norm = len / linewidth;
398
399						#ifndef USE_DASH
400
401							#ifdef USE_ALPHA_TO_COVERAGE
402
403								float dnorm = fwidth( norm );
404								alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
405
406							#else
407
408								if ( norm > 0.5 ) {
409
410									discard;
411
412								}
413
414							#endif
415
416						#endif
417
418					#else
419
420						#ifdef USE_ALPHA_TO_COVERAGE
421
422							// artifacts appear on some hardware if a derivative is taken within a conditional
423							float a = vUv.x;
424							float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
425							float len2 = a * a + b * b;
426							float dlen = fwidth( len2 );
427
428							if ( abs( vUv.y ) > 1.0 ) {
429
430								alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
431
432							}
433
434						#else
435
436							if ( abs( vUv.y ) > 1.0 ) {
437
438								float a = vUv.x;
439								float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
440								float len2 = a * a + b * b;
441
442								if ( len2 > 1.0 ) discard;
443
444							}
445
446						#endif
447
448					#endif
449
450					vec4 diffuseColor = vec4( diffuse, alpha );
451					#ifdef USE_COLOR
452						#ifdef USE_LINE_COLOR_ALPHA
453							diffuseColor *= vLineColor;
454						#else
455							diffuseColor.rgb *= vLineColor;
456						#endif
457					#endif
458
459					#include <logdepthbuf_fragment>
460
461					gl_FragColor = diffuseColor;
462
463					#include <tonemapping_fragment>
464					#include <${of.i>=154?"colorspace_fragment":"encodings_fragment"}>
465					#include <fog_fragment>
466					#include <premultiplied_alpha_fragment>
467
468				}
469			`,clipping:!0}),this.isLineMaterial=!0,this.onBeforeCompile=function(){this.transparent?this.defines.USE_LINE_COLOR_ALPHA="1":delete this.defines.USE_LINE_COLOR_ALPHA},Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(e){!!e!="USE_DASH"in this.defines&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}}
469,alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(e){!!e!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),!0===e?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}let og=of.i>=125?"uv1":"uv2",oy=new eT.Ltg,ov=new eT.Pa4,oE=new eT.Pa4,ox=new eT.Ltg,oC=new eT.Ltg,ow=new eT.Ltg,oB=new eT.Pa4,oI=new eT.yGw,o_=new eT.Zzh,ob=new eT.Pa4,oM=new eT.ZzF,oS=new eT.aLr,oD=new eT.Ltg;function oP(e,t,r){return oD.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),oD.multiplyScalar(1/oD.w),oD.x=n/r.width,oD.y=n/r.height,oD.applyMatrix4(e.projectionMatrixInverse),oD.multiplyScalar(1/oD.w),Math.abs(Math.max(oD.x,oD.y))}class oT extends eT.Kj0{constructor(e=new om,t=new op({color:16777215*Math.random()})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let e=0,n=0,a=t.count;e<a;e++,n+=2)ov.fromBufferAttribute(t,e),oE.fromBufferAttribute(r,e),i[n]=0===n?0:i[n-1],i[n+1]=i[n]+ov.distanceTo(oE);let n=new eT.$TI(i,2,1);return e.setAttribute("instanceDistanceStart",new eT.kB5(n,1,0)),e.setAttribute("instanceDistanceEnd",new eT.kB5(n,1,1)),this}raycast(e,t){let r,a;let o=this.material.worldUnits,s=e.camera;null!==s||o||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');let l=void 0!==e.params.Line2&&e.params.Line2.threshold||0;i=e.ray;let c=this.matrixWorld,u=this.geometry,h=this.material;if(n=h.linewidth+l,null===u.boundingSphere&&u.computeBoundingSphere(),oS.copy(u.boundingSphere).applyMatrix4(c),o)r=.5*n;else{let e=Math.max(s.near,oS.distanceToPoint(i.origin));r=oP(s,e,h.resolution)}if(oS.radius+=r,!1!==i.intersectsSphere(oS)){if(null===u.boundingBox&&u.computeBoundingBox(),oM.copy(u.boundingBox).applyMatrix4(c),o)a=.5*n;else{let e=Math.max(s.near,oM.distanceToPoint(i.origin));a=oP(s,e,h.resolution)}oM.expandByScalar(a),!1!==i.intersectsBox(oM)&&(o?function(e,t){let r=e.matrixWorld,a=e.geometry,o=a.attributes.instanceStart,s=a.attributes.instanceEnd,l=Math.min(a.instanceCount,o.count);for(let a=0;a<l;a++){o_.start.fromBufferAttribute(o,a),o_.end.fromBufferAttribute(s,a),o_.applyMatrix4(r);let l=new eT.Pa4,c=new eT.Pa4;i.distanceSqToSegment(o_.start,o_.end,c,l),c.distanceTo(l)<.5*n&&t.push({point:c,pointOnLine:l,distance:i.origin.distanceTo(c),object:e,face:null,faceIndex:a,uv:null,[og]:null})}}(this,t):function(e,t,r){let a=t.projectionMatrix,o=e.material.resolution,s=e.matrixWorld,l=e.geometry,c=l.attributes.instanceStart,u=l.attributes.instanceEnd,h=Math.min(l.instanceCount,c.count),A=-t.near;i.at(1,ow),ow.w=1,ow.applyMatrix4(t.matrixWorldInverse),ow.applyMatrix4(a),ow.multiplyScalar(1/ow.w),ow.x*=o.x/2,ow.y*=o.y/2,ow.z=0,oB.copy(ow),oI.multiplyMatrices(t.matrixWorldInverse,s);for(let t=0;t<h;t++){if(ox.fromBufferAttribute(c,t),oC.fromBufferAttribute(u,t),ox.w=1,oC.w=1,ox.applyMatrix4(oI),oC.applyMatrix4(oI),ox.z>A&&oC.z>A)continue;if(ox.z>A){let e=ox.z-oC.z,t=(ox.z-A)/e;ox.lerp(oC,t)}else if(oC.z>A){let e=oC.z-ox.z,t=(oC.z-A)/e;oC.lerp(ox,t)}ox.applyMatrix4(a),oC.applyMatrix4(a),ox.multiplyScalar(1/ox.w),oC.multiplyScalar(1/oC.w),ox.x*=o.x/2,ox.y*=o.y/2,oC.x*=o.x/2,oC.y*=o.y/2,o_.start.copy(ox),o_.start.z=0,o_.end.copy(oC),o_.end.z=0;let l=o_.closestPointToPointParameter(oB,!0);o_.at(l,ob);let h=eT.M8C.lerp(ox.z,oC.z,l),d=h>=-1&&h<=1,m=oB.distanceTo(ob)<.5*n;if(d&&m){o_.start.fromBufferAttribute(c,t),o_.end.fromBufferAttribute(u,t),o_.start.applyMatrix4(s),o_.end.applyMatrix4(s);let n=new eT.Pa4,a=new eT.Pa4;i.distanceSqToSegment(o_.start,o_.end,a,n),r.push({point:a,pointOnLine:n,distance:i.origin.distanceTo(a),object:e,face:null,faceIndex:t,uv:null,[og]:null})}}}(this,s,t))}}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(oy),this.material.uniforms.resolution.value.set(oy.z,oy.w))}}class oR extends om{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){let t=e.length-3,r=new Float32Array(2*t);for(let i=0;i<t;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return super.setPositions(r),this}setColors(e,t=3){let r=e.length-t,i=new Float32Array(2*r);if(3===t)for(let n=0;n<r;n+=t)i[2*n]=e[n],i[2*n+1]=e[n+1],i[2*n+2]=e[n+2],i[2*n+3]=e[n+3],i[2*n+4]=e[n+4],i[2*n+5]=e[n+5];else for(let n=0;n<r;n+=t)i[2*n]=e[n],i[2*n+1]=e[n+1],i[2*n+2]=e[n+2],i[2*n+3]=e[n+3],i[2*n+4]=e[n+4],i[2*n+5]=e[n+5],i[2*n+6]=e[n+6],i[2*n+7]=e[n+7];return super.setColors(i,t),this}fromLine(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class oF extends oT{constructor(e=new oR,t=new op({color:16777215*Math.random()})){super(e,t),this.isLine2=!0,this.type="Line2"}}let oQ=eD.forwardRef(function({points:e,color:t=16777215,vertexColors:r,linewidth:i,lineWidth:n,segments:a,dashed:o,...s},l){var c,u;let h=(0,eR.D)(e=>e.size),A=eD.useMemo(()=>a?new oT:new oF,[a]),[d]=eD.useState(()=>new op),m=(null==r||null==(c=r[0])?void 0:c.length)===4?4:3,f=eD.useMemo(()=>{let i=a?new om:new oR,n=e.map(e=>{let t=Array.isArray(e);return e instanceof eT.Pa4||e instanceof eT.Ltg?[e.x,e.y,e.z]:e instanceof eT.FM8?[e.x,e.y,0]:t&&3===e.length?[e[0],e[1],e[2]]:t&&2===e.length?[e[0],e[1],0]:e});if(i.setPositions(n.flat()),r){t=16777215;let e=r.map(e=>e instanceof eT.Ilk?e.toArray():e);i.setColors(e.flat(),m)}return i},[e,a,r,m]);return eD.useLayoutEffect(()=>{A.computeLineDistances()},[e,A]),eD.useLayoutEffect(()=>{o?d.defines.USE_DASH="":delete d.defines.USE_DASH,d.needsUpdate=!0},[o,d]),eD.useEffect(()=>()=>{f.dispose(),d.dispose()},[f]),eD.createElement("primitive",(0,eS.Z)({object:A,ref:l},s),eD.createElement("primitive",{object:f,attach:"geometry"}),eD.createElement("primitive",(0,eS.Z)({object:d,attach:"material",color:t,vertexColors:!!r,resolution:[h.width,h.height],linewidth:null!==(u=null!=i?i:n)&&void 0!==u?u:1,dashed:o,transparent:4===m},s)))}),oz=new eT.Pa4,ok=eD.forwardRef(function({start:e=[0,0,0],end:t=[0,0,0],mid:r,segments:i=20,...n},a){let o=eD.useRef(null);eD.useImperativeHandle(a,()=>o.current);let[s]=eD.useState(()=>new eT.mXe(void 0,void 0,void 0)),l=eD.useCallback((e,t,r,i=20)=>(e instanceof eT.Pa4?s.v0.copy(e):s.v0.set(...e),t instanceof eT.Pa4?s.v2.copy(t):s.v2.set(...t),r instanceof eT.Pa4?s.v1.copy(r):Array.isArray(r)?s.v1.set(...r):s.v1.copy(s.v0.clone().add(s.v2.clone().sub(s.v0)).add(oz.set(0,s.v0.y-s.v2.y,0))),s.getPoints(i)),[]);eD.useLayoutEffect(()=>{o.current.setPoints=(e,t,r)=>{let i=l(e,t,r);o.current.geometry&&o.current.geometry.setPositions(i.map(e=>e.toArray()).flat())}},[]);let c=eD.useMemo(()=>
469l(e,t,r,i),[e,t,r,i]);return eD.createElement(oQ,(0,eS.Z)({ref:o,points:c},n))}),oL=eD.forwardRef(function({start:e,end:t,midA:r,midB:i,segments:n=20,...a},o){let s=eD.useMemo(()=>{let a=e instanceof eT.Pa4?e:new eT.Pa4(...e),o=t instanceof eT.Pa4?t:new eT.Pa4(...t),s=r instanceof eT.Pa4?r:new eT.Pa4(...r),l=i instanceof eT.Pa4?i:new eT.Pa4(...i);return new eT.yj7(a,s,l,o).getPoints(n)},[e,t,r,i,n]);return eD.createElement(oQ,(0,eS.Z)({ref:o,points:s},a))}),oO=eD.forwardRef(function({points:e,closed:t=!1,curveType:r="centripetal",tension:i=.5,segments:n=20,vertexColors:a,...o},s){let l=eD.useMemo(()=>{let n=e.map(e=>e instanceof eT.Pa4?e:new eT.Pa4(...e));return new eT.YT8(n,t,r,i)},[e,t,r,i]),c=eD.useMemo(()=>l.getPoints(n),[l,n]),u=eD.useMemo(()=>{if(!a||a.length<2)return;if(a.length===n+1)return a;let e=a.map(e=>e instanceof eT.Ilk?e:new eT.Ilk(...e));t&&e.push(e[0].clone());let r=[e[0]],i=n/(e.length-1);for(let t=1;t<n;t++){let n=t%i/i,a=Math.floor(t/i);r.push(e[a].clone().lerp(e[a+1],n))}return r.push(e[e.length-1]),r},[a,n]);return eD.createElement(oQ,(0,eS.Z)({ref:s,points:c,vertexColors:u},o))}),oU=eD.forwardRef(({url:e,distance:t=1,loop:r=!0,autoplay:i,...n},a)=>{let o=eD.useRef(null);eD.useImperativeHandle(a,()=>o.current,[]);let s=(0,eR.D)(({camera:e})=>e),[l]=eD.useState(()=>new eT.SJI),c=(0,eR.H)(eT.mTL,e);return eD.useEffect(()=>{let e=o.current;e&&(e.setBuffer(c),e.setRefDistance(t),e.setLoop(r),i&&!e.isPlaying&&e.play())},[c,s,t,r]),eD.useEffect(()=>{let e=o.current;return s.add(l),()=>{s.remove(l),e&&(e.isPlaying&&e.stop(),e.source&&e.source._connected&&e.disconnect())}},[]),eD.createElement("positionalAudio",(0,eS.Z)({ref:o,args:[l]},n))});var oG=r(32760),oN=r(11257);let oH=eD.forwardRef(({sdfGlyphSize:e=64,anchorX:t="center",anchorY:r="middle",font:i,fontSize:n=1,children:a,characters:o,onSync:s,...l},c)=>{let u=(0,eR.D)(({invalidate:e})=>e),[h]=eD.useState(()=>new oG.xv),[A,d]=eD.useMemo(()=>{let e=[],t="";return eD.Children.forEach(a,r=>{"string"==typeof r||"number"==typeof r?t+=r:e.push(r)}),[e,t]},[a]);return(0,oN.Rq)(()=>new Promise(e=>(0,oG.C5)({font:i,characters:o},e)),["troika-text",i,o]),eD.useLayoutEffect(()=>void h.sync(()=>{u(),s&&s(h)})),eD.useEffect(()=>()=>h.dispose(),[h]),eD.createElement("primitive",(0,eS.Z)({object:h,ref:c,font:i,text:d,anchorX:t,anchorY:r,fontSize:n,sdfGlyphSize:e},l),A)});class oj extends eT.O7d{constructor(e,t={}){let{bevelEnabled:r=!1,bevelSize:i=8,bevelThickness:n=10,font:a,height:o=50,size:s=100,lineHeight:l=1,letterSpacing:c=0,...u}=t;void 0===a?super():super(a.generateShapes(e,s,{lineHeight:l,letterSpacing:c}),{...u,bevelEnabled:r,bevelSize:i,bevelThickness:n,depth:o}),this.type="TextGeometry"}}function oJ(e,t){if(t===eT.WwZ)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==eT.z$h&&t!==eT.UlW)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;{let r=e.getIndex();if(null===r){let t=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<i.count;e++)t.push(e);e.setIndex(t),r=e.getIndex()}let i=r.count-2,n=[];if(r){if(t===eT.z$h)for(let e=1;e<=i;e++)n.push(r.getX(0)),n.push(r.getX(e)),n.push(r.getX(e+1));else for(let e=0;e<i;e++)e%2==0?(n.push(r.getX(e)),n.push(r.getX(e+1)),n.push(r.getX(e+2))):(n.push(r.getX(e+2)),n.push(r.getX(e+1)),n.push(r.getX(e)))}n.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let a=e.clone();return a.setIndex(n),a.clearGroups(),a}}function oV(e,t=Math.PI/3){let r=Math.cos(t),i=(1+1e-10)*100,n=[new eT.Pa4,new eT.Pa4,new eT.Pa4],a=new eT.Pa4,o=new eT.Pa4,s=new eT.Pa4,l=new eT.Pa4;function c(e){let t=~~(e.x*i),r=~~(e.y*i),n=~~(e.z*i);return`${t},${r},${n}`}let u=e.index?e.toNonIndexed():e,h=u.attributes.position,A={};for(let e=0,t=h.count/3;e<t;e++){let t=3*e,r=n[0].fromBufferAttribute(h,t+0),i=n[1].fromBufferAttribute(h,t+1),s=n[2].fromBufferAttribute(h,t+2);a.subVectors(s,i),o.subVectors(r,i);let l=new eT.Pa4().crossVectors(a,o).normalize();for(let e=0;e<3;e++){let t=c(n[e]);t in A||(A[t]=[]),A[t].push(l)}}let d=new Float32Array(3*h.count),m=new eT.TlE(d,3,!1);for(let e=0,t=h.count/3;e<t;e++){let t=3*e,i=n[0].fromBufferAttribute(h,t+0),u=n[1].fromBufferAttribute(h,t+1),d=n[2].fromBufferAttribute(h,t+2);a.subVectors(d,u),o.subVectors(i,u),s.crossVectors(a,o).normalize();for(let e=0;e<3;e++){let i=A[c(n[e])];l.set(0,0,0);for(let e=0,t=i.length;e<t;e++){let t=i[e];s.dot(t)>r&&l.add(t)}l.normalize(),m.setXYZ(t+e,l.x,l.y,l.z)}}return u.setAttribute("normal",m),u}var oK=Object.defineProperty,oY=(e,t,r)=>t in e?oK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,oW=(e,t,r)=>(oY(e,"symbol"!=typeof t?t+"":t,r),r);class oq extends eT.aNw{constructor(e){super(e)}load(e,t,r,i){let n=new eT.hH6(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(e,e=>{if("string"!=typeof e)throw Error("unsupported data type");let r=JSON.parse(e),i=this.parse(r);t&&t(i)},r,i)}loadAsync(e,t){return super.loadAsync(e,t)}parse(e){return new oX(e)}}class oX{constructor(e){oW(this,"data"),oW(this,"isFont",!0),oW(this,"type","Font"),this.data=e}generateShapes(e,t=100,r){let i=[],n={letterSpacing:0,lineHeight:1,...r},a=function(e,t,r,i){let n=Array.from(e),a=t/r.resolution,o=(r.boun
469dingBox.yMax-r.boundingBox.yMin+r.underlineThickness)*a,s=[],l=0,c=0;for(let e=0;e<n.length;e++){let t=n[e];if("\n"===t)l=0,c-=o*i.lineHeight;else{let e=function(e,t,r,i,n){let a,o,s,l,c,u,h,A;let d=n.glyphs[e]||n.glyphs["?"];if(!d){console.error('THREE.Font: character "'+e+'" does not exists in font family '+n.familyName+".");return}let m=new eT.T_1;if(d.o){let e=d._cachedOutline||(d._cachedOutline=d.o.split(" "));for(let n=0,d=e.length;n<d;)switch(e[n++]){case"m":a=parseInt(e[n++])*t+r,o=parseInt(e[n++])*t+i,m.moveTo(a,o);break;case"l":a=parseInt(e[n++])*t+r,o=parseInt(e[n++])*t+i,m.lineTo(a,o);break;case"q":s=parseInt(e[n++])*t+r,l=parseInt(e[n++])*t+i,c=parseInt(e[n++])*t+r,u=parseInt(e[n++])*t+i,m.quadraticCurveTo(c,u,s,l);break;case"b":s=parseInt(e[n++])*t+r,l=parseInt(e[n++])*t+i,c=parseInt(e[n++])*t+r,u=parseInt(e[n++])*t+i,h=parseInt(e[n++])*t+r,A=parseInt(e[n++])*t+i,m.bezierCurveTo(c,u,h,A,s,l)}}return{offsetX:d.ha*t,path:m}}(t,a,l,c,r);e&&(l+=e.offsetX+i.letterSpacing,s.push(e.path))}}return s}(e,t,this.data,n);for(let e=0,t=a.length;e<t;e++)Array.prototype.push.apply(i,a[e].toShapes(!1));return i}}let oZ=null;async function o$(e){return"string"==typeof e?await (await fetch(e)).json():e}async function o1(e){var t;return t=await o$(e),oZ||(oZ=new oq),oZ.parse(t)}function o0(e){return(0,oN.Rq)(o1,[e])}o0.preload=e=>(0,oN.MA)(o1,[e]),o0.clear=e=>(0,oN.ZH)([e]);let o2=["string","number"],o3=e=>{let t="",r=[];return eD.Children.forEach(e,e=>{o2.includes(typeof e)?t+=e+"":r.push(e)}),[t,...r]},o4=eD.forwardRef(({font:e,letterSpacing:t=0,lineHeight:r=1,size:i=1,height:n=.2,bevelThickness:a=.1,bevelSize:o=.01,bevelEnabled:s=!1,bevelOffset:l=0,bevelSegments:c=4,curveSegments:u=8,smooth:h,children:A,...d},m)=>{eD.useMemo(()=>(0,eR.e)({RenamedTextGeometry:oj}),[]);let f=eD.useRef(null),p=o0(e),g=(0,eD.useMemo)(()=>({font:p,size:i,height:n,bevelThickness:a,bevelSize:o,bevelEnabled:s,bevelSegments:c,bevelOffset:l,curveSegments:u,letterSpacing:t,lineHeight:r}),[p,i,n,a,o,s,c,l,u,t,r]),[y,...v]=(0,eD.useMemo)(()=>o3(A),[A]),E=eD.useMemo(()=>[y,g],[y,g]);return eD.useLayoutEffect(()=>{h&&(f.current.geometry=function(e,t=1e-4){t=Math.max(t,Number.EPSILON);let r={},i=e.getIndex(),n=e.getAttribute("position"),a=i?i.count:n.count,o=0,s=Object.keys(e.attributes),l={},c={},u=[],h=["getX","getY","getZ","getW"];for(let t=0,r=s.length;t<r;t++){let r=s[t];l[r]=[];let i=e.morphAttributes[r];i&&(c[r]=Array(i.length).fill(0).map(()=>[]))}let A=Math.pow(10,Math.log10(1/t));for(let t=0;t<a;t++){let n=i?i.getX(t):t,a="";for(let t=0,r=s.length;t<r;t++){let r=s[t],i=e.getAttribute(r),o=i.itemSize;for(let e=0;e<o;e++)a+=`${~~(i[h[e]](n)*A)},`}if(a in r)u.push(r[a]);else{for(let t=0,r=s.length;t<r;t++){let r=s[t],i=e.getAttribute(r),a=e.morphAttributes[r],o=i.itemSize,u=l[r],A=c[r];for(let e=0;e<o;e++){let t=h[e];if(u.push(i[t](n)),a)for(let e=0,r=a.length;e<r;e++)A[e].push(a[e][t](n))}}r[a]=o,u.push(o),o++}}let d=e.clone();for(let t=0,r=s.length;t<r;t++){let r=s[t],i=e.getAttribute(r),n=new i.array.constructor(l[r]),a=new eT.TlE(n,i.itemSize,i.normalized);if(d.setAttribute(r,a),r in c)for(let t=0;t<c[r].length;t++){let i=e.morphAttributes[r][t],n=new i.array.constructor(c[r][t]),a=new eT.TlE(n,i.itemSize,i.normalized);d.morphAttributes[r][t]=a}}return d.setIndex(u),d}(f.current.geometry,h),f.current.geometry.computeVertexNormals())},[E,h]),eD.useImperativeHandle(m,()=>f.current,[]),eD.createElement("mesh",(0,eS.Z)({},d,{ref:f}),eD.createElement("renamedTextGeometry",{args:E}),v)}),o5={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
470    varying vec2 vUv;
471
472    void main() {
473
474    	vUv = uv;
475    	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
476
477    }
478  `,fragmentShader:`
479    uniform float opacity;
480
481    uniform sampler2D tDiffuse;
482
483    varying vec2 vUv;
484
485    void main() {
486
487    	vec4 texel = texture2D( tDiffuse, vUv );
488    	gl_FragColor = opacity * texel;
489
490    }
491  `};var o6=Object.defineProperty,o8=(e,t,r)=>t in e?o6(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,o9=(e,t,r)=>(o8(e,"symbol"!=typeof t?t+"":t,r),r);class o7{constructor(){o9(this,"enabled",!0),o9(this,"needsSwap",!0),o9(this,"clear",!1),o9(this,"renderToScreen",!1)}setSize(e,t){}render(e,t,r,i,n){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}class se{constructor(e){o9(this,"camera",new eT.iKG(-1,1,1,-1,0,1)),o9(this,"geometry",new eT._12(2,2)),o9(this,"mesh"),this.mesh=new eT.Kj0(this.geometry,e)}get material(){return this.mesh.material}set material(e){this.mesh.material=e}dispose(){this.mesh.geometry.dispose()}render(e){e.render(this.mesh,this.camera)}}var st=Object.defineProperty,sr=(e,t,r)=>t in e?st(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,si=(e,t,r)=>(sr(e,"symbol"!=typeof t?t+"":t,r),r);class sn extends o7{constructor(e,t="tDiffuse"){super(),si(this,"textureID"),si(this,"uniforms"),si(this,"material"),si(this,"fsQuad"),this.textureID=t,e instanceof eT.jyz?(this.uniforms=e.uniforms,this.material=e):(this.uniforms=eT.rDY.clone(e.uniforms),this.material=new eT.jyz({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new se(this.material)}render(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}dispose(){this.fsQuad.dispose(),this.material.dispose()}}var sa=Object.defineProperty,so=(e,t,r)=>t in e?sa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ss=(e,t,r)=>(so(e,"symbol"!=typeof t?t+"":t,r),r);class sl extends o7{constructor(e,t){super(),ss(this,"scene"),ss(this,"camera"),ss(this,"inverse"),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,r){let i,n;let a=e.getContext(),o=e.state;o.buffers.color.setMask(!1),o.buffers.depth.setMask(!1),o.buffers.color.setLocked(!0),o.buffers.depth.setLocked(!0),this.inverse?(i=0,n=1):(i=1,n=0),o.buffers.stencil.setTest(!0),o.buffers.stencil.setOp(a.REPLACE,a.REPLACE,a.REPLACE),o.buffers.stencil.setFunc(a.ALWAYS,i,4294967295),o.buffers.stencil.setClear(n),o.buffers.stencil.setLocked(!0),e.setRenderTarget(r),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),o.buffers.color.setLocked(!1),o.buffers.depth.setLocked(!1),o.buffers.stencil.setLocked(!1),o.buffers.stencil.setFunc(a.EQUAL,1,4294967295),o.buffers.stencil.setOp(a.KEEP,a.KEEP,a.KEEP),o.buffers.stencil.setLocked(!0)}}class sc extends o7{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}var su=Object.defineProperty,sh=(e,t,r)=>t in e?su(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,sA=(e,t,r)=>(sh(e,"symbol"!=typeof t?t+"":t,r),r);class sd{constructor(e,t){if(sA(this,"renderer"),sA(this,"_pixelRatio"),sA(this,"_width"),sA(this,"_height"),sA(this,"renderTarget1"),sA(this,"renderTarget2"),sA(this,"writeBuffer"),sA(this,"readBuffer"),sA(this,"renderToScreen"),sA(this,"passes",[]),sA(this,"copyPass"),sA(this,"clock"),this.renderer=e,void 0===t){let r={minFilter:eT.wem,magFilter:eT.wem,format:eT.wk1},i=e.getSize(new eT.FM8);this._pixelRatio=e.getPixelRatio(),this._width=i.width,this._height=i.height,(t=new eT.dd2(this._width*this._pixelRatio,this._height*this._pixelRatio,r)).texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,void 0===o5&&console.error("THREE.EffectComposer relies on CopyShader"),void 0===sn&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new sn(o5),this.copyPass.material.blending=eT.
491jFi,this.clock=new eT.SUY}swapBuffers(){let e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){let t=this.passes.indexOf(e);-1!==t&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){void 0===e&&(e=this.clock.getDelta());let t=this.renderer.getRenderTarget(),r=!1,i=this.passes.length;for(let t=0;t<i;t++){let i=this.passes[t];if(!1!==i.enabled){if(i.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(t),i.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),i.needsSwap){if(r){let t=this.renderer.getContext(),r=this.renderer.state.buffers.stencil;r.setFunc(t.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),r.setFunc(t.EQUAL,1,4294967295)}this.swapBuffers()}void 0!==sl&&(i instanceof sl?r=!0:i instanceof sc&&(r=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(void 0===e){let t=this.renderer.getSize(new eT.FM8);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;let r=this._width*this._pixelRatio,i=this._height*this._pixelRatio;this.renderTarget1.setSize(r,i),this.renderTarget2.setSize(r,i);for(let e=0;e<this.passes.length;e++)this.passes[e].setSize(r,i)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}var sm=Object.defineProperty,sf=(e,t,r)=>t in e?sm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,sp=(e,t,r)=>(sf(e,"symbol"!=typeof t?t+"":t,r),r);class sg extends o7{constructor(e,t,r,i,n=0){super(),sp(this,"scene"),sp(this,"camera"),sp(this,"overrideMaterial"),sp(this,"clearColor"),sp(this,"clearAlpha"),sp(this,"clearDepth",!1),sp(this,"_oldClearColor",new eT.Ilk),this.scene=e,this.camera=t,this.overrideMaterial=r,this.clearColor=i,this.clearAlpha=n,this.clear=!0,this.needsSwap=!1}render(e,t,r){let i,n=e.autoClear;e.autoClear=!1;let a=null;void 0!==this.overrideMaterial&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),i=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,i),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=a),e.autoClear=n}}let sy={uniforms:{tDiffuse:{value:null}},vertexShader:`
492    varying vec2 vUv;
493
494    void main() {
495
496    	vUv = uv;
497    	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
498
499    }
500  `,fragmentShader:`
501    uniform sampler2D tDiffuse;
502
503    varying vec2 vUv;
504
505    void main() {
506
507    	vec4 tex = texture2D( tDiffuse, vUv );
508
509    	#ifdef LinearTosRGB
510    		gl_FragColor = LinearTosRGB( tex );
511    	#else
512    		gl_FragColor = sRGBTransferOETF( tex );
513    	#endif
514
515    }
516  `},sv=()=>{try{var e=document.createElement("canvas");return!!(window.WebGL2RenderingContext&&e.getContext("webgl2"))}catch(e){return!1}},sE=eD.forwardRef(({children:e,multisamping:t=8,renderIndex:r=1,disableRender:i,disableGamma:n,disableRenderPass:a,depthBuffer:o=!0,stencilBuffer:s=!1,anisotropy:l=1,encoding:c,type:u,...h},A)=>{eD.useMemo(()=>(0,eR.e)({EffectComposer:sd,RenderPass:sg,ShaderPass:sn}),[]);let d=eD.useRef(null);eD.useImperativeHandle(A,()=>d.current,[]);let{scene:m,camera:f,gl:p,size:g,viewport:y}=(0,eR.D)(),[v]=eD.useState(()=>{let e=new eT.dd2(g.width,g.height,{type:u||eT.cLu,format:eT.wk1,depthBuffer:o,stencilBuffer:s,anisotropy:l});return u===eT.ywz&&null!=c&&("colorSpace"in e?e.texture.colorSpace
516=c:e.texture.encoding=c),e.samples=t,e});eD.useEffect(()=>{var e,t;null==(e=d.current)||e.setSize(g.width,g.height),null==(t=d.current)||t.setPixelRatio(y.dpr)},[p,g,y.dpr]),(0,eR.F)(()=>{var e;i||null==(e=d.current)||e.render()},r);let E=[];return a||E.push(eD.createElement("renderPass",{key:"renderpass",attach:`passes-${E.length}`,args:[m,f]})),n||E.push(eD.createElement("shaderPass",{attach:`passes-${E.length}`,key:"gammapass",args:[sy]})),eD.Children.forEach(e,e=>{e&&E.push(eD.cloneElement(e,{key:E.length,attach:`passes-${E.length}`}))}),eD.createElement("effectComposer",(0,eS.Z)({ref:d,args:[p,v]},h),E)}),sx=((q={}).Linear="linear",q.Radial="radial",q);function sC({stops:e,colors:t,size:r=1024,width:i=16,type:n=sx.Linear,innerCircleRadius:a=0,outerCircleRadius:o="auto",...s}){let l=(0,eR.D)(e=>e.gl),c=eD.useMemo(()=>{let s;let l=document.createElement("canvas"),c=l.getContext("2d");if(l.width=i,l.height=r,n===sx.Linear)s=c.createLinearGradient(0,0,0,r);else{let e=l.width/2,t=l.height/2,r="auto"!==o?Math.abs(Number(o)):Math.sqrt(e**2+t**2);s=c.createRadialGradient(e,t,Math.abs(a),e,t,r)}let u=new eT.Ilk,h=e.length;for(;h--;)s.addColorStop(e[h],u.set(t[h]).getStyle());return c.save(),c.fillStyle=s,c.fillRect(0,0,i,r),c.restore(),l},[e]);return eD.createElement("canvasTexture",(0,eS.Z)({colorSpace:l.outputColorSpace,args:[c],attach:"map"},s))}function sw(e,t,r,i){let n=class extends eT.jyz{constructor(n={}){let a=Object.entries(e);super({uniforms:a.reduce((e,[t,r])=>{let i=eT.rDY.clone({[t]:{value:r}});return{...e,...i}},{}),vertexShader:t,fragmentShader:r}),this.key="",a.forEach(([e])=>Object.defineProperty(this,e,{get:()=>this.uniforms[e].value,set:t=>this.uniforms[e].value=t})),Object.assign(this,n),i&&i(this)}};return n.key=eT.M8C.generateUUID(),n}var sB=r(79257),sI=r(24573);let s_=sw({color:new eT.Ilk("white"),scale:new eT.FM8(1,1),imageBounds:new eT.FM8(1,1),resolution:1024,map:null,zoom:1,radius:0,grayscale:0,opacity:1},`
517  varying vec2 vUv;
518  varying vec2 vPos;
519  void main() {
520    gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.);
521    vUv = uv;
522    vPos = position.xy;
523  }
524`,`
525  // mostly from https://gist.github.com/statico/df64c5d167362ecf7b34fca0b1459a44
526  varying vec2 vUv;
527  varying vec2 vPos;
528  uniform vec2 scale;
529  uniform vec2 imageBounds;
530  uniform float resolution;
531  uniform vec3 color;
532  uniform sampler2D map;
533  uniform float radius;
534  uniform float zoom;
535  uniform float grayscale;
536  uniform float opacity;
537  const vec3 luma = vec3(.299, 0.587, 0.114);
538  vec4 toGrayscale(vec4 color, float intensity) {
539    return vec4(mix(color.rgb, vec3(dot(color.rgb, luma)), intensity), color.a);
540  }
541  vec2 aspect(vec2 size) {
542    return size / min(size.x, size.y);
543  }
544  
545  const float PI = 3.14159265;
546    
547  // from https://iquilezles.org/articles/distfunctions
548  float udRoundBox( vec2 p, vec2 b, float r ) {
549    return length(max(abs(p)-b+r,0.0))-r;
550  }
551
552  void main() {
553    vec2 s = aspect(scale);
554    vec2 i = aspect(imageBounds);
555    float rs = s.x / s.y;
556    float ri = i.x / i.y;
557    vec2 new = rs < ri ? vec2(i.x * s.y / i.y, s.y) : vec2(s.x, i.y * s.x / i.x);
558    vec2 offset = (rs < ri ? vec2((new.x - s.x) / 2.0, 0.0) : vec2(0.0, (new.y - s.y) / 2.0)) / new;
559    vec2 uv = vUv * s / new + offset;
560    vec2 zUv = (uv - vec2(0.5, 0.5)) / zoom + vec2(0.5, 0.5);
561
562    vec2 res = vec2(scale * resolution);
563    vec2 halfRes = 0.5 * res;
564    float b = udRoundBox(vUv.xy * res - halfRes, halfRes, resolution * radius);    
565	  vec3 a = mix(vec3(1.0,0.0,0.0), vec3(0.0,0.0,0.0), smoothstep(0.0, 1.0, b));
566    gl_FragColor = toGrayscale(texture2D(map, zUv) * vec4(color, opacity * a), grayscale);
567    
568    #include <tonemapping_fragment>
569    #include <${sI.i>=154?"colorspace_fragment":"encodings_fragment"}>
570  }
571`),sb=eD.forwardRef(({children:e,color:t,segments:r=1,scale:i=1,zoom:n=1,grayscale:a=0,opacity:o=1,radius:s=0,texture:l,toneMapped:c,transparent:u,side:h,...A},d)=>{(0,eR.e)({ImageMaterial:s_});let m=eD.useRef(null),f=(0,eR.D)(e=>e.size),p=Array.isArray(i)?[i[0],i[1]]:[i,i],g=[l.image.width,l.image.height],y=Math.max(f.width,f.height);return eD.useImperativeHandle(d,()=>m.current,[]),eD.useLayoutEffect(()=>{m.current.geometry.parameters&&m.current.material.scale.set(p[0]
571*m.current.geometry.parameters.width,p[1]*m.current.geometry.parameters.height)},[p[0],p[1]]),eD.createElement("mesh",(0,eS.Z)({ref:m,scale:Array.isArray(i)?[...i,1]:i},A),eD.createElement("planeGeometry",{args:[1,1,r,r]}),eD.createElement("imageMaterial",{color:t,map:l,zoom:n,grayscale:a,opacity:o,scale:p,imageBounds:g,resolution:y,radius:s,toneMapped:c,transparent:u,side:h,key:s_.key}),e)}),sM=eD.forwardRef(({url:e,...t},r)=>{let i=(0,sB.mE)(e);return eD.createElement(sb,(0,eS.Z)({},t,{texture:i,ref:r}))}),sS=eD.forwardRef(({url:e,...t},r)=>eD.createElement(sb,(0,eS.Z)({},t,{ref:r}))),sD=eD.forwardRef((e,t)=>{if(e.url)return eD.createElement(sM,(0,eS.Z)({},e,{ref:t}));if(e.texture)return eD.createElement(sS,(0,eS.Z)({},e,{ref:t}));throw Error("<Image /> requires a url or texture")}),sP=eD.forwardRef(({threshold:e=15,geometry:t,...r},i)=>{let n=eD.useRef(null);eD.useImperativeHandle(i,()=>n.current,[]);let a=eD.useMemo(()=>[0,0,0,1,0,0],[]),o=eD.useRef(),s=eD.useRef();return eD.useLayoutEffect(()=>{let r=n.current.parent,i=null!=t?t:null==r?void 0:r.geometry;if(!i||o.current===i&&s.current===e)return;o.current=i,s.current=e;let a=new eT.TOt(i,e).attributes.position.array;n.current.geometry.setPositions(a),n.current.geometry.attributes.instanceStart.needsUpdate=!0,n.current.geometry.attributes.instanceEnd.needsUpdate=!0,n.current.computeLineDistances()}),eD.createElement(oQ,(0,eS.Z)({segments:!0,points:a,ref:n,raycast:()=>null},r))}),sT=sw({screenspace:!1,color:new eT.Ilk("black"),opacity:1,thickness:.05,size:new eT.FM8},`#include <common>
572   #include <morphtarget_pars_vertex>
573   #include <skinning_pars_vertex>
574   #include <clipping_planes_pars_vertex>
575   uniform float thickness;
576   uniform bool screenspace;
577   uniform vec2 size;
578   void main() {
579     #if defined (USE_SKINNING)
580	     #include <beginnormal_vertex>
581       #include <morphnormal_vertex>
582       #include <skinbase_vertex>
583       #include <skinnormal_vertex>
584       #include <defaultnormal_vertex>
585     #endif
586     #include <begin_vertex>
587	   #include <morphtarget_vertex>
588	   #include <skinning_vertex>
589     #include <project_vertex>
590     #include <clipping_planes_vertex>
591     vec4 tNormal = vec4(normal, 0.0);
592     vec4 tPosition = vec4(transformed, 1.0);
593     #ifdef USE_INSTANCING
594       tNormal = instanceMatrix * tNormal;
595       tPosition = instanceMatrix * tPosition;
596     #endif
597     if (screenspace) {
598       vec3 newPosition = tPosition.xyz + tNormal.xyz * thickness;
599       gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0
599); 
600     } else {
601       vec4 clipPosition = projectionMatrix * modelViewMatrix * tPosition;
602       vec4 clipNormal = projectionMatrix * modelViewMatrix * tNormal;
603       vec2 offset = normalize(clipNormal.xy) * thickness / size * clipPosition.w * 2.0;
604       clipPosition.xy += offset;
605       gl_Position = clipPosition;
606     }
607   }`,`uniform vec3 color;
608   uniform float opacity;
609   #include <clipping_planes_pars_fragment>
610   void main(){
611     #include <clipping_planes_fragment>
612     gl_FragColor = vec4(color, opacity);
613     #include <tonemapping_fragment>
614     #include <${sI.i>=154?"colorspace_fragment":"encodings_fragment"}>
615   }`);function sR({color:e="black",opacity:t=1,transparent:r=!1,screenspace:i=!1,toneMapped:n=!0,polygonOffset:a=!1,polygonOffsetFactor:o=0,renderOrder:s=0,thickness:l=.05,angle:c=Math.PI,clippingPlanes:u,...h}){let A=eD.useRef(),[d]=eD.useState(()=>new sT({side:eT._Li})),{gl:m}=(0,eR.D)(),f=m.getDrawingBufferSize(new eT.FM8);eD.useMemo(()=>(0,eR.e)({OutlinesMaterial:sT}),[]);let p=eD.useRef(0),g=eD.useRef();return eD.useLayoutEffect(()=>{let e=A.current;if(!e)return;let t=e.parent;if(t&&t.geometry&&(p.current!==c||g.current!==t.geometry)){var r;p.current=c,g.current=t.geometry;let i=null==(r=e.children)?void 0:r[0];i&&(c&&i.geometry.dispose(),e.remove(i)),t.skeleton?((i=new eT.TUv).material=d,i.bind(t.skeleton,t.bindMatrix)):t.isInstancedMesh?(i=new eT.SPe(t.geometry,d,t.count)).instanceMatrix=t.instanceMatrix:(i=new eT.Kj0).material=d,e.add(i),i.geometry=c?oV(t.geometry,c):t.geometry,i.morphTargetInfluences=t.morphTargetInfluences,i.morphTargetDictionary=t.morphTargetDictionary}}),eD.useLayoutEffect(()=>{let c=A.current;if(!c)return;let h=c.children[0];if(h){h.renderOrder=s;let A=c.parent;(0,eR.k)(h,{morphTargetInfluences:A.morphTargetInfluences,morphTargetDictionary:A.morphTargetDictionary}),(0,eR.k)(h.material,{transparent:r,thickness:l,color:e,opacity:t,size:f,screenspace:i,toneMapped:n,polygonOffset:a,polygonOffsetFactor:o,clippingPlanes:u,clipping:u&&u.length>0})}}),eD.useEffect(()=>()=>{let e=A.current;if(!e)return;let t=e.children[0];t&&(c&&t.geometry.dispose(),e.remove(t))},[]),eD.createElement("group",(0,eS.Z)({ref:A},h))}var sF=Object.defineProperty,sQ=(e,t,r)=>t in e?sF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,sz=(e,t,r)=>(sQ(e,"symbol"!=typeof t?t+"":t,r),r);function sk(e,t,r,i,n){let a;if(e=e.subarray||e.slice?e:e.buffer,r=r.subarray||r.slice?r:r.buffer,e=t?e.subarray?e.subarray(t,n&&t+n):e.slice(t,n&&t+n):e,r.set)r.set(e,i);else for(a=0;a<e.length;a++)r[a+i]=e[a];return r}class sL extends eT.u9r{constructor(){super(),sz(this,"type","MeshLine"),sz(this,"isMeshLine",!0),sz(this,"positions",[]),sz(this,"previous",[]),sz(this,"next",[]),sz(this,"side",[]),sz(this,"width",[]),sz(this,"indices_array",[]),sz(this,"uvs",[]),sz(this,"counters",[]),sz(this,"widthCallback",null),sz(this,"_attributes"),sz(this,"_points",[]),sz(this,"points"),sz(this,"matrixWorld",new eT.yGw),Object.defineProperties(this,{points:{enumerable:!0,get(){return this._points},set(e){this.setPoints(e,this.widthCallback)}}})}setMatrixWorld(e){this.matrixWorld=e}setPoints(e,t){var r;if(e=(r=e)instanceof Float32Array?r:r instanceof eT.u9r?r.getAttribute("position").array:r.map(e=>{let t=Array.isArray(e);return e instanceof eT.Pa4?[e.x,e.y,e.z]:e instanceof eT.FM8?[e.x,e.y,0]:t&&3===e.length?[e[0],e[1],e[2]]:t&&2===e.length?[e[0],e[1],0]:e}).flat(),this._points=e,this.widthCallback=null!=t?t:null,this.positions=[],this.counters=[],e.length&&e[0]instanceof eT.Pa4)for(let t=0;t<e.length;t++){let r=e[t],i=t/(e.length-1);this.positions.push(r.x,r.y,r.z),this.positions.push(r.x,r.y,r.z),this.counters.push(i),this.counters.push(i)}else for(let t=0;t<e.length;t+=3){let r=t/(e.length-1);this.positions.push(e[t],e[t+1],e[t+2]),this.positions.push(e[t],e[t+1],e[t+2]),this.counters.push(r),this.counters.push(r)}this.process()}compareV3(e,t){let r=6*e,i=6*t;return this.positions[r]===this.positions[i]&&this.positions[r+1]===this.positions[i+1]&&this.positions[r+2]===this.positions[i+2]}copyV3(e){let t=6*e;return[this.positions[t],this.positions[t+1],this.positions[t+2]]}process(){let e,t;let r=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],t=this.compareV3(0,r-1)?this.copyV3(r-2):this.copyV3(0),this.previous.push(t[0],t[1],t[2]),this.previous.push(t[0],t[1],t[2]);for(let i=0;i<r;i++){if(this.side.push(1),this.side.push(-1),e=this.widthCallback?this.widthCallback(i/(r-1)):1,this.width.push(e),this.width.push(e),this.uvs.push(i/(r-1),0),this.uvs.push(i/(r-1),1),i<r-1){t=this.copyV3(i),this.previous.push(t[0],t[1],t[2]),this.previous.push(t[0],t[1],t[2]);let e=2*i;this.indices_array.push(e,e+1,e+2),this.indices_array.push(e+2,e+1,e+3)}i>0&&(t=this.copyV3(i),this.next.push(t[0],t[1],t[2]),this.next.push(t[0],t[1],t[2]))}t=this.compareV3(r-1,0)?this.copyV3(1):this.copyV3(r-1),this.next.push(t[0],t[1],t[2]),this.next.push(t[0],t[1],t[2]),this._attributes&&this._attributes.position.count===this.counters.length?(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0):this._attributes={position:new eT.TlE(new Float32Array(this.positions),3),previous:new eT.TlE(new Float32Array(this.previous),3),next:new eT.TlE(new Float32Array(this.next),3),side:new eT.TlE(new Float32Array(this.side),1),width:new eT.TlE(new Float32Array(this.width),1),uv:new eT.TlE(new Float32Array(this.uvs),2),index:new eT.TlE(new Uint16Array(this.indices_array),1),counters:new eT.TlE(new Float32Array(this.counters),1)},this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()}advance({x:e,y:t,z:r}){let i=this._attributes.position.array,n=this._attributes.previous.array,a=this._attributes.next.array,o=i.length;sk(i,0,n,0,o),sk(i,6,i,0,o-6),i[o-6]=e,i[o-5]=t,i[o-4]=r,i[o-3]=e,i[o-2]=t,i[o-1]=r,sk(i,6,a,0,o-6),a[o-6]=e,a[o-5]=t,a[o-4]=r,a[o-3]=e,a[o-2]=t,a[o-1]=r,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0}}let sO=`
616  #include <common>
617  #include <logdepthbuf_pars_vertex>
618  #include <fog_pars_vertex>
619  #include <clipping_planes_pars_vertex>
620
621  attribute vec3 previous;
622  attribute vec3 next;
623  attribute float side;
624  attribute float width;
625  attribute float counters;
626  
627  uniform vec2 resolution;
628  uniform float lineWidth;
629  uniform vec3 color;
630  uniform float opacity;
631  uniform float sizeAttenuation;
632  
633  varying vec2 vUV;
634  varying vec4 vColor;
635  varying float vCounters;
636  
637  vec2 fix(vec4 i, float aspect) {
638    vec2 res = i.xy / i.w;
639    res.x *= aspect;
640    return res;
641  }
642  
643  void main() {
644    float aspect = resolution.x / resolution.y;
645    vColor = vec4(color, opacity);
646    vUV = uv;
647    vCounters = counters;
648  
649    mat4 m = projectionMatrix * modelViewMatrix;
650    vec4 finalPosition = m * vec4(position, 1.0) * aspect;
651    vec4 prevPos = m * vec4(previous, 1.0);
652    vec4 nextPos = m * vec4(next, 1.0);
653  
654    vec2 currentP = fix(finalPosition, aspect);
655    vec2 prevP = fix(prevPos, aspect);
656    vec2 nextP = fix(nextPos, aspect);
657  
658    float w = lineWidth * width;
659  
660    vec2 dir;
661    if (nextP == currentP) dir = normalize(currentP - prevP);
662    else if (prevP == currentP) dir = normalize(nextP - currentP);
663    else {
664      vec2 dir1 = normalize(currentP - prevP);
665      vec2 dir2 = normalize(nextP - currentP);
666      dir = normalize(dir1 + dir2);
667  
668      vec2 perp = vec2(-dir1.y, dir1.x);
669      vec2 miter = vec2(-dir.y, dir.x);
670      //w = clamp(w / dot(miter, perp), 0., 4. * lineWidth * width);
671    }
672  
673    //vec2 normal = (cross(vec3(dir, 0.), vec3(0., 0., 1.))).xy;
674    vec4 normal = vec4(-dir.y, dir.x, 0., 1.);
675    normal.xy *= .5 * w;
676    //normal *= projectionMatrix;
677    if (sizeAttenuation == 0.) {
678      normal.xy *= finalPosition.w;
679      normal.xy /= (vec4(resolution, 0., 1.) * projectionMatrix).xy * aspect;
680    }
681  
682    finalPosition.xy += normal.xy * side;
683    gl_Position = finalPosition;
684    #include <logdepthbuf_vertex>
685    #include <fog_vertex>
686    vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
687    #include <clipping_planes_vertex>
688    #include <fog_vertex>
689  }
690`,sU=parseInt(eT.UZH.replace(/\D+/g,"")),sG=`
691  #include <fog_pars_fragment>
692  #include <logdepthbuf_pars_fragment>
693  #include <clipping_planes_pars_fragment>
694  
695  uniform sampler2D map;
696  uniform sampler2D alphaMap;
697  uniform float useGradient;
698  uniform float useMap;
699  uniform float useAlphaMap;
700  uniform float useDash;
701  uniform float dashArray;
702  uniform float dashOffset;
703  uniform float dashRatio;
704  uniform float visibility;
705  uniform float alphaTest;
706  uniform vec2 repeat;
707  uniform vec3 gradient[2];
708  
709  varying vec2 vUV;
710  varying vec4 vColor;
711  varying float vCounters;
712  
713  void main() {
714    #include <logdepthbuf_fragment>
715    vec4 diffuseColor = vColor;
716    if (useGradient == 1.) diffuseColor = vec4(mix(gradient[0], gradient[1], vCounters), 1.0);
717    if (useMap == 1.) diffuseColor *= texture2D(map, vUV * repeat);
718    if (useAlphaMap == 1.) diffuseColor.a *= texture2D(alphaMap, vUV * repeat).a;
719    if (diffuseColor.a < alphaTest) discard;
720    if (useDash == 1.) diffuseColor.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));
721    diffuseColor.a *= step(vCounters, visibility);
722    #include <clipping_planes_fragment>
723    gl_FragColor = diffuseColor;     
724    #include <fog_fragment>
725    #include <tonemapping_fragment>
726    #include <${sU>=154?"colorspace_fragment":"encodings_fragment"}>
727  }
728`;class sN extends eT.jyz{constructor(e){super({uniforms:{...aQ.UniformsLib.fog,lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new eT.Ilk(16777215)},gradient:{value:[new eT.Ilk(16711680),new eT.Ilk(65280)]},opacity:{value:1},resolution:{value:new eT.FM8(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},useGradient:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new eT.FM8(1,1)}},vertexShader:sO,fragmentShader:sG}),sz(this,"lineWidth"),sz(this,"map"),sz(this,"useMap"),sz(this,"alphaMap"),sz(this,"useAlphaMap"),sz(this,"color"),sz(this,"gradient"),sz(this,"resolution"),sz(this,"sizeAttenuation"),sz(this,"dashArray"),sz(this,"dashOffset"),sz(this,"dashRatio"),sz(this,"useDash"),sz(this,"useGradient"),sz(this,"visibility"),sz(this,"repeat"),this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get(){return this.uniforms.lineWidth.value},set(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get(){return this.uniforms.map.value},set(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get(){return this.uniforms.useMap.value},set(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get(){return this.uniforms.alphaMap.value},set(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get(){return this.uniforms.useAlphaMap.value},set(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get(){return this.uniforms.color.value},set(e){this.uniforms.color.value=e}},gradient:{enumerable:!0,get(){return this.uniforms.gradient.value},set(e){this.uniforms.gradient.value=e}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get(){return this.uniforms.sizeAttenuation.value},set(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get(){return this.uniforms.dashArray.value},set(e){this.uniforms.dashArray.value=e,this.useDash=0!==e?1:0}},dashOffset:{enumerable:!0,get(){return this.uniforms.dashOffset.value},set(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get(){return this.uniforms.dashRatio.value},set(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get(){return this.uniforms.useDash.value},set(e){this.uniforms.useDash.value=e}},useGradient:{enumerable:!0,get(){return this.uniforms.useGradient.value},set(e){this.uniforms.useGradient.value=e}},visibility:{enumerable:!0,get(){return this.uniforms.visibility.value},set(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get(){return this.uniforms.alphaTest.value},set(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get(){return this.uniforms.repeat.value},set(e){this.uniforms.repeat.value.copy(e)}}}),this.setValues(e)}copy(e){return super.copy(e),this.lineWidth=e.lineWidth,this.map=e.map,this.useMap=e.useMap,this.alphaMap=e.alphaMap,this.useAlphaMap=e.useAlphaMap,this.color.copy(e.color),this.gradient=e.gradient,this.opacity=e.opacity,this.resolution.copy(e.resolution),this.sizeAttenuation=e.sizeAttenuation,this.dashArray=e.dashArray,this.dashOffset=e.dashOffset,this.dashRatio=e.dashRatio,this.useDash=e.useDash,this.useGradient=e.useGradient,this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this}}let sH={width:.2,length:1,decay:1,local:!1,stride:0,interval:1},sj=(e,t=1)=>(e.set(e.subarray(t)),e.fill(-1/0,-t),e);function sJ(e,t){let{length:r,local:i,decay:n,interval:a,stride:o}={...sH,...t},s=eD.useRef(),[l]=eD.useState(()=>new eT.Pa4);eD.useLayoutEffect(()=>{e&&(s.current=Float32Array.from({length:30*r}
728,(t,r)=>e.position.getComponent(r%3)))},[r,e]);let c=eD.useRef(new eT.Pa4),u=eD.useRef(0);return(0,eR.F)(()=>{if(e&&s.current){if(0===u.current){let t;i?t=e.position:(e.getWorldPosition(l),t=l);let r=1*n;for(let e=0;e<r;e++)t.distanceTo(c.current)<o||(sj(s.current,3),s.current.set(t.toArray(),s.current.length-3));c.current.copy(t)}u.current++,u.current=u.current%a}}),s}let sV=eD.forwardRef((e,t)=>{let{children:r}=e,{width:i,length:n,decay:a,local:o,stride:s,interval:l}={...sH,...e},{color:c="hotpink",attenuation:u,target:h}=e,A=(0,eR.D)(e=>e.size),d=(0,eR.D)(e=>e.scene),m=eD.useRef(null),[f,p]=eD.useState(null),g=sJ(f,{length:n,decay:a,local:o,stride:s,interval:l});eD.useEffect(()=>{let e=(null==h?void 0:h.current)||m.current.children.find(e=>e instanceof eT.Tme);e&&p(e)},[g,h]);let y=eD.useMemo(()=>new sL,[]),v=eD.useMemo(()=>{var e;let t;let n=new sN({lineWidth:.1*i,color:c,sizeAttenuation:1,resolution:new eT.FM8(A.width,A.height)});return r&&(Array.isArray(r)?t=r.find(e=>"string"==typeof e.type&&"meshLineMaterial"===e.type):"string"==typeof r.type&&"meshLineMaterial"===r.type&&(t=r)),"object"==typeof(null==(e=t)?void 0:e.props)&&n.setValues(t.props),n},[i,c,A,r]);return eD.useEffect(()=>{v.uniforms.resolution.value.set(A.width,A.height)},[A]),(0,eR.F)(()=>{g.current&&y.setPoints(g.current,u)}),eD.createElement("group",null,(0,eR.h)(eD.createElement("mesh",{ref:t,geometry:y,material:v}),d),eD.createElement("group",{ref:m},r))}),sK=new eT.CJI,sY=new eT.Pa4;class sW{constructor(e){let t=e.geometry;t.index&&(console.warn("THREE.MeshSurfaceSampler: Converting geometry to non-indexed BufferGeometry."),t=t.toNonIndexed()),this.geometry=t,this.randomFunction=Math.random,this.positionAttribute=this.geometry.getAttribute("position"),this.colorAttribute=this.geometry.getAttribute("color"),this.weightAttribute=null,this.distribution=null}setWeightAttribute(e){return this.weightAttribute=e?this.geometry.getAttribute(e):null,this}build(){let e=this.positionAttribute,t=this.weightAttribute,r=new Float32Array(e.count/3);for(let i=0;i<e.count;i+=3){let n=1;t&&(n=t.getX(i)+t.getX(i+1)+t.getX(i+2)),sK.a.fromBufferAttribute(e,i),sK.b.fromBufferAttribute(e,i+1),sK.c.fromBufferAttribute(e,i+2),n*=sK.getArea(),r[i/3]=n}this.distribution=new Float32Array(e.count/3);let i=0;for(let e=0;e<r.length;e++)i+=r[e],this.distribution[e]=i;return this}setRandomGenerator(e){return this.randomFunction=e,this}sample(e,t,r){let i=this.sampleFaceIndex();return this.sampleFace(i,e,t,r)}sampleFaceIndex(){let e=this.distribution[this.distribution.length-1];return this.binarySearch(this.randomFunction()*e)}binarySearch(e){let t=this.distribution,r=0,i=t.length-1,n=-1;for(;r<=i;){let a=Math.ceil((r+i)/2);if(0===a||t[a-1]<=e&&t[a]>e){n=a;break}e<t[a]?i=a-1:r=a+1}return n}sampleFace(e,t,r,i){let n=this.randomFunction(),a=this.randomFunction();return n+a>1&&(n=1-n,a=1-a),sK.a.fromBufferAttribute(this.positionAttribute,3*e),sK.b.fromBufferAttribute(this.positionAttribute,3*e+1),sK.c.fromBufferAttribute(this.positionAttribute,3*e+2),t.set(0,0,0).addScaledVector(sK.a,n).addScaledVector(sK.b,a).addScaledVector(sK.c,1-(n+a)),void 0!==r&&sK.getNormal(r),void 0!==i&&void 0!==this.colorAttribute&&(sK.a.fromBufferAttribute(this.colorAttribute,3*e),sK.b.fromBufferAttribute(this.colorAttribute,3*e+1),sK.c.fromBufferAttribute(this.colorAttribute,3*e+2),sY.set(0,0,0).addScaledVector(sK.a,n).addScaledVector(sK.b,a).addScaledVector(sK.c,1-(n+a)),i.r=sY.x,i.g=sY.y,i.b=sY.z),this}}function sq(e,t=16,r,i,n){let[a,o]=eD.useState(()=>{let e=Array.from({length:t},()=>[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]).flat();return new eT.lb7(Float32Array.from(e),16)});return eD.useLayoutEffect(()=>{if(void 0===e.current)return;let s=new sW(e.current);i&&s.setWeightAttribute(i),s.build();let l=new eT.Pa4,c=new eT.Pa4,u=new eT.Ilk,h=new eT.Tme;e.current.updateMatrixWorld(!0);for(let i=0;i<t;i++)s.sample(l,c,u),"function"==typeof r?r({dummy:h,sampledMesh:e.current,position:l,normal:c,color:u},i):h.position.copy(l),h.updateMatrix(),null!=n&&n.current&&n.current.setMatrixAt(i,h.matrix),h.matrix.toArray(a.array,16*i);null!=n&&n.current&&(n.current.instanceMatrix.needsUpdate=!0),a.needsUpdate=!0,o(new eT.lb7(a.array,a.itemSize).copy(a))},[e,n,i,t,r]),a}function sX({children:e,weight:t,transform:r,instances:i,mesh:n,count:a=16,...o}){let s=eD.useRef(null),l=eD.useRef(null),c=eD.useRef(null);return eD.useLayoutEffect(()=>{var e,t;l.current=null!==(e=null==i?void 0:i.current)&&void 0!==e?e:s.current.children.find(e=>e.hasOwnProperty("instanceMatrix")),c.current=null!==(t=null==n?void 0:n.current)&&void 0!==t?t:s.current.children.find(e=>"Mesh"===e.type)},[e,null==n?void 0:n.current,null==i?void 0:i.current]),sq(c,a,r,t,l),eD.createElement("group",(0,eS.Z)({ref:s},o),e)}let sZ=({compute:e,name:t,...r})=>{let[i]=eD.useState(()=>new eT.TlE(new Float32Array(0),1)),n=eD.useRef(null);return eD.useLayoutEffect(()=>{if(n.current){var t;let r=e(null!==(t=n.current.parent)&&void 0!==t?t:n.current.__r3f.parent);n.current.copy(r)}},[e]),eD.createElement("primitive",(0,eS.Z)({ref:n,object:i,attach:`attributes-${t}`},r))},s$={clone:function(e){let t=new Map,r=new Map,i=e.clone();return function e(t,r,i){i(t,r);for(let n=0;n<t.children.length;n++)e(t.children[n],r.children[n],i)}(e,i,function(e,i){t.set(i,e),r.set(e,i)}),i.traverse(function(e){if(!e.isSkinnedMesh)return;let i=t.get(e),n=i.skeleton.bones;e.skeleton=i.skeleton.clone(),e.bindMatrix.copy(i.bindMatrix),e.skeleton.bones=n.map(function(e){return r.get(e)}),e.bind(e.skeleton,e.bindMatrix)}),i}},s1=eD.forwardRef(({isChild:e=!1,object:t,children:r,deep:i,castShadow:n,receiveShadow:a,inject:o,keys:s,...l},c)=>{let u={keys:s,deep:i,inject:o,castShadow:n,receiveShadow:a};if(Array.isArray(t=eD.useMemo(()=>
728{if(!1===e&&!Array.isArray(t)){let e=!1;if(t.traverse(t=>{t.isSkinnedMesh&&(e=!0)}),e)return s$.clone(t)}return t},[t,e])))return eD.createElement("group",(0,eS.Z)({},l,{ref:c}),t.map(e=>eD.createElement(s1,(0,eS.Z)({key:e.uuid,object:e},u))),r);let{children:h,...A}=function(e,{keys:t=["near","far","color","distance","decay","penumbra","angle","intensity","skeleton","visible","castShadow","receiveShadow","morphTargetDictionary","morphTargetInfluences","name","geometry","material","position","rotation","scale","up","userData","bindMode","bindMatrix","bindMatrixInverse","skeleton"],deep:r,inject:i,castShadow:n,receiveShadow:a}){let o={};for(let r of t)o[r]=e[r];return r&&(o.geometry&&"materialsOnly"!==r&&(o.geometry=o.geometry.clone()),o.material&&"geometriesOnly"!==r&&(o.material=o.material.clone())),i&&(o="function"==typeof i?{...o,children:i(e)}:eD.isValidElement(i)?{...o,children:i}:{...o,...i}),e instanceof eT.Kj0&&(n&&(o.castShadow=!0),a&&(o.receiveShadow=!0)),o}(t,u),d=t.type[0].toLowerCase()+t.type.slice(1);return eD.createElement(d,(0,eS.Z)({},A,l,{ref:c}),t.children.map(e=>"Bone"===e.type?eD.createElement("primitive",(0,eS.Z)({key:e.uuid,object:e},u)):eD.createElement(s1,(0,eS.Z)({key:e.uuid,object:e},u,{isChild:!0}))),r,h)});class s0 extends eT.Kj0{constructor(e,t,r=!1,i=!1,n=1e4){let a=new eT.u9r;super(a,t),this.isMarchingCubes=!0;let o=this,s=new Float32Array(36),l=new Float32Array(36),c=new Float32Array(36);function u(e,t,r,i,n,a,u,h,A,d){var m,f,p,g,y,v;let E=(r-u)/(h-u),x=o.normal_cache;s[t+0]=i+E*o.delta,s[t+1]=n,s[t+2]=a,l[t+0]=(m=x[e+0])+(x[e+3]-m)*E,l[t+1]=(f=x[e+1])+(x[e+4]-f)*E,l[t+2]=(p=x[e+2])+(x[e+5]-p)*E,c[t+0]=(g=o.palette[3*A+0])+(o.palette[3*d+0]-g)*E,c[t+1]=(y=o.palette[3*A+1])+(o.palette[3*d+1]-y)*E,c[t+2]=(v=o.palette[3*A+2])+(o.palette[3*d+2]-v)*E}function h(e,t,r,i,n,a,u,h,A,d){var m,f,p,g,y,v;let E=(r-u)/(h-u),x=o.normal_cache;s[t+0]=i,s[t+1]=n+E*o.delta,s[t+2]=a;let C=e+3*o.yd;l[t+0]=(m=x[e+0])+(x[C+0]-m)*E,l[t+1]=(f=x[e+1])+(x[C+1]-f)*E,l[t+2]=(p=x[e+2])+(x[C+2]-p)*E,c[t+0]=(g=o.palette[3*A+0])+(o.palette[3*d+0]-g)*E,c[t+1]=(y=o.palette[3*A+1])+(o.palette[3*d+1]-y)*E,c[t+2]=(v=o.palette[3*A+2])+(o.palette[3*d+2]-v)*E}function A(e,t,r,i,n,a,u,h,A,d){var m,f,p,g,y,v;let E=(r-u)/(h-u),x=o.normal_cache;s[t+0]=i,s[t+1]=n,s[t+2]=a+E*o.delta;let C=e+3*o.zd;l[t+0]=(m=x[e+0])+(x[C+0]-m)*E,l[t+1]=(f=x[e+1])+(x[C+1]-f)*E,l[t+2]=(p=x[e+2])+(x[C+2]-p)*E,c[t+0]=(g=o.palette[3*A+0])+(o.palette[3*d+0]-g)*E,c[t+1]=(y=o.palette[3*A+1])+(o.palette[3*d+1]-y)*E,c[t+2]=(v=o.palette[3*A+2])+(o.palette[3*d+2]-v)*E}function d(e){let t=3*e;0===o.normal_cache[t]&&(o.normal_cache[t+0]=o.field[e-1]-o.field[e+1],o.normal_cache[t+1]=o.field[e-o.yd]-o.field[e+o.yd],o.normal_cache[t+2]=o.field[e-o.zd]-o.field[e+o.zd])}this.enableUvs=r,this.enableColors=i,this.init=function(e){this.resolution=e,this.isolation=80,this.size=e,this.size2=this.size*this.size,this.size3=this.size2*this.size,this.halfsize=this.size/2,this.delta=2/this.size,this.yd=this.size,this.zd=this.size2,this.field=new Float32Array(this.size3),this.normal_cache=new Float32Array(3*this.size3),this.palette=new Float32Array(3*this.size3),this.count=0;let t=3*n;this.positionArray=new Float32Array(3*t);let r=new eT.TlE(this.positionArray,3);r.setUsage(eT.dj0),a.setAttribute("position",r),this.normalArray=new Float32Array(3*t);let i=new eT.TlE(this.normalArray,3);if(i.setUsage(eT.dj0),a.setAttribute("normal",i),this.enableUvs){this.uvArray=new Float32Array(2*t);let e=new eT.TlE(this.uvArray,2);e.setUsage(eT.dj0),a.setAttribute("uv",e)}if(this.enableColors){this.colorArray=new Float32Array(3*t);let e=new eT.TlE(this.colorArray,3);e.setUsage(eT.dj0),a.setAttribute("color",e)}a.boundingSphere=new eT.aLr(new eT.Pa4,1)},this.addBall=function(e,t,r,i,n,a){let o,s,l,c,u,h,A,d,m,f,p;let g=Math.sign(i);i=Math.abs(i);let y=null!=a,v=new eT.Ilk(e,t,r);if(y)try{v=a instanceof eT.Ilk?a:Array.isArray(a)?new eT.Ilk(Math.min(Math.abs(a[0]),1),Math.min(Math.abs(a[1]),1),Math.min(Math.abs(a[2]),1)):new eT.Ilk(a)}catch(i){v=new eT.Ilk(e,t,r)}let E=this.size*Math.sqrt(i/n),x=r*this.size,C=t*this.size,w=e*this.size,B=Math.floor(x-E);B<1&&(B=1);let I=Math.floor(x+E);I>this.size-1&&(I=this.size-1);let _=Math.floor(C-E);_<1&&(_=1);let b=Math.floor(C+E);b>this.size-1&&(b=this.size-1);let M=Math.floor(w-E);M<1&&(M=1);let S=Math.floor(w+E);for(S>this.size-1&&(S=this.size-1),l=B;l<I;l++)for(u=this.size2*l,m=(d=l/this.size-r)*d,s=_;s<b;s++)for(c=u+this.size*s,f=(A=s/this.size-t)*A,o=M;o<S;o++)if((p=i/(1e-6+(h=o/this.size-e)*h+f+m)-n)>
7280){this.field[c+o]+=p*g;let e=Math.sqrt((o-w)*(o-w)+(s-C)*(s-C)+(l-x)*(l-x))/E,t=1-e*e*e*(e*(6*e-15)+10);this.palette[(c+o)*3+0]+=v.r*t,this.palette[(c+o)*3+1]+=v.g*t,this.palette[(c+o)*3+2]+=v.b*t}},this.addPlaneX=function(e,t){let r=this.size,i=this.yd,n=this.zd,a=this.field,o,s,l,c,u,h,A=r*Math.sqrt(e/t);for(A>r&&(A=r),o=0;o<A;o++)if((c=e/(1e-4+(u=o/r)*u)-t)>0)for(s=0;s<r;s++)for(l=0,h=o+s*i;l<r;l++)a[n*l+h]+=c},this.addPlaneY=function(e,t){let r=this.size,i=this.yd,n=this.zd,a=this.field,o,s,l,c,u,h,A,d=r*Math.sqrt(e/t);for(d>r&&(d=r),s=0;s<d;s++)if((c=e/(1e-4+(u=s/r)*u)-t)>0)for(o=0,h=s*i;o<r;o++)for(l=0,A=h+o;l<r;l++)a[n*l+A]+=c},this.addPlaneZ=function(e,t){let r=this.size,i=this.yd,n=this.zd,a=this.field,o,s,l,c,u,h,A,d=r*Math.sqrt(e/t);for(d>r&&(d=r),l=0;l<d;l++)if((c=e/(1e-4+(u=l/r)*u)-t)>0)for(s=0,h=n*l;s<r;s++)for(o=0,A=h+s*i;o<r;o++)a[A+o]+=c},this.setCell=function(e,t,r,i){let n=this.size2*r+this.size*t+e;this.field[n]=i},this.getCell=function(e,t,r){let i=this.size2*r+this.size*t+e;return this.field[i]},this.blur=function(e=1){let t=this.field,r=t.slice(),i=this.size,n=this.size2;for(let a=0;a<i;a++)for(let o=0;o<i;o++)for(let s=0;s<i;s++){let l=n*s+i*o+a,c=r[l],u=1;for(let t=-1;t<=1;t+=2){let l=t+a;if(!(l<0)&&!(l>=i))for(let t=-1;t<=1;t+=2){let a=t+o;if(!(a<0)&&!(a>=i))for(let t=-1;t<=1;t+=2){let o=t+s;if(o<0||o>=i)continue;let h=r[n*o+i*a+l];u++,c+=e*(h-c)/u}}}t[l]=c}},this.reset=function(){for(let e=0;e<this.size3;e++)this.normal_cache[3*e]=0,this.field[e]=0,this.palette[3*e]=this.palette[3*e+1]=this.palette[3*e+2]=0},this.update=function(){this.count=0;let e=this.size-2;for(let t=1;t<e;t++){let r=this.size2*t,i=(t-this.halfsize)/this.halfsize;
728for(let t=1;t<e;t++){let n=r+this.size*t,a=(t-this.halfsize)/this.halfsize;for(let t=1;t<e;t++)!function(e,t,r,i,n){let a=i+1,m=i+o.yd,f=i+o.zd,p=a+o.yd,g=a+o.zd,y=i+o.yd+o.zd,v=a+o.yd+o.zd,E=0,x=o.field[i],C=o.field[a],w=o.field[m],B=o.field[p],I=o.field[f],_=o.field[g],b=o.field[y],M=o.field[v];x<n&&(E|=1),C<n&&(E|=2),w<n&&(E|=8),B<n&&(E|=4),I<n&&(E|=16),_<n&&(E|=32),b<n&&(E|=128),M<n&&(E|=64);let S=s2[E];if(0===S)return;let D=o.delta,P=e+D,T=t+D,R=r+D;1&S&&(d(i),d(a),u(3*i,0,n,e,t,r,x,C,i,a)),2&S&&(d(a),d(p),h(3*a,3,n,P,t,r,C,B,a,p)),4&S&&(d(m),d(p),u(3*m,6,n,e,T,r,w,B,m,p)),8&S&&(d(i),d(m),h(3*i,9,n,e,t,r,x,w,i,m)),16&S&&(d(f),d(g),u(3*f,12,n,e,t,R,I,_,f,g)),32&S&&(d(g),d(v),h(3*g,15,n,P,t,R,_,M,g,v)),64&S&&(d(y),d(v),u(3*y,18,n,e,T,R,b,M,y,v)),128&S&&(d(f),d(y),h(3*f,21,n,e,t,R,I,b,f,y)),256&S&&(d(i),d(f),A(3*i,24,n,e,t,r,x,I,i,f)),512&S&&(d(a),d(g),A(3*a,27,n,P,t,r,C,_,a,g)),1024&S&&(d(p),d(v),A(3*p,30,n,P,T,r,B,M,p,v)),2048&S&&(d(m),d(y),A(3*m,33,n,e,T,r,w,b,m,y)),E<<=4;let F,Q,z,k=0;for(;-1!=s3[E+k];)Q=(F=E+k)+1,z=F+2,function(e,t,r,i,n,a){let s=3*o.count;if(o.positionArray[s+0]=e[i],o.positionArray[s+1]=e[i+1],o.positionArray[s+2]=e[i+2],o.positionArray[s+3]=e[n],o.positionArray[s+4]=e[n+1],o.positionArray[s+5]=e[n+2],o.positionArray[s+6]=e[a],o.positionArray[s+7]=e[a+1],o.positionArray[s+8]=e[a+2],!0===o.material.flatShading){let e=(t[i+0]+t[n+0]+t[a+0])/3,r=(t[i+1]+t[n+1]+t[a+1])/3,l=(t[i+2]+t[n+2]+t[a+2])/3;o.normalArray[s+0]=e,o.normalArray[s+1]=r,o.normalArray[s+2]=l,o.normalArray[s+3]=e,o.normalArray[s+4]=r,o.normalArray[s+5]=l,o.normalArray[s+6]=e,o.normalArray[s+7]=r,o.normalArray[s+8]=l}else o.normalArray[s+0]=t[i+0],o.normalArray[s+1]=t[i+1],o.normalArray[s+2]=t[i+2],o.normalArray[s+3]=t[n+0],o.normalArray[s+4]=t[n+1],o.normalArray[s+5]=t[n+2],o.normalArray[s+6]=t[a+0],o.normalArray[s+7]=t[a+1],o.normalArray[s+8]=t[a+2];if(o.enableUvs){let t=2*o.count;o.uvArray[t+0]=e[i+0],o.uvArray[t+1]=e[i+2],o.uvArray[t+2]=e[n+0],o.uvArray[t+3]=e[n+2],o.uvArray[t+4]=e[a+0],o.uvArray[t+5]=e[a+2]}o.enableColors&&(o.colorArray[s+0]=r[i+0],o.colorArray[s+1]=r[i+1],o.colorArray[s+2]=r[i+2],o.colorArray[s+3]=r[n+0],o.colorArray[s+4]=r[n+1],o.colorArray[s+5]=r[n+2],o.colorArray[s+6]=r[a+0],o.colorArray[s+7]=r[a+1],o.colorArray[s+8]=r[a+2]),o.count+=3}(s,l,c,3*s3[F],3*s3[Q],3*s3[z]),k+=3}((t-this.halfsize)/this.halfsize,a,i,n+t,this.isolation)}}this.geometry.setDrawRange(0,this.count),a.getAttribute("position").needsUpdate=!0,a.getAttribute("normal").needsUpdate=!0,this.enableUvs&&(a.getAttribute("uv").needsUpdate=!0),this.enableColors&&(a.getAttribute("color").needsUpdate=!0),this.count/3>n&&console.warn("THREE.MarchingCubes: Geometry buffers too small for rendering. Please create an instance with a higher poly count.")},this.init(e)}}let s2=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]),s3=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,-1,-1,9,2,10,9,0,2,8,4,7,-1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1,8,4,7,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,4,7,11,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1,9,0,1,8,4,7,2,3,11,-1,-1,-1,-1,-1,-1,-1,4,7,11,9,4,11,9,11,2,9,2,1,-1,-1,-1,-1,3,10,1,3,11,10,7,8,4,-1,-1,-1,-1,-1,-1,-1,1,11,10,1,4,11,1,0,4,7,11,4,
728-1,-1,-1,-1,4,7,8,9,0,11,9,11,10,11,0,3,-1,-1,-1,-1,4,7,11,4,11,9,9,11,10,-1,-1,-1,-1,-1,-1,-1,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,10,4,9,5,-1,-1,-1,-1,-1,-1,-1,5,2,10,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1,2,10,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1,9,5,4,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,0,8,11,4,9,5,-1,-1,-1,-1,-1,-1,-1,0,5,4,0,1,5,2,3,11,-1,-1,-1,-1,-1,-1,-1,2,1,5,2,5,8,2,8,11,4,8,5,-1,-1,-1,-1,10,3,11,10,1,3,9,5,4,-1,-1,-1,-1,-1,-1,-1,4,9,5,0,8,1,8,10,1,8,11,10,-1,-1,-1,-1,5,4,0,5,0,11,5,11,10,11,0,3,-1,-1,-1,-1,5,4,8,5,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1,1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,7,8,9,5,7,10,1,2,-1,-1,-1,-1,-1,-1,-1,10,1,2,9,5,0,5,3,0,5,7,3,-1,-1,-1,-1,8,0,2,8,2,5,8,5,7,10,5,2,-1,-1,-1,-1,2,10,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,7,9,5,7,8,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,9,5,7,9,7,2,9,2,0,2,7,11,-1,-1,-1,-1,2,3,11,0,1,8,1,7,8,1,5,7,-1,-1,-1,-1,11,2,1,11,1,7,7,1,5,-1,-1,-1,-1,-1,-1,-1,9,5,8,8,5,7,10,1,3,10,3,11,-1,-1,-1,-1,5,7,0,5,0,9,7,11,0,1,0,10,11,10,0,-1,11,10,0,11,0,3,10,5,0,8,0,7,5,7,0,-1,11,10,5,7,11,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,1,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,1,9,8,5,10,6,-1,-1,-1,-1,-1,-1,-1,1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,6,5,1,2,6,3,0,8,-1,-1,-1,-1,-1,-1,-1,9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1,5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1,2,3,11,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,0,8,11,2,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,0,1,9,2,3,11,5,10,6,-1,-1,-1,-1,-1,-1,-1,5,10,6,1,9,2,9,11,2,9,8,11,-1,-1,-1,-1,6,3,11,6,5,3,5,1,3,-1,-1,-1,-1,-1,-1,-1,0,8,11,0,11,5,0,5,1,5,11,6,-1,-1,-1,-1,3,11,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1,6,5,9,6,9,11,11,9,8,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,4,7,3,6,5,10,-1,-1,-1,-1,-1,-1,-1,1,9,0,5,10,6,8,4,7,-1,-1,-1,-1,-1,-1,-1,10,6,5,1,9,7,1,7,3,7,9,4,-1,-1,-1,-1,6,1,2,6,5,1,4,7,8,-1,-1,-1,-1,-1,-1,-1,1,2,5,5,2,6,3,0,4,3,4,7,-1,-1,-1,-1,8,4,7,9,0,5,0,6,5,0,2,6,-1,-1,-1,-1,7,3,9,7,9,4,3,2,9,5,9,6,2,6,9,-1,3,11,2,7,8,4,10,6,5,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,2,4,2,0,2,7,11,-1,-1,-1,-1,0,1,9,4,7,8,2,3,11,5,10,6,-1,-1,-1,-1,9,2,1,9,11,2,9,4,11,7,11,4,5,10,6,-1,8,4,7,3,11,5,3,5,1,5,11,6,-1,-1,-1,-1,5,1,11,5,11,6,1,0,11,7,11,4,0,4,11,-1,0,5,9,0,6,5,0,3,6,11,6,3,8,4,7,-1,6,5,9,6,9,11,4,7,9,7,11,9,-1,-1,-1,-1,10,4,9,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,10,6,4,9,10,0,8,3,-1,-1,-1,-1,-1,-1,-1,10,0,1,10,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,6,8,6,4,6,1,10,-1,-1,-1,-1,1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,9,2,4,9,2,6,4,-1,-1,-1,-1,0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,10,4,9,10,6,4,11,2,3,-1,-1,-1,-1,-1,-1,-1,0,8,2,2,8,11,4,9,10,4,10,6,-1,-1,-1,-1,3,11,2,0,1,6,0,6,4,6,1,10,-1,-1,-1,-1,6,4,1,6,1,10,4,8,1,2,1,11,8,11,1,-1,9,6,4,9,3,6,9,1,3,11,6,3,-1,-1,-1,-1,8,11,1,8,1,0,11,6,1,9,1,4,6,4,1,-1,3,11,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1,6,4,8,11,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,10,6,7,8,10,8,9,10,-1,-1,-1,-1,-1,-1,-1,0,7,3,0,10,7,0,9,10,6,7,10,-1,-1,-1,-1,10,6,7,1,10,7,1,7,8,1,8,0,-1,-1,-1,-1,10,6,7,10,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1,1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1,2,6,9,2,9,1,6,7,9,0,9,3,7,3,9,-1,7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1,7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,11,10,6,8,10,8,9,8,6,7,-1,-1,-1,-1,2,0,7,2,7,11,0,9,7,6,7,10,9,10,7,-1,1,8,0,1,7,8,1,10,7,6,7,10,2,3,11,-1,11,2,1,11,1,7,10,6,1,6,7,1,-1,-1,-1,-1,8,9,6,8,6,7,9,1,6,11,6,3,1,3,6,-1,0,9,1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,7,0,6,3,11,0,11,6,0,-1,-1,-1,-1,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,1,9,8,3,1,11,7,6,-1,-1,-1,-1,-1,-1,-1,10,1,2,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,8,6,11,7,-1,-1,-1,-1,-1,-1,-1,2,9,0,2,10,9,6,11,7,-1,-1,-1,-1,-1,-1,-1,6,11,7,2,10,3,10,8,3,10,9,8,-1,-1,-1,-1,7,2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1,2,7,6,2,3,7,0,1,9,-1,-1,-1,-1,-1,-1,-1,1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1,10,7,6,10,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,7,6,1,7,10,1,8,7,1,0,8,-1,-1,-1,-1,0,3,7,0,7,10,0,10,9,6,10,7,-1,-1,-1,-1,7,6,10,7,10,8,8,10,9,-1,-1,-1,-1,-1,-1,-1,6,8,4,11,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,6,11,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1,8,6,11,8,4,6,9,0,1,-1,-1,-1,-1,-1,-1,-1,9,4,6,9,6,3,9,3,1,11,3,6,-1,-1,-1,-1,6,8,4,6,11,8,2,10,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,11,0,6,11,0,4,6,-1,-1,-1,-1,4,11,8,4,6,11,0,2,9,2,10,9,-1,-1,-1,-1,10,9,3,10,3,2,9,4,3,11,3,6,4,6,3,-1,8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,4,2,4,6,4,3,8,-1,-1,-1,-1,1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1,8,1,3,8,6,1,8,4,6,6,10,1,-1,-1,-1,-1,10,1,0,10,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1,4,6,3,4,3,8,6,10,3,0,3,9,10,9,3,-1,10,9,4,6,10,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,5,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,5,11,7,6,-1,-1,-1,-1,-1,-1,-1,5,0,1,5,4,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,11,7,6,8,3,4,3,5,4,3,1,5,-1,-1,-1,-1,9,5,4,10,1,2,7,6,11,-1,-1,-1,-1,-1,-1,-1,6,11,7,1,2,10,0,8,3,4,9,5,-1,-1,-1,-1,7,6,11,5,4,10,4,2,10,4,0,2,-1,-1,-1,-1,3,4,8,3,5,4,3,2,5,10,5,2,11,7,6,-1,7,2,3,7,6,2,5,4,9,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,6,0,6,2,6,8,7,-1,-1,-1,-1,3,6,2,3,7,6,1,5,0,5,4,0,-1,-1,-1,-1,6,2,8,6,8,7,2,1,8,4,8,5,1,5,8,-1,9,5,4,10,1,6,1,7,6,1,3,7,-1,-1,-1,-1,1,6,10,1,7,
7286,1,0,7,8,7,0,9,5,4,-1,4,0,10,4,10,5,0,3,10,6,10,7,3,7,10,-1,7,6,10,7,10,8,5,4,10,4,8,10,-1,-1,-1,-1,6,9,5,6,11,9,11,8,9,-1,-1,-1,-1,-1,-1,-1,3,6,11,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1,0,11,8,0,5,11,0,1,5,5,6,11,-1,-1,-1,-1,6,11,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,11,9,11,8,11,5,6,-1,-1,-1,-1,0,11,3,0,6,11,0,9,6,5,6,9,1,2,10,-1,11,8,5,11,5,6,8,0,5,10,5,2,0,2,5,-1,6,11,3,6,3,5,2,10,3,10,5,3,-1,-1,-1,-1,5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1,9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1,1,5,8,1,8,0,5,6,8,3,8,2,6,2,8,-1,1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,6,1,6,10,3,8,6,5,6,9,8,9,6,-1,10,1,0,10,0,6,9,5,0,5,6,0,-1,-1,-1,-1,0,3,8,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,7,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,11,7,5,8,3,0,-1,-1,-1,-1,-1,-1,-1,5,11,7,5,10,11,1,9,0,-1,-1,-1,-1,-1,-1,-1,10,7,5,10,11,7,9,8,1,8,3,1,-1,-1,-1,-1,11,1,2,11,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,7,1,7,5,7,2,11,-1,-1,-1,-1,9,7,5,9,2,7,9,0,2,2,11,7,-1,-1,-1,-1,7,5,2,7,2,11,5,9,2,3,2,8,9,8,2,-1,2,5,10,2,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,8,2,0,8,5,2,8,7,5,10,2,5,-1,-1,-1,-1,9,0,1,5,10,3,5,3,7,3,10,2,-1,-1,-1,-1,9,8,2,9,2,1,8,7,2,10,2,5,7,5,2,-1,1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1,9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1,9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,8,4,5,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,5,0,4,5,11,0,5,10,11,11,3,0,-1,-1,-1,-1,0,1,9,8,4,10,8,10,11,10,4,5,-1,-1,-1,-1,10,11,4,10,4,5,11,3,4,9,4,1,3,1,4,-1,2,5,1,2,8,5,2,11,8,4,5,8,-1,-1,-1,-1,0,4,11,0,11,3,4,5,11,2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]),s4=eD.createContext(null),s5=eD.forwardRef(({resolution:e=28,maxPolyCount:t=1e4,enableUvs:r=!1,enableColors:i=!1,children:n,...a},o)=>{let s=eD.useRef(null);eD.useImperativeHandle(o,()=>s.current,[]);let l=eD.useMemo(()=>new s0(e,null,r,i,t),[e,t,r,i]),c=eD.useMemo(()=>({getParent:()=>s}),[]);return(0,eR.F)(()=>{l.update(),l.reset()},-1),eD.createElement(eD.Fragment,null,eD.createElement("primitive",(0,eS.Z)({object:l,ref:s},a),eD.createElement(s4.Provider,{value:c},n)))}),s6=eD.forwardRef(({strength:e=.5,subtract:t=12,color:r,...i},n)=>{let{getParent:a}=eD.useContext(s4),o=eD.useMemo(()=>a(),[a]),s=eD.useRef(null);eD.useImperativeHandle(n,()=>s.current,[]);let l=new eT.Pa4;return(0,eR.F)(i=>{o.current&&s.current&&(s.current.getWorldPosition(l),o.current.addBall(.5+.5*l.x,.5+.5*l.y,.5+.5*l.z,e,t,r))}),eD.createElement("group",(0,eS.Z)({ref:s},i))}),s8=eD.forwardRef(({planeType:e="x",strength:t=.5,subtract:r=12,...i},n)=>{let{getParent:a}=eD.useContext(s4),o=eD.useMemo(()=>a(),[a]),s=eD.useRef(null);eD.useImperativeHandle(n,()=>s.current,[]);let l=eD.useMemo(()=>"x"===e?"addPlaneX":"y"===e?"addPlaneY":"addPlaneZ",[e]);return(0,eR.F)(()=>{o.current&&s.current&&o.current[l](t,r)}),eD.createElement("group",(0,eS.Z)({ref:s},i))});
728class s9 extends eT.u9r{constructor(e,t,r,i){super();let n=[],a=[],o=[],s=new eT.Pa4,l=new eT.yGw;l.makeRotationFromEuler(r),l.setPosition(t);let c=new eT.yGw;function u(t,r,i){r.applyMatrix4(e.matrixWorld),r.applyMatrix4(c),i.transformDirection(e.matrixWorld),t.push(new s7(r.clone(),i.clone()))}function h(e,t){let r=[],n=.5*Math.abs(i.dot(t));for(let i=0;i<e.length;i+=3){let a,o,s,l,c,u,h;let d=e[i+0].position.dot(t)-n,m=e[i+1].position.dot(t)-n,f=e[i+2].position.dot(t)-n;switch(((c=d>0)?1:0)+((u=m>0)?1:0)+((h=f>0)?1:0)){case 0:r.push(e[i]),r.push(e[i+1]),r.push(e[i+2]);break;case 1:if(c&&(a=e[i+1],o=e[i+2],s=A(e[i],a,t,n),l=A(e[i],o,t,n)),u){a=e[i],o=e[i+2],s=A(e[i+1],a,t,n),l=A(e[i+1],o,t,n),r.push(s),r.push(o.clone()),r.push(a.clone()),r.push(o.clone()),r.push(s.clone()),r.push(l);break}h&&(a=e[i],o=e[i+1],s=A(e[i+2],a,t,n),l=A(e[i+2],o,t,n)),r.push(a.clone()),r.push(o.clone()),r.push(s),r.push(l),r.push(s.clone()),r.push(o.clone());break;case 2:c||(o=A(a=e[i].clone(),e[i+1],t,n),s=A(a,e[i+2],t,n),r.push(a),r.push(o),r.push(s)),u||(o=A(a=e[i+1].clone(),e[i+2],t,n),s=A(a,e[i],t,n),r.push(a),r.push(o),r.push(s)),h||(o=A(a=e[i+2].clone(),e[i],t,n),s=A(a,e[i+1],t,n),r.push(a),r.push(o),r.push(s))}}return r}
728function A(e,t,r,i){let n=e.position.dot(r)-i,a=n/(n-(t.position.dot(r)-i));return new s7(new eT.Pa4(e.position.x+a*(t.position.x-e.position.x),e.position.y+a*(t.position.y-e.position.y),e.position.z+a*(t.position.z-e.position.z)),new eT.Pa4(e.normal.x+a*(t.normal.x-e.normal.x),e.normal.y+a*(t.normal.y-e.normal.y),e.normal.z+a*(t.normal.z-e.normal.z)))}c.copy(l).invert(),function(){let t;let r=[],c=new eT.Pa4,A=new eT.Pa4;if(!0===e.geometry.isGeometry){console.error("THREE.DecalGeometry no longer supports THREE.Geometry. Use BufferGeometry instead.");return}let d=e.geometry,m=d.attributes.position,f=d.attributes.normal;if(null!==d.index){let e=d.index;for(t=0;t<e.count;t++)c.fromBufferAttribute(m,e.getX(t)),A.fromBufferAttribute(f,e.getX(t)),u(r,c,A)}else for(t=0;t<m.count;t++)c.fromBufferAttribute(m,t),A.fromBufferAttribute(f,t),u(r,c,A);for(t=0,r=h(r,s.set(1,0,0)),r=h(r,s.set(-1,0,0)),r=h(r,s.set(0,1,0)),r=h(r,s.set(0,-1,0)),r=h(r,s.set(0,0,1)),r=h(r,s.set(0,0,-1));t<r.length;t++){let e=r[t];o.push(.5+e.position.x/i.x,.5+e.position.y/i.y),e.position.applyMatrix4(l),n.push(e.position.x,e.position.y,e.position.z),a.push(e.normal.x,e.normal.y,e.normal.z)}}(),this.setAttribute("position",new eT.a$l(n,3)),this.setAttribute("normal",new eT.a$l(a,3)),this.setAttribute("uv",new eT.a$l(o,2))}}class s7{constructor(e,t){this.position=e,this.normal=t}clone(){return new this.constructor(this.position.clone(),this.normal.clone())}}function le(e=[0,0,0]){return Array.isArray(e)?e:e instanceof eT.Pa4||e instanceof eT.USm?[e.x,e.y,e.z]:[e,e,e]}let lt=eD.forwardRef(function({debug:e,depthTest:t=!1,polygonOffsetFactor:r=-10,map:i,mesh:n,children:a,position:o,rotation:s,scale:l,...c},u){let h=eD.useRef(null);eD.useImperativeHandle(u,()=>h.current);let A=eD.useRef(null),d=eD.useRef({position:new eT.Pa4,rotation:new eT.USm,scale:new eT.Pa4(1,1,1)});return eD.useLayoutEffect(()=>{let e=(null==n?void 0:n.current)||h.current.parent,t=h.current;if(!(e instanceof eT.Kj0))throw Error('Decal must have a Mesh as parent or specify its "mesh" prop');if(e){(0,eR.k)(d.current,{position:o,scale:l});let r=e.matrixWorld.clone();if(e.matrixWorld.identity(),s&&"number"!=typeof s)(0,eR.k)(d.current,{rotation:s});else{let t=new eT.Tme;t.position.copy(d.current.position);let r=e.geometry.attributes.position.array;void 0===e.geometry.attributes.normal&&e.geometry.computeVertexNormals();let i=e.geometry.attributes.normal.array,n=1/0;new eT.Pa4;let a=new eT.Pa4,o=t.position.x,l=t.position.y,c=t.position.z,u=r.length,h=-1;for(let e=0;e<u;e+=3){let t=r[e],i=r[e+1],a=r[e+2],s=t-o,u=i-l,A=a-c,d=s*s+u*u+A*A;d<n&&(n=d,h=e)}a.fromArray(i,h),t.lookAt(t.position.clone().add(a)),t.rotateZ(Math.PI),t.rotateY(Math.PI),"number"==typeof s&&t.rotateZ(s),(0,eR.k)(d.current,{rotation:t.rotation})}return t.geometry=new s9(e,d.current.position,d.current.rotation,d.current.scale),e.matrixWorld=r,()=>{t.geometry.dispose()}}},[n,...le(o),...le(l),...le(s)]),eD.useLayoutEffect(()=>{A.current&&((0,eR.k)(A.current,d.current),A.current.traverse(e=>e.raycast=()=>null))},[e]),eD.createElement("mesh",(0,eS.Z)({ref:h,"material-transparent":!0,"material-polygonOffset":!0,"material-polygonOffsetFactor":r,"material-depthTest":t,"material-map":i},c),a,e&&eD.createElement("mesh",{ref:A},eD.createElement("boxGeometry",null),eD.createElement("meshNormalMaterial",{wireframe:!0}),eD.createElement("axesHelper",null)))}),lr=(()=>{class e extends eT.aNw{constructor(e){super(e),this.defaultDPI=90,this.defaultUnit="px"}load(e,t,r,i){let n=this,a=new eT.hH6(n.manager);a.setPath(n.path),a.setRequestHeader(n.requestHeader),a.setWithCredentials(n.withCredentials),a.load(e,function(r){try{t(n.parse(r))}catch(t){i?i(t):console.error(t),n.manager.itemError(e)}},r,i)}parse(e){let t=this;function r(e,t,r,n,a,o,s,l){if(0==t||0==r){e.lineTo(l.x,l.y);return}n=n*Math.PI/180,t=Math.abs(t),r=Math.abs(r);let c=(s.x-l.x)/2,u=(s.y-l.y)/2,h=Math.cos(n)*c+Math.sin(n)*u,A=-Math.sin(n)*c+Math.cos(n)*u,d=t*t,m=r*r,f=h*h,p=A*A,g=f/d+p/m;if(g>1){let e=Math.sqrt(g);t*=e,r*=e,d=t*t,m=r*r}let y=d*p+m*f,v=Math.sqrt(Math.max(0,(d*m-y)/y));a===o&&(v=-v);let E=v*t*A/r,x=-v*r*h/t,C=Math.cos(n)*E-Math.sin(n)*x+(s.x+l.x)/2,w=Math.sin(n)*E+Math.cos(n)*x+(s.y+l.y)/2,B=i(1,0,(h-E)/t,(A-x)/r),I=i((h-E)/t,(A-x)/r,(-h-E)/t,(-A-x)/r)%(2*Math.PI);e.currentPath.absellipse(C,w,t,r,B,B+I,0===o,n)}function i(e,t,r,i){let n=Math.acos(Math.max(-1,Math.min(1,(e*r+t*i)/(Math.sqrt(e*e+t*t)*Math.sqrt(r*r+i*i)))));return e*i-t*r<0&&(n=-n),n}
728function n(e,t){t=Object.assign({},t);let r={};if(e.hasAttribute("class")){let t=e.getAttribute("class").split(/\s/).filter(Boolean).map(e=>e.trim());for(let e=0;e<t.length;e++)r=Object.assign(r,d["."+t[e]])}function i(i,n,a){void 0===a&&(a=function(e){return e.startsWith("url")&&console.warn("SVGLoader: url access in attributes is not implemented."),e}),e.hasAttribute(i)&&(t[n]=a(e.getAttribute(i))),r[i]&&(t[n]=a(r[i])),e.style&&""!==e.style[i]&&(t[n]=a(e.style[i]))}function n(e){return Math.max(0,Math.min(1,l(e)))}function a(e){return Math.max(0,l(e))}return e.hasAttribute("id")&&(r=Object.assign(r,d["#"+e.getAttribute("id")])),i("fill","fill"),i("fill-opacity","fillOpacity",n),i("fill-rule","fillRule"),i("opacity","opacity",n),i("stroke","stroke"),i("stroke-opacity","strokeOpacity",n),i("stroke-width","strokeWidth",a),i("stroke-linejoin","strokeLineJoin"),i("stroke-linecap","strokeLineCap"),i("stroke-miterlimit","strokeMiterLimit",a),i("visibility","visibility"),t}function a(e,t,r){let i;if("string"!=typeof e)throw TypeError("Invalid input: "+typeof e);let n={WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/},a=0,o=!0,s="",l="",c=[];function u(e,t,r){let i=SyntaxError('Unexpected character "'+e+'" at index '+t+".");throw i.partial=r,i}function h(){""!==s&&(""===l?c.push(Number(s)):c.push(Number(s)*Math.pow(10,Number(l)))),s="",l=""}let A=e.length;for(let d=0;d<A;d++){if(i=e[d],Array.isArray(t)&&t.includes(c.length%r)&&n.FLAGS.test(i)){a=1,s=i,h();continue}if(0===a){if(n.WHITESPACE.test(i))continue;if(n.DIGIT.test(i)||n.SIGN.test(i)){a=1,s=i;continue}if(n.POINT.test(i)){a=2,s=i;continue}n.COMMA.test(i)&&(o&&u(i,d,c),o=!0)}if(1===a){if(n.DIGIT.test(i)){s+=i;continue}if(n.POINT.test(i)){s+=i,a=2;continue}if(n.EXP.test(i)){a=3;continue}n.SIGN.test(i)&&1===s.length&&n.SIGN.test(s[0])&&u(i,d,c)}if(2===a){if(n.DIGIT.test(i)){s+=i;continue}if(n.EXP.test(i)){a=3;continue}n.POINT.test(i)&&"."===s[s.length-1]&&u(i,d,c)}if(3===a){if(n.DIGIT.test(i)){l+=i;continue}if(n.SIGN.test(i)){if(""===l){l+=i;continue}1===l.length&&n.SIGN.test(l)&&u(i,d,c)}}n.WHITESPACE.test(i)?(h(),a=0,o=!1):n.COMMA.test(i)?(h(),a=0,o=!0):n.SIGN.test(i)?(h(),a=1,s=i):n.POINT.test(i)?(h(),a=2,s=i):u(i,d,c)}return h(),c}let o=["mm","cm","in","pt","pc","px"],s={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}
728,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:12,pc:1,px:-1},px:{px:1}};function l(e){let r,i="px";if("string"==typeof e||e instanceof String)for(let t=0,r=o.length;t<r;t++){let r=o[t];if(e.endsWith(r)){i=r,e=e.substring(0,e.length-r.length);break}}return"px"===i&&"px"!==t.defaultUnit?r=s.in[t.defaultUnit]/t.defaultDPI:(r=s[i][t.defaultUnit])<0&&(r=s[i].in*t.defaultDPI),r*parseFloat(e)}function c(e){let t=e.elements;return t[0]*t[4]-t[1]*t[3]<0}function u(e){let t=e.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function h(e){let t=e.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}let A=[],d={},m=[],f=new eT.Vkp,p=new eT.Vkp,g=new eT.Vkp,y=new eT.Vkp,v=new eT.FM8,E=new eT.Pa4,x=new eT.Vkp,C=new DOMParser().parseFromString(e,"image/svg+xml");return!function e(t,i){if(1!==t.nodeType)return;let o=function(e){if(!(e.hasAttribute("transform")||"use"===e.nodeName&&(e.hasAttribute("x")||e.hasAttribute("y"))))return null;let t=function(e){let t=new eT.Vkp;if("use"===e.nodeName&&(e.hasAttribute("x")||e.hasAttribute("y"))){let r=l(e.getAttribute("x")),i=l(e.getAttribute("y"));t.translate(r,i)}if(e.hasAttribute("transform")){let r=e.getAttribute("transform").split(")");for(let e=r.length-1;e>=0;e--){let i=r[e].trim();if(""===i)continue;let n=i.indexOf("("),o=i.length;if(n>0&&n<o){let e=i.slice(0,n),t=a(i.slice(n+1));switch(f.identity(),e){case"translate":if(t.length>=1){let e=t[0],r=0;t.length>=2&&(r=t[1]),f.translate(e,r)}break;case"rotate":if(t.length>=1){let e=0,r=0,i=0;e=t[0]*Math.PI/180,t.length>=3&&(r=t[1],i=t[2]),p.makeTranslation(-r,-i),g.makeRotation(e),y.multiplyMatrices(g,p),p.makeTranslation(r,i),f.multiplyMatrices(p,y)}break;case"scale":if(t.length>=1){let e=t[0],r=e;t.length>=2&&(r=t[1]),f.scale(e,r)}break;case"skewX":1===t.length&&f.set(1,Math.tan(t[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===t.length&&f.set(1,0,0,Math.tan(t[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===t.length&&f.set(t[0],t[2],t[4],t[1],t[3],t[5],0,0,1)}}t.premultiply(f)}}return t}(e);return m.length>0&&t.premultiply(m[m.length-1]),x.copy(t),m.push(t),t}(t),s=!1,C=null;switch(t.nodeName){case"svg":case"g":i=n(t,i);break;case"style":(function(e){if(e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length)for(let t=0;t<e.sheet.cssRules.length;t++){let r=e.sheet.cssRules[t];if(1!==r.type)continue;let i=r.selectorText.split(/,/gm).filter(Boolean).map(e=>e.trim());for(let e=0;e<i.length;e++){let t=Object.fromEntries(Object.entries(r.style).filter(([,e])=>""!==e));d[i[e]]=Object.assign(d[i[e]]||{},t)}}})(t);break;case"path":i=n(t,i),t.hasAttribute("d")&&(C=function(e){let t=new eT.T_1,i=new eT.FM8,n=new eT.FM8,o=new eT.FM8,s=!0,l=!1,c=e.getAttribute("d");if(""===c||"none"===c)return null;let u=c.match(/[a-df-z][^a-df-z]*/gi);for(let e=0,c=u.length;e<c;e++){var h,A,d,m,f,p,g,y;let c;let v=u[e],E=v.charAt(0),x=v.slice(1).trim();switch(!0===s&&(l=!0,s=!1),E){case"M":c=a(x);for(let e=0,r=c.length;e<r;e+=2)i.x=c[e+0],i.y=c[e+1],n.x=i.x,n.y=i.y,0===e?t.moveTo(i.x,i.y):t.lineTo(i.x,i.y),0===e&&o.copy(i);break;case"H":c=a(x);for(let e=0,r=c.length;e<r;e++)i.x=c[e],n.x=i.x,n.y=i.y,t.lineTo(i.x,i.y),0===e&&!0===l&&o.copy(i);break;case"V":c=a(x);for(let e=0,r=c.length;e<r;e++)i.y=c[e],n.x=i.x,n.y=i.y,t.lineTo(i.x,i.y),0===e&&!0===l&&o.copy(i);break;case"L":c=a(x);for(let e=0,r=c.length;e<r;e+=2)i.x=c[e+0],i.y=c[e+1],n.x=i.x,n.y=i.y,t.lineTo(i.x,i.y),0===e&&!0===l&&o.copy(i);break;case"C":c=a(x);for(let e=0,r=c.length;e<r;e+=6)t.bezierCurveTo(c[e+0],c[e+1],c[e+2],c[e+3],c[e+4],c[e+5]),n.x=c[e+2],n.y=c[e+3],i.x=c[e+4],i.y=c[e+5],0===e&&!0===l&&o.copy(i);break;case"S":c=a(x);for(let e=0,r=c.length;e<r;e+=4)t.bezierCurveTo((h=i.x)-(n.x-h),(A=i.y)-(n.y-A),c[e+0],c[e+1],c[e+2],c[e+3]),n.x=c[e+0],n.y=c[e+1],i.x=c[e+2],i.y=c[e+3],0===e&&!0===l&&o.copy(i);break;case"Q":c=a(x);for(let e=0,r=c.length;e<r;e+=4)t.quadraticCurveTo(c[e+0],c[e+1],c[e+2],c[e+3]),n.x=c[e+0],n.y=c[e+1],i.x=c[e+2],i.y=c[e+3],0===e&&!0===l&&o.copy(i);break;case"T":c=a(x);for(let e=0,r=c.length;e<r;e+=2){let r=(d=i.x)-(n.x-d),a=(m=i.y)-(n.y-m);t.quadraticCurveTo(r,a,c[e+0],c[e+1]),n.x=r,n.y=a,i.x=c[e+0],i.y=c[e+1],0===e&&!0===l&&o.copy(i)}break;case"A":c=a(x,[3,4],7);for(let e=0,a=c.length;e<a;
728e+=7){if(c[e+5]==i.x&&c[e+6]==i.y)continue;let a=i.clone();i.x=c[e+5],i.y=c[e+6],n.x=i.x,n.y=i.y,r(t,c[e],c[e+1],c[e+2],c[e+3],c[e+4],a,i),0===e&&!0===l&&o.copy(i)}break;case"m":c=a(x);for(let e=0,r=c.length;e<r;e+=2)i.x+=c[e+0],i.y+=c[e+1],n.x=i.x,n.y=i.y,0===e?t.moveTo(i.x,i.y):t.lineTo(i.x,i.y),0===e&&o.copy(i);break;case"h":c=a(x);for(let e=0,r=c.length;e<r;e++)i.x+=c[e],n.x=i.x,n.y=i.y,t.lineTo(i.x,i.y),0===e&&!0===l&&o.copy(i);break;case"v":c=a(x);for(let e=0,r=c.length;e<r;e++)i.y+=c[e],n.x=i.x,n.y=i.y,t.lineTo(i.x,i.y),0===e&&!0===l&&o.copy(i);break;case"l":c=a(x);for(let e=0,r=c.length;e<r;e+=2)i.x+=c[e+0],i.y+=c[e+1],n.x=i.x,n.y=i.y,t.lineTo(i.x,i.y),0===e&&!0===l&&o.copy(i);break;case"c":c=a(x);for(let e=0,r=c.length;e<r;e+=6)t.bezierCurveTo(i.x+c[e+0],i.y+c[e+1],i.x+c[e+2],i.y+c[e+3],i.x+c[e+4],i.y+c[e+5]),n.x=i.x+c[e+2],n.y=i.y+c[e+3],i.x+=c[e+4],i.y+=c[e+5],0===e&&!0===l&&o.copy(i);break;case"s":c=a(x);for(let e=0,r=c.length;e<r;e+=4)t.bezierCurveTo((f=i.x)-(n.x-f),(p=i.y)-(n.y-p),i.x+c[e+0],i.y+c[e+1],i.x+c[e+2],i.y+c[e+3]),n.x=i.x+c[e+0],n.y=i.y+c[e+1],i.x+=c[e+2],i.y+=c[e+3],0===e&&!0===l&&o.copy(i);break;case"q":c=a(x);for(let e=0,r=c.length;e<r;e+=4)t.quadraticCurveTo(i.x+c[e+0],i.y+c[e+1],i.x+c[e+2],i.y+c[e+3]),n.x=i.x+c[e+0],n.y=i.y+c[e+1],i.x+=c[e+2],i.y+=c[e+3],0===e&&!0===l&&o.copy(i);break;case"t":c=a(x);for(let e=0,r=c.length;e<r;e+=2){let r=(g=i.x)-(n.x-g),a=(y=i.y)-(n.y-y);t.quadraticCurveTo(r,a,i.x+c[e+0],i.y+c[e+1]),n.x=r,n.y=a,i.x=i.x+c[e+0],i.y=i.y+c[e+1],0===e&&!0===l&&o.copy(i)}break;case"a":c=a(x,[3,4],7);for(let e=0,a=c.length;e<a;e+=7){if(0==c[e+5]&&0==c[e+6])continue;let a=i.clone();i.x+=c[e+5],i.y+=c[e+6],n.x=i.x,n.y=i.y,r(t,c[e],c[e+1],c[e+2],c[e+3],c[e+4],a,i),0===e&&!0===l&&o.copy(i)}break;case"Z":case"z":t.currentPath.autoClose=!0,t.currentPath.curves.length>0&&(i.copy(o),t.currentPath.currentPoint.copy(i),s=!0);break;default:console.warn(v)}l=!1}return t}(t));break;case"rect":i=n(t,i),C=function(e){let t=l(e.getAttribute("x")||0),r=l(e.getAttribute("y")||0),i=l(e.getAttribute("rx")||e.getAttribute("ry")||0),n=l(e.getAttribute("ry")||e.getAttribute("rx")||0),a=l(e.getAttribute("width")),o=l(e.getAttribute("height")),s=new eT.T_1;return s.moveTo(t+i,r),s.lineTo(t+a-i,r),(0!==i||0!==n)&&s.bezierCurveTo(t+a-.448084975506*i,r,t+a,r+.448084975506*n,t+a,r+n),s.lineTo(t+a,r+o-n),(0!==i||0!==n)&&s.bezierCurveTo(t+a,r+o-.448084975506*n,t+a-.448084975506*i,r+o,t+a-i,r+o),s.lineTo(t+i,r+o),(0!==i||0!==n)&&s.bezierCurveTo(t+.448084975506*i,r+o,t,r+o-.448084975506*n,t,r+o-n),s.lineTo(t,r+n),(0!==i||0!==n)&&s.bezierCurveTo(t,r+.448084975506*n,t+.448084975506*i,r,t+i,r),s}(t);break;case"polygon":i=n(t,i),C=function(e){let t=new eT.T_1,r=0;return e.getAttribute("points").replace(/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,function(e,i,n){let a=l(i),o=l(n);0===r?t.moveTo(a,o):t.lineTo(a,o),r++}),t.currentPath.autoClose=!0,t}(t);break;case"polyline":i=n(t,i),C=function(e){let t=new eT.T_1,r=0;return e.getAttribute("points").replace(/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,function(e,i,n){let a=l(i),o=l(n);0===r?t.moveTo(a,o):t.lineTo(a,o),r++}),t.currentPath.autoClose=!1,t}(t);break;case"circle":i=n(t,i),C=function(e){let t=l(e.getAttribute("cx")||0),r=l(e.getAttribute("cy")||0),i=l(e.getAttribute("r")||0),n=new eT.y$t;n.absarc(t,r,i,0,2*Math.PI);let a=new eT.T_1;return a.subPaths.push(n),a}(t);break;case"ellipse":i=n(t,i),C=function(e){let t=l(e.getAttribute("cx")||0),r=l(e.getAttribute("cy")||0),i=l(e.getAttribute("rx")||0),n=l(e.getAttribute("ry")||0),a=new eT.y$t;a.absellipse(t,r,i,n,0,2*Math.PI);let o=new eT.T_1;return o.subPaths.push(a),o}(t);break;case"line":i=n(t,i),C=function(e){let t=l(e.getAttribute("x1")||0),r=l(e.getAttribute("y1")||0),i=l(e.getAttribute("x2")||0),n=l(e.getAttribute("y2")||0),a=new eT.T_1;return a.moveTo(t,r),a.lineTo(i,n),a.currentPath.autoClose=!1,a}(t);break;case"defs":s=!0;break;case"use":i=n(t,i);let w=(t.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),B=t.viewportElement.getElementById(w);B?e(B,i):console.warn("SVGLoader: 'use node' references non-existent node id: "+w)}C&&(void 0!==i.fill&&"none"!==i.fill&&C.color.setStyle(i.fill,"srgb"),function(e,t){function r(e){E.set(e.x,e.y,1).applyMatrix3(t),e.set(E.x,E.y)}let i=e.subPaths;for(let e=0,n=i.length;e<n;e++){let n=i[e].curves;for(let e=0;e<n.length;e++){let i=n[e];i.isLineCurve?(r(i.v1),r(i.v2)):i.isCubicBezierCurve?(r(i.v0),r(i.v1),r(i.v2),r(i.v3)):i.isQuadraticBezierCurve?(r(i.v0),r(i.v1),r(i.v2)):i.isEllipseCurve&&(v.set(i.aX,i.aY),r(v),i.aX=v.x,i.aY=v.y,function(e){let t=e.elements,r=t[0]*t[3]+t[1]*t[4];return 0!==r&&Math.abs(r/(u(e)*h(e)))>Number.EPSILON}(t)?function(e){let r=e.xRadius,i=e.yRadius,n=Math.cos(e.aRotation),a=Math.sin(e.aRotation),o=new eT.Pa4(r*n,r*a,0),s=new eT.Pa4(-i*a,i*n,0),l=o.applyMatrix3(t),u=s.applyMatrix3(t),h=f.set(l.x,u.x,0,l.y,u.y,0,0,0,1),A=p.copy(h).invert(),d=g.copy(A).transpose().multiply(A).elements,m=function(e,t,r){let i,n,a,o,s;let l=e+r,c=e-r,u=Math.sqrt(c*c+4*t*t);return l>0?n=e*(s=1/(i=.5*(l+u)))*r-t*s*t:l<0?n=.5*(l-u):(i=.5*u,n=-.5*u),Math.abs(a=c>0?c+u:c-u)>2*Math.abs(t)?(o=1/Math.sqrt(1+(s=-2*t/a)*s),a=s*o):0===Math.abs(t)?(a=1,o=0):(a=1/Math.sqrt(1+(s=-.5*a/t)*s),o=s*a),c>0&&(s=a,a=-o,o=s),{rt1:i,rt2:n,cs:a,sn:o}}(d[0],d[1],d[4]),y=Math.sqrt(m.rt1),v=Math.sqrt(m.rt2);if(e.xRadius=1/y,e.yRadius=1/v,e.aRotation=Math.atan2(m.sn,m.cs),!((e.aEndAngle-e.aStartAngle)%(2*Math.PI)<Number.EPSILON)){let r=p.set(y,0,0,0,v,0,0,0,1),i=g.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),n=r.multiply(i).multiply(h),a=e=>{let{x:t,y:r}=new eT.Pa4(Math.cos(e),Math.sin(e),0).applyMatrix3(n);return Math.atan2(r,t)};e.aStartAngle=a(e.aStartAngle),e.aEndAngle=a(e.aEndAngle),c(t)&&(e.aClockwise=!e.aClockwise)}}(i):function(e){let r=u(t),i=h(t);e.xRadius*=r,e.yRadius*=i;let n=r>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);e.aRotation+=n,c(t)&&(e.aStartAngle*=-1,e.aEndAngle*=-1,e.aClockwise=!e.aClockwise)}(i))}}}(C,x),A.push(C),C.userData={node:t,style:i});let I=t.childNodes;for(let t=0;t<I.length;t++){let r=I[t];s&&"style"!==r.nodeName&&"defs"!==r.nodeName||e(r,i)}o&&(m.pop(),m.length>0?x.copy(m[m.length-1]):x.identity())}(C.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4}),{paths:A,xml:C.documentElement}}static createShapes(e){let t={ORIGIN:0,DESTINATION:1,BETWEEN:2,LEFT:3,RIGHT:4,BEHIND:5,BEYOND:6},r={loc:t.ORIGIN,t:0};function i(e,i,n){let a;let o=n.x-i.x,s=n.y-i.y,l=e.x-i.x,c=e.y-i.y,u=o*c-l*s;if(e.x===i.x&&e.y===i.y){r.loc=t.ORIGIN,r.t=0;return}if(e.x===n.x&&e.y===n.y){r.loc=t.DESTINATION,r.t=1;return}if(u<-Number.EPSILON){r.loc=t.LEFT;return}if(u>Number.EPSILON){r.loc=t.RIGHT;return}if(o*l<0||s*c<0){r.loc=t.BEHIND;return}if(Math.sqrt(o*o+s*s)<Math.sqrt(l*l+c*c)){r.loc=t.BEYOND;return}a=0!==o?l/o:c/s,r.loc=t.BETWEEN,r.t=a}let n=999999999,a=-999999999,o=e.subPaths.map(e=>{let t=e.getPoints(),r=-999999999,i=999999999,o=-999999999,s=999999999;for(let e=0;e<t.length;e++){let n=t[e];n.y>r&&(r=n.y),n.y<i&&(i=n.y),n.x>o&&(o=n.x),n.x<s&&(s=n.x)}return a<=o&&(a=o+1),n>=s&&(n=s-1),{curves:e.curves,points:t,isCW:eT.iDF.isClockWise(t),identifier:-1,boundingBox:new eT.TUj(new eT.FM8(s,i),new eT.FM8(o,r))}});o=o.filter(e=>e.points.length>1);for(let e=0;e<o.length;e++)o[e].identifier=e;let s=o.map(s=>(function(e,n,a,o,s){(null==s||""===s)&&(s="nonzero");let l=new eT.FM8;e.boundingBox.getCenter(l);let c=function(e,n,a){let o=new eT.FM8;n.getCenter(o);let s=[];return a.forEach(n=>
728{n.boundingBox.containsPoint(o)&&(function(e,n){let a=[],o=[];for(let s=1;s<e.length;s++){let l=e[s-1],c=e[s];for(let e=1;e<n.length;e++){let s=function(e,n,a,o){let s=e.x,l=n.x,c=a.x,u=o.x,h=e.y,A=n.y,d=a.y,m=o.y,f=(u-c)*(h-d)-(m-d)*(s-c),p=(m-d)*(l-s)-(u-c)*(A-h),g=f/p,y=((l-s)*(h-d)-(A-h)*(s-c))/p;if(0===p&&0!==f||g<=0||g>=1||y<0||y>1)return null;if(0===f&&0===p){for(let c=0;c<2;c++){if(i(0===c?a:o,e,n),r.loc==t.ORIGIN){let e=0===c?a:o;return{x:e.x,y:e.y,t:r.t}}if(r.loc==t.BETWEEN)return{x:+(s+r.t*(l-s)).toPrecision(10),y:+(h+r.t*(A-h)).toPrecision(10),t:r.t}}return null}for(let s=0;s<2;s++)if(i(0===s?a:o,e,n),r.loc==t.ORIGIN){let e=0===s?a:o;return{x:e.x,y:e.y,t:r.t}}return{x:+(s+g*(l-s)).toPrecision(10),y:+(h+g*(A-h)).toPrecision(10),t:g}}(l,c,n[e-1],n[e]);null!==s&&void 0===a.find(e=>e.t<=s.t+Number.EPSILON&&e.t>=s.t-Number.EPSILON)&&(a.push(s),o.push(new eT.FM8(s.x,s.y)))}}return o})(e,n.points).forEach(e=>{s.push({identifier:n.identifier,isCW:n.isCW,point:e})})}),s.sort((e,t)=>e.point.x-t.point.x),s}([new eT.FM8(a,l.y),new eT.FM8(o,l.y)],e.boundingBox,n);c.sort((e,t)=>e.point.x-t.point.x);let u=[],h=[];c.forEach(t=>{t.identifier===e.identifier?u.push(t):h.push(t)});let A=u[0].point.x,d=[],m=0;for(;m<h.length&&h[m].point.x<A;)d.length>0&&d[d.length-1]===h[m].identifier?d.pop():d.push(h[m].identifier),m++;if(d.push(e.identifier),"evenodd"===s){let t=d.length%2==0,r=d[d.length-2];return{identifier:e.identifier,isHole:t,for:r}}if("nonzero"===s){let t=!0,r=null,i=null;for(let e=0;e<d.length;e++){let a=d[e];t?(i=n[a].isCW,t=!1,r=a):i!==n[a].isCW&&(i=n[a].isCW,t=!0)}return{identifier:e.identifier,isHole:t,for:r}}console.warn('fill-rule: "'+s+'" is currently not implemented.')})(s,o,n,a,e.userData?e.userData.style.fillRule:void 0)),l=[];return o.forEach(e=>{if(!s[e.identifier].isHole){let t=new eT.bnF;t.curves=e.curves,s.filter(t=>t.isHole&&t.for===e.identifier).forEach(e=>{let r=o[e.identifier],i=new eT.y$t;i.curves=r.curves,t.holes.push(i)}),l.push(t)}}),l}static getStrokeStyle(e,t,r,i,n){return{strokeColor:t=void 0!==t?t:"#000",strokeWidth:e=void 0!==e?e:1,strokeLineJoin:r=void 0!==r?r:"miter",strokeLineCap:i=void 0!==i?i:"butt",strokeMiterLimit:n=void 0!==n?n:4}}static pointsToStroke(t,r,i,n){let a=[],o=[],s=[];if(0===e.pointsToStrokeWithBuffers(t,r,i,n,a,o,s))return null;let l=new eT.u9r;return l.setAttribute("position",new eT.a$l(a,3)),l.setAttribute("normal",new eT.a$l(o,3)),l.setAttribute("uv",new eT.a$l(s,2)),l}static pointsToStrokeWithBuffers(e,t,r,i,n,a,o,s){let l,c,u,h,A;let d=new eT.FM8,m=new eT.FM8,f=new eT.FM8,p=new eT.FM8,g=new eT.FM8,y=new eT.FM8,v=new eT.FM8,E=new eT.FM8,x=new eT.FM8,C=new eT.FM8,w=new eT.FM8,B=new eT.FM8,I=new eT.FM8,_=new eT.FM8,b=new eT.FM8,M=new eT.FM8,S=new eT.FM8;r=void 0!==r?r:12,i=void 0!==i?i:.001,s=void 0!==s?s:0;let D=(e=function(e){let t=!1;for(let r=1,n=e.length-1;r<n;r++)if(e[r].distanceTo(e[r+1])<i){t=!0;break}if(!t)return e;let r=[];r.push(e[0]);for(let t=1,n=e.length-1;t<n;t++)e[t].distanceTo(e[t+1])>=i&&r.push(e[t]);return r.push(e[e.length-1]),r}(e)).length;if(D<2)return 0;let P=e[0].equals(e[D-1]),T=e[0],R=t.strokeWidth/2,F=1/(D-1),Q=0,z,k=!1,L=0,O=3*s,U=2*s;G(e[0],e[1],d).multiplyScalar(R),E.copy(e[0]).sub(d),x.copy(e[0]).add(d),C.copy(E),w.copy(x);for(let r=1;r<D;r++){if(l=e[r],c=r===D-1?P?e[1]:void 0:e[r+1],G(T,l,d),f.copy(d).multiplyScalar(R),B.copy(l).sub(f),I.copy(l).add(f),z=Q+F,u=!1,void 0!==c){G(l,c,m),f.copy(m).multiplyScalar(R),_.copy(l).sub(f),b.copy(l).add(f),h=!0,f.subVectors(c,T),0>d.dot(f)&&(h=!1),1===r&&(k=h),f.subVectors(c,l),f.normalize();let e=Math.abs(d.dot(f));if(e>Number.EPSILON){let r=R/e;f.multiplyScalar(-r),p.subVectors(l,T),g.copy(p).setLength(r).add(f),M.copy(g).negate();let i=g.length(),n=p.length();p.divideScalar(n),y.subVectors(c,l);let a=y.length();switch(y.divideScalar(a),p.dot(M)<n&&y.dot(M)<a&&(u=!0),S.copy(g).add(l),M.add(l),A=!1,u?h?(b.copy(M),I.copy(M)):(_.copy(M),B.copy(M)):j(),t.strokeLineJoin){case"bevel":J(h,u,z);break;case"round":V(h,u),h?H(l,B,_,z,0):H(l,b,I,z,1);break;default:let o=R*t.strokeMiterLimit/i;o<1?"miter-clip"!==t.strokeLineJoin?J(h,u,z):(V(h,u),h?(y.subVectors(S,B).multiplyScalar(o).add(B),v.subVectors(S,_).multiplyScalar(o).add(_),N(B,z,0),N(y,z,0),N(l,z,.5),N(l,z,.5),N(y,z,0),N(v,z,0),N(l,z,.5),N(v,z,0),N(_,z,0)):(y.subVectors(S,I).multiplyScalar(o).add(I),v.subVectors(S,b).multiplyScalar(o).add(b),N(I,z,1),N(y,z,1),N(l,z,.5),N(l,z,.5),N(y,z,1),N(v,z,1),N(l,z,.5),N(v,z,1),N(b,z,1))):(u?(h?(N(x,Q,1),N(E,Q,0),N(S,z,0),N(x,Q,1),N(S,z,0),N(M,z,1)):(N(x,Q,1),N(E,Q,0),N(S,z,1),N(E,Q,0),N(M,z,0),N(S,z,1)),h?_.copy(S):b.copy(S)):h?(N(B,z,0),N(S,z,0),N(l,z,.5),N(l,z,.5),N(S,z,0),N(_,z,0)):(N(I,z,1),N(S,z,1),N(l,z,.5),N(l,z,.5),N(S,z,1),N(b,z,1)),A=!0)}}else j()}else j();P||r!==D-1||K(e[0],C,w,h,!0,Q),Q=z,T=l,E.copy(_),x.copy(b)}if(P){if(u&&n){let e=S,t=M;
728k!==h&&(e=M,t=S),h?(A||k)&&(t.toArray(n,0),t.toArray(n,9),A&&e.toArray(n,3)):(A||!k)&&(t.toArray(n,3),t.toArray(n,9),A&&e.toArray(n,0))}}else K(l,B,I,h,!1,z);return L;function G(e,t,r){return r.subVectors(t,e),r.set(-r.y,r.x).normalize()}function N(e,t,r){n&&(n[O]=e.x,n[O+1]=e.y,n[O+2]=0,a&&(a[O]=0,a[O+1]=0,a[O+2]=1),O+=3,o&&(o[U]=t,o[U+1]=r,U+=2)),L+=3}function H(e,t,i,n,a){d.copy(t).sub(e).normalize(),m.copy(i).sub(e).normalize();let o=Math.PI,s=d.dot(m);1>Math.abs(s)&&(o=Math.abs(Math.acos(s))),o/=r,f.copy(t);for(let t=0,i=r-1;t<i;t++)p.copy(f).rotateAround(e,o),N(f,n,a),N(p,n,a),N(e,n,.5),f.copy(p);N(p,n,a),N(i,n,a),N(e,n,.5)}function j(){N(x,Q,1),N(E,Q,0),N(B,z,0),N(x,Q,1),N(B,z,0),N(I,z,1)}function J(e,t,r){t?e?(N(x,Q,1),N(E,Q,0),N(B,z,0),N(x,Q,1),N(B,z,0),N(M,z,1),N(B,r,0),N(_,r,0),N(M,r,.5)):(N(x,Q,1),N(E,Q,0),N(I,z,1),N(E,Q,0),N(M,z,0),N(I,z,1),N(I,r,1),N(M,r,0),N(b,r,1)):(e?(N(B,r,0),N(_,r,0)):(N(I,r,1),N(b,r,0)),N(l,r,.5))}function V(e,t){t&&(e?(N(x,Q,1),N(E,Q,0),N(B,z,0),N(x,Q,1),N(B,z,0),N(M,z,1),N(B,Q,0),N(l,z,.5),N(M,z,1),N(l,z,.5),N(_,Q,0),N(M,z,1)):(N(x,Q,1),N(E,Q,0),N(I,z,1),N(E,Q,0),N(M,z,0),N(I,z,1),N(I,Q,1),N(M,z,0),N(l,z,.5),N(l,z,.5),N(M,z,0),N(b,Q,1)))}function K(e,r,i,a,s,l){switch(t.strokeLineCap){case"round":s?H(e,i,r,l,.5):H(e,r,i,l,.5);break;case"square":if(s)d.subVectors(r,e),m.set(d.y,-d.x),f.addVectors(d,m).add(e),p.subVectors(m,d).add(e),a?(f.toArray(n,3),p.toArray(n,0),p.toArray(n,9)):(f.toArray(n,3),1===o[7]?p.toArray(n,9):f.toArray(n,9),p.toArray(n,0));else{d.subVectors(i,e),m.set(d.y,-d.x),f.addVectors(d,m).add(e),p.subVectors(m,d).add(e);let t=n.length;a?(f.toArray(n,t-3),p.toArray(n,t-6)):(p.toArray(n,t-6),f.toArray(n,t-3)),p.toArray(n,t-12)}}}}}return e})(),li=(0,eD.forwardRef)(function({src:e,skipFill:t,skipStrokes:r,fillMaterial:i,strokeMaterial:n,fillMeshProps:a,strokeMeshProps:o,...s},l){let c=(0,eR.H)(lr,e.startsWith("<svg")?`data:image/svg+xml;utf8,${e}`:e),u=(0,eD.useMemo)(()=>r?[]:c.paths.map(e=>{var t;return(null==(t=e.userData)?void 0:t.style.stroke)===void 0||"none"===e.userData.style.stroke?null:e.subPaths.map(t=>lr.pointsToStroke(t.getPoints(),e.userData.style))}),[c,r]);(0,eD.useEffect)(()=>()=>u.forEach(e=>e&&e.map(e=>e.dispose())),[u]);let h=0;return eD.createElement("object3D",(0,eS.Z)({ref:l},s),eD.createElement("object3D",{scale:[1,-1,1]},c.paths.map((e,s)=>{var l,c;return eD.createElement(eD.Fragment,{key:s},!t&&(null==(l=e.userData)?void 0:l.style.fill)!==void 0&&"none"!==e.userData.style.fill&&lr.createShapes(e).map((t,r)=>eD.createElement("mesh",(0,eS.Z)({key:r},a,{renderOrder:h++}),eD.createElement("shapeGeometry",{args:[t]}),eD.createElement("meshBasicMaterial",(0,eS.Z)({color:e.userData.style.fill,opacity:e.userData.style.fillOpacity,transparent:!0,side:eT.ehD,depthWrite:!1},i)))),!r&&(null==(c=e.userData)?void 0:c.style.stroke)!==void 0&&"none"!==e.userData.style.stroke&&e.subPaths.map((t,r)=>eD.createElement("mesh",(0,eS.Z)({key:r,geometry:u[s][r]},o,{renderOrder:h++}),eD.createElement("meshBasicMaterial",(0,eS.Z)({color:e.userData.style.stroke,opacity:e.userData.style.strokeOpacity,transparent:!0,side:eT.ehD,depthWrite:!1},n)))))})))}),ln=new WeakMap;class la extends eT.aNw{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,r,i){let n=new eT.hH6(this.manager);n.setPath(this.path),n.setResponseType("arraybuffer"),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(e,e=>{let r={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,r).then(t).catch(i)},r,i)}
728decodeDracoFile(e,t,r,i){let n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,n).then(t)}decodeGeometry(e,t){let r;for(let e in t.attributeTypes){let r=t.attributeTypes[e];void 0!==r.BYTES_PER_ELEMENT&&(t.attributeTypes[e]=r.name)}let i=JSON.stringify(t);if(ln.has(e)){let t=ln.get(e);if(t.key===i)return t.promise;if(0===e.byteLength)throw Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n=this.workerNextTaskID++,a=e.byteLength,o=this._getWorker(n,a).then(i=>(r=i,new Promise((i,a)=>{r._callbacks[n]={resolve:i,reject:a},r.postMessage({type:"decode",id:n,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return o.catch(()=>!0).then(()=>{r&&n&&this._releaseTask(r,n)}),ln.set(e,{key:i,promise:o}),o}_createGeometry(e){let t=new eT.u9r;e.index&&t.setIndex(new eT.TlE(e.index.array,1));for(let r=0;r<e.attributes.length;r++){let i=e.attributes[r],n=i.name,a=i.array,o=i.itemSize;t.setAttribute(n,new eT.TlE(a,o))}return t}_loadLibrary(e,t){let r=new eT.hH6(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((t,i)=>{r.load(e,t,void 0,i)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{let r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);let i=lo.toString(),n=["/* draco decoder */",r,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([n]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){let r=t.data;switch(r.type){case"decode":e._callbacks[r.id].resolve(r);break;case"error":e._callbacks[r.id].reject(r);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+r.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort(function(e,t){return e._taskLoad>t._taskLoad?-1:1});let r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function lo(){let e,t;onmessage=function(r){let i=r.data;switch(i.type){case"init":e=i.decoderConfig,t=new Promise(function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)});break;case"decode":let n=i.buffer,a=i.taskConfig;t.then(e=>{let t=e.draco,r=new t.Decoder,o=new t.DecoderBuffer;o.Init(new Int8Array(n),n.byteLength);try{let e=function(e,t,r,i){let n,a;let o=i.attributeIDs,s=i.attributeTypes,l=t.GetEncodedGeometryType(r);if(l===e.TRIANGULAR_MESH)n=new e.Mesh,a=t.DecodeBufferToMesh(r,n);else if(l===e.POINT_CLOUD)n=new e.PointCloud,a=t.DecodeBufferToPointCloud(r,n);else throw Error("THREE.DRACOLoader: Unexpected geometry type.");if(!a.ok()||0===n.ptr)throw Error("THREE.DRACOLoader: Decoding failed: "+a.error_msg());let c={index:null,attributes:[]};for(let r in o){let a,l;let u=self[s[r]];if(i.useUniqueIDs)l=o[r],a=t.GetAttributeByUniqueId(n,l);else{if(-1===(l=t.GetAttributeId(n,e[o[r]])))continue;a=t.GetAttribute(n,l)}c.attributes.push(function(e,t,r,i,n,a){let o=a.num_components(),s=r.num_points()*o,l=s*n.BYTES_PER_ELEMENT,c=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,n),u=e._malloc(l);t.GetAttributeDataArrayForAllPoints(r,a,c,l,u);let h=new n(e.HEAPF32.buffer,u,s).slice();return e._free(u),{name:i,array:h,itemSize:o}}(e,t,n,r,u,a))}return l===e.TRIANGULAR_MESH&&(c.index=function(e,t,r){let i=3*r.num_faces(),n=4*i,a=e._malloc(n);t.GetTrianglesUInt32Array(r,n,a);let o=new Uint32Array(e.HEAPF32.buffer,a,i).slice();return e._free(a),{array:o,itemSize:1}}
728(e,t,n)),e.destroy(n),c}(t,r,o,a),n=e.attributes.map(e=>e.array.buffer);e.index&&n.push(e.index.array.buffer),self.postMessage({type:"decode",id:i.id,geometry:e},n)}catch(e){console.error(e),self.postMessage({type:"error",id:i.id,error:e.message})}finally{t.destroy(o),t.destroy(r)}})}}}let ls=()=>{let e;if(a)return a;let t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),r=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if("object"!=typeof WebAssembly)return{supported:!1};let i="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";WebAssembly.validate(t)&&(i="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");let n=WebAssembly.instantiate(function(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r){let i=e.charCodeAt(r);t[r]=i>96?i-71:i>64?i-65:i>47?i+4:i>46?63:62}let i=0;for(let n=0;n<e.length;++n)t[i++]=t[n]<60?r[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,i)}(i),{}).then(t=>{(e=t.instance).exports.__wasm_call_ctors()});function o(t,r,i,n,a,o){let s=e.exports.sbrk,l=i+3&-4,c=s(l*n),u=s(a.length),h=new Uint8Array(e.exports.memory.buffer);h.set(a,u);let A=t(c,i,n,u,a.length);if(0===A&&o&&o(c,l,n),r.set(h.subarray(c,c+i*n)),s(c-s(0)),0!==A)throw Error(`Malformed buffer data: ${A}`)}let s={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},l={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return a={ready:n,supported:!0,decodeVertexBuffer(t,r,i,n,a){o(e.exports.meshopt_decodeVertexBuffer,t,r,i,n,e.exports[s[a]])},decodeIndexBuffer(t,r,i,n){o(e.exports.meshopt_decodeIndexBuffer,t,r,i,n)},decodeIndexSequence(t,r,i,n){o(e.exports.meshopt_decodeIndexSequence,t,r,i,n)},decodeGltfBuffer(t,r,i,n,a,c){o(e.exports[l[a]],t,r,i,n,e.exports[s[c]])}}};function ll(e){if("undefined"!=typeof TextDecoder)return new TextDecoder().decode(e);let t="";for(let r=0,i=e.length;r<i;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch(e){return t}}let lc="srgb",lu="srgb-linear";class lh extends eT.aNw{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new lg(e)}),this.register(function(e){return new ly(e)}),this.register(function(e){return new lb(e)}),this.register(function(e){return new lM(e)}),this.register(function(e){return new lS(e)}),this.register(function(e){return new lE(e)}),this.register(function(e){return new lx(e)}),this.register(function(e){return new lC(e)}),this.register(function(e){return new lw(e)}),this.register(function(e){return new lp(e)}),this.register(function(e){return new lB(e)}),this.register(function(e){return new lv(e)}),this.register(function(e){return new l_(e)}),this.register(function(e){return new lI(e)}),this.register(function(e){return new lm(e)}
728),this.register(function(e){return new lD(e)}),this.register(function(e){return new lP(e)})}load(e,t,r,i){let n;let a=this;if(""!==this.resourcePath)n=this.resourcePath;else if(""!==this.path){let t=eT.Zp0.extractUrlBase(e);n=eT.Zp0.resolveURL(t,this.path)}else n=eT.Zp0.extractUrlBase(e);this.manager.itemStart(e);let o=function(t){i?i(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},s=new eT.hH6(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(r){try{a.parse(r,n,function(r){t(r),a.manager.itemEnd(e)},o)}catch(e){o(e)}},r,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return -1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return -1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,i){let n;let a={},o={};if("string"==typeof e)n=JSON.parse(e);else if(e instanceof ArrayBuffer){if(ll(new Uint8Array(e.slice(0,4)))===lT){try{a[ld.KHR_BINARY_GLTF]=new lF(e)}catch(e){i&&i(e);return}n=JSON.parse(a[ld.KHR_BINARY_GLTF].content)}else n=JSON.parse(ll(new Uint8Array(e)))}else n=e;if(void 0===n.asset||n.asset.version[0]<2){i&&i(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let s=new l0(n,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});s.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){let t=this.pluginCallbacks[e](s);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[t.name]=t,a[t.name]=!0}if(n.extensionsUsed)for(let e=0;e<n.extensionsUsed.length;++e){let t=n.extensionsUsed[e],r=n.extensionsRequired||[];switch(t){case ld.KHR_MATERIALS_UNLIT:a[t]=new lf;break;case ld.KHR_DRACO_MESH_COMPRESSION:a[t]=new lQ(n,this.dracoLoader);break;case ld.KHR_TEXTURE_TRANSFORM:a[t]=new lz;break;case ld.KHR_MESH_QUANTIZATION:a[t]=new lk;break;default:r.indexOf(t)>=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}s.setExtensions(a),s.setPlugins(o),s.parse(r,i)}parseAsync(e,t){let r=this;return new Promise(function(i,n){r.parse(e,t,i,n)})}}function lA(){let e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}let ld={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class lm{constructor(e){this.parser=e,this.name=ld.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let r=0,i=t.length;r<i;r++){let i=t[r];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){let t;let r=this.parser,i="light:"+e,n=r.cache.get(i);if(n)return n;let a=r.json,o=((a.extensions&&a.extensions[this.name]||{}).lights||[])[e],s=new eT.Ilk(16777215);
728void 0!==o.color&&s.setRGB(o.color[0],o.color[1],o.color[2],lu);let l=void 0!==o.range?o.range:0;switch(o.type){case"directional":(t=new eT.Ox3(s)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new eT.cek(s)).distance=l;break;case"spot":(t=new eT.PMe(s)).distance=l,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,t.angle=o.spot.outerConeAngle,t.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return t.position.set(0,0,0),t.decay=2,lX(t,o),void 0!==o.intensity&&(t.intensity=o.intensity),t.name=r.createUniqueName(o.name||"light_"+e),n=Promise.resolve(t),r.cache.add(i,n),n}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){let t=this,r=this.parser,i=r.json.nodes[e],n=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then(function(e){return r._getNodeRef(t.cache,n,e)})}}class lf{constructor(){this.name=ld.KHR_MATERIALS_UNLIT}getMaterialType(){return eT.vBJ}extendParams(e,t,r){let i=[];e.color=new eT.Ilk(1,1,1),e.opacity=1;let n=t.pbrMetallicRoughness;if(n){if(Array.isArray(n.baseColorFactor)){let t=n.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],lu),e.opacity=t[3]}void 0!==n.baseColorTexture&&i.push(r.assignTexture(e,"map",n.baseColorTexture,lc))}return Promise.all(i)}}class lp{constructor(e){this.parser=e,this.name=ld.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let i=r.extensions[this.name].emissiveStrength;return void 0!==i&&(t.emissiveIntensity=i),Promise.resolve()}}class lg{constructor(e){this.parser=e,this.name=ld.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eT.EJi:null}extendMaterialParams(e,t){let r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let n=[],a=i.extensions[this.name];if(void 0!==a.clearcoatFactor&&(t.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&n.push(r.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&n.push(r.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(n.push(r.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){let e=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new eT.FM8(e,e)}return Promise.all(n)}}class ly{constructor(e){this.parser=e,this.name=ld.KHR_MATERIALS_DISPERSION}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eT.EJi:null}extendMaterialParams(e,t){let r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let i=r.extensions[this.name];return t.dispersion=void 0!==i.dispersion?i.dispersion:0,Promise.resolve()}}class lv{constructor(e){this.parser=e,this.name=ld.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eT.EJi:null}extendMaterialParams(e,t){let r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let n=[],a=i.extensions[this.name];return void 0!==a.iridescenceFactor&&(t.iridescence=a.iridescenceFactor),void 0!==a.iridescenceTexture&&n.push(r.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),void 0!==a.iridescenceIor&&(t.iridescenceIOR=a.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==a.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),void 0!==a.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),void 0!==a.iridescenceThicknessTexture&&n.push(r.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(n)}}class lE{constructor(e){this.parser=e,this.name=ld.KHR_MATERIALS_SHEEN}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eT.EJi:null}extendMaterialParams(e,t){let r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let n=[];t.sheenColor=new eT.Ilk(0,0,0),t.sheenRoughness=0,t.sheen=1;let a=i.extensions[this.name];if(void 0!==a.sheenColorFactor){let e=a.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],lu)}return void 0!==a.sheenRoughnessFactor&&(t.sheenRoughness=a.sheenRoughnessFactor),void 0!==a.sheenColorTexture&&n.push(r.assignTexture(t,"sheenColorMap",a.sheenColorTexture,lc)),void 0!==a.sheenRoughnessTexture&&n.push(r.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(n)}}class lx{constructor(e){this.parser=e,this.name=ld.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eT.EJi:null}extendMaterialParams(e,t){let r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let n=[],a=i.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(n)}}class lC{constructor(e){this.parser=e,this.name=ld.KHR_MATERIALS_VOLUME}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eT.EJi:null}extendMaterialParams(e,t){let r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let n=[],a=i.extensions[this.name];t.thickness=void 0!==a.thicknessFactor?a.thicknessFactor:0,void 0!==a.thicknessTexture&&n.push(r.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;let o=a.attenuationColor||[1,1,1];return t.attenuationColor=new eT.Ilk().setRGB(o[0],o[1],o[2],lu),Promise.all(n)}}class lw{constructor(e){this.parser=e,this.name=ld.KHR_MATERIALS_IOR}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eT.EJi:null}extendMaterialParams(e,t){let r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let i=r.extensions[this.name];return t.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class lB{constructor(e){this.parser=e,this.name=ld.KHR_MATERIALS_SPECULAR}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eT.EJi:null}extendMaterialParams(e,t){let r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let n=[],a=i.extensions[this.name];t.specularIntensity=void 0!==a.specularFactor?a.specularFactor:1,void 0!==a.specularTexture&&n.push(r.assignTexture(t,"specularIntensityMap",a.specularTexture));let o=a.specularColorFactor||[1,1,1];return t.specularColor=new eT.Ilk().setRGB(o[0],o[1],o[2],lu),void 0!==a.specularColorTexture&&n.push(r.assignTexture(t,"specularColorMap",a.specularColorTexture,lc)),Promise.all(n)}}class lI{constructor(e){this.parser=e,this.name=ld.EXT_MATERIALS_BUMP}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eT.EJi:null}extendMaterialParams(e,t){let r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let n=[],a=i.extensions[this.name];return t.bumpScale=void 0!==a.bumpFactor?a.bumpFactor:1,void 0!==a.bumpTexture&&n.push(r.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(n)}}class l_{constructor(e){this.parser=e,this.name=ld.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eT.EJi:null}extendMaterialParams(e,t){let r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let n=[],a=i.extensions[this.name];return void 0!==a.anisotropyStrength&&(t.anisotropy=a.anisotropyStrength),void 0!==a.anisotropyRotation&&(t.anisotropyRotation=a.anisotropyRotation),void 0!==a.anisotropyTexture&&n.push(r.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(n)}}class lb{constructor(e){this.parser=e,this.name=ld.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,r=t.json,i=r.textures[e];if(!i.extensions||!i.extensions[this.name])return null;let n=i.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(!(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0))return null;throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures")}return t.loadTextureImage(e,n.source,a)}}class lM{constructor(e){this.parser=e,this.name=ld.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){let t=this.name,r=this.parser,i=r.json,n=i.textures[e];if(!n.extensions||!n.extensions[t])return null;let a=n.extensions[t],o=i.images[a.source],s=r.textureLoader;if(o.uri){let e=r.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then(function(n){if(n)return r.loadTextureImage(e,a.source,s);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class lS{constructor(e){this.parser=e,this.name=ld.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){let t=this.name,r=this.parser,i=r.json,n=i.textures[e];if(!n.extensions||!n.extensions[t])return null;let a=n.extensions[t],o=i.images[a.source],s=r.textureLoader;if(o.uri){let e=r.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then(function(n){if(n)return r.loadTextureImage(e,a.source,s);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdj
728FDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class lD{constructor(e){this.name=ld.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,r=t.bufferViews[e];if(!r.extensions||!r.extensions[this.name])return null;{let e=r.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),n=this.parser.options.meshoptDecoder;if(!n||!n.supported){if(!(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0))return null;throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files")}return i.then(function(t){let r=e.byteOffset||0,i=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,r,i);return n.decodeGltfBufferAsync?n.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):n.ready.then(function(){let t=new ArrayBuffer(a*o);return n.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}}}class lP{constructor(e){this.name=ld.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;for(let e of t.meshes[r.mesh].primitives)if(e.mode!==lG.TRIANGLES&&e.mode!==lG.TRIANGLE_STRIP&&e.mode!==lG.TRIANGLE_FAN&&void 0!==e.mode)return null;let i=r.extensions[this.name].attributes,n=[],a={};for(let e in i)n.push(this.parser.getDependency("accessor",i[e]).then(t=>(a[e]=t,a[e])));return n.length<1?null:(n.push(this.parser.createNodeMesh(e)),Promise.all(n).then(e=>{let t=e.pop(),r=t.isGroup?t.children:[t],i=e[0].count,n=[];for(let e of r){let t=new eT.yGw,r=new eT.Pa4,o=new eT._fP,s=new eT.Pa4(1,1,1),l=new eT.SPe(e.geometry,e.material,i);for(let e=0;e<i;e++)a.TRANSLATION&&r.fromBufferAttribute(a.TRANSLATION,e),a.ROTATION&&o.fromBufferAttribute(a.ROTATION,e),a.SCALE&&s.fromBufferAttribute(a.SCALE,e),l.setMatrixAt(e,t.compose(r,o,s));for(let t in a)if("_COLOR_0"===t){let e=a[t];l.instanceColor=new eT.lb7(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,a[t]);eT.Tme.prototype.copy.call(l,e),this.parser.assignFinalMaterial(l),n.push(l)}return t.isGroup?(t.clear(),t.add(...n),t):n[0]}))}}let lT="glTF",lR={JSON:1313821514,BIN:5130562};class lF{constructor(e){this.name=ld.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,12);if(this.header={magic:ll(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==lT)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");let r=this.header.length-12,i=new DataView(e,12),n=0;for(;n<r;){let t=i.getUint32(n,!0);n+=4;let r=i.getUint32(n,!0);if(n+=4,r===lR.JSON){let r=new Uint8Array(e,12+n,t);this.content=ll(r)}else if(r===lR.BIN){let r=12+n;this.body=e.slice(r,r+t)}n+=t}if(null===this.content)throw Error("THREE.GLTFLoader: JSON content not found.")}}class lQ{constructor(e,t){if(!t)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=ld.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let r=this.json,i=this.dracoLoader,n=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},l={};for(let e in a)o[lV[e]||e.toLowerCase()]=a[e];for(let t in e.attributes){let i=lV[t]||t.toLowerCase();if(void 0!==a[t]){let n=r.accessors[e.attributes[t]],a=lN[n.componentType];l[i]=a.name,s[i]=!0===n.normalized}}return t.getDependency("bufferView",n).then(function(e){return new Promise(function(t,r){i.decodeDracoFile(e,function(e){for(let t in e.attributes){let r=e.attributes[t],i=s[t];void 0!==i&&(r.normalized=i)}t(e)},o,l,lu,r)})})}}class lz{constructor(){this.name=ld.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(void 0===t.texCoord||t.texCoord===e.channel)&&void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}
728class lk{constructor(){this.name=ld.KHR_MESH_QUANTIZATION}}class lL extends eT._C8{constructor(e,t,r,i){super(e,t,r,i)}copySampleValue_(e){let t=this.resultBuffer,r=this.sampleValues,i=this.valueSize,n=e*i*3+i;for(let e=0;e!==i;e++)t[e]=r[n+e];return t}interpolate_(e,t,r,i){let n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,l=3*o,c=i-t,u=(r-t)/c,h=u*u,A=h*u,d=e*l,m=d-l,f=-2*A+3*h,p=A-h,g=1-f,y=p-h+u;for(let e=0;e!==o;e++){let t=a[m+e+o],r=a[m+e+s]*c,i=a[d+e+o],l=a[d+e]*c;n[e]=g*t+y*r+f*i+p*l}return n}}let lO=new eT._fP;class lU extends lL{interpolate_(e,t,r,i){let n=super.interpolate_(e,t,r,i);return lO.fromArray(n).normalize().toArray(n),n}}let lG={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},lN={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},lH={9728:eT.TyD,9729:eT.wem,9984:eT.YLQ,9985:eT.qyh,9986:eT.aH4,9987:eT.D1R},lj={33071:eT.uWy,33648:eT.OoA,10497:eT.rpg},lJ={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},lV={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...of.i>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},lK={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},lY={CUBICSPLINE:void 0,LINEAR:eT.NMF,STEP:eT.Syv},lW={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function lq(e,t,r){for(let i in r.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=r.extensions[i])}function lX(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function lZ(e){let t="",r=Object.keys(e).sort();for(let i=0,n=r.length;i<n;i++)t+=r[i]+":"+e[r[i]]+";";return t}function l$(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}let l1=new eT.yGw;class l0{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new lA,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=!1,n=-1;"undefined"!=typeof navigator&&void 0!==navigator.userAgent&&(r=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),n=(i=navigator.userAgent.indexOf("Firefox")>-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||r||i&&n<98?this.textureLoader=new eT.dpR(this.options.manager):this.textureLoader=new eT.QRU(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new eT.hH6(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let r=this,i=this.json,n=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(t){let a={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:r,userData:{}};return lq(n,a,i),lX(a,i),Promise.all(r._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let r=0,i=t.length;r<i;r++){let i=t[r].joints;for(let t=0,r=i.length;t<r;t++)e[i[t]].isBone=!0}for(let t=0,i=e.length;t<i;t++){let i=e[t];void 0!==i.mesh&&(this._addNodeRef(this.meshCache,i.mesh),void 0!==i.skin&&(r[i.mesh].isSkinnedMesh=!0)),void 0!==i.camera&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,r){if(e.refs[t]<=1)return r;let i=r.clone(),n=(e,t)=>{let r=this.associations.get(e);for(let[i,a]of(null!=r&&this.associations.set(t,r),e.children.entries()))n(a,t.children[i])};return n(r,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let r=0;r<t.length;r++){let i=e(t[r]);if(i)return i}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let r=[];for(let i=0;i<t.length;i++){let n=e(t[i]);n&&r.push(n)}return r}getDependency(e,t){let r=e+":"+t,i=this.cache.get(r);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":i=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(!(i=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)})))throw Error("Unknown type: "+e)}this.cache.add(r,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){let r=this;t=Promise.all((this.json[e+("mesh"===e?"es":"s")]||[]).map(function(t,i){return r.getDependency(e,i)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");
728if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[ld.KHR_BINARY_GLTF].body);let i=this.options;return new Promise(function(e,n){r.load(eT.Zp0.resolveURL(t.uri,i.path),e,void 0,function(){n(Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){let r=t.byteLength||0,i=t.byteOffset||0;return e.slice(i,i+r)})}loadAccessor(e){let t=this,r=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse){let e=lJ[i.type],t=lN[i.componentType],r=!0===i.normalized,n=new t(i.count*e);return Promise.resolve(new eT.TlE(n,e,r))}let n=[];return void 0!==i.bufferView?n.push(this.getDependency("bufferView",i.bufferView)):n.push(null),void 0!==i.sparse&&(n.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),n.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(n).then(function(e){let n,a;let o=e[0],s=lJ[i.type],l=lN[i.componentType],c=l.BYTES_PER_ELEMENT,u=c*s,h=i.byteOffset||0,A=void 0!==i.bufferView?r.bufferViews[i.bufferView].byteStride:void 0,d=!0===i.normalized;if(A&&A!==u){let e=Math.floor(h/A),r="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+e+":"+i.count,u=t.cache.get(r);u||(n=new l(o,e*A,i.count*A/c),u=new eT.vpT(n,A/c),t.cache.add(r,u)),a=new eT.kB5(u,s,h%A/c,d)}else n=null===o?new l(i.count*s):new l(o,h,i.count*s),a=new eT.TlE(n,s,d);if(void 0!==i.sparse){let t=lJ.SCALAR,r=lN[i.sparse.indices.componentType],n=i.sparse.indices.byteOffset||0,c=i.sparse.values.byteOffset||0,u=new r(e[1],n,i.sparse.count*t),h=new l(e[2],c,i.sparse.count*s);null!==o&&(a=new eT.TlE(a.array.slice(),a.itemSize,a.normalized));for(let e=0,t=u.length;e<t;e++){let t=u[e];if(a.setX(t,h[e*s]),s>=2&&a.setY(t,h[e*s+1]),s>=3&&a.setZ(t,h[e*s+2]),s>=4&&a.setW(t,h[e*s+3]),s>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return a})}loadTexture(e){let t=this.json,r=this.options,i=t.textures[e].source,n=t.images[i],a=this.textureLoader;if(n.uri){let e=r.manager.getHandler(n.uri);null!==e&&(a=e)}return this.loadTextureImage(e,i,a)}loadTextureImage(e,t,r){let i=this,n=this.json,a=n.textures[e],o=n.images[t],s=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[s])return this.textureCache[s];let l=this.loadImageSource(t,r).then(function(t){t.flipY=!1,t.name=a.name||o.name||"",""===t.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(t.name=o.uri);let r=(n.samplers||{})[a.sampler]||{};return t.magFilter=lH[r.magFilter]||eT.wem,t.minFilter=lH[r.minFilter]||eT.D1R,t.wrapS=lj[r.wrapS]||eT.rpg,t.wrapT=lj[r.wrapT]||eT.rpg,i.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=l,l}loadImageSource(e,t){let r=this.json,i=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());let n=r.images[e],a=self.URL||self.webkitURL,o=n.uri||"",s=!1;if(void 0!==n.bufferView)o=this.getDependency("bufferView",n.bufferView).then(function(e){s=!0;let t=new Blob([e],{type:n.mimeType});return o=a.createObjectURL(t)});else if(void 0===n.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let l=Promise.resolve(o).then(function(e){return new Promise(function(r,n){let a=r;!0===t.isImageBitmapLoader&&(a=function(e){let t=new eT.xEZ(e);t.needsUpdate=!0,r(t)}),t.load(eT.Zp0.resolveURL(e,i.path),a,void 0,n)})}).then(function(e){var t;return!0===s&&a.revokeObjectURL(o),lX(e,n),e.userData.mimeType=n.mimeType||((t=n.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),e});return this.sourceCache[e]=l,l}assignTexture(e,t,r,i){let n=this;return this.getDependency("texture",r.index).then(function(a){if(!a)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((a=a.clone()).channel=r.texCoord),n.extensions[ld.KHR_TEXTURE_TRANSFORM]){let e=void 0!==r.extensions?r.extensions[ld.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=n.associations.get(a);a=n.extensions[ld.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),n.associations.set(a,t)}}return void 0!==i&&("number"==typeof i&&(i=3001===i?lc:lu),"colorSpace"in a?a.colorSpace
728=i:a.encoding=i===lc?3001:3e3),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,r=e.material,i=void 0===t.attributes.tangent,n=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+r.uuid,t=this.cache.get(e);t||(t=new eT.UY4,eT.F5T.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,t.sizeAttenuation=!1,this.cache.add(e,t)),r=t}else if(e.isLine){let e="LineBasicMaterial:"+r.uuid,t=this.cache.get(e);t||(t=new eT.nls,eT.F5T.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,this.cache.add(e,t)),r=t}if(i||n||a){let e="ClonedMaterial:"+r.uuid+":";i&&(e+="derivative-tangents:"),n&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=r.clone(),n&&(t.vertexColors=!0),a&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(r))),r=t}e.material=r}getMaterialType(){return eT.Wid}loadMaterial(e){let t;let r=this,i=this.json,n=this.extensions,a=i.materials[e],o={},s=a.extensions||{},l=[];if(s[ld.KHR_MATERIALS_UNLIT]){let e=n[ld.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),l.push(e.extendParams(o,a,r))}else{let i=a.pbrMetallicRoughness||{};if(o.color=new eT.Ilk(1,1,1),o.opacity=1,Array.isArray(i.baseColorFactor)){let e=i.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],lu),o.opacity=e[3]}void 0!==i.baseColorTexture&&l.push(r.assignTexture(o,"map",i.baseColorTexture,lc)),o.metalness=void 0!==i.metallicFactor?i.metallicFactor:1,o.roughness=void 0!==i.roughnessFactor?i.roughnessFactor:1,void 0!==i.metallicRoughnessTexture&&(l.push(r.assignTexture(o,"metalnessMap",i.metallicRoughnessTexture)),l.push(r.assignTexture(o,"roughnessMap",i.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}!0===a.doubleSided&&(o.side=eT.ehD);let c=a.alphaMode||lW.OPAQUE;if(c===lW.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,c===lW.MASK&&(o.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==eT.vBJ&&(l.push(r.assignTexture(o,"normalMap",a.normalTexture)),o.normalScale=new eT.FM8(1,1),void 0!==a.normalTexture.scale)){let e=a.normalTexture.scale;o.normalScale.set(e,e)}if(void 0!==a.occlusionTexture&&t!==eT.vBJ&&(l.push(r.assignTexture(o,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(o.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==eT.vBJ){let e=a.emissiveFactor;o.emissive=new eT.Ilk().setRGB(e[0],e[1],e[2],lu)}return void 0!==a.emissiveTexture&&t!==eT.vBJ&&l.push(r.assignTexture(o,"emissiveMap",a.emissiveTexture,lc)),Promise.all(l).then(function(){let i=new t(o);return a.name&&(i.name=a.name),lX(i,a),r.associations.set(i,{materials:e}),a.extensions&&lq(n,i,a),i})}createUniqueName(e){let t=eT.iUV.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,r=this.extensions,i=this.primitiveCache,n=[];for(let a=0,o=e.length;a<o;a++){let o=e[a],s=function(e){let t;let r=e.extensions&&e.extensions[ld.KHR_DRACO_MESH_COMPRESSION];if(t=r?"draco:"+r.bufferView+":"+r.indices+":"+lZ(r.attributes):e.indices+":"+lZ(e.attributes)+":"+e.mode,void 0!==e.targets)for(let r=0,i=e.targets.length;r<i;r++)t+=":"+lZ(e.targets[r]);return t}(o),l=i[s];if(l)n.push(l.promise);else{let e;e=o.extensions&&o.extensions[ld.KHR_DRACO_MESH_COMPRESSION]?function(e){return r[ld.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(r){return l2(r,e,t)})}(o):l2(new eT.u9r,o,t),i[s]={primitive:o,promise:e},n.push(e)}}return Promise.all(n)}loadMesh(e){let t=this,r=this.json,i=this.extensions,n=r.meshes[e],a=n.primitives,o=[];for(let e=0,t=a.length;e<t;e++){var s;let t=void 0===a[e].material?(void 0===(s=this.cache).DefaultMaterial&&(s.DefaultMaterial=new eT.Wid({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:eT.Wl3})),s.DefaultMaterial):this.getDependency("material",a[e].material);o.push(t)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(r){let o=r.slice(0,r.length-1),s=r[r.length-1],l=[];for(let r=0,c=s.length;r<c;r++){let c;let u=s[r],h=a[r],A=o[r];if(h.mode===lG.TRIANGLES||h.mode===lG.TRIANGLE_STRIP||h.mode===lG.TRIANGLE_FAN||void 0===h.mode)!0===(c=!0===n.isSkinnedMesh?new eT.TUv(u,A):new eT.Kj0(u,A)).isSkinnedMesh&&c.normalizeSkinWeights(),h.mode===lG.TRIANGLE_STRIP?c.geometry=oJ(c.geometry,eT.UlW):h.mode===lG.TRIANGLE_FAN&&(c.geometry=oJ(c.geometry,eT.z$h));else if(h.mode===lG.LINES)c=new eT.ejS(u,A);else if(h.mode===lG.LINE_STRIP)c=new eT.x12(u,A);else if(h.mode===lG.LINE_LOOP)c=new eT.blk(u,A);
728else if(h.mode===lG.POINTS)c=new eT.woe(u,A);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);Object.keys(c.geometry.morphAttributes).length>0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,i=t.weights.length;r<i;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){let r=t.extras.targetNames;if(e.morphTargetInfluences.length===r.length){e.morphTargetDictionary={};for(let t=0,i=r.length;t<i;t++)e.morphTargetDictionary[r[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}(c,n),c.name=t.createUniqueName(n.name||"mesh_"+e),lX(c,n),h.extensions&&lq(i,c,h),t.assignFinalMaterial(c),l.push(c)}for(let r=0,i=l.length;r<i;r++)t.associations.set(l[r],{meshes:e,primitives:r});if(1===l.length)return n.extensions&&lq(i,l[0],n),l[0];let c=new eT.ZAu;n.extensions&&lq(i,c,n),t.associations.set(c,{meshes:e});for(let e=0,t=l.length;e<t;e++)c.add(l[e]);return c})}loadCamera(e){let t;let r=this.json.cameras[e],i=r[r.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return"perspective"===r.type?t=new eT.cPb(eT.M8C.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===r.type&&(t=new eT.iKG(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),r.name&&(t.name=this.createUniqueName(r.name)),lX(t,r),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],r=[];for(let e=0,i=t.joints.length;e<i;e++)r.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then(function(e){let r=e.pop(),i=[],n=[];for(let a=0,o=e.length;a<o;a++){let o=e[a];if(o){i.push(o);let e=new eT.yGw;null!==r&&e.fromArray(r.array,16*a),n.push(e)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[a])}return new eT.OdW(i,n)})}loadAnimation(e){let t=this.json,r=this,i=t.animations[e],n=i.name?i.name:"animation_"+e,a=[],o=[],s=[],l=[],c=[];for(let e=0,t=i.channels.length;e<t;e++){let t=i.channels[e],r=i.samplers[t.sampler],n=t.target,u=n.node,h=void 0!==i.parameters?i.parameters[r.input]:r.input,A=void 0!==i.parameters?i.parameters[r.output]:r.output;void 0!==n.node&&(a.push(this.getDependency("node",u)),o.push(this.getDependency("accessor",h)),s.push(this.getDependency("accessor",A)),l.push(r),c.push(n))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(l),Promise.all(c)]).then(function(e){let t=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=[];for(let e=0,n=t.length;e<n;e++){let n=t[e],c=i[e],u=a[e],h=o[e],A=s[e];if(void 0===n)continue;n.updateMatrix&&n.updateMatrix();let d=r._createAnimationTracks(n,c,u,h,A);if(d)for(let e=0;e<d.length;e++)l.push(d[e])}return new eT.m7l(n,void 0,l)})}createNodeMesh(e){let t=this.json,r=this,i=t.nodes[e];return void 0===i.mesh?null:r.getDependency("mesh",i.mesh).then(function(e){let t=r._getNodeRef(r.meshCache,i.mesh,e);return void 0!==i.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,r=i.weights.length;t<r;t++)e.morphTargetInfluences[t]=i.weights[t]}),t})}loadNode(e){let t=this.json.nodes[e],r=this._loadNodeShallow(e),i=[],n=t.children||[];for(let e=0,t=n.length;e<t;e++)i.push(this.getDependency("node",n[e]));let a=void 0===t.skin?Promise.resolve(null):this.getDependency("skin",t.skin);return Promise.all([r,Promise.all(i),a]).then(function(e){let t=e[0],r=e[1],i=e[2];null!==i&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(i,l1)});for(let e=0,i=r.length;e<i;e++)t.add(r[e]);return t})}_loadNodeShallow(e){let t=this.json,r=this.extensions,i=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];let n=t.nodes[e],a=n.name?i.createUniqueName(n.name):"",o=[],s=i._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return s&&o.push(s),void 0!==n.camera&&o.push(i.getDependency("camera",n.camera).then(function(e){return i._getNodeRef(i.cameraCache,n.camera,e)})),i._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){o.push(e)}),this.nodeCache[e]=Promise.all(o).then(function(t){let o;if((o=!0===n.isBone?new eT.N$j:t.length>1?new eT.ZAu:1===t.length?t[0]:new eT.Tme)!==t[0])for(let e=0,r=t.length;e<r;e++)o.add(t[e]);if(n.name&&(o.userData.name=n.name,o.name=a),lX(o,n),n.extensions&&lq(r,o,n),void 0!==n.matrix
728){let e=new eT.yGw;e.fromArray(n.matrix),o.applyMatrix4(e)}else void 0!==n.translation&&o.position.fromArray(n.translation),void 0!==n.rotation&&o.quaternion.fromArray(n.rotation),void 0!==n.scale&&o.scale.fromArray(n.scale);return i.associations.has(o)||i.associations.set(o,{}),i.associations.get(o).nodes=e,o}),this.nodeCache[e]}loadScene(e){let t=this.extensions,r=this.json.scenes[e],i=this,n=new eT.ZAu;r.name&&(n.name=i.createUniqueName(r.name)),lX(n,r),r.extensions&&lq(t,n,r);let a=r.nodes||[],o=[];for(let e=0,t=a.length;e<t;e++)o.push(i.getDependency("node",a[e]));return Promise.all(o).then(function(e){for(let t=0,r=e.length;t<r;t++)n.add(e[t]);return i.associations=(e=>{let t=new Map;for(let[e,r]of i.associations)(e instanceof eT.F5T||e instanceof eT.xEZ)&&t.set(e,r);return e.traverse(e=>{let r=i.associations.get(e);null!=r&&t.set(e,r)}),t})(n),n})}_createAnimationTracks(e,t,r,i,n){let a;let o=[],s=e.name?e.name:e.uuid,l=[];switch(lK[n.path]===lK.weights?e.traverse(function(e){e.morphTargetInfluences&&l.push(e.name?e.name:e.uuid)}):l.push(s),lK[n.path]){case lK.weights:a=eT.dUE;break;case lK.rotation:a=eT.iLg;break;case lK.position:case lK.scale:a=eT.yC1;break;default:a=1===r.itemSize?eT.dUE:eT.yC1}let c=void 0!==i.interpolation?lY[i.interpolation]:eT.NMF,u=this._getArrayFromAccessor(r);for(let e=0,r=l.length;e<r;e++){let r=new a(l[e]+"."+lK[n.path],t.array,u,c);"CUBICSPLINE"===i.interpolation&&this._createCubicSplineTrackInterpolant(r),o.push(r)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let e=l$(t.constructor),r=new Float32Array(t.length);for(let i=0,n=t.length;i<n;i++)r[i]=t[i]*e;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof eT.iLg?lU:lL)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function l2(e,t,r){let i=t.attributes,n=[];for(let t in i){let a=lV[t]||t.toLowerCase();a in e.attributes||n.push(function(t,i){return r.getDependency("accessor",t).then(function(t){e.setAttribute(i,t)})}(i[t],a))}if(void 0!==t.indices&&!e.index){let i=r.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});n.push(i)}return lX(e,t),!function(e,t,r){let i=t.attributes,n=new eT.ZzF;if(void 0===i.POSITION)return;{let e=r.json.accessors[i.POSITION],t=e.min,a=e.max;if(void 0!==t&&void 0!==a){if(n.set(new eT.Pa4(t[0],t[1],t[2]),new eT.Pa4(a[0],a[1],a[2])),e.normalized){let t=l$(lN[e.componentType]);n.min.multiplyScalar(t),n.max.multiplyScalar(t)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}let a=t.targets;if(void 0!==a){let e=new eT.Pa4,t=new eT.Pa4;for(let i=0,n=a.length;i<n;i++){let n=a[i];if(void 0!==n.POSITION){let i=r.json.accessors[n.POSITION],a=i.min,o=i.max;if(void 0!==a&&void 0!==o){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(o[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(o[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(o[2]))),i.normalized){let e=l$(lN[i.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(e)}e.boundingBox=n;let o=new eT.aLr;n.getCenter(o.center),o.radius=n.min.distanceTo(n.max)/2,e.boundingSphere=o}(e,t,r),Promise.all(n).then(function(){return void 0!==t.targets?function(e,t,r){let i=!1,n=!1,a=!1;for(let e=0,r=t.length;e<r;e++){let r=t[e];if(void 0!==r.POSITION&&(i=!0),void 0!==r.NORMAL&&(n=!0),void 0!==r.COLOR_0&&(a=!0),i&&n&&a)break}if(!i&&!n&&!a)return Promise.resolve(e);let o=[],s=[],l=[];for(let c=0,u=t.length;c<u;c++){let u=t[c];if(i){let t=void 0!==u.POSITION?r.getDependency("accessor",u.POSITION):e.attributes.position;o.push(t)}if(n){let t=void 0!==u.NORMAL?r.getDependency("accessor",u.NORMAL):e.attributes.normal;s.push(t)}if(a){let t=void 0!==u.COLOR_0?r.getDependency("accessor",u.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(l)]).then(function(t){let r=t[0],o=t[1],s=t[2];return i&&(e.morphAttributes.position=r),n&&(e.morphAttributes.normal=o),a&&(e.morphAttributes.color=s),e.morphTargetsRelative=!0,e})}(e,t.targets,r):e})}
728let l3=null,l4="https://www.gstatic.com/draco/versioned/decoders/1.5.5/";function l5(e=!0,t=!0,r){return i=>{r&&r(i),e&&(l3||(l3=new la),l3.setDecoderPath("string"==typeof e?e:l4),i.setDRACOLoader(l3)),t&&i.setMeshoptDecoder("function"==typeof ls?ls():ls)}}let l6=(e,t,r,i)=>(0,eR.H)(lh,e,l5(t,r,i));l6.preload=(e,t,r,i)=>eR.H.preload(lh,e,l5(t,r,i)),l6.clear=e=>eR.H.clear(lh,e),l6.setDecoderPath=e=>{l4=e};let l8=eD.forwardRef(({src:e,useDraco:t,useMeshOpt:r,extendLoader:i,...n},a)=>{let{scene:o}=l6(e,t,r,i);return eD.createElement(s1,(0,eS.Z)({ref:a},n,{object:o}))});class l9{constructor(e,t=" .:-=+*#%@",r={}){let i,n,a,o,s;let l=r.resolution||.15,c=r.scale||1,u=r.color||!1,h=r.alpha||!1,A=r.block||!1,d=r.invert||!1,m=r.strResolution||"low",f=document.createElement("div");f.style.cursor="default";let p=document.createElement("table");f.appendChild(p),this.setSize=function(t,r){i=t,n=r,e.setSize(t,r),function(){a=Math.floor(i*l),o=Math.floor(n*l),v.width=a,v.height=o,(s=e.domElement).style.backgroundColor&&(p.rows[0].cells[0].style.backgroundColor=s.style.backgroundColor,p.rows[0].cells[0].style.color=s.style.color),p.cellSpacing=0,p.cellPadding=0;let t=p.style;t.whiteSpace="pre",t.margin="0px",t.padding="0px",t.letterSpacing=B+"px",t.fontFamily=g,t.fontSize=C+"px",t.lineHeight=w+"px",t.textAlign="left",t.textDecoration="none"}()},this.render=function(t,r){e.render(t,r),function(e){E.clearRect(0,0,a,o),E.drawImage(y,0,0,a,o);let t=E.getImageData(0,0,a,o).data,r="";for(let e=0;e<o;e+=2){for(let i=0;i<a;i++){let n,o;let s=(e*a+i)*4,l=t[s],c=t[s+1],m=t[s+2],f=t[s+3];o=(.3*l+.59*c+.11*m)/255,0==f&&(o=1),n=Math.floor((1-o)*(x.length-1)),d&&(n=x.length-n-1);let p=x[n];(void 0===p||" "==p)&&(p="&nbsp;"),u?r+="<span style='color:rgb("+l+","+c+","+m+");"+(A?"background-color:rgb("+l+","+c+","+m+");":"")+(h?"opacity:"+f/255+";":"")+"'>"+p+"</span>":r+=p}r+="<br/>"}e.innerHTML=`<tr><td style="display:block;width:${i}px;height:${n}px;overflow:hidden">${r}</td></tr>`}(p)},this.domElement=f;let g="courier new, monospace",y=e.domElement,v=document.createElement("canvas");if(!v.getContext)return;let E=v.getContext("2d");if(!E.getImageData)return;let x=u?" CGO08@".split(""):" .,:;i1tfLCG08@".split("");t&&(x=t);let C=2/l*c,w=2/l*c,B=0;if("low"==m)switch(c){case 1:B=-1;break;case 2:case 3:B=-2.1;break;case 4:B=-3.1;break;case 5:B=-4.15}if("medium"==m)switch(c){case 1:B=0;break;case 2:B=-1;break;case 3:B=-1.04;break;case 4:case 5:B=-2.1}if("high"==m)switch(c){case 1:case 2:B=0;break;case 3:case 4:case 5:B=-1}}}function l7({renderIndex:e=1,bgColor:t="black",fgColor:r="white",characters:i=" .:-+*=%@#",invert:n=!0,color:a=!1,resolution:o=.15}){let{size:s,gl:l,scene:c,camera:u}=(0,eR.D)(),h=eD.useMemo(()=>{let e=new l9(l,i,{invert:n,color:a,resolution:o});return e.domElement.style.position="absolute",e.domElement.style.top="0px",e.domElement.style.left="0px",e.domElement.style.pointerEvents="none",e},[i,n,a,o]);return eD.useLayoutEffect(()=>{h.domElement.style.color=r,h.domElement.style.backgroundColor=t},[r,t]),eD.useEffect(()=>(l.domElement.style.opacity="0",l.domElement.parentNode.appendChild(h.domElement),()=>{l.domElement.style.opacity="1",l.domElement.parentNode.removeChild(h.domElement)}),[h]),eD.useEffect(()=>{h.setSize(s.width,s.height)},[h,s]),(0,eR.F)(e=>{h.render(c,u)},e),eD.createElement(eD.Fragment,null)}let ce=sw({alphaTest:0,viewport:new eT.FM8(1980,1080),focal:1e3,centerAndScaleTexture:null,covAndColorTexture:null},`
729    precision highp sampler2D;
730    precision highp usampler2D;
731    out vec4 vColor;
732    out vec3 vPosition;
733    uniform vec2 resolution;
734    uniform vec2 viewport;
735    uniform float focal;
736    attribute uint splatIndex;
737    uniform sampler2D centerAndScaleTexture;
738    uniform usampler2D covAndColorTexture;    
739
740    vec2 unpackInt16(in uint value) {
741      int v = int(value);
742      int v0 = v >> 16;
743      int v1 = (v & 0xFFFF);
744      if((v & 0x8000) != 0)
745        v1 |= 0xFFFF0000;
746      return vec2(float(v1), float(v0));
747    }
748
749    void main () {
750      ivec2 texSize = textureSize(centerAndScaleTexture, 0);
751      ivec2 texPos = ivec2(splatIndex%uint(texSize.x), splatIndex/uint(texSize.x));
752      vec4 centerAndScaleData = texelFetch(centerAndScaleTexture, texPos, 0);
753      vec4 center = vec4(centerAndScaleData.xyz, 1);
754      vec4 camspace = modelViewMatrix * center;
755      vec4 pos2d = projectionMatrix * camspace;
756
757      float bounds = 1.2 * pos2d.w;
758      if (pos2d.z < -pos2d.w || pos2d.x < -bounds || pos2d.x > bounds
759        || pos2d.y < -bounds || pos2d.y > bounds) {
760        gl_Position = vec4(0.0, 0.0, 2.0, 1.0);
761        return;
762      }
763
764      uvec4 covAndColorData = texelFetch(covAndColorTexture, texPos, 0);
765      vec2 cov3D_M11_M12 = unpackInt16(covAndColorData.x) * centerAndScaleData.w;
766      vec2 cov3D_M13_M22 = unpackInt16(covAndColorData.y) * centerAndScaleData.w;
767      vec2 cov3D_M23_M33 = unpackInt16(covAndColorData.z) * centerAndScaleData.w;
768      mat3 Vrk = mat3(
769        cov3D_M11_M12.x, cov3D_M11_M12.y, cov3D_M13_M22.x,
770        cov3D_M11_M12.y, cov3D_M13_M22.y, cov3D_M23_M33.x,
771        cov3D_M13_M22.x, cov3D_M23_M33.x, cov3D_M23_M33.y
772      );
773
774      mat3 J = mat3(
775        focal / camspace.z, 0., -(focal * camspace.x) / (camspace.z * camspace.z),
776        0., focal / camspace.z, -(focal * camspace.y) / (camspace.z * camspace.z),
777        0., 0., 0.
778      );
779
780      mat3 W = transpose(mat3(modelViewMatrix));
781      mat3 T = W * J;
782      mat3 cov = transpose(T) * Vrk * T;
783      vec2 vCenter = vec2(pos2d) / pos2d.w;
784      float diagonal1 = cov[0][0] + 0.3;
785      float offDiagonal = cov[0][1];
786      float diagonal2 = cov[1][1] + 0.3;
787      float mid = 0.5 * (diagonal1 + diagonal2);
788      float radius = length(vec2((diagonal1 - diagonal2) / 2.0, offDiagonal));
789      float lambda1 = mid + radius;
790      float lambda2 = max(mid - radius, 0.1);
791      vec2 diagonalVector = normalize(vec2(offDiagonal, lambda1 - diagonal1));
792      vec2 v1 = min(sqrt(2.0 * lambda1), 1024.0) * diagonalVector;
793      vec2 v2 = min(sqrt(2.0 * lambda2), 1024.0) * vec2(diagonalVector.y, -diagonalVector.x);
794      uint colorUint = covAndColorData.w;
795      vColor = vec4(
796        float(colorUint & uint(0xFF)) / 255.0,
797        float((colorUint >> uint(8)) & uint(0xFF)) / 255.0,
798        float((colorUint >> uint(16)) & uint(0xFF)) / 255.0,
799        float(colorUint >> uint(24)) / 255.0
800      );
801      vPosition = position;
802
803      gl_Position = vec4(
804        vCenter 
805          + position.x * v2 / viewport * 2.0 
806          + position.y * v1 / viewport * 2.0, pos2d.z / pos2d.w, 1.0);
807    }
808    `,`
809    #include <alphatest_pars_fragment>
810    #include <alphahash_pars_fragment>
811    in vec4 vColor;
812    in vec3 vPosition;
813    void main () {
814      float A = -dot(vPosition.xy, vPosition.xy);
815      if (A < -4.0) discard;
816      float B = exp(A) * vColor.a;
817      vec4 diffuseColor = vec4(vColor.rgb, B);
818      #include <alphatest_fragment>
819      #include <alphahash_fragment>
820      gl_FragColor = diffuseColor;
821      #include <tonemapping_fragment>
822      #include <${sI.i>=154?"colorspace_fragment":"encodings_fragment"}>
823    }
824  `);function ct(e){let t=null,r=0;e.onmessage=i=>{if("push"==i.data.method){0===r&&(t=new Float32Array(i.data.length));let e=new Float32Array(i.data.matrices);t.set(e,r),r+=e.length}else if("sort"==i.data.method&&null!==t){let r=function(e,r=!1){let i=t.length/16,n=-1/0,a=1/0,o=new Float32Array(i),s=new Int32Array(o.buffer),l=new Int32Array(i),c=0;for(let s=0;s<i;s++){let i=e[0]*t[16*s+12]+e[1]*t[16*s+13]+e[2]*t[16*s+14]+e[3];(r||i<0&&t[16*s+15]>-.0001*i)&&(o[c]=i,l[c]=s,c++,i>n&&(n=i),i<a&&(a=i))}let u=65535/(n-a),h=new Uint32Array(65536);for(let e=0;e<c;e++)s[e]=(o[e]-a)*u|0,h[s[e]]++;let A=new Uint32Array(65536);for(let e=1;e<65536;e++)A[e]=A[e-1]+h[e-1];let d=new Uint32Array(c);for(let e=0;e<c;e++)d[A[s[e]]++]=l[e];return d}(new Float32Array(i.data.view),i.data.hashed);e.postMessage({indices:r,key:i.data.key},[r.buffer])}}}class cr extends eT.aNw{constructor(...e){super(...e),this.gl=null,this.chunkSize=25e3}load(e,t,r,i){let n={gl:this.gl,url:this.manager.resolveURL(e),worker:new Worker(URL.createObjectURL(new Blob(["(",ct.toString(),")(self)"],{type:"application/javascript"}))),manager:this.manager,update:(e,t,r)=>(function(e,t,r,i){if(e.updateMatrixWorld(),t.gl.getCurrentViewport(r.viewport),r.material.viewport.x=r.viewport.z,r.material.viewport.y=r.viewport.w,r.material.focal=r.viewport.w/2*Math.abs(e.projectionMatrix.elements[5]),r.ready){if(i&&r.sorted)return;r.ready=!1;let e=new Float32Array([r.modelViewMatrix.elements[2],-r.modelViewMatrix.elements[6],r.modelViewMatrix.elements[10],r.modelViewMatrix.elements[14]]);t.worker.postMessage({method:"sort",src:t.url,key:r.uuid,view:e.buffer,hashed:i},[e.buffer]),i&&t.loaded&&(r.sorted=!0)}})(t,n,e,r),connect:e=>(function(e,t){e.loading||cn(e),t.ready=!1,t.pm=new eT.yGw,t.vm1=new eT.yGw,t.vm2=new eT.yGw,t.viewport=new eT.Ltg;let r=new Uint32Array(e.bufferTextureWidth*e.bufferTextureHeight),i=new eT.lb7(r,1,!1);i.setUsage(eT.dj0);let n=t.geometry=new eT.L5s,a=new Float32Array(18),o=new eT.TlE(a,3);function s(e){if(t&&e.data.key===t.uuid){let r=new Uint32Array(e.data.indices);n.attributes.splatIndex.set(r),n.attributes.splatIndex.needsUpdate=!0,n.instanceCount=r.length,t.ready=!0}}return n.setAttribute("position",o),o.setXYZ(2,-2,2,0),o.setXYZ(1,2,2,0),o.setXYZ(0,-2,-2,0),o.setXYZ(5,-2,-2,0),o.setXYZ(4,2,2,0),o.setXYZ(3,2,-2,0),o.needsUpdate=!0,n.setAttribute("splatIndex",i),n.instanceCount=1,e.worker.addEventListener("message",s),async function(){for(;;){let t=e.gl.properties.get(e.centerAndScaleTexture),r=e.gl.properties.get(e.covAndColorTexture);if(null!=t&&t.__webglTexture&&null!=r&&r.__webglTexture&&e.loadedVertexCount>0)break;await new Promise(e=>setTimeout(e,10))}t.ready=!0}(),()=>e.worker.removeEventListener("message",s)})(n,e),loading:!1,loaded:!1,loadedVertexCount:0,chunkSize:this.chunkSize,totalDownloadBytes:0,numVertices:0,rowLength:32,maxVertexes:0,bufferTextureWidth:0,bufferTextureHeight:0,stream:null,centerAndScaleData:null,covAndColorData:null,covAndColorTexture:null,centerAndScaleTexture:null,onProgress:r};
824ci(n).then(t).catch(e=>{null==i||i(e),n.manager.itemError(n.url)})}}async function ci(e){e.manager.itemStart(e.url);let t=await fetch(e.url);if(null===t.body)throw"Failed to fetch file";let r=t.headers.get("Content-Length"),i=r?parseInt(r):void 0;if(void 0==i)throw"Failed to get content length";e.stream=t.body.getReader(),e.totalDownloadBytes=i,e.numVertices=Math.floor(e.totalDownloadBytes/e.rowLength);let n=e.gl.getContext(),a=n.getParameter(n.MAX_TEXTURE_SIZE);return e.maxVertexes=a*a,e.numVertices>e.maxVertexes&&(e.numVertices=e.maxVertexes),e.bufferTextureWidth=a,e.bufferTextureHeight=Math.floor((e.numVertices-1)/a)+1,e.centerAndScaleData=new Float32Array(e.bufferTextureWidth*e.bufferTextureHeight*4),e.covAndColorData=new Uint32Array(e.bufferTextureWidth*e.bufferTextureHeight*4),e.centerAndScaleTexture=new eT.IEO(e.centerAndScaleData,e.bufferTextureWidth,e.bufferTextureHeight,eT.wk1,eT.VzW),e.centerAndScaleTexture.needsUpdate=!0,e.covAndColorTexture=new eT.IEO(e.covAndColorData,e.bufferTextureWidth,e.bufferTextureHeight,eT.E2K,eT.JQ4),e.covAndColorTexture.internalFormat="RGBA32UI",e.covAndColorTexture.needsUpdate=!0,e}async function cn(e){e.loading=!0;let t=0,r=0,i=[],n=0,a=0!==e.totalDownloadBytes;for(;;)try{let{value:o,done:s}=await e.stream.read();if(s)break;if(t+=o.length,void 0!=e.totalDownloadBytes){let r=t/e.totalDownloadBytes*100;if(e.onProgress&&r-n>1){let i=new ProgressEvent("progress",{lengthComputable:a,loaded:t,total:e.totalDownloadBytes});e.onProgress(i),n=r}}i.push(o);let l=t-r;if(void 0!=e.totalDownloadBytes&&l>e.rowLength*e.chunkSize){let t=Math.floor(l/e.rowLength),n=new Uint8Array(l),o=0;for(let e of i)n.set(e,o),o+=e.length;if(i.length=0,l>t*e.rowLength){let r=new Uint8Array(l-t*e.rowLength);r.set(n.subarray(l-r.length,l),0),i.push(r)}let s=new Uint8Array(t*e.rowLength);s.set(n.subarray(0,s.byteLength),0);let c=ca(e,s.buffer,t);if(e.worker.postMessage({method:"push",src:e.url,length:16*e.numVertices,matrices:c.buffer},[c.buffer]),r+=t*e.rowLength,e.onProgress){let t=new ProgressEvent("progress",{lengthComputable:a,loaded:e.totalDownloadBytes,total:e.totalDownloadBytes});e.onProgress(t)}}}catch(e){console.error(e);break}if(t-r>0){let t=new Uint8Array(i.reduce((e,t)=>e+t.length,0)),r=0;for(let e of i)t.set(e,r),r+=e.length;let n=Math.floor(t.byteLength/e.rowLength),a=ca(e,t.buffer,n);e.worker.postMessage({method:"push",src:e.url,length:16*n,matrices:a.buffer},[a.buffer])}e.loaded=!0,e.manager.itemEnd(e.url)}function ca(e,t,r){let i=e.gl.getContext();if(e.loadedVertexCount+r>e.maxVertexes&&(r=e.maxVertexes-e.loadedVertexCount),r<=0)throw"Failed to parse file";let n=new Uint8Array(t),a=new Float32Array(t),o=new Float32Array(16*r),s=new Uint8Array(e.covAndColorData.buffer),l=new Int16Array(e.covAndColorData.buffer);for(let t=0;t<r;t++){let r=new eT._fP(-(n[32*t+28+1]-128)/128,(n[32*t+28+2]-128)/128,(n[32*t+28+3]-128)/128,-(n[32*t+28+0]-128)/128);r.invert();let i=new eT.Pa4(a[8*t+0],a[8*t+1],-a[8*t+2]),c=new eT.Pa4(a[8*t+3+0],a[8*t+3+1],a[8*t+3+2]),u=new eT.yGw;u.makeRotationFromQuaternion(r),u.transpose(),u.scale(c);let h=u.clone();u.transpose(),u.premultiply(h),u.setPosition(i);let A=[0,1,2,5,6,10],d=0;for(let e=0;e<A.length;e++)Math.abs(u.elements[A[e]])>d&&(d=Math.abs(u.elements[A[e]]));let m=4*e.loadedVertexCount+4*t;e.centerAndScaleData[m+0]=i.x,e.centerAndScaleData[m+1]=-i.y,e.centerAndScaleData[m+2]=i.z,e.centerAndScaleData[m+3]=d/32767,m=8*e.loadedVertexCount+8*t;for(let e=0;e<A.length;e++)l[m+e]=32767*u.elements[A[e]]/d;m=16*e.loadedVertexCount+(4*t+3)*4;let f=new eT.Ilk(n[32*t+24+0]/255,n[32*t+24+1]/255,n[32*t+24+2]/255);f.convertSRGBToLinear(),s[m+0]=255*f.r,s[m+1]=255*f.g,s[m+2]=255*f.b,s[m+3]=n[32*t+24+3],u.elements[15]=Math.max(c.x,c.y,c.z)*n[32*t+24+3]/255;for(let e=0;e<16;e++)o[16*t+e]=u.elements[e]}for(;r>0;){let t=0,n=0,a=e.loadedVertexCount%e.bufferTextureWidth,o=Math.floor(e.loadedVertexCount/e.bufferTextureWidth);e.loadedVertexCount%e.bufferTextureWidth!=0?(t=Math.min(e.bufferTextureWidth,a+r)-a,n=1):Math.floor(r/e.bufferTextureWidth)>0?(t=e.bufferTextureWidth,n=Math.floor(r/e.bufferTextureWidth)):(t=r%e.bufferTextureWidth,n=1);let s=e.gl.properties.get(e.centerAndScaleTexture);i.bindTexture(i.TEXTURE_2D,s.__webglTexture),i.texSubImage2D(i.TEXTURE_2D,0,a,o,t,n,i.RGBA,i.FLOAT,e.centerAndScaleData,4*e.loadedVertexCount);let l=e.gl.properties.get(e.covAndColorTexture);i.bindTexture(i.TEXTURE_2D,l.__webglTexture),i.texSubImage2D(i.TEXTURE_2D,0,a,o,t,n,i.RGBA_INTEGER,i.UNSIGNED_INT,e.covAndColorData,4*e.loadedVertexCount),e.gl.resetState(),e.loadedVertexCount+=t*n,r-=t*n}return o}function co({src:e,toneMapped:t=!1,alphaTest:r=0,alphaHash:i=!1,chunkSize:n=25e3,...a}){(0,eR.e)({SplatMaterial:ce});let o=eD.useRef(null),s=(0,eR.D)(e=>e.gl),l=(0,eR.D)(e=>e.camera),c=(0,eR.H)(cr,e,e=>{e.gl=s,e.chunkSize=n});return eD.useLayoutEffect(()=>c.connect(o.current),[e]),(0,eR.F)(()=>c.update(o.current,l,i)),eD.createElement("mesh",(0,eS.Z)({ref:o,frustumCulled:!1},a),eD.createElement("splatMaterial",{key:`${e}/${r}/${i}${ce.key}`,transparent:!i,depthTest:!0,alphaTest:i?0:r,centerAndScaleTexture:c.centerAndScaleTexture,covAndColorTexture:c.covAndColorTexture,depthWrite:!!i||r>0,blending:i?eT.bdR:eT.Xaj,blendSrcAlpha:eT.ghN,alphaHash:!!i,toneMapped:t}))}function cs(e,t,r){let i=(0,eR.D)(e=>e.size),n=(0,eR.D)(e=>e.viewport),a="number"==typeof e?e:i.width*n.dpr,o="number"==typeof t?t:i.height*n.dpr,{samples:s=0,depth:l,...c}=("number"==typeof e?r:e)||{},u=eD.useMemo(()=>{let e=new eT.dd2(a,o,{minFilter:eT.wem,magFilter:eT.wem,type:eT.cLu,...c});return l&&(e.depthTexture=new eT.$YQ(a,o,eT.VzW)),e.samples=s,e},[]);return eD.useLayoutEffect(()=>{u.setSize(a,o),s&&(u.samples=s)},[s,u,a,o]),eD.useEffect(()=>()=>u.dispose(),[]),u}let cl=({children:e,width:t,height:r,...i})=>{let n=cs(t,r,i);return eD.createElement(eD.Fragment,null,null==e?void 0:e(n))}
824,cc=e=>"function"==typeof e,cu=eD.forwardRef(({envMap:e,resolution:t=256,frames:r=1/0,children:i,makeDefault:n,...a},o)=>{let s=(0,eR.D)(({set:e})=>e),l=(0,eR.D)(({camera:e})=>e),c=(0,eR.D)(({size:e})=>e),u=eD.useRef(null);eD.useImperativeHandle(o,()=>u.current,[]);let h=eD.useRef(null),A=cs(t);eD.useLayoutEffect(()=>{a.manual||u.current.updateProjectionMatrix()},[c,a]),eD.useLayoutEffect(()=>{u.current.updateProjectionMatrix()}),eD.useLayoutEffect(()=>{if(n)return s(()=>({camera:u.current})),()=>s(()=>({camera:l}))},[u,n,s]);let d=0,m=null,f=cc(i);return(0,eR.F)(t=>{f&&(r===1/0||d<r)&&(h.current.visible=!1,t.gl.setRenderTarget(A),m=t.scene.background,e&&(t.scene.background=e),t.gl.render(t.scene,u.current),t.scene.background=m,t.gl.setRenderTarget(null),h.current.visible=!0,d++)}),eD.createElement(eD.Fragment,null,eD.createElement("orthographicCamera",(0,eS.Z)({left:-(c.width/2),right:c.width/2,top:c.height/2,bottom:-(c.height/2),ref:u},a),!f&&i),eD.createElement("group",{ref:h},f&&i(A.texture)))}),ch=e=>"function"==typeof e,cA=eD.forwardRef(({envMap:e,resolution:t=256,frames:r=1/0,makeDefault:i,children:n,...a},o)=>{let s=(0,eR.D)(({set:e})=>e),l=(0,eR.D)(({camera:e})=>e),c=(0,eR.D)(({size:e})=>e),u=eD.useRef(null);eD.useImperativeHandle(o,()=>u.current,[]);let h=eD.useRef(null),A=cs(t);eD.useLayoutEffect(()=>{a.manual||(u.current.aspect=c.width/c.height)},[c,a]),eD.useLayoutEffect(()=>{u.current.updateProjectionMatrix()});let d=0,m=null,f=ch(n);return(0,eR.F)(t=>{f&&(r===1/0||d<r)&&(h.current.visible=!1,t.gl.setRenderTarget(A),m=t.scene.background,e&&(t.scene.background=e),t.gl.render(t.scene,u.current),t.scene.background=m,t.gl.setRenderTarget(null),h.current.visible=!0,d++)}),eD.useLayoutEffect(()=>{if(i)return s(()=>({camera:u.current})),()=>s(()=>({camera:l}))},[u,i,s]),eD.createElement(eD.Fragment,null,eD.createElement("perspectiveCamera",(0,eS.Z)({ref:u},a),!f&&n),eD.createElement("group",{ref:h},f&&n(A.texture)))});function cd({resolution:e=256,near:t=.1,far:r=1e3,envMap:i,fog:n}={}){let a,o;let s=(0,eR.D)(({gl:e})=>e),l=(0,eR.D)(({scene:e})=>e),c=(0,eD.useMemo)(()=>{let t=new eT.oAp(e);return t.texture.type=eT.cLu,t},[e]);(0,eD.useEffect)(()=>()=>{c.dispose()},[c]);let u=(0,eD.useMemo)(()=>new eT._am(t,r,c),[t,r,c]),h=eD.useCallback(()=>{a=l.fog,o=l.background,l.background=i||o,l.fog=n||a,u.update(s,l),l.fog=a,l.background=o},[s,l,u]);return{fbo:c,camera:u,update:h}}function cm({children:e,frames:t=1/0,resolution:r,near:i,far:n,envMap:a,fog:o,...s}){let l=eD.useRef(null),{fbo:c,camera:u,update:h}=cd({resolution:r,near:i,far:n,envMap:a,fog:o}),A=0;return(0,eR.F)(()=>{l.current&&(t===1/0||A<t)&&(l.current.visible=!1,h(),l.current.visible=!0,A++)}),eD.createElement("group",s,eD.createElement("primitive",{object:u}),eD.createElement("group",{ref:l},null==e?void 0:e(c.texture)))}var cf=Object.defineProperty,cp=(e,t,r)=>t in e?cf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cg=(e,t,r)=>(cp(e,"symbol"!=typeof t?t+"":t,r),r);class cy{constructor(){cg(this,"_listeners")}addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let r=this._listeners[e];if(void 0!==r){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners[e.type];if(void 0!==t){e.target=this;let r=t.slice(0);for(let t=0,i=r.length;t<i;t++)r[t].call(this,e);e.target=null}}}var cv=Object.defineProperty,cE=(e,t,r)=>t in e?cv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cx=(e,t,r)=>(cE(e,"symbol"!=typeof t?t+"":t,r),r);class cC extends cy{constructor(e){super(),cx(this,"object"),cx(this,"changeEvent",{type:"change"}),cx(this,"EPS",1e-6),cx(this,"enabled",!0),cx(this,"deviceOrientation",{alpha:0,beta:0,gamma:0}),cx(this,"screenOrientation",0),cx(this,"alphaOffset",0),cx(this,"onDeviceOrientationChangeEvent",e=>{this.deviceOrientation=e}),cx(this,"onScreenOrientationChangeEvent",()=>{this.screenOrientation=window.orientation||0}),cx(this,"zee",new eT.Pa4(0,0,1)),cx(this,"euler",new eT.USm),cx(this,"q0",new eT._fP),cx(this,"q1",new eT._fP(-Math.sqrt(.5),0,0,Math.sqrt(.5))),cx(this,"setObjectQuaternion",(e,t,r,i,n)=>{this.euler.set(r,t,-i,"YXZ"),e.setFromEuler(this.euler),e.multiply(this.q1),e.multiply(this.q0.setFromAxisAngle(this.zee,-n))}),cx(this,"connect",()=>{this.onScreenOrientationChangeEvent(),void 0!==window.DeviceOrientationEvent&&"function"==typeof window.DeviceOrientationEvent.requestPermission?window.DeviceOrientationEvent.requestPermission().then(e=>{"granted"==e&&(window.addEventListener("orientationchange",this.onScreenOrientationChangeEvent),window.addEventListener("deviceorientation",this.onDeviceOrientationChangeEvent))}).catch(e=>{console.error("THREE.DeviceOrientationControls: Unable to use DeviceOrientation API:",e)}):(window.addEventListener("orientationchange",this.onScreenOrientationChangeEvent),window.addEventListener("deviceorientation",this.onDeviceOrientationChangeEvent)),this.enabled=!0}),cx(this,"disconnect",()=>{window.removeEventListener("orientationchange",this.onScreenOrientationChangeEvent),window.removeEventListener("deviceorientation",this.onDeviceOrientationChangeEvent),this.enabled=!1}),cx(this,"lastQuaternion",new eT._fP),cx(this,"update",()=>{if(!1===this.enabled)return;let e=this.deviceOrientation;if(e){let t=e.alpha?eT.M8C.degToRad(e.alpha)+this.alphaOffset:0,r=e.beta?eT.M8C.degToRad(e.beta):0,i=e.gamma?eT.M8C.degToRad(e.gamma):0,n=this.screenOrientation?eT.M8C.degToRad(this.screenOrientation):0;this.setObjectQuaternion(this.object.quaternion,t,r,i,n),8*(1-this.lastQuaternion.dot(this.object.quaternion))>this.EPS&&(this.lastQuaternion.copy(this.object.quaternion),this.dispatchEvent(this.changeEvent))}}),cx(this,"dispose",()=>this.disconnect()),this.object=e,this.object.rotation.reorder("YXZ"),this.connect()}}let cw=eD.forwardRef((e,t)=>
824{let{camera:r,onChange:i,makeDefault:n,...a}=e,o=(0,eR.D)(e=>e.camera),s=(0,eR.D)(e=>e.invalidate),l=(0,eR.D)(e=>e.get),c=(0,eR.D)(e=>e.set),u=r||o,h=eD.useMemo(()=>new cC(u),[u]);return eD.useEffect(()=>{let e=e=>{s(),i&&i(e)};return null==h||null==h.addEventListener||h.addEventListener("change",e),()=>null==h||null==h.removeEventListener?void 0:h.removeEventListener("change",e)},[i,h,s]),(0,eR.F)(()=>null==h?void 0:h.update(),-1),eD.useEffect(()=>(null==h||h.connect(),()=>null==h?void 0:h.dispose()),[h]),eD.useEffect(()=>{if(n){let e=l().controls;return c({controls:h}),()=>c({controls:e})}},[n,h]),h?eD.createElement("primitive",(0,eS.Z)({ref:t,object:h},a)):null});var cB=Object.defineProperty,cI=(e,t,r)=>t in e?cB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,c_=(e,t,r)=>(cI(e,"symbol"!=typeof t?t+"":t,r),r);function cb(e){e.preventDefault()}class cM extends cy{constructor(e,t){super(),c_(this,"object"),c_(this,"domElement",null),c_(this,"movementSpeed",1),c_(this,"rollSpeed",.005),c_(this,"dragToLook",!1),c_(this,"autoForward",!1),c_(this,"changeEvent",{type:"change"}),c_(this,"EPS",1e-6),c_(this,"tmpQuaternion",new eT._fP),c_(this,"mouseStatus",0),c_(this,"movementSpeedMultiplier",1),c_(this,"moveState",{up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0}),c_(this,"moveVector",new eT.Pa4(0,0,0)),c_(this,"rotationVector",new eT.Pa4(0,0,0)),c_(this,"keydown",e=>{if(!e.altKey){switch(e.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=.1;break;case"KeyW":this.moveState.forward=1;break;case"KeyS":this.moveState.back=1;break;case"KeyA":this.moveState.left=1;break;case"KeyD":this.moveState.right=1;break;case"KeyR":this.moveState.up=1;break;case"KeyF":this.moveState.down=1;break;case"ArrowUp":this.moveState.pitchUp=1;break;case"ArrowDown":this.moveState.pitchDown=1;break;case"ArrowLeft":this.moveState.yawLeft=1;break;case"ArrowRight":this.moveState.yawRight=1;break;case"KeyQ":this.moveState.rollLeft=1;break;case"KeyE":this.moveState.rollRight=1}this.updateMovementVector(),this.updateRotationVector()}}),c_(this,"keyup",e=>{switch(e.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=1;break;case"KeyW":this.moveState.forward=0;break;case"KeyS":this.moveState.back=0;break;case"KeyA":this.moveState.left=0;break;case"KeyD":this.moveState.right=0;break;case"KeyR":this.moveState.up=0;break;case"KeyF":this.moveState.down=0;break;case"ArrowUp":this.moveState.pitchUp=0;break;case"ArrowDown":this.moveState.pitchDown=0;break;case"ArrowLeft":this.moveState.yawLeft=0;break;case"ArrowRight":this.moveState.yawRight=0;break;case"KeyQ":this.moveState.rollLeft=0;break;case"KeyE":this.moveState.rollRight=0}this.updateMovementVector(),this.updateRotationVector()}),c_(this,"pointerdown",e=>{if(this.dragToLook)this.mouseStatus++;else{switch(e.button){case 0:this.moveState.forward=1;break;case 2:this.moveState.back=1}this.updateMovementVector()}}),c_(this,"pointermove",e=>{if(!this.dragToLook||this.mouseStatus>0){let t=this.getContainerDimensions(),r=t.size[0]/2,i=t.size[1]/2;this.moveState.yawLeft=-(e.pageX-t.offset[0]-r)/r,this.moveState.pitchDown=(e.pageY-t.offset[1]-i)/i,this.updateRotationVector()}}),c_(this,"pointerup",e=>{if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else{switch(e.button){case 0:this.moveState.forward=0;break;case 2:this.moveState.back=0}this.updateMovementVector()}this.updateRotationVector()}),c_(this,"lastQuaternion",new eT._fP),c_(this,"lastPosition",new eT.Pa4),c_(this,"update",e=>{let t=e*this.movementSpeed,r=e*this.rollSpeed;this.object.translateX(this.moveVector.x*t),this.object.translateY(this.moveVector.y*t),this.object.translateZ(this.moveVector.z*t),this.tmpQuaternion.set(this.rotationVector.x*r,this.rotationVector.y*r,this.rotationVector.z*r,1).normalize(),this.object.quaternion.multiply(this.tmpQuaternion),(this.lastPosition.distanceToSquared(this.object.position)>this.EPS||8*(1-this.lastQuaternion.dot(this.object.quaternion))>this.EPS)&&(this.dispatchEvent(this.changeEvent),this.lastQuaternion.copy(this.object.quaternion),this.lastPosition.copy(this.object.position))}),c_(this,"updateMovementVector",()=>{let e=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right,this.moveVector.y=-this.moveState.down+this.moveState.up,this.moveVector.z=-e+this.moveState.back}),c_(this,"updateRotationVector",()=>{this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp,this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft,this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft}),c_(this,"getContainerDimensions",()=>this.domElement==document||this.domElement instanceof Document?{size:[window.innerWidth,window.innerHeight],offset:[0,0]}:{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}),c_(this,"connect",e=>{this.domElement=e,e instanceof Document||e.setAttribute("tabindex",-1),this.domElement.addEventListener("contextmenu",cb),this.domElement.addEventListener("pointermove",this.pointermove),this.domElement.addEventListener("pointerdown",this.pointerdown),this.domElement.addEventListener("pointerup",this.pointerup),window.addEventListener("keydown",this.keydown),window.addEventListener("keyup",this.keyup)}),c_(this,"dispose",()=>{this.domElement.removeEventListener("contextmenu",cb),this.domElement.removeEventListener("pointermove",this.pointermove),this.domElement.removeEventListener("pointerdown",this.pointerdown),this.domElement.removeEventListener("pointerup",this.pointerup),window.removeEventListener("keydown",this.keydown),window.removeEventListener("keyup",this.keyup)}),this.object=e,void 0!==t&&this.connect(t),this.updateMovementVector(),this.updateRotationVector()}}let cS=eD.forwardRef(({domElement:e,...t},r)=>{let{onChange:i,makeDefault:n,...a}=t,o=(0,eR.D)(e=>e.invalidate),s=(0,eR.D)(e=>e.camera),l=(0,eR.D)(e=>e.gl),c=(0,eR.D)(e=>e.events),u=(0,eR.D)(e=>e.get),h=(0,eR.D)(e=>e.set),A=e||c.connected||l.domElement,d=eD.useMemo(()=>new cM(s),[s]);return eD.useEffect(()=>(d.connect(A),()=>void d.dispose()),[A,d,o]),eD.useEffect(()=>{let e=e=>{o(),i&&i(e)};return null==d.addEventListener||d.addEventListener("change",e),()=>null==d.removeEventListener?void 0:d.removeEventListener("change",e)},[i,o]),eD.useEffect(()=>{if(n){let e=u().controls;return h({controls:d}),()=>h({controls:e})}},[n,d]),(0,eR.F)((e,t)=>d.update(t)),eD.createElement("primitive",(0,eS.Z)({ref:r,object:d,args:[s,A]},a))});var cD=Object.defineProperty,cP=(e,t,r)=>t in e?cD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cT=(e,t,r)=>(cP(e,"symbol"!=typeof t?t+"":t,r),r);let cR=new eT.zHn,cF=new eT.JOQ,cQ=Math.cos(Math.PI/180*70),cz=(e,t)=>
824(e%t+t)%t;class ck extends cy{constructor(e,t){super(),cT(this,"object"),cT(this,"domElement"),cT(this,"enabled",!0),cT(this,"target",new eT.Pa4),cT(this,"minDistance",0),cT(this,"maxDistance",1/0),cT(this,"minZoom",0),cT(this,"maxZoom",1/0),cT(this,"minPolarAngle",0),cT(this,"maxPolarAngle",Math.PI),cT(this,"minAzimuthAngle",-1/0),cT(this,"maxAzimuthAngle",1/0),cT(this,"enableDamping",!1),cT(this,"dampingFactor",.05),cT(this,"enableZoom",!0),cT(this,"zoomSpeed",1),cT(this,"enableRotate",!0),cT(this,"rotateSpeed",1),cT(this,"enablePan",!0),cT(this,"panSpeed",1),cT(this,"screenSpacePanning",!0),cT(this,"keyPanSpeed",7),cT(this,"zoomToCursor",!1),cT(this,"autoRotate",!1),cT(this,"autoRotateSpeed",2),cT(this,"reverseOrbit",!1),cT(this,"reverseHorizontalOrbit",!1),cT(this,"reverseVerticalOrbit",!1),cT(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),cT(this,"mouseButtons",{LEFT:eT.RsA.ROTATE,MIDDLE:eT.RsA.DOLLY,RIGHT:eT.RsA.PAN}),cT(this,"touches",{ONE:eT.QmN.ROTATE,TWO:eT.QmN.DOLLY_PAN}),cT(this,"target0"),cT(this,"position0"),cT(this,"zoom0"),cT(this,"_domElementKeyEvents",null),cT(this,"getPolarAngle"),cT(this,"getAzimuthalAngle"),cT(this,"setPolarAngle"),cT(this,"setAzimuthalAngle"),cT(this,"getDistance"),cT(this,"getZoomScale"),cT(this,"listenToKeyEvents"),cT(this,"stopListenToKeyEvents"),cT(this,"saveState"),cT(this,"reset"),cT(this,"update"),cT(this,"connect"),cT(this,"dispose"),cT(this,"dollyIn"),cT(this,"dollyOut"),cT(this,"getScale"),cT(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>c.phi,this.getAzimuthalAngle=()=>c.theta,this.setPolarAngle=e=>{let t=cz(e,2*Math.PI),i=c.phi;i<0&&(i+=2*Math.PI),t<0&&(t+=2*Math.PI);let n=Math.abs(t-i);2*Math.PI-n<n&&(t<i?t+=2*Math.PI:i+=2*Math.PI),u.phi=t-i,r.update(
824)},this.setAzimuthalAngle=e=>{let t=cz(e,2*Math.PI),i=c.theta;i<0&&(i+=2*Math.PI),t<0&&(t+=2*Math.PI);let n=Math.abs(t-i);2*Math.PI-n<n&&(t<i?t+=2*Math.PI:i+=2*Math.PI),u.theta=t-i,r.update()},this.getDistance=()=>r.object.position.distanceTo(r.target),this.listenToKeyEvents=e=>{e.addEventListener("keydown",Y),this._domElementKeyEvents=e},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",Y),this._domElementKeyEvents=null},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),s=o.NONE},this.update=(()=>{let t=new eT.Pa4,n=new eT.Pa4(0,1,0),a=new eT._fP().setFromUnitVectors(e.up,n),d=a.clone().invert(),m=new eT.Pa4,f=new eT._fP,p=2*Math.PI;return function(){let g=r.object.position;a.setFromUnitVectors(e.up,n),d.copy(a).invert(),t.copy(g).sub(r.target),t.applyQuaternion(a),c.setFromVector3(t),r.autoRotate&&s===o.NONE&&M(2*Math.PI/60/60*r.autoRotateSpeed),r.enableDamping?(c.theta+=u.theta*r.dampingFactor,c.phi+=u.phi*r.dampingFactor):(c.theta+=u.theta,c.phi+=u.phi);let y=r.minAzimuthAngle,v=r.maxAzimuthAngle;isFinite(y)&&isFinite(v)&&(y<-Math.PI?y+=p:y>Math.PI&&(y-=p),v<-Math.PI?v+=p:v>Math.PI&&(v-=p),y<=v?c.theta=Math.max(y,Math.min(v,c.theta)):c.theta=c.theta>(y+v)/2?Math.max(y,c.theta):Math.min(v,c.theta)),c.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,c.phi)),c.makeSafe(),!0===r.enableDamping?r.target.addScaledVector(A,r.dampingFactor):r.target.add(A),r.zoomToCursor&&B||r.object.isOrthographicCamera?c.radius=Q(c.radius):c.radius=Q(c.radius*h),t.setFromSpherical(c),t.applyQuaternion(d),g.copy(r.target).add(t),r.object.matrixAutoUpdate||r.object.updateMatrix(),r.object.lookAt(r.target),!0===r.enableDamping?(u.theta*=1-r.dampingFactor,u.phi*=1-r.dampingFactor,A.multiplyScalar(1-r.dampingFactor)):(u.set(0,0,0),A.set(0,0,0));let E=!1;if(r.zoomToCursor&&B){let i=null;if(r.object instanceof eT.cPb&&r.object.isPerspectiveCamera){let e=t.length();i=Q(e*h);let n=e-i;r.object.position.addScaledVector(C,n),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){let e=new eT.Pa4(w.x,w.y,0);e.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/h)),r.object.updateProjectionMatrix(),E=!0;let n=new eT.Pa4(w.x,w.y,0);n.unproject(r.object),r.object.position.sub(n).add(e),r.object.updateMatrixWorld(),i=t.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;null!==i&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(i).add(r.object.position):(cR.origin.copy(r.object.position),cR.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(cR.direction))<cQ?e.lookAt(r.target):(cF.setFromNormalAndCoplanarPoint(r.object.up,r.target),cR.intersectPlane(cF,r.target))))}else r.object instanceof eT.iKG&&r.object.isOrthographicCamera&&(E=1!==h)&&(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/h)),r.object.updateProjectionMatrix());return h=1,B=!1,!!(E||m.distanceToSquared(r.object.position)>l||8*(1-f.dot(r.object.quaternion))>l)&&(r.dispatchEvent(i),m.copy(r.object.position),f.copy(r.object.quaternion),E=!1,!0)}})(),this.connect=e=>{r.domElement=e,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",W),r.domElement.addEventListener("pointerdown",j),r.domElement.addEventListener("pointercancel",V),r.domElement.addEventListener("wheel",K)},this.dispose=()=>{var e,t,i,n,a,o;r.domElement&&(r.domElement.style.touchAction="auto"),null==(e=r.domElement)||e.removeEventListener("contextmenu",W),null==(t=r.domElement)||t.removeEventListener("pointerdown",j),null==(i=r.domElement)||i.removeEventListener("pointercancel",V),null==(n=r.domElement)||n.removeEventListener("wheel",K),null==(a=r.domElement)||a.ownerDocument.removeEventListener("pointermove",J),null==(o=r.domElement)||o.ownerDocument.removeEventListener("pointerup",V),null!==r._domElementKeyEvents&&r._domElementKeyEvents.removeEventListener("keydown",Y)};let r=this,i={type:"change"},n={type:"start"},a={type:"end"},o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},s=o.NONE,l=1e-6,c=new eT.$V,u=new eT.$V,h=1,A=new eT.Pa4,d=new eT.FM8,m=new eT.FM8,f=new eT.FM8,p=new eT.FM8,g=new eT.FM8,y=new eT.FM8,v=new eT.FM8,E=new eT.FM8,x=new eT.FM8,C=new eT.Pa4,w=new eT.FM8,B=!1,I=[],_={};function b(){return Math.pow(.95,r.zoomSpeed)}function M(e){r.reverseOrbit||r.reverseHorizontalOrbit?u.theta+=e:u.theta-=e}function S(e){r.reverseOrbit||r.reverseVerticalOrbit?u.phi+=e:u.phi-=e}let D=(()=>{let e=new eT.Pa4;return function(t,r){e.setFromMatrixColumn(r,0),e.multiplyScalar(-t),A.add(e)}})(),P=(()=>{let e=new eT.Pa4;return function(t,i){!0===r.screenSpacePanning?e.setFromMatrixColumn(i,1):(e.setFromMatrixColumn(i,0),e.crossVectors(r.object.up,e)),e.multiplyScalar(t),A.add(e)}})(),T=(()=>{let e=new eT.Pa4;return function(t,i){let n=r.domElement;if(n&&r.object instanceof eT.cPb&&r.object.isPerspectiveCamera){let a=r.object.position;e.copy(a).sub(r.target);let o=e.length();
824D(2*t*(o*=Math.tan(r.object.fov/2*Math.PI/180))/n.clientHeight,r.object.matrix),P(2*i*o/n.clientHeight,r.object.matrix)}else n&&r.object instanceof eT.iKG&&r.object.isOrthographicCamera?(D(t*(r.object.right-r.object.left)/r.object.zoom/n.clientWidth,r.object.matrix),P(i*(r.object.top-r.object.bottom)/r.object.zoom/n.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function R(e){r.object instanceof eT.cPb&&r.object.isPerspectiveCamera||r.object instanceof eT.iKG&&r.object.isOrthographicCamera?h=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function F(e){if(!r.zoomToCursor||!r.domElement)return;B=!0;let t=r.domElement.getBoundingClientRect(),i=e.clientX-t.left,n=e.clientY-t.top,a=t.width,o=t.height;w.x=i/a*2-1,w.y=-(n/o*2)+1,C.set(w.x,w.y,1).unproject(r.object).sub(r.object.position).normalize()}function Q(e){return Math.max(r.minDistance,Math.min(r.maxDistance,e))}function z(e){d.set(e.clientX,e.clientY)}function k(e){p.set(e.clientX,e.clientY)}function L(){if(1==I.length)d.set(I[0].pageX,I[0].pageY);else{let e=.5*(I[0].pageX+I[1].pageX),t=.5*(I[0].pageY+I[1].pageY);d.set(e,t)}}function O(){if(1==I.length)p.set(I[0].pageX,I[0].pageY);else{let e=.5*(I[0].pageX+I[1].pageX),t=.5*(I[0].pageY+I[1].pageY);p.set(e,t)}}function U(){let e=I[0].pageX-I[1].pageX,t=I[0].pageY-I[1].pageY;v.set(0,Math.sqrt(e*e+t*t))}function G(e){if(1==I.length)m.set(e.pageX,e.pageY);else{let t=X(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);m.set(r,i)}f.subVectors(m,d).multiplyScalar(r.rotateSpeed);let t=r.domElement;t&&(M(2*Math.PI*f.x/t.clientHeight),S(2*Math.PI*f.y/t.clientHeight)),d.copy(m)}function N(e){if(1==I.length)g.set(e.pageX,e.pageY);else{let t=X(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);g.set(r,i)}y.subVectors(g,p).multiplyScalar(r.panSpeed),T(y.x,y.y),p.copy(g)}function H(e){var t;let i=X(e),n=e.pageX-i.x,a=e.pageY-i.y;E.set(0,Math.sqrt(n*n+a*a)),x.set(0,Math.pow(E.y/v.y,r.zoomSpeed)),t=x.y,R(h/t),v.copy(E)}function j(e){var t,i;!1!==r.enabled&&(0===I.length&&(null==(t=r.domElement)||t.ownerDocument.addEventListener("pointermove",J),null==(i=r.domElement)||i.ownerDocument.addEventListener("pointerup",V)),I.push(e),"touch"===e.pointerType?function(e){switch(q(e),I.length){case 1:switch(r.touches.ONE){case eT.QmN.ROTATE:if(!1===r.enableRotate)return;L(),s=o.TOUCH_ROTATE;break;case eT.QmN.PAN:if(!1===r.enablePan)return;O(),s=o.TOUCH_PAN;break;default:s=o.NONE}break;case 2:switch(r.touches.TWO){case eT.QmN.DOLLY_PAN:if(!1===r.enableZoom&&!1===r.enablePan)return;r.enableZoom&&U(),r.enablePan&&O(),s=o.TOUCH_DOLLY_PAN;break;case eT.QmN.DOLLY_ROTATE:if(!1===r.enableZoom&&!1===r.enableRotate)return;r.enableZoom&&U(),r.enableRotate&&L(),s=o.TOUCH_DOLLY_ROTATE;break;default:s=o.NONE}break;default:s=o.NONE}s!==o.NONE&&r.dispatchEvent(n)}(e):function(e){let t;switch(e.button){case 0:t=r.mouseButtons.LEFT;break;case 1:t=r.mouseButtons.MIDDLE;break;case 2:t=r.mouseButtons.RIGHT;break;default:t=-1}switch(t){case eT.RsA.DOLLY:if(!1===r.enableZoom)return;F(e),v.set(e.clientX,e.clientY),s=o.DOLLY;break;case eT.RsA.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===r.enablePan)return;k(e),s=o.PAN}else{if(!1===r.enableRotate)return;z(e),s=o.ROTATE}break;case eT.RsA.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===r.enableRotate)return;z(e),s=o.ROTATE}else{if(!1===r.enablePan)return;k(e),s=o.PAN}break;default:s=o.NONE}s!==o.NONE&&r.dispatchEvent(n)}(e))}function J(e){!1!==r.enabled&&("touch"===e.pointerType?function(e){switch(q(e),s){case o.TOUCH_ROTATE:if(!1===r.enableRotate)return;G(e),r.update();break;case o.TOUCH_PAN:if(!1===r.enablePan)return;N(e),r.update();break;case o.TOUCH_DOLLY_PAN:if(!1===r.enableZoom&&!1===r.enablePan)return;r.enableZoom&&H(e),r.enablePan&&N(e),r.update();break;case o.TOUCH_DOLLY_ROTATE:if(!1===r.enableZoom&&!1===r.enableRotate)return;r.enableZoom&&H(e),r.enableRotate&&G(e),r.update();break;default:s=o.NONE}}(e):function(e){if(!1!==r.enabled)switch(s){case o.ROTATE:if(!1===r.enableRotate)return;!function(e){m.set(e.clientX,e.clientY),f.subVectors(m,d).multiplyScalar(r.rotateSpeed);let t=r.domElement;t&&(M(2*Math.PI*f.x/t.clientHeight),S(2*Math.PI*f.y/t.clientHeight)),d.copy(m),r.update(
824)}(e);break;case o.DOLLY:var t,i;if(!1===r.enableZoom)return;(E.set(e.clientX,e.clientY),x.subVectors(E,v),x.y>0)?(t=b(),R(h/t)):x.y<0&&(i=b(),R(h*i)),v.copy(E),r.update();break;case o.PAN:if(!1===r.enablePan)return;g.set(e.clientX,e.clientY),y.subVectors(g,p).multiplyScalar(r.panSpeed),T(y.x,y.y),p.copy(g),r.update()}}(e))}function V(e){var t,i,n;(function(e){delete _[e.pointerId];for(let t=0;t<I.length;t++)if(I[t].pointerId==e.pointerId){I.splice(t,1);return}})(e),0===I.length&&(null==(t=r.domElement)||t.releasePointerCapture(e.pointerId),null==(i=r.domElement)||i.ownerDocument.removeEventListener("pointermove",J),null==(n=r.domElement)||n.ownerDocument.removeEventListener("pointerup",V)),r.dispatchEvent(a),s=o.NONE}function K(e){if(!1!==r.enabled&&!1!==r.enableZoom&&(s===o.NONE||s===o.ROTATE)){var t,i;e.preventDefault(),r.dispatchEvent(n),(F(e),e.deltaY<0)?(t=b(),R(h*t)):e.deltaY>0&&(i=b(),R(h/i)),r.update(),r.dispatchEvent(a)}}function Y(e){!1!==r.enabled&&!1!==r.enablePan&&function(e){let t=!1;switch(e.code){case r.keys.UP:T(0,r.keyPanSpeed),t=!0;break;case r.keys.BOTTOM:T(0,-r.keyPanSpeed),t=!0;break;case r.keys.LEFT:T(r.keyPanSpeed,0),t=!0;break;case r.keys.RIGHT:T(-r.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),r.update())}(e)}function W(e){!1!==r.enabled&&e.preventDefault()}function q(e){let t=_[e.pointerId];void 0===t&&(t=new eT.FM8,_[e.pointerId]=t),t.set(e.pageX,e.pageY)}function X(e){return _[(e.pointerId===I[0].pointerId?I[1]:I[0]).pointerId]}this.dollyIn=(e=b())=>{R(h*e),r.update()},this.dollyOut=(e=b())=>{R(h/e),r.update()},this.getScale=()=>h,this.setScale=e=>{R(e),r.update()},this.getZoomScale=()=>b(),void 0!==t&&this.connect(t),this.update()}}class cL extends ck{constructor(e,t){super(e,t),this.screenSpacePanning=!1,this.mouseButtons.LEFT=eT.RsA.PAN,this.mouseButtons.RIGHT=eT.RsA.ROTATE,this.touches.ONE=eT.QmN.PAN,this.touches.TWO=eT.QmN.DOLLY_ROTATE}}let cO=eD.forwardRef((e={enableDamping:!0},t)=>{let{domElement:r,camera:i,makeDefault:n,onChange:a,onStart:o,onEnd:s,...l}=e,c=(0,eR.D)(e=>e.invalidate),u=(0,eR.D)(e=>e.camera),h=(0,eR.D)(e=>e.gl),A=(0,eR.D)(e=>e.events),d=(0,eR.D)(e=>e.set),m=(0,eR.D)(e=>e.get),f=r||A.connected||h.domElement,p=i||u,g=eD.useMemo(()=>new cL(p),[p]);return eD.useEffect(()=>{g.connect(f);let e=e=>{c(),a&&a(e)};return g.addEventListener("change",e),o&&g.addEventListener("start",o),s&&g.addEventListener("end",s),()=>{g.dispose(),g.removeEventListener("change",e),o&&g.removeEventListener("start",o),s&&g.removeEventListener("end",s)}},[a,o,s,g,c,f]),eD.useEffect(()=>{if(n){let e=m().controls;return d({controls:g}),()=>d({controls:e})}},[n,g]),(0,eR.F)(()=>g.update(),-1),eD.createElement("primitive",(0,eS.Z)({ref:t,object:g,enableDamping:!0},l))}),cU=eD.forwardRef(({makeDefault:e,camera:t,regress:r,domElement:i,enableDamping:n=!0,keyEvents:a=!1,onChange:o,onStart:s,onEnd:l,...c},u)=>{let h=(0,eR.D)(e=>e.invalidate),A=(0,eR.D)(e=>e.camera),d=(0,eR.D)(e=>e.gl),m=(0,eR.D)(e=>e.events),f=(0,eR.D)(e=>e.setEvents),p=(0,eR.D)(e=>e.set),g=(0,eR.D)(e=>e.get),y=(0,eR.D)(e=>e.performance),v=t||A,E=i||m.connected||d.domElement,x=eD.useMemo(()=>new ck(v),[v]);return(0,eR.F)(()=>{x.enabled&&x.update()},-1),eD.useEffect(()=>(a&&x.connect(!0===a?E:a),x.connect(E),()=>void x.dispose()),[a,E,r,x,h]),eD.useEffect(()=>{let e=e=>{h(),r&&y.regress(),o&&o(e)},t=e=>{s&&s(e)},i=e=>{l&&l(e)};return x.addEventListener("change",e),x.addEventListener("start",t),x.addEventListener("end",i),()=>{x.removeEventListener("start",t),x.removeEventListener("end",i),x.removeEventListener("change",e)}},[o,s,l,x,h,f]),eD.useEffect(()=>{if(e){let e=g().controls;return p({controls:x}),()=>p({controls:e})}},[e,x]),eD.createElement("primitive",(0,eS.Z)({ref:u,object:x,enableDamping:n},c))});var cG=Object.defineProperty,cN=(e,t,r)=>t in e?cG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cH=(e,t,r)=>(cN(e,"symbol"!=typeof t?t+"":t,r),r);class cj extends cy{constructor(e,t){super(),cH(this,"enabled",!0),cH(this,"screen",{left:0,top:0,width:0,height:0}),cH(this,"rotateSpeed",1),cH(this,"zoomSpeed",1.2),cH(this,"panSpeed",.3),cH(this,"noRotate",!1),cH(this,"noZoom",!1),cH(this,"noPan",!1),cH(this,"staticMoving",!1),cH(this,"dynamicDampingFactor",.2),cH(this,"minDistance",0),cH(this,"maxDistance",1/0),cH(this,"keys",["KeyA","KeyS","KeyD"]),cH(this,"mouseButtons",{LEFT:eT.RsA.ROTATE,MIDDLE:eT.RsA.DOLLY,RIGHT:eT.RsA.PAN}),cH(this,"object"),cH(this,"domElement"),cH(this,"cursorZoom",!1),cH(this,"target",new eT.Pa4),cH(this,"mousePosition",new eT.FM8),cH(this,"STATE",{NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4}),cH(this,"EPS",1e-6),cH(this,"lastZoom",1),cH(this,"lastPosition",new eT.Pa4),cH(this,"cursorVector",new eT.Pa4),cH(this,"targetVector",new eT.Pa4),cH(this,"_state",this.STATE.NONE),cH(this,"_keyState",this.STATE.NONE),cH(this,"_eye",new eT.Pa4),cH(this,"_movePrev",new eT.FM8),cH(this,"_moveCurr",new eT.FM8),cH(this,"_lastAxis",new eT.Pa4),cH(this,"_lastAngle",0),cH(this,"_zoomStart",new eT.FM8),cH(this,"_zoomEnd",new eT.FM8),cH(this,"_touchZoomDistanceStart",0),cH(this,"_touchZoomDistanceEnd",0),cH(this,"_panStart",new eT.FM8),cH(this,"_panEnd",new eT.FM8),cH(this,"target0"),cH(this,"position0"),cH(this,"up0"),
824cH(this,"zoom0"),cH(this,"changeEvent",{type:"change"}),cH(this,"startEvent",{type:"start"}),cH(this,"endEvent",{type:"end"}),cH(this,"onScreenVector",new eT.FM8),cH(this,"getMouseOnScreen",(e,t)=>(this.onScreenVector.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),this.onScreenVector)),cH(this,"onCircleVector",new eT.FM8),cH(this,"getMouseOnCircle",(e,t)=>(this.onCircleVector.set((e-.5*this.screen.width-this.screen.left)/(.5*this.screen.width),(this.screen.height+2*(this.screen.top-t))/this.screen.width),this.onCircleVector)),cH(this,"axis",new eT.Pa4),cH(this,"quaternion",new eT._fP),cH(this,"eyeDirection",new eT.Pa4),cH(this,"objectUpDirection",new eT.Pa4),cH(this,"objectSidewaysDirection",new eT.Pa4),cH(this,"moveDirection",new eT.Pa4),cH(this,"angle",0),cH(this,"rotateCamera",()=>{this.moveDirection.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0),this.angle=this.moveDirection.length(),this.angle?(this._eye.copy(this.object.position).sub(this.target),this.eyeDirection.copy(this._eye).normalize(),this.objectUpDirection.copy(this.object.up).normalize(),this.objectSidewaysDirection.crossVectors(this.objectUpDirection,this.eyeDirection).normalize(),this.objectUpDirection.setLength(this._moveCurr.y-this._movePrev.y),this.objectSidewaysDirection.setLength(this._moveCurr.x-this._movePrev.x),this.moveDirection.copy(this.objectUpDirection.add(this.objectSidewaysDirection)),this.axis.crossVectors(this.moveDirection,this._eye).normalize(),this.angle*=this.rotateSpeed,this.quaternion.setFromAxisAngle(this.axis,this.angle),this._eye.applyQuaternion(this.quaternion),this.object.up.applyQuaternion(this.quaternion),this._lastAxis.copy(this.axis),this._lastAngle=this.angle):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),this.quaternion.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(this.quaternion),this.object.up.applyQuaternion(this.quaternion)),this._movePrev.copy(this._moveCurr)}),cH(this,"zoomCamera",()=>{let e;if(this._state===this.STATE.TOUCH_ZOOM_PAN)e=this._touchZoomDistanceStart/this._touchZoomDistanceEnd,this._touchZoomDistanceStart=this._touchZoomDistanceEnd,this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom/=e,this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type");else{if(Math.abs((e=1+(this._zoomEnd.y-this._zoomStart.y)*this.zoomSpeed)-1)>this.EPS&&e>0&&(this.object.isPerspectiveCamera?(e>1&&this._eye.length()>=this.maxDistance-this.EPS&&(e=1),this._eye.multiplyScalar(e)):this.object.isOrthographicCamera?(e>1&&this.object.zoom<this.maxDistance*this.maxDistance&&(e=1),this.object.zoom/=e):console.warn("THREE.TrackballControls: Unsupported camera type")),this.staticMoving?this._zoomStart.copy(this._zoomEnd):this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor,this.cursorZoom){this.targetVector.copy(this.target).project(this.object);let t=this.cursorVector.set(this.mousePosition.x,this.mousePosition.y,this.targetVector.z).unproject(this.object);this.target.lerpVectors(t,this.target,e)}this.object.isOrthographicCamera&&this.object.updateProjectionMatrix()}}),cH(this,"mouseChange",new eT.FM8),cH(this,"objectUp",new eT.Pa4),cH(this,"pan",new eT.Pa4),cH(this,"panCamera",()=>{if(this.domElement&&(this.mouseChange.copy(this._panEnd).sub(this._panStart),this.mouseChange.lengthSq()>this.EPS)){if(this.object.isOrthographicCamera){let e=this.object,t=(e.right-e.left)/this.object.zoom,r=(e.top-e.bottom)/this.object.zoom;this.mouseChange.x*=t,this.mouseChange.y*=r}else this.mouseChange.multiplyScalar(this._eye.length()*this.panSpeed);this.pan.copy(this._eye).cross(this.object.up).setLength(this.mouseChange.x),this.pan.add(this.objectUp.copy(this.object.up).setLength(this.mouseChange.y)),this.object.position.add(this.pan),this.target.add(this.pan),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(this.mouseChange.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}),cH(this,"checkDistances",()=>{this.noZoom&&this.noPan||(this._eye.lengthSq()>this.maxDistance*this.maxDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),this._zoomStart.copy(this._zoomEnd)),this._eye.lengthSq()<this.minDistance*this.minDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.minDistance)),this._zoomStart.copy(this._zoomEnd)))}),cH(this,"handleResize",()=>{if(!this.domElement)return;let e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}),cH(this,"update",()=>{this._eye.subVectors(this.object.position,this.target),this.noRotate||this.rotateCamera(),this.noZoom||this.zoomCamera(),this.noPan||this.panCamera(),this.object.position.addVectors(this.target,this._eye),this.object.isPerspectiveCamera?(this.checkDistances(),this.object.lookAt(this.target),this.lastPosition.distanceToSquared(this.object.position)>this.EPS&&(this.dispatchEvent(this.changeEvent),this.lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this.lastPosition.distanceToSquared(this.object.position)>this.EPS||this.lastZoom!==this.object.zoom)&&(this.dispatchEvent(this.changeEvent),this.lastPosition.copy(this.object.position),this.lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type")}),cH(this,"reset",()=>{this._state=this.STATE.NONE,this._keyState=this.STATE.NONE,this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.up.copy(this.up0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this._eye.subVectors(this.object.position,this.target),this.object.lookAt(this.target),this.dispatchEvent(this.changeEvent),this.lastPosition.copy(this.object.position),this.lastZoom=this.object.zoom}),cH(this,"keydown",e=>{!1!==this.enabled&&(window.removeEventListener("keydown",this.keydown),this._keyState===this.STATE.NONE&&(e.code!==this.keys[this.STATE.ROTATE]||this.noRotate?e.code!==this.keys[this.STATE.ZOOM]||this.noZoom?e.code!==this.keys[this.STATE.PAN]||this.noPan||(this._keyState=this.STATE.PAN):this._keyState=this.STATE.ZOOM:this._keyState=this.STATE.ROTATE)
824)}),cH(this,"onPointerDown",e=>{if(!1!==this.enabled)switch(e.pointerType){case"mouse":case"pen":this.onMouseDown(e)}}),cH(this,"onPointerMove",e=>{if(!1!==this.enabled)switch(e.pointerType){case"mouse":case"pen":this.onMouseMove(e)}}),cH(this,"onPointerUp",e=>{if(!1!==this.enabled)switch(e.pointerType){case"mouse":case"pen":this.onMouseUp()}}),cH(this,"keyup",()=>{!1!==this.enabled&&(this._keyState=this.STATE.NONE,window.addEventListener("keydown",this.keydown))}),cH(this,"onMouseDown",e=>{if(!this.domElement)return;if(this._state===this.STATE.NONE)switch(e.button){case this.mouseButtons.LEFT:this._state=this.STATE.ROTATE;break;case this.mouseButtons.MIDDLE:this._state=this.STATE.ZOOM;break;case this.mouseButtons.RIGHT:this._state=this.STATE.PAN}let t=this._keyState!==this.STATE.NONE?this._keyState:this._state;t!==this.STATE.ROTATE||this.noRotate?t!==this.STATE.ZOOM||this.noZoom?t!==this.STATE.PAN||this.noPan||(this._panStart.copy(this.getMouseOnScreen(e.pageX,e.pageY)),this._panEnd.copy(this._panStart)):(this._zoomStart.copy(this.getMouseOnScreen(e.pageX,e.pageY)),this._zoomEnd.copy(this._zoomStart)):(this._moveCurr.copy(this.getMouseOnCircle(e.pageX,e.pageY)),this._movePrev.copy(this._moveCurr)),this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.dispatchEvent(this.startEvent)}),cH(this,"onMouseMove",e=>{if(!1===this.enabled)return;let t=this._keyState!==this.STATE.NONE?this._keyState:this._state;t!==this.STATE.ROTATE||this.noRotate?t!==this.STATE.ZOOM||this.noZoom?t!==this.STATE.PAN||this.noPan||this._panEnd.copy(this.getMouseOnScreen(e.pageX,e.pageY)):this._zoomEnd.copy(this.getMouseOnScreen(e.pageX,e.pageY)):(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this.getMouseOnCircle(e.pageX,e.pageY)))}),cH(this,"onMouseUp",()=>{this.domElement&&!1!==this.enabled&&(this._state=this.STATE.NONE,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),this.dispatchEvent(this.endEvent))}),cH(this,"mousewheel",e=>{if(!1!==this.enabled&&!0!==this.noZoom){switch(e.preventDefault(),e.deltaMode){case 2:this._zoomStart.y-=.025*e.deltaY;break;case 1:this._zoomStart.y-=.01*e.deltaY;break;default:this._zoomStart.y-=25e-5*e.deltaY}this.mousePosition.x=e.offsetX/this.screen.width*2-1,this.mousePosition.y=-(e.offsetY/this.screen.height*2)+1,this.dispatchEvent(this.startEvent),this.dispatchEvent(this.endEvent)}}),cH(this,"touchstart",e=>{if(!1!==this.enabled){if(e.preventDefault(),1===e.touches.length)this._state=this.STATE.TOUCH_ROTATE,this._moveCurr.copy(this.getMouseOnCircle(e.touches[0].pageX,e.touches[0].pageY)),this._movePrev.copy(this._moveCurr);else{this._state=this.STATE.TOUCH_ZOOM_PAN;let t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY;this._touchZoomDistanceEnd=this._touchZoomDistanceStart=Math.sqrt(t*t+r*r);let i=(e.touches[0].pageX+e.touches[1].pageX)/2,n=(e.touches[0].pageY+e.touches[1].pageY)/2;this._panStart.copy(this.getMouseOnScreen(i,n)),this._panEnd.copy(this._panStart)}this.dispatchEvent(this.startEvent)}}),cH(this,"touchmove",e=>{if(!1!==this.enabled){if(e.preventDefault(),1===e.touches.length)this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this.getMouseOnCircle(e.touches[0].pageX,e.touches[0].pageY));else{let t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY;this._touchZoomDistanceEnd=Math.sqrt(t*t+r*r);let i=(e.touches[0].pageX+e.touches[1].pageX)/2,n=(e.touches[0].pageY+e.touches[1].pageY)/2;this._panEnd.copy(this.getMouseOnScreen(i,n))}}}),cH(this,"touchend",e=>{if(!1!==this.enabled){switch(e.touches.length){case 0:this._state=this.STATE.NONE;break;case 1:this._state=this.STATE.TOUCH_ROTATE,this._moveCurr.copy(this.getMouseOnCircle(e.touches[0].pageX,e.touches[0].pageY)),this._movePrev.copy(this._moveCurr)}this.dispatchEvent(this.endEvent)}}),cH(this,"contextmenu",e=>{!1!==this.enabled&&e.preventDefault()}),cH(this,"connect",e=>{e===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.domElement=e,this.domElement.addEventListener("contextmenu",this.contextmenu),this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("wheel",this.mousewheel),this.domElement.addEventListener("touchstart",this.touchstart),this.domElement.addEventListener("touchend",this.touchend),this.domElement.addEventListener("touchmove",this.touchmove),this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),window.addEventListener("keydown",this.keydown),window.addEventListener("keyup",this.keyup),this.handleResize()}),cH(this,"dispose",()=>{this.domElement&&(this.domElement.removeEventListener("contextmenu",this.contextmenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("wheel",this.mousewheel),this.domElement.removeEventListener("touchstart",this.touchstart),this.domElement.removeEventListener("touchend",this.touchend),this.domElement.removeEventListener("touchmove",this.touchmove),this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("keydown",this.keydown),window.removeEventListener("keyup",this.keyup))}),this.object=e,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.up0=this.object.up.clone(),this.zoom0=this.object.zoom,void 0!==t&&this.connect(t),this.update()}}let cJ=eD.forwardRef(({makeDefault:e,camera:t,domElement:r,regress:i,onChange:n,onStart:a,onEnd:o,...s},l)=>{let{invalidate:c,camera:u,gl:h,events:A,set:d,get:m,performance:f,viewport:p}=(0,eR.D)(),g=t||u,y=r||A.connected||h.domElement,v=eD.useMemo(()=>new cj(g),[g]);return(0,eR.F)(()=>
824{v.enabled&&v.update()},-1),eD.useEffect(()=>(v.connect(y),()=>void v.dispose()),[y,i,v,c]),eD.useEffect(()=>{let e=e=>{c(),i&&f.regress(),n&&n(e)};return v.addEventListener("change",e),a&&v.addEventListener("start",a),o&&v.addEventListener("end",o),()=>{a&&v.removeEventListener("start",a),o&&v.removeEventListener("end",o),v.removeEventListener("change",e)}},[n,a,o,v,c]),eD.useEffect(()=>{v.handleResize()},[p]),eD.useEffect(()=>{if(e){let e=m().controls;return d({controls:v}),()=>d({controls:e})}},[e,v]),eD.createElement("primitive",(0,eS.Z)({ref:l,object:v},s))});var cV=Object.defineProperty,cK=(e,t,r)=>t in e?cV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cY=(e,t,r)=>(cK(e,"symbol"!=typeof t?t+"":t,r),r);let cW={IDLE:Symbol(),ROTATE:Symbol(),PAN:Symbol(),SCALE:Symbol(),FOV:Symbol(),FOCUS:Symbol(),ZROTATE:Symbol(),TOUCH_MULTI:Symbol(),ANIMATION_FOCUS:Symbol(),ANIMATION_ROTATE:Symbol()},cq={NONE:Symbol(),ONE_FINGER:Symbol(),ONE_FINGER_SWITCHED:Symbol(),TWO_FINGER:Symbol(),MULT_FINGER:Symbol(),CURSOR:Symbol()},cX={x:0,y:0},cZ={camera:new eT.yGw,gizmos:new eT.yGw},c$={type:"change"},c1={type:"start"},c0={type:"end"};class c2 extends cy{constructor(e,t=null,r=null){super(),cY(this,"camera"),cY(this,"domElement"),cY(this,"scene"),cY(this,"mouseActions"),cY(this,"_mouseOp"),cY(this,"_v2_1"),cY(this,"_v3_1"),cY(this,"_v3_2"),cY(this,"_m4_1"),cY(this,"_m4_2"),cY(this,"_quat"),cY(this,"_translationMatrix"),cY(this,"_rotationMatrix"),cY(this,"_scaleMatrix"),cY(this,"_rotationAxis"),cY(this,"_cameraMatrixState"),cY(this,"_cameraProjectionState"),cY(this,"_fovState"),cY(this,"_upState"),cY(this,"_zoomState"),cY(this,"_nearPos"),cY(this,"_farPos"),cY(this,"_gizmoMatrixState"),cY(this,"_up0"),cY(this,"_zoom0"),cY(this,"_fov0"),cY(this,"_initialNear"),cY(this,"_nearPos0"),cY(this,"_initialFar"),cY(this,"_farPos0"),cY(this,"_cameraMatrixState0"),cY(this,"_gizmoMatrixState0"),cY(this,"_button"),cY(this,"_touchStart"),cY(this,"_touchCurrent"),cY(this,"_input"),cY(this,"_switchSensibility"),cY(this,"_startFingerDistance"),cY(this,"_currentFingerDistance"),cY(this,"_startFingerRotation"),cY(this,"_currentFingerRotation"),cY(this,"_devPxRatio"),cY(this,"_downValid"),cY(this,"_nclicks"),cY(this,"_downEvents"),cY(this,"_clickStart"),cY(this,"_maxDownTime"),cY(this,"_maxInterval"),cY(this,"_posThreshold"),cY(this,"_movementThreshold"),cY(this,"_currentCursorPosition"),cY(this,"_startCursorPosition"),cY(this,"_grid"),cY(this,"_gridPosition"),cY(this,"_gizmos"),cY(this,"_curvePts"),cY(this,"_timeStart"),cY(this,"_animationId"),cY(this,"focusAnimationTime"),cY(this,"_timePrev"),cY(this,"_timeCurrent"),cY(this,"_anglePrev"),cY(this,"_angleCurrent"),cY(this,"_cursorPosPrev"),cY(this,"_cursorPosCurr"),cY(this,"_wPrev"),cY(this,"_wCurr"),cY(this,"adjustNearFar"),cY(this,"scaleFactor"),cY(this,"dampingFactor"),cY(this,"wMax"),cY(this,"enableAnimations"),cY(this,"enableGrid"),cY(this,"cursorZoom"),cY(this,"minFov"),cY(this,"maxFov"),cY(this,"enabled"),cY(this,"enablePan"),cY(this,"enableRotate"),cY(this,"enableZoom"),cY(this,"minDistance"),cY(this,"maxDistance"),cY(this,"minZoom"),cY(this,"maxZoom"),cY(this,"target"),cY(this,"_currentTarget"),cY(this,"_tbRadius"),cY(this,"_state"),cY(this,"onWindowResize",()=>{let e=(this._gizmos.scale.x+this._gizmos.scale.y+this._gizmos.scale.z)/3;if(this.camera){let e=this.calculateTbRadius(this.camera);void 0!==e&&(this._tbRadius=e)}let t=this._tbRadius/e,r=new eT.Ny0(0,0,t,t).getPoints(this._curvePts),i=new eT.u9r().setFromPoints(r);for(let e in this._gizmos.children)this._gizmos.children[e].geometry=i;this.dispatchEvent(c$)}),cY(this,"onContextMenu",e=>{if(this.enabled){for(let t=0;t<this.mouseActions.length;t++)if(2==this.mouseActions[t].mouse){e.preventDefault();break}}}),cY(this,"onPointerCancel",()=>{this._touchStart.splice(0,this._touchStart.length),this._touchCurrent.splice(0,this._touchCurrent.length),this._input=cq.NONE}),cY(this,"onPointerDown",e=>{if(0==e.button&&e.isPrimary?(this._downValid=!0,this._downEvents.push(e)):this._downValid=!1,"touch"==e.pointerType&&this._input!=cq.CURSOR)switch(this._touchStart.push(e),this._touchCurrent.push(e),this._input){case cq.NONE:this._input=cq.ONE_FINGER,this.onSinglePanStart(e,"ROTATE"),window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp);break;case cq.ONE_FINGER:case cq.ONE_FINGER_SWITCHED:this._input=cq.TWO_FINGER,this.onRotateStart(),this.onPinchStart(),this.onDoublePanStart();break;case cq.TWO_FINGER:this._input=cq.MULT_FINGER,this.onTriplePanStart()}else if("touch"!=e.pointerType&&this._input==cq.NONE){let t=null;e.ctrlKey||e.metaKey?t="CTRL":e.shiftKey&&(t="SHIFT"),this._mouseOp=this.getOpFromAction(e.button,t),this._mouseOp&&(window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),this._input=cq.CURSOR,this._button=e.button,this.onSinglePanStart(e,this._mouseOp))}}),cY(this,"onPointerMove",e=>{if("touch"==e.pointerType&&this._input!=cq.CURSOR)switch(this._input){case cq.ONE_FINGER:this.updateTouchEvent(e),this.onSinglePanMove(e,cW.ROTATE);break;case cq.ONE_FINGER_SWITCHED:this.calculatePointersDistance(this._touchCurrent[0],e)*this._devPxRatio>=this._switchSensibility&&(this._input=cq.ONE_FINGER,this.updateTouchEvent(e),this.onSinglePanStart(e,"ROTATE"));break;case cq.TWO_FINGER:this.updateTouchEvent(e),this.onRotateMove(),this.onPinchMove(),this.onDoublePanMove();break;case cq.MULT_FINGER:this.updateTouchEvent(e),this.onTriplePanMove()}else if("touch"!=e.pointerType&&this._input==cq.CURSOR){let t=null;e.ctrlKey||e.metaKey?t="CTRL":e.shiftKey&&(t="SHIFT");let r=this.getOpStateFromAction(this._button,t);r&&this.onSinglePanMove(e,r)}this._downValid&&this.calculatePointersDistance(this._downEvents[this._downEvents.length-1],e)*this._devPxRatio>this._movementThreshold&&(this._downValid=!1)}),cY(this,"onPointerUp",e=>{if("touch"==e.pointerType&&this._input!=cq.CURSOR){let t=this._touchCurrent.length;for(let r=0;r<t;r++)if(this._touchCurrent[r].pointerId==e.pointerId){this._touchCurrent.splice(r,1),this._touchStart.splice(r,1);break}switch(this._input){case cq.ONE_FINGER:case cq.ONE_FINGER_SWITCHED:window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),this._input=cq.NONE,this.onSinglePanEnd();break;case cq.TWO_FINGER:this.onDoublePanEnd(),this.onPinchEnd(),this.onRotateEnd(),this._input=cq.ONE_FINGER_SWITCHED;break;case cq.MULT_FINGER:0==this._touchCurrent.length&&(window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),this._input=cq.NONE,this.onTriplePanEnd())}}else"touch"!=e.pointerType&&this._input==cq.CURSOR&&(window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),this._input=cq.NONE,this.onSinglePanEnd(),this._button=-1);if(e.isPrimary){if(this._downValid){if(e.timeStamp-this._downEvents[this._downEvents.length-1].timeStamp<=this._maxDownTime){if(0==this._nclicks)this._nclicks=1,this._clickStart=performance.now();else{let t=e.timeStamp-this._clickStart,r=this.calculatePointersDistance(this._downEvents[1],this._downEvents[0])*this._devPxRatio;t<=this._maxInterval&&r<=this._posThreshold?(this._nclicks=0,this._downEvents.splice(0,this._downEvents.length),this.onDoubleTap(e)):(this._nclicks=1,this._downEvents.shift(),this._clickStart=performance.now())}}else this._downValid=!1,this._nclicks=0,this._downEvents.splice(0,this._downEvents.length)}else this._nclicks=0,this._downEvents.splice(0,this._downEvents.length)}}),cY(this,"onWheel",e=>{var t,r;if(this.enabled&&this.enableZoom&&this.domElement){let i=null;e.ctrlKey||e.metaKey?i="CTRL":e.shiftKey&&(i="SHIFT");let n=this.getOpFromAction("WHEEL",i);if(n){e.preventDefault(),this.dispatchEvent(c1);let i=e.deltaY/125,a=1;switch(i>0?a=1/this.scaleFactor:i<0&&(a=this.scaleFactor),n){case"ZOOM":if(this.updateTbState(cW.SCALE,!0),i>0?a=1/Math.pow(this.scaleFactor,i):i<0&&(a=Math.pow(this.scaleFactor,-i)),this.cursorZoom&&this.enablePan){let i;this.camera instanceof eT.iKG&&(i=null==(t=this.unprojectOnTbPlane(this.camera,e.clientX,e.clientY,this.domElement))?void 0:t.applyQuaternion(this.camera.quaternion).multiplyScalar(1/this.camera.zoom).add(this._gizmos.position)),this.camera instanceof eT.cPb&&(i=null==(r=this.unprojectOnTbPlane(this.camera,e.clientX,e.clientY,this.domElement))?void 0:r.applyQuaternion(this.camera.quaternion).add(this._gizmos.position)),void 0!==i&&this.applyTransformMatrix(this.applyScale(a,i))}else this.applyTransformMatrix(this.applyScale(a,this._gizmos.position));
824this._grid&&(this.disposeGrid(),this.drawGrid()),this.updateTbState(cW.IDLE,!1),this.dispatchEvent(c$),this.dispatchEvent(c0);break;case"FOV":if(this.camera instanceof eT.cPb){this.updateTbState(cW.FOV,!0),0!=e.deltaX&&(i=e.deltaX/125,a=1,i>0?a=1/Math.pow(this.scaleFactor,i):i<0&&(a=Math.pow(this.scaleFactor,-i))),this._v3_1.setFromMatrixPosition(this._cameraMatrixState);let t=this._v3_1.distanceTo(this._gizmos.position),r=t/a;r=eT.M8C.clamp(r,this.minDistance,this.maxDistance);let n=t*Math.tan(eT.M8C.DEG2RAD*this.camera.fov*.5),o=eT.M8C.RAD2DEG*(2*Math.atan(n/r));o>this.maxFov?o=this.maxFov:o<this.minFov&&(o=this.minFov),a=t/(n/Math.tan(eT.M8C.DEG2RAD*(o/2))),this.setFov(o),this.applyTransformMatrix(this.applyScale(a,this._gizmos.position,!1))}this._grid&&(this.disposeGrid(),this.drawGrid()),this.updateTbState(cW.IDLE,!1),this.dispatchEvent(c$),this.dispatchEvent(c0)}}}}),cY(this,"onSinglePanStart",(e,t)=>{if(this.enabled&&this.domElement)switch(this.dispatchEvent(c1),this.setCenter(e.clientX,e.clientY),t){case"PAN":if(!this.enablePan)return;if(-1!=this._animationId&&(cancelAnimationFrame(this._animationId),this._animationId=-1,this._timeStart=-1,this.activateGizmos(!1),this.dispatchEvent(c$)),this.camera){this.updateTbState(cW.PAN,!0);let e=this.unprojectOnTbPlane(this.camera,cX.x,cX.y,this.domElement);void 0!==e&&this._startCursorPosition.copy(e),this.enableGrid&&(this.drawGrid(),this.dispatchEvent(c$))}break;case"ROTATE":if(!this.enableRotate)return;if(-1!=this._animationId&&(cancelAnimationFrame(this._animationId),this._animationId=-1,this._timeStart=-1),this.camera){this.updateTbState(cW.ROTATE,!0);let e=this.unprojectOnTbSurface(this.camera,cX.x,cX.y,this.domElement,this._tbRadius);void 0!==e&&this._startCursorPosition.copy(e),this.activateGizmos(!0),this.enableAnimations&&(this._timePrev=this._timeCurrent=performance.now(),this._angleCurrent=this._anglePrev=0,this._cursorPosPrev.copy(this._startCursorPosition),this._cursorPosCurr.copy(this._cursorPosPrev),this._wCurr=0,this._wPrev=this._wCurr)}this.dispatchEvent(c$);break;case"FOV":if(!this.enableZoom)return;this.camera instanceof eT.cPb&&(-1!=this._animationId&&(cancelAnimationFrame(this._animationId),this._animationId=-1,this._timeStart=-1,this.activateGizmos(!1),this.dispatchEvent(c$)),this.updateTbState(cW.FOV,!0),this._startCursorPosition.setY(.5*this.getCursorNDC(cX.x,cX.y,this.domElement).y),this._currentCursorPosition.copy(this._startCursorPosition));break;case"ZOOM":if(!this.enableZoom)return;-1!=this._animationId&&(cancelAnimationFrame(this._animationId),this._animationId=-1,this._timeStart=-1,this.activateGizmos(!1),this.dispatchEvent(c$)),this.updateTbState(cW.SCALE,!0),this._startCursorPosition.setY(.5*this.getCursorNDC(cX.x,cX.y,this.domElement).y),this._currentCursorPosition.copy(this._startCursorPosition)}}),cY(this,"onSinglePanMove",(e,t)=>{if(this.enabled&&this.domElement){let r=t!=this._state;switch(this.setCenter(e.clientX,e.clientY),t){case cW.PAN:if(this.enablePan&&this.camera){if(r){this.dispatchEvent(c0),this.dispatchEvent(c1),this.updateTbState(t,!0);let e=this.unprojectOnTbPlane(this.camera,cX.x,cX.y,this.domElement);void 0!==e&&this._startCursorPosition.copy(e),this.enableGrid&&this.drawGrid(),this.activateGizmos(!1)}else{let e=this.unprojectOnTbPlane(this.camera,cX.x,cX.y,this.domElement);void 0!==e&&this._currentCursorPosition.copy(e),this.applyTransformMatrix(this.pan(this._startCursorPosition,this._currentCursorPosition))}}break;case cW.ROTATE:if(this.enableRotate&&this.camera){if(r){this.dispatchEvent(c0),this.dispatchEvent(c1),this.updateTbState(t,!0);let e=this.unprojectOnTbSurface(this.camera,cX.x,cX.y,this.domElement,this._tbRadius);void 0!==e&&this._startCursorPosition.copy(e),this.enableGrid&&this.disposeGrid(),this.activateGizmos(!0)}else{let e=this.unprojectOnTbSurface(this.camera,cX.x,cX.y,this.domElement,this._tbRadius);void 0!==e&&this._currentCursorPosition.copy(e);let t=this._startCursorPosition.distanceTo(this._currentCursorPosition),r=this._startCursorPosition.angleTo(this._currentCursorPosition),i=Math.max(t/this._tbRadius,r);this.applyTransformMatrix(this.rotate(this.calculateRotationAxis(this._startCursorPosition,this._currentCursorPosition),i)),this.enableAnimations&&(this._timePrev=this._timeCurrent,this._timeCurrent=performance.now(),this._anglePrev=this._angleCurrent,this._angleCurrent=i,this._cursorPosPrev.copy(this._cursorPosCurr),this._cursorPosCurr.copy(this._currentCursorPosition),this._wPrev=this._wCurr,this._wCurr=this.calculateAngularSpeed(this._anglePrev,this._angleCurrent,this._timePrev,this._timeCurrent))}}break;case cW.SCALE:if(this.enableZoom){if(r)this.dispatchEvent(c0),this.dispatchEvent(c1),this.updateTbState(t,!0),this._startCursorPosition.setY(.5*this.getCursorNDC(cX.x,cX.y,this.domElement).y),this._currentCursorPosition.copy(this._startCursorPosition),this.enableGrid&&this.disposeGrid(),this.activateGizmos(!1);else{this._currentCursorPosition.setY(.5*this.getCursorNDC(cX.x,cX.y,this.domElement).y);let e=this._currentCursorPosition.y-this._startCursorPosition.y,t=1;e<0?t=1/Math.pow(this.scaleFactor,-(8*e)):e>0&&(t=Math.pow(this.scaleFactor,8*e)),this.applyTransformMatrix(this.applyScale(t,this._gizmos.position))}}break;case cW.FOV:if(this.enableZoom&&this.camera instanceof eT.cPb){if(r)this.dispatchEvent(c0),this.dispatchEvent(c1),this.updateTbState(t,!0),this._startCursorPosition.setY(.5*this.getCursorNDC(cX.x,cX.y,this.domElement).y),this._currentCursorPosition.copy(this._startCursorPosition),this.enableGrid&&this.disposeGrid(),this.activateGizmos(!1);else{this._currentCursorPosition.setY(.5*this.getCursorNDC(cX.x,cX.y,this.domElement).y);let e=this._currentCursorPosition.y-this._startCursorPosition.y,t=1;e<0?t=1/Math.pow(this.scaleFactor,-(8*e)):e>0&&(t=Math.pow(this.scaleFactor,8*e)),this._v3_1.setFromMatrixPosition(this._cameraMatrixState);let r=this._v3_1.distanceTo(this._gizmos.position),i=r/t;i=eT.M8C.clamp(i,this.minDistance,this.maxDistance);let n=r*Math.tan(eT.M8C.DEG2RAD*this._fovState*.5),a=eT.M8C.RAD2DEG*(2*Math.atan(n/i));a=eT.M8C.clamp(a,this.minFov,this.maxFov);let o=n/Math.tan(eT.M8C.DEG2RAD*(a/2));t=r/o,this._v3_2.setFromMatrixPosition(this._gizmoMatrixState),this.setFov(a),this.applyTransformMatrix(this.applyScale(t,this._v3_2,!1));let s=this._gizmos.position.clone().sub(this.camera.position).normalize().multiplyScalar(o/r);this._m4_1.makeTranslation(s.x,s.y,s.z)}}}this.dispatchEvent(c$)}}),cY(this,"onSinglePanEnd",()=>{if(this._state==cW.ROTATE){if(!this.enableRotate)return;if(this.enableAnimations){if(performance.now()-this._timeCurrent<120){let e=Math.abs((this._wPrev+this._wCurr)/2),t=this;this._animationId=window.requestAnimationFrame(function(r){t.updateTbState(cW.ANIMATION_ROTATE,!0);let i=t.calculateRotationAxis(t._cursorPosPrev,t._cursorPosCurr);t.onRotationAnim(r,i,Math.min(e,t.wMax))})}else this.updateTbState(cW.IDLE,!1),this.activateGizmos(!1),this.dispatchEvent(c$)}else this.updateTbState(cW.IDLE,!1),this.activateGizmos(!1),this.dispatchEvent(c$)}else(this._state==cW.PAN||this._state==cW.IDLE)&&(this.updateTbState(cW.IDLE,!1),this.enableGrid&&this.disposeGrid(),this.activateGizmos(!1),this.dispatchEvent(c$));this.dispatchEvent(c0)}),cY(this,"onDoubleTap",e=>{if(this.enabled&&this.enablePan&&this.scene&&this.camera&&this.domElement){this.dispatchEvent(c1),this.setCenter(e.clientX,e.clientY);let t=this.unprojectOnObj(this.getCursorNDC(cX.x,cX.y,this.domElement),this.camera);if(t&&this.enableAnimations){let e=this;-1!=this._animationId&&window.cancelAnimationFrame(this._animationId),this._timeStart=-1,this._animationId=window.requestAnimationFrame(function(r){e.updateTbState(cW.ANIMATION_FOCUS,!0),e.onFocusAnim(r,t,e._cameraMatrixState,e._gizmoMatrixState)})}else t&&!this.enableAnimations&&(this.updateTbState(cW.FOCUS,!0),this.focus(t,this.scaleFactor),this.updateTbState(cW.IDLE,!1),this.dispatchEvent(c$))}this.dispatchEvent(c0)}),cY(this,"onDoublePanStart",()=>{if(this.enabled&&this.enablePan&&this.camera&&this.domElement){this.dispatchEvent(c1),this.updateTbState(cW.PAN,!0),this.setCenter((this._touchCurrent[0].clientX+this._touchCurrent[1].clientX)/2,(this._touchCurrent[0].clientY+this._touchCurrent[1].clientY)/2);let e=this.unprojectOnTbPlane(this.camera,cX.x,cX.y,this.domElement,!0);void 0!==e&&this._startCursorPosition.copy(e),this._currentCursorPosition.copy(this._startCursorPosition),this.activateGizmos(!1)}}),cY(this,"onDoublePanMove",()=>{if(this.enabled&&this.enablePan&&this.camera&&this.domElement){this.setCenter((this._touchCurrent[0].clientX+this._touchCurrent[1].clientX)/2,(this._touchCurrent[0].clientY+this._touchCurrent[1].clientY)/2),this._state!=cW.PAN&&(this.updateTbState(cW.PAN,!0),this._startCursorPosition.copy(this._currentCursorPosition));let e=this.unprojectOnTbPlane(this.camera,cX.x,cX.y,this.domElement,!0);void 0!==e&&this._currentCursorPosition.copy(e),this.applyTransformMatrix(this.pan(this._startCursorPosition,this._currentCursorPosition,!0)),this.dispatchEvent(c$)}}),cY(this,"onDoublePanEnd",()=>{this.updateTbState(cW.IDLE,!1),this.dispatchEvent(c0)}),cY(this,"onRotateStart",()=>{var e;this.enabled&&this.enableRotate&&(this.dispatchEvent(c1),this.updateTbState(cW.ZROTATE,!0),this._startFingerRotation=this.getAngle(this._touchCurrent[1],this._touchCurrent[0])+this.getAngle(this._touchStart[1],this._touchStart[0]),this._currentFingerRotation=this._startFingerRotation,null==(e=this.camera)||e.getWorldDirection(this._rotationAxis),this.enablePan||this.enableZoom||this.activateGizmos(!0))}),cY(this,"onRotateMove",()=>{var e;if(this.enabled&&this.enableRotate&&this.camera&&this.domElement){let t;this.setCenter((this._touchCurrent[0].clientX+this._touchCurrent[1].clientX)/2,(this._touchCurrent[0].clientY+this._touchCurrent[1].clientY)/2),this._state!=cW.ZROTATE&&(this.updateTbState(cW.ZROTATE,!0),this._startFingerRotation=this._currentFingerRotation),this._currentFingerRotation=this.getAngle(this._touchCurrent[1],this._touchCurrent[0])+this.getAngle(this._touchStart[1],this._touchStart[0]),this.enablePan?this.camera&&(this._v3_2.setFromMatrixPosition(this._gizmoMatrixState),t=null==(e=this.unprojectOnTbPlane(this.camera,cX.x,cX.y,this.domElement))?void 0:e.applyQuaternion(this.camera.quaternion).multiplyScalar(1/this.camera.zoom).add(this._v3_2)):t=new eT.Pa4().setFromMatrixPosition(this._gizmoMatrixState);let r=eT.M8C.DEG2RAD*(this._startFingerRotation-this._currentFingerRotation);void 0!==t&&this.applyTransformMatrix(this.zRotate(t,r)),this.dispatchEvent(c$)}}),cY(this,"onRotateEnd",()=>{this.updateTbState(cW.IDLE,!1),this.activateGizmos(!1),this.dispatchEvent(c0)}),cY(this,"onPinchStart",()=>{this.enabled&&this.enableZoom&&(this.dispatchEvent(c1),this.updateTbState(cW.SCALE,!0),this._startFingerDistance=this.calculatePointersDistance(this._touchCurrent[0],this._touchCurrent[1]),this._currentFingerDistance=this._startFingerDistance,this.activateGizmos(!1))}),cY(this,"onPinchMove",()=>{var e,t;if(this.enabled&&this.enableZoom&&this.domElement){let r;this.setCenter((this._touchCurrent[0].clientX+this._touchCurrent[1].clientX)/2,(this._touchCurrent[0].clientY+this._touchCurrent[1].clientY)/2),this._state!=cW.SCALE&&(this._startFingerDistance=this._currentFingerDistance,this.updateTbState(cW.SCALE,!0)),this._currentFingerDistance=Math.max(this.calculatePointersDistance(this._touchCurrent[0],this._touchCurrent[1]),12*this._devPxRatio);let i=this._currentFingerDistance/this._startFingerDistance;this.enablePan?this.camera instanceof eT.iKG?r=null==(e=this.unprojectOnTbPlane(this.camera,cX.x,cX.y,this.domElement))?void 0:e.applyQuaternion(this.camera.quaternion).multiplyScalar(1/this.camera.zoom).add(this._gizmos.position):this.camera instanceof eT.cPb&&(r=null==(t=this.unprojectOnTbPlane(this.camera,cX.x,cX.y,this.domElement))?void 0:t.applyQuaternion(this.camera.quaternion).add(this._gizmos.position)):r=this._gizmos.position,void 0!==r&&this.applyTransformMatrix(this.applyScale(i,r)),this.dispatchEvent(c$)}}),cY(this,"onPinchEnd",()=>{this.updateTbState(cW.IDLE,!1),this.dispatchEvent(c0)}),cY(this,"onTriplePanStart",()=>{if(this.enabled&&this.enableZoom&&this.domElement){this.dispatchEvent(c1),this.updateTbState(cW.SCALE,!0);let e=0,t=0,r=this._touchCurrent.length;for(let i=0;i<r;i++)e+=this._touchCurrent[i].clientX,t+=this._touchCurrent[i].clientY;this.setCenter(e/r,t/r),this._startCursorPosition.setY(.5*this.getCursorNDC(cX.x,cX.y,this.domElement).y),this._currentCursorPosition.copy(this._startCursorPosition)}}),cY(this,"onTriplePanMove",()=>{if(this.enabled&&this.enableZoom&&this.camera&&this.domElement){let e=0,t=0,r=this._touchCurrent.length;for(let i=0;i<r;i++)e+=this._touchCurrent[i].clientX,t+=this._touchCurrent[i].clientY;this.setCenter(e/r,t/r),this._currentCursorPosition.setY(.5*this.getCursorNDC(cX.x,cX.y,this.domElement).y);let i=this._currentCursorPosition.y-this._startCursorPosition.y,n=1;i<0?n=1/Math.pow(this.scaleFactor,-(8*i)):i>0&&(n=Math.pow(this.scaleFactor,8*i)),this._v3_1.setFromMatrixPosition(this._cameraMatrixState);let a=this._v3_1.distanceTo(this._gizmos.position),o=a/n;o=eT.M8C.clamp(o,this.minDistance,this.maxDistance);let s=a*Math.tan(eT.M8C.DEG2RAD*this._fovState*.5),l=eT.M8C.RAD2DEG*(2*Math.atan(s/o
824));l=eT.M8C.clamp(l,this.minFov,this.maxFov);let c=s/Math.tan(eT.M8C.DEG2RAD*(l/2));n=a/c,this._v3_2.setFromMatrixPosition(this._gizmoMatrixState),this.setFov(l),this.applyTransformMatrix(this.applyScale(n,this._v3_2,!1));let u=this._gizmos.position.clone().sub(this.camera.position).normalize().multiplyScalar(c/a);this._m4_1.makeTranslation(u.x,u.y,u.z),this.dispatchEvent(c$)}}),cY(this,"onTriplePanEnd",()=>{this.updateTbState(cW.IDLE,!1),this.dispatchEvent(c0)}),cY(this,"setCenter",(e,t)=>{cX.x=e,cX.y=t}),cY(this,"initializeMouseActions",()=>{this.setMouseAction("PAN",0,"CTRL"),this.setMouseAction("PAN",2),this.setMouseAction("ROTATE",0),this.setMouseAction("ZOOM","WHEEL"),this.setMouseAction("ZOOM",1),this.setMouseAction("FOV","WHEEL","SHIFT"),this.setMouseAction("FOV",1,"SHIFT")}),cY(this,"setMouseAction",(e,t,r=null)=>{let i;if(!["PAN","ROTATE","ZOOM","FOV"].includes(e)||![0,1,2,"WHEEL"].includes(t)||!["CTRL","SHIFT",null].includes(r)||"WHEEL"==t&&"ZOOM"!=e&&"FOV"!=e)return!1;switch(e){case"PAN":i=cW.PAN;break;case"ROTATE":i=cW.ROTATE;break;case"ZOOM":i=cW.SCALE;break;case"FOV":i=cW.FOV}let n={operation:e,mouse:t,key:r,state:i};for(let e=0;e<this.mouseActions.length;e++)if(this.mouseActions[e].mouse==n.mouse&&this.mouseActions[e].key==n.key)return this.mouseActions.splice(e,1,n),!0;return this.mouseActions.push(n),!0}),cY(this,"getOpFromAction",(e,t)=>{let r;for(let i=0;i<this.mouseActions.length;i++)if((r=this.mouseActions[i]).mouse==e&&r.key==t)return r.operation;if(t){for(let t=0;t<this.mouseActions.length;t++)if((r=this.mouseActions[t]).mouse==e&&null==r.key)return r.operation}return null}),cY(this,"getOpStateFromAction",(e,t)=>{let r;for(let i=0;i<this.mouseActions.length;i++)if((r=this.mouseActions[i]).mouse==e&&r.key==t)return r.state;if(t){for(let t=0;t<this.mouseActions.length;t++)if((r=this.mouseActions[t]).mouse==e&&null==r.key)return r.state}return null}),cY(this,"getAngle",(e,t)=>180*Math.atan2(t.clientY-e.clientY,t.clientX-e.clientX)/Math.PI),cY(this,"updateTouchEvent",e=>{for(let t=0;t<this._touchCurrent.length;t++)if(this._touchCurrent[t].pointerId==e.pointerId){this._touchCurrent.splice(t,1,e);break}}),cY(this,"calculateAngularSpeed",(e,t,r,i)=>{let n=(i-r)/1e3;return 0==n?0:(t-e)/n}),cY(this,"calculatePointersDistance",(e,t)=>Math.sqrt(Math.pow(t.clientX-e.clientX,2)+Math.pow(t.clientY-e.clientY,2))),cY(this,"calculateRotationAxis",(e,t)=>(this._rotationMatrix.extractRotation(this._cameraMatrixState),this._quat.setFromRotationMatrix(this._rotationMatrix),this._rotationAxis.crossVectors(e,t).applyQuaternion(this._quat),this._rotationAxis.normalize().clone())),cY(this,"calculateTbRadius",e=>{let t=e.position.distanceTo(this._gizmos.position);if(e instanceof eT.cPb){let r=eT.M8C.DEG2RAD*e.fov*.5,i=Math.atan(e.aspect*Math.tan(r));return Math.tan(Math.min(r,i))*t*.67}if(e instanceof eT.iKG)return .67*Math.min(e.top,e.right)}),cY(this,"focus",(e,t,r=1)=>{if(this.camera){let i=e.clone();i.sub(this._gizmos.position).multiplyScalar(r),this._translationMatrix.makeTranslation(i.x,i.y,i.z);let n=this._gizmoMatrixState.clone();this._gizmoMatrixState.premultiply(this._translationMatrix),this._gizmoMatrixState.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale);let a=this._cameraMatrixState.clone();this._cameraMatrixState.premultiply(this._translationMatrix),this._cameraMatrixState.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.enableZoom&&this.applyTransformMatrix(this.applyScale(t,this._gizmos.position)),this._gizmoMatrixState.copy(n),this._cameraMatrixState.copy(a)}}),cY(this,"drawGrid",()=>{if(this.scene){let e,t,r,i;if(this.camera instanceof eT.iKG)i=(r=Math.max(this.camera.right-this.camera.left,this.camera.bottom-this.camera.top))/20,t=(e=r/this.camera.zoom*3)/i*this.camera.zoom;else if(this.camera instanceof eT.cPb){let n=this.camera.position.distanceTo(this._gizmos.position),a=eT.M8C.DEG2RAD*this.camera.fov*.5,o=Math.atan(this.camera.aspect*Math.tan(a));i=(r=Math.tan(Math.max(a,o))*n*2)/20,t=(e=3*r)/i}null==this._grid&&this.camera&&(this._grid=new eT.VLJ(e,t,8947848,8947848),this._grid.position.copy(this._gizmos.position),this._gridPosition.copy(this._grid.position),this._grid.quaternion.copy(this.camera.quaternion),this._grid.rotateX(.5*Math.PI),this.scene.add(this._grid))}}),cY(this,"connect",e=>{e===document&&console.error('THREE.ArcballControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.domElement=e,this.domElement.style.touchAction="none",this.domElement.addEventListener("contextmenu",this.onContextMenu),this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("pointercancel",this.onPointerCancel),this.domElement.addEventListener("wheel",this.onWheel)}),cY(this,"dispose",()=>{var e,t,r,i,n;-1!=this._animationId&&window.cancelAnimationFrame(this._animationId),null==(e=this.domElement)||e.removeEventListener("pointerdown",this.onPointerDown),null==(t=this.domElement)||t.removeEventListener("pointercancel",this.onPointerCancel),null==(r=this.domElement)||r.removeEventListener("wheel",this.onWheel),null==(i=this.domElement)||i.removeEventListener("contextmenu",this.onContextMenu),window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),null==(n=this.scene)||n.remove(this._gizmos),this.disposeGrid()}),cY(this,"disposeGrid",()=>{this._grid&&this.scene&&(this.scene.remove(this._grid),this._grid=null)}),cY(this,"easeOutCubic",e=>1-Math.pow(1-e,3)),cY(this,"activateGizmos",e=>{for(let t of this._gizmos.children)t.material.setValues({opacity:e?1:.6})}),cY(this,"getCursorNDC",(e,t,r)=>{let i=r.getBoundingClientRect();return this._v2_1.setX((e-i.left)/i.width*2-1),this._v2_1.setY((i.bottom-t)/i.height*2-1),this._v2_1.clone()}),cY(this,"getCursorPosition",(e,t,r)=>(this._v2_1.copy(this.getCursorNDC(e,t,r)),this.camera instanceof eT.iKG&&(this._v2_1.x*=(this.camera.right-this.camera.left)*.5,this._v2_1.y*=(this.camera.top-this.camera.bottom)*.5),this._v2_1.clone())),cY(this,"setCamera",e=>{if(e){e.lookAt(this.target),e.updateMatrix(),e instanceof eT.cPb&&(this._fov0=e.fov,this._fovState=e.fov),this._cameraMatrixState0.copy(e.matrix),this._cameraMatrixState.copy(this._cameraMatrixState0),this._cameraProjectionState.copy(e.projectionMatrix),this._zoom0=e.zoom,this._zoomState=this._zoom0,this._initialNear=e.near,this._nearPos0=e.position.distanceTo(this.target)-e.near,this._nearPos=this._initialNear,this._initialFar=e.far,this._farPos0=e.position.distanceTo(this.target)-e.far,this._farPos=this._initialFar,this._up0.copy(e.up),this._upState.copy(e.up),this.camera=e,this.camera.updateProjectionMatrix();let t=this.calculateTbRadius(e);void 0!==t&&(this._tbRadius=t),this.makeGizmos(this.target,this._tbRadius)}}
824),cY(this,"makeGizmos",(e,t)=>{let r=new eT.Ny0(0,0,t,t).getPoints(this._curvePts),i=new eT.u9r().setFromPoints(r),n=new eT.nls({color:16744576,fog:!1,transparent:!0,opacity:.6}),a=new eT.nls({color:8454016,fog:!1,transparent:!0,opacity:.6}),o=new eT.nls({color:8421631,fog:!1,transparent:!0,opacity:.6}),s=new eT.x12(i,n),l=new eT.x12(i,a),c=new eT.x12(i,o),u=.5*Math.PI;if(s.rotation.x=u,l.rotation.y=u,this._gizmoMatrixState0.identity().setPosition(e),this._gizmoMatrixState.copy(this._gizmoMatrixState0),this.camera&&1!=this.camera.zoom){let t=1/this.camera.zoom;this._scaleMatrix.makeScale(t,t,t),this._translationMatrix.makeTranslation(-e.x,-e.y,-e.z),this._gizmoMatrixState.premultiply(this._translationMatrix).premultiply(this._scaleMatrix),this._translationMatrix.makeTranslation(e.x,e.y,e.z),this._gizmoMatrixState.premultiply(this._translationMatrix)}this._gizmoMatrixState.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale),this._gizmos.clear(),this._gizmos.add(s),this._gizmos.add(l),this._gizmos.add(c)}),cY(this,"onFocusAnim",(e,t,r,i)=>{if(-1==this._timeStart&&(this._timeStart=e),this._state==cW.ANIMATION_FOCUS){let n=(e-this._timeStart)/this.focusAnimationTime;if(this._gizmoMatrixState.copy(i),n>=1)this._gizmoMatrixState.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale),this.focus(t,this.scaleFactor),this._timeStart=-1,this.updateTbState(cW.IDLE,!1),this.activateGizmos(!1),this.dispatchEvent(c$);else{let e=this.easeOutCubic(n),a=1-e+this.scaleFactor*e;this._gizmoMatrixState.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale),this.focus(t,a,e),this.dispatchEvent(c$);let o=this;this._animationId=window.requestAnimationFrame(function(e){o.onFocusAnim(e,t,r,i.clone())})}}else this._animationId=-1,this._timeStart=-1}),cY(this,"onRotationAnim",(e,t,r)=>{if(-1==this._timeStart&&(this._anglePrev=0,this._angleCurrent=0,this._timeStart=e),this._state==cW.ANIMATION_ROTATE){let i=(e-this._timeStart)/1e3;if(r+-this.dampingFactor*i>0){this._angleCurrent=-(.5*this.dampingFactor)*Math.pow(i,2)+r*i+0,this.applyTransformMatrix(this.rotate(t,this._angleCurrent)),this.dispatchEvent(c$);let e=this;this._animationId=window.requestAnimationFrame(function(i){e.onRotationAnim(i,t,r)})}else this._animationId=-1,this._timeStart=-1,this.updateTbState(cW.IDLE,!1),this.activateGizmos(!1),this.dispatchEvent(c$)}else this._animationId=-1,this._timeStart=-1,this._state!=cW.ROTATE&&(this.activateGizmos(!1),this.dispatchEvent(c$))}),cY(this,"pan",(e,t,r=!1)=>{if(this.camera){let i=e.clone().sub(t);if(this.camera instanceof eT.iKG&&i.multiplyScalar(1/this.camera.zoom),this.camera instanceof eT.cPb&&r){this._v3_1.setFromMatrixPosition(this._cameraMatrixState0),this._v3_2.setFromMatrixPosition(this._gizmoMatrixState0);let e=this._v3_1.distanceTo(this._v3_2)/this.camera.position.distanceTo(this._gizmos.position);i.multiplyScalar(1/e)}this._v3_1.set(i.x,i.y,0).applyQuaternion(this.camera.quaternion),this._m4_1.makeTranslation(this._v3_1.x,this._v3_1.y,this._v3_1.z),this.setTransformationMatrices(this._m4_1,this._m4_1)}return cZ}),cY(this,"reset",()=>{if(this.camera){this.camera.zoom=this._zoom0,this.camera instanceof eT.cPb&&(this.camera.fov=this._fov0),this.camera.near=this._nearPos,this.camera.far=this._farPos,this._cameraMatrixState.copy(this._cameraMatrixState0),this._cameraMatrixState.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.up.copy(this._up0),this.camera.updateMatrix(),this.camera.updateProjectionMatrix(),this._gizmoMatrixState.copy(this._gizmoMatrixState0),this._gizmoMatrixState0.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale),this._gizmos.updateMatrix();let e=this.calculateTbRadius(this.camera);void 0!==e&&(this._tbRadius=e),this.makeGizmos(this._gizmos.position,this._tbRadius),this.camera.lookAt(this._gizmos.position),this.updateTbState(cW.IDLE,!1),this.dispatchEvent(c$)}}),cY(this,"rotate",(e,t)=>{let r=this._gizmos.position;return this._translationMatrix.makeTranslation(-r.x,-r.y,-r.z),this._rotationMatrix.makeRotationAxis(e,-t),this._m4_1.makeTranslation(r.x,r.y,r.z),this._m4_1.multiply(this._rotationMatrix),this._m4_1.multiply(this._translationMatrix),this.setTransformationMatrices(this._m4_1),cZ}),cY(this,"copyState",()=>{if(this.camera){let e=JSON.stringify(this.camera instanceof eT.iKG?{arcballState:{cameraFar:this.camera.far,cameraMatrix:this.camera.matrix,cameraNear:this.camera.near,cameraUp:this.camera.up,cameraZoom:this.camera.zoom,gizmoMatrix:this._gizmos.matrix}}:{arcballState:{cameraFar:this.camera.far,cameraFov:this.camera.fov,cameraMatrix:this.camera.matrix,cameraNear:this.camera.near,cameraUp:this.camera.up,cameraZoom:this.camera.zoom,gizmoMatrix:this._gizmos.matrix}});navigator.clipboard.writeText(e)}}),cY(this,"pasteState",()=>{let e=this;navigator.clipboard.readText().then(function(t){e.setStateFromJSON(t)})}),cY(this,"saveState",()=>
824{this.camera&&(this._cameraMatrixState0.copy(this.camera.matrix),this._gizmoMatrixState0.copy(this._gizmos.matrix),this._nearPos=this.camera.near,this._farPos=this.camera.far,this._zoom0=this.camera.zoom,this._up0.copy(this.camera.up),this.camera instanceof eT.cPb&&(this._fov0=this.camera.fov))}),cY(this,"applyScale",(e,t,r=!0)=>{if(!this.camera)return;let i=t.clone(),n=1/e;if(this.camera instanceof eT.iKG){this.camera.zoom=this._zoomState,this.camera.zoom*=e,this.camera.zoom>this.maxZoom?(this.camera.zoom=this.maxZoom,n=this._zoomState/this.maxZoom):this.camera.zoom<this.minZoom&&(this.camera.zoom=this.minZoom,n=this._zoomState/this.minZoom),this.camera.updateProjectionMatrix(),this._v3_1.setFromMatrixPosition(this._gizmoMatrixState),this._scaleMatrix.makeScale(n,n,n),this._translationMatrix.makeTranslation(-this._v3_1.x,-this._v3_1.y,-this._v3_1.z),this._m4_2.makeTranslation(this._v3_1.x,this._v3_1.y,this._v3_1.z).multiply(this._scaleMatrix),this._m4_2.multiply(this._translationMatrix),i.sub(this._v3_1);let t=i.clone().multiplyScalar(n);return i.sub(t),this._m4_1.makeTranslation(i.x,i.y,i.z),this._m4_2.premultiply(this._m4_1),this.setTransformationMatrices(this._m4_1,this._m4_2),cZ}if(this.camera instanceof eT.cPb){this._v3_1.setFromMatrixPosition(this._cameraMatrixState),this._v3_2.setFromMatrixPosition(this._gizmoMatrixState);let e=this._v3_1.distanceTo(i),t=e-e*n,a=e-t;a<this.minDistance?(n=this.minDistance/e,t=e-e*n):a>this.maxDistance&&(n=this.maxDistance/e,t=e-e*n);let o=i.clone().sub(this._v3_1).normalize().multiplyScalar(t);if(this._m4_1.makeTranslation(o.x,o.y,o.z),r){let r=this._v3_2;t=(e=r.distanceTo(i))-e*n,o=i.clone().sub(this._v3_2).normalize().multiplyScalar(t),this._translationMatrix.makeTranslation(r.x,r.y,r.z),this._scaleMatrix.makeScale(n,n,n),this._m4_2.makeTranslation(o.x,o.y,o.z).multiply(this._translationMatrix),this._m4_2.multiply(this._scaleMatrix),this._translationMatrix.makeTranslation(-r.x,-r.y,-r.z),this._m4_2.multiply(this._translationMatrix),this.setTransformationMatrices(this._m4_1,this._m4_2)}else this.setTransformationMatrices(this._m4_1);return cZ}}),cY(this,"setFov",e=>{this.camera instanceof eT.cPb&&(this.camera.fov=eT.M8C.clamp(e,this.minFov,this.maxFov),this.camera.updateProjectionMatrix())}),cY(this,"setTarget",(e,t,r)=>{if(this.camera){this.target.set(e,t,r),this._gizmos.position.set(e,t,r);let i=this.calculateTbRadius(this.camera);void 0!==i&&(this._tbRadius=i),this.makeGizmos(this.target,this._tbRadius),this.camera.lookAt(this.target)}}),cY(this,"zRotate",(e,t)=>(this._rotationMatrix.makeRotationAxis(this._rotationAxis,t),this._translationMatrix.makeTranslation(-e.x,-e.y,-e.z),this._m4_1.makeTranslation(e.x,e.y,e.z),this._m4_1.multiply(this._rotationMatrix),this._m4_1.multiply(this._translationMatrix),this._v3_1.setFromMatrixPosition(this._gizmoMatrixState).sub(e),this._v3_2.copy(this._v3_1).applyAxisAngle(this._rotationAxis,t),this._v3_2.sub(this._v3_1),this._m4_2.makeTranslation(this._v3_2.x,this._v3_2.y,this._v3_2.z),this.setTransformationMatrices(this._m4_1,this._m4_2),cZ)),cY(this,"unprojectOnObj",(e,t)=>{if(!this.scene)return null;let r=new eT.iMs;r.near=t.near,r.far=t.far,r.setFromCamera(e,t);let i=r.intersectObjects(this.scene.children,!0);for(let e=0;e<i.length;e++)if(i[e].object.uuid!=this._gizmos.uuid&&i[e].face)return i[e].point.clone();return null}),cY(this,"unprojectOnTbSurface",(e,t,r,i,n)=>{if(e instanceof eT.iKG){this._v2_1.copy(this.getCursorPosition(t,r,i)),this._v3_1.set(this._v2_1.x,this._v2_1.y,0);let e=Math.pow(this._v2_1.x,2),n=Math.pow(this._v2_1.y,2),a=Math.pow(this._tbRadius,2);return e+n<=.5*a?this._v3_1.setZ(Math.sqrt(a-(e+n))):this._v3_1.setZ(.5*a/Math.sqrt(e+n)),this._v3_1}if(e instanceof eT.cPb){this._v2_1.copy(this.getCursorNDC(t,r,i)),this._v3_1.set(this._v2_1.x,this._v2_1.y,-1),this._v3_1.applyMatrix4(e.projectionMatrixInverse);let a=this._v3_1.clone().normalize(),o=e.position.distanceTo(this._gizmos.position),s=Math.pow(n,2),l=this._v3_1.z,c=Math.sqrt(Math.pow(this._v3_1.x,2)+Math.pow(this._v3_1.y,2));if(0==c)return a.set(this._v3_1.x,this._v3_1.y,n),a;let u=l/c,h=Math.pow(u,2)+1,A=2*u*o,d=Math.pow(o,2)-s,m=Math.pow(A,2)-4*h*d;if(m>=0&&(this._v2_1.setX((-A-Math.sqrt(m))/(2*h)),this._v2_1.setY(u*this._v2_1.x+o),eT.M8C.RAD2DEG*this._v2_1.angle()>=45)){let e=Math.sqrt(Math.pow(this._v2_1.x,2)+Math.pow(o-this._v2_1.y,2));return a.multiplyScalar(e),a.z+=o,a}h=u,m=Math.pow(A=o,2)-4*h*(d=-(.5*s)),this._v2_1.setX((-A-Math.sqrt(m))/(2*h)),this._v2_1.setY(u*this._v2_1.x+o);let f=Math.sqrt(Math.pow(this._v2_1.x,2)+Math.pow(o-this._v2_1.y,2));return a.multiplyScalar(f),a.z+=o,a}}),cY(this,"unprojectOnTbPlane",(e,t,r,i,n=!1)=>
824{if(e instanceof eT.iKG)return this._v2_1.copy(this.getCursorPosition(t,r,i)),this._v3_1.set(this._v2_1.x,this._v2_1.y,0),this._v3_1.clone();if(e instanceof eT.cPb){let a;this._v2_1.copy(this.getCursorNDC(t,r,i)),this._v3_1.set(this._v2_1.x,this._v2_1.y,-1),this._v3_1.applyMatrix4(e.projectionMatrixInverse);let o=this._v3_1.clone().normalize(),s=this._v3_1.z,l=Math.sqrt(Math.pow(this._v3_1.x,2)+Math.pow(this._v3_1.y,2));return(a=n?this._v3_1.setFromMatrixPosition(this._cameraMatrixState0).distanceTo(this._v3_2.setFromMatrixPosition(this._gizmoMatrixState0)):e.position.distanceTo(this._gizmos.position),0==l)?o.set(0,0,0):(o.multiplyScalar(Math.sqrt(Math.pow(a,2)+Math.pow(-a/(s/l),2))),o.z=0),o}}),cY(this,"updateMatrixState",()=>{this.camera&&(this._cameraMatrixState.copy(this.camera.matrix),this._gizmoMatrixState.copy(this._gizmos.matrix),this.camera instanceof eT.iKG&&(this._cameraProjectionState.copy(this.camera.projectionMatrix),this.camera.updateProjectionMatrix(),this._zoomState=this.camera.zoom),this.camera instanceof eT.cPb&&(this._fovState=this.camera.fov))}),cY(this,"updateTbState",(e,t)=>{this._state=e,t&&this.updateMatrixState()}),cY(this,"update",()=>{if(!this.target.equals(this._currentTarget)&&this.camera){this._gizmos.position.set(this.target.x,this.target.y,this.target.z);let e=this.calculateTbRadius(this.camera);void 0!==e&&(this._tbRadius=e),this.makeGizmos(this.target,this._tbRadius),this._currentTarget.copy(this.target)}if(this.camera){if(this.camera instanceof eT.iKG&&(this.camera.zoom>this.maxZoom||this.camera.zoom<this.minZoom)){let e=eT.M8C.clamp(this.camera.zoom,this.minZoom,this.maxZoom);this.applyTransformMatrix(this.applyScale(e/this.camera.zoom,this._gizmos.position,!0))}if(this.camera instanceof eT.cPb){let e=this.camera.position.distanceTo(this._gizmos.position);if(e>this.maxDistance+1e-6||e<this.minDistance-1e-6){let t=eT.M8C.clamp(e,this.minDistance,this.maxDistance);this.applyTransformMatrix(this.applyScale(t/e,this._gizmos.position)),this.updateMatrixState()}(this.camera.fov<this.minFov||this.camera.fov>this.maxFov)&&(this.camera.fov=eT.M8C.clamp(this.camera.fov,this.minFov,this.maxFov),this.camera.updateProjectionMatrix());let t=this._tbRadius,r=this.calculateTbRadius(this.camera);if(void 0!==r&&(this._tbRadius=r),t<this._tbRadius-1e-6||t>this._tbRadius+1e-6){let e=(this._gizmos.scale.x+this._gizmos.scale.y+this._gizmos.scale.z)/3,t=this._tbRadius/e,r=new eT.Ny0(0,0,t,t).getPoints(this._curvePts),i=new eT.u9r().setFromPoints(r);for(let e in this._gizmos.children)this._gizmos.children[e].geometry=i}}this.camera.lookAt(this._gizmos.position)}}),cY(this,"setStateFromJSON",e=>{let t=JSON.parse(e);if(t.arcballState&&this.camera){this._cameraMatrixState.fromArray(t.arcballState.cameraMatrix.elements),this._cameraMatrixState.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.up.copy(t.arcballState.cameraUp),this.camera.near=t.arcballState.cameraNear,this.camera.far=t.arcballState.cameraFar,this.camera.zoom=t.arcballState.cameraZoom,this.camera instanceof eT.cPb&&(this.camera.fov=t.arcballState.cameraFov),this._gizmoMatrixState.fromArray(t.arcballState.gizmoMatrix.elements),this._gizmoMatrixState.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale),this.camera.updateMatrix(),this.camera.updateProjectionMatrix(),this._gizmos.updateMatrix();let e=this.calculateTbRadius(this.camera);void 0!==e&&(this._tbRadius=e);let r=new eT.yGw().copy(this._gizmoMatrixState0);this.makeGizmos(this._gizmos.position,this._tbRadius),this._gizmoMatrixState0.copy(r),this.camera.lookAt(this._gizmos.position),this.updateTbState(cW.IDLE,!1),this.dispatchEvent(c$)}}),this.camera=null,this.domElement=t,this.scene=r,this.mouseActions=[],this._mouseOp=null,this._v2_1=new eT.FM8,this._v3_1=new eT.Pa4,this._v3_2=new eT.Pa4,this._m4_1=new eT.yGw,this._m4_2=new eT.yGw,this._quat=new eT._fP,this._translationMatrix=new eT.yGw,this._rotationMatrix=new eT.yGw,this._scaleMatrix=new eT.yGw,this._rotationAxis=new eT.Pa4,this._cameraMatrixState=new eT.yGw,this._cameraProjectionState=new eT.yGw,this._fovState=1,this._upState=new eT.Pa4,this._zoomState=1,this._nearPos=0,this._farPos=0,this._gizmoMatrixState=new eT.yGw,this._up0=new eT.Pa4,this._zoom0=1,this._fov0=0,this._initialNear=0,this._nearPos0=0,this._initialFar=0,this._farPos0=0,this._cameraMatrixState0=new eT.yGw,this._gizmoMatrixState0=new eT.yGw,this._button=-1,this._touchStart=[],this._touchCurrent=[],this._input=cq.NONE,this._switchSensibility=32,this._startFingerDistance=0,this._currentFingerDistance=0,this._startFingerRotation=0,this._currentFingerRotation=0,this._devPxRatio=0,this._downValid=!0,this._nclicks=0,this._downEvents=[],this._clickStart=0,this._maxDownTime=250,this._maxInterval=300,this._posThreshold=24,this._movementThreshold=24,this._currentCursorPosition=new eT.Pa4,this._startCursorPosition=new eT.Pa4,this._grid=null,this._gridPosition=new eT.Pa4,this._gizmos=new eT.ZAu,this._curvePts=128,this._timeStart=-1,this._animationId=-1,this.focusAnimationTime=500,this._timePrev=0,this._timeCurrent=0,this._anglePrev=0,this._angleCurrent=0,this._cursorPosPrev=new eT.Pa4,this._cursorPosCurr=new eT.Pa4,this._wPrev=0,this._wCurr=0,this.adjustNearFar=!1,this.scaleFactor=1.1,this.dampingFactor=25,this.wMax=20,this.enableAnimations=!0,this.enableGrid=!1,this.cursorZoom=!1,this.minFov=5,this.maxFov=90,this.enabled=!0,this.enablePan=!0,this.enableRotate=!0,this.enableZoom=!0,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.target=new eT.Pa4(0,0,0),this._currentTarget=new eT.Pa4(0,0,0),this._tbRadius=1,this._state=cW.IDLE,this.setCamera(e),this.scene&&this.scene.add(this._gizmos),this._devPxRatio=window.devicePixelRatio,this.initializeMouseActions(),this.domElement&&this.connect(this.domElement),window.addEventListener("resize",this.onWindowResize)}applyTransformMatrix(e){if((null==e?void 0:e.camera)&&this.camera&&(this._m4_1.copy(this._cameraMatrixState).premultiply(e.camera),this._m4_1.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.updateMatrix(),(this._state==cW.ROTATE||this._state==cW.ZROTATE||this._state==cW.ANIMATION_ROTATE)&&this.camera.up.copy(this._upState).applyQuaternion(this.camera.quaternion)),(null==e?void 0:e.gizmos)&&(this._m4_1.copy(this._gizmoMatrixState).premultiply(e.gizmos),this._m4_1.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale),this._gizmos.updateMatrix()),(this._state==cW.SCALE||this._state==cW.FOCUS||this._state==cW.ANIMATION_FOCUS)&&this.camera){let e=this.calculateTbRadius(this.camera);if(void 0!==e&&(this._tbRadius=e),this.adjustNearFar){let e=this.camera.position.distanceTo(this._gizmos.position),t=new eT.ZzF;t.setFromObject(this._gizmos);let r=new eT.aLr;t.getBoundingSphere(r);let i=Math.max(this._nearPos0,r.radius+r.center.length()),n=e-this._initialNear;this.camera.near=e-Math.min(i,n);let a=Math.min(this._farPos0,-r.radius+r.center.length()),o=e-this._initialFar;this.camera.far=e-Math.min(a,o),this.camera.updateProjectionMatrix()}else{let e=!1;this.camera.near!=this._initialNear&&(this.camera.near=this._initialNear,e=!0),this.camera.far!=this._initialFar&&(this.camera.far=this._initialFar,e=!0),e&&this.camera.updateProjectionMatrix()}}}setGizmosVisible(e){this._gizmos.visible=e,this.dispatchEvent(c$)}setTransformationMatrices(e=null,t=null){e?cZ.camera?cZ.camera.copy(e):cZ.camera=e.clone():cZ.camera=null,t?cZ.gizmos?cZ.gizmos.copy(t):cZ.gizmos=t.clone():cZ.gizmos=null}}let c3=(0,eD.forwardRef)(({camera:e,makeDefault:t,regress:r,domElement:i,onChange:n,onStart:a,onEnd:o,...s},l)=>{let c=(0,eR.D)(e=>e.invalidate),u=(0,eR.D)(e=>e.camera),h=(0,eR.D)(e=>e.gl),A=(0,eR.D)(e=>e.events),d=(0,eR.D)(e=>e.set),m=(0,eR.D)(e=>e.get),f=(0,eR.D)(e=>e.performance),p=e||u,g=i||A.connected||h.domElement,y=(0,eD.useMemo)(()=>new c2(p),[p]);return(0,eR.F)(()=>{y.enabled&&y.update()},-1),(0,eD.useEffect)(()=>(y.connect(g),()=>void y.dispose()),[g,r,y,c]),(0,eD.useEffect)(()=>{let e=e=>{c(),r&&f.regress(),n&&n(e)};return y.addEventListener("change",e),a&&y.addEventListener("start",a),o&&y.addEventListener("end",o),()=>{y.removeEventListener("change",e),a&&y.removeEventListener("start",a),o&&y.removeEventListener("end",o)}},[n,a,o]),(0,eD.useEffect)(()=>
824{if(t){let e=m().controls;return d({controls:y}),()=>d({controls:e})}},[t,y]),eD.createElement("primitive",(0,eS.Z)({ref:l,object:y},s))});var c4=Object.defineProperty,c5=(e,t,r)=>t in e?c4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,c6=(e,t,r)=>(c5(e,"symbol"!=typeof t?t+"":t,r),r);class c8 extends eT.Tme{constructor(e,t){super(),c6(this,"isTransformControls",!0),c6(this,"visible",!1),c6(this,"domElement"),c6(this,"raycaster",new eT.iMs),c6(this,"gizmo"),c6(this,"plane"),c6(this,"tempVector",new eT.Pa4),c6(this,"tempVector2",new eT.Pa4),c6(this,"tempQuaternion",new eT._fP),c6(this,"unit",{X:new eT.Pa4(1,0,0),Y:new eT.Pa4(0,1,0),Z:new eT.Pa4(0,0,1)}),c6(this,"pointStart",new eT.Pa4),c6(this,"pointEnd",new eT.Pa4),c6(this,"offset",new eT.Pa4),c6(this,"rotationAxis",new eT.Pa4),c6(this,"startNorm",new eT.Pa4),c6(this,"endNorm",new eT.Pa4),c6(this,"rotationAngle",0),c6(this,"cameraPosition",new eT.Pa4),c6(this,"cameraQuaternion",new eT._fP),c6(this,"cameraScale",new eT.Pa4),c6(this,"parentPosition",new eT.Pa4),c6(this,"parentQuaternion",new eT._fP),c6(this,"parentQuaternionInv",new eT._fP),c6(this,"parentScale",new eT.Pa4),c6(this,"worldPositionStart",new eT.Pa4),c6(this,"worldQuaternionStart",new eT._fP),c6(this,"worldScaleStart",new eT.Pa4),c6(this,"worldPosition",new eT.Pa4),c6(this,"worldQuaternion",new eT._fP),c6(this,"worldQuaternionInv",new eT._fP),c6(this,"worldScale",new eT.Pa4),c6(this,"eye",new eT.Pa4),c6(this,"positionStart",new eT.Pa4),c6(this,"quaternionStart",new eT._fP),c6(this,"scaleStart",new eT.Pa4),c6(this,"camera"),c6(this,"object"),c6(this,"enabled",!0),c6(this,"axis",null),c6(this,"mode","translate"),c6(this,"translationSnap",null),c6(this,"rotationSnap",null),c6(this,"scaleSnap",null),c6(this,"space","world"),c6(this,"size",1),c6(this,"dragging",!1),c6(this,"showX",!0),c6(this,"showY",!0),c6(this,"showZ",!0),c6(this,"changeEvent",{type:"change"}),c6(this,"mouseDownEvent",{type:"mouseDown",mode:this.mode}),c6(this,"mouseUpEvent",{type:"mouseUp",mode:this.mode}),c6(this,"objectChangeEvent",{type:"objectChange"}),c6(this,"intersectObjectWithRay",(e,t,r)=>{let i=t.intersectObject(e,!0);for(let e=0;e<i.length;e++)if(i[e].object.visible||r)return i[e];return!1}),c6(this,"attach",e=>(this.object=e,this.visible=!0,this)),c6(this,"detach",()=>(this.object=void 0,this.visible=!1,this.axis=null,this)),c6(this,"reset",()=>(this.enabled&&this.dragging&&void 0!==this.object&&(this.object.position.copy(this.positionStart),this.object.quaternion.copy(this.quaternionStart),this.object.scale.copy(this.scaleStart),this.dispatchEvent(this.changeEvent),this.dispatchEvent(this.objectChangeEvent),this.pointStart.copy(this.pointEnd)),this)),c6(this,"updateMatrixWorld",()=>{void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this.parentPosition,this.parentQuaternion,this.parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this.worldScale),this.parentQuaternionInv.copy(this.parentQuaternion).invert(),this.worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this.cameraScale),this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld()}),c6(this,"pointerHover",e=>{if(void 0===this.object||!0===this.dragging)return;this.raycaster.setFromCamera(e,this.camera);let t=this.intersectObjectWithRay(this.gizmo.picker[this.mode],this.raycaster);t?this.axis=t.object.name:this.axis=null}),c6(this,"pointerDown",e=>{if(void 0!==this.object&&!0!==this.dragging&&0===e.button&&null!==this.axis){this.raycaster.setFromCamera(e,this.camera);let t=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(t){let e=this.space;if("scale"===this.mode?e="local":("E"===this.axis||"XYZE"===this.axis||"XYZ"===this.axis)&&(e="world"),"local"===e&&"rotate"===this.mode){let e=this.rotationSnap;"X"===this.axis&&e&&(this.object.rotation.x=Math.round(this.object.rotation.x/e)*e),"Y"===this.axis&&e&&(this.object.rotation.y=Math.round(this.object.rotation.y/e)*e),"Z"===this.axis&&e&&(this.object.rotation.z=Math.round(this.object.rotation.z/e)*e)}this.object.updateMatrixWorld(),this.object.parent&&this.object.parent.updateMatrixWorld(),this.positionStart.copy(this.object.position),this.quaternionStart.copy(this.object.quaternion),this.scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this.worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)}this.dragging=!0,this.mouseDownEvent.mode=this.mode,this.dispatchEvent(this.mouseDownEvent)}}),c6(this,"pointerMove",e=>{let t=this.axis,r=this.mode,i=this.object,n=this.space;if("scale"===r?n="local":("E"===t||"XYZE"===t||"XYZ"===t)&&(n="world"),void 0===i||null===t||!1===this.dragging||-1!==e.button)return;this.raycaster.setFromCamera(e,this.camera);let a=this.intersectObjectWithRay(this.plane,this.raycaster,!0);
824if(a){if(this.pointEnd.copy(a.point).sub(this.worldPositionStart),"translate"===r)this.offset.copy(this.pointEnd).sub(this.pointStart),"local"===n&&"XYZ"!==t&&this.offset.applyQuaternion(this.worldQuaternionInv),-1===t.indexOf("X")&&(this.offset.x=0),-1===t.indexOf("Y")&&(this.offset.y=0),-1===t.indexOf("Z")&&(this.offset.z=0),"local"===n&&"XYZ"!==t?this.offset.applyQuaternion(this.quaternionStart).divide(this.parentScale):this.offset.applyQuaternion(this.parentQuaternionInv).divide(this.parentScale),i.position.copy(this.offset).add(this.positionStart),this.translationSnap&&("local"===n&&(i.position.applyQuaternion(this.tempQuaternion.copy(this.quaternionStart).invert()),-1!==t.search("X")&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(this.quaternionStart)),"world"===n&&(i.parent&&i.position.add(this.tempVector.setFromMatrixPosition(i.parent.matrixWorld)),-1!==t.search("X")&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(this.tempVector.setFromMatrixPosition(i.parent.matrixWorld))));else if("scale"===r){if(-1!==t.search("XYZ")){let e=this.pointEnd.length()/this.pointStart.length();0>this.pointEnd.dot(this.pointStart)&&(e*=-1),this.tempVector2.set(e,e,e)}else this.tempVector.copy(this.pointStart),this.tempVector2.copy(this.pointEnd),this.tempVector.applyQuaternion(this.worldQuaternionInv),this.tempVector2.applyQuaternion(this.worldQuaternionInv),this.tempVector2.divide(this.tempVector),-1===t.search("X")&&(this.tempVector2.x=1),-1===t.search("Y")&&(this.tempVector2.y=1),-1===t.search("Z")&&(this.tempVector2.z=1);i.scale.copy(this.scaleStart).multiply(this.tempVector2),this.scaleSnap&&this.object&&(-1!==t.search("X")&&(this.object.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if("rotate"===r){this.offset.copy(this.pointEnd).sub(this.pointStart);let e=20/this.worldPosition.distanceTo(this.tempVector.setFromMatrixPosition(this.camera.matrixWorld));"E"===t?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this.startNorm.copy(this.pointStart).normalize(),this.endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=0>this.endNorm.cross(this.startNorm).dot(this.eye)?1:-1):"XYZE"===t?(this.rotationAxis.copy(this.offset).cross(this.eye).normalize(),this.rotationAngle=this.offset.dot(this.tempVector.copy(this.rotationAxis).cross(this.eye))*e):("X"===t||"Y"===t||"Z"===t)&&(this.rotationAxis.copy(this.unit[t]),this.tempVector.copy(this.unit[t]),"local"===n&&this.tempVector.applyQuaternion(this.worldQuaternion),this.rotationAngle=this.offset.dot(this.tempVector.cross(this.eye).normalize())*e),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===n&&"E"!==t&&"XYZE"!==t?(i.quaternion.copy(this.quaternionStart),i.quaternion.multiply(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this.parentQuaternionInv),i.quaternion.copy(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),i.quaternion.multiply(this.quaternionStart).normalize())}this.dispatchEvent(this.changeEvent),this.dispatchEvent(this.objectChangeEvent)}}),c6(this,"pointerUp",e=>{0===e.button&&(this.dragging&&null!==this.axis&&(this.mouseUpEvent.mode=this.mode,this.dispatchEvent(this.mouseUpEvent)),this.dragging=!1,this.axis=null)}),c6(this,"getPointer",e=>{var t;if(this.domElement&&(null==(t=this.domElement.ownerDocument)?void 0:t.pointerLockElement))return{x:0,y:0,button:e.button};{let t=e.changedTouches?e.changedTouches[0]:e,r=this.domElement.getBoundingClientRect();return{x:(t.clientX-r.left)/r.width*2-1,y:-(t.clientY-r.top)/r.height*2+1,button:e.button}}}),c6(this,"onPointerHover",e=>{if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this.getPointer(e))}}),c6(this,"onPointerDown",e=>{this.enabled&&this.domElement&&(this.domElement.style.touchAction="none",this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.pointerHover(this.getPointer(e)),this.pointerDown(this.getPointer(e)))}),c6(this,"onPointerMove",e=>{this.enabled&&this.pointerMove(this.getPointer(e))}),c6(this,"onPointerUp",e=>{this.enabled&&this.domElement&&(this.domElement.style.touchAction="",this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.pointerUp(this.getPointer(e)))}),c6(this,"getMode",()=>this.mode),c6(this,"setMode",e=>{this.mode=e}),c6(this,"setTranslationSnap",e=>{this.translationSnap=e}),c6(this,"setRotationSnap",e=>{this.rotationSnap=e}),c6(this,"setScaleSnap",e=>{this.scaleSnap=e}),c6(this,"setSize",e=>{this.size=e}),c6(this,"setSpace",e=>{this.space=e}),c6(this,"update",()=>{console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}),c6(this,"connect",e=>{e===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.domElement=e,this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("pointermove",this.onPointerHover),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)}),c6(this,"dispose",()=>{var e,t,r,i,n,a;null==(e=this.domElement)||e.removeEventListener("pointerdown",this.onPointerDown),null==(t=this.domElement)||t.removeEventListener("pointermove",this.onPointerHover),null==(i=null==(r=this.domElement)?void 0:r.ownerDocument)||i.removeEventListener("pointermove",this.onPointerMove),null==(a=null==(n=this.domElement)?void 0:n.ownerDocument)||a.removeEventListener("pointerup",this.onPointerUp),this.traverse(e=>{e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}),this.domElement=t,this.camera=e,this.gizmo=new c9,this.add(this.gizmo),this.plane=new c7,this.add(this.plane);let r=(e,t)=>{let r=t;Object.defineProperty(this,e,{get:function(){return void 0!==r?r:t},set:function(t){r!==t&&(r=t,this.plane[e]=t,this.gizmo[e]=t,this.dispatchEvent({type:e+"-changed",value:t}),this.dispatchEvent(this.changeEvent))}}),this[e]=t,this.plane[e]=t,this.gizmo[e]=t};r("camera",this.camera),r("object",this.object),r("enabled",this.enabled),r("axis",this.axis),r("mode",this.mode),r("translationSnap",this.translationSnap),r("rotationSnap",this.rotationSnap),r("scaleSnap",this.scaleSnap),r("space",this.space),r("size",this.size),r("dragging",this.dragging),r("showX",this.showX),r("showY",this.showY),r("showZ",this.showZ),r("worldPosition",this.worldPosition),r("worldPositionStart",this.worldPositionStart),r("worldQuaternion",this.worldQuaternion),r("worldQuaternionStart",this.worldQuaternionStart),r("cameraPosition",this.cameraPosition),r("cameraQuaternion",this.cameraQuaternion),r("pointStart",this.pointStart),r("pointEnd",this.pointEnd),r("rotationAxis",this.rotationAxis),r("rotationAngle",this.rotationAngle),r("eye",this.eye),void 0!==t&&this.connect(t)}}class c9 extends eT.Tme{constructor(){super(),c6(this,"isTransformControlsGizmo",!0),c6(this,"type","TransformControlsGizmo"),c6(this,"tempVector",new eT.Pa4(0,0,0)),c6(this,"tempEuler",new eT.USm),c6(this,"alignVector",new eT.Pa4(0,1,0)),c6(this,"zeroVector",new eT.Pa4(0,0,0)),c6(this,"lookAtMatrix",new eT.yGw),c6(this,"tempQuaternion",new eT._fP),c6(this,"tempQuaternion2",new eT._fP),c6(this,"identityQuaternion",new eT._fP),c6(this,"unitX",new eT.Pa4(1,0,0)),c6(this,"unitY",new eT.Pa4(0,1,0)),c6(this,"unitZ",new eT.Pa4(0,0,1)),c6(this,"gizmo"),c6(this,"picker"),c6(this,"helper"),c6(this,"rotationAxis",new eT.Pa4),c6(this,"cameraPosition",new eT.Pa4),c6(this,"worldPositionStart",new eT.Pa4),c6(this,"worldQuaternionStart",new eT._fP),c6(this,"worldPosition",new eT.Pa4),c6(this,"worldQuaternion",new eT._fP),c6(this,"eye",new eT.Pa4),c6(this,"camera",null),c6(this,"enabled",!0),c6(this,"axis",null),c6(this,"mode","translate"),c6(this,"space","world"),c6(this,"size",1),c6(this,"dragging",!1),c6(this,"showX",!0),c6(this,"showY",!0),c6(this,"showZ",!0),c6(this,"updateMatrixWorld",()=>{let e=this.space;"scale"===this.mode&&(e="local");let t="local"===e?this.worldQuaternion:this.identityQuaternion;this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode;let r=[];r=(r=(r=r.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);for(let e=0;e<r.length;e++){let i;let n=r[e];if(n.visible=!0,n.rotation.set(0,0,0),n.position.copy(this.worldPosition),i=this.camera.isOrthographicCamera?(this.camera.top-this.camera.bottom)/this.camera.zoom:this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),n.scale.set(1,1,1).multiplyScalar(i*this.size/7),"helper"===n.tag){n.visible=!1,"AXIS"===n.name?(n.position.copy(this.worldPositionStart),n.visible=!!this.axis,"X"===this.axis&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,0)),n.quaternion.copy(t).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(t).dot(this.eye))>.9&&(n.visible=!1)),"Y"===this.axis&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,Math.PI/2)),n.quaternion.copy(t).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(t).dot(this.eye))>.9&&(n.visible=!1)),"Z"===this.axis&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),n.quaternion.copy(t).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(t).dot(this.eye))>.9&&(n.visible=!1)),"XYZE"===this.axis&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),this.alignVector.copy(this.rotationAxis),n.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.zeroVector,this.alignVector,this.unitY)),n.quaternion.multiply(this.tempQuaternion),n.visible=this.dragging),"E"===this.axis&&(n.visible=!1)):"START"===n.name?(n.position.copy(this.worldPositionStart),n.visible=this.dragging):"END"===n.name?(n.position.copy(this.worldPosition),n.visible=this.dragging):"DELTA"===n.name?(n.position.copy(this.worldPositionStart),n.quaternion.copy(this.worldQuaternionStart),this.tempVector.set(1e-10,
8241e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),this.tempVector.applyQuaternion(this.worldQuaternionStart.clone().invert()),n.scale.copy(this.tempVector),n.visible=this.dragging):(n.quaternion.copy(t),this.dragging?n.position.copy(this.worldPositionStart):n.position.copy(this.worldPosition),this.axis&&(n.visible=-1!==this.axis.search(n.name)));continue}n.quaternion.copy(t),"translate"===this.mode||"scale"===this.mode?(("X"===n.name||"XYZX"===n.name)&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(t).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),("Y"===n.name||"XYZY"===n.name)&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(t).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),("Z"===n.name||"XYZZ"===n.name)&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(t).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"XY"===n.name&&.2>Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(t).dot(this.eye))&&(n.scale.set(1e-10,
8241e-10,1e-10),n.visible=!1),"YZ"===n.name&&.2>Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(t).dot(this.eye))&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"XZ"===n.name&&.2>Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(t).dot(this.eye))&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),-1!==n.name.search("X")&&(0>this.alignVector.copy(this.unitX).applyQuaternion(t).dot(this.eye)?"fwd"===n.tag?n.visible=!1:n.scale.x*=-1:"bwd"===n.tag&&(n.visible=!1)),-1!==n.name.search("Y")&&(0>this.alignVector.copy(this.unitY).applyQuaternion(t).dot(this.eye)?"fwd"===n.tag?n.visible=!1:n.scale.y*=-1:"bwd"===n.tag&&(n.visible=!1)),-1!==n.name.search("Z")&&(0>this.alignVector.copy(this.unitZ).applyQuaternion(t).dot(this.eye)?"fwd"===n.tag?n.visible=!1:n.scale.z*=-1:"bwd"===n.tag&&(n.visible=!1))):"rotate"===this.mode&&(this.tempQuaternion2.copy(t),this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy(t).invert()),-1!==n.name.search("E")&&n.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye,this.zeroVector,this.unitY)),"X"===n.name&&(this.tempQuaternion.setFromAxisAngle(this.unitX,Math.atan2(-this.alignVector.y,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),n.quaternion.copy(this.tempQuaternion)),"Y"===n.name&&(this.tempQuaternion.setFromAxisAngle(this.unitY,Math.atan2(this.alignVector.x,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),n.quaternion.copy(this.tempQuaternion)),"Z"===n.name&&(this.tempQuaternion.setFromAxisAngle(this.unitZ,Math.atan2(this.alignVector.y,this.alignVector.x)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),n.quaternion.copy(this.tempQuaternion))),n.visible=n.visible&&(-1===n.name.indexOf("X")||this.showX),n.visible=n.visible&&(-1===n.name.indexOf("Y")||this.showY),n.visible=n.visible&&(-1===n.name.indexOf("Z")||this.showZ),n.visible=n.visible&&(-1===n.name.indexOf("E")||this.showX&&this.showY&&this.showZ),n.material.tempOpacity=n.material.tempOpacity||n.material.opacity,n.material.tempColor=n.material.tempColor||n.material.color.clone(),n.material.color.copy(n.material.tempColor),n.material.opacity=n.material.tempOpacity,this.enabled?this.axis&&(n.name===this.axis?n.material.opacity=1:this.axis.split("").some(function(e){return n.name===e})?n.material.opacity=1:n.material.opacity*=.25,n.material.color.lerp(new eT.Ilk(1,1,1),.5)):(n.material.opacity*=.5,n.material.color.lerp(new eT.Ilk(1,1,1),.5))}super.updateMatrixWorld()});let e=new eT.vBJ({depthTest:!1,depthWrite:!1,transparent:!0,side:eT.ehD,fog:!1,toneMapped:!1}),t=new eT.nls({depthTest:!1,depthWrite:!1,transparent:!0,linewidth:1,fog:!1,toneMapped:!1}),r=e.clone();r.opacity=.15;let i=e.clone();i.opacity=.33;let n=e.clone();n.color.set(16711680);let a=e.clone();a.color.set(65280);let o=e.clone();o.color.set(255);let s=e.clone();s.opacity=.25;let l=s.clone();l.color.set(16776960);let c=s.clone();c.color.set(65535);let u=s.clone();u.color.set(16711935),e.clone().color.set(16776960);let h=t.clone();h.color.set(16711680);let A=t.clone();A.color.set(65280);let d=t.clone();d.color.set(255);let m=t.clone();m.color.set(65535);let f=t.clone();f.color.set(16711935);let p=t.clone();p.color.set(16776960);let g=t.clone();g.color.set(7895160);let y=p.clone();y.opacity=.25;let v=new eT.fHI(0,.05,.2,12,1,!1),E=new eT.DvJ(.125,.125,.125),x=new eT.u9r;x.setAttribute("position",new eT.a$l([0,0,0,1,0,0],3));let C=(e,t)=>{let r=new eT.u9r,i=[];for(let r=0;r<=64*t;++r)i.push(0,Math.cos(r/32*Math.PI)*e,Math.sin(r/32*Math.PI)*e);return r.setAttribute("position",new eT.a$l(i,3)),r},w={X:[[new eT.Kj0(v,n),[1,0,0],[0,0,-Math.PI/2],null,"fwd"],[new eT.Kj0(v,n),[1,0,0],[0,0,Math.PI/2],null,"bwd"],[new eT.x12(x,h)]],Y:[[new eT.Kj0(v,a),[0,1,0],null,null,"fwd"],[new eT.Kj0(v,a),[0,1,0],[Math.PI,0,0],null,"bwd"],[new eT.x12(x,A),null,[0,0,Math.PI/2]]],Z:[[new eT.Kj0(v,o),[0,0,1],[Math.PI/2,0,0],null,"fwd"],[new eT.Kj0(v,o),[0,0,1],[-Math.PI/2,0,0],null,"bwd"],[new eT.x12(x,d),null,[0,-Math.PI/2,0]]],XYZ:[[new eT.Kj0(new eT.pQR(.1,0),s.clone()),[0,0,0],[0,0,0]]],XY:[[new eT.Kj0(new eT._12(.295,.295),l.clone()),[.15,.15,0]],[new eT.x12(x,p),[.18,.3,0],null,[.125,1,1]],[new eT.x12(x,p),[.3,.18,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new eT.Kj0(new eT._12(.295,.295),c.clone()),[0,.15,.15],[0,Math.PI/2,0]],[new eT.x12(x,m),[0,.18,.3],[0,0,Math.PI/2],[.125,1,1]],[new eT.x12(x,m),[0,.3,.18],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new eT.Kj0(new eT._12(.295,.295),u.clone()),[.15,0,.15],[-Math.PI/2,0,0]],[new eT.x12(x,f),[.18,0,.3],null,[.125,1,1]],[new eT.x12(x,f),[.3,0,.18],[0,-Math.PI/2,0],[.125,1,1]]]},B={X:[[new eT.Kj0(new eT.fHI(.2,0,1,4,1,!1),r),[.6,0,0],[0,0,-Math.PI/2]]],Y:[[new eT.Kj0(new eT.fHI(.2,0,1,4,1,!1),r),[0,.6,0]]],Z:[[new eT.Kj0(new eT.fHI(.2,0,1,4,1,!1),r),[0,0,.6],[Math.PI/2,0,0]]],XYZ:[[new eT.Kj0(new eT.pQR(.2,0),r)]],XY:[[new eT.Kj0(new eT._12(.4,.4),r),[.2,.2,0]]],YZ:[[new eT.Kj0(new eT._12(.4,.4),r),[0,.2,.2],[0,Math.PI/2,0]]],XZ:[[new eT.Kj0(new eT._12(.4,.4),r),[.2,0,.2],[-Math.PI/2,0,0]]]},I={START:[[new eT.Kj0(new eT.pQR(.01,2),i),null,null,null,"helper"]],END:[[new eT.Kj0(new eT.pQR(.01,2),i),null,null,null,"helper"]],DELTA:[[new eT.x12((()=>{let e=new eT.u9r;return e.setAttribute("position",new eT.a$l([0,0,0,1,1,1],3)),e})(),i),null,null,null,"helper"]],X:[[new eT.x12(x,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new eT.x12(x,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new eT.x12(x,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},_={X:[[new eT.x12(C(1,.5),h)],[new eT.Kj0(new eT.pQR(.04,0),n),[0,0,.99],null,[1,3,1]]],Y:[[new eT.x12(C(1,.5),A),null,[0,0,-Math.PI/2]],[new eT.Kj0(new eT.pQR(.04,0),a),[0,0,.99],null,[3,1,1]]],Z:[[new eT.x12(C(1,.5),d),null,[0,Math.PI/2,0]],[new eT.Kj0(new eT.pQR(.04,0),o),[.99,0,0],null,[1,3,1]]],E:[[new eT.x12(C(1.25,1),y),null,[0,Math.PI/2,0]],[new eT.Kj0(new eT.fHI(.03,0,.15,4,1,!1),y),[1.17,0,0],[0,0,-Math.PI/2],[1,1,.001]],[new eT.Kj0(new eT.fHI(.03,0,.15,4,1,!1),y),[-1.17,0,0],[0,0,Math.PI/2],[1,1,.001]],[new eT.Kj0(new eT.fHI(.03,0,.15,4,1,!1),y),[0,-1.17,0],[Math.PI,0,0],[1,1,.001]],[new eT.Kj0(new eT.fHI(.03,0,.15,4,1,!1),y),[0,1.17,0],[0,0,0],[1,1,.001]]],XYZE:[[new eT.x12(C(1,1),g),null,[0,Math.PI/2,0]]]},b={AXIS:[[new eT.x12(x,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},M={X:[[new eT.Kj0(new eT.XvJ(1,.1,4,24),r),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new eT.Kj0(new eT.XvJ(1,.1,4,24),r),[0,0,0],[Math.PI/2,0,0]]],Z:[[new eT.Kj0(new eT.XvJ(1,.1,4,24),r),[0,0,0],[0,0,-Math.PI/2]]],E:[[new eT.Kj0(new eT.XvJ(1.25,.1,2,24),r)]],XYZE:[[new eT.Kj0(new eT.xo$(.7,10,8),r)]]},S={X:[[new eT.Kj0(E,n),[.8,0,0],[0,0,-Math.PI/2]],[new eT.x12(x,h),null,null,[.8,1,1]]],Y:[[new eT.Kj0(E,a),[0,.8,0]],[new eT.x12(x,A),null,[0,0,Math.PI/2],[.8,1,1]]],Z:[[new eT.Kj0(E,o),[0,0,.8],[Math.PI/2,0,0]],[new eT.x12(x,d),null,[0,-Math.PI/2,0],[.8,1,1]]],XY:[[new eT.Kj0(E,l),[.85,.85,0],null,[2,2,.2]],[new eT.x12(x,p),[.855,.98,0],null,[.125,1,1]],[new eT.x12(x,p),[.98,.855,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new eT.Kj0(E,c),[0,.85,.85],null,[.2,2,2]],[new eT.x12(x,m),[0,.855,.98],[0,0,Math.PI/2],[.125,1,1]],[new eT.x12(x,m),[0,.98,.855],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new eT.Kj0(E,u),[.85,0,.85],null,[2,.2,2]],[new eT.x12(x,f),[.855,0,.98],null,[.125,1,1]],[new eT.x12(x,f),[.98,0,.855],[0,-Math.PI/2,0],[.125,1,1]]],XYZX:[[new eT.Kj0(new eT.DvJ(.125,.125,.125),s.clone()),[1.1,0,0]]],XYZY:[[new eT.Kj0(new eT.DvJ(.125,.125,.125),s.clone()),[0,1.1,0]]],XYZZ:[[new eT.Kj0(new eT.DvJ(.125,.125,.125),s.clone()),[0,0,1.1]]]}
824,D={X:[[new eT.Kj0(new eT.fHI(.2,0,.8,4,1,!1),r),[.5,0,0],[0,0,-Math.PI/2]]],Y:[[new eT.Kj0(new eT.fHI(.2,0,.8,4,1,!1),r),[0,.5,0]]],Z:[[new eT.Kj0(new eT.fHI(.2,0,.8,4,1,!1),r),[0,0,.5],[Math.PI/2,0,0]]],XY:[[new eT.Kj0(E,r),[.85,.85,0],null,[3,3,.2]]],YZ:[[new eT.Kj0(E,r),[0,.85,.85],null,[.2,3,3]]],XZ:[[new eT.Kj0(E,r),[.85,0,.85],null,[3,.2,3]]],XYZX:[[new eT.Kj0(new eT.DvJ(.2,.2,.2),r),[1.1,0,0]]],XYZY:[[new eT.Kj0(new eT.DvJ(.2,.2,.2),r),[0,1.1,0]]],XYZZ:[[new eT.Kj0(new eT.DvJ(.2,.2,.2),r),[0,0,1.1]]]},P={X:[[new eT.x12(x,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new eT.x12(x,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new eT.x12(x,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},T=e=>{let t=new eT.Tme;for(let r in e)for(let i=e[r].length;i--;){let n=e[r][i][0].clone(),a=e[r][i][1],o=e[r][i][2],s=e[r][i][3],l=e[r][i][4];n.name=r,n.tag=l,a&&n.position.set(a[0],a[1],a[2]),o&&n.rotation.set(o[0],o[1],o[2]),s&&n.scale.set(s[0],s[1],s[2]),n.updateMatrix();let c=n.geometry.clone();c.applyMatrix4(n.matrix),n.geometry=c,n.renderOrder=1/0,n.position.set(0,0,0),n.rotation.set(0,0,0),n.scale.set(1,1,1),t.add(n)}return t};this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=T(w)),this.add(this.gizmo.rotate=T(_)),this.add(this.gizmo.scale=T(S)),this.add(this.picker.translate=T(B)),this.add(this.picker.rotate=T(M)),this.add(this.picker.scale=T(D)),this.add(this.helper.translate=T(I)),this.add(this.helper.rotate=T(b)),this.add(this.helper.scale=T(P)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}}class c7 extends eT.Kj0{constructor(){super(new eT._12(1e5,1e5,2,2),new eT.vBJ({visible:!1,wireframe:!0,side:eT.ehD,transparent:!0,opacity:.1,toneMapped:!1})),c6(this,"isTransformControlsPlane",!0),c6(this,"type","TransformControlsPlane"),c6(this,"unitX",new eT.Pa4(1,0,0)),c6(this,"unitY",new eT.Pa4(0,1,0)),c6(this,"unitZ",new eT.Pa4(0,0,1)),c6(this,"tempVector",new eT.Pa4),c6(this,"dirVector",new eT.Pa4),c6(this,"alignVector",new eT.Pa4),c6(this,"tempMatrix",new eT.yGw),c6(this,"identityQuaternion",new eT._fP),c6(this,"cameraQuaternion",new eT._fP),c6(this,"worldPosition",new eT.Pa4),c6(this,"worldQuaternion",new eT._fP),c6(this,"eye",new eT.Pa4),c6(this,"axis",null),c6(this,"mode","translate"),c6(this,"space","world"),c6(this,"updateMatrixWorld",()=>{let e=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(e="local"),this.unitX.set(1,0,0).applyQuaternion("local"===e?this.worldQuaternion:this.identityQuaternion),this.unitY.set(0,1,0).applyQuaternion("local"===e?this.worldQuaternion:this.identityQuaternion),this.unitZ.set(0,0,1).applyQuaternion("local"===e?this.worldQuaternion:this.identityQuaternion),this.alignVector.copy(this.unitY),this.mode){case"translate":case"scale":switch(this.axis){case"X":this.alignVector.copy(this.eye).cross(this.unitX),this.dirVector.copy(this.unitX).cross(this.alignVector);break;case"Y":this.alignVector.copy(this.eye).cross(this.unitY),this.dirVector.copy(this.unitY).cross(this.alignVector);break;case"Z":this.alignVector.copy(this.eye).cross(this.unitZ),this.dirVector.copy(this.unitZ).cross(this.alignVector);break;case"XY":this.dirVector.copy(this.unitZ);break;case"YZ":this.dirVector.copy(this.unitX);break;case"XZ":this.alignVector.copy(this.unitZ),this.dirVector.copy(this.unitY);break;case"XYZ":case"E":this.dirVector.set(0,0,0)}break;default:this.dirVector.set(0,0,0)}0===this.dirVector.length()?this.quaternion.copy(this.cameraQuaternion):(this.tempMatrix.lookAt(this.tempVector.set(0,0,0),this.dirVector,this.alignVector),this.quaternion.setFromRotationMatrix(this.tempMatrix)),super.updateMatrixWorld()})}}let ue=eD.forwardRef(({children:e,domElement:t,onChange:r,onMouseDown:i,onMouseUp:n,onObjectChange:a,object:o,makeDefault:s,camera:l,enabled:c,axis:u,mode:h,translationSnap:A,rotationSnap:d,scaleSnap:m,space:f,size:p,showX:g,showY:y,showZ:v,...E},x)=>{let C=(0,eR.D)(e=>e.controls),w=(0,eR.D)(e=>e.gl),B=(0,eR.D)(e=>e.events),I=(0,eR.D)(e=>e.camera),_=(0,eR.D)(e=>e.invalidate),b=(0,eR.D)(e=>e.get),M=(0,eR.D)(e=>e.set),S=l||I,D=t||B.connected||w.domElement,P=eD.useMemo(()=>new c8(S,D),[S,D]),T=eD.useRef(null);eD.useLayoutEffect(()=>(o?P.attach(o instanceof eT.Tme?o:o.current):T.current instanceof eT.Tme&&P.attach(T.current),()=>void P.detach()),[o,e,P]),eD.useEffect(()=>{if(C){let e=e=>C.enabled=!e.value;return P.addEventListener("dragging-changed",e),()=>P.removeEventListener("dragging-changed",e)}},[P,C]);let R=eD.useRef(),F=eD.useRef(),Q=eD.useRef(),z=eD.useRef();return eD.useLayoutEffect(()=>void(R.current=r),[r]),eD.useLayoutEffect(()=>void(F.current=i),[i]),eD.useLayoutEffect(()=>void(Q.current=n),[n]),eD.useLayoutEffect(()=>void(z.current=a),[a]),eD.useEffect(()=>{let e=e=>{_(),null==R.current||R.current(e)},t=e=>null==F.current?void 0:F.current(e),r=e=>null==Q.current?void 0:Q.current(e),i=e=>null==z.current?void 0:z.current(e);return P.addEventListener("change",e),P.addEventListener("mouseDown",t),P.addEventListener("mouseUp",r),P.addEventListener("objectChange",i
824),()=>{P.removeEventListener("change",e),P.removeEventListener("mouseDown",t),P.removeEventListener("mouseUp",r),P.removeEventListener("objectChange",i)}},[_,P]),eD.useEffect(()=>{if(s){let e=b().controls;return M({controls:P}),()=>M({controls:e})}},[s,P]),eD.createElement(eD.Fragment,null,eD.createElement("primitive",{ref:x,object:P,enabled:c,axis:u,mode:h,translationSnap:A,rotationSnap:d,scaleSnap:m,space:f,size:p,showX:g,showY:y,showZ:v}),eD.createElement("group",(0,eS.Z)({ref:T},E),e))});var ut=Object.defineProperty,ur=(e,t,r)=>t in e?ut(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ui=(e,t,r)=>(ur(e,"symbol"!=typeof t?t+"":t,r),r);let un=new eT.USm(0,0,0,"YXZ"),ua=new eT.Pa4,uo={type:"change"},us={type:"lock"},ul={type:"unlock"},uc=Math.PI/2;class uu extends cy{constructor(e,t){super(),ui(this,"camera"),ui(this,"domElement"),ui(this,"isLocked"),ui(this,"minPolarAngle"),ui(this,"maxPolarAngle"),ui(this,"pointerSpeed"),ui(this,"onMouseMove",e=>{this.domElement&&!1!==this.isLocked&&(un.setFromQuaternion(this.camera.quaternion),un.y-=.002*e.movementX*this.pointerSpeed,un.x-=.002*e.movementY*this.pointerSpeed,un.x=Math.max(uc-this.maxPolarAngle,Math.min(uc-this.minPolarAngle,un.x)),this.camera.quaternion.setFromEuler(un),this.dispatchEvent(uo))}),ui(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(us),this.isLocked=!0):(this.dispatchEvent(ul),this.isLocked=!1))}),ui(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),ui(this,"connect",e=>{this.domElement=e||this.domElement,this.domElement&&(this.domElement.ownerDocument.addEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError))}),ui(this,"disconnect",()=>{this.domElement&&(this.domElement.ownerDocument.removeEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError))}),ui(this,"dispose",()=>{this.disconnect()}),ui(this,"getObject",()=>this.camera),ui(this,"direction",new eT.Pa4(0,0,-1)),ui(this,"getDirection",e=>e.copy(this.direction).applyQuaternion(this.camera.quaternion)),ui(this,"moveForward",e=>{ua.setFromMatrixColumn(this.camera.matrix,0),ua.crossVectors(this.camera.up,ua),this.camera.position.addScaledVector(ua,e)}),ui(this,"moveRight",e=>{ua.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(ua,e)}),ui(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),ui(this,"unlock",()=>{this.domElement&&this.domElement.ownerDocument.exitPointerLock()}),this.camera=e,this.domElement=t,this.isLocked=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.pointerSpeed=1,t&&this.connect(t)}}let uh=eD.forwardRef(({domElement:e,selector:t,onChange:r,onLock:i,onUnlock:n,enabled:a=!0,makeDefault:o,...s},l)=>{let{camera:c,...u}=s,h=(0,eR.D)(e=>e.setEvents),A=(0,eR.D)(e=>e.gl),d=(0,eR.D)(e=>e.camera),m=(0,eR.D)(e=>e.invalidate),f=(0,eR.D)(e=>e.events),p=(0,eR.D)(e=>e.get),g=(0,eR.D)(e=>e.set),y=c||d,v=e||f.connected||A.domElement,E=eD.useMemo(()=>new uu(y),[y]);return eD.useEffect(()=>{if(a){E.connect(v);let e=p().events.compute;return h({compute(e,t){let r=t.size.width/2,i=t.size.height/2;t.pointer.set(r/t.size.width*2-1,-(i/t.size.height*2)+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),()=>{E.disconnect(),h({compute:e})}}},[a,E]),eD.useEffect(()=>{let e=e=>{m(),r&&r(e)};E.addEventListener("change",e),i&&E.addEventListener("lock",i),n&&E.addEventListener("unlock",n);let a=()=>E.lock(),o=t?Array.from(document.querySelectorAll(t)):[document];return o.forEach(e=>e&&e.addEventListener("click",a)),()=>{E.removeEventListener("change",e),i&&E.removeEventListener("lock",i),n&&E.removeEventListener("unlock",n),o.forEach(e=>e?e.removeEventListener("click",a):void 0)}},[r,i,n,t,E,m]),eD.useEffect(()=>{if(o){let e=p().controls;return g({controls:E}),()=>g({controls:e})}},[o,E]),eD.createElement("primitive",(0,eS.Z)({ref:l,object:E},u))});var uA=Object.defineProperty,ud=(e,t,r)=>t in e?uA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,um=(e,t,r)=>(ud(e,"symbol"!=typeof t?t+"":t,r),r);let uf=new eT.Pa4;class up extends cy{constructor(e,t){super(),um(this,"object"),um(this,"domElement"),um(this,"enabled",!0),um(this,"movementSpeed",1),um(this,"lookSpeed",.005),um(this,"lookVertical",!0),um(this,"autoForward",!1),um(this,"activeLook",!0),um(this,"heightSpeed",!1),um(this,"height
824Coef",1),um(this,"heightMin",0),um(this,"heightMax",1),um(this,"constrainVertical",!1),um(this,"verticalMin",0),um(this,"verticalMax",Math.PI),um(this,"mouseDragOn",!1),um(this,"autoSpeedFactor",0),um(this,"mouseX",0),um(this,"mouseY",0),um(this,"moveForward",!1),um(this,"moveBackward",!1),um(this,"moveLeft",!1),um(this,"moveRight",!1),um(this,"moveUp",!1),um(this,"moveDown",!1),um(this,"viewHalfX",0),um(this,"viewHalfY",0),um(this,"lat",0),um(this,"lon",0),um(this,"lookDirection",new eT.Pa4),um(this,"spherical",new eT.$V),um(this,"target",new eT.Pa4),um(this,"connect",e=>{e.setAttribute("tabindex","-1"),e.style.touchAction="none",e.addEventListener("contextmenu",this.contextmenu),e.addEventListener("mousemove",this.onMouseMove),e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),this.domElement=e,window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.handleResize()}),um(this,"dispose",()=>{var e,t,r,i;null==(e=this.domElement)||e.removeEventListener("contextmenu",this.contextmenu),null==(t=this.domElement)||t.removeEventListener("mousedown",this.onMouseDown),null==(r=this.domElement)||r.removeEventListener("mousemove",this.onMouseMove),null==(i=this.domElement)||i.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp)}),um(this,"handleResize",()=>{this.domElement&&(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2)}),um(this,"onMouseDown",e=>{var t;if(null==(t=this.domElement)||t.focus(),this.activeLook)switch(e.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0}),um(this,"onMouseUp",e=>{if(this.activeLook)switch(e.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1}),um(this,"onMouseMove",e=>{this.domElement&&(this.mouseX=e.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=e.pageY-this.domElement.offsetTop-this.viewHalfY)}),um(this,"onKeyDown",e=>{switch(e.code){case"ArrowUp":case"KeyW":this.moveForward=!0;break;case"ArrowLeft":case"KeyA":this.moveLeft=!0;break;case"ArrowDown":case"KeyS":this.moveBackward=!0;break;case"ArrowRight":case"KeyD":this.moveRight=!0;break;case"KeyR":this.moveUp=!0;break;case"KeyF":this.moveDown=!0}}),um(this,"onKeyUp",e=>{switch(e.code){case"ArrowUp":case"KeyW":this.moveForward=!1;break;case"ArrowLeft":case"KeyA":this.moveLeft=!1;break;case"ArrowDown":case"KeyS":this.moveBackward=!1;break;case"ArrowRight":case"KeyD":this.moveRight=!1;break;case"KeyR":this.moveUp=!1;break;case"KeyF":this.moveDown=!1}}),um(this,"lookAt",(e,t,r)=>(e instanceof eT.Pa4?this.target.copy(e):t&&r&&this.target.set(e,t,r),this.object.lookAt(this.target),this.setOrientation(),this)),um(this,"update",e=>{if(!this.enabled)return;if(this.heightSpeed){let t=eT.M8C.clamp(this.object.position.y,this.heightMin,this.heightMax)-this.heightMin;this.autoSpeedFactor=t*this.heightCoef*e}else this.autoSpeedFactor=0;let t=e*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.object.translateZ(-(t+this.autoSpeedFactor)),this.moveBackward&&this.object.translateZ(t),this.moveLeft&&this.object.translateX(-t),this.moveRight&&this.object.translateX(t),this.moveUp&&this.object.translateY(t),this.moveDown&&this.object.translateY(-t);let r=e*this.lookSpeed;this.activeLook||(r=0);let i=1;this.constrainVertical&&(i=Math.PI/(this.verticalMax-this.verticalMin)),this.lon-=this.mouseX*r,this.lookVertical&&(this.lat-=this.mouseY*r*i),this.lat=Math.max(-85,Math.min(85,this.lat));let n=eT.M8C.degToRad(90-this.lat),a=eT.M8C.degToRad(this.lon);this.constrainVertical&&(n=eT.M8C.mapLinear(n,0,Math.PI,this.verticalMin,this.verticalMax));let o=this.object.position;uf.setFromSphericalCoords(1,n,a).add(o),this.object.lookAt(uf)}),um(this,"contextmenu",e=>e.preventDefault()),um(this,"setOrientation",()=>{this.lookDirection.set(0,0,-1).applyQuaternion(this.object.quaternion),this.spherical.setFromVector3(this.lookDirection),this.lat=90-eT.M8C.radToDeg(this.spherical.phi),this.lon=eT.M8C.radToDeg(this.spherical.theta)}),this.object=e,this.domElement=t,this.setOrientation(),t&&this.connect(t)}}let ug=eD.forwardRef(({domElement:e,makeDefault:t,...r},i)=>{let n=(0,eR.D)(e=>e.camera),a=(0,eR.D)(e=>e.gl),o=(0,eR.D)(e=>e.events),s=(0,eR.D)(e=>e.get),l=(0,eR.D)(e=>e.set),c=e||o.connected||a.domElement,[u]=eD.useState(()=>new up(n,c));return eD.useEffect(()=>{if(t){let e=s().controls;return l({controls:u}),()=>l({controls:e})}},[t,u]),(0,eR.F)((e,t)=>{u.update(t)},-1),u?eD.createElement("primitive",(0,eS.Z)({ref:i,object:u},r)):null}),uy={LEFT:1,RIGHT:2,MIDDLE:4},uv=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,SCREEN_PAN:4,OFFSET:8,DOLLY:16,ZOOM:32,TOUCH_ROTATE:64,TOUCH_TRUCK:128,TOUCH_SCREEN_PAN:256,TOUCH_OFFSET:512,TOUCH_DOLLY:1024,TOUCH_ZOOM:2048,TOUCH_DOLLY_TRUCK:4096,TOUCH_DOLLY_SCREEN_PAN:8192,TOUCH_DOLLY_OFFSET:16384,TOUCH_DOLLY_ROTATE:32768,TOUCH_ZOOM_TRUCK:65536,TOUCH_ZOOM_OFFSET:131072,TOUCH_ZOOM_SCREEN_PAN:262144,TOUCH_ZOOM_ROTATE:524288}),uE={NONE:0,IN:1,OUT:-1};function ux(e){return e.isPerspectiveCamera}function uC(e){return e.isOrthographicCamera}let uw=2*Math.PI,uB=Math.PI/2,uI=Math.PI/180;function u_(e,t,r){return Math.max(t,Math.min(r,e))}function ub(e,t=1e-5){return Math.abs(e)<t}function uM(e,t,r=1e-5){return ub(e-t,r)}function uS(e,t){return Math.round(e/t)*t}function uD(e){return isFinite(e)?e:e<0?-Number.MAX_VALUE:Number.MAX_VALUE}function uP(e){return Math.abs(e)<Number.MAX_VALUE?e:1/0*e}function uT(e,t,r,i,n=1/0,a){let o=2/(i=Math.max(1e-4,i)),s=o*a,l=1/(1+s+.48*s*s+.235*s*s*s),c=e-t,u=t,h=n*i;t=e-(c=u_(c,-h,h));let A=(r.value+o*c)*a;r.value=(r.value-o*A)*l;let d=t+(c+A)*l;return u-e>0==d>
824u&&(d=u,r.value=(d-u)/a),d}function uR(e,t,r,i,n=1/0,a,o){let s=2/(i=Math.max(1e-4,i)),l=s*a,c=1/(1+l+.48*l*l+.235*l*l*l),u=t.x,h=t.y,A=t.z,d=e.x-u,m=e.y-h,f=e.z-A,p=u,g=h,y=A,v=n*i,E=d*d+m*m+f*f;if(E>v*v){let e=Math.sqrt(E);d=d/e*v,m=m/e*v,f=f/e*v}u=e.x-d,h=e.y-m,A=e.z-f;let x=(r.x+s*d)*a,C=(r.y+s*m)*a,w=(r.z+s*f)*a;r.x=(r.x-s*x)*c,r.y=(r.y-s*C)*c,r.z=(r.z-s*w)*c,o.x=u+(d+x)*c,o.y=h+(m+C)*c,o.z=A+(f+w)*c;let B=p-e.x,I=g-e.y,_=y-e.z;return B*(o.x-p)+I*(o.y-g)+_*(o.z-y)>0&&(o.x=p,o.y=g,o.z=y,r.x=(o.x-p)/a,r.y=(o.y-g)/a,r.z=(o.z-y)/a),o}function uF(e,t){t.set(0,0),e.forEach(e=>{t.x+=e.clientX,t.y+=e.clientY}),t.x/=e.length,t.y/=e.length}function uQ(e,t){return!!uC(e)&&(console.warn(`${t} is not supported in OrthographicCamera`),!0)}class uz{constructor(){this._listeners={}}addEventListener(e,t){let r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)}hasEventListener(e,t){let r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)}removeEventListener(e,t){let r=this._listeners[e];if(void 0!==r){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){let t=this._listeners[e.type];if(void 0!==t){e.target=this;let r=t.slice(0);for(let t=0,i=r.length;t<i;t++)r[t].call(this,e)}}}let uk=1/8,uL=/Mac/.test(null===(e_=null==globalThis?void 0:globalThis.navigator)||void 0===e_?void 0:e_.platform);class uO extends uz{static install(e){s=Object.freeze(new(o=e.THREE).Vector3(0,0,0)),l=Object.freeze(new o.Vector3(0,1,0)),c=Object.freeze(new o.Vector3(0,0,1)),u=new o.Vector2,h=new o.Vector3,A=new o.Vector3,d=new o.Vector3,m=new o.Vector3,f=new o.Vector3,p=new o.Vector3,g=new o.Vector3,y=new o.Vector3,v=new o.Vector3,E=new o.Spherical,x=new o.Spherical,C=new o.Box3,w=new o.Box3,B=new o.Sphere,I=new o.Quaternion,_=new o.Quaternion,b=new o.Matrix4,M=new o.Raycaster}static get ACTION(){return uv}set verticalDragToForward(e){console.warn("camera-controls: `verticalDragToForward` was removed. Use `mouseButtons.left = CameraControls.ACTION.SCREEN_PAN` instead.")}constructor(e,t){super(),this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minDistance=Number.EPSILON,this.maxDistance=1/0,this.infinityDolly=!1,this.minZoom=.01,this.maxZoom=1/0,this.smoothTime=.25,this.draggingSmoothTime=.125,this.maxSpeed=1/0,this.azimuthRotateSpeed=1,this.polarRotateSpeed=1,this.dollySpeed=1,this.dollyDragInverted=!1,this.truckSpeed=2,this.dollyToCursor=!1,this.dragToOffset=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=uv.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=uE.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new o.Vector3,this._focalOffsetVelocity=new o.Vector3,this._zoomVelocity={value:0},this._truckInternal=(e,t,r,i)=>{let n,a;if(ux(this._camera)){let r=h.copy(this._camera.position).sub(this._target),i=this._camera.getEffectiveFOV()*uI,o=r.length()*Math.tan(.5*i);n=this.truckSpeed*e*o/this._elementRect.height,a=this.truckSpeed*t*o/this._elementRect.height}else{if(!uC(this._camera))return;let r=this._camera;n=this.truckSpeed*e*(r.right-r.left)/r.zoom/this._elementRect.width,a=this.truckSpeed*t*(r.top-r.bottom)/r.zoom/this._elementRect.height}i?(r?this.setFocalOffset(this._focalOffsetEnd.x+n,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(n,0,!0),this.forward(-a,!0)):r?this.setFocalOffset(this._focalOffsetEnd.x+n,this._focalOffsetEnd.y+a,this._focalOffsetEnd.z,!0):this.truck(n,a,!0)},this._rotateInternal=(e,t)=>{let r=uw*this.azimuthRotateSpeed*e/this._elementRect.height,i=uw*this.polarRotateSpeed*t/this._elementRect.height;this.rotate(r,i,!0)},this._dollyInternal=(e,t,r)=>{let i=Math.pow(.95,-e*this.dollySpeed),n=this._sphericalEnd.radius,a=this._sphericalEnd.radius*i,o=u_(a,this.minDistance,this.maxDistance);this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(a,!0):(this.infinityDolly&&!this.dollyToCursor&&this.dollyInFixed(o-a,!0),this._dollyToNoClamp(o,!0)),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?a:o)-n,this._dollyControlCo
824ord.set(t,r)),this._lastDollyDirection=Math.sign(-e)},this._zoomInternal=(e,t,r)=>{let i=Math.pow(.95,e*this.dollySpeed),n=this._zoom,a=this._zoom*i;this.zoomTo(a,!0),this.dollyToCursor&&(this._changedZoom+=a-n,this._dollyControlCoord.set(t,r))},void 0===o&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new o.Quaternion().setFromUnitVectors(this._camera.up,l),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=uv.NONE,this._target=new o.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new o.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new o.Spherical().setFromVector3(h.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new o.Vector3,new o.Vector3,new o.Vector3,new o.Vector3],this._updateNearPlaneCorners(),this._boundary=new o.Box3(new o.Vector3(-1/0,-1/0,-1/0),new o.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new o.Vector2,this.mouseButtons={left:uv.ROTATE,middle:uv.DOLLY,right:uv.TRUCK,wheel:ux(this._camera)?uv.DOLLY:uC(this._camera)?uv.ZOOM:uv.NONE},this.touches={one:uv.TOUCH_ROTATE,two:ux(this._camera)?uv.TOUCH_DOLLY_TRUCK:uC(this._camera)?uv.TOUCH_ZOOM_TRUCK:uv.NONE,three:uv.TOUCH_TRUCK};let r=new o.Vector2,i=new o.Vector2,n=new o.Vector2,a=e=>{if(!this._enabled||!this._domElement)return;if(0!==this._interactiveArea.left||0!==this._interactiveArea.top||1!==this._interactiveArea.width||1!==this._interactiveArea.height){let t=this._domElement.getBoundingClientRect(),r=e.clientX/t.width,i=e.clientY/t.height;if(r<this._interactiveArea.left||r>this._interactiveArea.right||i<this._interactiveArea.top||i>this._interactiveArea.bottom)return}let t="mouse"!==e.pointerType?null:(e.buttons&uy.LEFT)===uy.LEFT?uy.LEFT:(e.buttons&uy.MIDDLE)===uy.MIDDLE?uy.MIDDLE:(e.buttons&uy.RIGHT)===uy.RIGHT?uy.RIGHT:null;if(null!==t){let e=this._findPointerByMouseButton(t);e&&this._disposePointer(e)}if((e.buttons&uy.LEFT)===uy.LEFT&&this._lockedPointer)return;let r={pointerId:e.pointerId,clientX:e.clientX,clientY:e.clientY,deltaX:0,deltaY:0,mouseButton:t};this._activePointers.push(r),this._domElement.ownerDocument.removeEventListener("pointermove",s,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this._domElement.ownerDocument.addEventListener("pointermove",s,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",c),this._isDragging=!0,f(e)},s=e=>{e.cancelable&&e.preventDefault();let t=e.pointerId,r=this._lockedPointer||this._findPointerById(t);if(r){if(r.clientX=e.clientX,r.clientY=e.clientY,r.deltaX=e.movementX,r.deltaY=e.movementY,this._state=0,"touch"===e.pointerType)switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(e.buttons&uy.LEFT)===uy.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(e.buttons&uy.MIDDLE)===uy.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(e.buttons&uy.RIGHT)===uy.RIGHT&&(this._state=this._state|this.mouseButtons.right);p()}},c=e=>{let t=this._findPointerById(e.pointerId);if(!t||t!==this._lockedPointer){if(t&&this._disposePointer(t),"touch"===e.pointerType)switch(this._activePointers.length){case 0:this._state=uv.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three}else this._state=uv.NONE;g()}},A=-1,d=e=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===uv.NONE)return;if(0!==this._interactiveArea.left||0!==this._interactiveArea.top||1!==this._interactiveArea.width||1!==this._interactiveArea.height){let t=this._domElement.getBoundingClientRect(),r=e.clientX/t.width,i=e.clientY/t.height;if(r<this._interactiveArea.left||r>
824this._interactiveArea.right||i<this._interactiveArea.top||i>this._interactiveArea.bottom)return}if(e.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===uv.ROTATE||this.mouseButtons.wheel===uv.TRUCK){let e=performance.now();A-e<1e3&&this._getClientRect(this._elementRect),A=e}let t=uL?-1:-3,r=1===e.deltaMode||e.ctrlKey?e.deltaY/t:e.deltaY/(10*t),i=this.dollyToCursor?(e.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,n=this.dollyToCursor?-((e.clientY-this._elementRect.y)/this._elementRect.height*2)+1:0;switch(this.mouseButtons.wheel){case uv.ROTATE:this._rotateInternal(e.deltaX,e.deltaY),this._isUserControllingRotate=!0;break;case uv.TRUCK:this._truckInternal(e.deltaX,e.deltaY,!1,!1),this._isUserControllingTruck=!0;break;case uv.SCREEN_PAN:this._truckInternal(e.deltaX,e.deltaY,!1,!0),this._isUserControllingTruck=!0;break;case uv.OFFSET:this._truckInternal(e.deltaX,e.deltaY,!0,!1),this._isUserControllingOffset=!0;break;case uv.DOLLY:this._dollyInternal(-r,i,n),this._isUserControllingDolly=!0;break;case uv.ZOOM:this._zoomInternal(-r,i,n),this._isUserControllingZoom=!0}this.dispatchEvent({type:"control"})},m=e=>{if(this._domElement&&this._enabled){if(this.mouseButtons.right===uO.ACTION.NONE){let t=e instanceof PointerEvent?e.pointerId:0,r=this._findPointerById(t);r&&this._disposePointer(r),this._domElement.ownerDocument.removeEventListener("pointermove",s,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c);return}e.preventDefault()}},f=e=>{if(this._enabled){if(uF(this._activePointers,u),this._getClientRect(this._elementRect),r.copy(u),i.copy(u),this._activePointers.length>=2){let e=u.x-this._activePointers[1].clientX,t=u.y-this._activePointers[1].clientY;n.set(0,Math.sqrt(e*e+t*t));let r=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,a=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;i.set(r,a)}if(this._state=0,e){if("pointerType"in e&&"touch"===e.pointerType)switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three}else this._lockedPointer||(e.buttons&uy.LEFT)!==uy.LEFT||(this._state=this._state|this.mouseButtons.left),(e.buttons&uy.MIDDLE)===uy.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(e.buttons&uy.RIGHT)===uy.RIGHT&&(this._state=this._state|this.mouseButtons.right)}else this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);((this._state&uv.ROTATE)===uv.ROTATE||(this._state&uv.TOUCH_ROTATE)===uv.TOUCH_ROTATE||(this._state&uv.TOUCH_DOLLY_ROTATE)===uv.TOUCH_DOLLY_ROTATE||(this._state&uv.TOUCH_ZOOM_ROTATE)===uv.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&uv.TRUCK)===uv.TRUCK||(this._state&uv.SCREEN_PAN)===uv.SCREEN_PAN||(this._state&uv.TOUCH_TRUCK)===uv.TOUCH_TRUCK||(this._state&uv.TOUCH_SCREEN_PAN)===uv.TOUCH_SCREEN_PAN||(this._state&uv.TOUCH_DOLLY_TRUCK)===uv.TOUCH_DOLLY_TRUCK||(this._state&uv.TOUCH_DOLLY_SCREEN_PAN)===uv.TOUCH_DOLLY_SCREEN_PAN||(this._state&uv.TOUCH_ZOOM_TRUCK)===uv.TOUCH_ZOOM_TRUCK||(this._state&uv.TOUCH_ZOOM_SCREEN_PAN)===uv.TOUCH_DOLLY_SCREEN_PAN)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&uv.DOLLY)===uv.DOLLY||(this._state&uv.TOUCH_DOLLY)===uv.TOUCH_DOLLY||(this._state&uv.TOUCH_DOLLY_TRUCK)===uv.TOUCH_DOLLY_TRUCK||(this._state&uv.TOUCH_DOLLY_SCREEN_PAN)===uv.TOUCH_DOLLY_SCREEN_PAN||(this._state&uv.TOUCH_DOLLY_OFFSET)===uv.TOUCH_DOLLY_OFFSET||(this._state&uv.TOUCH_DOLLY_ROTATE)===uv.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&uv.ZOOM)===uv.ZOOM||(this._state&uv.TOUCH_ZOOM)===uv.TOUCH_ZOOM||(this._state&uv.TOUCH_ZOOM_TRUCK)===uv.TOUCH_ZOOM_TRUCK||(this._state&uv.TOUCH_ZOOM_SCREEN_PAN)===uv.TOUCH_ZOOM_SCREEN_PAN||(this._state&uv.TOUCH_ZOOM_OFFSET)===uv.TOUCH_ZOOM_OFFSET||(this._state&uv.TOUCH_ZOOM_ROTATE)===uv.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&uv.OFFSET)===uv.OFFSET||(this._state&uv.TOUCH_OFFSET)===uv.TOUCH_OFFSET||(this._state&uv.TOUCH_DOLLY_OFFSET)===uv.TOUCH_DOLLY_OFFSET||(this._state&uv.TOUCH_ZOOM_OFFSET)===uv.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})}},p=()=>
824{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,uF(this._activePointers,u);let e=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,t=e?-e.deltaX:i.x-u.x,a=e?-e.deltaY:i.y-u.y;if(i.copy(u),((this._state&uv.ROTATE)===uv.ROTATE||(this._state&uv.TOUCH_ROTATE)===uv.TOUCH_ROTATE||(this._state&uv.TOUCH_DOLLY_ROTATE)===uv.TOUCH_DOLLY_ROTATE||(this._state&uv.TOUCH_ZOOM_ROTATE)===uv.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(t,a),this._isUserControllingRotate=!0),(this._state&uv.DOLLY)===uv.DOLLY||(this._state&uv.ZOOM)===uv.ZOOM){let e=this.dollyToCursor?(r.x-this._elementRect.x)/this._elementRect.width*2-1:0,t=this.dollyToCursor?-((r.y-this._elementRect.y)/this._elementRect.height*2)+1:0,i=this.dollyDragInverted?-1:1;(this._state&uv.DOLLY)===uv.DOLLY?(this._dollyInternal(i*a*uk,e,t),this._isUserControllingDolly=!0):(this._zoomInternal(i*a*uk,e,t),this._isUserControllingZoom=!0)}if((this._state&uv.TOUCH_DOLLY)===uv.TOUCH_DOLLY||(this._state&uv.TOUCH_ZOOM)===uv.TOUCH_ZOOM||(this._state&uv.TOUCH_DOLLY_TRUCK)===uv.TOUCH_DOLLY_TRUCK||(this._state&uv.TOUCH_ZOOM_TRUCK)===uv.TOUCH_ZOOM_TRUCK||(this._state&uv.TOUCH_DOLLY_SCREEN_PAN)===uv.TOUCH_DOLLY_SCREEN_PAN||(this._state&uv.TOUCH_ZOOM_SCREEN_PAN)===uv.TOUCH_ZOOM_SCREEN_PAN||(this._state&uv.TOUCH_DOLLY_OFFSET)===uv.TOUCH_DOLLY_OFFSET||(this._state&uv.TOUCH_ZOOM_OFFSET)===uv.TOUCH_ZOOM_OFFSET||(this._state&uv.TOUCH_DOLLY_ROTATE)===uv.TOUCH_DOLLY_ROTATE||(this._state&uv.TOUCH_ZOOM_ROTATE)===uv.TOUCH_ZOOM_ROTATE){let e=u.x-this._activePointers[1].clientX,t=u.y-this._activePointers[1].clientY,r=Math.sqrt(e*e+t*t),a=n.y-r;n.set(0,r);let o=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,s=this.dollyToCursor?-((i.y-this._elementRect.y)/this._elementRect.height*2)+1:0;(this._state&uv.TOUCH_DOLLY)===uv.TOUCH_DOLLY||(this._state&uv.TOUCH_DOLLY_ROTATE)===uv.TOUCH_DOLLY_ROTATE||(this._state&uv.TOUCH_DOLLY_TRUCK)===uv.TOUCH_DOLLY_TRUCK||(this._state&uv.TOUCH_DOLLY_SCREEN_PAN)===uv.TOUCH_DOLLY_SCREEN_PAN||(this._state&uv.TOUCH_DOLLY_OFFSET)===uv.TOUCH_DOLLY_OFFSET?(this._dollyInternal(a*uk,o,s),this._isUserControllingDolly=!0):(this._zoomInternal(a*uk,o,s),this._isUserControllingZoom=!0)}((this._state&uv.TRUCK)===uv.TRUCK||(this._state&uv.TOUCH_TRUCK)===uv.TOUCH_TRUCK||(this._state&uv.TOUCH_DOLLY_TRUCK)===uv.TOUCH_DOLLY_TRUCK||(this._state&uv.TOUCH_ZOOM_TRUCK)===uv.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(t,a,!1,!1),this._isUserControllingTruck=!0),((this._state&uv.SCREEN_PAN)===uv.SCREEN_PAN||(this._state&uv.TOUCH_SCREEN_PAN)===uv.TOUCH_SCREEN_PAN||(this._state&uv.TOUCH_DOLLY_SCREEN_PAN)===uv.TOUCH_DOLLY_SCREEN_PAN||(this._state&uv.TOUCH_ZOOM_SCREEN_PAN)===uv.TOUCH_ZOOM_SCREEN_PAN)&&(this._truckInternal(t,a,!1,!0),this._isUserControllingTruck=!0),((this._state&uv.OFFSET)===uv.OFFSET||(this._state&uv.TOUCH_OFFSET)===uv.TOUCH_OFFSET||(this._state&uv.TOUCH_DOLLY_OFFSET)===uv.TOUCH_DOLLY_OFFSET||(this._state&uv.TOUCH_ZOOM_OFFSET)===uv.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(t,a,!0,!1),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},g=()=>{uF(this._activePointers,u),i.copy(u),this._dragNeedsUpdate=!1,(0===this._activePointers.length||1===this._activePointers.length&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),0===this._activePointers.length&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",s,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{this._enabled&&this._domElement&&(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",s,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",y),this._domElement.ownerDocument.addEventListener("pointerlockerror",v),this._domElement.ownerDocument.addEventListener("pointermove",s,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",c),f())},this.unlockPointer=()=>{var e,t,r;null!==this._lockedPointer&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),null===(e=this._domElement)||void 0===e||e.ownerDocument.exitPointerLock(),null===(t=this._domElement)||void 0===t||t.ownerDocument.removeEventListener("pointerlockchange",y),null===(r=this._domElement)||void 0===r||r.ownerDocument.removeEventListener("pointerlockerror",v),this.cancel()};let y=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},v=()=>{this.unlockPointer()};this._addAllEventListeners=e=>{this._domElement=e,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",a),this._domElement.addEventListener("pointercancel",c),this._domElement.addEventListener("wheel",d,{passive:!1}),this._domElement.addEventListener("contextmenu",m)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",a),this._domElement.removeEventListener("pointercancel",c),this._domElement.removeEventListener("wheel",d,{passive:!1}),this._domElement.removeEventListener("contextmenu",m),this._domElement.ownerDocument.removeEventListener("pointermove",s,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this._domElement.ownerDocument.removeEventListener("pointerlockchange",y),this._domElement.ownerDocument.removeEventListener("pointerlockerror",v))},this.cancel=()=>{this._state!==uv.NONE&&(this._state=uv.NONE,this._activePointers.length=0,g())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}
vendor: 7,400 bytes, line 824
824get distance(){return this._spherical.radius}set distance(e){(this._spherical.radius!==e||this._sphericalEnd.radius!==e)&&(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){(this._spherical.theta!==e||this._sphericalEnd.theta!==e)&&(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){(this._spherical.phi!==e||this._sphericalEnd.phi!==e)&&(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=u_(e.width,0,1),this._interactiveArea.height=u_(e.height,0,1),this._interactiveArea.x=u_(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=u_(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,r=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,r)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,r=!1){this._isUserControllingRotate=!1;let i=u_(e,this.minAzimuthAngle,this.maxAzimuthAngle),n=u_(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=n,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,r||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);let a=!r||uM(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&uM(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(a)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=uE.NONE,this._changedDolly=0,this._dollyToNoClamp(u_(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){let r=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){let t=this._collisionTest(),i=uM(t,this._spherical.radius);if(!(r>e)&&i)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,t)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);let i=!t||uM(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(i)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(m).multiplyScalar(e)),t||this._target.copy(this._targetEnd);let r=!t||uM(this._target.x,this._targetEnd.x,this.restThreshold)&&uM(this._target.y,this._targetEnd.y,this.restThreshold)&&uM(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=u_(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);let r=!t||uM(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(r)}pan(e,t,r=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,r)}truck(e,t,r=!1){this._camera.updateMatrix(),f.setFromMatrixColumn(this._camera.matrix,0),p.setFromMatrixColumn(this._camera.matrix,1),f.multiplyScalar(e),p.multiplyScalar(-t);let i=h.copy(f).add(p),n=A.copy(this._targetEnd).add(i);return this.moveTo(n.x,n.y,n.z,r)}forward(e,t=!1){h.setFromMatrixColumn(this._camera.matrix,0),h.crossVectors(this._camera.up,h),h.multiplyScalar(e);let r=A.copy(this._targetEnd).add(h);return this.moveTo(r.x,r.y,r.z,t)}elevate(e,t=!1){return h.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+h.x,this._targetEnd.y+h.y,this._targetEnd.z+h.z,t)}moveTo(e,t,r,i=!1){this._isUserControllingTruck=!1;let n=h.set(e,t,r).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,n,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);let a=!i||uM(this._target.x,this._targetEnd.x,this.restThreshold)&&uM(this._target.y,this._targetEnd.y,this.restThreshold)&&uM(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(a)}lookInDirectionOf(e,t,r,i=!1){let n=h.set(e,t,r).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);return this.setPosition(n.x,n.y,n.z,i)}fitToBox(e,t,{cover:r=!1,paddingLeft:i=0,paddingRight:n=0,paddingBottom:a=0,paddingTop:o=0}={}){let s=[],u=e.isBox3?C.copy(e):C.setFromObject(e);u.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());let d=uS(this._sphericalEnd.theta,uB),m=uS(this._sphericalEnd.phi,uB);s.push(this.rotateTo(d,m,t));let f=h.setFromSpherical(this._sphericalEnd).normalize(),p=I.setFromUnitVectors(f,c),g=uM(Math.abs(f.y),1);g&&p.multiply(_.setFromAxisAngle(l,d)),p.multiply(this._yAxisUpSpaceInverse);let y=w.makeEmpty();A.copy(u.min).applyQuaternion(p),y.expandByPoint(A),A.copy(u.min).setX(u.max.x).applyQuaternion(p),y.expandByPoint(A),A.copy(u.min).setY(u.max.y).applyQuaternion(p),y.expandByPoint(A),A.copy(u.max).setZ(u.min.z).applyQuaternion(p),y.expandByPoint(A),A.copy(u.min).setZ(u.max.z).applyQuaternion(p),y.expandByPoint(A),A.copy(u.max).setY(u.min.y).applyQuaternion(p),y.expandByPoint(A),A.copy(u.max).setX(u.min.x).applyQuaternion(p),y.expandByPoint(A),A.copy(u.max).applyQuaternion(p),y.expandByPoint(A),y.min.x-=i,y.min.y-=a,y.max.x+=n,y.max.y+=o,p.setFromUnitVectors(c,f),g&&p.premultiply(_.invert()),p.premultiply(this._yAxisUpSpace);let v=y.getSize(h),E=y.getCenter(A).applyQuaternion(p);if(ux(this._camera)){let e=this.getDistanceToFitBox(v.x,v.y,v.z,r);s.push(this.moveTo(E.x,E.y,E.z,t)),s.push(this.dollyTo(e,t)),s.push(this.setFocalOffset(0,0,0,t))}else if(uC(this._camera)){let e=this._camera,i=e.right-e.left,n=e.top-e.bottom,a=r?Math.max(i/v.x,n/v.y):Math.min(i/v.x,n/v.y);s.push(this.moveTo(E.x,E.y,E.z,t)),s.push(this.zoomTo(a,t)),s.push(this.setFocalOffset(0,0,0,t))}return Promise.all(s)}fitToSphere(e,t){let r=[],i="isObject3D"in e?uO.createBoundingSphere(e,B):B.copy(e);if(r.push(this.moveTo(i.center.x,i.center.y,i.center.z,t)),ux(this._camera)){let e=this.getDistanceToFitSphere(i.radius);r.push(this.dollyTo(e,t))}else if(uC(this._camera)){let e=this._camera.right-this._camera.left,n=this._camera.top-this._camera.bottom,a=2*i.radius;r.push(this.zoomTo(Math.min(e/a,n/a),t))}return r.push(this.setFocalOffset(0,0,0,t)),Promise.all(r)}setLookAt(e,t,r,i,n,a,o=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=uE.NONE,this._changedDolly=0;let s=A.set(i,n,a),l=h.set(e,t,r);this._targetEnd.copy(s),this._sphericalEnd.setFromVector3(l.sub(s).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,o||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));let c=!o||uM(this._target.x,this._targetEnd.x,this.restThreshold)&&uM(this._target.y,this._targetEnd.y,this.restThreshold)&&uM(this._target.z,this._targetEnd.z,this.restThreshold)&&uM(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&uM(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&uM(this._spherical.radiu
824s,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(c)}lerpLookAt(e,t,r,i,n,a,o,s,l,c,u,m,f,p=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=uE.NONE,this._changedDolly=0;let g=h.set(i,n,a),y=A.set(e,t,r);E.setFromVector3(y.sub(g).applyQuaternion(this._yAxisUpSpace));let v=d.set(c,u,m),C=A.set(o,s,l);x.setFromVector3(C.sub(v).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(g.lerp(v,f));let w=x.theta-E.theta,B=x.phi-E.phi,I=x.radius-E.radius;this._sphericalEnd.set(E.radius+I*f,E.phi+B*f,E.theta+w*f),this.normalizeRotations(),this._needsUpdate=!0,p||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));let _=!p||uM(this._target.x,this._targetEnd.x,this.restThreshold)&&uM(this._target.y,this._targetEnd.y,this.restThreshold)&&uM(this._target.z,this._targetEnd.z,this.restThreshold)&&uM(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&uM(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&uM(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(_)}setPosition(e,t,r,i=!1){return this.setLookAt(e,t,r,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}setTarget(e,t,r,i=!1){let n=this.getPosition(h),a=this.setLookAt(n.x,n.y,n.z,e,t,r,i);return this._sphericalEnd.phi=u_(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),a}setFocalOffset(e,t,r,i=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,r),this._needsUpdate=!0,i||this._focalOffset.copy(this._focalOffsetEnd);let n=!i||uM(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&uM(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&uM(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}setOrbitPoint(e,t,r){this._camera.updateMatrixWorld(),f.setFromMatrixColumn(this._camera.matrixWorldInverse,0),p.setFromMatrixColumn(this._camera.matrixWorldInverse,1),g.setFromMatrixColumn(this._camera.matrixWorldInverse,2);let i=h.set(e,t,r),n=i.distanceTo(this._camera.position),a=i.sub(this._camera.position);f.multiplyScalar(a.x),p.multiplyScalar(a.y),g.multiplyScalar(a.z),h.copy(f).add(p).add(g),h.z=h.z+n,this.dollyTo(n,!1),this.setFocalOffset(-h.x,h.y,-h.z,!1),this.moveTo(e,t,r,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,r,i){if(null===e){this._viewport=null;return}this._viewport=this._viewport||new o.Vector4,"number"==typeof e?this._viewport.set(e,t,r,i):this._viewport.copy(e)}getDistanceToFitBox(e,t,r,i=!1){if(uQ(this._camera,"getDistanceToFitBox"))return this._spherical.radius;let n=e/t,a=this._camera.getEffectiveFOV()*uI,o=this._camera.aspect;return .5*((i?n>o:n<o)?t:e/o)/Math.tan(.5*a)+.5*r}getDistanceToFitSphere(e){if(uQ(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;let t=this._camera.getEffectiveFOV()*uI,r=2*Math.atan(Math.tan(.5*t)*this._camera.aspect);return e/Math.sin(.5*(1<this._camera.aspect?t:r))}getTarget(e,t=!0){return(e&&e.isVector3?e:new o.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new o.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e||new o.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new o.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%uw,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=uw),this._spherical.theta+=uw*Math.round((this._sphericalEnd.theta-this._spherical.theta)/uw)}stop(){this._focalOffset.copy(this._focalOffsetEnd),this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd),this._zoom=this._zoomEnd}reset(e=!1){if(!uM(this._camera.up.x,this._cameraUp0.x)||!uM(this._camera.up.y,this._cameraUp0.y)||!uM(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);let e=this.getPosition(h);this.updateCameraUp(),this.setPosition(e.x,e.y,e.z)}return Promise.all([this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,e),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,e),this.zoomTo(this._zoom0,e)]
vendor: 4,123 bytes, line 824
824)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,l),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){let e=h.subVectors(this._target,this._camera.position).normalize(),t=A.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();let r=this.getPosition(h);this.updateCameraUp(),this.setPosition(r.x,r.y,r.z)}update(e){let t=this._sphericalEnd.theta-this._spherical.theta,r=this._sphericalEnd.phi-this._spherical.phi,i=this._sphericalEnd.radius-this._spherical.radius,n=y.subVectors(this._targetEnd,this._target),a=v.subVectors(this._focalOffsetEnd,this._focalOffset),o=this._zoomEnd-this._zoom;if(ub(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{let t=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=uT(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,t,1/0,e),this._needsUpdate=!0}if(ub(r))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{let t=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=uT(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,t,1/0,e),this._needsUpdate=!0}if(ub(i))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{let t=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=uT(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,t,this.maxSpeed,e),this._needsUpdate=!0}if(ub(n.x)&&ub(n.y)&&ub(n.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{let t=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;uR(this._target,this._targetEnd,this._targetVelocity,t,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(ub(a.x)&&ub(a.y)&&ub(a.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{let t=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;uR(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,t,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(ub(o))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{let t=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=uT(this._zoom,this._zoomEnd,this._zoomVelocity,t,1/0,e)}if(this.dollyToCursor){if(ux(this._camera)&&0!==this._changedDolly){let e=this._spherical.radius-this._lastDistance,t=this._camera,r=this._getCameraDirection(m),i=h.copy(r).cross(t.up).normalize();0===i.lengthSq()&&(i.x=1);let n=A.crossVectors(i,r),a=this._sphericalEnd.radius*Math.tan(t.getEffectiveFOV()*uI*.5),o=(this._sphericalEnd.radius-e-this._sphericalEnd.radius)/this._sphericalEnd.radius,s=d.copy(this._targetEnd).add(i.multiplyScalar(this._dollyControlCoord.x*a*t.aspect)).add(n.multiplyScalar(this._dollyControlCoord.y*a)),l=h.copy(this._targetEnd).lerp(s,o),c=this._lastDollyDirection===uE.IN&&this._spherical.radius<=this.minDistance,u=this._lastDollyDirection===uE.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(c||u)){this._sphericalEnd.radius-=e,this._spherical.radius-=e;let t=A.copy(r).multiplyScalar(-e);l.add(t)}this._boundary.clampPoint(l,l);let f=A.subVectors(l,this._targetEnd);this._targetEnd.copy(l),this._target.add(f),this._changedDolly-=e,ub(this._changedDolly)&&(this._changedDolly=0)}else if(uC(this._camera)&&0!==this._changedZoom){let e=this._zoom-this._lastZoom,t=this._camera,r=h.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(t.near+t.far)/(t.near-t.far)).unproject(t),i=A.set(0,0,-1).applyQuaternion(t.quaternion),n=d.copy(r).add(i.multiplyScalar(-r.dot(t.up))),a=-(this._zoom-e-this._zoom)/this._zoom,o=this._getCameraDirection(m),s=this._targetEnd.dot(o),l=h.copy(this._targetEnd).lerp(n,a),c=l.dot(o),u=o.multiplyScalar(c-s);l.sub(u),this._boundary.clampPoint(l,l);let f=A.subVectors(l,this._targetEnd);
824this._targetEnd.copy(l),this._target.add(f),this._changedZoom-=e,ub(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;let s=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,s),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),ub(this._focalOffset.x)&&ub(this._focalOffset.y)&&ub(this._focalOffset.z)||(f.setFromMatrixColumn(this._camera.matrix,0),p.setFromMatrixColumn(this._camera.matrix,1),g.setFromMatrixColumn(this._camera.matrix,2),f.multiplyScalar(this._focalOffset.x),p.multiplyScalar(-this._focalOffset.y),g.multiplyScalar(this._focalOffset.z),h.copy(f).add(p).add(g),this._camera.position.add(h),this._camera.updateMatrixWorld()),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),h.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);let l=this._needsUpdate;return l&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):l?(this.dispatchEvent({type:"update"}),ub(t,this.restThreshold)&&ub(r,this.restThreshold)&&ub(i,this.restThreshold)&&ub(n.x,this.restThreshold)&&ub(n.y,this.restThreshold)&&ub(n.z,this.restThreshold)&&ub(a.x,this.restThreshold)&&ub(a.y,this.restThreshold)&&ub(a.z,this.restThreshold)&&ub(o,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!l&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=l,this._needsUpdate=!1,l}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:uD(this.maxDistance),minZoom:this.minZoom,maxZoom:uD(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:uD(this.maxPolarAngle),minAzimuthAngle:uD(this.minAzimuthAngle),maxAzimuthAngle:uD(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,target:this._targetEnd.toArray(),position:h.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(e,t=!1){let r=JSON.parse(e);this.enabled=r.enabled,this.minDistance=r.minDistance,this.maxDistance=uP(r.maxDistance),this.minZoom=r.minZoom,this.maxZoom=uP(r.maxZoom),this.minPolarAngle=r.minPolarAngle,this.maxPolarAngle=uP(r.maxPolarAngle),this.minAzimuthAngle=uP(r.minAzimuthAngle),this.maxAzimuthAngle=uP(r.maxAzimuthAngle),this.smoothTime=r.smoothTime,this.draggingSmoothTime=r.draggingSmoothTime,this.dollySpeed=r.dollySpeed,this.truckSpeed=r.truckSpeed,this.dollyToCursor=r.dollyToCursor,this._target0.fromArray(r.target0),this._position0.fromArray(r.position0),this._zoom0=r.zoom0,this._focalOffset0.fromArray(r.focalOffset0),this.moveTo(r.target[0],r.target[1],r.target[2],t),E.setFromVector3(h.fromArray(r.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(E.theta,E.phi,t),this.dollyTo(E.radius,t),this.zoomTo(r.zoom,t),this.setFocalOffset(r.focalOffset[0],r.focalOffset[1],r.focalOffset[2],t),this._needsUpdate=!0}connect(e){if(this._domElement){console.warn("camera-controls is already connected.");return}e.setAttribute("data-camera-controls-version","2.10.1"),this._addAllEventListeners(e),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(e){return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radiu
824s).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(e){return this._getTargetDirection(e).negate()}_findPointerById(e){return this._activePointers.find(t=>t.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,r){let i=t.lengthSq();if(0===i)return e;let n=A.copy(t).add(e),a=this._boundary.clampPoint(n,d).sub(n),o=a.lengthSq();if(0===o)return e.add(t);if(o===i)return e;if(0===r)return e.add(t).add(a);{let i=1+r*o/t.dot(a);return e.add(A.copy(t).multiplyScalar(i)).add(a.multiplyScalar(1-r))}}_updateNearPlaneCorners(){if(ux(this._camera)){let e=this._camera,t=e.near,r=Math.tan(e.getEffectiveFOV()*uI*.5)*t,i=r*e.aspect;this._nearPlaneCorners[0].set(-i,-r,0),this._nearPlaneCorners[1].set(i,-r,0),this._nearPlaneCorners[2].set(i,r,0),this._nearPlaneCorners[3].set(-i,r,0)}else if(uC(this._camera)){let e=this._camera,t=1/e.zoom,r=e.left*t,i=e.right*t,n=e.top*t,a=e.bottom*t;this._nearPlaneCorners[0].set(r,n,0),this._nearPlaneCorners[1].set(i,n,0),this._nearPlaneCorners[2].set(i,a,0),this._nearPlaneCorners[3].set(r,a,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||uQ(this._camera,"_collisionTest"))return e;let t=this._getTargetDirection(m);b.lookAt(s,t,this._camera.up);for(let r=0;r<4;r++){let i=A.copy(this._nearPlaneCorners[r]);i.applyMatrix4(b);let n=d.addVectors(this._target,i);M.set(n,t),M.far=this._spherical.radius+1;let a=M.intersectObjects(this.colliderMeshes);0!==a.length&&a[0].distance<e&&(e=a[0].distance)}return e}_getClientRect(e){if(!this._domElement)return;let t=this._domElement.getBoundingClientRect();return e.x=t.left,e.y=t.top,this._viewport?(e.x+=this._viewport.x,e.y+=t.height-this._viewport.w-this._viewport.y,e.width=this._viewport.z,e.height=this._viewport.w):(e.width=t.width,e.height=t.height),e}_createOnRestPromise(e){return e?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(e=>{let t=()=>{this.removeEventListener("rest",t),e()};this.addEventListener("rest",t)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new o.Sphere){let r=t.center;C.makeEmpty(),e.traverseVisible(e=>{e.isMesh&&C.expandByObject(e)}),C.getCenter(r);let i=0;return e.traverseVisible(e=>{if(!e.isMesh||!e.geometry)return;let t=e.geometry.clone();t.applyMatrix4(e.matrixWorld);let n=t.attributes.position;for(let e=0,t=n.count;e<t;e++)h.fromBufferAttribute(n,e),i=Math.max(i,r.distanceToSquared(h))}
824),t.radius=Math.sqrt(i),t}}let uU=(0,eD.forwardRef)((e,t)=>{(0,eD.useMemo)(()=>{let e={Box3:eT.ZzF,MathUtils:{clamp:eT.M8C.clamp},Matrix4:eT.yGw,Quaternion:eT._fP,Raycaster:eT.iMs,Sphere:eT.aLr,Spherical:eT.$V,Vector2:eT.FM8,Vector3:eT.Pa4,Vector4:eT.Ltg};uO.install({THREE:e}),(0,eR.e)({CameraControlsImpl:uO})},[]);let{camera:r,domElement:i,makeDefault:n,onStart:a,onEnd:o,onChange:s,regress:l,...c}=e,u=(0,eR.D)(e=>e.camera),h=(0,eR.D)(e=>e.gl),A=(0,eR.D)(e=>e.invalidate),d=(0,eR.D)(e=>e.events),m=(0,eR.D)(e=>e.setEvents),f=(0,eR.D)(e=>e.set),p=(0,eR.D)(e=>e.get),g=(0,eR.D)(e=>e.performance),y=r||u,v=i||d.connected||h.domElement,E=(0,eD.useMemo)(()=>new uO(y),[y]);return(0,eR.F)((e,t)=>{E.enabled&&E.update(t)},-1),(0,eD.useEffect)(()=>(E.connect(v),()=>void E.disconnect()),[v,E]),(0,eD.useEffect)(()=>{let e=e=>{A(),l&&g.regress(),s&&s(e)},t=e=>{a&&a(e)},r=e=>{o&&o(e)};return E.addEventListener("update",e),E.addEventListener("controlstart",t),E.addEventListener("controlend",r),E.addEventListener("control",e),E.addEventListener("transitionstart",e),E.addEventListener("wake",e),()=>{E.removeEventListener("update",e),E.removeEventListener("controlstart",t),E.removeEventListener("controlend",r),E.removeEventListener("control",e),E.removeEventListener("transitionstart",e),E.removeEventListener("wake",e)}},[E,a,o,A,m,l,s]),(0,eD.useEffect)(()=>{if(n){let e=p().controls;return f({controls:E}),()=>f({controls:e})}},[n,E]),eD.createElement("primitive",(0,eS.Z)({ref:t,object:E},c))}),uG=e=>(null==e?void 0:e.current)instanceof eT.Tme,uN=eD.createContext(null);function uH(){let e=eD.useContext(uN);if(!e)throw Error("useMotion hook must be used in a MotionPathControls component.");return e}function uj({points:e=50,color:t="black"}){let{path:r}=uH(),[i,n]=eD.useState([]),a=eD.useMemo(()=>new eT.vBJ({color:t}),[t]),o=eD.useMemo(()=>new eT.xo$(.025,16,16),[]),s=eD.useRef([]);return eD.useEffect(()=>{r.curves!==s.current&&(n(r.getPoints(e)),s.current=r.curves)}),i.map((e,t)=>eD.createElement("mesh",{key:t,material:a,geometry:o,position:[e.x,e.y,e.z]}))}let uJ=eD.forwardRef(({children:e,curves:t=[],debug:r=!1,debugColor:i="black",object:n,focus:a,loop:o=!0,offset:s,smooth:l=!1,eps:c=1e-5,damping:u=.1,focusDamping:h=.1,maxSpeed:A=1/0,...d},m)=>{let{camera:f}=(0,eR.D)(),p=eD.useRef(null),g=eD.useRef(null!=s?s:0),y=eD.useMemo(()=>new eT.Wqd,[]),v=eD.useMemo(()=>({focus:a,object:(null==n?void 0:n.current)instanceof eT.Tme?n:{current:f},path:y,current:g.current,offset:g.current,point:new eT.Pa4,tangent:new eT.Pa4,next:new eT.Pa4}),[a,n]);eD.useLayoutEffect(()=>{var e,r;y.curves=[];let i=t.length>0?t:null!==(e=null==(r=p.current)||null==(r=r.__r3f)?void 0:r.objects)&&void 0!==e?e:[];for(let e=0;e<i.length;e++)y.add(i[e]);if(l){let e=y.getPoints("number"==typeof l?l:1),t=new eT.YT8(e);y.curves=[t]}y.updateArcLengths()}),eD.useImperativeHandle(m,()=>Object.assign(p.current,{motion:v}),[v]),eD.useLayoutEffect(()=>{g.current=rg.repeat(g.current,1)},[s]);let E=eD.useMemo(()=>new eT.Pa4,[]);return(0,eR.F)((e,t)=>{let r=v.offset;if(rW.damp(g,"current",void 0!==s?s:v.current,u,t,A,void 0,c),v.offset=o?rg.repeat(g.current,1):rg.clamp(g.current,0,1),y.getCurveLengths().length>0){y.getPointAt(v.offset,v.point),y.getTangentAt(v.offset,v.tangent).normalize(),y.getPointAt(rg.repeat(g.current-(r-v.offset),1),v.next);let e=(null==n?void 0:n.current)instanceof eT.Tme?n.current:f;e.position.copy(v.point),a&&rW.dampLookAt(e,uG(a)?a.current.getWorldPosition(E):a,h,t,A,void 0,c)}}),eD.createElement("group",(0,eS.Z)({ref:p},d),eD.createElement(uN.Provider,{value:v},e,r&&eD.createElement(uj,{color:i})))});function uV({defaultScene:e,defaultCamera:t,renderPriority:r=1}){let i;let{gl:n,scene:a,camera:o}=(0,eR.D)();return(0,eR.F)(()=>{i=n.autoClear,1===r&&(n.autoClear=!0,n.render(e,t)),n.autoClear=!1,n.clearDepth(),n.render(a,o),n.autoClear=i},r),eD.createElement("group",{onPointerOver:()=>null})}function uK({children:e,renderPriority:t=1}){let{scene:r,camera:i}=(0,eR.D)(),[n]=eD.useState(()=>new eT.xsS);return eD.createElement(eD.Fragment,null,(0,eR.h)(eD.createElement(eD.Fragment,null,e,eD.createElement(uV,{defaultScene:r,defaultCamera:i,renderPri
824ority:t})),n,{events:{priority:t+1}}))}let uY=eD.createContext({}),uW=()=>eD.useContext(uY),uq=2*Math.PI,uX=new eT.Tme,uZ=new eT.yGw,[u$,u1]=[new eT._fP,new eT._fP],u0=new eT.Pa4,u2=new eT.Pa4,u3=e=>"minPolarAngle"in e,u4=e=>"getTarget"in e,u5=({alignment:e="bottom-right",margin:t=[80,80],renderPriority:r=1,onUpdate:i,onTarget:n,children:a})=>{let o=(0,eR.D)(e=>e.size),s=(0,eR.D)(e=>e.camera),l=(0,eR.D)(e=>e.controls),c=(0,eR.D)(e=>e.invalidate),u=eD.useRef(null),h=eD.useRef(null),A=eD.useRef(!1),d=eD.useRef(0),m=eD.useRef(new eT.Pa4(0,0,0)),f=eD.useRef(new eT.Pa4(0,0,0));eD.useEffect(()=>{f.current.copy(s.up),uX.up.copy(s.up)},[s]);let p=eD.useCallback(e=>{A.current=!0,(l||n)&&(m.current=(null==n?void 0:n())||(u4(l)?l.getTarget(m.current):null==l?void 0:l.target)),d.current=s.position.distanceTo(u0),u$.copy(s.quaternion),u2.copy(e).multiplyScalar(d.current).add(u0),uX.lookAt(u2),u1.copy(uX.quaternion),c()},[l,s,n,c]);(0,eR.F)((e,t)=>{if(h.current&&u.current){var r;A.current&&(.01>u$.angleTo(u1)?(A.current=!1,u3(l)&&s.up.copy(f.current)):(u$.rotateTowards(u1,t*uq),s.position.set(0,0,1).applyQuaternion(u$).multiplyScalar(d.current).add(m.current),s.up.set(0,1,0).applyQuaternion(u$).normalize(),s.quaternion.copy(u$),u4(l)&&l.setPosition(s.position.x,s.position.y,s.position.z),i?i():l&&l.update(t),c())),uZ.copy(s.matrix).invert(),null==(r=u.current)||r.quaternion.setFromRotationMatrix(uZ)}});let g=eD.useMemo(()=>({tweenCamera:p}),[p]),[y,v]=t,E=e.endsWith("-center")?0:e.endsWith("-left")?-o.width/2+y:o.width/2-y,x=e.startsWith("center-")?0:e.startsWith("top-")?o.height/2-v:-o.height/2+v;return eD.createElement(uK,{renderPriority:r},eD.createElement(uY.Provider,{value:g},eD.createElement(cu,{makeDefault:!0,ref:h,position:[0,0,200]}),eD.createElement("group",{ref:u,position:[E,x,0]},a)))},u6="#f0f0f0",u8="#999",u9="black",u7="black",he=["Right","Left","Top","Bottom","Front","Back"],ht=e=>new eT.Pa4(...e).multiplyScalar(.38),hr=[[1,1,1],[1,1,-1],[1,-1,1],[1,-1,-1],[-1,1,1],[-1,1,-1],[-1,-1,1],[-1,-1,-1]].map(ht),hi=[.25,.25,.25],hn=[[1,1,0],[1,0,1],[1,0,-1],[1,-1,0],[0,1,1],[0,1,-1],[0,-1,1],[0,-1,-1],[-1,1,0],[-1,0,1],[-1,0,-1],[-1,-1,0]].map(ht),ha=hn.map(e=>e.toArray().map(e=>0==e?.5:.25)),ho=({hover:e,index:t,font:r="20px Inter var, Arial, sans-serif",faces:i=he,color:n=u6,hoverColor:a=u8,textColor:o=u9,strokeColor:s=u7,opacity:l=1})=>{let c=(0,eR.D)(e=>e.gl),u=eD.useMemo(()=>{let e=document.createElement("canvas");e.width=128,e.height=128;let a=e.getContext("2d");return a.fillStyle=n,a.fillRect(0,0,e.width,e.height),a.strokeStyle=s,a.strokeRect(0,0,e.width,e.height),a.font=r,a.textAlign="center",a.fillStyle=o,a.fillText(i[t].toUpperCase(),64,76),new eT.ROQ(e)},[t,i,r,n,o,s]);return eD.createElement("meshBasicMaterial",{map:u,"map-anisotropy":c.capabilities.getMaxAnisotropy()||1,attach:`material-${t}`,color:e?a:"white",transparent:!0,opacity:l})},hs=e=>{let{tweenCamera:t}=uW(),[r,i]=eD.useState(null);return eD.createElement("mesh",{onPointerOut:e=>{e.stopPropagation(),i(null)},onPointerMove:e=>{e.stopPropagation(),i(Math.floor(e.faceIndex/2))},onClick:e.onClick||(e=>{e.stopPropagation(),t(e.face.normal)})},[...Array(6)].map((t,i)=>eD.createElement(ho,(0,eS.Z)({key:i,index:i,hover:r===i},e))),eD.createElement("boxGeometry",null))},hl=({onClick:e,dimensions:t,position:r,hoverColor:i=u8})=>{let{tweenCamera:n}=uW(),[a,o]=eD.useState(!1);return eD.createElement("mesh",{scale:1.01,position:r,onPointerOver:e=>{e.stopPropagation(),o(!0)},onPointerOut:e=>{e.stopPropagation(),o(!1)},onClick:e||(e=>{e.stopPropagation(),n(r)})},eD.createElement("meshBasicMaterial",{color:a?i:"white",transparent:!0,opacity:.6,visible:a}),eD.createElement("boxGeometry",{args:t}))},hc=e=>eD.createElement("group",{scale:[60,60,60]},eD.createElement(hs,e),hn.map((t,r)=>eD.createElement(hl,(0,eS.Z)({key:r,position:t,dimensions:ha[r]},e))),hr.map((t,r)=>eD.createElement(hl,(0,eS.Z)({key:r,position:t,dimensions:hi},e))));function hu({scale:e=[.8,.05,.05],color:t,rotation:r}){return eD.createElement("group",{rotation:r},eD.createElement("mesh",{position:[.4,0,0]},eD.createElement("boxGeometry",{args:e}),eD.createElement("meshBasicMaterial",{color:t,toneMapped:!1})))}function hh({onClick:e,font:t,disabled:r,arcStyle:i,label:n,labelColor:a,axisHeadScale:o=1,...s}){let l=(0,eR.D)(e=>e.gl),c=eD.useMemo(()=>{let e=document.createElement("canvas");e.width=64,e.height=64;let r=e.getContext("2d");return r.beginPath(),r.arc(32,32,16,0,2*Math.PI),r.closePath(),r.fillStyle=i,r.fill(),n&&(r.font=t,r.textAlign="center",r.fillStyle=a,r.fillText(n,32,41)),new eT.ROQ(e)},[i,n,a,t]),[u,h]=eD.useState(!1),A=(n?1:.75)*(u?1.2:1)*o;return eD.createElement("sprite",(0,eS.Z)({scale:A,onPointerOver:r?void 0:e=>{e.stopPropagation(),h(!0)},onPointerOut:r?void 0:e||(e=>{e.stopPropagation(),h(!1)})},s),eD.createElement("spriteMaterial",{map:c,"map-anisotropy":l.capabilities.getMaxAnisotropy()||1,alphaTest:.3,opacity:n?1:.75,toneMapped:!1}))}let hA=({hideNegativeAxes:e,hideAxisHeads:t,disabled:r,font:i="18px Inter var, Arial, sans-serif",axisColors:n=["#ff2060","#20df80","#2080ff"],axisHeadScale:a=1,axisScale:o,labels:s=["X","Y","Z"],labelColor:l="#000",onClick:c,...u})=>{let[h,A,d]=n,{tweenCamera:m}=uW(),f={font:i,disabled:r,labelColor:l,onClick:c,axisHeadScale:a,onPointerDown:r?void 0:e=>{m(e.object.position),e.stopPropagation()}};return eD.createElement("group",(0,eS.Z)({scale:40},u),eD.createElement(hu,{color:h,rotation:[0,0,0],scale:o}),eD.createElement(hu,{color:A,rotation:[0,0,Math.PI/2],scale:o}),eD.createElement(hu,{color:d,rotation:[0,-Math.PI/2,0],scale:o}),!t&&eD.createElement(eD.Fragment,null,eD.createElement(hh,(0,eS.Z)({arcStyle:h,position:[1,0,0],label:s[0]},f)),eD.createElement(hh,(0,eS.Z)({arcStyle:A,position:[0,1,0],label:s[1]},f)),eD.createElement(hh,(0,eS.Z)({arcStyle:d,position:[0,0,1],label:s[2]},f)),!e&&eD.createElement(eD.Fragment,null,eD.createElement(hh,(0,eS.Z)({arcStyle:h,position:[-1,0,0]},f)),eD.createElement(hh,(0,eS.Z)({arcStyle:A,position:[0,-1,0]},f)),eD.createElement(hh,(0,eS.Z)({arcStyle:d,position:[0,0,-1]},f)))))},hd=sw({cellSize:.5,sectionSize:1,fadeDistance:100,fadeStrength:1,fadeFrom:1,cellThickness:.5,sectionThickness:1,cellColor:new eT.Ilk,sectionColor:new eT.Ilk,infiniteGrid:!1,followCamera:!1,worldCamProjPosition:new eT.Pa4,worldPlanePosition:new eT.Pa4},`
825    varying vec3 localPosition;
826    varying vec4 worldPosition;
827
828    uniform vec3 worldCamProjPosition;
829    uniform vec3 worldPlanePosition;
830    uniform float fadeDistance;
831    uniform bool infiniteGrid;
832    uniform bool followCamera;
833
834    void main() {
835      localPosition = position.xzy;
836      if (infiniteGrid) localPosition *= 1.0 + fadeDistance;
837      
838      worldPosition = modelMatrix * vec4(localPosition, 1.0);
839      if (followCamera) {
840        worldPosition.xyz += (worldCamProjPosition - worldPlanePosition);
841        localPosition = (inverse(modelMatrix) * worldPosition).xyz;
842      }
843
844      gl_Position = projectionMatrix * viewMatrix * worldPosition;
845    }
846  `,`
847    varying vec3 localPosition;
848    varying vec4 worldPosition;
849
850    uniform vec3 worldCamProjPosition;
851    uniform float cellSize;
852    uniform float sectionSize;
853    uniform vec3 cellColor;
854    uniform vec3 sectionColor;
855    uniform float fadeDistance;
856    uniform float fadeStrength;
857    uniform float fadeFrom;
858    uniform float cellThickness;
859    uniform float sectionThickness;
860
861    float getGrid(float size, float thickness) {
862      vec2 r = localPosition.xz / size;
863      vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r);
864      float line = min(grid.x, grid.y) + 1.0 - thickness;
865      return 1.0 - min(line, 1.0);
866    }
867
868    void main() {
869      float g1 = getGrid(cellSize, cellThickness);
870      float g2 = getGrid(sectionSize, sectionThickness);
871
872      vec3 from = worldCamProjPosition*vec3(fadeFrom);
873      float dist = distance(from, worldPosition.xyz);
874      float d = 1.0 - min(dist / fadeDistance, 1.0);
875      vec3 color = mix(cellColor, sectionColor, min(1.0, sectionThickness * g2));
876
877      gl_FragColor = vec4(color, (g1 + g2) * pow(d, fadeStrength));
878      gl_FragColor.a = mix(0.75 * gl_FragColor.a, gl_FragColor.a, g2);
879      if (gl_FragColor.a <= 0.0) discard;
880
881      #include <tonemapping_fragment>
882      #include <${sI.i>=154?"colorspace_fragment":"encodings_fragment"}>
883    }
884  `),hm=eD.forwardRef(({args:e,cellColor:t="#000000",sectionColor:r="#2080ff",cellSize:i=.5,sectionSize:n=1,followCamera:a=!1,infiniteGrid:o=!1,fadeDistance:s=100,fadeStrength:l=1,fadeFrom:c=1,cellThickness:u=.5,sectionThickness:h=1,side:A=eT._Li,...d},m)=>{(0,eR.e)({GridMaterial:hd});let f=eD.useRef(null);eD.useImperativeHandle(m,()=>f.current,[]);let p=new eT.JOQ,g=new eT.Pa4(0,1,0),y=new eT.Pa4(0,0,0);return(0,eR.F)(e=>{p.setFromNormalAndCoplanarPoint(g,y).applyMatrix4(f.current.matrixWorld);let t=f.current.material,r=t.uniforms.worldCamProjPosition,i=t.uniforms.worldPlanePosition;p.projectPoint(e.camera.position,r.value),i.value.set(0,0,0).applyMatrix4(f.current.matrixWorld)}),eD.createElement("mesh",(0,eS.Z)({ref:f,frustumCulled:!1},d),eD.createElement("gridMaterial",(0,eS.Z)({transparent:!0,"extensions-derivatives":!0,side:A},{cellSize:i,sectionSize:n,cellColor:t,sectionColor:r,cellThickness:u,sectionThickness:h},{fadeDistance:s,fadeStrength:l,fadeFrom:c,infiniteGrid:o,followCamera:a})),eD.createElement("planeGeometry",{args:e}))});function hf(e,{path:t}){let[r]=(0,eR.H)(eT.cBK,[e],e=>e.setPath(t));return r}function hp({children:e,files:t,...r}){let i=hf(t,{...r});return eD.createElement(eD.Fragment,null,null==e?void 0:e(i))}hf.preload=(e,{path:t})=>eR.H.preload(eT.cBK,[e],e=>e.setPath(t));var hg={},hy=Uint8Array,hv=Uint16Array,hE=Uint32Array,hx=new hy([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]),hC=new hy([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]),hw=new hy([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),hB=function(e,t){for(var r=new hv(31),i=0;i<31;++i)r[i]=t+=1<<e[i-1];for(var n=new hE(r[30]),i=1;i<30;++i)for(var a=r[i];a<r[i+1];++a)n[a]=a-r[i]<<5|i;return[r,n]},hI=hB(hx,2),h_=hI[0],hb=hI[1];h_[28]=258,hb[258]=28;for(var hM=hB(hC,0),hS=hM[0],hD=hM[1],hP=new hv(32768),hT=0;hT<32768;++hT){var hR=(43690&hT)>>>1|(21845&hT)<<1;hR=(61680&(hR=(52428&hR)>>>2|(13107&hR)<<2))>>>4|(3855&hR)<<4,hP[hT]=((65280&hR)>>>8|(255&hR)<<8)>>>1}for(var hF=function(e,t,r){for(var i,n=e.length,a=0,o=new hv(t);a<n;++a)++o[e[a]-1];var s=new hv(t);for(a=0;a<t;++a)s[a]=s[a-1]+o[a-1]<<1;if(r){i=new hv(1<<t);var l=15-t;for(a=0;a<n;++a)if(e[a])for(var c=a<<4|e[a],u=t-e[a],h=s[e[a]-1]++<<u,A=h|(1<<u)-1;h<=A;++h)i[hP[h]>>>l]=c}else for(a=0,i=new hv(n);a<n;++a)e[a]&&(i[a]=hP[s[e[a]-1]++]>>>15-e[a]);return i},hQ=new hy(288),hT=0;hT<144;++hT)hQ[hT]=8;for(var hT=144;hT<256;++hT)hQ[hT]=9;for(var hT=256;hT<280;++hT)hQ[hT]=7;for(var hT=280;hT<288;++hT)hQ[hT]=8;for(var hz=new hy(32),hT=0;hT<32;++hT)hz[hT]=5;var hk=hF(hQ,9,1),hL=hF(hz,5,1),hO=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},hU=function(e,t,r){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(7&t)&r},hG=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(7&t)},hN=function(e){return(e/8|0)+(7&e&&1)},hH=function(e,t,r){(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length);var i=new(e instanceof hv?hv:e instanceof hE?hE:hy)(r-t);return i.set(e.subarray(t,r)),i},hj=function(e,t,r){var i=e.length;if(!i||r&&!r.l&&i<5)return t||new hy(0);var n=!t||r,a=!r||r.i;r||(r={}),t||(t=new hy(3*i));var o=function(e){var r=t.length;if(e>r){var i=new hy(Math.max(2*r,e));i.set(t),t=i}},s=r.f||0,l=r.p||0,c=r.b||0,u=r.l,h=r.d,A=r.m,d=r.n,m=8*i;do{if(!u){r.f=s=hU(e,l,1);var f=hU(e,l+1,3);if(l+=3,f){if(1==f)u=hk,h=hL,A=9,d=5;else if(2==f){var p=hU(e,l,31)+257,g=hU(e,l+10,15)+4,y=p+hU(e,l+5,31)+1;l+=14;for(var v=new hy(y),E=new hy(19),x=0;x<g;++x)E[hw[x]]=hU(e,l+3*x,7);l+=3*g;
884for(var C=hO(E),w=(1<<C)-1,B=hF(E,C,1),x=0;x<y;){var I=B[hU(e,l,w)];l+=15&I;var _=I>>>4;if(_<16)v[x++]=_;else{var b=0,M=0;for(16==_?(M=3+hU(e,l,3),l+=2,b=v[x-1]):17==_?(M=3+hU(e,l,7),l+=3):18==_&&(M=11+hU(e,l,127),l+=7);M--;)v[x++]=b}}var S=v.subarray(0,p),D=v.subarray(p);A=hO(S),d=hO(D),u=hF(S,A,1),h=hF(D,d,1)}else throw"invalid block type"}else{var _=hN(l)+4,P=e[_-4]|e[_-3]<<8,T=_+P;if(T>i){if(a)throw"unexpected EOF";break}n&&o(c+P),t.set(e.subarray(_,T),c),r.b=c+=P,r.p=l=8*T;continue}if(l>m){if(a)throw"unexpected EOF";break}}n&&o(c+131072);for(var R=(1<<A)-1,F=(1<<d)-1,Q=l;;Q=l){var b=u[hG(e,l)&R],z=b>>>4;if((l+=15&b)>m){if(a)throw"unexpected EOF";break}if(!b)throw"invalid length/literal";if(z<256)t[c++]=z;else if(256==z){Q=l,u=null;break}else{var k=z-254;if(z>264){var x=z-257,L=hx[x];k=hU(e,l,(1<<L)-1)+h_[x],l+=L}var O=h[hG(e,l)&F],U=O>>>4;if(!O)throw"invalid distance";l+=15&O;var D=hS[U];if(U>3){var L=hC[U];D+=hG(e,l)&(1<<L)-1,l+=L}if(l>m){if(a)throw"unexpected EOF";break}n&&o(c+131072);for(var G=c+k;c<G;c+=4)t[c]=t[c-D],t[c+1]=t[c+1-D],t[c+2]=t[c+2-D],t[c+3]=t[c+3-D];c=G}}r.l=u,r.p=Q,r.b=c,u&&(s=1,r.m=A,r.d=h,r.n=d)}while(!s);return c==t.length?t:hH(t,0,c)},hJ=function(e,t,r){r<<=7&t;var i=t/8|0;e[i]|=r,e[i+1]|=r>>>8},hV=function(e,t,r){r<<=7&t;var i=t/8|0;e[i]|=r,e[i+1]|=r>>>8,e[i+2]|=r>>>16},hK=function(e,t){for(var r=[],i=0;i<e.length;++i)e[i]&&r.push({s:i,f:e[i]});var n=r.length,a=r.slice();if(!n)return[h1,0];if(1==n){var o=new hy(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort(function(e,t){return e.f-t.f}),r.push({s:-1,f:25001});var s=r[0],l=r[1],c=0,u=1,h=2;for(r[0]={s:-1,f:s.f+l.f,l:s,r:l};u!=n-1;)s=r[r[c].f<r[h].f?c++:h++],l=r[c!=u&&r[c].f<r[h].f?c++:h++],r[u++]={s:-1,f:s.f+l.f,l:s,r:l};for(var A=a[0].s,i=1;i<n;++i)a[i].s>A&&(A=a[i].s);var d=new hv(A+1),m=hY(r[u-1],d,0);if(m>t){var i=0,f=0,p=m-t,g=1<<p;for(a.sort(function(e,t){return d[t.s]-d[e.s]||e.f-t.f});i<n;++i){var y=a[i].s;if(d[y]>t)f+=g-(1<<m-d[y]),d[y]=t;else break}for(f>>>=p;f>0;){var v=a[i].s;d[v]<t?f-=1<<t-d[v]++-1:++i}for(;i>=0&&f;--i){var E=a[i].s;d[E]==t&&(--d[E],++f)}m=t}return[new hy(d),m]},hY=function(e,t,r){return -1==e.s?Math.max(hY(e.l,t,r+1),hY(e.r,t,r+1)):t[e.s]=r},hW=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new hv(++t),i=0,n=e[0],a=1,o=function(e){r[i++]=e},s=1;s<=t;++s)if(e[s]==n&&s!=t)++a;else{if(!n&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(n),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(n);a=1,n=e[s]}return[r.subarray(0,i),t]},hq=function(e,t){for(var r=0,i=0;i<t.length;++i)r+=e[i]*t[i];return r},hX=function(e,t,r){var i=r.length,n=hN(t+2);e[n]=255&i,e[n+1]=i>>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var a=0;a<i;++a)e[n+a+4]=r[a];return(n+4+i)*8},hZ=function(e,t,r,i,n,a,o,s,l,c,u){hJ(t,u++,r),++n[256];for(var h,A,d,m,f=hK(n,15),p=f[0],g=f[1],y=hK(a,15),v=y[0],E=y[1],x=hW(p),C=x[0],w=x[1],B=hW(v),I=B[0],_=B[1],b=new hv(19),M=0;M<C.length;++M)b[31&C[M]]++;for(var M=0;M<I.length;++M)b[31&I[M]]++;for(var S=hK(b,7),D=S[0],P=S[1],T=19;T>4&&!D[hw[T-1]];--T);var R=c+5<<3,F=hq(n,hQ)+hq(a,hz)+o,Q=hq(n,p)+hq(a,v)+o+14+3*T+hq(b,D)+(2*b[16]+3*b[17]+7*b[18]);if(R<=F&&R<=Q)return hX(t,u,e.subarray(l,l+c));if(hJ(t,u,1+(Q<F)),u+=2,Q<F){h=hF(p,g,0),A=p,d=hF(v,E,0),m=v;var z=hF(D,P,0);hJ(t,u,w-257),hJ(t,u+5,_-1),hJ(t,u+10,T-4),u+=14;for(var M=0;M<T;++M)hJ(t,u+3*M,D[hw[M]]);u+=3*T;for(var k=[C,I],L=0;L<2;++L)for(var O=k[L],M=0;M<O.length;++M){var U=31&O[M];hJ(t,u,z[U]),u+=D[U],U>15&&(hJ(t,u,O[M]>>>5&127),u+=O[M]>>>12)}}else h=null,A=hQ,d=null,m=hz;for(var M=0;M<s;++M)if(i[M]>255){var U=i[M]>>>18&31;hV(t,u,h[U+257]),u+=A[U+257],U>7&&(hJ(t,u,i[M]>>>23&31),u+=hx[U]);var G=31&i[M];hV(t,u,d[G]),u+=m[G],G>3&&(hV(t,u,i[M]>>>5&8191),u+=hC[G])}else hV(t,u,h[i[M]]),u+=A[i[M]];return hV(t,u,h[256]),u+A[256]},h$=new hE([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),h1=new hy(0),h0=function(e){if((15&e[0])!=8||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"};function h2(e,t){return hj((h0(e),e.subarray(2,-4)),t)}var h3="undefined"!=typeof TextDecoder&&new TextDecoder;try{h3.decode(h1,{stream:!0})}catch(e){}function h4(e,t,r){let i=r.length-e-1;if(t>=r[i])return i-1;if(t<=r[e])return e;let n=e,a=i,o=Math.floor((n+a)/2);for(;t<r[o]||t>=r[o+1];)t<r[o]?a=o:n=o,o=Math.floor((n+a)/2);return o}class h5 extends eT.Hyl{constructor(e,t,r,i,n){super(),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=i||0,this.endKnot=n||this.knots.length-1;for(let e=0;e<r.length;++e){let t=r[e];this.controlPoints[e]=new eT.Ltg(t.x,t.y,t.z,t.w)}}getPoint(e,t){let r=t||new eT.Pa4,i=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),n=function(e,t,r,i){let n=h4(e,i,t),a=function(e,t,r,i){let n=[],a=[],o=[];n[0]=1;for(let s=1;s<=r;++s){a[s]=t-i[e+1-s],o[s]=i[e+s]-t;let r=0;for(let e=0;e<s;++e){let t=o[e+1],i=a[s-e],l=n[e]/(t+i);n[e]=r+t*l,r=i*l}n[s]=r}return n}(n,i,e,t),o=new eT.Ltg(0,0,0,0);for(let t=0;t<=e;++t){let i=r[n-e+t],s=a[t],l=i.w*s;o.x+=i.x*l,o.y+=i.y*l,o.z+=i.z*l,o.w+=i.w*s}return o}(this.degree,this.knots,this.controlPoints,i);return 1!=n.w&&n.divideScalar(n.w),r.set(n.x,n.y,n.z)}getTangent(e,t){var r;let i=t||new eT.Pa4,n=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),a=(r=this.degree,function(e){let t=e.length,r=[],i=[];for(let n=0;n<t;++n){let t=e[n];r[n]=new eT.Pa4(t.x,t.y,t.z),i[n]=t.w}let n=[];for(let e=0;e<t;++e){let t=r[e].clone();for(let r=1;r<=e;++r)t.sub(n[e-r].clone().multiplyScalar(function(e,t){let r=1;for(let t=2;t<=e;++t)r*=t;let i=1;for(let e=2;e<=t;++e)i*=e;for(let r=2;r<=e-t;++r)i*=r;return r/i}(e,r)*i[r]));n[e]=t.divideScalar(i[0])}return n}(function(e,t,r,i,n){let a=1<e?1:e,o=[],s=h4(e,i,t),l=function(e,t,r,i,n){let a=[];for(let e=0;e<=r;++e)a[e]=0;let o=[];for(let e=0;e<=i;++e)o[e]=a.slice(0);let s=[];for(let e=0;e<=r;++e)s[e]=a.slice(0);s[0][0]=1;let l=a.slice(0),c=a.slice(0);for(let i=1;i<=r;++i){l[i]=t-n[e+1-i],c[i]=n[e+i]-t;let r=0;for(let e=0;e<i;++e){let t=c[e+1],n=l[i-e];s[i][e]=t+n;let a=s[e][i-1]/s[i][e];s[e][i]=r+t*a,r=n*a}s[i][i]=r}for(let e=0;e<=r;++e)o[0][e]=s[e][r];for(let e=0;e<=r;++e){let t=0,n=1,l=[];for(let e=0;e<=r;++e)l[e]=a.slice(0);l[0][0]=1;for(let a=1;a<=i;++a){let i=0,c=e-a,u=r-a;e>=a&&(l[n][0]=l[t][0]/s[u+1][c],i=l[n][0]*s[c][u]);let h=c>=-1?1:-c,A=e-1<=u?a-1:r-e;for(let e=h;e<=A;++e)l[n][e]=(l[t][e]-l[t][e-1])/s[u+1][c+e],i+=l[n][e]*s[c+e][u];e<=u&&(l[n][a]=-l[t][a-1]/s[u+1][e],i+=l[n][a]*s[e][u]),o[a][e]=i;let d=t;t=n,n=d}}let u=r;
884for(let e=1;e<=i;++e){for(let t=0;t<=r;++t)o[e][t]*=u;u*=r-e}return o}(s,i,e,a,t),c=[];for(let e=0;e<r.length;++e){let t=r[e].clone(),i=t.w;t.x*=i,t.y*=i,t.z*=i,c[e]=t}for(let t=0;t<=a;++t){let r=c[s-e].clone().multiplyScalar(l[t][0]);for(let i=1;i<=e;++i)r.add(c[s-e+i].clone().multiplyScalar(l[t][i]));o[t]=r}for(let e=a+1;e<=n+1;++e)o[e]=new eT.Ltg(0,0,0);return o}(r,this.knots,this.controlPoints,n,1)));return i.copy(a[1]).normalize(),i}}class h6 extends eT.aNw{constructor(e){super(e)}load(e,t,r,i){let n=this,a=""===n.path?eT.Zp0.extractUrlBase(e):n.path,o=new eT.hH6(this.manager);o.setPath(n.path),o.setResponseType("arraybuffer"),o.setRequestHeader(n.requestHeader),o.setWithCredentials(n.withCredentials),o.load(e,function(r){try{t(n.parse(r,a))}catch(t){i?i(t):console.error(t),n.manager.itemError(e)}},r,i)}parse(e,t){if(function(e){let t="Kaydara FBX Binary  \0";return e.byteLength>=t.length&&t===Ad(e,0,t.length)}(e))S=new At().parse(e);else{let t=Ad(e);if(!function(e){let t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],r=0;for(let i=0;i<t.length;++i)if(function(t){let i=e[0];return e=e.slice(r+1),r++,i}(0)===t[i])return!1;return!0}(t))throw Error("THREE.FBXLoader: Unknown format.");if(7e3>An(t))throw Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+An(t));S=new Ae().parse(t)}return new h8(new eT.dpR(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin),this.manager).parse(S)}}class h8{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){D=this.parseConnections();let e=this.parseImages(),t=this.parseTextures(e),r=this.parseMaterials(t),i=this.parseDeformers(),n=new h9().parse(i);return this.parseScene(i,n,r),P}parseConnections(){let e=new Map;return"Connections"in S&&S.Connections.connections.forEach(function(t){let r=t[0],i=t[1],n=t[2];e.has(r)||e.set(r,{parents:[],children:[]}),e.get(r).parents.push({ID:i,relationship:n}),e.has(i)||e.set(i,{parents:[],children:[]}),e.get(i).children.push({ID:r,relationship:n})}),e}parseImages(){let e={},t={};if("Video"in S.Objects){let r=S.Objects.Video;for(let i in r){let n=r[i];if(e[parseInt(i)]=n.RelativeFilename||n.Filename,"Content"in n){let e=n.Content instanceof ArrayBuffer&&n.Content.byteLength>0,a="string"==typeof n.Content&&""!==n.Content;if(e||a){let e=this.parseImage(r[i]);t[n.RelativeFilename||n.Filename]=e}}}}for(let r in e){let i=e[r];void 0!==t[i]?e[r]=t[i]:e[r]=e[r].split("\\").pop()}return e}parseImage(e){let t;let r=e.Content,i=e.RelativeFilename||e.Filename,n=i.slice(i.lastIndexOf(".")+1).toLowerCase();switch(n){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",i),t="image/tga";break;default:console.warn('FBXLoader: Image type "'+n+'" is not supported.');return}if("string"==typeof r)return"data:"+t+";base64,"+r;{let e=new Uint8Array(r);return window.URL.createObjectURL(new Blob([e],{type:t}))}}parseTextures(e){let t=new Map;if("Texture"in S.Objects){let r=S.Objects.Texture;for(let i in r){let n=this.parseTexture(r[i],e);t.set(parseInt(i),n)}}return t}parseTexture(e,t){let r=this.loadTexture(e,t);r.ID=e.id,r.name=e.attrName;let i=e.WrapModeU,n=e.WrapModeV,a=void 0!==i?i.value:0,o=void 0!==n?n.value:0;if(r.wrapS=0===a?eT.rpg:eT.uWy,r.wrapT=0===o?eT.rpg:eT.uWy,"Scaling"in e){let t=e.Scaling.value;r.repeat.x=t[0],r.repeat.y=t[1]}return r}loadTexture(e,t){let r,i;let n=this.textureLoader.path,a=D.get(e.id).children;void 0!==a&&a.length>0&&void 0!==t[a[0].ID]&&(0===(r=t[a[0].ID]).indexOf("blob:")||0===r.indexOf("data:"))&&this.textureLoader.setPath(void 0);let o=e.FileName.slice(-3).toLowerCase();if("tga"===o){let t=this.manager.getHandler(".tga");null===t?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),i=new eT.xEZ):(t.setPath(this.textureLoader.path),i=t.load(r))}else"psd"===o?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),i=new eT.xE
884Z):i=this.textureLoader.load(r);return this.textureLoader.setPath(n),i}parseMaterials(e){let t=new Map;if("Material"in S.Objects){let r=S.Objects.Material;for(let i in r){let n=this.parseMaterial(r[i],e);null!==n&&t.set(parseInt(i),n)}}return t}parseMaterial(e,t){let r;let i=e.id,n=e.attrName,a=e.ShadingModel;if("object"==typeof a&&(a=a.value),!D.has(i))return null;let o=this.parseParameters(e,t,i);switch(a.toLowerCase()){case"phong":r=new eT.xoR;break;case"lambert":r=new eT.YBo;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',a),r=new eT.xoR}return r.setValues(o),r.name=n,r}parseParameters(e,t,r){let i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=new eT.Ilk().fromArray(e.Diffuse.value):e.DiffuseColor&&("Color"===e.DiffuseColor.type||"ColorRGB"===e.DiffuseColor.type)&&(i.color=new eT.Ilk().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=new eT.Ilk().fromArray(e.Emissive.value):e.EmissiveColor&&("Color"===e.EmissiveColor.type||"ColorRGB"===e.EmissiveColor.type)&&(i.emissive=new eT.Ilk().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 eT.Ilk().fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(i.specular=new eT.Ilk().fromArray(e.SpecularColor.value));let n=this;return D.get(r).children.forEach(function(e){let r=e.relationship;switch(r){case"Bump":i.bumpMap=n.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":i.aoMap=n.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=n.getTexture(t,e.ID),void 0!==i.map&&("colorSpace"in i.map?i.map.colorSpace
884="srgb":i.map.encoding=3001);break;case"DisplacementColor":i.displacementMap=n.getTexture(t,e.ID);break;case"EmissiveColor":i.emissiveMap=n.getTexture(t,e.ID),void 0!==i.emissiveMap&&("colorSpace"in i.emissiveMap?i.emissiveMap.colorSpace="srgb":i.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=n.getTexture(t,e.ID);break;case"ReflectionColor":i.envMap=n.getTexture(t,e.ID),void 0!==i.envMap&&(i.envMap.mapping=eT.dSO,"colorSpace"in i.envMap?i.envMap.colorSpace="srgb":i.envMap.encoding=3001);break;case"SpecularColor":i.specularMap=n.getTexture(t,e.ID),void 0!==i.specularMap&&("colorSpace"in i.specularMap?i.specularMap.colorSpace="srgb":i.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=n.getTexture(t,e.ID),i.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r)}}),i}getTexture(e,t){return"LayeredTexture"in S.Objects&&t in S.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=D.get(t).children[0].ID),e.get(t)}parseDeformers(){let e={},t={};if("Deformer"in S.Objects){let r=S.Objects.Deformer;for(let i in r){let n=r[i],a=D.get(parseInt(i));if("Skin"===n.attrType){let t=this.parseSkeleton(a,r);t.ID=i,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),t.geometryID=a.parents[0].ID,e[i]=t}else if("BlendShape"===n.attrType){let e={id:i};e.rawTargets=this.parseMorphTargets(a,r),e.id=i,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[i]=e}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){let r=[];return e.children.forEach(function(e){let i=t[e.ID];if("Cluster"!==i.attrType)return;let n={ID:e.ID,indices:[],weights:[],transformLink:new eT.yGw().fromArray(i.TransformLink.a)};"Indexes"in i&&(n.indices=i.Indexes.a,n.weights=i.Weights.a),r.push(n)}),{rawBones:r,bones:[]}}parseMorphTargets(e,t){let r=[];for(let i=0;i<e.children.length;i++){let n=e.children[i],a=t[n.ID],o={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if("BlendShapeChannel"!==a.attrType)return;o.geoID=D.get(parseInt(n.ID)).children.filter(function(e){return void 0===e.relationship})[0].ID,r.push(o)}return r}parseScene(e,t,r){P=new eT.ZAu;let i=this.parseModels(e.skeletons,t,r),n=S.Objects.Model,a=this;i.forEach(function(e){let t=n[e.ID];a.setLookAtProperties(e,t),D.get(e.ID).parents.forEach(function(t){let r=i.get(t.ID);void 0!==r&&r.add(e)}),null===e.parent&&P.add(e)}),this.bindSkeleton(e.skeletons,t,i),this.createAmbientLight(),P.traverse(function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld);let t=Au(e.userData.transformData);e.applyMatrix4(t),e.updateWorldMatrix()}});let o=new h7().parse();1===P.children.length&&P.children[0].isGroup&&(P.children[0].animations=o,P=P.children[0]),P.animations=o}parseModels(e,t,r){let i=new Map,n=S.Objects.Model;for(let a in n){let o=parseInt(a),s=n[a],l=D.get(o),c=this.buildSkeleton(l,e,o,s.attrName);if(!c){switch(s.attrType){case"Camera":c=this.createCamera(l);break;case"Light":c=this.createLight(l);break;case"Mesh":c=this.createMesh(l,t,r);break;case"NurbsCurve":c=this.createCurve(l,t);break;case"LimbNode":case"Root":c=new eT.N$j;break;default:c=new eT.ZAu}c.name=s.attrName?eT.iUV.sanitizeNodeName(s.attrName):"",c.ID=o}this.getTransformData(c,s),i.set(o,c)}return i}buildSkeleton(e,t,r,i){let n=null;return e.parents.forEach(function(e){for(let a in t){let o=t[a];o.rawBones.forEach(function(t,a){if(t.ID===e.ID){let e=n;(n=new eT.N$j).matrixWorld.copy(t.transformLink),n.name=i?eT.iUV.sanitizeNodeName(i):"",n.ID=r,o.bones[a]=n,null!==e&&n.add(e)}})}}),n}createCamera(e){let t,r;if(e.children.forEach(function(e){let t=S.Objects.NodeAttribute[e.ID];void 0!==t&&(r=t)}),void 0===r)t=new eT.Tme;else{let e=0;void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(e=1);let i=1;void 0!==r.NearPlane&&(i=r.NearPlane.value/1e3);let n=1e3;void 0!==r.FarPlane&&(n=r.FarPlane.value/1e3);let a=window.innerWidth,o=window.innerHeight;void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(a=r.AspectWidth.value,o=r.AspectHeight.value);let s=a/o,l=45;void 0!==r.FieldOfView&&(l=r.FieldOfView.value);let c=r.FocalLength?r.FocalLength.value:null;switch(e){case 0:t=new eT.cPb(l,s,i,n),null!==c&&t.setFocalLength(c);break;case 1:t=new eT.iKG(-a/2,a/2,o/2,-o/2,i,n);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+e+"."),t=new eT.Tme}}return t}createLight(e){let t,r;
884if(e.children.forEach(function(e){let t=S.Objects.NodeAttribute[e.ID];void 0!==t&&(r=t)}),void 0===r)t=new eT.Tme;else{let e;e=void 0===r.LightType?0:r.LightType.value;let i=16777215;void 0!==r.Color&&(i=new eT.Ilk().fromArray(r.Color.value));let n=void 0===r.Intensity?1:r.Intensity.value/100;void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(n=0);let a=0;switch(void 0!==r.FarAttenuationEnd&&(a=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value),e){case 0:t=new eT.cek(i,n,a,1);break;case 1:t=new eT.Ox3(i,n);break;case 2:let o=Math.PI/3;void 0!==r.InnerAngle&&(o=eT.M8C.degToRad(r.InnerAngle.value));let s=0;void 0!==r.OuterAngle&&(s=Math.max(s=eT.M8C.degToRad(r.OuterAngle.value),1)),t=new eT.PMe(i,n,a,o,s,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),t=new eT.cek(i,n)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(t.castShadow=!0)}return t}createMesh(e,t,r){let i;let n=null,a=null,o=[];return e.children.forEach(function(e){t.has(e.ID)&&(n=t.get(e.ID)),r.has(e.ID)&&o.push(r.get(e.ID))}),o.length>1?a=o:o.length>0?a=o[0]:(a=new eT.xoR({color:13421772}),o.push(a)),"color"in n.attributes&&o.forEach(function(e){e.vertexColors=!0}),n.FBX_Deformer?(i=new eT.TUv(n,a)).normalizeSkinWeights():i=new eT.Kj0(n,a),i}createCurve(e,t){let r=e.children.reduce(function(e,r){return t.has(r.ID)&&(e=t.get(r.ID)),e},null),i=new eT.nls({color:3342591,linewidth:1});return new eT.x12(r,i)}getTransformData(e,t){let r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?r.eulerOrder=Ah(t.RotationOrder.value):r.eulerOrder="ZYX","Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}setLookAtProperties(e,t){"LookAtProperty"in t&&D.get(e.ID).children.forEach(function(t){if("LookAtProperty"===t.relationship){let r=S.Objects.Model[t.ID];if("Lcl_Translation"in r){let t=r.Lcl_Translation.value;void 0!==e.target?(e.target.position.fromArray(t),P.add(e.target)):e.lookAt(new eT.Pa4().fromArray(t))}}})}bindSkeleton(e,t,r){let i=this.parsePoseNodes();for(let n in e){let a=e[n];D.get(parseInt(a.ID)).parents.forEach(function(e){if(t.has(e.ID)){let t=e.ID;D.get(t).parents.forEach(function(e){r.has(e.ID)&&r.get(e.ID).bind(new eT.OdW(a.bones),i[e.ID])})}})}}parsePoseNodes(){let e={};
884if("Pose"in S.Objects){let t=S.Objects.Pose;for(let r in t)if("BindPose"===t[r].attrType&&t[r].NbPoseNodes>0){let i=t[r].PoseNode;Array.isArray(i)?i.forEach(function(t){e[t.Node]=new eT.yGw().fromArray(t.Matrix.a)}):e[i.Node]=new eT.yGw().fromArray(i.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in S&&"AmbientColor"in S.GlobalSettings){let e=S.GlobalSettings.AmbientColor.value,t=e[0],r=e[1],i=e[2];if(0!==t||0!==r||0!==i){let e=new eT.Ilk(t,r,i);P.add(new eT.Mig(e,1))}}}}class h9{parse(e){let t=new Map;if("Geometry"in S.Objects){let r=S.Objects.Geometry;for(let i in r){let n=D.get(parseInt(i)),a=this.parseGeometry(n,r[i],e);t.set(parseInt(i),a)}}return t}parseGeometry(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,r){let i=r.skeletons,n=[],a=e.parents.map(function(e){return S.Objects.Model[e.ID]});if(0===a.length)return;let o=e.children.reduce(function(e,t){return void 0!==i[t.ID]&&(e=i[t.ID]),e},null);e.children.forEach(function(e){void 0!==r.morphTargets[e.ID]&&n.push(r.morphTargets[e.ID])});let s=a[0],l={};"RotationOrder"in s&&(l.eulerOrder=Ah(s.RotationOrder.value)),"InheritType"in s&&(l.inheritType=parseInt(s.InheritType.value)),"GeometricTranslation"in s&&(l.translation=s.GeometricTranslation.value),"GeometricRotation"in s&&(l.rotation=s.GeometricRotation.value),"GeometricScaling"in s&&(l.scale=s.GeometricScaling.value);let c=Au(l);return this.genGeometry(t,o,n,c)}genGeometry(e,t,r,i){let n=new eT.u9r;e.attrName&&(n.name=e.attrName);let a=this.parseGeoNode(e,t),o=this.genBuffers(a),s=new eT.a$l(o.vertex,3);if(s.applyMatrix4(i),n.setAttribute("position",s),o.colors.length>0&&n.setAttribute("color",new eT.a$l(o.colors,3)),t&&(n.setAttribute("skinIndex",new eT.qlB(o.weightsIndices,4)),n.setAttribute("skinWeight",new eT.a$l(o.vertexWeights,4)),n.FBX_Deformer=t),o.normal.length>0){let e=new eT.Vkp().getNormalMatrix(i),t=new eT.a$l(o.normal,3);t.applyNormalMatrix(e),n.setAttribute("normal",t)}
884if(o.uvs.forEach(function(e,t){"uv2"===og&&t++;let r=0===t?"uv":`uv${t}`;n.setAttribute(r,new eT.a$l(o.uvs[t],2))}),a.material&&"AllSame"!==a.material.mappingType){let e=o.materialIndex[0],t=0;if(o.materialIndex.forEach(function(r,i){r!==e&&(n.addGroup(t,i-t,e),e=r,t=i)}),n.groups.length>0){let t=n.groups[n.groups.length-1],r=t.start+t.count;r!==o.materialIndex.length&&n.addGroup(r,o.materialIndex.length-r,e)}0===n.groups.length&&n.addGroup(0,o.materialIndex.length,o.materialIndex[0])}return this.addMorphTargets(n,e,r,i),n}parseGeoNode(e,t){let r={};if(r.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],r.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];let t=0;for(;e.LayerElementUV[t];)e.LayerElementUV[t].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[t])),t++}return r.weightTable={},null!==t&&(r.skeleton=t,t.rawBones.forEach(function(e,t){e.indices.forEach(function(i,n){void 0===r.weightTable[i]&&(r.weightTable[i]=[]),r.weightTable[i].push({id:t,weight:e.weights[n]})})})),r}genBuffers(e){let t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,i=0,n=!1,a=[],o=[],s=[],l=[],c=[],u=[],h=this;return e.vertexIndices.forEach(function(A,d){let m;let f=!1;A<0&&(A^=-1,f=!0);let p=[],g=[];if(a.push(3*A,3*A+1,3*A+2),e.color){let t=As(d,r,A,e.color);s.push(t[0],t[1],t[2])}if(e.skeleton){if(void 0!==e.weightTable[A]&&e.weightTable[A].forEach(function(e){g.push(e.weight),p.push(e.id)}),g.length>4){n||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),n=!0);let e=[0,0,0,0],t=[0,0,0,0];g.forEach(function(r,i){let n=r,a=p[i];t.forEach(function(t,r,i){if(n>t){i[r]=n,n=t;let o=e[r];e[r]=a,a=o}})}),p=e,g=t}for(;g.length<4;)g.push(0),p.push(0);for(let e=0;e<4;++e)c.push(g[e]),u.push(p[e])}if(e.normal){let t=As(d,r,A,e.normal);o.push(t[0],t[1],t[2])}e.material&&"AllSame"!==e.material.mappingType&&(m=As(d,r,A,e.material)[0]),e.uv&&e.uv.forEach(function(e,t){let i=As(d,r,A,e);void 0===l[t]&&(l[t]=[]),l[t].push(i[0]),l[t].push(i[1])}),i++,f&&(h.genFace(t,e,a,m,o,s,l,c,u,i),r++,i=0,a=[],o=[],s=[],l=[],c=[],u=[])}),t}genFace(e,t,r,i,n,a,o,s,l,c){for(let u=2;u<c;u++)e.vertex.push(t.vertexPositions[r[0]]),e.vertex.push(t.vertexPositions[r[1]]),e.vertex.push(t.vertexPositions[r[2]]),e.vertex.push(t.vertexPositions[r[(u-1)*3]]),e.vertex.push(t.vertexPositions[r[(u-1)*3+1]]),e.vertex.push(t.vertexPositions[r[(u-1)*3+2]]),e.vertex.push(t.vertexPositions[r[3*u]]),e.vertex.push(t.vertexPositions[r[3*u+1]]),e.vertex.push(t.vertexPositions[r[3*u+2]]),t.skeleton&&(e.vertexWeights.push(s[0]),e.vertexWeights.push(s[1]),e.vertexWeights.push(s[2]),e.vertexWeights.push(s[3]),e.vertexWeights.push(s[(u-1)*4]),e.vertexWeights.push(s[(u-1)*4+1]),e.vertexWeights.push(s[(u-1)*4+2]),e.vertexWeights.push(s[(u-1)*4+3]),e.vertexWeights.push(s[4*u]),e.vertexWeights.push(s[4*u+1]),e.vertexWeights.push(s[4*u+2]),e.vertexWeights.push(s[4*u+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.
884weightsIndices.push(l[3]),e.weightsIndices.push(l[(u-1)*4]),e.weightsIndices.push(l[(u-1)*4+1]),e.weightsIndices.push(l[(u-1)*4+2]),e.weightsIndices.push(l[(u-1)*4+3]),e.weightsIndices.push(l[4*u]),e.weightsIndices.push(l[4*u+1]),e.weightsIndices.push(l[4*u+2]),e.weightsIndices.push(l[4*u+3])),t.color&&(e.colors.push(a[0]),e.colors.push(a[1]),e.colors.push(a[2]),e.colors.push(a[(u-1)*3]),e.colors.push(a[(u-1)*3+1]),e.colors.push(a[(u-1)*3+2]),e.colors.push(a[3*u]),e.colors.push(a[3*u+1]),e.colors.push(a[3*u+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(i),e.materialIndex.push(i),e.materialIndex.push(i)),t.normal&&(e.normal.push(n[0]),e.normal.push(n[1]),e.normal.push(n[2]),e.normal.push(n[(u-1)*3]),e.normal.push(n[(u-1)*3+1]),e.normal.push(n[(u-1)*3+2]),e.normal.push(n[3*u]),e.normal.push(n[3*u+1]),e.normal.push(n[3*u+2])),t.uv&&t.uv.forEach(function(t,r){void 0===e.uvs[r]&&(e.uvs[r]=[]),e.uvs[r].push(o[r][0]),e.uvs[r].push(o[r][1]),e.uvs[r].push(o[r][(u-1)*2]),e.uvs[r].push(o[r][(u-1)*2+1]),e.uvs[r].push(o[r][2*u]),e.uvs[r].push(o[r][2*u+1])})}addMorphTargets(e,t,r,i){if(0===r.length)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];let n=this;r.forEach(function(r){r.rawTargets.forEach(function(r){let a=S.Objects.Geometry[r.geoID];void 0!==a&&n.genMorphGeometry(e,t,a,i,r.name)})})}genMorphGeometry(e,t,r,i,n){let a=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],o=void 0!==r.Vertices?r.Vertices.a:[],s=void 0!==r.Indexes?r.Indexes.a:[],l=new Float32Array(3*e.attributes.position.count);for(let e=0;e<s.length;e++){let t=3*s[e];l[t]=o[3*e],l[t+1]=o[3*e+1],l[t+2]=o[3*e+2]}let c=this.genBuffers({vertexIndices:a,vertexPositions:l}),u=new eT.a$l(c.vertex,3);u.name=n||r.attrName,u.applyMatrix4(i),e.morphAttributes.position.push(u)}parseNormals(e){let t=e.MappingInformationType,r=e.ReferenceInformationType,i=e.Normals.a,n=[];return"IndexToDirect"===r&&("NormalIndex"in e?n=e.NormalIndex.a:"NormalsIndex"in e&&(n=e.NormalsIndex.a)),{dataSize:3,buffer:i,indices:n,mappingType:t,referenceType:r}}parseUVs(e){let t=e.MappingInformationType,r=e.ReferenceInformationType,i=e.UV.a,n=[];return"IndexToDirect"===r&&(n=e.UVIndex.a),{dataSize:2,buffer:i,indices:n,mappingType:t,referenceType:r}}parseVertexColors(e){let t=e.MappingInformationType,r=e.ReferenceInformationType,i=e.Colors.a,n=[];return"IndexToDirect"===r&&(n=e.ColorIndex.a),{dataSize:4,buffer:i,indices:n,mappingType:t,referenceType:r}}parseMaterialIndices(e){let t=e.MappingInformationType,r=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};let i=e.Materials.a,n=[];for(let e=0;e<i.length;++e)n.push(e);return{dataSize:1,buffer:i,indices:n,mappingType:t,referenceType:r}}parseNurbsGeometry(e){let t,r;if(void 0===h5)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 eT.u9r;let i=parseInt(e.Order);if(isNaN(i))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new eT.u9r;let n=i-1,a=e.KnotVector.a,o=[],s=e.Points.a;for(let e=0,t=s.length;e<t;e+=4)o.push(new eT.Ltg().fromArray(s,e));if("Closed"===e.Form)o.push(o[0]);else if("Periodic"===e.Form){t=n,r=a.length-1-t;for(let e=0;e<n;++e)o.push(o[e])}let l=new h5(n,a,o,t,r).getPoints(12*o.length);return new eT.u9r().setFromPoints(l)}}class h7{parse(){let e=[],t=this.parseClips();if(void 0!==t)for(let r in t){let i=t[r],n=this.addClip(i);e.push(n)}return e}parseClips(){if(void 0===S.Objects.AnimationCurve)return;let e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);let t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){let e=S.Objects.AnimationCurveNode,t=new Map;for(let r in e){let i=e[r];if(null!==i.attrName.match(/S|R|T|DeformPercent/)){let e={id:i.id,attr:i.attrName,curves:{}};t.set(e.id,e)}}return t}parseAnimationCurves(e){let t=S.Objects.AnimationCurve;for(let r in t){let i={id:t[r].id,times:t[r].KeyTime.a.map(Aa),values:t[r].KeyValueFloat.a},n=D.get(i.id);if(void 0!==n){let t=n.parents[0].ID,r=n.parents[0].relationship;r.match(/X/)?e.get(t).curves.x=i:r.match(/Y/)?e.get(t).curves.y=i:r.match(/Z/)?e.get(t).curves.z=i:r.match(/d|DeformPercent/)&&e.has(t)&&(e.get(t).curves.morph=i)}}}parseAnimationLayers(e){let t=S.Objects.AnimationLayer,r=new Map;for(let i in t){let t=[],n=D.get(parseInt(i));
884void 0!==n&&(n.children.forEach(function(r,i){if(e.has(r.ID)){let n=e.get(r.ID);if(void 0!==n.curves.x||void 0!==n.curves.y||void 0!==n.curves.z){if(void 0===t[i]){let e=D.get(r.ID).parents.filter(function(e){return void 0!==e.relationship})[0].ID;if(void 0!==e){let n=S.Objects.Model[e.toString()];if(void 0===n){console.warn("THREE.FBXLoader: Encountered a unused curve.",r);return}let a={modelName:n.attrName?eT.iUV.sanitizeNodeName(n.attrName):"",ID:n.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};P.traverse(function(e){e.ID===n.id&&(a.transform=e.matrix,e.userData.transformData&&(a.eulerOrder=e.userData.transformData.eulerOrder))}),a.transform||(a.transform=new eT.yGw),"PreRotation"in n&&(a.preRotation=n.PreRotation.value),"PostRotation"in n&&(a.postRotation=n.PostRotation.value),t[i]=a}}t[i]&&(t[i][n.attr]=n)}else if(void 0!==n.curves.morph){if(void 0===t[i]){let e=D.get(r.ID).parents.filter(function(e){return void 0!==e.relationship})[0].ID,n=D.get(e).parents[0].ID,a=D.get(n).parents[0].ID,o=D.get(a).parents[0].ID,s=S.Objects.Model[o],l={modelName:s.attrName?eT.iUV.sanitizeNodeName(s.attrName):"",morphName:S.Objects.Deformer[e].attrName};t[i]=l}t[i][n.attr]=n}}}),r.set(parseInt(i),t))}return r}parseAnimStacks(e){let t=S.Objects.AnimationStack,r={};for(let i in t){let n=D.get(parseInt(i)).children;n.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");let a=e.get(n[0].ID);r[i]={name:t[i].attrName,layer:a}}return r}addClip(e){let t=[],r=this;return e.layer.forEach(function(e){t=t.concat(r.generateTracks(e))}),new eT.m7l(e.name,-1,t)}generateTracks(e){let t=[],r=new eT.Pa4,i=new eT._fP,n=new eT.Pa4;if(e.transform&&e.transform.decompose(r,i,n),r=r.toArray(),i=new eT.USm().setFromQuaternion(i,e.eulerOrder).toArray(),n=n.toArray(),void 0!==e.T&&Object.keys(e.T.curves).length>0){let i=this.generateVectorTrack(e.modelName,e.T.curves,r,"position");void 0!==i&&t.push(i)}if(void 0!==e.R&&Object.keys(e.R.curves).length>0){let r=this.generateRotationTrack(e.modelName,e.R.curves,i,e.preRotation,e.postRotation,e.eulerOrder);void 0!==r&&t.push(r)}if(void 0!==e.S&&Object.keys(e.S.curves).length>0){let r=this.generateVectorTrack(e.modelName,e.S.curves,n,"scale");void 0!==r&&t.push(r)}if(void 0!==e.DeformPercent){let r=this.generateMorphTrack(e);void 0!==r&&t.push(r)}return t}generateVectorTrack(e,t,r,i){let n=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(n,t,r);return new eT.yC1(e+"."+i,n,a)}generateRotationTrack(e,t,r,i,n,a){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(eT.M8C.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(eT.M8C.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(eT.M8C.degToRad));let o=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(o,t,r);void 0!==i&&((i=i.map(eT.M8C.degToRad)).push(a),i=new eT.USm().fromArray(i),i=new eT._fP().setFromEuler(i)),void 0!==n&&((n=n.map(eT.M8C.degToRad)).push(a),n=new eT.USm().fromArray(n),n=new eT._fP().setFromEuler(n).invert());let l=new eT._fP,c=new eT.USm,u=[];for(let e=0;e<s.length;e+=3)c.set(s[e],s[e+1],s[e+2],a),l.setFromEuler(c),void 0!==i&&l.premultiply(i),void 0!==n&&l.multiply(n),l.toArray(u,e/3*4);return new eT.iLg(e+".quaternion",o,u)}generateMorphTrack(e){let t=e.DeformPercent.curves.morph,r=t.values.map(function(e){return e/100}),i=P.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new eT.dUE(e.modelName+".morphTargetInfluences["+i+"]",t.times,r)}getTimesForAllAxes(e){let t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),void 0!==e.z&&(t=t.concat(e.z.times)),(t=t.sort(function(e,t){return e-t})).length>1){let e=1,r=t[0];for(let i=1;i<t.length;i++){let n=t[i];n!==r&&(t[e]=n,r=n,e++)}t=t.slice(0,e)}return t}getKeyframeTrackValues(e,t,r){let i=[],n=-1,a=-1,o=-1;return e.forEach(function(e){if(t.x&&(n=t.x.times.indexOf(e)),t.y&&(a=t.y.times.indexOf(e)),t.z&&(o=t.z.times.indexOf(e)),-1!==n){let e=t.x.values[n];i.push(e),r[0]=e}else i.push(r[0]);if(-1!==a){let e=t.y.values[a];i.push(e),r[1]=e}else i.push(r[1]);if(-1!==o){let e=t.z.values[o];i.push(e),r[2]=e}else i.push(r[2])}),i}interpolateRotations(e){for(let t=1;t<e.values.length;t++){let r=e.values[t-1],i=e.values[t]-r,n=Math.abs(i);if(n>=180){let a=n/180,o=i/a,s=r+o,l=e.times[t-1],c=(e.times[t]-l)/a,u=l+c,h=[],A=[];for(;u<e.times[t];)h.push(u),u+=c,A.push(s),s+=o;e.times=Am(e.times,t,h),e.values=Am(e.values,t,A)}}}}class Ae{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 Ai,this.nodeStack=[],this.currentProp=[],this.currentPropName="";let t=this,r=e.split(/[\r\n]+/);return r.forEach(function(e,i){let n=e.match(/^[\s\t]*;/),a=e.match(/^[\s\t]*$/);if(n||a)return;let o=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),s=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),l=e.match("^\\t{"+(t.currentIndent-1)+"}}");o?t.parseNodeBegin(e,o):s?t.parseNodeProperty(e,s,r[++i]):l?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)}),this.allNodes}parseNodeBegin(e,t){let r=t[1].trim().replace(/^"/,"").replace(/"$/,""),i=t[2].split(",").map(function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")}),n={name:r},a=this.parseNodeAttr(i),o=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(r,n):r in o?("PoseNode"===r?o.PoseNode.push(n):void 0!==o[r].id&&(o[r]={},o[r][o[r].id]=o[r]),""!==a.id&&(o[r][a.id]=n)):"number"==typeof a.id?(o[r]={},o[r][a.id]=n):"Properties70"!==r&&("PoseNode"===r?o[r]=[n]:o[r]=n),"number"==typeof a.id&&(n.id=a.id),""!==a.name&&(n.attrName=a.name),""!==a.type&&(n.attrType=a.type),this.pushStack(n)}parseNodeAttr(e){let t=e[0];""!==e[0]&&isNaN(t=parseInt(e[0]))&&(t=e[0]);let r="",i="";return e.length>1&&(r=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:r,type:i}}parseNodeProperty(e,t,r){let i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),n=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===i&&","===n&&(n=r.replace(/"/g,"").replace(/,$/,"").trim());let a=this.getCurrentNode();if("Properties70"===a.name){this.parseNodeSpecialProperty(e,i,n);return}if("C"===i){let e=n.split(",").slice(1),t=parseInt(e[0]),r=parseInt(e[1]),o=n.split(",").slice(3);o=o.map(function(e){return e.trim().replace(/^"/,"")}),i="connections",function(e,t){for(let r=0,i=e.length,n=t.length;r<n;r++,i++)e[i]=t[r]}(n=[t,r],o),void 0===a[i]&&(a[i]=[])}"Node"===i&&(a.id=n),i in a&&Array.isArray(a[i])?a[i].push(n):"a"!==i?a[i]=n:a.a=n,this.setCurrentProp(a,i),"a"===i&&","!==n.slice(-1)&&(a.a=AA(n))}parseNodePropertyContinued(e){let t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=AA(t.a))}parseNodeSpecialProperty(e,t,r){let i=r.split('",').map(function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")}
884),n=i[0],a=i[1],o=i[2],s=i[3],l=i[4];switch(a){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=AA(l)}this.getPrevNode()[n]={type:a,type2:o,flag:s,value:l},this.setCurrentProp(this.getPrevNode(),n)}}class At{parse(e){let t=new Ar(e);t.skip(23);let r=t.getUint32();if(r<6400)throw Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);let i=new Ai;for(;!this.endOfContent(t);){let e=this.parseNode(t,r);null!==e&&i.add(e.name,e)}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 r={},i=t>=7500?e.getUint64():e.getUint32(),n=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();let a=e.getUint8(),o=e.getString(a);if(0===i)return null;let s=[];for(let t=0;t<n;t++)s.push(this.parseProperty(e));let l=s.length>0?s[0]:"",c=s.length>1?s[1]:"",u=s.length>2?s[2]:"";for(r.singleProperty=1===n&&e.getOffset()===i;i>e.getOffset();){let i=this.parseNode(e,t);null!==i&&this.parseSubNode(o,r,i)}return r.propertyList=s,"number"==typeof l&&(r.id=l),""!==c&&(r.attrName=c),""!==u&&(r.attrType=u),""!==o&&(r.name=o),r}parseSubNode(e,t,r){if(!0===r.singleProperty){let e=r.propertyList[0];Array.isArray(e)?(t[r.name]=r,r.a=e):t[r.name]=e}else if("Connections"===e&&"C"===r.name){let e=[];r.propertyList.forEach(function(t,r){0!==r&&e.push(t)}),void 0===t.connections&&(t.connections=[]),t.connections.push(e)}else if("Properties70"===r.name)Object.keys(r).forEach(function(e){t[e]=r[e]});else if("Properties70"===e&&"P"===r.name){let e,i=r.propertyList[0],n=r.propertyList[1],a=r.propertyList[2],o=r.propertyList[3];0===i.indexOf("Lcl ")&&(i=i.replace("Lcl ","Lcl_")),0===n.indexOf("Lcl ")&&(n=n.replace("Lcl ","Lcl_")),e="Color"===n||"ColorRGB"===n||"Vector"===n||"Vector3D"===n||0===n.indexOf("Lcl_")?[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:r.propertyList[4],t[i]={type:n,type2:a,flag:o,value:e}}else void 0===t[r.name]?"number"==typeof r.id?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:"PoseNode"===r.name?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):void 0===t[r.name][r.id]&&(t[r.name][r.id]=r)}parseProperty(e){let t;let r=e.getString(1);switch(r){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 t=e.getUint32(),e.getArrayBuffer(t);case"S":return t=e.getUint32(),e.getString(t);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":let i=e.getUint32(),n=e.getUint32(),a=e.getUint32();if(0===n)switch(r){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)}let o=new Ar(h2(new Uint8Array(e.getArrayBuffer(a))).buffer);switch(r){case"b":case"c":return o.getBooleanArray(i);case"d":return o.getFloat64Array(i);case"f":return o.getFloat32Array(i);case"i":return o.getInt32Array(i);case"l":return o.getInt64Array(i)}default:throw Error("THREE.FBXLoader: Unknown property type "+r)}}}class Ar{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===t||t}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(1&this.getUint8())==1}getBooleanArray(e){let t=[];for(let r=0;r<e;r++)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 r=0;r<e;r++)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()),2147483648&t)?(t=4294967295&~t,4294967295==(e=4294967295&~e)&&(t=t+1&4294967295),-(4294967296*t+(e=e+1&4294967295))):4294967296*t+e}getInt64Array(e){let t=[];for(let r=0;r<e;r++)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()),4294967296*t+e}getFloat32(){let e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){let t=[];for(let r=0;r<e;r++)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 r=0;r<e;r++)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 r=0;r<e;r++)t[r]=this.getUint8();let r=t.indexOf(0);return r>
884=0&&(t=t.slice(0,r)),ll(new Uint8Array(t))}}class Ai{add(e,t){this[e]=t}}function An(e){let t=e.match(/FBXVersion: (\d+)/);if(t)return parseInt(t[1]);throw Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Aa(e){return e/46186158e3}let Ao=[];function As(e,t,r,i){let n;switch(i.mappingType){case"ByPolygonVertex":n=e;break;case"ByPolygon":n=t;break;case"ByVertice":n=r;break;case"AllSame":n=i.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+i.mappingType)}"IndexToDirect"===i.referenceType&&(n=i.indices[n]);let a=n*i.dataSize,o=a+i.dataSize;return function(e,t,r,i){for(let n=r,a=0;n<i;n++,a++)e[a]=t[n];return e}(Ao,i.buffer,a,o)}let Al=new eT.USm,Ac=new eT.Pa4;function Au(e){let t=new eT.yGw,r=new eT.yGw,i=new eT.yGw,n=new eT.yGw,a=new eT.yGw,o=new eT.yGw,s=new eT.yGw,l=new eT.yGw,c=new eT.yGw,u=new eT.yGw,h=new eT.yGw,A=new eT.yGw,d=e.inheritType?e.inheritType:0;if(e.translation&&t.setPosition(Ac.fromArray(e.translation)),e.preRotation){let t=e.preRotation.map(eT.M8C.degToRad);t.push(e.eulerOrder),r.makeRotationFromEuler(Al.fromArray(t))}if(e.rotation){let t=e.rotation.map(eT.M8C.degToRad);t.push(e.eulerOrder),i.makeRotationFromEuler(Al.fromArray(t))}if(e.postRotation){let t=e.postRotation.map(eT.M8C.degToRad);t.push(e.eulerOrder),n.makeRotationFromEuler(Al.fromArray(t)),n.invert()}e.scale&&a.scale(Ac.fromArray(e.scale)),e.scalingOffset&&s.setPosition(Ac.fromArray(e.scalingOffset)),e.scalingPivot&&o.setPosition(Ac.fromArray(e.scalingPivot)),e.rotationOffset&&l.setPosition(Ac.fromArray(e.rotationOffset)),e.rotationPivot&&c.setPosition(Ac.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(h.copy(e.parentMatrix),u.copy(e.parentMatrixWorld));let m=r.clone().multiply(i).multiply(n),f=new eT.yGw;f.extractRotation(u);let p=new eT.yGw;p.copyPosition(u);let g=p.clone().invert().multiply(u),y=f.clone().invert().multiply(g),v=new eT.yGw;if(0===d)v.copy(f).multiply(m).multiply(y).multiply(a);else if(1===d)v.copy(f).multiply(y).multiply(m).multiply(a);else{let e=new eT.yGw().scale(new eT.Pa4().setFromMatrixScale(h)).clone().invert(),t=y.clone().multiply(e);v.copy(f).multiply(m).multiply(t).multiply(a)}let E=c.clone().invert(),x=o.clone().invert(),C=t.clone().multiply(l).multiply(c).multiply(r).multiply(i).multiply(n).multiply(E).multiply(s).multiply(o).multiply(a).multiply(x),w=new eT.yGw().copyPosition(C),B=u.clone().multiply(w);return A.copyPosition(B),(C=A.clone().multiply(v)).premultiply(u.invert()),C}function Ah(e){return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),"ZYX"):["ZYX","YZX","XZY","ZXY","YXZ","XYZ"][e]}function AA(e){return e.split(",").map(function(e){return parseFloat(e)})}function Ad(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=e.byteLength),ll(new Uint8Array(e,t,r))}function Am(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}function Af(e){return(0,eR.H)(h6,e)}function Ap({path:e,...t}){let r=Af(e).children[0];return eD.createElement(s1,(0,eS.Z)({},t,{object:r}))}Af.preload=e=>eR.H.preload(h6,e),Af.clear=e=>eR.H.clear(h6,e);class Ag{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){let t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return -1}_onMessage(e,t){let r=this.workersResolve[e];if(r&&r(t),this.queue.length){let{resolve:t,msg:r,transfer:i}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(r,i)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(r=>{let i=this._getIdleWorker();-1!==i?(this._initWorker(i),this.workerStatus|=1<<i,this.workersResolve[i]=r,this.workers[i].postMessage(e,t)):this.queue.push({resolve:r,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}var Ay=r(82957).lW;class Av{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}
884class AE{constructor(e,t,r,i){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,r),this._littleEndian=i,this._offset=0}_nextUint8(){let e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){let e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){let e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){let e=this._dataView.getUint32(this._offset,this._littleEndian),t=this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e+4294967296*t}_nextInt32(){let e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){let t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t){void 0===t&&(t=0);let r=this._offset,i=0;for(;this._dataView.getUint8(this._offset)!==t&&i<e;)i++,this._offset++;return i<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,i)}}let Ax=[171,75,84,88,32,50,48,187,13,10,26,10];function AC(e){return"undefined"!=typeof TextDecoder?new TextDecoder().decode(e):Ay.from(e).toString("utf8")}var Aw=r(82957).lW;let AB={env:{emscripten_notify_memory_growth:function(e){F=new Uint8Array(R.exports.memory.buffer)}}};class AI{init(){return T||("undefined"!=typeof fetch?T=fetch("data:application/wasm;base64,"+A_).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,AB)).then(this._init):T=WebAssembly.instantiate(Aw.from(A_,"base64"),AB).then(this._init)),T}_init(e){R=e.instance,AB.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!R)throw Error("ZSTDDecoder: Await .init() before decoding.");let r=e.byteLength,i=R.exports.malloc(r);F.set(e,i),t=t||Number(R.exports.ZSTD_findDecompressedSize(i,r));let n=R.exports.malloc(t),a=R.exports.ZSTD_decompress(n,t,i,r),o=F.slice(n,n+a);return R.exports.free(i),R.exports.free(n),o}}let A_="
vendor: 19,971 bytes, line 884
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wJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQ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rjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAea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
vendor: 19,006 bytes, line 884
884hCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5C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AwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ"
884;class Ab extends eT.EB7{constructor(e,t,r){super(void 0,e[0].width,e[0].height,t,r,eT.fY$),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class AM extends eT.EB7{constructor(e,t,r,i,n,a){super(e,t,r,n,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=eT.uWy}}class AS extends eT.xEZ{constructor(e=null,t=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=eT.TyD,this.minFilter=eT.TyD,this.wrapR=eT.uWy,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}var AD=Object.defineProperty,AP=(e,t,r)=>t in e?AD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,AT=(e,t,r)=>(AP(e,"symbol"!=typeof t?t+"":t,r),r);let AR="srgb",AF=new WeakMap,AQ=0,Az=(()=>{let e=class extends eT.aNw{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new Ag,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}detectSupport(e){return this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},e.capabilities.isWebGL2&&(this.workerConfig.etc1Supported=!1),this}init(){if(!this.transcoderPending){let t=new eT.hH6(this.manager);t.setPath(this.transcoderPath),t.setWithCredentials(this.withCredentials);let r=t.loadAsync("basis_transcoder.js"),i=new eT.hH6(this.manager);i.setPath(this.transcoderPath),i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);let n=i.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([r,n]).then(([t,r])=>{let i=e.BasisWorker.toString(),n=["/* constants */","let _EngineFormat = "+JSON.stringify(e.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(e.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(e.BasisFormat),"/* basis_transcoder.js */",t,"/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([n])),this.transcoderBinary=r,this.workerPool.setWorkerCreator(()=>{let e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e})}),AQ>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),AQ++}return this.transcoderPending}load(e,t,r,i){if(null===this.workerConfig)throw Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");let n=new eT.hH6(this.manager);n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials),n.load(e,e=>
884{if(AF.has(e))return AF.get(e).promise.then(t).catch(i);this._createTexture(e).then(e=>t?t(e):null).catch(i)},r,i)}_createTextureFrom(e,t){let r;let{faces:i,width:n,height:a,format:o,type:s,error:l,dfdFlags:c}=e;if("error"===s)return Promise.reject(l);if(6===t.faceCount)r=new Ab(i,o,eT.ywz);else{let e=i[0].mipmaps;r=t.layerCount>1?new AM(e,n,a,t.layerCount,o,eT.ywz):new eT.EB7(e,n,a,o,eT.ywz)}r.minFilter=1===i[0].mipmaps.length?eT.wem:eT.D1R,r.magFilter=eT.wem,r.generateMipmaps=!1,r.needsUpdate=!0;let u=AG(t);return"colorSpace"in r?r.colorSpace=u:r.encoding=u===AR?3001:3e3,r.premultiplyAlpha=!!(1&c),r}async _createTexture(e,t={}){let r=function(e){let t=new Uint8Array(e.buffer,e.byteOffset,Ax.length);if(t[0]!==Ax[0]||t[1]!==Ax[1]||t[2]!==Ax[2]||t[3]!==Ax[3]||t[4]!==Ax[4]||t[5]!==Ax[5]||t[6]!==Ax[6]||t[7]!==Ax[7]||t[8]!==Ax[8]||t[9]!==Ax[9]||t[10]!==Ax[10]||t[11]!==Ax[11])throw Error("Missing KTX 2.0 identifier.");let r=new Av,i=17*Uint32Array.BYTES_PER_ELEMENT,n=new AE(e,Ax.length,i,!0);r.vkFormat=n._nextUint32(),r.typeSize=n._nextUint32(),r.pixelWidth=n._nextUint32(),r.pixelHeight=n._nextUint32(),r.pixelDepth=n._nextUint32(),r.layerCount=n._nextUint32(),r.faceCount=n._nextUint32();let a=n._nextUint32();r.supercompressionScheme=n._nextUint32();let o=n._nextUint32(),s=n._nextUint32(),l=n._nextUint32(),c=n._nextUint32(),u=n._nextUint64(),h=n._nextUint64(),A=new AE(e,Ax.length+i,24*a,!0);for(let t=0;t<a;t++)r.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+A._nextUint64(),A._nextUint64()),uncompressedByteLength:A._nextUint64()});let d=new AE(e,o,s,!0),m={vendorId:d._skip(4)._nextUint16(),descriptorType:d._nextUint16(),versionNumber:d._nextUint16(),descriptorBlockSize:d._nextUint16(),colorModel:d._nextUint8(),colorPrimaries:d._nextUint8(),transferFunction:d._nextUint8(),flags:d._nextUint8(),texelBlockDimension:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],bytesPlane:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],samples:[]},f=(m.descriptorBlockSize/4-6)/4;for(let e=0;e<f;e++){let t={bitOffset:d._nextUint16(),bitLength:d._nextUint8(),channelType:d._nextUint8(),samplePosition:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=d._nextInt32(),t.sampleUpper=d._nextInt32()):(t.sampleLower=d._nextUint32(),t.sampleUpper=d._nextUint32()),m.samples[e]=t}r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(m);let p=new AE(e,l,c,!0);for(;p._offset<c;){let e=p._nextUint32(),t=p._scan(e),i=AC(t);if(r.keyValue[i]=p._nextUint8Array(e-t.byteLength-1),i.match(/^ktx/i)){let e=AC(r.keyValue[i]);r.keyValue[i]=e.substring(0,e.lastIndexOf("\0"))}let n=e%4?4-e%4:0;p._skip(n)}if(h<=0)return r;let g=new AE(e,u,h,!0),y=g._nextUint16(),v=g._nextUint16(),E=g._nextUint32(),x=g._nextUint32(),C=g._nextUint32(),w=g._nextUint32(),B=[];for(let e=0;e<a;e++)B.push({imageFlags:g._nextUint32(),rgbSliceByteOffset:g._nextUint32(),rgbSliceByteLength:g._nextUint32(),alphaSliceByteOffset:g._nextUint32(),alphaSliceByteLength:g._nextUint32()});let I=u+g._offset,_=I+E,b=_+x,M=b+C,S=new Uint8Array(e.buffer,e.byteOffset+I,E),D=new Uint8Array(e.buffer,e.byteOffset+_,x),P=new Uint8Array(e.buffer,e.byteOffset+b,C),T=new Uint8Array(e.buffer,e.byteOffset+M,w);return r.globalData={endpointCount:y,selectorCount:v,imageDescs:B,endpointsData:S,selectorsData:D,tablesData:P,extendedData:T},r}(new Uint8Array(e));if(0!==r.vkFormat)return AU(r);let i=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:t},[e])).then(e=>this._createTextureFrom(e.data,r));return AF.set(e,{promise:i}),i}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),AQ--,this}};return AT(e,"BasisFormat",{ETC1S:0,UASTC_4x4:1}),AT(e,"TranscoderFormat",{ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16}),AT(e,"EngineFormat",{RGBAFormat:eT.wk1,RGBA_ASTC_4x4_Format:eT.ptH,RGBA_BPTC_Format:eT.bsb,RGBA_ETC2_EAC_Format:eT.ekQ,RGBA_PVRTC_4BPPV1_Format:eT.eaV,RGBA_S3TC_DXT5_Format:eT.ILR,RGB_ETC1_Format:eT.fto,RGB_ETC2_Format:eT.l0P,RGB_PVRTC_4BPPV1_Format:eT._AM,RGB_S3TC_DXT1_Format:eT.wuA}),AT(e,"BasisWorker",function(){let e,t,r;let i=_EngineFormat,n=_TranscoderFormat,a=_BasisFormat;self.addEventListener("message",function(o){let u=o.data;switch(u.type){case"init":var h;e=u.config,h=u.transcoderBinary,t=new Promise(e=>{BASIS(r={wasmBinary:h,onRuntimeInitialized:e})}).then(()=>{r.initializeBasis(),void 0===r.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")});break;case"transcode":t.then(()=>{try{let{faces:t,buffers:o,width:h,height:A,hasAlpha:d,format:m,dfdFlags:f}
884=function(t){let o=new r.KTX2File(new Uint8Array(t));function u(){o.close(),o.delete()}if(!o.isValid())throw u(),Error("THREE.KTX2Loader:	Invalid or unsupported .ktx2 file");let h=o.isUASTC()?a.UASTC_4x4:a.ETC1S,A=o.getWidth(),d=o.getHeight(),m=o.getLayers()||1,f=o.getLevels(),p=o.getFaces(),g=o.getHasAlpha(),y=o.getDFDFlags(),{transcoderFormat:v,engineFormat:E}=function(t,r,o,u){let h;let A=t===a.ETC1S?s:l;for(let i=0;i<A.length;i++){let n=A[i];if(e[n.if]&&n.basisFormat.includes(t)&&(!u||!(n.transcoderFormat.length<2))&&(!n.needsPowerOfTwo||c(r)&&c(o)))return{transcoderFormat:n.transcoderFormat[u?1:0],engineFormat:n.engineFormat[u?1:0]}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),{transcoderFormat:n.RGBA32,engineFormat:i.RGBAFormat}}(h,A,d,g);if(!A||!d||!f)throw u(),Error("THREE.KTX2Loader:	Invalid texture");if(!o.startTranscoding())throw u(),Error("THREE.KTX2Loader: .startTranscoding failed");let x=[],C=[];for(let e=0;e<p;e++){let t=[];for(let r=0;r<f;r++){let i,n;let a=[];for(let t=0;t<m;t++){let s=o.getImageLevelInfo(r,t,e);0===e&&0===r&&0===t&&(s.origWidth%4!=0||s.origHeight%4!=0)&&console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),f>1?(i=s.origWidth,n=s.origHeight):(i=s.width,n=s.height);let l=new Uint8Array(o.getImageTranscodedSizeInBytes(r,t,0,v));if(!o.transcodeImage(l,r,t,e,v,0,-1,-1))throw u(),Error("THREE.KTX2Loader: .transcodeImage failed.");a.push(l)}let s=function(e){if(1===e.length)return e[0];let t=0;for(let r=0;r<e.length;r++)t+=e[r].byteLength;let r=new Uint8Array(t),i=0;for(let t=0;t<e.length;t++){let n=e[t];r.set(n,i),i+=n.byteLength}return r}(a);t.push({data:s,width:i,height:n}),C.push(s.buffer)}x.push({mipmaps:t,width:A,height:d,format:E})}return u(),{faces:x,buffers:C,width:A,height:d,hasAlpha:g,format:E,dfdFlags:y}}(u.buffer);self.postMessage({type:"transcode",id:u.id,faces:t,width:h,height:A,hasAlpha:d,format:m,dfdFlags:f},o)}catch(e){console.error(e),self.postMessage({type:"error",id:u.id,error:e.message})}})}});let o=[{if:"astcSupported",basisFormat:[a.UASTC_4x4],transcoderFormat:[n.ASTC_4x4,n.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[n.BC7_M5,n.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[n.BC1,n.BC3],engineFormat:[i.RGB_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[n.ETC1,n.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[n.ETC1],engineFormat:[i.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[n.PVRTC1_4_RGB,n.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],s=o.sort(function(e,t){return e.priorityETC1S-t.priorityETC1S}),l=o.sort(function(e,t){return e.priorityUASTC-t.priorityUASTC});function c(e){return e<=2||(e&e-1)==0&&0!==e}}),e})(),Ak=new Set([eT.wk1,eT.av9,eT.hEm]),AL={109:eT.wk1,97:eT.wk1,37:eT.wk1,43:eT.wk1,103:eT.av9,83:eT.av9,16:eT.av9,22:eT.av9,100:eT.hEm,76:eT.hEm,15:eT.hEm,9:eT.hEm,166:eT.Djp,165:eT.Djp},AO={109:eT.VzW,97:eT.cLu,37:eT.ywz,43:eT.ywz,103:eT.VzW,83:eT.cLu,16:eT.ywz,22:eT.ywz,100:eT.VzW,76:eT.cLu,15:eT.ywz,9:eT.ywz,166:eT.ywz,165:eT.ywz};async function AU(e){let t,r;let{vkFormat:i}=e;if(void 0===AL[i])throw Error("THREE.KTX2Loader: Unsupported vkFormat.");2===e.supercompressionScheme&&(Q||(Q=new Promise(async e=>{let t=new AI;await t.init(),e(t)})),t=await Q);let n=[];for(let r=0;r<e.levels.length;r++){let a,o;let s=Math.max(1,e.pixelWidth>>r),l=Math.max(1,e.pixelHeight>>r),c=e.pixelDepth?Math.max(1,e.pixelDepth>
884>r):0,u=e.levels[r];if(0===e.supercompressionScheme)a=u.levelData;else if(2===e.supercompressionScheme)a=t.decode(u.levelData,u.uncompressedByteLength);else throw Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");o=AO[i]===eT.VzW?new Float32Array(a.buffer,a.byteOffset,a.byteLength/Float32Array.BYTES_PER_ELEMENT):AO[i]===eT.cLu?new Uint16Array(a.buffer,a.byteOffset,a.byteLength/Uint16Array.BYTES_PER_ELEMENT):a,n.push({data:o,width:s,height:l,depth:c})}if(Ak.has(AL[i]))r=0===e.pixelDepth?new eT.IEO(n[0].data,e.pixelWidth,e.pixelHeight):new AS(n[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw Error("THREE.KTX2Loader: Unsupported pixelDepth.");r=new eT.EB7(n,e.pixelWidth,e.pixelHeight)}r.mipmaps=n,r.type=AO[i],r.format=AL[i],r.needsUpdate=!0;let a=AG(e);return"colorSpace"in r?r.colorSpace=a:r.encoding=a===AR?3001:3e3,Promise.resolve(r)}function AG(e){let t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?AR:"srgb-linear":10===t.colorPrimaries?2===t.transferFunction?"display-p3":"display-p3-linear":(0===t.colorPrimaries||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),"")}let AN="https://cdn.jsdelivr.net/gh/pmndrs/drei-assets@master";function AH(e,t=`${AN}/basis/`){let r=(0,eR.D)(e=>e.gl),i=(0,eR.H)(Az,(0,sB.ci)(e)?Object.values(e):e,e=>{e.detectSupport(r),e.setTranscoderPath(t)});if((0,eD.useEffect)(()=>{(Array.isArray(i)?i:[i]).forEach(r.initTexture)},[r,i]),!(0,sB.ci)(e))return i;{let t=Object.keys(e),r={};return t.forEach(e=>Object.assign(r,{[e]:i[t.indexOf(e)]})),r}}AH.preload=(e,t=`${AN}/basis/`)=>eR.H.preload(Az,e,e=>{e.setTranscoderPath(t)}),AH.clear=e=>eR.H.clear(Az,e);let Aj=({children:e,input:t,basisPath:r})=>{let i=AH(t,r);return eD.createElement(eD.Fragment,null,null==e?void 0:e(i))};var AJ=r(40303);let AV="undefined"!=typeof window&&"function"==typeof(null==(K=window.document)?void 0:K.createElement)&&"string"==typeof(null==(Y=window.navigator)?void 0:Y.userAgent),AK=null;async function AY(...e){var t;null!==(t=AK)&&void 0!==t||(AK=await Promise.resolve().then(r.bind(r,40303)));let i=AK.default;return i.isSupported()?new i(...e):null}function AW(e,{unsuspend:t="loadedmetadata",start:r=!0,hls:i={},crossOrigin:n="anonymous",muted:a=!0,loop:o=!0,playsInline:s=!0,onVideoFrame:l,...c}={}){let u=(0,eR.D)(e=>e.gl),h=(0,eD.useRef)(null),A=(0,oN.Rq)(()=>new Promise(async r=>{let l,A;"string"==typeof e?l=e:A=e;let d=Object.assign(document.createElement("video"),{src:l,srcObject:A,crossOrigin:n,loop:o,muted:a,playsInline:s,...c});if(l&&AV&&l.endsWith(".m3u8")){let e=h.current=await AY(i);e&&(e.on(AJ.Events.MEDIA_ATTACHED,()=>void e.loadSource(l)),e.attachMedia(d))}let m=new eT.fO1(d);"colorSpace"in m?m.colorSpace=u.outputColorSpace:m.encoding=u.outputEncoding,d.addEventListener(t,()=>r(m))}),[e]);return AX(A.source.data,l),(0,eD.useEffect)(()=>(r&&A.image.play(),()=>{h.current&&(h.current.destroy(),h.current=null)}),[A,r]),A}let Aq=(0,eD.forwardRef)(({children:e,src:t,...r},i)=>{let n=AW(t,r);return(0,eD.useEffect)(()=>()=>void n.dispose(),[n]),(0,eD.useImperativeHandle)(i,()=>n,[n]),eD.createElement(eD.Fragment,null,null==e?void 0:e(n))}),AX=(e,t)=>{(0,eD.useEffect)(()=>{let r;if(!t||!e.requestVideoFrameCallback)return;let i=(...n)=>{t(...n),r=e.requestVideoFrameCallback(i)};return e.requestVideoFrameCallback(i),()=>e.cancelVideoFrameCallback(r)},[e,t])},AZ=(e,t)=>{if(Array.isArray(e))return e[0];{let r=null!=t?t:Object.keys(e)[0];return e[r][0]}},A$=e=>{for(let t=3;t<e.length;t+=4)if(0!==e[t])return!1;return!0};function A1(e,t,r,i,n,a){let o=eD.useRef((0,eR.D)(e=>e.viewport)),s=eD.useRef(null),l=eD.useRef(0),c=eD.useRef(e),u=eD.useRef(t),h=eD.useRef(r),[A,d]=(0,eD.useState)(null),[m,f]=eD.useState(new eT.xEZ),p=eD.useMemo(()=>new eT.dpR,[]),[g,y]=(0,eD.useState)(null),v=eD.useCallback((e,t,r)=>{let i=t*(o.current.aspect>e/t?o.current.width/e:o.current.height/t),n=e*(o.current.aspect>e/t?o.current.width/e:o.current.height/t)*r,a=i*r,s=Math.min(1,n),l=Math.min(1,a);return n>1&&(s=1,l=a/n*1),new eT.Pa4(s,l,1)},[]),E=eD.useCallback((e,t)=>{if(!e.image)return{rows:0,columns:0,frameWidth:0,frameHeight:0,emptyFrames:[]};{let r=document.createElement("canvas"),i=r.getContext("2d",a);if(!i)throw Error("Failed to get 2d context");r.width=e.image.width,r.height=e.image.height,i.drawImage(e.image,0,0
884);let n=e.image.width,o=e.image.height,s=Math.round(Math.sqrt(n/o*t)),l=Math.round(t/s),c=n/s,u=o/l,h=[];for(let e=0;e<l;e++)for(let r=0;r<s;r++){if(e*s+r>=t){h.push({row:e,col:r});continue}A$(i.getImageData(r*c,e*u,c,u).data)&&h.push({row:e,col:r})}return{rows:l,columns:s,frameWidth:c,frameHeight:u,emptyFrames:h}}},[a]),x=eD.useCallback(e=>{let t=e=>{let t=null;for(let r of e){let{w:e,h:i}=r.frame,n=e*i;(!t||n>t.area)&&(t={w:e,h:i,area:n})}return e.map(e=>{let{w:r,h:i}=e.frame,n=r*i,a=t?n===t.area?1:Math.sqrt(n/t.area):1;return{...e,scaleRatio:a}})};if(Array.isArray(e))return t(e);{let r={};for(let i in e)r[i]=t(e[i]);return r}},[]),C=eD.useCallback(()=>{let e={},t=s.current,r=h.current;if(t){if(r&&Array.isArray(t.frames)){for(let i=0;i<r.length;i++)for(let n of(e[r[i]]=[],t.frames)){let t=n.frame,a=n.sourceSize.w,o=n.sourceSize.h;"string"==typeof n.filename&&-1!==n.filename.toLowerCase().indexOf(r[i].toLowerCase())&&e[r[i]].push({...n,frame:t,sourceSize:{w:a,h:o}})}for(let t in e){let r=x(e[t]);Array.isArray(r)&&(e[t]=r)}return e}if(r&&"object"==typeof t.frames){for(let i=0;i<r.length;i++)for(let n in e[r[i]]=[],t.frames){let a=t.frames[n],o=a.frame,s=a.sourceSize.w,l=a.sourceSize.h;"string"==typeof n&&-1!==n.toLowerCase().indexOf(r[i].toLowerCase())&&e[r[i]].push({...a,frame:o,sourceSize:{w:s,h:l}})}for(let t in e){let r=x(e[t]);Array.isArray(r)&&(e[t]=r)}return e}{let e=[];return null!=t&&t.frames&&(e=Array.isArray(t.frames)?t.frames.map(e=>({...e,x:e.frame.x,y:e.frame.y,w:e.frame.w,h:e.frame.h})):Object.values(t.frames).flat().map(e=>({...e,x:e.frame.x,y:e.frame.y,w:e.frame.w,h:e.frame.h}))),x(e)}}return[]},[x,s]),w=eD.useCallback((e,t)=>{let r=new eT.Pa4(1,1,1);if(null===e){if(t&&i){let e=t.image.width,n=t.image.height;l.current=i;let{rows:a,columns:o,frameWidth:c,frameHeight:u,emptyFrames:h}=E(t,i),A={frames:[],meta:{version:"1.0",size:{w:e,h:n},rows:a,columns:o,frameWidth:c,frameHeight:u,scale:"1"}};for(let e=0;e<a;e++)for(let t=0;t<o;t++)!(null!=h?h:[]).some(r=>r.row===e&&r.col===t)&&Array.isArray(A.frames)&&A.frames.push({frame:{x:t*c,y:e*u,w:c,h:u},scaleRatio:1,rotated:!1,trimmed:!1,spriteSourceSize:{x:0,y:0,w:c,h:u},sourceSize:{w:c,h:u}});r=v(c,u,.1),s.current=A}s.current&&s.current.frames&&(s.current.frames=x(s.current.frames))}else if(t){s.current=e,s.current.frames=C(),l.current=Array.isArray(e.frames)?e.frames.length:Object.keys(e.frames).length;let{w:t,h:i}=AZ(e.frames).sourceSize;r=v(t,i,.1)}d(s.current),"encoding"in t?t.encoding=3001:"colorSpace"in t&&(t.colorSpace=eT.KI_),f(t),y({spriteTexture:t,spriteData:s.current,aspect:r})},[E,i,C,v,x]),B=eD.useCallback((e,t,r)=>{Promise.all([fetch(e).then(e=>e.json()),new Promise(e=>{p.load(t,e)})]).then(e=>{r(e[0],e[1])})},[p]),I=eD.useCallback(e=>{if(!e&&!c.current)throw Error("Either textureUrl or input must be provided");let t=null!=e?e:c.current;if(!t)throw Error("A valid texture URL must be provided");p.load(t,e=>w(null,e))},[p,w]),_=eD.useCallback((e,t)=>{t&&e?B(t,e,w):I(e)},[B,I,w]);return eD.useLayoutEffect(()=>{u.current&&c.current?B(u.current,c.current,w):c.current&&I();let e=c.current;return()=>{e&&eR.H.clear(eT.dpR,e)}},[B,I,w]),eD.useLayoutEffect(()=>{null==n||n(m,null!=A?A:null)},[m,A,n]),{spriteObj:g,loadJsonAndTexture:_}}function A0(e,t,...r){let i=eD.useRef(),n=(0,eR.D)(e=>e.scene);return eD.useLayoutEffect(()=>{let a;if(e&&null!=e&&e.current&&t&&(i.current=a=new t(e.current,...r)),a)return a.traverse(e=>e.raycast=()=>null),n.add(a),()=>{i.current=void 0,n.remove(a),null==a.dispose||a.dispose()}},[n,t,e,...r]),(0,eR.F)(()=>{var e;null==(e=i.current)||null==e.update||e.update()}),i}A1.preload=e=>eR.H.preload(eT.dpR,e),A1.clear=e=>eR.H.clear(eT.dpR,e);let A2=({type:e,args:t=[]})=>{let r=eD.useRef(null),i=eD.useRef(null);return eD.useLayoutEffect(()=>{i.current=r.current.parent}),A0(i,e,...t),eD.createElement("object3D",{ref:r})};var A3=r(57243),A4=r.n(A3);function A5(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}function A6({showPanel:e=0,className:t,parent:r}){let i=function(e,t=[],r){let[i,n]=eD.useState();return eD.useLayoutEffect(()=>{let t=e();return n(t),A5(void 0,t),()=>A5(void 0,null)},t),i}(()=>new(A4()),[]);return eD.useEffect(()=>{if(i){let n=r&&r.current||document.body;i.showPanel(e),null==n||n.appendChild(i.dom);let a=(null!=t?t:"").split(" ").filter(e=>e);a.length&&i.dom.classList.add(...a);let o=(0,eR.o)(()=>i.begin()),s=(0,eR.p)(()=>i.end());return()=>{a.length&&i.dom.classList.remove(...a),null==n||n.removeChild(i.dom),o(),s()}}},[r,i,t,e]),null}class A8{constructor(e,t,r){this.name=e,this.fg=t,this.bg=r,this.gradient=null,this.PR=Math.round(window.devicePixelRatio||1),this.WIDTH=90*this.PR,this.HEIGHT=48*this.PR,this.TEXT_X=3*this.PR,this.TEXT_Y=2*this.PR,this.GRAPH_X=3*this.PR,this.GRAPH_Y=15*this.PR,this.GRAPH_WIDTH=84*this.PR,this.GRAPH_HEIGHT=30*this.PR,this.canvas=document.createElement("canvas"),this.canvas.width=this.WIDTH,this.canvas.height=this.HEIGHT,this.canvas.style.width="90px",this.canvas.style.height="48px",this.canvas.style.position="absolute",this.canvas.style.cssText="width:90px;height:48px",this.context=this.canvas.getContext("2d"),this.initializeCanvas()}createGradient(){let e;if(!this.context)throw Error("No context");let t=this.context.createLinearGradient(0,this.GRAPH_Y,0,this.GRAPH_Y+this.GRAPH_HEIGHT),r=this.fg;switch(this.fg.toLowerCase()){case"#0ff":e="#006666";break;case"#0f0":e="#006600";break;case"#ff0":e="#666600";break;case"#e1e1e1":e="#666666";break;default:e=this.bg}return t.addColorStop(0,e),t.addColorStop(1,r),t}initializeCanvas(){this.context&&(this.context.font="bold "+9*this.PR+"px Helvetica,Arial,sans-serif",this.context.textBaseline="top",this.gradient=this.createGradient(),this.context.fillStyle=this.bg,this.context.fillRect(0,0,this.WIDTH,this.HEIGHT),this.context.fillStyle=this.fg,this.context.fillText(this.name,this.TEXT_X,this.TEXT_Y),this.context.fillStyle=this.fg,this.context.fillRect(this.GRAPH_X,this.GRAPH_Y,this.GRAPH_WIDTH,this.GRAPH_HEIGHT),this.context.fillStyle=this.bg,this.context.globalAlpha=.9,this.context.fillRect(this.GRAPH_X,this.GRAPH_Y,this.GRAPH_WIDTH,this.GRAPH_HEIGHT))}update(e,t,r,i,n=0){if(!this.context||!this.gradient)return;i=Math.max(i,t),this.context.globalAlpha=1,this.context.fillStyle=this.bg,this.context.fillRect(0,0,this.WIDTH,this.GRAPH_Y),this.context.fillStyle=this.fg,this.context.fillText(`${e.toFixed(n)} ${this.name} (${Math.min(1/0,e).toFixed(n)}-${parseFloat(Math.max(r,e).toFixed(n))})`,this.TEXT_X,this.TEXT_Y),this.context.drawImage(this.canvas,this.GRAPH_X+this.PR,this.GRAPH_Y,this.GRAPH_WIDTH-this.PR,this.GRAPH_HEIGHT,this.GRAPH_X,this.GRAPH_Y,this.GRAPH_WIDTH-this.PR,this.GRAPH_HEIGHT);let a=this.GRAPH_HEIGHT-(1-t/i)*this.GRAPH_HEIGHT;a>0&&(this.context.globalAlpha=1,this.context.fillStyle=this.gradient,this.context.fillRect(this.GRAPH_X+this.GRAPH_WIDTH-this.PR,this.GRAPH_Y+this.GRAPH_HEIGHT-a,this.PR,a))}}let A9=class e{constructor({trackGPU:t=!1,logsPerSecond:r=30,samplesLog:i=60,samplesGraph:n=10,precision:a=2,minimal:o=!1,horizontal:s=!0,mode:l=0}={}){this.gl=null,this.ext=null,this.activeQuery=null,this.gpuQueries=[],this.threeRendererPatched=!1,this.frames=0,this.renderCount=0,this.isRunningCPUProfiling=!1,this.totalCpuDuration=0,this.totalGpuDuration=0,this.totalGpuDurationCompute=0,this.totalFps=0,this.gpuPanel=null,this.gpuPanelCompute=null,this.averageFps={logs:[],graph:[]},this.averageCpu={logs:[],graph:[]},this.averageGpu={logs:[],graph:[]},this.averageGpuCompute={logs:[],graph:[]},this.handleClick=e=>{e.preventDefault(),this.showPanel(++this.mode%this.dom.children.length)},this.handleResize=()=>{this.resizePanel(this.fpsPanel,0),this.resizePanel(this.msPanel,1),this.gpuPanel&&this.resizePanel(this.gpuPanel,2),this.gpuPanelCompute&&this.resizePanel(this.gpuPanelCompute,3)},this.mode=l,this.horizontal=s,this.minimal=o,this.trackGPU=t,this.samplesLog=i,this.samplesGraph=n,this.precision=a,this.logsPerSecond=r,this.dom=document.createElement("div"),this.initializeDOM(),this.beginTime=performance.now(),this.prevTime=this.beginTime,this.prevCpuTime=this.beginTime,this.fpsPanel=this.addPanel
884(new e.Panel("FPS","#0ff","#002"),0),this.msPanel=this.addPanel(new e.Panel("CPU","#0f0","#020"),1),this.setupEventListeners()}initializeDOM(){this.dom.style.cssText=`
885      position: fixed;
886      top: 0;
887      left: 0;
888      opacity: 0.9;
889      z-index: 10000;
890      ${this.minimal?"cursor: pointer;":""}
891    `}setupEventListeners(){this.minimal?(this.dom.addEventListener("click",this.handleClick),this.showPanel(this.mode)):window.addEventListener("resize",this.handleResize)}async init(e){if(!e){console.error('Stats: The "canvas" parameter is undefined.');return}if(this.handleThreeRenderer(e)||!await this.handleWebGPURenderer(e)&&!this.initializeWebGL(e))return}handleThreeRenderer(e){return!!e.isWebGLRenderer&&!this.threeRendererPatched&&(this.patchThreeRenderer(e),this.gl=e.getContext(),this.trackGPU&&this.initializeGPUTracking(),!0)}async handleWebGPURenderer(e){return!!e.isWebGPURenderer&&(this.trackGPU&&(e.backend.trackTimestamp=!0,await e.hasFeatureAsync("timestamp-query")&&this.initializeWebGPUPanels()),this.info=e.info,!0)}initializeWebGPUPanels(){this.gpuPanel=this.addPanel(new e.Panel("GPU","#ff0","#220"),2),this.gpuPanelCompute=this.addPanel(new e.Panel("CPT","#e1e1e1","#212121"),3)}initializeWebGL(e){if(e instanceof WebGL2RenderingContext)this.gl=e;else if(!(e instanceof HTMLCanvasElement||e instanceof OffscreenCanvas))return console.error("Stats: Invalid input type. Expected WebGL2RenderingContext, HTMLCanvasElement, or OffscreenCanvas."),!1;else if(this.gl=e.getContext("webgl2"),!this.gl)return console.error("Stats: Unable to obtain WebGL2 context."),!1;return!0}initializeGPUTracking(){this.gl&&(this.ext=this.gl.getExtension("EXT_disjoint_timer_query_webgl2"),this.ext&&(this.gpuPanel=this.addPanel(new e.Panel("GPU","#ff0","#220"),2)))}begin(){this.isRunningCPUProfiling||this.beginProfiling("cpu-started"),this.gl&&this.ext&&(this.activeQuery&&this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.activeQuery=this.gl.createQuery(),this.activeQuery&&this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,this.activeQuery))}end(){this.renderCount++,this.gl&&this.ext&&this.activeQuery&&(this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.gpuQueries.push({query:this.activeQuery}),this.activeQuery=null)}update(){this.info?this.processWebGPUTimestamps():this.processGpuQueries(),this.endProfiling("cpu-started","cpu-finished","cpu-duration"),this.updateAverages(),this.resetCounters()}processWebGPUTimestamps(){this.totalGpuDuration=this.info.render.timestamp,this.totalGpuDurationCompute=this.info.compute.timestamp,this.addToAverage(this.totalGpuDurationCompute,this.averageGpuCompute)}updateAverages(){this.addToAverage(this.totalCpuDuration,this.averageCpu),this.addToAverage(this.totalGpuDuration,this.averageGpu)}resetCounters(){this.renderCount=0,0===this.totalCpuDuration&&this.beginProfiling("cpu-started"),this.totalCpuDuration=0,this.totalFps=0,this.beginTime=this.endInternal()}resizePanel(e,t){e.canvas.style.position="absolute",this.minimal?e.canvas.style.display="none":(e.canvas.style.display="block",this.horizontal?(e.canvas.style.top="0px",e.canvas.style.left=t*e.WIDTH/e.PR+"px"):(e.canvas.style.left="0px",e.canvas.style.top=t*e.HEIGHT/e.PR+"px"))}addPanel(e,t){return e.canvas&&(this.dom.appendChild(e.canvas),this.resizePanel(e,t)),e}showPanel(e){for(let t=0;t<this.dom.children.length;t++)this.dom.children[t].style.display=t===e?"block":"none";this.mode=e}processGpuQueries(){this.gl&&this.ext&&(this.totalGpuDuration=0,this.gpuQueries.forEach((e,t)=>{if(this.gl){let r=this.gl.getQueryParameter(e.query,this.gl.QUERY_RESULT_AVAILABLE),i=this.gl.getParameter(this.ext.GPU_DISJOINT_EXT);if(r&&!i){let r=this.gl.getQueryParameter(e.query,this.gl.QUERY_RESULT);this.totalGpuDuration+=1e-6*r,this.gl.deleteQuery(e.query),this.gpuQueries.splice(t,1)}}}))}endInternal(){this.frames++;let e=(performance||Date).now(),t=e-this.prevTime;if(e>=this.prevCpuTime+1e3/this.logsPerSecond){let r=Math.round(1e3*this.frames/t);this.addToAverage(r,this.averageFps),this.updatePanel(this.fpsPanel,this.averageFps,0),this.updatePanel(this.msPanel,this.averageCpu,this.precision),this.updatePanel(this.gpuPanel,this.averageGpu,this.precision),this.gpuPanelCompute&&this.updatePanel(this.gpuPanelCompute,this.averageGpuCompute),this.frames=0,this.prevCpuTime=e,this.prevTime=e}return e}addToAverage(e,t){t.logs.push(e),t.logs.length>this.samplesLog&&t.logs.shift(),t.graph.push(e),t.graph.length>this.samplesGraph&&t.graph.shift()}beginProfiling(e){window.performance&&(window.performance.mark(e),this.isRunningCPUProfiling=!0)}endProfiling(e,t,r){if(window.performance&&t&&this.isRunningCPUProfiling){window.performance.mark(t);let i=performance.measure(r,e,t);this.totalCpuDuration+=i.duration,this.isRunningCPUProfiling=!1}}updatePanel(e,t,r=2){if(t.logs.length>0){let i=0,n=.01;for(let e=0;e<t.logs.length;e++)i+=t.logs[e],t.logs[e]>n&&(n=t.logs[e]);let a=0,o=.01;for(let e=0;e<t.graph.length;e++)a+=t.graph[e],t.graph[e]>o&&(o=t.graph[e]);e&&e.update(i/Math.min(t.logs.length,this.samplesLog),a/Math.min(t.graph.length,this.samplesGraph),n,o,r)}}get domElement(){return this.dom}patchThreeRenderer(e){let t=e.render,r=this;e.render=function(e,i){r.begin(),t.call(this,e,i),r.end()},this.threeRendererPatched=!0}};A9.Panel=A8;let A7=eD.forwardRef(function({className:e,parent:t,id:r,clearStatsGlStyle:i,...n},a){let o=(0,eR.D)(e=>e.gl),s=eD.useMemo(()=>{let e=new A9({...n});return e.init(o),e},[o]);return eD.useImperativeHandle(a,()=>s.domElement,[s]),eD.useEffect(()=>{if(s){let n=t&&t.current||document.body;null==n||n.appendChild(s.domElement),s.domElement.querySelectorAll("canvas").forEach(e
891=>{e.style.removeProperty("position")}),r&&(s.domElement.id=r),i&&s.domElement.removeAttribute("style"),s.domElement.removeAttribute("style");let a=(null!=e?e:"").split(" ").filter(e=>e);a.length&&s.domElement.classList.add(...a);let o=(0,eR.p)(()=>s.update());return()=>{a.length&&s.domElement.classList.remove(...a),null==n||n.removeChild(s.domElement),o()}}},[t,s,e,r,i]),null});function de({size:e=256,frames:t=1/0}={}){let r=(0,eR.D)(e=>e.viewport.dpr),{width:i,height:n}=(0,eR.D)(e=>e.size),a=e||i*r,o=e||n*r,s=eD.useMemo(()=>{let e=new eT.$YQ(a,o);return e.format=eT.qkB,e.type=eT.LsT,{depthTexture:e}},[a,o]),l=0,c=cs(a,o,s);return(0,eR.F)(e=>{(t===1/0||l<t)&&(e.gl.setRenderTarget(c),e.gl.render(e.scene,e.camera),e.gl.setRenderTarget(null),l++)}),c.depthTexture}function dt(e,t,r=1){let i=(0,eR.D)(e=>e.viewport),n=t*(i.aspect>e/t?i.width/e:i.height/t);return[e*(i.aspect>e/t?i.width/e:i.height/t)*r,n*r,1]}function dr(e,t){let r=(0,eR.D)(e=>e.pointer),[i]=eD.useState(()=>{let i=new eT.iMs;return t&&(0,eR.k)(i,t,{}),function(t,n){i.setFromCamera(r,e instanceof eT.V1s?e:e.current);let a=this.constructor.prototype.raycast.bind(this);a&&a(i,n)}});return i}function di(e,t,r,i){return new(r||(r=Promise))(function(n,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}l((i=i.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;let dn=["geforce 320m","geforce 8600","geforce 8600m gt","geforce 8800 gs","geforce 8800 gt","geforce 9400","geforce 9400m g","geforce 9400m","geforce 9600m gt","geforce 9600m","geforce fx go5200","geforce gt 120","geforce gt 130","geforce gt 330m","geforce gtx 285","google swiftshader","intel g41","intel g45","intel gma 4500mhd","intel gma x3100","intel hd 3000","intel q45","legacy","mali-2","mali-3","mali-4","quadro fx 1500","quadro fx 4","quadro fx 5","radeon hd 2400","radeon hd 2600","radeon hd 4670","radeon hd 4850","radeon hd 4870","radeon hd 5670","radeon hd 5750","radeon hd 6290","radeon hd 6300","radeon hd 6310","radeon hd 6320","radeon hd 6490m","radeon hd 6630m","radeon hd 6750m","radeon hd 6770m","radeon hd 6970m","sgx 543","sgx543"];function da(e){return e=e.toLowerCase().replace(/.*angle ?\((.+)\)(?: on vulkan [0-9.]+)?$/i,"$1").replace(/\s(\d{1,2}gb|direct3d.+$)|\(r\)| \([^)]+\)$/g,"").replace(/(?:vulkan|opengl) \d+\.\d+(?:\.\d+)?(?: \((.*)\))?/,"$1")}let ds="undefined"==typeof window,dl=(()=>{if(ds)return;let{userAgent:e,platform:t,maxTouchPoints:r}=window.navigator,i=/(iphone|ipod|ipad)/i.test(e),n="iPad"===t||"MacIntel"===t&&r>0&&!window.MSStream;return{isIpad:n,isMobile:/android/i.test(e)||i||n,isSafari12:/Version\/12.+Safari/.test(e),isFirefox:/Firefox/.test(e)}})();class dc extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}let du=[],dh=[];function dA(e){return null!=e}let dd=({mobileTiers:e=[0,15,30,60],desktopTiers:t=[0,15,30,60],override:r={},glContext:i,failIfMajorPerformanceCaveat:n=!1,benchmarksURL:a="https://unpkg.com/[email protected]/dist/benchmarks"}={})=>di(void 0,void 0,void 0,function*(){let o={};if(ds)return{tier:0,type:"SSR"};let{isIpad:s=!!(null==dl?void 0:dl.isIpad),isMobile:l=!!(null==dl?void 0:dl.isMobile),screenSize:c=window.screen,loadBenchmarks:u=e=>di(void 0,void 0,void 0,function*(){let t=yield fetch(`${a}/${e}`).then(e=>e.json());if(4>parseInt(t.shift().split(".")[0],10))throw new dc("Detect GPU benchmark data is out of date. Please update to version 4x");return t})}=r,{renderer:h}=r,A=(e,t,r,i,n)=>({device:n,fps:i,gpu:r,isMobile:l,tier:e,type:t}),d,m="";if(h)d=[h=da(h)];else{var f;let e=i||function(e,t=!1){let r={alpha:!1,antialias:!1,depth:!1,failIfMajorPerformanceCaveat:t,powerPreference:"high-performance",stencil:!1};e&&delete r.powerPreference;let i=window.document.createElement("canvas"),n=i.getContext("webgl",r)||i.getContext("experimental-webgl",r);return null!=n?n:void 0}(null==dl?void 0:dl.isSafari12,n);if(!e)return A(0,"WEBGL_UNSUPPORTED");let t=(null==dl?void 0:dl.isFirefox)?null:e.getExtension("WEBGL_debug_renderer_info");if(!(h=t?e.getParameter(t.UNMASKED_RENDERER_WEBGL):e.getParameter(e.RENDERER)))return A(1,"FALLBACK");m=h,d="apple gpu"===(f=h=da(h))?function(e,t,r){let i;if(!r)return[t];let n=function(e){let t=e.createShader(35633),r=e.createShader(35632),i=e.createProgram();if(!(r&&t&&i))return;e.shaderSource(t,"\n    precision highp float;\n    attribute vec3 aPosition;\n    varying float vvv;\n    void main() {\n      vvv = 0.31622776601683794;
891\n      gl_Position = vec4(aPosition, 1.0);\n    }\n  "),e.shaderSource(r,"\n    precision highp float;\n    varying float vvv;\n    void main() {\n      vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * vvv;\n      enc = fract(enc);\n      enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n      gl_FragColor = enc;\n    }\n  "),e.compileShader(t),e.compileShader(r),e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),e.detachShader(i,t),e.detachShader(i,r),e.deleteShader(t),e.deleteShader(r),e.useProgram(i);let n=e.createBuffer();e.bindBuffer(34962,n),e.bufferData(34962,new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),35044);let a=e.getAttribLocation(i,"aPosition");e.vertexAttribPointer(a,3,5126,!1,0,0),e.enableVertexAttribArray(a),e.clearColor(1,1,1,1),e.clear(16384),e.viewport(0,0,1,1),e.drawArrays(4,0,3);let o=new Uint8Array(4);return e.readPixels(0,0,1,1,6408,5121,o),e.deleteProgram(i),e.deleteBuffer(n),o.join("")}(e),a="801621810",o="8016218135",s="80162181161",l=(null==dl?void 0:dl.isIpad)?[["a7",s,12],["a8",o,15],["a8x",o,15],["a9",o,15],["a9x",o,15],["a10",o,15],["a10x",o,15],["a12",a,15],["a12x",a,15],["a12z",a,15],["a14",a,15],["a15",a,15],["m1",a,15],["m2",a,15]]:[["a7",s,12],["a8",o,12],["a9",o,15],["a10",o,15],["a11",a,15],["a12",a,15],["a13",a,15],["a14",a,15],["a15",a,15],["a16",a,15],["a17",a,15]];return"80162181255"===n?i=l.filter(([,,e])=>e>=14):(i=l.filter(([,e])=>e===n)).length||(i=l),i.map(([e])=>`apple ${e} gpu`)}(e,f,l):[f]}let p=(yield Promise.all(d.map(function(e){var t;return di(this,void 0,void 0,function*(){let r;let i=(e=>{for(let t of l?["adreno","apple","mali-t","mali","nvidia","powervr","samsung"]:["intel","apple","amd","radeon","nvidia","geforce","adreno"])if(e.includes(t))return t})(e);if(!i)return;let n=`${l?"m":"d"}-${i}${s?"-ipad":""}.json`,a=o[n]=null!==(t=o[n])&&void 0!==t?t:u(n);try{r=yield a}catch(e){if(e instanceof dc)throw e;return}let h=function(e){var t;let r=(e=e.replace(/\([^)]+\)/,"")).match(/\d+/)||e.match(/(\W|^)([A-Za-z]{1,3})(\W|$)/g);return null!==(t=null==r?void 0:r.join("").replace(/\W|amd/g,""))&&void 0!==t?t:""}(e),A=r.filter(([,e])=>e===h);A.length||(A=r.filter(([t])=>t.includes(e)));let d=A.length;if(0===d)return;let m=e.split(/[.,()\[\]/\s]/g).sort().filter((e,t,r)=>0===t||e!==r[t-1]).join(" "),f,[p,,,,g]=d>1?A.map(e=>[e,function(e,t){if(e===t)return 0;let r=e;e.length>t.length&&(e=t,t=r);let i=e.length,n=t.length;for(;i>0&&e.charCodeAt(~-i)===t.charCodeAt(~-n);)i--,n--;let a,o=0;for(;o<i&&e.charCodeAt(o)===t.charCodeAt(o);)o++;if(i-=o,n-=o,0===i)return n;let s,l,c=0,u=0,h=0;for(;u<i;)dh[u]=e.charCodeAt(o+u),du[u]=++u;for(;h<n;)for(a=t.charCodeAt(o+h),s=h++,c=h,u=0;u<i;u++)l=a===dh[u]?s:s+1,s=du[u],c=du[u]=s>c?l>c?c+1:l:l>s?s+1:l;return c}(m,e[2])]).sort(([,e],[,t])=>e-t)[0][0]:A[0],y=Number.MAX_VALUE,{devicePixelRatio:v}=window,E=c.width*v*c.height*v;for(let e of g){let[t,r]=e,i=Math.abs(E-t*r);i<y&&(y=i,f=e)}if(!f)return;let[,,x,C]=f;return[y,x,p,C]})}))).filter(dA).sort(([e=Number.MAX_VALUE,t],[r=Number.MAX_VALUE,i])=>e===r?t-i:e-r);if(!p.length){let e=dn.find(e=>h.includes(e));return e?A(0,"BLOCKLISTED",e):A(1,"FALLBACK",`${h} (${m})`)}let[,g,y,v]=p[0];if(-1===g)return A(0,"BLOCKLISTED",y,g,v);let E=l?e:t,x=0;for(let e=0;e<E.length;e++)g>=E[e]&&(x=e);return A(x,"BENCHMARK",y,g,v)}),dm=e=>(0,oN.Rq)(()=>dd(e),["useDetectGPU"]);function df({children:e,...t}){let r=dm(t);return eD.createElement(eD.Fragment,null,null==e?void 0:e(r))}let dp=2,dg=Symbol("SKIP_GENERATION");function dy(e,t,r){return null===e?null:(e.point.applyMatrix4(t.matrixWorld),e.distance=e.point.distanceTo(r.ray.origin),e.object=t,e)}function dv(e){return e.index?e.index.count:e.attributes.position.count}function dE(e){return dv(e)/3}function dx(e,t=ArrayBuffer){return e>65535?new Uint32Array(new t(4*e)):new Uint16Array(new t(2*e))}function dC(e,t){let r=dE(e),i=t||e.drawRange,n=i.start/3,a=(i.start+i.count)/3,o=Math.max(0,n);return[{offset:Math.floor(o),count:Math.floor(Math.min(r,a)-o)}]}function dw(e,t){if(!e.groups||!e.groups.length)return dC(e,t);let r=[],i=new Set,n=t||e.drawRange,a=n.start/3,o=(n.start+n.count)/3;for(let t of e.groups){let e=t.start/3,r=(t.start+t.count)/3;i.add(Math.max(a,e)),i.add(Math.min(o,r))}let s=Array.from(i.values()).sort((e,t)=>
891e-t);for(let e=0;e<s.length-1;e++){let t=s[e],i=s[e+1];r.push({offset:Math.floor(t),count:Math.floor(i-t)})}return r}function dB(e,t,r,i,n){let a=1/0,o=1/0,s=1/0,l=-1/0,c=-1/0,u=-1/0,h=1/0,A=1/0,d=1/0,m=-1/0,f=-1/0,p=-1/0;for(let i=6*t,n=(t+r)*6;i<n;i+=6){let t=e[i+0],r=e[i+1],n=t-r,g=t+r;n<a&&(a=n),g>l&&(l=g),t<h&&(h=t),t>m&&(m=t);let y=e[i+2],v=e[i+3],E=y-v,x=y+v;E<o&&(o=E),x>c&&(c=x),y<A&&(A=y),y>f&&(f=y);let C=e[i+4],w=e[i+5],B=C-w,I=C+w;B<s&&(s=B),I>u&&(u=I),C<d&&(d=C),C>p&&(p=C)}i[0]=a,i[1]=o,i[2]=s,i[3]=l,i[4]=c,i[5]=u,n[0]=h,n[1]=A,n[2]=d,n[3]=m,n[4]=f,n[5]=p}function dI(e,t,r){return r.min.x=t[e],r.min.y=t[e+1],r.min.z=t[e+2],r.max.x=t[e+3],r.max.y=t[e+4],r.max.z=t[e+5],r}function d_(e){let t=-1,r=-1/0;for(let i=0;i<3;i++){let n=e[i+3]-e[i];n>r&&(r=n,t=i)}return t}function db(e,t,r){let i,n;for(let a=0;a<3;a++){let o=a+3;i=e[a],n=t[a],r[a]=i<n?i:n,i=e[o],n=t[o],r[o]=i>n?i:n}}function dM(e,t,r){for(let i=0;i<3;i++){let n=t[e+2*i],a=t[e+2*i+1],o=n-a,s=n+a;o<r[i]&&(r[i]=o),s>r[i+3]&&(r[i+3]=s)}}function dS(e){let t=e[3]-e[0],r=e[4]-e[1],i=e[5]-e[2];return 2*(t*r+r*i+i*t)}let dD=(e,t)=>e.candidate-t.candidate,dP=Array(32).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),dT=new Float32Array(6);class dR{constructor(){this.boundingData=new Float32Array(6)}}function dF(e,t,r,i,n,a){let o=i,s=i+n-1,l=a.pos,c=2*a.axis;for(;;){for(;o<=s&&r[6*o+c]<l;)o++;for(;o<=s&&r[6*s+c]>=l;)s--;if(!(o<s))return o;for(let e=0;e<3;e++){let r=t[3*o+e];t[3*o+e]=t[3*s+e],t[3*s+e]=r}for(let e=0;e<6;e++){let t=r[6*o+e];r[6*o+e]=r[6*s+e],r[6*s+e]=t}o++,s--}}function dQ(e,t,r,i,n,a){let o=i,s=i+n-1,l=a.pos,c=2*a.axis;for(;;){for(;o<=s&&r[6*o+c]<l;)o++;for(;o<=s&&r[6*s+c]>=l;)s--;if(!(o<s))return o;{let t=e[o];e[o]=e[s],e[s]=t;for(let e=0;e<6;e++){let t=r[6*o+e];r[6*o+e]=r[6*s+e],r[6*s+e]=t}o++,s--}}}function dz(e,t){return 65535===t[e+15]}function dk(e,t){return t[e+14]}class dL{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let r=1/0,i=-1/0;for(let n=0,a=e.length;n<a;n++){let a=e[n][t];r=a<r?a:r,i=a>i?a:i}this.min=r,this.max=i}setFromPoints(e,t){let r=1/0,i=-1/0;for(let n=0,a=t.length;n<a;n++){let a=t[n],o=e.dot(a);r=o<r?o:r,i=o>i?o:i}this.min=r,this.max=i}isSeparated(e){return this.min>e.max||e.min>this.max}}dL.prototype.setFromBox=function(){let e=new eT.Pa4;return function(t,r){let i=r.min,n=r.max,a=1/0,o=-1/0;for(let r=0;r<=1;r++)for(let s=0;s<=1;s++)for(let l=0;l<=1;l++){e.x=i.x*r+n.x*(1-r),e.y=i.y*s+n.y*(1-s),e.z=i.z*l+n.z*(1-l);let c=t.dot(e);a=Math.min(c,a),o=Math.max(c,o)}this.min=a,this.max=o}}(),new dL;let dO=function(){let e=new eT.Pa4,t=new eT.Pa4,r=new eT.Pa4;return function(i,n,a){let o,s;let l=i.start,c=n.start;r.subVectors(l,c),e.subVectors(i.end,i.start),t.subVectors(n.end,n.start);let u=r.dot(t),h=t.dot(e),A=t.dot(t),d=r.dot(e),m=e.dot(e)*A-h*h;o=0!==m?(u*h-d*A)/m:0,s=(u+o*h)/A,a.x=o,a.y=s}}(),dU=function(){let e=new eT.FM8,t=new eT.Pa4,r=new eT.Pa4;return function(i,n,a,o){dO(i,n,e);let s=e.x,l=e.y;if(s>=0&&s<=1&&l>=0&&l<=1){i.at(s,a),n.at(l,o);return}if(s>=0&&s<=1){l<0?n.at(0,o):n.at(1,o),i.closestPointToPoint(o,!0,a);return}if(l>=0&&l<=1){s<0?i.at(0,a):i.at(1,a),n.closestPointToPoint(a,!0,o);return}{let e,c;if(e=s<0?i.start:i.end,c=l<0?n.start:n.end,i.closestPointToPoint(c,!0,t),n.closestPointToPoint(e,!0,r),t.distanceToSquared(c)<=r.distanceToSquared(e)){a.copy(t),o.copy(c);return}a.copy(e),o.copy(r);return}}}(),dG=function(){let e=new eT.Pa4,t=new eT.Pa4,r=new eT.JOQ,i=new eT.Zzh;return function(n,a){let{radius:o,center:s}=n,{a:l,b:c,c:u}=a;if(i.start=l,i.end=c,i.closestPointToPoint(s,!0,e).distanceTo(s)<=o||(i.start=l,i.end=u,i.closestPointToPoint(s,!0,e).distanceTo(s)<=o)||(i.start=c,i.end=u,i.closestPointToPoint(s,!0,e).distanceTo(s)<=o))return!0;let h=a.getPlane(r);if(Math.abs(h.distanceToPoint(s))<=o){let e=h.projectPoint(s,t);if(a.containsPoint(e))return!0}return!1}}();function dN(e){return 1e-15>Math.abs(e)}class dH extends eT.CJI{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=[,,,,].fill().map(()=>new eT.Pa4),this.satBounds=[,,,,].fill().map(()=>new dL),this.points=[this.a,this.b,this.c],this.sphere=new eT.aLr,this.plane=new eT.JOQ,this.needsUpdate=!0}intersectsSphere(e){return dG(e,this)}update(){let e=this.a,t=this.b,r=this.c,i=this.points,n=this.satAxes,a=this.satBounds,o=n[0],s=a[0];this.getNormal(o),s.setFromPoints(o,i);let l=n[1],c=a[1];l.subVectors(e,t),c.setFromPoints(l,i);let u=n[2],h=a[2];u.subVectors(t,r),h.setFromPoints(u,i);let A=n[3],d=a[3];A.subVectors(r,e),d.setFromPoints(A,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(o,e),this.needsUpdate=!1}}dH.prototype.closestPointToSegment=function(){let e=new eT.Pa4,t=new eT.Pa4,r=new eT.Zzh;return function(i,n=null,a=null){let o;let{start:s,end:l}=i,c=this.points,u=1/0;for(let s=0;s<3;s++){let l=(s+1)%3;r.start.copy(c[s]),r.end.copy(c[l]),dU(r,i,e,t),(o=e.distanceToSquared(t))<u&&(u=
891o,n&&n.copy(e),a&&a.copy(t))}return this.closestPointToPoint(s,e),(o=s.distanceToSquared(e))<u&&(u=o,n&&n.copy(e),a&&a.copy(s)),this.closestPointToPoint(l,e),(o=l.distanceToSquared(e))<u&&(u=o,n&&n.copy(e),a&&a.copy(l)),Math.sqrt(u)}}(),dH.prototype.intersectsTriangle=function(){let e=new dH,t=[,,,],r=[,,,],i=new dL,n=new dL,a=new eT.Pa4,o=new eT.Pa4,s=new eT.Pa4,l=new eT.Pa4,c=new eT.Pa4,u=new eT.Zzh,h=new eT.Zzh,A=new eT.Zzh,d=new eT.Pa4;function m(e,t,r){let i=e.points,n=0,a=-1;for(let e=0;e<3;e++){let{start:s,end:l}=u;s.copy(i[e]),l.copy(i[(e+1)%3]),u.delta(o);let c=dN(t.distanceToPoint(s));if(dN(t.normal.dot(o))&&c){r.copy(u),n=2;break}let h=t.intersectLine(u,d);if(!h&&c&&d.copy(s),(h||c)&&!dN(d.distanceTo(l))){if(n<=1)(1===n?r.start:r.end).copy(d),c&&(a=n);else if(n>=2){(1===a?r.start:r.end).copy(d),n=2;break}if(2==++n&&-1===a)break}}return n}return function(o,u=null,d=!1){this.needsUpdate&&this.update(),o.isExtendedTriangle?o.needsUpdate&&o.update():(e.copy(o),e.update(),o=e);let f=this.plane,p=o.plane;if(Math.abs(f.normal.dot(p.normal))>1-1e-10){let e=this.satBounds,s=this.satAxes;r[0]=o.a,r[1]=o.b,r[2]=o.c;for(let t=0;t<4;t++){let n=e[t],a=s[t];if(i.setFromPoints(a,r),n.isSeparated(i))return!1}let l=o.satBounds,c=o.satAxes;t[0]=this.a,t[1]=this.b,t[2]=this.c;for(let e=0;e<4;e++){let r=l[e],n=c[e];if(i.setFromPoints(n,t),r.isSeparated(i))return!1}for(let e=0;e<4;e++){let o=s[e];for(let e=0;e<4;e++){let s=c[e];if(a.crossVectors(o,s),i.setFromPoints(a,t),n.setFromPoints(a,r),i.isSeparated(n))return!1}}return u&&(d||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),u.start.set(0,0,0),u.end.set(0,0,0)),!0}{let e=m(this,p,h);if(1===e&&o.containsPoint(h.end))return u&&(u.start.copy(h.end),u.end.copy(h.end)),!0;if(2!==e)return!1;let t=m(o,f,A);if(1===t&&this.containsPoint(A.end))return u&&(u.start.copy(A.end),u.end.copy(A.end)),!0;if(2!==t)return!1;if(h.delta(s),A.delta(l),0>s.dot(l)){let e=A.start;A.start=A.end,A.end=e}let r=h.start.dot(s),i=h.end.dot(s),n=A.start.dot(s),a=A.end.dot(s);return(r===a||n===i||i<n!=r<a)&&(u&&(c.subVectors(h.start,A.start),c.dot(s)>0?u.start.copy(h.start):u.start.copy(A.start),c.subVectors(h.end,A.end),0>c.dot(s)?u.end.copy(h.end):u.end.copy(A.end)),!0)}}}(),dH.prototype.distanceToPoint=function(){let e=new eT.Pa4;return function(t){return this.closestPointToPoint(t,e),t.distanceTo(e)}}(),dH.prototype.distanceToTriangle=function(){let e=new eT.Pa4,t=new eT.Pa4,r=["a","b","c"],i=new eT.Zzh,n=new eT.Zzh;return function(a,o=null,s=null){let l=o||s?i:null;if(this.intersectsTriangle(a,l))return(o||s)&&(o&&l.getCenter(o),s&&l.getCenter(s)),0;let c=1/0;for(let t=0;t<3;t++){let i;let n=r[t],l=a[n];this.closestPointToPoint(l,e),(i=l.distanceToSquared(e))<c&&(c=i,o&&o.copy(e),s&&s.copy(l));let u=this[n];a.closestPointToPoint(u,e),(i=u.distanceToSquared(e))<c&&(c=i,o&&o.copy(u),s&&s.copy(e))}for(let l=0;l<3;l++){let u=r[l],h=r[(l+1)%3];i.set(this[u],this[h]);for(let l=0;l<3;l++){let u=r[l],h=r[(l+1)%3];n.set(a[u],a[h]),dU(i,n,e,t);let A=e.distanceToSquared(t);A<c&&(c=A,o&&o.copy(e),s&&s.copy(t))}}return Math.sqrt(c)}}();class dj{constructor(e,t,r){this.isOrientedBox=!0,this.min=new eT.Pa4,this.max=new eT.Pa4,this.matrix=new eT.yGw,this.invMatrix=new eT.yGw,this.points=Array(8).fill().map(()=>new eT.Pa4),this.satAxes=[,,,].fill().map(()=>new eT.Pa4),this.satBounds=[,,,].fill().map(()=>new dL),this.alignedSatBounds=[,,,].fill().map(()=>new dL),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),r&&this.matrix.copy(r)}set(e,t,r){this.min.copy(e),this.max.copy(t),this.matrix.copy(r),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}dj.prototype.update=function(){let e=this.matrix,t=this.min,r=this.max,i=this.points;for(let n=0;n<=1;n++)for(let a=0;a<=1;a++)for(let o=0;o<=1;o++){let s=i[1*n|2*a|4*o];s.x=n?r.x:t.x,s.y=a?r.y:t.y,s.z=o?r.z:t.z,s.applyMatrix4(e)}let n=this.satBounds,a=this.satAxes,o=i[0];for(let e=0;e<3;e++){let t=a[e],r=n[e],s=i[1<<e];t.subVectors(o,s),r.setFromPoints(t,i)}let s=this.alignedSatBounds;s[0].setFromPointsField(i,"x"),s[1].setFromPointsField(i,"y"),s[2].setFromPointsField(i,"z"),this.invMatrix.copy(this.matrix
891).invert(),this.needsUpdate=!1},dj.prototype.intersectsBox=function(){let e=new dL;return function(t){this.needsUpdate&&this.update();let r=t.min,i=t.max,n=this.satBounds,a=this.satAxes,o=this.alignedSatBounds;if(e.min=r.x,e.max=i.x,o[0].isSeparated(e)||(e.min=r.y,e.max=i.y,o[1].isSeparated(e))||(e.min=r.z,e.max=i.z,o[2].isSeparated(e)))return!1;for(let r=0;r<3;r++){let i=a[r],o=n[r];if(e.setFromBox(i,t),o.isSeparated(e))return!1}return!0}}(),dj.prototype.intersectsTriangle=function(){let e=new dH,t=[,,,],r=new dL,i=new dL,n=new eT.Pa4;return function(a){this.needsUpdate&&this.update(),a.isExtendedTriangle?a.needsUpdate&&a.update():(e.copy(a),e.update(),a=e);let o=this.satBounds,s=this.satAxes;t[0]=a.a,t[1]=a.b,t[2]=a.c;for(let e=0;e<3;e++){let i=o[e],n=s[e];if(r.setFromPoints(n,t),i.isSeparated(r))return!1}let l=a.satBounds,c=a.satAxes,u=this.points;for(let e=0;e<3;e++){let t=l[e],i=c[e];if(r.setFromPoints(i,u),t.isSeparated(r))return!1}for(let e=0;e<3;e++){let a=s[e];for(let e=0;e<4;e++){let o=c[e];if(n.crossVectors(a,o),r.setFromPoints(n,t),i.setFromPoints(n,u),r.isSeparated(i))return!1}}return!0}}(),dj.prototype.closestPointToPoint=function(e,t){return this.needsUpdate&&this.update(),t.copy(e).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),t},dj.prototype.distanceToPoint=function(){let e=new eT.Pa4;return function(t){return this.closestPointToPoint(t,e),t.distanceTo(e)}}(),dj.prototype.distanceToBox=function(){let e=["x","y","z"],t=Array(12).fill().map(()=>new eT.Zzh),r=Array(12).fill().map(()=>new eT.Zzh),i=new eT.Pa4,n=new eT.Pa4;return function(a,o=0,s=null,l=null){if(this.needsUpdate&&this.update(),this.intersectsBox(a))return(s||l)&&(a.getCenter(n),this.closestPointToPoint(n,i),a.closestPointToPoint(i,n),s&&s.copy(i),l&&l.copy(n)),0;let c=o*o,u=a.min,h=a.max,A=this.points,d=1/0;for(let e=0;e<8;e++){let t=A[e];n.copy(t).clamp(u,h);let r=t.distanceToSquared(n);if(r<d&&(d=r,s&&s.copy(t),l&&l.copy(n),r<c))return Math.sqrt(r)}let m=0;for(let i=0;i<3;i++)for(let n=0;n<=1;n++)for(let a=0;a<=1;a++){let o=(i+1)%3,s=(i+2)%3,l=n<<o|a<<s,c=1<<i|n<<o|a<<s,d=A[l],f=A[c];t[m].set(d,f);let p=e[i],g=e[o],y=e[s],v=r[m],E=v.start,x=v.end;E[p]=u[p],E[g]=n?u[g]:h[g],E[y]=a?u[y]:h[g],x[p]=h[p],x[g]=n?u[g]:h[g],x[y]=a?u[y]:h[g],m++}for(let e=0;e<=1;e++)for(let t=0;t<=1;t++)for(let r=0;r<=1;r++){n.x=e?h.x:u.x,n.y=t?h.y:u.y,n.z=r?h.z:u.z,this.closestPointToPoint(n,i);let a=n.distanceToSquared(i);if(a<d&&(d=a,s&&s.copy(i),l&&l.copy(n),a<c))return Math.sqrt(a)}for(let e=0;e<12;e++){let a=t[e];for(let e=0;e<12;e++){dU(a,r[e],i,n);let t=i.distanceToSquared(n);if(t<d&&(d=t,s&&s.copy(i),l&&l.copy(n),t<c))return Math.sqrt(t)}}return Math.sqrt(d)}}();class dJ{constructor(e){this._getNewPrimitive=e,this._primitives=[]}getPrimitive(){let e=this._primitives;return 0===e.length?this._getNewPrimitive():e.pop()}releasePrimitive(e){this._primitives.push(e)}}class dV extends dJ{constructor(){super(()=>new dH)}}let dK=new dV;class dY{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;let e=[],t=null;this.setBuffer=r=>{t&&e.push(t),t=r,this.float32Array=new Float32Array(r),this.uint16Array=new Uint16Array(r),this.uint32Array=new Uint32Array(r)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,0!==e.length&&this.setBuffer(e.pop())}}}let dW=new dY,dq=[],dX=new dJ(()=>new eT.ZzF),dZ=new eT.Pa4,d$=new eT.Pa4,d1=new eT.Pa4,d0=new eT.Pa4,d2=new eT.Pa4,d3=new eT.FM8,d4=new eT.FM8,d5=new eT.FM8,d6=new eT.Pa4,d8=new eT.Pa4,d9=new eT.Pa4,d7=new eT.Pa4;function me(e,t,r,i,n,a,o){let s=3*i,l=s+0,c=s+1,u=s+2,h=e.index;e.index&&(l=h.getX(l),c=h.getX(c),u=h.getX(u));let{position:A,normal:d,uv:m,uv1:f}=e.attributes,p=function(e,t,r,i,n,a,o,s,l,c,u){d1.fromBufferAttribute(t,a),d0.fromBufferAttribute(t,o),d2.fromBufferAttribute(t,s);let h=function(e,t,r,i,n,a,o,s){if(null===(a===eT._Li?e.intersectTriangle(i,r,t,!0,n):e.intersectTriangle(t,r,i,a!==eT.ehD,n)))return null;let l=e.origin.distanceTo(n);return l<o||l>s?null:{distance:l,point:n.clone()}}(e,d1,d0,d2,d7,l,c,u);
891if(h){i&&(d3.fromBufferAttribute(i,a),d4.fromBufferAttribute(i,o),d5.fromBufferAttribute(i,s),h.uv=eT.CJI.getInterpolation(d7,d1,d0,d2,d3,d4,d5,new eT.FM8)),n&&(d3.fromBufferAttribute(n,a),d4.fromBufferAttribute(n,o),d5.fromBufferAttribute(n,s),h.uv1=eT.CJI.getInterpolation(d7,d1,d0,d2,d3,d4,d5,new eT.FM8)),r&&(d6.fromBufferAttribute(r,a),d8.fromBufferAttribute(r,o),d9.fromBufferAttribute(r,s),h.normal=eT.CJI.getInterpolation(d7,d1,d0,d2,d6,d8,d9,new eT.Pa4),h.normal.dot(e.direction)>0&&h.normal.multiplyScalar(-1));let t={a:a,b:o,c:s,normal:new eT.Pa4,materialIndex:0};eT.CJI.getNormal(d1,d0,d2,t.normal),h.face=t,h.faceIndex=a}return h}(r,A,d,m,f,l,c,u,t,a,o);return p?(p.faceIndex=i,n&&n.push(p),p):null}function mt(e,t,r,i){let n=e.a,a=e.b,o=e.c,s=t,l=t+1,c=t+2;r&&(s=r.getX(s),l=r.getX(l),c=r.getX(c)),n.x=i.getX(s),n.y=i.getY(s),n.z=i.getZ(s),a.x=i.getX(l),a.y=i.getY(l),a.z=i.getZ(l),o.x=i.getX(c),o.y=i.getY(c),o.z=i.getZ(c)}function mr(e,t,r,i,n,a,o){let{geometry:s}=r,{index:l}=s,c=s.attributes.position;for(let r=e,s=t+e;r<s;r++){let e;if(mt(o,3*(e=r),l,c),o.needsUpdate=!0,i(o,e,n,a))return!0}return!1}function mi(e,t,r,i,n){let a,o,s,l,c,u;let h=1/r.direction.x,A=1/r.direction.y,d=1/r.direction.z,m=r.origin.x,f=r.origin.y,p=r.origin.z,g=t[e],y=t[e+3],v=t[e+1],E=t[e+3+1],x=t[e+2],C=t[e+3+2];return h>=0?(a=(g-m)*h,o=(y-m)*h):(a=(y-m)*h,o=(g-m)*h),A>=0?(s=(v-f)*A,l=(E-f)*A):(s=(E-f)*A,l=(v-f)*A),!(a>l)&&!(s>o)&&((s>a||isNaN(a))&&(a=s),(l<o||isNaN(o))&&(o=l),d>=0?(c=(x-p)*d,u=(C-p)*d):(c=(C-p)*d,u=(x-p)*d),!(a>u)&&!(c>o)&&((c>a||a!=a)&&(a=c),(u<o||o!=o)&&(o=u),a<=n&&o>=i))}function mn(e,t,r,i,n,a,o){dW.setBuffer(e._roots[t]),function e(t,r,i,n,a,o,s){let{float32Array:l,uint16Array:c,uint32Array:u}=dW,h=2*t;if(dz(h,c))!function(e,t,r,i,n,a,o,s){let{geometry:l,_indirectBuffer:c}=e;for(let e=i,c=i+n;e<c;e++)me(l,t,r,e,a,o,s)}(r,i,n,u[t+6],dk(h,c),a,o,s);else{let c=t+8;mi(c,l,n,o,s)&&e(c,r,i,n,a,o,s);let h=u[t+6];mi(h,l,n,o,s)&&e(h,r,i,n,a,o,s)}}(0,e,r,i,n,a,o),dW.clearBuffer()}let ma=["x","y","z"];function mo(e,t,r,i,n,a){dW.setBuffer(e._roots[t]);let o=function e(t,r,i,n,a,o){let{float32Array:s,uint16Array:l,uint32Array:c}=dW,u=2*t;if(dz(u,l))return function(e,t,r,i,n,a,o){let{geometry:s,_indirectBuffer:l}=e,c=1/0,u=null;for(let e=i,l=i+n;e<l;e++){let i;(i=me(s,t,r,e,null,a,o))&&i.distance<c&&(u=i,c=i.distance)}return u}(r,i,n,c[t+6],dk(u,l),a,o);{let l,u;let h=c[t+7],A=ma[h],d=n.direction[A]>=0;d?(l=t+8,u=c[t+6]):(l=c[t+6],u=t+8);let m=mi(l,s,n,a,o)?e(l,r,i,n,a,o):null;if(m){let e=m.point[A];if(d?e<=s[u+h]:e>=s[u+h+3])return m}let f=mi(u,s,n,a,o)?e(u,r,i,n,a,o):null;return m&&f?m.distance<=f.distance?m:f:m||f||null}}(0,e,r,i,n,a);return dW.clearBuffer(),o}let ms=new eT.ZzF,ml=new dH,mc=new dH,mu=new eT.yGw,mh=new dj,mA=new dj;function md(e,t,r,i){dW.setBuffer(e._roots[t]);let n=function e(t,r,i,n,a=null){let{float32Array:o,uint16Array:s,uint32Array:l}=dW,c=2*t;if(null===a&&(i.boundingBox||i.computeBoundingBox(),mh.set(i.boundingBox.min,i.boundingBox.max,n),a=mh),dz(c,s)){let e=r.geometry,a=e.index,u=e.attributes.position,h=i.index,A=i.attributes.position,d=l[t+6],m=dk(c,s);if(mu.copy(n).invert(),i.boundsTree)return dI(t,o,mA),mA.matrix.copy(mu),mA.needsUpdate=!0,i.boundsTree.shapecast({intersectsBounds:e=>mA.intersectsBox(e),intersectsTriangle:e=>{e.a.applyMatrix4(n),e.b.applyMatrix4(n),e.c.applyMatrix4(n),e.needsUpdate=!0;for(let t=3*d,r=(m+d)*3;t<r;t+=3)if(mt(mc,t,a,u),mc.needsUpdate=!0,e.intersectsTriangle(mc))return!0;return!1}});for(let e=3*d,t=(m+d)*3;e<t;e+=3){mt(ml,e,a,u),ml.a.applyMatrix4(mu),ml.b.applyMatrix4(mu),ml.c.applyMatrix4(mu),ml.needsUpdate=!0;for(let e=0,t=h.count;e<t;e+=3)if(mt(mc,e,h,A),mc.needsUpdate=!0,ml.intersectsTriangle(mc))return!0}}else{let s=t+8,c=l[t+6];return dI(s,o,ms),!!(a.intersectsBox(ms)&&e(s,r,i,n,a))||(dI(c,o,ms),!!(a.intersectsBox(ms)&&e(c,r,i,n,a)))}}(0,e,r,i);return dW.clearBuffer(),n}let mm=new eT.yGw,mf=new dj,mp=new dj,mg=new eT.Pa4,my=new eT.Pa4,mv=new eT.Pa4,mE=new eT.Pa4;function mx(e,t,r,i,n,a,o){let{geometry:s}=r,{index:l}=s,c=s.attributes.position;for(let s=e,u=t+e;s<u;s++){let e;if(mt(o,3*(e=r.resolveTriangleIndex(s)),l,c),o.needsUpdate=!0,i(o,e,n,a))return!0}return!1}function mC(e,t,r,i,n,a,o){dW.setBuffer(e._roots[t]),function e(t,r,i,n,a,o,s){let{float32Array:l,uint16Array:c,uint32Array:u}=dW,h=2*t;if(dz(h,c))!function(e,t,r,i,n,a,o,s){let{geometry:l,_indirectBuffer:c}=e;for(let e=i,u=i+n;e<u;e++)me(l,t,r,c?c[e]:e,a,o,s)}(r,i,n,u[t+6],dk(h,c),a,o,s);else{let c=t+8;mi(c,l,n,o,s)&&e(c,r,i,n,a,o,s);let h=u[t+6];mi(h,l,n,o,s)&&e(h,r,i,n,a,o,s)}}(0,e,r,i,n,a,o),dW.clearBuffer()}let mw=["x","y","z"];function mB(e,t,r,i,n,a){dW.setBuffer(e._roots[t]);let o=function e(t,r,i,n,a,o){let{float32Array:s,uint16Array:l,uint32Array:c}=dW,u=2*t;if(dz(u,l))return function(e,t,r,i,n,a,o){let{geometry:s,_indirectBuffer:l}=e,c=1/0,u=null;for(let e=i,h=i+n;e<h;e++){let i;(i=me(s,t,r,l?l[e]:e,null,a,o))&&i.distance<c&&(u=i,c=i.distance)}return u}(r,i,n,c[t+6],dk(u,l),a,o);{let l,u;let h=c[t+7],A=mw[h],d=n.direction[A]>=0;
891d?(l=t+8,u=c[t+6]):(l=c[t+6],u=t+8);let m=mi(l,s,n,a,o)?e(l,r,i,n,a,o):null;if(m){let e=m.point[A];if(d?e<=s[u+h]:e>=s[u+h+3])return m}let f=mi(u,s,n,a,o)?e(u,r,i,n,a,o):null;return m&&f?m.distance<=f.distance?m:f:m||f||null}}(0,e,r,i,n,a);return dW.clearBuffer(),o}let mI=new eT.ZzF,m_=new dH,mb=new dH,mM=new eT.yGw,mS=new dj,mD=new dj;function mP(e,t,r,i){dW.setBuffer(e._roots[t]);let n=function e(t,r,i,n,a=null){let{float32Array:o,uint16Array:s,uint32Array:l}=dW,c=2*t;if(null===a&&(i.boundingBox||i.computeBoundingBox(),mS.set(i.boundingBox.min,i.boundingBox.max,n),a=mS),dz(c,s)){let e=r.geometry,a=e.index,u=e.attributes.position,h=i.index,A=i.attributes.position,d=l[t+6],m=dk(c,s);if(mM.copy(n).invert(),i.boundsTree)return dI(t,o,mD),mD.matrix.copy(mM),mD.needsUpdate=!0,i.boundsTree.shapecast({intersectsBounds:e=>mD.intersectsBox(e),intersectsTriangle:e=>{e.a.applyMatrix4(n),e.b.applyMatrix4(n),e.c.applyMatrix4(n),e.needsUpdate=!0;for(let t=d,i=m+d;t<i;t++)if(mt(mb,3*r.resolveTriangleIndex(t),a,u),mb.needsUpdate=!0,e.intersectsTriangle(mb))return!0;return!1}});for(let e=d,t=m+d;e<t;e++){mt(m_,3*r.resolveTriangleIndex(e),a,u),m_.a.applyMatrix4(mM),m_.b.applyMatrix4(mM),m_.c.applyMatrix4(mM),m_.needsUpdate=!0;for(let e=0,t=h.count;e<t;e+=3)if(mt(mb,e,h,A),mb.needsUpdate=!0,m_.intersectsTriangle(mb))return!0}}else{let s=t+8,c=l[t+6];return dI(s,o,mI),!!(a.intersectsBox(mI)&&e(s,r,i,n,a))||(dI(c,o,mI),!!(a.intersectsBox(mI)&&e(c,r,i,n,a)))}}(0,e,r,i);return dW.clearBuffer(),n}let mT=new eT.yGw,mR=new dj,mF=new dj,mQ=new eT.Pa4,mz=new eT.Pa4,mk=new eT.Pa4,mL=new eT.Pa4,mO=new dW.constructor,mU=new dW.constructor,mG=new dJ(()=>new eT.ZzF),mN=new eT.ZzF,mH=new eT.ZzF,mj=new eT.ZzF,mJ=new eT.ZzF,mV=!1,mK=new dj,mY=new eT.ZzF,mW={strategy:0,maxDepth:40,maxLeafTris:10,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,verbose:!0,range:null};class mq{static serialize(e,t={}){t={cloneBuffers:!0,...t};let r=e.geometry,i=e._roots,n=e._indirectBuffer,a=r.getIndex();return t.cloneBuffers?{roots:i.map(e=>e.slice()),index:a?a.array.slice():null,indirectBuffer:n?n.slice():null}:{roots:i,index:a?a.array:null,indirectBuffer:n}}static deserialize(e,t,r={}){r={setIndex:!0,indirect:!!e.indirectBuffer,...r};let{index:i,roots:n,indirectBuffer:a}=e,o=new mq(t,{...r,[dg]:!0});if(o._roots=n,o._indirectBuffer=a||null,r.setIndex){let r=t.getIndex();if(null===r){let r=new eT.TlE(e.index,1,!1);t.setIndex(r)}else r.array!==i&&(r.array.set(i),r.needsUpdate=!0)}return o}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw Error("MeshBVH: Only BufferGeometries are supported.");if((t=Object.assign({...mW,[dg]:!1},t)).useSharedArrayBuffer&&!("undefined"!=typeof SharedArrayBuffer))throw Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[dg]||(function(e,t){let r=e.geometry;t.indirect&&(e._indirectBuffer=function(e,t){let r=(e.index?e.index.count:e.attributes.position.count)/3,i=r>65536,n=i?4:2,a=t?new SharedArrayBuffer(r*n):new ArrayBuffer(r*n),o=i?new Uint32Array(a):new Uint16Array(a);for(let e=0,t=o.length;e<t;e++)o[e]=e;return o}(r,t.useSharedArrayBuffer),function(e,t){let r=dE(e),i=dw(e,t).sort((e,t)=>e.offset-t.offset),n=i[i.length-1];n.count=Math.min(r-n.offset,n.count);let a=0;return i.forEach(({count:e})=>a+=e),r!==a}(r,t.range)&&!t.verbose&&console.warn('MeshBVH: Provided geometry contains groups or a range that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),e._indirectBuffer||function(e,t){if(!e.index){let r=e.attributes.position.count,i=dx(r,t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer);e.setIndex(new eT.TlE(i,1));for(let e=0;e<r;e++)i[e]=e}}(r,t);let i=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,n=function(e,t=null,r=null,i=null){let n;let a=e.attributes.position,o=e.index?e.index.array:null,s=dE(e),l=a.normalized;null===t?(n=new Float32Array(24*s),r=0,i=s):(n=t,r=r||0,i=i||s);let c=a.array,u=a.offset||0,h=3;a.isInterleavedBufferAttribute&&(h=a.data.stride);let A=["getX","getY","getZ"];for(let e=r;e<r+i;e++){let t=3*e,r=6*e,i=t+0,s=t+1,d=t+2;o&&(i=o[i],s=o[s],d=o[d]),l||(i=i*h+u,s=s*h+u,d=d*h+u);for(let e=0;e<3;e++){let t,o,u;
891l?(t=a[A[e]](i),o=a[A[e]](s),u=a[A[e]](d)):(t=c[i+e],o=c[s+e],u=c[d+e]);let h=t;o<h&&(h=o),u<h&&(h=u);let m=t;o>m&&(m=o),u>m&&(m=u);let f=(m-h)/2,p=2*e;n[r+p+0]=h+f,n[r+p+1]=f+(Math.abs(h)+f)*5960464477539063e-23}}return n}(r),a=t.indirect?dC(r,t.range):dw(r,t.range);e._roots=a.map(r=>{let a=function(e,t,r,i,n){let{maxDepth:a,verbose:o,maxLeafTris:s,strategy:l,onProgress:c,indirect:u}=n,h=e._indirectBuffer,A=e.geometry,d=A.index?A.index.array:null,m=u?dQ:dF,f=dE(A),p=new Float32Array(6),g=!1,y=new dR;return dB(t,r,i,y.boundingData,p),function e(r,i,n,c=null,u=0){if(!g&&u>=a&&(g=!0,o&&(console.warn(`MeshBVH: Max depth of ${a} reached when generating BVH. Consider increasing maxDepth.`),console.warn(A))),n<=s||u>=a)return v(i+n),r.offset=i,r.count=n,r;let f=function(e,t,r,i,n,a){let o=-1,s=0;if(0===a)-1!==(o=d_(t))&&(s=(t[o]+t[o+3])/2);else if(1===a)-1!==(o=d_(e))&&(s=function(e,t,r,i){let n=0;for(let a=t,o=t+r;a<o;a++)n+=e[6*a+2*i];return n/r}(r,i,n,o));else if(a===dp){let a=dS(e),l=1.25*n,c=6*i,u=(i+n)*6;for(let e=0;e<3;e++){let i=t[e],h=(t[e+3]-i)/32;if(n<8){let t=[...dP];t.length=n;let i=0;for(let n=c;n<u;n+=6,i++){let a=t[i];
891a.candidate=r[n+2*e],a.count=0;let{bounds:o,leftCacheBounds:s,rightCacheBounds:l}=a;for(let e=0;e<3;e++)l[e]=1/0,l[e+3]=-1/0,s[e]=1/0,s[e+3]=-1/0,o[e]=1/0,o[e+3]=-1/0;dM(n,r,o)}t.sort(dD);let h=n;for(let e=0;e<h;e++){let r=t[e];for(;e+1<h&&t[e+1].candidate===r.candidate;)t.splice(e+1,1),h--}for(let i=c;i<u;i+=6){let n=r[i+2*e];for(let e=0;e<h;e++){let a=t[e];n>=a.candidate?dM(i,r,a.rightCacheBounds):(dM(i,r,a.leftCacheBounds),a.count++)}}for(let r=0;r<h;r++){let i=t[r],c=i.count,u=n-i.count,h=i.leftCacheBounds,A=i.rightCacheBounds,d=0;0!==c&&(d=dS(h)/a);let m=0;0!==u&&(m=dS(A)/a);let f=1+1.25*(d*c+m*u);f<l&&(o=e,l=f,s=i.candidate)}}else{for(let e=0;e<32;e++){let t=dP[e];t.count=0,t.candidate=i+h+e*h;let r=t.bounds;for(let e=0;e<3;e++)r[e]=1/0,r[e+3]=-1/0}for(let t=c;t<u;t+=6){let n=~~((r[t+2*e]-i)/h);n>=32&&(n=31);let a=dP[n];a.count++,dM(t,r,a.bounds)}let t=dP[31];!function(e,t){t.set(e)}(t.bounds,t.rightCacheBounds);for(let e=30;e>=0;e--){let t=dP[e],r=dP[e+1];db(t.bounds,r.rightCacheBounds,t.rightCacheBounds)}let A=0;for(let t=0;t<31;t++){let r=dP[t],i=r.count,c=r.bounds,u=dP[t+1].rightCacheBounds;0!==i&&(0===A?function(e,t){t.set(e)}(c,dT):db(c,dT,dT));let h=0,d=0;0!==(A+=i)&&(h=dS(dT)/a);let m=n-A;0!==m&&(d=dS(u)/a);let f=1+1.25*(h*A+d*m);f<l&&(o=e,l=f,s=r.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${a} used.`);return{axis:o,pos:s}}(r.boundingData,c,t,i,n,l);if(-1===f.axis)return v(i+n),r.offset=i,r.count=n,r;let y=m(h,d,t,i,n,f);if(y===i||y===i+n)v(i+n),r.offset=i,r.count=n;else{r.splitAxis=f.axis;let a=new dR,o=y-i;r.left=a,dB(t,i,o,a.boundingData,p),e(a,i,o,p,u+1);let s=new dR,l=n-o;r.right=s,dB(t,y,l,s.boundingData,p),e(s,y,l,p,u+1)}return r}(y,r,i,p),y;function v(e){c&&c(e/f)}}(e,n,r.offset,r.count,t),o=new i(32*function e(t){return"count"in t?1:1+e(t.left)+e(t.right)}(a));return z=new Float32Array(o),k=new Uint32Array(o),L=new Uint16Array(o),O=new Uint8Array(o),function e(t,r){let i=t/4,n=t/2,a=r.boundingData;for(let e=0;e<6;e++)z[i+e]=a[e];if("count"in r){if(r.buffer){let e=r.buffer;O.set(new Uint8Array(e),t);for(let r=t,n=t+e.byteLength;r<n;r+=32)dz(r/2,L)||(k[r/4+6]+=i);return t+e.byteLength}{let e=r.offset,a=r.count;return k[i+6]=e,L[n+14]=a,L[n+15]=65535,t+32}}{let n;let a=r.left,o=r.right,s=r.splitAxis;if((n=e(t+32,a))/4>4294967296)throw Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return k[i+6]=n/4,n=e(n,o),k[i+7]=s,n}}(0,a),o})}(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new eT.ZzF))),this.resolveTriangleIndex=t.indirect?e=>this._indirectBuffer[e]:e=>e}refit(e=null){return(this.indirect?function(e,t=null){let r,i,n,a;t&&Array.isArray(t)&&(t=new Set(t));let o=e.geometry,s=o.index?o.index.array:null,l=o.attributes.position,c=0,u=e._roots;for(let o=0,h=u.length;o<h;o++)i=new Uint32Array(r=u[o]),n=new Uint16Array(r),a=new Float32Array(r),function r(o,c,u=!1){let h=2*o;if(65535===n[h+15]){let t=i[o+6],r=n[h+14],c=1/0,u=1/0,A=1/0,d=-1/0,m=-1/0,f=-1/0;for(let i=t,n=t+r;i<n;i++){let t=3*e.resolveTriangleIndex(i);for(let e=0;e<3;e++){let r=t+e;r=s?s[r]:r;let i=l.getX(r),n=l.getY(r),a=l.getZ(r);i<c&&(c=i),i>d&&(d=i),n<u&&(u=n),n>m&&(m=n),a<A&&(A=a),a>f&&(f=a)}}return(a[o+0]!==c||a[o+1]!==u||a[o+2]!==A||a[o+3]!==d||a[o+4]!==m||a[o+5]!==f)&&(a[o+0]=c,a[o+1]=u,a[o+2]=A,a[o+3]=d,a[o+4]=m,a[o+5]=f,!0)}{let e=o+8,n=i[o+6],s=u,l=!1,h=!1;t?s||(l=t.has(e+c),h=t.has(n+c),s=!l&&!h):(l=!0,h=!0);let A=s||l,d=s||h,m=!1;A&&(m=r(e,c,s));let f=!1;d&&(f=r(n,c,s));let p=m||f;if(p)for(let t=0;t<3;t++){let r=e+t,i=n+t,s=a[r],l=a[r+3],c=a[i],u=a[i+3];a[o+t]=s<c?s:c,a[o+t+3]=l>u?l:u}return p}}(0,c),c+=r.byteLength}:function(e,t=null){let r,i,n,a;t&&Array.isArray(t)&&(t=new Set(t));let o=e.geometry,s=o.index?o.index.array:null,l=o.attributes.position,c=0,u=e._roots;for(let e=0,o=u.length;e<o;e++)i=new Uint32Array(r=u[e]),n=new Uint16Array(r),a=new Float32Array(r),function e(r,o,c=!1){let u=2*r;if(65535===n[u+15]){let e=i[r+6],t=n[u+14],o=1/0,c=1/0,h=1/0,A=-1/0,d=-1/0,m=-1/0;for(let r=3*e,i=3*(e+t);r<i;r++){let e=s[r],t=l.getX(e),i=l.getY(e),n=l.getZ(e);t<o&&(o=t),t>A&&(A=t),i<c&&(c=i),i>d&&(d=i),n<h&&(h=n),n>m&&(m=n)}return(a[r+0]!==o||a[r+1]!==c||a[r+2]!==h||a[r+3]!==A||a[r+4]!==d||a[r+5]!==m)&&(a[r+0]=o,a[r+1]=c,a[r+2]=h,a[r+3]=A,a[r+4]=d,a[r+5]=m,!0)}{let n=r+8,s=i[r+6],l=c,u=!1,h=!1;t?l||(u=t.has(n+o),h=t.has(s+o),l=!u&&!h):(u=!0,h=!0);let A=l||u,d=l||h,m=!1;A&&(m=e(n,o,l));let f=!1;d&&(f=e(s,o,l));let p=m||f;if(p)for(let e=0;e<3;e++){let t=n+e,i=s+e,o=a[t],l=a[t+3],c=a[i],u=a[i+3];a[r+e]=o<c?o:c,a[r+e+3]=l>u?l:u}return p}}(0,c),c+=r.byteLength})(this,e)}traverse(e,t=0){let r=this._roots[t],i=new Uint32Array(r),n=new Uint16Array(r);!function t(a,o=0){let s=2*a,l=65535===n[s+15];if(l){let t=i[a+6],c=n[s+14];e(o,l,new Float32Array(r,4*a,6),t,c)}else{let n=i[a+6],s=i[a+7];e(o,l,new Float32Array(r,4*a,6),s)||(t(a+8,o+1),t(n,o+1))}}(0)}raycast(e,t=eT.Wl3,r=0,i=1/0){let n=this._roots,a=this.geometry,o=[],s=t.isMaterial,l=Array.isArray(t),c=a.groups,u=s?t.side:t,h=this.indirect?mC:mn;for(let a=0,s=n.length;a<s;a++){let n=l?t[c[a].materialIndex].side:u,s=o.length;if(h(this,a,n,e,o,r,i),l){let e=c[a].materialIndex;for(let t=s,r=o.length;t<r;t++)o[t].face.materialIndex=e}}return o}raycastFirst(e,t=eT.Wl3,r=0,i=1/0){let n=this._roots,a=this.geometry,o=t.isMaterial,s=Array.isArray(t),l=null,c=a.groups,u=o?t.side:t,h=this.indirect?mB:mo;for(let a=0,o=n.length;a<o;a++){let n=s?t[c[a].materialIndex].side:u,o=h(this,a,n,e,r,i);null!=o&&(null==l||o.distance<l.distance)&&(l=o,s&&(o.face.materialIndex=c[a].materialIndex))}return l}intersectsGeometry(e,t){let r=!1,i=this._roots,n=this.indirect?mP:md;for(let a=0,o=i.length;a<o&&!(r=n(this,a,e,t));a++);return r}shapecast(e){let t=dK.getPrimitive(),r=this.indirect?mx:mr,{boundsTraverseOrder:i,intersectsBounds:n,intersectsRange:a,intersectsTriangle:o}=e;if(a&&o){let e=a;a=(i,n,a,s,l)=>!!e(i,n,a,s,l)||r(i,n,this,o,a,s,t)}else a||(a=o?(e,i,n,a)=>r(e,i,this,o,n,a,t):(e,t,r)=>r);let s=!1,l=0,c=this._roots;for(let e=0,t=c.length;e<t;e++){let t=c[e];if(s=function(e,t,r,i,n,a){U=dX.getPrimitive(),G=dX.getPrimitive(),dq.push(U,G),dW.setBuffer(e._roots[t]);let o=function e(t,r,i,n,a=null,o=0,s=0){let{float32Array:l,uint16Array:c,uint32Array:u}=dW,h=2*t;if(dz(h,c)){let e=u[t+6],r=dk(h,c);return dI(t,l,U),n(e,r,!1,s,o+t,U)}{let h,m,f,p,g,y;let v=t+8,E=u[t+6],x=v,C=E;
891if(a&&(f=U,p=G,dI(x,l,f),dI(C,l,p),h=a(f),(m=a(p))<h)){x=E,C=v;let e=h;h=m,m=e,f=p}f||dI(x,l,f=U);let w=i(f,dz(2*x,c),h,s+1,o+x);if(2===w){let e=A(x);g=n(e,d(x)-e,!0,s+1,o+x,f)}else g=w&&e(x,r,i,n,a,o,s+1);if(g)return!0;dI(C,l,p=G);let B=i(p,dz(2*C,c),m,s+1,o+C);if(2===B){let e=A(C);y=n(e,d(C)-e,!0,s+1,o+C,p)}else y=B&&e(C,r,i,n,a,o,s+1);if(y)return!0;return!1;function A(e){let{uint16Array:t,uint32Array:r}=dW,i=2*e;for(;!dz(i,t);)e+=8,i=2*e;return r[e+6]}function d(e){let{uint16Array:t,uint32Array:r}=dW,i=2*e;for(;!dz(i,t);)i=2*(e=r[e+6]);return r[e+6]+dk(i,t)}}}(0,e.geometry,r,i,n,a);dW.clearBuffer(),dX.releasePrimitive(U),dX.releasePrimitive(G),dq.pop(),dq.pop();let s=dq.length;return s>0&&(G=dq[s-1],U=dq[s-2]),o}(this,e,n,a,i,l))break;l+=t.byteLength}return dK.releasePrimitive(t),s}bvhcast(e,t,r){let{intersectsRanges:i,intersectsTriangles:n}=r,a=dK.getPrimitive(),o=this.geometry.index,s=this.geometry.attributes.position,l=this.indirect?e=>{mt(a,3*this.resolveTriangleIndex(e),o,s)}:e=>{mt(a,3*e,o,s)},c=dK.getPrimitive(),u=e.geometry.index,h=e.geometry.attributes.position,A=e.indirect?t=>{mt(c,3*e.resolveTriangleIndex(t),u,h)}:e=>{mt(c,3*e,u,h)};if(n){let e=(e,r,i,o,s,u,h,d)=>{for(let m=i,f=i+o;m<f;m++){A(m),c.a.applyMatrix4(t),c.b.applyMatrix4(t),c.c.applyMatrix4(t),c.needsUpdate=!0;for(let t=e,i=e+r;t<i;t++)if(l(t),a.needsUpdate=!0,n(a,c,t,m,s,u,h,d))return!0}return!1};if(i){let t=i;i=function(r,i,n,a,o,s,l,c){return!!t(r,i,n,a,o,s,l,c)||e(r,i,n,a,o,s,l,c)}}else i=e}return function(e,t,r,i){let n;if(mV)throw Error("MeshBVH: Recursive calls to bvhcast not supported.");mV=!0;let a=e._roots,o=t._roots,s=0,l=0,c=new eT.yGw().copy(r).invert();for(let e=0,t=a.length;e<t;e++){mO.setBuffer(a[e]),l=0;let t=mG.getPrimitive();dI(0,mO.float32Array,t),t.applyMatrix4(c);for(let e=0,a=o.length;e<a&&(mU.setBuffer(o[e]),n=function e(t,r,i,n,a,o=0,s=0,l=0,c=0,u=null,h=!1){let A,d;h?(A=mU,d=mO):(A=mO,d=mU);let m=A.float32Array,f=A.uint32Array,p=A.uint16Array,g=d.float32Array,y=d.uint32Array,v=d.uint16Array,E=2*r,x=dz(2*t,p),C=dz(E,v),w=!1;if(C&&x)w=h?a(y[r+6],dk(2*r,v),f[t+6],dk(2*t,p),c,s+r,l,o+t):a(f[t+6],dk(2*t,p),y[r+6],dk(2*r,v),l,o+t,c,s+r);else if(C){let u=mG.getPrimitive();dI(r,g,u),u.applyMatrix4(i);let A=t+8,d=f[t+6];dI(A,m,mN),dI(d,m,mH);let p=u.intersectsBox(mN),y=u.intersectsBox(mH);w=p&&e(r,A,n,i,a,s,o,c,l+1,u,!h)||y&&e(r,d,n,i,a,s,o,c,l+1,u,!h),mG.releasePrimitive(u)}else{let A=r+8,d=y[r+6];dI(A,g,mj),dI(d,g,mJ);let p=u.intersectsBox(mj),v=u.intersectsBox(mJ);if(p&&v)w=e(t,A,i,n,a,o,s,l,c+1,u,h)||e(t,d,i,n,a,o,s,l,c+1,u,h);else if(p){if(x)w=e(t,A,i,n,a,o,s,l,c+1,u,h);else{let r=mG.getPrimitive();r.copy(mj).applyMatrix4(i);let u=t+8,d=f[t+6];dI(u,m,mN),dI(d,m,mH);let p=r.intersectsBox(mN),g=r.intersectsBox(mH);w=p&&e(A,u,n,i,a,s,o,c,l+1,r,!h)||g&&e(A,d,n,i,a,s,o,c,l+1,r,!h),mG.releasePrimitive(r)}}else if(v){if(x)w=e(t,d,i,n,a,o,s,l,c+1,u,h);else{let r=mG.getPrimitive();r.copy(mJ).applyMatrix4(i);let u=t+8,A=f[t+6];dI(u,m,mN),dI(A,m,mH);let p=r.intersectsBox(mN),g=r.intersectsBox(mH);w=p&&e(d,u,n,i,a,s,o,c,l+1,r,!h)||g&&e(d,A,n,i,a,s,o,c,l+1,r,!h),mG.releasePrimitive(r)}}}return w}(0,0,r,c,i,s,l,0,0,t),mU.clearBuffer(),l+=o[e].length,!n);e++);if(mG.releasePrimitive(t),mO.clearBuffer(),s+=a[e].length,n)break}return mV=!1,n}(this,e,t,i)}intersectsBox(e,t){return mK.set(e.min,e.max,t),mK.needsUpdate=!0,this.shapecast({intersectsBounds:e=>mK.intersectsBox(e),intersectsTriangle:e=>mK.intersectsTriangle(e)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,r={},i={},n=0,a=1/0){return(this.indirect?function(e,t,r,i={},n={},a=0,o=1/0){t.boundingBox||t.computeBoundingBox(),mR.set(t.boundingBox.min,t.boundingBox.max,r),mR.needsUpdate=!0;let s=e.geometry,l=s.attributes.position,c=s.index,u=t.attributes.position,h=t.index,A=dK.getPrimitive(),d=dK.getPrimitive(),m=null,f=null;n&&(m=mk,f=mL);let p=1/0,g=null,y=null;return(mT.copy(r).invert(),mF.matrix.copy(mT),e.shapecast({boundsTraverseOrder:e=>mR.distanceToBox(e),intersectsBounds:(e,t,r)=>r<p&&r<o&&(t&&(mF.min.copy(e.min),mF.max.copy(e.max),mF.needsUpdate=!0),!0),intersectsRange:(i,n)=>
891{if(t.boundsTree){let s=t.boundsTree;return s.shapecast({boundsTraverseOrder:e=>mF.distanceToBox(e),intersectsBounds:(e,t,r)=>r<p&&r<o,intersectsRange:(t,o)=>{for(let v=t,E=t+o;v<E;v++){mt(d,3*s.resolveTriangleIndex(v),h,u),d.a.applyMatrix4(r),d.b.applyMatrix4(r),d.c.applyMatrix4(r),d.needsUpdate=!0;for(let t=i,r=i+n;t<r;t++){mt(A,3*e.resolveTriangleIndex(t),c,l),A.needsUpdate=!0;let r=A.distanceToTriangle(d,mQ,m);if(r<p&&(mz.copy(mQ),f&&f.copy(m),p=r,g=t,y=v),r<a)return!0}}}})}{let o=dE(t);for(let t=0;t<o;t++){mt(d,3*t,h,u),d.a.applyMatrix4(r),d.b.applyMatrix4(r),d.c.applyMatrix4(r),d.needsUpdate=!0;for(let r=i,o=i+n;r<o;r++){mt(A,3*e.resolveTriangleIndex(r),c,l),A.needsUpdate=!0;let i=A.distanceToTriangle(d,mQ,m);if(i<p&&(mz.copy(mQ),f&&f.copy(m),p=i,g=r,y=t),i<a)return!0}}}}}),dK.releasePrimitive(A),dK.releasePrimitive(d),p===1/0)?null:(i.point?i.point.copy(mz):i.point=mz.clone(),i.distance=p,i.faceIndex=g,n&&(n.point?n.point.copy(f):n.point=f.clone(),n.point.applyMatrix4(mT),mz.applyMatrix4(mT),n.distance=mz.sub(n.point).length(),n.faceIndex=y),i)}:function(e,t,r,i={},n={},a=0,o=1/0){t.boundingBox||t.computeBoundingBox(),mf.set(t.boundingBox.min,t.boundingBox.max,r),mf.needsUpdate=!0;let s=e.geometry,l=s.attributes.position,c=s.index,u=t.attributes.position,h=t.index,A=dK.getPrimitive(),d=dK.getPrimitive(),m=null,f=null;n&&(m=mv,f=mE);let p=1/0,g=null,y=null;return(mm.copy(r).invert(),mp.matrix.copy(mm),e.shapecast({boundsTraverseOrder:e=>mf.distanceToBox(e),intersectsBounds:(e,t,r)=>r<p&&r<o&&(t&&(mp.min.copy(e.min),mp.max.copy(e.max),mp.needsUpdate=!0),!0),intersectsRange:(e,i)=>{if(t.boundsTree)return t.boundsTree.shapecast({boundsTraverseOrder:e=>mp.distanceToBox(e),intersectsBounds:(e,t,r)=>r<p&&r<o,intersectsRange:(t,n)=>{for(let o=t,s=t+n;o<s;o++){mt(d,3*o,h,u),d.a.applyMatrix4(r),d.b.applyMatrix4(r),d.c.applyMatrix4(r),d.needsUpdate=!0;for(let t=e,r=e+i;t<r;t++){mt(A,3*t,c,l),A.needsUpdate=!0;let e=A.distanceToTriangle(d,mg,m);if(e<p&&(my.copy(mg),f&&f.copy(m),p=e,g=t,y=o),e<a)return!0}}}});{let n=dE(t);for(let t=0;t<n;t++){mt(d,3*t,h,u),d.a.applyMatrix4(r),d.b.applyMatrix4(r),d.c.applyMatrix4(r),d.needsUpdate=!0;for(let r=e,n=e+i;r<n;r++){mt(A,3*r,c,l),A.needsUpdate=!0;let e=A.distanceToTriangle(d,mg,m);if(e<p&&(my.copy(mg),f&&f.copy(m),p=e,g=r,y=t),e<a)return!0}}}}}),dK.releasePrimitive(A),dK.releasePrimitive(d),p===1/0)?null:(i.point?i.point.copy(my):i.point=my.clone(),i.distance=p,i.faceIndex=g,n&&(n.point?n.point.copy(f):n.point=f.clone(),n.point.applyMatrix4(mm),my.applyMatrix4(mm),n.distance=my.sub(n.point).length(),n.faceIndex=y),i)})(this,e,t,r,i,n,a)}closestPointToPoint(e,t={},r=0,i=1/0){return function(e,t,r={},i=0,n=1/0){let a=i*i,o=n*n,s=1/0,l=null;if(e.shapecast({boundsTraverseOrder:e=>(dZ.copy(t).clamp(e.min,e.max),dZ.distanceToSquared(t)),intersectsBounds:(e,t,r)=>r<s&&r<o,intersectsTriangle:(e,r)=>{e.closestPointToPoint(t,dZ);let i=t.distanceToSquared(dZ);return i<s&&(d$.copy(dZ),s=i,l=r),i<a}}),s===1/0)return null;let c=Math.sqrt(s);return r.point?r.point.copy(d$):r.point=d$.clone(),r.distance=c,r.faceIndex=l,r}(this,e,t,r,i)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(t=>{dI(0,new Float32Array(t),mY),e.union(mY)}),e}}let mX=eT.zwN||null;parseInt(eT.UZH);let mZ=new eT.zHn,m$=new eT.Pa4,m1=new eT.yGw,m0=eT.Kj0.prototype.raycast,m2=null!==mX?mX.prototype.raycast:null,m3=new eT.Pa4,m4=new eT.Kj0,m5=[];function m6(e,t){this.isBatchedMesh?m8.call(this,e,t):m9.call(this,e,t)}function m8(e,t){if(this.boundsTrees){let r=this.boundsTrees,i=this._drawInfo,n=this._drawRanges,a=this.matrixWorld;m4.material=this.material,m4.geometry=this.geometry;let o=m4.geometry.boundsTree,s=m4.geometry.drawRange;null===m4.geometry.boundingSphere&&(m4.geometry.boundingSphere=new eT.aLr);for(let o=0,s=i.length;o<s;o++){if(!this.getVisibleAt(o))continue;let s=i[o].geometryIndex;if(m4.geometry.boundsTree=r[s],this.getMatrixAt(o,m4.matrixWorld).premultiply(a),!m4.geometry.boundsTree){this.getBoundingBoxAt(s,m4.geometry.boundingBox),this.getBoundingSphereAt(s,m4.geometry.boundingSphere);let e=n[s];m4.geometry.setDrawRange(e.start,e.count)}m4.raycast(e,m5);for(let e=0,r=m5.length;e<r;e++){let r=m5[e];r.object=this,r.batchId=o,t.push(r)}m5.length=0}m4.geometry.boundsTree=o,m4.geometry.drawRange=s,m4.material=null,m4.geometry=null}else m2.call(this,e,t)}function m9(e,t){if(this.geometry.boundsTree){if(void 0===this.material)return;m1.copy(this.matrixWorld).invert(),mZ.copy(e.ray).applyMatrix4(m1),m3.setFromMatrixScale(this.matrixWorld),m$.copy(mZ.direction).multiply(m3);let r=m$.length(),i=e.near/r,n=e.far/r,a=this.geometry.boundsTree;if(!0===e.firstHitOnly){let r=dy(a.raycastFirst(mZ,this.material,i,n),this,e);r&&t.push(r)}else{let r=a.raycast(mZ,this.material,i,n);for(let i=0,n=r.length;i<n;i++){let n=dy(r[i],this,e);
891n&&t.push(n)}}}else m0.call(this,e,t)}function m7(e={}){return this.boundsTree=new mq(this,e),this.boundsTree}function fe(){this.boundsTree=null}let ft=e=>e.isMesh;function fr(e,t){t={strategy:dp,verbose:!1,setBoundingBox:!0,maxDepth:40,maxLeafTris:10,indirect:!1,...t},eD.useEffect(()=>{if(e.current){e.current.raycast=m6;let r=e.current.geometry;return r.computeBoundsTree=m7,r.disposeBoundsTree=fe,r.computeBoundsTree(t),()=>{r.boundsTree&&r.disposeBoundsTree()}}},[e,JSON.stringify(t)])}let fi=eD.forwardRef(({enabled:e=!0,firstHitOnly:t=!1,children:r,strategy:i=dp,verbose:n=!1,setBoundingBox:a=!0,maxDepth:o=40,maxLeafTris:s=10,indirect:l=!1,...c},u)=>{let h=eD.useRef(null),A=(0,eR.D)(e=>e.raycaster);return eD.useImperativeHandle(u,()=>h.current,[]),eD.useEffect(()=>{if(e){let e={strategy:i,verbose:n,setBoundingBox:a,maxDepth:o,maxLeafTris:s,indirect:l},r=h.current;return A.firstHitOnly=t,r.traverse(t=>{ft(t)&&!t.geometry.boundsTree&&t.raycast===eT.Kj0.prototype.raycast&&(t.raycast=m6,t.geometry.computeBoundsTree=m7,t.geometry.disposeBoundsTree=fe,t.geometry.computeBoundsTree(e))}),()=>{delete A.firstHitOnly,r.traverse(e=>{ft(e)&&e.geometry.boundsTree&&(e.geometry.disposeBoundsTree(),e.raycast=eT.Kj0.prototype.raycast)})}}},[]),eD.createElement("group",(0,eS.Z)({ref:h},c),r)});function fn(...e){let t=eD.useRef([]);return t.current=e.map(e=>eD.useContext(e)),eD.useMemo(()=>({children:r})=>e.reduceRight((e,r,i)=>eD.createElement(r.Provider,{value:t.current[i],children:e}),r),[])}function fa(e,t){let r=eD.useRef(),[i]=eD.useState(()=>t?t instanceof eT.Tme?{current:t}:t:r),[n]=eD.useState(()=>new eT.Xcj(void 0));eD.useLayoutEffect(()=>{t&&(i.current=t instanceof eT.Tme?t:t.current),n._root=i.current});let a=eD.useRef({}),o=eD.useMemo(()=>{let t={};return e.forEach(e=>Object.defineProperty(t,e.name,{enumerable:!0,get(){if(i.current)return a.current[e.name]||(a.current[e.name]=n.clipAction(e,i.current))},configurable:!0})),{ref:i,clips:e,actions:t,names:e.map(e=>e.name),mixer:n}},[e]);return(0,eR.F)((e,t)=>n.update(t)),eD.useEffect(()=>{let e=i.current;return()=>{a.current={},n.stopAllAction(),Object.values(o.actions).forEach(t=>{e&&n.uncacheAction(t,e)})}},[e]),o}function fo(e){let t=eD.useRef(null),r=eD.useRef(!1),i=eD.useRef(!1),n=eD.useRef(e);return eD.useLayoutEffect(()=>void(n.current=e),[e]),eD.useEffect(()=>{let e=t.current;if(e){let t=(0,eR.o)(()=>(r.current=!1,!0)),a=e.onBeforeRender;e.onBeforeRender=()=>r.current=!0;let o=(0,eR.p)(()=>(r.current!==i.current&&(null==n.current||n.current(i.current=r.current)),!0));return()=>{e.onBeforeRender=a,t(),o()}}},[]),t}let fs=`
892#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )
893  vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );
894  #ifdef BOX_PROJECTED_ENV_MAP
895    vWorldPosition = worldPosition.xyz;
896  #endif
897#endif
898`,fl=`
899#ifdef BOX_PROJECTED_ENV_MAP
900  uniform vec3 envMapSize;
901  uniform vec3 envMapPosition;
902  varying vec3 vWorldPosition;
903    
904  vec3 parallaxCorrectNormal( vec3 v, vec3 cubeSize, vec3 cubePos ) {
905    vec3 nDir = normalize( v );
906    vec3 rbmax = ( .5 * cubeSize + cubePos - vWorldPosition ) / nDir;
907    vec3 rbmin = ( -.5 * cubeSize + cubePos - vWorldPosition ) / nDir;
908    vec3 rbminmax;
909    rbminmax.x = ( nDir.x > 0. ) ? rbmax.x : rbmin.x;
910    rbminmax.y = ( nDir.y > 0. ) ? rbmax.y : rbmin.y;
911    rbminmax.z = ( nDir.z > 0. ) ? rbmax.z : rbmin.z;
912    float correction = min( min( rbminmax.x, rbminmax.y ), rbminmax.z );
913    vec3 boxIntersection = vWorldPosition + nDir * correction;    
914    return boxIntersection - cubePos;
915  }
916#endif
917`,fc=`
918#ifdef BOX_PROJECTED_ENV_MAP
919  worldNormal = parallaxCorrectNormal( worldNormal, envMapSize, envMapPosition );
920#endif
921`,fu=`
922#ifdef BOX_PROJECTED_ENV_MAP
923  reflectVec = parallaxCorrectNormal( reflectVec, envMapSize, envMapPosition );
924#endif
925`;function fh(e=new eT.Pa4,t=new eT.Pa4){let[r]=eD.useState(()=>({position:new eT.Pa4,size:new eT.Pa4}));(0,eR.k)(r,{position:e,size:t});let i=eD.useRef(null),n=eD.useMemo(()=>({ref:i,onBeforeCompile:e=>{var t,i;
925return t=r.position,i=r.size,void(e.defines.BOX_PROJECTED_ENV_MAP=!0,e.uniforms.envMapPosition={value:t},e.uniforms.envMapSize={value:i},e.vertexShader=`
926  varying vec3 vWorldPosition;
927  ${e.vertexShader.replace("#include <worldpos_vertex>",fs)}`,e.fragmentShader=`
928    ${fl}
929    ${e.fragmentShader.replace("#include <envmap_physical_pars_fragment>",aQ.ShaderChunk.envmap_physical_pars_fragment).replace("vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );",`vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
930         ${fc}
931         `).replace("reflectVec = inverseTransformDirection( reflectVec, viewMatrix );",`reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
932         ${fu}
933        `)}`)},customProgramCacheKey:()=>JSON.stringify(r.position.toArray())+JSON.stringify(r.size.toArray())}),[...r.position.toArray(),...r.size.toArray()]);return eD.useLayoutEffect(()=>void(i.current.needsUpdate=!0),[r]),n}let fA=new eT.ZzF,fd=new eT.Pa4,fm=({anchor:e,...t})=>{let r=eD.useRef(null),i=eD.useRef(null);return eD.useEffect(()=>{var e;null!=(e=r.current)&&null!=(e=e.parent)&&e.parent&&(i.current=r.current.parent,r.current.parent.parent.add(r.current))},[]),(0,eR.F)(()=>{i.current&&(fA.setFromObject(i.current),fA.getSize(fd),r.current.position.set(i.current.position.x+fd.x*(Array.isArray(e)?e[0]:e.x)/2,i.current.position.y+fd.y*(Array.isArray(e)?e[1]:e.y)/2,i.current.position.z+fd.z*(Array.isArray(e)?e[2]:e.z)/2))}),eD.createElement("group",(0,eS.Z)({ref:r},t))},ff=e=>Math.sqrt(1-Math.pow(e-1,2));class fp{constructor({size:e=256,maxAge:t=750,radius:r=.3,intensity:i=.2,interpolate:n=0,smoothing:a=0,minForce:o=.3,blend:s="screen",ease:l=ff}={}){this.size=e,this.maxAge=t,this.radius=r,this.intensity=i,this.ease=l,this.interpolate=n,this.smoothing=a,this.minForce=o,this.blend=s,this.trail=[],this.force=0,this.initTexture()}initTexture(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=this.size;let e=this.canvas.getContext("2d");if(null===e)throw Error("2D not available");this.ctx=e,this.ctx.fillStyle="black",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.texture=new eT.xEZ(this.canvas),this.canvas.id="touchTexture",this.canvas.style.width=this.canvas.style.height=`${this.canvas.width}px`}update(e){this.clear(),this.trail.forEach((t,r)=>{t.age+=1e3*e,t.age>this.maxAge&&this.trail.splice(r,1)}),this.trail.length||(this.force=0),this.trail.forEach(e=>{this.drawTouch(e)}),this.texture.needsUpdate=!0}clear(){this.ctx.globalCompositeOperation="source-over",this.ctx.fillStyle="black",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)}addTouch(e){let t=this.trail[this.trail.length-1];if(t){let r=t.x-e.x,i=t.y-e.y,n=r*r+i*i,a=Math.max(this.minForce,Math.min(1e4*n,1));if(this.force=function(e,t,r=.9){return t*r+e*(1-r)}(a,this.force,this.smoothing),this.interpolate){let e=Math.ceil(n/Math.pow(.5*this.radius/this.interpolate,2));if(e>1)for(let n=1;n<e;n++)this.trail.push({x:t.x-r/e*n,y:t.y-i/e*n,age:0,force:a})}}this.trail.push({x:e.x,y:e.y,age:0,force:this.force})}drawTouch(e){let t={x:e.x*this.size,y:(1-e.y)*this.size},r=1;r=(e.age<.3*this.maxAge?this.ease(e.age/(.3*this.maxAge)):this.ease(1-(e.age-.3*this.maxAge)/(.7*this.maxAge)))*e.force,this.ctx.globalCompositeOperation=this.blend;let i=this.size*this.radius*r,n=this.ctx.createRadialGradient(t.x,t.y,Math.max(0,.25*i),t.x,t.y,Math.max(0,i));n.addColorStop(0,`rgba(255, 255, 255, ${this.intensity})`),n.addColorStop(1,"rgba(0, 0, 0, 0.0)"),this.ctx.beginPath(),this.ctx.fillStyle=n,this.ctx.arc(t.x,t.y,Math.max(0,i),0,2*Math.PI),this.ctx.fill()}}function fg(e={}){let{size:t,maxAge:r,radius:i,intensity:n,interpolate:a,smoothing:o,minForce:s,blend:l,ease:c}=e,u=(0,eD.useMemo)(()=>new fp(e),[t,r,i,n,a,o,s,l,c]);(0,eR.F)((e,t)=>void u.update(t));let h=(0,eD.useCallback)(e=>u.addTouch(e.uv),[u]);return[u.texture,h]}let fy=({children:e,...t})=>{let r=fg(t);return eD.createElement(eD.Fragment,null,null==e?void 0:e(r))},fv=eD.forwardRef(function({children:e,disable:t,disableX:r,disableY:i,disableZ:n,left:a,right:o,top:s,bottom:l,front:c,back:u,onCentered:h,precise:A=!0,cacheKey:d=0,...m},f){let p=eD.useRef(null),g=eD.useRef(null),y=eD.useRef(null);return eD.useLayoutEffect(()=>{g.current.matrixWorld.identity();let e=new eT.ZzF().setFromObject(y.current,A),d=new eT.Pa4,m=new eT.aLr,f=e.max.x-e.min.x,v=e.max.y-e.min.y,E=e.max.z-e.min.z;e.getCenter(d),e.getBoundingSphere(m);let x=s?v/2:l?-v/2:0,C=a?-f/2:o?f/2:0,w=c?E/2:u?-E/2:0;g.current.position.set(t||r?0:-d.x+C,t||i?0:-d.y+x,t||n?0:-d.z+w),void 0!==h&&h({parent:p.current.parent,container:p.current,width:f,height:v,depth:E,boundingBox:e,boundingSphere:m,center:d,verticalAlignment:x,horizontalAlignment:C,depthAlignment:w})},[d,h,s,a,c,t,r,i,n,A,o,l,u]),eD.useImperativeHandle(f,()=>p.current,[]),eD.createElement("group",(0,eS.Z)({ref:p},m),eD.createElement("group",{ref:g},eD.createElement("group",{ref:y},e)))}),fE=eD.forwardRef(({font:e,color:t="#cbcbcb",bevelSize:r=.04,debug:i=!1,children:n,...a},o)=>{let[s,l]=eD.useState(0),c=eD.useCallback((e=1)=>l(s+e),[s]),u=eD.useCallback((e=1)=>l(s-e),[s]),h=eD.useMemo(()=>({incr:c,decr:u}),[c,u]);return eD.useImperativeHandle(o,()=>h,[h]),eD.createElement("group",a,eD.createElement(eD.Suspense,{fallback:null},eD.createElement(fv,{top:!0,cacheKey:JSON.stringify({counter:s,font:e})},eD.createElement(o4,{bevelEnabled:!0,bevelSize:r,font:e},i?eD.createElement("meshNormalMaterial",{wireframe:!0}):eD.createElement("meshStandardMaterial",{color:t}),s))),n)});var fx=r(40718),fC=r.n(fx);function fw(e){return function e(t,r,i){if(i=i||[],!r[0])return t(i);function n(n){return e(t,r.slice(1),i.concat([n]))}return"function"==typeof r[0]?r[0]({results:i,render:n}):(0,eD.cloneElement)(r[0],{children:n})}(e.children,e.components)}fw.propTypes={children:fC().func.isRequired,components:fC().arrayOf(fC().oneOfType([fC().element,fC().func])).isRequired};var fB=r(80008);let fI=new eT.yGw,f_=new eT.yGw,fb=[],fM=new eT.Kj0;class fS extends eT.ZAu{constructor(){super(),this.color=new eT.Ilk("white"),this.instance={current:void 0},this.instanceKey={current:void 0}}get geometry(){var e;return null==(e=this.instance.current)?void 0:e.geometry}raycast(e,t){let r=this.instance.current;if(!r||!r.geometry||!r.material)return;fM.geometry=r.geometry;let i=r.matrixWorld,n=r.userData.instances.indexOf(this.instanceKey);if(-1!==n&&!(n>r.count)){r.getMatrixAt(n,fI),f_.multiplyMatrices(i,fI),fM.matrixWorld=f_,r.material instanceof eT.F5T?fM.material.side=r.material.side:fM.material.side=r.material[0].side,fM.raycast(e,fb);for(let e=0,r=fb.length;e<r;e++){let r=fb[e];r.instanceId=n,r.object=this,t.push(r)}fb.length=0}}}let fD=eD.createContext(null),fP=new eT.yGw,fT=new eT.yGw,fR=new eT.yGw,fF=new eT.Pa4,fQ=new eT._fP,fz=new eT.Pa4,fk=e=>e.isInstancedBufferAttribute,fL=eD.forwardRef(({context:e,children:t,...r},i)=>{eD.useMemo(()=>(0,eR.e)({PositionMesh:fS}),[]);let n=eD.useRef();eD.useImperativeHandle(i,()=>n.current,[]);let{subscribe:a,getParent:o}=eD.useContext(e||fD);return eD.useLayoutEffect(()=>a(n),[]),eD.createElement("positionMesh",(0,eS.Z)({instance:o(),instanceKey:n,ref:n},r),t)}),fO=eD.forwardRef(({context:e,children:t,range:r,limit:i=1e3,frames:n=1/0,...a},o)=>{let[{localContext:s,instance:l}]=eD.useState(()=>{let e=eD.createContext(null);return{localContext:e,instance:eD.forwardRef((t,r)=>eD.createElement(fL,(0,eS.Z)({context:e},t,{ref:r})))}}),c=eD.useRef(null);eD.useImperativeHandle(o,()=>c.current,[]);let[u,h]=eD.useState([]),[[A,d]]=eD.useState(()=>{let e=new Float32Array(16*i);for(let t=0;t<i;t++)fR.identity().toArray(e,16*t);return[e,new Float32Array([...Array(3*i)].map(()=>1))]});eD.useEffect(()=>{c.current.instanceMatrix.needsUpdate=!0});let m=0,f=0,p=eD.useRef([]);eD.useLayoutEffect(()=>{p.current=Object.entries(c.current.geometry.attributes).filter(([e,t])=>fk(t))}),(0,eR.F)(()=>
933{if(n===1/0||m<n){c.current.updateMatrix(),c.current.updateMatrixWorld(),fP.copy(c.current.matrixWorld).invert(),f=Math.min(i,void 0!==r?r:i,u.length),c.current.count=f,(0,fB.Jj)(c.current.instanceMatrix,{offset:0,count:16*f}),(0,fB.Jj)(c.current.instanceColor,{offset:0,count:3*f});for(let e=0;e<u.length;e++){let t=u[e].current;t.matrixWorld.decompose(fF,fQ,fz),fT.compose(fF,fQ,fz).premultiply(fP),fT.toArray(A,16*e),c.current.instanceMatrix.needsUpdate=!0,t.color.toArray(d,3*e),c.current.instanceColor.needsUpdate=!0}m++}});let g=eD.useMemo(()=>({getParent:()=>c,subscribe:e=>(h(t=>[...t,e]),()=>h(t=>t.filter(t=>t.current!==e.current)))}),[]);return eD.createElement("instancedMesh",(0,eS.Z)({userData:{instances:u,limit:i,frames:n},matrixAutoUpdate:!1,ref:c,args:[null,null,0],raycast:()=>null},a),eD.createElement("instancedBufferAttribute",{attach:"instanceMatrix",count:A.length/16,array:A,itemSize:16,usage:eT.dj0}),eD.createElement("instancedBufferAttribute",{attach:"instanceColor",count:d.length/3,array:d,itemSize:3,usage:eT.dj0}),"function"==typeof t?eD.createElement(s.Provider,{value:g},t(l)):e?eD.createElement(e.Provider,{value:g},t):eD.createElement(fD.Provider,{value:g},t))}),fU=eD.forwardRef(function({meshes:e,children:t,...r},i){let n=Array.isArray(e);if(!n)for(let t of Object.keys(e))e[t].isMesh||delete e[t];return eD.createElement("group",{ref:i},eD.createElement(fw,{components:(n?e:Object.values(e)).map(({geometry:e,material:t})=>eD.createElement(fO,(0,eS.Z)({key:e.uuid,geometry:e,material:t},r)))},r=>n?t(...r):t(Object.keys(e).filter(t=>e[t].isMesh).reduce((e,t,i)=>({...e,[t]:r[i]}),{}))))});function fG(){let e=eD.createContext(null);return[eD.forwardRef((t,r)=>eD.createElement(fO,(0,eS.Z)({ref:r,context:e},t))),eD.forwardRef((t,r)=>eD.createElement(fL,(0,eS.Z)({ref:r,context:e},t)))]}let fN=eD.forwardRef(({name:e,defaultValue:t,normalized:r,usage:i=eT.dj0},n)=>{let a=eD.useRef(null);eD.useImperativeHandle(n,()=>a.current,[]),eD.useLayoutEffect(()=>{let r=a.current.__r3f.parent;r.geometry.attributes[e]=a.current;let i=Array.isArray(t)?t:[t],n=Array.from({length:r.userData.limit},()=>i).flat();return a.current.array=new Float32Array(n),a.current.itemSize=i.length,a.current.count=n.length/a.current.itemSize,()=>{delete r.geometry.attributes[e]}},[e]);let o=0;return(0,eR.F)(()=>{let t=a.current.__r3f.parent;if(t.userData.frames===1/0||o<t.userData.frames){for(let r=0;r<t.userData.instances.length;r++){let i=t.userData.instances[r].current[e];void 0!==i&&(a.current.set(Array.isArray(i)?i:"function"==typeof i.toArray?i.toArray():[i],r*a.current.itemSize),a.current.needsUpdate=!0)}o++}}),eD.createElement("instancedBufferAttribute",{ref:a,usage:i,normalized:r})}),fH=eD.createContext(null);function fj(){return eD.useContext(fH)}let fJ=new eT._12(1,1),fV=eD.forwardRef(({startFrame:e=0,endFrame:t,fps:r=30,frameName:i="",textureDataURL:n,textureImageURL:a,loop:o=!1,numberOfFrames:s=1,autoPlay:l=!0,animationNames:c,onStart:u,onEnd:h,onLoopEnd:A,onFrame:d,play:m,pause:f=!1,flipX:p=!1,alphaTest:g=0,children:y,asSprite:v=!1,offset:E,playBackwards:x=!1,resetOnEnd:C=!1,maxItems:w=1,instanceItems:B=[[0,0,0]],spriteDataset:I,canvasRenderingContext2DSettings:_,roundFramePosition:b=!1,meshProps:M={},...S},D)=>{let P=eD.useRef(new eT.ZAu),T=eD.useRef(null),R=eD.useRef(null),F=eD.useRef(null),Q=eD.useRef(window.performance.now()),z=eD.useRef(e),k=eD.useRef(i),L=r>0?1e3/r:0,[O,U]=eD.useState(new eT.xEZ),G=eD.useRef(0),[N,H]=eD.useState(new eT.Pa4(1,1,1)),j=p?-1:1,J=eD.useRef(f),V=eD.useRef(E),K=eD.useRef(!1),{spriteObj:Y,loadJsonAndTexture:W}=A1(null,null,c,s,void 0,_),q=eD.useRef(i),X=eD.useCallback((e,t)=>{if(null===t)s&&(G.current=s,x&&(z.current=s-1),T.current=t);else{var r,i;T.current=t,T.current&&Array.isArray(T.current.frames)?G.current=T.current.frames.length:T.current&&"object"==typeof T.current&&q.current?G.current=T.current.frames[q.current].length:G.current=0,x&&(z.current=G.current-1);let{w:n,h:a}=AZ(null!==(r=null==(i=T.current)?void 0:i.frames)&&void 0!==r?r:[],q.current).sourceSize;H(ee(n,a)),R.current&&(R.current.map=e)}U(e)},[s,x]),Z=eD.useCallback(()=>
933{if(!T.current)return;let{meta:{size:e},frames:t}=T.current,{w:r,h:n}=Array.isArray(t)?t[0].sourceSize:i&&t[i]?t[i][0].sourceSize:{w:0,h:0};R.current&&R.current.map&&(R.current.map.wrapS=R.current.map.wrapT=eT.rpg,R.current.map.center.set(0,0),R.current.map.repeat.set(1*j/(e.w/r),1/(e.h/n)));let a=(e.h-1)/n;R.current&&R.current.map&&(R.current.map.offset.x=0,R.current.map.offset.y=1-1/a),u&&u({currentFrameName:null!=i?i:"",currentFrame:z.current})},[j,i,u]),$=eD.useMemo(()=>({current:V.current,offset:V.current,imageUrl:a,hasEnded:!1,ref:D}),[a,D]);eD.useImperativeHandle(D,()=>P.current,[]),eD.useLayoutEffect(()=>{V.current=E},[E]);let ee=(e,t)=>{var r;let i=new eT.Pa4;return i.set(1,t/e,1),null==(r=F.current)||r.scale.copy(i),i};eD.useEffect(()=>{if(I){var e;X(null==I||null==(e=I.spriteTexture)?void 0:e.clone(),I.spriteData)}else a&&n&&W(a,n)},[W,I,n,a,X]),eD.useEffect(()=>{if(Y){var e;X(null==Y||null==(e=Y.spriteTexture)?void 0:e.clone(),null==Y?void 0:Y.spriteData)}},[Y,X]),eD.useEffect(()=>{if($.hasEnded=!1,T.current&&!0===x){var e;z.current=(null!==(e=T.current.frames.length)&&void 0!==e?e:0)-1}else z.current=0},[x,$]),eD.useLayoutEffect(()=>{Z()},[O,p,Z]),eD.useEffect(()=>{l&&(J.current=!1)},[l]),eD.useLayoutEffect(()=>{if(k.current!==i&&i&&(z.current=0,k.current=i,$.hasEnded=!1,L<=0&&(z.current=t||e||0),T.current)){let{w:e,h:t}=AZ(T.current.frames,i).sourceSize;H(ee(e,t))}},[i,L,$,t,e]);let et=()=>{if(!(null!==(d=T.current)&&"meta"in d&&"frames"in d))return;let{meta:{size:r},frames:n}=T.current,{w:a,h:s}=AZ(n,i).sourceSize,l=Array.isArray(n)?n:i?n[i]:[],c=t||l.length-1;var d,m=void 0===E?$.current:E;if(L<=0){z.current=t||e||0,er(a,s,r,l);return}let f=window.performance.now(),p=f-Q.current;if(!(p<=L)){var g=x?z.current<0:z.current>c,y=x?z.current===c:0===z.current,v=x?z.current<0:z.current>=c;if(g){if(z.current=o&&null!=e?e:0,x&&(z.current=c),o?null==A||A({currentFrameName:null!=i?i:"",currentFrame:z.current}):(null==h||h({currentFrameName:null!=i?i:"",currentFrame:z.current}),$.hasEnded=!C,C&&(J.current=!0)),!o)return}else y&&(null==u||u({currentFrameName:null!=i?i:"",currentFrame:z.current}));void 0!==m&&v?!1===K.current&&(null==h||h({currentFrameName:null!=i?i:"",currentFrame:z.current}),K.current=!0):K.current=!1,p<=L||(Q.current=f-p%L,er(a,s,r,l))}},er=(e,t,r,i)=>{var n=void 0===E?$.current:E;let a=z.current,o=0,s=0;ee(e,t);let l=b?Math.round((r.w-1)/e):(r.w-1)/e,c=b?Math.round((r.h-1)/t):(r.h-1)/t;if(!i[a])return;let{frame:{x:u,y:h},sourceSize:{w:A,h:d}}=i[a],m=1/l,f=1/c;if(R.current&&R.current.map&&(o=j>0?u/A*m:u/A*m-R.current.map.repeat.x,s=Math.abs(1-f)-h/d*f,R.current.map.offset.x=o,R.current.map.offset.y=s),null!=n){let e=Math.floor(n*i.length);isNaN(e=Math.max(0,Math.min(e,i.length-1)))&&(e=0),z.current=e}else x?z.current-=1:z.current+=1};return(0,eR.F)((e,t)=>{var r,i;null!=(r=T.current)&&r.frames&&null!=(i=R.current)&&i.map&&!J.current&&!$.hasEnded&&(l||m)&&(et(),null==d||d({currentFrameName:k.current,currentFrame:z.current}))}),eD.createElement("group",(0,eS.Z)({},S,{ref:P,scale:function(e=new eT.Pa4(1,1,1),t=1){return"number"==typeof t?e.multiplyScalar(t):Array.isArray(t)?e.multiply(new eT.Pa4(...t)):t instanceof eT.Pa4?e.multiply(t):void 0}(N,S.scale)}),eD.createElement(fH.Provider,{value:$},v&&eD.createElement(or,null,eD.createElement("mesh",(0,eS.Z)({ref:F,scale:1,geometry:fJ},M),eD.createElement("meshBasicMaterial",{premultipliedAlpha:!1,toneMapped:!1,side:eT.ehD,ref:R,map:O,transparent:!0,alphaTest:null!=g?g:0}))),!v&&eD.createElement(fO,(0,eS.Z)({geometry:fJ,limit:null!=w?w:1},M),eD.createElement("meshBasicMaterial",{premultipliedAlpha:!1,toneMapped:!1,side:eT.ehD,ref:R,map:O,transparent:!0,alphaTest:null!=g?g:0}),(null!=B?B:[0]).map((e,t)=>eD.createElement(fL,(0,eS.Z)({key:t,ref:(null==B?void 0:B.length)===1?F:null,position:e,scale:1},M)))),y))});var fK=Object.defineProperty,fY=(e,t,r)=>t in e?fK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fW=(e,t,r)=>(fY(e,"symbol"!=typeof t?t+"":t,r),r);let fq=(e=1)=>{let t=new Float32Array(4096*e*4),r=new eT.IEO(t,1024,4*e,eT.wk1,eT.VzW);return r.wrapS=eT.rpg,r.wrapT=eT.rpg,r.magFilter=eT.TyD,r.needsUpdate=!0,r},fX=(e,t,r=0)=>{let i=Math.floor(1024);t.arcLengthDivisions=i/2,t.updateArcLengths();let n=t.getSpacedPoints(i),a=t.computeFrenetFrames(i,!0);for(let t=0;t<i;t++){let i=Math.floor(t/1024),o=t%1024,s=n[t];fZ(e,o,s.x,s.y,s.z,0+i+4*r),fZ(e,o,(s=a.tangents[t]).x,s.y,s.z,1+i+4*r),fZ(e,o,(s=a.normals[t]).x,s.y,s.z,2+i+4*r),fZ(e,o,(s=a.binormals[t]).x,s.y,s.z,3+i+4*r)}e.needsUpdate=!0},fZ=(e,t,r,i,n,a)=>{let{data:o}=e.image,s=4096*a;o[4*t+s+0]=r,o[4*t+s+1]=i,o[4*t+s+2]=n,o[4*t+s+3]=1},f$=e=>({spineTexture:{value:e},pathOffset:{type:"f",value:0},pathSegment:{type:"f",value:1},spineOffset:{type:"f",value:161},spineLength:{type:"f",value:400},flow:{type:"i",value:1}});class f1{constructor(e,t=1){fW(this,"curveArray"),fW(this,"curveLengthArray"),fW(this,"object3D"),fW(this,"splineTexure"),fW(this,"uniforms");let r=e.clone(),i=fq(t),n=f$(i);r.traverse(e=>{(e instanceof eT.Kj0||e instanceof eT.SPe)&&(e.material=e.material.clone(),function(e,t,r=1){e.__ok||(e.__ok=!0,e.onBeforeCompile=e=>{if(e.__modified)return;e.__modified=!0,Object.assign(e.uniforms,t);let i=`
934		uniform sampler2D spineTexture;
935		uniform float pathOffset;
936		uniform float pathSegment;
937		uniform float spineOffset;
938		uniform float spineLength;
939		uniform int flow;
940
941		float textureLayers = ${4*r}.;
942		float textureStacks = 1.;
943
944		${e.vertexShader}
945		`.replace("#include <beginnormal_vertex>","").replace("#include <defaultnormal_vertex>","").replace("#include <begin_vertex>","").replace(/void\s*main\s*\(\)\s*\{/,`
946        void main() {
947        #include <beginnormal_vertex>
948
949        vec4 worldPos = modelMatrix * vec4(position, 1.);
950
951        bool bend = flow > 0;
952        float xWeight = bend ? 0. : 1.;
953
954        #ifdef USE_INSTANCING
955        float pathOffsetFromInstanceMatrix = instanceMatrix[3][2];
956        float spineLengthFromInstanceMatrix = instanceMatrix[3][0];
957        float spinePortion = bend ? (worldPos.x + spineOffset) / spineLengthFromInstanceMatrix : 0.;
958        float mt = (spinePortion * pathSegment + pathOffset + pathOffsetFromInstanceMatrix)*textureStacks;
959        #else
960        float spinePortion = bend ? (worldPos.x + spineOffset) / spineLength : 0.;
961        float mt = (spinePortion * pathSegment + pathOffset)*textureStacks;
962        #endif
963
964        mt = mod(mt, textureStacks);
965        float rowOffset = floor(mt);
966
967        #ifdef USE_INSTANCING
968        rowOffset += instanceMatrix[3][1] * 4.;
969        #endif
970
971        vec3 spinePos = texture2D(spineTexture, vec2(mt, (0. + rowOffset + 0.5) / textureLayers)).xyz;
972        vec3 a =        texture2D(spineTexture, vec2(mt, (1. + rowOffset + 0.5) / textureLayers)).xyz;
973        vec3 b =        texture2D(spineTexture, vec2(mt, (2. + rowOffset + 0.5) / textureLayers)).xyz;
974        vec3 c =        texture2D(spineTexture, vec2(mt, (3. + rowOffset + 0.5) / textureLayers)).xyz;
975        mat3 basis = mat3(a, b, c);
976
977        vec3 transformed = basis
978          * vec3(worldPos.x * xWeight, worldPos.y * 1., worldPos.z * 1.)
979          + spinePos;
980
981        vec3 transformedNormal = normalMatrix * (basis * objectNormal);
982			`).replace("#include <project_vertex>",`vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );
983				gl_Position = projectionMatrix * mvPosition;`);e.vertexShader=i})}(e.material,n,t))}),this.curveArray=Array(t),this.curveLengthArray=Array(t),this.object3D=r,this.splineTexure=i,this.uniforms=n}updateCurve(e,t){if(e>=this.curveArray.length)throw Error("Index out of range for Flow");let r=t.getLength();this.uniforms.spineLength.value=r,this.curveLengthArray[e]=r,this.curveArray[e]=t,fX(this.splineTexure,t,e)}moveAlongCurve(e){this.uniforms.pathOffset.value+=e}}let f0=eD.forwardRef(({children:e,curve:t},r)=>{let[i]=eD.useState(()=>new eT.xsS),[n,a]=eD.useState(),o=eD.useRef(null);return eD.useLayoutEffect(()=>
983{o.current=new f1(i.children[0]),a(o.current.object3D)},[e]),eD.useEffect(()=>{var e;t&&(null==(e=o.current)||e.updateCurve(0,t))},[t]),eD.useImperativeHandle(r,()=>o.current),eD.createElement(eD.Fragment,null,(0,eR.h)(e,i),n&&eD.createElement("primitive",{object:n}))});class f2 extends eT.EJi{constructor(e={}){super(e),this.setValues(e),this._time={value:0},this._distort={value:.4},this._radius={value:1}}onBeforeCompile(e){e.uniforms.time=this._time,e.uniforms.radius=this._radius,e.uniforms.distort=this._distort,e.vertexShader=`
984      uniform float time;
985      uniform float radius;
986      uniform float distort;
987      #define GLSLIFY 1
988vec3 mod289(vec3 x){return x-floor(x*(1.0/289.0))*289.0;}vec4 mod289(vec4 x){return x-floor(x*(1.0/289.0))*289.0;}vec4 permute(vec4 x){return mod289(((x*34.0)+1.0)*x);}vec4 taylorInvSqrt(vec4 r){return 1.79284291400159-0.85373472095314*r;}float snoise(vec3 v){const vec2 C=vec2(1.0/6.0,1.0/3.0);const vec4 D=vec4(0.0,0.5,1.0,2.0);vec3 i=floor(v+dot(v,C.yyy));vec3 x0=v-i+dot(i,C.xxx);vec3 g=step(x0.yzx,x0.xyz);vec3 l=1.0-g;vec3 i1=min(g.xyz,l.zxy);vec3 i2=max(g.xyz,l.zxy);vec3 x1=x0-i1+C.xxx;vec3 x2=x0-i2+C.yyy;vec3 x3=x0-D.yyy;i=mod289(i);vec4 p=permute(permute(permute(i.z+vec4(0.0,i1.z,i2.z,1.0))+i.y+vec4(0.0,i1.y,i2.y,1.0))+i.x+vec4(0.0,i1.x,i2.x,1.0));float n_=0.142857142857;vec3 ns=n_*D.wyz-D.xzx;vec4 j=p-49.0*floor(p*ns.z*ns.z);vec4 x_=floor(j*ns.z);vec4 y_=floor(j-7.0*x_);vec4 x=x_*ns.x+ns.yyyy;vec4 y=y_*ns.x+ns.yyyy;vec4 h=1.0-abs(x)-abs(y);vec4 b0=vec4(x.xy,y.xy);vec4 b1=vec4(x.zw,y.zw);vec4 s0=floor(b0)*2.0+1.0;vec4 s1=floor(b1)*2.0+1.0;vec4 sh=-step(h,vec4(0.0));vec4 a0=b0.xzyw+s0.xzyw*sh.xxyy;vec4 a1=b1.xzyw+s1.xzyw*sh.zzww;vec3 p0=vec3(a0.xy,h.x);vec3 p1=vec3(a0.zw,h.y);vec3 p2=vec3(a1.xy,h.z);vec3 p3=vec3(a1.zw,h.w);vec4 norm=taylorInvSqrt(vec4(dot(p0,p0),dot(p1,p1),dot(p2,p2),dot(p3,p3)));p0*=norm.x;p1*=norm.y;p2*=norm.z;p3*=norm.w;vec4 m=max(0.6-vec4(dot(x0,x0),dot(x1,x1),dot(x2,x2),dot(x3,x3)),0.0);m=m*m;return 42.0*dot(m*m,vec4(dot(p0,x0),dot(p1,x1),dot(p2,x2),dot(p3,x3)));}
989      ${e.vertexShader}
990    `,e.vertexShader=e.vertexShader.replace("#include <begin_vertex>",`
991        float updateTime = time / 50.0;
992        float noise = snoise(vec3(position / 2.0 + updateTime * 5.0));
993        vec3 transformed = vec3(position * (noise * pow(distort, 2.0) + radius));
994        `)}get time(){return this._time.value}set time(e){this._time.value=e}get distort(){return this._distort.value}set distort(e){this._distort.value=e}get radius(){return this._radius.value}set radius(e){this._radius.value=e}}let f3=eD.forwardRef(({speed:e=1,...t},r)=>{let[i]=eD.useState(()=>new f2);return(0,eR.F)(t=>i&&(i.time=t.clock.elapsedTime*e)),eD.createElement("primitive",(0,eS.Z)({object:i,ref:r,attach:"material"},t))});class f4 extends eT.Wid{constructor(e={}){super(e),this.setValues(e),this._time={value:0},this._factor={value:1}}onBeforeCompile(e){e.uniforms.time=this._time,e.uniforms.factor=this._factor,e.vertexShader=`
995      uniform float time;
996      uniform float factor;
997      ${e.vertexShader}
998    `,e.vertexShader=e.vertexShader.replace("#include <begin_vertex>",`float theta = sin( time + position.y ) / 2.0 * factor;
999        float c = cos( theta );
1000        float s = sin( theta );
1001        mat3 m = mat3( c, 0, s, 0, 1, 0, -s, 0, c );
1002        vec3 transformed = vec3( position ) * m;
1003        vNormal = vNormal * m;`)}get time(){return this._time.value}set time(e){this._time.value=e}get factor(){return this._factor.value}set factor(e){this._factor.value=e}}let f5=eD.forwardRef(({speed:e=1,...t},r)=>{let[i]=eD.useState(()=>new f4);return(0,eR.F)(t=>i&&(i.time=t.clock.elapsedTime*e)),eD.createElement("primitive",(0,eS.Z)({object:i,ref:r,attach:"material"},t))});class f6 extends eT.jyz{constructor(e=new eT.FM8){super({uniforms:{inputBuffer:new eT.xWb(null),depthBuffer:new eT.xWb(null),resolution:new eT.xWb(new eT.FM8),texelSize:new eT.xWb(new eT.FM8),halfTexelSize:new eT.xWb(new eT.FM8),kernel:new eT.xWb(0),scale:new eT.xWb(1),cameraNear:new eT.xWb(0),cameraFar:new eT.xWb(1),minDepthThreshold:new eT.xWb(0),maxDepthThreshold:new eT.xWb(1),depthScale:new eT.xWb(0),depthToBlurRatioBias:new eT.xWb(.25)},fragmentShader:`#include <common>
1004        #include <dithering_pars_fragment>      
1005        uniform sampler2D inputBuffer;
1006        uniform sampler2D depthBuffer;
1007        uniform float cameraNear;
1008        uniform float cameraFar;
1009        uniform float minDepthThreshold;
1010        uniform float maxDepthThreshold;
1011        uniform float depthScale;
1012        uniform float depthToBlurRatioBias;
1013        varying vec2 vUv;
1014        varying vec2 vUv0;
1015        varying vec2 vUv1;
1016        varying vec2 vUv2;
1017        varying vec2 vUv3;
1018
1019        void main() {
1020          float depthFactor = 0.0;
1021          
1022          #ifdef USE_DEPTH
1023            vec4 depth = texture2D(depthBuffer, vUv);
1024            depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));
1025            depthFactor *= depthScale;
1026            depthFactor = max(0.0, min(1.0, depthFactor + 0.25));
1027          #endif
1028          
1029          vec4 sum = texture2D(inputBuffer, mix(vUv0, vUv, depthFactor));
1030          sum += texture2D(inputBuffer, mix(vUv1, vUv, depthFactor));
1031          sum += texture2D(inputBuffer, mix(vUv2, vUv, depthFactor));
1032          sum += texture2D(inputBuffer, mix(vUv3, vUv, depthFactor));
1033          gl_FragColor = sum * 0.25 ;
1034
1035          #include <dithering_fragment>
1036          #include <tonemapping_fragment>
1037          #include <${sI.i>=154?"colorspace_fragment":"encodings_fragment"}>
1038        }`,vertexShader:`uniform vec2 texelSize;
1039        uniform vec2 halfTexelSize;
1040        uniform float kernel;
1041        uniform float scale;
1042        varying vec2 vUv;
1043        varying vec2 vUv0;
1044        varying vec2 vUv1;
1045        varying vec2 vUv2;
1046        varying vec2 vUv3;
1047
1048        void main() {
1049          vec2 uv = position.xy * 0.5 + 0.5;
1050          vUv = uv;
1051
1052          vec2 dUv = (texelSize * vec2(kernel) + halfTexelSize) * scale;
1053          vUv0 = vec2(uv.x - dUv.x, uv.y + dUv.y);
1054          vUv1 = vec2(uv.x + dUv.x, uv.y + dUv.y);
1055          vUv2 = vec2(uv.x + dUv.x, uv.y - dUv.y);
1056          vUv3 = vec2(uv.x - dUv.x, uv.y - dUv.y);
1057
1058          gl_Position = vec4(position.xy, 1.0, 1.0);
1059        }
1059`,blending:eT.jFi,depthWrite:!1,depthTest:!1}),this.toneMapped=!1,this.setTexelSize(e.x,e.y),this.kernel=new Float32Array([0,1,2,2,3])}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t),this.uniforms.halfTexelSize.value.set(e,t).multiplyScalar(.5)}setResolution(e){this.uniforms.resolution.value.copy(e)}}class f8{constructor({gl:e,resolution:t,width:r=500,height:i=500,minDepthThreshold:n=0,maxDepthThreshold:a=1,depthScale:o=0,depthToBlurRatioBias:s=.25}){this.renderToScreen=!1,this.renderTargetA=new eT.dd2(t,t,{minFilter:eT.wem,magFilter:eT.wem,stencilBuffer:!1,depthBuffer:!1,type:eT.cLu}),this.renderTargetB=this.renderTargetA.clone(),this.convolutionMaterial=new f6,this.convolutionMaterial.setTexelSize(1/r,1/i),this.convolutionMaterial.setResolution(new eT.FM8(r,i)),this.scene=new eT.xsS,this.camera=new eT.V1s,this.convolutionMaterial.uniforms.minDepthThreshold.value=n,this.convolutionMaterial.uniforms.maxDepthThreshold.value=a,this.convolutionMaterial.uniforms.depthScale.value=o,this.convolutionMaterial.uniforms.depthToBlurRatioBias.value=s,this.convolutionMaterial.defines.USE_DEPTH=o>0;let l=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),c=new Float32Array([0,0,2,0,0,2]),u=new eT.u9r;u.setAttribute("position",new eT.TlE(l,3)),u.setAttribute("uv",new eT.TlE(c,2)),this.screen=new eT.Kj0(u,this.convolutionMaterial),this.screen.frustumCulled=!1,this.scene.add(this.screen)}render(e,t,r){let i,n,a;let o=this.scene,s=this.camera,l=this.renderTargetA,c=this.renderTargetB,u=this.convolutionMaterial,h=u.uniforms;h.depthBuffer.value=t.depthTexture;let A=u.kernel,d=t;for(n=0,a=A.length-1;n<a;++n)i=(1&n)==0?l:c,h.kernel.value=A[n],h.inputBuffer.value=d.texture,e.setRenderTarget(i),e.render(o,s),d=i;h.kernel.value=A[n],h.inputBuffer.value=d.texture,e.setRenderTarget(this.renderToScreen?null:r),e.render(o,s)}}class f9 extends eT.Wid{constructor(e={}){super(e),this._tDepth={value:null},this._distortionMap={value:null},this._tDiffuse={value:null},this._tDiffuseBlur={value:null},this._textureMatrix={value:null},this._hasBlur={value:!1},this._mirror={value:0},this._mixBlur={value:0},this._blurStrength={value:.5},this._minDepthThreshold={value:.9},this._maxDepthThreshold={value:1},this._depthScale={value:0},this._depthToBlurRatioBias={value:.25},this._distortion={value:1},this._mixContrast={value:1},this.setValues(e)}onBeforeCompile(e){var t;null!=(t=e.defines)&&t.USE_UV||(e.defines.USE_UV=""),e.uniforms.hasBlur=this._hasBlur,e.uniforms.tDiffuse=this._tDiffuse,e.uniforms.tDepth=this._tDepth,e.uniforms.distortionMap=this._distortionMap,e.uniforms.tDiffuseBlur=this._tDiffuseBlur,e.uniforms.textureMatrix=this._textureMatrix,e.uniforms.mirror=this._mirror,e.uniforms.mixBlur=this._mixBlur,e.uniforms.mixStrength=this._blurStrength,e.uniforms.minDepthThreshold=this._minDepthThreshold,e.uniforms.maxDepthThreshold=this._maxDepthThreshold,e.uniforms.depthScale=this._depthScale,e.uniforms.depthToBlurRatioBias=this._depthToBlurRatioBias,e.uniforms.distortion=this._distortion,e.uniforms.mixContrast=this._mixContrast,e.vertexShader=`
1060        uniform mat4 textureMatrix;
1061        varying vec4 my_vUv;
1062      ${e.vertexShader}`,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",`#include <project_vertex>
1063        my_vUv = textureMatrix * vec4( position, 1.0 );
1064        gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );`),e.fragmentShader=`
1065        uniform sampler2D tDiffuse;
1066        uniform sampler2D tDiffuseBlur;
1067        uniform sampler2D tDepth;
1068        uniform sampler2D distortionMap;
1069        uniform float distortion;
1070        uniform float cameraNear;
1071			  uniform float cameraFar;
1072        uniform bool hasBlur;
1073        uniform float mixBlur;
1074        uniform float mirror;
1075        uniform float mixStrength;
1076        uniform float minDepthThreshold;
1077        uniform float maxDepthThreshold;
1078        uniform float mixContrast;
1079        uniform float depthScale;
1080        uniform float depthToBlurRatioBias;
1081        varying vec4 my_vUv;
1082        ${e.fragmentShader}`,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",`#include <emissivemap_fragment>
1083
1084      float distortionFactor = 0.0;
1085      #ifdef USE_DISTORTION
1086        distortionFactor = texture2D(distortionMap, vUv).r * distortion;
1087      #endif
1088
1089      vec4 new_vUv = my_vUv;
1090      new_vUv.x += distortionFactor;
1091      new_vUv.y += distortionFactor;
1092
1093      vec4 base = texture2DProj(tDiffuse, new_vUv);
1094      vec4 blur = texture2DProj(tDiffuseBlur, new_vUv);
1095
1096      vec4 merge = base;
1097
1098      #ifdef USE_NORMALMAP
1099        vec2 normal_uv = vec2(0.0);
1100        vec4 normalColor = texture2D(normalMap, vUv * normalScale);
1101        vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b,  normalColor.g * 2.0 - 1.0 ) );
1102        vec3 coord = new_vUv.xyz / new_vUv.w;
1103        normal_uv = coord.xy + coord.z * my_normal.xz * 0.05;
1104        vec4 base_normal = texture2D(tDiffuse, normal_uv);
1105        vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv);
1106        merge = base_normal;
1107        blur = blur_normal;
1108      #endif
1109
1110      float depthFactor = 0.0001;
1111      float blurFactor = 0.0;
1112
1113      #ifdef USE_DEPTH
1114        vec4 depth = texture2DProj(tDepth, new_vUv);
1115        depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));
1116        depthFactor *= depthScale;
1117        depthFactor = max(0.0001, min(1.0, depthFactor));
1118
1119        #ifdef USE_BLUR
1120          blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);
1121          merge = merge * min(1.0, depthFactor + 0.5);
1122        #else
1123          merge = merge * depthFactor;
1124        #endif
1125
1126      #endif
1127
1128      float reflectorRoughnessFactor = roughness;
1129      #ifdef USE_ROUGHNESSMAP
1130        vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv );
1131        reflectorRoughnessFactor *= reflectorTexelRoughness.g;
1132      #endif
1133
1134      #ifdef USE_BLUR
1135        blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor);
1136        merge = mix(merge, blur, blurFactor);
1137      #endif
1138
1139      vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0);
1140      newMerge.r = (merge.r - 0.5) * mixContrast + 0.5;
1141      newMerge.g = (merge.g - 0.5) * mixContrast + 0.5;
1142      newMerge.b = (merge.b - 0.5) * mixContrast + 0.5;
1143
1144      diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength);
1145      `)}get tDiffuse(){return this._tDiffuse.value}set tDiffuse(e){this._tDiffuse.value=e}get tDepth(){return this._tDepth.value}set tDepth(e){this._tDepth.value=e}get distortionMap(){return this._distortionMap.value}set distortionMap(e){this._distortionMap.value=e}get tDiffuseBlur(){return this._tDiffuseBlur.value}set tDiffuseBlur(e){this._tDiffuseBlur.value=e}get textureMatrix(){return this._textureMatrix.value}set textureMatrix(e){this._textureMatrix.value=e}get hasBlur(){return this._hasBlur.value}set hasBlur(e){this._hasBlur.value=e}get mirror(){return this._mirror.value}set mirror(e){this._mirror.value=e}get mixBlur(){return this._mixBlur.value}set mixBlur(e){this._mixBlur.value=e}get mixStrength(){return this._blurStrength.value}set mixStrength(e){this._blurStrength.value=e}get minDepthThreshold(){return this._minDepthThreshold.value}set minDepthThreshold(e){this._minDepthThreshold.value=e}get maxDepthThreshold(){return this._maxDepthThreshold.value}set maxDepthThreshold(e){this._maxDepthThreshold.value=e}get depthScale(){return this._depthScale.value}set depthScale(e){this._depthScale.value=e}get depthToBlurRatioBias(){return this._depthToBlurRatioBias.value}set depthToBlurRatioBias(e){this._depthToBlurRatioBias.value=e}get distortion(){return this._distortion.value}set distortion(e){this._distortion.value=e}get mixContrast(){return this._mixContrast.value}set mixContrast(e){this._mixContrast.value=e}}let f7=eD.forwardRef(({mixBlur:e=0,mixStrength:t=1,resolution:r=256,blur:i=[0,0],minDepthThreshold:n=.9,maxDepthThreshold:a=1,depthScale:o=0,depthToBlurRatioBias:s=.25,mirror:l=0,distortion:c=1,mixContrast:u=1,distortionMap:h,reflectorOffset:A=0,...d},m)=>{(0,eR.e)({MeshReflectorMaterialImpl:f9});let f=(0,eR.D)(({gl:e})=>e),p=(0,eR.D)(({camera:e})=>e),g=(0,eR.D)(({scene:e})=>e),y=(i=Array.isArray(i)?i:[i,i])[0]+i[1]>0,v=eD.useRef(null);eD.useImperativeHandle(m,()=>v.current,[]);let[E]=eD.useState(()=>new eT.JOQ),[x]=eD.useState(()=>new eT.Pa4),[C]=eD.useState(()=>new eT.Pa4),[w]=eD.useState(()=>new eT.Pa4),[B]=eD.useState(()=>new eT.yGw),[I]=eD.useState(()=>new eT.Pa4(0,0,-1)),[_]=eD.useState(()=>new eT.Ltg),[b]=eD.useState(()=>new eT.Pa4),[M]=eD.useState(()=>new eT.Pa4),[S]=eD.useState(()=>new eT.Ltg),[D]=eD.useState(()=>new eT.yGw),[P]=eD.useState(()=>new eT.cPb),T=eD.useCallback(()=>{var e;let t=v.current.parent||(null==(e=v.current)?void 0:e.__r3f.parent);if(!t||(C.setFromMatrixPosition(t.matrixWorld),w.setFromMatrixPosition(p.matrixWorld),B.extractRotation(t.matrixWorld),x.set(0,0,1),x.applyMatrix4(B),C.addScaledVector(x,A),b.subVectors(C,w),b.dot(x)>0))return;b.reflect(x).negate(),b.add(C),B.extractRotation(p.matrixWorld),I.set(0,0,-1),I.applyMatrix4(B),I.add(w),M.subVectors(C,I),M.reflect(x).negate(),M.add(C),P.position.copy(b),P.up.set(0,1,0),P.up.applyMatrix4(B),P.up.reflect(x),P.lookAt(M),P.far=p.far,P.updateMatrixWorld(),P.projectionMatrix.copy(p.projectionMatrix),D.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),D.multiply(P.projectionMatrix),D.multiply(P.matrixWorldInverse),D.multiply(t.matrixWorld),E.setFromNormalAndCoplanarPoint(x,C),E.applyMatrix4(P.matrixWorldInverse),_.set(E.normal.x,E.normal.y,E.normal.z,E.constant);let r=P.projectionMatrix;S.x=(Math.sign(_.x)+r.elements[8])/r.elements[0],S.y=(Math.sign(_.y)+r.elements[9])/r.elements[5],S.z=-1,S.w=(1+r.elements[10])/r.elements[14],_.multiplyScalar(2/_.dot(S)),r.elements[2]=_.x,r.elements[6]=_.y,r.elements[10]=_.z+1,r.elements[14]=_.w},[p,A]),[R,F,Q,z]=eD.useMemo(()=>{let A={minFilter:eT.wem,magFilter:eT.wem,type:eT.cLu},d=new eT.dd2(r,r,A);d.depthBuffer=!0,d.depthTexture=new eT.$YQ(r,r),d.depthTexture.format=eT.qkB,d.depthTexture.type=eT.LsT;let m=new eT.dd2(r,r,A),p=new f8({gl:f,resolution:r,width:i[0],height:i[1],minDepthThreshold:n,maxDepthThreshold:a,depthScale:o,depthToBlurRatioBias:s}),g={mirror:l,textureMatrix:D,mixBlur:e,tDiffuse:d.texture,tDepth:d.depthTexture,tDiffuseBlur:m.texture,hasBlur:y,mixStrength:t,minDepthThreshold:n,maxDepthThreshold:a,depthScale:o,depthToBlurRatioBias:s,distortion:c,distortionMap:h,mixContrast:u,"defines-USE_BLUR":y?"":void 0,"defines-USE_DEPTH":o>0?"":void 0,"defines-USE_DISTORTION":h?"":void 0};return[d,m,p,g]},[f,i,D,r,l,y,e,t,n,a,o,s,c,h,u]);return(0,eR.F)(()=>{var e;let t=v.current.parent||(null==(e=v.current)?void 0:e.__r3f.parent);if(!t)return;t.visible=!1;let r=f.xr.enabled,i=f.shadowMap.autoUpdate;T(),f.xr.enabled=!1,f.shadowMap.autoUpdate=!1,f.setRenderTarget(R),f.state.buffers.depth.setMask(!0),f.autoClear||f.clear(),f.render(g,P),y&&Q.render(f,R,F),f.xr.enabled=r,f.shadowMap.autoUpdate=i,t.visible=!0,f.setRenderTarget(null)}),eD.createElement("meshReflectorMaterialImpl",(0,eS.Z)({attach:"material",key:"key"+z["defines-USE_BLUR"]+z["defines-USE_DEPTH"]+z["defines-USE_DISTORTION"],ref:v},z,d))});function pe(e){switch(e){case 1:return eT.D9w;case 2:return eT.CtA;
1145case 3:case 4:return eT.E2K}}class pt extends eT.IEO{constructor(){super(),this.minFilter=eT.TyD,this.magFilter=eT.TyD,this.generateMipmaps=!1,this.overrideItemSize=null,this._forcedType=null}updateFrom(e){let t,r,i,n;let a=this.overrideItemSize,o=e.itemSize,s=e.count;if(null!==a){if(o*s%a!=0)throw Error("VertexAttributeTexture: overrideItemSize must divide evenly into buffer length.");e.itemSize=a,e.count=s*o/a}let l=e.itemSize,c=e.count,u=e.normalized,h=e.array.constructor,A=h.BYTES_PER_ELEMENT,d=this._forcedType,m=l;if(null===d)switch(h){case Float32Array:d=eT.VzW;break;case Uint8Array:case Uint16Array:case Uint32Array:d=eT.JQ4;break;case Int8Array:case Int16Array:case Int32Array:d=eT.Kz5}let f=function(e){switch(e){case 1:return"R";case 2:return"RG";case 3:case 4:return"RGBA"}throw Error()}(l);switch(d){case eT.VzW:i=1,r=function(e){switch(e){case 1:return eT.hEm;case 2:return eT.av9;case 3:case 4:return eT.wk1}}(l),u&&1===A?(n=h,f+="8",h===Uint8Array?t=eT.ywz:(t=eT.T95,f+="_SNORM")):(n=Float32Array,f+="32F",t=eT.VzW);break;case eT.Kz5:f+=8*A+"I",i=u?Math.pow(2,8*h.BYTES_PER_ELEMENT-1):1,r=pe(l),1===A?(n=Int8Array,t=eT.T95):2===A?(n=Int16Array,t=eT.iAb):(n=Int32Array,t=eT.Kz5);break;case eT.JQ4:f+=8*A+"UI",i=u?Math.pow(2,8*h.BYTES_PER_ELEMENT-1):1,r=pe(l),1===A?(n=Uint8Array,t=eT.ywz):2===A?(n=Uint16Array,t=eT.LsT):(n=Uint32Array,t=eT.JQ4)}3===m&&(r===eT.wk1||r===eT.E2K)&&(m=4);let p=Math.ceil(Math.sqrt(c))||1,g=new n(m*p*p),y=e.normalized;e.normalized=!1;for(let t=0;t<c;t++){let r=m*t;g[r]=e.getX(t)/i,l>=2&&(g[r+1]=e.getY(t)/i),l>=3&&(g[r+2]=e.getZ(t)/i,4===m&&(g[r+3]=1)),l>=4&&(g[r+3]=e.getW(t)/i)}e.normalized=y,this.internalFormat=f,this.format=r,this.type=t,this.image.width=p,this.image.height=p,this.image.data=g,this.needsUpdate=!0,this.dispose(),e.itemSize=o,e.count=s}}class pr extends pt{constructor(){super(),this._forcedType=eT.JQ4}}class pi extends pt{constructor(){super(),this._forcedType=eT.VzW}}class pn{constructor(){this.index=new pr,this.position=new pi,this.bvhBounds=new eT.IEO,this.bvhContents=new eT.IEO,this._cachedIndexAttr=null,this.index.overrideItemSize=3}updateFrom(e){let{geometry:t}=e;if(function(e,t,r){let i=e._roots;if(1!==i.length)throw Error("MeshBVHUniformStruct: Multi-root BVHs not supported.");let n=i[0],a=new Uint16Array(n),o=new Uint32Array(n),s=new Float32Array(n),l=n.byteLength/32,c=2*Math.ceil(Math.sqrt(l/2)),u=new Float32Array(4*c*c),h=Math.ceil(Math.sqrt(l)),A=new Uint32Array(2*h*h);for(let e=0;e<l;e++){let t=32*e/4,r=2*t;for(let r=0;r<3;r++)u[8*e+0+r]=s[t+0+r],u[8*e+4+r]=s[t+3+r];if(dz(r,a)){let i=dk(r,a),n=o[t+6],s=4294901760|i;A[2*e+0]=s,A[2*e+1]=n}else{let r=4*o[t+6]/32,i=o[t+7];A[2*e+0]=i,A[2*e+1]=r}}t.image.data=u,t.image.width=c,t.image.height=c,t.format=eT.wk1,t.type=eT.VzW,t.internalFormat="RGBA32F",t.minFilter=eT.TyD,t.magFilter=eT.TyD,t.generateMipmaps=!1,t.needsUpdate=!0,t.dispose(),r.image.data=A,r.image.width=h,r.image.height=h,r.format=eT.CtA,r.type=eT.JQ4,r.internalFormat="RG32UI",r.minFilter=eT.TyD,r.magFilter=eT.TyD,r.generateMipmaps=!1,r.needsUpdate=!0,r.dispose()}(e,this.bvhBounds,this.bvhContents),this.position.updateFrom(t.attributes.position),e.indirect){let r=e._indirectBuffer;if(null===this._cachedIndexAttr||this._cachedIndexAttr.count!==r.length){if(t.index)this._cachedIndexAttr=t.index.clone();else{let e=dx(dv(t));this._cachedIndexAttr=new eT.TlE(e,1,!1)}}(function(e,t,r){let i=r.array,n=e.index?e.index.array:null;for(let e=0,r=t.length;e<r;e++){let r=3*e,a=3*t[e];for(let e=0;e<3;e++)i[r+e]=n?n[a+e]:a+e}})(t,r,this._cachedIndexAttr),this.index.updateFrom(this._cachedIndexAttr)}else this.index.updateFrom(t.index)}dispose(){let{index:e,position:t,bvhBounds:r,bvhContents:i}=this;e&&e.dispose(),t&&t.dispose(),r&&r.dispose(),i&&i.dispose()}}let pa=`
1146struct BVH {
1147
1148	usampler2D index;
1149	sampler2D position;
1150
1151	sampler2D bvhBounds;
1152	usampler2D bvhContents;
1153
1154};
1155`,po=`
1156
1157// A stack of uint32 indices can can store the indices for
1158// a perfectly balanced tree with a depth up to 31. Lower stack
1159// depth gets higher performance.
1160//
1161// However not all trees are balanced. Best value to set this to
1162// is the trees max depth.
1163#ifndef BVH_STACK_DEPTH
1164#define BVH_STACK_DEPTH 60
1165#endif
1166
1167#ifndef INFINITY
1168#define INFINITY 1e20
1169#endif
1170
1171// Utilities
1172uvec4 uTexelFetch1D( usampler2D tex, uint index ) {
1173
1174	uint width = uint( textureSize( tex, 0 ).x );
1175	uvec2 uv;
1176	uv.x = index % width;
1177	uv.y = index / width;
1178
1179	return texelFetch( tex, ivec2( uv ), 0 );
1180
1181}
1182
1183ivec4 iTexelFetch1D( isampler2D tex, uint index ) {
1184
1185	uint width = uint( textureSize( tex, 0 ).x );
1186	uvec2 uv;
1187	uv.x = index % width;
1188	uv.y = index / width;
1189
1190	return texelFetch( tex, ivec2( uv ), 0 );
1191
1192}
1193
1194vec4 texelFetch1D( sampler2D tex, uint index ) {
1195
1196	uint width = uint( textureSize( tex, 0 ).x );
1197	uvec2 uv;
1198	uv.x = index % width;
1199	uv.y = index / width;
1200
1201	return texelFetch( tex, ivec2( uv ), 0 );
1202
1203}
1204
1205vec4 textureSampleBarycoord( sampler2D tex, vec3 barycoord, uvec3 faceIndices ) {
1206
1207	return
1208		barycoord.x * texelFetch1D( tex, faceIndices.x ) +
1209		barycoord.y * texelFetch1D( tex, faceIndices.y ) +
1210		barycoord.z * texelFetch1D( tex, faceIndices.z );
1211
1212}
1213
1214void ndcToCameraRay(
1215	vec2 coord, mat4 cameraWorld, mat4 invProjectionMatrix,
1216	out vec3 rayOrigin, out vec3 rayDirection
1217) {
1218
1219	// get camera look direction and near plane for camera clipping
1220	vec4 lookDirection = cameraWorld * vec4( 0.0, 0.0, - 1.0, 0.0 );
1221	vec4 nearVector = invProjectionMatrix * vec4( 0.0, 0.0, - 1.0, 1.0 );
1222	float near = abs( nearVector.z / nearVector.w );
1223
1224	// get the camera direction and position from camera matrices
1225	vec4 origin = cameraWorld * vec4( 0.0, 0.0, 0.0, 1.0 );
1226	vec4 direction = invProjectionMatrix * vec4( coord, 0.5, 1.0 );
1227	direction /= direction.w;
1228	direction = cameraWorld * direction - origin;
1229
1230	// slide the origin along the ray until it sits at the near clip plane position
1231	origin.xyz += direction.xyz * near / dot( direction, lookDirection );
1232
1233	rayOrigin = origin.xyz;
1234	rayDirection = direction.xyz;
1235
1236}
1237`,ps=`
1238
1239#ifndef TRI_INTERSECT_EPSILON
1240#define TRI_INTERSECT_EPSILON 1e-5
1241#endif
1242
1243// Raycasting
1244bool intersectsBounds( vec3 rayOrigin, vec3 rayDirection, vec3 boundsMin, vec3 boundsMax, out float dist ) {
1245
1246	// https://www.reddit.com/r/opengl/comments/8ntzz5/fast_glsl_ray_box_intersection/
1247	// https://tavianator.com/2011/ray_box.html
1248	vec3 invDir = 1.0 / rayDirection;
1249
1250	// find intersection distances for each plane
1251	vec3 tMinPlane = invDir * ( boundsMin - rayOrigin );
1252	vec3 tMaxPlane = invDir * ( boundsMax - rayOrigin );
1253
1254	// get the min and max distances from each intersection
1255	vec3 tMinHit = min( tMaxPlane, tMinPlane );
1256	vec3 tMaxHit = max( tMaxPlane, tMinPlane );
1257
1258	// get the furthest hit distance
1259	vec2 t = max( tMinHit.xx, tMinHit.yz );
1260	float t0 = max( t.x, t.y );
1261
1262	// get the minimum hit distance
1263	t = min( tMaxHit.xx, tMaxHit.yz );
1264	float t1 = min( t.x, t.y );
1265
1266	// set distance to 0.0 if the ray starts inside the box
1267	dist = max( t0, 0.0 );
1268
1269	return t1 >= dist;
1270
1271}
1272
1273bool intersectsTriangle(
1274	vec3 rayOrigin, vec3 rayDirection, vec3 a, vec3 b, vec3 c,
1275	out vec3 barycoord, out vec3 norm, out float dist, out float side
1276) {
1277
1278	// https://stackoverflow.com/questions/42740765/intersection-between-line-and-triangle-in-3d
1279	vec3 edge1 = b - a;
1280	vec3 edge2 = c - a;
1281	norm = cross( edge1, edge2 );
1282
1283	float det = - dot( rayDirection, norm );
1284	float invdet = 1.0 / det;
1285
1286	vec3 AO = rayOrigin - a;
1287	vec3 DAO = cross( AO, rayDirection );
1288
1289	vec4 uvt;
1290	uvt.x = dot( edge2, DAO ) * invdet;
1291	uvt.y = - dot( edge1, DAO ) * invdet;
1292	uvt.z = dot( AO, norm ) * invdet;
1293	uvt.w = 1.0 - uvt.x - uvt.y;
1294
1295	// set the hit information
1296	barycoord = uvt.wxy; // arranged in A, B, C order
1297	dist = uvt.z;
1298	side = sign( det );
1299	norm = side * normalize( norm );
1300
1301	// add an epsilon to avoid misses between triangles
1302	uvt += vec4( TRI_INTERSECT_EPSILON );
1303
1304	return all( greaterThanEqual( uvt, vec4( 0.0 ) ) );
1305
1306}
1307
1308bool intersectTriangles(
1309	// geometry info and triangle range
1310	sampler2D positionAttr, usampler2D indexAttr, uint offset, uint count,
1311
1312	// ray
1313	vec3 rayOrigin, vec3 rayDirection,
1314
1315	// outputs
1316	inout float minDistance, inout uvec4 faceIndices, inout vec3 faceNormal, inout vec3 barycoord,
1317	inout float side, inout float dist
1318) {
1319
1320	bool found = false;
1321	vec3 localBarycoord, localNormal;
1322	float localDist, localSide;
1323	for ( uint i = offset, l = offset + count; i < l; i ++ ) {
1324
1325		uvec3 indices = uTexelFetch1D( indexAttr, i ).xyz;
1326		vec3 a = texelFetch1D( positionAttr, indices.x ).rgb;
1327		vec3 b = texelFetch1D( positionAttr, indices.y ).rgb;
1328		vec3 c = texelFetch1D( positionAttr, indices.z ).rgb;
1329
1330		if (
1331			intersectsTriangle( rayOrigin, rayDirection, a, b, c, localBarycoord, localNormal, localDist, localSide )
1332			&& localDist < minDistance
1333		) {
1334
1335			found = true;
1336			minDistance = localDist;
1337
1338			faceIndices = uvec4( indices.xyz, i );
1339			faceNormal = localNormal;
1340
1341			side = localSide;
1342			barycoord = localBarycoord;
1343			dist = localDist;
1344
1345		}
1346
1347	}
1348
1349	return found;
1350
1351}
1352
1353bool intersectsBVHNodeBounds( vec3 rayOrigin, vec3 rayDirection, sampler2D bvhBounds, uint currNodeIndex, out float dist ) {
1354
1355	uint cni2 = currNodeIndex * 2u;
1356	vec3 boundsMin = texelFetch1D( bvhBounds, cni2 ).xyz;
1357	vec3 boundsMax = texelFetch1D( bvhBounds, cni2 + 1u ).xyz;
1358	return intersectsBounds( rayOrigin, rayDirection, boundsMin, boundsMax, dist );
1359
1360}
1361
1362// use a macro to hide the fact that we need to expand the struct into separate fields
1363#define\
1364	bvhIntersectFirstHit(\
1365		bvh,\
1366		rayOrigin, rayDirection, faceIndices, faceNormal, barycoord, side, dist\
1367	)\
1368	_bvhIntersectFirstHit(\
1369		bvh.position, bvh.index, bvh.bvhBounds, bvh.bvhContents,\
1370		rayOrigin, rayDirection, faceIndices, faceNormal, barycoord, side, dist\
1371	)
1372
1373bool _bvhIntersectFirstHit(
1374	// bvh info
1375	sampler2D bvh_position, usampler2D bvh_index, sampler2D bvh_bvhBounds, usampler2D bvh_bvhContents,
1376
1377	// ray
1378	vec3 rayOrigin, vec3 rayDirection,
1379
1380	// output variables split into separate variables due to output precision
1381	inout uvec4 faceIndices, inout vec3 faceNormal, inout vec3 barycoord,
1382	inout float side, inout float dist
1383) {
1384
1385	// stack needs to be twice as long as the deepest tree we expect because
1386	// we push both the left and right child onto the stack every traversal
1387	int ptr = 0;
1388	uint stack[ BVH_STACK_DEPTH ];
1389	stack[ 0 ] = 0u;
1390
1391	float triangleDistance = INFINITY;
1392	bool found = false;
1393	while ( ptr > - 1 && ptr < BVH_STACK_DEPTH ) {
1394
1395		uint currNodeIndex = stack[ ptr ];
1396		ptr --;
1397
1398		// check if we intersect the current bounds
1399		float boundsHitDistance;
1400		if (
1401			! intersectsBVHNodeBounds( rayOrigin, rayDirection, bvh_bvhBounds, currNodeIndex, boundsHitDistance )
1402			|| boundsHitDistance > triangleDistance
1403		) {
1404
1405			continue;
1406
1407		}
1408
1409		uvec2 boundsInfo = uTexelFetch1D( bvh_bvhContents, currNodeIndex ).xy;
1410		bool isLeaf = bool( boundsInfo.x & 0xffff0000u );
1411
1412		if ( isLeaf ) {
1413
1414			uint count = boundsInfo.x & 0x0000ffffu;
1415			uint offset = boundsInfo.y;
1416
1417			found = intersectTriangles(
1418				bvh_position, bvh_index, offset, count,
1419				rayOrigin, rayDirection, triangleDistance,
1420				faceIndices, faceNormal, barycoord, side, dist
1421			) || found;
1422
1423		} else {
1424
1425			uint leftIndex = currNodeIndex + 1u;
1426			uint splitAxis = boundsInfo.x & 0x0000ffffu;
1427			uint rightIndex = boundsInfo.y;
1428
1429			bool leftToRight = rayDirection[ splitAxis ] >= 0.0;
1430			uint c1 = leftToRight ? leftIndex : rightIndex;
1431			uint c2 = leftToRight ? rightIndex : leftIndex;
1432
1433			// set c2 in the stack so we traverse it later. We need to keep track of a pointer in
1434			// the stack while we traverse. The second pointer added is the one that will be
1435			// traversed first
1436			ptr ++;
1437			stack[ ptr ] = c2;
1438
1439			ptr ++;
1440			stack[ ptr ] = c1;
1441
1442		}
1443
1444	}
1445
1446	return found;
1447
1448}
1449`,pl=`
1450	${po}
1451	${ps}
1452`,pc=sw({envMap:null,bounces:3,ior:2.4,correctMips:!0,aberrationStrength:.01,fresnel:0,bvh:new pn,color:new eT.Ilk("white"),opacity:1,resolution:new eT.FM8,viewMatrixInverse:new eT.yGw,projectionMatrixInverse:new eT.yGw},`
1453  uniform mat4 viewMatrixInverse;
1454
1455  varying vec3 vWorldPosition;
1456  varying vec3 vNormal;
1457  varying mat4 vModelMatrixInverse;
1458
1459  #include <color_pars_vertex>
1460
1461  void main() {
1462    #include <color_vertex>
1463
1464    vec4 transformedNormal = vec4(normal, 0.0);
1465    vec4 transformedPosition = vec4(position, 1.0);
1466    #ifdef USE_INSTANCING
1467      transformedNormal = instanceMatrix * transformedNormal;
1468      transformedPosition = instanceMatrix * transformedPosition;
1469    #endif
1470
1471    #ifdef USE_INSTANCING
1472      vModelMatrixInverse = inverse(modelMatrix * instanceMatrix);
1473    #else
1474      vModelMatrixInverse = inverse(modelMatrix);
1475    #endif
1476
1477    vWorldPosition = (modelMatrix * transformedPosition).xyz;
1478    vNormal = normalize((viewMatrixInverse * vec4(normalMatrix * transformedNormal.xyz, 0.0)).xyz);
1479    gl_Position = projectionMatrix * viewMatrix * modelMatrix * transformedPosition;
1480  }`,`
1481  #define ENVMAP_TYPE_CUBE_UV
1482  precision highp isampler2D;
1483  precision highp usampler2D;
1484  varying vec3 vWorldPosition;
1485  varying vec3 vNormal;
1486  varying mat4 vModelMatrixInverse;
1487
1488  #include <color_pars_fragment>
1489
1490  #ifdef ENVMAP_TYPE_CUBEM
1491    uniform samplerCube envMap;
1492  #else
1493    uniform sampler2D envMap;
1494  #endif
1495
1496  uniform float bounces;
1497  ${pa}
1498  ${pl}
1499  uniform BVH bvh;
1500  uniform float ior;
1501  uniform bool correctMips;
1502  uniform vec2 resolution;
1503  uniform float fresnel;
1504  uniform mat4 modelMatrix;
1505  uniform mat4 projectionMatrixInverse;
1506  uniform mat4 viewMatrixInverse;
1507  uniform float aberrationStrength;
1508  uniform vec3 color;
1509  uniform float opacity;
1510
1511  float fresnelFunc(vec3 viewDirection, vec3 worldNormal) {
1512    return pow( 1.0 + dot( viewDirection, worldNormal), 10.0 );
1513  }
1514
1515  vec3 totalInternalReflection(vec3 ro, vec3 rd, vec3 normal, float ior, mat4 modelMatrixInverse) {
1516    vec3 rayOrigin = ro;
1517    vec3 rayDirection = rd;
1518    rayDirection = refract(rayDirection, normal, 1.0 / ior);
1519    rayOrigin = vWorldPosition + rayDirection * 0.001;
1520    rayOrigin = (modelMatrixInverse * vec4(rayOrigin, 1.0)).xyz;
1521    rayDirection = normalize((modelMatrixInverse * vec4(rayDirection, 0.0)).xyz);
1522    for(float i = 0.0; i < bounces; i++) {
1523      uvec4 faceIndices = uvec4( 0u );
1524      vec3 faceNormal = vec3( 0.0, 0.0, 1.0 );
1525      vec3 barycoord = vec3( 0.0 );
1526      float side = 1.0;
1527      float dist = 0.0;
1528      bvhIntersectFirstHit( bvh, rayOrigin, rayDirection, faceIndices, faceNormal, barycoord, side, dist );
1529      vec3 hitPos = rayOrigin + rayDirection * max(dist - 0.001, 0.0);
1530      vec3 tempDir = refract(rayDirection, faceNormal, ior);
1531      if (length(tempDir) != 0.0) {
1532        rayDirection = tempDir;
1533        break;
1534      }
1535      rayDirection = reflect(rayDirection, faceNormal);
1536      rayOrigin = hitPos + rayDirection * 0.01;
1537    }
1538    rayDirection = normalize((modelMatrix * vec4(rayDirection, 0.0)).xyz);
1539    return rayDirection;
1540  }
1541
1542  #include <common>
1543  #include <cube_uv_reflection_fragment>
1544
1545  #ifdef ENVMAP_TYPE_CUBEM
1546    vec4 textureGradient(samplerCube envMap, vec3 rayDirection, vec3 directionCamPerfect) {
1547      return textureGrad(envMap, rayDirection, dFdx(correctMips ? directionCamPerfect: rayDirection), dFdy(correctMips ? directionCamPerfect: rayDirection));
1548    }
1549  #else
1550    vec4 textureGradient(sampler2D envMap, vec3 rayDirection, vec3 directionCamPerfect) {
1551      vec2 uvv = equirectUv( rayDirection );
1552      vec2 smoothUv = equirectUv( directionCamPerfect );
1553      return textureGrad(envMap, uvv, dFdx(correctMips ? smoothUv : uvv), dFdy(correctMips ? smoothUv : uvv));
1554    }
1555  #endif
1556
1557  void main() {
1558    vec2 uv = gl_FragCoord.xy / resolution;
1559    vec3 directionCamPerfect = (projectionMatrixInverse * vec4(uv * 2.0 - 1.0, 0.0, 1.0)).xyz;
1560    directionCamPerfect = (viewMatrixInverse * vec4(directionCamPerfect, 0.0)).xyz;
1561    directionCamPerfect = normalize(directionCamPerfect);
1562    vec3 normal = vNormal;
1563    vec3 rayOrigin = cameraPosition;
1564    vec3 rayDirection = normalize(vWorldPosition - cameraPosition);
1565
1566    vec4 diffuseColor = vec4(color, opacity);
1567    #include <color_fragment>
1568
1569    #ifdef CHROMATIC_ABERRATIONS
1570      vec3 rayDirectionG = totalInternalReflection(rayOrigin, rayDirection, normal, max(ior, 1.0), vModelMatrixInverse);
1571      #ifdef FAST_CHROMA
1572        vec3 rayDirectionR = normalize(rayDirectionG + 1.0 * vec3(aberrationStrength / 2.0));
1573        vec3 rayDirectionB = normalize(rayDirectionG - 1.0 * vec3(aberrationStrength / 2.0));
1574      #else
1575        vec3 rayDirectionR = totalInternalReflection(rayOrigin, rayDirection, normal, max(ior * (1.0 - aberrationStrength), 1.0), vModelMatrixInverse);
1576        vec3 rayDirectionB = totalInternalReflection(rayOrigin, rayDirection, normal, max(ior * (1.0 + aberrationStrength), 1.0), vModelMatrixInverse);
1577      #endif
1578      float finalColorR = textureGradient(envMap, rayDirectionR, directionCamPerfect).r;
1579      float finalColorG = textureGradient(envMap, rayDirectionG, directionCamPerfect).g;
1580      float finalColorB = textureGradient(envMap, rayDirectionB, directionCamPerfect).b;
1581      diffuseColor.rgb *= vec3(finalColorR, finalColorG, finalColorB);
1582    #else
1583      rayDirection = totalInternalReflection(rayOrigin, rayDirection, normal, max(ior, 1.0), vModelMatrixInverse);
1584      diffuseColor.rgb *= textureGradient(envMap, rayDirection, directionCamPerfect).rgb;
1585    #endif
1586
1587    vec3 viewDirection = normalize(vWorldPosition - cameraPosition);
1588    float nFresnel = fresnelFunc(viewDirection, normal) * fresnel;
1589    gl_FragColor = vec4(mix(diffuseColor.rgb, vec3(1.0), nFresnel), diffuseColor.a);
1590
1591    #include <tonemapping_fragment>
1592    #include <${sI.i>=154?"colorspace_fragment":"encodings_fragment"}>
1593  }`),pu=e=>e&&e.isCubeTexture;function ph({aberrationStrength:e=0,fastChroma:t=!0,envMap:r,...i}){(0,eR.e)({MeshRefractionMaterial:pc});let n=(0,eD.useRef)(),{size:a}=(0,eR.D)(),o=(0,eD.useMemo)(()=>{var i,n;let a={},o=pu(r),s=Math.floor(Math.log2((null!==(i=o?null==(n=r.image[0])?void 0:n.width:r.image.width)&&void 0!==i?i:1024)/4)),l=Math.pow(2,s);return o&&(a.ENVMAP_TYPE_CUBEM=""),a.CUBEUV_TEXEL_WIDTH=`${1/(3*Math.max(l,112))}`,a.CUBEUV_TEXEL_HEIGHT=`${1/(4*l)}`,a.CUBEUV_MAX_MIP=`${s}.0`,e>0&&(a.CHROMATIC_ABERRATIONS=""),t&&(a.FAST_CHROMA=""),a},[e,t]);return(0,eD.useLayoutEffect)(()=>{var e;let t=null==(e=n.current)||null==(e=e.__r3f)||null==(e=e.parent)?void 0:e.geometry;t&&(n.current.bvh=new pn,n.current.bvh.updateFrom(new mq(t.clone().toNonIndexed(),{strategy:dp})))},[]),(0,eR.F)(({camera:e})=>{n.current.viewMatrixInverse=e.matrixWorld,n.current.projectionMatrixInverse=e.projectionMatrixInverse}),eD.createElement("meshRefractionMaterial",(0,eS.Z)({key:JSON.stringify(o),defines:o,ref:n,resolution:[a.width,a.height],aberrationStrength:e,envMap:r},i))}let pA=sw({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard;  }");class pd extends eT.EJi{constructor(e=6,t=!1){super(),this.uniforms={chromaticAberration:{value:.05},transmission:{value:0},_transmission:{value:1},transmissionMap:{value:null},roughness:{value:0},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:1/0},attenuationColor:{value:new eT.Ilk("white")},anisotropicBlur:{value:.1},time:{value:0},distortion:{value:0},distortionScale:{value:.5},temporalDistortion:{value:0},buffer:{value:null}},this.onBeforeCompile=r=>{r.uniforms={...r.uniforms,...this.uniforms},this.anisotropy>
15930&&(r.defines.USE_ANISOTROPY=""),t?r.defines.USE_SAMPLER="":r.defines.USE_TRANSMISSION="",r.fragmentShader=`
1594      uniform float chromaticAberration;         
1595      uniform float anisotropicBlur;      
1596      uniform float time;
1597      uniform float distortion;
1598      uniform float distortionScale;
1599      uniform float temporalDistortion;
1600      uniform sampler2D buffer;
1601
1602      vec3 random3(vec3 c) {
1603        float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0)));
1604        vec3 r;
1605        r.z = fract(512.0*j);
1606        j *= .125;
1607        r.x = fract(512.0*j);
1608        j *= .125;
1609        r.y = fract(512.0*j);
1610        return r-0.5;
1611      }
1612
1613      uint hash( uint x ) {
1614        x += ( x << 10u );
1615        x ^= ( x >>  6u );
1616        x += ( x <<  3u );
1617        x ^= ( x >> 11u );
1618        x += ( x << 15u );
1619        return x;
1620      }
1621
1622      // Compound versions of the hashing algorithm I whipped together.
1623      uint hash( uvec2 v ) { return hash( v.x ^ hash(v.y)                         ); }
1624      uint hash( uvec3 v ) { return hash( v.x ^ hash(v.y) ^ hash(v.z)             ); }
1625      uint hash( uvec4 v ) { return hash( v.x ^ hash(v.y) ^ hash(v.z) ^ hash(v.w) ); }
1626
1627      // Construct a float with half-open range [0:1] using low 23 bits.
1628      // All zeroes yields 0.0, all ones yields the next smallest representable value below 1.0.
1629      float floatConstruct( uint m ) {
1630        const uint ieeeMantissa = 0x007FFFFFu; // binary32 mantissa bitmask
1631        const uint ieeeOne      = 0x3F800000u; // 1.0 in IEEE binary32
1632        m &= ieeeMantissa;                     // Keep only mantissa bits (fractional part)
1633        m |= ieeeOne;                          // Add fractional part to 1.0
1634        float  f = uintBitsToFloat( m );       // Range [1:2]
1635        return f - 1.0;                        // Range [0:1]
1636      }
1637
1638      // Pseudo-random value in half-open range [0:1].
1639      float randomBase( float x ) { return floatConstruct(hash(floatBitsToUint(x))); }
1640      float randomBase( vec2  v ) { return floatConstruct(hash(floatBitsToUint(v))); }
1641      float randomBase( vec3  v ) { return floatConstruct(hash(floatBitsToUint(v))); }
1642      float randomBase( vec4  v ) { return floatConstruct(hash(floatBitsToUint(v))); }
1643      float rand(float seed) {
1644        float result = randomBase(vec3(gl_FragCoord.xy, seed));
1645        return result;
1646      }
1647
1648      const float F3 =  0.3333333;
1649      const float G3 =  0.1666667;
1650
1651      float snoise(vec3 p) {
1652        vec3 s = floor(p + dot(p, vec3(F3)));
1653        vec3 x = p - s + dot(s, vec3(G3));
1654        vec3 e = step(vec3(0.0), x - x.yzx);
1655        vec3 i1 = e*(1.0 - e.zxy);
1656        vec3 i2 = 1.0 - e.zxy*(1.0 - e);
1657        vec3 x1 = x - i1 + G3;
1658        vec3 x2 = x - i2 + 2.0*G3;
1659        vec3 x3 = x - 1.0 + 3.0*G3;
1660        vec4 w, d;
1661        w.x = dot(x, x);
1662        w.y = dot(x1, x1);
1663        w.z = dot(x2, x2);
1664        w.w = dot(x3, x3);
1665        w = max(0.6 - w, 0.0);
1666        d.x = dot(random3(s), x);
1667        d.y = dot(random3(s + i1), x1);
1668        d.z = dot(random3(s + i2), x2);
1669        d.w = dot(random3(s + 1.0), x3);
1670        w *= w;
1671        w *= w;
1672        d *= w;
1673        return dot(d, vec4(52.0));
1674      }
1675
1676      float snoiseFractal(vec3 m) {
1677        return 0.5333333* snoise(m)
1678              +0.2666667* snoise(2.0*m)
1679              +0.1333333* snoise(4.0*m)
1680              +0.0666667* snoise(8.0*m);
1681      }
1682`+r.fragmentShader,r.fragmentShader=r.fragmentShader.replace("#include <transmission_pars_fragment>",`
1683        #ifdef USE_TRANSMISSION
1684          // Transmission code is based on glTF-Sampler-Viewer
1685          // https://github.com/KhronosGroup/glTF-Sample-Viewer
1686          uniform float _transmission;
1687          uniform float thickness;
1688          uniform float attenuationDistance;
1689          uniform vec3 attenuationColor;
1690          #ifdef USE_TRANSMISSIONMAP
1691            uniform sampler2D transmissionMap;
1692          #endif
1693          #ifdef USE_THICKNESSMAP
1694            uniform sampler2D thicknessMap;
1695          #endif
1696          uniform vec2 transmissionSamplerSize;
1697          uniform sampler2D transmissionSamplerMap;
1698          uniform mat4 modelMatrix;
1699          uniform mat4 projectionMatrix;
1700          varying vec3 vWorldPosition;
1701          vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
1702            // Direction of refracted light.
1703            vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
1704            // Compute rotation-independant scaling of the model matrix.
1705            vec3 modelScale;
1706            modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
1707            modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
1708            modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
1709            // The thickness is specified in local space.
1710            return normalize( refractionVector ) * thickness * modelScale;
1711          }
1712          float applyIorToRoughness( const in float roughness, const in float ior ) {
1713            // Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and
1714            // an IOR of 1.5 results in the default amount of microfacet refraction.
1715            return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
1716          }
1717          vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
1718            float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );            
1719            #ifdef USE_SAMPLER
1720              #ifdef texture2DLodEXT
1721                return texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod);
1722              #else
1723                return texture2D(transmissionSamplerMap, fragCoord.xy, framebufferLod);
1724              #endif
1725            #else
1726              return texture2D(buffer, fragCoord.xy);
1727            #endif
1728          }
1729          vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
1730            if ( isinf( attenuationDistance ) ) {
1731              // Attenuation distance is +∞, i.e. the transmitted color is not attenuated at all.
1732              return radiance;
1733            } else {
1734              // Compute light attenuation using Beer's law.
1735              vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
1736              vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); // Beer's law
1737              return transmittance * radiance;
1738            }
1739          }
1740          vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
1741            const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
1742            const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
1743            const in vec3 attenuationColor, const in float attenuationDistance ) {
1744            vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
1745            vec3 refractedRayExit = position + transmissionRay;
1746            // Project refracted vector on the framebuffer, while mapping to normalized device coordinates.
1747            vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
1748            vec2 refractionCoords = ndcPos.xy / ndcPos.w;
1749            refractionCoords += 1.0;
1750            refractionCoords /= 2.0;
1751            // Sample framebuffer to get pixel the refracted ray hits.
1752            vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
1753            vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );
1754            // Get the specular component.
1755            vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
1756            return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );
1757          }
1758        #endif
1759`),r.fragmentShader=r.fragmentShader.replace("#include <transmission_fragment>",`  
1760        // Improve the refraction to use the world pos
1761        material.transmission = _transmission;
1762        material.transmissionAlpha = 1.0;
1763        material.thickness = thickness;
1764        material.attenuationDistance = attenuationDistance;
1765        material.attenuationColor = attenuationColor;
1766        #ifdef USE_TRANSMISSIONMAP
1767          material.transmission *= texture2D( transmissionMap, vUv ).r;
1768        #endif
1769        #ifdef USE_THICKNESSMAP
1770          material.thickness *= texture2D( thicknessMap, vUv ).g;
1771        #endif
1772        
1773        vec3 pos = vWorldPosition;
1774        float runningSeed = 0.0;
1775        vec3 v = normalize( cameraPosition - pos );
1776        vec3 n = inverseTransformDirection( normal, viewMatrix );
1777        vec3 transmission = vec3(0.0);
1778        float transmissionR, transmissionB, transmissionG;
1779        float randomCoords = rand(runningSeed++);
1780        float thickness_smear = thickness * max(pow(roughnessFactor, 0.33), anisotropicBlur);
1781        vec3 distortionNormal = vec3(0.0);
1782        vec3 temporalOffset = vec3(time, -time, -time) * temporalDistortion;
1783        if (distortion > 0.0) {
1784          distortionNormal = distortion * vec3(snoiseFractal(vec3((pos * distortionScale + temporalOffset))), snoiseFractal(vec3(pos.zxy * distortionScale - temporalOffset)), snoiseFractal(vec3(pos.yxz * distortionScale + temporalOffset)));
1785        }
1786        for (float i = 0.0; i < ${e}.0; i ++) {
1787          vec3 sampleNorm = normalize(n + roughnessFactor * roughnessFactor * 2.0 * normalize(vec3(rand(runningSeed++) - 0.5, rand(runningSeed++) - 0.5, rand(runningSeed++) - 0.5)) * pow(rand(runningSeed++), 0.33) + distortionNormal);
1788          transmissionR = getIBLVolumeRefraction(
1789            sampleNorm, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
1790            pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness  + thickness_smear * (i + randomCoords) / float(${e}),
1791            material.attenuationColor, material.attenuationDistance
1792          ).r;
1793          transmissionG = getIBLVolumeRefraction(
1794            sampleNorm, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
1795            pos, modelMatrix, viewMatrix, projectionMatrix, material.ior  * (1.0 + chromaticAberration * (i + randomCoords) / float(${e})) , material.thickness + thickness_smear * (i + randomCoords) / float(${e}),
1796            material.attenuationColor, material.attenuationDistance
1797          ).g;
1798          transmissionB = getIBLVolumeRefraction(
1799            sampleNorm, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
1800            pos, modelMatrix, viewMatrix, projectionMatrix, material.ior * (1.0 + 2.0 * chromaticAberration * (i + randomCoords) / float(${e})), material.thickness + thickness_smear * (i + randomCoords) / float(${e}),
1801            material.attenuationColor, material.attenuationDistance
1802          ).b;
1803          transmission.r += transmissionR;
1804          transmission.g += transmissionG;
1805          transmission.b += transmissionB;
1806        }
1807        transmission /= ${e}.0;
1808        totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );
1809`)},Object.keys(this.uniforms).forEach(e=>Object.defineProperty(this,e,{get:()=>this.uniforms[e].value,set:t=>this.uniforms[e].value=t}))}}let pm=eD.forwardRef(({buffer:e,transmissionSampler:t=!1,backside:r=!1,side:i=eT.Wl3,transmission:n=1,thickness:a=0,backsideThickness:o=0,backsideEnvMapIntensity:s=1,samples:l=10,resolution:c,backsideResolution:u,background:h,anisotropy:A,anisotropicBlur:d,...m},f)=>{let p,g,y,v;(0,eR.e)({MeshTransmissionMaterial:pd});let E=eD.useRef(null),[x]=eD.useState(()=>new pA),C=cs(u||c),w=cs(c);return(0,eR.F)(e=>{E.current.time=e.clock.elapsedTime,E.current.buffer===w.texture&&!t&&(v=E.current.__r3f.parent)&&(y=e.gl.toneMapping,p=e.scene.background,g=E.current.envMapIntensity,e.gl.toneMapping=eT.uL9,h&&(e.scene.background=h),v.material=x,r&&(e.gl.setRenderTarget(C),e.gl.render(e.scene,e.camera),v.material=E.current,v.material.buffer=C.texture,v.material.thickness=o,v.material.side=eT._Li,v.material.envMapIntensity=s),e.gl.setRenderTarget(w),e.gl.render(e.scene,e.camera),v.material=E.current,v.material.thickness=a,v.material.side=i,v.material.buffer=w.texture,v.material.envMapIntensity=g,e.scene.background=p,e.gl.setRenderTarget(null),e.gl.toneMapping=y)}),eD.useImperativeHandle(f,()=>E.current,[]),eD.createElement("meshTransmissionMaterial",(0,eS.Z)({args:[l,t],ref:E},m,{buffer:e||w.texture,_transmission:n,anisotropicBlur:null!=d?d:A,transmission:t?n:0,thickness:a,side:i}))}),pf=eD.forwardRef((e,t)=>
1809((0,eR.e)({DiscardMaterialImpl:pA}),eD.createElement("discardMaterialImpl",(0,eS.Z)({ref:t},e))));function pp(e){let t=eD.useRef(null);return eD.useLayoutEffect(()=>{var e;let r=null==(e=t.current)?void 0:e.parent,i=null==r?void 0:r.geometry;if(i){let e=r.material;r.material=t.current.__r3f.objects;let n=[...i.groups];return i.clearGroups(),r.material.forEach((e,t)=>{t<r.material.length-1&&(e.depthWrite=!1),i.addGroup(0,1/0,t)}),()=>{r.material=e,i.groups=n}}}),eD.createElement("group",(0,eS.Z)({ref:t},e))}let pg=sI.i>=154?"opaque_fragment":"output_fragment";class py extends eT.UY4{constructor(e){super(e),this.onBeforeCompile=(e,t)=>{let{isWebGL2:r}=t.capabilities;e.fragmentShader=e.fragmentShader.replace(`#include <${pg}>`,`
1810        ${r?`#include <${pg}>`:`#extension GL_OES_standard_derivatives : enable
1811#include <${pg}>`}
1812      vec2 cxy = 2.0 * gl_PointCoord - 1.0;
1813      float r = dot(cxy, cxy);
1814      float delta = fwidth(r);     
1815      float mask = 1.0 - smoothstep(1.0 - delta, 1.0 + delta, r);
1816      gl_FragColor = vec4(gl_FragColor.rgb, mask * gl_FragColor.a );
1817      #include <tonemapping_fragment>
1818      #include <${sI.i>=154?"colorspace_fragment":"encodings_fragment"}>
1819      `)}}}let pv=eD.forwardRef((e,t)=>{let[r]=eD.useState(()=>new py(null));return eD.createElement("primitive",(0,eS.Z)({},e,{object:r,ref:t,attach:"material"}))}),pE=({focus:e=0,size:t=25,samples:r=10}={})=>`
1820#define PENUMBRA_FILTER_SIZE float(${t})
1821#define RGB_NOISE_FUNCTION(uv) (randRGB(uv))
1822vec3 randRGB(vec2 uv) {
1823  return vec3(
1824    fract(sin(dot(uv, vec2(12.75613, 38.12123))) * 13234.76575),
1825    fract(sin(dot(uv, vec2(19.45531, 58.46547))) * 43678.23431),
1826    fract(sin(dot(uv, vec2(23.67817, 78.23121))) * 93567.23423)
1827  );
1828}
1829
1830vec3 lowPassRandRGB(vec2 uv) {
1831  // 3x3 convolution (average)
1832  // can be implemented as separable with an extra buffer for a total of 6 samples instead of 9
1833  vec3 result = vec3(0);
1834  result += RGB_NOISE_FUNCTION(uv + vec2(-1.0, -1.0));
1835  result += RGB_NOISE_FUNCTION(uv + vec2(-1.0,  0.0));
1836  result += RGB_NOISE_FUNCTION(uv + vec2(-1.0, +1.0));
1837  result += RGB_NOISE_FUNCTION(uv + vec2( 0.0, -1.0));
1838  result += RGB_NOISE_FUNCTION(uv + vec2( 0.0,  0.0));
1839  result += RGB_NOISE_FUNCTION(uv + vec2( 0.0, +1.0));
1840  result += RGB_NOISE_FUNCTION(uv + vec2(+1.0, -1.0));
1841  result += RGB_NOISE_FUNCTION(uv + vec2(+1.0,  0.0));
1842  result += RGB_NOISE_FUNCTION(uv + vec2(+1.0, +1.0));
1843  result *= 0.111111111; // 1.0 / 9.0
1844  return result;
1845}
1846vec3 highPassRandRGB(vec2 uv) {
1847  // by subtracting the low-pass signal from the original signal, we're being left with the high-pass signal
1848  // hp(x) = x - lp(x)
1849  return RGB_NOISE_FUNCTION(uv) - lowPassRandRGB(uv) + 0.5;
1850}
1851
1852
1853vec2 vogelDiskSample(int sampleIndex, int sampleCount, float angle) {
1854  const float goldenAngle = 2.399963f; // radians
1855  float r = sqrt(float(sampleIndex) + 0.5f) / sqrt(float(sampleCount));
1856  float theta = float(sampleIndex) * goldenAngle + angle;
1857  float sine = sin(theta);
1858  float cosine = cos(theta);
1859  return vec2(cosine, sine) * r;
1860}
1861float penumbraSize( const in float zReceiver, const in float zBlocker ) { // Parallel plane estimation
1862  return (zReceiver - zBlocker) / zBlocker;
1863}
1864float findBlocker(sampler2D shadowMap, vec2 uv, float compare, float angle) {
1865  float texelSize = 1.0 / float(textureSize(shadowMap, 0).x);
1866  float blockerDepthSum = float(${e});
1867  float blockers = 0.0;
1868
1869  int j = 0;
1870  vec2 offset = vec2(0.);
1871  float depth = 0.;
1872
1873  #pragma unroll_loop_start
1874  for(int i = 0; i < ${r}; i ++) {
1875    offset = (vogelDiskSample(j, ${r}, angle) * texelSize) * 2.0 * PENUMBRA_FILTER_SIZE;
1876    depth = unpackRGBAToDepth( texture2D( shadowMap, uv + offset));
1877    if (depth < compare) {
1878      blockerDepthSum += depth;
1879      blockers++;
1880    }
1881    j++;
1882  }
1883  #pragma unroll_loop_end
1884
1885  if (blockers > 0.0) {
1886    return blockerDepthSum / blockers;
1887  }
1888  return -1.0;
1889}
1890
1891        
1892float vogelFilter(sampler2D shadowMap, vec2 uv, float zReceiver, float filterRadius, float angle) {
1893  float texelSize = 1.0 / float(textureSize(shadowMap, 0).x);
1894  float shadow = 0.0f;
1895  int j = 0;
1896  vec2 vogelSample = vec2(0.0);
1897  vec2 offset = vec2(0.0);
1898  #pragma unroll_loop_start
1899  for (int i = 0; i < ${r}; i++) {
1900    vogelSample = vogelDiskSample(j, ${r}, angle) * texelSize;
1901    offset = vogelSample * (1.0 + filterRadius * float(${t}));
1902    shadow += step( zReceiver, unpackRGBAToDepth( texture2D( shadowMap, uv + offset ) ) );
1903    j++;
1904  }
1905  #pragma unroll_loop_end
1906  return shadow * 1.0 / ${r}.0;
1907}
1908
1909float PCSS (sampler2D shadowMap, vec4 coords) {
1910  vec2 uv = coords.xy;
1911  float zReceiver = coords.z; // Assumed to be eye-space z in this code
1912  float angle = highPassRandRGB(gl_FragCoord.xy).r * PI2;
1913  float avgBlockerDepth = findBlocker(shadowMap, uv, zReceiver, angle);
1914  if (avgBlockerDepth == -1.0) {
1915    return 1.0;
1916  }
1917  float penumbraRatio = penumbraSize(zReceiver, avgBlockerDepth);
1918  return vogelFilter(shadowMap, uv, zReceiver, 1.25 * penumbraRatio, angle);
1919}`;function px(e,t,r){t.traverse(t=>{t.material&&(e.properties.remove(t.material),null==t.material.dispose||t.material.dispose())}
1919),e.info.programs.length=0,e.compile(t,r)}function pC({focus:e=0,samples:t=10,size:r=25}){let i=(0,eR.D)(e=>e.gl),n=(0,eR.D)(e=>e.scene),a=(0,eR.D)(e=>e.camera);return eD.useEffect(()=>{let o=aQ.ShaderChunk.shadowmap_pars_fragment;return aQ.ShaderChunk.shadowmap_pars_fragment=aQ.ShaderChunk.shadowmap_pars_fragment.replace("#ifdef USE_SHADOWMAP","#ifdef USE_SHADOWMAP\n"+pE({size:r,samples:t,focus:e})).replace("#if defined( SHADOWMAP_TYPE_PCF )","\nreturn PCSS(shadowMap, shadowCoord);\n#if defined( SHADOWMAP_TYPE_PCF )"),px(i,n,a),()=>{aQ.ShaderChunk.shadowmap_pars_fragment=o,px(i,n,a)}},[e,r,t]),null}function pw(e,t){let r=e+"Geometry";return eD.forwardRef(({args:e,children:i,...n},a)=>{let o=eD.useRef(null);return eD.useImperativeHandle(a,()=>o.current),eD.useLayoutEffect(()=>void(null==t||t(o.current))),eD.createElement("mesh",(0,eS.Z)({ref:o},n),eD.createElement(r,{attach:"geometry",args:e}),i)})}let pB=pw("box"),pI=pw("circle"),p_=pw("cone"),pb=pw("cylinder"),pM=pw("sphere"),pS=pw("plane"),pD=pw("tube"),pP=pw("torus"),pT=pw("torusKnot"),pR=pw("tetrahedron"),pF=pw("ring"),pQ=pw("polyhedron"),pz=pw("icosahedron"),pk=pw("octahedron"),pL=pw("dodecahedron"),pO=pw("extrude"),pU=pw("lathe"),pG=pw("capsule"),pN=pw("shape",({geometry:e})=>{let t=e.attributes.position,r=new eT.ZzF().setFromBufferAttribute(t),i=new eT.Pa4;r.getSize(i);let n=[],a=0,o=0,s=0,l=0;for(let e=0;e<t.count;e++)a=t.getX(e),o=t.getY(e),s=(a-r.min.x)/i.x,l=(o-r.min.y)/i.y,n.push(s,l);e.setAttribute("uv",new eT.a$l(n,2))}),pH=eD.forwardRef(function({args:[e=1,t=1,r=1]=[],radius:i=.05,steps:n=1,smoothness:a=4,bevelSegments:o=4,creaseAngle:s=.4,children:l,...c},u){let h=eD.useMemo(()=>(function(e,t,r){let i=new eT.bnF,n=r-1e-5;return i.absarc(1e-5,1e-5,1e-5,-Math.PI/2,-Math.PI,!0),i.absarc(1e-5,t-2*n,1e-5,Math.PI,Math.PI/2,!0),i.absarc(e-2*n,t-2*n,1e-5,Math.PI/2,0,!0),i.absarc(e-2*n,1e-5,1e-5,0,-Math.PI/2,!0),i})(e,t,i),[e,t,i]),A=eD.useMemo(()=>({depth:r-2*i,bevelEnabled:!0,bevelSegments:2*o,steps:n,bevelSize:i-1e-5,bevelThickness:i,curveSegments:a}),[r,i,a]),d=eD.useRef(null);return eD.useLayoutEffect(()=>{d.current&&(d.current.center(),oV(d.current,s))},[h,A]),eD.createElement("mesh",(0,eS.Z)({ref:u},c),eD.createElement("extrudeGeometry",{ref:d,args:[h,A]}),l)});function pj(){let e=new eT.u9r,t=new Float32Array([-1,-1,3,-1,-1,3]);return e.boundingSphere=new eT.aLr,e.boundingSphere.set(new eT.Pa4,1/0),e.setAttribute("position",new eT.TlE(t,2)),e}let pJ=eD.forwardRef(function({children:e,...t},r){let i=eD.useMemo(pj,[]);return eD.createElement("mesh",(0,eS.Z)({ref:r,geometry:i,frustumCulled:!1},t),e)}),pV=eD.forwardRef(({children:e,width:t,height:r,depth:i,box3:n,precise:a=!0,...o},s)=>{let l=eD.useRef(null),c=eD.useRef(null),u=eD.useRef(null);return eD.useLayoutEffect(()=>{c.current.matrixWorld.identity();let e=n||new eT.ZzF().setFromObject(u.current,a),o=e.max.x-e.min.x,s=e.max.y-e.min.y,l=e.max.z-e.min.z,h=Math.max(o,s,l);t&&(h=o),r&&(h=s),i&&(h=l),c.current.scale.setScalar(1/h)},[t,r,i,n,a]),eD.useImperativeHandle(s,()=>l.current,[]),eD.createElement("group",(0,eS.Z)({ref:l},o),eD.createElement("group",{ref:c},eD.createElement("group",{ref:u},e)))});var pK=((X=pK||{})[X.NONE=0]="NONE",X[X.START=1]="START",X[X.ACTIVE=2]="ACTIVE",X);let pY=e=>e&&e.isOrthographicCamera,pW=e=>e&&e.isBox3,pq=e=>1-Math.exp(-5*e)+.007*e,pX=eD.createContext(null);function pZ({children:e,maxDuration:t=1,margin:r=1.2,observe:i,fit:n,clip:a,interpolateFunc:o=pq,onFit:s}){let l=eD.useRef(null),{camera:c,size:u,invalidate:h}=(0,eR.D)(),A=(0,eR.D)(e=>e.controls),d=eD.useRef(s);d.current=s;let m=eD.useRef({camPos:new eT.Pa4,camRot:new eT._fP,camZoom:1}),f=eD.useRef({camPos:void 0,camRot:void 0,camZoom:void 0,camUp:void 0,target:void 0}),p=eD.useRef(pK.NONE),g=eD.useRef(0),[y]=eD.useState(()=>new eT.ZzF),v=eD.useMemo(()=>{function e(){let e=y.getSize(new eT.Pa4),t=y.getCenter(new eT.Pa4),i=Math.max(e.x,e.y,e.z),n=pY(c)?4*i:i/(2*Math.atan(Math.PI*c.fov/360)),a=pY(c)?4*i:n/c.aspect;return{box:y,size:e,center:t,distance:r*Math.max(n,a)}}return{getSize:e,refresh(e){if(pW(e))y.copy(e);else{let t=e||l.current;if(!t)return this;t.updateWorldMatrix(!0,!0),y.setFromObject(t)}if(y.isEmpty()){let e=c.position.length()||10;y.setFromCenterAndSize(new eT.Pa4,new eT.Pa4(e,e,e))}return m.current.camPos.copy(c.position),m.current.camRot.copy(c.quaternion),pY(c)&&(m.current.camZoom=c.zoom),f.current.camPos=void 0,f.current.camRot=void 0,f.current.camZoom=void 0,f.current.camUp=void 0,f.current.target=void 0,this},reset(){let{center:t,distance:r}=e(),i=c.position.clone().sub(t).normalize();f.current.camPos=t.clone().addScaledVector(i,r),f.current.target=t.clone();let n=new eT.yGw().lookAt(f.current.camPos,f.current.target,c.up);return f.current.camRot=new eT._fP().setFromRotationMatrix(n),p.current=pK.START,g.current=0,this},moveTo(e){return f.current.camPos=Array.isArray(e)?new eT.Pa4(...e):e.clone(),p.current=pK.START,g.current=0,this},lookAt({target:e,up:t}){f.current.target=Array.isArray(e)?new eT.Pa4(...e):e.clone(),t?f.current.camUp=Array.isArray(t)?new eT.Pa4(...t):t.clone():f.current.camUp=c.up.clone();let r=new eT.yGw().lookAt(f.current.camPos||c.position,f.current.target,f.current.camUp);return f.current.camRot=new eT._fP().setFromRotationMatrix(r),p.current=pK.START,g.current=0,this},to({position:e,target:t}){return this.moveTo(e).lookAt({target:t})},fit(){if(!pY(c))return this.reset();let e=0,t=0,i=[new eT.Pa4(y.min.x,y.min.y,y.min.z),new eT.Pa4(y.min.x,y.max.y,y.min.z),new eT.Pa4(y.min.x,y.min.y,y.max.z),new eT.Pa4(y.min.x,y.max.y,y.max.z),new eT.Pa4(y.max.x,y.max.y,y.max.z),new eT.Pa4(y.max.x,y.max.y,y.min.z),new eT.Pa4(y.max.x,y.min.y,y.max.z),new eT.Pa4(y.max.x,y.min.y,y.min.z)],n=f.current.camPos||c.position,a=f.current.target||(null==A?void 0:A.target),o=f.current.camUp||c.up,s=a?new eT.yGw().lookAt(n,a,o).setPosition(n).invert():c.matrixWorldInverse;for(let r of i)r.applyMatrix4(s),e=Math.max(e,Math.abs(r.y)),t=Math.max(t,Math.abs(r.x));e*=2,t*=2;let l=(c.top-c.bottom)/e,u=(c.right-c.left)/t;return f.current.camZoom=Math.min(l,u)/r,p.current=pK.START,g.current=0,d.current&&d.current(this.getSize()),this},clip(){let{distance:t}=e();return c.near=t/100,c.far=100*t,c.updateProjectionMatrix(),A&&(A.maxDistance=10*t,A.update(
1919)),h(),this}}},[y,c,A,r,h]);eD.useLayoutEffect(()=>{if(A){let e=()=>{if(A&&f.current.target&&p.current!==pK.NONE){let e=new eT.Pa4().setFromMatrixColumn(c.matrix,2),t=m.current.camPos.distanceTo(A.target),r=(f.current.camPos||m.current.camPos).distanceTo(f.current.target),i=(1-g.current)*t+g.current*r;A.target.copy(c.position).addScaledVector(e,-i),A.update()}p.current=pK.NONE};return A.addEventListener("start",e),()=>A.removeEventListener("start",e)}},[A]);let E=eD.useRef(0);return eD.useLayoutEffect(()=>{(i||0==E.current++)&&(v.refresh(),n&&v.reset().fit(),a&&v.clip())},[u,a,n,i,c,A]),(0,eR.F)((e,r)=>{if(p.current===pK.START)p.current=pK.ACTIVE,h();else if(p.current===pK.ACTIVE){if(g.current+=r/t,g.current>=1)f.current.camPos&&c.position.copy(f.current.camPos),f.current.camRot&&c.quaternion.copy(f.current.camRot),f.current.camUp&&c.up.copy(f.current.camUp),f.current.camZoom&&pY(c)&&(c.zoom=f.current.camZoom),c.updateMatrixWorld(),c.updateProjectionMatrix(),A&&f.current.target&&(A.target.copy(f.current.target),A.update()),p.current=pK.NONE;else{let e=o(g.current);f.current.camPos&&c.position.lerpVectors(m.current.camPos,f.current.camPos,e),f.current.camRot&&c.quaternion.slerpQuaternions(m.current.camRot,f.current.camRot,e),f.current.camUp&&c.up.set(0,1,0).applyQuaternion(c.quaternion),f.current.camZoom&&pY(c)&&(c.zoom=(1-e)*m.current.camZoom+e*f.current.camZoom),c.updateMatrixWorld(),c.updateProjectionMatrix()}h()}}),eD.createElement("group",{ref:l},eD.createElement(pX.Provider,{value:v},e))}function p$(){return eD.useContext(pX)}var p1=Object.defineProperty,p0=(e,t,r)=>t in e?p1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,p2=(e,t,r)=>(p0(e,"symbol"!=typeof t?t+"":t,r),r);class p3{constructor(e=Math){p2(this,"grad3",[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]]),p2(this,"grad4",[[0,1,1,1],[0,1,1,-1],[0,1,-1,1],[0,1,-1,-1],[0,-1,1,1],[0,-1,1,-1],[0,-1,-1,1],[0,-1,-1,-1],[1,0,1,1],[1,0,1,-1],[1,0,-1,1],[1,0,-1,-1],[-1,0,1,1],[-1,0,1,-1],[-1,0,-1,1],[-1,0,-1,-1],[1,1,0,1],[1,1,0,-1],[1,-1,0,1],[1,-1,0,-1],[-1,1,0,1],[-1,1,0,-1],[-1,-1,0,1],[-1,-1,0,-1],[1,1,1,0],[1,1,-1,0],[1,-1,1,0],[1,-1,-1,0],[-1,1,1,0],[-1,1,-1,0],[-1,-1,1,0],[-1,-1,-1,0]]),p2(this,"p",[]),p2(this,"perm",[]),p2(this,"simplex",[[0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0],[0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2,3,1,0],[1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],[2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]]),p2(this,"dot",(e,t,r)=>e[0]*t+e[1]*r),p2(this,"dot3",(e,t,r,i)=>e[0]*t+e[1]*r+e[2]*i),p2(this,"dot4",(e,t,r,i,n)=>e[0]*t+e[1]*r+e[2]*i+e[3]*n),p2(this,"noise",(e,t)=>{let r,i,n;let a=.5*(Math.sqrt(3)-1)*(e+t),o=Math.floor(e+a),s=Math.floor(t+a),l=(3-Math.sqrt(3))/6,c=(o+s)*l,u=e-(o-c),h=t-(s-c),A=0,d=1;u>h&&(A=1,d=0);let m=u-A+l,f=h-d+l,p=u-1+2*l,g=h-1+2*l,y=255&o,v=255&s,E=this.perm[y+this.perm[v]]%12,x=this.perm[y+A+this.perm[v+d]]%12,C=this.perm[y+1+this.perm[v+1]]%12,w=.5-u*u-h*h;w<0?r=0:(w*=w,r=w*w*this.dot(this.grad3[E],u,h));let B=.5-m*m-f*f;B<0?i=0:(B*=B,i=B*B*this.dot(this.grad3[x],m,f));let I=.5-p*p-g*g;return I<0?n=0:(I*=I,n=I*I*this.dot(this.grad3[C],p,g)),70*(r+i+n)}),p2(this,"noise3d",(e,t,r)=>{let i,n,a,o,s,l,c,u,h,A;let d=1/3*(e+t+r),m=Math.floor(e+d),f=Math.floor(t+d),p=Math.floor(r+d),g=1/6*(m+f+p),y=e-(m-g),v=t-(f-g),E=r-(p-g);y>=v?v>=E?(s=1,l=0,c=0,u=1,h=1,A=0):(y>=E?(s=1,l=0,c=0):(s=0,l=0,c=1),u=1,h=0,A=1):v<E?(s=0,l=0,c=1,u=0,h=1,A=1):y<E?(s=0,l=1,c=0,u=0,h=1,A=1):(s=0,l=1,c=0,u=1,h=1,A=0);let x=y-s+1/6,C=v-l+1/6,w=E-c+1/6,B=y-u+1/6*2,I=v-h+1/6*2,_=E-A+1/6*2,b=y-1+1/6*3,M=v-1+1/6*3,S=E-1+1/6*3,D=255&m,P=255&f,T=255&p,R=this.perm[D+this.perm[P+this.perm[T]]]%12,F=this.perm[D+s+this.perm[P+l+this.perm[T+c]]]%12,Q=this.perm[D+u+this.perm[P+h+this.perm[T+A]]]%12,z=this.perm[D+1+this.perm[P+1+this.perm[T+1]]]%12,k=.6-y*y-v*v-E*E;k<0?i=0:(k*=k,i=k*k*this.dot3(this.grad3[R],y,v,E));let L=.6-x*x-C*C-w*w;
1919L<0?n=0:(L*=L,n=L*L*this.dot3(this.grad3[F],x,C,w));let O=.6-B*B-I*I-_*_;O<0?a=0:(O*=O,a=O*O*this.dot3(this.grad3[Q],B,I,_));let U=.6-b*b-M*M-S*S;return U<0?o=0:(U*=U,o=U*U*this.dot3(this.grad3[z],b,M,S)),32*(i+n+a+o)}),p2(this,"noise4d",(e,t,r,i)=>{let n,a,o,s,l,c,u,h,A,d,m,f,p,g,y,v,E;let x=this.grad4,C=this.simplex,w=this.perm,B=(5-Math.sqrt(5))/20,I=(Math.sqrt(5)-1)/4*(e+t+r+i),_=Math.floor(e+I),b=Math.floor(t+I),M=Math.floor(r+I),S=Math.floor(i+I),D=(_+b+M+S)*B,P=e-(_-D),T=t-(b-D),R=r-(M-D),F=i-(S-D),Q=(P>T?32:0)+(P>R?16:0)+(T>R?8:0)+(P>F?4:0)+(T>F?2:0)+(R>F?1:0);c=C[Q][0]>=3?1:0,u=C[Q][1]>=3?1:0,h=C[Q][2]>=3?1:0,A=C[Q][3]>=3?1:0,d=C[Q][0]>=2?1:0,m=C[Q][1]>=2?1:0,f=C[Q][2]>=2?1:0,p=C[Q][3]>=2?1:0,g=C[Q][0]>=1?1:0,y=C[Q][1]>=1?1:0,v=C[Q][2]>=1?1:0,E=C[Q][3]>=1?1:0;let z=P-c+B,k=T-u+B,L=R-h+B,O=F-A+B,U=P-d+2*B,G=T-m+2*B,N=R-f+2*B,H=F-p+2*B,j=P-g+3*B,J=T-y+3*B,V=R-v+3*B,K=F-E+3*B,Y=P-1+4*B,W=T-1+4*B,q=R-1+4*B,X=F-1+4*B,Z=255&_,$=255&b,ee=255&M,et=255&S,er=w[Z+w[$+w[ee+w[et]]]]%32,ei=w[Z+c+w[$+u+w[ee+h+w[et+A]]]]%32,en=w[Z+d+w[$+m+w[ee+f+w[et+p]]]]%32,ea=w[Z+g+w[$+y+w[ee+v+w[et+E]]]]%32,eo=w[Z+1+w[$+1+w[ee+1+w[et+1]]]]%32,es=.6-P*P-T*T-R*R-F*F;es<0?n=0:(es*=es,n=es*es*this.dot4(x[er],P,T,R,F));let el=.6-z*z-k*k-L*L-O*O;el<0?a=0:(el*=el,a=el*el*this.dot4(x[ei],z,k,L,O));let ec=.6-U*U-G*G-N*N-H*H;ec<0?o=0:(ec*=ec,o=ec*ec*this.dot4(x[en],U,G,N,H));let eu=.6-j*j-J*J-V*V-K*K;eu<0?s=0:(eu*=eu,s=eu*eu*this.dot4(x[ea],j,J,V,K));let eh=.6-Y*Y-W*W-q*q-X*X;return eh<0?l=0:(eh*=eh,l=eh*eh*this.dot4(x[eo],Y,W,q,X)),27*(n+a+o+s+l)});for(let t=0;t<256;t++)this.p[t]=Math.floor(256*e.random());for(let e=0;e<512;e++)this.perm[e]=this.p[255&e]}}let p4=eD.forwardRef(({intensity:e=1,decay:t,decayRate:r=.65,maxYaw:i=.1,maxPitch:n=.1,maxRoll:a=.1,yawFrequency:o=.1,pitchFrequency:s=.1,rollFrequency:l=.1},c)=>{let u=(0,eR.D)(e=>e.camera),h=(0,eR.D)(e=>e.controls),A=eD.useRef(e),d=eD.useRef(u.rotation.clone()),[m]=eD.useState(()=>new p3),[f]=eD.useState(()=>new p3),[p]=eD.useState(()=>new p3),g=()=>{(A.current<0||A.current>1)&&(A.current=A.current<0?0:1)};return eD.useImperativeHandle(c,()=>({getIntensity:()=>A.current,setIntensity:e=>{A.current=e,g()}}),[]),eD.useEffect(()=>{if(h){let e=()=>void(d.current=u.rotation.clone());return h.addEventListener("change",e),e(),()=>void h.removeEventListener("change",e)}},[u,h]),(0,eR.F)((e,c)=>{let h=Math.pow(A.current,2),y=i*h*m.noise(e.clock.elapsedTime*o,1),v=n*h*f.noise(e.clock.elapsedTime*s,1),E=a*h*p.noise(e.clock.elapsedTime*l,1);u.rotation.set(d.current.x+v,d.current.y+y,d.current.z+E),t&&A.current>0&&(A.current-=r*c,g())}),null}),p5=eD.forwardRef(({children:e,enabled:t=!0,speed:r=1,rotationIntensity:i=1,floatIntensity:n=1,floatingRange:a=[-.1,.1],autoInvalidate:o=!1,...s},l)=>{let c=eD.useRef(null);eD.useImperativeHandle(l,()=>c.current,[]);let u=eD.useRef(1e4*Math.random());return(0,eR.F)(e=>{var s,l;if(!t||0===r)return;o&&e.invalidate();let h=u.current+e.clock.elapsedTime;c.current.rotation.x=Math.cos(h/4*r)/8*i,c.current.rotation.y=Math.sin(h/4*r)/8*i,c.current.rotation.z=Math.sin(h/4*r)/20*i;let A=Math.sin(h/4*r)/10;A=eT.M8C.mapLinear(A,-.1,.1,null!==(s=null==a?void 0:a[0])&&void 0!==s?s:-.1,null!==(l=null==a?void 0:a[1])&&void 0!==l?l:.1),c.current.position.y=A*n,c.current.updateMatrix()}),eD.createElement("group",s,eD.createElement("group",{ref:c,matrixAutoUpdate:!1},e))}),p6=e=>e&&e.isCubeTexture;class p8 extends eT.Kj0{constructor(e,t){var r,i;let n=p6(e),a=Math.floor(Math.log2((null!=(i=n?null==(r=e.image[0])?void 0:r.width:e.image.width)?i:1024)/4)),o=Math.pow(2,a),s=`
1920        varying vec3 vWorldPosition;
1921        void main() 
1922        {
1923            vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) );
1924            vWorldPosition = worldPosition.xyz;
1925            
1926            gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
1927        }
1928        `,l=[n?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/(3*Math.max(o,112))}`,`#define CUBEUV_TEXEL_HEIGHT ${1/(4*o)}`,`#define CUBEUV_MAX_MIP ${a}.0`].join("\n")+`
1929        #define ENVMAP_TYPE_CUBE_UV
1930        varying vec3 vWorldPosition;
1931        uniform float radius;
1932        uniform float height;
1933        uniform float angle;
1934        #ifdef ENVMAP_TYPE_CUBE
1935            uniform samplerCube map;
1936        #else
1937            uniform sampler2D map;
1938        #endif
1939        // From: https://www.shadertoy.com/view/4tsBD7
1940        float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) 
1941        {
1942            float d = dot ( rd, n );
1943            
1944            if( d > 0.0 ) { return 1e6; }
1945            
1946            vec3  o = ro - c;
1947            float t = - dot( n, o ) / d;
1948            vec3  q = o + rd * t;
1949            
1950            return ( dot( q, q ) < r * r ) ? t : 1e6;
1951        }
1952        // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm
1953        float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) 
1954        {
1955            vec3 oc = ro - ce;
1956            float b = dot( oc, rd );
1957            float c = dot( oc, oc ) - ra * ra;
1958            float h = b * b - c;
1959            
1960            if( h < 0.0 ) { return -1.0; }
1961            
1962            h = sqrt( h );
1963            
1964            return - b + h;
1965        }
1966        vec3 project() 
1967        {
1968            vec3 p = normalize( vWorldPosition );
1969            vec3 camPos = cameraPosition;
1970            camPos.y -= height;
1971            float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius );
1972            if( intersection > 0.0 ) {
1973                
1974                vec3 h = vec3( 0.0, - height, 0.0 );
1975                float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius );
1976                p = ( camPos + min( intersection, intersection2 ) * p ) / radius;
1977            } else {
1978                p = vec3( 0.0, 1.0, 0.0 );
1979            }
1980            return p;
1981        }
1982        #include <common>
1983        #include <cube_uv_reflection_fragment>
1984        void main() 
1985        {
1986            vec3 projectedWorldPosition = project();
1987            
1988            #ifdef ENVMAP_TYPE_CUBE
1989                vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb;
1990            #else
1991                vec3 direction = normalize( projectedWorldPosition );
1992                vec2 uv = equirectUv( direction );
1993                vec3 outcolor = texture2D( map, uv ).rgb;
1994            #endif
1995            gl_FragColor = vec4( outcolor, 1.0 );
1996            #include <tonemapping_fragment>
1997            #include <${of.i>=154?"colorspace_fragment":"encodings_fragment"}>
1998        }
1999        `;super(new eT.cJO(1,16),new eT.jyz({uniforms:{map:{value:e},height:{value:(null==t?void 0:t.height)||15},radius:{value:(null==t?void 0:t.radius)||100}},fragmentShader:l,vertexShader:s,side:eT.ehD}))}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}class p9 extends eT.yxD{constructor(e){super(e),this.type=eT.cLu}parse(e){let t,r,i;let n=function(e,t){switch(e){case 1:throw Error("THREE.RGBELoader: Read Error: "+(t||""));case 2:throw Error("THREE.RGBELoader: Write Error: "+(t||""));case 3:throw Error("THREE.RGBELoader: Bad File Format: "+(t||""));default:throw Error("THREE.RGBELoader: Memory Error: "+(t||""))}},a=function(e,t,r){t=t||1024;let i=e.pos,n=-1,a=0,o="",s=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));for(;0>(n=s.indexOf("\n"))&&a<t&&i<e.byteLength;)o+=s,a+=s.length,i+=128,s+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));return -1<n&&(!1!==r&&(e.pos+=a+n+1),o+s.slice(0,n))},o=new Uint8Array(e);o.pos=0;let s=function(e){let t,r;
1999let i=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,o=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,l=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,c={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};for(!(e.pos>=e.byteLength)&&(t=a(e))||n(1,"no header found"),(r=t.match(/^#\?(\S+)/))||n(3,"bad initial token"),c.valid|=1,c.programtype=r[1],c.string+=t+"\n";!1!==(t=a(e));){if(c.string+=t+"\n","#"===t.charAt(0)){c.comments+=t+"\n";continue}if((r=t.match(i))&&(c.gamma=parseFloat(r[1])),(r=t.match(o))&&(c.exposure=parseFloat(r[1])),(r=t.match(s))&&(c.valid|=2,c.format=r[1]),(r=t.match(l))&&(c.valid|=4,c.height=parseInt(r[1],10),c.width=parseInt(r[2],10)),2&c.valid&&4&c.valid)break}return 2&c.valid||n(3,"missing format specifier"),4&c.valid||n(3,"missing image size specifier"),c}(o),l=s.width,c=s.height,u=function(e,t,r){if(t<8||t>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);t!==(e[2]<<8|e[3])&&n(3,"wrong scanline width");let i=new Uint8Array(4*t*r);i.length||n(4,"unable to allocate buffer space");let a=0,o=0,s=4*t,l=new Uint8Array(4),c=new Uint8Array(s),u=r;for(;u>0&&o<e.byteLength;){o+4>e.byteLength&&n(1),l[0]=e[o++],l[1]=e[o++],l[2]=e[o++],l[3]=e[o++],(2!=l[0]||2!=l[1]||(l[2]<<8|l[3])!=t)&&n(3,"bad rgbe scanline format");let r=0,h;for(;r<s&&o<e.byteLength;){let t=(h=e[o++])>128;if(t&&(h-=128),(0===h||r+h>s)&&n(3,"bad scanline data"),t){let t=e[o++];for(let e=0;e<h;e++)c[r++]=t}else c.set(e.subarray(o,o+h),r),r+=h,o+=h}for(let e=0;e<t;e++){let r=0;i[a]=c[e+r],r+=t,i[a+1]=c[e+r],r+=t,i[a+2]=c[e+r],r+=t,i[a+3]=c[e+r],a+=4}u--}return i}(o.subarray(o.pos),l,c);switch(this.type){case eT.VzW:let h=new Float32Array(4*(i=u.length/4));for(let e=0;e<i;e++)!function(e,t,r,i){let n=Math.pow(2,e[t+3]-128)/255;r[i+0]=e[t+0]*n,r[i+1]=e[t+1]*n,r[i+2]=e[t+2]*n,r[i+3]=1}(u,4*e,h,4*e);t=h,r=eT.VzW;break;case eT.cLu:let A=new Uint16Array(4*(i=u.length/4));for(let e=0;e<i;e++)!function(e,t,r,i){let n=Math.pow(2,e[t+3]-128)/255;r[i+0]=eT.A5E.toHalfFloat(Math.min(e[t+0]*n,65504)),r[i+1]=eT.A5E.toHalfFloat(Math.min(e[t+1]*n,65504)),r[i+2]=eT.A5E.toHalfFloat(Math.min(e[t+2]*n,65504)),r[i+3]=eT.A5E.toHalfFloat(1)}(u,4*e,A,4*e);t=A,r=eT.cLu;break;default:throw Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:l,height:c,data:t,header:s.string,gamma:s.gamma,exposure:s.exposure,type:r}}setDataType(e){return this.type=e,this}load(e,t,r,i){return super.load(e,function(e,r){switch(e.type){case eT.VzW:case eT.cLu:"colorSpace"in e?e.colorSpace="srgb-linear":e.encoding=3e3,e.minFilter=eT.wem,e.magFilter=eT.wem,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,r)},r,i)}}let p7=of.i>=152;class ge extends eT.yxD{constructor(e){super(e),this.type=eT.cLu}parse(e){let t={l:0,c:0,lc:0};function r(e,r,i,n,a){for(;i<e;)r=r<<8|I(n,a),i+=8;i-=e,t.l=r>>i&(1<<e)-1,t.c=r,t.lc=i}let i=Array(59),n={c:0,lc:0};function a(e,t,r,i){e=e<<8|I(r,i),t+=8,n.c=e,n.lc=t}let o={c:0,lc:0};function s(e,t,r,i,s,l,c,u,h,A){if(e==t){i<8&&(a(r,i,s,c),r=n.c,i=n.lc);var d=r>>(i-=8),d=new Uint8Array([d])[0];if(h.value+d>A)return!1;for(var m=u[h.value-1];d-- >0;)u[h.value++]=m}else{if(!(h.value<A))return!1;u[h.value++]=e}o.c=r,o.lc=i}function l(e){var t=65535&e;return t>32767?t-65536:t}let c={a:0,b:0};function u(e,t){var r=l(e),i=l(t),n=r+(1&i)+(i>>1),a=n-i;c.a=n,c.b=a}function h(e,t){var r=65535&t,i=(65535&e)-(r>>1)&65535;c.a=r+i-32768&65535,c.b=i}function A(e,l,c,u,h,A){var d=c.value,m=B(l,c),f=B(l,c);c.value+=4;var p=B(l,c);if(c.value+=4,m<0||m>=65537||f<0||f>=65537)throw"Something wrong with HUF_ENCSIZE";var g=Array(65537),y=Array(16384);!function(e){for(var t=0;t<16384;t++)e[t]={},e[t].len=0,e[t].lit=0,e[t].p=null}(y);var v=u-(c.value-d);if(!function(e,n,a,o,s,l,c){for(var u=0,h=0;s<=l;s++){if(a.value-a.value>o)return!1;r(6,u,h,e,a);var A=t.l;if(u=t.c,h=t.lc,c[s]=A,63==A){if(a.value-a.value>o)throw"Something wrong with hufUnpackEncTable";r(8,u,h,e,a);var d=t.l+6;if(u=t.c,h=t.lc,s+d>l+1)throw"Something wrong with hufUnpackEncTable";for(;d--;)c[s++]=0;s--}else if(A>=59){var d=A-59+2;if(s+d>l+1)throw"Something wrong with hufUnpackEncTable";for(;d--;)c[s++]=0;s--}}!function(e){for(var t=0;t<=58;++t)i[t]=0;for(var t=0;t<65537;++t)i[e[t]]+=1;for(var r=0,t=58;t>0;--t){var n=r+i[t]>>1;i[t]=r,r=n}for(var t=0;t<65537;++t){var a=e[t];a>0&&(e[t]=a|i[a]++<<6)}}(c)}(e,0,c,v,m,f,g),p>8*(u-(c.value-d)))throw"Something wrong with hufUncompress";!function(e,t,r,i){for(;t<=r;t++){var n=e[t]>>6,a=63&e[t];if(n>>a)throw"Invalid table entry";if(a>14){var o=i[n>>a-14];
1999if(o.len)throw"Invalid table entry";if(o.lit++,o.p){var s=o.p;o.p=Array(o.lit);for(var l=0;l<o.lit-1;++l)o.p[l]=s[l]}else o.p=[,];o.p[o.lit-1]=t}else if(a)for(var c=0,l=1<<14-a;l>0;l--){var o=i[(n<<14-a)+c];if(o.len||o.p)throw"Invalid table entry";o.len=a,o.lit=t,c++}}}(g,m,f,y),function(e,t,r,i,l,c,u,h,A,d){for(var m=0,f=0,p=Math.trunc(l.value+(c+7)/8);l.value<p;)for(a(m,f,r,l),m=n.c,f=n.lc;f>=14;){var g=t[m>>f-14&16383];if(g.len)f-=g.len,s(g.lit,u,m,f,r,i,l,A,d,h),m=o.c,f=o.lc;else{if(!g.p)throw"hufDecode issues";for(y=0;y<g.lit;y++){for(var y,v=63&e[g.p[y]];f<v&&l.value<p;)a(m,f,r,l),m=n.c,f=n.lc;if(f>=v&&e[g.p[y]]>>6==(m>>f-v&(1<<v)-1)){f-=v,s(g.p[y],u,m,f,r,i,l,A,d,h),m=o.c,f=o.lc;break}}if(y==g.lit)throw"hufDecode issues"}}var E=8-c&7;for(m>>=E,f-=E;f>0;){var g=t[m<<14-f&16383];if(g.len)f-=g.len,s(g.lit,u,m,f,r,i,l,A,d,h),m=o.c,f=o.lc;else throw"hufDecode issues"}}(g,y,e,l,c,p,f,A,h,{value:0})}function d(e){for(var t=1;t<e.length;t++){var r=e[t-1]+e[t]-128;e[t]=r}}function m(e,t){for(var r=0,i=Math.floor((e.length+1)/2),n=0,a=e.length-1;!(n>a)&&(t[n++]=e[r++],!(n>a));)t[n++]=e[i++]}function f(e){for(var t=e.byteLength,r=[],i=0,n=new DataView(e);t>0;){var a=n.getInt8(i++);if(a<0){var o=-a;t-=o+1;for(var s=0;s<o;s++)r.push(n.getUint8(i++))}else{var o=a;t-=2;for(var l=n.getUint8(i++),s=0;s<o+1;s++)r.push(l)}}return r}function p(e){return new DataView(e.array.buffer,e.offset.value,e.size)}function g(e){var t=new Uint8Array(f(e.viewer.buffer.slice(e.offset.value,e.offset.value+e.size))),r=new Uint8Array(t.length);return d(t),m(t,r),new DataView(r.buffer)}function y(e){var t=h2(e.array.slice(e.offset.value,e.offset.value+e.size)),r=new Uint8Array(t.length);return d(t),m(t,r),new DataView(r.buffer)}function v(e){for(var t=e.viewer,r={value:e.offset.value},i=new Uint16Array(e.width*e.scanlineBlockSize*(e.channels*e.type)),n=new Uint8Array(8192),a=0,o=Array(e.channels),s=0;s<e.channels;s++)o[s]={},o[s].start=a,o[s].end=o[s].start,o[s].nx=e.width,o[s].ny=e.lines,o[s].size=e.type,a+=o[s].nx*o[s].ny*o[s].size;var l=P(t,r),d=P(t,r);if(d>=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(l<=d)for(var s=0;s<d-l+1;s++)n[s+l]=_(t,r);var m=new Uint16Array(65536),f=function(e,t){for(var r=0,i=0;i<65536;++i)(0==i||e[i>>3]&1<<(7&i))&&(t[r++]=i);for(var n=r-1;r<65536;)t[r++]=0;return n}(n,m),p=B(t,r);A(e.array,t,r,p,i,a);for(var s=0;s<e.channels;++s)for(var g=o[s],y=0;y<o[s].size;++y)!function(e,t,r,i,n,a,o){for(var s=o<16384,l=r>n?n:r,A=1;A<=l;)A<<=1;for(A>>=1,d=A,A>>=1;A>=1;){for(var d,m,f,p,g,y=0,v=0+a*(n-d),E=a*A,x=a*d,C=i*A,w=i*d;y<=v;y+=x){for(var B=y,I=y+i*(r-d);B<=I;B+=w){var _=B+C,b=B+E,M=b+C;s?(u(e[B+t],e[b+t]),m=c.a,p=c.b,u(e[_+t],e[M+t]),f=c.a,g=c.b,u(m,f),e[B+t]=c.a,e[_+t]=c.b,u(p,g)):(h(e[B+t],e[b+t]),m=c.a,p=c.b,h(e[_+t],e[M+t]),f=c.a,g=c.b,h(m,f),e[B+t]=c.a,e[_+t]=c.b,h(p,g)),e[b+t]=c.a,e[M+t]=c.b}if(r&A){var b=B+E;s?u(e[B+t],e[b+t]):h(e[B+t],e[b+t]),m=c.a,e[b+t]=c.b,e[B+t]=m}}if(n&A)for(var B=y,I=y+i*(r-d);B<=I;B+=w){var _=B+C;s?u(e[B+t],e[_+t]):h(e[B+t],e[_+t]),m=c.a,e[_+t]=c.b,e[B+t]=m}d=A,A>>=1}}(i,g.start+y,g.nx,g.size,g.ny,g.nx*g.size,f);!function(e,t,r){for(var i=0;i<r;++i)t[i]=e[t[i]]}(m,i,a);for(var v=0,E=new Uint8Array(i.buffer.byteLength),x=0;x<e.lines;x++)for(var C=0;C<e.channels;C++){var g=o[C],w=g.nx*g.size,I=new Uint8Array(i.buffer,2*g.end,2*w);E.set(I,v),v+=2*w,g.end+=w}return new DataView(E.buffer)}function E(e){var t=h2(e.array.slice(e.offset.value,e.offset.value+e.size));let r=e.lines*e.channels*e.width,i=1==e.type?new Uint16Array(r):new Uint32Array(r),n=0,a=0,o=[,,,,];for(let r=0;r<e.lines;r++)for(let r=0;r<e.channels;r++){let r=0;switch(e.type){case 1:o[0]=n,o[1]=o[0]+e.width,n=o[1]+e.width;for(let n=0;n<e.width;++n)r+=t[o[0]++]<<8|t[o[1]++],i[a]=r,a++;break;case 2:o[0]=n,o[1]=o[0]+e.width,o[2]=o[1]+e.width,n=o[2]+e.width;for(let n=0;n<e.width;++n)r+=t[o[0]++]<<24|t[o[1]++]<<16|t[o[2]++]<<8,i[a]=r,a++}}return new DataView(i.buffer)}function x(e){var t=e.viewer,r={value:e.offset.value},i=new Uint8Array(e.width*e.lines*(e.channels*e.type*2)),n={version:b(t,r),unknownUncompressedSize:b(t,r),unknownCompressedSize:b(t,r),acCompressedSize:b(t,r),dcCompressedSize:b(t,r),rleCompressedSize:b(t,r),rleUncompressedSize:b(t,r),rleRawSize:b(t,r),totalAcUncompressedCount:b(t,r),totalDcUncompressedCount:b(t,r),acCompression:b(t,r)};if(n.version<2)throw"EXRLoader.parse: "+z.compression+" version "+n.version+" is unsupported";for(var a=[],o=P(t,r)-2;o>0;){var s=C(t.buffer,r),l=_(t,r),c=l>>2&3,u=new Int8Array([(l>>4)-1])[0],h=_(t,r);a.push({name:s,index:u,type:h,compression:c}),o-=s.length+3}for(var d=z.channels,m=Array(e.channels),p=0;p<e.channels;++p){var g=m[p]={},v=d[p];g.name=v.name,g.compression=0,g.decoded=!1,g.type=v.pixelType,g.pLinear=v.pLinear,g.width=e.width,g.height=e.lines}for(var E={idx:[,,,]},x=0;x<e.channels;++x)for(var g=m[x],p=0;p<a.length;++p){var w=a[p];g.name==w.name&&(g.compression=w.compression,w.index>=0&&(E.idx[w.index]=x),g.offset=x)}if(n.acCompressedSize>0)switch(n.acCompression){case 0:var B=new Uint16Array(n.totalAcUncompressedCount);A(e.array,t,r,n.acCompressedSize,B,n.totalAcUncompressedCount);break;case 1:var I=e.array.slice(r.value,r.value+n.totalAcUncompressedCount),M=h2(I),B=new Uint16Array(M.buffer);r.value+=n.totalAcUncompressedCount}if(n.dcCompressedSize>0){var S=new Uint16Array(y({array:e.array,offset:r,size:n.dcCompressedSize}).buffer);r.value+=n.dcCompressedSize}if(n.rleRawSize>0){var I=e.array.slice(r.value,r.value+n.rleCompressedSize),M=h2(I),T=f(M.buffer);r.value+=n.rleCompressedSize}for(var R=0,F=Array(m.length),p=0;p<F.length;++p)F[p]=[];for(var Q=0;Q<e.lines;++Q)for(var k=0;k<m.length;++k)F[k].push(R),R+=m[k].width*e.type*2;!function(e,t,r,i,n,a){var o=new DataView(a.buffer),s=r[e.idx[0]].width,l=r[e.idx[0]].height,c=Math.floor(s/8),u=Math.ceil(s/8),h=Math.ceil(l/8),A=s-(u-1)*8,d=l-(h-1)*8,m={value:0},f=[,,,],p=[,,,],g=[,,,],y=[,,,],v=[,,,];for(let r=0;r<3;++r)v[r]=t[e.idx[r]],f[r]=r<1?0:f[r-1]+u*h,p[r]=new Float32Array(64),g[r]=new Uint16Array(64),y[r]=new Uint16Array(64*u);for(let t=0;t<h;++t){var E,x,C=8;t==h-1&&(C=d);var w=8;for(let e=0;e<u;++e){e==u-1&&(w=A);for(let e=0;e<3;++e)g[e].fill(0),g[e][0]=n[f[e]++],function(e,t,r){for(var i,n=1;n<64;)65280==(i=t[e.value])?n=64:i>>8==255?n+=255&i:(r[n]=i,n++),e.value++}(m,i,g[e]),E=g[e],(x=p[e])[0]=D(E[0]),x[1]=D(E[1]),x[2]=D(E[5]),x[3]=D(E[6]),x[4]=D(E[14]),x[5]=D(E[15]),x[6]=D(E[27]),x[7]=D(E[28]),x[8]=D(E[2]),x[9]=D(E[4]),x[10]=D(E[7]),x[11]=D(E[13]),x[12]=D(E[16]),x[13]=D(E[26]),x[14]=D(E[29]),x[15]=D(E[42]),x[16]=D(E[3]),x[17]=D(E[8]),x[18]=D(E[12]),x[19]=D(E[17]),x[20]=D(E[25]),x[21]=D(E[30]),x[22]=D(E[41]),x[23]=D(E[43]),x[24]=D(E[9]),x[25]=D(E[11]),x[26]=D(E[18]),x[27]=D(E[24]),x[28]=D(E[31]),x[29]=D(E[40]),x[30]=D(E[44]),x[31]=D(E[53]),x[32]=D(E[10]),x[33]=D(E[19]),x[34]=D(E[23]),x[35]=D(E[32]),x[36]=D(E[39]),x[37]=D(E[45]),x[38]=D(E[52]),x[39]=D(E[54]),x[40]=D(E[20]),x[41]=D(E[22]),x[42]=D(E[33]),x[43]=D(E[38]),x[44]=D(E[46]),x[45]=D(E[51]),x[46]=D(E[55]),x[47]=D(E[60]),x[48]=D(E[21]),x[49]=D(E[34]),x[50]=D(E[37]),x[51]=D(E[47]),x[52]=D(E[50]),x[53]=D(E[56]),x[54]=D(E[59]),x[55]=D(E[61]),x[56]=D(E[35]),x[57]=D(E[36]),x[58]=D(E[48]),x[59]=D(E[49]),x[60]=D(E[57]),x[61]=D(E[58]),x[62]=D(E[62]),x[63]=D(E[63]),function(e){let t=.5*Math.cos(3.14159/16),r=.5*Math.cos(3.14159/8),i=.5*Math.cos(3*3.14159/16),n=.5*Math.cos(3*3.14159/8);for(var a=[,,,,],o=[,,,,],s=[,,,,],l=[,,,,],c=0;c<8;++c){var u=8*c;a[0]=r*e[u+2],a[1]=n*e[u+2],a[2]=r*e[u+6],a[3]=n*e[u+6],o[0]=t*e[u+1]+i*e[u+3]+.2777854612564676*e[u+5]+.09754573032714427*e[u+7],o[1]=i*e[u+1]-.09754573032714427*e[u+3]-t*e[u+5]-.2777854612564676*e[u+7],o[2]=.2777854612564676*e[u+1]-t*e[u+3]+.09754573032714427*e[u+5]+i*e[u+7],o[3]=.09754573032714427*e[u+1]-.2777854612564676*e[u+3]+i*e[u+5]-t*e[u+7],s[0]=.35355362513961314*(e[u+0]+e[u+4]),s[3]=.35355362513961314*(e[u+0]-e[u+4]),s[1]=a[0]+a[3],s[2]=a[1]-a[2],l[0]=s[0]+s[1],l[1]=s[3]+s[2],l[2]=s[3]-s[2],l[3]=s[0]-s[1],e[u+0]=l[0]+o[0],e[u+1]=l[1]+o[1],e[u+2]=l[2]+o[2],e[u+3]=l[3]+o[3],e[u+4]=l[3]-o[3],e[u+5]=l[2]-o[2],e[u+6]=l[1]-o[1],e[u+7]=l[0]-o[0]}for(var h=0;h<8;++h)a[0]=r*e[16+h],a[1]=n*e[16+h],a[2]=r*e[48+h],a[3]=n*e[48+h],o[0]=t*e[8+h]+i*e[24+h]+.2777854612564676*e[40+h]+.09754573032714427*e[56+h],o[1]=i*e[8+h]-.09754573032714427*e[24+h]-t*e[40+h]-.2777854612564676*e[56+h],o[2]=.2777854612564676*e[8+h]-t*e[24+h]+.09754573032714427*e[40+h]+i*e[56+h],o[3]=.09754573032714427*e[8+h]-.2777854612564676*e[24+h]+i*e[40+h]-t*e[56+h],s[0]=.35355362513961314*(e[h]+e[32+h]),s[3]=.35355362513961314*(e[h]-e[32+h]),s[1]=a[0]+a[3],s[2]=a[1]-a[2],l[0]=s[0]+s[1],l[1]=s[3]+s[2],l[2]=s[3]-s[2],l[3]=s[0]-s[1],e[0+h]=l[0]+o[0],e[8+h]=l[1]+o[1],e[16+h]=l[2]+o[2],e[24+h]=l[3]+o[3],e[32+h]=l[3]-o[3],e[40+h]=l[2]-o[2],e[48+h]=l[1]-o[1],e[56+h]=l[0]-o[0]}(p[e]);!function(e){for(var t=0;t<64;++t){var r=e[0][t],i=e[1][t],n=e[2][t];e[0][t]=r+1.5747*n,e[1][t]=r-.1873*i-.4682*n,e[2][t]=r+1.8556*i}}(p);for(let t=0;t<3;++t)!function(e,t,r){for(var i,n=0;n<64;++n)t[r+n]=eT.A5E.toHalfFloat((i=e[n])<=1?Math.sign(i)*Math.pow(Math.abs(i),2.2):Math.sign(i)*Math.pow(9.025013291561939,Math.abs(i)-1))}(p[t],y[t],64*e)}let a=0;for(let i=0;i<3;++i){let n=r[e.idx[i]].type;for(let e=8*t;e<8*t+C;++e){a=v[i][e];for(let t=0;t<c;++t){let r=64*t+(7&e)*8;o.setUint16(a+0*n,y[i][r+0],!0),o.setUint16(a+2*n,y[i][r+1],!0),o.setUint16(a+4*n,y[i][r+2],!0),o.setUint16(a+6*n,y[i][r+3],!0),o.setUint16(a+8*n,y[i][r+4],!0),o.setUint16(a+10*n,y[i][r+5],!0),o.setUint16(a+12*n,y[i][r+6],!0),o.setUint16(a+14*n,y[i][r+7],!0),a+=16*n}}if(c!=u)for(let e=8*t;e<8*t+C;++e){let t=v[i][e]+8*c*2*n,r=64*c+(7&e)*8;for(let e=0;e<w;++e)o.setUint16(t+2*e*n,y[i][r+e],!0)}}}for(var B=new Uint16Array(s),o=new DataView(a.buffer),I=0;I<3;
1999++I){r[e.idx[I]].decoded=!0;var _=r[e.idx[I]].type;if(2==r[I].type)for(var b=0;b<l;++b){let e=v[I][b];for(var M=0;M<s;++M)B[M]=o.getUint16(e+2*M*_,!0);for(var M=0;M<s;++M)o.setFloat32(e+2*M*_,D(B[M]),!0)}}}(E,F,m,B,S,i);for(var p=0;p<m.length;++p){var g=m[p];if(!g.decoded){if(2===g.compression)for(var L=0,O=0,Q=0;Q<e.lines;++Q){for(var U=F[p][L],G=0;G<g.width;++G){for(var N=0;N<2*g.type;++N)i[U++]=T[O+N*g.width*g.height];O++}L++}else throw"EXRLoader.parse: unsupported channel compression"}}return new DataView(i.buffer)}function C(e,t){for(var r=new Uint8Array(e),i=0;0!=r[t.value+i];)i+=1;var n=new TextDecoder().decode(r.slice(t.value,t.value+i));return t.value=t.value+i+1,n}function w(e,t){var r=e.getInt32(t.value,!0);return t.value=t.value+4,r}function B(e,t){var r=e.getUint32(t.value,!0);return t.value=t.value+4,r}function I(e,t){var r=e[t.value];return t.value=t.value+1,r}function _(e,t){var r=e.getUint8(t.value);return t.value=t.value+1,r}let b=function(e,t){let r;return"getBigInt64"in DataView.prototype?r=Number(e.getBigInt64(t.value,!0)):r=e.getUint32(t.value+4,!0)+Number(e.getUint32(t.value,!0)<<32),t.value+=8,r};function M(e,t){var r=e.getFloat32(t.value,!0);return t.value+=4,r}function S(e,t){return eT.A5E.toHalfFloat(M(e,t))}function D(e){var t=(31744&e)>>10,r=1023&e;return(e>>15?-1:1)*(t?31===t?r?NaN:1/0:Math.pow(2,t-15)*(1+r/1024):r/1024*6103515625e-14)}function P(e,t){var r=e.getUint16(t.value,!0);return t.value+=2,r}function T(e,t){return D(P(e,t))}let R=new DataView(e),F=new Uint8Array(e),Q={value:0},z=function(e,t,r){let i={};if(20000630!=e.getUint32(0,!0))throw"THREE.EXRLoader: provided file doesn't appear to be in OpenEXR format.";i.version=e.getUint8(4);let n=e.getUint8(5);i.spec={singleTile:!!(2&n),longName:!!(4&n),deepFormat:!!(8&n),multiPart:!!(16&n)},r.value=8;for(var a=!0;a;){var o=C(t,r);if(0==o)a=!1;else{var s=C(t,r),l=B(e,r),c=function(e,t,r,i,n){var a,o,s,l,c;if("string"===i||"stringvector"===i||"iccProfile"===i)return a=new TextDecoder().decode(new Uint8Array(t).slice(r.value,r.value+n)),r.value=r.value+n,a;if("chlist"===i)return function(e,t,r,i){for(var n=r.value,a=[];r.value<n+i-1;){var o=C(t,r),s=w(e,r),l=_(e,r);r.value+=3;var c=w(e,r),u=w(e,r);a.push({name:o,pixelType:s,pLinear:l,xSampling:c,ySampling:u})}return r.value+=1,a}(e,t,r,n);if("chromaticities"===i)return o=M(e,r),s=M(e,r),l=M(e,r),c=M(e,r),{redX:o,redY:s,greenX:l,greenY:c,blueX:M(e,r),blueY:M(e,r),whiteX:M(e,r),whiteY:M(e,r)};if("compression"===i)return["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"][_(e,r)];if("box2i"===i)return{xMin:B(e,r),yMin:B(e,r),xMax:B(e,r),yMax:B(e,r)};if("lineOrder"===i)return["INCREASING_Y"][_(e,r)];if("float"===i)return M(e,r);else if("v2f"===i)return[M(e,r),M(e,r)];else if("v3f"===i)return[M(e,r),M(e,r),M(e,r)];else if("int"===i)return w(e,r);else if("rational"===i)return[w(e,r),B(e,r)];else if("timecode"===i)return[B(e,r),B(e,r)];else return"preview"===i?(r.value+=n,"skipped"):void(r.value+=n)}(e,t,r,s,l);void 0===c?console.warn(`EXRLoader.parse: skipped unknown header attribute type '${s}'.`):i[o]=c}}if((-5&n)!=0)throw console.error("EXRHeader:",i),"THREE.EXRLoader: provided file is currently unsupported.";return i}(R,e,Q),k=function(e,t,r,i,n){let a={size:0,viewer:t,array:r,offset:i,width:e.dataWindow.xMax-e.dataWindow.xMin+1,height:e.dataWindow.yMax-e.dataWindow.yMin+1,channels:e.channels.length,bytesPerLine:null,lines:null,inputSize:null,type:e.channels[0].pixelType,uncompress:null,getter:null,format:null,[p7?"colorSpace":"encoding"]:null};switch(e.compression){case"NO_COMPRESSION":a.lines=1,a.uncompress=p;break;case"RLE_COMPRESSION":a.lines=1,a.uncompress=g;break;case"ZIPS_COMPRESSION":a.lines=1,a.uncompress=y;break;case"ZIP_COMPRESSION":a.lines=16,a.uncompress=y;break;case"PIZ_COMPRESSION":a.lines=32,a.uncompress=v;break;case"PXR24_COMPRESSION":a.lines=16,a.uncompress=E;break;case"DWAA_COMPRESSION":a.lines=32,a.uncompress=x;break;case"DWAB_COMPRESSION":a.lines=256,a.uncompress=x;break;default:throw"EXRLoader.parse: "+e.compression+" is unsupported"}if(a.scanlineBlockSize=a.lines,1==a.type)switch(n){case eT.VzW:a.getter=T,a.inputSize=2;break;case eT.cLu:a.getter=P,a.inputSize=2}else if(2==a.type)switch(n){case eT.VzW:a.getter=M,a.inputSize=4;break;case eT.cLu:a.getter=S,a.inputSize=4}else throw"EXRLoader.parse: unsupported pixelType "+a.type+" for "+e.compression+".";a.blockCount=(e.dataWindow.yMax+1)/a.scanlineBlockSize;for(var o=0;o<a.blockCount;o++)b(t,i);a.outputChannels=3==a.channels?4:a.channels;let s=a.width*a.height*a.outputChannels;switch(n){case eT.VzW:a.byteArray=new Float32Array(s),a.channels<a.outputChannels&&a.byteArray.fill(1,0,s);break;case eT.cLu:a.byteArray=new Uint16Array(s),a.channels<a.outputChannels&&a.byteArray.fill(15360,0,s);break;default:console.error("THREE.EXRLoader: unsupported type: ",n)}
1999return a.bytesPerLine=a.width*a.inputSize*a.channels,4==a.outputChannels?a.format=eT.wk1:a.format=eT.hEm,p7?a.colorSpace="srgb-linear":a.encoding=3e3,a}(z,R,F,Q,this.type),L={value:0},O={R:0,G:1,B:2,A:3,Y:0};for(let e=0;e<k.height/k.scanlineBlockSize;e++){let t=B(R,Q);k.size=B(R,Q),k.lines=t+k.scanlineBlockSize>k.height?k.height-t:k.scanlineBlockSize;let r=k.size<k.lines*k.bytesPerLine?k.uncompress(k):p(k);Q.value+=k.size;for(let t=0;t<k.scanlineBlockSize;t++){let i=t+e*k.scanlineBlockSize;if(i>=k.height)break;for(let e=0;e<k.channels;e++){let n=O[z.channels[e].name];for(let a=0;a<k.width;a++){L.value=(k.channels*k.width*t+e*k.width+a)*k.inputSize;let o=(k.height-1-i)*(k.width*k.outputChannels)+a*k.outputChannels+n;k.byteArray[o]=k.getter(r,L)}}}}return{header:z,width:k.width,height:k.height,data:k.byteArray,format:k.format,[p7?"colorSpace":"encoding"]:k[p7?"colorSpace":"encoding"],type:this.type}}setDataType(e){return this.type=e,this}load(e,t,r,i){return super.load(e,function(e,r){p7?e.colorSpace=r.colorSpace:e.encoding=r.encoding,e.minFilter=eT.wem,e.magFilter=eT.wem,e.generateMipmaps=!1,e.flipY=!1,t&&t(e,r)},r,i)}}let gt=(e,t,r)=>{let i;switch(e){case eT.ywz:i=new Uint8ClampedArray(t*r*4);break;case eT.cLu:i=new Uint16Array(t*r*4);break;case eT.JQ4:i=new Uint32Array(t*r*4);break;case eT.T95:i=new Int8Array(t*r*4);break;case eT.iAb:i=new Int16Array(t*r*4);break;case eT.Kz5:i=new Int32Array(t*r*4);break;case eT.VzW:i=new Float32Array(t*r*4);break;default:throw Error("Unsupported data type")}return i},gr=(e,t,r,i)=>{if(void 0!==N)return N;let n=new eT.dd2(1,1,i);t.setRenderTarget(n);let a=new eT.Kj0(new eT._12,new eT.vBJ({color:16777215}));t.render(a,r),t.setRenderTarget(null);let o=gt(e,n.width,n.height);return t.readRenderTargetPixels(n,0,0,n.width,n.height,o),n.dispose(),a.geometry.dispose(),a.material.dispose(),N=0!==o[0]};class gi{constructor(e){var t,r,i,n,a,o,s,l,c,u,h,A,d,m,f,p;this._rendererIsDisposable=!1,this._supportsReadPixels=!0,this.render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)},this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace
1999=e.colorSpace;let g={format:eT.wk1,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:(null===(t=e.renderTargetOptions)||void 0===t?void 0:t.anisotropy)!==void 0?null===(r=e.renderTargetOptions)||void 0===r?void 0:r.anisotropy:1,generateMipmaps:(null===(i=e.renderTargetOptions)||void 0===i?void 0:i.generateMipmaps)!==void 0&&(null===(n=e.renderTargetOptions)||void 0===n?void 0:n.generateMipmaps),magFilter:(null===(a=e.renderTargetOptions)||void 0===a?void 0:a.magFilter)!==void 0?null===(o=e.renderTargetOptions)||void 0===o?void 0:o.magFilter:eT.wem,minFilter:(null===(s=e.renderTargetOptions)||void 0===s?void 0:s.minFilter)!==void 0?null===(l=e.renderTargetOptions)||void 0===l?void 0:l.minFilter:eT.wem,samples:(null===(c=e.renderTargetOptions)||void 0===c?void 0:c.samples)!==void 0?null===(u=e.renderTargetOptions)||void 0===u?void 0:u.samples:void 0,wrapS:(null===(h=e.renderTargetOptions)||void 0===h?void 0:h.wrapS)!==void 0?null===(A=e.renderTargetOptions)||void 0===A?void 0:A.wrapS:eT.uWy,wrapT:(null===(d=e.renderTargetOptions)||void 0===d?void 0:d.wrapT)!==void 0?null===(m=e.renderTargetOptions)||void 0===m?void 0:m.wrapT:eT.uWy};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=gi.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new eT.xsS,this._camera=new eT.iKG,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!gr(this._type,this._renderer,this._camera,g)){let e;this._type===eT.cLu&&(e=this._renderer.extensions.has("EXT_color_buffer_float")?eT.VzW:void 0),void 0!==e?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${eT.VzW}`),this._type=e):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new eT.Kj0(new eT._12,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new eT.dd2(this.width,this.height,g),this._renderTarget.texture.mapping=(null===(f=e.renderTargetOptions)||void 0===f?void 0:f.mapping)!==void 0?null===(p=e.renderTargetOptions)||void 0===p?void 0:p.mapping:eT.xfE}static instantiateRenderer(){let e=new aQ.WebGLRenderer;return e.setSize(128,128),e}toArray(){if(!this._supportsReadPixels)throw Error("Can't read pixels in this browser");let e=gt(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){let t=new eT.IEO(this.toArray(),this.width,this.height,eT.wk1,this._type,(null==e?void 0:e.mapping)||eT.xfE,(null==e?void 0:e.wrapS)||eT.uWy,(null==e?void 0:e.wrapT)||eT.uWy,(null==e?void 0:e.magFilter)||eT.wem,(null==e?void 0:e.minFilter)||eT.wem,(null==e?void 0:e.anisotropy)||1,eT.GUF);return t.generateMipmaps=(null==e?void 0:e.generateMipmaps)!==void 0&&(null==e?void 0:e.generateMipmaps),t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof eT.jyz&&Object.values(this.material.uniforms).forEach(e=>{e.value instanceof eT.xEZ&&e.value.dispose()}),Object.values(this.material).forEach(e=>{e instanceof eT.xEZ&&e.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}let gn=`
2000varying vec2 vUv;
2001
2002void main() {
2003  vUv = uv;
2004  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0
2004);
2005}
2006`,ga=`
2007// min half float value
2008#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )
2009// max half float value
2010#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )
2011
2012uniform sampler2D sdr;
2013uniform sampler2D gainMap;
2014uniform vec3 gamma;
2015uniform vec3 offsetHdr;
2016uniform vec3 offsetSdr;
2017uniform vec3 gainMapMin;
2018uniform vec3 gainMapMax;
2019uniform float weightFactor;
2020
2021varying vec2 vUv;
2022
2023void main() {
2024  vec3 rgb = texture2D( sdr, vUv ).rgb;
2025  vec3 recovery = texture2D( gainMap, vUv ).rgb;
2026  vec3 logRecovery = pow( recovery, gamma );
2027  vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;
2028  vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;
2029  vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));
2030  gl_FragColor = vec4( clampedHdrColor , 1.0 );
2031}
2032`;class go extends eT.jyz{constructor({gamma:e,offsetHdr:t,offsetSdr:r,gainMapMin:i,gainMapMax:n,maxDisplayBoost:a,hdrCapacityMin:o,hdrCapacityMax:s,sdr:l,gainMap:c}){super({name:"GainMapDecoderMaterial",vertexShader:gn,fragmentShader:ga,uniforms:{sdr:{value:l},gainMap:{value:c},gamma:{value:new eT.Pa4(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new eT.Pa4().fromArray(t)},offsetSdr:{value:new eT.Pa4().fromArray(r)},gainMapMin:{value:new eT.Pa4().fromArray(i)},gainMapMax:{value:new eT.Pa4().fromArray(n)},weightFactor:{value:(Math.log2(a)-o)/(s-o)}},blending:eT.jFi,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=a,this._hdrCapacityMin=o,this._hdrCapacityMax=s,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){let e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){let t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){let e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class gs extends Error{}class gl extends Error{}let gc=(e,t,r)=>{let i=RegExp(`${t}="([^"]*)"`,"i").exec(e);if(i)return i[1];let n=RegExp(`<${t}[^>]*>([\\s\\S]*?)</${t}>`,"i").exec(e);if(n){let e=n[1].match(/<rdf:li>([^<]*)<\/rdf:li>/g);return e&&3===e.length?e.map(e=>e.replace(/<\/?rdf:li>/g,"")):n[1].trim()}if(void 0!==r)return r;throw Error(`Can't find ${t} in gainmap metadata`)},gu=e=>{let t;"undefined"!=typeof TextDecoder?t=new TextDecoder().decode(e):t=e.toString();let r=t.indexOf("<x:xmpmeta");for(;-1!==r;){let e=t.indexOf("x:xmpmeta>",r),i=t.slice(r,e+10);try{let e=gc(i,"hdrgm:GainMapMin","0"),t=gc(i,"hdrgm:GainMapMax"),r=gc(i,"hdrgm:Gamma","1"),n=gc(i,"hdrgm:OffsetSDR","0.015625"),a=gc(i,"hdrgm:OffsetHDR","0.015625"),o=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(i),s=o?o[1]:"0",l=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(i);if(!l)throw Error("Incomplete gainmap metadata");let c=l[1];return{gainMapMin:Array.isArray(e)?e.map(e=>parseFloat(e)):[parseFloat(e),parseFloat(e),parseFloat(e)],gainMapMax:Array.isArray(t)?t.map(e=>parseFloat(e)):[parseFloat(t),parseFloat(t),parseFloat(t)],gamma:Array.isArray(r)?r.map(e=>parseFloat(e)):[parseFloat(r),parseFloat(r),parseFloat(r)],offsetSdr:Array.isArray(n)?n.map(e=>parseFloat(e)):[parseFloat(n),parseFloat(n),parseFloat(n)],offsetHdr:Array.isArray(a)?a.map(e=>parseFloat(e)):[parseFloat(a),parseFloat(a),parseFloat(a)],hdrCapacityMin:parseFloat(s),hdrCapacityMax:p
2032arseFloat(c)}}catch(e){}r=t.indexOf("<x:xmpmeta",e)}};class gh{constructor(e){this.options={debug:!!e&&void 0!==e.debug&&e.debug,extractFII:!e||void 0===e.extractFII||e.extractFII,extractNonFII:!e||void 0===e.extractNonFII||e.extractNonFII}}extract(e){return new Promise((t,r)=>{let i;let n=this.options.debug,a=new DataView(e.buffer);if(65496!==a.getUint16(0)){r(Error("Not a valid jpeg"));return}let o=a.byteLength,s=2,l=0;for(;s<o;){if(++l>250){r(Error(`Found no marker after ${l} loops 😵`));return}if(255!==a.getUint8(s)){r(Error(`Not a valid marker at offset 0x${s.toString(16)}, found: 0x${a.getUint8(s).toString(16)}`));return}if(i=a.getUint8(s+1),n&&console.log(`Marker: ${i.toString(16)}`),226===i){n&&console.log("Found APP2 marker (0xffe2)");let e=s+4;if(1297106432===a.getUint32(e)){let i;let n=e+4;if(18761===a.getUint16(n))i=!1;else if(19789===a.getUint16(n))i=!0;else{r(Error("No valid endianness marker found in TIFF header"));return}if(42!==a.getUint16(n+2,!i)){r(Error("Not valid TIFF data! (no 0x002A marker)"));return}let o=a.getUint32(n+4,!i);if(o<8){r(Error("Not valid TIFF data! (First offset less than 8)"));return}let s=n+o,l=a.getUint16(s,!i),c=s+2,u=0;for(let e=c;e<c+12*l;e+=12)45057===a.getUint16(e,!i)&&(u=a.getUint32(e+8,!i));let h=s+2+12*l+4,A=[];for(let e=h;e<h+16*u;e+=16){let t={MPType:a.getUint32(e,!i),size:a.getUint32(e+4,!i),dataOffset:a.getUint32(e+8,!i),dependantImages:a.getUint32(e+12,!i),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=n+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,A.push(t)}if(this.options.extractNonFII&&A.length){let e=new Blob([a]),r=[];for(let t of A){if(t.isFII&&!this.options.extractFII)continue;let i=e.slice(t.start,t.end+1,"image/jpeg");r.push(i)}t(r)}}}s+=2+a.getUint16(s+2)}})}}let gA=async e=>{let t=gu(e);if(!t)throw new gl("Gain map XMP metadata not found");let r=new gh({extractFII:!0,extractNonFII:!0}),i=await r.extract(e);if(2!==i.length)throw new gs("Gain map recovery image not found");return{sdr:new Uint8Array(await i[0].arrayBuffer()),gainMap:new Uint8Array(await i[1].arrayBuffer()),metadata:t}},gd=e=>new Promise((t,r)=>{let i=document.createElement("img");i.onload=()=>{t(i)},i.onerror=e=>{r(e)},i.src=URL.createObjectURL(e)});class gm extends eT.aNw{constructor(e,t){super(t),e&&(this._renderer=e),this._internalLoadingManager=new eT.lLk}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: An existing WebGL Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");let e=new go({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new eT.xEZ,sdr:new eT.xEZ});return new gi({width:16,height:16,type:eT.cLu,colorSpace:eT.GUF,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async render(e,t,r,i){let n,a;let o=i?new Blob([i],{type:"image/jpeg"}):void 0,s=new Blob([r],{type:"image/jpeg"}),l=!1;if("undefined"==typeof createImageBitmap){let e=await Promise.all([o?gd(o):Promise.resolve(void 0),gd(s)]);a=e[0],n=e[1],l=!0}else{let e=await Promise.all([o?createImageBitmap(o,{imageOrientation:"flipY"}):Promise.resolve(void 0),createImageBitmap(s,{imageOrientation:"flipY"})]);a=e[0],n=e[1]}let c=new eT.xEZ(a||new ImageData(2,2),eT.xfE,eT.uWy,eT.uWy,eT.wem,eT.FDw,eT.wk1,eT.ywz,1,eT.GUF);c.flipY=l,c.needsUpdate=!0;let u=new eT.xEZ(n,eT.xfE,eT.uWy,eT.uWy,eT.wem,eT.FDw,eT.wk1,eT.ywz,1,eT.KI_);u.flipY=l,u.needsUpdate=!0,e.width=n.width,e.height=n.height,e.material.gainMap=c,e.material.sdr=u,e.material.gainMapMin=t.gainMapMin,e.material.gainMapMax=t.gainMapMax,e.material.offsetHdr=t.offsetHdr,e.material.offsetSdr=t.offsetSdr,e.material.gamma=t.gamma,e.material.hdrCapacityMin=t.hdrCapacityMin,e.material.hdrCapacityMax=t.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,t.hdrCapacityMax),e.material.needsUpdate=!0,e.render()}}class gf extends gm{load([e,t,r],i,n,a){let o,s,l;let c=this.prepareQuadRenderer(),u=async()=>
2032{if(o&&s&&l){try{await this.render(c,l,o,s)}catch(i){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(r),"function"==typeof a&&a(i),c.disposeOnDemandRenderer();return}"function"==typeof i&&i(c),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(r),c.disposeOnDemandRenderer()}},h=!0,A=0,d=0,m=!0,f=0,p=0,g=!0,y=0,v=0,E=()=>{"function"==typeof n&&n(new ProgressEvent("progress",{lengthComputable:h&&m&&g,loaded:d+p+v,total:A+f+y}))};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(r);let x=new eT.hH6(this._internalLoadingManager);x.setResponseType("arraybuffer"),x.setRequestHeader(this.requestHeader),x.setPath(this.path),x.setWithCredentials(this.withCredentials),x.load(e,async e=>{if("string"==typeof e)throw Error("Invalid sdr buffer");o=e,await u()},e=>{h=e.lengthComputable,d=e.loaded,A=e.total,E()},t=>{this.manager.itemError(e),"function"==typeof a&&a(t)});let C=new eT.hH6(this._internalLoadingManager);C.setResponseType("arraybuffer"),C.setRequestHeader(this.requestHeader),C.setPath(this.path),C.setWithCredentials(this.withCredentials),C.load(t,async e=>{if("string"==typeof e)throw Error("Invalid gainmap buffer");s=e,await u()},e=>{m=e.lengthComputable,p=e.loaded,f=e.total,E()},e=>{this.manager.itemError(t),"function"==typeof a&&a(e)});let w=new eT.hH6(this._internalLoadingManager);return w.setRequestHeader(this.requestHeader),w.setPath(this.path),w.setWithCredentials(this.withCredentials),w.load(r,async e=>{if("string"!=typeof e)throw Error("Invalid metadata string");l=JSON.parse(e),await u()},e=>{g=e.lengthComputable,v=e.loaded,y=e.total,E()},e=>{this.manager.itemError(r),"function"==typeof a&&a(e)}),c}}class gp extends gm{load(e,t,r,i){let n=this.prepareQuadRenderer(),a=new eT.hH6(this._internalLoadingManager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(this.withCredentials),this.manager.itemStart(e),a.load(e,async r=>{let a,o,s;if("string"==typeof r)throw Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");let l=new Uint8Array(r);try{let e=await gA(l);a=e.sdr,o=e.gainMap,s=e.metadata}catch(t){if(t instanceof gl||t instanceof gs)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),s={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},a=l;else throw t}try{await this.render(n,s,a,o)}catch(t){this.manager.itemError(e),"function"==typeof i&&i(t),n.disposeOnDemandRenderer();return}"function"==typeof t&&t(n),this.manager.itemEnd(e),n.disposeOnDemandRenderer()},r,t=>{this.manager.itemError(e),"function"==typeof i&&i(t)}),n}}let gg={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},gy="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",gv=e=>Array.isArray(e),gE=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function gx({files:e=gE,path:t="",preset:r,encoding:i,extensions:n}={}){let a=null,o=!1;r&&(gB(r),e=gg[r],t=gy),o=gv(e);let{extension:s,isCubemap:l}=gI(e);if(!(a=g_(s)))throw Error("useEnvironment: Unrecognized file extension: "+e);let c=(0,eR.D)(e=>e.gl);(0,eD.useLayoutEffect)(()=>{("webp"===s||"jpg"===s||"jpeg"===s)&&c.domElement.addEventListener("webglcontextlost",function(){eR.H.clear(a,o?[e]:e)},{once:!0})},[e,c.domElement]);let u=(0,eR.H)(a,o?[e]:e,e=>{("webp"===s||"jpg"===s||"jpeg"===s)&&e.setRenderer(c),null==e.setPath||e.setPath(t),n&&n(e)}),h=o?u[0]:u;if("jpg"===s||"jpeg"===s||"webp"===s){var A;h=null==(A=h.renderTarget)?void 0:A.texture}return h.mapping=l?eT.fY$:eT.dSO,"colorSpace"in h?h.colorSpace=(null!=i?i:l)?"srgb":"srgb-linear":h.encoding=(null!=i?i:l)?fB.kn:fB.rn,h}let gC={files:gE,path:"",preset:void 0,extensions:void 0};gx.preload=e=>{let t={...gC,...e},{files:r,path:i=""}=t,{preset:n,extensions:a}=t;n&&(gB(n),r=gg[n],i=gy);let{extension:o}=gI(r);if("webp"===o||"jpg"===o||"jpeg"===o)throw Error("useEnvironment: Preloading gainmaps is not supported");let s=g_(o);if(!s)throw Error("useEnvironment: Unrecognized file extension: "+r);eR.H.preload(s,gv(r)?[r]:r,e=>{null==e.setPath||e.setPath(i),a&&a(e)})};let gw={files:gE,preset:void 0};function gB(e){if(!(e in gg))throw Error("Preset must be one of: "+Object.keys(gg).join(", "))}function gI(e){var t;let r=gv(e)&&6===e.length,i=gv(e)&&3===e.length&&e.some(e=>e.endsWith("json")),n=gv(e)?e[0]:e;return{extension:r?"cube":i?"webp":n.startsWith("data:application/exr")?"exr":n.startsWith("data:application/hdr")?"hdr":n.startsWith("data:image/jpeg")?"jpg":null==(t=n.split(".").pop())||null==(t=t.split("?"))||null==(t=t.shift())?void 0:t.toLowerCase(),isCubemap:r,isGainmap:i}}function g_(e){return"cube"===e?eT.cBK:"hdr"===e?p9:"exr"===e?ge:"jpg"===e||"jpeg"===e?gp:"webp"===e?gf:null}gx.clear=e=>{let t={...gw,...e},{files:r}=t,{preset:i}=t;i&&(gB(i),r=gg[i]);let{extension:n}=gI(r),a=g_(n);if(!a)throw Error("useEnvironment: Unrecognized file extension: "+r);eR.H.clear(a,gv(r)?[r]:r)};let gb=e=>e.current&&e.current.isScene,gM=e=>gb(e)?e.current:e;function gS(e,t,r,i,n={}){var a,o,s,l;n={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...n};let c=gM(t||r),u=c.background,h=c.environment,A={backgroundBlurriness:c.backgroundBlurriness,backgroundIntensity:c.backgroundIntensity,backgroundRotation:null!==(a=null==(o=c.backgroundRotation)||null==o.clone?void 0:o.clone())&&void 0!==a?a:[0,0,0],environmentIntensity:c.environmentIntensity,environmentRotation:null!==(s=null==(l=c.environmentRotation)||null==l.clone?void 0:l.clone())&&void 0!==s?s:[0,0,0]};return"only"!==e&&(c.environment=i),e&&(c.background=i),(0,eR.k)(c,n),()=>{"only"!==e&&(c.environment=h),e&&(c.background=u),(0,eR.k)(c,A)}}function gD({scene:e,background:t=!1,map:r,...i}){let n=(0,eR.D)(e=>e.scene);return eD.useLayoutEffect(()=>{if(r)return gS(t,e,n,r,i)}),null}function gP({background:e=!1,scene:t,blur:r,backgroundBlurriness:i,backgroundIntensity:n,backgroundRotation:a,environmentIntensity:o,environmentRotation:s,...l}){let c=gx(l),u=(0,eR.D)(e=>e.scene);return eD.useLayoutEffect(()=>gS(e,t,u,c,{backgroundBlurriness:null!=r?r:i,backgroundIntensity:n,backgroundRotation:a,environmentIntensity:o,environmentRotation:s})),eD.useEffect(()=>()=>{c.dispose()},[c]),null}function gT({children:e,near:t=.1,far:r=1e3,resolution:i=256,frames:n=1,map:a,background:o=!1,blur:s,backgroundBlurriness:l,backgroundIntensity:c,backgroundRotation:u,environmentIntensity:h,environmentRotation:A,scene:d,files:m,path:f,preset:p,extensions:g}){let y=(0,eR.D)(e=>e.gl),v=(0,eR.D)(e=>e.scene),E=eD.useRef(null),[x]=eD.useState(()=>new eT.xsS),C=eD.useMemo(()=>{let e=new eT.oAp(i);return e.texture.type=eT.cLu,e},[i]);eD.useEffect(()=>()=>{C.dispose()},[C]),eD.useLayoutEffect(()=>{if(1===n){let e=y.autoClear;y.autoClear=!0,E.current.update(y,x),y.autoClear=e}return gS(o,d,v,C.texture,{backgroundBlurriness:null!=s?s:l,backgroundIntensity:c,backgroundRotation:u,environmentIntensity:h,environmentRotation:A})},[e,x,C.texture,d,v,o,n,y]);let w=1;return(0,eR.F)(()=>
2032{if(n===1/0||w<n){let e=y.autoClear;y.autoClear=!0,E.current.update(y,x),y.autoClear=e,w++}}),eD.createElement(eD.Fragment,null,(0,eR.h)(eD.createElement(eD.Fragment,null,e,eD.createElement("cubeCamera",{ref:E,args:[t,r,C]}),m||p?eD.createElement(gP,{background:!0,files:m,preset:p,path:f,extensions:g}):a?eD.createElement(gD,{background:!0,map:a,extensions:g}):null),x))}function gR(e){var t,r,i,n;let a=gx(e),o=e.map||a;eD.useMemo(()=>(0,eR.e)({GroundProjectedEnvImpl:p8}),[]),eD.useEffect(()=>()=>{a.dispose()},[a]);let s=eD.useMemo(()=>[o],[o]),l=null==(t=e.ground)?void 0:t.height,c=null==(r=e.ground)?void 0:r.radius,u=null!==(i=null==(n=e.ground)?void 0:n.scale)&&void 0!==i?i:1e3;return eD.createElement(eD.Fragment,null,eD.createElement(gD,(0,eS.Z)({},e,{map:o})),eD.createElement("groundProjectedEnvImpl",{args:s,scale:u,height:l,radius:c}))}function gF(e){return e.ground?eD.createElement(gR,e):e.map?eD.createElement(gD,e):e.children?eD.createElement(gT,e):eD.createElement(gP,e)}let gQ={uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:`
2033      varying vec2 vUv;
2034
2035      void main() {
2036
2037        vUv = uv;
2038        gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
2039
2040      }
2041  `,fragmentShader:`
2042    uniform sampler2D tDiffuse;
2043    uniform float h;
2044
2045    varying vec2 vUv;
2046
2047    void main() {
2048
2049    	vec4 sum = vec4( 0.0 );
2050
2051    	sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;
2052    	sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;
2053    	sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;
2054    	sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;
2055    	sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
2056    	sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;
2057    	sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;
2058    	sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;
2059    	sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;
2060
2061    	gl_FragColor = sum;
2062
2063    }
2064  `},gz={uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:`
2065    varying vec2 vUv;
2066
2067    void main() {
2068
2069      vUv = uv;
2070      gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
2071
2072    }
2073  `,fragmentShader:`
2074
2075  uniform sampler2D tDiffuse;
2076  uniform float v;
2077
2078  varying vec2 vUv;
2079
2080  void main() {
2081
2082    vec4 sum = vec4( 0.0 );
2083
2084    sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;
2085    sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;
2086    sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;
2087    sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;
2088    sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
2089    sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;
2090    sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;
2091    sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;
2092    sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;
2093
2094    gl_FragColor = sum;
2095
2096  }
2097  `},gk=eD.forwardRef(({scale:e=10,frames:t=1/0,opacity:r=1,width:i=1,height:n=1,blur:a=1,near:o=0,far:s=10,resolution:l=512,smooth:c=!0,color:u="#000000",depthWrite:h=!1,renderOrder:A,...d},m)=>{let f,p;let g=eD.useRef(null),y=(0,eR.D)(e=>e.scene),v=(0,eR.D)(e=>e.gl),E=eD.useRef(null);i*=Array.isArray(e)?e[0]:e||1,n*=Array.isArray(e)?e[1]:e||1;let[x,C,w,B,I,_,b]=eD.useMemo(()=>{let e=new eT.dd2(l,l),t=new eT.dd2(l,l);t.texture.generateMipmaps=e.texture.generateMipmaps=!1;let r=new eT._12(i,n).rotateX(Math.PI/2),a=new eT.Kj0(r),o=new eT.lRF;o.depthTest=o.depthWrite=!1,o.onBeforeCompile=e=>{e.uniforms={...e.uniforms,ucolor:{value:new eT.Ilk(u)}},e.fragmentShader=e.fragmentShader.replace("void main() {",`uniform vec3 ucolor;
2098           void main() {
2099          `),e.fragmentShader=e.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};let s=new eT.jyz(gQ),c=new eT.jyz(gz);return c.depthTest=s.depthTest=!1,[e,r,o,a,s,c,t]},[l,i,n,e,u]),M=e=>{B.visible=!0,B.material=I,I.uniforms.tDiffuse.value=x.texture,I.uniforms.h.value=1*e/256,v.setRenderTarget(b),v.render(B,E.current),B.material=_,_.uniforms.tDiffuse.value=b.texture,_.uniforms.v.value=1*e/256,v.setRenderTarget(x),v.render(B,E.current),B.visible=!1},S=0;return(0,eR.F)(()=>{E.current&&(t===1/0||S<t)&&(S++,f=y.background,p=y.overrideMaterial,g.current.visible=!1,y.background=null,y.overrideMaterial=w,v.setRenderTarget(x),v.render(y,E.current),M(a),c&&M(.4*a),v.setRenderTarget(null),g.current.visible=!0,y.overrideMaterial=p,y.background=f)}),eD.useImperativeHandle(m,()=>g.current,[]),eD.createElement("group",(0,eS.Z)({"rotation-x":Math.PI/2},d,{ref:g}),eD.createElement("mesh",{renderOrder:A,geometry:C,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},eD.createElement("meshBasicMaterial",{transparent:!0,map:x.texture,opacity:r,depthWrite:h})),eD.createElement("orthographicCamera",{ref:E,args:[-i/2,i/2,n/2,-n/2,o,s]}))}),gL=eD.createContext(null),gO=sw({color:new eT.Ilk,blend:2,alphaTest:.75,opacity:0,map:null},`varying vec2 vUv;
2100   void main() {
2101     gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.);
2102     vUv = uv;
2103   }`,`varying vec2 vUv;
2104   uniform sampler2D map;
2105   uniform vec3 color;
2106   uniform float opacity;
2107   uniform float alphaTest;
2108   uniform float blend;
2109   void main() {
2110     vec4 sampledDiffuseColor = texture2D(map, vUv);
2111     gl_FragColor = vec4(color * sampledDiffuseColor.r * blend, max(0.0, (1.
21110 - (sampledDiffuseColor.r + sampledDiffuseColor.g + sampledDiffuseColor.b) / alphaTest)) * opacity);
2112     #include <tonemapping_fragment>
2113     #include <${sI.i>=154?"colorspace_fragment":"encodings_fragment"}>
2114   }`),gU=eD.forwardRef(({children:e,temporal:t,frames:r=40,limit:i=1/0,blend:n=20,scale:a=10,opacity:o=1,alphaTest:s=.75,color:l="black",colorBlend:c=2,resolution:u=1024,toneMapped:h=!0,...A},d)=>{(0,eR.e)({SoftShadowMaterial:gO});let m=(0,eR.D)(e=>e.gl),f=(0,eR.D)(e=>e.scene),p=(0,eR.D)(e=>e.camera),g=(0,eR.D)(e=>e.invalidate),y=eD.useRef(null),v=eD.useRef(null),[E]=eD.useState(()=>new gN(m,f,u));eD.useLayoutEffect(()=>{E.configure(y.current)},[]);let x=eD.useMemo(()=>({lights:new Map,temporal:!!t,frames:Math.max(2,r),blend:Math.max(2,r===1/0?n:r),count:0,getMesh:()=>y.current,reset:()=>{E.clear();let e=y.current.material;e.opacity=0,e.alphaTest=0,x.count=0},update:(e=1)=>{let t=y.current.material;x.temporal?(t.opacity=Math.min(o,t.opacity+o/x.blend),t.alphaTest=Math.min(s,t.alphaTest+s/x.blend)):(t.opacity=o,t.alphaTest=s),v.current.visible=!0,E.prepare();for(let t=0;t<e;t++)x.lights.forEach(e=>e.update()),E.update(p,x.blend);v.current.visible=!1,E.finish()}}),[E,p,f,t,r,n,o,s]);return eD.useLayoutEffect(()=>{x.reset(),x.temporal||x.frames===1/0||x.update(x.blend)}),eD.useImperativeHandle(d,()=>x,[x]),(0,eR.F)(()=>{(x.temporal||x.frames===1/0)&&x.count<x.frames&&x.count<i&&(g(),x.update(),x.count++)}),eD.createElement("group",A,eD.createElement("group",{traverse:()=>null,ref:v},eD.createElement(gL.Provider,{value:x},e)),eD.createElement("mesh",{receiveShadow:!0,ref:y,scale:a,rotation:[-Math.PI/2,0,0]},eD.createElement("planeGeometry",null),eD.createElement("softShadowMaterial",{transparent:!0,depthWrite:!1,toneMapped:h,color:l,blend:c,map:E.progressiveLightMap2.texture})))}),gG=eD.forwardRef(({castShadow:e=!0,bias:t=.001,mapSize:r=512,size:i=5,near:n=.5,far:a=500,frames:o=1,position:s=[0,0,0],radius:l=1,amount:c=8,intensity:u=sI.i>=155?Math.PI:1,ambient:h=.5,...A},d)=>{let m=eD.useRef(null),f=new eT.Pa4(...s).length(),p=eD.useContext(gL),g=eD.useCallback(()=>{let e;if(m.current)for(let t=0;t<m.current.children.length;t++)if(e=m.current.children[t],Math.random()>h)e.position.set(s[0]+eT.M8C.randFloatSpread(l),s[1]+eT.M8C.randFloatSpread(l),s[2]+eT.M8C.randFloatSpread(l));else{let t=Math.acos(2*Math.random()-1)-Math.PI/2,r=2*Math.PI*Math.random();e.position.set(Math.cos(t)*Math.cos(r)*f,Math.abs(Math.cos(t)*Math.sin(r)*f),Math.sin(t)*f)}},[l,h,f,...s]),y=eD.useMemo(()=>({update:g}),[g]);return eD.useImperativeHandle(d,()=>y,[y]),eD.useLayoutEffect(()=>{var e;let t=m.current;return p&&(null==(e=p.lights)||e.set(t.uuid,y)),()=>{var e;null==p||null==(e=p.lights)||e.delete(t.uuid)}},[p,y]),eD.createElement("group",(0,eS.Z)({ref:m},A),Array.from({length:c},(o,s)=>eD.createElement("directionalLight",{key:s,castShadow:e,"shadow-bias":t,"shadow-mapSize":[r,r],intensity:u/c},eD.createElement("orthographicCamera",{attach:"shadow-camera",args:[-i,i,i,-i,n,a]}))))});class gN{constructor(e,t,r=1024){this.renderer=e,this.res=r,this.scene=t,this.buffer1Active=!1,this.lights=[],this.meshes=[],this.object=null,this.clearColor=new eT.Ilk,this.clearAlpha=0;let i={type:eT.cLu,magFilter:eT.TyD,minFilter:eT.TyD};this.progressiveLightMap1=new eT.dd2(this.res,this.res,i),this.progressiveLightMap2=new eT.dd2(this.res,this.res,i),this.discardMat=new pA,this.targetMat=new eT.YBo({fog:!1}),this.previousShadowMap={value:this.progressiveLightMap1.texture},this.averagingWindow={value:100},this.targetMat.onBeforeCompile=e=>{e.vertexShader="varying vec2 vUv;\n"+e.vertexShader.slice(0,-1)+"vUv = uv; gl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }";let t=e.fragmentShader.indexOf("void main() {");e.fragmentShader="varying vec2 vUv;\n"+e.fragmentShader.slice(0,t)+"uniform sampler2D previousShadowMap;\n	uniform float averagingWindow;\n"+e.fragmentShader.slice(t-1,-1)+`
2115vec3 texelOld = texture2D(previousShadowMap, vUv).rgb;
2116        gl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/ averagingWindow);
2117      }`,e.uniforms.previousShadowMap=this.previousShadowMap,e.uniforms.averagingWindow=this.averagingWindow}}clear(){this.renderer.getClearColor(this.clearColor),this.clearAlpha=this.renderer.getClearAlpha(),this.renderer.setClearColor("black",1),this.renderer.setRenderTarget(this.progressiveLightMap1),this.renderer.clear(),this.renderer.setRenderTarget(this.progressiveLightMap2),this.renderer.clear(),this.renderer.setRenderTarget(null),this.renderer.setClearColor(this.clearColor,this.clearAlpha),this.lights=[],this.meshes=[],this.scene.traverse(e=>{e.geometry?this.meshes.push({object:e,material:e.material}):e.isLight&&this.lights.push({object:e,intensity:e.intensity})})}
2117prepare(){this.lights.forEach(e=>e.object.intensity=0),this.meshes.forEach(e=>e.object.material=this.discardMat)}finish(){this.lights.forEach(e=>e.object.intensity=e.intensity),this.meshes.forEach(e=>e.object.material=e.material)}configure(e){this.object=e}update(e,t=100){if(!this.object)return;this.averagingWindow.value=t,this.object.material=this.targetMat;let r=this.buffer1Active?this.progressiveLightMap1:this.progressiveLightMap2,i=this.buffer1Active?this.progressiveLightMap2:this.progressiveLightMap1,n=this.scene.background;this.scene.background=null,this.renderer.setRenderTarget(r),this.previousShadowMap.value=i.texture,this.buffer1Active=!this.buffer1Active,this.renderer.render(this.scene,e),this.renderer.setRenderTarget(null),this.scene.background=n}}let gH={rembrandt:{main:[1,2,1],fill:[-2,-.5,-2]},portrait:{main:[-1,2,.5],fill:[-1,.5,-1.5]},upfront:{main:[0,2,1],fill:[-1,.5,-1.5]},soft:{main:[-2,4,4],fill:[-1,.5,-1.5]}};function gj({radius:e,adjustCamera:t}){let r=p$();return eD.useEffect(()=>{t&&r.refresh().clip().fit()},[e,t]),null}function gJ({children:e,center:t,adjustCamera:r=!0,intensity:i=.5,shadows:n="contact",environment:a="city",preset:o="rembrandt",...s}){var l,c,u,h,A,d,m,f;let p="string"==typeof o?gH[o]:o,[{radius:g,height:y},v]=eD.useState({radius:0,width:0,height:0,depth:0}),E=null!==(l=null==n?void 0:n.bias)&&void 0!==l?l:-.0001,x=null!==(c=null==n?void 0:n.normalBias)&&void 0!==c?c:0,C=null!==(u=null==n?void 0:n.size)&&void 0!==u?u:1024,w=null!==(h=null==n?void 0:n.offset)&&void 0!==h?h:0,B="contact"===n||(null==n?void 0:n.type)==="contact",I="accumulative"===n||(null==n?void 0:n.type)==="accumulative",_={..."object"==typeof n?n:{}},b=a?"string"==typeof a?{preset:a}:a:null,M=eD.useCallback(e=>{let{width:r,height:i,depth:n,boundingSphere:a}=e;v({radius:a.radius,width:r,height:i,depth:n}),null!=t&&t.onCentered&&t.onCentered(e)},[]);return eD.createElement(eD.Fragment,null,eD.createElement("ambientLight",{intensity:i/3}),eD.createElement("spotLight",{penumbra:1,position:[p.main[0]*g,p.main[1]*g,p.main[2]*g],intensity:2*i,castShadow:!!n,"shadow-bias":E,"shadow-normalBias":x,"shadow-mapSize":C}),eD.createElement("pointLight",{position:[p.fill[0]*g,p.fill[1]*g,p.fill[2]*g],intensity:i}),eD.createElement(pZ,(0,eS.Z)({fit:!!r,clip:!!r,margin:Number(r),observe:!0},s),eD.createElement(gj,{radius:g,adjustCamera:r}),eD.createElement(fv,(0,eS.Z)({},t,{position:[0,w/2,0],onCentered:M}),e)),eD.createElement("group",{position:[0,-y/2-w/2,0]},B&&eD.createElement(gk,(0,eS.Z)({scale:4*g,far:g,blur:2},_)),I&&eD.createElement(gU,(0,eS.Z)({temporal:!0,frames:100,alphaTest:.9,toneMapped:!0,scale:4*g},_),eD.createElement(gG,{amount:null!==(A=_.amount)&&void 0!==A?A:8,radius:null!==(d=_.radius)&&void 0!==d?d:g,ambient:null!==(m=_.ambient)&&void 0!==m?m:.5,intensity:null!==(f=_.intensity)&&void 0!==f?f:1,position:[p.main[0]*g,p.main[1]*g,p.main[2]*g],size:4*g,bias:-E,mapSize:C}))),a&&eD.createElement(gF,b))}let gV=e=>0===e?0:Math.pow(2,10*e-10);function gK({children:e,floor:t=.25,segments:r=20,receiveShadow:i,...n}){let a=eD.useRef(null);return eD.useLayoutEffect(()=>{let e=0,i=r/r/2,n=a.current.attributes.position;for(let a=0;a<r+1;a++)for(let o=0;o<r+1;o++)n.setXYZ(e++,a/r-i+(0===a?-t:0),o/r-i,gV(a/r));n.needsUpdate=!0,a.current.computeVertexNormals()},[r,t]),eD.createElement("group",n,eD.createElement("mesh",{receiveShadow:i,rotation:[-Math.PI/2,0,Math.PI/2]},eD.createElement("planeGeometry",{ref:a,args:[1,1,r,r]}),e))}let gY=eD.forwardRef(({fog:e=!1,renderOrder:t,depthWrite:r=!1,colorStop:i=0,color:n="black",opacity:a=.5,...o},s)=>{let l=eD.useMemo(()=>{let e=document.createElement("canvas");e.width=128,e.height=128;let t=e.getContext("2d"),r=t.createRadialGradient(e.width/2,e.height/2,0,e.width/2,e.height/2,e.width/2);return r.addColorStop(i,new eT.Ilk(n).getStyle()),r.addColorStop(1,"rgba(0,0,0,0)"),t.fillStyle=r,t.fillRect(0,0,e.width,e.height),e},[n,i]);return eD.createElement("mesh",(0,eS.Z)({renderOrder:t,ref:s,"rotation-x":-Math.PI/2},o),eD.createElement("planeGeometry",null),eD.createElement("meshBasicMaterial",{transparent:!0,opacity:a,fog:e,depthWrite:r,side:eT.ehD},eD.createElement("canvasTexture",{attach:"map",args:[l]})))});function gW(e=eT.Wl3){let t={value:new eT.yGw};return Object.assign(new eT.RSm({side:e}),{viewMatrix:t,onBeforeCompile:e=>{e.uniforms.viewMatrix=t,e.fragmentShader=`vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
2118           return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
2119         }
2120`+e.fragmentShader.replace("#include <normal_fragment_maps>",`#include <normal_fragment_maps>
2121           normal = inverseTransformDirection( normal, viewMatrix );
2122`)}})}let gq=sw({causticsTexture:null,causticsTextureB:null,color:new eT.Ilk,lightProjMatrix:new eT.yGw,lightViewM
2122atrix:new eT.yGw},`varying vec3 vWorldPosition;
2123   void main() {
2124     gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.);
2125     vec4 worldPosition = modelMatrix * vec4(position, 1.);
2126     vWorldPosition = worldPosition.xyz;
2127   }`,`varying vec3 vWorldPosition;
2128  uniform vec3 color;
2129  uniform sampler2D causticsTexture;
2130  uniform sampler2D causticsTextureB;
2131  uniform mat4 lightProjMatrix;
2132  uniform mat4 lightViewMatrix;
2133   void main() {
2134    // Apply caustics
2135    vec4 lightSpacePos = lightProjMatrix * lightViewMatrix * vec4(vWorldPosition, 1.0);
2136    lightSpacePos.xyz /= lightSpacePos.w;
2137    lightSpacePos.xyz = lightSpacePos.xyz * 0.5 + 0.5;
2138    vec3 front = texture2D(causticsTexture, lightSpacePos.xy).rgb;
2139    vec3 back = texture2D(causticsTextureB, lightSpacePos.xy).rgb;
2140    gl_FragColor = vec4((front + back) * color, 1.0);
2141    #include <tonemapping_fragment>
2142    #include <${sI.i>=154?"colorspace_fragment":"encodings_fragment"}>
2143   }`),gX=sw({cameraMatrixWorld:new eT.yGw,cameraProjectionMatrixInv:new eT.yGw,normalTexture:null,depthTexture:null,lightDir:new eT.Pa4(0,1,0),lightPlaneNormal:new eT.Pa4(0,1,0),lightPlaneConstant:0,near:.1,far:100,modelMatrix:new eT.yGw,worldRadius:1/40,ior:1.1,bounces:0,resolution:1024,size:10,intensity:.5},`
2144  varying vec2 vUv;
2145  void main() {
2146      vUv = uv;
2147      gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
2148  }`,`
2149  uniform mat4 cameraMatrixWorld;
2150  uniform mat4 cameraProjectionMatrixInv;
2151  uniform vec3 lightDir;
2152  uniform vec3 lightPlaneNormal;
2153  uniform float lightPlaneConstant;
2154  uniform float near;
2155  uniform float far;
2156  uniform float time;
2157  uniform float worldRadius;
2158  uniform float resolution;
2159  uniform float size;
2160  uniform float intensity;
2161  uniform float ior;
2162  precision highp isampler2D;
2163  precision highp usampler2D;
2164  uniform sampler2D normalTexture;
2165  uniform sampler2D depthTexture;
2166  uniform float bounces;
2167  varying vec2 vUv;
2168  vec3 WorldPosFromDepth(float depth, vec2 coord) {
2169    float z = depth * 2.0 - 1.0;
2170    vec4 clipSpacePosition = vec4(coord * 2.0 - 1.0, z, 1.0);
2171    vec4 viewSpacePosition = cameraProjectionMatrixInv * clipSpacePosition;
2172    // Perspective division
2173    viewSpacePosition /= viewSpacePosition.w;
2174    vec4 worldSpacePosition = cameraMatrixWorld * viewSpacePosition;
2175    return worldSpacePosition.xyz;
2176  }
2177  float sdPlane( vec3 p, vec3 n, float h ) {
2178    // n must be normalized
2179    return dot(p,n) + h;
2180  }
2181  float planeIntersect( vec3 ro, vec3 rd, vec4 p ) {
2182    return -(dot(ro,p.xyz)+p.w)/dot(rd,p.xyz);
2183  }
2184  vec3 totalInternalReflection(vec3 ro, vec3 rd, vec3 pos, vec3 normal, float ior, out vec3 rayOrigin, out vec3 rayDirection) {
2185    rayOrigin = ro;
2186    rayDirection = rd;
2187    rayDirection = refract(rayDirection, normal, 1.0 / ior);
2188    rayOrigin = pos + rayDirection * 0.1;
2189    return rayDirection;
2190  }
2191  void main() {
2192    // Each sample consists of random offset in the x and y direction
2193    float caustic = 0.0;
2194    float causticTexelSize = (1.0 / resolution) * size * 2.0;
2195    float texelsNeeded = worldRadius / causticTexelSize;
2196    float sampleRadius = texelsNeeded / resolution;
2197    float sum = 0.0;
2198    if (texture2D(depthTexture, vUv).x == 1.0) {
2199      gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
2200      return;
2201    }
2202    vec2 offset1 = vec2(-0.5, -0.5);//vec2(rand() - 0.5, rand() - 0.5);
2203    vec2 offset2 = vec2(-0.5, 0.5);//vec2(rand() - 0.5, rand() - 0.5);
2204    vec2 offset3 = vec2(0.5, 0.5);//vec2(rand() - 0.5, rand() - 0.5);
2205    vec2 offset4 = vec2(0.5, -0.5);//vec2(rand() - 0.5, rand() - 0.5);
2206    vec2 uv1 = vUv + offset1 * sampleRadius;
2207    vec2 uv2 = vUv + offset2 * sampleRadius;
2208    vec2 uv3 = vUv + offset3 * sampleRadius;
2209    vec2 uv4 = vUv + offset4 * sampleRadius;
2210    vec3 normal1 = texture2D(normalTexture, uv1, -10.0).rgb * 2.0 - 1.0;
2211    vec3 normal2 = texture2D(normalTexture, uv2, -10.0).rgb * 2.0 - 1.0;
2212    vec3 normal3 = texture2D(normalTexture, uv3, -10.0).rgb * 2.0 - 1.0;
2213    vec3 normal4 = texture2D(normalTexture, uv4, -10.0).rgb * 2.0 - 1.0;
2214    float depth1 = texture2D(depthTexture, uv1, -10.0).x;
2215    float depth2 = texture2D(depthTexture, uv2, -10.0).x;
2216    float depth3 = texture2D(depthTexture, uv3, -10.0).x;
2217    float depth4 = texture2D(depthTexture, uv4, -10.0).x;
2218    // Sanity check the depths
2219    if (depth1 == 1.0 || depth2 == 1.0 || depth3 == 1.0 || depth4 == 1.0) {
2220      gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
2221      return;
2222    }
2223    vec3 pos1 = WorldPosFromDepth(depth1, uv1);
2224    vec3 pos2 = WorldPosFromDepth(depth2, uv2);
2225    vec3 pos3 = WorldPosFromDepth(depth3, uv3);
2226    vec3 pos4 = WorldPosFromDepth(depth4, uv4);
2227    vec3 originPos1 = WorldPosFromDepth(0.0, uv1);
2228    vec3 originPos2 = WorldPosFromDepth(0.0, uv2);
2229    vec3 originPos3 = WorldPosFromDepth(0.0, uv3);
2230    vec3 originPos4 = WorldPosFromDepth(0.0, uv4);
2231    vec3 endPos1, endPos2, endPos3, endPos4;
2232    vec3 endDir1, endDir2, endDir3, endDir4;
2233    totalInternalReflection(originPos1, lightDir, pos1, normal1, ior, endPos1, endDir1);
2234    totalInternalReflection(originPos2, lightDir, pos2, normal2, ior, endPos2, endDir2);
2235    totalInternalReflection(originPos3, lightDir, pos3, normal3, ior, endPos3, endDir3);
2236    totalInternalReflection(originPos4, lightDir, pos4, normal4, ior, endPos4, endDir4);
2237    float lightPosArea = length(cross(originPos2 - originPos1, originPos3 - originPos1)) + length(cross(originPos3 - originPos1, originPos4 - originPos1));
2238    float t1 = planeIntersect(endPos1, endDir1, vec4(lightPlaneNormal, lightPlaneConstant));
2239    float t2 = planeIntersect(endPos2, endDir2, vec4(lightPlaneNormal, lightPlaneConstant));
2240    float t3 = planeIntersect(endPos3, endDir3, vec4(lightPlaneNormal, lightPlaneConstant));
2241    float t4 = planeIntersect(endPos4, endDir4, vec4(lightPlaneNormal, lightPlaneConstant));
2242    vec3 finalPos1 = endPos1 + endDir1 * t1;
2243    vec3 finalPos2 = endPos2 + endDir2 * t2;
2244    vec3 finalPos3 = endPos3 + endDir3 * t3;
2245    vec3 finalPos4 = endPos4 + endDir4 * t4;
2246    float finalArea = length(cross(finalPos2 - finalPos1, finalPos3 - finalPos1)) + length(cross(finalPos3 - finalPos1, finalPos4 - finalPos1));
2247    caustic += intensity * (lightPosArea / finalArea);
2248    // Calculate the area of the triangle in light spaces
2249    gl_FragColor = vec4(vec3(max(caustic, 0.0)), 1.0);
2250  }`),gZ={depth:!0,minFilter:eT.wem,magFilter:eT.wem,type:eT.ywz},g$={minFilter:eT.D1R,magFilter:eT.wem,type:eT.VzW,generateMipmaps:!0},g1=eD.forwardRef(({debug:e,children:t,frames:r=1,ior:i=1.1,color:n="white",causticsOnly:a=!1,backside:o=!1,backsideIOR:s=1.1,worldRadius:l=.3125,intensity:c=.05,resolution:u=2024,lightSource:h=[5,5,5],...A},d)=>{(0,eR.e)({CausticsProjectionMaterial:gq});let m=eD.useRef(null),f=eD.useRef(null),p=eD.useRef(null),g=eD.useRef(null),y=(0,eR.D)(e=>e.gl),v=A0(e&&f,eT.Rki),E=cs(u,u,gZ),x=cs(u,u,gZ),C=cs(u,u,g$),w=cs(u,u,g$),[B]=eD.useState(()=>gW()),[I]=eD.useState(()=>gW(eT._Li)),[_]=eD.useState(()=>new gX),[b]=eD.useState(()=>new se(_));eD.useLayoutEffect(()=>{m.current.updateWorldMatrix(!1,!0)});let M=0,S=new eT.Pa4,D=new eT.iWj,P=new eT.yGw,T=new eT.JOQ,R=new eT.Pa4,F=new eT.Pa4,Q=new eT.ZzF,z=new eT.Pa4,k=[],L=[],O=[],U=[],G=new eT.Pa4;for(let e=0;e<8;e++)k.push(new eT.Pa4),L.push(new eT.Pa4),O.push(new eT.Pa4),U.push(new eT.Pa4);return(0,eR.F)(()=>{if(r===1/0||M++<r){var t,n;Array.isArray(h)?R.fromArray(h).normalize():R.copy(m.current.worldToLocal(h.current.getWorldPosition(S)).normalize()),F.copy(R).multiplyScalar(-1),null==(t=p.current.parent)||t.matrixWorld.identity(),Q.setFromObject(p.current,!0),k[0].set(Q.min.x,Q.min.y,Q.min.z),k[1].set(Q.min.x,Q.min.y,Q.max.z),k[2].set(Q.min.x,Q.max.y,Q.min.z),k[3].set(Q.min.x,Q.max.y,Q.max.z),k[4].set(Q.max.x,Q.min.y,Q.min.z),k[5].set(Q.max.x,Q.min.y,Q.max.z),k[6].set(Q.max.x,Q.max.y,Q.min.z),k[7].set(Q.max.x,Q.max.y,Q.max.z);for(let e=0;e<8;e++)L[e].copy(k[e]);Q.getCenter(z),k.map(e=>e.sub(z));let r=T.set(F,0);k.map((e,t)=>r.projectPoint(e,O[t]));let A=O.reduce((e,t)=>e.add(t),S.set(0,0,0)).divideScalar(O.length),d=O.map(e=>e.distanceTo(A)).reduce((e,t)=>Math.max(e,t)),M=k.map(e=>e.dot(R)).reduce((e,t)=>Math.max(e,t));f.current.position.copy(G.copy(R).multiplyScalar(M).add(z)),f.current.lookAt(p.current.localToWorld(z));let N=P.lookAt(f.current.position,z,S.set(0,1,0));f.current.left=-d,f.current.right=d,f.current.top=d,f.current.bottom=-d;let H=S.set(0,d,0).applyMatrix4(N),j=(f.current.position.y+H.y)/R.y;f.current.near=.1,f.current.far=j,f.current.updateProjectionMatrix(),f.current.updateMatrixWorld();let J=L.map((e,t)=>e.add(U[t].copy(R).multiplyScalar(-e.y/R.y))),V=J.reduce((e,t)=>e.add(t),S.set(0,0,0)).divideScalar(J.length),K=2*J.map(e=>Math.hypot(e.x-V.x,e.z-V.z)).reduce((e,t)=>Math.max(e,t));g.current.scale.setScalar(K),g.current.position.copy(V),e&&(null==(n=v.current)||n.update()),I.viewMatrix.value=B.viewMatrix.value=f.current.matrixWorldInverse;let Y=D.setFromProjectionMatrix(P.multiplyMatrices(f.current.projectionMatrix,f.current.matrixWorldInverse)).planes[4];_.cameraMatrixWorld=f.current.matrixWorld,_.cameraProjectionMatrixInv=f.current.projectionMatrixInverse,_.lightDir=F,_.lightPlaneNormal=Y.normal,_.lightPlaneConstant=Y.constant,_.near=f.current.near,_.far=f.current.far,_.resolution=u,_.size=d,_.intensity=c,_.worldRadius=l,p.current.visible=!0,y.setRenderTarget(E),y.clear(),p.current.overrideMaterial=B,y.render(p.current,f.current),y.setRenderTarget(x),y.clear(),o&&(p.current.overrideMaterial=I,y.render(p.current,f.current)),p.current.overrideMaterial=null,_.ior=i,g.current.material.lightProjMatrix=f.current.projectionMatrix,g.current.material.lightViewMatrix=f.current.matrixWorldInverse,_.normalTexture=E.texture,_.depthTexture=E.depthTexture,y.setRenderTarget(C),y.clear(),b.render(y),_.ior=s,_.normalTexture=x.texture,_.depthTexture=x.depthTexture,y.setRenderTarget(w),y.clear(),o&&b.render(y),y.setRenderTarget(null),a&&(p.current.visible=!1)}}),eD.useImperativeHandle(d,()=>m.current,[]),eD.createElement("group",(0,eS.Z)({ref:m},A),eD.createElement("scene",{ref:p},eD.createElement("orthographicCamera",{ref:f,up:[0,1,0]}),t),eD.createElement("mesh",{renderOrder:2,ref:g,"rotation-x":-Math.PI/2},eD.createElement("planeGeometry",null),eD.createElement("causticsProjectionMaterial",{transparent:!0,color:n,causticsTexture:C.texture,causticsTextureB:w.texture,blending:eT.Xaj,blendSrc:eT.ghN,blendDst:eT.k74,depthWrite:!1}),e&&eD.createElement(sP,null,eD.createElement("lineBasicMaterial",{color:"#ffff00",toneMapped:!1}))))}),g0=eD.forwardRef(({mixBlur:e=0,mixStrength:t=.5,resolution:r=256,blur:i=[0,0],args:n=[1,1],minDepthThreshold:a=.9,maxDepthThreshold:o=1,depthScale:s=0,depthToBlurRatioBias:l=.25,mirror:c=0,children:u,debug:h=0,distortion:A=1,mixContrast:d=1,distortionMap:m,...f},p)=>{(0,eR.e)({MeshReflectorMaterial:f9}),eD.useEffect(()=>{console.warn("Reflector has been deprecated and will be removed next major. Replace it with <MeshReflectorMaterial />!")},[]);let g=(0,eR.D)(({gl:e})=>e),y=(0,eR.D)(({camera:e})=>e),v=(0,eR.D)(({scene:e})=>e),E=(i=Array.isArray(i)?i:[i,i])[0]+i[1]>0,x=eD.useRef(null);eD.useImperativeHandle(p,()=>x.current,[]);let[C]=eD.useState(()=>new eT.JOQ),[w]=eD.useState(()=>new eT.Pa4),[B]=eD.useState(()=>new eT.Pa4),[I]=eD.useState(()=>new eT.Pa4),[_]=eD.useState(()=>new eT.yGw),[b]=eD.useState(()=>new eT.Pa4(0,0,-1)),[M]=eD.useState(()=>new eT.Ltg),[S]=eD.useState(()=>new eT.Pa4),[D]=eD.useState(()=>new eT.Pa4),[P]=eD.useState(()=>new eT.Ltg),[T]=eD.useState(()=>new eT.yGw),[R]=eD.useState(()=>new eT.cPb),F=eD.useCallback(()=>
2250{if(B.setFromMatrixPosition(x.current.matrixWorld),I.setFromMatrixPosition(y.matrixWorld),_.extractRotation(x.current.matrixWorld),w.set(0,0,1),w.applyMatrix4(_),S.subVectors(B,I),S.dot(w)>0)return;S.reflect(w).negate(),S.add(B),_.extractRotation(y.matrixWorld),b.set(0,0,-1),b.applyMatrix4(_),b.add(I),D.subVectors(B,b),D.reflect(w).negate(),D.add(B),R.position.copy(S),R.up.set(0,1,0),R.up.applyMatrix4(_),R.up.reflect(w),R.lookAt(D),R.far=y.far,R.updateMatrixWorld(),R.projectionMatrix.copy(y.projectionMatrix),T.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),T.multiply(R.projectionMatrix),T.multiply(R.matrixWorldInverse),T.multiply(x.current.matrixWorld),C.setFromNormalAndCoplanarPoint(w,B),C.applyMatrix4(R.matrixWorldInverse),M.set(C.normal.x,C.normal.y,C.normal.z,C.constant);let e=R.projectionMatrix;P.x=(Math.sign(M.x)+e.elements[8])/e.elements[0],P.y=(Math.sign(M.y)+e.elements[9])/e.elements[5],P.z=-1,P.w=(1+e.elements[10])/e.elements[14],M.multiplyScalar(2/M.dot(P)),e.elements[2]=M.x,e.elements[6]=M.y,e.elements[10]=M.z+1,e.elements[14]=M.w},[]),[Q,z,k,L]=eD.useMemo(()=>{let n={type:eT.cLu,minFilter:eT.wem,magFilter:eT.wem},u=new eT.dd2(r,r,n);u.depthBuffer=!0,u.depthTexture=new eT.$YQ(r,r),u.depthTexture.format=eT.qkB,u.depthTexture.type=eT.LsT;let f=new eT.dd2(r,r,n),p=new f8({gl:g,resolution:r,width:i[0],height:i[1],minDepthThreshold:a,maxDepthThreshold:o,depthScale:s,depthToBlurRatioBias:l}),y={mirror:c,textureMatrix:T,mixBlur:e,tDiffuse:u.texture,tDepth:u.depthTexture,tDiffuseBlur:f.texture,hasBlur:E,mixStrength:t,minDepthThreshold:a,maxDepthThreshold:o,depthScale:s,depthToBlurRatioBias:l,transparent:!0,debug:h,distortion:A,distortionMap:m,mixContrast:d,"defines-USE_BLUR":E?"":void 0,"defines-USE_DEPTH":s>0?"":void 0,"defines-USE_DISTORTION":m?"":void 0};return[u,f,p,y]},[g,i,T,r,c,E,e,t,a,o,s,l,h,A,m,d]);return(0,eR.F)(()=>{if(!(null!=x&&x.current))return;x.current.visible=!1;let e=g.xr.enabled,t=g.shadowMap.autoUpdate;F(),g.xr.enabled=!1,g.shadowMap.autoUpdate=!1,g.setRenderTarget(Q),g.state.buffers.depth.setMask(!0),g.autoClear||g.clear(),g.render(v,R),E&&k.render(g,Q,z),g.xr.enabled=e,g.shadowMap.autoUpdate=t,x.current.visible=!0,g.setRenderTarget(null)}),eD.createElement("mesh",(0,eS.Z)({ref:x},f),eD.createElement("planeGeometry",{args:n}),u?u("meshReflectorMaterial",L):eD.createElement("meshReflectorMaterial",L))});class g2 extends eT.jyz{constructor(){super({uniforms:{depth:{value:null},opacity:{value:1},attenuation:{value:2.5},anglePower:{value:12},spotPosition:{value:new eT.Pa4(0,0,0)},lightColor:{value:new eT.Ilk("white")},cameraNear:{value:0},cameraFar:{value:1},resolution:{value:new eT.FM8(0,0)}},transparent:!0,depthWrite:!1,vertexShader:`
2251        varying vec3 vNormal;
2252        varying float vViewZ;
2253        varying float vIntensity;
2254        uniform vec3 spotPosition;
2255        uniform float attenuation;
2256
2257        #include <common>
2258        #include <logdepthbuf_pars_vertex>
2259
2260        void main() {
2261          // compute intensity
2262          vNormal = normalize(normalMatrix * normal);
2263          vec4 worldPosition = modelMatrix * vec4(position, 1);
2264          vec4 viewPosition = viewMatrix * worldPosition;
2265          vViewZ = viewPosition.z;
2266
2267          vIntensity = 1.0 - saturate(distance(worldPosition.xyz, spotPosition) / attenuation);
2268
2269          gl_Position = projectionMatrix * viewPosition;
2270
2271          #include <logdepthbuf_vertex>
2272        }
2273      `,fragmentShader:`
2274        varying vec3 vNormal;
2275        varying float vViewZ;
2276        varying float vIntensity;
2277
2278        uniform vec3 lightColor;
2279        uniform float anglePower;
2280        uniform sampler2D depth;
2281        uniform vec2 resolution;
2282        uniform float cameraNear;
2283        uniform float cameraFar;
2284        uniform float opacity;
2285
2286        #include <packing>
2287        #include <logdepthbuf_pars_fragment>
2288
2289        float readDepth(sampler2D depthSampler, vec2 uv) {
2290          float fragCoordZ = texture(depthSampler, uv).r;
2291
2292          // https://github.com/mrdoob/three.js/issues/23072
2293          #ifdef USE_LOGDEPTHBUF
2294            float viewZ = 1.0 - exp2(fragCoordZ * log(cameraFar + 1.0) / log(2.0));
2295          #else
2296            float viewZ = perspectiveDepthToViewZ(fragCoordZ, cameraNear, cameraFar);
2297          #endif
2298
2299          return viewZ;
2300        }
2301
2302        void main() {
2303          #include <logdepthbuf_fragment>
2304
2305          vec3 normal = vec3(vNormal.x, vNormal.y, abs(vNormal.z));
2306          float angleIntensity = pow(dot(normal, vec3(0, 0, 1)), anglePower);
2307          float intensity = vIntensity * angleIntensity;
2308
2309          // fades when z is close to sampled depth, meaning the cone is intersecting existing geometry
2310          bool isSoft = resolution[0] > 0.0 && resolution[1] > 0.0;
2311          if (isSoft) {
2312            vec2 uv = gl_FragCoord.xy / resolution;
2313            intensity *= smoothstep(0.0, 1.0, vViewZ - readDepth(depth, uv));
2314          }
2315
2316          gl_FragColor = vec4(lightColor, intensity * opacity);
2317
2318          #include <tonemapping_fragment>
2319          #include <${sI.i>=154?"colorspace_fragment":"encodings_fragment"}>
2320        }
2321      `})}}let g3=e=>null==e?void 0:e.isSpotLight;function g4({opacity:e=1,radiusTop:t,radiusBottom:r,depthBuffer:i,color:n="white",distance:a=5,angle:o=.15,attenuation:s=5,anglePower:l=5}){let c=eD.useRef(null),u=(0,eR.D)(e=>e.size),h=(0,eR.D)(e=>e.camera),A=(0,eR.D)(e=>e.viewport.dpr),[d]=eD.useState(()=>new g2),[m]=eD.useState(()=>new eT.Pa4);t=void 0===t?.1:t,r=void 0===r?7*o:r,(0,eR.F)(()=>{d.uniforms.spotPosition.value.copy(c.current.getWorldPosition(m)),c.current.lookAt(c.
2321current.parent.target.getWorldPosition(m))});let f=eD.useMemo(()=>{let e=new eT.fHI(t,r,a,128,64,!0);return e.applyMatrix4(new eT.yGw().makeTranslation(0,-a/2,0)),e.applyMatrix4(new eT.yGw().makeRotationX(-Math.PI/2)),e},[a,t,r]);return eD.createElement(eD.Fragment,null,eD.createElement("mesh",{ref:c,geometry:f,raycast:()=>null},eD.createElement("primitive",{object:d,attach:"material","uniforms-opacity-value":e,"uniforms-lightColor-value":n,"uniforms-attenuation-value":s,"uniforms-anglePower-value":l,"uniforms-depth-value":i,"uniforms-cameraNear-value":h.near,"uniforms-cameraFar-value":h.far,"uniforms-resolution-value":i?[u.width*A,u.height*A]:[0,0]})))}function g5(e,t,r,i,n){let[[a,o]]=eD.useState(()=>[new eT.Pa4,new eT.Pa4]);eD.useLayoutEffect(()=>{if(g3(e.current))e.current.shadow.mapSize.set(r,i),e.current.shadow.needsUpdate=!0;else throw Error("SpotlightShadow must be a child of a SpotLight")},[e,r,i]),(0,eR.F)(()=>{if(!e.current)return;let r=e.current.position,i=e.current.target.position;o.copy(i).sub(r);var s=o.length();o.normalize().multiplyScalar(s*n),a.copy(r).add(o),t.current.position.copy(a),t.current.lookAt(e.current.target.position)})}function g6({distance:e=.4,alphaTest:t=.5,map:r,shader:i="#define GLSLIFY 1\nvarying vec2 vUv;uniform sampler2D uShadowMap;uniform float uTime;void main(){vec3 color=texture2D(uShadowMap,vUv).xyz;gl_FragColor=vec4(color,1.);}",width:n=512,height:a=512,scale:o=1,children:s,...l}){let c=eD.useRef(null),u=l.spotlightRef,h=l.debug;g5(u,c,n,a,e);let A=eD.useMemo(()=>new eT.dd2(n,a,{format:eT.wk1,stencilBuffer:!1}),[n,a]),d=eD.useRef({uShadowMap:{value:r},uTime:{value:0}});eD.useEffect(()=>void(d.current.uShadowMap.value=r),[r]);let m=eD.useMemo(()=>new se(new eT.jyz({uniforms:d.current,vertexShader:`
2322          varying vec2 vUv;
2323
2324          void main() {
2325            vUv = uv;
2326            gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
2327          }
2328          `,fragmentShader:i})),[i]);return eD.useEffect(()=>()=>{m.material.dispose(),m.dispose()},[m]),eD.useEffect(()=>()=>A.dispose(),[A]),(0,eR.F)(({gl:e},t)=>{d.current.uTime.value+=t,e.setRenderTarget(A),m.render(e),e.setRenderTarget(null)}),eD.createElement(eD.Fragment,null,eD.createElement("mesh",{ref:c,scale:o,castShadow:!0},eD.createElement("planeGeometry",null),eD.createElement("meshBasicMaterial",{transparent:!0,side:eT.ehD,alphaTest:t,alphaMap:A.texture,"alphaMap-wrapS":eT.rpg,"alphaMap-wrapT":eT.rpg,opacity:h?1:0},s)))}function g8({distance:e=.4,alphaTest:t=.5,map:r,width:i=512,height:n=512,scale:a,children:o,...s}){let l=eD.useRef(null),c=s.spotlightRef,u=s.debug;return g5(c,l,i,n,e),eD.createElement(eD.Fragment,null,eD.createElement("mesh",{ref:l,scale:a,castShadow:!0},eD.createElement("planeGeometry",null),eD.createElement("meshBasicMaterial",{transparent:!0,side:eT.ehD,alphaTest:t,alphaMap:r,"alphaMap-wrapS":eT.rpg,"alphaMap-wrapT":eT.rpg,opacity:u?1:0},o)))}function g9(e){return e.shader?eD.createElement(g6,e):eD.createElement(g8,e)}let g7=eD.forwardRef(({opacity:e=1,radiusTop:t,radiusBottom:r,depthBuffer:i,color:n="white",distance:a=5,angle:o=.15,attenuation:s=5,anglePower:l=5,volumetric:c=!0,debug:u=!1,children:h,...A},d)=>{let m=eD.useRef(null);return eD.useImperativeHandle(d,()=>m.current,[]),eD.createElement("group",null,u&&m.current&&eD.createElement("spotLightHelper",{args:[m.current]}),eD.createElement("spotLight",(0,eS.Z)({ref:m,angle:o,color:n,distance:a,castShadow:!0},A),c&&eD.createElement(g4,{debug:u,opacity:e,radiusTop:t,radiusBottom:r,depthBuffer:i,color:n,distance:a,angle:o,attenuation:s,anglePower:l})),h&&eD.cloneElement(h,{spotlightRef:m,debug:u}))}),ye=eD.forwardRef(({light:e,args:t,map:r,toneMapped:i=!1,color:n="white",form:a="rect",intensity:o=1,scale:s=1,target:l=[0,0,0],children:c,...u},h)=>{let A=eD.useRef(null);return eD.useImperativeHandle(h,()=>A.current,[]),eD.useLayoutEffect(()=>{c||u.material||((0,eR.k)(A.current.material,{color:n}),A.current.material.color.multiplyScalar(o))},[n,o,c,u.material]),eD.useLayoutEffect(()=>{u.rotation||A.current.quaternion.identity(),l&&!u.rotation&&("boolean"==typeof l?A.current.lookAt(0,0,0):A.current.lookAt(Array.isArray(l)?new eT.Pa4(...l):l))},[l,u.rotation]),s=Array.isArray(s)&&2===s.length?[s[0],s[1],1]:s,eD.createElement("mesh",(0,eS.Z)({ref:A,scale:s},u),"circle"===a?eD.createElement("ringGeometry",{args:t||[0,.5,64]}):"ring"===a?eD.createElement("ringGeometry",{args:t||[.25,.5,64]}):"rect"===a||"plane"===a?eD.createElement("planeGeometry",{args:t||[1,1]}):"box"===a?eD.createElement("boxGeometry",{args:t||[1,1,1]}):eD.createElement(a,{args:t}),c||eD.createElement("meshBasicMaterial",{toneMapped:i,map:r,side:eT.ehD}),e&&eD.createElement("pointLight",(0,eS.Z)({castShadow:!0}
2328,e)))});var yt=r(40697),yr=r(70782),yi=r(27819);class yn extends eT.jyz{constructor(){super({uniforms:{time:{value:0},pixelRatio:{value:1}},vertexShader:`
2329        uniform float pixelRatio;
2330        uniform float time;
2331        attribute float size;  
2332        attribute float speed;  
2333        attribute float opacity;
2334        attribute vec3 noise;
2335        attribute vec3 color;
2336        varying vec3 vColor;
2337        varying float vOpacity;
2338
2339        void main() {
2340          vec4 modelPosition = modelMatrix * vec4(position, 1.0);
2341          modelPosition.y += sin(time * speed + modelPosition.x * noise.x * 100.0) * 0.2;
2342          modelPosition.z += cos(time * speed + modelPosition.x * noise.y * 100.0) * 0.2;
2343          modelPosition.x += cos(time * speed + modelPosition.x * noise.z * 100.0) * 0.2;
2344          vec4 viewPosition = viewMatrix * modelPosition;
2345          vec4 projectionPostion = projectionMatrix * viewPosition;
2346          gl_Position = projectionPostion;
2347          gl_PointSize = size * 25. * pixelRatio;
2348          gl_PointSize *= (1.0 / - viewPosition.z);
2349          vColor = color;
2350          vOpacity = opacity;
2351        }
2352      `,fragmentShader:`
2353        varying vec3 vColor;
2354        varying float vOpacity;
2355        void main() {
2356          float distanceToCenter = distance(gl_PointCoord, vec2(0.5));
2357          float strength = 0.05 / distanceToCenter - 0.1;
2358          gl_FragColor = vec4(vColor, strength * vOpacity);
2359          #include <tonemapping_fragment>
2360          #include <${sI.i>=154?"colorspace_fragment":"encodings_fragment"}>
2361        }
2362      `})}get time(){return this.uniforms.time.value}set time(e){this.uniforms.time.value=e}get pixelRatio(){return this.uniforms.pixelRatio.value}set pixelRatio(e){this.uniforms.pixelRatio.value=e}}let ya=e=>e&&e.constructor===Float32Array,yo=e=>[e.r,e.g,e.b],ys=e=>e instanceof eT.FM8||e instanceof eT.Pa4||e instanceof eT.Ltg,yl=e=>Array.isArray(e)?e:ys(e)?e.toArray():[e,e,e];function yc(e,t,r){return eD.useMemo(()=>{if(void 0!==t){if(ya(t))return t;if(t instanceof eT.Ilk){let r=Array.from({length:3*e},()=>yo(t)).flat();return Float32Array.from(r)}if(ys(t)||Array.isArray(t)){let r=Array.from({length:3*e},()=>yl(t)).flat();return Float32Array.from(r)}return Float32Array.from({length:e},()=>t)}return Float32Array.from({length:e},r)},[t])}let yu=eD.forwardRef(({noise:e=1,count:t=100,speed:r=1,opacity:i=1,scale:n=1,size:a,color:o,children:s,...l},c)=>{eD.useMemo(()=>(0,eR.e)({SparklesImplMaterial:yn}),[]);let u=eD.useRef(null),h=(0,eR.D)(e=>e.viewport.dpr),A=yl(n),d=eD.useMemo(()=>Float32Array.from(Array.from({length:t},()=>A.map(eT.M8C.randFloatSpread)).flat()),[t,...A]),m=yc(t,a,Math.random),f=yc(t,i),p=yc(t,r),g=yc(3*t,e),y=yc(void 0===o?3*t:t,ya(o)?o:new eT.Ilk(o),()=>1);return(0,eR.F)(e=>{u.current&&u.current.material&&(u.current.material.time=e.clock.elapsedTime)}),eD.useImperativeHandle(c,()=>u.current,[]),eD.createElement("points",(0,eS.Z)({key:`particle-${t}-${JSON.stringify(n)}`},l,{ref:u}),eD.createElement("bufferGeometry",null,eD.createElement("bufferAttribute",{attach:"attributes-position",args:[d,3]}),eD.createElement("bufferAttribute",{attach:"attributes-size",args:[m,1]}),eD.createElement("bufferAttribute",{attach:"attributes-opacity",args:[f,1]}),eD.createElement("bufferAttribute",{attach:"attributes-speed",args:[p,1]}),eD.createElement("bufferAttribute",{attach:"attributes-color",args:[y,3]}),eD.createElement("bufferAttribute",{attach:"attributes-noise",args:[g,3]})),s||eD.createElement("sparklesImplMaterial",{transparent:!0,pixelRatio:h,depthWrite:!1}))});function yh(e=0,t=1024,r){let i=(0,oN.Rq)(()=>fetch("https://cdn.jsdelivr.net/gh/pmndrs/drei-assets@master/matcaps.json").then(e=>e.json()),["matcapList"]),n=i[0],a=eD.useMemo(()=>Object.keys(i).length,[]),o=eD.useMemo(()=>"string"==typeof e?e:"number"==typeof e?i[e]:null,[e]),s=`${o||n}${function(e){switch(e){case 64:return"-64px";case 128:return"-128px";case 256:return"-256px";case 512:return"-512px";default:return""}}(t)}.png`,l=`https://rawcdn.githack.com/emmelleppi/matcaps/9b36ccaaf0a24881a39062d05566c9e92be4aa0d/${t}/${s}`;return[(0,sB.mE)(l,r),l,a]}let yA=({children:e,id:t,format:r,onLoad:i})=>{let n=yh(t,r,i);return eD.createElement(eD.Fragment,null,null==e?void 0:e(n))};function yd(e=0,t={},r){let{repeat:i=[1,1],anisotropy:n=1,offset:a=[0,0]}=t,o=(0,oN.Rq)(()=>fetch("https://cdn.jsdelivr.net/gh/pmndrs/drei-assets@master/normals/normals.json").then(e=>e.json()),["normalsList"]),s=eD.useMemo(()=>Object.keys(o).length,[]),l=o[0],c=o[e]||l,u=`https://rawcdn.githack.com/pmndrs/drei-assets/7a3104997e1576f83472829815b00880d88b32fb/normals/${c}`,h=(0,sB.mE)(u,r);return eD.useLayoutEffect(()=>{h&&(h.wrapS=h.wrapT=eT.rpg,h.repeat=new eT.FM8(i[0],i[1]),h.offset=new eT.FM8(a[0],a[1]),h.anisotropy=n)},[h,n,i,a]),[h,u,s]}let ym=({children:e,id:t,onLoad:r,...i})=>{let n=yd(t,i,r);return eD.createElement(eD.Fragment,null,null==e?void 0:e(n))},yf={uniforms:{strokeOpacity:1,fillOpacity:.25,fillMix:0,thickness:.05,colorBackfaces:!1,dashInvert:!0,dash:!1,dashRepeats:4,dashLength:.5,squeeze:!1,squeezeMin:.2,squeezeMax:1,stroke:new eT.Ilk("#ff0000"),backfaceStroke:new eT.Ilk("#0000ff"),fill:new eT.Ilk("#00ff00")},vertex:`
2363	  attribute vec3 barycentric;
2364	
2365		varying vec3 v_edges_Barycentric;
2366		varying vec3 v_edges_Position;
2367
2368		void initWireframe() {
2369			v_edges_Barycentric = barycentric;
2370			v_edges_Position = position.xyz;
2371		}
2372	  `,fragment:`
2373		#ifndef PI
2374	  	#define PI 3.1415926535897932384626433832795
2375		#endif
2376  
2377	  varying vec3 v_edges_Barycentric;
2378	  varying vec3 v_edges_Position;
2379  
2380	  uniform float strokeOpacity;
2381	  uniform float fillOpacity;
2382	  uniform float fillMix;
2383	  uniform float thickness;
2384	  uniform bool colorBackfaces;
2385  
2386	  // Dash
2387	  uniform bool dashInvert;
2388	  uniform bool dash;
2389	  uniform bool dashOnly;
2390	  uniform float dashRepeats;
2391	  uniform float dashLength;
2392  
2393	  // Squeeze
2394	  uniform bool squeeze;
2395	  uniform float squeezeMin;
2396	  uniform float squeezeMax;
2397  
2398	  // Colors
2399	  uniform vec3 stroke;
2400	  uniform vec3 backfaceStroke;
2401	  uniform vec3 fill;
2402  
2403	  // This is like
2404	  float wireframe_aastep(float threshold, float dist) {
2405		  float afwidth = fwidth(dist) * 0.5;
2406		  return smoothstep(threshold - afwidth, threshold + afwidth, dist);
2407	  }
2408  
2409	  float wireframe_map(float value, float min1, float max1, float min2, float max2) {
2410		  return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
2411	  }
2412  
2413	  float getWireframe() {
2414			vec3 barycentric = v_edges_Barycentric;
2415		
2416			// Distance from center of each triangle to its edges.
2417			float d = min(min(barycentric.x, barycentric.y), barycentric.z);
2418
2419			// for dashed rendering, we can use this to get the 0 .. 1 value of the line length
2420			float positionAlong = max(barycentric.x, barycentric.y);
2421			if (barycentric.y < barycentric.x && barycentric.y < barycentric.z) {
2422				positionAlong = 1.0 - positionAlong;
2423			}
2424
2425			// the thickness of the stroke
2426			float computedThickness = wireframe_map(thickness, 0.0, 1.0, 0.0, 0.34);
2427
2428			// if we want to shrink the thickness toward the center of the line segment
2429			if (squeeze) {
2430				computedThickness *= mix(squeezeMin, squeezeMax, (1.0 - sin(positionAlong * PI)));
2431			}
2432
2433			// Create dash pattern
2434			if (dash) {
2435				// here we offset the stroke position depending on whether it
2436				// should overlap or not
2437				float offset = 1.0 / dashRepeats * dashLength / 2.0;
2438				if (!dashInvert) {
2439					offset += 1.0 / dashRepeats / 2.0;
2440				}
2441
2442				// if we should animate the dash or not
2443				// if (dashAnimate) {
2444				// 	offset += time * 0.22;
2445				// }
2446
2447				// create the repeating dash pattern
2448				float pattern = fract((positionAlong + offset) * dashRepeats);
2449				computedThickness *= 1.0 - wireframe_aastep(dashLength, pattern);
2450			}
2451
2452			// compute the anti-aliased stroke edge  
2453			float edge = 1.0 - wireframe_aastep(computedThickness, d);
2454
2455			return edge;
2456	  }
2457	  `},yp=sw(yf.uniforms,yf.vertex+`
2458  	void main() {
2459		initWireframe();
2460		gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
2461	}
2462  `,yf.fragment+`
2463  void main () {
2464		// Compute color
2465
2466		float edge = getWireframe();
2467		vec4 colorStroke = vec4(stroke, edge);
2468
2469		#ifdef FLIP_SIDED
2470			colorStroke.rgb = backfaceStroke;
2471		#endif
2472    
2473		vec4 colorFill = vec4(fill, fillOpacity);
2474		vec4 outColor = mix(colorFill, colorStroke, edge * strokeOpacity);
2475
2476		gl_FragColor = outColor;
2477	}
2478  `);function yg(e){return(null==e?void 0:e.current)!==void 0}function yy(e){return"WireframeGeometry"===e.type}function yv(e){let t=null!=e&&e.current?e.current:e;if(null!=t&&t.isBufferGeometry)return t;{if(yy(t))throw Error("Wireframe: WireframeGeometry is not supported.");let e=t.parent;if(null!=e&&e.geometry){if(yy(e.geometry))throw Error("Wireframe: WireframeGeometry is not supported.");return e.geometry}}}function yE(e,t){if(e.index){console.warn("Wireframe: Requires non-indexed geometry, converting to non-indexed geometry.");let t=e.toNonIndexed();e.copy(t),e.setIndex(null)}let r=function(e,t){let r=e.getAttribute("position").count,i=[];for(let e=0;e<r;e++){let r=t?1:0;e%2==0?i.push(0,0,1,0,1,0,1,0,r):i.push(0,1,0,0,0,1,1,0,r)}return new eT.TlE(Float32Array.from(i),3)}(e,t);e.setAttribute("barycentric",r)}function yx({geometry:e,simplify:t=!1,...r}){(0,eR.e)({MeshWireframeMaterial:yp});let[i,n]=eD.useState(null);eD.useLayoutEffect(()=>{let r=yv(e);if(!r)throw Error("Wireframe: geometry prop must be a BufferGeometry or a ref to a BufferGeometry.");yE(r,t),yg(e)&&n(r)},[t,e]);let a=yg(e)?i:e;return eD.createElement(eD.Fragment,null,a&&eD.createElement("mesh",{geometry:a},eD.createElement("meshWireframeMaterial",(0,eS.Z)({attach:"material",transparent:!0,side:eT.ehD,polygonOffset:!0,polygonOffsetFactor:-4},r,{extensions:{derivatives:!0,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1}}))))}function yC({simplify:e=!1,...t}){let r=eD.useRef(null),i=eD.useMemo(()=>(function(){let e={};for(let t in yf.uniforms)e[t]={value:yf.uniforms[t]};return e})(),[yf.uniforms]);return eD.useEffect(()=>{var e;i.fillOpacity.value=null!==(e=t.fillOpacity)&&void 0!==e?e:i.fillOpacity.value},[t.fillOpacity]),eD.useEffect(()=>{var e;i.fillMix.value=null!==(e=t.fillMix)&&void 0!==e?e:i.fillMix.value},[t.fillMix]),eD.useEffect(()=>{var e;i.strokeOpacity.value=null!==(e=t.strokeOpacity)&&void 0!==e?e:i.strokeOpacity.value},[t.strokeOpacity]),eD.useEffect(()=>{var e;i.thickness.value=null!==(e=t.thickness)&&void 0!==e?e:i.thickness.value},[t.thickness]),eD.useEffect(()=>void(i.colorBackfaces.value=!!t.colorBackfaces),[t.colorBackfaces]),eD.useEffect(()=>void(i.dash.value=!!t.dash),[t.dash]),eD.useEffect(()=>void(i.dashInvert.value=!!t.dashInvert),[t.dashInvert]),eD.useEffect(()=>{var e;i.dashRepeats.value=null!==(e=t.dashRepeats)&&void 0!==e?e:i.dashRepeats.value},[t.dashRepeats]),eD.useEffect(()=>{var e;i.dashLength.value=null!==(e=t.dashLength)&&void 0!==e?e:i.dashLength.value},[t.dashLength]),eD.useEffect(()=>void(i.squeeze.value=!!t.squeeze),[t.squeeze]),eD.useEffect(()=>{var e;i.squeezeMin.value=null!==(e=t.squeezeMin)&&void 0!==e?e:i.squeezeMin.value},[t.squeezeMin]),eD.useEffect(()=>{var e;i.squeezeMax.value=null!==(e=t.squeezeMax)&&void 0!==e?e:i.squeezeMax.value},[t.squeezeMax]),eD.useEffect(()=>void(i.stroke.value=t.stroke?new eT.Ilk(t.stroke):i.stroke.value),[t.stroke]),eD.useEffect(()=>void(i.fill.value=t.fill?new eT.Ilk(t.fill):i.fill.value),[t.fill]),eD.useEffect(()=>void(i.backfaceStroke.value=t.backfaceStroke?new eT.Ilk(t.backfaceStroke):i.backfaceStroke.value),[t.backfaceStroke]),eD.useLayoutEffect(()=>{let t=yv(r);if(!t)throw Error("Wireframe: Must be a child of a Mesh, Line or Points object or specify a geometry prop.");let i=t.clone();return yE(t,e),()=>{t.copy(i),i.dispose()}},[e]),eD.useLayoutEffect(()=>{var e;let t=r.current.parent,n=t.material.clone();return(e=t.material).onBeforeCompile=e=>{e.uniforms={...e.uniforms,...i},e.vertexShader=e.vertexShader.replace("void main() {",`
2479		  ${yf.vertex}
2480		  void main() {
2481			initWireframe();
2482		`),e.fragmentShader=e.fragmentShader.replace("void main() {",`
2483		  ${yf.fragment}
2484		  void main() {
2485		`),e.fragmentShader=e.fragmentShader.replace("#include <color_fragment>",`
2486		  #include <color_fragment>
2487			  float edge = getWireframe();
2488		  vec4 colorStroke = vec4(stroke, edge);
2489		  #ifdef FLIP_SIDED
2490			colorStroke.rgb = backfaceStroke;
2491		  #endif
2492		  vec4 colorFill = vec4(mix(diffuseColor.rgb, fill, fillMix), mix(diffuseColor.a, fillOpacity, fillMix));
2493		  vec4 outColor = mix(colorFill, colorStroke, edge * strokeOpacity);
2494
2495		  diffuseColor.rgb = outColor.rgb;
2496		  diffuseColor.a *= outColor.a;
2497		`)},e.side=eT.ehD,e.transparent=!0,()=>{t.material.dispose(),t.material=n}},[]),eD.createElement("object3D",{ref:r})}function yw({geometry:e,...t}){return e?eD.createElement(yx,(0,eS.Z)({geometry:e},t)):eD.createElement(yC,t)}function yB({opacity:e,alphaMap:t}){let r=eD.useRef(null),i=eD.useRef(null),n=eD.useRef({value:1}),a=eD.useRef({value:null}),o=eD.useRef({value:!1});return eD.useLayoutEffect(()=>{r.current.onBeforeCompile=i.current.onBeforeCompile=e=>{let t;let r=e.fragmentShader.indexOf("void main"),i="",s=r;for(;"\n"!==t&&s<r+100;)i+=t=e.fragmentShader.charAt(s),s++;i=i.trim(),e.vertexShader=e.vertexShader.replace("void main() {",`
2498        varying vec2 custom_vUv;
2499
2500        void main() {
2501          custom_vUv = uv;
2502          
2503        `),e.fragmentShader=e.fragmentShader.replace(i,`
2504          uniform float uShadowOpacity;
2505          uniform sampler2D uAlphaMap;
2506          uniform bool uHasAlphaMap;
2507
2508          varying vec2 custom_vUv;
2509  
2510          float bayerDither2x2( vec2 v ) {
2511            return mod( 3.0 * v.y + 2.0 * v.x, 4.0 );
2512          }
2513    
2514          float bayerDither4x4( vec2 v ) {
2515            vec2 P1 = mod( v, 2.0 );
2516            vec2 P2 = mod( floor( 0.5  * v ), 2.0 );
2517            return 4.0 * bayerDither2x2( P1 ) + bayerDither2x2( P2 );
2518          }
2519  
2520          void main() {
2521            float alpha = 
2522              uHasAlphaMap ? 
2523                uShadowOpacity * texture2D(uAlphaMap, custom_vUv).x
2524              : uShadowOpacity;
2525
2526            if( ( bayerDither4x4( floor( mod( gl_FragCoord.xy, 4.0 ) ) ) ) / 16.0 >= alpha ) discard;
2527            
2528          `),e.uniforms.uShadowOpacity=n.current,e.uniforms.uAlphaMap=a.current,e.uniforms.uHasAlphaMap=o.current}},[]),(0,eR.F)(()=>{var i;let s=null==(i=r.current.__r3f)?void 0:i.parent;if(s){let r=s.material;r&&(n.current.value=null!=e?e:r.opacity,!1===t?(a.current.value=null,o.current.value=!1):(a.current.value=t||r.alphaMap,o.current.value=!!a.current.value))}}),eD.createElement(eD.Fragment,null,eD.createElement("meshDepthMaterial",{ref:r,attach:"customDepthMaterial",depthPacking:eT.mSO}),eD.createElement("meshDistanceMaterial",{ref:i,attach:"customDistanceMaterial"}))}let yI=new eT.yGw,y_=new eT.zHn,yb=new eT.aLr,yM=new eT.Pa4;class yS extends eT.ZAu{constructor(){super(),this.size=0,this.color=new eT.Ilk("white"),this.instance={current:void 0},this.instanceKey={current:void 0}}get geometry(){var e;return null==(e=this.instance.current)?void 0:e.geometry}raycast(e,t){var r,i;let n=this.instance.current;if(!n||!n.geometry)return;let a=n.userData.instances.indexOf(this.instanceKey);if(-1===a||a>n.geometry.drawRange.count)return;let o=null!==(r=null==(i=e.params.Points)?void 0:i.threshold)&&void 0!==r?r:1;if(yb.set(this.getWorldPosition(yM),o),!1===e.ray.intersectsSphere(yb))return;yI.copy(n.matrixWorld).invert(),y_.copy(e.ray).applyMatrix4(yI);let s=o/((this.scale.x+this.scale.y+this.scale.z)/3),l=y_.distanceSqToPoint(this.position);if(l<s*s){let r=new eT.Pa4;
2528y_.closestPointToPoint(this.position,r),r.applyMatrix4(this.matrixWorld);let i=e.ray.origin.distanceTo(r);if(i<e.near||i>e.far)return;t.push({distance:i,distanceToRay:Math.sqrt(l),point:r,index:a,face:null,object:this})}}}let yD=eD.createContext(null),yP=new eT.yGw,yT=new eT.Pa4,yR=eD.forwardRef(({children:e,range:t,limit:r=1e3,...i},n)=>{let a=eD.useRef(null);eD.useImperativeHandle(n,()=>a.current,[]);let[o,s]=eD.useState([]),[[l,c,u]]=eD.useState(()=>[new Float32Array(3*r),Float32Array.from({length:3*r},()=>1),Float32Array.from({length:r},()=>1)]);eD.useEffect(()=>{a.current.geometry.attributes.position.needsUpdate=!0}),(0,eR.F)(()=>{for(a.current.updateMatrix(),a.current.updateMatrixWorld(),yP.copy(a.current.matrixWorld).invert(),a.current.geometry.drawRange.count=Math.min(r,void 0!==t?t:r,o.length),H=0;H<o.length;H++)(j=o[H].current).getWorldPosition(yT).applyMatrix4(yP),yT.toArray(l,3*H),a.current.geometry.attributes.position.needsUpdate=!0,j.matrixWorldNeedsUpdate=!0,j.color.toArray(c,3*H),a.current.geometry.attributes.color.needsUpdate=!0,u.set([j.size],H),a.current.geometry.attributes.size.needsUpdate=!0});let h=eD.useMemo(()=>({getParent:()=>a,subscribe:e=>(s(t=>[...t,e]),()=>s(t=>t.filter(t=>t.current!==e.current)))}),[]);return eD.createElement("points",(0,eS.Z)({userData:{instances:o},matrixAutoUpdate:!1,ref:a,raycast:()=>null},i),eD.createElement("bufferGeometry",null,eD.createElement("bufferAttribute",{attach:"attributes-position",count:l.length/3,array:l,itemSize:3,usage:eT.dj0}),eD.createElement("bufferAttribute",{attach:"attributes-color",count:c.length/3,array:c,itemSize:3,usage:eT.dj0}),eD.createElement("bufferAttribute",{attach:"attributes-size",count:u.length,array:u,itemSize:1,usage:eT.dj0})),eD.createElement(yD.Provider,{value:h},e))}),yF=eD.forwardRef(({children:e,...t},r)=>{eD.useMemo(()=>(0,eR.e)({PositionPoint:yS}),[]);let i=eD.useRef(null);eD.useImperativeHandle(r,()=>i.current,[]);let{subscribe:n,getParent:a}=eD.useContext(yD);return eD.useLayoutEffect(()=>n(i),[]),eD.createElement("positionPoint",(0,eS.Z)({instance:a(),instanceKey:i,ref:i},t),e)}),yQ=eD.forwardRef(({children:e,positions:t,colors:r,sizes:i,stride:n=3,...a},o)=>{let s=eD.useRef(null);return eD.useImperativeHandle(o,()=>s.current,[]),(0,eR.F)(()=>{let e=s.current.geometry.attributes;e.position.needsUpdate=!0,r&&(e.color.needsUpdate=!0),i&&(e.size.needsUpdate=!0)}),eD.createElement("points",(0,eS.Z)({ref:s},a),eD.createElement("bufferGeometry",null,eD.createElement("bufferAttribute",{attach:"attributes-position",count:t.length/n,array:t,itemSize:n,usage:eT.dj0}),r&&eD.createElement("bufferAttribute",{attach:"attributes-color",count:r.length/n,array:r,itemSize:3,usage:eT.dj0}),i&&eD.createElement("bufferAttribute",{attach:"attributes-size",count:i.length/n,array:i,itemSize:1,usage:eT.dj0})),e)}),yz=eD.forwardRef((e,t)=>e.positions instanceof Float32Array?eD.createElement(yQ,(0,eS.Z)({},e,{ref:t})):eD.createElement(yR,(0,eS.Z)({},e,{ref:t}))),yk=eD.createContext(null),yL=eD.forwardRef((e,t)=>{eD.useMemo(()=>(0,eR.e)({SegmentObject:yO}),[]);let{limit:r=1e3,lineWidth:i=1,children:n,...a}=e,[o,s]=eD.useState([]),[l]=eD.useState(()=>new oF),[c]=eD.useState(()=>new op),[u]=eD.useState(()=>new om),[h]=eD.useState(()=>new eT.FM8(512,512)),[A]=eD.useState(()=>Array(6*r).fill(0)),[d]=eD.useState(()=>Array(6*r).fill(0)),m=eD.useMemo(()=>({subscribe:e=>(s(t=>[...t,e]),()=>s(t=>t.filter(t=>t.current!==e.current)))}),[]);return(0,eR.F)(()=>{for(let t=0;t<r;t++){var e;let r=null==(e=o[t])?void 0:e.current;r&&(A[6*t+0]=r.start.x,A[6*t+1]=r.start.y,A[6*t+2]=r.start.z,A[6*t+3]=r.end.x,A[6*t+4]=r.end.y,A[6*t+5]=r.end.z,d[6*t+0]=r.color.r,d[6*t+1]=r.color.g,d[6*t+2]=r.color.b,d[6*t+3]=r.color.r,d[6*t+4]=r.color.g,d[6*t+5]=r.color.b)}u.setColors(d),u.setPositions(A),l.computeLineDistances()}),eD.createElement("primitive",{object:l,ref:t},eD.createElement("primitive",{object:u,attach:"geometry"}),eD.createElement("primitive",(0,eS.Z)({object:c,attach:"material",vertexColors:!0,resolution:h,linewidth:i},a)),eD.createElement(yk.Provider,{value:m},n))});class yO{constructor(){this.color=new eT.Ilk("white"),this.start=new eT.Pa4(0,0,0),this.end=new eT.Pa4(0,0,0)}}let yU=e=>e instanceof eT.Pa4?e:new eT.Pa4(..."number"==typeof e?[e,e,e]:e),yG=eD.forwardRef(({color:e,start:t,end:r},i)=>{let n=eD.useContext(yk);if(!n)throw"Segment must used inside Segments component.";let a=eD.useRef(null);return eD.useImperativeHandle(i,()=>a.current,[]),eD.useLayoutEffect(()=>n.subscribe(a),[]),eD.createElement("segmentObject",{ref:a,color:e,start:yU(t),end:yU(r)})}),yN=eD.forwardRef(({children:e,hysteresis:t=0,distances:r,...i},n)=>{let a=eD.useRef(null);return eD.useImperativeHandle(n,()=>a.current,[]),eD.useLayoutEffect(()=>{let{current:e}=a;
2528e.levels.length=0,e.children.forEach((i,n)=>e.levels.push({object:i,hysteresis:t,distance:r[n]}))}),(0,eR.F)(e=>{var t;return null==(t=a.current)?void 0:t.update(e.camera)}),eD.createElement("lOD",(0,eS.Z)({ref:a},i),e)});function yH({all:e,scene:t,camera:r}){let i=(0,eR.D)(({gl:e})=>e),n=(0,eR.D)(({camera:e})=>e),a=(0,eR.D)(({scene:e})=>e);return eD.useLayoutEffect(()=>{let o=[];e&&(t||a).traverse(e=>{!1===e.visible&&(o.push(e),e.visible=!0)}),i.compile(t||a,r||n);let s=new eT.oAp(128);new eT._am(.01,1e5,s).update(i,t||a),s.dispose(),o.forEach(e=>e.visible=!1)},[]),null}function yj(){let e=(0,eR.D)(e=>e.gl);return(0,eD.useEffect)(()=>(e.shadowMap.autoUpdate=!1,e.shadowMap.needsUpdate=!0,()=>{e.shadowMap.autoUpdate=e.shadowMap.needsUpdate=!0}),[e.shadowMap]),null}let yJ=new eT.yGw,yV=new eT.zHn,yK=new eT.aLr,yY=new eT.Pa4;function yW(e,t){let r=this.geometry,i=this.material,n=this.matrixWorld;void 0!==i&&(null===r.boundingSphere&&r.computeBoundingSphere(),yK.copy(r.boundingSphere),yK.applyMatrix4(n),!1!==e.ray.intersectsSphere(yK)&&(yJ.copy(n).invert(),yV.copy(e.ray).applyMatrix4(yJ),(null===r.boundingBox||null!==yV.intersectBox(r.boundingBox,yY))&&t.push({distance:yY.distanceTo(e.ray.origin),point:yY.clone(),object:this})))}function yq({pixelated:e}){let t=(0,eR.D)(e=>e.gl),r=(0,eR.D)(e=>e.internal.active),i=(0,eR.D)(e=>e.performance.current),n=(0,eR.D)(e=>e.viewport.initialDpr),a=(0,eR.D)(e=>e.setDpr);return eD.useEffect(()=>{let i=t.domElement;return()=>{r&&a(n),e&&i&&(i.style.imageRendering="auto")}},[]),eD.useEffect(()=>{a(i*n),e&&t.domElement&&(t.domElement.style.imageRendering=1===i?"auto":"pixelated")},[i]),null}function yX(){let e=(0,eR.D)(e=>e.get),t=(0,eR.D)(e=>e.setEvents),r=(0,eR.D)(e=>e.performance.current);return eD.useEffect(()=>{let r=e().events.enabled;return()=>t({enabled:r})},[]),eD.useEffect(()=>t({enabled:1===r}),[r]),null}let yZ=(0,eD.createContext)(null);function y$({iterations:e=10,ms:t=250,threshold:r=.75,step:i=.1,factor:n=.5,flipflops:a=1/0,bounds:o=e=>e>100?[60,100]:[40,60],onIncline:s,onDecline:l,onChange:c,onFallback:u,children:h}){let[A,d]=(0,eD.useState)(()=>({fps:0,index:0,factor:n,flipped:0,refreshrate:0,fallback:!1,frames:[],averages:[],subscriptions:new Map,subscribe:e=>{let t=Symbol();return A.subscriptions.set(t,e.current),()=>void A.subscriptions.delete(t)}})),m=0;return(0,eR.F)(()=>{let{frames:n,averages:h}=A;if(!A.fallback&&h.length<e){n.push(performance.now());let d=n[n.length-1]-n[0];if(d>=t){if(A.fps=Math.round(n.length/d*1e3)/1,A.refreshrate=Math.max(A.refreshrate,A.fps),h[A.index++%e]=A.fps,h.length===e){let[t,n]=o(A.refreshrate),d=h.filter(e=>e>=n),f=h.filter(e=>e<t);d.length>e*r&&(A.factor=Math.min(1,A.factor+i),A.flipped++,s&&s(A),A.subscriptions.forEach(e=>e.onIncline&&e.onIncline(A))),f.length>e*r&&(A.factor=Math.max(0,A.factor-i),A.flipped++,l&&l(A),A.subscriptions.forEach(e=>e.onDecline&&e.onDecline(A))),m!==A.factor&&(m=A.factor,c&&c(A),A.subscriptions.forEach(e=>e.onChange&&e.onChange(A))),A.flipped>a&&!A.fallback&&(A.fallback=!0,u&&u(A),A.subscriptions.forEach(e=>e.onFallback&&e.onFallback(A))),A.averages=[]}A.frames=[]}}}),eD.createElement(yZ.Provider,{value:A},h)}function y1({onIncline:e,onDecline:t,onChange:r,onFallback:i}){let n=(0,eD.useContext)(yZ),a=(0,eD.useRef)({onIncline:e,onDecline:t,onChange:r,onFallback:i});(0,eD.useLayoutEffect)(()=>{a.current.onIncline=e,a.current.onDecline=t,a.current.onChange=r,a.current.onFallback=i},[e,t,r,i]),(0,eD.useLayoutEffect)(()=>n.subscribe(a),[n])}let y0=eD.forwardRef(({children:e,compute:t,width:r,height:i,samples:n=8,renderPriority:a=0,eventPriority:o=0,frames:s=1/0,stencilBuffer:l=!1,depthBuffer:c=!0,generateMipmaps:u=!1,...h},A)=>{let{size:d,viewport:m}=(0,eR.D)(),f=cs((r||d.width)*m.dpr,(i||d.height)*m.dpr,{samples:n,stencilBuffer:l,depthBuffer:c,generateMipmaps:u}),[p]=eD.useState(()=>new eT.xsS),g=eD.useCallback((e,t,r)=>{var i,n;let a=null==(i=f.texture)?void 0:i.__r3f.parent;for(;a&&!(a instanceof eT.Tme);)a=a.__r3f.parent;if(!a)return!1;r.raycaster.camera||r.events.compute(e,r,null==(n=r.previousRoot)?void 0:n.getState());let[o]=r.raycaster.intersectObject(a);if(!o)return!1;let s=o.uv;if(!s)return!1;t.raycaster.setFromCamera(t.pointer.set(2*s.x-1,2*s.y-1),t.camera)},[]);return eD.useImperativeHandle(A,()=>f.texture,[f]),eD.createElement(eD.Fragment,null,(0,eR.h)(eD.createElement(y2,{renderPri
2528ority:a,frames:s,fbo:f},e,eD.createElement("group",{onPointerOver:()=>null})),p,{events:{compute:t||g,priority:o}}),eD.createElement("primitive",(0,eS.Z)({object:f.texture},h)))});function y2({frames:e,renderPriority:t,children:r,fbo:i}){let n,a,o,s,l=0;return(0,eR.F)(t=>{(e===1/0||l<e)&&(n=t.gl.autoClear,a=t.gl.xr.enabled,o=t.gl.getRenderTarget(),s=t.gl.xr.isPresenting,t.gl.autoClear=!0,t.gl.xr.enabled=!1,t.gl.xr.isPresenting=!1,t.gl.setRenderTarget(i),t.gl.render(t.scene,t.camera),t.gl.setRenderTarget(o),t.gl.autoClear=n,t.gl.xr.enabled=a,t.gl.xr.isPresenting=s,l++)},t),eD.createElement(eD.Fragment,null,r)}let y3=eD.forwardRef(({children:e,compute:t,renderPriority:r=-1,eventPriority:i=0,frames:n=1/0,stencilBuffer:a=!1,depthBuffer:o=!0,generateMipmaps:s=!1,resolution:l=896,near:c=.1,far:u=1e3,flip:h=!1,position:A,rotation:d,scale:m,quaternion:f,matrix:p,matrixAutoUpdate:g,...y},v)=>{let{size:E,viewport:x}=(0,eR.D)(),C=eD.useRef(null),w=eD.useMemo(()=>{let e=new eT.oAp(Math.max((l||E.width)*x.dpr,(l||E.height)*x.dpr),{stencilBuffer:a,depthBuffer:o,generateMipmaps:s});return e.texture.isRenderTargetTexture=!h,e.texture.flipY=!0,e.texture.type=eT.cLu,e},[l,h]);eD.useEffect(()=>()=>w.dispose(),[w]);let[B]=eD.useState(()=>new eT.xsS);return eD.useImperativeHandle(v,()=>({scene:B,fbo:w,camera:C.current}),[w]),eD.createElement(eD.Fragment,null,(0,eR.h)(eD.createElement(y4,{renderPri
2528ority:r,frames:n,camera:C},e,eD.createElement("group",{onPointerOver:()=>null})),B,{events:{compute:t,priority:i}}),eD.createElement("primitive",(0,eS.Z)({object:w.texture},y)),eD.createElement("cubeCamera",{ref:C,args:[c,u,w],position:A,rotation:d,scale:m,quaternion:f,matrix:p,matrixAutoUpdate:g}))});function y4({frames:e,renderPriority:t,children:r,camera:i}){let n=0;return(0,eR.F)(t=>{(e===1/0||n<e)&&(i.current.update(t.gl,t.scene),n++)},t),eD.createElement(eD.Fragment,null,r)}let y5=eD.forwardRef(({id:e=1,colorWrite:t=!1,depthWrite:r=!1,...i},n)=>{let a=eD.useRef(null),o=eD.useMemo(()=>({colorWrite:t,depthWrite:r,stencilWrite:!0,stencilRef:e,stencilFunc:eT.cum,stencilFail:eT.ce8,stencilZFail:eT.ce8,stencilZPass:eT.ce8}),[e,t,r]);return eD.useLayoutEffect(()=>{Object.assign(a.current.material,o)}),eD.useImperativeHandle(n,()=>a.current,[]),eD.createElement("mesh",(0,eS.Z)({ref:a,renderOrder:-e},i))});function y6(e,t=!1){return{stencilWrite:!0,stencilRef:e,stencilFunc:t?eT.RvT:eT.jwo,stencilFail:eT.x5V,stencilZFail:eT.x5V,stencilZPass:eT.x5V}}function y8({renderPriority:e=1,zoom:t=0,segments:r=64,children:i,resolution:n=896,...a}){let o=eD.useRef(null),s=eD.useRef(null),{width:l,height:c}=(0,eR.D)(e=>e.size),[u]=eD.useState(()=>new eT.iKG);eD.useLayoutEffect(()=>{u.position.set(0,0,100),u.zoom=100,u.left=-(l/2),u.right=l/2,u.top=c/2,u.bottom=-(c/2),u.updateProjectionMatrix()},[l,c]);let h=Math.sqrt(l*l+c*c)/100*(.5+t/2),A=new eT.Pa4,d=new eT.aLr(new eT.Pa4,h),m=new eT.Vkp,f=eD.useCallback((e,t,r)=>{t.pointer.set(e.offsetX/t.size.width*2-1,-(e.offsetY/t.size.height*2)+1),t.raycaster.setFromCamera(t.pointer,u),t.raycaster.ray.intersectSphere(d,A)&&(A.normalize(),m.getNormalMatrix(s.current.camera.matrixWorld),s.current.camera.getWorldPosition(t.raycaster.ray.origin),t.raycaster.ray.direction.set(0,0,1).reflect(A),t.raycaster.ray.direction.x*=-1,t.raycaster.ray.direction.applyNormalMatrix(m).multiplyScalar(-1))},[]);return(0,eR.F)(t=>{e&&t.gl.render(o.current,u)},e),eD.createElement(eD.Fragment,null,eD.createElement("mesh",(0,eS.Z)({ref:o},a,{scale:h}),eD.createElement("sphereGeometry",{args:[1,r,r]}),eD.createElement("meshBasicMaterial",null,eD.createElement(y3,{compute:f,attach:"envMap",flip:!0,resolution:n,ref:s},i,eD.createElement(y9,{api:s})))))}function y9({api:e}){let t=new eT.Pa4,r=new eT._fP,i=new eT.Pa4,n=new eT.USm(0,Math.PI,0);return(0,eR.F)(a=>{a.camera.matrixWorld.decompose(t,r,i),e.current.camera.position.copy(t),e.current.camera.quaternion.setFromEuler(n).premultiply(r)}),null}let y7=sw({blur:0,map:null,sdf:null,blend:0,size:0,resolution:new eT.FM8},`varying vec2 vUv;
2529   void main() {
2530     gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
2531     vUv = uv;
2532   }`,`uniform sampler2D sdf;
2533   uniform sampler2D map;
2534   uniform float blur;
2535   uniform float size;
2536   uniform float time;
2537   uniform vec2 resolution;
2538   varying vec2 vUv;
2539   #include <packing>
2540   void main() {
2541     vec2 uv = gl_FragCoord.xy / resolution.xy;
2542     vec4 t = texture2D(map, uv);
2543     float k = blur;
2544     float d = texture2D(sdf, vUv).r/size;
2545     float alpha = 1.0 - smoothstep(0.0, 1.0, clamp(d/k + 1.0, 0.0, 1.0));
2546     gl_FragColor = vec4(t.rgb, blur == 0.0 ? t.a : t.a * alpha);
2547     #include <tonemapping_fragment>
2548     #include <${sI.i>=154?"colorspace_fragment":"encodings_fragment"}>
2549   }`),ve=eD.forwardRef(({children:e,events:t,blur:r=0,eventPriority:i=0,renderPriority:n=0,worldUnits:a=!1,resolution:o=512,...s},l)=>{(0,eR.e)({PortalMaterialImpl:y7});let c=eD.useRef(null),{scene:u,gl:h,size:A,viewport:d,setEvents:m}=(0,eR.D)(),f=cs(o,o),[p,g]=eD.useState(0);(0,eR.F)(()=>{let e=c.current.blend>0?Math.max(1,n):0;p!==e&&g(e)}),eD.useEffect(()=>{void 0!==t&&m({enabled:!t})},[t]);let[y,v]=eD.useState(!0),E=fo(v);eD.useLayoutEffect(()=>{var e;E.current=null==(e=c.current)?void 0:e.__r3f.parent},[]),eD.useLayoutEffect(()=>{if(E.current&&r&&null===c.current.sdf){let e=new eT.Kj0(E.current.geometry,new eT.vBJ),t=new eT.ZzF().setFromBufferAttribute(e.geometry.attributes.position),r=new eT.iKG(t.min.x*(1+2/o),t.max.x*(1+2/o),t.max.y*(1+2/o),t.min.y*(1+2/o),.1,1e3);r.position.set(0,0,1),r.lookAt(0,0,0),h.setRenderTarget(f),h.render(e,r);let i=vr(o,o,h)(f.texture),n=new Float32Array(o*o);h.readRenderTargetPixels(i,0,0,o,o,n);let a=1/0;for(let e=0;e<n.length;e++)n[e]<a&&(a=n[e]);a=-a,c.current.size=a,c.current.sdf=i.texture,h.setRenderTarget(null)}},[o,r]),eD.useImperativeHandle(l,()=>c.current);let x=eD.useCallback((e,t,r)=>{var i;if(!E.current)return!1;if(t.pointer.set(e.offsetX/t.size.width*2-1,-(e.offsetY/t.size.height*2)+1),t.raycaster.setFromCamera(t.pointer,t.camera),(null==(i=c.current)?void 0:i.blend)===0){let[e]=t.raycaster.intersectObject(E.current);if(!e)return t.raycaster.camera=void 0,!1}},[]);return eD.createElement("portalMaterialImpl",(0,eS.Z)({ref:c,blur:r,blend:0,resolution:[A.width*d.dpr,A.height*d.dpr],attach:"material"},s),eD.createElement(y0,{attach:"map",frames:y?1/0:0,eventPriority:i,renderPri
2549ority:n,compute:x},e,eD.createElement(vt,{events:t,rootScene:u,priority:p,material:c,worldUnits:a})))});function vt({events:e,rootScene:t,material:r,priority:i,worldUnits:n}){let a=(0,eR.D)(e=>e.scene),o=(0,eR.D)(e=>e.setEvents),s=cs(),l=cs();eD.useLayoutEffect(()=>{a.matrixAutoUpdate=!1},[]),eD.useEffect(()=>{void 0!==e&&o({enabled:e})},[e]);let[c,u]=eD.useMemo(()=>{let e={value:0};return[new se(new eT.jyz({uniforms:{a:{value:s.texture},b:{value:l.texture},blend:e},vertexShader:`
2550          varying vec2 vUv;
2551          void main() {
2552            vUv = uv;
2553            gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
2554          }`,fragmentShader:`
2555          uniform sampler2D a;
2556          uniform sampler2D b;
2557          uniform float blend;
2558          varying vec2 vUv;
2559          #include <packing>
2560          void main() {
2561            vec4 ta = texture2D(a, vUv);
2562            vec4 tb = texture2D(b, vUv);
2563            gl_FragColor = mix(tb, ta, blend);
2564            #include <tonemapping_fragment>
2565            #include <${sI.i>=154?"colorspace_fragment":"encodings_fragment"}>
2566          }`})),e]},[]);return(0,eR.F)(e=>{var o,h,A,d,m;let f=null==r||null==(o=r.current)?void 0:o.__r3f.parent;f&&(n?a.matrixWorld.identity():(i&&(null==(h=r.current)?void 0:h.blend)===1&&f.updateWorldMatrix(!0,!1),a.matrixWorld.copy(f.matrixWorld)),i&&((null==(A=r.current)?void 0:A.blend)>0&&(null==(d=r.current)?void 0:d.blend)<1?(u.value=r.current.blend,e.gl.setRenderTarget(s),e.gl.render(a,e.camera),e.gl.setRenderTarget(l),e.gl.render(t,e.camera),e.gl.setRenderTarget(null),c.render(e.gl)):(null==(m=r.current)?void 0:m.blend)===1&&e.gl.render(a,e.camera)))},i),eD.createElement(eD.Fragment,null)}let vr=(e,t,r)=>{let i=new eT.dd2(e,t,{minFilter:eT.D1R,magFilter:eT.wem,type:eT.VzW,format:eT.hEm,generateMipmaps:!0}),n=new eT.dd2(e,t,{minFilter:eT.TyD,magFilter:eT.TyD}),a=new eT.dd2(e,t,{minFilter:eT.TyD,magFilter:eT.TyD}),o=new eT.dd2(e,t,{minFilter:eT.TyD,magFilter:eT.TyD}),s=new eT.dd2(e,t,{minFilter:eT.TyD,magFilter:eT.TyD}),l=new eT.dd2(e,t,{minFilter:eT.TyD,magFilter:eT.TyD,type:eT.VzW,format:eT.hEm}),c=new eT.dd2(e,t,{minFilter:eT.TyD,magFilter:eT.TyD,type:eT.VzW,format:eT.hEm}),u=new se(new eT.jyz({uniforms:{tex:{value:null}},vertexShader:`
2567        varying vec2 vUv;
2568        void main() {
2569          vUv = uv;
2570          gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
2571        }`,fragmentShader:`
2572        uniform sampler2D tex;
2573        varying vec2 vUv;
2574        #include <packing>
2575        void main() {
2576          gl_FragColor = pack2HalfToRGBA(vUv * (round(texture2D(tex, vUv).x)));
2577        }`})),h=new se(new eT.jyz({uniforms:{tex:{value:null}},vertexShader:`
2578        varying vec2 vUv;
2579        void main() {
2580          vUv = uv;
2581          gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
2582        }`,fragmentShader:`
2583        uniform sampler2D tex;
2584        varying vec2 vUv;
2585        #include <packing>
2586        void main() {
2587          gl_FragColor = pack2HalfToRGBA(vUv * (1.0 - round(texture2D(tex, vUv).x)));
2588        }`})),A=new se(new eT.jyz({uniforms:{tex:{value:null},offset:{value:0},level:{value:0},maxSteps:{value:0}},vertexShader:`
2589        varying vec2 vUv;
2590        void main() {
2591          vUv = uv;
2592          gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
2593        }`,fragmentShader:`
2594        varying vec2 vUv;
2595        uniform sampler2D tex;
2596        uniform float offset;
2597        uniform float level;
2598        uniform float maxSteps;
2599        #include <packing>
2600        void main() {
2601          float closestDist = 9999999.9;
2602          vec2 closestPos = vec2(0.0);
2603          for (float x = -1.0; x <= 1.0; x += 1.0) {
2604            for (float y = -1.0; y <= 1.0; y += 1.0) {
2605              vec2 voffset = vUv;
2606              voffset += vec2(x, y) * vec2(${1/e}, ${1/t}) * offset;
2607              vec2 pos = unpackRGBATo2Half(texture2D(tex, voffset));
2608              float dist = distance(pos.xy, vUv);
2609              if(pos.x != 0.0 && pos.y != 0.0 && dist < closestDist) {
2610                closestDist = dist;
2611                closestPos = pos;
2612              }
2613            }
2614          }
2615          gl_FragColor = pack2HalfToRGBA(closestPos);
2616        }`})),d=new se(new eT.jyz({uniforms:{tex:{value:null},size:{value:new eT.FM8(e,t)}},vertexShader:`
2617        varying vec2 vUv;
2618        void main() {
2619          vUv = uv;
2620          gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
2621        }`,fragmentShader:`
2622        varying vec2 vUv;
2623        uniform sampler2D tex;
2624        uniform vec2 size;
2625        #include <packing>
2626        void main() {
2627          gl_FragColor = vec4(distance(size * unpackRGBATo2Half(texture2D(tex, vUv)), size * vUv), 0.0, 0.0, 0.0);
2628        }`})),m=new se(new eT.jyz({uniforms:{inside:{value:c.texture},outside:{value:l.texture},tex:{value:null}},vertexShader:`
2629        varying vec2 vUv;
2630        void main() {
2631          vUv = uv;
2632          gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
2633        }`,fragmentShader:`
2634        varying vec2 vUv;
2635        uniform sampler2D inside;
2636        uniform sampler2D outside;
2637        uniform sampler2D tex;
2638        #include <packing>
2639        void main() {
2640          float i = texture2D(inside, vUv).x;
2641          float o =texture2D(outside, vUv).x;
2642          if (texture2D(tex, vUv).x == 0.0) {
2643            gl_FragColor = vec4(o, 0.0, 0.0, 0.0);
2644          } else {
2645            gl_FragColor = vec4(-i, 0.0, 0.0, 0.0);
2646          }
2647        }`}));return f=>{f.minFilter=eT.TyD,f.magFilter=eT.TyD,u.material.uniforms.tex.value=f,r.setRenderTarget(n),u.render(r);let p=Math.ceil(Math.log(Math.max(e,t))/Math.log(2)),g=n,y=null;for(let e=0;e<p;e++){let t=Math.pow(2,p-e-1);y=g===n?o:n,A.material.uniforms.level.value=e,A.material.uniforms.maxSteps.value=p,A.material.uniforms.offset.value=t,A.material.uniforms.tex.value=g.texture,r.setRenderTarget(y),A.render(r),g=y}r.setRenderTarget(l),d.material.uniforms.tex.value=y.texture,d.render(r),h.material.uniforms.tex.value=f,r.setRenderTarget(a),h.render(r),g=a;for(let e=0;e<p;e++){let t=Math.pow(2,p-e-1);y=g===a?s:a,A.material.uniforms.level.value=e,A.material.uniforms.maxSteps.value=p,A.material.uniforms.offset.value=t,A.material.uniforms.tex.value=g.texture,r.setRenderTarget(y),A.render(r),g=y}return r.setRenderTarget(c),d.material.uniforms.tex.value=y.texture,d.render(r),r.setRenderTarget(i),m.material.uniforms.tex.value=f,m.render(r),r.setRenderTarget(null),i}},vi=e=>{let t;let r=new Set,i=(e,i)=>{let n="function"==typeof e?e(t):e;if(!Object.is(n,t)){let e=t;t=(null!=i?i:"object"!=typeof n||null===n)?n:Object.assign({},t,n),r.forEach(r=>r(t,e))}},n=()=>t,a={setState:i,getState:n,getInitialState:()=>o,subscribe:e=>(r.add(e),()=>r.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},o=t=e(i,n,a);return a},vn=e=>e?vi(e):vi;var va=r(35195);let{useDebugValue:vo}=eD,{useSyncExternalStoreWithSelector:vs}=va,vl=!1,vc=e=>e,vu=e=>{"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");let t="function"==typeof e?vn(e):e,r=(e,r)=>(function(e,t=vc,r){r&&!vl&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),vl=!0);let i=vs(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return vo(i),i})(t,e,r);return Object.assign(r,t),r},vh=e=>e?vu(e):vu,vA="undefined"!=typeof window&&(null!=(eb=window.document)&&eb.createElement||(null==(eM=window.navigator)?void 0:eM.product)==="ReactNative")?eD.useLayoutEffect:eD.useEffect,vd=e=>e&&e.isOrthographicCamera,vm=new eT.Ilk,vf=function(){let e=vh(e=>({current:[],version:0,set:e}));return{In:({children:t})=>{let r=e(e=>e.set),i=e(e=>e.version);return vA(()=>{r(e=>({version:e.version+1}))},[]),vA(()=>(r(({current:e})=>({current:[...e,t]})),()=>r(({current:e})=>({current:e.filter(e=>e!==t)}))),[t,i]),null},Out:()=>{let t=e(e=>e.current);return eD.createElement(eD.Fragment,null,t)}}}();function vp(e,t){let{right:r,top:i,left:n,bottom:a,width:o,height:s}=t,l=t.bottom<0||i>e.height||r<0||t.left>e.width;if("top"in e){let t=e.top+e.height;return{position:{width:o,height:s,left:n-e.left,top:i,bottom:t-a,right:r},isOffscreen:l}}return{position:{width:o,height:s,top:i,left:n,bottom:e.height-a,right:r},isOffscreen:l}}function vg(e,{left:t,bottom:r,width:i,height:n}){let a;let o=i/n;return vd(e.camera)?e.camera.manual?e.camera.updateProjectionMatrix():(e.camera.left!==-(i/2)||e.camera.right!==i/2||e.camera.top!==n/2||e.camera.bottom!==-(n/2))&&(Object.assign(e.camera,{left:-(i/2),right:i/2,top:n/2,bottom:-(n/2)}),e.camera.updateProjectionMatrix()):e.camera.aspect!==o&&(e.camera.aspect=o,e.camera.updateProjectionMatrix()),a=e.gl.autoClear,e.gl.autoClear=!1,e.gl.setViewport(t,r,i,n),e.gl.setScissor(t,r,i,n),e.gl.setScissorTest(!0),a}function vy(e,t){e.gl.setScissorTest(!1),e.gl.autoClear=t}function vv(e){e.gl.getClearColor(vm),e.gl.setClearColor(vm,e.gl.getClearAlpha()),e.gl.clear(!0,!0)}function vE({visible:e=!0,canvasSize:t,scene:r,index:i,children:n,frames:a,rect:o,track:s}){let l=(0,eR.D)(),[c,u]=eD.useState(!1),h=0;return(0,eR.F)(i=>{if(a===1/0||h<=a){var l;s&&(o.current=null==(l=s.current)?void 0:l.getBoundingClientRect()),h++}if(o.current){let{position:a,isOffscreen:s}=vp(t,o.current);if(c!==s&&u(s),e&&!c&&o.current){let e=vg(i,a);
2647i.gl.render(n?i.scene:r,i.camera),vy(i,e)}}},i),eD.useLayoutEffect(()=>{let r=o.current;if(r&&(!e||!c)){let{position:e}=vp(t,r),i=vg(l,e);vv(l),vy(l,i)}},[e,c]),eD.useEffect(()=>{if(!s)return;let e=o.current,r=l.get().events.connected;return l.setEvents({connected:s.current}),()=>{if(e){let{position:r}=vp(t,e),i=vg(l,r);vv(l),vy(l,i)}l.setEvents({connected:r})}},[s]),eD.useEffect(()=>{"top"in t||console.warn("Detected @react-three/fiber canvas size does not include position information. <View /> may not work as expected. Upgrade to @react-three/fiber ^8.1.0 for support.\n See https://github.com/pmndrs/drei/issues/944")},[]),eD.createElement(eD.Fragment,null,n,eD.createElement("group",{onPointerOver:()=>null}))}let vx=eD.forwardRef(({track:e,visible:t=!0,index:r=1,id:i,style:n,className:a,frames:o=1/0,children:s,...l},c)=>{var u,h,A,d;let m=eD.useRef(null),{size:f,scene:p}=(0,eR.D)(),[g]=eD.useState(()=>new eT.xsS),[y,v]=eD.useReducer(()=>!0,!1),E=eD.useCallback((t,r)=>{if(m.current&&e&&e.current&&t.target===e.current){let{width:e,height:i,left:n,top:a}=m.current,o=t.clientX-n,s=t.clientY-a;r.pointer.set(o/e*2-1,-(s/i*2)+1),r.raycaster.setFromCamera(r.pointer,r.camera)}},[m,e]);return eD.useEffect(()=>{var t;e&&(m.current=null==(t=e.current)?void 0:t.getBoundingClientRect()),v()},[e]),eD.createElement("group",(0,eS.Z)({ref:c},l),y&&(0,eR.h)(eD.createElement(vE,{visible:t,canvasSize:f,frames:o,scene:p,track:e,rect:m,index:r},s),g,{events:{compute:E,priority:r},size:{width:null==(u=m.current)?void 0:u.width,height:null==(h=m.current)?void 0:h.height,top:null==(A=m.current)?void 0:A.top,left:null==(d=m.current)?void 0:d.left}}))}),vC=eD.forwardRef(({as:e="div",id:t,visible:r,className:i,style:n,index:a=1,track:o,frames:s=1/0,children:l,...c},u)=>{let h=eD.useId(),A=eD.useRef(null);return eD.useImperativeHandle(u,()=>A.current),eD.createElement(eD.Fragment,null,eD.createElement(e,(0,eS.Z)({ref:A,id:t,className:i,style:n},c)),eD.createElement(vf.In,null,eD.createElement(vx,{visible:r,key:h,track:A,frames:s,index:a},l)))}),vw=(()=>{let e=eD.forwardRef((e,t)=>eD.useContext(eR.g)?eD.createElement(vx,(0,eS.Z)({ref:t},e)):eD.createElement(vC,(0,eS.Z)({ref:t},e)));return e.Port=()=>eD.createElement(vf.Out,null),e})(),vB=eD.createContext(null),vI=new eT.Pa4,v_=new eT.Pa4,vb=(e,t,r,i)=>{let n=t.dot(t),a=t.dot(e)-t.dot(r),o=t.dot(i);return 0===o?-a/n:(vI.copy(i).multiplyScalar(n/o).sub(t),v_.copy(i).multiplyScalar(a/o).add(r).sub(e),-vI.dot(v_)/vI.dot(vI))},vM=new eT.Pa4(0,1,0),vS=new eT.yGw,vD=({direction:e,axis:t})=>{let{translation:r,translationLimits:i,annotations:n,annotationsClass:a,depthTest:o,scale:s,lineWidth:l,fixed:c,axisColors:u,hoveredColor:h,opacity:A,onDragStart:d,onDrag:m,onDragEnd:f,userData:p}=eD.useContext(vB),g=(0,eR.D)(e=>e.controls),y=eD.useRef(null),v=eD.useRef(null),E=eD.useRef(null),x=eD.useRef(0),[C,w]=eD.useState(!1),B=eD.useCallback(i=>{n&&(y.current.innerText=`${r.current[t].toFixed(2)}`,y.current.style.display="block"),i.stopPropagation();let a=new eT.yGw().extractRotation(v.current.matrixWorld),o=i.point.clone(),s=new eT.Pa4().setFromMatrixPosition(v.current.matrixWorld),l=e.clone().applyMatrix4(a).normalize();E.current={clickPoint:o,dir:l},x.current=r.current[t],d({component:"Arrow",axis:t,origin:s,directions:[l]}),g&&(g.enabled=!1),i.target.setPointerCapture(i.pointerId)},[n,e,g,d,r,t]),I=eD.useCallback(e=>{if(e.stopPropagation(),C||w(!0),E.current){let{clickPoint:a,dir:o}=E.current,[s,l]=(null==i?void 0:i[t])||[void 0,void 0],c=vb(a,o,e.ray.origin,e.ray.direction);void 0!==s&&(c=Math.max(c,s-x.current)),void 0!==l&&(c=Math.min(c,l-x.current)),r.current[t]=x.current+c,n&&(y.current.innerText=`${r.current[t].toFixed(2)}`),vS.makeTranslation(o.x*c,o.y*c,o.z*c),m(vS)}},[n,m,C,r,i,t]),_=eD.useCallback(e=>{n&&(y.current.style.display="none"),e.stopPropagation(),E.current=null,f(),g&&(g.enabled=!0),e.target.releasePointerCapture(e.pointerId)},[n,g,f]),b=eD.useCallback(e=>{e.stopPropagation(),w(!1)},[]),{cylinderLength:M,coneWidth:S,coneLength:D,matrixL:P}=eD.useMemo(()=>{let t=c?l/s*1.6:s/20,r=c?.2:s/5,i=c?1-r:s-r,n=new eT._fP().setFromUnitVectors(vM,e.clone().normalize());return{cylinderLength:i,coneWidth:t,coneLength:r,matrixL:new eT.yGw().makeRotationFromQuaternion(n)}},[e,s,l,c]),T=C?h:u[t];return eD.createElement("group",{ref:v},eD.createElement("group",{matrix:P,matrixAutoUpdate:!1,onPointerDown:B,onPointerMove:I,onPointerUp:_,onPointerOut:b},n&&eD.createElement(eH,{position:[0,-D,0]},eD.createElement("div",{style:{display:"none",background:"#151520",color:"white",padding:"6px 8px",borderRadius:7,whiteSpace:"nowrap"},className:a,ref:y})),eD.createElement("mesh",{visible:!1,position:[0,(M+D)/2,0],userData:p},eD.createElement("cylinderGeometry",{args:[1.4*S,1.4*S,M+D,8,1]})),eD.createElement(oQ,{transparent:!0,raycast:()=>
2647null,depthTest:o,points:[0,0,0,0,M,0],lineWidth:l,side:eT.ehD,color:T,opacity:A,polygonOffset:!0,renderOrder:1,polygonOffsetFactor:-10,fog:!1}),eD.createElement("mesh",{raycast:()=>null,position:[0,M+D/2,0],renderOrder:500},eD.createElement("coneGeometry",{args:[S,D,24,1]}),eD.createElement("meshBasicMaterial",{transparent:!0,depthTest:o,color:T,opacity:A,polygonOffset:!0,polygonOffsetFactor:-10,fog:!1}))))},vP=new eT.Pa4,vT=new eT.Pa4,vR=e=>180*e/Math.PI,vF=e=>e*Math.PI/180,vQ=(e,t,r,i,n)=>{vP.copy(e).sub(r),vT.copy(t).sub(r);let a=i.dot(i),o=n.dot(n),s=vP.dot(i)/a,l=vP.dot(n)/o,c=vT.dot(i)/a;return Math.atan2(vT.dot(n)/o,c)-Math.atan2(l,s)},vz=(e,t)=>{let r=Math.floor(e/t);return e-(r=r<0?r+1:r)*t},vk=e=>{let t=vz(e,2*Math.PI);return 1e-6>Math.abs(t)?0:(t<0&&(t+=2*Math.PI),t)},vL=new eT.yGw,vO=new eT.Pa4,vU=new eT.zHn,vG=new eT.Pa4,vN=({dir1:e,dir2:t,axis:r})=>{let{rotationLimits:i,annotations:n,annotationsClass:a,depthTest:o,scale:s,lineWidth:l,fixed:c,axisColors:u,hoveredColor:h,opacity:A,onDragStart:d,onDrag:m,onDragEnd:f,userData:p}=eD.useContext(vB),g=(0,eR.D)(e=>e.controls),y=eD.useRef(null),v=eD.useRef(null),E=eD.useRef(0),x=eD.useRef(0),C=eD.useRef(null),[w,B]=eD.useState(!1),I=eD.useCallback(e=>{n&&(y.current.innerText=`${vR(x.current).toFixed(0)}\xba`,y.current.style.display="block"),e.stopPropagation();let t=e.point.clone(),i=new eT.Pa4().setFromMatrixPosition(v.current.matrixWorld),a=new eT.Pa4().setFromMatrixColumn(v.current.matrixWorld,0).normalize(),o=new eT.Pa4().setFromMatrixColumn(v.current.matrixWorld,1).normalize(),s=new eT.Pa4().setFromMatrixColumn(v.current.matrixWorld,2).normalize(),l=new eT.JOQ().setFromNormalAndCoplanarPoint(s,i);C.current={clickPoint:t,origin:i,e1:a,e2:o,normal:s,plane:l},d({component:"Rotator",axis:r,origin:i,directions:[a,o,s]}),g&&(g.enabled=!1),e.target.setPointerCapture(e.pointerId)},[n,g,d,r]),_=eD.useCallback(e=>{if(e.stopPropagation(),w||B(!0),C.current){let{clickPoint:t,origin:a,e1:o,e2:s,normal:l,plane:c}=C.current,[u,h]=(null==i?void 0:i[r])||[void 0,void 0];vU.copy(e.ray),vU.intersectPlane(c,vG),vU.direction.negate(),vU.intersectPlane(c,vG);let A=vQ(t,vG,a,o,s),d=vR(A);e.shiftKey&&(A=vF(d=10*Math.round(d/10))),void 0!==u&&void 0!==h&&h-u<2*Math.PI?(A=(A=vk(A))>Math.PI?A-2*Math.PI:A,A=eT.M8C.clamp(A,u-E.current,h-E.current),x.current=E.current+A):(x.current=vk(E.current+A),x.current=x.current>Math.PI?x.current-2*Math.PI:x.current),n&&(d=vR(x.current),y.current.innerText=`${d.toFixed(0)}\xba`),vL.makeRotationAxis(l,A),vO.copy(a).applyMatrix4(vL).sub(a).negate(),vL.setPosition(vO),m(vL)}},[n,m,w,i,r]),b=eD.useCallback(e=>{n&&(y.current.style.display="none"),e.stopPropagation(),E.current=x.current,C.current=null,f(),g&&(g.enabled=!0),e.target.releasePointerCapture(e.pointerId)},[n,g,f]),M=eD.useCallback(e=>{e.stopPropagation(),B(!1)},[]),S=eD.useMemo(()=>{let r=e.clone().normalize(),i=t.clone().normalize();return new eT.yGw().makeBasis(r,i,r.clone().cross(i))},[e,t]),D=c?.65:.65*s,P=eD.useMemo(()=>{let e=[];for(let t=0;t<=32;t++){let r=Math.PI/2*t/32;e.push(new eT.Pa4(Math.cos(r)*D,Math.sin(r)*D,0))}return e},[D]);return eD.createElement("group",{ref:v,onPointerDown:I,onPointerMove:_,onPointerUp:b,onPointerOut:M,matrix:S,matrixAutoUpdate:!1},n&&eD.createElement(eH,{position:[D,D,0]},eD.createElement("div",{style:{display:"none",background:"#151520",color:"white",padding:"6px 8px",borderRadius:7,whiteSpace:"nowrap"},className:a,ref:y})),eD.createElement(oQ,{points:P,lineWidth:4*l,visible:!1,userData:p}),eD.createElement(oQ,{transparent:!0,raycast:()=>null,depthTest:o,points:P,lineWidth:l,side:eT.ehD,color:w?h:u[r],opacity:A,polygonOffset:!0,polygonOffsetFactor:-10,fog:!1}))},vH=(e,t,r)=>{let i=Math.abs(e.x)>=Math.abs(e.y)&&Math.abs(e.x)>=Math.abs(e.z)?0:Math.abs(e.y)>=Math.abs(e.x)&&Math.abs(e.y)>=Math.abs(e.z)?1:2,n=[0,1,2].sort((e,r)=>Math.abs(t.getComponent(r))-Math.abs(t.getComponent(e))),a=i===n[0]?n[1]:n[0],o=e.getComponent(i),s=e.getComponent(a),l=t.getComponent(i),c=t.getComponent(a),u=r.getComponent(i),h=(r.getComponent(a)-s/o*u)/(c-s/o*l);return[(u-h*l)/o,h]},vj=new eT.zHn,vJ=new eT.Pa4,vV=new eT.yGw,vK=({dir1:e,dir2:t,axis:r})=>{let{translation:i,translationLimits:n,annotations:a,annotationsClass:o,depthTest:s,scale:l,lineWidth:c,fixed:u,axisColors:h,hoveredColor:A,opacity:d,onDragStart:m,onDrag:f,onDragEnd:p,userData:g}=eD.useContext(vB),y=(0,eR.D)(e=>e.controls),v=eD.useRef(null),E=eD.useRef(null),x=eD.useRef(null),C=eD.useRef(0),w=eD.useRef(0),[B,I]=eD.useState(!1),_=eD.useCallback(e=>{a&&(v.current.innerText=`${i.current[(r+1)%3].toFixed(2)}, ${i.current[(r+2)%3].toFixed(2)}`,v.current.style.display="block"),e.stopPropagation();let t=e.point.clone(),n=new eT.Pa4().setFromMatrixPosition(E.current.matrixWorld),o=new eT.Pa4().setFromMatrixColumn(E.current.matrixWorld,0).normalize(),s=new eT.Pa4().setFromMatrixColumn(E.current.matrixWorld,
26471).normalize(),l=new eT.Pa4().setFromMatrixColumn(E.current.matrixWorld,2).normalize(),c=new eT.JOQ().setFromNormalAndCoplanarPoint(l,n);x.current={clickPoint:t,e1:o,e2:s,plane:c},C.current=i.current[(r+1)%3],w.current=i.current[(r+2)%3],m({component:"Slider",axis:r,origin:n,directions:[o,s,l]}),y&&(y.enabled=!1),e.target.setPointerCapture(e.pointerId)},[a,y,m,r]),b=eD.useCallback(e=>{if(e.stopPropagation(),B||I(!0),x.current){let{clickPoint:t,e1:o,e2:s,plane:l}=x.current,[c,u]=(null==n?void 0:n[(r+1)%3])||[void 0,void 0],[h,A]=(null==n?void 0:n[(r+2)%3])||[void 0,void 0];vj.copy(e.ray),vj.intersectPlane(l,vJ),vj.direction.negate(),vj.intersectPlane(l,vJ),vJ.sub(t);let[d,m]=vH(o,s,vJ);void 0!==c&&(d=Math.max(d,c-C.current)),void 0!==u&&(d=Math.min(d,u-C.current)),void 0!==h&&(m=Math.max(m,h-w.current)),void 0!==A&&(m=Math.min(m,A-w.current)),i.current[(r+1)%3]=C.current+d,i.current[(r+2)%3]=w.current+m,a&&(v.current.innerText=`${i.current[(r+1)%3].toFixed(2)}, ${i.current[(r+2)%3].toFixed(2)}`),vV.makeTranslation(d*o.x+m*s.x,d*o.y+m*s.y,d*o.z+m*s.z),f(vV)}},[a,f,B,i,n,r]),M=eD.useCallback(e=>{a&&(v.current.style.display="none"),e.stopPropagation(),x.current=null,p(),y&&(y.enabled=!0),e.target.releasePointerCapture(e.pointerId)},[a,y,p]),S=eD.useCallback(e=>{e.stopPropagation(),I(!1)},[]),D=eD.useMemo(()=>{let r=e.clone().normalize(),i=t.clone().normalize();return new eT.yGw().makeBasis(r,i,r.clone().cross(i))},[e,t]),P=u?1/7:l/7,T=u?.225:.225*l,R=B?A:h[r],F=eD.useMemo(()=>[new eT.Pa4(0,0,0),new eT.Pa4(0,T,0),new eT.Pa4(T,T,0),new eT.Pa4(T,0,0),new eT.Pa4(0,0,0)],[T]);return eD.createElement("group",{ref:E,matrix:D,matrixAutoUpdate:!1},a&&eD.createElement(eH,{position:[0,0,0]},eD.createElement("div",{style:{display:"none",background:"#151520",color:"white",padding:"6px 8px",borderRadius:7,whiteSpace:"nowrap"},className:o,ref:v})),eD.createElement("group",{position:[1.7*P,1.7*P,0]},eD.createElement("mesh",{visible:!0,onPointerDown:_,onPointerMove:b,onPointerUp:M,onPointerOut:S,scale:T,userData:g},eD.createElement("planeGeometry",null),eD.createElement("meshBasicMaterial",{transparent:!0,depthTest:s,color:R,polygonOffset:!0,polygonOffsetFactor:-10,side:eT.ehD,fog:!1})),eD.createElement(oQ,{position:[-T/2,-T/2,0],transparent:!0,depthTest:s,points:F,lineWidth:c,color:R,opacity:d,polygonOffset:!0,polygonOffsetFactor:-10,userData:g,fog:!1})))},vY=new eT.Pa4,vW=new eT.Pa4,vq=(e,t,r,i)=>{let n=t.dot(t),a=t.dot(e)-t.dot(r),o=t.dot(i);return 0===o?-a/n:(vY.copy(i).multiplyScalar(n/o).sub(t),vW.copy(i).multiplyScalar(a/o).add(r).sub(e),-vY.dot(vW)/vY.dot(vY))},vX=new eT.Pa4(0,1,0),vZ=new eT.Pa4,v$=new eT.yGw,v1=({direction:e,axis:t})=>{let{scaleLimits:r,annotations:i,annotationsClass:n,depthTest:a,scale:o,lineWidth:s,fixed:l,axisColors:c,hoveredColor:u,opacity:h,onDragStart:A,onDrag:d,onDragEnd:m,userData:f}=eD.useContext(vB),p=(0,eR.D)(e=>e.size),g=(0,eR.D)(e=>e.controls),y=eD.useRef(null),v=eD.useRef(null),E=eD.useRef(null),x=eD.useRef(1),C=eD.useRef(1),w=eD.useRef(null),[B,I]=eD.useState(!1),_=l?1.2:1.2*o,b=eD.useCallback(r=>{i&&(y.current.innerText=`${C.current.toFixed(2)}`,y.current.style.display="block"),r.stopPropagation();let n=new eT.yGw().extractRotation(v.current.matrixWorld),a=r.point.clone(),s=new eT.Pa4().setFromMatrixPosition(v.current.matrixWorld),c=e.clone().applyMatrix4(n).normalize(),u=v.current.matrixWorld.clone(),h=u.clone().invert(),d=l?1/oc(v.current.getWorldPosition(vY),o,r.camera,p):1;w.current={clickPoint:a,dir:c,mPLG:u,mPLGInv:h,offsetMultiplier:d},A({component:"Sphere",axis:t,origin:s,directions:[c]}),g&&(g.enabled=!1),r.target.setPointerCapture(r.pointerId)},[i,g,e,A,t,l,o,p]),M=eD.useCallback(e=>{if(e.stopPropagation(),B||I(!0),w.current){let{clickPoint:n,dir:a,mPLG:s,mPLGInv:c,offsetMultiplier:u}=w.current,[h,A]=(null==r?void 0:r[t])||[1e-5,void 0],m=vq(n,a,e.ray.origin,e.ray.direction)*u,f=Math.pow(2,.2*(l?m:m/o));e.shiftKey&&(f=Math.round(10*f)/10),f=Math.max(f,h/x.current),void 0!==A&&(f=Math.min(f,A/x.current)),C.current=x.current*f,E.current.position.set(0,_+m,0),i&&(y.current.innerText=`${C.current.toFixed(2)}`),vZ.set(1,1,1),vZ.setComponent(t,f),v$.makeScale(vZ.x,vZ.y,vZ.z).premultiply(s).multiply(c),d(v$)}},[i,_,d,B,r,t]),S=eD.useCallback(e=>{i&&(y.current.style.display="none"),e.stopPropagation(),x.current=C.current,w.current=null,E.current.position.set(0,_,0),m(),g&&(g.enabled=!0),e.target.releasePointerCapture(e.pointerId)},[i,g,m,_]),D=eD.useCallback(e=>{e.stopPropagation(),I(!1)},[]),{radius:P,matrixL:T}=eD.useMemo(()=>{let t=l?s/o*1.8:o/22.5,r=new eT._fP().setFromUnitVectors(vX,e.clone().normalize());return{radius:t,matrixL:new eT.yGw().makeRotationFromQuaternion(r)}},[e,o,s,l]),R=B?u:c[t];return eD.createElement("group",{ref:v},eD.createElement("group",{matrix:T,matrixAutoUpdate:!1,onPointerDown:b,onPointerMove:M,onPointerUp:S,onPointerOut:D},i&&eD.createElement(eH,{position:[0,_/2,0]},eD.createElement("div",{style:{display:"none",background:"#151520",color:"white",padding:"6px 8px",borderRadius:7,whiteSpace:"nowrap"},className:n,ref:y})),eD.createElement("mesh",{ref:E,position:[0,_,0],renderOrder:500,userData:f},eD.createElement("sphereGeometry",{args:[P,12,12]}),eD.createElement("meshBasicMaterial",{transparent:!0,depthTest:a,color:R,opacity:h,polygonOffset:!0,polygonOffsetFactor:-10}))))},v0=new eT.yGw,v2=new eT.yGw,v3=new eT.yGw,v4=new eT.yGw,v5=new eT.yGw,v6=new eT.yGw,v8=new eT.yGw,v9=new eT.yGw,v7=new eT.yGw,Ee=new eT.ZzF,Et=ne
2647w eT.ZzF,Er=new eT.Pa4,Ei=new eT.Pa4,En=new eT.Pa4,Ea=new eT.Pa4,Eo=new eT.Pa4,Es=new eT.Pa4(1,0,0),El=new eT.Pa4(0,1,0),Ec=new eT.Pa4(0,0,1),Eu=eD.forwardRef(({enabled:e=!0,matrix:t,onDragStart:r,onDrag:i,onDragEnd:n,autoTransform:a=!0,anchor:o,disableAxes:s=!1,disableSliders:l=!1,disableRotations:c=!1,disableScaling:u=!1,activeAxes:h=[!0,!0,!0],offset:A=[0,0,0],rotation:d=[0,0,0],scale:m=1,lineWidth:f=4,fixed:p=!1,translationLimits:g,rotationLimits:y,scaleLimits:v,depthTest:E=!0,axisColors:x=["#ff2060","#20df80","#2080ff"],hoveredColor:C="#ffff40",annotations:w=!1,annotationsClass:B,opacity:I=1,visible:_=!0,userData:b,children:M,...S},D)=>{let P=(0,eR.D)(e=>e.invalidate),T=eD.useRef(null),R=eD.useRef(null),F=eD.useRef(null),Q=eD.useRef(null),z=eD.useRef([0,0,0]),k=eD.useRef(new eT.Pa4(1,1,1)),L=eD.useRef(new eT.Pa4(1,1,1));eD.useLayoutEffect(()=>{o&&(Q.current.updateWorldMatrix(!0,!0),v4.copy(Q.current.matrixWorld).invert(),Ee.makeEmpty(),Q.current.traverse(e=>{e.geometry&&(e.geometry.boundingBox||e.geometry.computeBoundingBox(),v6.copy(e.matrixWorld).premultiply(v4),Et.copy(e.geometry.boundingBox),Et.applyMatrix4(v6),Ee.union(Et))}),Er.copy(Ee.max).add(Ee.min).multiplyScalar(.5),Ei.copy(Ee.max).sub(Ee.min).multiplyScalar(.5),En.copy(Ei).multiply(new eT.Pa4(...o)).add(Er),Ea.set(...A).add(En),F.current.position.copy(Ea),P())});let O=eD.useMemo(()=>({onDragStart:e=>{v0.copy(R.current.matrix),v2.copy(R.current.matrixWorld),r&&r(e),P()},onDrag:e=>{v3.copy(T.current.matrixWorld),v4.copy(v3).invert(),v5.copy(v2).premultiply(e),v6.copy(v5).premultiply(v4),v8.copy(v0).invert(),v9.copy(v6).multiply(v8),a&&R.current.matrix.copy(v6),i&&i(v6,v9,v5,e),P()},onDragEnd:()=>{n&&n(),P()},translation:z,translationLimits:g,rotationLimits:y,axisColors:x,hoveredColor:C,opacity:I,scale:m,lineWidth:f,fixed:p,depthTest:E,userData:b,annotations:w,annotationsClass:B}),[r,i,n,z,g,y,v,E,m,f,p,...x,C,I,b,a,w,B]),U=new eT.Pa4;return(0,eR.F)(e=>{if(p){let t=oc(F.current.getWorldPosition(U),m,e.camera,e.size);k.current.setScalar(t)}t&&t instanceof eT.yGw&&(R.current.matrix=t),R.current.updateWorldMatrix(!0,!0),v7.makeRotationFromEuler(F.current.rotation).setPosition(F.current.position).premultiply(R.current.matrixWorld),L.current.setFromMatrixScale(v7),Eo.copy(k.current).divide(L.current),(Math.abs(F.current.scale.x-Eo.x)>1e-4||Math.abs(F.current.scale.y-Eo.y)>1e-4||Math.abs(F.current.scale.z-Eo.z)>1e-4)&&(F.current.scale.copy(Eo),e.invalidate())}),eD.useImperativeHandle(D,()=>R.current,[]),eD.createElement(vB.Provider,{value:O},eD.createElement("group",{ref:T},eD.createElement("group",(0,eS.Z)({ref:R,matrix:t,matrixAutoUpdate:!1},S),eD.createElement("group",{visible:_,ref:F,position:A,rotation:d},e&&eD.createElement(eD.Fragment,null,!s&&h[0]&&eD.createElement(vD,{axis:0,direction:Es}),!s&&h[1]&&eD.createElement(vD,{axis:1,direction:El}),!s&&h[2]&&eD.createElement(vD,{axis:2,direction:Ec}),!l&&h[0]&&h[1]&&eD.createElement(vK,{axis:2,dir1:Es,dir2:El}),!l&&h[0]&&h[2]&&eD.createElement(vK,{axis:1,dir1:Ec,dir2:Es}),!l&&h[2]&&h[1]&&eD.createElement(vK,{axis:0,dir1:El,dir2:Ec}),!c&&h[0]&&h[1]&&eD.createElement(vN,{axis:2,dir1:Es,dir2:El}),!c&&h[0]&&h[2]&&eD.createElement(vN,{axis:1,dir1:Ec,dir2:Es}),!c&&h[2]&&h[1]&&eD.createElement(vN,{axis:0,dir1:El,dir2:Ec}),!u&&h[0]&&eD.createElement(v1,{axis:0,direction:Es}),!u&&h[1]&&eD.createElement(v1,{axis:1,direction:El}),!u&&h[2]&&eD.createElement(v1,{axis:2,direction:Ec}))),eD.createElement("group",{ref:Q},M))))}),Eh=(0,eD.forwardRef)(({options:e={video:!0},...t},r)=>{let i=(0,oN.Rq)(()=>navigator.mediaDevices.getDisplayMedia(e),[]);return(0,eD.useEffect)(()=>()=>{null==i||i.getTracks().forEach(e=>e.stop()),(0,oN.ZH)([])},[i]),eD.createElement(Aq,(0,eS.Z)({ref:r},t,{src:i}))}),EA=(0,eD.forwardRef)(({constraints:e={audio:!1,video:{facingMode:"user"}},...t},r)=>{let i=(0,oN.Rq)(()=>navigator.mediaDevices.getUserMedia(e),[]);return(0,eD.useEffect)(()=>()=>{null==i||i.getTracks().forEach(e=>e.stop()),(0,oN.ZH)([])},[i]),eD.createElement(Aq,(0,eS.Z)({ref:r},t,{src:i}))}),Ed=new eT.Pa4(0,0,-1),Em=function(){let e=new eT.Pa4,t=new eT.Pa4,r=new eT.Pa4,i=new eT.Pa4,n=new eT.Pa4;return function(a,o,s,l){return e.copy(a),t.copy(o),r.copy(s),i.copy(t).sub(e),n.copy(r).sub(e),l.crossVectors(n,i).normalize()}}(),Ef=eD.forwardRef(({points:e=Ey.SAMPLE_FACELANDMARKER_RESULT.faceLandmarks[0],face:t,facialTransformationMatrix:r,faceBlendshapes:i,offset:n,offsetScalar:a=80,width:o,height:s,depth:l=1,verticalTri:c=[159,386,152],origin:u,eyes:h=!0,eyesAsOrigin:A=!1,debug:d=!1,children:m,...f},p)=>{var g;t&&(e=t.keypoints,console.warn("Facemesh `face` prop is deprecated: use `points` instead"));let y=eD.useRef(null),v=eD.useRef(null),E=eD.useRef(null),x=eD.useRef(null),C=eD.useRef(null),w=eD.useRef(null),B=eD.useRef(null),[I]=eD.useState(()=>new eT.Pa4),[_]=eD.useState(()=>new eT.Tme),[b]=eD.useState(()=>new eT._fP),[M]=eD.useState(()=>new eT.Pa4),{invalidate:S}
2647=(0,eR.D)();eD.useEffect(()=>{var e;null==(e=C.current)||e.geometry.setIndex(Ey.TRIANGULATION)},[]);let[D]=eD.useState(()=>new eT.Pa4);eD.useEffect(()=>{var t,m,f,p,g,P;let T=null==(t=C.current)?void 0:t.geometry;if(!T)return;T.setFromPoints(e),T.setDrawRange(0,Ey.TRIANGULATION.length),r?(_.matrix.fromArray(r.data),_.matrix.decompose(_.position,_.quaternion,_.scale),_.rotation.y*=-1,_.rotation.z*=-1,b.setFromEuler(_.rotation),n?(_.position.y*=-1,_.position.z*=-1,null==(f=y.current)||f.position.copy(_.position.divideScalar(a))):null==(p=y.current)||p.position.set(0,0,0)):(Em(e[c[0]],e[c[1]],e[c[2]],I),b.setFromUnitVectors(Ed,I));let R=b.clone().invert();if(T.computeBoundingBox(),d&&S(),T.center(),T.applyQuaternion(R),null==(m=x.current)||m.setRotationFromQuaternion(b),h){if(i){if(w.current&&B.current&&E.current){if(A){let e=w.current._computeSphere(T),t=B.current._computeSphere(T);u=(g=e.center,P=t.center,g.clone().add(P).multiplyScalar(.5)).negate(),w.current._update(T,i,e),B.current._update(T,i,t)}else w.current._update(T,i),B.current._update(T,i)}}else console.warn("Facemesh `eyes` option only works if `faceBlendshapes` is provided: skipping.")}if(E.current){if(void 0!==u){if("number"==typeof u){let e=T.getAttribute("position");M.set(-e.getX(u),-e.getY(u),-e.getZ(u))}else u.isVector3&&M.copy(u)}else M.setScalar(0);E.current.position.copy(M)}if(v.current){let e=1;(o||s||l)&&(T.boundingBox.getSize(D),o&&(e=o/D.x),s&&(e=s/D.y),l&&(e=l/D.z)),v.current.scale.setScalar(1!==e?e:1)}T.computeVertexNormals(),T.attributes.position.needsUpdate=!0},[e,r,i,_,n,a,o,s,l,c,u,h,d,S,I,b,D,M]);let P=eD.useMemo(()=>({outerRef:x,meshRef:C,eyeRightRef:w,eyeLeftRef:B}),[]);eD.useImperativeHandle(p,()=>P,[P]);let[T]=eD.useState(()=>new eT.Pa4),R=null==(g=C.current)?void 0:g.geometry.boundingBox,F=(null==R?void 0:R.getSize(T).z)||1;return eD.createElement("group",f,eD.createElement("group",{ref:y},eD.createElement("group",{ref:x},eD.createElement("group",{ref:v},d?eD.createElement(eD.Fragment,null,eD.createElement("axesHelper",{args:[F]}),eD.createElement(oQ,{points:[[0,0,0],[0,0,-F]],color:65535})):null,eD.createElement("group",{ref:E},h&&i&&eD.createElement("group",{name:"eyes"},eD.createElement(Eg,{side:"left",ref:w,debug:d}),eD.createElement(Eg,{side:"right",ref:B,debug:d})),eD.createElement("mesh",{ref:C,name:"face"},m,d?eD.createElement(eD.Fragment,null,R&&eD.createElement("box3Helper",{args:[R]})):null))))))}),Ep={contourLandmarks:{right:[33,133,159,145,153],left:[263,362,386,374,380]},blendshapes:{right:[14,16,18,12],left:[13,15,17,11]},color:{right:"red",left:"#00ff00"},fov:{horizontal:100,vertical:90}},Eg=eD.forwardRef(({side:e,debug:t=!0},r)=>{let i=eD.useRef(null),n=eD.useRef(null),[a]=eD.useState(()=>new eT.aLr),o=eD.useCallback(t=>{let r=t.getAttribute("position"),i=Ep.contourLandmarks[e].map(e=>new eT.Pa4(r.getX(e),r.getY(e),r.getZ(e)));return a.center.set(0,0,0),i.forEach(e=>a.center.add(e)),a.center.divideScalar(i.length),a.radius=i[0].sub(i[1]).length()/2,a},[a,e]),[s]=eD.useState(()=>new eT.USm),l=eD.useCallback((t,r,a)=>{if(i.current){var l;null!==(l=a)&&void 0!==l||(a=o(t)),i.current.position.copy(a.center),i.current.scale.setScalar(a.radius)}if(r&&n.current){let t=Ep.blendshapes[e],i=r.categories[t[0]].score,a=r.categories[t[1]].score,o=r.categories[t[2]].score,l=r.categories[t[3]].score,c=Ep.fov.horizontal*eT.M8C.DEG2RAD,u=Ep.fov.vertical*eT.M8C.DEG2RAD*.5*(i-a)*("left"===e?1:-1);s.set(.5*c*(l-o),u,0),n.current.setRotationFromEuler(s)}},[o,e,s]),c=eD.useMemo(()=>({eyeMeshRef:i,irisDirRef:n,_computeSphere:o,_update:l}),[o,l]);eD.useImperativeHandle(r,()=>c,[c]);let u=Ep.color[e];return eD.createElement("group",null,eD.createElement("group",{ref:i},t&&eD.createElement("axesHelper",null),eD.createElement("group",{ref:n},eD.createElement(eD.Fragment,null,t&&eD.createElement(oQ,{points:[[0,0,0],[0,0,-2]],lineWidth:1,color:u})))))}),Ey
vendor: 12,527 bytes, line 2647
2647={TRIANGULATION:[127,34,139,11,0,37,232,231,120,72,37,39,128,121,47,232,121,128,104,69,67,175,171,148,157,154,155,118,50,101,73,39,40,9,151,108,48,115,131,194,204,211,74,40,185,80,42,183,40,92,186,230,229,118,202,212,214,83,18,17,76,61,146,160,29,30,56,157,173,106,204,194,135,214,192,203,165,98,21,71,68,51,45,4,144,24,23,77,146,91,205,50,187,201,200,18,91,106,182,90,91,181,85,84,17,206,203,36,148,171,140,92,40,39,193,189,244,159,158,28,247,246,161,236,3,196,54,68,104,193,168,8,117,228,31,189,193,55,98,97,99,126,47,100,166,79,218,155,154,26,209,49,131,135,136,150,47,126,217,223,52,53,45,51,134,211,170,140,67,69,108,43,106,91,230,119,120,226,130,247,63,53,52,238,20,242,46,70,156,78,62,96,46,53,63,143,34,227,173,155,133,123,117,111,44,125,19,236,134,51,216,206,205,154,153,22,39,37,167,200,201,208,36,142,100,57,212,202,20,60,99,28,158,157,35,226,113,160,159,27,204,202,210,113,225,46,43,202,204,62,76,77,137,123,116,41,38,72,203,129,142,64,98,240,49,102,64,41,73,74,212,216,207,42,74,184,169,170,211,170,149,176,105,66,69,122,6,168,123,147,187,96,77,90,65,55,107,89,90,180,101,100,120,63,105,104,93,137,227,15,86,85,129,102,49,14,87,86,55,8,9,100,47,121,145,23,22,88,89,179,6,122,196,88,95,96,138,172,136,215,58,172,115,48,219,42,80,81,195,3,51,43,146,61,171,175,199,81,82,38,53,46,225,144,163,110,246,33,7,52,65,66,229,228,117,34,127,234,107,108,69,109,108,151,48,64,235,62,78,191,129,209,126,111,35,143,163,161,246,117,123,50,222,65,52,19,125,141,221,55,65,3,195,197,25,7,33,220,237,44,70,71,139,122,193,245,247,130,33,71,21,162,153,158,159,170,169,150,188,174,196,216,186,92,144,160,161,2,97,167,141,125,241,164,167,37,72,38,12,145,159,160,38,82,13,63,68,71,226,35,111,158,153,154,101,50,205,206,92,165,209,198,217,165,167,97,220,115,218,133,112,243,239,238,241,214,135,169,190,173,133,171,208,32,125,44,237,86,87,178,85,86,179,84,85,180,83,84,181,201,83,182,137,93,132,76,62,183,61,76,184,57,61,185,212,57,186,214,207,187,34,143,156,79,239,237,123,137,177,44,1,4,201,194,32,64,102,129,213,215,138,59,166,219,242,99,97,2,94,141,75,59,235,24,110,228,25,130,226,23,24,229,22,23,230,26,22,231,112,26,232,189,190,243,221,56,190,28,56,221,27,28,222,29,27,223,30,29,224,247,30,225,238,79,20,166,59,75,60,75,240,147,177,215,20,79,166,187,147,213,112,233,244,233,128,245,128,114,188,114,217,174,131,115,220,217,198,236,198,131,134,177,132,58,143,35,124,110,163,7,228,110,25,356,389,368,11,302,267,452,350,349,302,303,269,357,343,277,452,453,357,333,332,297,175,152,377,384,398,382,347,348,330,303,304,270,9,336,337,278,279,360,418,262,431,304,408,409,310,415,407,270,409,410,450,348,347,422,430,434,313,314,17,306,307,375,387,388,260,286,414,398,335,406,418,364,367,416,423,358,327,251,284,298,281,5,4,373,374,253,307,320,321,425,427,411,421,313,18,321,405,406,320,404,405,315,16,17,426,425,266,377,400,369,322,391,269,417,465,464,386,257,258,466,260,388,456,399,419,284,332,333,417,285,8,346,340,261,413,441,285,327,460,328,355,371,329,392,439,438,382,341,256,429,420,360,364,394,379,277,343,437,443,444,283,275,440,363,431,262,369,297,338,337,273,375,321,450,451,349,446,342,467,293,334,282,458,461,462,276,353,383,308,324,325,276,300,293,372,345,447,382,398,362,352,345,340,274,1,19,456,248,281,436,427,425,381,256,252,269,391,393,200,199,428,266,330,329,287,273,422,250,462,328,258,286,384,265,353,342,387,259,257,424,431,430,342,353,276,273,335,424,292,325,307,366,447,345,271,303,302,423,266,371,294,455,460,279,278,294,271,272,304,432,434,427,272,407,408,394,430,431,395,369,400,334,333,299,351,417,168,352,280,411,325,319,320,295,296,336,319,403,404,330,348,349,293,298,333,323,454,447,15,16,315,358,429,279,14,15,316,285,336,9,329,349,350,374,380,252,318,402,403,6,197,419,318,319,325,367,364,365,435,367,397,344,438,439,272,271,311,195,5,281,273,287,291,396,428,199,311,271,268,283,444,445,373,254,339,263,466,249,282,334,296,449,347,346,264,447,454,336,296,299,338,10,151,278,439,455,292,407,415,358,371,355,340,345,372,390,249,466,346,347,280,442,443,282,19,94,370,441,442,295,248,419,197,263,255,359,440,275,274,300,383,368,351,412,465,263,467,466,301,368,389,380,374,386,395,378,379,412,351,419,436,426,322,373,390,388,2,164,393,370,462,461,164,0,267,302,11,12,374,373,387,268,12,13,293,300,301,446,261,340,385,384,381,330,266,425,426,423,391,429,355,437,391,327,326,440,457,438,341,382,362,459,457,461,434,430,394,414,463,362,396,369,262,354,461,457,316,403,402,315,404,403,314,405,404,313,406,405,421,418,406,366,401,361,306,408,407,291,409,408,287,410,409,432,436,410,434,416,411,264,368,383,309,438,457,352,376,401,274,275,4,421,428,262,294,327,358,433,416,367,289,455,439,462,370,326,2,326,370,305,460,455,254,449,448,255,261,446,253,450,449,252,451,450,256,452,451,341,453,452,413,464,463,441,413,414,258,442,441,257,443,442,259,444,443,260,445,444,467,342,445,459,458,250,289,392,290,290,328,460,376,433,435,250,290,392,411,416,433,341,463,464,453,464,465,357,465,412,343,412,399,360,363,440,437,399,456,420,456,363,401,435,288,372,383,353,339,255,249,448,261,255,133,243,190,133,155,112,33,246,247,33,130,25,398,384,286,362,398,414,362,463,341,263,359,467,263,249,255,466,467,260,75,60,166,238,239,79,162,127,139,72,11,37,121,232,120,73,72,39,114,128,47,233,232,128,103,104,67,152,175,148,173,157,155,119,118,101,74,73,40,107,9,108,49,48,131,32,194,211,184,74,185,191,80,183,185,40,186,119,230,118,210,202,214,84,83,17,77,76,146,161,160,30,190,56,173,182,106,194,138,135,192,129,203,98,54,21,68,5,51,4,145,144,23,90,77,91,207,205,187,83,201,18,181,91,182,180,90,181,16,85,17,205,206,36,176,148,140,165,92,39,245,193,244,27,159,28,30,247,161,174,236,196,103,54,104,55,193,8,111,117,31,221,189,55,240,98,99,142,126,100,219,166,218,112,155,26,198,209,131,169,135,150,114,47,217,224,223,53,220,45,134,32,211,140,109,67,108,146,43,91,231,230,120,113,226,247,105,63,52,241,238,242,124,46,156,95,78,96,70,46,63,116,143,227,116,123,111,1,44,19,3,236,51,207,216,205,26,154,22,165,39,167,199,200,208,101,36,100,43,57,202,242,20,99,56,28,157,124,35,113,29,160,27,211,204,210,124,113,46,106,43,204,96,62,77,227,137,116,73,41,72,36,203,142,235,64,240,48,49,64,42,41,74,214,212,207,183,42,184,210,169,211,140,170,176,104,105,69,193,122,168,50,123,187,89,96,90,66,65,107,179,89,180,119,101,120,68,63,104,234,93,227,16,15,85,209,129,49,15,14,86,107,55,9,120,100,121,153,145,22,178,88,179,197,6,196,89,88,96,135,138,136,138,215,172,218,115,219,41,42,81,5,195,51,57,43,61,208,171,199,41,81,38,224,53,225,24,144,110,105,52,66,118,229,117,227,34,234,66,107,69,10,109,151,219,48,235,183,62,191,142,129,126,116,111,143,7,163,246,118,117,50,223,222,52,94,19,141,222,221,65,196,3,197,45,220,44,156,70,139,188,122,245,139,71,162,145,153,159,149,170,150,122,188,196,206,216,92,163,144,161,164,2,167,242,141,241,0,164,37,11,72,12,144,145,160,12,38,13,70,63,71,31,226,111,157,158,154,36,101,205,203,206,165,126,209,217,98,165,97,237,220,218,237,239,241,210,214,169,140,171,32,241,125,237,179,86,178,180,85,179,181,84,180,182,83,181,194,201,182,177,137,132,184,76,183,185,61,184,186,57,185,216,212,186,192,214,187,139,34,156,218,79,237,147,123,177,45,44,4,208,201,32,98,64,129,192,213,138,235,59,219,141,242,97,97,2,141,240,75,235,229,24,228,31,25,226,230,23,229,231,22,230,232,26,231,233,112,232,244,189,243,189,221,190,222,28,221,223,27,222,224,29,223,225,30,224,113,247,225,99,60,240,213,147,215,60,20,166,192,187,213,243,112,244,244,233,245,245,128,188,188,114,174,134,131,220,174,217,236,236,198,134,215,177,58,156,143,124,25,110,7,31,228,25,264,356,368,0,11,267,451,452,349,267,302,269,350,357,277,350,452,357,299,333,297,396,175,377,381,384,382,280,347,330,269,303,270,151,9,337,344,278,360,424,418,431,270,304,409,272,310,407,322,270,410,449,450,347,432,422,434,18,313,17,291,306,375,259,387,260,424,335,418,434,364,416,391,423,327,301,251,298,275,281,4,254,373,253,375,307,321,280,425,411,200,421,18,335,321,406,321,320,405,314,315,17,423,426,266,396,377,369,270,322,269,413,417,464,385,386,258,248,456,419,298,284,333,168,417,8,448,346,261,417,413,285,326,327,328,277,355,329,309,392,438,381,382,256,279,429,360,365,364,379,355,277,437,282,443,283,281,275,363,395,431,369,299,297,337,335,273,321,348,450,349,359,446,467,283,293,282,250,458,462,300,276,383,292,308,325,283,276,293,264,372,447,346,352,340,354,274,19,363,456,281,426,436,425,380,381,252,267,269,393,421,200,428,371,266,329,432,287,422,290,250,328,385,258,384,446,265,342,386,387,257,422,424,430,445,342,276,422,273,424,306,292,307,352,366,345,268,271,302,358,423,371,327,294,460,331,279,294,303,271,304,436,432,427,304,272,408,395,394,431,378,395,400,296,334,299,6,351,168,376,352,411,307,325,320,285,295,336,320,319,404,329,330,349,334,293,333,366,323,447,316,15,315,331,358,279,317,14,316,8,285,9,277,329,350,253,374,252,319,318,403,351,6,419,324,318,325,397,367,365,288,435,397,278,344,439,310,272,311,248,195,281,375,273,291,175,396,199,312,311,268,276,283,445,390,373,339,295,282,296,448,449,346,356,264,454,337,336,299,337,338,151,294,278,455,308,292,415,429,358,355,265,340,372,388,390,466,352,346,280,295,442,282,354,19,370,285,441,295,195,248,197,457,440,274,301,300,368,417,351,465,251,301,389,385,380,386,394,395,379,399,412,419,410,436,322,387,373,388,326,2,393,354,370,461,393,164,267,268,302,12,386,374,387,312,268,13,298,293,301,265,446,340,380,385,381,280,330,425,322,426,391,420,429,437,393,391,326,344,440,438,458,459,461,364,434,394,428,396,262,274,354,457,317,316,402,316,315,403,315,314,404,314,313,405,313,421,406,323,366,361,292,306,407,306,291,408,291,287,409,287,432,410,427,434,411,372,264,383,459,309,457,366,352,401,1,274,4,418,421,262,331,294,358,435,433,367,392,289,439,328,462,326,94,2,370,289,305,455,339,254,448,359,255,446,254,253,449,253,252,450,252,256,451,256,341,452,414,413,463,286,441,414,286,258,441,258,257,442,257,259,443,259,260,444,260,467,445,309,459,250,305,289,290,305,290,460,401,376,435,309,250,392,376,411,433,453,341,464,357,453,465,343,357,412,437,343,399,344,360,440,420,437,456,360,420,363,361,401,288,265,372,353,390,339,249,339,448,255],SAMPLE_FACE:{keypoints:[{x:356.2804412841797,y:295.1960563659668,z:-23.786449432373047,name:"lips"},{x:354.8859405517578,y:264.69520568847656,z:-36.718435287475586},{x:355.2180862426758,y:275.3360366821289,z:-21.183712482452393},{x:347.349853515625,y:242.4400234222412,z:-25.093655586242676},{x:354.40135955810547,y:256.67933464050293,z:-38.23572635650635},{x:353.7689971923828,y:247.54886627197266,z:-34.5475435256958},{x:352.1288299560547,y:227.34312057495117,z:-13.095386028289795},{x:303.5013198852539,y:234.67002868652344,z:12.500141859054565,name:"rightEye"},{x:351.09378814697266,y:211.87547206878662,z:-6.413471698760986},{x:350.7115936279297,y:202.1251630783081,z:-6.413471698760986},{x:348.33667755126953,y:168.7741756439209,z:6.483500003814697,name:"faceOval"},{x:356.4806365966797,y:299.2995357513428,z:-23.144519329071045},{x:356.5511703491211,y:302.66146659851074,z:-21.020312309265137},{x:356.6239547729492,y:304.1536331176758,z:-18.137459754943848,name:"lips"},{x:356.5807342529297,y:305.1840591430664,z:-18.767719268798828,name:"lips"},{x:356.8241500854492,y:308.25711250305176,z:-20.16829490661621},{x:357.113037109375,y:312.26277351379395,z:-22.10575819015503},{x:357.34962463378906,y:317.1123218536377,z:-21.837315559387207,name:"lips"},{x:357.6658630371094,y:325.51036834716797,z:-16.27002477645874},{x:355.0201416015625,y:269.36279296875,z:-33.73054027557373},{x:348.5237503051758,y:270.33411026000977,z:-24.93025302886963},{x:279.97331619262695,y:213.24176788330078,z:47.759642601013184,name:"faceOval"},{x:322.66529083251953,y:238.5027265548706,z:5.535193085670471},{x:316.0983657836914,y:239.94489669799805,z:5.777376294136047},{x:309.9431610107422,y:240.24518966674805,z:7.510589361190796},{x:301.31994247436523,y:237.86138534545898,z:13.118728399276733},{x:328.14266204833984,y:235.80496788024902,z:6.646900177001953},{x:313.7326431274414,y:222.11161136627197,z:3.9887237548828125},{x:320.45196533203125,y:221.87729358673096,z:4.601476192474365},{x:307.35679626464844,y:223.63793849945068,z:5.932023525238037},{x:303.0031204223633,y:226.3743782043457,z:8.479321002960205},{x:296.80023193359375,y:242.94299125671387,z:15.931552648544312},{x:332.2352981567383,y:340.77341079711914,z:-10.165848731994629},{x:301.38587951660156,y:233.46447944641113,z:14.764405488967896,name:"rightEye"},{x:279.0147018432617,y:244.37155723571777,z:45.77549457550049},{x:289.60548400878906,y:239.1807460784912,z:23.191204071044922},{x:320.32257080078125,y:267.1292781829834,z:-4.954537749290466},{x:347.64583587646484,y:294.4955062866211,z:-23.06282043457031
26473,name:"lips"},{x:349.28138732910156,y:303.1095886230469,z:-20.238323211669922},{x:338.9453125,y:298.19186210632324,z:-19.456336498260498,name:"lips"},{x:333.36788177490234,y:302.6706790924072,z:-14.776077270507813,name:"lips"},{x:342.89188385009766,y:304.3561363220215,z:-17.752301692962646},{x:337.7375030517578,y:306.0098361968994,z:-13.410515785217285},{x:325.6159210205078,y:316.22995376586914,z:-6.681914925575256},{x:349.0104675292969,y:264.9818515777588,z:-36.274919509887695},{x:347.7138900756836,y:257.5664806365967,z:-37.67549514770508},{x:291.79357528686523,y:218.88171672821045,z:11.578094959259033,name:"rightEyebrow"},{x:332.2689437866211,y:247.56946563720703,z:-3.3730539679527283},{x:332.0074462890625,y:267.1201229095459,z:-19.969879388809204},{x:331.27952575683594,y:263.6967658996582,z:-17.47218608856201},{x:301.04373931884766,y:269.56552505493164,z:3.61815482378006},{x:347.4863815307617,y:249.0706443786621,z:-32.633421421051025},{x:307.26118087768555,y:208.2646894454956,z:1.1591226607561111,name:"rightEyebrow"},{x:297.91919708251953,y:212.22604751586914,z:5.914516448974609,name:"rightEyebrow"},{x:285.1651382446289,y:197.98450469970703,z:36.391637325286865,name:"faceOval"},{x:337.04097747802734,y:211.25229835510254,z:-4.548954665660858},{x:326.5912628173828,y:223.16698551177979,z:6.670243740081787},{x:320.05664825439453,y:309.5834255218506,z:-4.055835008621216},{x:289.6866226196289,y:314.617395401001,z:53.875489234924316,name:"faceOval"},{x:337.4256896972656,y:270.8755302429199,z:-17.67060160636902},{x:343.69922637939453,y:273.0000400543213,z:-18.756048679351807},{x:327.4242401123047,y:309.22399520874023,z:-4.703601002693176,name:"lips"},{x:330.37220001220703,y:308.3323001861572,z:-6.442649960517883},{x:293.87027740478516,y:207.7961826324463,z:9.821539521217346,name:"rightEyebrow"},{x:332.11437225341797,y:271.22812271118164,z:-16.64351224899292},{x:320.1197814941406,y:207.40366458892822,z:-2.48164564371109,name:"rightEyebrow"},{x:318.59575271606445,y:201.07443809509277,z:-3.110446035861969,name:"rightEyebrow"},{x:310.72303771972656,y:175.75075149536133,z:13.328815698623657,name:"faceOval"},{x:289.67578887939453,y:202.29835510253906,z:21.370456218719482},{x:315.30879974365234,y:187.35260009765625,z:5.0304025411605835},{x:287.8936767578125,y:216.54793739318848,z:17.81065821647644,name:"rightEyebrow"},{x:283.9391899108887,y:215.01142501831055,z:32.04984903335571},{x:348.35330963134766,y:299.4155788421631,z:-22.47924566268921},{x:341.1790466308594,y:301.8221855163574,z:-18.977805376052856},{x:335.69713592529297,y:304.4266891479492,z:-14.682706594467163},{x:339.4615173339844,y:272.3654365539551,z:-16.38674020767212},{x:328.99600982666016,y:308.86685371398926,z:-5.616893768310547},{x:332.00313568115234,y:309.1875743865967,z:-10.335084199905396},{x:331.0068130493164,y:307.9274368286133,z:-6.681914925575256,name:"lips"},{x:341.13792419433594,y:266.4876937866211,z:-26.56425952911377},{x:339.02950286865234,y:305.6663703918457,z:-12.33674168586731,name:"lips"},{x:344.22935485839844,y:304.9452781677246,z:-15.161235332489014,name:"lips"},{x:350.1844024658203,y:304.374303817749,z:-17.5305438041687,name:"lips"},{x:348.52630615234375,y:325.9562301635742,z:-16.164982318878174},{x:348.6581802368164,y:317.1624183654785,z:-21.510512828826904,name:"lips"},{x:348.9766311645508,y:312.1923065185547,z:-21.708929538726807},{x:349.2427444458008,y:308.0660820007324,z:-19.643079042434692},{x:349.67491149902344,y:305.42747497558594,z:-18.16080331802368,name:"lips"},{x:337.95589447021484,y:306.6535949707031,z:-12.803598642349243,name:"lips"},{x:337.06878662109375,y:307.63169288635254,z:-14.274203777313232},{x:335.77449798583984,y:309.8449516296387,z:-15.698124170303345},{x:334.6099090576172,y:312.7997016906738,z:-14.764405488967896,name:"lips"},{x:327.2330856323242,y:293.80866050720215,z:-11.864047050476074},{x:280.97679138183594,y:279.79928970336914,z:68.90834331512451,name:"faceOval"},{x:355.13843536376953,y:271.7875671386719,z:-25.350427627563477},{x:334.7235870361328,y:307.4656391143799,z:-9.302158951759338,name:"lips"},{x:333.5293960571289,y:307.89782524108887,z:-10.200862884521484},{x:346.29688262939453,y:276.4256286621094,z:-19.748122692108154},{x:335.16246795654297,y:276.22097969055176,z:-12.313398122787476},{x:345.09132385253906,y:274.7082996368408,z:-19.304605722427368},{x:325.4267883300781,y:252.95130729675293,z:-1.6661019623279572},{x:315.347843170166,y:259.05200958251953,z:-.25604281574487686},{x:330.44933319091797,y:267.7570152282715,z:-14.017432928085327},{x:294.96768951416016,y:185.26001930236816,z:23.903164863586426,name:"faceOval"},{x:299.63531494140625,y:192.7913761138916,z:12.640198469161987},{x:304.5452117919922,y:202.4142837524414,z:3.244667649269104,name:"rightEyebrow"},{x:331.6915512084961,y:320.0467872619629,z:-10.632705688476563},{x:334.5911407470703,y:201.27566814422607,z:-6.133356094360352,name:"rightEyebrow"},{x:331.4815902709961,y:185.44180870056152,z:.6627205014228821},{x:328.05816650390625,y:170.8385467529297,z:7.358860373497009,name:"faceOval"},{x:304.49764251708984,y:239.76297855377197,z:10.387605428695679},{x:290.6382179260254,y:248.85257720947266,z:19.03616428375244},{x:331.5682601928711,y:233.20727348327637,z:7.837390303611755},{x:295.5115509033203,y:228.9834451675415,z:14.41426157951355},{x:336.94332122802734,y:241.8259334564209,z:-5.27842104434967},{x:336.2792205810547,y:262.7049922943115,z:-26.12074375152588},{x:284.4102478027344,y:255.3262710571289,z:25.467140674591064}
2647,{x:295.1420593261719,y:253.02655220031738,z:12.430112361907959},{x:303.5196113586426,y:254.20703887939453,z:6.139191389083862},{x:315.73450088500977,y:251.64799690246582,z:3.3788898587226868},{x:324.69661712646484,y:247.56494522094727,z:2.3328344523906708},{x:331.57970428466797,y:243.02241325378418,z:1.1423448473215103},{x:345.6210708618164,y:229.9976634979248,z:-10.825285911560059},{x:286.26644134521484,y:270.37991523742676,z:21.708929538726807},{x:290.2525520324707,y:228.4921360015869,z:17.71728754043579},{x:351.65367126464844,y:269.3400764465332,z:-33.450424671173096},{x:333.1378936767578,y:253.88388633728027,z:-7.230473756790161},{x:277.8318977355957,y:246.95331573486328,z:68.20805549621582,name:"faceOval"},{x:336.6680908203125,y:238.10003757476807,z:.7688578963279724},{x:329.95800018310547,y:269.18323516845703,z:-7.207130789756775},{x:299.17491912841797,y:234.13324356079102,z:15.95489501953125},{x:335.61729431152344,y:258.71752738952637,z:-23.016133308410645},{x:284.1079330444336,y:297.0343494415283,z:63.25934886932373,name:"faceOval"},{x:331.44542694091797,y:230.6892442703247,z:9.92658257484436,name:"rightEye"},{x:341.41536712646484,y:253.01264762878418,z:-29.038610458374023},{x:303.5472869873047,y:327.5896739959717,z:16.725212335586548},{x:304.7756576538086,y:337.4389457702637,z:27.38126277923584,name:"faceOval"},{x:280.80501556396484,y:275.32050132751465,z:45.0752067565918},{x:295.43582916259766,y:318.4501647949219,z:26.2608003616333},{x:281.4303207397461,y:228.7355661392212,z:40.94350814819336},{x:331.2549591064453,y:349.4216537475586,z:-7.376367449760437},{x:352.4247741699219,y:271.7330074310303,z:-24.953596591949463},{x:327.5672912597656,y:260.41900634765625,z:-5.456410646438599},{x:284.5432472229004,y:241.7647933959961,z:29.668869972229004},{x:310,y:235.66174507141113,z:8.502663969993591,name:"rightEye"},{x:315.7071113586426,y:235.7572603225708,z:6.938687562942505,name:"rightEye"},{x:330.41088104248047,y:311.04143142700195,z:-9.325502514839172,name:"lips"},{x:288.5377502441406,y:285.31983375549316,z:21.837315559387207},{x:344.55039978027344,y:359.4300842285156,z:-6.705257892608643,name:"faceOval"},{x:323.41880798339844,y:351.67362213134766,z:7.802375555038452,name:"faceOval"},{x:314.64088439941406,y:346.11894607543945,z:16.36339783668518,name:"faceOval"},{x:349.4945526123047,y:184.8434829711914,z:-.21847527474164963},{x:359.24694061279297,y:359.8348903656006,z:-8.403456211090088,name:"faceOval"},{x:321.26182556152344,y:234.64492321014404,z:6.90950870513916,name:"rightEye"},{x:326.318359375,y:232.90250301361084,z:8.029969334602356,name:"rightEye"},{x:329.6211624145508,y:231.6195774078369,z:9.722331762313843,name:"rightEye"},{x:285.9398078918457,y:228.2351303100586,z:24.650139808654785},{x:325.79288482666016,y:227.88007736206055,z:7.469738721847534,name:"rightEye"},{x:320.1699447631836,y:227.5934886932373,z:6.168370842933655,name:"rightEye"},{x:314.85408782958984,y:227.85282611846924,z:6.2675780057907104,name:"rightEye"},{x:309.3084907531738,y:229.1516876220703,z:7.7031683921813965,name:"rightEye"},{x:305.5621337890625,y:230.92366218566895,z:9.722331762313843,name:"rightEye"},{x:277.8681945800781,y:228.5354232788086,z:59.71122741699219,name:"faceOval"},{x:306.1444664001465,y:235.1954698562622,z:10.603528022766113,name:"rightEye"},{x:355.4478454589844,y:281.96210861206055,z:-20.565123558044434},{x:333.02661895751953,y:288.0105400085449,z:-14.72939133644104},{x:337.15728759765625,y:269.2059516906738,z:-19.8414945602417},{x:345.9898376464844,y:283.5453128814697,z:-20.4834246635437},{x:351.48963928222656,y:219.98916149139404,z:-7.0378947257995605},{x:312.39574432373047,y:336.50628089904785,z:8.671900033950806},{x:321.32152557373047,y:343.1755256652832,z:.9067271649837494},{x:343.78379821777344,y:353.2975959777832,z:-14.355905055999756},{x:296.8791389465332,y:327.91497230529785,z:41.01353645324707,name:"faceOval"},{x:329.6939468383789,y:229.27897453308105,z:8.934508562088013,name:"rightEye"},{x:341.6905212402344,y:241.4073657989502,z:-14.589333534240723},{x:359.03079986572266,y:353.48859786987305,z:-15.803166627883911},{x:333.1861877441406,y:356.43213272094727,z:-1.0234417766332626,name:"faceOval"},{x:283.97483825683594,y:291.4318656921387,z:41.94725513458252},{x:343.33770751953125,y:305.830135345459,z:-15.756480693817139,name:"lips"},{x:342.40283966064453,y:307.7453899383545,z:-17.4021577835083},{x:341.53621673583984,y:311.0595703125,z:-19.047834873199463},{x:340.9107208251953,y:315.4837703704834,z:-18.5576331615448,name:"lips"},{x:339.1478729248047,y:323.42233657836914,z:-14.367576837539673}
2647,{x:333.3201599121094,y:307.4406337738037,z:-9.617288708686829},{x:331.2411117553711,y:306.9811820983887,z:-9.669809937477112},{x:329.23255920410156,y:306.0508346557617,z:-9.582273960113525,name:"lips"},{x:322.4586486816406,y:301.33323669433594,z:-7.720675468444824},{x:297.1712112426758,y:286.9552803039551,z:8.240055441856384},{x:341.3060760498047,y:235.4432201385498,z:-7.504753470420837},{x:336.9318389892578,y:224.3451976776123,z:5.829898118972778},{x:332.65323638916016,y:226.70403957366943,z:8.105834126472473},{x:334.67357635498047,y:306.4397621154785,z:-8.981193900108337,name:"lips"},{x:297.4601936340332,y:306.29210472106934,z:15.476365089416504},{x:342.9119110107422,y:222.37077713012695,z:-2.754466235637665},{x:335.4629898071289,y:332.20250129699707,z:-11.823196411132813},{x:353.2412338256836,y:240.56339263916016,z:-27.147831916809082},{x:346.3080596923828,y:236.41446590423584,z:-18.452589511871338},{x:352.6475143432617,y:234.1420555114746,z:-19.748122692108154},{x:337.3209762573242,y:253.39937210083008,z:-16.024924516677856},{x:358.6122131347656,y:344.90861892700195,z:-18.592647314071655},{x:358.1117248535156,y:334.64990615844727,z:-17.49552845954895},{x:346.4450454711914,y:335.0321102142334,z:-16.32838249206543},{x:319.17640686035156,y:320.2833938598633,z:-3.276764452457428},{x:325.2540588378906,y:276.2369728088379,z:-6.460157036781311},{x:326.7214584350586,y:327.3939514160156,z:-7.417217493057251},{x:310.7190132141113,y:277.2265148162842,z:-3.5452082753181458},{x:319.78355407714844,y:284.8238182067871,z:-6.4543211460113525},{x:305.773983001709,y:290.83580017089844,z:.06907138042151928},{x:344.4001770019531,y:344.85408782958984,z:-16.946970224380493},{x:333.1879425048828,y:258.74256134033203,z:-11.90489649772644},{x:313.80598068237305,y:327.08919525146484,z:2.2277912497520447},{x:322.9637908935547,y:334.6819496154785,z:-3.3643004298210144},{x:313.4055519104004,y:311.2166690826416,z:-1.1175429821014404},{x:291.0865783691406,y:298.2831001281738,z:22.467575073242188},{x:305.6580924987793,y:313.3707904815674,z:5.561453700065613},{x:288.23760986328125,y:305.9941864013672,z:36.765122413635254},{x:315.10692596435547,y:296.26991271972656,z:-4.604393839836121},{x:337.50518798828125,y:247.5944423675537,z:-10.597691535949707},{x:338.8450622558594,y:265.47778129577637,z:-27.778091430664063
vendor: 3,872 bytes, line 2647
2647},{x:334.25254821777344,y:269.0671920776367,z:-20.938611030578613},{x:341.64512634277344,y:259.6387195587158,z:-32.189905643463135},{x:331.44081115722656,y:219.0976095199585,z:4.207563698291779},{x:320.56339263916016,y:216.49658203125,z:2.930997312068939},{x:311.21912002563477,y:216.57853603363037,z:2.9674705862998962},{x:303.46256256103516,y:218.54614734649658,z:5.357203483581543},{x:297.99999237060547,y:222.505202293396,z:9.325502514839172},{x:294.93839263916016,y:236.39654159545898,z:18.534289598464966},{x:278.87489318847656,y:259.7095584869385,z:45.68212032318115},{x:300.3782653808594,y:245.38593292236328,z:12.278382778167725},{x:307.06348419189453,y:246.36857986450195,z:8.164191246032715},{x:315.5229187011719,y:245.3949737548828,z:5.503097176551819},{x:323.71395111083984,y:242.75178909301758,z:4.6335723996162415},{x:330.2785873413086,y:239.34658527374268,z:4.937030673027039},{x:334.6982192993164,y:236.0460376739502,z:4.823233783245087},{x:279.3412208557129,y:263.5196113586426,z:70.91583728790283,name:"faceOval"},{x:334.65972900390625,y:271.6648578643799,z:-17.775644063949585},{x:342.05677032470703,y:246.99846267700195,z:-20.84523916244507},{x:344.0357971191406,y:264.5701503753662,z:-32.936880588531494},{x:348.25531005859375,y:268.6645030975342,z:-30.695960521697998},{x:344.12227630615234,y:266.34212493896484,z:-29.808926582336426},{x:337.12318420410156,y:274.2556858062744,z:-15.768152475357056},{x:349.49047088623047,y:269.071683883667,z:-32.51670837402344},{x:350.1683044433594,y:271.4691352844238,z:-24.93025302886963},{x:333.9634704589844,y:230.56639194488525,z:8.89949381351471},{x:338.2147979736328,y:231.4807891845703,z:4.6715047955513},{x:340.4712677001953,y:231.74463272094727,z:-.34996166825294495},{x:303.28975677490234,y:232.24980354309082,z:11.916568279266357,name:"rightEye"},{x:299.4649124145508,y:229.53842639923096,z:12.325069904327393},{x:359.09618377685547,y:241.77349090576172,z:-24.650139808654785},{x:399.46216583251953,y:229.89503860473633,z:15.919880867004395,name:"leftEye"},{x:361.38919830322266,y:269.6129894256592,z:-24.510080814361572},{x:416.9973373413086,y:206.0895538330078,z:53.26857566833496,name:"faceOval"},{x:381.32179260253906,y:235.5476474761963,z:7.6214683055877686},{x:387.8068542480469,y:236.25958442687988,z:8.345099091529846},{x:393.95751953125,y:235.8660364151001,z:10.475142002105713},{x:401.84600830078125,y:232.77019500732422,z:16.760226488113403},{x:375.70568084716797,y:233.48456382751465,z:8.234220147132874},{x:388.17752838134766,y:218.94717693328857,z:6.810300946235657},{x:381.64928436279297,y:219.2656660079956,z:6.711093783378601},{x:394.4760513305664,y:219.66821193695068,z:9.173773527145386},{x:398.8843536376953,y:221.8837022781372,z:12.03328251838684},{x:406.5454864501953,y:237.12156772613525,z:19.7131085395813},{x:383.87447357177734,y:337.6932907104492,z:-8.631049990653992},{x:401.2682342529297,y:228.5916566848755,z:18.359217643737793,name:"leftEye"},{x:422.0449447631836,y:236.73934936523438,z:51.16771221160889},{x:412.69153594970703,y:232.80198097229004,z:27.52131938934326},{x:387.3497772216797,y:263.298397064209,z:-2.8609684109687805},{x:364.5124053955078,y:293.39221000671387,z:-22.397546768188477,name:"lips"},{x:363.62987518310547,y:302.1291446685791,z:-19.643079042434692},{x:373.2334518432617,y:295.8647060394287,z:-18.125789165496826,name:"lips"},{x:378.83365631103516,y:299.5177745819092,z:-13.153743743896484,name:"lips"},{x:369.91477966308594,y:302.5704002380371,z:-16.65518283843994},{x:374.9167251586914,y:303.5416603088379,z:-11.963253021240234},{x:387.58888244628906,y:312.2716999053955,z:-4.680258631706238},{x:360.6635284423828,y:264.31986808776855,z:-35.94811677932739},{x:361.04564666748047,y:256.8225860595703,z:-37.278664112091064},{x:408.3855438232422,y:213.52088928222656,z:15.756480693817139,name:"leftEyebrow"},{x:373.2946014404297,y:245.3810119628906
26473,z:-1.9316278398036957},{x:376.83860778808594,y:264.3721103668213,z:-18.510947227478027},{x:376.9546127319336,y:261.0010528564453,z:-15.989909172058105},{x:406.1498260498047,y:263.5030174255371,z:7.072908878326416},{x:360.07205963134766,y:248.3631706237793,z:-32.16656446456909},{x:393.11119079589844,y:205.10473251342773,z:3.7786373496055603,name:"leftEyebrow"},{x:402.12791442871094,y:207.89000988006592,z:9.383859634399414,name:"leftEyebrow"},{x:410.8693313598633,y:191.6182279586792,z:41.27030849456787,name:"faceOval"},{x:364.9509811401367,y:210.40483474731445,z:-3.758212625980377},{x:375.94444274902344,y:221.1331844329834,z:8.368442058563232},{x:392.1904754638672,y:305.0360298156738,z:-1.752179116010666},{x:419.50225830078125,y:307.25592613220215,z:58.96425247192383,name:"faceOval"},{x:372.0027160644531,y:268.7212657928467,z:-16.631840467453003},{x:366.1614227294922,y:271.6237449645996,z:-18.219159841537476},{x:385.00938415527344,y:305.3863334655762,z:-2.567722797393799},{x:381.99771881103516,y:304.9723720550537,z:-4.575215280056},{x:405.078125,y:203.21216583251953,z:13.713973760604858,name:"leftEyebrow"},{x:377.13207244873047,y:268.4710121154785,z:-15.266278982162476},{x:380.9713363647461,y:205.36980628967285,z:-.7250899076461792,name:"leftEyebrow"},{x:381.7788314819336,y:198.9268398284912,z:-1.184653863310814,name:"leftEyebrow"},{x:385.5204772949219,y:172.1484375,z:16.04826807975769,name:"faceOval"},{x:407.94189453125,y:196.76236152648926,z:25.723915100097656},{x:383.03890228271484,y:184.5157527923584,z:7.393874526023865},{x:411.61781311035156,y:210.79241752624512,z:22.315845489501953,name:"leftEyebrow"},{x:414.30870056152344,y:208.4643030166626,z:37.021894454956055},{x:364.28722381591797,y:298.35777282714844,z:-21.86065673828125},{x:371.3682556152344,y:299.78848457336426,z:-17.834001779556274},{x:376.88201904296875,y:301.6696071624756,z:-13.153743743896484},{x:370.2193832397461,y:270.49095153808594,z:-15.569736957550049},{x:383.5081100463867,y:305.2726364135742,z:-3.673594295978546},{x:380.73760986328125,y:305.96869468688965,z:-8.660228252410889},{x:381.2334442138672,y:304.63574409484863,z:-4.820316135883331,name:"lips"},{x:368.1698989868164,y:264.8884963989258,z:-25.653886795043945},{x:373.5087203979492,y:303.4233856201172,z:-10.95950722694397,name:"lips"},{x:368.4544372558594,y:303.29601287841797,z:-14.169161319732666,name:"lips"},{x:362.76554107666016,y:303.5735607147217,z:-16.911956071853638,name:"lips"},{x:366.60980224609375,y:324.8870658874512,z:-15.616422891616821},{x:365.7067108154297,y:315.95678329467773,z:-20.903596878051758,name:"lips"},{x:365.0083923339844,y:311.2232208251953,z:-21.066999435424805},{x:364.1508102416992,y:307.0583438873291,z:-18.907777070999146},{x:363.37512969970703,y:304.5721435546875,z:-17.42550015449524,name:"lips"},{x:374.580078125,y:304.3059539794922,z:-11.40302300453186,name:"lips"},{x:375.55362701416016,y:305.0998020172119,z:-12.861957550048828},{x:377.2437286376953,y:307.1674346923828,z:-14.215847253799438},{x:378.68587493896484,y:309.9015712738037,z:-13.223772048950195,name:"lips"},{x:383.8992691040039,y:290.29629707336426,z:-9.97326910495758},{x:423.3871841430664,y:271.91688537597656,z:74.37058925628662,name:"faceOval"},{x:377.68043518066406,y:304.62209701538086,z:-7.603961229324341,name:"lips"},{x:379.00428771972656,y:304.9314594268799,z:-8.57852816581726},{x:364.00279998779297,y:275.2813911437988,z:-19.25792098045349},{x:374.68231201171875,y:273.82555961608887,z:-11.28047227859497},{x:365.0354766845703,y:273.4548568725586,z:-18.791062831878662},{x:380.61901092529297,y:249.8848056793213,z:.15501167625188828},{x:391.14158630371094,y:254.7934627532959,z:2.0906515419483185},{x:378.1761169433594,y:264.9612236022949,z:-12.605184316635132},{x:400.9540557861328,y:179.99592304229736,z:27.82477855682373,name:"faceOval"},{x:398.0038833618164,y:188.50656509399414,z:16.094952821731567},{x:394.8717498779297,y:199.0359592437744,z:6.226727366447449,name:"leftEyebrow"},{x:382.10926055908203,y:316.83926582336426,z:-8.946179747581482},{x:366.51588439941406,y:200.32583713531494,z:-5.24632453918457,name:"leftEyebrow"},{x:367.4893569946289,y:183.87210845947266,z:1.9039081037044525},{x:368.6243438720703,y:168.8127565383911,z:8.736093044281006,name:"faceOval"},{x:398.96175384521484,y:234.9675178527832,z:13.713973760604858},{x:412.9645538330078,y:242.23042488098145,z:23.272905349731445},{x:372.05257415771484,y:231.41919136047363,z:9.226294755935669},{x:406.0722351074219,y:223.58965873718262,z:18.370890617370605},{x:368.27442169189453,y:240.2039337158203,z:-4.166713654994965},{x:372.3575210571289,y:260.66442489624023,z:-24.976940155029297},{x:419.2244338989258,y:247.9079246520996,z:30.299127101898193},{x:409.43885803222656,y:246.60913467407227,z:16.398411989212036},{x:401.69139862060547,y:248.76328468322754,z:9.395531415939331},{x:389.7608184814453,y:247.56915092468262,z:5.841569304466248},{x:380.5461883544922,y:244.55984115600586,z:4.263003468513489},{x:373.25817108154297,y:240.80214500427246,z:2.5356262922286987},{x:358.77086639404297,y:229.35615062713623,z:-10.387605428695679},{x:419.5793914794922,y:262.8478717803955,z:26.5175724029541},{x:410.8808898925781,y:222.51372814178467,z:22.199130058288574},{x:358.45714569091797,y:268.91467094421387,z:-33.17030906677246},{x:373.4129333496094,y:251.6385841369629,z:-5.771540403366089},{x:422.5408172607422,y:239.23919677734375,z:74.04378890991211,name:"faceOval"},{x:367.8171920776367,y:236.58040523529053,z:1.820748895406723},{x:378.51959228515625,y:266.2532329559326,z:-5.74819803237915}
2647,{x:403.3472442626953,y:229.05112266540527,z:19.689764976501465},{x:372.34840393066406,y:256.6451168060303,z:-21.872329711914063},{x:422.54566192626953,y:289.1587829589844,z:68.67491245269775,name:"faceOval"},{x:371.9297409057617,y:228.90116214752197,z:11.432201862335205,name:"leftEye"},{x:366.21360778808594,y:251.6158962249756,z:-28.19826364517212},{x:409.1571807861328,y:321.3156223297119,z:20.2266526222229},{x:408.52943420410156,y:331.44238471984863,z:31.09278917312622,name:"faceOval"},{x:424.2788314819336,y:267.1992301940918,z:50.467424392700195},{x:415.60352325439453,y:311.6528606414795,z:30.579242706298828},{x:418.12793731689453,y:221.59927368164063,z:46.26569747924805},{x:385.68286895751953,y:346.0184955596924,z:-5.70151150226593},{x:357.82936096191406,y:271.3758373260498,z:-24.836881160736084},{x:379.588623046875,y:257.5071716308594,z:-3.755294680595398},{x:417.4592590332031,y:234.71948146820068,z:34.5475435256958},{x:393.4684371948242,y:231.58967971801758,z:11.408859491348267,name:"leftEye"},{x:387.8864288330078,y:232.14245796203613,z:9.51808214187622,name:"leftEye"},{x:382.4981689453125,y:307.5654888153076,z:-7.522260546684265,name:"lips"},{x:419.00169372558594,y:277.8332805633545,z:26.424202919006348},{x:373.62953186035156,y:357.6375102996826,z:-5.75986921787262,name:"faceOval"},{x:392.8708267211914,y:347.72446632385254,z:10.154176950454712,name:"faceOval"},{x:400.3953552246094,y:341.0005187988281,z:19.39797878265381,name:"faceOval"},{x:382.25440979003906,y:231.66935920715332,z:8.998700976371765,name:"leftEye"},{x:377.14550018310547,y:230.4228687286377,z:9.804032444953918,name:"leftEye"},{x:373.8358688354492,y:229.64950561523438,z:11.292144060134888,name:"leftEye"},{x:414.5794677734375,y:221.67891025543213,z:29.412097930908203},{x:377.00672149658203,y:225.66201210021973,z:9.360517263412476,name:"leftEye"},{x:382.29530334472656,y:224.8431158065796,z:8.32175612449646,name:"leftEye"},{x:387.5133514404297,y:224.49507236480713,z:8.917000889778137,name:"leftEye"},{x:393.15906524658203,y:225.24795055389404,z:10.737749338150024,name:"leftEye"},{x:397.05554962158203,y:226.55359268188477,z:13.002015352249146,name:"leftEye"},{x:420.5299377441406,y:221.014666557312,z:65.40690422058105,name:"faceOval"},{x:397.06920623779297,y:230.6661558151245,z:13.807345628738403,name:"leftEye"},{x:377.94647216796875,y:285.1647090911865,z:-13.305472135543823},{x:372.1118927001953,y:267.1267318725586,z:-18.83774757385254},{x:364.9968719482422,y:282.24411964416504,z:-19.818150997161865},{x:401.973876953125,y:331.20131492614746,z:11.566424369812012},{x:394.3083190917969,y:338.86693954467773,z:3.142542541027069},{x:373.9820861816406,y:351.4504623413086,z:-13.50388765335083},{x:414.3888854980469,y:321.24735832214355,z:45.51872253417969,name:"faceOval"},{x:373.44234466552734,y:227.33163356781006,z:10.626870393753052,name:"leftEye"},{x:364.0731430053711,y:240.31539916992188,z:-13.807345628738403},{x:384.2658233642578,y:353.3793067932129,z:.7385850697755814,name:"faceOval"},{x:423.20526123046875,y:283.5176181793213,z:47.152724266052246},{x:369.42798614501953,y:304.0898895263672,z:-14.647691249847412,name:"lips"},{x:370.63812255859375,y:305.90051651000977,z:-16.211668252944946},{x:371.91192626953125,y:309.0167713165283,z:-17.84567356109619},{x:373.0583953857422,y:313.3545398712158,z:-17.378815412521362,name:"lips"},{x:375.39905548095703,y:321.09289169311523,z:-13.118728399276733},{x:379.2567825317383,y:304.3582534790039,z:-7.924926280975342},{x:381.18797302246094,y:303.7031364440918,z:-7.843226194381714},{x:383.0918502807617,y:302.4884605407715,z:-7.6506465673446655,name:"lips"},{x:389.09461975097656,y:297.1475315093994,z:-5.5497825145721436},{x:411.6408920288086,y:280.24898529052734,z:12.02161192893982},{x:363.3110809326172,y:234.27620887756348,z:-6.775286793708801},{x:366.0474395751953,y:223.29872131347656,z:6.827808618545532},{x:370.34427642822266,y:225.1457118988037,z:9.558931589126587},{x:377.5371551513672,y:303.60079765319824,z:-7.358860373497009,name:"lips"},{x:412.9557800292969,y:299.53579902648926,z:19.39797878265381},{x:360.0810241699219,y:221.72012329101563,z:-2.153385728597641},{x:379.82784271240234,y:329.47723388671875,z:-10.48097848892212},{x:359.08477783203125,y:235.7911491394043,z:-18.079102039337158},{x:369.6688461303711,y:251.5407943725586,z:-14.962821006774902},{x:369.5555114746094,y:333.5307312011719,z:-15.67478060722351},{x:394.0193176269531,y:315.6973171234131,z:-.9920747578144073},{x:383.78997802734375,y:272.7268695831299,z:-4.689012169837952},{x:387.67765045166016,y:323.6722755432129,z:-5.640236139297485},{x:397.8769302368164,y:272.1331214904785,z:-.9395531564950943},{x:389.87476348876953,y:280.5630111694336,z:-4.29218202829361},{x:403.83888244628906,y:285.1167869567871,z:3.0229100584983826},{x:372.5467300415039,y:343.1070327758789,z:-16.153310537338257},{x:374.1112518310547,y:256.3721466064453,z:-10.574349164962769},{x:399.73785400390625,y:321.77515983581543,z:4.849494695663452}
2647,{x:392.03365325927734,y:330.56447982788086,z:-1.3407598435878754},{x:398.59134674072266,y:305.93902587890625,z:1.517290621995926},{x:417.95997619628906,y:290.9716987609863,z:26.89105987548828},{x:406.04541778564453,y:307.35154151916504,z:8.666064143180847},{x:420.75328826904297,y:298.40752601623535,z:41.78385257720947},{x:395.4522705078125,y:291.4153575897217,z:-2.1752697229385376},{x:368.6452102661133,y:245.8882999420166,z:-9.453888535499573},{x:370.34900665283203,y:263.56690406799316,z:-26.75100326538086},{x:374.98477935791016,y:266.6126346588135,z:-19.77146625518799},{x:366.99840545654297,y:258.12140464782715,z:-31.372904777526855},{x:371.00616455078125,y:217.63479709625244,z:5.60522198677063},{x:381.30577087402344,y:214.14087295532227,z:4.983716309070587},{x:390.1496124267578,y:213.38221549987793,z:5.593550801277161},{x:397.7696990966797,y:214.3659782409668,z:8.57852816581726},{x:403.1652069091797,y:217.65509605407715,z:13.013685941696167},{x:407.3551940917969,y:230.72525024414063
vendor: 3,314 bytes, line 2647
2647,z:22.444231510162354},{x:424.0876770019531,y:251.7839241027832,z:51.16771221160889},{x:403.50196838378906,y:239.88757610321045,z:15.803166627883911},{x:397.31719970703125,y:241.49806022644043,z:11.233787536621094},{x:388.99425506591797,y:241.4366912841797,z:7.948269248008728},{x:380.7804489135742,y:239.78078842163086,z:6.600214838981628},{x:374.01336669921875,y:237.11946487426758,z:6.349278092384338},{x:369.39125061035156,y:234.35351371765137,z:5.987462401390076},{x:422.9730987548828,y:255.76455116271973,z:76.61150932312012,name:"faceOval"},{x:374.73915100097656,y:269.24214363098145,z:-16.608498096466064},{x:364.61681365966797,y:245.71088790893555,z:-20.02823829650879},{x:365.3834533691406,y:263.34174156188965,z:-32.32996463775635},{x:361.58252716064453,y:267.8273677825928,z:-30.345816612243652},{x:365.37208557128906,y:265.0249671936035,z:-29.178667068481445},{x:372.72605895996094,y:272.05135345458984,z:-14.834434986114502},{x:360.48614501953125,y:268.34827423095703,z:-32.189905643463135},{x:359.9516296386719,y:270.8049201965332,z:-24.650139808654785},{x:369.5049285888672,y:229.01945114135742,z:10.107489824295044},{x:365.5447769165039,y:230.24096488952637,z:5.593550801277161},{x:363.50669860839844,y:230.6208372116089,z:.43622106313705444},{x:399.3529510498047,y:227.65677452087402,z:15.35965085029602,name:"leftEye"},{x:402.5693130493164,y:224.60190296173096,z:15.931552648544312}],box:{xMin:277.8318977355957,yMin:168.7741756439209,xMax:424.2788314819336,yMax:359.8348903656006,width:146.4469337463379,height:191.0607147216797}},SAMPLE_FACELANDMARKER_RESULT:{faceLandmarks:[[{x:.5760777592658997,y:.8639070391654968,z:-.030997956171631813},{x:.572094738483429,y:.7886289358139038,z:-.07189624011516571},{x:.5723551511764526,y:.8075382709503174,z:-.03578168898820877},{x:.5548420548439026,y:.7188365459442139,z:-.057787876576185226},{x:.5706077814102173,y:.7674974799156189,z:-.07740399986505508},{x:.5681378245353699,y:.7387768030166626,z:-.07356284558773041},{x:.5621535181999207,y:.6681165099143982,z:-.04189874976873398},{x:.46613582968711853,y:.6679812073707581,z:.011289681307971478},{x:.5579932928085327,y:.6174106597900391,z:-.03502821549773216},{x:.5563451647758484,y:.5905600190162659,z:-.03928658738732338},{x:.5487832427024841,y:.4900572597980499,z:-.029898937791585922},{x:.5765544176101685,y:.8692144751548767,z:-.02831427752971649},{x:.5771114230155945,y:.873644232749939,z:-.02345779910683632},{x:.5771905779838562,y:.877016007900238,z:-.016658689826726913},{x:.5778058767318726,y:.8770116567611694,z:-.014505492523312569},{x:.5783766508102417,y:.8835000991821289,z:-.015996402129530907},{x:.5792440176010132,y:.8913810849189758,z:-.01924579218029976},{x:.5796768069267273,y:.8996334671974182,z:-.018261712044477463},{x:.5817288160324097,y:.9255813956260681,z:-.007126849144697189},{x:.5726592540740967,y:.7992473244667053,z:-.0643521398305893},{x:.5579419136047363,y:.7996989488601685,z:-.04566684365272522},{x:.4216199815273285,y:.5958762764930725,z:.06776496022939682},{x:.5052269697189331,y:.6796539425849915,z:-.0010737782577052712},{x:.49243026971817017,y:.6838865876197815,z:-.0005227324436418712},{x:.4796970784664154,y:.6856290102005005,z:.002684245817363262},{x:.4618356227874756,y:.6764569878578186,z:.013439622707664967},{x:.5160380601882935,y:.6737282276153564,z:-
2647.000017607348127057776},{x:.48070961236953735,y:.6255870461463928,z:-.008339674212038517},{x:.49719780683517456,y:.6256808042526245,z:-.008027955889701843},{x:.46674346923828125,y:.6317623853683472,z:-.004460199736058712},{x:.4582492709159851,y:.641118049621582,z:.0011905613355338573},{x:.45408669114112854,y:.6911458969116211,z:.020514748990535736},{x:.535312294960022,y:.9619986414909363,z:.012499462813138962},{x:.4608460068702698,y:.6628725528717041,z:.01517564244568348},{x:.4206731915473938,y:.6828458309173584,z:.07848648726940155},{x:.4390624463558197,y:.6796106696128845,z:.03283142298460007},{x:.5029968619346619,y:.7701570391654968,z:-.009734481573104858},{x:.5595027208328247,y:.8607323169708252,z:-.030043255537748337},{x:.5621269941329956,y:.8738374710083008,z:-.021709579974412918},{x:.5451499819755554,y:.865527331829071,z:-.022014077752828598},{x:.5351184010505676,y:.8705098032951355,z:-.011602800339460373},{x:.5495014190673828,y:.8744956254959106,z:-.016490943729877472},{x:.5395170450210571,y:.8759440779685974,z:-.007333362940698862},{x:.5183624029159546,y:.8959754705429077,z:.010520773939788342},{x:.5604349374771118,y:.7895449995994568,z:-.07082037627696991},{x:.557381272315979,y:.7687489986419678,z:-.07590588927268982},{x:.4432901442050934,y:.6308897733688354,z:.0027153254486620426},{x:.5258325338363647,y:.7151225805282593,z:-.014676518738269806},{x:.5271827578544617,y:.7833116054534912,z:-.037643320858478546},{x:.5257382988929749,y:.7717816233634949,z:-.03401920944452286},{x:.46516409516334534,y:.7705106735229492,z:.0065747760236263275},{x:.5558893084526062,y:.7420997619628906,z:-.0694495290517807},{x:.4720408320426941,y:.6066038608551025,z:-.021204356104135513},{x:.45432573556900024,y:.6158540844917297,z:-.011054684408009052},{x:.4305151402950287,y:.5608053803443909,z:.0396830290555954},{x:.5310865640640259,y:.6157484650611877,z:-.03081176057457924},{x:.5114666223526001,y:.6329749226570129,z:-.00335998204536736},{x:.506435751914978,y:.8786543607711792,z:.012980876490473747},{x:.4480472207069397,y:.8640613555908203,z:.12569651007652283},{x:.5372058153152466,y:.7942581176757813
vendor: 5,517 bytes, line 2647
2647,z:-.03168361634016037},{x:.5488379597663879,y:.8001630306243896,z:-.03280917927622795},{x:.5213388204574585,y:.8794381618499756,z:.011892606504261494},{x:.5242055654525757,y:.8789222240447998,z:.008370225317776203},{x:.4477175176143646,y:.6039950251579285,z:-.0050799972377717495},{x:.526964008808136,y:.7916748523712158,z:-.02968614175915718},{x:.4971255660057068,y:.6050706505775452,z:-.028175678104162216},{x:.4938119053840637,y:.5882453918457031,z:-.03210941329598427},{x:.4757143557071686,y:.5094879865646362,z:-.01300730835646391},{x:.43947282433509827,y:.5816648006439209,z:.01415177434682846},{x:.485664039850235,y:.5477864146232605,z:-.023685332387685776},{x:.43635931611061096,y:.6226438283920288,z:.013606148771941662},{x:.42910251021385193,y:.6102726459503174,z:.03926564007997513},{x:.5605402588844299,y:.8680099248886108,z:-.027318159118294716},{x:.5474816560745239,y:.8702861070632935,z:-.019686367362737656},{x:.5373021364212036,y:.8728838562965393,z:-.010484928265213966},{x:.540735125541687,y:.7979167103767395,z:-.029073253273963928},{x:.5228585004806519,y:.87913578748703,z:.009915109723806381},{x:.530497670173645,y:.8815253973007202,z:.0020524784922599792},{x:.5259912610054016,y:.8790552616119385,z:.007895970717072487},{x:.5433906316757202,y:.7882310748100281,z:-.05121905356645584},{x:.541388213634491,y:.8777219653129578,z:-.00466804439201951},{x:.5515822172164917,y:.8767023086547852,z:-.010475946590304375},{x:.5637003779411316,y:.877059817314148,z:-.015273625031113625},{x:.5640299320220947,y:.9263423085212708,z:-.00658724969252944},{x:.5642300248146057,y:.8993074893951416,z:-.017653480172157288},{x:.5637336373329163,y:.8910360932350159,z:-.01852807030081749},{x:.5637134313583374,y:.8837276697158813,z:-.01482592523097992},{x:.564205527305603,y:.8768964409828186,z:-.01331155002117157},{x:.5419867634773254,y:.8778373599052429,z:-.0037720394320786},{x:.5404468774795532,y:.880696177482605,z:-.005610354244709015},{x:.5392338633537292,y:.8845721483230591,z:-.007352025713771582},{x:.538469672203064,y:.8891173601150513,z:-.005154991988092661},{x:.5189250111579895,y:.8452741503715515,z:-.009755070321261883},{x:.4258975088596344,y:.7662280797958374,z:.1387351155281067},{x:.5725725293159485,y:.8041572570800781,z:-.04583907872438431},{x:.5342061519622803,y:.8785833120346069,z:.002659974154084921},{x:.5324031114578247,y:.8804071545600891,z:.0017832003068178892},{x:.5538818836212158,y:.8078407645225525,z:-.03254539892077446},{x:.5325431823730469,y:.8026832938194275,z:-.019140373915433884},{x:.5514076948165894,y:.8043903112411499,z:-.03313535451889038},{x:.5131856203079224,y:.7284771800041199,z:-.009399853646755219},{x:.49331504106521606,y:.7443980574607849,z:-.005225230939686298},{x:.5239617824554443,y:.7807451486587524,z:-.025881027802824974},{x:.4473606050014496,y:.5315827131271362,z:.011164786294102669},{x:.45718759298324585,y:.5604941248893738,z:-.005943301599472761},{x:.4670005738735199,y:.5909327268600464,z:-.019681761041283607},{x:.5311570167541504,y:.9076261520385742,z:.00389476353302598},{x:.5249923467636108,y:.5893563628196716,z:-.037981919944286346},{x:.5166932344436646,y:.5429551005363464,z:-.03319704160094261},{x:.5085030198097229,y:.49676206707954407,z:-.02691275253891945},{x:.4687720239162445,y:.6834565997123718,z:.008113506250083447},{x:.4426414966583252,y:.7069531679153442,z:.028577271848917007},{x:.5230373740196228,y:.6675713658332825,z:.001773772411979735},{x:.4481240212917328,y:.6527872085571289,z:.012414850294589996},{x:.5339856743812561,y:.7012367844581604,z:-.020220188423991203},{x:.5347223281860352,y:.7761190533638,z:-.05141595005989075},{x:.4315067231655121,y:.7211957573890686,z:.04381405934691429},{x:.45203351974487305,y:.7206180095672607,z:.017288070172071457},{x:.46892452239990234,y:.7265436053276062,z:.005602988880127668},{x:.49314674735069275,y:.7202282547950745,z:-.0006408205372281373},{x:.5104925632476807,y:.7091827392578125,z:-.00362918758764863},{x:.5232142210006714,y:.698553740978241,z:-.00787867046892643},{x:.5497883558273315,y:.6743605136871338,z:-.036349106580019},{x:.43658503890037537,y:.7627100348472595,z:.042555369436740875},{x:.4397648870944977,y:.6528646349906921,z:.017956094816327095},{x:.5653332471847534,y:.7992802858352661,z:-.06365057826042175},{x:.5285563468933105,y:.736810564994812,z:-.018836988136172295},{x:.4180678725242615,y:.6792560815811157,z:.12284679710865021},{x:.5328429937362671,y:.6865872144699097,z:-.010484723374247551},{x:.5230283141136169,y:.7809416055679321,z:-.011922398582100868},{x:.4551771283149719,y:.6650775074958801,z:.01774493046104908},{x:.5337203741073608,y:.7618928551673889,z:-.04697106033563614},{x:.43463975191116333,y:.8133478164672852,z:.1354849934577942},{x:.5225707292556763,y:.6605283617973328,z:.004980515688657761},{x:.5441933870315552,y:.7497199773788452,z:-.06091512367129326},{x:.4774007797241211,y:.9159183502197266,z:.059622734785079956},{x:.48068761825561523,y:.9364941716194153,z:.08404944837093353},{x:.4268292486667633,y:.7657528519630432,z:.09051097184419632},{x:.46051913499832153,y:.8880485892295837,z:.0738474428653717},{x:.4243420660495758,y:.6434382200241089,z:.06230505183339119},{x:.5342157483100891,y:.9835634231567383,z:.021662971004843712},{x:.5668109655380249,y:.8042187094688416,z:-.044937074184417725},{x:.5176341533660889,y:.7530587315559387,z:-.012967454269528389},{x:.430206298828125,y:.6835605502128601,z:.04612284153699875},{x:.4794231951236725,y:.6732114553451538,z:.003970044665038586},{x:.49073347449302673,y:.6722435355186462,z:
26478692514384165406e-19},{x:.5294116139411926,y:.884677529335022,z:.004413890186697245},{x:.4430122375488281,y:.80235356092453,z:.04987282305955887},{x:.5603825449943542,y:1.0092442035675049,z:.026417359709739685},{x:.5186598300933838,y:.9828659892082214,z:.0513598807156086},{x:.5010536909103394,y:.9640932679176331,z:.06591596454381943},{x:.5524769425392151,y:.539441704750061,z:-.035816047340631485},{x:.5879997611045837,y:1.0091472864151,z:.02285068854689598},{x:.5016193985939026,y:.6684437990188599,z:28415941051207483e-20},{x:.511952817440033,y:.6642197370529175,z:.0021144719794392586},{x:.5194343328475952,y:.6623469591140747,z:.004674181342124939},{x:.4321230351924896,y:.6496355533599854,z:.03124697133898735},{x:.508686363697052,y:.6479565501213074,z:-.00044765998609364033},{x:.4963986277580261,y:.6431032419204712,z:-.0032507688738405704},{x:.4845542013645172,y:.6430778503417969,z:-.002903624437749386},{x:.4733612537384033,y:.647506833076477,z:23347247042693198e-20},{x:.4668654501438141,y:.653346598148346,z:.004762572236359119},{x:.41815051436424255,y:.633708119392395,z:.09809435904026031},{x:.47159942984580994,y:.6711485385894775,z:.007849935442209244},{x:.5734396576881409,y:.8256140351295471,z:-.03155219927430153},{x:.5306524038314819,y:.8337990641593933,z:-.018351426348090172},{x:.5371729135513306,y:.7910830974578857,z:-.037286680191755295},{x:.5549534559249878,y:.8275275826454163,z:-.030664825811982155},{x:.5597432255744934,y:.6418541669845581,z:-.03318847343325615},{x:.4958484172821045,y:.9429569244384766,z:.048340678215026855},{x:.5140507817268372,y:.9634028077125549,z:.03589847311377525},{x:.5587693452835083,y:.9951097369194031,z:.00908728688955307},{x:.46411189436912537,y:.9051855206489563,z:.10601935535669327},{x:.5181609392166138,y:.6554316878318787,z:.002546071307733655},{x:.5436590909957886,y:.7085841298103333,z:-.03844436630606651},{x:.5872187614440918,y:.9960382580757141,z:.0063423276878893375},{x:.5379653573036194,y:.9989125728607178,z:.03636329993605614},{x:.4350326955318451,y:.8088565468788147,z:.09147704392671585},{x:.5523084998130798,y:.8773422837257385,z:-.009068487212061882},{x:.5510149598121643,y:.8816931843757629,z:-.011043853126466274},{x:.5503793954849243,y:.88776695728302,z:-.01348799467086792},{x:.5501549243927002,y:.8954370617866516,z:-.012142189778387547},{x:.546072781085968,y:.9192524552345276,z:-.003157563041895628},{x:.5314661860466003,y:.8771666884422302,z:5075141089037061e-19},{x:.5293324589729309,y:.8762547969818115,z:39177737198770046e-20},{x:.5275698900222778,y:.8750609755516052,z:47732755774632096e-21},{x:.5104271173477173,y:.8607332110404968,z:.0012934643309563398},{x:.45938700437545776,y:.8134918212890625,z:.023569690063595772},{x:.5418947339057922,y:.6864100694656372,z:-.027333909645676613},{x:.531914234161377,y:.6456130743026733,z:-.005434140563011169},{x:.523697018623352,y:.647885262966156,z:-.0002466466394253075},{x:.5338191390037537,y:.8783687353134155,z:.002268768846988678},{x:.46226605772972107,y:.8610277771949768,z:.04718952998518944},{x:.5434442758560181,y:.6456181406974792,z:-.02327350154519081},{x:.5399754643440247,y:.940219521522522,z:.005075343884527683},{x:.5661457777023315,y:.71457839012146,z:-.06242101639509201},{x:.5523148775100708,y:.6974870562553406,z:-.04863070324063301},{x:.5639959573745728,y:.6923378109931946,z:-.05180761218070984},{x:.5367592573165894,y:.7423217296600342,z:-.03623027727007866},{x:.5853689908981323,y:.9752064943313599,z:-.002361974213272333},{x:.5835235118865967,y:.9493685960769653,z:-.003941743168979883},{x:.5615018606185913,y:.949194610118866,z:-.0015953965485095978},{x:.5068561434745789,y:.9048219323158264,z:.01862684078514576},{x:.5134067535400391,y:.7971825003623962,z:-.008485661819577217},{x:.5223897099494934,y:.925589919090271,z:.01249657291918993},{x:.48500555753707886,y:.7959478497505188,z:-.0032065745908766985},{x:.5037734508514404,y:.8184596300125122,z:-.004932103678584099},{x:.4766361117362976,y:.828806459903717,z:.01027688942849636}
2647,{x:.5589827299118042,y:.974656343460083,z:9666886180639267e-19},{x:.5294582843780518,y:.7541216611862183,z:-.025603046640753746},{x:.4973002076148987,y:.9208990931510925,z:.031931452453136444},{x:.5163551568984985,y:.9432790875434875,z:.024321340024471283},{x:.49399662017822266,y:.8814862370491028,z:.018687399104237556},{x:.44948166608810425,y:.836137592792511,z:.05702034756541252},{x:.47898444533348083,y:.8836610913276672,z:.03150695189833641},{x:.4454479217529297,y:.8499438166618347,z:.08868525922298431},{x:.49572959542274475,y:.8452823758125305,z:.0036111653316766024},{x:.5362502336502075,y:.7222585678100586,z:-.027912352234125137},{x:.5393770337104797,y:.7850722074508667,z:-.05415399745106697},{x:.531399667263031,y:.7898418307304382,z:-.03883346915245056},{x:.5451627373695374,y:.7717036604881287,z:-.06480253487825394},{x:.5206395983695984,y:.6287745833396912,z:-.010521138086915016},{x:.4974782466888428,y:.6191938519477844,z:-.014098240062594414},{x:.4774145185947418,y:.6193130612373352,z:-.013643337413668633},{x:.4616098403930664,y:.6259890198707581,z:-.008448202162981033},{x:.4516478478908539,y:.6368461847305298,z:9050309745362028e-20},{x:.4485096037387848,y:.6719120740890503,z:.022984720766544342},{x:.42177659273147583,y:.7240667343139648,z:.08511673659086227},{x:.4616215229034424,y:.6988231539726257,z:.014238474890589714},{x:.4755798876285553,y:.7034608721733093,z:.00625590980052948},{x:.4924992024898529,y:.7005885243415833,z:9391739731654525e-19},{x:.5082254409790039,y:.693384051322937,z:-.0009464038303121924},{x:.5203112959861755,y:.6849707961082458,z:-.0022114769089967012},{x:.52867591381073,y:.6779075860977173,z:-.002962538506835699},{x:.4213953912258148,y:.7219811677932739,z:.1350894570350647},{x:.5320829749107361,y:.794858992099762,z:-.03181503340601921},{x:.5452795028686523,y:.7286570072174072,z:-.04771539941430092},{x:.5496407747268677,y:.7866933345794678,z:-.06452003121376038},{x:.557040274143219,y:.7962084412574768,z:-.05837344378232956},{x:.549176812171936,y:.7895247936248779,z:-.057761140167713165},{x:.5362890362739563,y:.8005836606025696,z:-.026903774589300156},{x:.560200035572052,y:.7983731031417847,z:-.06172555685043335},{x:.5616944432258606,y:.8022753596305847,z:-.045200999826192856},{x:.5273328423500061,y:.6611284017562866,z:.0029021520167589188},{x:.534850537776947,y:.6660012006759644,z:-.005215510260313749},{x:.5394860506057739,y:.6701375246047974,z:-.014931917190551758},{x:.4634307324886322,y:.658291757106781,z:.009295716881752014},{x:.4538393020629883,y:.6519932150840759,z:.00930330716073513},{x:.5776031613349915,y:.7159298658370972,z:-.057365912944078445},{x:.6504855155944824,y:.6461779475212097,z:.014184834435582161},{x:.5860154032707214,y:.7962266206741333,z:-.04522843658924103},{x:.6842049360275269,y:.5631637573242188,z:.07207967340946198},{x:.6152560710906982,y:.6674962639808655,z:7529259892180562e-19},{x:.6280948519706726,y:.6684326529502869,z:.0016892586136236787},{x:.6408625245094299,y:.6663892269134521,z:.005331226624548435},{x:.6557814478874207,y:.6534678936004639,z:.01646413467824459},{x:.6035663485527039,y:.6639701724052429,z:.0013799630105495453},{x:.6329053044319153,y:.608010470867157,z:-.006195899099111557},{x:.6167260408401489,y:.6117533445358276,z:-.006319951266050339},{x:.6471013426780701,y:.6112449765205383,z:-.0017843559617176652},{x:.6560901999473572,y:.6185776591300964,z:.004047257360070944},{x:.6666946411132813
vendor: 9,807 bytes, line 2647
2647,y:.6651176810264587,z:.023647578433156013},{x:.6311345100402832,y:.9495396018028259,z:.014004078693687916},{x:.6544655561447144,y:.6397901773452759,z:.01809609681367874},{x:.6965808868408203,y:.6482675075531006,z:.08304904401302338},{x:.679817259311676,y:.650188148021698,z:.03632688894867897},{x:.6336516737937927,y:.7541458010673523,z:-.007742783520370722},{x:.5921701192855835,y:.8567668199539185,z:-.029399123042821884},{x:.591663658618927,y:.870215654373169,z:-.02103729173541069},{x:.6068367958068848,y:.8584195375442505,z:-.020668085664510727},{x:.6176617741584778,y:.860965371131897,z:-.009790095500648022},{x:.6040634512901306,y:.8686612844467163,z:-.015289564616978168},{x:.6143736839294434,y:.8671170473098755,z:-.005712216719985008},{x:.6373105049133301,y:.8815656900405884,z:.012672550976276398},{x:.5832505822181702,y:.7866312861442566,z:-.07051534950733185},{x:.5836675763130188,y:.7658692598342896,z:-.07566110789775848},{x:.6709531545639038,y:.604898989200592,z:.005951565690338612},{x:.6029891967773438,y:.705652117729187,z:-.013388276100158691},{x:.6131622195243835,y:.7728396058082581,z:-.036248479038476944},{x:.6123163104057312,y:.7612020373344421,z:-.03264721855521202},{x:.6696187853813171,y:.744706928730011,z:.009673702530562878},{x:.5803102254867554,y:.7385968565940857,z:-.0689152330160141},{x:.6404349207878113,y:.5877999663352966,z:-.01929756999015808},{x:.6588467955589294,y:.5929454565048218,z:-.008487257175147533},{x:.6720337867736816,y:.530631422996521,z:.043437421321868896},{x:.584305465221405,y:.6099005341529846,z:-.030301367864012718},{x:.6034283638000488,y:.6217452883720398,z:-.001970183802768588},{x:.6460927724838257,y:.8608663082122803,z:.015541625209152699},{x:.6957815289497375,y:.8326103091239929,z:.13015234470367432},{x:.6043362617492676,y:.7861682772636414,z:-.030476901680231094},{x:.594293475151062,y:.7942103147506714,z:-.032218821346759796},{x:.6324057579040527,y:.8665139675140381,z:.014255806803703308},{x:.6296147704124451,y:.8667733669281006,z:.010388285852968693},{x:.663644552230835,y:.5798642635345459,z:-.0022301070857793093},{x:.6140630841255188,y:.7809288501739502,z:-.02835679054260254},{x:.615908145904541,y:.5921698212623596,z:-.026804860681295395},{x:.617181122303009,y:.5748661756515503,z:-.03060605563223362},{x:.6222207546234131,y:.49137672781944275,z:-.011151673272252083},{x:.6669357419013977,y:.5541607141494751,z:.017466170713305473},{x:.6182981729507446,y:.5320425629615784,z:-.021793590858578682},{x:.6760554313659668,y:.595052182674408,z:.017115700989961624},{x:.6801463961601257,y:.5800720453262329,z:.043127160519361496},{x:.5922210812568665,y:.8644017577171326,z:-.02662893570959568},{x:.6054555177688599,y:.8637874722480774,z:-.018363753333687782},{x:.6161889433860779,y:.8641164898872375,z:-.008808949030935764},{x:.6017249822616577,y:.7901403307914734,z:-.028126630932092667},{x:.631446123123169,y:.8664817810058594,z:.012112865224480629},{x:.6249198913574219,y:.8716511130332947,z:.003882825840264559},{x:.6281915903091431,y:.867301881313324,z:.009891441091895103},{x:.5986843109130859,y:.7813931703567505,z:-.050227612257003784},{x:.6126407384872437,y:.869275689125061,z:-.0031255714129656553},{x:.6027271151542664,y:.8711842894554138,z:-.009324162267148495},{x:.59088134765625,y:.8742044568061829,z:-.014608660712838173},{x:.5984604358673096,y:.9216185212135315,z:-.005981989670544863},{x:.5950398445129395,y:.8964707255363464,z:-.01703473925590515},{x:.5941568613052368,y:.8882410526275635,z:-.017784785479307175},{x:.5928806662559509,y:.8803883194923401,z:-.014153128489851952},{x:.5909661054611206,y:.8748103976249695,z:-.012609979137778282},{x:.6128016710281372,y:.8702545762062073,z:-.0022550546564161777},{x:.6150846481323242,y:.8726804256439209,z:-.00414019962772727},{x:.6173093914985657,y:.8770190477371216,z:-.005970994010567665},{x:.619335412979126,y:.8814800977706909,z:-.0036864024586975574},{x:.6292637586593628,y:.8314558267593384,z:-.007714875973761082},{x:.702275276184082,y:.7320667505264282,z:.1433621346950531},{x:.6204835176467896,y:.8689177632331848,z:.0044869170524179935},{x:.6223508715629578,y:.8704851269721985,z:.00352082890458405},{x:.590448260307312,y:.8029727935791016,z:-.03200828656554222},{x:.6097423434257507,y:.7933741211891174,z:-.018042555078864098},{x:.59229576587677,y:.7993767261505127,z:-.032564569264650345},{x:.6171364188194275,y:.7153720259666443,z:-.007672437466681004},{x:.6389747858047485,y:.726390540599823,z:-.002999067772179842},{x:.6151940226554871,y:.769412100315094,z:-.024427521973848343},{x:.6526776552200317,y:.505868136882782,z:.01412637997418642},{x:.6475822329521179,y:.5375454425811768,z:-.0033899128902703524},{x:.6433356404304504,y:.5714520215988159,z:-.017428796738386154},{x:.626949667930603,y:.8962116837501526,z:.005602736957371235},{x:.5868416428565979,y:.5829002261161804,z:-.03727729618549347},{x:.5877229571342468,y:.5345035791397095,z:-.032396964728832245},{x:.5887066125869751,y:.48655083775520325,z:-.025856535881757736},{x:.6507197618484497,y:.6612282991409302,z:.011114613153040409},{x:.6803066730499268,y:.677992045879364,z:.032125361263751984},{x:.5963194370269775,y:.6598632335662842,z:.002976928371936083},{x:.667536199092865,y:.6274255514144897,z:.015618261881172657},{x:.5930740833282471,y:.6940041780471802,z:-.019217798486351967},{x:.6053346395492554,y:.7676517963409424,z:-.050308309495449066},{x:.6934473514556885,y:.6884298920631409,z:.04794462397694588},{x:.6738007664680481,y:.6934011578559875,z:.020697161555290222},{x:.6588084697723389,y:.7033141851425171,z:.008462334051728249},{x:.6346072554588318,y:.7029502391815186,z:.001542167621664703},{x:.6157816648483276,y:.6966525912284851,z:-.002009218093007803},{x:.6015574336051941,y:.688928484916687,z:-.006588225718587637},{x:.5746836066246033,y:.6711069345474243,z:-.03597589209675789},{x:.6947521567344666,y:.7309479117393494,z:.046707939356565475},{x:.6759101152420044,y:.6249120831489563,z:.021654341369867325},{x:.5794773101806641,y:.7971615195274353,z:-.06339326500892639},{x:.6041849851608276,y:.727514922618866,z:-.017512541264295578},{x:.6968844532966614,y:.6440950036048889,z:.12727996706962585},{x:.5910853147506714,y:.679325520992279,z:-.009497715160250664},{x:.6157375574111938,y:.7695677280426025,z:-.010624290443956852},{x:.6606494784355164,y:.6410489678382874,z:.0208158977329731},{x:.6040687561035156,y:.7531470656394958,z:-.045887019485235214},{x:.7012156248092651,y:.780247151851654,z:.14028730988502502},{x:.595149576663971,y:.6527782678604126,z:.006308757700026035},{x:.5925500392913818,y:.7436665892601013,z:-.060151755809783936},{x:.6780198812484741,y:.8905693888664246,z:.0626060739159584},{x:.676746666431427,y:.9113880395889282,z:.08726003766059875},{x:.7030686140060425,y:.7312687635421753,z:.09529774636030197},{x:.688987135887146,y:.8588417172431946,z:.07752864807844162},{x:.6883691549301147,y:.6109960675239563,z:.06669612973928452},{x:.6358906030654907,y:.9702065587043762,z:.023120900616049767},{x:.5781539678573608,y:.8023634552955627,z:-.044763918966054916},{x:.6170316934585571,y:.7408350706100464,z:-.011375460773706436},{x:.688542366027832,y:.6516284346580505,z:.050206027925014496},{x:.6385149359703064,y:.6540714502334595,z:.006462941411882639},{x:.6279382109642029,y:.6563615798950195,z:.003062846139073372},{x:.6268895268440247,y:.8736732006072998,z:.00627936702221632},{x:.6944946050643921,y:.7709181308746338,z:.053824134171009064},{x:.614617109298706,y:1.0022112131118774,z:.02719894051551819},{x:.6493719220161438,y:.9665167927742004,z:.053563784807920456},{x:.6624587178230286,y:.943530797958374,z:.068605437874794},{x:.6162528991699219,y:.6558693051338196,z:.002187855076044798},{x:.6058168411254883,y:.654328465461731,z:.0036193584091961384},{x:.5987918972969055,y:.6536934971809387,z:.006134530063718557},{x:.6831037402153015,y:.6195642948150635,z:.03511790186166763},{x:.6062582731246948,y:.6356398463249207,z:.001280312892049551},{x:.6174948811531067,y:.62776118516922,z:-.0013642468256875873},{x:.6297246217727661,y:.6253792643547058,z:-.0007034156005829573},{x:.6407091617584229,y:.627578616142273,z:.0028144705574959517},{x:.6479622721672058,y:.6322650909423828,z:.00750273372977972},{x:.6915091276168823,y:.5990704298019409,z:.10270945727825165},{x:.6457163095474243,y:.6504453420639038,z:.010696077719330788},{x:.6164222955703735,y:.8231936097145081,z:-.016772059723734856},{x:.6042401194572449,y:.7830976843833923,z:-.03630910441279411},{x:.5922216773033142,y:.8228387236595154,z:-.029992375522851944},{x:.6646111011505127,y:.92097008228302,z:.050967294722795486},{x:.651232898235321,y:.9460107088088989,z:.038000158965587616},{x:.6140977144241333,y:.9882472157478333,z:.009882091544568539},{x:.6870781183242798,y:.8768675327301025,z:.10980932414531708},{x:.5986856818199158,y:.6456438899040222,z:.003999010659754276},{x:.585981547832489,y:.7034481763839722,z:-.0377722829580307},{x:.6342031359672546,y:.9867448806762695,z:.03786521404981613},{x:.7013950943946838,y:.776049017906189,z:.09598205983638763},{x:.6030206680297852,y:.8719133138656616,z:-.007931148633360863},{x:.6050592064857483,y:.8767156004905701,z:-.009791925549507141},{x:.6073468923568726,y:.8831382393836975,z:-.012361008673906326},{x:.6087977290153503,y:.890143632888794,z:-.01098148338496685},{x:.6147705316543579,y:.9110084772109985,z:-.0018823575228452682},{x:.622577965259552,y:.8670604825019836,z:.002609190298244357},{x:.6241236329078674,y:.8651344180107117,z:.0025534380692988634},{x:.6257084608078003,y:.8638408184051514,z:.0023300074972212315},{x:.639931321144104,y:.8449671268463135,z:.0038123116828501225},{x:.6810906529426575,y:.7856625318527222,z:.02717764675617218},{x:.583532452583313,y:.6811994910240173,z:-.026588857173919678},{x:.5855660438537598,y:.6393819451332092,z:-.004512844607234001},{x:.5932201743125916,y:.6398029327392578,z:
26478020466193556786e-19},{x:.6200879812240601,y:.8683351874351501,z:.00417016725987196},{x:.6842559576034546,y:.8330534100532532,z:.050836317241191864},{x:.5754412412643433,y:.6418221592903137,z:-.022838059812784195},{x:.6232790350914001,y:.9295297265052795,z:.006339520215988159},{x:.5764067769050598,y:.694546639919281,z:-.04825803264975548},{x:.59778892993927,y:.7343927621841431,z:-.035004377365112305},{x:.6042810678482056,y:.9441440105438232,z:-.0010970570147037506},{x:.6496372222900391,y:.8869078159332275,z:.021036235615611076},{x:.6274012327194214,y:.7830310463905334,z:-.006658440921455622},{x:.637792706489563,y:.9104999899864197,z:.014290250837802887},{x:.6549934148788452,y:.7748609185218811,z:-.0006672973395325243},{x:.6404005289077759,y:.801220715045929,z:-.0026642554439604282},{x:.6671456694602966,y:.8045546412467957,z:.013180811889469624},{x:.6107483506202698,y:.9680658578872681,z:.001778992242179811},{x:.6060343980789185,y:.744587242603302,z:-.024382334202528},{x:.6602751612663269,y:.8998945355415344,z:.0344940721988678},{x:.6463775038719177,y:.9262562394142151,z:.02617623284459114},{x:.6579852104187012,y:.8602304458618164,z:.021586716175079346},{x:.6926165223121643,y:.8053340315818787,z:.061075080186128616},{x:.6724731922149658,y:.8594399690628052,z:.03457934781908989},{x:.6975721716880798,y:.8183245062828064,z:.09300774335861206},{x:.6512877941131592,y:.8258221745491028,z:.006324059329926968},{x:.594887375831604,y:.7148372530937195,z:-.026898479089140892},{x:.6017440557479858,y:.7773507833480835,z:-.05312420800328255},{x:.6096571683883667,y:.7806998491287231,z:-.037646256387233734},{x:.5952993035316467,y:.7654367685317993,z:-.06398405134677887},{x:.5950021147727966,y:.6201304793357849,z:-.009297547861933708}
2647,{x:.6165438890457153,y:.6052900552749634,z:-.012455573305487633},{x:.6362661719322205,y:.6015968918800354,z:-.011649220250546932},{x:.6522727608680725,y:.6046400666236877,z:-.005903332494199276},{x:.6625409722328186,y:.6128141283988953,z:.0030042496509850025},{x:.6688099503517151,y:.6457712054252625,z:.026322703808546066},{x:.7013440728187561,y:.6893666386604309,z:.08984331786632538},{x:.6608623266220093,y:.6749406456947327,z:.0172116681933403},{x:.6482325196266174,y:.6823726296424866,z:.008881398476660252},{x:.6313265562057495,y:.6842025518417358,z:.0031308617908507586},{x:.6147016286849976,y:.6809731721878052,z:7630771724507213e-19},{x:.6018834114074707,y:.6755372285842896,z:-.0008834321051836014},{x:.5925027132034302,y:.670681357383728,z:-.001968748401850462},{x:.700127363204956,y:.6871103644371033,z:.13980500400066376},{x:.6095665693283081,y:.7853189706802368,z:-.03074747882783413},{x:.5880423784255981,y:.7229287028312683,z:-.04691500961780548},{x:.5930182337760925,y:.7811514139175415,z:-.06398335844278336},{x:.5867722034454346,y:.7922660112380981,z:-.05794971063733101},{x:.5933279991149902,y:.7842848896980286,z:-.05714067071676254},{x:.6063535809516907,y:.7920218706130981,z:-.02590685710310936},{x:.5839452743530273,y:.794978141784668,z:-.0615212507545948},{x:.5828126072883606,y:.8000800013542175,z:-.0449722595512867},{x:.5909603834152222,y:.6541213393211365,z:.003991890233010054},{x:.5852181911468506,y:.6602938771247864,z:-.004428438376635313},{x:.5825737714767456,y:.6651063561439514,z:-.014345290139317513},{x:.6517343521118164,y:.6362385153770447,z:.012151890434324741},{x:.6615052819252014,y:.6281577944755554,z:.0123682152479887},{x:.4856873154640198,y:.6568945646286011,z:720038078725338e-18},{x:.49988406896591187,y:.6547410488128662,z:6949726957827806e-19},{x:.48438939452171326,y:.6392973065376282,z:705525919329375e-18},{x:.47143134474754333,y:.6589511632919312,z:6980331381782889e-19},{x:.48704618215560913,y:.6752797961235046,z:6921177846379578e-19},{x:.6243702173233032,y:.640461802482605,z:-.00006592126737814397},{x:.6390967965126038,y:.6385173797607422,z:-.00016105435497593135},{x:.6230536699295044,y:.6224825382232666,z:-.00016136496560648084},{x:.6095397472381592,y:.641917884349823,z:-.0001803556369850412},{x:.6250996589660645,y:.6586247682571411,z:-.0001785515050869435}]],faceBlendshapes:[{categories:[{index:0,score:5187174338061595e-21,categoryName:"_neutral",displayName:""},{index:1,score:.24521504342556,categoryName:"browDownLeft",displayName:""},{index:2,score:.1987743377685547,categoryName:"browDownRight",displayName:""},{index:3,score:.013400448486208916,categoryName:"browInnerUp",displayName:""},{index:4,score:.012361560948193073,categoryName:"browOuterUpLeft",displayName:""},{index:5,score:.019305096939206123,categoryName:"browOuterUpRight",displayName:""},{index:6,score:28426356948330067e-21,categoryName:"cheekPuff",displayName:""},{index:7,score:34500112633395474e-23,categoryName:"cheekSquintLeft",displayName:""},{index:8,score:483789051486383e-21,categoryName:"cheekSquintRight",displayName:""},{index:9,score:.07650448381900787,categoryName:"eyeBlinkLeft",displayName:""},{index:10,score:.05070012807846069,categoryName:"eyeBlinkRight",displayName:""},{index:11,score:.13978900015354156,categoryName:"eyeLookDownLeft",displayName:""},{index:12,score:.14198613166809082,categoryName:"eyeLookDownRight",displayName:""},{index:13,score:.2177766114473343,categoryName:"eyeLookInLeft",displayName:""},{index:14,score:.014739357866346836,categoryName:"eyeLookInRight",displayName:""},{index:15,score:.02361512929201126,categoryName:"eyeLookOutLeft",displayName:""},{index:16,score:.19679604470729828,categoryName:"eyeLookOutRight",displayName:""},{index:17,score:.04874616861343384,categoryName:"eyeLookUpLeft",displayName:""},{index:18,score:.049392376095056534,categoryName:"eyeLookUpRight",displayName:""},{index:19,score:.34944331645965576,categoryName:"eyeSquintLeft",displayName:""},{index:20,score:.2939716875553131,categoryName:"eyeSquintRight",displayName:""},{index:21,score:.005955042317509651,categoryName:"eyeWideLeft",displayName:""},{index:22,score:.006776117719709873,categoryName:"eyeWideRight",displayName:""},{index:23,score:16942436559475027e-21,categoryName:"jawForward",displayName:""},{index:24,score:.0045165494084358215,categoryName:"jawLeft",displayName:""},{index:25,score:.07803940027952194,categoryName:"jawOpen",displayName:""},{index:26,score:2090057751047425e-20,categoryName:"jawRight",displayName:""},{index:27,score:.06032035872340202,categoryName:"mouthClose",displayName:""},{index:28,score:.00228882092051208,categoryName:"mouthDimpleLeft",displayName:""},{index:29,score:.00781762320548296,categoryName:"mouthDimpleRight",displayName:""},{index:30,score:.0017093931091949344,categoryName:"mouthFrownLeft",displayName:""},{index:31,score:.0019319106359034777,categoryName:"mouthFrownRight",displayName:""},{index:32,score:8485237776767462e-20,categoryName:"mouthFunnel",displayName:""},{index:33,score:9051355300471187e-19,categoryName:"mouthLeft",displayName:""},{index:34,score:3630454302765429e-19,categoryName:"mouthLowerDownLeft",displayName:""},{index:35,score:17601238505449146e-20,categoryName:"mouthLowerDownRight",displayName:""},{index:36,score:.12865161895751953,categoryName:"mouthPressLeft",displayName:""},{index:37,score:.20137207210063934,categoryName:"mouthPressRight",displayName:""},{index:38,score:.0022203284315764904,categoryName:"mouthPucker",dis
2647playName:""},{index:39,score:9096377179957926e-19,categoryName:"mouthRight",displayName:""},{index:40,score:.34189721941947937,categoryName:"mouthRollLower",displayName:""},{index:41,score:.11409689486026764,categoryName:"mouthRollUpper",displayName:""},{index:42,score:.17172536253929138,categoryName:"mouthShrugLower",displayName:""},{index:43,score:.004038424696773291,categoryName:"mouthShrugUpper",displayName:""},{index:44,score:23205230536404997e-20,categoryName:"mouthSmileLeft",displayName:""},{index:45,score:19313619122840464e-20,categoryName:"mouthSmileRight",displayName:""},{index:46,score:.0018571305554360151,categoryName:"mouthStretchLeft",displayName:""},{index:47,score:.0023813238367438316,categoryName:"mouthStretchRight",displayName:""},{index:48,score:24323100660694763e-21,categoryName:"mouthUpperUpLeft",displayName:""},{index:49,score:3161552012898028e-20,categoryName:"mouthUpperUpRight",displayName:""},{index:50,score:108198406678639e-21,categoryName:"noseSneerLeft",displayName:""},{index:51,score:12652527630052646e-22,categoryName:"noseSneerRight",displayName:""}],headIndex:-1,headName:""}],facialTransformationMatrixes:[{rows:4,columns:4,data:[.9947517514228821,.10230544209480286,.0013679931871592999,0,-.10230997204780579,.9947447776794434,.003816320328041911,0,-.000970348424743861,-.0039362297393381596,.9999914169311523,0,2.8888821601867676,-7.808934211730957,-30.52109146118164,1]}]}},Ev=(0,eD.createContext)({}),EE={basePath:"https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/wasm",options:{baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/1/face_landmarker.task",delegate:"GPU"},runningMode:"VIDEO",outputFaceBlendshapes:!0,outputFacialTransformationMatrixes:!0}},Ex=(0,eD.forwardRef)(({basePath:e=EE.basePath,options:t=EE.options,children:i},n)=>{let a=JSON.stringify(t),o=(0,oN.Rq)(async()=>{let{FilesetResolver:i,FaceLandmarker:n}=await r.e(3386).then(r.bind(r,83386)),a=await i.forVisionTasks(e);return n.createFromOptions(a,t)},[e,a]);return(0,eD.useEffect)(()=>()=>{null==o||o.close(),(0,oN.ZH)([e,a])},[o,e,a]),(0,eD.useImperativeHandle)(n,()=>o,[o]),eD.createElement(Ev.Provider,{value:o},i)});function EC(){return(0,eD.useContext)(Ev)}function Ew(e,t){return e.clone().add(t).multiplyScalar(.5)}function EB(e,t,r){let i=e.localToWorld(t);return r.worldToLocal(i)}let EI=(0,eD.createContext)({}),E_=(0,eD.forwardRef)(({camera:e,videoTexture:t={start:!0},manualDetect:r=!1,faceLandmarkerResult:i,manualUpdate:n=!1,makeDefault:a,smoothTime:o=.25,offset:s=!0,offsetScalar:l=80,eyes:c=!1,eyesAsOrigin:u=!0,depth:h=.15,debug:A=!1,facemesh:d},m)=>{var f,p;let g=(0,eR.D)(e=>e.scene),y=(0,eR.D)(e=>e.camera),v=(0,eR.D)(e=>e.set),E=(0,eR.D)(e=>e.get),x=e||y,C=(0,eD.useRef)(null),[w]=(0,eD.useState)(()=>new eT.Tme),[B]=(0,eD.useState)(()=>new eT.Pa4),[I]=(0,eD.useState)(()=>new eT.Pa4),[_]=(0,eD.useState)(()=>new eT.Pa4),[b]=(0,eD.useState)(()=>new eT.Pa4),M=(0,eD.useCallback)(()=>{w.parent=x.parent;let e=C.current;if(e){let{outerRef:t,eyeRightRef:r,eyeLeftRef:i}=e;if(r.current&&i.current){let{irisDirRef:e}=r.current,{irisDirRef:n}=i.current;e.current&&n.current&&t.current&&(B.copy(EB(e.current,new eT.Pa4(0,0,0),t.current)),I.copy(EB(n.current,new eT.Pa4(0,0,0),t.current)),w.position.copy(EB(t.current,Ew(B,I),x.parent||g)),_.copy(EB(e.current,new eT.Pa4(0,0,1),t.current)),b.copy(EB(n.current,new eT.Pa4(0,0,1),t.current)),w.lookAt(t.current.localToWorld(Ew(_,b))))}else t.current&&(w.position.copy(EB(t.current,new eT.Pa4(0,0,0),x.parent||g)),w.lookAt(t.current.localToWorld(new eT.Pa4(0,0,1))))}return w},[x,I,b,B,_,g,w]),[S]=(0,eD.useState)(()=>new eT.Tme),D=(0,eD.useCallback)(function(e,t){if(x){var r;null!==(r=t)&&void 0!==r||(t=M()),o>0?(rW.damp3(S.position,t.position,o,e,void 0,void 0,1e-9),rW.dampE(S.rotation,t.rotation,o,e,void 0,void 0,1e-9)):(S.position.copy(t.position),S.rotation.copy(t.rotation)),x.position.copy(S.position),x.rotation.copy(S.rotation)}},[x,M,o,S.position,S.rotation]);(0,eR.F)((e,t)=>{n||D(t)});let P=(0,eD.useRef)(null),[T,R]=(0,eD.useState)(),F=EC(),Q=(0,eD.useCallback)((e,t)=>{let r=P.current;if(!r)return;let i=r.source.data;R(null==F?void 0:F.detectForVideo(i,e))},[F]),z=(0,eD.useMemo)(()=>Object.assign(Object.create(eT.pBf.prototype),{computeTarget:M,update:D,facemeshApiRef:C}),[M,D]);(0,eD.useImperativeHandle)(m,()=>z,[z]),(0,eD.useEffect)(()=>
2647{if(a){let e=E().controls;return v({controls:z}),()=>v({controls:e})}},[a,z,E,v]);let k=null!=i?i:T,L=null==k?void 0:k.faceLandmarks[0],O=null==k||null==(f=k.facialTransformationMatrixes)?void 0:f[0],U=null==k||null==(p=k.faceBlendshapes)?void 0:p[0],G={onVideoFrame:Q,...t};return eD.createElement(EI.Provider,{value:z},!r&&eD.createElement(eD.Suspense,{fallback:null},"src"in G?eD.createElement(Aq,(0,eS.Z)({ref:P},G)):eD.createElement(EA,(0,eS.Z)({ref:P},G))),eD.createElement(Ef,(0,eS.Z)({ref:C,children:eD.createElement("meshNormalMaterial",{side:eT.ehD})},d,{points:L,depth:h,facialTransformationMatrix:O,faceBlendshapes:U,eyes:c,eyesAsOrigin:u,offset:s,offsetScalar:l,debug:A,"rotation-z":Math.PI,visible:A})))}),Eb=()=>(0,eD.useContext)(EI)},57243:function(e){var t;t=function(){var e=function(){function t(e){return n.appendChild(e.dom),e}function r(e){for(var t=0;t<n.children.length;t++)n.children[t].style.display=t===e?"block":"none";i=e}var i=0,n=document.createElement("div");n.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",n.addEventListener("click",function(e){e.preventDefault(),r(++i%n.children.length)},!1);var a=(performance||Date).now(),o=a,s=0,l=t(new e.Panel("FPS","#0ff","#002")),c=t(new e.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var u=t(new e.Panel("MB","#f08","#201"));return r(0),{REVISION:16,dom:n,addPanel:t,showPanel:r,begin:function(){a=(performance||Date).now()},end:function(){s++;var e=(performance||Date).now();if(c.update(e-a,200),e>
2647o+1e3&&(l.update(1e3*s/(e-o),100),o=e,s=0,u)){var t=performance.memory;u.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){a=this.end()},domElement:n,setMode:r}};return e.Panel=function(e,t,r){var i=1/0,n=0,a=Math.round,o=a(window.devicePixelRatio||1),s=80*o,l=48*o,c=3*o,u=2*o,h=3*o,A=15*o,d=74*o,m=30*o,f=document.createElement("canvas");f.width=s,f.height=l,f.style.cssText="width:80px;height:48px";var p=f.getContext("2d");return p.font="bold "+9*o+"px Helvetica,Arial,sans-serif",p.textBaseline="top",p.fillStyle=r,p.fillRect(0,0,s,l),p.fillStyle=t,p.fillText(e,c,u),p.fillRect(h,A,d,m),p.fillStyle=r,p.globalAlpha=.9,p.fillRect(h,A,d,m),{dom:f,update:function(l,g){i=Math.min(i,l),n=Math.max(n,l),p.fillStyle=r,p.globalAlpha=1,p.fillRect(0,0,s,A),p.fillStyle=t,p.fillText(a(l)+" "+e+" ("+a(i)+"-"+a(n)+")",c,u),p.drawImage(f,h+o,A,d-o,m,h,A,d-o,m),p.fillRect(h+d-o,A,o,m),p.fillStyle=r,p.globalAlpha=.9,p.fillRect(h+d-o,A,o,a((1-l/g)*m))}}},e},e.exports=t()},68377:function(e,t,r){"use strict";r.d(t,{B$:function(){return function e(t,r){let i=function(e){let t=JSON.stringify(e,m),r=p.get(t);return null==r&&p.set(t,r=++f),r}(r),a=u.get(t);if(a||u.set(t,a=Object.create(null)),a[i])return new a[i];let g=`_onBeforeCompile${i}`,y=function(e,n){t.onBeforeCompile.call(this,e,n);let a=this.customProgramCacheKey()+"|"+e.vertexShader+"|"+e.fragmentShader,s=h[a];if(!s){let t=function(e,{vertexShader:t,fragmentShader:r},i,n){let{vertexDefs:a,vertexMainIntro:s,vertexMainOutro:l,vertexTransform:c,fragmentDefs:u,fragmentMainIntro:h,fragmentMainOutro:A,fragmentColorTransform:m,customRewriter:f,timeUniform:p}=i;if(a=a||"",s=s||"",l=l||"",u=u||"",h=h||"",A=A||"",(c||f)&&(t=o(t)),(m||f)&&(r=o(r=r.replace(/^[ \t]*#include <((?:tonemapping|encodings|colorspace|fog|premultiplied_alpha|dithering)_fragment)>/gm,"\n//!BEGIN_POST_CHUNK $1\n$&\n//!END_POST_CHUNK\n"))),f){let e=f({vertexShader:t,fragmentShader:r});t=e.vertexShader,r=e.fragmentShader}if(m){let e=[];r=r.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,t=>(e.push(t),"")),A=`${m}
2648${e.join("\n")}
2649${A}`}if(p){let e=`
2650uniform float ${p};
2651`;a=e+a,u=e+u}return c&&(t=`vec3 troika_position_${n};
2652vec3 troika_normal_${n};
2653vec2 troika_uv_${n};
2654${t}
2655`,a=`${a}
2656void troikaVertexTransform${n}(inout vec3 position, inout vec3 normal, inout vec2 uv) {
2657  ${c}
2658}
2659`,s=`
2660troika_position_${n} = vec3(position);
2661troika_normal_${n} = vec3(normal);
2662troika_uv_${n} = vec2(uv);
2663troikaVertexTransform${n}(troika_position_${n}, troika_normal_${n}, troika_uv_${n});
2664${s}
2665`,t=t.replace(/\b(position|normal|uv)\b/g,(e,t,r,i)=>
2665/\battribute\s+vec[23]\s+$/.test(i.substr(0,r))?t:`troika_${t}_${n}`),e.map&&e.map.channel>0||(t=t.replace(/\bMAP_UV\b/g,`troika_uv_${n}`))),{vertexShader:t=d(t,n,a,s,l),fragmentShader:r=d(r,n,u,h,A)}}(this,e,r,i);s=h[a]=t}e.vertexShader=s.vertexShader,e.fragmentShader=s.fragmentShader,l(e.uniforms,this.uniforms),r.timeUniform&&(e.uniforms[r.timeUniform]={get value(){return Date.now()-c}}),this[g]&&this[g](e)},v=function(){return E(r.chained?t:t.clone())},E=function(e){let n=Object.create(e,x);return Object.defineProperty(n,"baseMaterial",{value:t}),Object.defineProperty(n,"id",{value:A++}),n.uuid=function(){let e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,r=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(s[255&e]+s[e>>8&255]+s[e>>16&255]+s[e>>24&255]+"-"+s[255&t]+s[t>>8&255]+"-"+s[t>>16&15|64]+s[t>>24&255]+"-"+s[63&r|128]+s[r>>8&255]+"-"+s[r>>16&255]+s[r>>24&255]+s[255&i]+s[i>>8&255]+s[i>>16&255]+s[i>>24&255]).toUpperCase()}(),n.uniforms=l({},e.uniforms,r.uniforms),n.defines=l({},e.defines,r.defines),n.defines[`TROIKA_DERIVED_MATERIAL_${i}`]="",n.extensions=l({},e.extensions,r.extensions),n._listeners=void 0,n},x={constructor:{value:v},isDerivedMaterial:{value:!0},type:{get:()=>t.type,set:e=>{t.type=e}},isDerivedFrom:{writable:!0,configurable:!0,value:function(e){let t=this.baseMaterial;return e===t||t.isDerivedMaterial&&t.isDerivedFrom(e)||!1}},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return t.customProgramCacheKey()+"|"+i}},onBeforeCompile:{get:()=>y,set(e){this[g]=e}},copy:{writable:!0,configurable:!0,value:function(e){return t.copy.call(this,e),t.isShaderMaterial||t.isDerivedMaterial||(l(this.extensions,e.extensions),l(this.defines,e.defines),l(this.uniforms,n.rDY.clone(e.uniforms))),this}},clone:{writable:!0,configurable:!0,value:function(){return E(new t.constructor).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){let i=this._depthMaterial;return i||((i=this._depthMaterial=e(t.isDerivedMaterial?t.getDepthMaterial():new n.lRF({depthPacking:n.mSO}),r)).defines.IS_DEPTH_MATERIAL="",i.uniforms=this.uniforms),i}},getDistanceMaterial:{writable:!0,configurable:!0,value:function(){let i=this._distanceMaterial;return i||((i=this._distanceMaterial=e(t.isDerivedMaterial?t.getDistanceMaterial():new n.Lun,r)).defines.IS_DISTANCE_MATERIAL="",i.uniforms=this.uniforms),i}},dispose:{writable:!0,configurable:!0,value(){let{_depthMaterial:e,_distanceMaterial:r}=this;e&&e.dispose(),r&&r.dispose(),t.dispose.call(this)}}};return a[i]=v,new v}},MW:function(){return a}});var i=r(51448),n=r(72079);let a=/\bvoid\s+main\s*\(\s*\)\s*{/g;function o(e){return e.replace(/^[ \t]*#include +<([\w\d./]+)>/gm,function(e,t){let r=i.ShaderChunk[t];return r?o(r):e})}let s=[];for(let e=0;e<256;e++)s[e]=(e<16?"0":"")+e.toString(16);let l=Object.assign||function(){let e=arguments[0];for(let t=1,r=arguments.length;t<r;t++){let r=arguments[t];if(r)for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},c=Date.now(),u=new WeakMap,h=new Map,A=1e10;function d(e,t,r,i,n){return(i||n||r)&&(e=e.replace(a,`
2666${r}
2667void troikaOrigMain${t}() {`)+`
2668void main() {
2669  ${i}
2670  troikaOrigMain${t}();
2671  ${n}
2672}`),e}function m(e,t){return"uniforms"===e?void 0:"function"==typeof t?t.toString():t}let f=0,p=new Map;n.ehD},75461:function(e,t,r){"use strict";function i(){var e=Object.create(null);function t(e,t){var r=void 0;self.troikaDefine=function(e){return r=e};var i=URL.createObjectURL(new Blob(["/** "+e.replace(/\*/g,"")+" **/\n\ntroikaDefine(\n"+t+"\n)"],{type:"application/javascript"}));try{importScripts(i)}catch(e){console.error(e)}return URL.revokeObjectURL(i),delete self.troikaDefine,r}self.addEventListener("message",function(r){var i=r.data,n=i.messageId,a=i.action,o=i.data;try{"registerModule"===a&&function r(i,n){var a=i.id,o=i.name,s=i.dependencies;void 0===s&&(s=[]);var l=i.init;void 0===l&&(l=function(){});var c=i.getTransferables;if(void 0===c&&(c=null),!e[a])try{s=s.map(function(t){return t&&t.isWorkerModule&&(r(t,function(e){if(e instanceof Error)throw e}),t=e[t.id].value),t}),l=t("<"+o+">.init",l),c&&(c=t("<"+o+">.getTransferables",c));var u=null;"function"==typeof l?u=l.apply(void 0,s):console.error("worker module init function failed to rehydrate"),e[a]={id:a,value:u,getTransferables:c},n(u)}catch(e){e&&e.noLog||console.error(e),n(e)}}(o,function(e){e instanceof Error?postMessage({messageId:n,success:!1,error:e.message}):postMessage({messageId:n,success:!0,result:{isCallable:"function"==typeof e}})}),"callModule"===a&&function(t,r){var i,n=t.id,a=t.args;e[n]&&"function"==typeof e[n].value||r(Error("Worker module "+n+": n
2672ot found or its 'init' did not return a function"));try{var o=(i=e[n]).value.apply(i,a);o&&"function"==typeof o.then?o.then(s,function(e){return r(e instanceof Error?e:Error(""+e))}):s(o)}catch(e){r(e)}function s(t){try{var i=e[n].getTransferables&&e[n].getTransferables(t);i&&Array.isArray(i)&&i.length||(i=void 0),r(t,i)}catch(e){console.error(e),r(e)}}}(o,function(e,t){e instanceof Error?postMessage({messageId:n,success:!1,error:e.message}):postMessage({messageId:n,success:!0,result:e},t||void 0)})}catch(e){postMessage({messageId:n,success:!1,error:e.stack})}})}r.d(t,{Ae:function(){return h},Ch:function(){return function e(t){if((!t||"function"!=typeof t.init)&&!s)throw Error("requires `options.init` function");var r,i=t.dependencies,o=t.init,l=t.getTransferables,u=t.workerId,h=((r=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return r._getInitResult().then(function(t){if("function"==typeof t)return t.apply(void 0,e);throw Error("Worker module function was called but `init` did not return a callable function")})})._getInitResult=function(){var e=t.dependencies,i=t.init,n=Promise.all(e=Array.isArray(e)?e.map(function(e){return e&&(e=e.onMainThread||e)._getInitResult&&(e=e._getInitResult()),e}):[]).then(function(e){return i.apply(null,e)});return r._getInitResult=function(){return n},n},r);null==u&&(u="#default");var m="workerModule"+ ++a,f=t.name||m,p=null;function g(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(!n())return h.apply(void 0,e);if(!p){p=d(u,"registerModule",g.workerModuleData);var r=function(){p=null,c[u].delete(r)};(c[u]||(c[u]=new Set)).add(r)}return p.then(function(t){if(t.isCallable)return d(u,"callModule",{id:m,args:e});throw Error("Worker module function was called but `init` did not return a callable function")})}return i=i&&i.map(function(t){return"function"!=typeof t||t.workerModuleData||(s=!0,t=e({workerId:u,name:"<"+f+"> function dependency: "+t.name,init:"function(){return (\n"+A(t)+"\n)}"}),s=!1),t&&t.workerModuleData&&(t=t.workerModuleData),t}),g.workerModuleData={isWorkerModule:!0,id:m,name:f,dependencies:i,init:A(o),getTransferables:l&&A(l)},g.onMainThread=h,g}}}),r(40257);var n=function(){var e=!1;if("undefined"!=typeof window&&void 0!==window.document)try{new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"}))).terminate(),e=!0}catch(e){console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+e.message+"]")}return n=function(){return e},e},a=0,o=0,s=!1,l=Object.create(null),c=Object.create(null),u=Object.create(null);function h(e){c[e]&&c[e].forEach(function(e){e()}),l[e]&&(l[e].terminate(),delete l[e])}function A(e){var t=e.toString();return!/^function/.test(t)&&/^\w+\s*\(/.test(t)&&(t="function "+t),t}function d(e,t,r){return new Promise(function(n,a){var s=++o;u[s]=function(e){e.success?n(e.result):a(Error("Error in worker "+t+" call: "+e.error))},(function(e){var t=l[e];if(!t){var r=A(i);(t=l[e]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+e.replace(/\*/g,"")+" **/\n\n;("+r+")()"],{type:"application/javascript"})))).onmessage=function(e){var t=e.data,r=t.messageId,i=u[r];if(!i)throw Error("WorkerModule response with empty or unknown messageId");delete u[r],i(t)}}return t})(e).postMessage({messageId:s,action:t,data:r})})}},24369:function(e,t,r){"use strict";var i=r(2265),n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=i.useState,o=i.useEffect,s=i.useLayoutEffect,l=i.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),i=a({inst:{value:r,getSnapshot:t}}),n=i[0].inst,u=i[1];return s(function(){n.value=r,n.getSnapshot=t,c(n)&&u({inst:n})},[e,r,t]),o(function(){return c(n)&&u({inst:n}),e(function(){c(n)&&u({inst:n})})},[e]),l(r),r};t.useSyncExternalStore=void 0!==i.useSyncExternalStore?i.useSyncExternalStore:u},92860:function(e,t,r){"use strict";var i=r(2265),n=r(53941),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=n.useSyncExternalStore,s=i.useRef,l=i.useEffect,c=i.useMemo,u=i.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,r,i,n){var h=s(null);if(null===h.current){var A={hasValue:!1,value:null};h.current=A}else A=h.current;var d=o(e,(h=c(function(){function e(e){if(!l){if(l=!0,o=e,e=i(e),void 0!==n&&A.hasValue){var t=A.value;if(n(t,e))return s=t}return s=e}if(t=s,a(o,e))return t;var r=i(e);return void 0!==n&&n(t,r)?(o=e,t):(o=e,s=r)}
2672var o,s,l=!1,c=void 0===r?null:r;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,r,i,n]))[0],h[1]);return l(function(){A.hasValue=!0,A.value=d},[d]),u(d),d}},53941:function(e,t,r){"use strict";e.exports=r(24369)},35195:function(e,t,r){"use strict";e.exports=r(92860)},9419:function(e,t){"use strict";t.Z=function(){return function(e){var t,r,i,n,a={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},o={},s={};o.L=1,s[1]="L",Object.keys(a).forEach(function(e,t){o[e]=1<<t+1,s[o[e]]=e}),Object.freeze(o);var l=o.LRI|o.RLI|o.FSI,c=o.L|o.R|o.AL,u=o.B|o.S|o.WS|o.ON|o.FSI|o.LRI|o.RLI|o.PDI,h=o.BN|o.RLE|o.LRE|o.RLO|o.LRO|o.PDF,A=o.S|o.WS|o.B|l|o.PDI|h,d=null;function m(e){return!function(){if(!d){d=new Map;var e=function(e){if(a.hasOwnProperty(e)){var t=0;a[e].split(",").forEach(function(r){var i=r.split("+"),n=i[0],a=i[1];n=parseInt(n,36),a=a?parseInt(a,36):0,d.set(t+=n,o[e]);for(var s=0;s<a;s++)d.set(++t,o[e])})}};for(var t in a)e(t)}}(),d.get(e.codePointAt(0))||o.L}var f={pairs:"14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function p(e,t){var r,i=0,n=new Map,a=t&&new Map;return e.split(",").forEach(function e(o){if(-1!==o.indexOf("+"))for(var s=+o;s--;)e(r);else{r=o;var l=o.split(">"),c=l[0],u=l[1];c=String.fromCodePoint(i+=parseInt(c,36)),u=String.fromCodePoint(i+=parseInt(u,36)),n.set(c,u),t&&a.set(u,c)}}),{map:n,reverseMap:a}}function g(){if(!t){var e=p(f.pairs,!0),n=e.map,a=e.reverseMap;t=n,r=a,i=p(f.canonical,!1).map}}function y(e){return g(),t.get(e)||null}function v(e){return g(),r.get(e)||null}function E(e){return g(),i.get(e)||null}
vendor: 5,571 bytes, line 2672
2672var x=o.L,C=o.R,w=o.EN,B=o.ES,I=o.ET,_=o.AN,b=o.CS,M=o.B,S=o.S,D=o.ON,P=o.BN,T=o.NSM,R=o.AL,F=o.LRO,Q=o.RLO,z=o.LRE,k=o.RLE,L=o.PDF,O=o.LRI,U=o.RLI,G=o.FSI,N=o.PDI;function H(e){return!function(){if(!n){var e=p("14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",!0),t=e.map;e.reverseMap.forEach(function(e,r){t.set(r,e)}),n=t}}(),n.get(e)||null}function j(e,t,r,i){var n=e.length;r=Math.max(0,null==r?0:+r),i=Math.min(n-1,null==i?n-1:+i);var a=[];return t.paragraphs.forEach(function(n){var o=Math.max(r,n.start),s=Math.min(i,n.end);if(o<s){for(var l=t.levels.slice(o,s+1),c=s;c>=o&&m(e[c])&A;c--)l[c]=n.level;for(var u=n.level,h=1/0,d=0;d<l.length;d++){var f=l[d];f>u&&(u=f),f<h&&(h=1|f)}for(var p=u;p>=h;p--)for(var g=0;g<l.length;g++)if(l[g]>=p){for(var y=g;g+1<l.length&&l[g+1]>=p;)g++;g>y&&a.push([y+o,g+o])}}}),a}function J(e,t,r,i){for(var n=j(e,t,r,i),a=[],o=0;o<e.length;o++)a[o]=o;return n.forEach(function(e){for(var t=e[0],r=e[1],i=a.slice(t,r+1),n=i.length;n--;)a[r-n]=i[n]}),a}return e.closingToOpeningBracket=v,e.getBidiCharType=m,e.getBidiCharTypeName=function(e){return s[m(e)]},e.getCanonicalBracket=E,e.getEmbeddingLevels=function(e,t){for(var r=new Uint32Array(e.length),i=0;i<e.length;i++)r[i]=m(e[i]);var n=new Map;function a(e,t){var i=r[e];r[e]=t,n.set(i,n.get(i)-1),i&u&&n.set(u,n.get(u)-1),n.set(t,(n.get(t)||0)+1),t&u&&n.set(u,(n.get(u)||0)+1)}for(var o=new Uint8Array(e.length),s=new Map,d=[],f=null,p=0;p<e.length;p++)f||d.push(f={start:p,end:e.length-1,level:"rtl"===t?1:"ltr"===t?0:tD(p,!1)}),r[p]&M&&(f.end=p,f=null);for(var g=k|z|Q|F|l|N|L|M,H=function(e){return e+(1&e?1:2)},j=function(e){return e+(1&e?2:1)},J=0;J<d.length;J++){var V=[{_level:(f=d[J]).level,_override:0,_isolate:0}],K=void 0,Y=0,W=0,q=0;n.clear();for(var X=f.start;X<=f.end;X++){var Z=r[X];if(K=V[V.length-1],n.set(Z,(n.get(Z)||0)+1),Z&u&&n.set(u,(n.get(u)||0)+1),Z&g){if(Z&(k|z)){o[X]=K._level;var $=(Z===k?j:H)(K._level);!($<=125)||Y||W?!Y&&W++:V.push({_level:$,_override:0,_isolate:0})}else if(Z&(Q|F)){o[X]=K._level;var ee=(Z===Q?j:H)(K._level);!(ee<=125)||Y||W?!Y&&W++:V.push({_level:ee,_override:Z&Q?C:x,_isolate:0})}else if(Z&l){Z&G&&(Z=1===tD(X+1,!0)?U:O),o[X]=K._level,K._override&&a(X,K._override);var et=(Z===U?j:H)(K._level);et<=125&&0===Y&&0===W?(q++,V.push({_level:et,_override:0,_isolate:1,_isolInitIndex:X})):Y++}else if(Z&N){if(Y>0)Y--;else if(q>0){for(W=0;!V[V.length-1]._isolate;)V.pop();var er=V[V.length-1]._isolInitIndex;null!=er&&(s.set(er,X),s.set(X,er)),V.pop(),q--}K=V[V.length-1],o[X]=K._level,K._override&&a(X,K._override)}else Z&L?(0===Y&&(W>0?W--:!K._isolate&&V.length>1&&(V.pop(),K=V[V.length-1])),o[X]=K._level):Z&M&&(o[X]=f.level)}else o[X]=K._level,K._override&&Z!==P&&a(X,K._override)}for(var ei=[],en=null,ea=f.start;ea<=f.end;ea++){var eo=r[ea];if(!(eo&h)){var es=o[ea],el=eo&l,ec=eo===N;en&&es===en._level?(en._end=ea,en._endsWithIsolInit=el):ei.push(en={_start:ea,_end:ea,_level:es,_startsWithPDI:ec,_endsWithIsolInit:el})}}for(var eu=[],eh=0;eh<ei.length;eh++){var eA=ei[eh];if(!eA._startsWithPDI||eA._startsWithPDI&&!s.has(eA._start)){for(var ed=[en=eA],em=void 0;en&&en._endsWithIsolInit&&null!=(em=s.get(en._end));)for(var ef=eh+1;ef<ei.length;ef++)if(ei[ef]._start===em){ed.push(en=ei[ef]);break}for(var ep=[],eg=0;eg<ed.length;eg++)for(var ey=ed[eg],ev=ey._start;ev<=ey._end;ev++)ep.push(ev);for(var eE=o[ep[0]],ex=f.level,eC=ep[0]-1;eC>=0;eC--)if(!(r[eC]&h)){ex=o[eC];break}var ew=ep[ep.length-1],eB=o[ew],eI=f.level;if(!(r[ew]&l)){for(var e_=ew+1;e_<=f.end;e_++)if(!(r[e_]&h)){eI=o[e_];break}}eu.push({_seqIndices:ep,_sosType:Math.max(ex,eE)%2?C:x,_eosType:Math.max(eI,eB)%2?C:x})}}for(var eb=0;eb<eu.length;eb++){var eM=eu[eb],eS=eM._seqIndices,eD=eM._sosType,eP=eM._eosType,eT=1&o[eS[0]]?C:x;if(n.get(T))for(var eR=0;eR<eS.length;eR++){var eF=eS[eR];if(r[eF]&T){for(var eQ=eD,ez=eR-1;ez>=0;ez--)if(!(r[eS[ez]]&h)){eQ=r[eS[ez]];break}a(eF,eQ&(l|N)?D:eQ)}}if(n.get(w))for(var ek=0;ek<eS.length;ek++){var eL=eS[ek];if(r[eL]&w)for(var eO=ek-1;eO>=-1;eO--){var eU=-1===eO?eD:r[eS[eO]];if(eU&c){eU===R&&a(eL,_);break}}}if(n.get(R))for(var eG=0;eG<eS.length;eG++){var eN=eS[eG];r[eN]&R&&a(eN,C)}if(n.get(B)||n.get(b))for(var eH=1;eH<eS.length-1;eH++){var ej=eS[eH];if(r[ej]&(B|b)){for(var eJ=0,eV=0,eK=eH-1;eK>=0&&(eJ=r[eS[eK]])&h;eK--);for(var eY=eH+1;eY<eS.length&&(eV=r[eS[eY]])&h;eY++);eJ===eV&&(r[ej]===B?eJ===w:eJ&(w|_))&&a(ej,eJ)}}if(n.get(w)){for(var eW=0;eW<eS.length;eW++)if(r[eS[eW]]&w){for(var eq=eW-1;eq>=0&&r[eS[eq]]&(I|h);eq--)a(eS[eq],w);for(eW++;eW<eS.length&&r[eS[eW]]&(I|h|w);eW++)r[eS[eW]]!==w&&a(eS[eW],w)}}if(n.get(I)||n.get(B)||n.get(b))for(var eX=0;eX<eS.length;eX++){var eZ=eS[eX];if(r[eZ]&(I|B|b)){a(eZ,D);for(var e$=eX-1;e$>=0&&r[eS[e$]]&h;e$--)a(eS[e$],D);for(var e1=eX+1;e1<eS.length&&r[eS[e1]]&h;e1++)a(eS[e1],D)}}if(n.get(w))for(var e0=0,e2=eD;e0<eS.length;e0++){var e3=eS[e0],e4=r[e3];e4&w?e2===x&&a(e3,x):e4&c&&(e2=e4)}if(n.get(u)){for(var e5=C|w|_,e6=e5|x,e8=[],e9=[],e7=0;e7<eS.length;e7++)if(r[eS[e7]]&u){var te=e[eS[e7]],tt=void 0;
2672if(null!==y(te)){if(e9.length<63)e9.push({char:te,seqIndex:e7});else break}else if(null!==(tt=v(te)))for(var tr=e9.length-1;tr>=0;tr--){var ti=e9[tr].char;if(ti===tt||ti===v(E(te))||y(E(ti))===te){e8.push([e9[tr].seqIndex,e7]),e9.length=tr;break}}}e8.sort(function(e,t){return e[0]-t[0]});for(var tn=0;tn<e8.length;tn++){for(var ta=e8[tn],to=ta[0],ts=ta[1],tl=!1,tc=0,tu=to+1;tu<ts;tu++){var th=eS[tu];if(r[th]&e6){tl=!0;var tA=r[th]&e5?C:x;if(tA===eT){tc=tA;break}}}if(tl&&!tc){tc=eD;for(var td=to-1;td>=0;td--){var tm=eS[td];if(r[tm]&e6){var tf=r[tm]&e5?C:x;tc=tf!==eT?tf:eT;break}}}if(tc){if(r[eS[to]]=r[eS[ts]]=tc,tc!==eT){for(var tp=to+1;tp<eS.length;tp++)if(!(r[eS[tp]]&h)){m(e[eS[tp]])&T&&(r[eS[tp]]=tc);break}}if(tc!==eT){for(var tg=ts+1;tg<eS.length;tg++)if(!(r[eS[tg]]&h)){m(e[eS[tg]])&T&&(r[eS[tg]]=tc);break}}}}for(var ty=0;ty<eS.length;ty++)if(r[eS[ty]]&u){for(var tv=ty,tE=ty,tx=eD,tC=ty-1;tC>=0;tC--)if(r[eS[tC]]&h)tv=tC;else{tx=r[eS[tC]]&e5?C:x;break}for(var tw=eP,tB=ty+1;tB<eS.length;tB++)if(r[eS[tB]]&(u|h))tE=tB;else{tw=r[eS[tB]]&e5?C:x;break}for(var tI=tv;tI<=tE;tI++)r[eS[tI]]=tx===tw?tx:eT;ty=tE}}}for(var t_=f.start;t_<=f.end;t_++){var tb=o[t_],tM=r[t_];if(1&tb?tM&(x|w|_)&&o[t_]++:tM&C?o[t_]++:tM&(_|w)&&(o[t_]+=2),tM&h&&(o[t_]=0===t_?f.level:o[t_-1]),t_===f.end||m(e[t_])&(S|M))for(var tS=t_;tS>=0&&m(e[tS])&A;tS--)o[tS]=f.level}}return{levels:o,paragraphs:d};function tD(t,i){for(var n=t;n<e.length;n++){var a=r[n];if(a&(C|R))return 1;if(a&(M|x)||i&&a===N)break;if(a&l){var o=function(t){for(var i=1,n=t+1;n<e.length;n++){var a=r[n];if(a&M)break;if(a&N){if(0==--i)return n}else a&l&&i++}return -1}(n);n=-1===o?e.length:o}}return 0}},e.getMirroredCharacter=H,e.getMirroredCharactersMap=function(e,t,r,i){var n=e.length;r=Math.max(0,null==r?0:+r),i=Math.min(n-1,null==i?n-1:+i);for(var a=new Map,o=r;o<=i;o++)if(1&t[o]){var s=H(e[o]);null!==s&&a.set(o,s)}return a},e.getReorderSegments=j,e.getReorderedIndices=J,e.getReorderedString=function(e,t,r,i){var n=J(e,t,r,i),a=[].concat(e);return n.forEach(function(r,i){a[i]=(1&t.levels[r]?H(e[r]):null)||e[r]}),a.join("")},e.openingToClosingBracket=y,Object.defineProperty(e,"__esModule",{value:!0}),e}({})}},22061:function(e,t,r){"use strict";function i(){return function(e){function t(e,t){for(var r,i,n,a,o,s=/([MLQCZ])([^MLQCZ]*)/g;r=s.exec(e);){var l=r[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(e){return parseFloat(e)});switch(r[1]){case"M":a=i=l[0],o=n=l[1];break;case"L":(l[0]!==a||l[1]!==o)&&t("L",a,o,a=l[0],o=l[1]);break;case"Q":t("Q",a,o,a=l[2],o=l[3],l[0],l[1]);break;case"C":t("C",a,o,a=l[4],o=l[5],l[0],l[1],l[2],l[3]);break;case"Z":(a!==i||o!==n)&&t("L",a,o,i,n)}}}function r(e,r,i){void 0===i&&(i=16);var n={x:0,y:0};t(e,function(e,t,a,o,s,l,c,u,h){switch(e){case"L":r(t,a,o,s);break;case"Q":for(var A=t,d=a,m=1;m<i;m++)!function(e,t,r,i,n,a,o,s){var l=1-o;s.x=l*l*e+2*l*o*r+o*o*n,s.y=l*l*t+2*l*o*i+o*o*a}(t,a,l,c,o,s,m/(i-1),n),r(A,d,n.x,n.y),A=n.x,d=n.y;break;case"C":for(var f=t,p=a,g=1;g<i;g++)!function(e,t,r,i,n,a,o,s,l,c){var u=1-l;c.x=u*u*u*e+3*u*u*l*r+3*u*l*l*n+l*l*l*o,c.y=u*u*u*t+3*u*u*l*i+3*u*l*l*a+l*l*l*s}(t,a,l,c,u,h,o,s,g/(i-1),n),r(f,p,n.x,n.y),f=n.x,p=n.y}})}var i="precision highp float;attribute vec2 aUV;varying vec2 vUV;void main(){vUV=aUV;gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",n=new WeakMap,a={premultipliedAlpha:!1,preserveDrawingBuffer:!0,antialias:!1,depth:!1};function o(e,t){var r=e.getContext?e.getContext("webgl",a):e,i=n.get(r);if(!i){var o="undefined"!=typeof WebGL2RenderingContext&&r instanceof WebGL2RenderingContext,s={},l={},c={},u=-1,h=[];function A(e){var t=s[e];if(!t&&!(t=s[e]=r.getExtension(e)))throw Error(e+" not supported");return t}function d(e,t){var i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function m(){s={},l={},c={},u=-1,h.length=0}r.canvas.addEventListener("webglcontextlost",function(e){m(),e.preventDefault()},!1),n.set(r,i={gl:r,isWebGL2:o,getExtension:A,withProgram:function(e,t,i,n){if(!l[e]){var a={},s={},c=r.createProgram();r.attachShader(c,d(t,r.VERTEX_SHADER)),r.attachShader(c,d(i,r.FRAGMENT_SHADER)),r.linkProgram(c),l[e]={program:c,transaction:function(e){r.useProgram(c),e({setUniform:function(e,t){for(var i=[],n=arguments.length-2;n-- >0;)i[n]=arguments[n+2];var a=s[t]||(s[t]=r.getUniformLocation(c,t));r["uniform"+e].apply(r,[a].concat(i))},setAttribute:function(e,t,i,n,s){var l=a[e];l||(l=a[e]={buf:r.createBuffer(),loc:r.getAttribLocation(c,e),data:null}),r.bindBuffer(r.ARRAY_BUFFER,l.buf),r.vertexAttribPointer(l.loc,t,r.FLOAT,!1,0,0),r.enableVertexAttribArray(l.loc),o?r.vertexAttribDivisor(l.loc,n):A("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(l.loc,n),s!==l.data&&(r.bufferData(r.ARRAY_BUFFER,s,i),l.data=s)}})}}}l[e].transaction(n)},withTexture:function(e,t){u++;try{r.activeTexture(r.TEXTURE0+u);var i=c[e];i||(i=c[e]=r.createTexture(),r.bindTexture(r.TEXTURE_2D,i),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST)),r.bindTexture(r.TEXTURE_2D,i),t(i,u)}finally{u--}},withTextureFramebuffer:function(e,t,i){var n=r.createFramebuffer();h.push(n),r.bindFramebuffer(r.FRAMEBUFFER,n),r.activeTexture(r.TEXTURE0+t),r.bindTexture(r.TEXTURE_2D,e),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0);try{i(n)}finally{r.deleteFramebuffer(n),r.bindFramebuffer(r.FRAMEBUFFER,h[--h.length-1]||null)}},handleContextLoss:m})}t(i)}function s(e,t,r,n,a,s,l,c){void 0===l&&(l=15),void 0===c&&(c=null),o(e,function(e){var o=e.gl,u=e.withProgram;(0,e.withTexture)("copy",function(e,h){o.texImage2D(o.TEXTURE_2D,0,o.RGBA,a,s,0,o.RGBA,o.UNSIGNED_BYTE,t),u("copy",i,"precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){gl_FragColor=texture2D(tex,vUV);}",function(e){var t=e.setUniform;(0,e.setAttribute)("aUV",2,o.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),t("1i","image",h),o.bindFramebuffer(o.FRAMEBUFFER,c||null),o.disable(o.BLEND),o.colorMask(8&l,4&l,2&l,1&l),o.viewport(r,n,a,s),o.scissor(r,n,a,s),o.drawArrays(o.TRIANGLES,0,3)})})})}var l=Object.freeze({__proto__:null,withWebGLContext:o,renderImageData:s,resizeWebGLCanvasWithoutClearing:function(e,t,r){var i=e.width,n=e.he
2672ight;o(e,function(a){var o=a.gl,l=new Uint8Array(i*n*4);o.readPixels(0,0,i,n,o.RGBA,o.UNSIGNED_BYTE,l),e.width=t,e.height=r,s(o,l,0,0,i,n)})}});function c(e,t,i,n,a,o){void 0===o&&(o=1);var s=new Uint8Array(e*t),l=n[2]-n[0],c=n[3]-n[1],u=[];r(i,function(e,t,r,i){u.push({x1:e,y1:t,x2:r,y2:i,minX:Math.min(e,r),minY:Math.min(t,i),maxX:Math.max(e,r),maxY:Math.max(t,i)})}),u.sort(function(e,t){return e.maxX-t.maxX});for(var h=0;h<e;h++)for(var A=0;A<t;A++){var d=function(e,t){for(var r=1/0,i=1/0,n=u.length;n--;){var a=u[n];if(a.maxX+i<=e)break;if(e+i>a.minX&&t-i<a.maxY&&t+i>a.minY){var o=function(e,t,r,i,n,a){var o=n-r,s=a-i,l=o*o+s*s,c=l?Math.max(0,Math.min(1,((e-r)*o+(t-i)*s)/l)):0,u=e-(r+c*o),h=t-(i+c*s);return u*u+h*h}(e,t,a.x1,a.y1,a.x2,a.y2);o<r&&(i=Math.sqrt(r=o))}}return function(e,t){for(var r=0,i=u.length;i--;){var n=u[i];if(n.maxX<=e)break;n.y1>t!=n.y2>t&&e<(n.x2-n.x1)*(t-n.y1)/(n.y2-n.y1)+n.x1&&(r+=n.y1<n.y2?1:-1)}return 0!==r}(e,t)&&(i=-i),i}(n[0]+l*(h+.5)/e,n[1]+c*(A+.5)/t),m=Math.pow(1-Math.abs(d)/a,o)/2;d<0&&(m=1-m),m=Math.max(0,Math.min(255,Math.round(255*m))),s[A*e+h]=m}return s}function u(e,t,r,i,n,a,o,s,l,c){void 0===a&&(a=1),void 0===s&&(s=0),void 0===l&&(l=0),void 0===c&&(c=0),h(e,t,r,i,n,a,o,null,s,l,c)}function h(e,t,r,i,n,a,o,l,u,h,A){void 0===a&&(a=1),void 0===u&&(u=0),void 0===h&&(h=0),void 0===A&&(A=0);for(var d=c(e,t,r,i,n,a),m=new Uint8Array(4*d.length),f=0;f<d.length;f++)m[4*f+A]=d[f];s(o,m,u,h,e,t,1<<3-A,l)}var A=Object.freeze({__proto__:null,generate:c,generateIntoCanvas:u,generateIntoFramebuffer:h}),d=new Float32Array([0,0,2,0,0,2]),m=null,f=!1,p={},g=new WeakMap;function y(e){if(!f&&!C(e))throw Error("WebGL generation not supported")}function v(e,t,r,i,n,a,s){if(void 0===a&&(a=1),void 0===s&&(s=null),!s&&!(s=m)){var l="function"==typeof OffscreenCanvas?new OffscreenCanvas(1,1):"undefined"!=typeof document?document.createElement("canvas"):null;if(!l)throw Error("OffscreenCanvas or DOM canvas not supported");s=m=l.getContext("webgl",{depth:!1})}y(s);var c=new Uint8Array(e*t*4);o(s,function(o){var s=o.gl,l=o.withTexture,u=o.withTextureFramebuffer;l("readable",function(o,l){s.texImage2D(s.TEXTURE_2D,0,s.RGBA,e,t,0,s.RGBA,s.UNSIGNED_BYTE,null),u(o,l,function(o){x(e,t,r,i,n,a,s,o,0,0,0),s.readPixels(0,0,e,t,s.RGBA,s.UNSIGNED_BYTE,c)})})});for(var u=new Uint8Array(e*t),h=0,A=0;h<c.length;h+=4)u[A++]=c[h];return u}function E(e,t,r,i,n,a,o,s,l,c){void 0===a&&(a=1),void 0===s&&(s=0),void 0===l&&(l=0),void 0===c&&(c=0),x(e,t,r,i,n,a,o,null,s,l,c)}function x(e,t,n,a,s,l,c,u,h,A,m){void 0===l&&(l=1),void 0===h&&(h=0),void 0===A&&(A=0),void 0===m&&(m=0),y(c);var f=[];r(n,function(e,t,r,i){f.push(e,t,r,i)}),f=new Float32Array(f),o(c,function(r){var n=r.gl,o=r.isWebGL2,c=r.getExtension,p=r.withProgram,g=r.withTexture,y=r.withTextureFramebuffer,v=r.handleContextLoss;if(g("rawDistances",function(r,g){(e!==r._lastWidth||t!==r._lastHeight)&&n.texImage2D(n.TEXTURE_2D,0,n.RGBA,r._lastWidth=e,r._lastHeight=t,0,n.RGBA,n.UNSIGNED_BYTE,null),p("main","precision highp float;uniform vec4 uGlyphBounds;attribute vec2 aUV;attribute vec4 aLineSegment;varying vec4 vLineSegment;varying vec2 vGlyphXY;void main(){vLineSegment=aLineSegment;vGlyphXY=mix(uGlyphBounds.xy,uGlyphBounds.zw,aUV);gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}","precision highp float;uniform vec4 uGlyphBounds;uniform float uMaxDistance;uniform float uExponent;varying vec4 vLineSegment;varying vec2 vGlyphXY;float absDistToSegment(vec2 point,vec2 lineA,vec2 lineB){vec2 lineDir=lineB-lineA;float lenSq=dot(lineDir,lineDir);float t=lenSq==0.0 ? 0.0 : clamp(dot(point-lineA,lineDir)/lenSq,0.0,1.0);vec2 linePt=lineA+t*lineDir;return distance(point,linePt);}void main(){vec4 seg=vLineSegment;vec2 p=vGlyphXY;float dist=absDistToSegment(p,seg.xy,seg.zw);float val=pow(1.0-clamp(dist/uMaxDistance,0.0,1.0),uExponent)*0.5;bool crossing=(seg.y>p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y<vLineSegment.w;gl_FragColor=vec4(crossingUp ? 1.0/255.0 : 0.0,crossing&&!crossingUp ? 1.0/255.0 : 0.0,0.0,val);}",function(i){var u=i.setAttribute,h=i.setUniform,A=!o&&c("ANGLE_instanced_arrays"),m=!o&&c("EXT_blend_minmax");u("aUV",2,n.STATIC_DRAW,0,d),u("aLineSegment",4,n.DYNAMIC_DRAW,1,f),h.apply(void 0,["4f","uGlyphBounds"].concat(a)),h("1f","uMaxDistance",s),h("1f","uExponent",l),y(r,g,function(r){n.enable(n.BLEND),n.colorMask(!0,!0,
2672!0,!0),n.viewport(0,0,e,t),n.scissor(0,0,e,t),n.blendFunc(n.ONE,n.ONE),n.blendEquationSeparate(n.FUNC_ADD,o?n.MAX:m.MAX_EXT),n.clear(n.COLOR_BUFFER_BIT),o?n.drawArraysInstanced(n.TRIANGLES,0,3,f.length/4):A.drawArraysInstancedANGLE(n.TRIANGLES,0,3,f.length/4)})}),p("post",i,"precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){vec4 color=texture2D(tex,vUV);bool inside=color.r!=color.g;float val=inside ? 1.0-color.a : color.a;gl_FragColor=vec4(val);}",function(r){r.setAttribute("aUV",2,n.STATIC_DRAW,0,d),r.setUniform("1i","tex",g),n.bindFramebuffer(n.FRAMEBUFFER,u),n.disable(n.BLEND),n.colorMask(0===m,1===m,2===m,3===m),n.viewport(h,A,e,t),n.scissor(h,A,e,t),n.drawArrays(n.TRIANGLES,0,3)})}),n.isContextLost())throw v(),Error("webgl context lost")})}function C(e){var t=e&&e!==m?e.canvas||e:p,r=g.get(t);if(void 0===r){f=!0;var i=null;try{var n=[97,106,97,61,99,137,118,80,80,118,137,99,61,97,106,97],a=v(4,4,"M8,8L16,8L24,24L16,24Z",[0,0,32,32],24,1,e);(r=a&&n.length===a.length&&a.every(function(e,t){return e===n[t]}))||(i="bad trial run results",console.info(n,a))}catch(e){r=!1,i=e.message}i&&console.warn("WebGL SDF generation not supported:",i),f=!1,g.set(t,r)}return r}var w=Object.freeze({__proto__:null,generate:v,generateIntoCanvas:E,generateIntoFramebuffer:x,isSupported:C});return e.forEachPathCommand=t,e.generate=function(e,t,r,i,n,a){void 0===n&&(n=Math.max(i[2]-i[0],i[3]-i[1])/2),void 0===a&&(a=1);try{return v.apply(w,arguments)}catch(e){return console.info("WebGL SDF generation failed, falling back to JS",e),c.apply(A,arguments)}},e.generateIntoCanvas=function(e,t,r,i,n,a,o,s,l,c){void 0===n&&(n=Math.max(i[2]-i[0],i[3]-i[1])/2),void 0===a&&(a=1),void 0===s&&(s=0),void 0===l&&(l=0),void 0===c&&(c=0);try{return E.apply(w,arguments)}catch(e){return console.info("WebGL SDF generation failed, falling back to JS",e),u.apply(A,arguments)}},e.javascript=A,e.pathToLineSegments=r,e.webgl=w,e.webglUtils=l,Object.defineProperty(e,"__esModule",{value:!0}),e}({})}r.d(t,{Z:function(){return i}})}}]);

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.