diff --git a/dist/assets/index-BKlYAz7v.js b/dist/assets/index-Bh_ePSY9.js similarity index 99% rename from dist/assets/index-BKlYAz7v.js rename to dist/assets/index-Bh_ePSY9.js index 0d081dcd..5835c9d1 100644 --- a/dist/assets/index-BKlYAz7v.js +++ b/dist/assets/index-Bh_ePSY9.js @@ -3586,7 +3586,7 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function xv(n,e,t){let i=new Lc;const r=new je,s=new je,a=new at,o=new gv({depthPacking:mp}),c=new _v,l={},u=t.maxTextureSize,d={[oi]:Bt,[Bt]:oi,[Fn]:Fn},p=new Di({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new je},radius:{value:4}},vertexShader:vv,fragmentShader:yv}),g=p.clone();g.defines.HORIZONTAL_PASS=1;const _=new Fi;_.setAttribute("position",new Sn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new Hn(_,p),h=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ud;let f=this.type;this.render=function(R,L,C){if(h.enabled===!1||h.autoUpdate===!1&&h.needsUpdate===!1||R.length===0)return;const P=n.getRenderTarget(),S=n.getActiveCubeFace(),E=n.getActiveMipmapLevel(),O=n.state;O.setBlending(ri),O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);const k=f!==On&&this.type===On,Z=f===On&&this.type!==On;for(let I=0,y=R.length;Iu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/q.x),r.x=s.x*q.x,D.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/q.y),r.y=s.y*q.y,D.mapSize.y=s.y)),D.map===null||k===!0||Z===!0){const H=this.type!==On?{minFilter:It,magFilter:It}:{};D.map!==null&&D.map.dispose(),D.map=new Ii(r.x,r.y,H),D.map.texture.name=w.name+".shadowMap",D.camera.updateProjectionMatrix()}n.setRenderTarget(D.map),n.clear();const V=D.getViewportCount();for(let H=0;H0||L.map&&L.alphaTest>0){const O=S.uuid,k=L.uuid;let Z=l[O];Z===void 0&&(Z={},l[O]=Z);let I=Z[k];I===void 0&&(I=S.clone(),Z[k]=I),S=I}if(S.visible=L.visible,S.wireframe=L.wireframe,P===On?S.side=L.shadowSide!==null?L.shadowSide:L.side:S.side=L.shadowSide!==null?L.shadowSide:d[L.side],S.alphaMap=L.alphaMap,S.alphaTest=L.alphaTest,S.map=L.map,S.clipShadows=L.clipShadows,S.clippingPlanes=L.clippingPlanes,S.clipIntersection=L.clipIntersection,S.displacementMap=L.displacementMap,S.displacementScale=L.displacementScale,S.displacementBias=L.displacementBias,S.wireframeLinewidth=L.wireframeLinewidth,S.linewidth=L.linewidth,C.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const O=n.properties.get(S);O.light=C}return S}function M(R,L,C,P,S){if(R.visible===!1)return;if(R.layers.test(L.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&S===On)&&(!R.frustumCulled||i.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,R.matrixWorld);const k=e.update(R),Z=R.material;if(Array.isArray(Z)){const I=k.groups;for(let y=0,w=I.length;y=1):H.indexOf("OpenGL ES")!==-1&&(V=parseFloat(/^OpenGL ES (\d)/.exec(H)[1]),q=V>=2);let N=null,G={};const ee=n.getParameter(n.SCISSOR_BOX),ae=n.getParameter(n.VIEWPORT),fe=new at().fromArray(ee),xe=new at().fromArray(ae);function De(U,ue,re,Y){const se=new Uint8Array(4),Me=n.createTexture();n.bindTexture(U,Me),n.texParameteri(U,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(U,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Je=0;Je"u"?!1:/OculusBrowser/g.test(navigator.userAgent),_=new WeakMap;let m;const h=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(A,x){return f?new OffscreenCanvas(A,x):ua("canvas")}function v(A,x,W,ne){let Q=1;if((A.width>ne||A.height>ne)&&(Q=ne/Math.max(A.width,A.height)),Q<1||x===!0)if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap){const ie=x?Ko:Math.floor,ve=ie(Q*A.width),oe=ie(Q*A.height);m===void 0&&(m=b(ve,oe));const he=W?b(ve,oe):m;return he.width=ve,he.height=oe,he.getContext("2d").drawImage(A,0,0,ve,oe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+A.width+"x"+A.height+") to ("+ve+"x"+oe+")."),he}else return"data"in A&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+A.width+"x"+A.height+")."),A;return A}function M(A){return Vl(A.width)&&Vl(A.height)}function R(A){return o?!1:A.wrapS!==dn||A.wrapT!==dn||A.minFilter!==It&&A.minFilter!==Jt}function L(A,x){return A.generateMipmaps&&x&&A.minFilter!==It&&A.minFilter!==Jt}function C(A){n.generateMipmap(A)}function P(A,x,W,ne,Q=!1){if(o===!1)return x;if(A!==null){if(n[A]!==void 0)return n[A];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+A+"'")}let ie=x;if(x===n.RED&&(W===n.FLOAT&&(ie=n.R32F),W===n.HALF_FLOAT&&(ie=n.R16F),W===n.UNSIGNED_BYTE&&(ie=n.R8)),x===n.RED_INTEGER&&(W===n.UNSIGNED_BYTE&&(ie=n.R8UI),W===n.UNSIGNED_SHORT&&(ie=n.R16UI),W===n.UNSIGNED_INT&&(ie=n.R32UI),W===n.BYTE&&(ie=n.R8I),W===n.SHORT&&(ie=n.R16I),W===n.INT&&(ie=n.R32I)),x===n.RG&&(W===n.FLOAT&&(ie=n.RG32F),W===n.HALF_FLOAT&&(ie=n.RG16F),W===n.UNSIGNED_BYTE&&(ie=n.RG8)),x===n.RGBA){const ve=Q?aa:tt.getTransfer(ne);W===n.FLOAT&&(ie=n.RGBA32F),W===n.HALF_FLOAT&&(ie=n.RGBA16F),W===n.UNSIGNED_BYTE&&(ie=ve===st?n.SRGB8_ALPHA8:n.RGBA8),W===n.UNSIGNED_SHORT_4_4_4_4&&(ie=n.RGBA4),W===n.UNSIGNED_SHORT_5_5_5_1&&(ie=n.RGB5_A1)}return(ie===n.R16F||ie===n.R32F||ie===n.RG16F||ie===n.RG32F||ie===n.RGBA16F||ie===n.RGBA32F)&&e.get("EXT_color_buffer_float"),ie}function S(A,x,W){return L(A,W)===!0||A.isFramebufferTexture&&A.minFilter!==It&&A.minFilter!==Jt?Math.log2(Math.max(x.width,x.height))+1:A.mipmaps!==void 0&&A.mipmaps.length>0?A.mipmaps.length:A.isCompressedTexture&&Array.isArray(A.image)?x.mipmaps.length:1}function E(A){return A===It||A===hl||A===Za?n.NEAREST:n.LINEAR}function O(A){const x=A.target;x.removeEventListener("dispose",O),Z(x),x.isVideoTexture&&_.delete(x)}function k(A){const x=A.target;x.removeEventListener("dispose",k),y(x)}function Z(A){const x=i.get(A);if(x.__webglInit===void 0)return;const W=A.source,ne=h.get(W);if(ne){const Q=ne[x.__cacheKey];Q.usedTimes--,Q.usedTimes===0&&I(A),Object.keys(ne).length===0&&h.delete(W)}i.remove(A)}function I(A){const x=i.get(A);n.deleteTexture(x.__webglTexture);const W=A.source,ne=h.get(W);delete ne[x.__cacheKey],a.memory.textures--}function y(A){const x=A.texture,W=i.get(A),ne=i.get(x);if(ne.__webglTexture!==void 0&&(n.deleteTexture(ne.__webglTexture),a.memory.textures--),A.depthTexture&&A.depthTexture.dispose(),A.isWebGLCubeRenderTarget)for(let Q=0;Q<6;Q++){if(Array.isArray(W.__webglFramebuffer[Q]))for(let ie=0;ie=c&&console.warn("THREE.WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+c),w+=1,A}function V(A){const x=[];return x.push(A.wrapS),x.push(A.wrapT),x.push(A.wrapR||0),x.push(A.magFilter),x.push(A.minFilter),x.push(A.anisotropy),x.push(A.internalFormat),x.push(A.format),x.push(A.type),x.push(A.generateMipmaps),x.push(A.premultiplyAlpha),x.push(A.flipY),x.push(A.unpackAlignment),x.push(A.colorSpace),x.join()}function H(A,x){const W=i.get(A);if(A.isVideoTexture&&yt(A),A.isRenderTargetTexture===!1&&A.version>0&&W.__version!==A.version){const ne=A.image;if(ne===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ne.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{be(W,A,x);return}}t.bindTexture(n.TEXTURE_2D,W.__webglTexture,n.TEXTURE0+x)}function N(A,x){const W=i.get(A);if(A.version>0&&W.__version!==A.version){be(W,A,x);return}t.bindTexture(n.TEXTURE_2D_ARRAY,W.__webglTexture,n.TEXTURE0+x)}function G(A,x){const W=i.get(A);if(A.version>0&&W.__version!==A.version){be(W,A,x);return}t.bindTexture(n.TEXTURE_3D,W.__webglTexture,n.TEXTURE0+x)}function ee(A,x){const W=i.get(A);if(A.version>0&&W.__version!==A.version){Qe(W,A,x);return}t.bindTexture(n.TEXTURE_CUBE_MAP,W.__webglTexture,n.TEXTURE0+x)}const ae={[jo]:n.REPEAT,[dn]:n.CLAMP_TO_EDGE,[$o]:n.MIRRORED_REPEAT},fe={[It]:n.NEAREST,[hl]:n.NEAREST_MIPMAP_NEAREST,[Za]:n.NEAREST_MIPMAP_LINEAR,[Jt]:n.LINEAR,[rp]:n.LINEAR_MIPMAP_NEAREST,[Xr]:n.LINEAR_MIPMAP_LINEAR},xe={[_p]:n.NEVER,[Mp]:n.ALWAYS,[vp]:n.LESS,[xp]:n.LEQUAL,[yp]:n.EQUAL,[bp]:n.GEQUAL,[Sp]:n.GREATER,[Ep]:n.NOTEQUAL};function De(A,x,W){if(W?(n.texParameteri(A,n.TEXTURE_WRAP_S,ae[x.wrapS]),n.texParameteri(A,n.TEXTURE_WRAP_T,ae[x.wrapT]),(A===n.TEXTURE_3D||A===n.TEXTURE_2D_ARRAY)&&n.texParameteri(A,n.TEXTURE_WRAP_R,ae[x.wrapR]),n.texParameteri(A,n.TEXTURE_MAG_FILTER,fe[x.magFilter]),n.texParameteri(A,n.TEXTURE_MIN_FILTER,fe[x.minFilter])):(n.texParameteri(A,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(A,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(A===n.TEXTURE_3D||A===n.TEXTURE_2D_ARRAY)&&n.texParameteri(A,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(x.wrapS!==dn||x.wrapT!==dn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(A,n.TEXTURE_MAG_FILTER,E(x.magFilter)),n.texParameteri(A,n.TEXTURE_MIN_FILTER,E(x.minFilter)),x.minFilter!==It&&x.minFilter!==Jt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),x.compareFunction&&(n.texParameteri(A,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(A,n.TEXTURE_COMPARE_FUNC,xe[x.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const ne=e.get("EXT_texture_filter_anisotropic");if(x.magFilter===It||x.minFilter!==Za&&x.minFilter!==Xr||x.type===ii&&e.has("OES_texture_float_linear")===!1||o===!1&&x.type===qr&&e.has("OES_texture_half_float_linear")===!1)return;(x.anisotropy>1||i.get(x).__currentAnisotropy)&&(n.texParameterf(A,ne.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(x.anisotropy,r.getMaxAnisotropy())),i.get(x).__currentAnisotropy=x.anisotropy)}}function Ae(A,x){let W=!1;A.__webglInit===void 0&&(A.__webglInit=!0,x.addEventListener("dispose",O));const ne=x.source;let Q=h.get(ne);Q===void 0&&(Q={},h.set(ne,Q));const ie=V(x);if(ie!==A.__cacheKey){Q[ie]===void 0&&(Q[ie]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,W=!0),Q[ie].usedTimes++;const ve=Q[A.__cacheKey];ve!==void 0&&(Q[A.__cacheKey].usedTimes--,ve.usedTimes===0&&I(x)),A.__cacheKey=ie,A.__webglTexture=Q[ie].texture}return W}function be(A,x,W){let ne=n.TEXTURE_2D;(x.isDataArrayTexture||x.isCompressedArrayTexture)&&(ne=n.TEXTURE_2D_ARRAY),x.isData3DTexture&&(ne=n.TEXTURE_3D);const Q=Ae(A,x),ie=x.source;t.bindTexture(ne,A.__webglTexture,n.TEXTURE0+W);const ve=i.get(ie);if(ie.version!==ve.__version||Q===!0){t.activeTexture(n.TEXTURE0+W);const oe=tt.getPrimaries(tt.workingColorSpace),he=x.colorSpace===Qt?null:tt.getPrimaries(x.colorSpace),Le=x.colorSpace===Qt||oe===he?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,x.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,x.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Le);const Ke=R(x)&&M(x.image)===!1;let te=v(x.image,Ke,!1,u);te=Tt(x,te);const et=M(te)||o,Ne=s.convert(x.format,x.colorSpace);let Pe=s.convert(x.type),Se=P(x.internalFormat,Ne,Pe,x.colorSpace,x.isVideoTexture);De(ne,x,et);let me;const $e=x.mipmaps,U=o&&x.isVideoTexture!==!0,ue=ve.__version===void 0||Q===!0,re=S(x,te,et);if(x.isDepthTexture)Se=n.DEPTH_COMPONENT,o?x.type===ii?Se=n.DEPTH_COMPONENT32F:x.type===ni?Se=n.DEPTH_COMPONENT24:x.type===Ti?Se=n.DEPTH24_STENCIL8:Se=n.DEPTH_COMPONENT16:x.type===ii&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),x.format===wi&&Se===n.DEPTH_COMPONENT&&x.type!==wc&&x.type!==ni&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),x.type=ni,Pe=s.convert(x.type)),x.format===hr&&Se===n.DEPTH_COMPONENT&&(Se=n.DEPTH_STENCIL,x.type!==Ti&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),x.type=Ti,Pe=s.convert(x.type))),ue&&(U?t.texStorage2D(n.TEXTURE_2D,1,Se,te.width,te.height):t.texImage2D(n.TEXTURE_2D,0,Se,te.width,te.height,0,Ne,Pe,null));else if(x.isDataTexture)if($e.length>0&&et){U&&ue&&t.texStorage2D(n.TEXTURE_2D,re,Se,$e[0].width,$e[0].height);for(let Y=0,se=$e.length;Y>=1,se>>=1}}else if($e.length>0&&et){U&&ue&&t.texStorage2D(n.TEXTURE_2D,re,Se,$e[0].width,$e[0].height);for(let Y=0,se=$e.length;Y0&&ue++,t.texStorage2D(n.TEXTURE_CUBE_MAP,ue,me,te[0].width,te[0].height));for(let Y=0;Y<6;Y++)if(Ke){$e?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,0,0,te[Y].width,te[Y].height,Pe,Se,te[Y].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,me,te[Y].width,te[Y].height,0,Pe,Se,te[Y].data);for(let se=0;se>ie),te=Math.max(1,x.height>>ie);Q===n.TEXTURE_3D||Q===n.TEXTURE_2D_ARRAY?t.texImage3D(Q,ie,he,Ke,te,x.depth,0,ve,oe,null):t.texImage2D(Q,ie,he,Ke,te,0,ve,oe,null)}t.bindFramebuffer(n.FRAMEBUFFER,A),nt(x)?p.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,ne,Q,i.get(W).__webglTexture,0,We(x)):(Q===n.TEXTURE_2D||Q>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&Q<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,ne,Q,i.get(W).__webglTexture,ie),t.bindFramebuffer(n.FRAMEBUFFER,null)}function z(A,x,W){if(n.bindRenderbuffer(n.RENDERBUFFER,A),x.depthBuffer&&!x.stencilBuffer){let ne=o===!0?n.DEPTH_COMPONENT24:n.DEPTH_COMPONENT16;if(W||nt(x)){const Q=x.depthTexture;Q&&Q.isDepthTexture&&(Q.type===ii?ne=n.DEPTH_COMPONENT32F:Q.type===ni&&(ne=n.DEPTH_COMPONENT24));const ie=We(x);nt(x)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ie,ne,x.width,x.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,ie,ne,x.width,x.height)}else n.renderbufferStorage(n.RENDERBUFFER,ne,x.width,x.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,A)}else if(x.depthBuffer&&x.stencilBuffer){const ne=We(x);W&&nt(x)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,ne,n.DEPTH24_STENCIL8,x.width,x.height):nt(x)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ne,n.DEPTH24_STENCIL8,x.width,x.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,x.width,x.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,A)}else{const ne=x.isWebGLMultipleRenderTargets===!0?x.texture:[x.texture];for(let Q=0;Q0){W.__webglFramebuffer[oe]=[];for(let he=0;he0){W.__webglFramebuffer=[];for(let oe=0;oe0&&nt(A)===!1){const oe=ie?x:[x];W.__webglMultisampledFramebuffer=n.createFramebuffer(),W.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,W.__webglMultisampledFramebuffer);for(let he=0;he0)for(let he=0;he0)for(let he=0;he0&&nt(A)===!1){const x=A.isWebGLMultipleRenderTargets?A.texture:[A.texture],W=A.width,ne=A.height;let Q=n.COLOR_BUFFER_BIT;const ie=[],ve=A.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,oe=i.get(A),he=A.isWebGLMultipleRenderTargets===!0;if(he)for(let Le=0;Le0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&x.__useRenderToTexture!==!1}function yt(A){const x=a.render.frame;_.get(A)!==x&&(_.set(A,x),A.update())}function Tt(A,x){const W=A.colorSpace,ne=A.format,Q=A.type;return A.isCompressedTexture===!0||A.isVideoTexture===!0||A.format===Zo||W!==Gn&&W!==Qt&&(tt.getTransfer(W)===st?o===!1?e.has("EXT_sRGB")===!0&&ne===fn?(A.format=Zo,A.minFilter=Jt,A.generateMipmaps=!1):x=Xd.sRGBToLinear(x):(ne!==fn||Q!==ai)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",W)),x}this.allocateTextureUnit=q,this.resetTextureUnits=D,this.setTexture2D=H,this.setTexture2DArray=N,this.setTexture3D=G,this.setTextureCube=ee,this.rebindTextures=Ce,this.setupRenderTarget=Re,this.updateRenderTargetMipmap=ct,this.updateMultisampleRenderTarget=Ge,this.setupDepthRenderbuffer=ge,this.setupFrameBufferTexture=Fe,this.useMultisampledRTT=nt}function bv(n,e,t){const i=t.isWebGL2;function r(s,a=Qt){let o;const c=tt.getTransfer(a);if(s===ai)return n.UNSIGNED_BYTE;if(s===Bd)return n.UNSIGNED_SHORT_4_4_4_4;if(s===Fd)return n.UNSIGNED_SHORT_5_5_5_1;if(s===sp)return n.BYTE;if(s===ap)return n.SHORT;if(s===wc)return n.UNSIGNED_SHORT;if(s===Od)return n.INT;if(s===ni)return n.UNSIGNED_INT;if(s===ii)return n.FLOAT;if(s===qr)return i?n.HALF_FLOAT:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(s===op)return n.ALPHA;if(s===fn)return n.RGBA;if(s===cp)return n.LUMINANCE;if(s===lp)return n.LUMINANCE_ALPHA;if(s===wi)return n.DEPTH_COMPONENT;if(s===hr)return n.DEPTH_STENCIL;if(s===Zo)return o=e.get("EXT_sRGB"),o!==null?o.SRGB_ALPHA_EXT:null;if(s===up)return n.RED;if(s===kd)return n.RED_INTEGER;if(s===dp)return n.RG;if(s===zd)return n.RG_INTEGER;if(s===Hd)return n.RGBA_INTEGER;if(s===Ya||s===Ka||s===Ja||s===Qa)if(c===st)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(s===Ya)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Ka)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===Ja)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Qa)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(s===Ya)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Ka)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Ja)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Qa)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===pl||s===ml||s===gl||s===_l)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(s===pl)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===ml)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===gl)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===_l)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===fp)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===vl||s===yl)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(s===vl)return c===st?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(s===yl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===xl||s===Sl||s===El||s===bl||s===Ml||s===Tl||s===wl||s===Al||s===Rl||s===Cl||s===Ll||s===Pl||s===Il||s===Dl)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(s===xl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Sl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===El)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===bl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Ml)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Tl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===wl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Al)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Rl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Cl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Ll)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Pl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===Il)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===Dl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===eo||s===Ul||s===Nl)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(s===eo)return c===st?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===Ul)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===Nl)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===hp||s===Ol||s===Bl||s===Fl)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(s===eo)return o.COMPRESSED_RED_RGTC1_EXT;if(s===Ol)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Bl)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===Fl)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Ti?i?n.UNSIGNED_INT_24_8:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:r}}class Mv extends Wt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Br extends Ft{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Tv={type:"move"};class wo{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Br,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Br,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new F,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new F),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Br,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new F,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new F),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null;const o=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(const m of e.hand.values()){const h=t.getJointPose(m,i),f=this._getHandJoint(l,m);h!==null&&(f.matrix.fromArray(h.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=h.radius),f.visible=h!==null}const u=l.joints["index-finger-tip"],d=l.joints["thumb-tip"],p=u.position.distanceTo(d.position),g=.02,_=.005;l.inputState.pinching&&p>g+_?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&p<=g-_&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Tv)))}return o!==null&&(o.visible=r!==null),c!==null&&(c.visible=s!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Br;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class wv extends Xt{constructor(e,t,i,r,s,a,o,c,l,u){if(u=u!==void 0?u:wi,u!==wi&&u!==hr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===wi&&(i=ni),i===void 0&&u===hr&&(i=Ti),super(null,r,s,a,o,c,u,i,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:It,this.minFilter=c!==void 0?c:It,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Av extends br{constructor(e,t){super();const i=this;let r=null,s=1,a=null,o="local-floor",c=1,l=null,u=null,d=null,p=null,g=null,_=null;const m=t.getContextAttributes();let h=null,f=null;const b=[],v=[],M=new Wt;M.layers.enable(1),M.viewport=new at;const R=new Wt;R.layers.enable(2),R.viewport=new at;const L=[M,R],C=new Mv;C.layers.enable(1),C.layers.enable(2);let P=null,S=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(N){let G=b[N];return G===void 0&&(G=new wo,b[N]=G),G.getTargetRaySpace()},this.getControllerGrip=function(N){let G=b[N];return G===void 0&&(G=new wo,b[N]=G),G.getGripSpace()},this.getHand=function(N){let G=b[N];return G===void 0&&(G=new wo,b[N]=G),G.getHandSpace()};function E(N){const G=v.indexOf(N.inputSource);if(G===-1)return;const ee=b[G];ee!==void 0&&(ee.update(N.inputSource,N.frame,l||a),ee.dispatchEvent({type:N.type,data:N.inputSource}))}function O(){r.removeEventListener("select",E),r.removeEventListener("selectstart",E),r.removeEventListener("selectend",E),r.removeEventListener("squeeze",E),r.removeEventListener("squeezestart",E),r.removeEventListener("squeezeend",E),r.removeEventListener("end",O),r.removeEventListener("inputsourceschange",k);for(let N=0;N=0&&(v[ae]=null,b[ae].disconnect(ee))}for(let G=0;G=v.length){v.push(ee),ae=xe;break}else if(v[xe]===null){v[xe]=ee,ae=xe;break}if(ae===-1)break}const fe=b[ae];fe&&fe.connect(ee)}}const Z=new F,I=new F;function y(N,G,ee){Z.setFromMatrixPosition(G.matrixWorld),I.setFromMatrixPosition(ee.matrixWorld);const ae=Z.distanceTo(I),fe=G.projectionMatrix.elements,xe=ee.projectionMatrix.elements,De=fe[14]/(fe[10]-1),Ae=fe[14]/(fe[10]+1),be=(fe[9]+1)/fe[5],Qe=(fe[9]-1)/fe[5],Fe=(fe[8]-1)/fe[0],z=(xe[8]+1)/xe[0],rt=De*Fe,ge=De*z,Ce=ae/(-Fe+z),Re=Ce*-Fe;G.matrixWorld.decompose(N.position,N.quaternion,N.scale),N.translateX(Re),N.translateZ(Ce),N.matrixWorld.compose(N.position,N.quaternion,N.scale),N.matrixWorldInverse.copy(N.matrixWorld).invert();const ct=De+Ce,Ge=Ae+Ce,We=rt-Re,nt=ge+(ae-Re),yt=be*Ae/Ge*ct,Tt=Qe*Ae/Ge*ct;N.projectionMatrix.makePerspective(We,nt,yt,Tt,ct,Ge),N.projectionMatrixInverse.copy(N.projectionMatrix).invert()}function w(N,G){G===null?N.matrixWorld.copy(N.matrix):N.matrixWorld.multiplyMatrices(G.matrixWorld,N.matrix),N.matrixWorldInverse.copy(N.matrixWorld).invert()}this.updateCamera=function(N){if(r===null)return;C.near=R.near=M.near=N.near,C.far=R.far=M.far=N.far,(P!==C.near||S!==C.far)&&(r.updateRenderState({depthNear:C.near,depthFar:C.far}),P=C.near,S=C.far);const G=N.parent,ee=C.cameras;w(C,G);for(let ae=0;ae0&&(h.alphaTest.value=f.alphaTest);const b=e.get(f).envMap;if(b&&(h.envMap.value=b,h.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,h.reflectivity.value=f.reflectivity,h.ior.value=f.ior,h.refractionRatio.value=f.refractionRatio),f.lightMap){h.lightMap.value=f.lightMap;const v=n._useLegacyLights===!0?Math.PI:1;h.lightMapIntensity.value=f.lightMapIntensity*v,t(f.lightMap,h.lightMapTransform)}f.aoMap&&(h.aoMap.value=f.aoMap,h.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,h.aoMapTransform))}function a(h,f){h.diffuse.value.copy(f.color),h.opacity.value=f.opacity,f.map&&(h.map.value=f.map,t(f.map,h.mapTransform))}function o(h,f){h.dashSize.value=f.dashSize,h.totalSize.value=f.dashSize+f.gapSize,h.scale.value=f.scale}function c(h,f,b,v){h.diffuse.value.copy(f.color),h.opacity.value=f.opacity,h.size.value=f.size*b,h.scale.value=v*.5,f.map&&(h.map.value=f.map,t(f.map,h.uvTransform)),f.alphaMap&&(h.alphaMap.value=f.alphaMap,t(f.alphaMap,h.alphaMapTransform)),f.alphaTest>0&&(h.alphaTest.value=f.alphaTest)}function l(h,f){h.diffuse.value.copy(f.color),h.opacity.value=f.opacity,h.rotation.value=f.rotation,f.map&&(h.map.value=f.map,t(f.map,h.mapTransform)),f.alphaMap&&(h.alphaMap.value=f.alphaMap,t(f.alphaMap,h.alphaMapTransform)),f.alphaTest>0&&(h.alphaTest.value=f.alphaTest)}function u(h,f){h.specular.value.copy(f.specular),h.shininess.value=Math.max(f.shininess,1e-4)}function d(h,f){f.gradientMap&&(h.gradientMap.value=f.gradientMap)}function p(h,f){h.metalness.value=f.metalness,f.metalnessMap&&(h.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,h.metalnessMapTransform)),h.roughness.value=f.roughness,f.roughnessMap&&(h.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,h.roughnessMapTransform)),e.get(f).envMap&&(h.envMapIntensity.value=f.envMapIntensity)}function g(h,f,b){h.ior.value=f.ior,f.sheen>0&&(h.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),h.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(h.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,h.sheenColorMapTransform)),f.sheenRoughnessMap&&(h.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,h.sheenRoughnessMapTransform))),f.clearcoat>0&&(h.clearcoat.value=f.clearcoat,h.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(h.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,h.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(h.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,h.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(h.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,h.clearcoatNormalMapTransform),h.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Bt&&h.clearcoatNormalScale.value.negate())),f.iridescence>0&&(h.iridescence.value=f.iridescence,h.iridescenceIOR.value=f.iridescenceIOR,h.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],h.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(h.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,h.iridescenceMapTransform)),f.iridescenceThicknessMap&&(h.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,h.iridescenceThicknessMapTransform))),f.transmission>0&&(h.transmission.value=f.transmission,h.transmissionSamplerMap.value=b.texture,h.transmissionSamplerSize.value.set(b.width,b.height),f.transmissionMap&&(h.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,h.transmissionMapTransform)),h.thickness.value=f.thickness,f.thicknessMap&&(h.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,h.thicknessMapTransform)),h.attenuationDistance.value=f.attenuationDistance,h.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(h.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(h.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,h.anisotropyMapTransform))),h.specularIntensity.value=f.specularIntensity,h.specularColor.value.copy(f.specularColor),f.specularColorMap&&(h.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,h.specularColorMapTransform)),f.specularIntensityMap&&(h.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,h.specularIntensityMapTransform))}function _(h,f){f.matcap&&(h.matcap.value=f.matcap)}function m(h,f){const b=e.get(f).light;h.referencePosition.value.setFromMatrixPosition(b.matrixWorld),h.nearDistance.value=b.shadow.camera.near,h.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function Cv(n,e,t,i){let r={},s={},a=[];const o=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function c(b,v){const M=v.program;i.uniformBlockBinding(b,M)}function l(b,v){let M=r[b.id];M===void 0&&(_(b),M=u(b),r[b.id]=M,b.addEventListener("dispose",h));const R=v.program;i.updateUBOMapping(b,R);const L=e.render.frame;s[b.id]!==L&&(p(b),s[b.id]=L)}function u(b){const v=d();b.__bindingPointIndex=v;const M=n.createBuffer(),R=b.__size,L=b.usage;return n.bindBuffer(n.UNIFORM_BUFFER,M),n.bufferData(n.UNIFORM_BUFFER,R,L),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,v,M),M}function d(){for(let b=0;b0){L=M%R;const k=R-L;L!==0&&k-E.boundary<0&&(M+=R-L,S.__offset=M)}M+=E.storage}return L=M%R,L>0&&(M+=R-L),b.__size=M,b.__cache={},this}function m(b){const v={boundary:0,storage:0};return typeof b=="number"?(v.boundary=4,v.storage=4):b.isVector2?(v.boundary=8,v.storage=8):b.isVector3||b.isColor?(v.boundary=16,v.storage=12):b.isVector4?(v.boundary=16,v.storage=16):b.isMatrix3?(v.boundary=48,v.storage=48):b.isMatrix4?(v.boundary=64,v.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),v}function h(b){const v=b.target;v.removeEventListener("dispose",h);const M=a.indexOf(v.__bindingPointIndex);a.splice(M,1),n.deleteBuffer(r[v.id]),delete r[v.id],delete s[v.id]}function f(){for(const b in r)n.deleteBuffer(r[b]);a=[],r={},s={}}return{bind:c,update:l,dispose:f}}class cf{constructor(e={}){const{canvas:t=wp(),context:i=null,depth:r=!0,stencil:s=!0,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let p;i!==null?p=i.getContextAttributes().alpha:p=a;const g=new Uint32Array(4),_=new Int32Array(4);let m=null,h=null;const f=[],b=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Mt,this._useLegacyLights=!1,this.toneMapping=si,this.toneMappingExposure=1;const v=this;let M=!1,R=0,L=0,C=null,P=-1,S=null;const E=new at,O=new at;let k=null;const Z=new Ue(0);let I=0,y=t.width,w=t.height,D=1,q=null,V=null;const H=new at(0,0,y,w),N=new at(0,0,y,w);let G=!1;const ee=new Lc;let ae=!1,fe=!1,xe=null;const De=new mt,Ae=new je,be=new F,Qe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Fe(){return C===null?D:1}let z=i;function rt(T,B){for(let X=0;X{function pe(){if(j.forEach(function(ye){Ge.get(ye).currentProgram.isReady()&&j.delete(ye)}),j.size===0){$(T);return}setTimeout(pe,10)}ge.get("KHR_parallel_shader_compile")!==null?pe():setTimeout(pe,10)})};let Je=null;function ft(T){Je&&Je(T)}function jt(){Ct.stop()}function it(){Ct.start()}const Ct=new nf;Ct.setAnimationLoop(ft),typeof self<"u"&&Ct.setContext(self),this.setAnimationLoop=function(T){Je=T,me.setAnimationLoop(T),T===null?Ct.stop():Ct.start()},me.addEventListener("sessionstart",jt),me.addEventListener("sessionend",it),this.render=function(T,B){if(B!==void 0&&B.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(M===!0)return;T.matrixWorldAutoUpdate===!0&&T.updateMatrixWorld(),B.parent===null&&B.matrixWorldAutoUpdate===!0&&B.updateMatrixWorld(),me.enabled===!0&&me.isPresenting===!0&&(me.cameraAutoUpdate===!0&&me.updateCamera(B),B=me.getCamera()),T.isScene===!0&&T.onBeforeRender(v,T,B,C),h=ie.get(T,b.length),h.init(),b.push(h),De.multiplyMatrices(B.projectionMatrix,B.matrixWorldInverse),ee.setFromProjectionMatrix(De),fe=this.localClippingEnabled,ae=ve.init(this.clippingPlanes,fe),m=Q.get(T,f.length),m.init(),f.push(m),gn(T,B,0,v.sortObjects),m.finish(),v.sortObjects===!0&&m.sort(q,V),this.info.render.frame++,ae===!0&&ve.beginShadows();const X=h.state.shadowsArray;if(oe.render(X,T,B),ae===!0&&ve.endShadows(),this.info.autoReset===!0&&this.info.reset(),he.render(m,T),h.setupLights(v._useLegacyLights),B.isArrayCamera){const j=B.cameras;for(let $=0,pe=j.length;$0?h=b[b.length-1]:h=null,f.pop(),f.length>0?m=f[f.length-1]:m=null};function gn(T,B,X,j){if(T.visible===!1)return;if(T.layers.test(B.layers)){if(T.isGroup)X=T.renderOrder;else if(T.isLOD)T.autoUpdate===!0&&T.update(B);else if(T.isLight)h.pushLight(T),T.castShadow&&h.pushShadow(T);else if(T.isSprite){if(!T.frustumCulled||ee.intersectsSprite(T)){j&&be.setFromMatrixPosition(T.matrixWorld).applyMatrix4(De);const ye=x.update(T),Te=T.material;Te.visible&&m.push(T,ye,Te,X,be.z,null)}}else if((T.isMesh||T.isLine||T.isPoints)&&(!T.frustumCulled||ee.intersectsObject(T))){const ye=x.update(T),Te=T.material;if(j&&(T.boundingSphere!==void 0?(T.boundingSphere===null&&T.computeBoundingSphere(),be.copy(T.boundingSphere.center)):(ye.boundingSphere===null&&ye.computeBoundingSphere(),be.copy(ye.boundingSphere.center)),be.applyMatrix4(T.matrixWorld).applyMatrix4(De)),Array.isArray(Te)){const Ie=ye.groups;for(let Ve=0,Oe=Ie.length;Ve0&&yh($,pe,B,X),j&&Re.viewport(E.copy(j)),$.length>0&&Ms($,B,X),pe.length>0&&Ms(pe,B,X),ye.length>0&&Ms(ye,B,X),Re.buffers.depth.setTest(!0),Re.buffers.depth.setMask(!0),Re.buffers.color.setMask(!0),Re.setPolygonOffset(!1)}function yh(T,B,X,j){if((X.isScene===!0?X.overrideMaterial:null)!==null)return;const pe=Ce.isWebGL2;xe===null&&(xe=new Ii(1,1,{generateMipmaps:!0,type:ge.has("EXT_color_buffer_half_float")?qr:ai,minFilter:Xr,samples:pe?4:0})),v.getDrawingBufferSize(Ae),pe?xe.setSize(Ae.x,Ae.y):xe.setSize(Ko(Ae.x),Ko(Ae.y));const ye=v.getRenderTarget();v.setRenderTarget(xe),v.getClearColor(Z),I=v.getClearAlpha(),I<1&&v.setClearColor(16777215,.5),v.clear();const Te=v.toneMapping;v.toneMapping=si,Ms(T,X,j),We.updateMultisampleRenderTarget(xe),We.updateRenderTargetMipmap(xe);let Ie=!1;for(let Ve=0,Oe=B.length;Ve0),ke=!!X.morphAttributes.position,ut=!!X.morphAttributes.normal,zt=!!X.morphAttributes.color;let xt=si;j.toneMapped&&(C===null||C.isXRRenderTarget===!0)&&(xt=v.toneMapping);const An=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,lt=An!==void 0?An.length:0,qe=Ge.get(j),Xa=h.state.lights;if(ae===!0&&(fe===!0||T!==S)){const Ht=T===S&&j.id===P;ve.setState(j,T,Ht)}let ht=!1;j.version===qe.__version?(qe.needsLights&&qe.lightsStateVersion!==Xa.state.version||qe.outputColorSpace!==Te||$.isInstancedMesh&&qe.instancing===!1||!$.isInstancedMesh&&qe.instancing===!0||$.isSkinnedMesh&&qe.skinning===!1||!$.isSkinnedMesh&&qe.skinning===!0||$.isInstancedMesh&&qe.instancingColor===!0&&$.instanceColor===null||$.isInstancedMesh&&qe.instancingColor===!1&&$.instanceColor!==null||qe.envMap!==Ie||j.fog===!0&&qe.fog!==pe||qe.numClippingPlanes!==void 0&&(qe.numClippingPlanes!==ve.numPlanes||qe.numIntersection!==ve.numIntersection)||qe.vertexAlphas!==Ve||qe.vertexTangents!==Oe||qe.morphTargets!==ke||qe.morphNormals!==ut||qe.morphColors!==zt||qe.toneMapping!==xt||Ce.isWebGL2===!0&&qe.morphTargetsCount!==lt)&&(ht=!0):(ht=!0,qe.__version=j.version);let fi=qe.currentProgram;ht===!0&&(fi=Ts(j,B,$));let sl=!1,Ar=!1,qa=!1;const Lt=fi.getUniforms(),hi=qe.uniforms;if(Re.useProgram(fi.program)&&(sl=!0,Ar=!0,qa=!0),j.id!==P&&(P=j.id,Ar=!0),sl||S!==T){Lt.setValue(z,"projectionMatrix",T.projectionMatrix),Lt.setValue(z,"viewMatrix",T.matrixWorldInverse);const Ht=Lt.map.cameraPosition;Ht!==void 0&&Ht.setValue(z,be.setFromMatrixPosition(T.matrixWorld)),Ce.logarithmicDepthBuffer&&Lt.setValue(z,"logDepthBufFC",2/(Math.log(T.far+1)/Math.LN2)),(j.isMeshPhongMaterial||j.isMeshToonMaterial||j.isMeshLambertMaterial||j.isMeshBasicMaterial||j.isMeshStandardMaterial||j.isShaderMaterial)&&Lt.setValue(z,"isOrthographic",T.isOrthographicCamera===!0),S!==T&&(S=T,Ar=!0,qa=!0)}if($.isSkinnedMesh){Lt.setOptional(z,$,"bindMatrix"),Lt.setOptional(z,$,"bindMatrixInverse");const Ht=$.skeleton;Ht&&(Ce.floatVertexTextures?(Ht.boneTexture===null&&Ht.computeBoneTexture(),Lt.setValue(z,"boneTexture",Ht.boneTexture,We),Lt.setValue(z,"boneTextureSize",Ht.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const ja=X.morphAttributes;if((ja.position!==void 0||ja.normal!==void 0||ja.color!==void 0&&Ce.isWebGL2===!0)&&Le.update($,X,fi),(Ar||qe.receiveShadow!==$.receiveShadow)&&(qe.receiveShadow=$.receiveShadow,Lt.setValue(z,"receiveShadow",$.receiveShadow)),j.isMeshGouraudMaterial&&j.envMap!==null&&(hi.envMap.value=Ie,hi.flipEnvMap.value=Ie.isCubeTexture&&Ie.isRenderTargetTexture===!1?-1:1),Ar&&(Lt.setValue(z,"toneMappingExposure",v.toneMappingExposure),qe.needsLights&&Sh(hi,qa),pe&&j.fog===!0&&ne.refreshFogUniforms(hi,pe),ne.refreshMaterialUniforms(hi,j,D,w,xe),na.upload(z,il(qe),hi,We)),j.isShaderMaterial&&j.uniformsNeedUpdate===!0&&(na.upload(z,il(qe),hi,We),j.uniformsNeedUpdate=!1),j.isSpriteMaterial&&Lt.setValue(z,"center",$.center),Lt.setValue(z,"modelViewMatrix",$.modelViewMatrix),Lt.setValue(z,"normalMatrix",$.normalMatrix),Lt.setValue(z,"modelMatrix",$.matrixWorld),j.isShaderMaterial||j.isRawShaderMaterial){const Ht=j.uniformsGroups;for(let $a=0,bh=Ht.length;$a0&&We.useMultisampledRTT(T)===!1?$=Ge.get(T).__webglMultisampledFramebuffer:Array.isArray(Oe)?$=Oe[X]:$=Oe,E.copy(T.viewport),O.copy(T.scissor),k=T.scissorTest}else E.copy(H).multiplyScalar(D).floor(),O.copy(N).multiplyScalar(D).floor(),k=G;if(Re.bindFramebuffer(z.FRAMEBUFFER,$)&&Ce.drawBuffers&&j&&Re.drawBuffers(T,$),Re.viewport(E),Re.scissor(O),Re.setScissorTest(k),pe){const Ie=Ge.get(T.texture);z.framebufferTexture2D(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_CUBE_MAP_POSITIVE_X+B,Ie.__webglTexture,X)}else if(ye){const Ie=Ge.get(T.texture),Ve=B||0;z.framebufferTextureLayer(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,Ie.__webglTexture,X||0,Ve)}P=-1},this.readRenderTargetPixels=function(T,B,X,j,$,pe,ye){if(!(T&&T.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Te=Ge.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&ye!==void 0&&(Te=Te[ye]),Te){Re.bindFramebuffer(z.FRAMEBUFFER,Te);try{const Ie=T.texture,Ve=Ie.format,Oe=Ie.type;if(Ve!==fn&&et.convert(Ve)!==z.getParameter(z.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ke=Oe===qr&&(ge.has("EXT_color_buffer_half_float")||Ce.isWebGL2&&ge.has("EXT_color_buffer_float"));if(Oe!==ai&&et.convert(Oe)!==z.getParameter(z.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Oe===ii&&(Ce.isWebGL2||ge.has("OES_texture_float")||ge.has("WEBGL_color_buffer_float")))&&!ke){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}B>=0&&B<=T.width-j&&X>=0&&X<=T.height-$&&z.readPixels(B,X,j,$,et.convert(Ve),et.convert(Oe),pe)}finally{const Ie=C!==null?Ge.get(C).__webglFramebuffer:null;Re.bindFramebuffer(z.FRAMEBUFFER,Ie)}}},this.copyFramebufferToTexture=function(T,B,X=0){const j=Math.pow(2,-X),$=Math.floor(B.image.width*j),pe=Math.floor(B.image.height*j);We.setTexture2D(B,0),z.copyTexSubImage2D(z.TEXTURE_2D,X,0,0,T.x,T.y,$,pe),Re.unbindTexture()},this.copyTextureToTexture=function(T,B,X,j=0){const $=B.image.width,pe=B.image.height,ye=et.convert(X.format),Te=et.convert(X.type);We.setTexture2D(X,0),z.pixelStorei(z.UNPACK_FLIP_Y_WEBGL,X.flipY),z.pixelStorei(z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),z.pixelStorei(z.UNPACK_ALIGNMENT,X.unpackAlignment),B.isDataTexture?z.texSubImage2D(z.TEXTURE_2D,j,T.x,T.y,$,pe,ye,Te,B.image.data):B.isCompressedTexture?z.compressedTexSubImage2D(z.TEXTURE_2D,j,T.x,T.y,B.mipmaps[0].width,B.mipmaps[0].height,ye,B.mipmaps[0].data):z.texSubImage2D(z.TEXTURE_2D,j,T.x,T.y,ye,Te,B.image),j===0&&X.generateMipmaps&&z.generateMipmap(z.TEXTURE_2D),Re.unbindTexture()},this.copyTextureToTexture3D=function(T,B,X,j,$=0){if(v.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const pe=T.max.x-T.min.x+1,ye=T.max.y-T.min.y+1,Te=T.max.z-T.min.z+1,Ie=et.convert(j.format),Ve=et.convert(j.type);let Oe;if(j.isData3DTexture)We.setTexture3D(j,0),Oe=z.TEXTURE_3D;else if(j.isDataArrayTexture)We.setTexture2DArray(j,0),Oe=z.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}z.pixelStorei(z.UNPACK_FLIP_Y_WEBGL,j.flipY),z.pixelStorei(z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,j.premultiplyAlpha),z.pixelStorei(z.UNPACK_ALIGNMENT,j.unpackAlignment);const ke=z.getParameter(z.UNPACK_ROW_LENGTH),ut=z.getParameter(z.UNPACK_IMAGE_HEIGHT),zt=z.getParameter(z.UNPACK_SKIP_PIXELS),xt=z.getParameter(z.UNPACK_SKIP_ROWS),An=z.getParameter(z.UNPACK_SKIP_IMAGES),lt=X.isCompressedTexture?X.mipmaps[0]:X.image;z.pixelStorei(z.UNPACK_ROW_LENGTH,lt.width),z.pixelStorei(z.UNPACK_IMAGE_HEIGHT,lt.height),z.pixelStorei(z.UNPACK_SKIP_PIXELS,T.min.x),z.pixelStorei(z.UNPACK_SKIP_ROWS,T.min.y),z.pixelStorei(z.UNPACK_SKIP_IMAGES,T.min.z),X.isDataTexture||X.isData3DTexture?z.texSubImage3D(Oe,$,B.x,B.y,B.z,pe,ye,Te,Ie,Ve,lt.data):X.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),z.compressedTexSubImage3D(Oe,$,B.x,B.y,B.z,pe,ye,Te,Ie,lt.data)):z.texSubImage3D(Oe,$,B.x,B.y,B.z,pe,ye,Te,Ie,Ve,lt),z.pixelStorei(z.UNPACK_ROW_LENGTH,ke),z.pixelStorei(z.UNPACK_IMAGE_HEIGHT,ut),z.pixelStorei(z.UNPACK_SKIP_PIXELS,zt),z.pixelStorei(z.UNPACK_SKIP_ROWS,xt),z.pixelStorei(z.UNPACK_SKIP_IMAGES,An),$===0&&j.generateMipmaps&&z.generateMipmap(Oe),Re.unbindTexture()},this.initTexture=function(T){T.isCubeTexture?We.setTextureCube(T,0):T.isData3DTexture?We.setTexture3D(T,0):T.isDataArrayTexture||T.isCompressedArrayTexture?We.setTexture2DArray(T,0):We.setTexture2D(T,0),Re.unbindTexture()},this.resetState=function(){R=0,L=0,C=null,Re.reset(),Ne.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return zn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Ac?"display-p3":"srgb",t.unpackColorSpace=tt.workingColorSpace===Ua?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===Mt?Ai:Vd}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Ai?Mt:Gn}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class Lv extends cf{}Lv.prototype.isWebGL1Renderer=!0;class Pv extends Ft{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}class Iv extends _s{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ue(16777215),this.specular=new Ue(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ue(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Gd,this.normalScale=new je(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Tc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class lf extends Ft{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ue(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}const Ao=new mt,Au=new F,Ru=new F;class Dv{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new je(512,512),this.map=null,this.mapPass=null,this.matrix=new mt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Lc,this._frameExtents=new je(1,1),this._viewportCount=1,this._viewports=[new at(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;Au.setFromMatrixPosition(e.matrixWorld),t.position.copy(Au),Ru.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Ru),t.updateMatrixWorld(),Ao.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ao),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(Ao)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const Cu=new mt,Dr=new F,Ro=new F;class Uv extends Dv{constructor(){super(new Wt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new je(4,2),this._viewportCount=6,this._viewports=[new at(2,1,1,1),new at(0,1,1,1),new at(3,1,1,1),new at(1,1,1,1),new at(3,0,1,1),new at(1,0,1,1)],this._cubeDirections=[new F(1,0,0),new F(-1,0,0),new F(0,0,1),new F(0,0,-1),new F(0,1,0),new F(0,-1,0)],this._cubeUps=[new F(0,1,0),new F(0,1,0),new F(0,1,0),new F(0,1,0),new F(0,0,1),new F(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),Dr.setFromMatrixPosition(e.matrixWorld),i.position.copy(Dr),Ro.copy(i.position),Ro.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(Ro),i.updateMatrixWorld(),r.makeTranslation(-Dr.x,-Dr.y,-Dr.z),Cu.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Cu)}}class da extends lf{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new Uv}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Nv extends lf{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Ov{constructor(e,t,i=0,r=1/0){this.ray=new $d(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new Cc,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,i=[]){return Qo(e,this,i,t),i.sort(Lu),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r{t.setSize(window.innerWidth,window.innerHeight),e.aspect=window.innerWidth/window.innerHeight,e.updateProjectionMatrix()}),{scene:n,camera:e,renderer:t,lights:i}}const Du=[new Ue(0,.7,.6),new Ue(1,1,1)],zv=[new Ue(.3,.3,.3),new Ue(.5,.5,0),new Ue(1,0,0)],Hv=new Ue(.8,.2,.8),Uu=new Ue(.2,1,.5),Qn=1,tr=.3,ei=.2,Vv=2,Gv=.1,Wv=.04;class Xv{constructor(e,t){this.nodes=new Map,this.transactions=new Map,this.addressCount=0,this.loadedBlocks=new Map,this.loadingBlocks=new Map,this.loadedBars=new Map,this.blocksToClear=[],this.scene=e,this.blocks=[],this.canDrag=!0,this.canHover=!0,this.displayFrom,this.displayTo,this.displayAmount,this.maxRange=0,this.nodeArray,this.toggleSort=0,this.toggleScale=0,this.isLoaded=!1,this.dataToLoad,this.tempBlocks=[],this.viewTransitioning=!1,this.camera=t,this.allTimeMax=.01,this.allTimeMaxNumTrans=1,this.allTimeMaxBar=.01,this.allTimeMaxNumTransBar=1,this.symmetrical=!1,this.dataType=0}addNode(e){this.nodes.set(e,new qv(e))}addTransaction(e,t,i,r){let s=this.nodes.get(e),a=this.nodes.get(t);s.addTransactionIn(a,i,r),a.addTransactionOut(s,i,r);let o=[t,e].toString();if(this.transactions.get(o)||this.transactions.set(o,[]),this.transactions.get(o).push({amount:i,time:r}),this.symmetrical){a.addTransactionIn(s,i,r),s.addTransactionOut(a,i,r);let u=[e,t].toString();this.transactions.get(u)||this.transactions.set(u,[]),this.transactions.get(u).push({amount:i,time:r})}let c=0,l=0;this.transactions.get(o).forEach(u=>{c+=u.amount,l+=1}),c>this.allTimeMax&&(this.allTimeMax=c),l>this.allTimeMaxNumTrans&&(this.allTimeMaxNumTrans=l),s.totalTransactionsValueOut>this.allTimeMaxBar&&(this.allTimeMaxBar=s.totalTransactionsValueOut),a.totalTransactionsValueOut>this.allTimeMaxBar&&(this.allTimeMaxBar=a.totalTransactionsValueOut),s.numTransactionsOut>this.allTimeMaxNumTransBar&&(this.allTimeMaxNumTransBar=s.numTransactionsOut),a.numTransactionsOut>this.allTimeMaxNumTransBar&&(this.allTimeMaxNumTransBar=a.numTransactionsOut)}getTransactions(e,t){let i=this.transactions.get([e,t].toString());return i||[]}getTransactionsValue(e,t){let i=this.transactions.get([e,t].toString());if(i){let r=0;return i.forEach(s=>r+=s.amount),r}else return 0}getTotalNumTransactions(e,t){let i=this.transactions.get([e,t].toString());return i?i.length:0}compareNodeNumTransactions(e,t){return t.node.numTransactionsOut-e.node.numTransactionsOut}compareNodeTotals(e,t){return t.node.totalTransactionsValueOut-e.node.totalTransactionsValueOut}compareLargestTransaction(e,t){return Math.max(t.node.largestTransactionOut,t.node.largestTransactionIn)-Math.max(e.node.largestTransactionOut,e.node.largestTransactionIn)}loadData(e,t=-1,i=-1){this.dataToLoad=e,this.isLoaded=!1}loadDataHelper(e,t=-1,i=-1){this.allTimeMax=.01,this.allTimeMaxNumTrans=1,this.allTimeMaxBar=.01,this.allTimeMaxNumTransBar=1;let r=e.transactions;e.nodes.forEach(s=>this.addNode(s)),r.forEach(s=>{this.nodes.get(s.from)&&this.nodes.get(s.to)?this.addTransaction(s.from,s.to,Number(s.amount),s.timestamp):console.log("failed to add transaction")}),this.nodeArray=Array.from(this.nodes,([s,a])=>({id:s,node:a})),this.toggleSort==0?this.nodeArray.sort(this.compareNodeTotals):this.toggleSort==1?this.nodeArray.sort(this.compareNodeNumTransactions):this.toggleSort==2?this.nodeArray.sort(this.compareLargestTransaction):console.log("Sorting method unrecognized:",this.toggleSort),this.isLoaded=!0}loadBlocks(e,t,i,r=!1){if(!this.isLoaded)return;let s=e+i=this.allTimeMax,this.scene.add(_.getCube()),this.loadedBlocks.set([o,c].toString(),_),this.loadingBlocks.set([o,c].toString(),_),this.blocks.push(_)}}createTempBlocks(){}clearTempBlocks(){}unloadBlocks(e,t,i){if(!this.isLoaded)return;let r=e+i({key:p,value:g})).forEach(p=>{p.value.forEach(g=>{s+=g.amount,a+=1,o.push({to:p.key,amount:g.amount,time:g.time})})});let l=this.toggleSort==1?a:s,u=this.toggleSort==1?this.allTimeMaxNumTransBar:this.allTimeMaxBar,d=new Nu(this.nodeArray[r].id,null,o,l,u);d.setPosition(r*(Qn+tr),0*(Qn+tr)),d.pos=[r,0],this.scene.add(d.getCube()),this.loadedBlocks.set([r,0].toString(),d),this.loadingBlocks.set([r,0].toString(),d),this.blocks.push(d)}}getBlocks(){return this.blocks}clearBlocks(){for(let e=0;e0){this.blocksToClear.forEach(e=>{this.scene.remove(e.getCube())});for(let e=0;e0&&(t.getCube().material.opacity-=.01)}}else this.clearing=!1,this.blocks=[],this.loadedBlocks=new Map}clearData(){for(let e=0;e({key:t,val:i})).forEach(t=>{let i=t.val,r=i.pos[1];i.getCube().material.opacity=3-.2*r})}update(){if(this.isLoaded){let e=Array.from(this.loadingBlocks,([t,i])=>({key:t,val:i}));e.length>0,e.forEach(t=>{let i=t.val,r=i.yScale+(i.finalScale-i.yScale)*.1;i.getCube().material.opacity<=1&&(i.getCube().material.opacity+=.05),i.yScale=1&&(i.getCube().material.opacity=1,this.loadingBlocks.delete(t.key.toString()))}),e.length==0&&this.clearTempBlocks()}else{let e=Array.from(this.loadedBlocks,([t,i])=>({key:t,val:i}));e.forEach(t=>{let i=t.val,r=ei+(i.yScale-ei)*.9;i.getCube().material.opacity>0&&(i.getCube().material.opacity-=Wv),i.yScale>ei&&(i.getCube().geometry.scale(1,1/i.yScale,1),r-.1{r+=s.amount}),r>this.largestTransactionOut&&(this.largestTransactionOut=r)}addTransactionIn(e,t,i=0){this.transactionsIn.get(e.id)||this.transactionsIn.set(e.id,[]),this.transactionsIn.get(e.id).push({amount:t,time:i}),this.numTransactionsIn+=1,this.totalTransactionsValueIn+=t;let r=0;this.transactionsIn.get(e.id).forEach(s=>{r+=s.amount}),r>this.largestTransactionIn&&(this.largestTransactionIn=r)}}class uf{constructor(e,t){this.name=e,this.domParent=t,this.div=document.createElement("div"),this.div.id=e.replaceAll(" ","-")+"-div",this.div.classList.add("elementDiv"),this.id=e.replaceAll(" ","-"),t=="body"?this.domElement=document.body:this.domParent=document.getElementById(t),this.elements=[],this.endBreak=document.createElement("BR"),this.domParent.appendChild(this.div),this.labelBreak=document.createElement("BR"),this.label=document.createElement("label"),this.label.id=e.replaceAll(" ","-"),this.label.innerHTML=e,this.tooltip=""}createLineBreak(){return document.createElement("BR")}addElements(){this.elements.forEach(e=>{this.div.appendChild(e)})}removeDiv(){this.div.remove()}addDiv(){this.domParent.appendChild(this.div)}hideLabel(){this.label.remove(),this.labelBreak.remove()}showLabel(){this.div.prepend(this.labelBreak),this.div.prepend(this.label)}removeElement(e){this.elements[e].remove(),this.elements.splice(e,1)}addElement(e){this.elements.push(e),this.domParent.appendChild(e)}addClass(e){this.div.classList.add(e)}setToolTip(e,t){this.div.classList.contains("tooltip")||this.div.classList.add("tooltip");let i=document.createElement("span");i.classList.add("tooltiptext"),i.classList.add(t),i.innerHTML=e,this.tooltip=e,this.elements.push(i),this.div.appendChild(i)}}class Gr{constructor(e,t,i=!1){this.div=document.createElement("div"),this.div.id=e,i?this.div.classList.add("verticalContainer"):this.div.classList.add("horizontalContainer"),t=="body"?this.domElement=document.body:this.domParent=document.getElementById(t),this.domParent.appendChild(this.div)}addBlock(){let e=Array.prototype.slice.call(arguments);for(let t=0;t{this.showing?(this.hideOptions(),this.showing=!1):(this.showOptions(),this.showing=!0)}),this.button.button.innerHTML=i+": "+r[0][0],this.buttons=[],this.selected=this.options[0],this.text=i,this.name=e,this.container.addBlock(this.button)}showOptions(){this.button.div.remove();for(let e=0;e{this.selected!=this.options[e]&&(this.selected=this.options[e],this.options[e][1](),this.button.button.innerHTML=this.text+": "+this.options[e][0]),this.showing=!1,this.hideOptions()});t.div.classList.add("option"),this.options[e].length>=3&&(t.setToolTip(this.button.tooltip,"topTooltip"),t.setToolTip(this.options[e][2],"bottomTooltip")),this.buttons.push(t),this.container.addBlock(t)}this.container.addBlock(this.button),this.container.div.style.marginTop="-"+Number(this.button.div.offsetHeight*this.options.length*2)+"px"}hideOptions(){this.buttons.forEach(e=>{e.div.remove()}),this.container.div.style.marginTop="0px"}}const Ou=15,Bu=.99,jv=40,$v=5,Dn=10,Ks=5,Fu=10,ku=1,zu=.3,Po=2e4,Hu=0,Js=["yellow",2,10,1],Qs=["purple",80,20,2],Vu=1;function nr(n,e,t){return n+(e-n)*t}class Zv{constructor(e,t,i){this.scene=e,this.camera=t,this.transactionsGrid=i,this.mouse=new je,this.lastMouse=new je,this.raycaster=new Ov,this.isMouseHold=!1,this.cameraAccel=new je,this.highlightedBlock=null,this.clickedBlock=null,this.selectedBlock=null,this.selectedDiv,this.hlLight,this.hoverLight,this.hoverLightExists=!1,this.canScroll=!0,this.loadedChunks=new Map,this.isDataLoaded=!1,this.cameraMode=0,this.transitioning=!1,this.resettingCamera=!1,this.sideBarTransactionsToLoad=[],this.transitionSpeed=.008,this.cameraGridView={position:new F(0,10,0),lookAtDelta:new F(0,-1,0)},this.cameraBarView={position:new F(0,2,8),lookAtDelta:new F(0,-1,-3)},this.storedCamera,this.cameraTVal=0,this.addressDiv1=document.createElement("div"),this.addressDiv1.id="addressDiv1",document.body.appendChild(this.addressDiv1),this.addressDiv2=document.createElement("div"),this.addressDiv2.id="addressDiv2",document.body.appendChild(this.addressDiv2),this.selects=[]}mouseUpdate(){(this.lastMouse.x!=this.mouse.x||this.lastMouseY!=this.mouse.y)&&this.updateHighlight(),this.lastMouse.x=this.mouse.x,this.lastMouse.y=this.mouse.y,this.mouse.x=event.clientX/window.innerWidth*2-1,this.mouse.y=-(event.clientY/window.innerHeight)*2+1}updateHighlight(){let e=this.transactionsGrid.getBlocks(),t=e.flat().map(r=>r.getCube());this.raycaster.setFromCamera(this.mouse,this.camera);let i=this.raycaster.intersectObjects(t,!1);if(i.length>0&&this.transactionsGrid.canHover){let r=i[0].object;e.flat().forEach(s=>{r==s.getCube()?(s.toggleHighlight(!0),this.highlightedBlock=s):s.toggleHighlight(!1)})}else this.highlightedBlock&&this.highlightedBlock.toggleHighlight(!1),this.highlightedBlock=null;if(this.highlightedBlock&&this.transactionsGrid.displayFrom){this.transactionsGrid.displayFrom.label.innerHTML="From: "+this.highlightedBlock.node1,this.transactionsGrid.displayTo.label.innerHTML="To: "+this.highlightedBlock.node2,this.transactionsGrid.toggleSort==1?this.transactionsGrid.displayAmount.label.innerHTML="Number of Transactions: "+this.highlightedBlock.getTransactionsValue():this.transactionsGrid.displayAmount.label.innerHTML="Transactions Sum: "+this.highlightedBlock.getTransactionsValue();let r=this.highlightedBlock.getCube().position.clone();r.y+=this.highlightedBlock.yScale/2,r.project(this.transactionsGrid.camera);let s=(r.x+1)*window.innerWidth/2,a=(1-r.y)*window.innerHeight/2;if(this.addressDiv1.style.left=s-Po-Hu+"px",this.addressDiv1.style.top=a+"px",this.addressDiv2.style.left=s-Po/2+"px",this.addressDiv2.style.top=a-Po/2-Hu+"px",!this.hoverLightExists){let o=this.cameraMode==1?Vu:0;this.hoverLight=new da(Js[0],Js[1],Js[2],Js[3]),this.hoverLight.position.x=this.highlightedBlock.getCube().position.x,this.hoverLight.position.y=this.highlightedBlock.getCube().position.y+this.highlightedBlock.yScale/2+1,this.hoverLight.position.z=this.highlightedBlock.getCube().position.z+o,this.scene.add(this.hoverLight),this.hoverLightExists=!0}}else this.addressDiv1.style.left="-100000px",this.addressDiv1.style.top="-100000px",this.addressDiv2.style.left="-100000px",this.addressDiv2.style.top="-10000px",this.hoverLightExists&&(this.scene.remove(this.hoverLight),this.hoverLightExists=!1)}onMouseMove(e){if(this.mouseUpdate(),this.isMouseHold&&this.transactionsGrid.canDrag){let t=this.mouse.x-this.lastMouse.x,i=this.mouse.y-this.lastMouse.y;this.camera.position.x+=-t*Ou,this.camera.position.z+=i*Ou*(window.innerHeight/window.innerWidth),this.cameraAccel.x=t,this.cameraAccel.y=i,this.bindCamera()}}onMouseDown(e){this.mouseUpdate(),this.isMouseHold=!0}onMouseClick(e){this.mouseUpdate()}onMouseDblClick(e){if(this.mouseUpdate(),this.isMouseHold=!1,this.transactionsGrid.canDrag=!0,this.clickedBlock&&this.transactionsGrid.canHover&&this.highlightedBlock){this.selectedBlock&&this.selectedBlock.toggleSelect(!1),this.selectedBlock=this.clickedBlock;let t=document.getElementById("sideDiv");t.style.width="300px",t.style.padding="10px";let i=this.cameraMode==1?Vu:0;this.hlLight=new da(Qs[0],Qs[1],Qs[2],Qs[3]),this.hlLight.position.x=this.selectedBlock.getCube().position.x,this.hlLight.position.y=this.selectedBlock.getCube().position.y+this.selectedBlock.yScale/2+1,this.hlLight.position.z=this.selectedBlock.getCube().position.z+i,this.scene.add(this.hlLight),this.selectedDiv&&this.selectedDiv.removeDiv(),this.selectedDiv=new Gr("transaction select","sideDiv",!0);let r=new Kt("transaction from","sideDiv","From: "+String(this.clickedBlock.node1).substring(0,20)+"...");if(this.clickedBlock.node2){let s=new Kt("transaction to","sideDiv","To: "+String(this.clickedBlock.node2).substring(0,20)+"...");this.selectedDiv.addBlock(r,s)}else this.selectedDiv.addBlock(r);if(this.clickedBlock.transactions.sort(function(s,a){return new Date(a.time)-new Date(s.time)}),this.clickedBlock.transactions.forEach(s=>{this.sideBarTransactionsToLoad.push(s)}),this.sideBarTransactionsToLoad.length==0){let s=new Gr("tCont","sideDiv",!0),a=new Kt("transaction","sideDiv","Amount: NA");s.addBlock(a),this.selectedDiv.addBlock(s)}this.selectedBlock.toggleSelect(!0)}}addTransactionsToSideBar(e){if(e.amount>0){let t=new Gr("tCont","sideDiv",!0),i;e.to&&(i=new Kt("transaction to inner","sideDiv","To: "+String(e.to)));let r=new Kt("transaction amount","sideDiv","Amount: "+String(e.amount)),s;if(this.transactionsGrid.dataType==0){let a=new Date(e.time),o=String(a.getHours());o.length==1&&(o="0"+o);let c=String(a.getMinutes());c.length==1&&(c="0"+c);let l=String(a.getSeconds());l.length==1&&(l="0"+l);let u=String(a.getFullYear())+"-"+String(a.getMonth())+"-"+String(a.getDay())+" "+o+":"+c+":"+l;u=="NaN-NaN-NaN NaN:NaN:NaN"&&(u="N/A"),s=new Kt("transaction time","sideDiv","Time: "+u)}else{let a=e.time;s=new Kt("transaction time","sideDiv","Time: "+a)}i?t.addBlock(i,r,s):t.addBlock(r,s),this.selectedDiv.addBlock(t)}}onWheelEvent(e){if(!this.canScroll)return;e.deltaX;let t=e.deltaY;t>0&&this.camera.position.y$v&&this.cameraMode==0&&(this.camera.position.y-=.2,this.updateHighlight())}unselectBlock(){if(this.clickedBlock){this.clickedBlock.toggleSelect(!1);let e=document.getElementById("sideDiv");e.style.width="0px",e.style.padding="10px 0px 10px 0px",this.scene.remove(this.hlLight)}this.sideBarTransactionsToLoad=[]}onMouseUp(e){this.isMouseHold=!1,this.transactionsGrid.canDrag=!0,this.lastMouse.x==this.mouse.x&&this.lastMouse.y==this.mouse.y&&(this.unselectBlock(),this.clickedBlock=this.highlightedBlock)}update(){if(this.sideBarTransactionsToLoad.length>0){let e=this.sideBarTransactionsToLoad.shift();this.addTransactionsToSideBar(e)}if(this.transitioning){this.cameraTVal+=this.transitionSpeed,this.cameraTVal>=1&&(this.transitioning=!1,this.resettingCamera=!1,this.cameraTVal=1);let e;this.cameraMode==0?e=this.cameraGridView:e=this.cameraBarView;let t=nr(this.storedCamera.position.x,e.position.x,this.cameraTVal),i=nr(this.storedCamera.position.y,e.position.y,this.cameraTVal),r=nr(this.storedCamera.position.z,e.position.z,this.cameraTVal),s=nr(this.storedCamera.lookAtDelta.x,e.lookAtDelta.x,this.cameraTVal),a=nr(this.storedCamera.lookAtDelta.y,e.lookAtDelta.y,this.cameraTVal),o=nr(this.storedCamera.lookAtDelta.z,e.lookAtDelta.z,this.cameraTVal);this.resettingCamera?this.camera.position.set(t,i,r):this.camera.position.set(this.camera.position.x,i,r),this.camera.lookAt(this.camera.position.x+s,this.camera.position.y+a,this.camera.position.z+o),this.cameraTVal>=1&&(this.cameraTVal=0)}else this.isMouseHold||(this.cameraAccel.x*=Bu,this.cameraAccel.y*=Bu,Math.abs(this.cameraAccel.x)<.005&&(this.cameraAccel.x=0),Math.abs(this.cameraAccel.y)<.005&&(this.cameraAccel.y=0),this.camera.position.x+=-this.cameraAccel.x,this.camera.position.z+=this.cameraAccel.y,this.bindCamera()),this.cameraMode==1&&(this.camera.position.z=this.cameraBarView.position.z);if(this.isDataLoaded&&this.transactionsGrid.isLoaded){let e=(ku+zu)*Dn;for(let s=-Ks;s<=Ks;s++)for(let a=-Ks;a<=Ks;a++){let o=Math.floor(this.camera.position.x/e)+s,c=Math.floor(this.camera.position.z/e)+a;o>=0&&c>=0&&(this.loadedChunks.get([o,c].toString())||(this.loadedChunks.set([o,c].toString(),!0),this.cameraMode==0?this.transactionsGrid.loadBlocks(o*Dn,c*Dn,Dn,!1):this.transactionsGrid.loadBars(o*Dn,Dn)))}let t=Math.floor(this.camera.position.x/e),i=Math.floor(this.camera.position.z/e);Array.from(this.loadedChunks).forEach(s=>{let a=s[0].split(",").map(o=>Number(o));this.loadedChunks.get([a[0],a[1]].toString())&&(Math.abs(a[0]-t)>Fu||Math.abs(a[1]-i)>Fu)&&(this.loadedChunks.set([a[0],a[1]].toString(),!1),this.transactionsGrid.unloadBlocks(a[0]*Dn,a[1]*Dn,Dn))})}this.bindCamera()}clearChunks(){this.loadedChunks=new Map}setCamera(e){this.unselectBlock(),this.transitionSpeed=.008,this.transitioning=!0,e==0?(this.storedCamera={position:this.camera.position.clone(),lookAtDelta:this.cameraBarView.lookAtDelta},this.addressDiv1.style.height="2px",this.addressDiv2.style.height="2px"):e==1&&(this.storedCamera={position:this.camera.position.clone(),lookAtDelta:this.cameraGridView.lookAtDelta},this.addressDiv1.style.height="0px",this.addressDiv2.style.height="0px"),this.cameraMode=e}resetCamera(){this.transitioning=!0,this.resettingCamera=!0,this.transitionSpeed=.05,this.storedCamera={position:this.camera.position.clone(),lookAtDelta:this.cameraGridView.lookAtDelta},this.cameraAccel=new je}bindCamera(){if(this.isDataLoaded){if(!this.transactionsGrid.nodeArray)return;let e=(ku+zu)*this.transactionsGrid.nodeArray.length;this.camera.position.x>e&&(this.camera.position.x=e),this.camera.position.x<0&&(this.camera.position.x=0),this.camera.position.z>e&&(this.camera.position.z=e),this.camera.position.z<0&&(this.camera.position.z=0)}}}function df(n,e){return function(){return n.apply(e,arguments)}}const{toString:Yv}=Object.prototype,{getPrototypeOf:Dc}=Object,Ba=(n=>e=>{const t=Yv.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),wn=n=>(n=n.toLowerCase(),e=>Ba(e)===n),Fa=n=>e=>typeof e===n,{isArray:wr}=Array,jr=Fa("undefined");function Kv(n){return n!==null&&!jr(n)&&n.constructor!==null&&!jr(n.constructor)&&en(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const ff=wn("ArrayBuffer");function Jv(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&ff(n.buffer),e}const Qv=Fa("string"),en=Fa("function"),hf=Fa("number"),ka=n=>n!==null&&typeof n=="object",ey=n=>n===!0||n===!1,ia=n=>{if(Ba(n)!=="object")return!1;const e=Dc(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},ty=wn("Date"),ny=wn("File"),iy=wn("Blob"),ry=wn("FileList"),sy=n=>ka(n)&&en(n.pipe),ay=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||en(n.append)&&((e=Ba(n))==="formdata"||e==="object"&&en(n.toString)&&n.toString()==="[object FormData]"))},oy=wn("URLSearchParams"),cy=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function vs(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let i,r;if(typeof n!="object"&&(n=[n]),wr(n))for(i=0,r=n.length;i0;)if(r=t[i],e===r.toLowerCase())return r;return null}const mf=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,gf=n=>!jr(n)&&n!==mf;function tc(){const{caseless:n}=gf(this)&&this||{},e={},t=(i,r)=>{const s=n&&pf(e,r)||r;ia(e[s])&&ia(i)?e[s]=tc(e[s],i):ia(i)?e[s]=tc({},i):wr(i)?e[s]=i.slice():e[s]=i};for(let i=0,r=arguments.length;i(vs(e,(r,s)=>{t&&en(r)?n[s]=df(r,t):n[s]=r},{allOwnKeys:i}),n),uy=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),dy=(n,e,t,i)=>{n.prototype=Object.create(e.prototype,i),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},fy=(n,e,t,i)=>{let r,s,a;const o={};if(e=e||{},n==null)return e;do{for(r=Object.getOwnPropertyNames(n),s=r.length;s-- >0;)a=r[s],(!i||i(a,n,e))&&!o[a]&&(e[a]=n[a],o[a]=!0);n=t!==!1&&Dc(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},hy=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const i=n.indexOf(e,t);return i!==-1&&i===t},py=n=>{if(!n)return null;if(wr(n))return n;let e=n.length;if(!hf(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},my=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&Dc(Uint8Array)),gy=(n,e)=>{const i=(n&&n[Symbol.iterator]).call(n);let r;for(;(r=i.next())&&!r.done;){const s=r.value;e.call(n,s[0],s[1])}},_y=(n,e)=>{let t;const i=[];for(;(t=n.exec(e))!==null;)i.push(t);return i},vy=wn("HTMLFormElement"),yy=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,i,r){return i.toUpperCase()+r}),Gu=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),xy=wn("RegExp"),_f=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),i={};vs(t,(r,s)=>{let a;(a=e(r,s,n))!==!1&&(i[s]=a||r)}),Object.defineProperties(n,i)},Sy=n=>{_f(n,(e,t)=>{if(en(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const i=n[t];if(en(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},Ey=(n,e)=>{const t={},i=r=>{r.forEach(s=>{t[s]=!0})};return wr(n)?i(n):i(String(n).split(e)),t},by=()=>{},My=(n,e)=>(n=+n,Number.isFinite(n)?n:e),Io="abcdefghijklmnopqrstuvwxyz",Wu="0123456789",vf={DIGIT:Wu,ALPHA:Io,ALPHA_DIGIT:Io+Io.toUpperCase()+Wu},Ty=(n=16,e=vf.ALPHA_DIGIT)=>{let t="";const{length:i}=e;for(;n--;)t+=e[Math.random()*i|0];return t};function wy(n){return!!(n&&en(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const Ay=n=>{const e=new Array(10),t=(i,r)=>{if(ka(i)){if(e.indexOf(i)>=0)return;if(!("toJSON"in i)){e[r]=i;const s=wr(i)?[]:{};return vs(i,(a,o)=>{const c=t(a,r+1);!jr(c)&&(s[o]=c)}),e[r]=void 0,s}}return i};return t(n,0)},Ry=wn("AsyncFunction"),Cy=n=>n&&(ka(n)||en(n))&&en(n.then)&&en(n.catch),K={isArray:wr,isArrayBuffer:ff,isBuffer:Kv,isFormData:ay,isArrayBufferView:Jv,isString:Qv,isNumber:hf,isBoolean:ey,isObject:ka,isPlainObject:ia,isUndefined:jr,isDate:ty,isFile:ny,isBlob:iy,isRegExp:xy,isFunction:en,isStream:sy,isURLSearchParams:oy,isTypedArray:my,isFileList:ry,forEach:vs,merge:tc,extend:ly,trim:cy,stripBOM:uy,inherits:dy,toFlatObject:fy,kindOf:Ba,kindOfTest:wn,endsWith:hy,toArray:py,forEachEntry:gy,matchAll:_y,isHTMLForm:vy,hasOwnProperty:Gu,hasOwnProp:Gu,reduceDescriptors:_f,freezeMethods:Sy,toObjectSet:Ey,toCamelCase:yy,noop:by,toFiniteNumber:My,findKey:pf,global:mf,isContextDefined:gf,ALPHABET:vf,generateString:Ty,isSpecCompliantForm:wy,toJSONObject:Ay,isAsyncFn:Ry,isThenable:Cy};function Ze(n,e,t,i,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),i&&(this.request=i),r&&(this.response=r)}K.inherits(Ze,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:K.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const yf=Ze.prototype,xf={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{xf[n]={value:n}});Object.defineProperties(Ze,xf);Object.defineProperty(yf,"isAxiosError",{value:!0});Ze.from=(n,e,t,i,r,s)=>{const a=Object.create(yf);return K.toFlatObject(n,a,function(c){return c!==Error.prototype},o=>o!=="isAxiosError"),Ze.call(a,n.message,e,t,i,r),a.cause=n,a.name=n.name,s&&Object.assign(a,s),a};const Ly=null;function nc(n){return K.isPlainObject(n)||K.isArray(n)}function Sf(n){return K.endsWith(n,"[]")?n.slice(0,-2):n}function Xu(n,e,t){return n?n.concat(e).map(function(r,s){return r=Sf(r),!t&&s?"["+r+"]":r}).join(t?".":""):e}function Py(n){return K.isArray(n)&&!n.some(nc)}const Iy=K.toFlatObject(K,{},null,function(e){return/^is[A-Z]/.test(e)});function za(n,e,t){if(!K.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=K.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,h){return!K.isUndefined(h[m])});const i=t.metaTokens,r=t.visitor||u,s=t.dots,a=t.indexes,c=(t.Blob||typeof Blob<"u"&&Blob)&&K.isSpecCompliantForm(e);if(!K.isFunction(r))throw new TypeError("visitor must be a function");function l(_){if(_===null)return"";if(K.isDate(_))return _.toISOString();if(!c&&K.isBlob(_))throw new Ze("Blob is not supported. Use a Buffer instead.");return K.isArrayBuffer(_)||K.isTypedArray(_)?c&&typeof Blob=="function"?new Blob([_]):Buffer.from(_):_}function u(_,m,h){let f=_;if(_&&!h&&typeof _=="object"){if(K.endsWith(m,"{}"))m=i?m:m.slice(0,-2),_=JSON.stringify(_);else if(K.isArray(_)&&Py(_)||(K.isFileList(_)||K.endsWith(m,"[]"))&&(f=K.toArray(_)))return m=Sf(m),f.forEach(function(v,M){!(K.isUndefined(v)||v===null)&&e.append(a===!0?Xu([m],M,s):a===null?m:m+"[]",l(v))}),!1}return nc(_)?!0:(e.append(Xu(h,m,s),l(_)),!1)}const d=[],p=Object.assign(Iy,{defaultVisitor:u,convertValue:l,isVisitable:nc});function g(_,m){if(!K.isUndefined(_)){if(d.indexOf(_)!==-1)throw Error("Circular reference detected in "+m.join("."));d.push(_),K.forEach(_,function(f,b){(!(K.isUndefined(f)||f===null)&&r.call(e,f,K.isString(b)?b.trim():b,m,p))===!0&&g(f,m?m.concat(b):[b])}),d.pop()}}if(!K.isObject(n))throw new TypeError("data must be an object");return g(n),e}function qu(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function Uc(n,e){this._pairs=[],n&&za(n,this,e)}const Ef=Uc.prototype;Ef.append=function(e,t){this._pairs.push([e,t])};Ef.toString=function(e){const t=e?function(i){return e.call(this,i,qu)}:qu;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function Dy(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function bf(n,e,t){if(!e)return n;const i=t&&t.encode||Dy,r=t&&t.serialize;let s;if(r?s=r(e,t):s=K.isURLSearchParams(e)?e.toString():new Uc(e,t).toString(i),s){const a=n.indexOf("#");a!==-1&&(n=n.slice(0,a)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class ju{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){K.forEach(this.handlers,function(i){i!==null&&e(i)})}}const Mf={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Uy=typeof URLSearchParams<"u"?URLSearchParams:Uc,Ny=typeof FormData<"u"?FormData:null,Oy=typeof Blob<"u"?Blob:null,By={isBrowser:!0,classes:{URLSearchParams:Uy,FormData:Ny,Blob:Oy},protocols:["http","https","file","blob","url","data"]},Tf=typeof window<"u"&&typeof document<"u",Fy=(n=>Tf&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),ky=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",zy=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Tf,hasStandardBrowserEnv:Fy,hasStandardBrowserWebWorkerEnv:ky},Symbol.toStringTag,{value:"Module"})),xn={...zy,...By};function Hy(n,e){return za(n,new xn.classes.URLSearchParams,Object.assign({visitor:function(t,i,r,s){return xn.isNode&&K.isBuffer(t)?(this.append(i,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function Vy(n){return K.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Gy(n){const e={},t=Object.keys(n);let i;const r=t.length;let s;for(i=0;i=t.length;return a=!a&&K.isArray(r)?r.length:a,c?(K.hasOwnProp(r,a)?r[a]=[r[a],i]:r[a]=i,!o):((!r[a]||!K.isObject(r[a]))&&(r[a]=[]),e(t,i,r[a],s)&&K.isArray(r[a])&&(r[a]=Gy(r[a])),!o)}if(K.isFormData(n)&&K.isFunction(n.entries)){const t={};return K.forEachEntry(n,(i,r)=>{e(Vy(i),r,t,0)}),t}return null}function Wy(n,e,t){if(K.isString(n))try{return(e||JSON.parse)(n),K.trim(n)}catch(i){if(i.name!=="SyntaxError")throw i}return(t||JSON.stringify)(n)}const ys={transitional:Mf,adapter:["xhr","http"],transformRequest:[function(e,t){const i=t.getContentType()||"",r=i.indexOf("application/json")>-1,s=K.isObject(e);if(s&&K.isHTMLForm(e)&&(e=new FormData(e)),K.isFormData(e))return r?JSON.stringify(wf(e)):e;if(K.isArrayBuffer(e)||K.isBuffer(e)||K.isStream(e)||K.isFile(e)||K.isBlob(e))return e;if(K.isArrayBufferView(e))return e.buffer;if(K.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(i.indexOf("application/x-www-form-urlencoded")>-1)return Hy(e,this.formSerializer).toString();if((o=K.isFileList(e))||i.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return za(o?{"files[]":e}:e,c&&new c,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),Wy(e)):e}],transformResponse:[function(e){const t=this.transitional||ys.transitional,i=t&&t.forcedJSONParsing,r=this.responseType==="json";if(e&&K.isString(e)&&(i&&!this.responseType||r)){const a=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(o){if(a)throw o.name==="SyntaxError"?Ze.from(o,Ze.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:xn.classes.FormData,Blob:xn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};K.forEach(["delete","get","head","post","put","patch"],n=>{ys.headers[n]={}});const Xy=K.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),qy=n=>{const e={};let t,i,r;return n&&n.split(` +}`;function xv(n,e,t){let i=new Lc;const r=new je,s=new je,a=new at,o=new gv({depthPacking:mp}),c=new _v,l={},u=t.maxTextureSize,d={[oi]:Bt,[Bt]:oi,[Fn]:Fn},p=new Di({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new je},radius:{value:4}},vertexShader:vv,fragmentShader:yv}),g=p.clone();g.defines.HORIZONTAL_PASS=1;const _=new Fi;_.setAttribute("position",new Sn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new Hn(_,p),h=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ud;let f=this.type;this.render=function(R,L,C){if(h.enabled===!1||h.autoUpdate===!1&&h.needsUpdate===!1||R.length===0)return;const P=n.getRenderTarget(),S=n.getActiveCubeFace(),E=n.getActiveMipmapLevel(),O=n.state;O.setBlending(ri),O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);const k=f!==On&&this.type===On,Z=f===On&&this.type!==On;for(let I=0,y=R.length;Iu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/q.x),r.x=s.x*q.x,D.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/q.y),r.y=s.y*q.y,D.mapSize.y=s.y)),D.map===null||k===!0||Z===!0){const H=this.type!==On?{minFilter:It,magFilter:It}:{};D.map!==null&&D.map.dispose(),D.map=new Ii(r.x,r.y,H),D.map.texture.name=w.name+".shadowMap",D.camera.updateProjectionMatrix()}n.setRenderTarget(D.map),n.clear();const V=D.getViewportCount();for(let H=0;H0||L.map&&L.alphaTest>0){const O=S.uuid,k=L.uuid;let Z=l[O];Z===void 0&&(Z={},l[O]=Z);let I=Z[k];I===void 0&&(I=S.clone(),Z[k]=I),S=I}if(S.visible=L.visible,S.wireframe=L.wireframe,P===On?S.side=L.shadowSide!==null?L.shadowSide:L.side:S.side=L.shadowSide!==null?L.shadowSide:d[L.side],S.alphaMap=L.alphaMap,S.alphaTest=L.alphaTest,S.map=L.map,S.clipShadows=L.clipShadows,S.clippingPlanes=L.clippingPlanes,S.clipIntersection=L.clipIntersection,S.displacementMap=L.displacementMap,S.displacementScale=L.displacementScale,S.displacementBias=L.displacementBias,S.wireframeLinewidth=L.wireframeLinewidth,S.linewidth=L.linewidth,C.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const O=n.properties.get(S);O.light=C}return S}function M(R,L,C,P,S){if(R.visible===!1)return;if(R.layers.test(L.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&S===On)&&(!R.frustumCulled||i.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,R.matrixWorld);const k=e.update(R),Z=R.material;if(Array.isArray(Z)){const I=k.groups;for(let y=0,w=I.length;y=1):H.indexOf("OpenGL ES")!==-1&&(V=parseFloat(/^OpenGL ES (\d)/.exec(H)[1]),q=V>=2);let N=null,G={};const ee=n.getParameter(n.SCISSOR_BOX),ae=n.getParameter(n.VIEWPORT),fe=new at().fromArray(ee),xe=new at().fromArray(ae);function De(U,ue,re,Y){const se=new Uint8Array(4),Me=n.createTexture();n.bindTexture(U,Me),n.texParameteri(U,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(U,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Je=0;Je"u"?!1:/OculusBrowser/g.test(navigator.userAgent),_=new WeakMap;let m;const h=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(A,x){return f?new OffscreenCanvas(A,x):ua("canvas")}function v(A,x,W,ne){let Q=1;if((A.width>ne||A.height>ne)&&(Q=ne/Math.max(A.width,A.height)),Q<1||x===!0)if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap){const ie=x?Ko:Math.floor,ve=ie(Q*A.width),oe=ie(Q*A.height);m===void 0&&(m=b(ve,oe));const he=W?b(ve,oe):m;return he.width=ve,he.height=oe,he.getContext("2d").drawImage(A,0,0,ve,oe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+A.width+"x"+A.height+") to ("+ve+"x"+oe+")."),he}else return"data"in A&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+A.width+"x"+A.height+")."),A;return A}function M(A){return Vl(A.width)&&Vl(A.height)}function R(A){return o?!1:A.wrapS!==dn||A.wrapT!==dn||A.minFilter!==It&&A.minFilter!==Jt}function L(A,x){return A.generateMipmaps&&x&&A.minFilter!==It&&A.minFilter!==Jt}function C(A){n.generateMipmap(A)}function P(A,x,W,ne,Q=!1){if(o===!1)return x;if(A!==null){if(n[A]!==void 0)return n[A];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+A+"'")}let ie=x;if(x===n.RED&&(W===n.FLOAT&&(ie=n.R32F),W===n.HALF_FLOAT&&(ie=n.R16F),W===n.UNSIGNED_BYTE&&(ie=n.R8)),x===n.RED_INTEGER&&(W===n.UNSIGNED_BYTE&&(ie=n.R8UI),W===n.UNSIGNED_SHORT&&(ie=n.R16UI),W===n.UNSIGNED_INT&&(ie=n.R32UI),W===n.BYTE&&(ie=n.R8I),W===n.SHORT&&(ie=n.R16I),W===n.INT&&(ie=n.R32I)),x===n.RG&&(W===n.FLOAT&&(ie=n.RG32F),W===n.HALF_FLOAT&&(ie=n.RG16F),W===n.UNSIGNED_BYTE&&(ie=n.RG8)),x===n.RGBA){const ve=Q?aa:tt.getTransfer(ne);W===n.FLOAT&&(ie=n.RGBA32F),W===n.HALF_FLOAT&&(ie=n.RGBA16F),W===n.UNSIGNED_BYTE&&(ie=ve===st?n.SRGB8_ALPHA8:n.RGBA8),W===n.UNSIGNED_SHORT_4_4_4_4&&(ie=n.RGBA4),W===n.UNSIGNED_SHORT_5_5_5_1&&(ie=n.RGB5_A1)}return(ie===n.R16F||ie===n.R32F||ie===n.RG16F||ie===n.RG32F||ie===n.RGBA16F||ie===n.RGBA32F)&&e.get("EXT_color_buffer_float"),ie}function S(A,x,W){return L(A,W)===!0||A.isFramebufferTexture&&A.minFilter!==It&&A.minFilter!==Jt?Math.log2(Math.max(x.width,x.height))+1:A.mipmaps!==void 0&&A.mipmaps.length>0?A.mipmaps.length:A.isCompressedTexture&&Array.isArray(A.image)?x.mipmaps.length:1}function E(A){return A===It||A===hl||A===Za?n.NEAREST:n.LINEAR}function O(A){const x=A.target;x.removeEventListener("dispose",O),Z(x),x.isVideoTexture&&_.delete(x)}function k(A){const x=A.target;x.removeEventListener("dispose",k),y(x)}function Z(A){const x=i.get(A);if(x.__webglInit===void 0)return;const W=A.source,ne=h.get(W);if(ne){const Q=ne[x.__cacheKey];Q.usedTimes--,Q.usedTimes===0&&I(A),Object.keys(ne).length===0&&h.delete(W)}i.remove(A)}function I(A){const x=i.get(A);n.deleteTexture(x.__webglTexture);const W=A.source,ne=h.get(W);delete ne[x.__cacheKey],a.memory.textures--}function y(A){const x=A.texture,W=i.get(A),ne=i.get(x);if(ne.__webglTexture!==void 0&&(n.deleteTexture(ne.__webglTexture),a.memory.textures--),A.depthTexture&&A.depthTexture.dispose(),A.isWebGLCubeRenderTarget)for(let Q=0;Q<6;Q++){if(Array.isArray(W.__webglFramebuffer[Q]))for(let ie=0;ie=c&&console.warn("THREE.WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+c),w+=1,A}function V(A){const x=[];return x.push(A.wrapS),x.push(A.wrapT),x.push(A.wrapR||0),x.push(A.magFilter),x.push(A.minFilter),x.push(A.anisotropy),x.push(A.internalFormat),x.push(A.format),x.push(A.type),x.push(A.generateMipmaps),x.push(A.premultiplyAlpha),x.push(A.flipY),x.push(A.unpackAlignment),x.push(A.colorSpace),x.join()}function H(A,x){const W=i.get(A);if(A.isVideoTexture&&yt(A),A.isRenderTargetTexture===!1&&A.version>0&&W.__version!==A.version){const ne=A.image;if(ne===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ne.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{be(W,A,x);return}}t.bindTexture(n.TEXTURE_2D,W.__webglTexture,n.TEXTURE0+x)}function N(A,x){const W=i.get(A);if(A.version>0&&W.__version!==A.version){be(W,A,x);return}t.bindTexture(n.TEXTURE_2D_ARRAY,W.__webglTexture,n.TEXTURE0+x)}function G(A,x){const W=i.get(A);if(A.version>0&&W.__version!==A.version){be(W,A,x);return}t.bindTexture(n.TEXTURE_3D,W.__webglTexture,n.TEXTURE0+x)}function ee(A,x){const W=i.get(A);if(A.version>0&&W.__version!==A.version){Qe(W,A,x);return}t.bindTexture(n.TEXTURE_CUBE_MAP,W.__webglTexture,n.TEXTURE0+x)}const ae={[jo]:n.REPEAT,[dn]:n.CLAMP_TO_EDGE,[$o]:n.MIRRORED_REPEAT},fe={[It]:n.NEAREST,[hl]:n.NEAREST_MIPMAP_NEAREST,[Za]:n.NEAREST_MIPMAP_LINEAR,[Jt]:n.LINEAR,[rp]:n.LINEAR_MIPMAP_NEAREST,[Xr]:n.LINEAR_MIPMAP_LINEAR},xe={[_p]:n.NEVER,[Mp]:n.ALWAYS,[vp]:n.LESS,[xp]:n.LEQUAL,[yp]:n.EQUAL,[bp]:n.GEQUAL,[Sp]:n.GREATER,[Ep]:n.NOTEQUAL};function De(A,x,W){if(W?(n.texParameteri(A,n.TEXTURE_WRAP_S,ae[x.wrapS]),n.texParameteri(A,n.TEXTURE_WRAP_T,ae[x.wrapT]),(A===n.TEXTURE_3D||A===n.TEXTURE_2D_ARRAY)&&n.texParameteri(A,n.TEXTURE_WRAP_R,ae[x.wrapR]),n.texParameteri(A,n.TEXTURE_MAG_FILTER,fe[x.magFilter]),n.texParameteri(A,n.TEXTURE_MIN_FILTER,fe[x.minFilter])):(n.texParameteri(A,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(A,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(A===n.TEXTURE_3D||A===n.TEXTURE_2D_ARRAY)&&n.texParameteri(A,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(x.wrapS!==dn||x.wrapT!==dn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(A,n.TEXTURE_MAG_FILTER,E(x.magFilter)),n.texParameteri(A,n.TEXTURE_MIN_FILTER,E(x.minFilter)),x.minFilter!==It&&x.minFilter!==Jt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),x.compareFunction&&(n.texParameteri(A,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(A,n.TEXTURE_COMPARE_FUNC,xe[x.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const ne=e.get("EXT_texture_filter_anisotropic");if(x.magFilter===It||x.minFilter!==Za&&x.minFilter!==Xr||x.type===ii&&e.has("OES_texture_float_linear")===!1||o===!1&&x.type===qr&&e.has("OES_texture_half_float_linear")===!1)return;(x.anisotropy>1||i.get(x).__currentAnisotropy)&&(n.texParameterf(A,ne.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(x.anisotropy,r.getMaxAnisotropy())),i.get(x).__currentAnisotropy=x.anisotropy)}}function Ae(A,x){let W=!1;A.__webglInit===void 0&&(A.__webglInit=!0,x.addEventListener("dispose",O));const ne=x.source;let Q=h.get(ne);Q===void 0&&(Q={},h.set(ne,Q));const ie=V(x);if(ie!==A.__cacheKey){Q[ie]===void 0&&(Q[ie]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,W=!0),Q[ie].usedTimes++;const ve=Q[A.__cacheKey];ve!==void 0&&(Q[A.__cacheKey].usedTimes--,ve.usedTimes===0&&I(x)),A.__cacheKey=ie,A.__webglTexture=Q[ie].texture}return W}function be(A,x,W){let ne=n.TEXTURE_2D;(x.isDataArrayTexture||x.isCompressedArrayTexture)&&(ne=n.TEXTURE_2D_ARRAY),x.isData3DTexture&&(ne=n.TEXTURE_3D);const Q=Ae(A,x),ie=x.source;t.bindTexture(ne,A.__webglTexture,n.TEXTURE0+W);const ve=i.get(ie);if(ie.version!==ve.__version||Q===!0){t.activeTexture(n.TEXTURE0+W);const oe=tt.getPrimaries(tt.workingColorSpace),he=x.colorSpace===Qt?null:tt.getPrimaries(x.colorSpace),Le=x.colorSpace===Qt||oe===he?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,x.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,x.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Le);const Ke=R(x)&&M(x.image)===!1;let te=v(x.image,Ke,!1,u);te=Tt(x,te);const et=M(te)||o,Ne=s.convert(x.format,x.colorSpace);let Pe=s.convert(x.type),Se=P(x.internalFormat,Ne,Pe,x.colorSpace,x.isVideoTexture);De(ne,x,et);let me;const $e=x.mipmaps,U=o&&x.isVideoTexture!==!0,ue=ve.__version===void 0||Q===!0,re=S(x,te,et);if(x.isDepthTexture)Se=n.DEPTH_COMPONENT,o?x.type===ii?Se=n.DEPTH_COMPONENT32F:x.type===ni?Se=n.DEPTH_COMPONENT24:x.type===Ti?Se=n.DEPTH24_STENCIL8:Se=n.DEPTH_COMPONENT16:x.type===ii&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),x.format===wi&&Se===n.DEPTH_COMPONENT&&x.type!==wc&&x.type!==ni&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),x.type=ni,Pe=s.convert(x.type)),x.format===hr&&Se===n.DEPTH_COMPONENT&&(Se=n.DEPTH_STENCIL,x.type!==Ti&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),x.type=Ti,Pe=s.convert(x.type))),ue&&(U?t.texStorage2D(n.TEXTURE_2D,1,Se,te.width,te.height):t.texImage2D(n.TEXTURE_2D,0,Se,te.width,te.height,0,Ne,Pe,null));else if(x.isDataTexture)if($e.length>0&&et){U&&ue&&t.texStorage2D(n.TEXTURE_2D,re,Se,$e[0].width,$e[0].height);for(let Y=0,se=$e.length;Y>=1,se>>=1}}else if($e.length>0&&et){U&&ue&&t.texStorage2D(n.TEXTURE_2D,re,Se,$e[0].width,$e[0].height);for(let Y=0,se=$e.length;Y0&&ue++,t.texStorage2D(n.TEXTURE_CUBE_MAP,ue,me,te[0].width,te[0].height));for(let Y=0;Y<6;Y++)if(Ke){$e?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,0,0,te[Y].width,te[Y].height,Pe,Se,te[Y].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,me,te[Y].width,te[Y].height,0,Pe,Se,te[Y].data);for(let se=0;se>ie),te=Math.max(1,x.height>>ie);Q===n.TEXTURE_3D||Q===n.TEXTURE_2D_ARRAY?t.texImage3D(Q,ie,he,Ke,te,x.depth,0,ve,oe,null):t.texImage2D(Q,ie,he,Ke,te,0,ve,oe,null)}t.bindFramebuffer(n.FRAMEBUFFER,A),nt(x)?p.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,ne,Q,i.get(W).__webglTexture,0,We(x)):(Q===n.TEXTURE_2D||Q>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&Q<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,ne,Q,i.get(W).__webglTexture,ie),t.bindFramebuffer(n.FRAMEBUFFER,null)}function z(A,x,W){if(n.bindRenderbuffer(n.RENDERBUFFER,A),x.depthBuffer&&!x.stencilBuffer){let ne=o===!0?n.DEPTH_COMPONENT24:n.DEPTH_COMPONENT16;if(W||nt(x)){const Q=x.depthTexture;Q&&Q.isDepthTexture&&(Q.type===ii?ne=n.DEPTH_COMPONENT32F:Q.type===ni&&(ne=n.DEPTH_COMPONENT24));const ie=We(x);nt(x)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ie,ne,x.width,x.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,ie,ne,x.width,x.height)}else n.renderbufferStorage(n.RENDERBUFFER,ne,x.width,x.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,A)}else if(x.depthBuffer&&x.stencilBuffer){const ne=We(x);W&&nt(x)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,ne,n.DEPTH24_STENCIL8,x.width,x.height):nt(x)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ne,n.DEPTH24_STENCIL8,x.width,x.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,x.width,x.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,A)}else{const ne=x.isWebGLMultipleRenderTargets===!0?x.texture:[x.texture];for(let Q=0;Q0){W.__webglFramebuffer[oe]=[];for(let he=0;he0){W.__webglFramebuffer=[];for(let oe=0;oe0&&nt(A)===!1){const oe=ie?x:[x];W.__webglMultisampledFramebuffer=n.createFramebuffer(),W.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,W.__webglMultisampledFramebuffer);for(let he=0;he0)for(let he=0;he0)for(let he=0;he0&&nt(A)===!1){const x=A.isWebGLMultipleRenderTargets?A.texture:[A.texture],W=A.width,ne=A.height;let Q=n.COLOR_BUFFER_BIT;const ie=[],ve=A.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,oe=i.get(A),he=A.isWebGLMultipleRenderTargets===!0;if(he)for(let Le=0;Le0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&x.__useRenderToTexture!==!1}function yt(A){const x=a.render.frame;_.get(A)!==x&&(_.set(A,x),A.update())}function Tt(A,x){const W=A.colorSpace,ne=A.format,Q=A.type;return A.isCompressedTexture===!0||A.isVideoTexture===!0||A.format===Zo||W!==Gn&&W!==Qt&&(tt.getTransfer(W)===st?o===!1?e.has("EXT_sRGB")===!0&&ne===fn?(A.format=Zo,A.minFilter=Jt,A.generateMipmaps=!1):x=Xd.sRGBToLinear(x):(ne!==fn||Q!==ai)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",W)),x}this.allocateTextureUnit=q,this.resetTextureUnits=D,this.setTexture2D=H,this.setTexture2DArray=N,this.setTexture3D=G,this.setTextureCube=ee,this.rebindTextures=Ce,this.setupRenderTarget=Re,this.updateRenderTargetMipmap=ct,this.updateMultisampleRenderTarget=Ge,this.setupDepthRenderbuffer=ge,this.setupFrameBufferTexture=Fe,this.useMultisampledRTT=nt}function bv(n,e,t){const i=t.isWebGL2;function r(s,a=Qt){let o;const c=tt.getTransfer(a);if(s===ai)return n.UNSIGNED_BYTE;if(s===Bd)return n.UNSIGNED_SHORT_4_4_4_4;if(s===Fd)return n.UNSIGNED_SHORT_5_5_5_1;if(s===sp)return n.BYTE;if(s===ap)return n.SHORT;if(s===wc)return n.UNSIGNED_SHORT;if(s===Od)return n.INT;if(s===ni)return n.UNSIGNED_INT;if(s===ii)return n.FLOAT;if(s===qr)return i?n.HALF_FLOAT:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(s===op)return n.ALPHA;if(s===fn)return n.RGBA;if(s===cp)return n.LUMINANCE;if(s===lp)return n.LUMINANCE_ALPHA;if(s===wi)return n.DEPTH_COMPONENT;if(s===hr)return n.DEPTH_STENCIL;if(s===Zo)return o=e.get("EXT_sRGB"),o!==null?o.SRGB_ALPHA_EXT:null;if(s===up)return n.RED;if(s===kd)return n.RED_INTEGER;if(s===dp)return n.RG;if(s===zd)return n.RG_INTEGER;if(s===Hd)return n.RGBA_INTEGER;if(s===Ya||s===Ka||s===Ja||s===Qa)if(c===st)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(s===Ya)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Ka)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===Ja)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Qa)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(s===Ya)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Ka)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Ja)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Qa)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===pl||s===ml||s===gl||s===_l)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(s===pl)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===ml)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===gl)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===_l)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===fp)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===vl||s===yl)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(s===vl)return c===st?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(s===yl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===xl||s===Sl||s===El||s===bl||s===Ml||s===Tl||s===wl||s===Al||s===Rl||s===Cl||s===Ll||s===Pl||s===Il||s===Dl)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(s===xl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Sl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===El)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===bl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Ml)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Tl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===wl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Al)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Rl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Cl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Ll)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Pl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===Il)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===Dl)return c===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===eo||s===Ul||s===Nl)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(s===eo)return c===st?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===Ul)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===Nl)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===hp||s===Ol||s===Bl||s===Fl)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(s===eo)return o.COMPRESSED_RED_RGTC1_EXT;if(s===Ol)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Bl)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===Fl)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Ti?i?n.UNSIGNED_INT_24_8:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:r}}class Mv extends Wt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Br extends Ft{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Tv={type:"move"};class wo{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Br,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Br,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new F,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new F),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Br,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new F,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new F),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null;const o=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(const m of e.hand.values()){const h=t.getJointPose(m,i),f=this._getHandJoint(l,m);h!==null&&(f.matrix.fromArray(h.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=h.radius),f.visible=h!==null}const u=l.joints["index-finger-tip"],d=l.joints["thumb-tip"],p=u.position.distanceTo(d.position),g=.02,_=.005;l.inputState.pinching&&p>g+_?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&p<=g-_&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Tv)))}return o!==null&&(o.visible=r!==null),c!==null&&(c.visible=s!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Br;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class wv extends Xt{constructor(e,t,i,r,s,a,o,c,l,u){if(u=u!==void 0?u:wi,u!==wi&&u!==hr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===wi&&(i=ni),i===void 0&&u===hr&&(i=Ti),super(null,r,s,a,o,c,u,i,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:It,this.minFilter=c!==void 0?c:It,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Av extends br{constructor(e,t){super();const i=this;let r=null,s=1,a=null,o="local-floor",c=1,l=null,u=null,d=null,p=null,g=null,_=null;const m=t.getContextAttributes();let h=null,f=null;const b=[],v=[],M=new Wt;M.layers.enable(1),M.viewport=new at;const R=new Wt;R.layers.enable(2),R.viewport=new at;const L=[M,R],C=new Mv;C.layers.enable(1),C.layers.enable(2);let P=null,S=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(N){let G=b[N];return G===void 0&&(G=new wo,b[N]=G),G.getTargetRaySpace()},this.getControllerGrip=function(N){let G=b[N];return G===void 0&&(G=new wo,b[N]=G),G.getGripSpace()},this.getHand=function(N){let G=b[N];return G===void 0&&(G=new wo,b[N]=G),G.getHandSpace()};function E(N){const G=v.indexOf(N.inputSource);if(G===-1)return;const ee=b[G];ee!==void 0&&(ee.update(N.inputSource,N.frame,l||a),ee.dispatchEvent({type:N.type,data:N.inputSource}))}function O(){r.removeEventListener("select",E),r.removeEventListener("selectstart",E),r.removeEventListener("selectend",E),r.removeEventListener("squeeze",E),r.removeEventListener("squeezestart",E),r.removeEventListener("squeezeend",E),r.removeEventListener("end",O),r.removeEventListener("inputsourceschange",k);for(let N=0;N=0&&(v[ae]=null,b[ae].disconnect(ee))}for(let G=0;G=v.length){v.push(ee),ae=xe;break}else if(v[xe]===null){v[xe]=ee,ae=xe;break}if(ae===-1)break}const fe=b[ae];fe&&fe.connect(ee)}}const Z=new F,I=new F;function y(N,G,ee){Z.setFromMatrixPosition(G.matrixWorld),I.setFromMatrixPosition(ee.matrixWorld);const ae=Z.distanceTo(I),fe=G.projectionMatrix.elements,xe=ee.projectionMatrix.elements,De=fe[14]/(fe[10]-1),Ae=fe[14]/(fe[10]+1),be=(fe[9]+1)/fe[5],Qe=(fe[9]-1)/fe[5],Fe=(fe[8]-1)/fe[0],z=(xe[8]+1)/xe[0],rt=De*Fe,ge=De*z,Ce=ae/(-Fe+z),Re=Ce*-Fe;G.matrixWorld.decompose(N.position,N.quaternion,N.scale),N.translateX(Re),N.translateZ(Ce),N.matrixWorld.compose(N.position,N.quaternion,N.scale),N.matrixWorldInverse.copy(N.matrixWorld).invert();const ct=De+Ce,Ge=Ae+Ce,We=rt-Re,nt=ge+(ae-Re),yt=be*Ae/Ge*ct,Tt=Qe*Ae/Ge*ct;N.projectionMatrix.makePerspective(We,nt,yt,Tt,ct,Ge),N.projectionMatrixInverse.copy(N.projectionMatrix).invert()}function w(N,G){G===null?N.matrixWorld.copy(N.matrix):N.matrixWorld.multiplyMatrices(G.matrixWorld,N.matrix),N.matrixWorldInverse.copy(N.matrixWorld).invert()}this.updateCamera=function(N){if(r===null)return;C.near=R.near=M.near=N.near,C.far=R.far=M.far=N.far,(P!==C.near||S!==C.far)&&(r.updateRenderState({depthNear:C.near,depthFar:C.far}),P=C.near,S=C.far);const G=N.parent,ee=C.cameras;w(C,G);for(let ae=0;ae0&&(h.alphaTest.value=f.alphaTest);const b=e.get(f).envMap;if(b&&(h.envMap.value=b,h.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,h.reflectivity.value=f.reflectivity,h.ior.value=f.ior,h.refractionRatio.value=f.refractionRatio),f.lightMap){h.lightMap.value=f.lightMap;const v=n._useLegacyLights===!0?Math.PI:1;h.lightMapIntensity.value=f.lightMapIntensity*v,t(f.lightMap,h.lightMapTransform)}f.aoMap&&(h.aoMap.value=f.aoMap,h.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,h.aoMapTransform))}function a(h,f){h.diffuse.value.copy(f.color),h.opacity.value=f.opacity,f.map&&(h.map.value=f.map,t(f.map,h.mapTransform))}function o(h,f){h.dashSize.value=f.dashSize,h.totalSize.value=f.dashSize+f.gapSize,h.scale.value=f.scale}function c(h,f,b,v){h.diffuse.value.copy(f.color),h.opacity.value=f.opacity,h.size.value=f.size*b,h.scale.value=v*.5,f.map&&(h.map.value=f.map,t(f.map,h.uvTransform)),f.alphaMap&&(h.alphaMap.value=f.alphaMap,t(f.alphaMap,h.alphaMapTransform)),f.alphaTest>0&&(h.alphaTest.value=f.alphaTest)}function l(h,f){h.diffuse.value.copy(f.color),h.opacity.value=f.opacity,h.rotation.value=f.rotation,f.map&&(h.map.value=f.map,t(f.map,h.mapTransform)),f.alphaMap&&(h.alphaMap.value=f.alphaMap,t(f.alphaMap,h.alphaMapTransform)),f.alphaTest>0&&(h.alphaTest.value=f.alphaTest)}function u(h,f){h.specular.value.copy(f.specular),h.shininess.value=Math.max(f.shininess,1e-4)}function d(h,f){f.gradientMap&&(h.gradientMap.value=f.gradientMap)}function p(h,f){h.metalness.value=f.metalness,f.metalnessMap&&(h.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,h.metalnessMapTransform)),h.roughness.value=f.roughness,f.roughnessMap&&(h.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,h.roughnessMapTransform)),e.get(f).envMap&&(h.envMapIntensity.value=f.envMapIntensity)}function g(h,f,b){h.ior.value=f.ior,f.sheen>0&&(h.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),h.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(h.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,h.sheenColorMapTransform)),f.sheenRoughnessMap&&(h.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,h.sheenRoughnessMapTransform))),f.clearcoat>0&&(h.clearcoat.value=f.clearcoat,h.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(h.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,h.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(h.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,h.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(h.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,h.clearcoatNormalMapTransform),h.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Bt&&h.clearcoatNormalScale.value.negate())),f.iridescence>0&&(h.iridescence.value=f.iridescence,h.iridescenceIOR.value=f.iridescenceIOR,h.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],h.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(h.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,h.iridescenceMapTransform)),f.iridescenceThicknessMap&&(h.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,h.iridescenceThicknessMapTransform))),f.transmission>0&&(h.transmission.value=f.transmission,h.transmissionSamplerMap.value=b.texture,h.transmissionSamplerSize.value.set(b.width,b.height),f.transmissionMap&&(h.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,h.transmissionMapTransform)),h.thickness.value=f.thickness,f.thicknessMap&&(h.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,h.thicknessMapTransform)),h.attenuationDistance.value=f.attenuationDistance,h.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(h.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(h.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,h.anisotropyMapTransform))),h.specularIntensity.value=f.specularIntensity,h.specularColor.value.copy(f.specularColor),f.specularColorMap&&(h.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,h.specularColorMapTransform)),f.specularIntensityMap&&(h.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,h.specularIntensityMapTransform))}function _(h,f){f.matcap&&(h.matcap.value=f.matcap)}function m(h,f){const b=e.get(f).light;h.referencePosition.value.setFromMatrixPosition(b.matrixWorld),h.nearDistance.value=b.shadow.camera.near,h.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function Cv(n,e,t,i){let r={},s={},a=[];const o=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function c(b,v){const M=v.program;i.uniformBlockBinding(b,M)}function l(b,v){let M=r[b.id];M===void 0&&(_(b),M=u(b),r[b.id]=M,b.addEventListener("dispose",h));const R=v.program;i.updateUBOMapping(b,R);const L=e.render.frame;s[b.id]!==L&&(p(b),s[b.id]=L)}function u(b){const v=d();b.__bindingPointIndex=v;const M=n.createBuffer(),R=b.__size,L=b.usage;return n.bindBuffer(n.UNIFORM_BUFFER,M),n.bufferData(n.UNIFORM_BUFFER,R,L),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,v,M),M}function d(){for(let b=0;b0){L=M%R;const k=R-L;L!==0&&k-E.boundary<0&&(M+=R-L,S.__offset=M)}M+=E.storage}return L=M%R,L>0&&(M+=R-L),b.__size=M,b.__cache={},this}function m(b){const v={boundary:0,storage:0};return typeof b=="number"?(v.boundary=4,v.storage=4):b.isVector2?(v.boundary=8,v.storage=8):b.isVector3||b.isColor?(v.boundary=16,v.storage=12):b.isVector4?(v.boundary=16,v.storage=16):b.isMatrix3?(v.boundary=48,v.storage=48):b.isMatrix4?(v.boundary=64,v.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),v}function h(b){const v=b.target;v.removeEventListener("dispose",h);const M=a.indexOf(v.__bindingPointIndex);a.splice(M,1),n.deleteBuffer(r[v.id]),delete r[v.id],delete s[v.id]}function f(){for(const b in r)n.deleteBuffer(r[b]);a=[],r={},s={}}return{bind:c,update:l,dispose:f}}class cf{constructor(e={}){const{canvas:t=wp(),context:i=null,depth:r=!0,stencil:s=!0,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let p;i!==null?p=i.getContextAttributes().alpha:p=a;const g=new Uint32Array(4),_=new Int32Array(4);let m=null,h=null;const f=[],b=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Mt,this._useLegacyLights=!1,this.toneMapping=si,this.toneMappingExposure=1;const v=this;let M=!1,R=0,L=0,C=null,P=-1,S=null;const E=new at,O=new at;let k=null;const Z=new Ue(0);let I=0,y=t.width,w=t.height,D=1,q=null,V=null;const H=new at(0,0,y,w),N=new at(0,0,y,w);let G=!1;const ee=new Lc;let ae=!1,fe=!1,xe=null;const De=new mt,Ae=new je,be=new F,Qe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Fe(){return C===null?D:1}let z=i;function rt(T,B){for(let X=0;X{function pe(){if(j.forEach(function(ye){Ge.get(ye).currentProgram.isReady()&&j.delete(ye)}),j.size===0){$(T);return}setTimeout(pe,10)}ge.get("KHR_parallel_shader_compile")!==null?pe():setTimeout(pe,10)})};let Je=null;function ft(T){Je&&Je(T)}function jt(){Ct.stop()}function it(){Ct.start()}const Ct=new nf;Ct.setAnimationLoop(ft),typeof self<"u"&&Ct.setContext(self),this.setAnimationLoop=function(T){Je=T,me.setAnimationLoop(T),T===null?Ct.stop():Ct.start()},me.addEventListener("sessionstart",jt),me.addEventListener("sessionend",it),this.render=function(T,B){if(B!==void 0&&B.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(M===!0)return;T.matrixWorldAutoUpdate===!0&&T.updateMatrixWorld(),B.parent===null&&B.matrixWorldAutoUpdate===!0&&B.updateMatrixWorld(),me.enabled===!0&&me.isPresenting===!0&&(me.cameraAutoUpdate===!0&&me.updateCamera(B),B=me.getCamera()),T.isScene===!0&&T.onBeforeRender(v,T,B,C),h=ie.get(T,b.length),h.init(),b.push(h),De.multiplyMatrices(B.projectionMatrix,B.matrixWorldInverse),ee.setFromProjectionMatrix(De),fe=this.localClippingEnabled,ae=ve.init(this.clippingPlanes,fe),m=Q.get(T,f.length),m.init(),f.push(m),gn(T,B,0,v.sortObjects),m.finish(),v.sortObjects===!0&&m.sort(q,V),this.info.render.frame++,ae===!0&&ve.beginShadows();const X=h.state.shadowsArray;if(oe.render(X,T,B),ae===!0&&ve.endShadows(),this.info.autoReset===!0&&this.info.reset(),he.render(m,T),h.setupLights(v._useLegacyLights),B.isArrayCamera){const j=B.cameras;for(let $=0,pe=j.length;$0?h=b[b.length-1]:h=null,f.pop(),f.length>0?m=f[f.length-1]:m=null};function gn(T,B,X,j){if(T.visible===!1)return;if(T.layers.test(B.layers)){if(T.isGroup)X=T.renderOrder;else if(T.isLOD)T.autoUpdate===!0&&T.update(B);else if(T.isLight)h.pushLight(T),T.castShadow&&h.pushShadow(T);else if(T.isSprite){if(!T.frustumCulled||ee.intersectsSprite(T)){j&&be.setFromMatrixPosition(T.matrixWorld).applyMatrix4(De);const ye=x.update(T),Te=T.material;Te.visible&&m.push(T,ye,Te,X,be.z,null)}}else if((T.isMesh||T.isLine||T.isPoints)&&(!T.frustumCulled||ee.intersectsObject(T))){const ye=x.update(T),Te=T.material;if(j&&(T.boundingSphere!==void 0?(T.boundingSphere===null&&T.computeBoundingSphere(),be.copy(T.boundingSphere.center)):(ye.boundingSphere===null&&ye.computeBoundingSphere(),be.copy(ye.boundingSphere.center)),be.applyMatrix4(T.matrixWorld).applyMatrix4(De)),Array.isArray(Te)){const Ie=ye.groups;for(let Ve=0,Oe=Ie.length;Ve0&&yh($,pe,B,X),j&&Re.viewport(E.copy(j)),$.length>0&&Ms($,B,X),pe.length>0&&Ms(pe,B,X),ye.length>0&&Ms(ye,B,X),Re.buffers.depth.setTest(!0),Re.buffers.depth.setMask(!0),Re.buffers.color.setMask(!0),Re.setPolygonOffset(!1)}function yh(T,B,X,j){if((X.isScene===!0?X.overrideMaterial:null)!==null)return;const pe=Ce.isWebGL2;xe===null&&(xe=new Ii(1,1,{generateMipmaps:!0,type:ge.has("EXT_color_buffer_half_float")?qr:ai,minFilter:Xr,samples:pe?4:0})),v.getDrawingBufferSize(Ae),pe?xe.setSize(Ae.x,Ae.y):xe.setSize(Ko(Ae.x),Ko(Ae.y));const ye=v.getRenderTarget();v.setRenderTarget(xe),v.getClearColor(Z),I=v.getClearAlpha(),I<1&&v.setClearColor(16777215,.5),v.clear();const Te=v.toneMapping;v.toneMapping=si,Ms(T,X,j),We.updateMultisampleRenderTarget(xe),We.updateRenderTargetMipmap(xe);let Ie=!1;for(let Ve=0,Oe=B.length;Ve0),ke=!!X.morphAttributes.position,ut=!!X.morphAttributes.normal,zt=!!X.morphAttributes.color;let xt=si;j.toneMapped&&(C===null||C.isXRRenderTarget===!0)&&(xt=v.toneMapping);const An=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,lt=An!==void 0?An.length:0,qe=Ge.get(j),Xa=h.state.lights;if(ae===!0&&(fe===!0||T!==S)){const Ht=T===S&&j.id===P;ve.setState(j,T,Ht)}let ht=!1;j.version===qe.__version?(qe.needsLights&&qe.lightsStateVersion!==Xa.state.version||qe.outputColorSpace!==Te||$.isInstancedMesh&&qe.instancing===!1||!$.isInstancedMesh&&qe.instancing===!0||$.isSkinnedMesh&&qe.skinning===!1||!$.isSkinnedMesh&&qe.skinning===!0||$.isInstancedMesh&&qe.instancingColor===!0&&$.instanceColor===null||$.isInstancedMesh&&qe.instancingColor===!1&&$.instanceColor!==null||qe.envMap!==Ie||j.fog===!0&&qe.fog!==pe||qe.numClippingPlanes!==void 0&&(qe.numClippingPlanes!==ve.numPlanes||qe.numIntersection!==ve.numIntersection)||qe.vertexAlphas!==Ve||qe.vertexTangents!==Oe||qe.morphTargets!==ke||qe.morphNormals!==ut||qe.morphColors!==zt||qe.toneMapping!==xt||Ce.isWebGL2===!0&&qe.morphTargetsCount!==lt)&&(ht=!0):(ht=!0,qe.__version=j.version);let fi=qe.currentProgram;ht===!0&&(fi=Ts(j,B,$));let sl=!1,Ar=!1,qa=!1;const Lt=fi.getUniforms(),hi=qe.uniforms;if(Re.useProgram(fi.program)&&(sl=!0,Ar=!0,qa=!0),j.id!==P&&(P=j.id,Ar=!0),sl||S!==T){Lt.setValue(z,"projectionMatrix",T.projectionMatrix),Lt.setValue(z,"viewMatrix",T.matrixWorldInverse);const Ht=Lt.map.cameraPosition;Ht!==void 0&&Ht.setValue(z,be.setFromMatrixPosition(T.matrixWorld)),Ce.logarithmicDepthBuffer&&Lt.setValue(z,"logDepthBufFC",2/(Math.log(T.far+1)/Math.LN2)),(j.isMeshPhongMaterial||j.isMeshToonMaterial||j.isMeshLambertMaterial||j.isMeshBasicMaterial||j.isMeshStandardMaterial||j.isShaderMaterial)&&Lt.setValue(z,"isOrthographic",T.isOrthographicCamera===!0),S!==T&&(S=T,Ar=!0,qa=!0)}if($.isSkinnedMesh){Lt.setOptional(z,$,"bindMatrix"),Lt.setOptional(z,$,"bindMatrixInverse");const Ht=$.skeleton;Ht&&(Ce.floatVertexTextures?(Ht.boneTexture===null&&Ht.computeBoneTexture(),Lt.setValue(z,"boneTexture",Ht.boneTexture,We),Lt.setValue(z,"boneTextureSize",Ht.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const ja=X.morphAttributes;if((ja.position!==void 0||ja.normal!==void 0||ja.color!==void 0&&Ce.isWebGL2===!0)&&Le.update($,X,fi),(Ar||qe.receiveShadow!==$.receiveShadow)&&(qe.receiveShadow=$.receiveShadow,Lt.setValue(z,"receiveShadow",$.receiveShadow)),j.isMeshGouraudMaterial&&j.envMap!==null&&(hi.envMap.value=Ie,hi.flipEnvMap.value=Ie.isCubeTexture&&Ie.isRenderTargetTexture===!1?-1:1),Ar&&(Lt.setValue(z,"toneMappingExposure",v.toneMappingExposure),qe.needsLights&&Sh(hi,qa),pe&&j.fog===!0&&ne.refreshFogUniforms(hi,pe),ne.refreshMaterialUniforms(hi,j,D,w,xe),na.upload(z,il(qe),hi,We)),j.isShaderMaterial&&j.uniformsNeedUpdate===!0&&(na.upload(z,il(qe),hi,We),j.uniformsNeedUpdate=!1),j.isSpriteMaterial&&Lt.setValue(z,"center",$.center),Lt.setValue(z,"modelViewMatrix",$.modelViewMatrix),Lt.setValue(z,"normalMatrix",$.normalMatrix),Lt.setValue(z,"modelMatrix",$.matrixWorld),j.isShaderMaterial||j.isRawShaderMaterial){const Ht=j.uniformsGroups;for(let $a=0,bh=Ht.length;$a0&&We.useMultisampledRTT(T)===!1?$=Ge.get(T).__webglMultisampledFramebuffer:Array.isArray(Oe)?$=Oe[X]:$=Oe,E.copy(T.viewport),O.copy(T.scissor),k=T.scissorTest}else E.copy(H).multiplyScalar(D).floor(),O.copy(N).multiplyScalar(D).floor(),k=G;if(Re.bindFramebuffer(z.FRAMEBUFFER,$)&&Ce.drawBuffers&&j&&Re.drawBuffers(T,$),Re.viewport(E),Re.scissor(O),Re.setScissorTest(k),pe){const Ie=Ge.get(T.texture);z.framebufferTexture2D(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_CUBE_MAP_POSITIVE_X+B,Ie.__webglTexture,X)}else if(ye){const Ie=Ge.get(T.texture),Ve=B||0;z.framebufferTextureLayer(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,Ie.__webglTexture,X||0,Ve)}P=-1},this.readRenderTargetPixels=function(T,B,X,j,$,pe,ye){if(!(T&&T.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Te=Ge.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&ye!==void 0&&(Te=Te[ye]),Te){Re.bindFramebuffer(z.FRAMEBUFFER,Te);try{const Ie=T.texture,Ve=Ie.format,Oe=Ie.type;if(Ve!==fn&&et.convert(Ve)!==z.getParameter(z.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ke=Oe===qr&&(ge.has("EXT_color_buffer_half_float")||Ce.isWebGL2&&ge.has("EXT_color_buffer_float"));if(Oe!==ai&&et.convert(Oe)!==z.getParameter(z.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Oe===ii&&(Ce.isWebGL2||ge.has("OES_texture_float")||ge.has("WEBGL_color_buffer_float")))&&!ke){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}B>=0&&B<=T.width-j&&X>=0&&X<=T.height-$&&z.readPixels(B,X,j,$,et.convert(Ve),et.convert(Oe),pe)}finally{const Ie=C!==null?Ge.get(C).__webglFramebuffer:null;Re.bindFramebuffer(z.FRAMEBUFFER,Ie)}}},this.copyFramebufferToTexture=function(T,B,X=0){const j=Math.pow(2,-X),$=Math.floor(B.image.width*j),pe=Math.floor(B.image.height*j);We.setTexture2D(B,0),z.copyTexSubImage2D(z.TEXTURE_2D,X,0,0,T.x,T.y,$,pe),Re.unbindTexture()},this.copyTextureToTexture=function(T,B,X,j=0){const $=B.image.width,pe=B.image.height,ye=et.convert(X.format),Te=et.convert(X.type);We.setTexture2D(X,0),z.pixelStorei(z.UNPACK_FLIP_Y_WEBGL,X.flipY),z.pixelStorei(z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),z.pixelStorei(z.UNPACK_ALIGNMENT,X.unpackAlignment),B.isDataTexture?z.texSubImage2D(z.TEXTURE_2D,j,T.x,T.y,$,pe,ye,Te,B.image.data):B.isCompressedTexture?z.compressedTexSubImage2D(z.TEXTURE_2D,j,T.x,T.y,B.mipmaps[0].width,B.mipmaps[0].height,ye,B.mipmaps[0].data):z.texSubImage2D(z.TEXTURE_2D,j,T.x,T.y,ye,Te,B.image),j===0&&X.generateMipmaps&&z.generateMipmap(z.TEXTURE_2D),Re.unbindTexture()},this.copyTextureToTexture3D=function(T,B,X,j,$=0){if(v.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const pe=T.max.x-T.min.x+1,ye=T.max.y-T.min.y+1,Te=T.max.z-T.min.z+1,Ie=et.convert(j.format),Ve=et.convert(j.type);let Oe;if(j.isData3DTexture)We.setTexture3D(j,0),Oe=z.TEXTURE_3D;else if(j.isDataArrayTexture)We.setTexture2DArray(j,0),Oe=z.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}z.pixelStorei(z.UNPACK_FLIP_Y_WEBGL,j.flipY),z.pixelStorei(z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,j.premultiplyAlpha),z.pixelStorei(z.UNPACK_ALIGNMENT,j.unpackAlignment);const ke=z.getParameter(z.UNPACK_ROW_LENGTH),ut=z.getParameter(z.UNPACK_IMAGE_HEIGHT),zt=z.getParameter(z.UNPACK_SKIP_PIXELS),xt=z.getParameter(z.UNPACK_SKIP_ROWS),An=z.getParameter(z.UNPACK_SKIP_IMAGES),lt=X.isCompressedTexture?X.mipmaps[0]:X.image;z.pixelStorei(z.UNPACK_ROW_LENGTH,lt.width),z.pixelStorei(z.UNPACK_IMAGE_HEIGHT,lt.height),z.pixelStorei(z.UNPACK_SKIP_PIXELS,T.min.x),z.pixelStorei(z.UNPACK_SKIP_ROWS,T.min.y),z.pixelStorei(z.UNPACK_SKIP_IMAGES,T.min.z),X.isDataTexture||X.isData3DTexture?z.texSubImage3D(Oe,$,B.x,B.y,B.z,pe,ye,Te,Ie,Ve,lt.data):X.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),z.compressedTexSubImage3D(Oe,$,B.x,B.y,B.z,pe,ye,Te,Ie,lt.data)):z.texSubImage3D(Oe,$,B.x,B.y,B.z,pe,ye,Te,Ie,Ve,lt),z.pixelStorei(z.UNPACK_ROW_LENGTH,ke),z.pixelStorei(z.UNPACK_IMAGE_HEIGHT,ut),z.pixelStorei(z.UNPACK_SKIP_PIXELS,zt),z.pixelStorei(z.UNPACK_SKIP_ROWS,xt),z.pixelStorei(z.UNPACK_SKIP_IMAGES,An),$===0&&j.generateMipmaps&&z.generateMipmap(Oe),Re.unbindTexture()},this.initTexture=function(T){T.isCubeTexture?We.setTextureCube(T,0):T.isData3DTexture?We.setTexture3D(T,0):T.isDataArrayTexture||T.isCompressedArrayTexture?We.setTexture2DArray(T,0):We.setTexture2D(T,0),Re.unbindTexture()},this.resetState=function(){R=0,L=0,C=null,Re.reset(),Ne.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return zn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Ac?"display-p3":"srgb",t.unpackColorSpace=tt.workingColorSpace===Ua?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===Mt?Ai:Vd}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Ai?Mt:Gn}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class Lv extends cf{}Lv.prototype.isWebGL1Renderer=!0;class Pv extends Ft{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}class Iv extends _s{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ue(16777215),this.specular=new Ue(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ue(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Gd,this.normalScale=new je(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Tc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class lf extends Ft{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ue(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}const Ao=new mt,Au=new F,Ru=new F;class Dv{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new je(512,512),this.map=null,this.mapPass=null,this.matrix=new mt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Lc,this._frameExtents=new je(1,1),this._viewportCount=1,this._viewports=[new at(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;Au.setFromMatrixPosition(e.matrixWorld),t.position.copy(Au),Ru.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Ru),t.updateMatrixWorld(),Ao.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ao),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(Ao)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const Cu=new mt,Dr=new F,Ro=new F;class Uv extends Dv{constructor(){super(new Wt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new je(4,2),this._viewportCount=6,this._viewports=[new at(2,1,1,1),new at(0,1,1,1),new at(3,1,1,1),new at(1,1,1,1),new at(3,0,1,1),new at(1,0,1,1)],this._cubeDirections=[new F(1,0,0),new F(-1,0,0),new F(0,0,1),new F(0,0,-1),new F(0,1,0),new F(0,-1,0)],this._cubeUps=[new F(0,1,0),new F(0,1,0),new F(0,1,0),new F(0,1,0),new F(0,0,1),new F(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),Dr.setFromMatrixPosition(e.matrixWorld),i.position.copy(Dr),Ro.copy(i.position),Ro.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(Ro),i.updateMatrixWorld(),r.makeTranslation(-Dr.x,-Dr.y,-Dr.z),Cu.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Cu)}}class da extends lf{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new Uv}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Nv extends lf{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Ov{constructor(e,t,i=0,r=1/0){this.ray=new $d(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new Cc,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,i=[]){return Qo(e,this,i,t),i.sort(Lu),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r{t.setSize(window.innerWidth,window.innerHeight),e.aspect=window.innerWidth/window.innerHeight,e.updateProjectionMatrix()}),{scene:n,camera:e,renderer:t,lights:i}}function Lo(n,e,t){return n+(e-n)*t}function Zs(n,e){e*=n.length-1;let t=Math.floor(e),i=e-t,r=n[t],s=n[t{c+=u.amount,l+=1}),c>this.allTimeMax&&(this.allTimeMax=c),l>this.allTimeMaxNumTrans&&(this.allTimeMaxNumTrans=l),s.totalTransactionsValueOut>this.allTimeMaxBar&&(this.allTimeMaxBar=s.totalTransactionsValueOut),a.totalTransactionsValueOut>this.allTimeMaxBar&&(this.allTimeMaxBar=a.totalTransactionsValueOut),s.numTransactionsOut>this.allTimeMaxNumTransBar&&(this.allTimeMaxNumTransBar=s.numTransactionsOut),a.numTransactionsOut>this.allTimeMaxNumTransBar&&(this.allTimeMaxNumTransBar=a.numTransactionsOut)}getTransactions(e,t){let i=this.transactions.get([e,t].toString());return i||[]}getTransactionsValue(e,t){let i=this.transactions.get([e,t].toString());if(i){let r=0;return i.forEach(s=>r+=s.amount),r}else return 0}getTotalNumTransactions(e,t){let i=this.transactions.get([e,t].toString());return i?i.length:0}compareNodeNumTransactions(e,t){return t.node.numTransactionsOut-e.node.numTransactionsOut}compareNodeTotals(e,t){return t.node.totalTransactionsValueOut-e.node.totalTransactionsValueOut}compareLargestTransaction(e,t){return Math.max(t.node.largestTransactionOut,t.node.largestTransactionIn)-Math.max(e.node.largestTransactionOut,e.node.largestTransactionIn)}loadData(e,t=-1,i=-1){this.dataToLoad=e,this.isLoaded=!1}loadDataHelper(e,t=-1,i=-1){this.allTimeMax=.01,this.allTimeMaxNumTrans=1,this.allTimeMaxBar=.01,this.allTimeMaxNumTransBar=1;let r=e.transactions;e.nodes.forEach(s=>this.addNode(s)),r.forEach(s=>{this.nodes.get(s.from)&&this.nodes.get(s.to)?this.addTransaction(s.from,s.to,Number(s.amount),s.timestamp):console.log("failed to add transaction")}),this.nodeArray=Array.from(this.nodes,([s,a])=>({id:s,node:a})),this.toggleSort==0?this.nodeArray.sort(this.compareNodeTotals):this.toggleSort==1?this.nodeArray.sort(this.compareNodeNumTransactions):this.toggleSort==2?this.nodeArray.sort(this.compareLargestTransaction):console.log("Sorting method unrecognized:",this.toggleSort),this.isLoaded=!0}loadBlocks(e,t,i,r=!1){if(!this.isLoaded)return;let s=e+i=this.allTimeMax,this.scene.add(_.getCube()),this.loadedBlocks.set([o,c].toString(),_),this.loadingBlocks.set([o,c].toString(),_),this.blocks.push(_)}}createTempBlocks(){}clearTempBlocks(){}unloadBlocks(e,t,i){if(!this.isLoaded)return;let r=e+i({key:p,value:g})).forEach(p=>{p.value.forEach(g=>{s+=g.amount,a+=1,o.push({to:p.key,amount:g.amount,time:g.time})})});let l=this.toggleSort==1?a:s,u=this.toggleSort==1?this.allTimeMaxNumTransBar:this.allTimeMaxBar,d=new Nu(this.nodeArray[r].id,null,o,l,u);d.setPosition(r*(Qn+tr),0*(Qn+tr)),d.pos=[r,0],this.scene.add(d.getCube()),this.loadedBlocks.set([r,0].toString(),d),this.loadingBlocks.set([r,0].toString(),d),this.blocks.push(d)}}getBlocks(){return this.blocks}clearBlocks(){for(let e=0;e0){this.blocksToClear.forEach(e=>{this.scene.remove(e.getCube())});for(let e=0;e0&&(t.getCube().material.opacity-=.01)}}else this.clearing=!1,this.blocks=[],this.loadedBlocks=new Map}clearData(){for(let e=0;e({key:t,val:i})).forEach(t=>{let i=t.val,r=i.pos[1];i.getCube().material.opacity=3-.2*r})}update(){if(this.isLoaded){let e=Array.from(this.loadingBlocks,([t,i])=>({key:t,val:i}));e.length>0,e.forEach(t=>{let i=t.val,r=i.yScale+(i.finalScale-i.yScale)*.1;i.getCube().material.opacity<=1&&(i.getCube().material.opacity+=.05),i.yScale=1&&(i.getCube().material.opacity=1,this.loadingBlocks.delete(t.key.toString()))}),e.length==0&&this.clearTempBlocks()}else{let e=Array.from(this.loadedBlocks,([t,i])=>({key:t,val:i}));e.forEach(t=>{let i=t.val,r=ei+(i.yScale-ei)*.9;i.getCube().material.opacity>0&&(i.getCube().material.opacity-=Wv),i.yScale>ei&&(i.getCube().geometry.scale(1,1/i.yScale,1),r-.1{r+=s.amount}),r>this.largestTransactionOut&&(this.largestTransactionOut=r)}addTransactionIn(e,t,i=0){this.transactionsIn.get(e.id)||this.transactionsIn.set(e.id,[]),this.transactionsIn.get(e.id).push({amount:t,time:i}),this.numTransactionsIn+=1,this.totalTransactionsValueIn+=t;let r=0;this.transactionsIn.get(e.id).forEach(s=>{r+=s.amount}),r>this.largestTransactionIn&&(this.largestTransactionIn=r)}}class uf{constructor(e,t){this.name=e,this.domParent=t,this.div=document.createElement("div"),this.div.id=e.replaceAll(" ","-")+"-div",this.div.classList.add("elementDiv"),this.id=e.replaceAll(" ","-"),t=="body"?this.domElement=document.body:this.domParent=document.getElementById(t),this.elements=[],this.endBreak=document.createElement("BR"),this.domParent.appendChild(this.div),this.labelBreak=document.createElement("BR"),this.label=document.createElement("label"),this.label.id=e.replaceAll(" ","-"),this.label.innerHTML=e,this.tooltip=""}createLineBreak(){return document.createElement("BR")}addElements(){this.elements.forEach(e=>{this.div.appendChild(e)})}removeDiv(){this.div.remove()}addDiv(){this.domParent.appendChild(this.div)}hideLabel(){this.label.remove(),this.labelBreak.remove()}showLabel(){this.div.prepend(this.labelBreak),this.div.prepend(this.label)}removeElement(e){this.elements[e].remove(),this.elements.splice(e,1)}addElement(e){this.elements.push(e),this.domParent.appendChild(e)}addClass(e){this.div.classList.add(e)}setToolTip(e,t){this.div.classList.contains("tooltip")||this.div.classList.add("tooltip");let i=document.createElement("span");i.classList.add("tooltiptext"),i.classList.add(t),i.innerHTML=e,this.tooltip=e,this.elements.push(i),this.div.appendChild(i)}}class Gr{constructor(e,t,i=!1){this.div=document.createElement("div"),this.div.id=e,i?this.div.classList.add("verticalContainer"):this.div.classList.add("horizontalContainer"),t=="body"?this.domElement=document.body:this.domParent=document.getElementById(t),this.domParent.appendChild(this.div)}addBlock(){let e=Array.prototype.slice.call(arguments);for(let t=0;t{this.showing?(this.hideOptions(),this.showing=!1):(this.showOptions(),this.showing=!0)}),this.button.button.innerHTML=i+": "+r[0][0],this.buttons=[],this.selected=this.options[0],this.text=i,this.name=e,this.container.addBlock(this.button)}showOptions(){this.button.div.remove();for(let e=0;e{this.selected!=this.options[e]&&(this.selected=this.options[e],this.options[e][1](),this.button.button.innerHTML=this.text+": "+this.options[e][0]),this.showing=!1,this.hideOptions()});t.div.classList.add("option"),this.options[e].length>=3&&(t.setToolTip(this.button.tooltip,"topTooltip"),t.setToolTip(this.options[e][2],"bottomTooltip")),this.buttons.push(t),this.container.addBlock(t)}this.container.addBlock(this.button),this.container.div.style.marginTop="-"+Number(this.button.div.offsetHeight*this.options.length*2)+"px"}hideOptions(){this.buttons.forEach(e=>{e.div.remove()}),this.container.div.style.marginTop="0px"}}const Ou=15,Bu=.99,jv=40,$v=5,Dn=10,Ks=5,Fu=10,ku=1,zu=.3,Po=2e4,Hu=0,Js=["yellow",2,10,1],Qs=["purple",80,20,2],Vu=1;function nr(n,e,t){return n+(e-n)*t}class Zv{constructor(e,t,i){this.scene=e,this.camera=t,this.transactionsGrid=i,this.mouse=new je,this.lastMouse=new je,this.raycaster=new Ov,this.isMouseHold=!1,this.cameraAccel=new je,this.highlightedBlock=null,this.clickedBlock=null,this.selectedBlock=null,this.selectedDiv,this.hlLight,this.hoverLight,this.hoverLightExists=!1,this.canScroll=!0,this.loadedChunks=new Map,this.isDataLoaded=!1,this.cameraMode=0,this.transitioning=!1,this.resettingCamera=!1,this.sideBarTransactionsToLoad=[],this.transitionSpeed=.008,this.cameraGridView={position:new F(0,10,0),lookAtDelta:new F(0,-1,0)},this.cameraBarView={position:new F(0,2,8),lookAtDelta:new F(0,-1,-3)},this.storedCamera,this.cameraTVal=0,this.addressDiv1=document.createElement("div"),this.addressDiv1.id="addressDiv1",document.body.appendChild(this.addressDiv1),this.addressDiv2=document.createElement("div"),this.addressDiv2.id="addressDiv2",document.body.appendChild(this.addressDiv2),this.selects=[]}mouseUpdate(){(this.lastMouse.x!=this.mouse.x||this.lastMouseY!=this.mouse.y)&&this.updateHighlight(),this.lastMouse.x=this.mouse.x,this.lastMouse.y=this.mouse.y,this.mouse.x=event.clientX/window.innerWidth*2-1,this.mouse.y=-(event.clientY/window.innerHeight)*2+1}updateHighlight(){let e=this.transactionsGrid.getBlocks(),t=e.flat().map(r=>r.getCube());this.raycaster.setFromCamera(this.mouse,this.camera);let i=this.raycaster.intersectObjects(t,!1);if(i.length>0&&this.transactionsGrid.canHover){let r=i[0].object;e.flat().forEach(s=>{r==s.getCube()?(s.toggleHighlight(!0),this.highlightedBlock=s):s.toggleHighlight(!1)})}else this.highlightedBlock&&this.highlightedBlock.toggleHighlight(!1),this.highlightedBlock=null;if(this.highlightedBlock&&this.transactionsGrid.displayFrom){this.transactionsGrid.displayFrom.label.innerHTML="From: "+this.highlightedBlock.node1,this.transactionsGrid.displayTo.label.innerHTML="To: "+this.highlightedBlock.node2,this.transactionsGrid.toggleSort==1?this.transactionsGrid.displayAmount.label.innerHTML="Number of Transactions: "+this.highlightedBlock.getTransactionsValue():this.transactionsGrid.displayAmount.label.innerHTML="Transactions Sum: "+this.highlightedBlock.getTransactionsValue();let r=this.highlightedBlock.getCube().position.clone();r.y+=this.highlightedBlock.yScale/2,r.project(this.transactionsGrid.camera);let s=(r.x+1)*window.innerWidth/2,a=(1-r.y)*window.innerHeight/2;if(this.addressDiv1.style.left=s-Po-Hu+"px",this.addressDiv1.style.top=a+"px",this.addressDiv2.style.left=s-Po/2+"px",this.addressDiv2.style.top=a-Po/2-Hu+"px",!this.hoverLightExists){let o=this.cameraMode==1?Vu:0;this.hoverLight=new da(Js[0],Js[1],Js[2],Js[3]),this.hoverLight.position.x=this.highlightedBlock.getCube().position.x,this.hoverLight.position.y=this.highlightedBlock.getCube().position.y+this.highlightedBlock.yScale/2+1,this.hoverLight.position.z=this.highlightedBlock.getCube().position.z+o,this.scene.add(this.hoverLight),this.hoverLightExists=!0}}else this.addressDiv1.style.left="-100000px",this.addressDiv1.style.top="-100000px",this.addressDiv2.style.left="-100000px",this.addressDiv2.style.top="-10000px",this.hoverLightExists&&(this.scene.remove(this.hoverLight),this.hoverLightExists=!1)}onMouseMove(e){if(this.mouseUpdate(),this.isMouseHold&&this.transactionsGrid.canDrag){let t=this.mouse.x-this.lastMouse.x,i=this.mouse.y-this.lastMouse.y;this.camera.position.x+=-t*Ou,this.camera.position.z+=i*Ou*(window.innerHeight/window.innerWidth),this.cameraAccel.x=t,this.cameraAccel.y=i,this.bindCamera()}}onMouseDown(e){this.mouseUpdate(),this.isMouseHold=!0}onMouseClick(e){this.mouseUpdate()}onMouseDblClick(e){if(this.mouseUpdate(),this.isMouseHold=!1,this.transactionsGrid.canDrag=!0,this.clickedBlock&&this.transactionsGrid.canHover&&this.highlightedBlock){this.selectedBlock&&this.selectedBlock.toggleSelect(!1),this.selectedBlock=this.clickedBlock;let t=document.getElementById("sideDiv");t.style.width="300px",t.style.padding="10px";let i=this.cameraMode==1?Vu:0;this.hlLight=new da(Qs[0],Qs[1],Qs[2],Qs[3]),this.hlLight.position.x=this.selectedBlock.getCube().position.x,this.hlLight.position.y=this.selectedBlock.getCube().position.y+this.selectedBlock.yScale/2+1,this.hlLight.position.z=this.selectedBlock.getCube().position.z+i,this.scene.add(this.hlLight),this.selectedDiv&&this.selectedDiv.removeDiv(),this.selectedDiv=new Gr("transaction select","sideDiv",!0);let r=new Kt("transaction from","sideDiv","From: "+String(this.clickedBlock.node1).substring(0,20)+"...");if(this.clickedBlock.node2){let s=new Kt("transaction to","sideDiv","To: "+String(this.clickedBlock.node2).substring(0,20)+"...");this.selectedDiv.addBlock(r,s)}else this.selectedDiv.addBlock(r);if(this.clickedBlock.transactions.sort(function(s,a){return new Date(a.time)-new Date(s.time)}),this.clickedBlock.transactions.forEach(s=>{this.sideBarTransactionsToLoad.push(s)}),this.sideBarTransactionsToLoad.length==0){let s=new Gr("tCont","sideDiv",!0),a=new Kt("transaction","sideDiv","Amount: NA");s.addBlock(a),this.selectedDiv.addBlock(s)}this.selectedBlock.toggleSelect(!0)}}addTransactionsToSideBar(e){if(e.amount>0){let t=new Gr("tCont","sideDiv",!0),i;e.to&&(i=new Kt("transaction to inner","sideDiv","To: "+String(e.to)));let r=new Kt("transaction amount","sideDiv","Amount: "+String(e.amount)),s;if(this.transactionsGrid.dataType==0){let a=new Date(e.time),o=String(a.getHours());o.length==1&&(o="0"+o);let c=String(a.getMinutes());c.length==1&&(c="0"+c);let l=String(a.getSeconds());l.length==1&&(l="0"+l);let u=String(a.getFullYear())+"-"+String(a.getMonth())+"-"+String(a.getDay())+" "+o+":"+c+":"+l;u=="NaN-NaN-NaN NaN:NaN:NaN"&&(u="N/A"),s=new Kt("transaction time","sideDiv","Time: "+u)}else{let a=e.time;s=new Kt("transaction time","sideDiv","Time: "+a)}i?t.addBlock(i,r,s):t.addBlock(r,s),this.selectedDiv.addBlock(t)}}onWheelEvent(e){if(!this.canScroll)return;e.deltaX;let t=e.deltaY;t>0&&this.camera.position.y$v&&this.cameraMode==0&&(this.camera.position.y-=.2,this.updateHighlight())}unselectBlock(){if(this.clickedBlock){this.clickedBlock.toggleSelect(!1);let e=document.getElementById("sideDiv");e.style.width="0px",e.style.padding="10px 0px 10px 0px",this.scene.remove(this.hlLight)}this.sideBarTransactionsToLoad=[]}onMouseUp(e){this.isMouseHold=!1,this.transactionsGrid.canDrag=!0,this.lastMouse.x==this.mouse.x&&this.lastMouse.y==this.mouse.y&&(this.unselectBlock(),this.clickedBlock=this.highlightedBlock)}update(){if(this.sideBarTransactionsToLoad.length>0){let e=this.sideBarTransactionsToLoad.shift();this.addTransactionsToSideBar(e)}if(this.transitioning){this.cameraTVal+=this.transitionSpeed,this.cameraTVal>=1&&(this.transitioning=!1,this.resettingCamera=!1,this.cameraTVal=1);let e;this.cameraMode==0?e=this.cameraGridView:e=this.cameraBarView;let t=nr(this.storedCamera.position.x,e.position.x,this.cameraTVal),i=nr(this.storedCamera.position.y,e.position.y,this.cameraTVal),r=nr(this.storedCamera.position.z,e.position.z,this.cameraTVal),s=nr(this.storedCamera.lookAtDelta.x,e.lookAtDelta.x,this.cameraTVal),a=nr(this.storedCamera.lookAtDelta.y,e.lookAtDelta.y,this.cameraTVal),o=nr(this.storedCamera.lookAtDelta.z,e.lookAtDelta.z,this.cameraTVal);this.resettingCamera?this.camera.position.set(t,i,r):this.camera.position.set(this.camera.position.x,i,r),this.camera.lookAt(this.camera.position.x+s,this.camera.position.y+a,this.camera.position.z+o),this.cameraTVal>=1&&(this.cameraTVal=0)}else this.isMouseHold||(this.cameraAccel.x*=Bu,this.cameraAccel.y*=Bu,Math.abs(this.cameraAccel.x)<.005&&(this.cameraAccel.x=0),Math.abs(this.cameraAccel.y)<.005&&(this.cameraAccel.y=0),this.camera.position.x+=-this.cameraAccel.x,this.camera.position.z+=this.cameraAccel.y,this.bindCamera()),this.cameraMode==1&&(this.camera.position.z=this.cameraBarView.position.z);if(this.isDataLoaded&&this.transactionsGrid.isLoaded){let e=(ku+zu)*Dn;for(let s=-Ks;s<=Ks;s++)for(let a=-Ks;a<=Ks;a++){let o=Math.floor(this.camera.position.x/e)+s,c=Math.floor(this.camera.position.z/e)+a;o>=0&&c>=0&&(this.loadedChunks.get([o,c].toString())||(this.loadedChunks.set([o,c].toString(),!0),this.cameraMode==0?this.transactionsGrid.loadBlocks(o*Dn,c*Dn,Dn,!1):this.transactionsGrid.loadBars(o*Dn,Dn)))}let t=Math.floor(this.camera.position.x/e),i=Math.floor(this.camera.position.z/e);Array.from(this.loadedChunks).forEach(s=>{let a=s[0].split(",").map(o=>Number(o));this.loadedChunks.get([a[0],a[1]].toString())&&(Math.abs(a[0]-t)>Fu||Math.abs(a[1]-i)>Fu)&&(this.loadedChunks.set([a[0],a[1]].toString(),!1),this.transactionsGrid.unloadBlocks(a[0]*Dn,a[1]*Dn,Dn))})}this.bindCamera()}clearChunks(){this.loadedChunks=new Map}setCamera(e){this.unselectBlock(),this.transitionSpeed=.008,this.transitioning=!0,e==0?(this.storedCamera={position:this.camera.position.clone(),lookAtDelta:this.cameraBarView.lookAtDelta},this.addressDiv1.style.height="2px",this.addressDiv2.style.height="2px"):e==1&&(this.storedCamera={position:this.camera.position.clone(),lookAtDelta:this.cameraGridView.lookAtDelta},this.addressDiv1.style.height="0px",this.addressDiv2.style.height="0px"),this.cameraMode=e}resetCamera(){this.transitioning=!0,this.resettingCamera=!0,this.transitionSpeed=.05,this.storedCamera={position:this.camera.position.clone(),lookAtDelta:this.cameraGridView.lookAtDelta},this.cameraAccel=new je}bindCamera(){if(this.isDataLoaded){if(!this.transactionsGrid.nodeArray)return;let e=(ku+zu)*this.transactionsGrid.nodeArray.length;this.camera.position.x>e&&(this.camera.position.x=e),this.camera.position.x<0&&(this.camera.position.x=0),this.camera.position.z>e&&(this.camera.position.z=e),this.camera.position.z<0&&(this.camera.position.z=0)}}}function df(n,e){return function(){return n.apply(e,arguments)}}const{toString:Yv}=Object.prototype,{getPrototypeOf:Dc}=Object,Ba=(n=>e=>{const t=Yv.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),wn=n=>(n=n.toLowerCase(),e=>Ba(e)===n),Fa=n=>e=>typeof e===n,{isArray:wr}=Array,jr=Fa("undefined");function Kv(n){return n!==null&&!jr(n)&&n.constructor!==null&&!jr(n.constructor)&&en(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const ff=wn("ArrayBuffer");function Jv(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&ff(n.buffer),e}const Qv=Fa("string"),en=Fa("function"),hf=Fa("number"),ka=n=>n!==null&&typeof n=="object",ey=n=>n===!0||n===!1,ia=n=>{if(Ba(n)!=="object")return!1;const e=Dc(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},ty=wn("Date"),ny=wn("File"),iy=wn("Blob"),ry=wn("FileList"),sy=n=>ka(n)&&en(n.pipe),ay=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||en(n.append)&&((e=Ba(n))==="formdata"||e==="object"&&en(n.toString)&&n.toString()==="[object FormData]"))},oy=wn("URLSearchParams"),cy=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function vs(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let i,r;if(typeof n!="object"&&(n=[n]),wr(n))for(i=0,r=n.length;i0;)if(r=t[i],e===r.toLowerCase())return r;return null}const mf=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,gf=n=>!jr(n)&&n!==mf;function tc(){const{caseless:n}=gf(this)&&this||{},e={},t=(i,r)=>{const s=n&&pf(e,r)||r;ia(e[s])&&ia(i)?e[s]=tc(e[s],i):ia(i)?e[s]=tc({},i):wr(i)?e[s]=i.slice():e[s]=i};for(let i=0,r=arguments.length;i(vs(e,(r,s)=>{t&&en(r)?n[s]=df(r,t):n[s]=r},{allOwnKeys:i}),n),uy=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),dy=(n,e,t,i)=>{n.prototype=Object.create(e.prototype,i),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},fy=(n,e,t,i)=>{let r,s,a;const o={};if(e=e||{},n==null)return e;do{for(r=Object.getOwnPropertyNames(n),s=r.length;s-- >0;)a=r[s],(!i||i(a,n,e))&&!o[a]&&(e[a]=n[a],o[a]=!0);n=t!==!1&&Dc(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},hy=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const i=n.indexOf(e,t);return i!==-1&&i===t},py=n=>{if(!n)return null;if(wr(n))return n;let e=n.length;if(!hf(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},my=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&Dc(Uint8Array)),gy=(n,e)=>{const i=(n&&n[Symbol.iterator]).call(n);let r;for(;(r=i.next())&&!r.done;){const s=r.value;e.call(n,s[0],s[1])}},_y=(n,e)=>{let t;const i=[];for(;(t=n.exec(e))!==null;)i.push(t);return i},vy=wn("HTMLFormElement"),yy=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,i,r){return i.toUpperCase()+r}),Gu=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),xy=wn("RegExp"),_f=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),i={};vs(t,(r,s)=>{let a;(a=e(r,s,n))!==!1&&(i[s]=a||r)}),Object.defineProperties(n,i)},Sy=n=>{_f(n,(e,t)=>{if(en(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const i=n[t];if(en(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},Ey=(n,e)=>{const t={},i=r=>{r.forEach(s=>{t[s]=!0})};return wr(n)?i(n):i(String(n).split(e)),t},by=()=>{},My=(n,e)=>(n=+n,Number.isFinite(n)?n:e),Io="abcdefghijklmnopqrstuvwxyz",Wu="0123456789",vf={DIGIT:Wu,ALPHA:Io,ALPHA_DIGIT:Io+Io.toUpperCase()+Wu},Ty=(n=16,e=vf.ALPHA_DIGIT)=>{let t="";const{length:i}=e;for(;n--;)t+=e[Math.random()*i|0];return t};function wy(n){return!!(n&&en(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const Ay=n=>{const e=new Array(10),t=(i,r)=>{if(ka(i)){if(e.indexOf(i)>=0)return;if(!("toJSON"in i)){e[r]=i;const s=wr(i)?[]:{};return vs(i,(a,o)=>{const c=t(a,r+1);!jr(c)&&(s[o]=c)}),e[r]=void 0,s}}return i};return t(n,0)},Ry=wn("AsyncFunction"),Cy=n=>n&&(ka(n)||en(n))&&en(n.then)&&en(n.catch),K={isArray:wr,isArrayBuffer:ff,isBuffer:Kv,isFormData:ay,isArrayBufferView:Jv,isString:Qv,isNumber:hf,isBoolean:ey,isObject:ka,isPlainObject:ia,isUndefined:jr,isDate:ty,isFile:ny,isBlob:iy,isRegExp:xy,isFunction:en,isStream:sy,isURLSearchParams:oy,isTypedArray:my,isFileList:ry,forEach:vs,merge:tc,extend:ly,trim:cy,stripBOM:uy,inherits:dy,toFlatObject:fy,kindOf:Ba,kindOfTest:wn,endsWith:hy,toArray:py,forEachEntry:gy,matchAll:_y,isHTMLForm:vy,hasOwnProperty:Gu,hasOwnProp:Gu,reduceDescriptors:_f,freezeMethods:Sy,toObjectSet:Ey,toCamelCase:yy,noop:by,toFiniteNumber:My,findKey:pf,global:mf,isContextDefined:gf,ALPHABET:vf,generateString:Ty,isSpecCompliantForm:wy,toJSONObject:Ay,isAsyncFn:Ry,isThenable:Cy};function Ze(n,e,t,i,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),i&&(this.request=i),r&&(this.response=r)}K.inherits(Ze,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:K.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const yf=Ze.prototype,xf={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{xf[n]={value:n}});Object.defineProperties(Ze,xf);Object.defineProperty(yf,"isAxiosError",{value:!0});Ze.from=(n,e,t,i,r,s)=>{const a=Object.create(yf);return K.toFlatObject(n,a,function(c){return c!==Error.prototype},o=>o!=="isAxiosError"),Ze.call(a,n.message,e,t,i,r),a.cause=n,a.name=n.name,s&&Object.assign(a,s),a};const Ly=null;function nc(n){return K.isPlainObject(n)||K.isArray(n)}function Sf(n){return K.endsWith(n,"[]")?n.slice(0,-2):n}function Xu(n,e,t){return n?n.concat(e).map(function(r,s){return r=Sf(r),!t&&s?"["+r+"]":r}).join(t?".":""):e}function Py(n){return K.isArray(n)&&!n.some(nc)}const Iy=K.toFlatObject(K,{},null,function(e){return/^is[A-Z]/.test(e)});function za(n,e,t){if(!K.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=K.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,h){return!K.isUndefined(h[m])});const i=t.metaTokens,r=t.visitor||u,s=t.dots,a=t.indexes,c=(t.Blob||typeof Blob<"u"&&Blob)&&K.isSpecCompliantForm(e);if(!K.isFunction(r))throw new TypeError("visitor must be a function");function l(_){if(_===null)return"";if(K.isDate(_))return _.toISOString();if(!c&&K.isBlob(_))throw new Ze("Blob is not supported. Use a Buffer instead.");return K.isArrayBuffer(_)||K.isTypedArray(_)?c&&typeof Blob=="function"?new Blob([_]):Buffer.from(_):_}function u(_,m,h){let f=_;if(_&&!h&&typeof _=="object"){if(K.endsWith(m,"{}"))m=i?m:m.slice(0,-2),_=JSON.stringify(_);else if(K.isArray(_)&&Py(_)||(K.isFileList(_)||K.endsWith(m,"[]"))&&(f=K.toArray(_)))return m=Sf(m),f.forEach(function(v,M){!(K.isUndefined(v)||v===null)&&e.append(a===!0?Xu([m],M,s):a===null?m:m+"[]",l(v))}),!1}return nc(_)?!0:(e.append(Xu(h,m,s),l(_)),!1)}const d=[],p=Object.assign(Iy,{defaultVisitor:u,convertValue:l,isVisitable:nc});function g(_,m){if(!K.isUndefined(_)){if(d.indexOf(_)!==-1)throw Error("Circular reference detected in "+m.join("."));d.push(_),K.forEach(_,function(f,b){(!(K.isUndefined(f)||f===null)&&r.call(e,f,K.isString(b)?b.trim():b,m,p))===!0&&g(f,m?m.concat(b):[b])}),d.pop()}}if(!K.isObject(n))throw new TypeError("data must be an object");return g(n),e}function qu(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function Uc(n,e){this._pairs=[],n&&za(n,this,e)}const Ef=Uc.prototype;Ef.append=function(e,t){this._pairs.push([e,t])};Ef.toString=function(e){const t=e?function(i){return e.call(this,i,qu)}:qu;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function Dy(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function bf(n,e,t){if(!e)return n;const i=t&&t.encode||Dy,r=t&&t.serialize;let s;if(r?s=r(e,t):s=K.isURLSearchParams(e)?e.toString():new Uc(e,t).toString(i),s){const a=n.indexOf("#");a!==-1&&(n=n.slice(0,a)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class ju{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){K.forEach(this.handlers,function(i){i!==null&&e(i)})}}const Mf={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Uy=typeof URLSearchParams<"u"?URLSearchParams:Uc,Ny=typeof FormData<"u"?FormData:null,Oy=typeof Blob<"u"?Blob:null,By={isBrowser:!0,classes:{URLSearchParams:Uy,FormData:Ny,Blob:Oy},protocols:["http","https","file","blob","url","data"]},Tf=typeof window<"u"&&typeof document<"u",Fy=(n=>Tf&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),ky=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",zy=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Tf,hasStandardBrowserEnv:Fy,hasStandardBrowserWebWorkerEnv:ky},Symbol.toStringTag,{value:"Module"})),xn={...zy,...By};function Hy(n,e){return za(n,new xn.classes.URLSearchParams,Object.assign({visitor:function(t,i,r,s){return xn.isNode&&K.isBuffer(t)?(this.append(i,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function Vy(n){return K.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Gy(n){const e={},t=Object.keys(n);let i;const r=t.length;let s;for(i=0;i=t.length;return a=!a&&K.isArray(r)?r.length:a,c?(K.hasOwnProp(r,a)?r[a]=[r[a],i]:r[a]=i,!o):((!r[a]||!K.isObject(r[a]))&&(r[a]=[]),e(t,i,r[a],s)&&K.isArray(r[a])&&(r[a]=Gy(r[a])),!o)}if(K.isFormData(n)&&K.isFunction(n.entries)){const t={};return K.forEachEntry(n,(i,r)=>{e(Vy(i),r,t,0)}),t}return null}function Wy(n,e,t){if(K.isString(n))try{return(e||JSON.parse)(n),K.trim(n)}catch(i){if(i.name!=="SyntaxError")throw i}return(t||JSON.stringify)(n)}const ys={transitional:Mf,adapter:["xhr","http"],transformRequest:[function(e,t){const i=t.getContentType()||"",r=i.indexOf("application/json")>-1,s=K.isObject(e);if(s&&K.isHTMLForm(e)&&(e=new FormData(e)),K.isFormData(e))return r?JSON.stringify(wf(e)):e;if(K.isArrayBuffer(e)||K.isBuffer(e)||K.isStream(e)||K.isFile(e)||K.isBlob(e))return e;if(K.isArrayBufferView(e))return e.buffer;if(K.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(i.indexOf("application/x-www-form-urlencoded")>-1)return Hy(e,this.formSerializer).toString();if((o=K.isFileList(e))||i.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return za(o?{"files[]":e}:e,c&&new c,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),Wy(e)):e}],transformResponse:[function(e){const t=this.transitional||ys.transitional,i=t&&t.forcedJSONParsing,r=this.responseType==="json";if(e&&K.isString(e)&&(i&&!this.responseType||r)){const a=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(o){if(a)throw o.name==="SyntaxError"?Ze.from(o,Ze.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:xn.classes.FormData,Blob:xn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};K.forEach(["delete","get","head","post","put","patch"],n=>{ys.headers[n]={}});const Xy=K.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),qy=n=>{const e={};let t,i,r;return n&&n.split(` `).forEach(function(a){r=a.indexOf(":"),t=a.substring(0,r).trim().toLowerCase(),i=a.substring(r+1).trim(),!(!t||e[t]&&Xy[t])&&(t==="set-cookie"?e[t]?e[t].push(i):e[t]=[i]:e[t]=e[t]?e[t]+", "+i:i)}),e},$u=Symbol("internals");function Ur(n){return n&&String(n).trim().toLowerCase()}function ra(n){return n===!1||n==null?n:K.isArray(n)?n.map(ra):String(n)}function jy(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=t.exec(n);)e[i[1]]=i[2];return e}const $y=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function Do(n,e,t,i,r){if(K.isFunction(i))return i.call(this,e,t);if(r&&(e=t),!!K.isString(e)){if(K.isString(i))return e.indexOf(i)!==-1;if(K.isRegExp(i))return i.test(e)}}function Zy(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,i)=>t.toUpperCase()+i)}function Yy(n,e){const t=K.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(n,i+t,{value:function(r,s,a){return this[i].call(this,e,r,s,a)},configurable:!0})})}class tn{constructor(e){e&&this.set(e)}set(e,t,i){const r=this;function s(o,c,l){const u=Ur(c);if(!u)throw new Error("header name must be a non-empty string");const d=K.findKey(r,u);(!d||r[d]===void 0||l===!0||l===void 0&&r[d]!==!1)&&(r[d||c]=ra(o))}const a=(o,c)=>K.forEach(o,(l,u)=>s(l,u,c));return K.isPlainObject(e)||e instanceof this.constructor?a(e,t):K.isString(e)&&(e=e.trim())&&!$y(e)?a(qy(e),t):e!=null&&s(t,e,i),this}get(e,t){if(e=Ur(e),e){const i=K.findKey(this,e);if(i){const r=this[i];if(!t)return r;if(t===!0)return jy(r);if(K.isFunction(t))return t.call(this,r,i);if(K.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Ur(e),e){const i=K.findKey(this,e);return!!(i&&this[i]!==void 0&&(!t||Do(this,this[i],i,t)))}return!1}delete(e,t){const i=this;let r=!1;function s(a){if(a=Ur(a),a){const o=K.findKey(i,a);o&&(!t||Do(i,i[o],o,t))&&(delete i[o],r=!0)}}return K.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let i=t.length,r=!1;for(;i--;){const s=t[i];(!e||Do(this,this[s],s,e,!0))&&(delete this[s],r=!0)}return r}normalize(e){const t=this,i={};return K.forEach(this,(r,s)=>{const a=K.findKey(i,s);if(a){t[a]=ra(r),delete t[s];return}const o=e?Zy(s):String(s).trim();o!==s&&delete t[s],t[o]=ra(r),i[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return K.forEach(this,(i,r)=>{i!=null&&i!==!1&&(t[r]=e&&K.isArray(i)?i.join(", "):i)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const i=new this(e);return t.forEach(r=>i.set(r)),i}static accessor(e){const i=(this[$u]=this[$u]={accessors:{}}).accessors,r=this.prototype;function s(a){const o=Ur(a);i[o]||(Yy(r,a),i[o]=!0)}return K.isArray(e)?e.forEach(s):s(e),this}}tn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);K.reduceDescriptors(tn.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(i){this[t]=i}}});K.freezeMethods(tn);function Uo(n,e){const t=this||ys,i=e||t,r=tn.from(i.headers);let s=i.data;return K.forEach(n,function(o){s=o.call(t,s,r.normalize(),e?e.status:void 0)}),r.normalize(),s}function Af(n){return!!(n&&n.__CANCEL__)}function xs(n,e,t){Ze.call(this,n??"canceled",Ze.ERR_CANCELED,e,t),this.name="CanceledError"}K.inherits(xs,Ze,{__CANCEL__:!0});function Ky(n,e,t){const i=t.config.validateStatus;!t.status||!i||i(t.status)?n(t):e(new Ze("Request failed with status code "+t.status,[Ze.ERR_BAD_REQUEST,Ze.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}const Jy=xn.hasStandardBrowserEnv?{write(n,e,t,i,r,s){const a=[n+"="+encodeURIComponent(e)];K.isNumber(t)&&a.push("expires="+new Date(t).toGMTString()),K.isString(i)&&a.push("path="+i),K.isString(r)&&a.push("domain="+r),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(n){const e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Qy(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function ex(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function Rf(n,e){return n&&!Qy(e)?ex(n,e):e}const tx=xn.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let i;function r(s){let a=s;return e&&(t.setAttribute("href",a),a=t.href),t.setAttribute("href",a),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return i=r(window.location.href),function(a){const o=K.isString(a)?r(a):a;return o.protocol===i.protocol&&o.host===i.host}}():function(){return function(){return!0}}();function nx(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function ix(n,e){n=n||10;const t=new Array(n),i=new Array(n);let r=0,s=0,a;return e=e!==void 0?e:1e3,function(c){const l=Date.now(),u=i[s];a||(a=l),t[r]=c,i[r]=l;let d=s,p=0;for(;d!==r;)p+=t[d++],d=d%n;if(r=(r+1)%n,r===s&&(s=(s+1)%n),l-a{const s=r.loaded,a=r.lengthComputable?r.total:void 0,o=s-t,c=i(o),l=s<=a;t=s;const u={loaded:s,total:a,progress:a?s/a:void 0,bytes:o,rate:c||void 0,estimated:c&&a&&l?(a-s)/c:void 0,event:r};u[e?"download":"upload"]=!0,n(u)}}const rx=typeof XMLHttpRequest<"u",sx=rx&&function(n){return new Promise(function(t,i){let r=n.data;const s=tn.from(n.headers).normalize();let{responseType:a,withXSRFToken:o}=n,c;function l(){n.cancelToken&&n.cancelToken.unsubscribe(c),n.signal&&n.signal.removeEventListener("abort",c)}let u;if(K.isFormData(r)){if(xn.hasStandardBrowserEnv||xn.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((u=s.getContentType())!==!1){const[m,...h]=u?u.split(";").map(f=>f.trim()).filter(Boolean):[];s.setContentType([m||"multipart/form-data",...h].join("; "))}}let d=new XMLHttpRequest;if(n.auth){const m=n.auth.username||"",h=n.auth.password?unescape(encodeURIComponent(n.auth.password)):"";s.set("Authorization","Basic "+btoa(m+":"+h))}const p=Rf(n.baseURL,n.url);d.open(n.method.toUpperCase(),bf(p,n.params,n.paramsSerializer),!0),d.timeout=n.timeout;function g(){if(!d)return;const m=tn.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders()),f={data:!a||a==="text"||a==="json"?d.responseText:d.response,status:d.status,statusText:d.statusText,headers:m,config:n,request:d};Ky(function(v){t(v),l()},function(v){i(v),l()},f),d=null}if("onloadend"in d?d.onloadend=g:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(g)},d.onabort=function(){d&&(i(new Ze("Request aborted",Ze.ECONNABORTED,n,d)),d=null)},d.onerror=function(){i(new Ze("Network Error",Ze.ERR_NETWORK,n,d)),d=null},d.ontimeout=function(){let h=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const f=n.transitional||Mf;n.timeoutErrorMessage&&(h=n.timeoutErrorMessage),i(new Ze(h,f.clarifyTimeoutError?Ze.ETIMEDOUT:Ze.ECONNABORTED,n,d)),d=null},xn.hasStandardBrowserEnv&&(o&&K.isFunction(o)&&(o=o(n)),o||o!==!1&&tx(p))){const m=n.xsrfHeaderName&&n.xsrfCookieName&&Jy.read(n.xsrfCookieName);m&&s.set(n.xsrfHeaderName,m)}r===void 0&&s.setContentType(null),"setRequestHeader"in d&&K.forEach(s.toJSON(),function(h,f){d.setRequestHeader(f,h)}),K.isUndefined(n.withCredentials)||(d.withCredentials=!!n.withCredentials),a&&a!=="json"&&(d.responseType=n.responseType),typeof n.onDownloadProgress=="function"&&d.addEventListener("progress",Zu(n.onDownloadProgress,!0)),typeof n.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",Zu(n.onUploadProgress)),(n.cancelToken||n.signal)&&(c=m=>{d&&(i(!m||m.type?new xs(null,n,d):m),d.abort(),d=null)},n.cancelToken&&n.cancelToken.subscribe(c),n.signal&&(n.signal.aborted?c():n.signal.addEventListener("abort",c)));const _=nx(p);if(_&&xn.protocols.indexOf(_)===-1){i(new Ze("Unsupported protocol "+_+":",Ze.ERR_BAD_REQUEST,n));return}d.send(r||null)})},ic={http:Ly,xhr:sx};K.forEach(ic,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const Yu=n=>`- ${n}`,ax=n=>K.isFunction(n)||n===null||n===!1,Cf={getAdapter:n=>{n=K.isArray(n)?n:[n];const{length:e}=n;let t,i;const r={};for(let s=0;s`adapter ${o} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=e?s.length>1?`since : `+s.map(Yu).join(` diff --git a/dist/index.html b/dist/index.html index 4ceb09dd..50344d4f 100644 --- a/dist/index.html +++ b/dist/index.html @@ -7,7 +7,7 @@ - + diff --git a/js/dashboard.js b/js/dashboard.js index fa281e45..869d26dc 100644 --- a/js/dashboard.js +++ b/js/dashboard.js @@ -1,11 +1,9 @@ // import * as T from 'three'; -import { getColorFromRamp } from './helpers.js'; import { sceneInit } from './sceneInit.js'; import { TransactionsGrid } from './transactionBlock.js'; import { SceneControl } from './control.js'; import { initUI } from './UIInit.js'; import { getData } from './endpoint.js'; -// import { Button } from './pageElements.js'; import { test } from './test.js'; export function startScene() { diff --git a/node_modules/.vite/deps/_metadata.json b/node_modules/.vite/deps/_metadata.json deleted file mode 100644 index 4615793a..00000000 --- a/node_modules/.vite/deps/_metadata.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "hash": "3c2e7f7b", - "configHash": "fcc0ba5f", - "lockfileHash": "6587f0f3", - "browserHash": "d213bba1", - "optimized": { - "axios": { - "src": "../../axios/index.js", - "file": "axios.js", - "fileHash": "5c13a497", - "needsInterop": false - }, - "ethers": { - "src": "../../ethers/lib.esm/index.js", - "file": "ethers.js", - "fileHash": "077291bb", - "needsInterop": false - }, - "graphql": { - "src": "../../graphql/index.mjs", - "file": "graphql.js", - "fileHash": "81c2a07b", - "needsInterop": false - }, - "three": { - "src": "../../three/build/three.module.js", - "file": "three.js", - "fileHash": "0c6e4ee5", - "needsInterop": false - }, - "web3": { - "src": "../../web3/lib/esm/index.js", - "file": "web3.js", - "fileHash": "8ce496b1", - "needsInterop": false - }, - "three/addons/geometries/TextGeometry.js": { - "src": "../../three/examples/jsm/geometries/TextGeometry.js", - "file": "three_addons_geometries_TextGeometry__js.js", - "fileHash": "3e589300", - "needsInterop": false - }, - "three/addons/loaders/FontLoader.js": { - "src": "../../three/examples/jsm/loaders/FontLoader.js", - "file": "three_addons_loaders_FontLoader__js.js", - "fileHash": "14f90d76", - "needsInterop": false - } - }, - "chunks": { - "chunk-MIR452EH": { - "file": "chunk-MIR452EH.js" - }, - "chunk-6P5T4EWA": { - "file": "chunk-6P5T4EWA.js" - }, - "chunk-TXPGJST7": { - "file": "chunk-TXPGJST7.js" - } - } -} \ No newline at end of file diff --git a/node_modules/.vite/deps/axios.js b/node_modules/.vite/deps/axios.js deleted file mode 100644 index c8597918..00000000 --- a/node_modules/.vite/deps/axios.js +++ /dev/null @@ -1,2160 +0,0 @@ -import { - __export -} from "./chunk-TXPGJST7.js"; - -// node_modules/axios/lib/helpers/bind.js -function bind(fn, thisArg) { - return function wrap() { - return fn.apply(thisArg, arguments); - }; -} - -// node_modules/axios/lib/utils.js -var { toString } = Object.prototype; -var { getPrototypeOf } = Object; -var kindOf = /* @__PURE__ */ ((cache) => (thing) => { - const str = toString.call(thing); - return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); -})(/* @__PURE__ */ Object.create(null)); -var kindOfTest = (type) => { - type = type.toLowerCase(); - return (thing) => kindOf(thing) === type; -}; -var typeOfTest = (type) => (thing) => typeof thing === type; -var { isArray } = Array; -var isUndefined = typeOfTest("undefined"); -function isBuffer(val) { - return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val); -} -var isArrayBuffer = kindOfTest("ArrayBuffer"); -function isArrayBufferView(val) { - let result; - if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) { - result = ArrayBuffer.isView(val); - } else { - result = val && val.buffer && isArrayBuffer(val.buffer); - } - return result; -} -var isString = typeOfTest("string"); -var isFunction = typeOfTest("function"); -var isNumber = typeOfTest("number"); -var isObject = (thing) => thing !== null && typeof thing === "object"; -var isBoolean = (thing) => thing === true || thing === false; -var isPlainObject = (val) => { - if (kindOf(val) !== "object") { - return false; - } - const prototype3 = getPrototypeOf(val); - return (prototype3 === null || prototype3 === Object.prototype || Object.getPrototypeOf(prototype3) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val); -}; -var isDate = kindOfTest("Date"); -var isFile = kindOfTest("File"); -var isBlob = kindOfTest("Blob"); -var isFileList = kindOfTest("FileList"); -var isStream = (val) => isObject(val) && isFunction(val.pipe); -var isFormData = (thing) => { - let kind; - return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance - kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]")); -}; -var isURLSearchParams = kindOfTest("URLSearchParams"); -var trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); -function forEach(obj, fn, { allOwnKeys = false } = {}) { - if (obj === null || typeof obj === "undefined") { - return; - } - let i; - let l; - if (typeof obj !== "object") { - obj = [obj]; - } - if (isArray(obj)) { - for (i = 0, l = obj.length; i < l; i++) { - fn.call(null, obj[i], i, obj); - } - } else { - const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj); - const len = keys.length; - let key; - for (i = 0; i < len; i++) { - key = keys[i]; - fn.call(null, obj[key], key, obj); - } - } -} -function findKey(obj, key) { - key = key.toLowerCase(); - const keys = Object.keys(obj); - let i = keys.length; - let _key; - while (i-- > 0) { - _key = keys[i]; - if (key === _key.toLowerCase()) { - return _key; - } - } - return null; -} -var _global = (() => { - if (typeof globalThis !== "undefined") - return globalThis; - return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global; -})(); -var isContextDefined = (context) => !isUndefined(context) && context !== _global; -function merge() { - const { caseless } = isContextDefined(this) && this || {}; - const result = {}; - const assignValue = (val, key) => { - const targetKey = caseless && findKey(result, key) || key; - if (isPlainObject(result[targetKey]) && isPlainObject(val)) { - result[targetKey] = merge(result[targetKey], val); - } else if (isPlainObject(val)) { - result[targetKey] = merge({}, val); - } else if (isArray(val)) { - result[targetKey] = val.slice(); - } else { - result[targetKey] = val; - } - }; - for (let i = 0, l = arguments.length; i < l; i++) { - arguments[i] && forEach(arguments[i], assignValue); - } - return result; -} -var extend = (a, b, thisArg, { allOwnKeys } = {}) => { - forEach(b, (val, key) => { - if (thisArg && isFunction(val)) { - a[key] = bind(val, thisArg); - } else { - a[key] = val; - } - }, { allOwnKeys }); - return a; -}; -var stripBOM = (content) => { - if (content.charCodeAt(0) === 65279) { - content = content.slice(1); - } - return content; -}; -var inherits = (constructor, superConstructor, props, descriptors2) => { - constructor.prototype = Object.create(superConstructor.prototype, descriptors2); - constructor.prototype.constructor = constructor; - Object.defineProperty(constructor, "super", { - value: superConstructor.prototype - }); - props && Object.assign(constructor.prototype, props); -}; -var toFlatObject = (sourceObj, destObj, filter2, propFilter) => { - let props; - let i; - let prop; - const merged = {}; - destObj = destObj || {}; - if (sourceObj == null) - return destObj; - do { - props = Object.getOwnPropertyNames(sourceObj); - i = props.length; - while (i-- > 0) { - prop = props[i]; - if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) { - destObj[prop] = sourceObj[prop]; - merged[prop] = true; - } - } - sourceObj = filter2 !== false && getPrototypeOf(sourceObj); - } while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype); - return destObj; -}; -var endsWith = (str, searchString, position) => { - str = String(str); - if (position === void 0 || position > str.length) { - position = str.length; - } - position -= searchString.length; - const lastIndex = str.indexOf(searchString, position); - return lastIndex !== -1 && lastIndex === position; -}; -var toArray = (thing) => { - if (!thing) - return null; - if (isArray(thing)) - return thing; - let i = thing.length; - if (!isNumber(i)) - return null; - const arr = new Array(i); - while (i-- > 0) { - arr[i] = thing[i]; - } - return arr; -}; -var isTypedArray = /* @__PURE__ */ ((TypedArray) => { - return (thing) => { - return TypedArray && thing instanceof TypedArray; - }; -})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array)); -var forEachEntry = (obj, fn) => { - const generator = obj && obj[Symbol.iterator]; - const iterator = generator.call(obj); - let result; - while ((result = iterator.next()) && !result.done) { - const pair = result.value; - fn.call(obj, pair[0], pair[1]); - } -}; -var matchAll = (regExp, str) => { - let matches; - const arr = []; - while ((matches = regExp.exec(str)) !== null) { - arr.push(matches); - } - return arr; -}; -var isHTMLForm = kindOfTest("HTMLFormElement"); -var toCamelCase = (str) => { - return str.toLowerCase().replace( - /[-_\s]([a-z\d])(\w*)/g, - function replacer(m, p1, p2) { - return p1.toUpperCase() + p2; - } - ); -}; -var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype); -var isRegExp = kindOfTest("RegExp"); -var reduceDescriptors = (obj, reducer) => { - const descriptors2 = Object.getOwnPropertyDescriptors(obj); - const reducedDescriptors = {}; - forEach(descriptors2, (descriptor, name) => { - let ret; - if ((ret = reducer(descriptor, name, obj)) !== false) { - reducedDescriptors[name] = ret || descriptor; - } - }); - Object.defineProperties(obj, reducedDescriptors); -}; -var freezeMethods = (obj) => { - reduceDescriptors(obj, (descriptor, name) => { - if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) { - return false; - } - const value = obj[name]; - if (!isFunction(value)) - return; - descriptor.enumerable = false; - if ("writable" in descriptor) { - descriptor.writable = false; - return; - } - if (!descriptor.set) { - descriptor.set = () => { - throw Error("Can not rewrite read-only method '" + name + "'"); - }; - } - }); -}; -var toObjectSet = (arrayOrString, delimiter) => { - const obj = {}; - const define = (arr) => { - arr.forEach((value) => { - obj[value] = true; - }); - }; - isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)); - return obj; -}; -var noop = () => { -}; -var toFiniteNumber = (value, defaultValue) => { - value = +value; - return Number.isFinite(value) ? value : defaultValue; -}; -var ALPHA = "abcdefghijklmnopqrstuvwxyz"; -var DIGIT = "0123456789"; -var ALPHABET = { - DIGIT, - ALPHA, - ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT -}; -var generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => { - let str = ""; - const { length } = alphabet; - while (size--) { - str += alphabet[Math.random() * length | 0]; - } - return str; -}; -function isSpecCompliantForm(thing) { - return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === "FormData" && thing[Symbol.iterator]); -} -var toJSONObject = (obj) => { - const stack = new Array(10); - const visit = (source, i) => { - if (isObject(source)) { - if (stack.indexOf(source) >= 0) { - return; - } - if (!("toJSON" in source)) { - stack[i] = source; - const target = isArray(source) ? [] : {}; - forEach(source, (value, key) => { - const reducedValue = visit(value, i + 1); - !isUndefined(reducedValue) && (target[key] = reducedValue); - }); - stack[i] = void 0; - return target; - } - } - return source; - }; - return visit(obj, 0); -}; -var isAsyncFn = kindOfTest("AsyncFunction"); -var isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch); -var utils_default = { - isArray, - isArrayBuffer, - isBuffer, - isFormData, - isArrayBufferView, - isString, - isNumber, - isBoolean, - isObject, - isPlainObject, - isUndefined, - isDate, - isFile, - isBlob, - isRegExp, - isFunction, - isStream, - isURLSearchParams, - isTypedArray, - isFileList, - forEach, - merge, - extend, - trim, - stripBOM, - inherits, - toFlatObject, - kindOf, - kindOfTest, - endsWith, - toArray, - forEachEntry, - matchAll, - isHTMLForm, - hasOwnProperty, - hasOwnProp: hasOwnProperty, - // an alias to avoid ESLint no-prototype-builtins detection - reduceDescriptors, - freezeMethods, - toObjectSet, - toCamelCase, - noop, - toFiniteNumber, - findKey, - global: _global, - isContextDefined, - ALPHABET, - generateString, - isSpecCompliantForm, - toJSONObject, - isAsyncFn, - isThenable -}; - -// node_modules/axios/lib/core/AxiosError.js -function AxiosError(message, code, config, request, response) { - Error.call(this); - if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } else { - this.stack = new Error().stack; - } - this.message = message; - this.name = "AxiosError"; - code && (this.code = code); - config && (this.config = config); - request && (this.request = request); - response && (this.response = response); -} -utils_default.inherits(AxiosError, Error, { - toJSON: function toJSON() { - return { - // Standard - message: this.message, - name: this.name, - // Microsoft - description: this.description, - number: this.number, - // Mozilla - fileName: this.fileName, - lineNumber: this.lineNumber, - columnNumber: this.columnNumber, - stack: this.stack, - // Axios - config: utils_default.toJSONObject(this.config), - code: this.code, - status: this.response && this.response.status ? this.response.status : null - }; - } -}); -var prototype = AxiosError.prototype; -var descriptors = {}; -[ - "ERR_BAD_OPTION_VALUE", - "ERR_BAD_OPTION", - "ECONNABORTED", - "ETIMEDOUT", - "ERR_NETWORK", - "ERR_FR_TOO_MANY_REDIRECTS", - "ERR_DEPRECATED", - "ERR_BAD_RESPONSE", - "ERR_BAD_REQUEST", - "ERR_CANCELED", - "ERR_NOT_SUPPORT", - "ERR_INVALID_URL" - // eslint-disable-next-line func-names -].forEach((code) => { - descriptors[code] = { value: code }; -}); -Object.defineProperties(AxiosError, descriptors); -Object.defineProperty(prototype, "isAxiosError", { value: true }); -AxiosError.from = (error, code, config, request, response, customProps) => { - const axiosError = Object.create(prototype); - utils_default.toFlatObject(error, axiosError, function filter2(obj) { - return obj !== Error.prototype; - }, (prop) => { - return prop !== "isAxiosError"; - }); - AxiosError.call(axiosError, error.message, code, config, request, response); - axiosError.cause = error; - axiosError.name = error.name; - customProps && Object.assign(axiosError, customProps); - return axiosError; -}; -var AxiosError_default = AxiosError; - -// node_modules/axios/lib/helpers/null.js -var null_default = null; - -// node_modules/axios/lib/helpers/toFormData.js -function isVisitable(thing) { - return utils_default.isPlainObject(thing) || utils_default.isArray(thing); -} -function removeBrackets(key) { - return utils_default.endsWith(key, "[]") ? key.slice(0, -2) : key; -} -function renderKey(path, key, dots) { - if (!path) - return key; - return path.concat(key).map(function each(token, i) { - token = removeBrackets(token); - return !dots && i ? "[" + token + "]" : token; - }).join(dots ? "." : ""); -} -function isFlatArray(arr) { - return utils_default.isArray(arr) && !arr.some(isVisitable); -} -var predicates = utils_default.toFlatObject(utils_default, {}, null, function filter(prop) { - return /^is[A-Z]/.test(prop); -}); -function toFormData(obj, formData, options) { - if (!utils_default.isObject(obj)) { - throw new TypeError("target must be an object"); - } - formData = formData || new (null_default || FormData)(); - options = utils_default.toFlatObject(options, { - metaTokens: true, - dots: false, - indexes: false - }, false, function defined(option, source) { - return !utils_default.isUndefined(source[option]); - }); - const metaTokens = options.metaTokens; - const visitor = options.visitor || defaultVisitor; - const dots = options.dots; - const indexes = options.indexes; - const _Blob = options.Blob || typeof Blob !== "undefined" && Blob; - const useBlob = _Blob && utils_default.isSpecCompliantForm(formData); - if (!utils_default.isFunction(visitor)) { - throw new TypeError("visitor must be a function"); - } - function convertValue(value) { - if (value === null) - return ""; - if (utils_default.isDate(value)) { - return value.toISOString(); - } - if (!useBlob && utils_default.isBlob(value)) { - throw new AxiosError_default("Blob is not supported. Use a Buffer instead."); - } - if (utils_default.isArrayBuffer(value) || utils_default.isTypedArray(value)) { - return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value); - } - return value; - } - function defaultVisitor(value, key, path) { - let arr = value; - if (value && !path && typeof value === "object") { - if (utils_default.endsWith(key, "{}")) { - key = metaTokens ? key : key.slice(0, -2); - value = JSON.stringify(value); - } else if (utils_default.isArray(value) && isFlatArray(value) || (utils_default.isFileList(value) || utils_default.endsWith(key, "[]")) && (arr = utils_default.toArray(value))) { - key = removeBrackets(key); - arr.forEach(function each(el, index) { - !(utils_default.isUndefined(el) || el === null) && formData.append( - // eslint-disable-next-line no-nested-ternary - indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]", - convertValue(el) - ); - }); - return false; - } - } - if (isVisitable(value)) { - return true; - } - formData.append(renderKey(path, key, dots), convertValue(value)); - return false; - } - const stack = []; - const exposedHelpers = Object.assign(predicates, { - defaultVisitor, - convertValue, - isVisitable - }); - function build(value, path) { - if (utils_default.isUndefined(value)) - return; - if (stack.indexOf(value) !== -1) { - throw Error("Circular reference detected in " + path.join(".")); - } - stack.push(value); - utils_default.forEach(value, function each(el, key) { - const result = !(utils_default.isUndefined(el) || el === null) && visitor.call( - formData, - el, - utils_default.isString(key) ? key.trim() : key, - path, - exposedHelpers - ); - if (result === true) { - build(el, path ? path.concat(key) : [key]); - } - }); - stack.pop(); - } - if (!utils_default.isObject(obj)) { - throw new TypeError("data must be an object"); - } - build(obj); - return formData; -} -var toFormData_default = toFormData; - -// node_modules/axios/lib/helpers/AxiosURLSearchParams.js -function encode(str) { - const charMap = { - "!": "%21", - "'": "%27", - "(": "%28", - ")": "%29", - "~": "%7E", - "%20": "+", - "%00": "\0" - }; - return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) { - return charMap[match]; - }); -} -function AxiosURLSearchParams(params, options) { - this._pairs = []; - params && toFormData_default(params, this, options); -} -var prototype2 = AxiosURLSearchParams.prototype; -prototype2.append = function append(name, value) { - this._pairs.push([name, value]); -}; -prototype2.toString = function toString2(encoder) { - const _encode = encoder ? function(value) { - return encoder.call(this, value, encode); - } : encode; - return this._pairs.map(function each(pair) { - return _encode(pair[0]) + "=" + _encode(pair[1]); - }, "").join("&"); -}; -var AxiosURLSearchParams_default = AxiosURLSearchParams; - -// node_modules/axios/lib/helpers/buildURL.js -function encode2(val) { - return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]"); -} -function buildURL(url, params, options) { - if (!params) { - return url; - } - const _encode = options && options.encode || encode2; - const serializeFn = options && options.serialize; - let serializedParams; - if (serializeFn) { - serializedParams = serializeFn(params, options); - } else { - serializedParams = utils_default.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams_default(params, options).toString(_encode); - } - if (serializedParams) { - const hashmarkIndex = url.indexOf("#"); - if (hashmarkIndex !== -1) { - url = url.slice(0, hashmarkIndex); - } - url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams; - } - return url; -} - -// node_modules/axios/lib/core/InterceptorManager.js -var InterceptorManager = class { - constructor() { - this.handlers = []; - } - /** - * Add a new interceptor to the stack - * - * @param {Function} fulfilled The function to handle `then` for a `Promise` - * @param {Function} rejected The function to handle `reject` for a `Promise` - * - * @return {Number} An ID used to remove interceptor later - */ - use(fulfilled, rejected, options) { - this.handlers.push({ - fulfilled, - rejected, - synchronous: options ? options.synchronous : false, - runWhen: options ? options.runWhen : null - }); - return this.handlers.length - 1; - } - /** - * Remove an interceptor from the stack - * - * @param {Number} id The ID that was returned by `use` - * - * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise - */ - eject(id) { - if (this.handlers[id]) { - this.handlers[id] = null; - } - } - /** - * Clear all interceptors from the stack - * - * @returns {void} - */ - clear() { - if (this.handlers) { - this.handlers = []; - } - } - /** - * Iterate over all the registered interceptors - * - * This method is particularly useful for skipping over any - * interceptors that may have become `null` calling `eject`. - * - * @param {Function} fn The function to call for each interceptor - * - * @returns {void} - */ - forEach(fn) { - utils_default.forEach(this.handlers, function forEachHandler(h) { - if (h !== null) { - fn(h); - } - }); - } -}; -var InterceptorManager_default = InterceptorManager; - -// node_modules/axios/lib/defaults/transitional.js -var transitional_default = { - silentJSONParsing: true, - forcedJSONParsing: true, - clarifyTimeoutError: false -}; - -// node_modules/axios/lib/platform/browser/classes/URLSearchParams.js -var URLSearchParams_default = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams_default; - -// node_modules/axios/lib/platform/browser/classes/FormData.js -var FormData_default = typeof FormData !== "undefined" ? FormData : null; - -// node_modules/axios/lib/platform/browser/classes/Blob.js -var Blob_default = typeof Blob !== "undefined" ? Blob : null; - -// node_modules/axios/lib/platform/browser/index.js -var browser_default = { - isBrowser: true, - classes: { - URLSearchParams: URLSearchParams_default, - FormData: FormData_default, - Blob: Blob_default - }, - protocols: ["http", "https", "file", "blob", "url", "data"] -}; - -// node_modules/axios/lib/platform/common/utils.js -var utils_exports = {}; -__export(utils_exports, { - hasBrowserEnv: () => hasBrowserEnv, - hasStandardBrowserEnv: () => hasStandardBrowserEnv, - hasStandardBrowserWebWorkerEnv: () => hasStandardBrowserWebWorkerEnv -}); -var hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined"; -var hasStandardBrowserEnv = ((product) => { - return hasBrowserEnv && ["ReactNative", "NativeScript", "NS"].indexOf(product) < 0; -})(typeof navigator !== "undefined" && navigator.product); -var hasStandardBrowserWebWorkerEnv = (() => { - return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef - self instanceof WorkerGlobalScope && typeof self.importScripts === "function"; -})(); - -// node_modules/axios/lib/platform/index.js -var platform_default = { - ...utils_exports, - ...browser_default -}; - -// node_modules/axios/lib/helpers/toURLEncodedForm.js -function toURLEncodedForm(data, options) { - return toFormData_default(data, new platform_default.classes.URLSearchParams(), Object.assign({ - visitor: function(value, key, path, helpers) { - if (platform_default.isNode && utils_default.isBuffer(value)) { - this.append(key, value.toString("base64")); - return false; - } - return helpers.defaultVisitor.apply(this, arguments); - } - }, options)); -} - -// node_modules/axios/lib/helpers/formDataToJSON.js -function parsePropPath(name) { - return utils_default.matchAll(/\w+|\[(\w*)]/g, name).map((match) => { - return match[0] === "[]" ? "" : match[1] || match[0]; - }); -} -function arrayToObject(arr) { - const obj = {}; - const keys = Object.keys(arr); - let i; - const len = keys.length; - let key; - for (i = 0; i < len; i++) { - key = keys[i]; - obj[key] = arr[key]; - } - return obj; -} -function formDataToJSON(formData) { - function buildPath(path, value, target, index) { - let name = path[index++]; - if (name === "__proto__") - return true; - const isNumericKey = Number.isFinite(+name); - const isLast = index >= path.length; - name = !name && utils_default.isArray(target) ? target.length : name; - if (isLast) { - if (utils_default.hasOwnProp(target, name)) { - target[name] = [target[name], value]; - } else { - target[name] = value; - } - return !isNumericKey; - } - if (!target[name] || !utils_default.isObject(target[name])) { - target[name] = []; - } - const result = buildPath(path, value, target[name], index); - if (result && utils_default.isArray(target[name])) { - target[name] = arrayToObject(target[name]); - } - return !isNumericKey; - } - if (utils_default.isFormData(formData) && utils_default.isFunction(formData.entries)) { - const obj = {}; - utils_default.forEachEntry(formData, (name, value) => { - buildPath(parsePropPath(name), value, obj, 0); - }); - return obj; - } - return null; -} -var formDataToJSON_default = formDataToJSON; - -// node_modules/axios/lib/defaults/index.js -function stringifySafely(rawValue, parser, encoder) { - if (utils_default.isString(rawValue)) { - try { - (parser || JSON.parse)(rawValue); - return utils_default.trim(rawValue); - } catch (e) { - if (e.name !== "SyntaxError") { - throw e; - } - } - } - return (encoder || JSON.stringify)(rawValue); -} -var defaults = { - transitional: transitional_default, - adapter: ["xhr", "http"], - transformRequest: [function transformRequest(data, headers) { - const contentType = headers.getContentType() || ""; - const hasJSONContentType = contentType.indexOf("application/json") > -1; - const isObjectPayload = utils_default.isObject(data); - if (isObjectPayload && utils_default.isHTMLForm(data)) { - data = new FormData(data); - } - const isFormData2 = utils_default.isFormData(data); - if (isFormData2) { - return hasJSONContentType ? JSON.stringify(formDataToJSON_default(data)) : data; - } - if (utils_default.isArrayBuffer(data) || utils_default.isBuffer(data) || utils_default.isStream(data) || utils_default.isFile(data) || utils_default.isBlob(data)) { - return data; - } - if (utils_default.isArrayBufferView(data)) { - return data.buffer; - } - if (utils_default.isURLSearchParams(data)) { - headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false); - return data.toString(); - } - let isFileList2; - if (isObjectPayload) { - if (contentType.indexOf("application/x-www-form-urlencoded") > -1) { - return toURLEncodedForm(data, this.formSerializer).toString(); - } - if ((isFileList2 = utils_default.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) { - const _FormData = this.env && this.env.FormData; - return toFormData_default( - isFileList2 ? { "files[]": data } : data, - _FormData && new _FormData(), - this.formSerializer - ); - } - } - if (isObjectPayload || hasJSONContentType) { - headers.setContentType("application/json", false); - return stringifySafely(data); - } - return data; - }], - transformResponse: [function transformResponse(data) { - const transitional2 = this.transitional || defaults.transitional; - const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing; - const JSONRequested = this.responseType === "json"; - if (data && utils_default.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) { - const silentJSONParsing = transitional2 && transitional2.silentJSONParsing; - const strictJSONParsing = !silentJSONParsing && JSONRequested; - try { - return JSON.parse(data); - } catch (e) { - if (strictJSONParsing) { - if (e.name === "SyntaxError") { - throw AxiosError_default.from(e, AxiosError_default.ERR_BAD_RESPONSE, this, null, this.response); - } - throw e; - } - } - } - return data; - }], - /** - * A timeout in milliseconds to abort a request. If set to 0 (default) a - * timeout is not created. - */ - timeout: 0, - xsrfCookieName: "XSRF-TOKEN", - xsrfHeaderName: "X-XSRF-TOKEN", - maxContentLength: -1, - maxBodyLength: -1, - env: { - FormData: platform_default.classes.FormData, - Blob: platform_default.classes.Blob - }, - validateStatus: function validateStatus(status) { - return status >= 200 && status < 300; - }, - headers: { - common: { - "Accept": "application/json, text/plain, */*", - "Content-Type": void 0 - } - } -}; -utils_default.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => { - defaults.headers[method] = {}; -}); -var defaults_default = defaults; - -// node_modules/axios/lib/helpers/parseHeaders.js -var ignoreDuplicateOf = utils_default.toObjectSet([ - "age", - "authorization", - "content-length", - "content-type", - "etag", - "expires", - "from", - "host", - "if-modified-since", - "if-unmodified-since", - "last-modified", - "location", - "max-forwards", - "proxy-authorization", - "referer", - "retry-after", - "user-agent" -]); -var parseHeaders_default = (rawHeaders) => { - const parsed = {}; - let key; - let val; - let i; - rawHeaders && rawHeaders.split("\n").forEach(function parser(line) { - i = line.indexOf(":"); - key = line.substring(0, i).trim().toLowerCase(); - val = line.substring(i + 1).trim(); - if (!key || parsed[key] && ignoreDuplicateOf[key]) { - return; - } - if (key === "set-cookie") { - if (parsed[key]) { - parsed[key].push(val); - } else { - parsed[key] = [val]; - } - } else { - parsed[key] = parsed[key] ? parsed[key] + ", " + val : val; - } - }); - return parsed; -}; - -// node_modules/axios/lib/core/AxiosHeaders.js -var $internals = Symbol("internals"); -function normalizeHeader(header) { - return header && String(header).trim().toLowerCase(); -} -function normalizeValue(value) { - if (value === false || value == null) { - return value; - } - return utils_default.isArray(value) ? value.map(normalizeValue) : String(value); -} -function parseTokens(str) { - const tokens = /* @__PURE__ */ Object.create(null); - const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; - let match; - while (match = tokensRE.exec(str)) { - tokens[match[1]] = match[2]; - } - return tokens; -} -var isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()); -function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) { - if (utils_default.isFunction(filter2)) { - return filter2.call(this, value, header); - } - if (isHeaderNameFilter) { - value = header; - } - if (!utils_default.isString(value)) - return; - if (utils_default.isString(filter2)) { - return value.indexOf(filter2) !== -1; - } - if (utils_default.isRegExp(filter2)) { - return filter2.test(value); - } -} -function formatHeader(header) { - return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => { - return char.toUpperCase() + str; - }); -} -function buildAccessors(obj, header) { - const accessorName = utils_default.toCamelCase(" " + header); - ["get", "set", "has"].forEach((methodName) => { - Object.defineProperty(obj, methodName + accessorName, { - value: function(arg1, arg2, arg3) { - return this[methodName].call(this, header, arg1, arg2, arg3); - }, - configurable: true - }); - }); -} -var AxiosHeaders = class { - constructor(headers) { - headers && this.set(headers); - } - set(header, valueOrRewrite, rewrite) { - const self2 = this; - function setHeader(_value, _header, _rewrite) { - const lHeader = normalizeHeader(_header); - if (!lHeader) { - throw new Error("header name must be a non-empty string"); - } - const key = utils_default.findKey(self2, lHeader); - if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) { - self2[key || _header] = normalizeValue(_value); - } - } - const setHeaders = (headers, _rewrite) => utils_default.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite)); - if (utils_default.isPlainObject(header) || header instanceof this.constructor) { - setHeaders(header, valueOrRewrite); - } else if (utils_default.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) { - setHeaders(parseHeaders_default(header), valueOrRewrite); - } else { - header != null && setHeader(valueOrRewrite, header, rewrite); - } - return this; - } - get(header, parser) { - header = normalizeHeader(header); - if (header) { - const key = utils_default.findKey(this, header); - if (key) { - const value = this[key]; - if (!parser) { - return value; - } - if (parser === true) { - return parseTokens(value); - } - if (utils_default.isFunction(parser)) { - return parser.call(this, value, key); - } - if (utils_default.isRegExp(parser)) { - return parser.exec(value); - } - throw new TypeError("parser must be boolean|regexp|function"); - } - } - } - has(header, matcher) { - header = normalizeHeader(header); - if (header) { - const key = utils_default.findKey(this, header); - return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher))); - } - return false; - } - delete(header, matcher) { - const self2 = this; - let deleted = false; - function deleteHeader(_header) { - _header = normalizeHeader(_header); - if (_header) { - const key = utils_default.findKey(self2, _header); - if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) { - delete self2[key]; - deleted = true; - } - } - } - if (utils_default.isArray(header)) { - header.forEach(deleteHeader); - } else { - deleteHeader(header); - } - return deleted; - } - clear(matcher) { - const keys = Object.keys(this); - let i = keys.length; - let deleted = false; - while (i--) { - const key = keys[i]; - if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) { - delete this[key]; - deleted = true; - } - } - return deleted; - } - normalize(format) { - const self2 = this; - const headers = {}; - utils_default.forEach(this, (value, header) => { - const key = utils_default.findKey(headers, header); - if (key) { - self2[key] = normalizeValue(value); - delete self2[header]; - return; - } - const normalized = format ? formatHeader(header) : String(header).trim(); - if (normalized !== header) { - delete self2[header]; - } - self2[normalized] = normalizeValue(value); - headers[normalized] = true; - }); - return this; - } - concat(...targets) { - return this.constructor.concat(this, ...targets); - } - toJSON(asStrings) { - const obj = /* @__PURE__ */ Object.create(null); - utils_default.forEach(this, (value, header) => { - value != null && value !== false && (obj[header] = asStrings && utils_default.isArray(value) ? value.join(", ") : value); - }); - return obj; - } - [Symbol.iterator]() { - return Object.entries(this.toJSON())[Symbol.iterator](); - } - toString() { - return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n"); - } - get [Symbol.toStringTag]() { - return "AxiosHeaders"; - } - static from(thing) { - return thing instanceof this ? thing : new this(thing); - } - static concat(first, ...targets) { - const computed = new this(first); - targets.forEach((target) => computed.set(target)); - return computed; - } - static accessor(header) { - const internals = this[$internals] = this[$internals] = { - accessors: {} - }; - const accessors = internals.accessors; - const prototype3 = this.prototype; - function defineAccessor(_header) { - const lHeader = normalizeHeader(_header); - if (!accessors[lHeader]) { - buildAccessors(prototype3, _header); - accessors[lHeader] = true; - } - } - utils_default.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header); - return this; - } -}; -AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]); -utils_default.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => { - let mapped = key[0].toUpperCase() + key.slice(1); - return { - get: () => value, - set(headerValue) { - this[mapped] = headerValue; - } - }; -}); -utils_default.freezeMethods(AxiosHeaders); -var AxiosHeaders_default = AxiosHeaders; - -// node_modules/axios/lib/core/transformData.js -function transformData(fns, response) { - const config = this || defaults_default; - const context = response || config; - const headers = AxiosHeaders_default.from(context.headers); - let data = context.data; - utils_default.forEach(fns, function transform(fn) { - data = fn.call(config, data, headers.normalize(), response ? response.status : void 0); - }); - headers.normalize(); - return data; -} - -// node_modules/axios/lib/cancel/isCancel.js -function isCancel(value) { - return !!(value && value.__CANCEL__); -} - -// node_modules/axios/lib/cancel/CanceledError.js -function CanceledError(message, config, request) { - AxiosError_default.call(this, message == null ? "canceled" : message, AxiosError_default.ERR_CANCELED, config, request); - this.name = "CanceledError"; -} -utils_default.inherits(CanceledError, AxiosError_default, { - __CANCEL__: true -}); -var CanceledError_default = CanceledError; - -// node_modules/axios/lib/core/settle.js -function settle(resolve, reject, response) { - const validateStatus2 = response.config.validateStatus; - if (!response.status || !validateStatus2 || validateStatus2(response.status)) { - resolve(response); - } else { - reject(new AxiosError_default( - "Request failed with status code " + response.status, - [AxiosError_default.ERR_BAD_REQUEST, AxiosError_default.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], - response.config, - response.request, - response - )); - } -} - -// node_modules/axios/lib/helpers/cookies.js -var cookies_default = platform_default.hasStandardBrowserEnv ? ( - // Standard browser envs support document.cookie - { - write(name, value, expires, path, domain, secure) { - const cookie = [name + "=" + encodeURIComponent(value)]; - utils_default.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString()); - utils_default.isString(path) && cookie.push("path=" + path); - utils_default.isString(domain) && cookie.push("domain=" + domain); - secure === true && cookie.push("secure"); - document.cookie = cookie.join("; "); - }, - read(name) { - const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)")); - return match ? decodeURIComponent(match[3]) : null; - }, - remove(name) { - this.write(name, "", Date.now() - 864e5); - } - } -) : ( - // Non-standard browser env (web workers, react-native) lack needed support. - { - write() { - }, - read() { - return null; - }, - remove() { - } - } -); - -// node_modules/axios/lib/helpers/isAbsoluteURL.js -function isAbsoluteURL(url) { - return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); -} - -// node_modules/axios/lib/helpers/combineURLs.js -function combineURLs(baseURL, relativeURL) { - return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL; -} - -// node_modules/axios/lib/core/buildFullPath.js -function buildFullPath(baseURL, requestedURL) { - if (baseURL && !isAbsoluteURL(requestedURL)) { - return combineURLs(baseURL, requestedURL); - } - return requestedURL; -} - -// node_modules/axios/lib/helpers/isURLSameOrigin.js -var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? ( - // Standard browser envs have full support of the APIs needed to test - // whether the request URL is of the same origin as current location. - function standardBrowserEnv() { - const msie = /(msie|trident)/i.test(navigator.userAgent); - const urlParsingNode = document.createElement("a"); - let originURL; - function resolveURL(url) { - let href = url; - if (msie) { - urlParsingNode.setAttribute("href", href); - href = urlParsingNode.href; - } - urlParsingNode.setAttribute("href", href); - return { - href: urlParsingNode.href, - protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "", - host: urlParsingNode.host, - search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "", - hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "", - hostname: urlParsingNode.hostname, - port: urlParsingNode.port, - pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname - }; - } - originURL = resolveURL(window.location.href); - return function isURLSameOrigin(requestURL) { - const parsed = utils_default.isString(requestURL) ? resolveURL(requestURL) : requestURL; - return parsed.protocol === originURL.protocol && parsed.host === originURL.host; - }; - }() -) : ( - // Non standard browser envs (web workers, react-native) lack needed support. - /* @__PURE__ */ function nonStandardBrowserEnv() { - return function isURLSameOrigin() { - return true; - }; - }() -); - -// node_modules/axios/lib/helpers/parseProtocol.js -function parseProtocol(url) { - const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); - return match && match[1] || ""; -} - -// node_modules/axios/lib/helpers/speedometer.js -function speedometer(samplesCount, min) { - samplesCount = samplesCount || 10; - const bytes = new Array(samplesCount); - const timestamps = new Array(samplesCount); - let head = 0; - let tail = 0; - let firstSampleTS; - min = min !== void 0 ? min : 1e3; - return function push(chunkLength) { - const now = Date.now(); - const startedAt = timestamps[tail]; - if (!firstSampleTS) { - firstSampleTS = now; - } - bytes[head] = chunkLength; - timestamps[head] = now; - let i = tail; - let bytesCount = 0; - while (i !== head) { - bytesCount += bytes[i++]; - i = i % samplesCount; - } - head = (head + 1) % samplesCount; - if (head === tail) { - tail = (tail + 1) % samplesCount; - } - if (now - firstSampleTS < min) { - return; - } - const passed = startedAt && now - startedAt; - return passed ? Math.round(bytesCount * 1e3 / passed) : void 0; - }; -} -var speedometer_default = speedometer; - -// node_modules/axios/lib/adapters/xhr.js -function progressEventReducer(listener, isDownloadStream) { - let bytesNotified = 0; - const _speedometer = speedometer_default(50, 250); - return (e) => { - const loaded = e.loaded; - const total = e.lengthComputable ? e.total : void 0; - const progressBytes = loaded - bytesNotified; - const rate = _speedometer(progressBytes); - const inRange = loaded <= total; - bytesNotified = loaded; - const data = { - loaded, - total, - progress: total ? loaded / total : void 0, - bytes: progressBytes, - rate: rate ? rate : void 0, - estimated: rate && total && inRange ? (total - loaded) / rate : void 0, - event: e - }; - data[isDownloadStream ? "download" : "upload"] = true; - listener(data); - }; -} -var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined"; -var xhr_default = isXHRAdapterSupported && function(config) { - return new Promise(function dispatchXhrRequest(resolve, reject) { - let requestData = config.data; - const requestHeaders = AxiosHeaders_default.from(config.headers).normalize(); - let { responseType, withXSRFToken } = config; - let onCanceled; - function done() { - if (config.cancelToken) { - config.cancelToken.unsubscribe(onCanceled); - } - if (config.signal) { - config.signal.removeEventListener("abort", onCanceled); - } - } - let contentType; - if (utils_default.isFormData(requestData)) { - if (platform_default.hasStandardBrowserEnv || platform_default.hasStandardBrowserWebWorkerEnv) { - requestHeaders.setContentType(false); - } else if ((contentType = requestHeaders.getContentType()) !== false) { - const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : []; - requestHeaders.setContentType([type || "multipart/form-data", ...tokens].join("; ")); - } - } - let request = new XMLHttpRequest(); - if (config.auth) { - const username = config.auth.username || ""; - const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ""; - requestHeaders.set("Authorization", "Basic " + btoa(username + ":" + password)); - } - const fullPath = buildFullPath(config.baseURL, config.url); - request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); - request.timeout = config.timeout; - function onloadend() { - if (!request) { - return; - } - const responseHeaders = AxiosHeaders_default.from( - "getAllResponseHeaders" in request && request.getAllResponseHeaders() - ); - const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response; - const response = { - data: responseData, - status: request.status, - statusText: request.statusText, - headers: responseHeaders, - config, - request - }; - settle(function _resolve(value) { - resolve(value); - done(); - }, function _reject(err) { - reject(err); - done(); - }, response); - request = null; - } - if ("onloadend" in request) { - request.onloadend = onloadend; - } else { - request.onreadystatechange = function handleLoad() { - if (!request || request.readyState !== 4) { - return; - } - if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) { - return; - } - setTimeout(onloadend); - }; - } - request.onabort = function handleAbort() { - if (!request) { - return; - } - reject(new AxiosError_default("Request aborted", AxiosError_default.ECONNABORTED, config, request)); - request = null; - }; - request.onerror = function handleError() { - reject(new AxiosError_default("Network Error", AxiosError_default.ERR_NETWORK, config, request)); - request = null; - }; - request.ontimeout = function handleTimeout() { - let timeoutErrorMessage = config.timeout ? "timeout of " + config.timeout + "ms exceeded" : "timeout exceeded"; - const transitional2 = config.transitional || transitional_default; - if (config.timeoutErrorMessage) { - timeoutErrorMessage = config.timeoutErrorMessage; - } - reject(new AxiosError_default( - timeoutErrorMessage, - transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED, - config, - request - )); - request = null; - }; - if (platform_default.hasStandardBrowserEnv) { - withXSRFToken && utils_default.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config)); - if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin_default(fullPath)) { - const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies_default.read(config.xsrfCookieName); - if (xsrfValue) { - requestHeaders.set(config.xsrfHeaderName, xsrfValue); - } - } - } - requestData === void 0 && requestHeaders.setContentType(null); - if ("setRequestHeader" in request) { - utils_default.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) { - request.setRequestHeader(key, val); - }); - } - if (!utils_default.isUndefined(config.withCredentials)) { - request.withCredentials = !!config.withCredentials; - } - if (responseType && responseType !== "json") { - request.responseType = config.responseType; - } - if (typeof config.onDownloadProgress === "function") { - request.addEventListener("progress", progressEventReducer(config.onDownloadProgress, true)); - } - if (typeof config.onUploadProgress === "function" && request.upload) { - request.upload.addEventListener("progress", progressEventReducer(config.onUploadProgress)); - } - if (config.cancelToken || config.signal) { - onCanceled = (cancel) => { - if (!request) { - return; - } - reject(!cancel || cancel.type ? new CanceledError_default(null, config, request) : cancel); - request.abort(); - request = null; - }; - config.cancelToken && config.cancelToken.subscribe(onCanceled); - if (config.signal) { - config.signal.aborted ? onCanceled() : config.signal.addEventListener("abort", onCanceled); - } - } - const protocol = parseProtocol(fullPath); - if (protocol && platform_default.protocols.indexOf(protocol) === -1) { - reject(new AxiosError_default("Unsupported protocol " + protocol + ":", AxiosError_default.ERR_BAD_REQUEST, config)); - return; - } - request.send(requestData || null); - }); -}; - -// node_modules/axios/lib/adapters/adapters.js -var knownAdapters = { - http: null_default, - xhr: xhr_default -}; -utils_default.forEach(knownAdapters, (fn, value) => { - if (fn) { - try { - Object.defineProperty(fn, "name", { value }); - } catch (e) { - } - Object.defineProperty(fn, "adapterName", { value }); - } -}); -var renderReason = (reason) => `- ${reason}`; -var isResolvedHandle = (adapter) => utils_default.isFunction(adapter) || adapter === null || adapter === false; -var adapters_default = { - getAdapter: (adapters) => { - adapters = utils_default.isArray(adapters) ? adapters : [adapters]; - const { length } = adapters; - let nameOrAdapter; - let adapter; - const rejectedReasons = {}; - for (let i = 0; i < length; i++) { - nameOrAdapter = adapters[i]; - let id; - adapter = nameOrAdapter; - if (!isResolvedHandle(nameOrAdapter)) { - adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()]; - if (adapter === void 0) { - throw new AxiosError_default(`Unknown adapter '${id}'`); - } - } - if (adapter) { - break; - } - rejectedReasons[id || "#" + i] = adapter; - } - if (!adapter) { - const reasons = Object.entries(rejectedReasons).map( - ([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build") - ); - let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified"; - throw new AxiosError_default( - `There is no suitable adapter to dispatch the request ` + s, - "ERR_NOT_SUPPORT" - ); - } - return adapter; - }, - adapters: knownAdapters -}; - -// node_modules/axios/lib/core/dispatchRequest.js -function throwIfCancellationRequested(config) { - if (config.cancelToken) { - config.cancelToken.throwIfRequested(); - } - if (config.signal && config.signal.aborted) { - throw new CanceledError_default(null, config); - } -} -function dispatchRequest(config) { - throwIfCancellationRequested(config); - config.headers = AxiosHeaders_default.from(config.headers); - config.data = transformData.call( - config, - config.transformRequest - ); - if (["post", "put", "patch"].indexOf(config.method) !== -1) { - config.headers.setContentType("application/x-www-form-urlencoded", false); - } - const adapter = adapters_default.getAdapter(config.adapter || defaults_default.adapter); - return adapter(config).then(function onAdapterResolution(response) { - throwIfCancellationRequested(config); - response.data = transformData.call( - config, - config.transformResponse, - response - ); - response.headers = AxiosHeaders_default.from(response.headers); - return response; - }, function onAdapterRejection(reason) { - if (!isCancel(reason)) { - throwIfCancellationRequested(config); - if (reason && reason.response) { - reason.response.data = transformData.call( - config, - config.transformResponse, - reason.response - ); - reason.response.headers = AxiosHeaders_default.from(reason.response.headers); - } - } - return Promise.reject(reason); - }); -} - -// node_modules/axios/lib/core/mergeConfig.js -var headersToObject = (thing) => thing instanceof AxiosHeaders_default ? { ...thing } : thing; -function mergeConfig(config1, config2) { - config2 = config2 || {}; - const config = {}; - function getMergedValue(target, source, caseless) { - if (utils_default.isPlainObject(target) && utils_default.isPlainObject(source)) { - return utils_default.merge.call({ caseless }, target, source); - } else if (utils_default.isPlainObject(source)) { - return utils_default.merge({}, source); - } else if (utils_default.isArray(source)) { - return source.slice(); - } - return source; - } - function mergeDeepProperties(a, b, caseless) { - if (!utils_default.isUndefined(b)) { - return getMergedValue(a, b, caseless); - } else if (!utils_default.isUndefined(a)) { - return getMergedValue(void 0, a, caseless); - } - } - function valueFromConfig2(a, b) { - if (!utils_default.isUndefined(b)) { - return getMergedValue(void 0, b); - } - } - function defaultToConfig2(a, b) { - if (!utils_default.isUndefined(b)) { - return getMergedValue(void 0, b); - } else if (!utils_default.isUndefined(a)) { - return getMergedValue(void 0, a); - } - } - function mergeDirectKeys(a, b, prop) { - if (prop in config2) { - return getMergedValue(a, b); - } else if (prop in config1) { - return getMergedValue(void 0, a); - } - } - const mergeMap = { - url: valueFromConfig2, - method: valueFromConfig2, - data: valueFromConfig2, - baseURL: defaultToConfig2, - transformRequest: defaultToConfig2, - transformResponse: defaultToConfig2, - paramsSerializer: defaultToConfig2, - timeout: defaultToConfig2, - timeoutMessage: defaultToConfig2, - withCredentials: defaultToConfig2, - withXSRFToken: defaultToConfig2, - adapter: defaultToConfig2, - responseType: defaultToConfig2, - xsrfCookieName: defaultToConfig2, - xsrfHeaderName: defaultToConfig2, - onUploadProgress: defaultToConfig2, - onDownloadProgress: defaultToConfig2, - decompress: defaultToConfig2, - maxContentLength: defaultToConfig2, - maxBodyLength: defaultToConfig2, - beforeRedirect: defaultToConfig2, - transport: defaultToConfig2, - httpAgent: defaultToConfig2, - httpsAgent: defaultToConfig2, - cancelToken: defaultToConfig2, - socketPath: defaultToConfig2, - responseEncoding: defaultToConfig2, - validateStatus: mergeDirectKeys, - headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true) - }; - utils_default.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) { - const merge2 = mergeMap[prop] || mergeDeepProperties; - const configValue = merge2(config1[prop], config2[prop], prop); - utils_default.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue); - }); - return config; -} - -// node_modules/axios/lib/env/data.js -var VERSION = "1.6.8"; - -// node_modules/axios/lib/helpers/validator.js -var validators = {}; -["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => { - validators[type] = function validator(thing) { - return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type; - }; -}); -var deprecatedWarnings = {}; -validators.transitional = function transitional(validator, version, message) { - function formatMessage(opt, desc) { - return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : ""); - } - return (value, opt, opts) => { - if (validator === false) { - throw new AxiosError_default( - formatMessage(opt, " has been removed" + (version ? " in " + version : "")), - AxiosError_default.ERR_DEPRECATED - ); - } - if (version && !deprecatedWarnings[opt]) { - deprecatedWarnings[opt] = true; - console.warn( - formatMessage( - opt, - " has been deprecated since v" + version + " and will be removed in the near future" - ) - ); - } - return validator ? validator(value, opt, opts) : true; - }; -}; -function assertOptions(options, schema, allowUnknown) { - if (typeof options !== "object") { - throw new AxiosError_default("options must be an object", AxiosError_default.ERR_BAD_OPTION_VALUE); - } - const keys = Object.keys(options); - let i = keys.length; - while (i-- > 0) { - const opt = keys[i]; - const validator = schema[opt]; - if (validator) { - const value = options[opt]; - const result = value === void 0 || validator(value, opt, options); - if (result !== true) { - throw new AxiosError_default("option " + opt + " must be " + result, AxiosError_default.ERR_BAD_OPTION_VALUE); - } - continue; - } - if (allowUnknown !== true) { - throw new AxiosError_default("Unknown option " + opt, AxiosError_default.ERR_BAD_OPTION); - } - } -} -var validator_default = { - assertOptions, - validators -}; - -// node_modules/axios/lib/core/Axios.js -var validators2 = validator_default.validators; -var Axios = class { - constructor(instanceConfig) { - this.defaults = instanceConfig; - this.interceptors = { - request: new InterceptorManager_default(), - response: new InterceptorManager_default() - }; - } - /** - * Dispatch a request - * - * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) - * @param {?Object} config - * - * @returns {Promise} The Promise to be fulfilled - */ - async request(configOrUrl, config) { - try { - return await this._request(configOrUrl, config); - } catch (err) { - if (err instanceof Error) { - let dummy; - Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : dummy = new Error(); - const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : ""; - if (!err.stack) { - err.stack = stack; - } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) { - err.stack += "\n" + stack; - } - } - throw err; - } - } - _request(configOrUrl, config) { - if (typeof configOrUrl === "string") { - config = config || {}; - config.url = configOrUrl; - } else { - config = configOrUrl || {}; - } - config = mergeConfig(this.defaults, config); - const { transitional: transitional2, paramsSerializer, headers } = config; - if (transitional2 !== void 0) { - validator_default.assertOptions(transitional2, { - silentJSONParsing: validators2.transitional(validators2.boolean), - forcedJSONParsing: validators2.transitional(validators2.boolean), - clarifyTimeoutError: validators2.transitional(validators2.boolean) - }, false); - } - if (paramsSerializer != null) { - if (utils_default.isFunction(paramsSerializer)) { - config.paramsSerializer = { - serialize: paramsSerializer - }; - } else { - validator_default.assertOptions(paramsSerializer, { - encode: validators2.function, - serialize: validators2.function - }, true); - } - } - config.method = (config.method || this.defaults.method || "get").toLowerCase(); - let contextHeaders = headers && utils_default.merge( - headers.common, - headers[config.method] - ); - headers && utils_default.forEach( - ["delete", "get", "head", "post", "put", "patch", "common"], - (method) => { - delete headers[method]; - } - ); - config.headers = AxiosHeaders_default.concat(contextHeaders, headers); - const requestInterceptorChain = []; - let synchronousRequestInterceptors = true; - this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { - if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) { - return; - } - synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; - requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); - }); - const responseInterceptorChain = []; - this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { - responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); - }); - let promise; - let i = 0; - let len; - if (!synchronousRequestInterceptors) { - const chain = [dispatchRequest.bind(this), void 0]; - chain.unshift.apply(chain, requestInterceptorChain); - chain.push.apply(chain, responseInterceptorChain); - len = chain.length; - promise = Promise.resolve(config); - while (i < len) { - promise = promise.then(chain[i++], chain[i++]); - } - return promise; - } - len = requestInterceptorChain.length; - let newConfig = config; - i = 0; - while (i < len) { - const onFulfilled = requestInterceptorChain[i++]; - const onRejected = requestInterceptorChain[i++]; - try { - newConfig = onFulfilled(newConfig); - } catch (error) { - onRejected.call(this, error); - break; - } - } - try { - promise = dispatchRequest.call(this, newConfig); - } catch (error) { - return Promise.reject(error); - } - i = 0; - len = responseInterceptorChain.length; - while (i < len) { - promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]); - } - return promise; - } - getUri(config) { - config = mergeConfig(this.defaults, config); - const fullPath = buildFullPath(config.baseURL, config.url); - return buildURL(fullPath, config.params, config.paramsSerializer); - } -}; -utils_default.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) { - Axios.prototype[method] = function(url, config) { - return this.request(mergeConfig(config || {}, { - method, - url, - data: (config || {}).data - })); - }; -}); -utils_default.forEach(["post", "put", "patch"], function forEachMethodWithData(method) { - function generateHTTPMethod(isForm) { - return function httpMethod(url, data, config) { - return this.request(mergeConfig(config || {}, { - method, - headers: isForm ? { - "Content-Type": "multipart/form-data" - } : {}, - url, - data - })); - }; - } - Axios.prototype[method] = generateHTTPMethod(); - Axios.prototype[method + "Form"] = generateHTTPMethod(true); -}); -var Axios_default = Axios; - -// node_modules/axios/lib/cancel/CancelToken.js -var CancelToken = class _CancelToken { - constructor(executor) { - if (typeof executor !== "function") { - throw new TypeError("executor must be a function."); - } - let resolvePromise; - this.promise = new Promise(function promiseExecutor(resolve) { - resolvePromise = resolve; - }); - const token = this; - this.promise.then((cancel) => { - if (!token._listeners) - return; - let i = token._listeners.length; - while (i-- > 0) { - token._listeners[i](cancel); - } - token._listeners = null; - }); - this.promise.then = (onfulfilled) => { - let _resolve; - const promise = new Promise((resolve) => { - token.subscribe(resolve); - _resolve = resolve; - }).then(onfulfilled); - promise.cancel = function reject() { - token.unsubscribe(_resolve); - }; - return promise; - }; - executor(function cancel(message, config, request) { - if (token.reason) { - return; - } - token.reason = new CanceledError_default(message, config, request); - resolvePromise(token.reason); - }); - } - /** - * Throws a `CanceledError` if cancellation has been requested. - */ - throwIfRequested() { - if (this.reason) { - throw this.reason; - } - } - /** - * Subscribe to the cancel signal - */ - subscribe(listener) { - if (this.reason) { - listener(this.reason); - return; - } - if (this._listeners) { - this._listeners.push(listener); - } else { - this._listeners = [listener]; - } - } - /** - * Unsubscribe from the cancel signal - */ - unsubscribe(listener) { - if (!this._listeners) { - return; - } - const index = this._listeners.indexOf(listener); - if (index !== -1) { - this._listeners.splice(index, 1); - } - } - /** - * Returns an object that contains a new `CancelToken` and a function that, when called, - * cancels the `CancelToken`. - */ - static source() { - let cancel; - const token = new _CancelToken(function executor(c) { - cancel = c; - }); - return { - token, - cancel - }; - } -}; -var CancelToken_default = CancelToken; - -// node_modules/axios/lib/helpers/spread.js -function spread(callback) { - return function wrap(arr) { - return callback.apply(null, arr); - }; -} - -// node_modules/axios/lib/helpers/isAxiosError.js -function isAxiosError(payload) { - return utils_default.isObject(payload) && payload.isAxiosError === true; -} - -// node_modules/axios/lib/helpers/HttpStatusCode.js -var HttpStatusCode = { - Continue: 100, - SwitchingProtocols: 101, - Processing: 102, - EarlyHints: 103, - Ok: 200, - Created: 201, - Accepted: 202, - NonAuthoritativeInformation: 203, - NoContent: 204, - ResetContent: 205, - PartialContent: 206, - MultiStatus: 207, - AlreadyReported: 208, - ImUsed: 226, - MultipleChoices: 300, - MovedPermanently: 301, - Found: 302, - SeeOther: 303, - NotModified: 304, - UseProxy: 305, - Unused: 306, - TemporaryRedirect: 307, - PermanentRedirect: 308, - BadRequest: 400, - Unauthorized: 401, - PaymentRequired: 402, - Forbidden: 403, - NotFound: 404, - MethodNotAllowed: 405, - NotAcceptable: 406, - ProxyAuthenticationRequired: 407, - RequestTimeout: 408, - Conflict: 409, - Gone: 410, - LengthRequired: 411, - PreconditionFailed: 412, - PayloadTooLarge: 413, - UriTooLong: 414, - UnsupportedMediaType: 415, - RangeNotSatisfiable: 416, - ExpectationFailed: 417, - ImATeapot: 418, - MisdirectedRequest: 421, - UnprocessableEntity: 422, - Locked: 423, - FailedDependency: 424, - TooEarly: 425, - UpgradeRequired: 426, - PreconditionRequired: 428, - TooManyRequests: 429, - RequestHeaderFieldsTooLarge: 431, - UnavailableForLegalReasons: 451, - InternalServerError: 500, - NotImplemented: 501, - BadGateway: 502, - ServiceUnavailable: 503, - GatewayTimeout: 504, - HttpVersionNotSupported: 505, - VariantAlsoNegotiates: 506, - InsufficientStorage: 507, - LoopDetected: 508, - NotExtended: 510, - NetworkAuthenticationRequired: 511 -}; -Object.entries(HttpStatusCode).forEach(([key, value]) => { - HttpStatusCode[value] = key; -}); -var HttpStatusCode_default = HttpStatusCode; - -// node_modules/axios/lib/axios.js -function createInstance(defaultConfig) { - const context = new Axios_default(defaultConfig); - const instance = bind(Axios_default.prototype.request, context); - utils_default.extend(instance, Axios_default.prototype, context, { allOwnKeys: true }); - utils_default.extend(instance, context, null, { allOwnKeys: true }); - instance.create = function create(instanceConfig) { - return createInstance(mergeConfig(defaultConfig, instanceConfig)); - }; - return instance; -} -var axios = createInstance(defaults_default); -axios.Axios = Axios_default; -axios.CanceledError = CanceledError_default; -axios.CancelToken = CancelToken_default; -axios.isCancel = isCancel; -axios.VERSION = VERSION; -axios.toFormData = toFormData_default; -axios.AxiosError = AxiosError_default; -axios.Cancel = axios.CanceledError; -axios.all = function all(promises) { - return Promise.all(promises); -}; -axios.spread = spread; -axios.isAxiosError = isAxiosError; -axios.mergeConfig = mergeConfig; -axios.AxiosHeaders = AxiosHeaders_default; -axios.formToJSON = (thing) => formDataToJSON_default(utils_default.isHTMLForm(thing) ? new FormData(thing) : thing); -axios.getAdapter = adapters_default.getAdapter; -axios.HttpStatusCode = HttpStatusCode_default; -axios.default = axios; -var axios_default = axios; - -// node_modules/axios/index.js -var { - Axios: Axios2, - AxiosError: AxiosError2, - CanceledError: CanceledError2, - isCancel: isCancel2, - CancelToken: CancelToken2, - VERSION: VERSION2, - all: all2, - Cancel, - isAxiosError: isAxiosError2, - spread: spread2, - toFormData: toFormData2, - AxiosHeaders: AxiosHeaders2, - HttpStatusCode: HttpStatusCode2, - formToJSON, - getAdapter, - mergeConfig: mergeConfig2 -} = axios_default; -export { - Axios2 as Axios, - AxiosError2 as AxiosError, - AxiosHeaders2 as AxiosHeaders, - Cancel, - CancelToken2 as CancelToken, - CanceledError2 as CanceledError, - HttpStatusCode2 as HttpStatusCode, - VERSION2 as VERSION, - all2 as all, - axios_default as default, - formToJSON, - getAdapter, - isAxiosError2 as isAxiosError, - isCancel2 as isCancel, - mergeConfig2 as mergeConfig, - spread2 as spread, - toFormData2 as toFormData -}; -//# sourceMappingURL=axios.js.map diff --git a/node_modules/.vite/deps/axios.js.map b/node_modules/.vite/deps/axios.js.map deleted file mode 100644 index 949a88b4..00000000 --- a/node_modules/.vite/deps/axios.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../../axios/lib/helpers/bind.js", "../../axios/lib/utils.js", "../../axios/lib/core/AxiosError.js", "../../axios/lib/helpers/null.js", "../../axios/lib/helpers/toFormData.js", "../../axios/lib/helpers/AxiosURLSearchParams.js", "../../axios/lib/helpers/buildURL.js", "../../axios/lib/core/InterceptorManager.js", "../../axios/lib/defaults/transitional.js", "../../axios/lib/platform/browser/classes/URLSearchParams.js", "../../axios/lib/platform/browser/classes/FormData.js", "../../axios/lib/platform/browser/classes/Blob.js", "../../axios/lib/platform/browser/index.js", "../../axios/lib/platform/common/utils.js", "../../axios/lib/platform/index.js", "../../axios/lib/helpers/toURLEncodedForm.js", "../../axios/lib/helpers/formDataToJSON.js", "../../axios/lib/defaults/index.js", "../../axios/lib/helpers/parseHeaders.js", "../../axios/lib/core/AxiosHeaders.js", "../../axios/lib/core/transformData.js", "../../axios/lib/cancel/isCancel.js", "../../axios/lib/cancel/CanceledError.js", "../../axios/lib/core/settle.js", "../../axios/lib/helpers/cookies.js", "../../axios/lib/helpers/isAbsoluteURL.js", "../../axios/lib/helpers/combineURLs.js", "../../axios/lib/core/buildFullPath.js", "../../axios/lib/helpers/isURLSameOrigin.js", "../../axios/lib/helpers/parseProtocol.js", "../../axios/lib/helpers/speedometer.js", "../../axios/lib/adapters/xhr.js", "../../axios/lib/adapters/adapters.js", "../../axios/lib/core/dispatchRequest.js", "../../axios/lib/core/mergeConfig.js", "../../axios/lib/env/data.js", "../../axios/lib/helpers/validator.js", "../../axios/lib/core/Axios.js", "../../axios/lib/cancel/CancelToken.js", "../../axios/lib/helpers/spread.js", "../../axios/lib/helpers/isAxiosError.js", "../../axios/lib/helpers/HttpStatusCode.js", "../../axios/lib/axios.js", "../../axios/index.js"], - "sourcesContent": ["'use strict';\n\nexport default function bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n", "'use strict';\n\nimport bind from './helpers/bind.js';\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst {toString} = Object.prototype;\nconst {getPrototypeOf} = Object;\n\nconst kindOf = (cache => thing => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type\n}\n\nconst typeOfTest = type => thing => typeof thing === type;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst {isArray} = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, otherwise false\n */\nconst isNumber = typeOfTest('number');\n\n/**\n * Determine if a value is an Object\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an Object, otherwise false\n */\nconst isObject = (thing) => thing !== null && typeof thing === 'object';\n\n/**\n * Determine if a value is a Boolean\n *\n * @param {*} thing The value to test\n * @returns {boolean} True if value is a Boolean, otherwise false\n */\nconst isBoolean = thing => thing === true || thing === false;\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a plain Object, otherwise false\n */\nconst isPlainObject = (val) => {\n if (kindOf(val) !== 'object') {\n return false;\n }\n\n const prototype = getPrototypeOf(val);\n return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Date, otherwise false\n */\nconst isDate = kindOfTest('Date');\n\n/**\n * Determine if a value is a File\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFile = kindOfTest('File');\n\n/**\n * Determine if a value is a Blob\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nconst isBlob = kindOfTest('Blob');\n\n/**\n * Determine if a value is a FileList\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFileList = kindOfTest('FileList');\n\n/**\n * Determine if a value is a Stream\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nconst isStream = (val) => isObject(val) && isFunction(val.pipe);\n\n/**\n * Determine if a value is a FormData\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nconst isFormData = (thing) => {\n let kind;\n return thing && (\n (typeof FormData === 'function' && thing instanceof FormData) || (\n isFunction(thing.append) && (\n (kind = kindOf(thing)) === 'formdata' ||\n // detect form-data instance\n (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')\n )\n )\n )\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nconst isURLSearchParams = kindOfTest('URLSearchParams');\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n *\n * @returns {String} The String freed of excess whitespace\n */\nconst trim = (str) => str.trim ?\n str.trim() : str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n *\n * @param {Boolean} [allOwnKeys = false]\n * @returns {any}\n */\nfunction forEach(obj, fn, {allOwnKeys = false} = {}) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n let i;\n let l;\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);\n const len = keys.length;\n let key;\n\n for (i = 0; i < len; i++) {\n key = keys[i];\n fn.call(null, obj[key], key, obj);\n }\n }\n}\n\nfunction findKey(obj, key) {\n key = key.toLowerCase();\n const keys = Object.keys(obj);\n let i = keys.length;\n let _key;\n while (i-- > 0) {\n _key = keys[i];\n if (key === _key.toLowerCase()) {\n return _key;\n }\n }\n return null;\n}\n\nconst _global = (() => {\n /*eslint no-undef:0*/\n if (typeof globalThis !== \"undefined\") return globalThis;\n return typeof self !== \"undefined\" ? self : (typeof window !== 'undefined' ? window : global)\n})();\n\nconst isContextDefined = (context) => !isUndefined(context) && context !== _global;\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n *\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n const {caseless} = isContextDefined(this) && this || {};\n const result = {};\n const assignValue = (val, key) => {\n const targetKey = caseless && findKey(result, key) || key;\n if (isPlainObject(result[targetKey]) && isPlainObject(val)) {\n result[targetKey] = merge(result[targetKey], val);\n } else if (isPlainObject(val)) {\n result[targetKey] = merge({}, val);\n } else if (isArray(val)) {\n result[targetKey] = val.slice();\n } else {\n result[targetKey] = val;\n }\n }\n\n for (let i = 0, l = arguments.length; i < l; i++) {\n arguments[i] && forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n *\n * @param {Boolean} [allOwnKeys]\n * @returns {Object} The resulting value of object a\n */\nconst extend = (a, b, thisArg, {allOwnKeys}= {}) => {\n forEach(b, (val, key) => {\n if (thisArg && isFunction(val)) {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n }, {allOwnKeys});\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n *\n * @returns {string} content value without BOM\n */\nconst stripBOM = (content) => {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\n/**\n * Inherit the prototype methods from one constructor into another\n * @param {function} constructor\n * @param {function} superConstructor\n * @param {object} [props]\n * @param {object} [descriptors]\n *\n * @returns {void}\n */\nconst inherits = (constructor, superConstructor, props, descriptors) => {\n constructor.prototype = Object.create(superConstructor.prototype, descriptors);\n constructor.prototype.constructor = constructor;\n Object.defineProperty(constructor, 'super', {\n value: superConstructor.prototype\n });\n props && Object.assign(constructor.prototype, props);\n}\n\n/**\n * Resolve object with deep prototype chain to a flat object\n * @param {Object} sourceObj source object\n * @param {Object} [destObj]\n * @param {Function|Boolean} [filter]\n * @param {Function} [propFilter]\n *\n * @returns {Object}\n */\nconst toFlatObject = (sourceObj, destObj, filter, propFilter) => {\n let props;\n let i;\n let prop;\n const merged = {};\n\n destObj = destObj || {};\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (sourceObj == null) return destObj;\n\n do {\n props = Object.getOwnPropertyNames(sourceObj);\n i = props.length;\n while (i-- > 0) {\n prop = props[i];\n if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {\n destObj[prop] = sourceObj[prop];\n merged[prop] = true;\n }\n }\n sourceObj = filter !== false && getPrototypeOf(sourceObj);\n } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);\n\n return destObj;\n}\n\n/**\n * Determines whether a string ends with the characters of a specified string\n *\n * @param {String} str\n * @param {String} searchString\n * @param {Number} [position= 0]\n *\n * @returns {boolean}\n */\nconst endsWith = (str, searchString, position) => {\n str = String(str);\n if (position === undefined || position > str.length) {\n position = str.length;\n }\n position -= searchString.length;\n const lastIndex = str.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n}\n\n\n/**\n * Returns new array from array like object or null if failed\n *\n * @param {*} [thing]\n *\n * @returns {?Array}\n */\nconst toArray = (thing) => {\n if (!thing) return null;\n if (isArray(thing)) return thing;\n let i = thing.length;\n if (!isNumber(i)) return null;\n const arr = new Array(i);\n while (i-- > 0) {\n arr[i] = thing[i];\n }\n return arr;\n}\n\n/**\n * Checking if the Uint8Array exists and if it does, it returns a function that checks if the\n * thing passed in is an instance of Uint8Array\n *\n * @param {TypedArray}\n *\n * @returns {Array}\n */\n// eslint-disable-next-line func-names\nconst isTypedArray = (TypedArray => {\n // eslint-disable-next-line func-names\n return thing => {\n return TypedArray && thing instanceof TypedArray;\n };\n})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));\n\n/**\n * For each entry in the object, call the function with the key and value.\n *\n * @param {Object} obj - The object to iterate over.\n * @param {Function} fn - The function to call for each entry.\n *\n * @returns {void}\n */\nconst forEachEntry = (obj, fn) => {\n const generator = obj && obj[Symbol.iterator];\n\n const iterator = generator.call(obj);\n\n let result;\n\n while ((result = iterator.next()) && !result.done) {\n const pair = result.value;\n fn.call(obj, pair[0], pair[1]);\n }\n}\n\n/**\n * It takes a regular expression and a string, and returns an array of all the matches\n *\n * @param {string} regExp - The regular expression to match against.\n * @param {string} str - The string to search.\n *\n * @returns {Array}\n */\nconst matchAll = (regExp, str) => {\n let matches;\n const arr = [];\n\n while ((matches = regExp.exec(str)) !== null) {\n arr.push(matches);\n }\n\n return arr;\n}\n\n/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */\nconst isHTMLForm = kindOfTest('HTMLFormElement');\n\nconst toCamelCase = str => {\n return str.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g,\n function replacer(m, p1, p2) {\n return p1.toUpperCase() + p2;\n }\n );\n};\n\n/* Creating a function that will check if an object has a property. */\nconst hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);\n\n/**\n * Determine if a value is a RegExp object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a RegExp object, otherwise false\n */\nconst isRegExp = kindOfTest('RegExp');\n\nconst reduceDescriptors = (obj, reducer) => {\n const descriptors = Object.getOwnPropertyDescriptors(obj);\n const reducedDescriptors = {};\n\n forEach(descriptors, (descriptor, name) => {\n let ret;\n if ((ret = reducer(descriptor, name, obj)) !== false) {\n reducedDescriptors[name] = ret || descriptor;\n }\n });\n\n Object.defineProperties(obj, reducedDescriptors);\n}\n\n/**\n * Makes all methods read-only\n * @param {Object} obj\n */\n\nconst freezeMethods = (obj) => {\n reduceDescriptors(obj, (descriptor, name) => {\n // skip restricted props in strict mode\n if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {\n return false;\n }\n\n const value = obj[name];\n\n if (!isFunction(value)) return;\n\n descriptor.enumerable = false;\n\n if ('writable' in descriptor) {\n descriptor.writable = false;\n return;\n }\n\n if (!descriptor.set) {\n descriptor.set = () => {\n throw Error('Can not rewrite read-only method \\'' + name + '\\'');\n };\n }\n });\n}\n\nconst toObjectSet = (arrayOrString, delimiter) => {\n const obj = {};\n\n const define = (arr) => {\n arr.forEach(value => {\n obj[value] = true;\n });\n }\n\n isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));\n\n return obj;\n}\n\nconst noop = () => {}\n\nconst toFiniteNumber = (value, defaultValue) => {\n value = +value;\n return Number.isFinite(value) ? value : defaultValue;\n}\n\nconst ALPHA = 'abcdefghijklmnopqrstuvwxyz'\n\nconst DIGIT = '0123456789';\n\nconst ALPHABET = {\n DIGIT,\n ALPHA,\n ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT\n}\n\nconst generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {\n let str = '';\n const {length} = alphabet;\n while (size--) {\n str += alphabet[Math.random() * length|0]\n }\n\n return str;\n}\n\n/**\n * If the thing is a FormData object, return true, otherwise return false.\n *\n * @param {unknown} thing - The thing to check.\n *\n * @returns {boolean}\n */\nfunction isSpecCompliantForm(thing) {\n return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);\n}\n\nconst toJSONObject = (obj) => {\n const stack = new Array(10);\n\n const visit = (source, i) => {\n\n if (isObject(source)) {\n if (stack.indexOf(source) >= 0) {\n return;\n }\n\n if(!('toJSON' in source)) {\n stack[i] = source;\n const target = isArray(source) ? [] : {};\n\n forEach(source, (value, key) => {\n const reducedValue = visit(value, i + 1);\n !isUndefined(reducedValue) && (target[key] = reducedValue);\n });\n\n stack[i] = undefined;\n\n return target;\n }\n }\n\n return source;\n }\n\n return visit(obj, 0);\n}\n\nconst isAsyncFn = kindOfTest('AsyncFunction');\n\nconst isThenable = (thing) =>\n thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);\n\nexport default {\n isArray,\n isArrayBuffer,\n isBuffer,\n isFormData,\n isArrayBufferView,\n isString,\n isNumber,\n isBoolean,\n isObject,\n isPlainObject,\n isUndefined,\n isDate,\n isFile,\n isBlob,\n isRegExp,\n isFunction,\n isStream,\n isURLSearchParams,\n isTypedArray,\n isFileList,\n forEach,\n merge,\n extend,\n trim,\n stripBOM,\n inherits,\n toFlatObject,\n kindOf,\n kindOfTest,\n endsWith,\n toArray,\n forEachEntry,\n matchAll,\n isHTMLForm,\n hasOwnProperty,\n hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection\n reduceDescriptors,\n freezeMethods,\n toObjectSet,\n toCamelCase,\n noop,\n toFiniteNumber,\n findKey,\n global: _global,\n isContextDefined,\n ALPHABET,\n generateString,\n isSpecCompliantForm,\n toJSONObject,\n isAsyncFn,\n isThenable\n};\n", "'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [config] The config.\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n *\n * @returns {Error} The created error.\n */\nfunction AxiosError(message, code, config, request, response) {\n Error.call(this);\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = (new Error()).stack;\n }\n\n this.message = message;\n this.name = 'AxiosError';\n code && (this.code = code);\n config && (this.config = config);\n request && (this.request = request);\n response && (this.response = response);\n}\n\nutils.inherits(AxiosError, Error, {\n toJSON: function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: utils.toJSONObject(this.config),\n code: this.code,\n status: this.response && this.response.status ? this.response.status : null\n };\n }\n});\n\nconst prototype = AxiosError.prototype;\nconst descriptors = {};\n\n[\n 'ERR_BAD_OPTION_VALUE',\n 'ERR_BAD_OPTION',\n 'ECONNABORTED',\n 'ETIMEDOUT',\n 'ERR_NETWORK',\n 'ERR_FR_TOO_MANY_REDIRECTS',\n 'ERR_DEPRECATED',\n 'ERR_BAD_RESPONSE',\n 'ERR_BAD_REQUEST',\n 'ERR_CANCELED',\n 'ERR_NOT_SUPPORT',\n 'ERR_INVALID_URL'\n// eslint-disable-next-line func-names\n].forEach(code => {\n descriptors[code] = {value: code};\n});\n\nObject.defineProperties(AxiosError, descriptors);\nObject.defineProperty(prototype, 'isAxiosError', {value: true});\n\n// eslint-disable-next-line func-names\nAxiosError.from = (error, code, config, request, response, customProps) => {\n const axiosError = Object.create(prototype);\n\n utils.toFlatObject(error, axiosError, function filter(obj) {\n return obj !== Error.prototype;\n }, prop => {\n return prop !== 'isAxiosError';\n });\n\n AxiosError.call(axiosError, error.message, code, config, request, response);\n\n axiosError.cause = error;\n\n axiosError.name = error.name;\n\n customProps && Object.assign(axiosError, customProps);\n\n return axiosError;\n};\n\nexport default AxiosError;\n", "// eslint-disable-next-line strict\nexport default null;\n", "'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\n// temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored\nimport PlatformFormData from '../platform/node/classes/FormData.js';\n\n/**\n * Determines if the given thing is a array or js object.\n *\n * @param {string} thing - The object or array to be visited.\n *\n * @returns {boolean}\n */\nfunction isVisitable(thing) {\n return utils.isPlainObject(thing) || utils.isArray(thing);\n}\n\n/**\n * It removes the brackets from the end of a string\n *\n * @param {string} key - The key of the parameter.\n *\n * @returns {string} the key without the brackets.\n */\nfunction removeBrackets(key) {\n return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;\n}\n\n/**\n * It takes a path, a key, and a boolean, and returns a string\n *\n * @param {string} path - The path to the current key.\n * @param {string} key - The key of the current object being iterated over.\n * @param {string} dots - If true, the key will be rendered with dots instead of brackets.\n *\n * @returns {string} The path to the current key.\n */\nfunction renderKey(path, key, dots) {\n if (!path) return key;\n return path.concat(key).map(function each(token, i) {\n // eslint-disable-next-line no-param-reassign\n token = removeBrackets(token);\n return !dots && i ? '[' + token + ']' : token;\n }).join(dots ? '.' : '');\n}\n\n/**\n * If the array is an array and none of its elements are visitable, then it's a flat array.\n *\n * @param {Array} arr - The array to check\n *\n * @returns {boolean}\n */\nfunction isFlatArray(arr) {\n return utils.isArray(arr) && !arr.some(isVisitable);\n}\n\nconst predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {\n return /^is[A-Z]/.test(prop);\n});\n\n/**\n * Convert a data object to FormData\n *\n * @param {Object} obj\n * @param {?Object} [formData]\n * @param {?Object} [options]\n * @param {Function} [options.visitor]\n * @param {Boolean} [options.metaTokens = true]\n * @param {Boolean} [options.dots = false]\n * @param {?Boolean} [options.indexes = false]\n *\n * @returns {Object}\n **/\n\n/**\n * It converts an object into a FormData object\n *\n * @param {Object} obj - The object to convert to form data.\n * @param {string} formData - The FormData object to append to.\n * @param {Object} options\n *\n * @returns\n */\nfunction toFormData(obj, formData, options) {\n if (!utils.isObject(obj)) {\n throw new TypeError('target must be an object');\n }\n\n // eslint-disable-next-line no-param-reassign\n formData = formData || new (PlatformFormData || FormData)();\n\n // eslint-disable-next-line no-param-reassign\n options = utils.toFlatObject(options, {\n metaTokens: true,\n dots: false,\n indexes: false\n }, false, function defined(option, source) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n return !utils.isUndefined(source[option]);\n });\n\n const metaTokens = options.metaTokens;\n // eslint-disable-next-line no-use-before-define\n const visitor = options.visitor || defaultVisitor;\n const dots = options.dots;\n const indexes = options.indexes;\n const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;\n const useBlob = _Blob && utils.isSpecCompliantForm(formData);\n\n if (!utils.isFunction(visitor)) {\n throw new TypeError('visitor must be a function');\n }\n\n function convertValue(value) {\n if (value === null) return '';\n\n if (utils.isDate(value)) {\n return value.toISOString();\n }\n\n if (!useBlob && utils.isBlob(value)) {\n throw new AxiosError('Blob is not supported. Use a Buffer instead.');\n }\n\n if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {\n return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);\n }\n\n return value;\n }\n\n /**\n * Default visitor.\n *\n * @param {*} value\n * @param {String|Number} key\n * @param {Array} path\n * @this {FormData}\n *\n * @returns {boolean} return true to visit the each prop of the value recursively\n */\n function defaultVisitor(value, key, path) {\n let arr = value;\n\n if (value && !path && typeof value === 'object') {\n if (utils.endsWith(key, '{}')) {\n // eslint-disable-next-line no-param-reassign\n key = metaTokens ? key : key.slice(0, -2);\n // eslint-disable-next-line no-param-reassign\n value = JSON.stringify(value);\n } else if (\n (utils.isArray(value) && isFlatArray(value)) ||\n ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))\n )) {\n // eslint-disable-next-line no-param-reassign\n key = removeBrackets(key);\n\n arr.forEach(function each(el, index) {\n !(utils.isUndefined(el) || el === null) && formData.append(\n // eslint-disable-next-line no-nested-ternary\n indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),\n convertValue(el)\n );\n });\n return false;\n }\n }\n\n if (isVisitable(value)) {\n return true;\n }\n\n formData.append(renderKey(path, key, dots), convertValue(value));\n\n return false;\n }\n\n const stack = [];\n\n const exposedHelpers = Object.assign(predicates, {\n defaultVisitor,\n convertValue,\n isVisitable\n });\n\n function build(value, path) {\n if (utils.isUndefined(value)) return;\n\n if (stack.indexOf(value) !== -1) {\n throw Error('Circular reference detected in ' + path.join('.'));\n }\n\n stack.push(value);\n\n utils.forEach(value, function each(el, key) {\n const result = !(utils.isUndefined(el) || el === null) && visitor.call(\n formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers\n );\n\n if (result === true) {\n build(el, path ? path.concat(key) : [key]);\n }\n });\n\n stack.pop();\n }\n\n if (!utils.isObject(obj)) {\n throw new TypeError('data must be an object');\n }\n\n build(obj);\n\n return formData;\n}\n\nexport default toFormData;\n", "'use strict';\n\nimport toFormData from './toFormData.js';\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode(str) {\n const charMap = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {\n return charMap[match];\n });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object} params - The parameters to be converted to a FormData object.\n * @param {Object} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n this._pairs = [];\n\n params && toFormData(params, this, options);\n}\n\nconst prototype = AxiosURLSearchParams.prototype;\n\nprototype.append = function append(name, value) {\n this._pairs.push([name, value]);\n};\n\nprototype.toString = function toString(encoder) {\n const _encode = encoder ? function(value) {\n return encoder.call(this, value, encode);\n } : encode;\n\n return this._pairs.map(function each(pair) {\n return _encode(pair[0]) + '=' + _encode(pair[1]);\n }, '').join('&');\n};\n\nexport default AxiosURLSearchParams;\n", "'use strict';\n\nimport utils from '../utils.js';\nimport AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';\n\n/**\n * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their\n * URI encoded counterparts\n *\n * @param {string} val The value to be encoded.\n *\n * @returns {string} The encoded value.\n */\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @param {?object} options\n *\n * @returns {string} The formatted url\n */\nexport default function buildURL(url, params, options) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n \n const _encode = options && options.encode || encode;\n\n const serializeFn = options && options.serialize;\n\n let serializedParams;\n\n if (serializeFn) {\n serializedParams = serializeFn(params, options);\n } else {\n serializedParams = utils.isURLSearchParams(params) ?\n params.toString() :\n new AxiosURLSearchParams(params, options).toString(_encode);\n }\n\n if (serializedParams) {\n const hashmarkIndex = url.indexOf(\"#\");\n\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n}\n", "'use strict';\n\nimport utils from './../utils.js';\n\nclass InterceptorManager {\n constructor() {\n this.handlers = [];\n }\n\n /**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\n use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled,\n rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n }\n\n /**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n *\n * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise\n */\n eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n }\n\n /**\n * Clear all interceptors from the stack\n *\n * @returns {void}\n */\n clear() {\n if (this.handlers) {\n this.handlers = [];\n }\n }\n\n /**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n *\n * @returns {void}\n */\n forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n }\n}\n\nexport default InterceptorManager;\n", "'use strict';\n\nexport default {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false\n};\n", "'use strict';\n\nimport AxiosURLSearchParams from '../../../helpers/AxiosURLSearchParams.js';\nexport default typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;\n", "'use strict';\n\nexport default typeof FormData !== 'undefined' ? FormData : null;\n", "'use strict'\n\nexport default typeof Blob !== 'undefined' ? Blob : null\n", "import URLSearchParams from './classes/URLSearchParams.js'\nimport FormData from './classes/FormData.js'\nimport Blob from './classes/Blob.js'\n\nexport default {\n isBrowser: true,\n classes: {\n URLSearchParams,\n FormData,\n Blob\n },\n protocols: ['http', 'https', 'file', 'blob', 'url', 'data']\n};\n", "const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst hasStandardBrowserEnv = (\n (product) => {\n return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0\n })(typeof navigator !== 'undefined' && navigator.product);\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\nconst hasStandardBrowserWebWorkerEnv = (() => {\n return (\n typeof WorkerGlobalScope !== 'undefined' &&\n // eslint-disable-next-line no-undef\n self instanceof WorkerGlobalScope &&\n typeof self.importScripts === 'function'\n );\n})();\n\nexport {\n hasBrowserEnv,\n hasStandardBrowserWebWorkerEnv,\n hasStandardBrowserEnv\n}\n", "import platform from './node/index.js';\nimport * as utils from './common/utils.js';\n\nexport default {\n ...utils,\n ...platform\n}\n", "'use strict';\n\nimport utils from '../utils.js';\nimport toFormData from './toFormData.js';\nimport platform from '../platform/index.js';\n\nexport default function toURLEncodedForm(data, options) {\n return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({\n visitor: function(value, key, path, helpers) {\n if (platform.isNode && utils.isBuffer(value)) {\n this.append(key, value.toString('base64'));\n return false;\n }\n\n return helpers.defaultVisitor.apply(this, arguments);\n }\n }, options));\n}\n", "'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']\n *\n * @param {string} name - The name of the property to get.\n *\n * @returns An array of strings.\n */\nfunction parsePropPath(name) {\n // foo[x][y][z]\n // foo.x.y.z\n // foo-x-y-z\n // foo x y z\n return utils.matchAll(/\\w+|\\[(\\w*)]/g, name).map(match => {\n return match[0] === '[]' ? '' : match[1] || match[0];\n });\n}\n\n/**\n * Convert an array to an object.\n *\n * @param {Array} arr - The array to convert to an object.\n *\n * @returns An object with the same keys and values as the array.\n */\nfunction arrayToObject(arr) {\n const obj = {};\n const keys = Object.keys(arr);\n let i;\n const len = keys.length;\n let key;\n for (i = 0; i < len; i++) {\n key = keys[i];\n obj[key] = arr[key];\n }\n return obj;\n}\n\n/**\n * It takes a FormData object and returns a JavaScript object\n *\n * @param {string} formData The FormData object to convert to JSON.\n *\n * @returns {Object | null} The converted object.\n */\nfunction formDataToJSON(formData) {\n function buildPath(path, value, target, index) {\n let name = path[index++];\n\n if (name === '__proto__') return true;\n\n const isNumericKey = Number.isFinite(+name);\n const isLast = index >= path.length;\n name = !name && utils.isArray(target) ? target.length : name;\n\n if (isLast) {\n if (utils.hasOwnProp(target, name)) {\n target[name] = [target[name], value];\n } else {\n target[name] = value;\n }\n\n return !isNumericKey;\n }\n\n if (!target[name] || !utils.isObject(target[name])) {\n target[name] = [];\n }\n\n const result = buildPath(path, value, target[name], index);\n\n if (result && utils.isArray(target[name])) {\n target[name] = arrayToObject(target[name]);\n }\n\n return !isNumericKey;\n }\n\n if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {\n const obj = {};\n\n utils.forEachEntry(formData, (name, value) => {\n buildPath(parsePropPath(name), value, obj, 0);\n });\n\n return obj;\n }\n\n return null;\n}\n\nexport default formDataToJSON;\n", "'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport transitionalDefaults from './transitional.js';\nimport toFormData from '../helpers/toFormData.js';\nimport toURLEncodedForm from '../helpers/toURLEncodedForm.js';\nimport platform from '../platform/index.js';\nimport formDataToJSON from '../helpers/formDataToJSON.js';\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (utils.isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return utils.trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n\n transitional: transitionalDefaults,\n\n adapter: ['xhr', 'http'],\n\n transformRequest: [function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = utils.isObject(data);\n\n if (isObjectPayload && utils.isHTMLForm(data)) {\n data = new FormData(data);\n }\n\n const isFormData = utils.isFormData(data);\n\n if (isFormData) {\n return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n }\n\n if (utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n return data.toString();\n }\n\n let isFileList;\n\n if (isObjectPayload) {\n if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n return toURLEncodedForm(data, this.formSerializer).toString();\n }\n\n if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {\n const _FormData = this.env && this.env.FormData;\n\n return toFormData(\n isFileList ? {'files[]': data} : data,\n _FormData && new _FormData(),\n this.formSerializer\n );\n }\n }\n\n if (isObjectPayload || hasJSONContentType ) {\n headers.setContentType('application/json', false);\n return stringifySafely(data);\n }\n\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n const transitional = this.transitional || defaults.transitional;\n const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n const JSONRequested = this.responseType === 'json';\n\n if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {\n const silentJSONParsing = transitional && transitional.silentJSONParsing;\n const strictJSONParsing = !silentJSONParsing && JSONRequested;\n\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);\n }\n throw e;\n }\n }\n }\n\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n env: {\n FormData: platform.classes.FormData,\n Blob: platform.classes.Blob\n },\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*',\n 'Content-Type': undefined\n }\n }\n};\n\nutils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {\n defaults.headers[method] = {};\n});\n\nexport default defaults;\n", "'use strict';\n\nimport utils from './../utils.js';\n\n// RawAxiosHeaders whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nconst ignoreDuplicateOf = utils.toObjectSet([\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n]);\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} rawHeaders Headers needing to be parsed\n *\n * @returns {Object} Headers parsed into an object\n */\nexport default rawHeaders => {\n const parsed = {};\n let key;\n let val;\n let i;\n\n rawHeaders && rawHeaders.split('\\n').forEach(function parser(line) {\n i = line.indexOf(':');\n key = line.substring(0, i).trim().toLowerCase();\n val = line.substring(i + 1).trim();\n\n if (!key || (parsed[key] && ignoreDuplicateOf[key])) {\n return;\n }\n\n if (key === 'set-cookie') {\n if (parsed[key]) {\n parsed[key].push(val);\n } else {\n parsed[key] = [val];\n }\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n", "'use strict';\n\nimport utils from '../utils.js';\nimport parseHeaders from '../helpers/parseHeaders.js';\n\nconst $internals = Symbol('internals');\n\nfunction normalizeHeader(header) {\n return header && String(header).trim().toLowerCase();\n}\n\nfunction normalizeValue(value) {\n if (value === false || value == null) {\n return value;\n }\n\n return utils.isArray(value) ? value.map(normalizeValue) : String(value);\n}\n\nfunction parseTokens(str) {\n const tokens = Object.create(null);\n const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n let match;\n\n while ((match = tokensRE.exec(str))) {\n tokens[match[1]] = match[2];\n }\n\n return tokens;\n}\n\nconst isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\n\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n if (utils.isFunction(filter)) {\n return filter.call(this, value, header);\n }\n\n if (isHeaderNameFilter) {\n value = header;\n }\n\n if (!utils.isString(value)) return;\n\n if (utils.isString(filter)) {\n return value.indexOf(filter) !== -1;\n }\n\n if (utils.isRegExp(filter)) {\n return filter.test(value);\n }\n}\n\nfunction formatHeader(header) {\n return header.trim()\n .toLowerCase().replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n return char.toUpperCase() + str;\n });\n}\n\nfunction buildAccessors(obj, header) {\n const accessorName = utils.toCamelCase(' ' + header);\n\n ['get', 'set', 'has'].forEach(methodName => {\n Object.defineProperty(obj, methodName + accessorName, {\n value: function(arg1, arg2, arg3) {\n return this[methodName].call(this, header, arg1, arg2, arg3);\n },\n configurable: true\n });\n });\n}\n\nclass AxiosHeaders {\n constructor(headers) {\n headers && this.set(headers);\n }\n\n set(header, valueOrRewrite, rewrite) {\n const self = this;\n\n function setHeader(_value, _header, _rewrite) {\n const lHeader = normalizeHeader(_header);\n\n if (!lHeader) {\n throw new Error('header name must be a non-empty string');\n }\n\n const key = utils.findKey(self, lHeader);\n\n if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {\n self[key || _header] = normalizeValue(_value);\n }\n }\n\n const setHeaders = (headers, _rewrite) =>\n utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n\n if (utils.isPlainObject(header) || header instanceof this.constructor) {\n setHeaders(header, valueOrRewrite)\n } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n setHeaders(parseHeaders(header), valueOrRewrite);\n } else {\n header != null && setHeader(valueOrRewrite, header, rewrite);\n }\n\n return this;\n }\n\n get(header, parser) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n if (key) {\n const value = this[key];\n\n if (!parser) {\n return value;\n }\n\n if (parser === true) {\n return parseTokens(value);\n }\n\n if (utils.isFunction(parser)) {\n return parser.call(this, value, key);\n }\n\n if (utils.isRegExp(parser)) {\n return parser.exec(value);\n }\n\n throw new TypeError('parser must be boolean|regexp|function');\n }\n }\n }\n\n has(header, matcher) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));\n }\n\n return false;\n }\n\n delete(header, matcher) {\n const self = this;\n let deleted = false;\n\n function deleteHeader(_header) {\n _header = normalizeHeader(_header);\n\n if (_header) {\n const key = utils.findKey(self, _header);\n\n if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n delete self[key];\n\n deleted = true;\n }\n }\n }\n\n if (utils.isArray(header)) {\n header.forEach(deleteHeader);\n } else {\n deleteHeader(header);\n }\n\n return deleted;\n }\n\n clear(matcher) {\n const keys = Object.keys(this);\n let i = keys.length;\n let deleted = false;\n\n while (i--) {\n const key = keys[i];\n if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n delete this[key];\n deleted = true;\n }\n }\n\n return deleted;\n }\n\n normalize(format) {\n const self = this;\n const headers = {};\n\n utils.forEach(this, (value, header) => {\n const key = utils.findKey(headers, header);\n\n if (key) {\n self[key] = normalizeValue(value);\n delete self[header];\n return;\n }\n\n const normalized = format ? formatHeader(header) : String(header).trim();\n\n if (normalized !== header) {\n delete self[header];\n }\n\n self[normalized] = normalizeValue(value);\n\n headers[normalized] = true;\n });\n\n return this;\n }\n\n concat(...targets) {\n return this.constructor.concat(this, ...targets);\n }\n\n toJSON(asStrings) {\n const obj = Object.create(null);\n\n utils.forEach(this, (value, header) => {\n value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);\n });\n\n return obj;\n }\n\n [Symbol.iterator]() {\n return Object.entries(this.toJSON())[Symbol.iterator]();\n }\n\n toString() {\n return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\\n');\n }\n\n get [Symbol.toStringTag]() {\n return 'AxiosHeaders';\n }\n\n static from(thing) {\n return thing instanceof this ? thing : new this(thing);\n }\n\n static concat(first, ...targets) {\n const computed = new this(first);\n\n targets.forEach((target) => computed.set(target));\n\n return computed;\n }\n\n static accessor(header) {\n const internals = this[$internals] = (this[$internals] = {\n accessors: {}\n });\n\n const accessors = internals.accessors;\n const prototype = this.prototype;\n\n function defineAccessor(_header) {\n const lHeader = normalizeHeader(_header);\n\n if (!accessors[lHeader]) {\n buildAccessors(prototype, _header);\n accessors[lHeader] = true;\n }\n }\n\n utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n\n return this;\n }\n}\n\nAxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);\n\n// reserved names hotfix\nutils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {\n let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`\n return {\n get: () => value,\n set(headerValue) {\n this[mapped] = headerValue;\n }\n }\n});\n\nutils.freezeMethods(AxiosHeaders);\n\nexport default AxiosHeaders;\n", "'use strict';\n\nimport utils from './../utils.js';\nimport defaults from '../defaults/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nexport default function transformData(fns, response) {\n const config = this || defaults;\n const context = response || config;\n const headers = AxiosHeaders.from(context.headers);\n let data = context.data;\n\n utils.forEach(fns, function transform(fn) {\n data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n });\n\n headers.normalize();\n\n return data;\n}\n", "'use strict';\n\nexport default function isCancel(value) {\n return !!(value && value.__CANCEL__);\n}\n", "'use strict';\n\nimport AxiosError from '../core/AxiosError.js';\nimport utils from '../utils.js';\n\n/**\n * A `CanceledError` is an object that is thrown when an operation is canceled.\n *\n * @param {string=} message The message.\n * @param {Object=} config The config.\n * @param {Object=} request The request.\n *\n * @returns {CanceledError} The created error.\n */\nfunction CanceledError(message, config, request) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);\n this.name = 'CanceledError';\n}\n\nutils.inherits(CanceledError, AxiosError, {\n __CANCEL__: true\n});\n\nexport default CanceledError;\n", "'use strict';\n\nimport AxiosError from './AxiosError.js';\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n *\n * @returns {object} The response.\n */\nexport default function settle(resolve, reject, response) {\n const validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(new AxiosError(\n 'Request failed with status code ' + response.status,\n [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],\n response.config,\n response.request,\n response\n ));\n }\n}\n", "import utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n // Standard browser envs support document.cookie\n {\n write(name, value, expires, path, domain, secure) {\n const cookie = [name + '=' + encodeURIComponent(value)];\n\n utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());\n\n utils.isString(path) && cookie.push('path=' + path);\n\n utils.isString(domain) && cookie.push('domain=' + domain);\n\n secure === true && cookie.push('secure');\n\n document.cookie = cookie.join('; ');\n },\n\n read(name) {\n const match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n }\n\n :\n\n // Non-standard browser env (web workers, react-native) lack needed support.\n {\n write() {},\n read() {\n return null;\n },\n remove() {}\n };\n\n", "'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nexport default function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}\n", "'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nexport default function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/?\\/$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n}\n", "'use strict';\n\nimport isAbsoluteURL from '../helpers/isAbsoluteURL.js';\nimport combineURLs from '../helpers/combineURLs.js';\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n *\n * @returns {string} The combined full path\n */\nexport default function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n}\n", "'use strict';\n\nimport utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n// Standard browser envs have full support of the APIs needed to test\n// whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n const msie = /(msie|trident)/i.test(navigator.userAgent);\n const urlParsingNode = document.createElement('a');\n let originURL;\n\n /**\n * Parse a URL to discover its components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n let href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })();\n", "'use strict';\n\nexport default function parseProtocol(url) {\n const match = /^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(url);\n return match && match[1] || '';\n}\n", "'use strict';\n\n/**\n * Calculate data maxRate\n * @param {Number} [samplesCount= 10]\n * @param {Number} [min= 1000]\n * @returns {Function}\n */\nfunction speedometer(samplesCount, min) {\n samplesCount = samplesCount || 10;\n const bytes = new Array(samplesCount);\n const timestamps = new Array(samplesCount);\n let head = 0;\n let tail = 0;\n let firstSampleTS;\n\n min = min !== undefined ? min : 1000;\n\n return function push(chunkLength) {\n const now = Date.now();\n\n const startedAt = timestamps[tail];\n\n if (!firstSampleTS) {\n firstSampleTS = now;\n }\n\n bytes[head] = chunkLength;\n timestamps[head] = now;\n\n let i = tail;\n let bytesCount = 0;\n\n while (i !== head) {\n bytesCount += bytes[i++];\n i = i % samplesCount;\n }\n\n head = (head + 1) % samplesCount;\n\n if (head === tail) {\n tail = (tail + 1) % samplesCount;\n }\n\n if (now - firstSampleTS < min) {\n return;\n }\n\n const passed = startedAt && now - startedAt;\n\n return passed ? Math.round(bytesCount * 1000 / passed) : undefined;\n };\n}\n\nexport default speedometer;\n", "'use strict';\n\nimport utils from './../utils.js';\nimport settle from './../core/settle.js';\nimport cookies from './../helpers/cookies.js';\nimport buildURL from './../helpers/buildURL.js';\nimport buildFullPath from '../core/buildFullPath.js';\nimport isURLSameOrigin from './../helpers/isURLSameOrigin.js';\nimport transitionalDefaults from '../defaults/transitional.js';\nimport AxiosError from '../core/AxiosError.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport parseProtocol from '../helpers/parseProtocol.js';\nimport platform from '../platform/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport speedometer from '../helpers/speedometer.js';\n\nfunction progressEventReducer(listener, isDownloadStream) {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n\n return e => {\n const loaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const progressBytes = loaded - bytesNotified;\n const rate = _speedometer(progressBytes);\n const inRange = loaded <= total;\n\n bytesNotified = loaded;\n\n const data = {\n loaded,\n total,\n progress: total ? (loaded / total) : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total && inRange ? (total - loaded) / rate : undefined,\n event: e\n };\n\n data[isDownloadStream ? 'download' : 'upload'] = true;\n\n listener(data);\n };\n}\n\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\n\nexport default isXHRAdapterSupported && function (config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n let requestData = config.data;\n const requestHeaders = AxiosHeaders.from(config.headers).normalize();\n let {responseType, withXSRFToken} = config;\n let onCanceled;\n function done() {\n if (config.cancelToken) {\n config.cancelToken.unsubscribe(onCanceled);\n }\n\n if (config.signal) {\n config.signal.removeEventListener('abort', onCanceled);\n }\n }\n\n let contentType;\n\n if (utils.isFormData(requestData)) {\n if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {\n requestHeaders.setContentType(false); // Let the browser set it\n } else if ((contentType = requestHeaders.getContentType()) !== false) {\n // fix semicolon duplication issue for ReactNative FormData implementation\n const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];\n requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));\n }\n }\n\n let request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n const username = config.auth.username || '';\n const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';\n requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));\n }\n\n const fullPath = buildFullPath(config.baseURL, config.url);\n\n request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n const responseHeaders = AxiosHeaders.from(\n 'getAllResponseHeaders' in request && request.getAllResponseHeaders()\n );\n const responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n request.responseText : request.response;\n const response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config,\n request\n };\n\n settle(function _resolve(value) {\n resolve(value);\n done();\n }, function _reject(err) {\n reject(err);\n done();\n }, response);\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';\n const transitional = config.transitional || transitionalDefaults;\n if (config.timeoutErrorMessage) {\n timeoutErrorMessage = config.timeoutErrorMessage;\n }\n reject(new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n config,\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if(platform.hasStandardBrowserEnv) {\n withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));\n\n if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {\n // Add xsrf header\n const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);\n\n if (xsrfValue) {\n requestHeaders.set(config.xsrfHeaderName, xsrfValue);\n }\n }\n }\n\n // Remove Content-Type if data is undefined\n requestData === undefined && requestHeaders.setContentType(null);\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {\n request.setRequestHeader(key, val);\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(config.withCredentials)) {\n request.withCredentials = !!config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = config.responseType;\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));\n }\n\n if (config.cancelToken || config.signal) {\n // Handle cancellation\n // eslint-disable-next-line func-names\n onCanceled = cancel => {\n if (!request) {\n return;\n }\n reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n request.abort();\n request = null;\n };\n\n config.cancelToken && config.cancelToken.subscribe(onCanceled);\n if (config.signal) {\n config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);\n }\n }\n\n const protocol = parseProtocol(fullPath);\n\n if (protocol && platform.protocols.indexOf(protocol) === -1) {\n reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));\n return;\n }\n\n\n // Send the request\n request.send(requestData || null);\n });\n}\n", "import utils from '../utils.js';\nimport httpAdapter from './http.js';\nimport xhrAdapter from './xhr.js';\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst knownAdapters = {\n http: httpAdapter,\n xhr: xhrAdapter\n}\n\nutils.forEach(knownAdapters, (fn, value) => {\n if (fn) {\n try {\n Object.defineProperty(fn, 'name', {value});\n } catch (e) {\n // eslint-disable-next-line no-empty\n }\n Object.defineProperty(fn, 'adapterName', {value});\n }\n});\n\nconst renderReason = (reason) => `- ${reason}`;\n\nconst isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;\n\nexport default {\n getAdapter: (adapters) => {\n adapters = utils.isArray(adapters) ? adapters : [adapters];\n\n const {length} = adapters;\n let nameOrAdapter;\n let adapter;\n\n const rejectedReasons = {};\n\n for (let i = 0; i < length; i++) {\n nameOrAdapter = adapters[i];\n let id;\n\n adapter = nameOrAdapter;\n\n if (!isResolvedHandle(nameOrAdapter)) {\n adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];\n\n if (adapter === undefined) {\n throw new AxiosError(`Unknown adapter '${id}'`);\n }\n }\n\n if (adapter) {\n break;\n }\n\n rejectedReasons[id || '#' + i] = adapter;\n }\n\n if (!adapter) {\n\n const reasons = Object.entries(rejectedReasons)\n .map(([id, state]) => `adapter ${id} ` +\n (state === false ? 'is not supported by the environment' : 'is not available in the build')\n );\n\n let s = length ?\n (reasons.length > 1 ? 'since :\\n' + reasons.map(renderReason).join('\\n') : ' ' + renderReason(reasons[0])) :\n 'as no adapter specified';\n\n throw new AxiosError(\n `There is no suitable adapter to dispatch the request ` + s,\n 'ERR_NOT_SUPPORT'\n );\n }\n\n return adapter;\n },\n adapters: knownAdapters\n}\n", "'use strict';\n\nimport transformData from './transformData.js';\nimport isCancel from '../cancel/isCancel.js';\nimport defaults from '../defaults/index.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport adapters from \"../adapters/adapters.js\";\n\n/**\n * Throws a `CanceledError` if cancellation has been requested.\n *\n * @param {Object} config The config that is to be used for the request\n *\n * @returns {void}\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n\n if (config.signal && config.signal.aborted) {\n throw new CanceledError(null, config);\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n *\n * @returns {Promise} The Promise to be fulfilled\n */\nexport default function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n config.headers = AxiosHeaders.from(config.headers);\n\n // Transform request data\n config.data = transformData.call(\n config,\n config.transformRequest\n );\n\n if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {\n config.headers.setContentType('application/x-www-form-urlencoded', false);\n }\n\n const adapter = adapters.getAdapter(config.adapter || defaults.adapter);\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(\n config,\n config.transformResponse,\n response\n );\n\n response.headers = AxiosHeaders.from(response.headers);\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(\n config,\n config.transformResponse,\n reason.response\n );\n reason.response.headers = AxiosHeaders.from(reason.response.headers);\n }\n }\n\n return Promise.reject(reason);\n });\n}\n", "'use strict';\n\nimport utils from '../utils.js';\nimport AxiosHeaders from \"./AxiosHeaders.js\";\n\nconst headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n *\n * @returns {Object} New object resulting from merging config2 to config1\n */\nexport default function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n const config = {};\n\n function getMergedValue(target, source, caseless) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge.call({caseless}, target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDeepProperties(a, b, caseless) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(a, b, caseless);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a, caseless);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function valueFromConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function defaultToConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDirectKeys(a, b, prop) {\n if (prop in config2) {\n return getMergedValue(a, b);\n } else if (prop in config1) {\n return getMergedValue(undefined, a);\n }\n }\n\n const mergeMap = {\n url: valueFromConfig2,\n method: valueFromConfig2,\n data: valueFromConfig2,\n baseURL: defaultToConfig2,\n transformRequest: defaultToConfig2,\n transformResponse: defaultToConfig2,\n paramsSerializer: defaultToConfig2,\n timeout: defaultToConfig2,\n timeoutMessage: defaultToConfig2,\n withCredentials: defaultToConfig2,\n withXSRFToken: defaultToConfig2,\n adapter: defaultToConfig2,\n responseType: defaultToConfig2,\n xsrfCookieName: defaultToConfig2,\n xsrfHeaderName: defaultToConfig2,\n onUploadProgress: defaultToConfig2,\n onDownloadProgress: defaultToConfig2,\n decompress: defaultToConfig2,\n maxContentLength: defaultToConfig2,\n maxBodyLength: defaultToConfig2,\n beforeRedirect: defaultToConfig2,\n transport: defaultToConfig2,\n httpAgent: defaultToConfig2,\n httpsAgent: defaultToConfig2,\n cancelToken: defaultToConfig2,\n socketPath: defaultToConfig2,\n responseEncoding: defaultToConfig2,\n validateStatus: mergeDirectKeys,\n headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)\n };\n\n utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {\n const merge = mergeMap[prop] || mergeDeepProperties;\n const configValue = merge(config1[prop], config2[prop], prop);\n (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);\n });\n\n return config;\n}\n", "export const VERSION = \"1.6.8\";", "'use strict';\n\nimport {VERSION} from '../env/data.js';\nimport AxiosError from '../core/AxiosError.js';\n\nconst validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nconst deprecatedWarnings = {};\n\n/**\n * Transitional option validator\n *\n * @param {function|boolean?} validator - set to false if the transitional option has been removed\n * @param {string?} version - deprecated version / removed since version\n * @param {string?} message - some message with additional info\n *\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n function formatMessage(opt, desc) {\n return '[Axios v' + VERSION + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return (value, opt, opts) => {\n if (validator === false) {\n throw new AxiosError(\n formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),\n AxiosError.ERR_DEPRECATED\n );\n }\n\n if (version && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n *\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n *\n * @returns {object}\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);\n }\n const keys = Object.keys(options);\n let i = keys.length;\n while (i-- > 0) {\n const opt = keys[i];\n const validator = schema[opt];\n if (validator) {\n const value = options[opt];\n const result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);\n }\n }\n}\n\nexport default {\n assertOptions,\n validators\n};\n", "'use strict';\n\nimport utils from './../utils.js';\nimport buildURL from '../helpers/buildURL.js';\nimport InterceptorManager from './InterceptorManager.js';\nimport dispatchRequest from './dispatchRequest.js';\nimport mergeConfig from './mergeConfig.js';\nimport buildFullPath from './buildFullPath.js';\nimport validator from '../helpers/validator.js';\nimport AxiosHeaders from './AxiosHeaders.js';\n\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n async request(configOrUrl, config) {\n try {\n return await this._request(configOrUrl, config);\n } catch (err) {\n if (err instanceof Error) {\n let dummy;\n\n Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());\n\n // slice off the Error: ... line\n const stack = dummy.stack ? dummy.stack.replace(/^.+\\n/, '') : '';\n\n if (!err.stack) {\n err.stack = stack;\n // match without the 2 top stack lines\n } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\\n.+\\n/, ''))) {\n err.stack += '\\n' + stack\n }\n }\n\n throw err;\n }\n }\n\n _request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n const {transitional, paramsSerializer, headers} = config;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean)\n }, false);\n }\n\n if (paramsSerializer != null) {\n if (utils.isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer\n }\n } else {\n validator.assertOptions(paramsSerializer, {\n encode: validators.function,\n serialize: validators.function\n }, true);\n }\n }\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && utils.merge(\n headers.common,\n headers[config.method]\n );\n\n headers && utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n (method) => {\n delete headers[method];\n }\n );\n\n config.headers = AxiosHeaders.concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [dispatchRequest.bind(this), undefined];\n chain.unshift.apply(chain, requestInterceptorChain);\n chain.push.apply(chain, responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n i = 0;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected.call(this, error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest.call(this, newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = mergeConfig(this.defaults, config);\n const fullPath = buildFullPath(config.baseURL, config.url);\n return buildURL(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n headers: isForm ? {\n 'Content-Type': 'multipart/form-data'\n } : {},\n url,\n data\n }));\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\n\nexport default Axios;\n", "'use strict';\n\nimport CanceledError from './CanceledError.js';\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @param {Function} executor The executor function.\n *\n * @returns {CancelToken}\n */\nclass CancelToken {\n constructor(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n let resolvePromise;\n\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n const token = this;\n\n // eslint-disable-next-line func-names\n this.promise.then(cancel => {\n if (!token._listeners) return;\n\n let i = token._listeners.length;\n\n while (i-- > 0) {\n token._listeners[i](cancel);\n }\n token._listeners = null;\n });\n\n // eslint-disable-next-line func-names\n this.promise.then = onfulfilled => {\n let _resolve;\n // eslint-disable-next-line func-names\n const promise = new Promise(resolve => {\n token.subscribe(resolve);\n _resolve = resolve;\n }).then(onfulfilled);\n\n promise.cancel = function reject() {\n token.unsubscribe(_resolve);\n };\n\n return promise;\n };\n\n executor(function cancel(message, config, request) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new CanceledError(message, config, request);\n resolvePromise(token.reason);\n });\n }\n\n /**\n * Throws a `CanceledError` if cancellation has been requested.\n */\n throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n }\n\n /**\n * Subscribe to the cancel signal\n */\n\n subscribe(listener) {\n if (this.reason) {\n listener(this.reason);\n return;\n }\n\n if (this._listeners) {\n this._listeners.push(listener);\n } else {\n this._listeners = [listener];\n }\n }\n\n /**\n * Unsubscribe from the cancel signal\n */\n\n unsubscribe(listener) {\n if (!this._listeners) {\n return;\n }\n const index = this._listeners.indexOf(listener);\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n /**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n static source() {\n let cancel;\n const token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token,\n cancel\n };\n }\n}\n\nexport default CancelToken;\n", "'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n *\n * @returns {Function}\n */\nexport default function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n}\n", "'use strict';\n\nimport utils from './../utils.js';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nexport default function isAxiosError(payload) {\n return utils.isObject(payload) && (payload.isAxiosError === true);\n}\n", "const HttpStatusCode = {\n Continue: 100,\n SwitchingProtocols: 101,\n Processing: 102,\n EarlyHints: 103,\n Ok: 200,\n Created: 201,\n Accepted: 202,\n NonAuthoritativeInformation: 203,\n NoContent: 204,\n ResetContent: 205,\n PartialContent: 206,\n MultiStatus: 207,\n AlreadyReported: 208,\n ImUsed: 226,\n MultipleChoices: 300,\n MovedPermanently: 301,\n Found: 302,\n SeeOther: 303,\n NotModified: 304,\n UseProxy: 305,\n Unused: 306,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n BadRequest: 400,\n Unauthorized: 401,\n PaymentRequired: 402,\n Forbidden: 403,\n NotFound: 404,\n MethodNotAllowed: 405,\n NotAcceptable: 406,\n ProxyAuthenticationRequired: 407,\n RequestTimeout: 408,\n Conflict: 409,\n Gone: 410,\n LengthRequired: 411,\n PreconditionFailed: 412,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n MisdirectedRequest: 421,\n UnprocessableEntity: 422,\n Locked: 423,\n FailedDependency: 424,\n TooEarly: 425,\n UpgradeRequired: 426,\n PreconditionRequired: 428,\n TooManyRequests: 429,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n InternalServerError: 500,\n NotImplemented: 501,\n BadGateway: 502,\n ServiceUnavailable: 503,\n GatewayTimeout: 504,\n HttpVersionNotSupported: 505,\n VariantAlsoNegotiates: 506,\n InsufficientStorage: 507,\n LoopDetected: 508,\n NotExtended: 510,\n NetworkAuthenticationRequired: 511,\n};\n\nObject.entries(HttpStatusCode).forEach(([key, value]) => {\n HttpStatusCode[value] = key;\n});\n\nexport default HttpStatusCode;\n", "'use strict';\n\nimport utils from './utils.js';\nimport bind from './helpers/bind.js';\nimport Axios from './core/Axios.js';\nimport mergeConfig from './core/mergeConfig.js';\nimport defaults from './defaults/index.js';\nimport formDataToJSON from './helpers/formDataToJSON.js';\nimport CanceledError from './cancel/CanceledError.js';\nimport CancelToken from './cancel/CancelToken.js';\nimport isCancel from './cancel/isCancel.js';\nimport {VERSION} from './env/data.js';\nimport toFormData from './helpers/toFormData.js';\nimport AxiosError from './core/AxiosError.js';\nimport spread from './helpers/spread.js';\nimport isAxiosError from './helpers/isAxiosError.js';\nimport AxiosHeaders from \"./core/AxiosHeaders.js\";\nimport adapters from './adapters/adapters.js';\nimport HttpStatusCode from './helpers/HttpStatusCode.js';\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n const context = new Axios(defaultConfig);\n const instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});\n\n // Copy context to instance\n utils.extend(instance, context, null, {allOwnKeys: true});\n\n // Factory for creating new instances\n instance.create = function create(instanceConfig) {\n return createInstance(mergeConfig(defaultConfig, instanceConfig));\n };\n\n return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\n\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\n\naxios.AxiosHeaders = AxiosHeaders;\n\naxios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);\n\naxios.getAdapter = adapters.getAdapter;\n\naxios.HttpStatusCode = HttpStatusCode;\n\naxios.default = axios;\n\n// this module should only have a default export\nexport default axios\n", "import axios from './lib/axios.js';\n\n// This module is intended to unwrap Axios default export as named.\n// Keep top-level export same with static properties\n// so that it can keep same with es module or cjs\nconst {\n Axios,\n AxiosError,\n CanceledError,\n isCancel,\n CancelToken,\n VERSION,\n all,\n Cancel,\n isAxiosError,\n spread,\n toFormData,\n AxiosHeaders,\n HttpStatusCode,\n formToJSON,\n getAdapter,\n mergeConfig\n} = axios;\n\nexport {\n axios as default,\n Axios,\n AxiosError,\n CanceledError,\n isCancel,\n CancelToken,\n VERSION,\n all,\n Cancel,\n isAxiosError,\n spread,\n toFormData,\n AxiosHeaders,\n HttpStatusCode,\n formToJSON,\n getAdapter,\n mergeConfig\n}\n"], - "mappings": ";;;;;AAEe,SAAR,KAAsB,IAAI,SAAS;AACxC,SAAO,SAAS,OAAO;AACrB,WAAO,GAAG,MAAM,SAAS,SAAS;AAAA,EACpC;AACF;;;ACAA,IAAM,EAAC,SAAQ,IAAI,OAAO;AAC1B,IAAM,EAAC,eAAc,IAAI;AAEzB,IAAM,SAAU,4BAAS,WAAS;AAC9B,QAAM,MAAM,SAAS,KAAK,KAAK;AAC/B,SAAO,MAAM,GAAG,MAAM,MAAM,GAAG,IAAI,IAAI,MAAM,GAAG,EAAE,EAAE,YAAY;AACpE,GAAG,uBAAO,OAAO,IAAI,CAAC;AAEtB,IAAM,aAAa,CAAC,SAAS;AAC3B,SAAO,KAAK,YAAY;AACxB,SAAO,CAAC,UAAU,OAAO,KAAK,MAAM;AACtC;AAEA,IAAM,aAAa,UAAQ,WAAS,OAAO,UAAU;AASrD,IAAM,EAAC,QAAO,IAAI;AASlB,IAAM,cAAc,WAAW,WAAW;AAS1C,SAAS,SAAS,KAAK;AACrB,SAAO,QAAQ,QAAQ,CAAC,YAAY,GAAG,KAAK,IAAI,gBAAgB,QAAQ,CAAC,YAAY,IAAI,WAAW,KAC/F,WAAW,IAAI,YAAY,QAAQ,KAAK,IAAI,YAAY,SAAS,GAAG;AAC3E;AASA,IAAM,gBAAgB,WAAW,aAAa;AAU9C,SAAS,kBAAkB,KAAK;A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,gBAAQ;AAGrC,MAAM,QAAQ;AAGd,MAAM,gBAAgB;AACtB,MAAM,cAAc;AACpB,MAAM,WAAW;AACjB,MAAM,UAAU;AAChB,MAAM,aAAa;AAGnB,MAAM,aAAa;AAGnB,MAAM,SAAS,MAAM;AAGrB,MAAM,MAAM,SAAS,IAAI,UAAU;AACjC,SAAO,QAAQ,IAAI,QAAQ;AAC7B;AAEA,MAAM,SAAS;AAGf,MAAM,eAAe;AAGrB,MAAM,cAAc;AAEpB,MAAM,eAAe;AAErB,MAAM,aAAa,WAAS,uBAAe,cAAM,WAAW,KAAK,IAAI,IAAI,SAAS,KAAK,IAAI,KAAK;AAEhG,MAAM,aAAa,iBAAS;AAE5B,MAAM,iBAAiB;AAEvB,MAAM,UAAU;AAGhB,IAAO,gBAAQ;;;ACnFf,IAAM;AAAA,EACJ,OAAAE;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,SAAAC;AAAA,EACA,KAAAC;AAAA,EACA;AAAA,EACA,cAAAC;AAAA,EACA,QAAAC;AAAA,EACA,YAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAAC;AACF,IAAI;", - "names": ["prototype", "descriptors", "filter", "hasOwnProperty", "filter", "prototype", "toString", "encode", "isFormData", "isFileList", "transitional", "filter", "self", "prototype", "validateStatus", "transitional", "merge", "validators", "transitional", "Axios", "AxiosError", "CanceledError", "isCancel", "CancelToken", "VERSION", "all", "isAxiosError", "spread", "toFormData", "AxiosHeaders", "HttpStatusCode", "mergeConfig"] -} diff --git a/node_modules/.vite/deps/chunk-6P5T4EWA.js b/node_modules/.vite/deps/chunk-6P5T4EWA.js deleted file mode 100644 index 2a91bb0b..00000000 --- a/node_modules/.vite/deps/chunk-6P5T4EWA.js +++ /dev/null @@ -1,30652 +0,0 @@ -// node_modules/three/build/three.module.js -var REVISION = "158"; -var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 }; -var TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }; -var CullFaceNone = 0; -var CullFaceBack = 1; -var CullFaceFront = 2; -var CullFaceFrontBack = 3; -var BasicShadowMap = 0; -var PCFShadowMap = 1; -var PCFSoftShadowMap = 2; -var VSMShadowMap = 3; -var FrontSide = 0; -var BackSide = 1; -var DoubleSide = 2; -var TwoPassDoubleSide = 2; -var NoBlending = 0; -var NormalBlending = 1; -var AdditiveBlending = 2; -var SubtractiveBlending = 3; -var MultiplyBlending = 4; -var CustomBlending = 5; -var AddEquation = 100; -var SubtractEquation = 101; -var ReverseSubtractEquation = 102; -var MinEquation = 103; -var MaxEquation = 104; -var ZeroFactor = 200; -var OneFactor = 201; -var SrcColorFactor = 202; -var OneMinusSrcColorFactor = 203; -var SrcAlphaFactor = 204; -var OneMinusSrcAlphaFactor = 205; -var DstAlphaFactor = 206; -var OneMinusDstAlphaFactor = 207; -var DstColorFactor = 208; -var OneMinusDstColorFactor = 209; -var SrcAlphaSaturateFactor = 210; -var ConstantColorFactor = 211; -var OneMinusConstantColorFactor = 212; -var ConstantAlphaFactor = 213; -var OneMinusConstantAlphaFactor = 214; -var NeverDepth = 0; -var AlwaysDepth = 1; -var LessDepth = 2; -var LessEqualDepth = 3; -var EqualDepth = 4; -var GreaterEqualDepth = 5; -var GreaterDepth = 6; -var NotEqualDepth = 7; -var MultiplyOperation = 0; -var MixOperation = 1; -var AddOperation = 2; -var NoToneMapping = 0; -var LinearToneMapping = 1; -var ReinhardToneMapping = 2; -var CineonToneMapping = 3; -var ACESFilmicToneMapping = 4; -var CustomToneMapping = 5; -var AttachedBindMode = "attached"; -var DetachedBindMode = "detached"; -var UVMapping = 300; -var CubeReflectionMapping = 301; -var CubeRefractionMapping = 302; -var EquirectangularReflectionMapping = 303; -var EquirectangularRefractionMapping = 304; -var CubeUVReflectionMapping = 306; -var RepeatWrapping = 1e3; -var ClampToEdgeWrapping = 1001; -var MirroredRepeatWrapping = 1002; -var NearestFilter = 1003; -var NearestMipmapNearestFilter = 1004; -var NearestMipMapNearestFilter = 1004; -var NearestMipmapLinearFilter = 1005; -var NearestMipMapLinearFilter = 1005; -var LinearFilter = 1006; -var LinearMipmapNearestFilter = 1007; -var LinearMipMapNearestFilter = 1007; -var LinearMipmapLinearFilter = 1008; -var LinearMipMapLinearFilter = 1008; -var UnsignedByteType = 1009; -var ByteType = 1010; -var ShortType = 1011; -var UnsignedShortType = 1012; -var IntType = 1013; -var UnsignedIntType = 1014; -var FloatType = 1015; -var HalfFloatType = 1016; -var UnsignedShort4444Type = 1017; -var UnsignedShort5551Type = 1018; -var UnsignedInt248Type = 1020; -var AlphaFormat = 1021; -var RGBAFormat = 1023; -var LuminanceFormat = 1024; -var LuminanceAlphaFormat = 1025; -var DepthFormat = 1026; -var DepthStencilFormat = 1027; -var RedFormat = 1028; -var RedIntegerFormat = 1029; -var RGFormat = 1030; -var RGIntegerFormat = 1031; -var RGBAIntegerFormat = 1033; -var RGB_S3TC_DXT1_Format = 33776; -var RGBA_S3TC_DXT1_Format = 33777; -var RGBA_S3TC_DXT3_Format = 33778; -var RGBA_S3TC_DXT5_Format = 33779; -var RGB_PVRTC_4BPPV1_Format = 35840; -var RGB_PVRTC_2BPPV1_Format = 35841; -var RGBA_PVRTC_4BPPV1_Format = 35842; -var RGBA_PVRTC_2BPPV1_Format = 35843; -var RGB_ETC1_Format = 36196; -var RGB_ETC2_Format = 37492; -var RGBA_ETC2_EAC_Format = 37496; -var RGBA_ASTC_4x4_Format = 37808; -var RGBA_ASTC_5x4_Format = 37809; -var RGBA_ASTC_5x5_Format = 37810; -var RGBA_ASTC_6x5_Format = 37811; -var RGBA_ASTC_6x6_Format = 37812; -var RGBA_ASTC_8x5_Format = 37813; -var RGBA_ASTC_8x6_Format = 37814; -var RGBA_ASTC_8x8_Format = 37815; -var RGBA_ASTC_10x5_Format = 37816; -var RGBA_ASTC_10x6_Format = 37817; -var RGBA_ASTC_10x8_Format = 37818; -var RGBA_ASTC_10x10_Format = 37819; -var RGBA_ASTC_12x10_Format = 37820; -var RGBA_ASTC_12x12_Format = 37821; -var RGBA_BPTC_Format = 36492; -var RGB_BPTC_SIGNED_Format = 36494; -var RGB_BPTC_UNSIGNED_Format = 36495; -var RED_RGTC1_Format = 36283; -var SIGNED_RED_RGTC1_Format = 36284; -var RED_GREEN_RGTC2_Format = 36285; -var SIGNED_RED_GREEN_RGTC2_Format = 36286; -var LoopOnce = 2200; -var LoopRepeat = 2201; -var LoopPingPong = 2202; -var InterpolateDiscrete = 2300; -var InterpolateLinear = 2301; -var InterpolateSmooth = 2302; -var ZeroCurvatureEnding = 2400; -var ZeroSlopeEnding = 2401; -var WrapAroundEnding = 2402; -var NormalAnimationBlendMode = 2500; -var AdditiveAnimationBlendMode = 2501; -var TrianglesDrawMode = 0; -var TriangleStripDrawMode = 1; -var TriangleFanDrawMode = 2; -var LinearEncoding = 3e3; -var sRGBEncoding = 3001; -var BasicDepthPacking = 3200; -var RGBADepthPacking = 3201; -var TangentSpaceNormalMap = 0; -var ObjectSpaceNormalMap = 1; -var NoColorSpace = ""; -var SRGBColorSpace = "srgb"; -var LinearSRGBColorSpace = "srgb-linear"; -var DisplayP3ColorSpace = "display-p3"; -var LinearDisplayP3ColorSpace = "display-p3-linear"; -var LinearTransfer = "linear"; -var SRGBTransfer = "srgb"; -var Rec709Primaries = "rec709"; -var P3Primaries = "p3"; -var ZeroStencilOp = 0; -var KeepStencilOp = 7680; -var ReplaceStencilOp = 7681; -var IncrementStencilOp = 7682; -var DecrementStencilOp = 7683; -var IncrementWrapStencilOp = 34055; -var DecrementWrapStencilOp = 34056; -var InvertStencilOp = 5386; -var NeverStencilFunc = 512; -var LessStencilFunc = 513; -var EqualStencilFunc = 514; -var LessEqualStencilFunc = 515; -var GreaterStencilFunc = 516; -var NotEqualStencilFunc = 517; -var GreaterEqualStencilFunc = 518; -var AlwaysStencilFunc = 519; -var NeverCompare = 512; -var LessCompare = 513; -var EqualCompare = 514; -var LessEqualCompare = 515; -var GreaterCompare = 516; -var NotEqualCompare = 517; -var GreaterEqualCompare = 518; -var AlwaysCompare = 519; -var StaticDrawUsage = 35044; -var DynamicDrawUsage = 35048; -var StreamDrawUsage = 35040; -var StaticReadUsage = 35045; -var DynamicReadUsage = 35049; -var StreamReadUsage = 35041; -var StaticCopyUsage = 35046; -var DynamicCopyUsage = 35050; -var StreamCopyUsage = 35042; -var GLSL1 = "100"; -var GLSL3 = "300 es"; -var _SRGBAFormat = 1035; -var WebGLCoordinateSystem = 2e3; -var WebGPUCoordinateSystem = 2001; -var EventDispatcher = class { - addEventListener(type, listener) { - if (this._listeners === void 0) - this._listeners = {}; - const listeners = this._listeners; - if (listeners[type] === void 0) { - listeners[type] = []; - } - if (listeners[type].indexOf(listener) === -1) { - listeners[type].push(listener); - } - } - hasEventListener(type, listener) { - if (this._listeners === void 0) - return false; - const listeners = this._listeners; - return listeners[type] !== void 0 && listeners[type].indexOf(listener) !== -1; - } - removeEventListener(type, listener) { - if (this._listeners === void 0) - return; - const listeners = this._listeners; - const listenerArray = listeners[type]; - if (listenerArray !== void 0) { - const index = listenerArray.indexOf(listener); - if (index !== -1) { - listenerArray.splice(index, 1); - } - } - } - dispatchEvent(event) { - if (this._listeners === void 0) - return; - const listeners = this._listeners; - const listenerArray = listeners[event.type]; - if (listenerArray !== void 0) { - event.target = this; - const array = listenerArray.slice(0); - for (let i = 0, l = array.length; i < l; i++) { - array[i].call(this, event); - } - event.target = null; - } - } -}; -var _lut = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3a", "3b", "3c", "3d", "3e", "3f", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4a", "4b", "4c", "4d", "4e", "4f", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5a", "5b", "5c", "5d", "5e", "5f", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7a", "7b", "7c", "7d", "7e", "7f", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8a", "8b", "8c", "8d", "8e", "8f", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9a", "9b", "9c", "9d", "9e", "9f", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "da", "db", "dc", "dd", "de", "df", "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff"]; -var _seed = 1234567; -var DEG2RAD = Math.PI / 180; -var RAD2DEG = 180 / Math.PI; -function generateUUID() { - const d0 = Math.random() * 4294967295 | 0; - const d1 = Math.random() * 4294967295 | 0; - const d2 = Math.random() * 4294967295 | 0; - const d3 = Math.random() * 4294967295 | 0; - const uuid = _lut[d0 & 255] + _lut[d0 >> 8 & 255] + _lut[d0 >> 16 & 255] + _lut[d0 >> 24 & 255] + "-" + _lut[d1 & 255] + _lut[d1 >> 8 & 255] + "-" + _lut[d1 >> 16 & 15 | 64] + _lut[d1 >> 24 & 255] + "-" + _lut[d2 & 63 | 128] + _lut[d2 >> 8 & 255] + "-" + _lut[d2 >> 16 & 255] + _lut[d2 >> 24 & 255] + _lut[d3 & 255] + _lut[d3 >> 8 & 255] + _lut[d3 >> 16 & 255] + _lut[d3 >> 24 & 255]; - return uuid.toLowerCase(); -} -function clamp(value, min, max) { - return Math.max(min, Math.min(max, value)); -} -function euclideanModulo(n, m) { - return (n % m + m) % m; -} -function mapLinear(x, a1, a2, b1, b2) { - return b1 + (x - a1) * (b2 - b1) / (a2 - a1); -} -function inverseLerp(x, y, value) { - if (x !== y) { - return (value - x) / (y - x); - } else { - return 0; - } -} -function lerp(x, y, t) { - return (1 - t) * x + t * y; -} -function damp(x, y, lambda, dt) { - return lerp(x, y, 1 - Math.exp(-lambda * dt)); -} -function pingpong(x, length = 1) { - return length - Math.abs(euclideanModulo(x, length * 2) - length); -} -function smoothstep(x, min, max) { - if (x <= min) - return 0; - if (x >= max) - return 1; - x = (x - min) / (max - min); - return x * x * (3 - 2 * x); -} -function smootherstep(x, min, max) { - if (x <= min) - return 0; - if (x >= max) - return 1; - x = (x - min) / (max - min); - return x * x * x * (x * (x * 6 - 15) + 10); -} -function randInt(low, high) { - return low + Math.floor(Math.random() * (high - low + 1)); -} -function randFloat(low, high) { - return low + Math.random() * (high - low); -} -function randFloatSpread(range) { - return range * (0.5 - Math.random()); -} -function seededRandom(s) { - if (s !== void 0) - _seed = s; - let t = _seed += 1831565813; - t = Math.imul(t ^ t >>> 15, t | 1); - t ^= t + Math.imul(t ^ t >>> 7, t | 61); - return ((t ^ t >>> 14) >>> 0) / 4294967296; -} -function degToRad(degrees) { - return degrees * DEG2RAD; -} -function radToDeg(radians) { - return radians * RAD2DEG; -} -function isPowerOfTwo(value) { - return (value & value - 1) === 0 && value !== 0; -} -function ceilPowerOfTwo(value) { - return Math.pow(2, Math.ceil(Math.log(value) / Math.LN2)); -} -function floorPowerOfTwo(value) { - return Math.pow(2, Math.floor(Math.log(value) / Math.LN2)); -} -function setQuaternionFromProperEuler(q, a, b, c, order) { - const cos = Math.cos; - const sin = Math.sin; - const c2 = cos(b / 2); - const s2 = sin(b / 2); - const c13 = cos((a + c) / 2); - const s13 = sin((a + c) / 2); - const c1_3 = cos((a - c) / 2); - const s1_3 = sin((a - c) / 2); - const c3_1 = cos((c - a) / 2); - const s3_1 = sin((c - a) / 2); - switch (order) { - case "XYX": - q.set(c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13); - break; - case "YZY": - q.set(s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13); - break; - case "ZXZ": - q.set(s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13); - break; - case "XZX": - q.set(c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13); - break; - case "YXY": - q.set(s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13); - break; - case "ZYZ": - q.set(s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13); - break; - default: - console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + order); - } -} -function denormalize(value, array) { - switch (array.constructor) { - case Float32Array: - return value; - case Uint32Array: - return value / 4294967295; - case Uint16Array: - return value / 65535; - case Uint8Array: - return value / 255; - case Int32Array: - return Math.max(value / 2147483647, -1); - case Int16Array: - return Math.max(value / 32767, -1); - case Int8Array: - return Math.max(value / 127, -1); - default: - throw new Error("Invalid component type."); - } -} -function normalize(value, array) { - switch (array.constructor) { - case Float32Array: - return value; - case Uint32Array: - return Math.round(value * 4294967295); - case Uint16Array: - return Math.round(value * 65535); - case Uint8Array: - return Math.round(value * 255); - case Int32Array: - return Math.round(value * 2147483647); - case Int16Array: - return Math.round(value * 32767); - case Int8Array: - return Math.round(value * 127); - default: - throw new Error("Invalid component type."); - } -} -var MathUtils = { - DEG2RAD, - RAD2DEG, - generateUUID, - clamp, - euclideanModulo, - mapLinear, - inverseLerp, - lerp, - damp, - pingpong, - smoothstep, - smootherstep, - randInt, - randFloat, - randFloatSpread, - seededRandom, - degToRad, - radToDeg, - isPowerOfTwo, - ceilPowerOfTwo, - floorPowerOfTwo, - setQuaternionFromProperEuler, - normalize, - denormalize -}; -var Vector2 = class _Vector2 { - constructor(x = 0, y = 0) { - _Vector2.prototype.isVector2 = true; - this.x = x; - this.y = y; - } - get width() { - return this.x; - } - set width(value) { - this.x = value; - } - get height() { - return this.y; - } - set height(value) { - this.y = value; - } - set(x, y) { - this.x = x; - this.y = y; - return this; - } - setScalar(scalar) { - this.x = scalar; - this.y = scalar; - return this; - } - setX(x) { - this.x = x; - return this; - } - setY(y) { - this.y = y; - return this; - } - setComponent(index, value) { - switch (index) { - case 0: - this.x = value; - break; - case 1: - this.y = value; - break; - default: - throw new Error("index is out of range: " + index); - } - return this; - } - getComponent(index) { - switch (index) { - case 0: - return this.x; - case 1: - return this.y; - default: - throw new Error("index is out of range: " + index); - } - } - clone() { - return new this.constructor(this.x, this.y); - } - copy(v) { - this.x = v.x; - this.y = v.y; - return this; - } - add(v) { - this.x += v.x; - this.y += v.y; - return this; - } - addScalar(s) { - this.x += s; - this.y += s; - return this; - } - addVectors(a, b) { - this.x = a.x + b.x; - this.y = a.y + b.y; - return this; - } - addScaledVector(v, s) { - this.x += v.x * s; - this.y += v.y * s; - return this; - } - sub(v) { - this.x -= v.x; - this.y -= v.y; - return this; - } - subScalar(s) { - this.x -= s; - this.y -= s; - return this; - } - subVectors(a, b) { - this.x = a.x - b.x; - this.y = a.y - b.y; - return this; - } - multiply(v) { - this.x *= v.x; - this.y *= v.y; - return this; - } - multiplyScalar(scalar) { - this.x *= scalar; - this.y *= scalar; - return this; - } - divide(v) { - this.x /= v.x; - this.y /= v.y; - return this; - } - divideScalar(scalar) { - return this.multiplyScalar(1 / scalar); - } - applyMatrix3(m) { - const x = this.x, y = this.y; - const e = m.elements; - this.x = e[0] * x + e[3] * y + e[6]; - this.y = e[1] * x + e[4] * y + e[7]; - return this; - } - min(v) { - this.x = Math.min(this.x, v.x); - this.y = Math.min(this.y, v.y); - return this; - } - max(v) { - this.x = Math.max(this.x, v.x); - this.y = Math.max(this.y, v.y); - return this; - } - clamp(min, max) { - this.x = Math.max(min.x, Math.min(max.x, this.x)); - this.y = Math.max(min.y, Math.min(max.y, this.y)); - return this; - } - clampScalar(minVal, maxVal) { - this.x = Math.max(minVal, Math.min(maxVal, this.x)); - this.y = Math.max(minVal, Math.min(maxVal, this.y)); - return this; - } - clampLength(min, max) { - const length = this.length(); - return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length))); - } - floor() { - this.x = Math.floor(this.x); - this.y = Math.floor(this.y); - return this; - } - ceil() { - this.x = Math.ceil(this.x); - this.y = Math.ceil(this.y); - return this; - } - round() { - this.x = Math.round(this.x); - this.y = Math.round(this.y); - return this; - } - roundToZero() { - this.x = Math.trunc(this.x); - this.y = Math.trunc(this.y); - return this; - } - negate() { - this.x = -this.x; - this.y = -this.y; - return this; - } - dot(v) { - return this.x * v.x + this.y * v.y; - } - cross(v) { - return this.x * v.y - this.y * v.x; - } - lengthSq() { - return this.x * this.x + this.y * this.y; - } - length() { - return Math.sqrt(this.x * this.x + this.y * this.y); - } - manhattanLength() { - return Math.abs(this.x) + Math.abs(this.y); - } - normalize() { - return this.divideScalar(this.length() || 1); - } - angle() { - const angle = Math.atan2(-this.y, -this.x) + Math.PI; - return angle; - } - angleTo(v) { - const denominator = Math.sqrt(this.lengthSq() * v.lengthSq()); - if (denominator === 0) - return Math.PI / 2; - const theta = this.dot(v) / denominator; - return Math.acos(clamp(theta, -1, 1)); - } - distanceTo(v) { - return Math.sqrt(this.distanceToSquared(v)); - } - distanceToSquared(v) { - const dx = this.x - v.x, dy = this.y - v.y; - return dx * dx + dy * dy; - } - manhattanDistanceTo(v) { - return Math.abs(this.x - v.x) + Math.abs(this.y - v.y); - } - setLength(length) { - return this.normalize().multiplyScalar(length); - } - lerp(v, alpha) { - this.x += (v.x - this.x) * alpha; - this.y += (v.y - this.y) * alpha; - return this; - } - lerpVectors(v1, v2, alpha) { - this.x = v1.x + (v2.x - v1.x) * alpha; - this.y = v1.y + (v2.y - v1.y) * alpha; - return this; - } - equals(v) { - return v.x === this.x && v.y === this.y; - } - fromArray(array, offset = 0) { - this.x = array[offset]; - this.y = array[offset + 1]; - return this; - } - toArray(array = [], offset = 0) { - array[offset] = this.x; - array[offset + 1] = this.y; - return array; - } - fromBufferAttribute(attribute, index) { - this.x = attribute.getX(index); - this.y = attribute.getY(index); - return this; - } - rotateAround(center, angle) { - const c = Math.cos(angle), s = Math.sin(angle); - const x = this.x - center.x; - const y = this.y - center.y; - this.x = x * c - y * s + center.x; - this.y = x * s + y * c + center.y; - return this; - } - random() { - this.x = Math.random(); - this.y = Math.random(); - return this; - } - *[Symbol.iterator]() { - yield this.x; - yield this.y; - } -}; -var Matrix3 = class _Matrix3 { - constructor(n11, n12, n13, n21, n22, n23, n31, n32, n33) { - _Matrix3.prototype.isMatrix3 = true; - this.elements = [ - 1, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 1 - ]; - if (n11 !== void 0) { - this.set(n11, n12, n13, n21, n22, n23, n31, n32, n33); - } - } - set(n11, n12, n13, n21, n22, n23, n31, n32, n33) { - const te = this.elements; - te[0] = n11; - te[1] = n21; - te[2] = n31; - te[3] = n12; - te[4] = n22; - te[5] = n32; - te[6] = n13; - te[7] = n23; - te[8] = n33; - return this; - } - identity() { - this.set( - 1, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 1 - ); - return this; - } - copy(m) { - const te = this.elements; - const me = m.elements; - te[0] = me[0]; - te[1] = me[1]; - te[2] = me[2]; - te[3] = me[3]; - te[4] = me[4]; - te[5] = me[5]; - te[6] = me[6]; - te[7] = me[7]; - te[8] = me[8]; - return this; - } - extractBasis(xAxis, yAxis, zAxis) { - xAxis.setFromMatrix3Column(this, 0); - yAxis.setFromMatrix3Column(this, 1); - zAxis.setFromMatrix3Column(this, 2); - return this; - } - setFromMatrix4(m) { - const me = m.elements; - this.set( - me[0], - me[4], - me[8], - me[1], - me[5], - me[9], - me[2], - me[6], - me[10] - ); - return this; - } - multiply(m) { - return this.multiplyMatrices(this, m); - } - premultiply(m) { - return this.multiplyMatrices(m, this); - } - multiplyMatrices(a, b) { - const ae = a.elements; - const be = b.elements; - const te = this.elements; - const a11 = ae[0], a12 = ae[3], a13 = ae[6]; - const a21 = ae[1], a22 = ae[4], a23 = ae[7]; - const a31 = ae[2], a32 = ae[5], a33 = ae[8]; - const b11 = be[0], b12 = be[3], b13 = be[6]; - const b21 = be[1], b22 = be[4], b23 = be[7]; - const b31 = be[2], b32 = be[5], b33 = be[8]; - te[0] = a11 * b11 + a12 * b21 + a13 * b31; - te[3] = a11 * b12 + a12 * b22 + a13 * b32; - te[6] = a11 * b13 + a12 * b23 + a13 * b33; - te[1] = a21 * b11 + a22 * b21 + a23 * b31; - te[4] = a21 * b12 + a22 * b22 + a23 * b32; - te[7] = a21 * b13 + a22 * b23 + a23 * b33; - te[2] = a31 * b11 + a32 * b21 + a33 * b31; - te[5] = a31 * b12 + a32 * b22 + a33 * b32; - te[8] = a31 * b13 + a32 * b23 + a33 * b33; - return this; - } - multiplyScalar(s) { - const te = this.elements; - te[0] *= s; - te[3] *= s; - te[6] *= s; - te[1] *= s; - te[4] *= s; - te[7] *= s; - te[2] *= s; - te[5] *= s; - te[8] *= s; - return this; - } - determinant() { - const te = this.elements; - const a = te[0], b = te[1], c = te[2], d = te[3], e = te[4], f = te[5], g = te[6], h = te[7], i = te[8]; - return a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g; - } - invert() { - const te = this.elements, n11 = te[0], n21 = te[1], n31 = te[2], n12 = te[3], n22 = te[4], n32 = te[5], n13 = te[6], n23 = te[7], n33 = te[8], t11 = n33 * n22 - n32 * n23, t12 = n32 * n13 - n33 * n12, t13 = n23 * n12 - n22 * n13, det = n11 * t11 + n21 * t12 + n31 * t13; - if (det === 0) - return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0); - const detInv = 1 / det; - te[0] = t11 * detInv; - te[1] = (n31 * n23 - n33 * n21) * detInv; - te[2] = (n32 * n21 - n31 * n22) * detInv; - te[3] = t12 * detInv; - te[4] = (n33 * n11 - n31 * n13) * detInv; - te[5] = (n31 * n12 - n32 * n11) * detInv; - te[6] = t13 * detInv; - te[7] = (n21 * n13 - n23 * n11) * detInv; - te[8] = (n22 * n11 - n21 * n12) * detInv; - return this; - } - transpose() { - let tmp2; - const m = this.elements; - tmp2 = m[1]; - m[1] = m[3]; - m[3] = tmp2; - tmp2 = m[2]; - m[2] = m[6]; - m[6] = tmp2; - tmp2 = m[5]; - m[5] = m[7]; - m[7] = tmp2; - return this; - } - getNormalMatrix(matrix4) { - return this.setFromMatrix4(matrix4).invert().transpose(); - } - transposeIntoArray(r) { - const m = this.elements; - r[0] = m[0]; - r[1] = m[3]; - r[2] = m[6]; - r[3] = m[1]; - r[4] = m[4]; - r[5] = m[7]; - r[6] = m[2]; - r[7] = m[5]; - r[8] = m[8]; - return this; - } - setUvTransform(tx, ty, sx, sy, rotation, cx, cy) { - const c = Math.cos(rotation); - const s = Math.sin(rotation); - this.set( - sx * c, - sx * s, - -sx * (c * cx + s * cy) + cx + tx, - -sy * s, - sy * c, - -sy * (-s * cx + c * cy) + cy + ty, - 0, - 0, - 1 - ); - return this; - } - // - scale(sx, sy) { - this.premultiply(_m3.makeScale(sx, sy)); - return this; - } - rotate(theta) { - this.premultiply(_m3.makeRotation(-theta)); - return this; - } - translate(tx, ty) { - this.premultiply(_m3.makeTranslation(tx, ty)); - return this; - } - // for 2D Transforms - makeTranslation(x, y) { - if (x.isVector2) { - this.set( - 1, - 0, - x.x, - 0, - 1, - x.y, - 0, - 0, - 1 - ); - } else { - this.set( - 1, - 0, - x, - 0, - 1, - y, - 0, - 0, - 1 - ); - } - return this; - } - makeRotation(theta) { - const c = Math.cos(theta); - const s = Math.sin(theta); - this.set( - c, - -s, - 0, - s, - c, - 0, - 0, - 0, - 1 - ); - return this; - } - makeScale(x, y) { - this.set( - x, - 0, - 0, - 0, - y, - 0, - 0, - 0, - 1 - ); - return this; - } - // - equals(matrix) { - const te = this.elements; - const me = matrix.elements; - for (let i = 0; i < 9; i++) { - if (te[i] !== me[i]) - return false; - } - return true; - } - fromArray(array, offset = 0) { - for (let i = 0; i < 9; i++) { - this.elements[i] = array[i + offset]; - } - return this; - } - toArray(array = [], offset = 0) { - const te = this.elements; - array[offset] = te[0]; - array[offset + 1] = te[1]; - array[offset + 2] = te[2]; - array[offset + 3] = te[3]; - array[offset + 4] = te[4]; - array[offset + 5] = te[5]; - array[offset + 6] = te[6]; - array[offset + 7] = te[7]; - array[offset + 8] = te[8]; - return array; - } - clone() { - return new this.constructor().fromArray(this.elements); - } -}; -var _m3 = new Matrix3(); -function arrayNeedsUint32(array) { - for (let i = array.length - 1; i >= 0; --i) { - if (array[i] >= 65535) - return true; - } - return false; -} -var TYPED_ARRAYS = { - Int8Array, - Uint8Array, - Uint8ClampedArray, - Int16Array, - Uint16Array, - Int32Array, - Uint32Array, - Float32Array, - Float64Array -}; -function getTypedArray(type, buffer) { - return new TYPED_ARRAYS[type](buffer); -} -function createElementNS(name) { - return document.createElementNS("http://www.w3.org/1999/xhtml", name); -} -function createCanvasElement() { - const canvas = createElementNS("canvas"); - canvas.style.display = "block"; - return canvas; -} -var _cache = {}; -function warnOnce(message) { - if (message in _cache) - return; - _cache[message] = true; - console.warn(message); -} -var LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = new Matrix3().set( - 0.8224621, - 0.177538, - 0, - 0.0331941, - 0.9668058, - 0, - 0.0170827, - 0.0723974, - 0.9105199 -); -var LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = new Matrix3().set( - 1.2249401, - -0.2249404, - 0, - -0.0420569, - 1.0420571, - 0, - -0.0196376, - -0.0786361, - 1.0982735 -); -var COLOR_SPACES = { - [LinearSRGBColorSpace]: { - transfer: LinearTransfer, - primaries: Rec709Primaries, - toReference: (color) => color, - fromReference: (color) => color - }, - [SRGBColorSpace]: { - transfer: SRGBTransfer, - primaries: Rec709Primaries, - toReference: (color) => color.convertSRGBToLinear(), - fromReference: (color) => color.convertLinearToSRGB() - }, - [LinearDisplayP3ColorSpace]: { - transfer: LinearTransfer, - primaries: P3Primaries, - toReference: (color) => color.applyMatrix3(LINEAR_DISPLAY_P3_TO_LINEAR_SRGB), - fromReference: (color) => color.applyMatrix3(LINEAR_SRGB_TO_LINEAR_DISPLAY_P3) - }, - [DisplayP3ColorSpace]: { - transfer: SRGBTransfer, - primaries: P3Primaries, - toReference: (color) => color.convertSRGBToLinear().applyMatrix3(LINEAR_DISPLAY_P3_TO_LINEAR_SRGB), - fromReference: (color) => color.applyMatrix3(LINEAR_SRGB_TO_LINEAR_DISPLAY_P3).convertLinearToSRGB() - } -}; -var SUPPORTED_WORKING_COLOR_SPACES = /* @__PURE__ */ new Set([LinearSRGBColorSpace, LinearDisplayP3ColorSpace]); -var ColorManagement = { - enabled: true, - _workingColorSpace: LinearSRGBColorSpace, - get legacyMode() { - console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."); - return !this.enabled; - }, - set legacyMode(legacyMode) { - console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."); - this.enabled = !legacyMode; - }, - get workingColorSpace() { - return this._workingColorSpace; - }, - set workingColorSpace(colorSpace) { - if (!SUPPORTED_WORKING_COLOR_SPACES.has(colorSpace)) { - throw new Error(`Unsupported working color space, "${colorSpace}".`); - } - this._workingColorSpace = colorSpace; - }, - convert: function(color, sourceColorSpace, targetColorSpace) { - if (this.enabled === false || sourceColorSpace === targetColorSpace || !sourceColorSpace || !targetColorSpace) { - return color; - } - const sourceToReference = COLOR_SPACES[sourceColorSpace].toReference; - const targetFromReference = COLOR_SPACES[targetColorSpace].fromReference; - return targetFromReference(sourceToReference(color)); - }, - fromWorkingColorSpace: function(color, targetColorSpace) { - return this.convert(color, this._workingColorSpace, targetColorSpace); - }, - toWorkingColorSpace: function(color, sourceColorSpace) { - return this.convert(color, sourceColorSpace, this._workingColorSpace); - }, - getPrimaries: function(colorSpace) { - return COLOR_SPACES[colorSpace].primaries; - }, - getTransfer: function(colorSpace) { - if (colorSpace === NoColorSpace) - return LinearTransfer; - return COLOR_SPACES[colorSpace].transfer; - } -}; -function SRGBToLinear(c) { - return c < 0.04045 ? c * 0.0773993808 : Math.pow(c * 0.9478672986 + 0.0521327014, 2.4); -} -function LinearToSRGB(c) { - return c < 31308e-7 ? c * 12.92 : 1.055 * Math.pow(c, 0.41666) - 0.055; -} -var _canvas; -var ImageUtils = class { - static getDataURL(image) { - if (/^data:/i.test(image.src)) { - return image.src; - } - if (typeof HTMLCanvasElement === "undefined") { - return image.src; - } - let canvas; - if (image instanceof HTMLCanvasElement) { - canvas = image; - } else { - if (_canvas === void 0) - _canvas = createElementNS("canvas"); - _canvas.width = image.width; - _canvas.height = image.height; - const context = _canvas.getContext("2d"); - if (image instanceof ImageData) { - context.putImageData(image, 0, 0); - } else { - context.drawImage(image, 0, 0, image.width, image.height); - } - canvas = _canvas; - } - if (canvas.width > 2048 || canvas.height > 2048) { - console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons", image); - return canvas.toDataURL("image/jpeg", 0.6); - } else { - return canvas.toDataURL("image/png"); - } - } - static sRGBToLinear(image) { - if (typeof HTMLImageElement !== "undefined" && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== "undefined" && image instanceof HTMLCanvasElement || typeof ImageBitmap !== "undefined" && image instanceof ImageBitmap) { - const canvas = createElementNS("canvas"); - canvas.width = image.width; - canvas.height = image.height; - const context = canvas.getContext("2d"); - context.drawImage(image, 0, 0, image.width, image.height); - const imageData = context.getImageData(0, 0, image.width, image.height); - const data = imageData.data; - for (let i = 0; i < data.length; i++) { - data[i] = SRGBToLinear(data[i] / 255) * 255; - } - context.putImageData(imageData, 0, 0); - return canvas; - } else if (image.data) { - const data = image.data.slice(0); - for (let i = 0; i < data.length; i++) { - if (data instanceof Uint8Array || data instanceof Uint8ClampedArray) { - data[i] = Math.floor(SRGBToLinear(data[i] / 255) * 255); - } else { - data[i] = SRGBToLinear(data[i]); - } - } - return { - data, - width: image.width, - height: image.height - }; - } else { - console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."); - return image; - } - } -}; -var _sourceId = 0; -var Source = class { - constructor(data = null) { - this.isSource = true; - Object.defineProperty(this, "id", { value: _sourceId++ }); - this.uuid = generateUUID(); - this.data = data; - this.version = 0; - } - set needsUpdate(value) { - if (value === true) - this.version++; - } - toJSON(meta) { - const isRootObject = meta === void 0 || typeof meta === "string"; - if (!isRootObject && meta.images[this.uuid] !== void 0) { - return meta.images[this.uuid]; - } - const output = { - uuid: this.uuid, - url: "" - }; - const data = this.data; - if (data !== null) { - let url; - if (Array.isArray(data)) { - url = []; - for (let i = 0, l = data.length; i < l; i++) { - if (data[i].isDataTexture) { - url.push(serializeImage(data[i].image)); - } else { - url.push(serializeImage(data[i])); - } - } - } else { - url = serializeImage(data); - } - output.url = url; - } - if (!isRootObject) { - meta.images[this.uuid] = output; - } - return output; - } -}; -function serializeImage(image) { - if (typeof HTMLImageElement !== "undefined" && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== "undefined" && image instanceof HTMLCanvasElement || typeof ImageBitmap !== "undefined" && image instanceof ImageBitmap) { - return ImageUtils.getDataURL(image); - } else { - if (image.data) { - return { - data: Array.from(image.data), - width: image.width, - height: image.height, - type: image.data.constructor.name - }; - } else { - console.warn("THREE.Texture: Unable to serialize Texture."); - return {}; - } - } -} -var _textureId = 0; -var Texture = class _Texture extends EventDispatcher { - constructor(image = _Texture.DEFAULT_IMAGE, mapping = _Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = _Texture.DEFAULT_ANISOTROPY, colorSpace = NoColorSpace) { - super(); - this.isTexture = true; - Object.defineProperty(this, "id", { value: _textureId++ }); - this.uuid = generateUUID(); - this.name = ""; - this.source = new Source(image); - this.mipmaps = []; - this.mapping = mapping; - this.channel = 0; - this.wrapS = wrapS; - this.wrapT = wrapT; - this.magFilter = magFilter; - this.minFilter = minFilter; - this.anisotropy = anisotropy; - this.format = format; - this.internalFormat = null; - this.type = type; - this.offset = new Vector2(0, 0); - this.repeat = new Vector2(1, 1); - this.center = new Vector2(0, 0); - this.rotation = 0; - this.matrixAutoUpdate = true; - this.matrix = new Matrix3(); - this.generateMipmaps = true; - this.premultiplyAlpha = false; - this.flipY = true; - this.unpackAlignment = 4; - if (typeof colorSpace === "string") { - this.colorSpace = colorSpace; - } else { - warnOnce("THREE.Texture: Property .encoding has been replaced by .colorSpace."); - this.colorSpace = colorSpace === sRGBEncoding ? SRGBColorSpace : NoColorSpace; - } - this.userData = {}; - this.version = 0; - this.onUpdate = null; - this.isRenderTargetTexture = false; - this.needsPMREMUpdate = false; - } - get image() { - return this.source.data; - } - set image(value = null) { - this.source.data = value; - } - updateMatrix() { - this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y); - } - clone() { - return new this.constructor().copy(this); - } - copy(source) { - this.name = source.name; - this.source = source.source; - this.mipmaps = source.mipmaps.slice(0); - this.mapping = source.mapping; - this.channel = source.channel; - this.wrapS = source.wrapS; - this.wrapT = source.wrapT; - this.magFilter = source.magFilter; - this.minFilter = source.minFilter; - this.anisotropy = source.anisotropy; - this.format = source.format; - this.internalFormat = source.internalFormat; - this.type = source.type; - this.offset.copy(source.offset); - this.repeat.copy(source.repeat); - this.center.copy(source.center); - this.rotation = source.rotation; - this.matrixAutoUpdate = source.matrixAutoUpdate; - this.matrix.copy(source.matrix); - this.generateMipmaps = source.generateMipmaps; - this.premultiplyAlpha = source.premultiplyAlpha; - this.flipY = source.flipY; - this.unpackAlignment = source.unpackAlignment; - this.colorSpace = source.colorSpace; - this.userData = JSON.parse(JSON.stringify(source.userData)); - this.needsUpdate = true; - return this; - } - toJSON(meta) { - const isRootObject = meta === void 0 || typeof meta === "string"; - if (!isRootObject && meta.textures[this.uuid] !== void 0) { - return meta.textures[this.uuid]; - } - const output = { - metadata: { - version: 4.6, - type: "Texture", - generator: "Texture.toJSON" - }, - uuid: this.uuid, - name: this.name, - image: this.source.toJSON(meta).uuid, - mapping: this.mapping, - channel: this.channel, - repeat: [this.repeat.x, this.repeat.y], - offset: [this.offset.x, this.offset.y], - center: [this.center.x, this.center.y], - rotation: this.rotation, - wrap: [this.wrapS, this.wrapT], - format: this.format, - internalFormat: this.internalFormat, - type: this.type, - colorSpace: this.colorSpace, - minFilter: this.minFilter, - magFilter: this.magFilter, - anisotropy: this.anisotropy, - flipY: this.flipY, - generateMipmaps: this.generateMipmaps, - premultiplyAlpha: this.premultiplyAlpha, - unpackAlignment: this.unpackAlignment - }; - if (Object.keys(this.userData).length > 0) - output.userData = this.userData; - if (!isRootObject) { - meta.textures[this.uuid] = output; - } - return output; - } - dispose() { - this.dispatchEvent({ type: "dispose" }); - } - transformUv(uv) { - if (this.mapping !== UVMapping) - return uv; - uv.applyMatrix3(this.matrix); - if (uv.x < 0 || uv.x > 1) { - switch (this.wrapS) { - case RepeatWrapping: - uv.x = uv.x - Math.floor(uv.x); - break; - case ClampToEdgeWrapping: - uv.x = uv.x < 0 ? 0 : 1; - break; - case MirroredRepeatWrapping: - if (Math.abs(Math.floor(uv.x) % 2) === 1) { - uv.x = Math.ceil(uv.x) - uv.x; - } else { - uv.x = uv.x - Math.floor(uv.x); - } - break; - } - } - if (uv.y < 0 || uv.y > 1) { - switch (this.wrapT) { - case RepeatWrapping: - uv.y = uv.y - Math.floor(uv.y); - break; - case ClampToEdgeWrapping: - uv.y = uv.y < 0 ? 0 : 1; - break; - case MirroredRepeatWrapping: - if (Math.abs(Math.floor(uv.y) % 2) === 1) { - uv.y = Math.ceil(uv.y) - uv.y; - } else { - uv.y = uv.y - Math.floor(uv.y); - } - break; - } - } - if (this.flipY) { - uv.y = 1 - uv.y; - } - return uv; - } - set needsUpdate(value) { - if (value === true) { - this.version++; - this.source.needsUpdate = true; - } - } - get encoding() { - warnOnce("THREE.Texture: Property .encoding has been replaced by .colorSpace."); - return this.colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding; - } - set encoding(encoding) { - warnOnce("THREE.Texture: Property .encoding has been replaced by .colorSpace."); - this.colorSpace = encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace; - } -}; -Texture.DEFAULT_IMAGE = null; -Texture.DEFAULT_MAPPING = UVMapping; -Texture.DEFAULT_ANISOTROPY = 1; -var Vector4 = class _Vector4 { - constructor(x = 0, y = 0, z = 0, w = 1) { - _Vector4.prototype.isVector4 = true; - this.x = x; - this.y = y; - this.z = z; - this.w = w; - } - get width() { - return this.z; - } - set width(value) { - this.z = value; - } - get height() { - return this.w; - } - set height(value) { - this.w = value; - } - set(x, y, z, w) { - this.x = x; - this.y = y; - this.z = z; - this.w = w; - return this; - } - setScalar(scalar) { - this.x = scalar; - this.y = scalar; - this.z = scalar; - this.w = scalar; - return this; - } - setX(x) { - this.x = x; - return this; - } - setY(y) { - this.y = y; - return this; - } - setZ(z) { - this.z = z; - return this; - } - setW(w) { - this.w = w; - return this; - } - setComponent(index, value) { - switch (index) { - case 0: - this.x = value; - break; - case 1: - this.y = value; - break; - case 2: - this.z = value; - break; - case 3: - this.w = value; - break; - default: - throw new Error("index is out of range: " + index); - } - return this; - } - getComponent(index) { - switch (index) { - case 0: - return this.x; - case 1: - return this.y; - case 2: - return this.z; - case 3: - return this.w; - default: - throw new Error("index is out of range: " + index); - } - } - clone() { - return new this.constructor(this.x, this.y, this.z, this.w); - } - copy(v) { - this.x = v.x; - this.y = v.y; - this.z = v.z; - this.w = v.w !== void 0 ? v.w : 1; - return this; - } - add(v) { - this.x += v.x; - this.y += v.y; - this.z += v.z; - this.w += v.w; - return this; - } - addScalar(s) { - this.x += s; - this.y += s; - this.z += s; - this.w += s; - return this; - } - addVectors(a, b) { - this.x = a.x + b.x; - this.y = a.y + b.y; - this.z = a.z + b.z; - this.w = a.w + b.w; - return this; - } - addScaledVector(v, s) { - this.x += v.x * s; - this.y += v.y * s; - this.z += v.z * s; - this.w += v.w * s; - return this; - } - sub(v) { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - this.w -= v.w; - return this; - } - subScalar(s) { - this.x -= s; - this.y -= s; - this.z -= s; - this.w -= s; - return this; - } - subVectors(a, b) { - this.x = a.x - b.x; - this.y = a.y - b.y; - this.z = a.z - b.z; - this.w = a.w - b.w; - return this; - } - multiply(v) { - this.x *= v.x; - this.y *= v.y; - this.z *= v.z; - this.w *= v.w; - return this; - } - multiplyScalar(scalar) { - this.x *= scalar; - this.y *= scalar; - this.z *= scalar; - this.w *= scalar; - return this; - } - applyMatrix4(m) { - const x = this.x, y = this.y, z = this.z, w = this.w; - const e = m.elements; - this.x = e[0] * x + e[4] * y + e[8] * z + e[12] * w; - this.y = e[1] * x + e[5] * y + e[9] * z + e[13] * w; - this.z = e[2] * x + e[6] * y + e[10] * z + e[14] * w; - this.w = e[3] * x + e[7] * y + e[11] * z + e[15] * w; - return this; - } - divideScalar(scalar) { - return this.multiplyScalar(1 / scalar); - } - setAxisAngleFromQuaternion(q) { - this.w = 2 * Math.acos(q.w); - const s = Math.sqrt(1 - q.w * q.w); - if (s < 1e-4) { - this.x = 1; - this.y = 0; - this.z = 0; - } else { - this.x = q.x / s; - this.y = q.y / s; - this.z = q.z / s; - } - return this; - } - setAxisAngleFromRotationMatrix(m) { - let angle, x, y, z; - const epsilon = 0.01, epsilon2 = 0.1, te = m.elements, m11 = te[0], m12 = te[4], m13 = te[8], m21 = te[1], m22 = te[5], m23 = te[9], m31 = te[2], m32 = te[6], m33 = te[10]; - if (Math.abs(m12 - m21) < epsilon && Math.abs(m13 - m31) < epsilon && Math.abs(m23 - m32) < epsilon) { - if (Math.abs(m12 + m21) < epsilon2 && Math.abs(m13 + m31) < epsilon2 && Math.abs(m23 + m32) < epsilon2 && Math.abs(m11 + m22 + m33 - 3) < epsilon2) { - this.set(1, 0, 0, 0); - return this; - } - angle = Math.PI; - const xx = (m11 + 1) / 2; - const yy = (m22 + 1) / 2; - const zz = (m33 + 1) / 2; - const xy = (m12 + m21) / 4; - const xz = (m13 + m31) / 4; - const yz = (m23 + m32) / 4; - if (xx > yy && xx > zz) { - if (xx < epsilon) { - x = 0; - y = 0.707106781; - z = 0.707106781; - } else { - x = Math.sqrt(xx); - y = xy / x; - z = xz / x; - } - } else if (yy > zz) { - if (yy < epsilon) { - x = 0.707106781; - y = 0; - z = 0.707106781; - } else { - y = Math.sqrt(yy); - x = xy / y; - z = yz / y; - } - } else { - if (zz < epsilon) { - x = 0.707106781; - y = 0.707106781; - z = 0; - } else { - z = Math.sqrt(zz); - x = xz / z; - y = yz / z; - } - } - this.set(x, y, z, angle); - return this; - } - let s = Math.sqrt((m32 - m23) * (m32 - m23) + (m13 - m31) * (m13 - m31) + (m21 - m12) * (m21 - m12)); - if (Math.abs(s) < 1e-3) - s = 1; - this.x = (m32 - m23) / s; - this.y = (m13 - m31) / s; - this.z = (m21 - m12) / s; - this.w = Math.acos((m11 + m22 + m33 - 1) / 2); - return this; - } - min(v) { - this.x = Math.min(this.x, v.x); - this.y = Math.min(this.y, v.y); - this.z = Math.min(this.z, v.z); - this.w = Math.min(this.w, v.w); - return this; - } - max(v) { - this.x = Math.max(this.x, v.x); - this.y = Math.max(this.y, v.y); - this.z = Math.max(this.z, v.z); - this.w = Math.max(this.w, v.w); - return this; - } - clamp(min, max) { - this.x = Math.max(min.x, Math.min(max.x, this.x)); - this.y = Math.max(min.y, Math.min(max.y, this.y)); - this.z = Math.max(min.z, Math.min(max.z, this.z)); - this.w = Math.max(min.w, Math.min(max.w, this.w)); - return this; - } - clampScalar(minVal, maxVal) { - this.x = Math.max(minVal, Math.min(maxVal, this.x)); - this.y = Math.max(minVal, Math.min(maxVal, this.y)); - this.z = Math.max(minVal, Math.min(maxVal, this.z)); - this.w = Math.max(minVal, Math.min(maxVal, this.w)); - return this; - } - clampLength(min, max) { - const length = this.length(); - return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length))); - } - floor() { - this.x = Math.floor(this.x); - this.y = Math.floor(this.y); - this.z = Math.floor(this.z); - this.w = Math.floor(this.w); - return this; - } - ceil() { - this.x = Math.ceil(this.x); - this.y = Math.ceil(this.y); - this.z = Math.ceil(this.z); - this.w = Math.ceil(this.w); - return this; - } - round() { - this.x = Math.round(this.x); - this.y = Math.round(this.y); - this.z = Math.round(this.z); - this.w = Math.round(this.w); - return this; - } - roundToZero() { - this.x = Math.trunc(this.x); - this.y = Math.trunc(this.y); - this.z = Math.trunc(this.z); - this.w = Math.trunc(this.w); - return this; - } - negate() { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; - this.w = -this.w; - return this; - } - dot(v) { - return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; - } - lengthSq() { - return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w; - } - length() { - return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); - } - manhattanLength() { - return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w); - } - normalize() { - return this.divideScalar(this.length() || 1); - } - setLength(length) { - return this.normalize().multiplyScalar(length); - } - lerp(v, alpha) { - this.x += (v.x - this.x) * alpha; - this.y += (v.y - this.y) * alpha; - this.z += (v.z - this.z) * alpha; - this.w += (v.w - this.w) * alpha; - return this; - } - lerpVectors(v1, v2, alpha) { - this.x = v1.x + (v2.x - v1.x) * alpha; - this.y = v1.y + (v2.y - v1.y) * alpha; - this.z = v1.z + (v2.z - v1.z) * alpha; - this.w = v1.w + (v2.w - v1.w) * alpha; - return this; - } - equals(v) { - return v.x === this.x && v.y === this.y && v.z === this.z && v.w === this.w; - } - fromArray(array, offset = 0) { - this.x = array[offset]; - this.y = array[offset + 1]; - this.z = array[offset + 2]; - this.w = array[offset + 3]; - return this; - } - toArray(array = [], offset = 0) { - array[offset] = this.x; - array[offset + 1] = this.y; - array[offset + 2] = this.z; - array[offset + 3] = this.w; - return array; - } - fromBufferAttribute(attribute, index) { - this.x = attribute.getX(index); - this.y = attribute.getY(index); - this.z = attribute.getZ(index); - this.w = attribute.getW(index); - return this; - } - random() { - this.x = Math.random(); - this.y = Math.random(); - this.z = Math.random(); - this.w = Math.random(); - return this; - } - *[Symbol.iterator]() { - yield this.x; - yield this.y; - yield this.z; - yield this.w; - } -}; -var RenderTarget = class extends EventDispatcher { - constructor(width = 1, height = 1, options = {}) { - super(); - this.isRenderTarget = true; - this.width = width; - this.height = height; - this.depth = 1; - this.scissor = new Vector4(0, 0, width, height); - this.scissorTest = false; - this.viewport = new Vector4(0, 0, width, height); - const image = { width, height, depth: 1 }; - if (options.encoding !== void 0) { - warnOnce("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."); - options.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace; - } - options = Object.assign({ - generateMipmaps: false, - internalFormat: null, - minFilter: LinearFilter, - depthBuffer: true, - stencilBuffer: false, - depthTexture: null, - samples: 0 - }, options); - this.texture = new Texture(image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace); - this.texture.isRenderTargetTexture = true; - this.texture.flipY = false; - this.texture.generateMipmaps = options.generateMipmaps; - this.texture.internalFormat = options.internalFormat; - this.depthBuffer = options.depthBuffer; - this.stencilBuffer = options.stencilBuffer; - this.depthTexture = options.depthTexture; - this.samples = options.samples; - } - setSize(width, height, depth = 1) { - if (this.width !== width || this.height !== height || this.depth !== depth) { - this.width = width; - this.height = height; - this.depth = depth; - this.texture.image.width = width; - this.texture.image.height = height; - this.texture.image.depth = depth; - this.dispose(); - } - this.viewport.set(0, 0, width, height); - this.scissor.set(0, 0, width, height); - } - clone() { - return new this.constructor().copy(this); - } - copy(source) { - this.width = source.width; - this.height = source.height; - this.depth = source.depth; - this.scissor.copy(source.scissor); - this.scissorTest = source.scissorTest; - this.viewport.copy(source.viewport); - this.texture = source.texture.clone(); - this.texture.isRenderTargetTexture = true; - const image = Object.assign({}, source.texture.image); - this.texture.source = new Source(image); - this.depthBuffer = source.depthBuffer; - this.stencilBuffer = source.stencilBuffer; - if (source.depthTexture !== null) - this.depthTexture = source.depthTexture.clone(); - this.samples = source.samples; - return this; - } - dispose() { - this.dispatchEvent({ type: "dispose" }); - } -}; -var WebGLRenderTarget = class extends RenderTarget { - constructor(width = 1, height = 1, options = {}) { - super(width, height, options); - this.isWebGLRenderTarget = true; - } -}; -var DataArrayTexture = class extends Texture { - constructor(data = null, width = 1, height = 1, depth = 1) { - super(null); - this.isDataArrayTexture = true; - this.image = { data, width, height, depth }; - this.magFilter = NearestFilter; - this.minFilter = NearestFilter; - this.wrapR = ClampToEdgeWrapping; - this.generateMipmaps = false; - this.flipY = false; - this.unpackAlignment = 1; - } -}; -var WebGLArrayRenderTarget = class extends WebGLRenderTarget { - constructor(width = 1, height = 1, depth = 1) { - super(width, height); - this.isWebGLArrayRenderTarget = true; - this.depth = depth; - this.texture = new DataArrayTexture(null, width, height, depth); - this.texture.isRenderTargetTexture = true; - } -}; -var Data3DTexture = class extends Texture { - constructor(data = null, width = 1, height = 1, depth = 1) { - super(null); - this.isData3DTexture = true; - this.image = { data, width, height, depth }; - this.magFilter = NearestFilter; - this.minFilter = NearestFilter; - this.wrapR = ClampToEdgeWrapping; - this.generateMipmaps = false; - this.flipY = false; - this.unpackAlignment = 1; - } -}; -var WebGL3DRenderTarget = class extends WebGLRenderTarget { - constructor(width = 1, height = 1, depth = 1) { - super(width, height); - this.isWebGL3DRenderTarget = true; - this.depth = depth; - this.texture = new Data3DTexture(null, width, height, depth); - this.texture.isRenderTargetTexture = true; - } -}; -var WebGLMultipleRenderTargets = class extends WebGLRenderTarget { - constructor(width = 1, height = 1, count = 1, options = {}) { - super(width, height, options); - this.isWebGLMultipleRenderTargets = true; - const texture = this.texture; - this.texture = []; - for (let i = 0; i < count; i++) { - this.texture[i] = texture.clone(); - this.texture[i].isRenderTargetTexture = true; - } - } - setSize(width, height, depth = 1) { - if (this.width !== width || this.height !== height || this.depth !== depth) { - this.width = width; - this.height = height; - this.depth = depth; - for (let i = 0, il = this.texture.length; i < il; i++) { - this.texture[i].image.width = width; - this.texture[i].image.height = height; - this.texture[i].image.depth = depth; - } - this.dispose(); - } - this.viewport.set(0, 0, width, height); - this.scissor.set(0, 0, width, height); - } - copy(source) { - this.dispose(); - this.width = source.width; - this.height = source.height; - this.depth = source.depth; - this.scissor.copy(source.scissor); - this.scissorTest = source.scissorTest; - this.viewport.copy(source.viewport); - this.depthBuffer = source.depthBuffer; - this.stencilBuffer = source.stencilBuffer; - if (source.depthTexture !== null) - this.depthTexture = source.depthTexture.clone(); - this.texture.length = 0; - for (let i = 0, il = source.texture.length; i < il; i++) { - this.texture[i] = source.texture[i].clone(); - this.texture[i].isRenderTargetTexture = true; - } - return this; - } -}; -var Quaternion = class { - constructor(x = 0, y = 0, z = 0, w = 1) { - this.isQuaternion = true; - this._x = x; - this._y = y; - this._z = z; - this._w = w; - } - static slerpFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t) { - let x0 = src0[srcOffset0 + 0], y0 = src0[srcOffset0 + 1], z0 = src0[srcOffset0 + 2], w0 = src0[srcOffset0 + 3]; - const x1 = src1[srcOffset1 + 0], y1 = src1[srcOffset1 + 1], z1 = src1[srcOffset1 + 2], w1 = src1[srcOffset1 + 3]; - if (t === 0) { - dst[dstOffset + 0] = x0; - dst[dstOffset + 1] = y0; - dst[dstOffset + 2] = z0; - dst[dstOffset + 3] = w0; - return; - } - if (t === 1) { - dst[dstOffset + 0] = x1; - dst[dstOffset + 1] = y1; - dst[dstOffset + 2] = z1; - dst[dstOffset + 3] = w1; - return; - } - if (w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1) { - let s = 1 - t; - const cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1, dir = cos >= 0 ? 1 : -1, sqrSin = 1 - cos * cos; - if (sqrSin > Number.EPSILON) { - const sin = Math.sqrt(sqrSin), len = Math.atan2(sin, cos * dir); - s = Math.sin(s * len) / sin; - t = Math.sin(t * len) / sin; - } - const tDir = t * dir; - x0 = x0 * s + x1 * tDir; - y0 = y0 * s + y1 * tDir; - z0 = z0 * s + z1 * tDir; - w0 = w0 * s + w1 * tDir; - if (s === 1 - t) { - const f = 1 / Math.sqrt(x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0); - x0 *= f; - y0 *= f; - z0 *= f; - w0 *= f; - } - } - dst[dstOffset] = x0; - dst[dstOffset + 1] = y0; - dst[dstOffset + 2] = z0; - dst[dstOffset + 3] = w0; - } - static multiplyQuaternionsFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1) { - const x0 = src0[srcOffset0]; - const y0 = src0[srcOffset0 + 1]; - const z0 = src0[srcOffset0 + 2]; - const w0 = src0[srcOffset0 + 3]; - const x1 = src1[srcOffset1]; - const y1 = src1[srcOffset1 + 1]; - const z1 = src1[srcOffset1 + 2]; - const w1 = src1[srcOffset1 + 3]; - dst[dstOffset] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1; - dst[dstOffset + 1] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1; - dst[dstOffset + 2] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1; - dst[dstOffset + 3] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1; - return dst; - } - get x() { - return this._x; - } - set x(value) { - this._x = value; - this._onChangeCallback(); - } - get y() { - return this._y; - } - set y(value) { - this._y = value; - this._onChangeCallback(); - } - get z() { - return this._z; - } - set z(value) { - this._z = value; - this._onChangeCallback(); - } - get w() { - return this._w; - } - set w(value) { - this._w = value; - this._onChangeCallback(); - } - set(x, y, z, w) { - this._x = x; - this._y = y; - this._z = z; - this._w = w; - this._onChangeCallback(); - return this; - } - clone() { - return new this.constructor(this._x, this._y, this._z, this._w); - } - copy(quaternion) { - this._x = quaternion.x; - this._y = quaternion.y; - this._z = quaternion.z; - this._w = quaternion.w; - this._onChangeCallback(); - return this; - } - setFromEuler(euler, update) { - const x = euler._x, y = euler._y, z = euler._z, order = euler._order; - const cos = Math.cos; - const sin = Math.sin; - const c1 = cos(x / 2); - const c2 = cos(y / 2); - const c3 = cos(z / 2); - const s1 = sin(x / 2); - const s2 = sin(y / 2); - const s3 = sin(z / 2); - switch (order) { - case "XYZ": - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - break; - case "YXZ": - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - break; - case "ZXY": - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - break; - case "ZYX": - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - break; - case "YZX": - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - break; - case "XZY": - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - break; - default: - console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + order); - } - if (update !== false) - this._onChangeCallback(); - return this; - } - setFromAxisAngle(axis, angle) { - const halfAngle = angle / 2, s = Math.sin(halfAngle); - this._x = axis.x * s; - this._y = axis.y * s; - this._z = axis.z * s; - this._w = Math.cos(halfAngle); - this._onChangeCallback(); - return this; - } - setFromRotationMatrix(m) { - const te = m.elements, m11 = te[0], m12 = te[4], m13 = te[8], m21 = te[1], m22 = te[5], m23 = te[9], m31 = te[2], m32 = te[6], m33 = te[10], trace = m11 + m22 + m33; - if (trace > 0) { - const s = 0.5 / Math.sqrt(trace + 1); - this._w = 0.25 / s; - this._x = (m32 - m23) * s; - this._y = (m13 - m31) * s; - this._z = (m21 - m12) * s; - } else if (m11 > m22 && m11 > m33) { - const s = 2 * Math.sqrt(1 + m11 - m22 - m33); - this._w = (m32 - m23) / s; - this._x = 0.25 * s; - this._y = (m12 + m21) / s; - this._z = (m13 + m31) / s; - } else if (m22 > m33) { - const s = 2 * Math.sqrt(1 + m22 - m11 - m33); - this._w = (m13 - m31) / s; - this._x = (m12 + m21) / s; - this._y = 0.25 * s; - this._z = (m23 + m32) / s; - } else { - const s = 2 * Math.sqrt(1 + m33 - m11 - m22); - this._w = (m21 - m12) / s; - this._x = (m13 + m31) / s; - this._y = (m23 + m32) / s; - this._z = 0.25 * s; - } - this._onChangeCallback(); - return this; - } - setFromUnitVectors(vFrom, vTo) { - let r = vFrom.dot(vTo) + 1; - if (r < Number.EPSILON) { - r = 0; - if (Math.abs(vFrom.x) > Math.abs(vFrom.z)) { - this._x = -vFrom.y; - this._y = vFrom.x; - this._z = 0; - this._w = r; - } else { - this._x = 0; - this._y = -vFrom.z; - this._z = vFrom.y; - this._w = r; - } - } else { - this._x = vFrom.y * vTo.z - vFrom.z * vTo.y; - this._y = vFrom.z * vTo.x - vFrom.x * vTo.z; - this._z = vFrom.x * vTo.y - vFrom.y * vTo.x; - this._w = r; - } - return this.normalize(); - } - angleTo(q) { - return 2 * Math.acos(Math.abs(clamp(this.dot(q), -1, 1))); - } - rotateTowards(q, step) { - const angle = this.angleTo(q); - if (angle === 0) - return this; - const t = Math.min(1, step / angle); - this.slerp(q, t); - return this; - } - identity() { - return this.set(0, 0, 0, 1); - } - invert() { - return this.conjugate(); - } - conjugate() { - this._x *= -1; - this._y *= -1; - this._z *= -1; - this._onChangeCallback(); - return this; - } - dot(v) { - return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w; - } - lengthSq() { - return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w; - } - length() { - return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w); - } - normalize() { - let l = this.length(); - if (l === 0) { - this._x = 0; - this._y = 0; - this._z = 0; - this._w = 1; - } else { - l = 1 / l; - this._x = this._x * l; - this._y = this._y * l; - this._z = this._z * l; - this._w = this._w * l; - } - this._onChangeCallback(); - return this; - } - multiply(q) { - return this.multiplyQuaternions(this, q); - } - premultiply(q) { - return this.multiplyQuaternions(q, this); - } - multiplyQuaternions(a, b) { - const qax = a._x, qay = a._y, qaz = a._z, qaw = a._w; - const qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w; - this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby; - this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz; - this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx; - this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz; - this._onChangeCallback(); - return this; - } - slerp(qb, t) { - if (t === 0) - return this; - if (t === 1) - return this.copy(qb); - const x = this._x, y = this._y, z = this._z, w = this._w; - let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z; - if (cosHalfTheta < 0) { - this._w = -qb._w; - this._x = -qb._x; - this._y = -qb._y; - this._z = -qb._z; - cosHalfTheta = -cosHalfTheta; - } else { - this.copy(qb); - } - if (cosHalfTheta >= 1) { - this._w = w; - this._x = x; - this._y = y; - this._z = z; - return this; - } - const sqrSinHalfTheta = 1 - cosHalfTheta * cosHalfTheta; - if (sqrSinHalfTheta <= Number.EPSILON) { - const s = 1 - t; - this._w = s * w + t * this._w; - this._x = s * x + t * this._x; - this._y = s * y + t * this._y; - this._z = s * z + t * this._z; - this.normalize(); - this._onChangeCallback(); - return this; - } - const sinHalfTheta = Math.sqrt(sqrSinHalfTheta); - const halfTheta = Math.atan2(sinHalfTheta, cosHalfTheta); - const ratioA = Math.sin((1 - t) * halfTheta) / sinHalfTheta, ratioB = Math.sin(t * halfTheta) / sinHalfTheta; - this._w = w * ratioA + this._w * ratioB; - this._x = x * ratioA + this._x * ratioB; - this._y = y * ratioA + this._y * ratioB; - this._z = z * ratioA + this._z * ratioB; - this._onChangeCallback(); - return this; - } - slerpQuaternions(qa, qb, t) { - return this.copy(qa).slerp(qb, t); - } - random() { - const u1 = Math.random(); - const sqrt1u1 = Math.sqrt(1 - u1); - const sqrtu1 = Math.sqrt(u1); - const u2 = 2 * Math.PI * Math.random(); - const u3 = 2 * Math.PI * Math.random(); - return this.set( - sqrt1u1 * Math.cos(u2), - sqrtu1 * Math.sin(u3), - sqrtu1 * Math.cos(u3), - sqrt1u1 * Math.sin(u2) - ); - } - equals(quaternion) { - return quaternion._x === this._x && quaternion._y === this._y && quaternion._z === this._z && quaternion._w === this._w; - } - fromArray(array, offset = 0) { - this._x = array[offset]; - this._y = array[offset + 1]; - this._z = array[offset + 2]; - this._w = array[offset + 3]; - this._onChangeCallback(); - return this; - } - toArray(array = [], offset = 0) { - array[offset] = this._x; - array[offset + 1] = this._y; - array[offset + 2] = this._z; - array[offset + 3] = this._w; - return array; - } - fromBufferAttribute(attribute, index) { - this._x = attribute.getX(index); - this._y = attribute.getY(index); - this._z = attribute.getZ(index); - this._w = attribute.getW(index); - return this; - } - toJSON() { - return this.toArray(); - } - _onChange(callback) { - this._onChangeCallback = callback; - return this; - } - _onChangeCallback() { - } - *[Symbol.iterator]() { - yield this._x; - yield this._y; - yield this._z; - yield this._w; - } -}; -var Vector3 = class _Vector3 { - constructor(x = 0, y = 0, z = 0) { - _Vector3.prototype.isVector3 = true; - this.x = x; - this.y = y; - this.z = z; - } - set(x, y, z) { - if (z === void 0) - z = this.z; - this.x = x; - this.y = y; - this.z = z; - return this; - } - setScalar(scalar) { - this.x = scalar; - this.y = scalar; - this.z = scalar; - return this; - } - setX(x) { - this.x = x; - return this; - } - setY(y) { - this.y = y; - return this; - } - setZ(z) { - this.z = z; - return this; - } - setComponent(index, value) { - switch (index) { - case 0: - this.x = value; - break; - case 1: - this.y = value; - break; - case 2: - this.z = value; - break; - default: - throw new Error("index is out of range: " + index); - } - return this; - } - getComponent(index) { - switch (index) { - case 0: - return this.x; - case 1: - return this.y; - case 2: - return this.z; - default: - throw new Error("index is out of range: " + index); - } - } - clone() { - return new this.constructor(this.x, this.y, this.z); - } - copy(v) { - this.x = v.x; - this.y = v.y; - this.z = v.z; - return this; - } - add(v) { - this.x += v.x; - this.y += v.y; - this.z += v.z; - return this; - } - addScalar(s) { - this.x += s; - this.y += s; - this.z += s; - return this; - } - addVectors(a, b) { - this.x = a.x + b.x; - this.y = a.y + b.y; - this.z = a.z + b.z; - return this; - } - addScaledVector(v, s) { - this.x += v.x * s; - this.y += v.y * s; - this.z += v.z * s; - return this; - } - sub(v) { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - return this; - } - subScalar(s) { - this.x -= s; - this.y -= s; - this.z -= s; - return this; - } - subVectors(a, b) { - this.x = a.x - b.x; - this.y = a.y - b.y; - this.z = a.z - b.z; - return this; - } - multiply(v) { - this.x *= v.x; - this.y *= v.y; - this.z *= v.z; - return this; - } - multiplyScalar(scalar) { - this.x *= scalar; - this.y *= scalar; - this.z *= scalar; - return this; - } - multiplyVectors(a, b) { - this.x = a.x * b.x; - this.y = a.y * b.y; - this.z = a.z * b.z; - return this; - } - applyEuler(euler) { - return this.applyQuaternion(_quaternion$4.setFromEuler(euler)); - } - applyAxisAngle(axis, angle) { - return this.applyQuaternion(_quaternion$4.setFromAxisAngle(axis, angle)); - } - applyMatrix3(m) { - const x = this.x, y = this.y, z = this.z; - const e = m.elements; - this.x = e[0] * x + e[3] * y + e[6] * z; - this.y = e[1] * x + e[4] * y + e[7] * z; - this.z = e[2] * x + e[5] * y + e[8] * z; - return this; - } - applyNormalMatrix(m) { - return this.applyMatrix3(m).normalize(); - } - applyMatrix4(m) { - const x = this.x, y = this.y, z = this.z; - const e = m.elements; - const w = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]); - this.x = (e[0] * x + e[4] * y + e[8] * z + e[12]) * w; - this.y = (e[1] * x + e[5] * y + e[9] * z + e[13]) * w; - this.z = (e[2] * x + e[6] * y + e[10] * z + e[14]) * w; - return this; - } - applyQuaternion(q) { - const vx = this.x, vy = this.y, vz = this.z; - const qx = q.x, qy = q.y, qz = q.z, qw = q.w; - const tx = 2 * (qy * vz - qz * vy); - const ty = 2 * (qz * vx - qx * vz); - const tz = 2 * (qx * vy - qy * vx); - this.x = vx + qw * tx + qy * tz - qz * ty; - this.y = vy + qw * ty + qz * tx - qx * tz; - this.z = vz + qw * tz + qx * ty - qy * tx; - return this; - } - project(camera) { - return this.applyMatrix4(camera.matrixWorldInverse).applyMatrix4(camera.projectionMatrix); - } - unproject(camera) { - return this.applyMatrix4(camera.projectionMatrixInverse).applyMatrix4(camera.matrixWorld); - } - transformDirection(m) { - const x = this.x, y = this.y, z = this.z; - const e = m.elements; - this.x = e[0] * x + e[4] * y + e[8] * z; - this.y = e[1] * x + e[5] * y + e[9] * z; - this.z = e[2] * x + e[6] * y + e[10] * z; - return this.normalize(); - } - divide(v) { - this.x /= v.x; - this.y /= v.y; - this.z /= v.z; - return this; - } - divideScalar(scalar) { - return this.multiplyScalar(1 / scalar); - } - min(v) { - this.x = Math.min(this.x, v.x); - this.y = Math.min(this.y, v.y); - this.z = Math.min(this.z, v.z); - return this; - } - max(v) { - this.x = Math.max(this.x, v.x); - this.y = Math.max(this.y, v.y); - this.z = Math.max(this.z, v.z); - return this; - } - clamp(min, max) { - this.x = Math.max(min.x, Math.min(max.x, this.x)); - this.y = Math.max(min.y, Math.min(max.y, this.y)); - this.z = Math.max(min.z, Math.min(max.z, this.z)); - return this; - } - clampScalar(minVal, maxVal) { - this.x = Math.max(minVal, Math.min(maxVal, this.x)); - this.y = Math.max(minVal, Math.min(maxVal, this.y)); - this.z = Math.max(minVal, Math.min(maxVal, this.z)); - return this; - } - clampLength(min, max) { - const length = this.length(); - return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length))); - } - floor() { - this.x = Math.floor(this.x); - this.y = Math.floor(this.y); - this.z = Math.floor(this.z); - return this; - } - ceil() { - this.x = Math.ceil(this.x); - this.y = Math.ceil(this.y); - this.z = Math.ceil(this.z); - return this; - } - round() { - this.x = Math.round(this.x); - this.y = Math.round(this.y); - this.z = Math.round(this.z); - return this; - } - roundToZero() { - this.x = Math.trunc(this.x); - this.y = Math.trunc(this.y); - this.z = Math.trunc(this.z); - return this; - } - negate() { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; - return this; - } - dot(v) { - return this.x * v.x + this.y * v.y + this.z * v.z; - } - // TODO lengthSquared? - lengthSq() { - return this.x * this.x + this.y * this.y + this.z * this.z; - } - length() { - return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); - } - manhattanLength() { - return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z); - } - normalize() { - return this.divideScalar(this.length() || 1); - } - setLength(length) { - return this.normalize().multiplyScalar(length); - } - lerp(v, alpha) { - this.x += (v.x - this.x) * alpha; - this.y += (v.y - this.y) * alpha; - this.z += (v.z - this.z) * alpha; - return this; - } - lerpVectors(v1, v2, alpha) { - this.x = v1.x + (v2.x - v1.x) * alpha; - this.y = v1.y + (v2.y - v1.y) * alpha; - this.z = v1.z + (v2.z - v1.z) * alpha; - return this; - } - cross(v) { - return this.crossVectors(this, v); - } - crossVectors(a, b) { - const ax = a.x, ay = a.y, az = a.z; - const bx = b.x, by = b.y, bz = b.z; - this.x = ay * bz - az * by; - this.y = az * bx - ax * bz; - this.z = ax * by - ay * bx; - return this; - } - projectOnVector(v) { - const denominator = v.lengthSq(); - if (denominator === 0) - return this.set(0, 0, 0); - const scalar = v.dot(this) / denominator; - return this.copy(v).multiplyScalar(scalar); - } - projectOnPlane(planeNormal) { - _vector$b.copy(this).projectOnVector(planeNormal); - return this.sub(_vector$b); - } - reflect(normal) { - return this.sub(_vector$b.copy(normal).multiplyScalar(2 * this.dot(normal))); - } - angleTo(v) { - const denominator = Math.sqrt(this.lengthSq() * v.lengthSq()); - if (denominator === 0) - return Math.PI / 2; - const theta = this.dot(v) / denominator; - return Math.acos(clamp(theta, -1, 1)); - } - distanceTo(v) { - return Math.sqrt(this.distanceToSquared(v)); - } - distanceToSquared(v) { - const dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z; - return dx * dx + dy * dy + dz * dz; - } - manhattanDistanceTo(v) { - return Math.abs(this.x - v.x) + Math.abs(this.y - v.y) + Math.abs(this.z - v.z); - } - setFromSpherical(s) { - return this.setFromSphericalCoords(s.radius, s.phi, s.theta); - } - setFromSphericalCoords(radius, phi, theta) { - const sinPhiRadius = Math.sin(phi) * radius; - this.x = sinPhiRadius * Math.sin(theta); - this.y = Math.cos(phi) * radius; - this.z = sinPhiRadius * Math.cos(theta); - return this; - } - setFromCylindrical(c) { - return this.setFromCylindricalCoords(c.radius, c.theta, c.y); - } - setFromCylindricalCoords(radius, theta, y) { - this.x = radius * Math.sin(theta); - this.y = y; - this.z = radius * Math.cos(theta); - return this; - } - setFromMatrixPosition(m) { - const e = m.elements; - this.x = e[12]; - this.y = e[13]; - this.z = e[14]; - return this; - } - setFromMatrixScale(m) { - const sx = this.setFromMatrixColumn(m, 0).length(); - const sy = this.setFromMatrixColumn(m, 1).length(); - const sz = this.setFromMatrixColumn(m, 2).length(); - this.x = sx; - this.y = sy; - this.z = sz; - return this; - } - setFromMatrixColumn(m, index) { - return this.fromArray(m.elements, index * 4); - } - setFromMatrix3Column(m, index) { - return this.fromArray(m.elements, index * 3); - } - setFromEuler(e) { - this.x = e._x; - this.y = e._y; - this.z = e._z; - return this; - } - setFromColor(c) { - this.x = c.r; - this.y = c.g; - this.z = c.b; - return this; - } - equals(v) { - return v.x === this.x && v.y === this.y && v.z === this.z; - } - fromArray(array, offset = 0) { - this.x = array[offset]; - this.y = array[offset + 1]; - this.z = array[offset + 2]; - return this; - } - toArray(array = [], offset = 0) { - array[offset] = this.x; - array[offset + 1] = this.y; - array[offset + 2] = this.z; - return array; - } - fromBufferAttribute(attribute, index) { - this.x = attribute.getX(index); - this.y = attribute.getY(index); - this.z = attribute.getZ(index); - return this; - } - random() { - this.x = Math.random(); - this.y = Math.random(); - this.z = Math.random(); - return this; - } - randomDirection() { - const u = (Math.random() - 0.5) * 2; - const t = Math.random() * Math.PI * 2; - const f = Math.sqrt(1 - u ** 2); - this.x = f * Math.cos(t); - this.y = f * Math.sin(t); - this.z = u; - return this; - } - *[Symbol.iterator]() { - yield this.x; - yield this.y; - yield this.z; - } -}; -var _vector$b = new Vector3(); -var _quaternion$4 = new Quaternion(); -var Box3 = class { - constructor(min = new Vector3(Infinity, Infinity, Infinity), max = new Vector3(-Infinity, -Infinity, -Infinity)) { - this.isBox3 = true; - this.min = min; - this.max = max; - } - set(min, max) { - this.min.copy(min); - this.max.copy(max); - return this; - } - setFromArray(array) { - this.makeEmpty(); - for (let i = 0, il = array.length; i < il; i += 3) { - this.expandByPoint(_vector$a.fromArray(array, i)); - } - return this; - } - setFromBufferAttribute(attribute) { - this.makeEmpty(); - for (let i = 0, il = attribute.count; i < il; i++) { - this.expandByPoint(_vector$a.fromBufferAttribute(attribute, i)); - } - return this; - } - setFromPoints(points) { - this.makeEmpty(); - for (let i = 0, il = points.length; i < il; i++) { - this.expandByPoint(points[i]); - } - return this; - } - setFromCenterAndSize(center, size) { - const halfSize = _vector$a.copy(size).multiplyScalar(0.5); - this.min.copy(center).sub(halfSize); - this.max.copy(center).add(halfSize); - return this; - } - setFromObject(object, precise = false) { - this.makeEmpty(); - return this.expandByObject(object, precise); - } - clone() { - return new this.constructor().copy(this); - } - copy(box) { - this.min.copy(box.min); - this.max.copy(box.max); - return this; - } - makeEmpty() { - this.min.x = this.min.y = this.min.z = Infinity; - this.max.x = this.max.y = this.max.z = -Infinity; - return this; - } - isEmpty() { - return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z; - } - getCenter(target) { - return this.isEmpty() ? target.set(0, 0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5); - } - getSize(target) { - return this.isEmpty() ? target.set(0, 0, 0) : target.subVectors(this.max, this.min); - } - expandByPoint(point) { - this.min.min(point); - this.max.max(point); - return this; - } - expandByVector(vector) { - this.min.sub(vector); - this.max.add(vector); - return this; - } - expandByScalar(scalar) { - this.min.addScalar(-scalar); - this.max.addScalar(scalar); - return this; - } - expandByObject(object, precise = false) { - object.updateWorldMatrix(false, false); - const geometry = object.geometry; - if (geometry !== void 0) { - const positionAttribute = geometry.getAttribute("position"); - if (precise === true && positionAttribute !== void 0 && object.isInstancedMesh !== true) { - for (let i = 0, l = positionAttribute.count; i < l; i++) { - if (object.isMesh === true) { - object.getVertexPosition(i, _vector$a); - } else { - _vector$a.fromBufferAttribute(positionAttribute, i); - } - _vector$a.applyMatrix4(object.matrixWorld); - this.expandByPoint(_vector$a); - } - } else { - if (object.boundingBox !== void 0) { - if (object.boundingBox === null) { - object.computeBoundingBox(); - } - _box$3.copy(object.boundingBox); - } else { - if (geometry.boundingBox === null) { - geometry.computeBoundingBox(); - } - _box$3.copy(geometry.boundingBox); - } - _box$3.applyMatrix4(object.matrixWorld); - this.union(_box$3); - } - } - const children = object.children; - for (let i = 0, l = children.length; i < l; i++) { - this.expandByObject(children[i], precise); - } - return this; - } - containsPoint(point) { - return point.x < this.min.x || point.x > this.max.x || point.y < this.min.y || point.y > this.max.y || point.z < this.min.z || point.z > this.max.z ? false : true; - } - containsBox(box) { - return this.min.x <= box.min.x && box.max.x <= this.max.x && this.min.y <= box.min.y && box.max.y <= this.max.y && this.min.z <= box.min.z && box.max.z <= this.max.z; - } - getParameter(point, target) { - return target.set( - (point.x - this.min.x) / (this.max.x - this.min.x), - (point.y - this.min.y) / (this.max.y - this.min.y), - (point.z - this.min.z) / (this.max.z - this.min.z) - ); - } - intersectsBox(box) { - return box.max.x < this.min.x || box.min.x > this.max.x || box.max.y < this.min.y || box.min.y > this.max.y || box.max.z < this.min.z || box.min.z > this.max.z ? false : true; - } - intersectsSphere(sphere) { - this.clampPoint(sphere.center, _vector$a); - return _vector$a.distanceToSquared(sphere.center) <= sphere.radius * sphere.radius; - } - intersectsPlane(plane) { - let min, max; - if (plane.normal.x > 0) { - min = plane.normal.x * this.min.x; - max = plane.normal.x * this.max.x; - } else { - min = plane.normal.x * this.max.x; - max = plane.normal.x * this.min.x; - } - if (plane.normal.y > 0) { - min += plane.normal.y * this.min.y; - max += plane.normal.y * this.max.y; - } else { - min += plane.normal.y * this.max.y; - max += plane.normal.y * this.min.y; - } - if (plane.normal.z > 0) { - min += plane.normal.z * this.min.z; - max += plane.normal.z * this.max.z; - } else { - min += plane.normal.z * this.max.z; - max += plane.normal.z * this.min.z; - } - return min <= -plane.constant && max >= -plane.constant; - } - intersectsTriangle(triangle) { - if (this.isEmpty()) { - return false; - } - this.getCenter(_center); - _extents.subVectors(this.max, _center); - _v0$2.subVectors(triangle.a, _center); - _v1$7.subVectors(triangle.b, _center); - _v2$4.subVectors(triangle.c, _center); - _f0.subVectors(_v1$7, _v0$2); - _f1.subVectors(_v2$4, _v1$7); - _f2.subVectors(_v0$2, _v2$4); - let axes = [ - 0, - -_f0.z, - _f0.y, - 0, - -_f1.z, - _f1.y, - 0, - -_f2.z, - _f2.y, - _f0.z, - 0, - -_f0.x, - _f1.z, - 0, - -_f1.x, - _f2.z, - 0, - -_f2.x, - -_f0.y, - _f0.x, - 0, - -_f1.y, - _f1.x, - 0, - -_f2.y, - _f2.x, - 0 - ]; - if (!satForAxes(axes, _v0$2, _v1$7, _v2$4, _extents)) { - return false; - } - axes = [1, 0, 0, 0, 1, 0, 0, 0, 1]; - if (!satForAxes(axes, _v0$2, _v1$7, _v2$4, _extents)) { - return false; - } - _triangleNormal.crossVectors(_f0, _f1); - axes = [_triangleNormal.x, _triangleNormal.y, _triangleNormal.z]; - return satForAxes(axes, _v0$2, _v1$7, _v2$4, _extents); - } - clampPoint(point, target) { - return target.copy(point).clamp(this.min, this.max); - } - distanceToPoint(point) { - return this.clampPoint(point, _vector$a).distanceTo(point); - } - getBoundingSphere(target) { - if (this.isEmpty()) { - target.makeEmpty(); - } else { - this.getCenter(target.center); - target.radius = this.getSize(_vector$a).length() * 0.5; - } - return target; - } - intersect(box) { - this.min.max(box.min); - this.max.min(box.max); - if (this.isEmpty()) - this.makeEmpty(); - return this; - } - union(box) { - this.min.min(box.min); - this.max.max(box.max); - return this; - } - applyMatrix4(matrix) { - if (this.isEmpty()) - return this; - _points[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(matrix); - _points[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(matrix); - _points[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(matrix); - _points[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(matrix); - _points[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(matrix); - _points[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(matrix); - _points[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(matrix); - _points[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(matrix); - this.setFromPoints(_points); - return this; - } - translate(offset) { - this.min.add(offset); - this.max.add(offset); - return this; - } - equals(box) { - return box.min.equals(this.min) && box.max.equals(this.max); - } -}; -var _points = [ - new Vector3(), - new Vector3(), - new Vector3(), - new Vector3(), - new Vector3(), - new Vector3(), - new Vector3(), - new Vector3() -]; -var _vector$a = new Vector3(); -var _box$3 = new Box3(); -var _v0$2 = new Vector3(); -var _v1$7 = new Vector3(); -var _v2$4 = new Vector3(); -var _f0 = new Vector3(); -var _f1 = new Vector3(); -var _f2 = new Vector3(); -var _center = new Vector3(); -var _extents = new Vector3(); -var _triangleNormal = new Vector3(); -var _testAxis = new Vector3(); -function satForAxes(axes, v0, v1, v2, extents) { - for (let i = 0, j = axes.length - 3; i <= j; i += 3) { - _testAxis.fromArray(axes, i); - const r = extents.x * Math.abs(_testAxis.x) + extents.y * Math.abs(_testAxis.y) + extents.z * Math.abs(_testAxis.z); - const p0 = v0.dot(_testAxis); - const p1 = v1.dot(_testAxis); - const p2 = v2.dot(_testAxis); - if (Math.max(-Math.max(p0, p1, p2), Math.min(p0, p1, p2)) > r) { - return false; - } - } - return true; -} -var _box$2 = new Box3(); -var _v1$6 = new Vector3(); -var _v2$3 = new Vector3(); -var Sphere = class { - constructor(center = new Vector3(), radius = -1) { - this.center = center; - this.radius = radius; - } - set(center, radius) { - this.center.copy(center); - this.radius = radius; - return this; - } - setFromPoints(points, optionalCenter) { - const center = this.center; - if (optionalCenter !== void 0) { - center.copy(optionalCenter); - } else { - _box$2.setFromPoints(points).getCenter(center); - } - let maxRadiusSq = 0; - for (let i = 0, il = points.length; i < il; i++) { - maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(points[i])); - } - this.radius = Math.sqrt(maxRadiusSq); - return this; - } - copy(sphere) { - this.center.copy(sphere.center); - this.radius = sphere.radius; - return this; - } - isEmpty() { - return this.radius < 0; - } - makeEmpty() { - this.center.set(0, 0, 0); - this.radius = -1; - return this; - } - containsPoint(point) { - return point.distanceToSquared(this.center) <= this.radius * this.radius; - } - distanceToPoint(point) { - return point.distanceTo(this.center) - this.radius; - } - intersectsSphere(sphere) { - const radiusSum = this.radius + sphere.radius; - return sphere.center.distanceToSquared(this.center) <= radiusSum * radiusSum; - } - intersectsBox(box) { - return box.intersectsSphere(this); - } - intersectsPlane(plane) { - return Math.abs(plane.distanceToPoint(this.center)) <= this.radius; - } - clampPoint(point, target) { - const deltaLengthSq = this.center.distanceToSquared(point); - target.copy(point); - if (deltaLengthSq > this.radius * this.radius) { - target.sub(this.center).normalize(); - target.multiplyScalar(this.radius).add(this.center); - } - return target; - } - getBoundingBox(target) { - if (this.isEmpty()) { - target.makeEmpty(); - return target; - } - target.set(this.center, this.center); - target.expandByScalar(this.radius); - return target; - } - applyMatrix4(matrix) { - this.center.applyMatrix4(matrix); - this.radius = this.radius * matrix.getMaxScaleOnAxis(); - return this; - } - translate(offset) { - this.center.add(offset); - return this; - } - expandByPoint(point) { - if (this.isEmpty()) { - this.center.copy(point); - this.radius = 0; - return this; - } - _v1$6.subVectors(point, this.center); - const lengthSq = _v1$6.lengthSq(); - if (lengthSq > this.radius * this.radius) { - const length = Math.sqrt(lengthSq); - const delta = (length - this.radius) * 0.5; - this.center.addScaledVector(_v1$6, delta / length); - this.radius += delta; - } - return this; - } - union(sphere) { - if (sphere.isEmpty()) { - return this; - } - if (this.isEmpty()) { - this.copy(sphere); - return this; - } - if (this.center.equals(sphere.center) === true) { - this.radius = Math.max(this.radius, sphere.radius); - } else { - _v2$3.subVectors(sphere.center, this.center).setLength(sphere.radius); - this.expandByPoint(_v1$6.copy(sphere.center).add(_v2$3)); - this.expandByPoint(_v1$6.copy(sphere.center).sub(_v2$3)); - } - return this; - } - equals(sphere) { - return sphere.center.equals(this.center) && sphere.radius === this.radius; - } - clone() { - return new this.constructor().copy(this); - } -}; -var _vector$9 = new Vector3(); -var _segCenter = new Vector3(); -var _segDir = new Vector3(); -var _diff = new Vector3(); -var _edge1 = new Vector3(); -var _edge2 = new Vector3(); -var _normal$1 = new Vector3(); -var Ray = class { - constructor(origin = new Vector3(), direction = new Vector3(0, 0, -1)) { - this.origin = origin; - this.direction = direction; - } - set(origin, direction) { - this.origin.copy(origin); - this.direction.copy(direction); - return this; - } - copy(ray) { - this.origin.copy(ray.origin); - this.direction.copy(ray.direction); - return this; - } - at(t, target) { - return target.copy(this.origin).addScaledVector(this.direction, t); - } - lookAt(v) { - this.direction.copy(v).sub(this.origin).normalize(); - return this; - } - recast(t) { - this.origin.copy(this.at(t, _vector$9)); - return this; - } - closestPointToPoint(point, target) { - target.subVectors(point, this.origin); - const directionDistance = target.dot(this.direction); - if (directionDistance < 0) { - return target.copy(this.origin); - } - return target.copy(this.origin).addScaledVector(this.direction, directionDistance); - } - distanceToPoint(point) { - return Math.sqrt(this.distanceSqToPoint(point)); - } - distanceSqToPoint(point) { - const directionDistance = _vector$9.subVectors(point, this.origin).dot(this.direction); - if (directionDistance < 0) { - return this.origin.distanceToSquared(point); - } - _vector$9.copy(this.origin).addScaledVector(this.direction, directionDistance); - return _vector$9.distanceToSquared(point); - } - distanceSqToSegment(v0, v1, optionalPointOnRay, optionalPointOnSegment) { - _segCenter.copy(v0).add(v1).multiplyScalar(0.5); - _segDir.copy(v1).sub(v0).normalize(); - _diff.copy(this.origin).sub(_segCenter); - const segExtent = v0.distanceTo(v1) * 0.5; - const a01 = -this.direction.dot(_segDir); - const b0 = _diff.dot(this.direction); - const b1 = -_diff.dot(_segDir); - const c = _diff.lengthSq(); - const det = Math.abs(1 - a01 * a01); - let s0, s1, sqrDist, extDet; - if (det > 0) { - s0 = a01 * b1 - b0; - s1 = a01 * b0 - b1; - extDet = segExtent * det; - if (s0 >= 0) { - if (s1 >= -extDet) { - if (s1 <= extDet) { - const invDet = 1 / det; - s0 *= invDet; - s1 *= invDet; - sqrDist = s0 * (s0 + a01 * s1 + 2 * b0) + s1 * (a01 * s0 + s1 + 2 * b1) + c; - } else { - s1 = segExtent; - s0 = Math.max(0, -(a01 * s1 + b0)); - sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; - } - } else { - s1 = -segExtent; - s0 = Math.max(0, -(a01 * s1 + b0)); - sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; - } - } else { - if (s1 <= -extDet) { - s0 = Math.max(0, -(-a01 * segExtent + b0)); - s1 = s0 > 0 ? -segExtent : Math.min(Math.max(-segExtent, -b1), segExtent); - sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; - } else if (s1 <= extDet) { - s0 = 0; - s1 = Math.min(Math.max(-segExtent, -b1), segExtent); - sqrDist = s1 * (s1 + 2 * b1) + c; - } else { - s0 = Math.max(0, -(a01 * segExtent + b0)); - s1 = s0 > 0 ? segExtent : Math.min(Math.max(-segExtent, -b1), segExtent); - sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; - } - } - } else { - s1 = a01 > 0 ? -segExtent : segExtent; - s0 = Math.max(0, -(a01 * s1 + b0)); - sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; - } - if (optionalPointOnRay) { - optionalPointOnRay.copy(this.origin).addScaledVector(this.direction, s0); - } - if (optionalPointOnSegment) { - optionalPointOnSegment.copy(_segCenter).addScaledVector(_segDir, s1); - } - return sqrDist; - } - intersectSphere(sphere, target) { - _vector$9.subVectors(sphere.center, this.origin); - const tca = _vector$9.dot(this.direction); - const d2 = _vector$9.dot(_vector$9) - tca * tca; - const radius2 = sphere.radius * sphere.radius; - if (d2 > radius2) - return null; - const thc = Math.sqrt(radius2 - d2); - const t0 = tca - thc; - const t1 = tca + thc; - if (t1 < 0) - return null; - if (t0 < 0) - return this.at(t1, target); - return this.at(t0, target); - } - intersectsSphere(sphere) { - return this.distanceSqToPoint(sphere.center) <= sphere.radius * sphere.radius; - } - distanceToPlane(plane) { - const denominator = plane.normal.dot(this.direction); - if (denominator === 0) { - if (plane.distanceToPoint(this.origin) === 0) { - return 0; - } - return null; - } - const t = -(this.origin.dot(plane.normal) + plane.constant) / denominator; - return t >= 0 ? t : null; - } - intersectPlane(plane, target) { - const t = this.distanceToPlane(plane); - if (t === null) { - return null; - } - return this.at(t, target); - } - intersectsPlane(plane) { - const distToPoint = plane.distanceToPoint(this.origin); - if (distToPoint === 0) { - return true; - } - const denominator = plane.normal.dot(this.direction); - if (denominator * distToPoint < 0) { - return true; - } - return false; - } - intersectBox(box, target) { - let tmin, tmax, tymin, tymax, tzmin, tzmax; - const invdirx = 1 / this.direction.x, invdiry = 1 / this.direction.y, invdirz = 1 / this.direction.z; - const origin = this.origin; - if (invdirx >= 0) { - tmin = (box.min.x - origin.x) * invdirx; - tmax = (box.max.x - origin.x) * invdirx; - } else { - tmin = (box.max.x - origin.x) * invdirx; - tmax = (box.min.x - origin.x) * invdirx; - } - if (invdiry >= 0) { - tymin = (box.min.y - origin.y) * invdiry; - tymax = (box.max.y - origin.y) * invdiry; - } else { - tymin = (box.max.y - origin.y) * invdiry; - tymax = (box.min.y - origin.y) * invdiry; - } - if (tmin > tymax || tymin > tmax) - return null; - if (tymin > tmin || isNaN(tmin)) - tmin = tymin; - if (tymax < tmax || isNaN(tmax)) - tmax = tymax; - if (invdirz >= 0) { - tzmin = (box.min.z - origin.z) * invdirz; - tzmax = (box.max.z - origin.z) * invdirz; - } else { - tzmin = (box.max.z - origin.z) * invdirz; - tzmax = (box.min.z - origin.z) * invdirz; - } - if (tmin > tzmax || tzmin > tmax) - return null; - if (tzmin > tmin || tmin !== tmin) - tmin = tzmin; - if (tzmax < tmax || tmax !== tmax) - tmax = tzmax; - if (tmax < 0) - return null; - return this.at(tmin >= 0 ? tmin : tmax, target); - } - intersectsBox(box) { - return this.intersectBox(box, _vector$9) !== null; - } - intersectTriangle(a, b, c, backfaceCulling, target) { - _edge1.subVectors(b, a); - _edge2.subVectors(c, a); - _normal$1.crossVectors(_edge1, _edge2); - let DdN = this.direction.dot(_normal$1); - let sign2; - if (DdN > 0) { - if (backfaceCulling) - return null; - sign2 = 1; - } else if (DdN < 0) { - sign2 = -1; - DdN = -DdN; - } else { - return null; - } - _diff.subVectors(this.origin, a); - const DdQxE2 = sign2 * this.direction.dot(_edge2.crossVectors(_diff, _edge2)); - if (DdQxE2 < 0) { - return null; - } - const DdE1xQ = sign2 * this.direction.dot(_edge1.cross(_diff)); - if (DdE1xQ < 0) { - return null; - } - if (DdQxE2 + DdE1xQ > DdN) { - return null; - } - const QdN = -sign2 * _diff.dot(_normal$1); - if (QdN < 0) { - return null; - } - return this.at(QdN / DdN, target); - } - applyMatrix4(matrix4) { - this.origin.applyMatrix4(matrix4); - this.direction.transformDirection(matrix4); - return this; - } - equals(ray) { - return ray.origin.equals(this.origin) && ray.direction.equals(this.direction); - } - clone() { - return new this.constructor().copy(this); - } -}; -var Matrix4 = class _Matrix4 { - constructor(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) { - _Matrix4.prototype.isMatrix4 = true; - this.elements = [ - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1 - ]; - if (n11 !== void 0) { - this.set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44); - } - } - set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) { - const te = this.elements; - te[0] = n11; - te[4] = n12; - te[8] = n13; - te[12] = n14; - te[1] = n21; - te[5] = n22; - te[9] = n23; - te[13] = n24; - te[2] = n31; - te[6] = n32; - te[10] = n33; - te[14] = n34; - te[3] = n41; - te[7] = n42; - te[11] = n43; - te[15] = n44; - return this; - } - identity() { - this.set( - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1 - ); - return this; - } - clone() { - return new _Matrix4().fromArray(this.elements); - } - copy(m) { - const te = this.elements; - const me = m.elements; - te[0] = me[0]; - te[1] = me[1]; - te[2] = me[2]; - te[3] = me[3]; - te[4] = me[4]; - te[5] = me[5]; - te[6] = me[6]; - te[7] = me[7]; - te[8] = me[8]; - te[9] = me[9]; - te[10] = me[10]; - te[11] = me[11]; - te[12] = me[12]; - te[13] = me[13]; - te[14] = me[14]; - te[15] = me[15]; - return this; - } - copyPosition(m) { - const te = this.elements, me = m.elements; - te[12] = me[12]; - te[13] = me[13]; - te[14] = me[14]; - return this; - } - setFromMatrix3(m) { - const me = m.elements; - this.set( - me[0], - me[3], - me[6], - 0, - me[1], - me[4], - me[7], - 0, - me[2], - me[5], - me[8], - 0, - 0, - 0, - 0, - 1 - ); - return this; - } - extractBasis(xAxis, yAxis, zAxis) { - xAxis.setFromMatrixColumn(this, 0); - yAxis.setFromMatrixColumn(this, 1); - zAxis.setFromMatrixColumn(this, 2); - return this; - } - makeBasis(xAxis, yAxis, zAxis) { - this.set( - xAxis.x, - yAxis.x, - zAxis.x, - 0, - xAxis.y, - yAxis.y, - zAxis.y, - 0, - xAxis.z, - yAxis.z, - zAxis.z, - 0, - 0, - 0, - 0, - 1 - ); - return this; - } - extractRotation(m) { - const te = this.elements; - const me = m.elements; - const scaleX = 1 / _v1$5.setFromMatrixColumn(m, 0).length(); - const scaleY = 1 / _v1$5.setFromMatrixColumn(m, 1).length(); - const scaleZ = 1 / _v1$5.setFromMatrixColumn(m, 2).length(); - te[0] = me[0] * scaleX; - te[1] = me[1] * scaleX; - te[2] = me[2] * scaleX; - te[3] = 0; - te[4] = me[4] * scaleY; - te[5] = me[5] * scaleY; - te[6] = me[6] * scaleY; - te[7] = 0; - te[8] = me[8] * scaleZ; - te[9] = me[9] * scaleZ; - te[10] = me[10] * scaleZ; - te[11] = 0; - te[12] = 0; - te[13] = 0; - te[14] = 0; - te[15] = 1; - return this; - } - makeRotationFromEuler(euler) { - const te = this.elements; - const x = euler.x, y = euler.y, z = euler.z; - const a = Math.cos(x), b = Math.sin(x); - const c = Math.cos(y), d = Math.sin(y); - const e = Math.cos(z), f = Math.sin(z); - if (euler.order === "XYZ") { - const ae = a * e, af = a * f, be = b * e, bf = b * f; - te[0] = c * e; - te[4] = -c * f; - te[8] = d; - te[1] = af + be * d; - te[5] = ae - bf * d; - te[9] = -b * c; - te[2] = bf - ae * d; - te[6] = be + af * d; - te[10] = a * c; - } else if (euler.order === "YXZ") { - const ce = c * e, cf = c * f, de = d * e, df = d * f; - te[0] = ce + df * b; - te[4] = de * b - cf; - te[8] = a * d; - te[1] = a * f; - te[5] = a * e; - te[9] = -b; - te[2] = cf * b - de; - te[6] = df + ce * b; - te[10] = a * c; - } else if (euler.order === "ZXY") { - const ce = c * e, cf = c * f, de = d * e, df = d * f; - te[0] = ce - df * b; - te[4] = -a * f; - te[8] = de + cf * b; - te[1] = cf + de * b; - te[5] = a * e; - te[9] = df - ce * b; - te[2] = -a * d; - te[6] = b; - te[10] = a * c; - } else if (euler.order === "ZYX") { - const ae = a * e, af = a * f, be = b * e, bf = b * f; - te[0] = c * e; - te[4] = be * d - af; - te[8] = ae * d + bf; - te[1] = c * f; - te[5] = bf * d + ae; - te[9] = af * d - be; - te[2] = -d; - te[6] = b * c; - te[10] = a * c; - } else if (euler.order === "YZX") { - const ac = a * c, ad = a * d, bc = b * c, bd = b * d; - te[0] = c * e; - te[4] = bd - ac * f; - te[8] = bc * f + ad; - te[1] = f; - te[5] = a * e; - te[9] = -b * e; - te[2] = -d * e; - te[6] = ad * f + bc; - te[10] = ac - bd * f; - } else if (euler.order === "XZY") { - const ac = a * c, ad = a * d, bc = b * c, bd = b * d; - te[0] = c * e; - te[4] = -f; - te[8] = d * e; - te[1] = ac * f + bd; - te[5] = a * e; - te[9] = ad * f - bc; - te[2] = bc * f - ad; - te[6] = b * e; - te[10] = bd * f + ac; - } - te[3] = 0; - te[7] = 0; - te[11] = 0; - te[12] = 0; - te[13] = 0; - te[14] = 0; - te[15] = 1; - return this; - } - makeRotationFromQuaternion(q) { - return this.compose(_zero, q, _one); - } - lookAt(eye, target, up) { - const te = this.elements; - _z.subVectors(eye, target); - if (_z.lengthSq() === 0) { - _z.z = 1; - } - _z.normalize(); - _x.crossVectors(up, _z); - if (_x.lengthSq() === 0) { - if (Math.abs(up.z) === 1) { - _z.x += 1e-4; - } else { - _z.z += 1e-4; - } - _z.normalize(); - _x.crossVectors(up, _z); - } - _x.normalize(); - _y.crossVectors(_z, _x); - te[0] = _x.x; - te[4] = _y.x; - te[8] = _z.x; - te[1] = _x.y; - te[5] = _y.y; - te[9] = _z.y; - te[2] = _x.z; - te[6] = _y.z; - te[10] = _z.z; - return this; - } - multiply(m) { - return this.multiplyMatrices(this, m); - } - premultiply(m) { - return this.multiplyMatrices(m, this); - } - multiplyMatrices(a, b) { - const ae = a.elements; - const be = b.elements; - const te = this.elements; - const a11 = ae[0], a12 = ae[4], a13 = ae[8], a14 = ae[12]; - const a21 = ae[1], a22 = ae[5], a23 = ae[9], a24 = ae[13]; - const a31 = ae[2], a32 = ae[6], a33 = ae[10], a34 = ae[14]; - const a41 = ae[3], a42 = ae[7], a43 = ae[11], a44 = ae[15]; - const b11 = be[0], b12 = be[4], b13 = be[8], b14 = be[12]; - const b21 = be[1], b22 = be[5], b23 = be[9], b24 = be[13]; - const b31 = be[2], b32 = be[6], b33 = be[10], b34 = be[14]; - const b41 = be[3], b42 = be[7], b43 = be[11], b44 = be[15]; - te[0] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41; - te[4] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42; - te[8] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43; - te[12] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44; - te[1] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41; - te[5] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42; - te[9] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43; - te[13] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44; - te[2] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41; - te[6] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42; - te[10] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43; - te[14] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44; - te[3] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41; - te[7] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42; - te[11] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43; - te[15] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44; - return this; - } - multiplyScalar(s) { - const te = this.elements; - te[0] *= s; - te[4] *= s; - te[8] *= s; - te[12] *= s; - te[1] *= s; - te[5] *= s; - te[9] *= s; - te[13] *= s; - te[2] *= s; - te[6] *= s; - te[10] *= s; - te[14] *= s; - te[3] *= s; - te[7] *= s; - te[11] *= s; - te[15] *= s; - return this; - } - determinant() { - const te = this.elements; - const n11 = te[0], n12 = te[4], n13 = te[8], n14 = te[12]; - const n21 = te[1], n22 = te[5], n23 = te[9], n24 = te[13]; - const n31 = te[2], n32 = te[6], n33 = te[10], n34 = te[14]; - const n41 = te[3], n42 = te[7], n43 = te[11], n44 = te[15]; - return n41 * (+n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34) + n42 * (+n11 * n23 * n34 - n11 * n24 * n33 + n14 * n21 * n33 - n13 * n21 * n34 + n13 * n24 * n31 - n14 * n23 * n31) + n43 * (+n11 * n24 * n32 - n11 * n22 * n34 - n14 * n21 * n32 + n12 * n21 * n34 + n14 * n22 * n31 - n12 * n24 * n31) + n44 * (-n13 * n22 * n31 - n11 * n23 * n32 + n11 * n22 * n33 + n13 * n21 * n32 - n12 * n21 * n33 + n12 * n23 * n31); - } - transpose() { - const te = this.elements; - let tmp2; - tmp2 = te[1]; - te[1] = te[4]; - te[4] = tmp2; - tmp2 = te[2]; - te[2] = te[8]; - te[8] = tmp2; - tmp2 = te[6]; - te[6] = te[9]; - te[9] = tmp2; - tmp2 = te[3]; - te[3] = te[12]; - te[12] = tmp2; - tmp2 = te[7]; - te[7] = te[13]; - te[13] = tmp2; - tmp2 = te[11]; - te[11] = te[14]; - te[14] = tmp2; - return this; - } - setPosition(x, y, z) { - const te = this.elements; - if (x.isVector3) { - te[12] = x.x; - te[13] = x.y; - te[14] = x.z; - } else { - te[12] = x; - te[13] = y; - te[14] = z; - } - return this; - } - invert() { - const te = this.elements, n11 = te[0], n21 = te[1], n31 = te[2], n41 = te[3], n12 = te[4], n22 = te[5], n32 = te[6], n42 = te[7], n13 = te[8], n23 = te[9], n33 = te[10], n43 = te[11], n14 = te[12], n24 = te[13], n34 = te[14], n44 = te[15], t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44, t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44, t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44, t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34; - const det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14; - if (det === 0) - return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - const detInv = 1 / det; - te[0] = t11 * detInv; - te[1] = (n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44) * detInv; - te[2] = (n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44) * detInv; - te[3] = (n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43) * detInv; - te[4] = t12 * detInv; - te[5] = (n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44) * detInv; - te[6] = (n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44) * detInv; - te[7] = (n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43) * detInv; - te[8] = t13 * detInv; - te[9] = (n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44) * detInv; - te[10] = (n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44) * detInv; - te[11] = (n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43) * detInv; - te[12] = t14 * detInv; - te[13] = (n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34) * detInv; - te[14] = (n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34) * detInv; - te[15] = (n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33) * detInv; - return this; - } - scale(v) { - const te = this.elements; - const x = v.x, y = v.y, z = v.z; - te[0] *= x; - te[4] *= y; - te[8] *= z; - te[1] *= x; - te[5] *= y; - te[9] *= z; - te[2] *= x; - te[6] *= y; - te[10] *= z; - te[3] *= x; - te[7] *= y; - te[11] *= z; - return this; - } - getMaxScaleOnAxis() { - const te = this.elements; - const scaleXSq = te[0] * te[0] + te[1] * te[1] + te[2] * te[2]; - const scaleYSq = te[4] * te[4] + te[5] * te[5] + te[6] * te[6]; - const scaleZSq = te[8] * te[8] + te[9] * te[9] + te[10] * te[10]; - return Math.sqrt(Math.max(scaleXSq, scaleYSq, scaleZSq)); - } - makeTranslation(x, y, z) { - if (x.isVector3) { - this.set( - 1, - 0, - 0, - x.x, - 0, - 1, - 0, - x.y, - 0, - 0, - 1, - x.z, - 0, - 0, - 0, - 1 - ); - } else { - this.set( - 1, - 0, - 0, - x, - 0, - 1, - 0, - y, - 0, - 0, - 1, - z, - 0, - 0, - 0, - 1 - ); - } - return this; - } - makeRotationX(theta) { - const c = Math.cos(theta), s = Math.sin(theta); - this.set( - 1, - 0, - 0, - 0, - 0, - c, - -s, - 0, - 0, - s, - c, - 0, - 0, - 0, - 0, - 1 - ); - return this; - } - makeRotationY(theta) { - const c = Math.cos(theta), s = Math.sin(theta); - this.set( - c, - 0, - s, - 0, - 0, - 1, - 0, - 0, - -s, - 0, - c, - 0, - 0, - 0, - 0, - 1 - ); - return this; - } - makeRotationZ(theta) { - const c = Math.cos(theta), s = Math.sin(theta); - this.set( - c, - -s, - 0, - 0, - s, - c, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1 - ); - return this; - } - makeRotationAxis(axis, angle) { - const c = Math.cos(angle); - const s = Math.sin(angle); - const t = 1 - c; - const x = axis.x, y = axis.y, z = axis.z; - const tx = t * x, ty = t * y; - this.set( - tx * x + c, - tx * y - s * z, - tx * z + s * y, - 0, - tx * y + s * z, - ty * y + c, - ty * z - s * x, - 0, - tx * z - s * y, - ty * z + s * x, - t * z * z + c, - 0, - 0, - 0, - 0, - 1 - ); - return this; - } - makeScale(x, y, z) { - this.set( - x, - 0, - 0, - 0, - 0, - y, - 0, - 0, - 0, - 0, - z, - 0, - 0, - 0, - 0, - 1 - ); - return this; - } - makeShear(xy, xz, yx, yz, zx, zy) { - this.set( - 1, - yx, - zx, - 0, - xy, - 1, - zy, - 0, - xz, - yz, - 1, - 0, - 0, - 0, - 0, - 1 - ); - return this; - } - compose(position, quaternion, scale) { - const te = this.elements; - const x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w; - const x2 = x + x, y2 = y + y, z2 = z + z; - const xx = x * x2, xy = x * y2, xz = x * z2; - const yy = y * y2, yz = y * z2, zz = z * z2; - const wx = w * x2, wy = w * y2, wz = w * z2; - const sx = scale.x, sy = scale.y, sz = scale.z; - te[0] = (1 - (yy + zz)) * sx; - te[1] = (xy + wz) * sx; - te[2] = (xz - wy) * sx; - te[3] = 0; - te[4] = (xy - wz) * sy; - te[5] = (1 - (xx + zz)) * sy; - te[6] = (yz + wx) * sy; - te[7] = 0; - te[8] = (xz + wy) * sz; - te[9] = (yz - wx) * sz; - te[10] = (1 - (xx + yy)) * sz; - te[11] = 0; - te[12] = position.x; - te[13] = position.y; - te[14] = position.z; - te[15] = 1; - return this; - } - decompose(position, quaternion, scale) { - const te = this.elements; - let sx = _v1$5.set(te[0], te[1], te[2]).length(); - const sy = _v1$5.set(te[4], te[5], te[6]).length(); - const sz = _v1$5.set(te[8], te[9], te[10]).length(); - const det = this.determinant(); - if (det < 0) - sx = -sx; - position.x = te[12]; - position.y = te[13]; - position.z = te[14]; - _m1$2.copy(this); - const invSX = 1 / sx; - const invSY = 1 / sy; - const invSZ = 1 / sz; - _m1$2.elements[0] *= invSX; - _m1$2.elements[1] *= invSX; - _m1$2.elements[2] *= invSX; - _m1$2.elements[4] *= invSY; - _m1$2.elements[5] *= invSY; - _m1$2.elements[6] *= invSY; - _m1$2.elements[8] *= invSZ; - _m1$2.elements[9] *= invSZ; - _m1$2.elements[10] *= invSZ; - quaternion.setFromRotationMatrix(_m1$2); - scale.x = sx; - scale.y = sy; - scale.z = sz; - return this; - } - makePerspective(left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem) { - const te = this.elements; - const x = 2 * near / (right - left); - const y = 2 * near / (top - bottom); - const a = (right + left) / (right - left); - const b = (top + bottom) / (top - bottom); - let c, d; - if (coordinateSystem === WebGLCoordinateSystem) { - c = -(far + near) / (far - near); - d = -2 * far * near / (far - near); - } else if (coordinateSystem === WebGPUCoordinateSystem) { - c = -far / (far - near); - d = -far * near / (far - near); - } else { - throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: " + coordinateSystem); - } - te[0] = x; - te[4] = 0; - te[8] = a; - te[12] = 0; - te[1] = 0; - te[5] = y; - te[9] = b; - te[13] = 0; - te[2] = 0; - te[6] = 0; - te[10] = c; - te[14] = d; - te[3] = 0; - te[7] = 0; - te[11] = -1; - te[15] = 0; - return this; - } - makeOrthographic(left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem) { - const te = this.elements; - const w = 1 / (right - left); - const h = 1 / (top - bottom); - const p = 1 / (far - near); - const x = (right + left) * w; - const y = (top + bottom) * h; - let z, zInv; - if (coordinateSystem === WebGLCoordinateSystem) { - z = (far + near) * p; - zInv = -2 * p; - } else if (coordinateSystem === WebGPUCoordinateSystem) { - z = near * p; - zInv = -1 * p; - } else { - throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: " + coordinateSystem); - } - te[0] = 2 * w; - te[4] = 0; - te[8] = 0; - te[12] = -x; - te[1] = 0; - te[5] = 2 * h; - te[9] = 0; - te[13] = -y; - te[2] = 0; - te[6] = 0; - te[10] = zInv; - te[14] = -z; - te[3] = 0; - te[7] = 0; - te[11] = 0; - te[15] = 1; - return this; - } - equals(matrix) { - const te = this.elements; - const me = matrix.elements; - for (let i = 0; i < 16; i++) { - if (te[i] !== me[i]) - return false; - } - return true; - } - fromArray(array, offset = 0) { - for (let i = 0; i < 16; i++) { - this.elements[i] = array[i + offset]; - } - return this; - } - toArray(array = [], offset = 0) { - const te = this.elements; - array[offset] = te[0]; - array[offset + 1] = te[1]; - array[offset + 2] = te[2]; - array[offset + 3] = te[3]; - array[offset + 4] = te[4]; - array[offset + 5] = te[5]; - array[offset + 6] = te[6]; - array[offset + 7] = te[7]; - array[offset + 8] = te[8]; - array[offset + 9] = te[9]; - array[offset + 10] = te[10]; - array[offset + 11] = te[11]; - array[offset + 12] = te[12]; - array[offset + 13] = te[13]; - array[offset + 14] = te[14]; - array[offset + 15] = te[15]; - return array; - } -}; -var _v1$5 = new Vector3(); -var _m1$2 = new Matrix4(); -var _zero = new Vector3(0, 0, 0); -var _one = new Vector3(1, 1, 1); -var _x = new Vector3(); -var _y = new Vector3(); -var _z = new Vector3(); -var _matrix = new Matrix4(); -var _quaternion$3 = new Quaternion(); -var Euler = class _Euler { - constructor(x = 0, y = 0, z = 0, order = _Euler.DEFAULT_ORDER) { - this.isEuler = true; - this._x = x; - this._y = y; - this._z = z; - this._order = order; - } - get x() { - return this._x; - } - set x(value) { - this._x = value; - this._onChangeCallback(); - } - get y() { - return this._y; - } - set y(value) { - this._y = value; - this._onChangeCallback(); - } - get z() { - return this._z; - } - set z(value) { - this._z = value; - this._onChangeCallback(); - } - get order() { - return this._order; - } - set order(value) { - this._order = value; - this._onChangeCallback(); - } - set(x, y, z, order = this._order) { - this._x = x; - this._y = y; - this._z = z; - this._order = order; - this._onChangeCallback(); - return this; - } - clone() { - return new this.constructor(this._x, this._y, this._z, this._order); - } - copy(euler) { - this._x = euler._x; - this._y = euler._y; - this._z = euler._z; - this._order = euler._order; - this._onChangeCallback(); - return this; - } - setFromRotationMatrix(m, order = this._order, update = true) { - const te = m.elements; - const m11 = te[0], m12 = te[4], m13 = te[8]; - const m21 = te[1], m22 = te[5], m23 = te[9]; - const m31 = te[2], m32 = te[6], m33 = te[10]; - switch (order) { - case "XYZ": - this._y = Math.asin(clamp(m13, -1, 1)); - if (Math.abs(m13) < 0.9999999) { - this._x = Math.atan2(-m23, m33); - this._z = Math.atan2(-m12, m11); - } else { - this._x = Math.atan2(m32, m22); - this._z = 0; - } - break; - case "YXZ": - this._x = Math.asin(-clamp(m23, -1, 1)); - if (Math.abs(m23) < 0.9999999) { - this._y = Math.atan2(m13, m33); - this._z = Math.atan2(m21, m22); - } else { - this._y = Math.atan2(-m31, m11); - this._z = 0; - } - break; - case "ZXY": - this._x = Math.asin(clamp(m32, -1, 1)); - if (Math.abs(m32) < 0.9999999) { - this._y = Math.atan2(-m31, m33); - this._z = Math.atan2(-m12, m22); - } else { - this._y = 0; - this._z = Math.atan2(m21, m11); - } - break; - case "ZYX": - this._y = Math.asin(-clamp(m31, -1, 1)); - if (Math.abs(m31) < 0.9999999) { - this._x = Math.atan2(m32, m33); - this._z = Math.atan2(m21, m11); - } else { - this._x = 0; - this._z = Math.atan2(-m12, m22); - } - break; - case "YZX": - this._z = Math.asin(clamp(m21, -1, 1)); - if (Math.abs(m21) < 0.9999999) { - this._x = Math.atan2(-m23, m22); - this._y = Math.atan2(-m31, m11); - } else { - this._x = 0; - this._y = Math.atan2(m13, m33); - } - break; - case "XZY": - this._z = Math.asin(-clamp(m12, -1, 1)); - if (Math.abs(m12) < 0.9999999) { - this._x = Math.atan2(m32, m22); - this._y = Math.atan2(m13, m11); - } else { - this._x = Math.atan2(-m23, m33); - this._y = 0; - } - break; - default: - console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: " + order); - } - this._order = order; - if (update === true) - this._onChangeCallback(); - return this; - } - setFromQuaternion(q, order, update) { - _matrix.makeRotationFromQuaternion(q); - return this.setFromRotationMatrix(_matrix, order, update); - } - setFromVector3(v, order = this._order) { - return this.set(v.x, v.y, v.z, order); - } - reorder(newOrder) { - _quaternion$3.setFromEuler(this); - return this.setFromQuaternion(_quaternion$3, newOrder); - } - equals(euler) { - return euler._x === this._x && euler._y === this._y && euler._z === this._z && euler._order === this._order; - } - fromArray(array) { - this._x = array[0]; - this._y = array[1]; - this._z = array[2]; - if (array[3] !== void 0) - this._order = array[3]; - this._onChangeCallback(); - return this; - } - toArray(array = [], offset = 0) { - array[offset] = this._x; - array[offset + 1] = this._y; - array[offset + 2] = this._z; - array[offset + 3] = this._order; - return array; - } - _onChange(callback) { - this._onChangeCallback = callback; - return this; - } - _onChangeCallback() { - } - *[Symbol.iterator]() { - yield this._x; - yield this._y; - yield this._z; - yield this._order; - } -}; -Euler.DEFAULT_ORDER = "XYZ"; -var Layers = class { - constructor() { - this.mask = 1 | 0; - } - set(channel) { - this.mask = (1 << channel | 0) >>> 0; - } - enable(channel) { - this.mask |= 1 << channel | 0; - } - enableAll() { - this.mask = 4294967295 | 0; - } - toggle(channel) { - this.mask ^= 1 << channel | 0; - } - disable(channel) { - this.mask &= ~(1 << channel | 0); - } - disableAll() { - this.mask = 0; - } - test(layers) { - return (this.mask & layers.mask) !== 0; - } - isEnabled(channel) { - return (this.mask & (1 << channel | 0)) !== 0; - } -}; -var _object3DId = 0; -var _v1$4 = new Vector3(); -var _q1 = new Quaternion(); -var _m1$1 = new Matrix4(); -var _target = new Vector3(); -var _position$3 = new Vector3(); -var _scale$2 = new Vector3(); -var _quaternion$2 = new Quaternion(); -var _xAxis = new Vector3(1, 0, 0); -var _yAxis = new Vector3(0, 1, 0); -var _zAxis = new Vector3(0, 0, 1); -var _addedEvent = { type: "added" }; -var _removedEvent = { type: "removed" }; -var Object3D = class _Object3D extends EventDispatcher { - constructor() { - super(); - this.isObject3D = true; - Object.defineProperty(this, "id", { value: _object3DId++ }); - this.uuid = generateUUID(); - this.name = ""; - this.type = "Object3D"; - this.parent = null; - this.children = []; - this.up = _Object3D.DEFAULT_UP.clone(); - const position = new Vector3(); - const rotation = new Euler(); - const quaternion = new Quaternion(); - const scale = new Vector3(1, 1, 1); - function onRotationChange() { - quaternion.setFromEuler(rotation, false); - } - function onQuaternionChange() { - rotation.setFromQuaternion(quaternion, void 0, false); - } - rotation._onChange(onRotationChange); - quaternion._onChange(onQuaternionChange); - Object.defineProperties(this, { - position: { - configurable: true, - enumerable: true, - value: position - }, - rotation: { - configurable: true, - enumerable: true, - value: rotation - }, - quaternion: { - configurable: true, - enumerable: true, - value: quaternion - }, - scale: { - configurable: true, - enumerable: true, - value: scale - }, - modelViewMatrix: { - value: new Matrix4() - }, - normalMatrix: { - value: new Matrix3() - } - }); - this.matrix = new Matrix4(); - this.matrixWorld = new Matrix4(); - this.matrixAutoUpdate = _Object3D.DEFAULT_MATRIX_AUTO_UPDATE; - this.matrixWorldNeedsUpdate = false; - this.matrixWorldAutoUpdate = _Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; - this.layers = new Layers(); - this.visible = true; - this.castShadow = false; - this.receiveShadow = false; - this.frustumCulled = true; - this.renderOrder = 0; - this.animations = []; - this.userData = {}; - } - onBeforeRender() { - } - onAfterRender() { - } - applyMatrix4(matrix) { - if (this.matrixAutoUpdate) - this.updateMatrix(); - this.matrix.premultiply(matrix); - this.matrix.decompose(this.position, this.quaternion, this.scale); - } - applyQuaternion(q) { - this.quaternion.premultiply(q); - return this; - } - setRotationFromAxisAngle(axis, angle) { - this.quaternion.setFromAxisAngle(axis, angle); - } - setRotationFromEuler(euler) { - this.quaternion.setFromEuler(euler, true); - } - setRotationFromMatrix(m) { - this.quaternion.setFromRotationMatrix(m); - } - setRotationFromQuaternion(q) { - this.quaternion.copy(q); - } - rotateOnAxis(axis, angle) { - _q1.setFromAxisAngle(axis, angle); - this.quaternion.multiply(_q1); - return this; - } - rotateOnWorldAxis(axis, angle) { - _q1.setFromAxisAngle(axis, angle); - this.quaternion.premultiply(_q1); - return this; - } - rotateX(angle) { - return this.rotateOnAxis(_xAxis, angle); - } - rotateY(angle) { - return this.rotateOnAxis(_yAxis, angle); - } - rotateZ(angle) { - return this.rotateOnAxis(_zAxis, angle); - } - translateOnAxis(axis, distance) { - _v1$4.copy(axis).applyQuaternion(this.quaternion); - this.position.add(_v1$4.multiplyScalar(distance)); - return this; - } - translateX(distance) { - return this.translateOnAxis(_xAxis, distance); - } - translateY(distance) { - return this.translateOnAxis(_yAxis, distance); - } - translateZ(distance) { - return this.translateOnAxis(_zAxis, distance); - } - localToWorld(vector) { - this.updateWorldMatrix(true, false); - return vector.applyMatrix4(this.matrixWorld); - } - worldToLocal(vector) { - this.updateWorldMatrix(true, false); - return vector.applyMatrix4(_m1$1.copy(this.matrixWorld).invert()); - } - lookAt(x, y, z) { - if (x.isVector3) { - _target.copy(x); - } else { - _target.set(x, y, z); - } - const parent = this.parent; - this.updateWorldMatrix(true, false); - _position$3.setFromMatrixPosition(this.matrixWorld); - if (this.isCamera || this.isLight) { - _m1$1.lookAt(_position$3, _target, this.up); - } else { - _m1$1.lookAt(_target, _position$3, this.up); - } - this.quaternion.setFromRotationMatrix(_m1$1); - if (parent) { - _m1$1.extractRotation(parent.matrixWorld); - _q1.setFromRotationMatrix(_m1$1); - this.quaternion.premultiply(_q1.invert()); - } - } - add(object) { - if (arguments.length > 1) { - for (let i = 0; i < arguments.length; i++) { - this.add(arguments[i]); - } - return this; - } - if (object === this) { - console.error("THREE.Object3D.add: object can't be added as a child of itself.", object); - return this; - } - if (object && object.isObject3D) { - if (object.parent !== null) { - object.parent.remove(object); - } - object.parent = this; - this.children.push(object); - object.dispatchEvent(_addedEvent); - } else { - console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", object); - } - return this; - } - remove(object) { - if (arguments.length > 1) { - for (let i = 0; i < arguments.length; i++) { - this.remove(arguments[i]); - } - return this; - } - const index = this.children.indexOf(object); - if (index !== -1) { - object.parent = null; - this.children.splice(index, 1); - object.dispatchEvent(_removedEvent); - } - return this; - } - removeFromParent() { - const parent = this.parent; - if (parent !== null) { - parent.remove(this); - } - return this; - } - clear() { - return this.remove(...this.children); - } - attach(object) { - this.updateWorldMatrix(true, false); - _m1$1.copy(this.matrixWorld).invert(); - if (object.parent !== null) { - object.parent.updateWorldMatrix(true, false); - _m1$1.multiply(object.parent.matrixWorld); - } - object.applyMatrix4(_m1$1); - this.add(object); - object.updateWorldMatrix(false, true); - return this; - } - getObjectById(id) { - return this.getObjectByProperty("id", id); - } - getObjectByName(name) { - return this.getObjectByProperty("name", name); - } - getObjectByProperty(name, value) { - if (this[name] === value) - return this; - for (let i = 0, l = this.children.length; i < l; i++) { - const child = this.children[i]; - const object = child.getObjectByProperty(name, value); - if (object !== void 0) { - return object; - } - } - return void 0; - } - getObjectsByProperty(name, value) { - let result = []; - if (this[name] === value) - result.push(this); - for (let i = 0, l = this.children.length; i < l; i++) { - const childResult = this.children[i].getObjectsByProperty(name, value); - if (childResult.length > 0) { - result = result.concat(childResult); - } - } - return result; - } - getWorldPosition(target) { - this.updateWorldMatrix(true, false); - return target.setFromMatrixPosition(this.matrixWorld); - } - getWorldQuaternion(target) { - this.updateWorldMatrix(true, false); - this.matrixWorld.decompose(_position$3, target, _scale$2); - return target; - } - getWorldScale(target) { - this.updateWorldMatrix(true, false); - this.matrixWorld.decompose(_position$3, _quaternion$2, target); - return target; - } - getWorldDirection(target) { - this.updateWorldMatrix(true, false); - const e = this.matrixWorld.elements; - return target.set(e[8], e[9], e[10]).normalize(); - } - raycast() { - } - traverse(callback) { - callback(this); - const children = this.children; - for (let i = 0, l = children.length; i < l; i++) { - children[i].traverse(callback); - } - } - traverseVisible(callback) { - if (this.visible === false) - return; - callback(this); - const children = this.children; - for (let i = 0, l = children.length; i < l; i++) { - children[i].traverseVisible(callback); - } - } - traverseAncestors(callback) { - const parent = this.parent; - if (parent !== null) { - callback(parent); - parent.traverseAncestors(callback); - } - } - updateMatrix() { - this.matrix.compose(this.position, this.quaternion, this.scale); - this.matrixWorldNeedsUpdate = true; - } - updateMatrixWorld(force) { - if (this.matrixAutoUpdate) - this.updateMatrix(); - if (this.matrixWorldNeedsUpdate || force) { - if (this.parent === null) { - this.matrixWorld.copy(this.matrix); - } else { - this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix); - } - this.matrixWorldNeedsUpdate = false; - force = true; - } - const children = this.children; - for (let i = 0, l = children.length; i < l; i++) { - const child = children[i]; - if (child.matrixWorldAutoUpdate === true || force === true) { - child.updateMatrixWorld(force); - } - } - } - updateWorldMatrix(updateParents, updateChildren) { - const parent = this.parent; - if (updateParents === true && parent !== null && parent.matrixWorldAutoUpdate === true) { - parent.updateWorldMatrix(true, false); - } - if (this.matrixAutoUpdate) - this.updateMatrix(); - if (this.parent === null) { - this.matrixWorld.copy(this.matrix); - } else { - this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix); - } - if (updateChildren === true) { - const children = this.children; - for (let i = 0, l = children.length; i < l; i++) { - const child = children[i]; - if (child.matrixWorldAutoUpdate === true) { - child.updateWorldMatrix(false, true); - } - } - } - } - toJSON(meta) { - const isRootObject = meta === void 0 || typeof meta === "string"; - const output = {}; - if (isRootObject) { - meta = { - geometries: {}, - materials: {}, - textures: {}, - images: {}, - shapes: {}, - skeletons: {}, - animations: {}, - nodes: {} - }; - output.metadata = { - version: 4.6, - type: "Object", - generator: "Object3D.toJSON" - }; - } - const object = {}; - object.uuid = this.uuid; - object.type = this.type; - if (this.name !== "") - object.name = this.name; - if (this.castShadow === true) - object.castShadow = true; - if (this.receiveShadow === true) - object.receiveShadow = true; - if (this.visible === false) - object.visible = false; - if (this.frustumCulled === false) - object.frustumCulled = false; - if (this.renderOrder !== 0) - object.renderOrder = this.renderOrder; - if (Object.keys(this.userData).length > 0) - object.userData = this.userData; - object.layers = this.layers.mask; - object.matrix = this.matrix.toArray(); - object.up = this.up.toArray(); - if (this.matrixAutoUpdate === false) - object.matrixAutoUpdate = false; - if (this.isInstancedMesh) { - object.type = "InstancedMesh"; - object.count = this.count; - object.instanceMatrix = this.instanceMatrix.toJSON(); - if (this.instanceColor !== null) - object.instanceColor = this.instanceColor.toJSON(); - } - function serialize(library, element) { - if (library[element.uuid] === void 0) { - library[element.uuid] = element.toJSON(meta); - } - return element.uuid; - } - if (this.isScene) { - if (this.background) { - if (this.background.isColor) { - object.background = this.background.toJSON(); - } else if (this.background.isTexture) { - object.background = this.background.toJSON(meta).uuid; - } - } - if (this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== true) { - object.environment = this.environment.toJSON(meta).uuid; - } - } else if (this.isMesh || this.isLine || this.isPoints) { - object.geometry = serialize(meta.geometries, this.geometry); - const parameters = this.geometry.parameters; - if (parameters !== void 0 && parameters.shapes !== void 0) { - const shapes = parameters.shapes; - if (Array.isArray(shapes)) { - for (let i = 0, l = shapes.length; i < l; i++) { - const shape = shapes[i]; - serialize(meta.shapes, shape); - } - } else { - serialize(meta.shapes, shapes); - } - } - } - if (this.isSkinnedMesh) { - object.bindMode = this.bindMode; - object.bindMatrix = this.bindMatrix.toArray(); - if (this.skeleton !== void 0) { - serialize(meta.skeletons, this.skeleton); - object.skeleton = this.skeleton.uuid; - } - } - if (this.material !== void 0) { - if (Array.isArray(this.material)) { - const uuids = []; - for (let i = 0, l = this.material.length; i < l; i++) { - uuids.push(serialize(meta.materials, this.material[i])); - } - object.material = uuids; - } else { - object.material = serialize(meta.materials, this.material); - } - } - if (this.children.length > 0) { - object.children = []; - for (let i = 0; i < this.children.length; i++) { - object.children.push(this.children[i].toJSON(meta).object); - } - } - if (this.animations.length > 0) { - object.animations = []; - for (let i = 0; i < this.animations.length; i++) { - const animation = this.animations[i]; - object.animations.push(serialize(meta.animations, animation)); - } - } - if (isRootObject) { - const geometries = extractFromCache(meta.geometries); - const materials = extractFromCache(meta.materials); - const textures = extractFromCache(meta.textures); - const images = extractFromCache(meta.images); - const shapes = extractFromCache(meta.shapes); - const skeletons = extractFromCache(meta.skeletons); - const animations = extractFromCache(meta.animations); - const nodes = extractFromCache(meta.nodes); - if (geometries.length > 0) - output.geometries = geometries; - if (materials.length > 0) - output.materials = materials; - if (textures.length > 0) - output.textures = textures; - if (images.length > 0) - output.images = images; - if (shapes.length > 0) - output.shapes = shapes; - if (skeletons.length > 0) - output.skeletons = skeletons; - if (animations.length > 0) - output.animations = animations; - if (nodes.length > 0) - output.nodes = nodes; - } - output.object = object; - return output; - function extractFromCache(cache) { - const values = []; - for (const key in cache) { - const data = cache[key]; - delete data.metadata; - values.push(data); - } - return values; - } - } - clone(recursive) { - return new this.constructor().copy(this, recursive); - } - copy(source, recursive = true) { - this.name = source.name; - this.up.copy(source.up); - this.position.copy(source.position); - this.rotation.order = source.rotation.order; - this.quaternion.copy(source.quaternion); - this.scale.copy(source.scale); - this.matrix.copy(source.matrix); - this.matrixWorld.copy(source.matrixWorld); - this.matrixAutoUpdate = source.matrixAutoUpdate; - this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate; - this.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate; - this.layers.mask = source.layers.mask; - this.visible = source.visible; - this.castShadow = source.castShadow; - this.receiveShadow = source.receiveShadow; - this.frustumCulled = source.frustumCulled; - this.renderOrder = source.renderOrder; - this.animations = source.animations.slice(); - this.userData = JSON.parse(JSON.stringify(source.userData)); - if (recursive === true) { - for (let i = 0; i < source.children.length; i++) { - const child = source.children[i]; - this.add(child.clone()); - } - } - return this; - } -}; -Object3D.DEFAULT_UP = new Vector3(0, 1, 0); -Object3D.DEFAULT_MATRIX_AUTO_UPDATE = true; -Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true; -var _v0$1 = new Vector3(); -var _v1$3 = new Vector3(); -var _v2$2 = new Vector3(); -var _v3$1 = new Vector3(); -var _vab = new Vector3(); -var _vac = new Vector3(); -var _vbc = new Vector3(); -var _vap = new Vector3(); -var _vbp = new Vector3(); -var _vcp = new Vector3(); -var warnedGetUV = false; -var Triangle = class _Triangle { - constructor(a = new Vector3(), b = new Vector3(), c = new Vector3()) { - this.a = a; - this.b = b; - this.c = c; - } - static getNormal(a, b, c, target) { - target.subVectors(c, b); - _v0$1.subVectors(a, b); - target.cross(_v0$1); - const targetLengthSq = target.lengthSq(); - if (targetLengthSq > 0) { - return target.multiplyScalar(1 / Math.sqrt(targetLengthSq)); - } - return target.set(0, 0, 0); - } - // static/instance method to calculate barycentric coordinates - // based on: http://www.blackpawn.com/texts/pointinpoly/default.html - static getBarycoord(point, a, b, c, target) { - _v0$1.subVectors(c, a); - _v1$3.subVectors(b, a); - _v2$2.subVectors(point, a); - const dot00 = _v0$1.dot(_v0$1); - const dot01 = _v0$1.dot(_v1$3); - const dot02 = _v0$1.dot(_v2$2); - const dot11 = _v1$3.dot(_v1$3); - const dot12 = _v1$3.dot(_v2$2); - const denom = dot00 * dot11 - dot01 * dot01; - if (denom === 0) { - return target.set(-2, -1, -1); - } - const invDenom = 1 / denom; - const u = (dot11 * dot02 - dot01 * dot12) * invDenom; - const v = (dot00 * dot12 - dot01 * dot02) * invDenom; - return target.set(1 - u - v, v, u); - } - static containsPoint(point, a, b, c) { - this.getBarycoord(point, a, b, c, _v3$1); - return _v3$1.x >= 0 && _v3$1.y >= 0 && _v3$1.x + _v3$1.y <= 1; - } - static getUV(point, p1, p2, p3, uv1, uv2, uv3, target) { - if (warnedGetUV === false) { - console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."); - warnedGetUV = true; - } - return this.getInterpolation(point, p1, p2, p3, uv1, uv2, uv3, target); - } - static getInterpolation(point, p1, p2, p3, v1, v2, v3, target) { - this.getBarycoord(point, p1, p2, p3, _v3$1); - target.setScalar(0); - target.addScaledVector(v1, _v3$1.x); - target.addScaledVector(v2, _v3$1.y); - target.addScaledVector(v3, _v3$1.z); - return target; - } - static isFrontFacing(a, b, c, direction) { - _v0$1.subVectors(c, b); - _v1$3.subVectors(a, b); - return _v0$1.cross(_v1$3).dot(direction) < 0 ? true : false; - } - set(a, b, c) { - this.a.copy(a); - this.b.copy(b); - this.c.copy(c); - return this; - } - setFromPointsAndIndices(points, i0, i1, i2) { - this.a.copy(points[i0]); - this.b.copy(points[i1]); - this.c.copy(points[i2]); - return this; - } - setFromAttributeAndIndices(attribute, i0, i1, i2) { - this.a.fromBufferAttribute(attribute, i0); - this.b.fromBufferAttribute(attribute, i1); - this.c.fromBufferAttribute(attribute, i2); - return this; - } - clone() { - return new this.constructor().copy(this); - } - copy(triangle) { - this.a.copy(triangle.a); - this.b.copy(triangle.b); - this.c.copy(triangle.c); - return this; - } - getArea() { - _v0$1.subVectors(this.c, this.b); - _v1$3.subVectors(this.a, this.b); - return _v0$1.cross(_v1$3).length() * 0.5; - } - getMidpoint(target) { - return target.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3); - } - getNormal(target) { - return _Triangle.getNormal(this.a, this.b, this.c, target); - } - getPlane(target) { - return target.setFromCoplanarPoints(this.a, this.b, this.c); - } - getBarycoord(point, target) { - return _Triangle.getBarycoord(point, this.a, this.b, this.c, target); - } - getUV(point, uv1, uv2, uv3, target) { - if (warnedGetUV === false) { - console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."); - warnedGetUV = true; - } - return _Triangle.getInterpolation(point, this.a, this.b, this.c, uv1, uv2, uv3, target); - } - getInterpolation(point, v1, v2, v3, target) { - return _Triangle.getInterpolation(point, this.a, this.b, this.c, v1, v2, v3, target); - } - containsPoint(point) { - return _Triangle.containsPoint(point, this.a, this.b, this.c); - } - isFrontFacing(direction) { - return _Triangle.isFrontFacing(this.a, this.b, this.c, direction); - } - intersectsBox(box) { - return box.intersectsTriangle(this); - } - closestPointToPoint(p, target) { - const a = this.a, b = this.b, c = this.c; - let v, w; - _vab.subVectors(b, a); - _vac.subVectors(c, a); - _vap.subVectors(p, a); - const d1 = _vab.dot(_vap); - const d2 = _vac.dot(_vap); - if (d1 <= 0 && d2 <= 0) { - return target.copy(a); - } - _vbp.subVectors(p, b); - const d3 = _vab.dot(_vbp); - const d4 = _vac.dot(_vbp); - if (d3 >= 0 && d4 <= d3) { - return target.copy(b); - } - const vc = d1 * d4 - d3 * d2; - if (vc <= 0 && d1 >= 0 && d3 <= 0) { - v = d1 / (d1 - d3); - return target.copy(a).addScaledVector(_vab, v); - } - _vcp.subVectors(p, c); - const d5 = _vab.dot(_vcp); - const d6 = _vac.dot(_vcp); - if (d6 >= 0 && d5 <= d6) { - return target.copy(c); - } - const vb = d5 * d2 - d1 * d6; - if (vb <= 0 && d2 >= 0 && d6 <= 0) { - w = d2 / (d2 - d6); - return target.copy(a).addScaledVector(_vac, w); - } - const va = d3 * d6 - d5 * d4; - if (va <= 0 && d4 - d3 >= 0 && d5 - d6 >= 0) { - _vbc.subVectors(c, b); - w = (d4 - d3) / (d4 - d3 + (d5 - d6)); - return target.copy(b).addScaledVector(_vbc, w); - } - const denom = 1 / (va + vb + vc); - v = vb * denom; - w = vc * denom; - return target.copy(a).addScaledVector(_vab, v).addScaledVector(_vac, w); - } - equals(triangle) { - return triangle.a.equals(this.a) && triangle.b.equals(this.b) && triangle.c.equals(this.c); - } -}; -var _colorKeywords = { - "aliceblue": 15792383, - "antiquewhite": 16444375, - "aqua": 65535, - "aquamarine": 8388564, - "azure": 15794175, - "beige": 16119260, - "bisque": 16770244, - "black": 0, - "blanchedalmond": 16772045, - "blue": 255, - "blueviolet": 9055202, - "brown": 10824234, - "burlywood": 14596231, - "cadetblue": 6266528, - "chartreuse": 8388352, - "chocolate": 13789470, - "coral": 16744272, - "cornflowerblue": 6591981, - "cornsilk": 16775388, - "crimson": 14423100, - "cyan": 65535, - "darkblue": 139, - "darkcyan": 35723, - "darkgoldenrod": 12092939, - "darkgray": 11119017, - "darkgreen": 25600, - "darkgrey": 11119017, - "darkkhaki": 12433259, - "darkmagenta": 9109643, - "darkolivegreen": 5597999, - "darkorange": 16747520, - "darkorchid": 10040012, - "darkred": 9109504, - "darksalmon": 15308410, - "darkseagreen": 9419919, - "darkslateblue": 4734347, - "darkslategray": 3100495, - "darkslategrey": 3100495, - "darkturquoise": 52945, - "darkviolet": 9699539, - "deeppink": 16716947, - "deepskyblue": 49151, - "dimgray": 6908265, - "dimgrey": 6908265, - "dodgerblue": 2003199, - "firebrick": 11674146, - "floralwhite": 16775920, - "forestgreen": 2263842, - "fuchsia": 16711935, - "gainsboro": 14474460, - "ghostwhite": 16316671, - "gold": 16766720, - "goldenrod": 14329120, - "gray": 8421504, - "green": 32768, - "greenyellow": 11403055, - "grey": 8421504, - "honeydew": 15794160, - "hotpink": 16738740, - "indianred": 13458524, - "indigo": 4915330, - "ivory": 16777200, - "khaki": 15787660, - "lavender": 15132410, - "lavenderblush": 16773365, - "lawngreen": 8190976, - "lemonchiffon": 16775885, - "lightblue": 11393254, - "lightcoral": 15761536, - "lightcyan": 14745599, - "lightgoldenrodyellow": 16448210, - "lightgray": 13882323, - "lightgreen": 9498256, - "lightgrey": 13882323, - "lightpink": 16758465, - "lightsalmon": 16752762, - "lightseagreen": 2142890, - "lightskyblue": 8900346, - "lightslategray": 7833753, - "lightslategrey": 7833753, - "lightsteelblue": 11584734, - "lightyellow": 16777184, - "lime": 65280, - "limegreen": 3329330, - "linen": 16445670, - "magenta": 16711935, - "maroon": 8388608, - "mediumaquamarine": 6737322, - "mediumblue": 205, - "mediumorchid": 12211667, - "mediumpurple": 9662683, - "mediumseagreen": 3978097, - "mediumslateblue": 8087790, - "mediumspringgreen": 64154, - "mediumturquoise": 4772300, - "mediumvioletred": 13047173, - "midnightblue": 1644912, - "mintcream": 16121850, - "mistyrose": 16770273, - "moccasin": 16770229, - "navajowhite": 16768685, - "navy": 128, - "oldlace": 16643558, - "olive": 8421376, - "olivedrab": 7048739, - "orange": 16753920, - "orangered": 16729344, - "orchid": 14315734, - "palegoldenrod": 15657130, - "palegreen": 10025880, - "paleturquoise": 11529966, - "palevioletred": 14381203, - "papayawhip": 16773077, - "peachpuff": 16767673, - "peru": 13468991, - "pink": 16761035, - "plum": 14524637, - "powderblue": 11591910, - "purple": 8388736, - "rebeccapurple": 6697881, - "red": 16711680, - "rosybrown": 12357519, - "royalblue": 4286945, - "saddlebrown": 9127187, - "salmon": 16416882, - "sandybrown": 16032864, - "seagreen": 3050327, - "seashell": 16774638, - "sienna": 10506797, - "silver": 12632256, - "skyblue": 8900331, - "slateblue": 6970061, - "slategray": 7372944, - "slategrey": 7372944, - "snow": 16775930, - "springgreen": 65407, - "steelblue": 4620980, - "tan": 13808780, - "teal": 32896, - "thistle": 14204888, - "tomato": 16737095, - "turquoise": 4251856, - "violet": 15631086, - "wheat": 16113331, - "white": 16777215, - "whitesmoke": 16119285, - "yellow": 16776960, - "yellowgreen": 10145074 -}; -var _hslA = { h: 0, s: 0, l: 0 }; -var _hslB = { h: 0, s: 0, l: 0 }; -function hue2rgb(p, q, t) { - if (t < 0) - t += 1; - if (t > 1) - t -= 1; - if (t < 1 / 6) - return p + (q - p) * 6 * t; - if (t < 1 / 2) - return q; - if (t < 2 / 3) - return p + (q - p) * 6 * (2 / 3 - t); - return p; -} -var Color = class { - constructor(r, g, b) { - this.isColor = true; - this.r = 1; - this.g = 1; - this.b = 1; - return this.set(r, g, b); - } - set(r, g, b) { - if (g === void 0 && b === void 0) { - const value = r; - if (value && value.isColor) { - this.copy(value); - } else if (typeof value === "number") { - this.setHex(value); - } else if (typeof value === "string") { - this.setStyle(value); - } - } else { - this.setRGB(r, g, b); - } - return this; - } - setScalar(scalar) { - this.r = scalar; - this.g = scalar; - this.b = scalar; - return this; - } - setHex(hex, colorSpace = SRGBColorSpace) { - hex = Math.floor(hex); - this.r = (hex >> 16 & 255) / 255; - this.g = (hex >> 8 & 255) / 255; - this.b = (hex & 255) / 255; - ColorManagement.toWorkingColorSpace(this, colorSpace); - return this; - } - setRGB(r, g, b, colorSpace = ColorManagement.workingColorSpace) { - this.r = r; - this.g = g; - this.b = b; - ColorManagement.toWorkingColorSpace(this, colorSpace); - return this; - } - setHSL(h, s, l, colorSpace = ColorManagement.workingColorSpace) { - h = euclideanModulo(h, 1); - s = clamp(s, 0, 1); - l = clamp(l, 0, 1); - if (s === 0) { - this.r = this.g = this.b = l; - } else { - const p = l <= 0.5 ? l * (1 + s) : l + s - l * s; - const q = 2 * l - p; - this.r = hue2rgb(q, p, h + 1 / 3); - this.g = hue2rgb(q, p, h); - this.b = hue2rgb(q, p, h - 1 / 3); - } - ColorManagement.toWorkingColorSpace(this, colorSpace); - return this; - } - setStyle(style, colorSpace = SRGBColorSpace) { - function handleAlpha(string) { - if (string === void 0) - return; - if (parseFloat(string) < 1) { - console.warn("THREE.Color: Alpha component of " + style + " will be ignored."); - } - } - let m; - if (m = /^(\w+)\(([^\)]*)\)/.exec(style)) { - let color; - const name = m[1]; - const components = m[2]; - switch (name) { - case "rgb": - case "rgba": - if (color = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) { - handleAlpha(color[4]); - return this.setRGB( - Math.min(255, parseInt(color[1], 10)) / 255, - Math.min(255, parseInt(color[2], 10)) / 255, - Math.min(255, parseInt(color[3], 10)) / 255, - colorSpace - ); - } - if (color = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) { - handleAlpha(color[4]); - return this.setRGB( - Math.min(100, parseInt(color[1], 10)) / 100, - Math.min(100, parseInt(color[2], 10)) / 100, - Math.min(100, parseInt(color[3], 10)) / 100, - colorSpace - ); - } - break; - case "hsl": - case "hsla": - if (color = /^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) { - handleAlpha(color[4]); - return this.setHSL( - parseFloat(color[1]) / 360, - parseFloat(color[2]) / 100, - parseFloat(color[3]) / 100, - colorSpace - ); - } - break; - default: - console.warn("THREE.Color: Unknown color model " + style); - } - } else if (m = /^\#([A-Fa-f\d]+)$/.exec(style)) { - const hex = m[1]; - const size = hex.length; - if (size === 3) { - return this.setRGB( - parseInt(hex.charAt(0), 16) / 15, - parseInt(hex.charAt(1), 16) / 15, - parseInt(hex.charAt(2), 16) / 15, - colorSpace - ); - } else if (size === 6) { - return this.setHex(parseInt(hex, 16), colorSpace); - } else { - console.warn("THREE.Color: Invalid hex color " + style); - } - } else if (style && style.length > 0) { - return this.setColorName(style, colorSpace); - } - return this; - } - setColorName(style, colorSpace = SRGBColorSpace) { - const hex = _colorKeywords[style.toLowerCase()]; - if (hex !== void 0) { - this.setHex(hex, colorSpace); - } else { - console.warn("THREE.Color: Unknown color " + style); - } - return this; - } - clone() { - return new this.constructor(this.r, this.g, this.b); - } - copy(color) { - this.r = color.r; - this.g = color.g; - this.b = color.b; - return this; - } - copySRGBToLinear(color) { - this.r = SRGBToLinear(color.r); - this.g = SRGBToLinear(color.g); - this.b = SRGBToLinear(color.b); - return this; - } - copyLinearToSRGB(color) { - this.r = LinearToSRGB(color.r); - this.g = LinearToSRGB(color.g); - this.b = LinearToSRGB(color.b); - return this; - } - convertSRGBToLinear() { - this.copySRGBToLinear(this); - return this; - } - convertLinearToSRGB() { - this.copyLinearToSRGB(this); - return this; - } - getHex(colorSpace = SRGBColorSpace) { - ColorManagement.fromWorkingColorSpace(_color.copy(this), colorSpace); - return Math.round(clamp(_color.r * 255, 0, 255)) * 65536 + Math.round(clamp(_color.g * 255, 0, 255)) * 256 + Math.round(clamp(_color.b * 255, 0, 255)); - } - getHexString(colorSpace = SRGBColorSpace) { - return ("000000" + this.getHex(colorSpace).toString(16)).slice(-6); - } - getHSL(target, colorSpace = ColorManagement.workingColorSpace) { - ColorManagement.fromWorkingColorSpace(_color.copy(this), colorSpace); - const r = _color.r, g = _color.g, b = _color.b; - const max = Math.max(r, g, b); - const min = Math.min(r, g, b); - let hue, saturation; - const lightness = (min + max) / 2; - if (min === max) { - hue = 0; - saturation = 0; - } else { - const delta = max - min; - saturation = lightness <= 0.5 ? delta / (max + min) : delta / (2 - max - min); - switch (max) { - case r: - hue = (g - b) / delta + (g < b ? 6 : 0); - break; - case g: - hue = (b - r) / delta + 2; - break; - case b: - hue = (r - g) / delta + 4; - break; - } - hue /= 6; - } - target.h = hue; - target.s = saturation; - target.l = lightness; - return target; - } - getRGB(target, colorSpace = ColorManagement.workingColorSpace) { - ColorManagement.fromWorkingColorSpace(_color.copy(this), colorSpace); - target.r = _color.r; - target.g = _color.g; - target.b = _color.b; - return target; - } - getStyle(colorSpace = SRGBColorSpace) { - ColorManagement.fromWorkingColorSpace(_color.copy(this), colorSpace); - const r = _color.r, g = _color.g, b = _color.b; - if (colorSpace !== SRGBColorSpace) { - return `color(${colorSpace} ${r.toFixed(3)} ${g.toFixed(3)} ${b.toFixed(3)})`; - } - return `rgb(${Math.round(r * 255)},${Math.round(g * 255)},${Math.round(b * 255)})`; - } - offsetHSL(h, s, l) { - this.getHSL(_hslA); - return this.setHSL(_hslA.h + h, _hslA.s + s, _hslA.l + l); - } - add(color) { - this.r += color.r; - this.g += color.g; - this.b += color.b; - return this; - } - addColors(color1, color2) { - this.r = color1.r + color2.r; - this.g = color1.g + color2.g; - this.b = color1.b + color2.b; - return this; - } - addScalar(s) { - this.r += s; - this.g += s; - this.b += s; - return this; - } - sub(color) { - this.r = Math.max(0, this.r - color.r); - this.g = Math.max(0, this.g - color.g); - this.b = Math.max(0, this.b - color.b); - return this; - } - multiply(color) { - this.r *= color.r; - this.g *= color.g; - this.b *= color.b; - return this; - } - multiplyScalar(s) { - this.r *= s; - this.g *= s; - this.b *= s; - return this; - } - lerp(color, alpha) { - this.r += (color.r - this.r) * alpha; - this.g += (color.g - this.g) * alpha; - this.b += (color.b - this.b) * alpha; - return this; - } - lerpColors(color1, color2, alpha) { - this.r = color1.r + (color2.r - color1.r) * alpha; - this.g = color1.g + (color2.g - color1.g) * alpha; - this.b = color1.b + (color2.b - color1.b) * alpha; - return this; - } - lerpHSL(color, alpha) { - this.getHSL(_hslA); - color.getHSL(_hslB); - const h = lerp(_hslA.h, _hslB.h, alpha); - const s = lerp(_hslA.s, _hslB.s, alpha); - const l = lerp(_hslA.l, _hslB.l, alpha); - this.setHSL(h, s, l); - return this; - } - setFromVector3(v) { - this.r = v.x; - this.g = v.y; - this.b = v.z; - return this; - } - applyMatrix3(m) { - const r = this.r, g = this.g, b = this.b; - const e = m.elements; - this.r = e[0] * r + e[3] * g + e[6] * b; - this.g = e[1] * r + e[4] * g + e[7] * b; - this.b = e[2] * r + e[5] * g + e[8] * b; - return this; - } - equals(c) { - return c.r === this.r && c.g === this.g && c.b === this.b; - } - fromArray(array, offset = 0) { - this.r = array[offset]; - this.g = array[offset + 1]; - this.b = array[offset + 2]; - return this; - } - toArray(array = [], offset = 0) { - array[offset] = this.r; - array[offset + 1] = this.g; - array[offset + 2] = this.b; - return array; - } - fromBufferAttribute(attribute, index) { - this.r = attribute.getX(index); - this.g = attribute.getY(index); - this.b = attribute.getZ(index); - return this; - } - toJSON() { - return this.getHex(); - } - *[Symbol.iterator]() { - yield this.r; - yield this.g; - yield this.b; - } -}; -var _color = new Color(); -Color.NAMES = _colorKeywords; -var _materialId = 0; -var Material = class extends EventDispatcher { - constructor() { - super(); - this.isMaterial = true; - Object.defineProperty(this, "id", { value: _materialId++ }); - this.uuid = generateUUID(); - this.name = ""; - this.type = "Material"; - this.blending = NormalBlending; - this.side = FrontSide; - this.vertexColors = false; - this.opacity = 1; - this.transparent = false; - this.alphaHash = false; - this.blendSrc = SrcAlphaFactor; - this.blendDst = OneMinusSrcAlphaFactor; - this.blendEquation = AddEquation; - this.blendSrcAlpha = null; - this.blendDstAlpha = null; - this.blendEquationAlpha = null; - this.blendColor = new Color(0, 0, 0); - this.blendAlpha = 0; - this.depthFunc = LessEqualDepth; - this.depthTest = true; - this.depthWrite = true; - this.stencilWriteMask = 255; - this.stencilFunc = AlwaysStencilFunc; - this.stencilRef = 0; - this.stencilFuncMask = 255; - this.stencilFail = KeepStencilOp; - this.stencilZFail = KeepStencilOp; - this.stencilZPass = KeepStencilOp; - this.stencilWrite = false; - this.clippingPlanes = null; - this.clipIntersection = false; - this.clipShadows = false; - this.shadowSide = null; - this.colorWrite = true; - this.precision = null; - this.polygonOffset = false; - this.polygonOffsetFactor = 0; - this.polygonOffsetUnits = 0; - this.dithering = false; - this.alphaToCoverage = false; - this.premultipliedAlpha = false; - this.forceSinglePass = false; - this.visible = true; - this.toneMapped = true; - this.userData = {}; - this.version = 0; - this._alphaTest = 0; - } - get alphaTest() { - return this._alphaTest; - } - set alphaTest(value) { - if (this._alphaTest > 0 !== value > 0) { - this.version++; - } - this._alphaTest = value; - } - onBuild() { - } - onBeforeRender() { - } - onBeforeCompile() { - } - customProgramCacheKey() { - return this.onBeforeCompile.toString(); - } - setValues(values) { - if (values === void 0) - return; - for (const key in values) { - const newValue = values[key]; - if (newValue === void 0) { - console.warn(`THREE.Material: parameter '${key}' has value of undefined.`); - continue; - } - const currentValue = this[key]; - if (currentValue === void 0) { - console.warn(`THREE.Material: '${key}' is not a property of THREE.${this.type}.`); - continue; - } - if (currentValue && currentValue.isColor) { - currentValue.set(newValue); - } else if (currentValue && currentValue.isVector3 && (newValue && newValue.isVector3)) { - currentValue.copy(newValue); - } else { - this[key] = newValue; - } - } - } - toJSON(meta) { - const isRootObject = meta === void 0 || typeof meta === "string"; - if (isRootObject) { - meta = { - textures: {}, - images: {} - }; - } - const data = { - metadata: { - version: 4.6, - type: "Material", - generator: "Material.toJSON" - } - }; - data.uuid = this.uuid; - data.type = this.type; - if (this.name !== "") - data.name = this.name; - if (this.color && this.color.isColor) - data.color = this.color.getHex(); - if (this.roughness !== void 0) - data.roughness = this.roughness; - if (this.metalness !== void 0) - data.metalness = this.metalness; - if (this.sheen !== void 0) - data.sheen = this.sheen; - if (this.sheenColor && this.sheenColor.isColor) - data.sheenColor = this.sheenColor.getHex(); - if (this.sheenRoughness !== void 0) - data.sheenRoughness = this.sheenRoughness; - if (this.emissive && this.emissive.isColor) - data.emissive = this.emissive.getHex(); - if (this.emissiveIntensity && this.emissiveIntensity !== 1) - data.emissiveIntensity = this.emissiveIntensity; - if (this.specular && this.specular.isColor) - data.specular = this.specular.getHex(); - if (this.specularIntensity !== void 0) - data.specularIntensity = this.specularIntensity; - if (this.specularColor && this.specularColor.isColor) - data.specularColor = this.specularColor.getHex(); - if (this.shininess !== void 0) - data.shininess = this.shininess; - if (this.clearcoat !== void 0) - data.clearcoat = this.clearcoat; - if (this.clearcoatRoughness !== void 0) - data.clearcoatRoughness = this.clearcoatRoughness; - if (this.clearcoatMap && this.clearcoatMap.isTexture) { - data.clearcoatMap = this.clearcoatMap.toJSON(meta).uuid; - } - if (this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture) { - data.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(meta).uuid; - } - if (this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture) { - data.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(meta).uuid; - data.clearcoatNormalScale = this.clearcoatNormalScale.toArray(); - } - if (this.iridescence !== void 0) - data.iridescence = this.iridescence; - if (this.iridescenceIOR !== void 0) - data.iridescenceIOR = this.iridescenceIOR; - if (this.iridescenceThicknessRange !== void 0) - data.iridescenceThicknessRange = this.iridescenceThicknessRange; - if (this.iridescenceMap && this.iridescenceMap.isTexture) { - data.iridescenceMap = this.iridescenceMap.toJSON(meta).uuid; - } - if (this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture) { - data.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON(meta).uuid; - } - if (this.anisotropy !== void 0) - data.anisotropy = this.anisotropy; - if (this.anisotropyRotation !== void 0) - data.anisotropyRotation = this.anisotropyRotation; - if (this.anisotropyMap && this.anisotropyMap.isTexture) { - data.anisotropyMap = this.anisotropyMap.toJSON(meta).uuid; - } - if (this.map && this.map.isTexture) - data.map = this.map.toJSON(meta).uuid; - if (this.matcap && this.matcap.isTexture) - data.matcap = this.matcap.toJSON(meta).uuid; - if (this.alphaMap && this.alphaMap.isTexture) - data.alphaMap = this.alphaMap.toJSON(meta).uuid; - if (this.lightMap && this.lightMap.isTexture) { - data.lightMap = this.lightMap.toJSON(meta).uuid; - data.lightMapIntensity = this.lightMapIntensity; - } - if (this.aoMap && this.aoMap.isTexture) { - data.aoMap = this.aoMap.toJSON(meta).uuid; - data.aoMapIntensity = this.aoMapIntensity; - } - if (this.bumpMap && this.bumpMap.isTexture) { - data.bumpMap = this.bumpMap.toJSON(meta).uuid; - data.bumpScale = this.bumpScale; - } - if (this.normalMap && this.normalMap.isTexture) { - data.normalMap = this.normalMap.toJSON(meta).uuid; - data.normalMapType = this.normalMapType; - data.normalScale = this.normalScale.toArray(); - } - if (this.displacementMap && this.displacementMap.isTexture) { - data.displacementMap = this.displacementMap.toJSON(meta).uuid; - data.displacementScale = this.displacementScale; - data.displacementBias = this.displacementBias; - } - if (this.roughnessMap && this.roughnessMap.isTexture) - data.roughnessMap = this.roughnessMap.toJSON(meta).uuid; - if (this.metalnessMap && this.metalnessMap.isTexture) - data.metalnessMap = this.metalnessMap.toJSON(meta).uuid; - if (this.emissiveMap && this.emissiveMap.isTexture) - data.emissiveMap = this.emissiveMap.toJSON(meta).uuid; - if (this.specularMap && this.specularMap.isTexture) - data.specularMap = this.specularMap.toJSON(meta).uuid; - if (this.specularIntensityMap && this.specularIntensityMap.isTexture) - data.specularIntensityMap = this.specularIntensityMap.toJSON(meta).uuid; - if (this.specularColorMap && this.specularColorMap.isTexture) - data.specularColorMap = this.specularColorMap.toJSON(meta).uuid; - if (this.envMap && this.envMap.isTexture) { - data.envMap = this.envMap.toJSON(meta).uuid; - if (this.combine !== void 0) - data.combine = this.combine; - } - if (this.envMapIntensity !== void 0) - data.envMapIntensity = this.envMapIntensity; - if (this.reflectivity !== void 0) - data.reflectivity = this.reflectivity; - if (this.refractionRatio !== void 0) - data.refractionRatio = this.refractionRatio; - if (this.gradientMap && this.gradientMap.isTexture) { - data.gradientMap = this.gradientMap.toJSON(meta).uuid; - } - if (this.transmission !== void 0) - data.transmission = this.transmission; - if (this.transmissionMap && this.transmissionMap.isTexture) - data.transmissionMap = this.transmissionMap.toJSON(meta).uuid; - if (this.thickness !== void 0) - data.thickness = this.thickness; - if (this.thicknessMap && this.thicknessMap.isTexture) - data.thicknessMap = this.thicknessMap.toJSON(meta).uuid; - if (this.attenuationDistance !== void 0 && this.attenuationDistance !== Infinity) - data.attenuationDistance = this.attenuationDistance; - if (this.attenuationColor !== void 0) - data.attenuationColor = this.attenuationColor.getHex(); - if (this.size !== void 0) - data.size = this.size; - if (this.shadowSide !== null) - data.shadowSide = this.shadowSide; - if (this.sizeAttenuation !== void 0) - data.sizeAttenuation = this.sizeAttenuation; - if (this.blending !== NormalBlending) - data.blending = this.blending; - if (this.side !== FrontSide) - data.side = this.side; - if (this.vertexColors === true) - data.vertexColors = true; - if (this.opacity < 1) - data.opacity = this.opacity; - if (this.transparent === true) - data.transparent = true; - if (this.blendSrc !== SrcAlphaFactor) - data.blendSrc = this.blendSrc; - if (this.blendDst !== OneMinusSrcAlphaFactor) - data.blendDst = this.blendDst; - if (this.blendEquation !== AddEquation) - data.blendEquation = this.blendEquation; - if (this.blendSrcAlpha !== null) - data.blendSrcAlpha = this.blendSrcAlpha; - if (this.blendDstAlpha !== null) - data.blendDstAlpha = this.blendDstAlpha; - if (this.blendEquationAlpha !== null) - data.blendEquationAlpha = this.blendEquationAlpha; - if (this.blendColor && this.blendColor.isColor) - data.blendColor = this.blendColor.getHex(); - if (this.blendAlpha !== 0) - data.blendAlpha = this.blendAlpha; - if (this.depthFunc !== LessEqualDepth) - data.depthFunc = this.depthFunc; - if (this.depthTest === false) - data.depthTest = this.depthTest; - if (this.depthWrite === false) - data.depthWrite = this.depthWrite; - if (this.colorWrite === false) - data.colorWrite = this.colorWrite; - if (this.stencilWriteMask !== 255) - data.stencilWriteMask = this.stencilWriteMask; - if (this.stencilFunc !== AlwaysStencilFunc) - data.stencilFunc = this.stencilFunc; - if (this.stencilRef !== 0) - data.stencilRef = this.stencilRef; - if (this.stencilFuncMask !== 255) - data.stencilFuncMask = this.stencilFuncMask; - if (this.stencilFail !== KeepStencilOp) - data.stencilFail = this.stencilFail; - if (this.stencilZFail !== KeepStencilOp) - data.stencilZFail = this.stencilZFail; - if (this.stencilZPass !== KeepStencilOp) - data.stencilZPass = this.stencilZPass; - if (this.stencilWrite === true) - data.stencilWrite = this.stencilWrite; - if (this.rotation !== void 0 && this.rotation !== 0) - data.rotation = this.rotation; - if (this.polygonOffset === true) - data.polygonOffset = true; - if (this.polygonOffsetFactor !== 0) - data.polygonOffsetFactor = this.polygonOffsetFactor; - if (this.polygonOffsetUnits !== 0) - data.polygonOffsetUnits = this.polygonOffsetUnits; - if (this.linewidth !== void 0 && this.linewidth !== 1) - data.linewidth = this.linewidth; - if (this.dashSize !== void 0) - data.dashSize = this.dashSize; - if (this.gapSize !== void 0) - data.gapSize = this.gapSize; - if (this.scale !== void 0) - data.scale = this.scale; - if (this.dithering === true) - data.dithering = true; - if (this.alphaTest > 0) - data.alphaTest = this.alphaTest; - if (this.alphaHash === true) - data.alphaHash = true; - if (this.alphaToCoverage === true) - data.alphaToCoverage = true; - if (this.premultipliedAlpha === true) - data.premultipliedAlpha = true; - if (this.forceSinglePass === true) - data.forceSinglePass = true; - if (this.wireframe === true) - data.wireframe = true; - if (this.wireframeLinewidth > 1) - data.wireframeLinewidth = this.wireframeLinewidth; - if (this.wireframeLinecap !== "round") - data.wireframeLinecap = this.wireframeLinecap; - if (this.wireframeLinejoin !== "round") - data.wireframeLinejoin = this.wireframeLinejoin; - if (this.flatShading === true) - data.flatShading = true; - if (this.visible === false) - data.visible = false; - if (this.toneMapped === false) - data.toneMapped = false; - if (this.fog === false) - data.fog = false; - if (Object.keys(this.userData).length > 0) - data.userData = this.userData; - function extractFromCache(cache) { - const values = []; - for (const key in cache) { - const data2 = cache[key]; - delete data2.metadata; - values.push(data2); - } - return values; - } - if (isRootObject) { - const textures = extractFromCache(meta.textures); - const images = extractFromCache(meta.images); - if (textures.length > 0) - data.textures = textures; - if (images.length > 0) - data.images = images; - } - return data; - } - clone() { - return new this.constructor().copy(this); - } - copy(source) { - this.name = source.name; - this.blending = source.blending; - this.side = source.side; - this.vertexColors = source.vertexColors; - this.opacity = source.opacity; - this.transparent = source.transparent; - this.blendSrc = source.blendSrc; - this.blendDst = source.blendDst; - this.blendEquation = source.blendEquation; - this.blendSrcAlpha = source.blendSrcAlpha; - this.blendDstAlpha = source.blendDstAlpha; - this.blendEquationAlpha = source.blendEquationAlpha; - this.blendColor.copy(source.blendColor); - this.blendAlpha = source.blendAlpha; - this.depthFunc = source.depthFunc; - this.depthTest = source.depthTest; - this.depthWrite = source.depthWrite; - this.stencilWriteMask = source.stencilWriteMask; - this.stencilFunc = source.stencilFunc; - this.stencilRef = source.stencilRef; - this.stencilFuncMask = source.stencilFuncMask; - this.stencilFail = source.stencilFail; - this.stencilZFail = source.stencilZFail; - this.stencilZPass = source.stencilZPass; - this.stencilWrite = source.stencilWrite; - const srcPlanes = source.clippingPlanes; - let dstPlanes = null; - if (srcPlanes !== null) { - const n = srcPlanes.length; - dstPlanes = new Array(n); - for (let i = 0; i !== n; ++i) { - dstPlanes[i] = srcPlanes[i].clone(); - } - } - this.clippingPlanes = dstPlanes; - this.clipIntersection = source.clipIntersection; - this.clipShadows = source.clipShadows; - this.shadowSide = source.shadowSide; - this.colorWrite = source.colorWrite; - this.precision = source.precision; - this.polygonOffset = source.polygonOffset; - this.polygonOffsetFactor = source.polygonOffsetFactor; - this.polygonOffsetUnits = source.polygonOffsetUnits; - this.dithering = source.dithering; - this.alphaTest = source.alphaTest; - this.alphaHash = source.alphaHash; - this.alphaToCoverage = source.alphaToCoverage; - this.premultipliedAlpha = source.premultipliedAlpha; - this.forceSinglePass = source.forceSinglePass; - this.visible = source.visible; - this.toneMapped = source.toneMapped; - this.userData = JSON.parse(JSON.stringify(source.userData)); - return this; - } - dispose() { - this.dispatchEvent({ type: "dispose" }); - } - set needsUpdate(value) { - if (value === true) - this.version++; - } -}; -var MeshBasicMaterial = class extends Material { - constructor(parameters) { - super(); - this.isMeshBasicMaterial = true; - this.type = "MeshBasicMaterial"; - this.color = new Color(16777215); - this.map = null; - this.lightMap = null; - this.lightMapIntensity = 1; - this.aoMap = null; - this.aoMapIntensity = 1; - this.specularMap = null; - this.alphaMap = null; - this.envMap = null; - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = "round"; - this.wireframeLinejoin = "round"; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.color.copy(source.color); - this.map = source.map; - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - this.specularMap = source.specularMap; - this.alphaMap = source.alphaMap; - this.envMap = source.envMap; - this.combine = source.combine; - this.reflectivity = source.reflectivity; - this.refractionRatio = source.refractionRatio; - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - this.fog = source.fog; - return this; - } -}; -var _tables = _generateTables(); -function _generateTables() { - const buffer = new ArrayBuffer(4); - const floatView = new Float32Array(buffer); - const uint32View = new Uint32Array(buffer); - const baseTable = new Uint32Array(512); - const shiftTable = new Uint32Array(512); - for (let i = 0; i < 256; ++i) { - const e = i - 127; - if (e < -27) { - baseTable[i] = 0; - baseTable[i | 256] = 32768; - shiftTable[i] = 24; - shiftTable[i | 256] = 24; - } else if (e < -14) { - baseTable[i] = 1024 >> -e - 14; - baseTable[i | 256] = 1024 >> -e - 14 | 32768; - shiftTable[i] = -e - 1; - shiftTable[i | 256] = -e - 1; - } else if (e <= 15) { - baseTable[i] = e + 15 << 10; - baseTable[i | 256] = e + 15 << 10 | 32768; - shiftTable[i] = 13; - shiftTable[i | 256] = 13; - } else if (e < 128) { - baseTable[i] = 31744; - baseTable[i | 256] = 64512; - shiftTable[i] = 24; - shiftTable[i | 256] = 24; - } else { - baseTable[i] = 31744; - baseTable[i | 256] = 64512; - shiftTable[i] = 13; - shiftTable[i | 256] = 13; - } - } - const mantissaTable = new Uint32Array(2048); - const exponentTable = new Uint32Array(64); - const offsetTable = new Uint32Array(64); - for (let i = 1; i < 1024; ++i) { - let m = i << 13; - let e = 0; - while ((m & 8388608) === 0) { - m <<= 1; - e -= 8388608; - } - m &= ~8388608; - e += 947912704; - mantissaTable[i] = m | e; - } - for (let i = 1024; i < 2048; ++i) { - mantissaTable[i] = 939524096 + (i - 1024 << 13); - } - for (let i = 1; i < 31; ++i) { - exponentTable[i] = i << 23; - } - exponentTable[31] = 1199570944; - exponentTable[32] = 2147483648; - for (let i = 33; i < 63; ++i) { - exponentTable[i] = 2147483648 + (i - 32 << 23); - } - exponentTable[63] = 3347054592; - for (let i = 1; i < 64; ++i) { - if (i !== 32) { - offsetTable[i] = 1024; - } - } - return { - floatView, - uint32View, - baseTable, - shiftTable, - mantissaTable, - exponentTable, - offsetTable - }; -} -function toHalfFloat(val) { - if (Math.abs(val) > 65504) - console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."); - val = clamp(val, -65504, 65504); - _tables.floatView[0] = val; - const f = _tables.uint32View[0]; - const e = f >> 23 & 511; - return _tables.baseTable[e] + ((f & 8388607) >> _tables.shiftTable[e]); -} -function fromHalfFloat(val) { - const m = val >> 10; - _tables.uint32View[0] = _tables.mantissaTable[_tables.offsetTable[m] + (val & 1023)] + _tables.exponentTable[m]; - return _tables.floatView[0]; -} -var DataUtils = { - toHalfFloat, - fromHalfFloat -}; -var _vector$8 = new Vector3(); -var _vector2$1 = new Vector2(); -var BufferAttribute = class { - constructor(array, itemSize, normalized = false) { - if (Array.isArray(array)) { - throw new TypeError("THREE.BufferAttribute: array should be a Typed Array."); - } - this.isBufferAttribute = true; - this.name = ""; - this.array = array; - this.itemSize = itemSize; - this.count = array !== void 0 ? array.length / itemSize : 0; - this.normalized = normalized; - this.usage = StaticDrawUsage; - this.updateRange = { offset: 0, count: -1 }; - this.gpuType = FloatType; - this.version = 0; - } - onUploadCallback() { - } - set needsUpdate(value) { - if (value === true) - this.version++; - } - setUsage(value) { - this.usage = value; - return this; - } - copy(source) { - this.name = source.name; - this.array = new source.array.constructor(source.array); - this.itemSize = source.itemSize; - this.count = source.count; - this.normalized = source.normalized; - this.usage = source.usage; - this.gpuType = source.gpuType; - return this; - } - copyAt(index1, attribute, index2) { - index1 *= this.itemSize; - index2 *= attribute.itemSize; - for (let i = 0, l = this.itemSize; i < l; i++) { - this.array[index1 + i] = attribute.array[index2 + i]; - } - return this; - } - copyArray(array) { - this.array.set(array); - return this; - } - applyMatrix3(m) { - if (this.itemSize === 2) { - for (let i = 0, l = this.count; i < l; i++) { - _vector2$1.fromBufferAttribute(this, i); - _vector2$1.applyMatrix3(m); - this.setXY(i, _vector2$1.x, _vector2$1.y); - } - } else if (this.itemSize === 3) { - for (let i = 0, l = this.count; i < l; i++) { - _vector$8.fromBufferAttribute(this, i); - _vector$8.applyMatrix3(m); - this.setXYZ(i, _vector$8.x, _vector$8.y, _vector$8.z); - } - } - return this; - } - applyMatrix4(m) { - for (let i = 0, l = this.count; i < l; i++) { - _vector$8.fromBufferAttribute(this, i); - _vector$8.applyMatrix4(m); - this.setXYZ(i, _vector$8.x, _vector$8.y, _vector$8.z); - } - return this; - } - applyNormalMatrix(m) { - for (let i = 0, l = this.count; i < l; i++) { - _vector$8.fromBufferAttribute(this, i); - _vector$8.applyNormalMatrix(m); - this.setXYZ(i, _vector$8.x, _vector$8.y, _vector$8.z); - } - return this; - } - transformDirection(m) { - for (let i = 0, l = this.count; i < l; i++) { - _vector$8.fromBufferAttribute(this, i); - _vector$8.transformDirection(m); - this.setXYZ(i, _vector$8.x, _vector$8.y, _vector$8.z); - } - return this; - } - set(value, offset = 0) { - this.array.set(value, offset); - return this; - } - getComponent(index, component) { - let value = this.array[index * this.itemSize + component]; - if (this.normalized) - value = denormalize(value, this.array); - return value; - } - setComponent(index, component, value) { - if (this.normalized) - value = normalize(value, this.array); - this.array[index * this.itemSize + component] = value; - return this; - } - getX(index) { - let x = this.array[index * this.itemSize]; - if (this.normalized) - x = denormalize(x, this.array); - return x; - } - setX(index, x) { - if (this.normalized) - x = normalize(x, this.array); - this.array[index * this.itemSize] = x; - return this; - } - getY(index) { - let y = this.array[index * this.itemSize + 1]; - if (this.normalized) - y = denormalize(y, this.array); - return y; - } - setY(index, y) { - if (this.normalized) - y = normalize(y, this.array); - this.array[index * this.itemSize + 1] = y; - return this; - } - getZ(index) { - let z = this.array[index * this.itemSize + 2]; - if (this.normalized) - z = denormalize(z, this.array); - return z; - } - setZ(index, z) { - if (this.normalized) - z = normalize(z, this.array); - this.array[index * this.itemSize + 2] = z; - return this; - } - getW(index) { - let w = this.array[index * this.itemSize + 3]; - if (this.normalized) - w = denormalize(w, this.array); - return w; - } - setW(index, w) { - if (this.normalized) - w = normalize(w, this.array); - this.array[index * this.itemSize + 3] = w; - return this; - } - setXY(index, x, y) { - index *= this.itemSize; - if (this.normalized) { - x = normalize(x, this.array); - y = normalize(y, this.array); - } - this.array[index + 0] = x; - this.array[index + 1] = y; - return this; - } - setXYZ(index, x, y, z) { - index *= this.itemSize; - if (this.normalized) { - x = normalize(x, this.array); - y = normalize(y, this.array); - z = normalize(z, this.array); - } - this.array[index + 0] = x; - this.array[index + 1] = y; - this.array[index + 2] = z; - return this; - } - setXYZW(index, x, y, z, w) { - index *= this.itemSize; - if (this.normalized) { - x = normalize(x, this.array); - y = normalize(y, this.array); - z = normalize(z, this.array); - w = normalize(w, this.array); - } - this.array[index + 0] = x; - this.array[index + 1] = y; - this.array[index + 2] = z; - this.array[index + 3] = w; - return this; - } - onUpload(callback) { - this.onUploadCallback = callback; - return this; - } - clone() { - return new this.constructor(this.array, this.itemSize).copy(this); - } - toJSON() { - const data = { - itemSize: this.itemSize, - type: this.array.constructor.name, - array: Array.from(this.array), - normalized: this.normalized - }; - if (this.name !== "") - data.name = this.name; - if (this.usage !== StaticDrawUsage) - data.usage = this.usage; - if (this.updateRange.offset !== 0 || this.updateRange.count !== -1) - data.updateRange = this.updateRange; - return data; - } -}; -var Int8BufferAttribute = class extends BufferAttribute { - constructor(array, itemSize, normalized) { - super(new Int8Array(array), itemSize, normalized); - } -}; -var Uint8BufferAttribute = class extends BufferAttribute { - constructor(array, itemSize, normalized) { - super(new Uint8Array(array), itemSize, normalized); - } -}; -var Uint8ClampedBufferAttribute = class extends BufferAttribute { - constructor(array, itemSize, normalized) { - super(new Uint8ClampedArray(array), itemSize, normalized); - } -}; -var Int16BufferAttribute = class extends BufferAttribute { - constructor(array, itemSize, normalized) { - super(new Int16Array(array), itemSize, normalized); - } -}; -var Uint16BufferAttribute = class extends BufferAttribute { - constructor(array, itemSize, normalized) { - super(new Uint16Array(array), itemSize, normalized); - } -}; -var Int32BufferAttribute = class extends BufferAttribute { - constructor(array, itemSize, normalized) { - super(new Int32Array(array), itemSize, normalized); - } -}; -var Uint32BufferAttribute = class extends BufferAttribute { - constructor(array, itemSize, normalized) { - super(new Uint32Array(array), itemSize, normalized); - } -}; -var Float16BufferAttribute = class extends BufferAttribute { - constructor(array, itemSize, normalized) { - super(new Uint16Array(array), itemSize, normalized); - this.isFloat16BufferAttribute = true; - } - getX(index) { - let x = fromHalfFloat(this.array[index * this.itemSize]); - if (this.normalized) - x = denormalize(x, this.array); - return x; - } - setX(index, x) { - if (this.normalized) - x = normalize(x, this.array); - this.array[index * this.itemSize] = toHalfFloat(x); - return this; - } - getY(index) { - let y = fromHalfFloat(this.array[index * this.itemSize + 1]); - if (this.normalized) - y = denormalize(y, this.array); - return y; - } - setY(index, y) { - if (this.normalized) - y = normalize(y, this.array); - this.array[index * this.itemSize + 1] = toHalfFloat(y); - return this; - } - getZ(index) { - let z = fromHalfFloat(this.array[index * this.itemSize + 2]); - if (this.normalized) - z = denormalize(z, this.array); - return z; - } - setZ(index, z) { - if (this.normalized) - z = normalize(z, this.array); - this.array[index * this.itemSize + 2] = toHalfFloat(z); - return this; - } - getW(index) { - let w = fromHalfFloat(this.array[index * this.itemSize + 3]); - if (this.normalized) - w = denormalize(w, this.array); - return w; - } - setW(index, w) { - if (this.normalized) - w = normalize(w, this.array); - this.array[index * this.itemSize + 3] = toHalfFloat(w); - return this; - } - setXY(index, x, y) { - index *= this.itemSize; - if (this.normalized) { - x = normalize(x, this.array); - y = normalize(y, this.array); - } - this.array[index + 0] = toHalfFloat(x); - this.array[index + 1] = toHalfFloat(y); - return this; - } - setXYZ(index, x, y, z) { - index *= this.itemSize; - if (this.normalized) { - x = normalize(x, this.array); - y = normalize(y, this.array); - z = normalize(z, this.array); - } - this.array[index + 0] = toHalfFloat(x); - this.array[index + 1] = toHalfFloat(y); - this.array[index + 2] = toHalfFloat(z); - return this; - } - setXYZW(index, x, y, z, w) { - index *= this.itemSize; - if (this.normalized) { - x = normalize(x, this.array); - y = normalize(y, this.array); - z = normalize(z, this.array); - w = normalize(w, this.array); - } - this.array[index + 0] = toHalfFloat(x); - this.array[index + 1] = toHalfFloat(y); - this.array[index + 2] = toHalfFloat(z); - this.array[index + 3] = toHalfFloat(w); - return this; - } -}; -var Float32BufferAttribute = class extends BufferAttribute { - constructor(array, itemSize, normalized) { - super(new Float32Array(array), itemSize, normalized); - } -}; -var Float64BufferAttribute = class extends BufferAttribute { - constructor(array, itemSize, normalized) { - super(new Float64Array(array), itemSize, normalized); - } -}; -var _id$2 = 0; -var _m1 = new Matrix4(); -var _obj = new Object3D(); -var _offset = new Vector3(); -var _box$1 = new Box3(); -var _boxMorphTargets = new Box3(); -var _vector$7 = new Vector3(); -var BufferGeometry = class _BufferGeometry extends EventDispatcher { - constructor() { - super(); - this.isBufferGeometry = true; - Object.defineProperty(this, "id", { value: _id$2++ }); - this.uuid = generateUUID(); - this.name = ""; - this.type = "BufferGeometry"; - this.index = null; - this.attributes = {}; - this.morphAttributes = {}; - this.morphTargetsRelative = false; - this.groups = []; - this.boundingBox = null; - this.boundingSphere = null; - this.drawRange = { start: 0, count: Infinity }; - this.userData = {}; - } - getIndex() { - return this.index; - } - setIndex(index) { - if (Array.isArray(index)) { - this.index = new (arrayNeedsUint32(index) ? Uint32BufferAttribute : Uint16BufferAttribute)(index, 1); - } else { - this.index = index; - } - return this; - } - getAttribute(name) { - return this.attributes[name]; - } - setAttribute(name, attribute) { - this.attributes[name] = attribute; - return this; - } - deleteAttribute(name) { - delete this.attributes[name]; - return this; - } - hasAttribute(name) { - return this.attributes[name] !== void 0; - } - addGroup(start, count, materialIndex = 0) { - this.groups.push({ - start, - count, - materialIndex - }); - } - clearGroups() { - this.groups = []; - } - setDrawRange(start, count) { - this.drawRange.start = start; - this.drawRange.count = count; - } - applyMatrix4(matrix) { - const position = this.attributes.position; - if (position !== void 0) { - position.applyMatrix4(matrix); - position.needsUpdate = true; - } - const normal = this.attributes.normal; - if (normal !== void 0) { - const normalMatrix = new Matrix3().getNormalMatrix(matrix); - normal.applyNormalMatrix(normalMatrix); - normal.needsUpdate = true; - } - const tangent = this.attributes.tangent; - if (tangent !== void 0) { - tangent.transformDirection(matrix); - tangent.needsUpdate = true; - } - if (this.boundingBox !== null) { - this.computeBoundingBox(); - } - if (this.boundingSphere !== null) { - this.computeBoundingSphere(); - } - return this; - } - applyQuaternion(q) { - _m1.makeRotationFromQuaternion(q); - this.applyMatrix4(_m1); - return this; - } - rotateX(angle) { - _m1.makeRotationX(angle); - this.applyMatrix4(_m1); - return this; - } - rotateY(angle) { - _m1.makeRotationY(angle); - this.applyMatrix4(_m1); - return this; - } - rotateZ(angle) { - _m1.makeRotationZ(angle); - this.applyMatrix4(_m1); - return this; - } - translate(x, y, z) { - _m1.makeTranslation(x, y, z); - this.applyMatrix4(_m1); - return this; - } - scale(x, y, z) { - _m1.makeScale(x, y, z); - this.applyMatrix4(_m1); - return this; - } - lookAt(vector) { - _obj.lookAt(vector); - _obj.updateMatrix(); - this.applyMatrix4(_obj.matrix); - return this; - } - center() { - this.computeBoundingBox(); - this.boundingBox.getCenter(_offset).negate(); - this.translate(_offset.x, _offset.y, _offset.z); - return this; - } - setFromPoints(points) { - const position = []; - for (let i = 0, l = points.length; i < l; i++) { - const point = points[i]; - position.push(point.x, point.y, point.z || 0); - } - this.setAttribute("position", new Float32BufferAttribute(position, 3)); - return this; - } - computeBoundingBox() { - if (this.boundingBox === null) { - this.boundingBox = new Box3(); - } - const position = this.attributes.position; - const morphAttributesPosition = this.morphAttributes.position; - if (position && position.isGLBufferAttribute) { - console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this); - this.boundingBox.set( - new Vector3(-Infinity, -Infinity, -Infinity), - new Vector3(Infinity, Infinity, Infinity) - ); - return; - } - if (position !== void 0) { - this.boundingBox.setFromBufferAttribute(position); - if (morphAttributesPosition) { - for (let i = 0, il = morphAttributesPosition.length; i < il; i++) { - const morphAttribute = morphAttributesPosition[i]; - _box$1.setFromBufferAttribute(morphAttribute); - if (this.morphTargetsRelative) { - _vector$7.addVectors(this.boundingBox.min, _box$1.min); - this.boundingBox.expandByPoint(_vector$7); - _vector$7.addVectors(this.boundingBox.max, _box$1.max); - this.boundingBox.expandByPoint(_vector$7); - } else { - this.boundingBox.expandByPoint(_box$1.min); - this.boundingBox.expandByPoint(_box$1.max); - } - } - } - } else { - this.boundingBox.makeEmpty(); - } - if (isNaN(this.boundingBox.min.x) || isNaN(this.boundingBox.min.y) || isNaN(this.boundingBox.min.z)) { - console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this); - } - } - computeBoundingSphere() { - if (this.boundingSphere === null) { - this.boundingSphere = new Sphere(); - } - const position = this.attributes.position; - const morphAttributesPosition = this.morphAttributes.position; - if (position && position.isGLBufferAttribute) { - console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this); - this.boundingSphere.set(new Vector3(), Infinity); - return; - } - if (position) { - const center = this.boundingSphere.center; - _box$1.setFromBufferAttribute(position); - if (morphAttributesPosition) { - for (let i = 0, il = morphAttributesPosition.length; i < il; i++) { - const morphAttribute = morphAttributesPosition[i]; - _boxMorphTargets.setFromBufferAttribute(morphAttribute); - if (this.morphTargetsRelative) { - _vector$7.addVectors(_box$1.min, _boxMorphTargets.min); - _box$1.expandByPoint(_vector$7); - _vector$7.addVectors(_box$1.max, _boxMorphTargets.max); - _box$1.expandByPoint(_vector$7); - } else { - _box$1.expandByPoint(_boxMorphTargets.min); - _box$1.expandByPoint(_boxMorphTargets.max); - } - } - } - _box$1.getCenter(center); - let maxRadiusSq = 0; - for (let i = 0, il = position.count; i < il; i++) { - _vector$7.fromBufferAttribute(position, i); - maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$7)); - } - if (morphAttributesPosition) { - for (let i = 0, il = morphAttributesPosition.length; i < il; i++) { - const morphAttribute = morphAttributesPosition[i]; - const morphTargetsRelative = this.morphTargetsRelative; - for (let j = 0, jl = morphAttribute.count; j < jl; j++) { - _vector$7.fromBufferAttribute(morphAttribute, j); - if (morphTargetsRelative) { - _offset.fromBufferAttribute(position, j); - _vector$7.add(_offset); - } - maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$7)); - } - } - } - this.boundingSphere.radius = Math.sqrt(maxRadiusSq); - if (isNaN(this.boundingSphere.radius)) { - console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this); - } - } - } - computeTangents() { - const index = this.index; - const attributes = this.attributes; - if (index === null || attributes.position === void 0 || attributes.normal === void 0 || attributes.uv === void 0) { - console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)"); - return; - } - const indices = index.array; - const positions = attributes.position.array; - const normals = attributes.normal.array; - const uvs = attributes.uv.array; - const nVertices = positions.length / 3; - if (this.hasAttribute("tangent") === false) { - this.setAttribute("tangent", new BufferAttribute(new Float32Array(4 * nVertices), 4)); - } - const tangents = this.getAttribute("tangent").array; - const tan1 = [], tan2 = []; - for (let i = 0; i < nVertices; i++) { - tan1[i] = new Vector3(); - tan2[i] = new Vector3(); - } - const vA = new Vector3(), vB = new Vector3(), vC = new Vector3(), uvA = new Vector2(), uvB = new Vector2(), uvC = new Vector2(), sdir = new Vector3(), tdir = new Vector3(); - function handleTriangle(a, b, c) { - vA.fromArray(positions, a * 3); - vB.fromArray(positions, b * 3); - vC.fromArray(positions, c * 3); - uvA.fromArray(uvs, a * 2); - uvB.fromArray(uvs, b * 2); - uvC.fromArray(uvs, c * 2); - vB.sub(vA); - vC.sub(vA); - uvB.sub(uvA); - uvC.sub(uvA); - const r = 1 / (uvB.x * uvC.y - uvC.x * uvB.y); - if (!isFinite(r)) - return; - sdir.copy(vB).multiplyScalar(uvC.y).addScaledVector(vC, -uvB.y).multiplyScalar(r); - tdir.copy(vC).multiplyScalar(uvB.x).addScaledVector(vB, -uvC.x).multiplyScalar(r); - tan1[a].add(sdir); - tan1[b].add(sdir); - tan1[c].add(sdir); - tan2[a].add(tdir); - tan2[b].add(tdir); - tan2[c].add(tdir); - } - let groups = this.groups; - if (groups.length === 0) { - groups = [{ - start: 0, - count: indices.length - }]; - } - for (let i = 0, il = groups.length; i < il; ++i) { - const group = groups[i]; - const start = group.start; - const count = group.count; - for (let j = start, jl = start + count; j < jl; j += 3) { - handleTriangle( - indices[j + 0], - indices[j + 1], - indices[j + 2] - ); - } - } - const tmp2 = new Vector3(), tmp22 = new Vector3(); - const n = new Vector3(), n2 = new Vector3(); - function handleVertex(v) { - n.fromArray(normals, v * 3); - n2.copy(n); - const t = tan1[v]; - tmp2.copy(t); - tmp2.sub(n.multiplyScalar(n.dot(t))).normalize(); - tmp22.crossVectors(n2, t); - const test = tmp22.dot(tan2[v]); - const w = test < 0 ? -1 : 1; - tangents[v * 4] = tmp2.x; - tangents[v * 4 + 1] = tmp2.y; - tangents[v * 4 + 2] = tmp2.z; - tangents[v * 4 + 3] = w; - } - for (let i = 0, il = groups.length; i < il; ++i) { - const group = groups[i]; - const start = group.start; - const count = group.count; - for (let j = start, jl = start + count; j < jl; j += 3) { - handleVertex(indices[j + 0]); - handleVertex(indices[j + 1]); - handleVertex(indices[j + 2]); - } - } - } - computeVertexNormals() { - const index = this.index; - const positionAttribute = this.getAttribute("position"); - if (positionAttribute !== void 0) { - let normalAttribute = this.getAttribute("normal"); - if (normalAttribute === void 0) { - normalAttribute = new BufferAttribute(new Float32Array(positionAttribute.count * 3), 3); - this.setAttribute("normal", normalAttribute); - } else { - for (let i = 0, il = normalAttribute.count; i < il; i++) { - normalAttribute.setXYZ(i, 0, 0, 0); - } - } - const pA = new Vector3(), pB = new Vector3(), pC = new Vector3(); - const nA = new Vector3(), nB = new Vector3(), nC = new Vector3(); - const cb = new Vector3(), ab = new Vector3(); - if (index) { - for (let i = 0, il = index.count; i < il; i += 3) { - const vA = index.getX(i + 0); - const vB = index.getX(i + 1); - const vC = index.getX(i + 2); - pA.fromBufferAttribute(positionAttribute, vA); - pB.fromBufferAttribute(positionAttribute, vB); - pC.fromBufferAttribute(positionAttribute, vC); - cb.subVectors(pC, pB); - ab.subVectors(pA, pB); - cb.cross(ab); - nA.fromBufferAttribute(normalAttribute, vA); - nB.fromBufferAttribute(normalAttribute, vB); - nC.fromBufferAttribute(normalAttribute, vC); - nA.add(cb); - nB.add(cb); - nC.add(cb); - normalAttribute.setXYZ(vA, nA.x, nA.y, nA.z); - normalAttribute.setXYZ(vB, nB.x, nB.y, nB.z); - normalAttribute.setXYZ(vC, nC.x, nC.y, nC.z); - } - } else { - for (let i = 0, il = positionAttribute.count; i < il; i += 3) { - pA.fromBufferAttribute(positionAttribute, i + 0); - pB.fromBufferAttribute(positionAttribute, i + 1); - pC.fromBufferAttribute(positionAttribute, i + 2); - cb.subVectors(pC, pB); - ab.subVectors(pA, pB); - cb.cross(ab); - normalAttribute.setXYZ(i + 0, cb.x, cb.y, cb.z); - normalAttribute.setXYZ(i + 1, cb.x, cb.y, cb.z); - normalAttribute.setXYZ(i + 2, cb.x, cb.y, cb.z); - } - } - this.normalizeNormals(); - normalAttribute.needsUpdate = true; - } - } - normalizeNormals() { - const normals = this.attributes.normal; - for (let i = 0, il = normals.count; i < il; i++) { - _vector$7.fromBufferAttribute(normals, i); - _vector$7.normalize(); - normals.setXYZ(i, _vector$7.x, _vector$7.y, _vector$7.z); - } - } - toNonIndexed() { - function convertBufferAttribute(attribute, indices2) { - const array = attribute.array; - const itemSize = attribute.itemSize; - const normalized = attribute.normalized; - const array2 = new array.constructor(indices2.length * itemSize); - let index = 0, index2 = 0; - for (let i = 0, l = indices2.length; i < l; i++) { - if (attribute.isInterleavedBufferAttribute) { - index = indices2[i] * attribute.data.stride + attribute.offset; - } else { - index = indices2[i] * itemSize; - } - for (let j = 0; j < itemSize; j++) { - array2[index2++] = array[index++]; - } - } - return new BufferAttribute(array2, itemSize, normalized); - } - if (this.index === null) { - console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."); - return this; - } - const geometry2 = new _BufferGeometry(); - const indices = this.index.array; - const attributes = this.attributes; - for (const name in attributes) { - const attribute = attributes[name]; - const newAttribute = convertBufferAttribute(attribute, indices); - geometry2.setAttribute(name, newAttribute); - } - const morphAttributes = this.morphAttributes; - for (const name in morphAttributes) { - const morphArray = []; - const morphAttribute = morphAttributes[name]; - for (let i = 0, il = morphAttribute.length; i < il; i++) { - const attribute = morphAttribute[i]; - const newAttribute = convertBufferAttribute(attribute, indices); - morphArray.push(newAttribute); - } - geometry2.morphAttributes[name] = morphArray; - } - geometry2.morphTargetsRelative = this.morphTargetsRelative; - const groups = this.groups; - for (let i = 0, l = groups.length; i < l; i++) { - const group = groups[i]; - geometry2.addGroup(group.start, group.count, group.materialIndex); - } - return geometry2; - } - toJSON() { - const data = { - metadata: { - version: 4.6, - type: "BufferGeometry", - generator: "BufferGeometry.toJSON" - } - }; - data.uuid = this.uuid; - data.type = this.type; - if (this.name !== "") - data.name = this.name; - if (Object.keys(this.userData).length > 0) - data.userData = this.userData; - if (this.parameters !== void 0) { - const parameters = this.parameters; - for (const key in parameters) { - if (parameters[key] !== void 0) - data[key] = parameters[key]; - } - return data; - } - data.data = { attributes: {} }; - const index = this.index; - if (index !== null) { - data.data.index = { - type: index.array.constructor.name, - array: Array.prototype.slice.call(index.array) - }; - } - const attributes = this.attributes; - for (const key in attributes) { - const attribute = attributes[key]; - data.data.attributes[key] = attribute.toJSON(data.data); - } - const morphAttributes = {}; - let hasMorphAttributes = false; - for (const key in this.morphAttributes) { - const attributeArray = this.morphAttributes[key]; - const array = []; - for (let i = 0, il = attributeArray.length; i < il; i++) { - const attribute = attributeArray[i]; - array.push(attribute.toJSON(data.data)); - } - if (array.length > 0) { - morphAttributes[key] = array; - hasMorphAttributes = true; - } - } - if (hasMorphAttributes) { - data.data.morphAttributes = morphAttributes; - data.data.morphTargetsRelative = this.morphTargetsRelative; - } - const groups = this.groups; - if (groups.length > 0) { - data.data.groups = JSON.parse(JSON.stringify(groups)); - } - const boundingSphere = this.boundingSphere; - if (boundingSphere !== null) { - data.data.boundingSphere = { - center: boundingSphere.center.toArray(), - radius: boundingSphere.radius - }; - } - return data; - } - clone() { - return new this.constructor().copy(this); - } - copy(source) { - this.index = null; - this.attributes = {}; - this.morphAttributes = {}; - this.groups = []; - this.boundingBox = null; - this.boundingSphere = null; - const data = {}; - this.name = source.name; - const index = source.index; - if (index !== null) { - this.setIndex(index.clone(data)); - } - const attributes = source.attributes; - for (const name in attributes) { - const attribute = attributes[name]; - this.setAttribute(name, attribute.clone(data)); - } - const morphAttributes = source.morphAttributes; - for (const name in morphAttributes) { - const array = []; - const morphAttribute = morphAttributes[name]; - for (let i = 0, l = morphAttribute.length; i < l; i++) { - array.push(morphAttribute[i].clone(data)); - } - this.morphAttributes[name] = array; - } - this.morphTargetsRelative = source.morphTargetsRelative; - const groups = source.groups; - for (let i = 0, l = groups.length; i < l; i++) { - const group = groups[i]; - this.addGroup(group.start, group.count, group.materialIndex); - } - const boundingBox = source.boundingBox; - if (boundingBox !== null) { - this.boundingBox = boundingBox.clone(); - } - const boundingSphere = source.boundingSphere; - if (boundingSphere !== null) { - this.boundingSphere = boundingSphere.clone(); - } - this.drawRange.start = source.drawRange.start; - this.drawRange.count = source.drawRange.count; - this.userData = source.userData; - return this; - } - dispose() { - this.dispatchEvent({ type: "dispose" }); - } -}; -var _inverseMatrix$3 = new Matrix4(); -var _ray$3 = new Ray(); -var _sphere$5 = new Sphere(); -var _sphereHitAt = new Vector3(); -var _vA$1 = new Vector3(); -var _vB$1 = new Vector3(); -var _vC$1 = new Vector3(); -var _tempA = new Vector3(); -var _morphA = new Vector3(); -var _uvA$1 = new Vector2(); -var _uvB$1 = new Vector2(); -var _uvC$1 = new Vector2(); -var _normalA = new Vector3(); -var _normalB = new Vector3(); -var _normalC = new Vector3(); -var _intersectionPoint = new Vector3(); -var _intersectionPointWorld = new Vector3(); -var Mesh = class extends Object3D { - constructor(geometry = new BufferGeometry(), material = new MeshBasicMaterial()) { - super(); - this.isMesh = true; - this.type = "Mesh"; - this.geometry = geometry; - this.material = material; - this.updateMorphTargets(); - } - copy(source, recursive) { - super.copy(source, recursive); - if (source.morphTargetInfluences !== void 0) { - this.morphTargetInfluences = source.morphTargetInfluences.slice(); - } - if (source.morphTargetDictionary !== void 0) { - this.morphTargetDictionary = Object.assign({}, source.morphTargetDictionary); - } - this.material = Array.isArray(source.material) ? source.material.slice() : source.material; - this.geometry = source.geometry; - return this; - } - updateMorphTargets() { - const geometry = this.geometry; - const morphAttributes = geometry.morphAttributes; - const keys = Object.keys(morphAttributes); - if (keys.length > 0) { - const morphAttribute = morphAttributes[keys[0]]; - if (morphAttribute !== void 0) { - this.morphTargetInfluences = []; - this.morphTargetDictionary = {}; - for (let m = 0, ml = morphAttribute.length; m < ml; m++) { - const name = morphAttribute[m].name || String(m); - this.morphTargetInfluences.push(0); - this.morphTargetDictionary[name] = m; - } - } - } - } - getVertexPosition(index, target) { - const geometry = this.geometry; - const position = geometry.attributes.position; - const morphPosition = geometry.morphAttributes.position; - const morphTargetsRelative = geometry.morphTargetsRelative; - target.fromBufferAttribute(position, index); - const morphInfluences = this.morphTargetInfluences; - if (morphPosition && morphInfluences) { - _morphA.set(0, 0, 0); - for (let i = 0, il = morphPosition.length; i < il; i++) { - const influence = morphInfluences[i]; - const morphAttribute = morphPosition[i]; - if (influence === 0) - continue; - _tempA.fromBufferAttribute(morphAttribute, index); - if (morphTargetsRelative) { - _morphA.addScaledVector(_tempA, influence); - } else { - _morphA.addScaledVector(_tempA.sub(target), influence); - } - } - target.add(_morphA); - } - return target; - } - raycast(raycaster, intersects2) { - const geometry = this.geometry; - const material = this.material; - const matrixWorld = this.matrixWorld; - if (material === void 0) - return; - if (geometry.boundingSphere === null) - geometry.computeBoundingSphere(); - _sphere$5.copy(geometry.boundingSphere); - _sphere$5.applyMatrix4(matrixWorld); - _ray$3.copy(raycaster.ray).recast(raycaster.near); - if (_sphere$5.containsPoint(_ray$3.origin) === false) { - if (_ray$3.intersectSphere(_sphere$5, _sphereHitAt) === null) - return; - if (_ray$3.origin.distanceToSquared(_sphereHitAt) > (raycaster.far - raycaster.near) ** 2) - return; - } - _inverseMatrix$3.copy(matrixWorld).invert(); - _ray$3.copy(raycaster.ray).applyMatrix4(_inverseMatrix$3); - if (geometry.boundingBox !== null) { - if (_ray$3.intersectsBox(geometry.boundingBox) === false) - return; - } - this._computeIntersections(raycaster, intersects2, _ray$3); - } - _computeIntersections(raycaster, intersects2, rayLocalSpace) { - let intersection; - const geometry = this.geometry; - const material = this.material; - const index = geometry.index; - const position = geometry.attributes.position; - const uv = geometry.attributes.uv; - const uv1 = geometry.attributes.uv1; - const normal = geometry.attributes.normal; - const groups = geometry.groups; - const drawRange = geometry.drawRange; - if (index !== null) { - if (Array.isArray(material)) { - for (let i = 0, il = groups.length; i < il; i++) { - const group = groups[i]; - const groupMaterial = material[group.materialIndex]; - const start = Math.max(group.start, drawRange.start); - const end = Math.min(index.count, Math.min(group.start + group.count, drawRange.start + drawRange.count)); - for (let j = start, jl = end; j < jl; j += 3) { - const a = index.getX(j); - const b = index.getX(j + 1); - const c = index.getX(j + 2); - intersection = checkGeometryIntersection(this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c); - if (intersection) { - intersection.faceIndex = Math.floor(j / 3); - intersection.face.materialIndex = group.materialIndex; - intersects2.push(intersection); - } - } - } - } else { - const start = Math.max(0, drawRange.start); - const end = Math.min(index.count, drawRange.start + drawRange.count); - for (let i = start, il = end; i < il; i += 3) { - const a = index.getX(i); - const b = index.getX(i + 1); - const c = index.getX(i + 2); - intersection = checkGeometryIntersection(this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c); - if (intersection) { - intersection.faceIndex = Math.floor(i / 3); - intersects2.push(intersection); - } - } - } - } else if (position !== void 0) { - if (Array.isArray(material)) { - for (let i = 0, il = groups.length; i < il; i++) { - const group = groups[i]; - const groupMaterial = material[group.materialIndex]; - const start = Math.max(group.start, drawRange.start); - const end = Math.min(position.count, Math.min(group.start + group.count, drawRange.start + drawRange.count)); - for (let j = start, jl = end; j < jl; j += 3) { - const a = j; - const b = j + 1; - const c = j + 2; - intersection = checkGeometryIntersection(this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c); - if (intersection) { - intersection.faceIndex = Math.floor(j / 3); - intersection.face.materialIndex = group.materialIndex; - intersects2.push(intersection); - } - } - } - } else { - const start = Math.max(0, drawRange.start); - const end = Math.min(position.count, drawRange.start + drawRange.count); - for (let i = start, il = end; i < il; i += 3) { - const a = i; - const b = i + 1; - const c = i + 2; - intersection = checkGeometryIntersection(this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c); - if (intersection) { - intersection.faceIndex = Math.floor(i / 3); - intersects2.push(intersection); - } - } - } - } - } -}; -function checkIntersection(object, material, raycaster, ray, pA, pB, pC, point) { - let intersect; - if (material.side === BackSide) { - intersect = ray.intersectTriangle(pC, pB, pA, true, point); - } else { - intersect = ray.intersectTriangle(pA, pB, pC, material.side === FrontSide, point); - } - if (intersect === null) - return null; - _intersectionPointWorld.copy(point); - _intersectionPointWorld.applyMatrix4(object.matrixWorld); - const distance = raycaster.ray.origin.distanceTo(_intersectionPointWorld); - if (distance < raycaster.near || distance > raycaster.far) - return null; - return { - distance, - point: _intersectionPointWorld.clone(), - object - }; -} -function checkGeometryIntersection(object, material, raycaster, ray, uv, uv1, normal, a, b, c) { - object.getVertexPosition(a, _vA$1); - object.getVertexPosition(b, _vB$1); - object.getVertexPosition(c, _vC$1); - const intersection = checkIntersection(object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint); - if (intersection) { - if (uv) { - _uvA$1.fromBufferAttribute(uv, a); - _uvB$1.fromBufferAttribute(uv, b); - _uvC$1.fromBufferAttribute(uv, c); - intersection.uv = Triangle.getInterpolation(_intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2()); - } - if (uv1) { - _uvA$1.fromBufferAttribute(uv1, a); - _uvB$1.fromBufferAttribute(uv1, b); - _uvC$1.fromBufferAttribute(uv1, c); - intersection.uv1 = Triangle.getInterpolation(_intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2()); - intersection.uv2 = intersection.uv1; - } - if (normal) { - _normalA.fromBufferAttribute(normal, a); - _normalB.fromBufferAttribute(normal, b); - _normalC.fromBufferAttribute(normal, c); - intersection.normal = Triangle.getInterpolation(_intersectionPoint, _vA$1, _vB$1, _vC$1, _normalA, _normalB, _normalC, new Vector3()); - if (intersection.normal.dot(ray.direction) > 0) { - intersection.normal.multiplyScalar(-1); - } - } - const face = { - a, - b, - c, - normal: new Vector3(), - materialIndex: 0 - }; - Triangle.getNormal(_vA$1, _vB$1, _vC$1, face.normal); - intersection.face = face; - } - return intersection; -} -var BoxGeometry = class _BoxGeometry extends BufferGeometry { - constructor(width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1) { - super(); - this.type = "BoxGeometry"; - this.parameters = { - width, - height, - depth, - widthSegments, - heightSegments, - depthSegments - }; - const scope = this; - widthSegments = Math.floor(widthSegments); - heightSegments = Math.floor(heightSegments); - depthSegments = Math.floor(depthSegments); - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - let numberOfVertices = 0; - let groupStart = 0; - buildPlane("z", "y", "x", -1, -1, depth, height, width, depthSegments, heightSegments, 0); - buildPlane("z", "y", "x", 1, -1, depth, height, -width, depthSegments, heightSegments, 1); - buildPlane("x", "z", "y", 1, 1, width, depth, height, widthSegments, depthSegments, 2); - buildPlane("x", "z", "y", 1, -1, width, depth, -height, widthSegments, depthSegments, 3); - buildPlane("x", "y", "z", 1, -1, width, height, depth, widthSegments, heightSegments, 4); - buildPlane("x", "y", "z", -1, -1, width, height, -depth, widthSegments, heightSegments, 5); - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - function buildPlane(u, v, w, udir, vdir, width2, height2, depth2, gridX, gridY, materialIndex) { - const segmentWidth = width2 / gridX; - const segmentHeight = height2 / gridY; - const widthHalf = width2 / 2; - const heightHalf = height2 / 2; - const depthHalf = depth2 / 2; - const gridX1 = gridX + 1; - const gridY1 = gridY + 1; - let vertexCounter = 0; - let groupCount = 0; - const vector = new Vector3(); - for (let iy = 0; iy < gridY1; iy++) { - const y = iy * segmentHeight - heightHalf; - for (let ix = 0; ix < gridX1; ix++) { - const x = ix * segmentWidth - widthHalf; - vector[u] = x * udir; - vector[v] = y * vdir; - vector[w] = depthHalf; - vertices.push(vector.x, vector.y, vector.z); - vector[u] = 0; - vector[v] = 0; - vector[w] = depth2 > 0 ? 1 : -1; - normals.push(vector.x, vector.y, vector.z); - uvs.push(ix / gridX); - uvs.push(1 - iy / gridY); - vertexCounter += 1; - } - } - for (let iy = 0; iy < gridY; iy++) { - for (let ix = 0; ix < gridX; ix++) { - const a = numberOfVertices + ix + gridX1 * iy; - const b = numberOfVertices + ix + gridX1 * (iy + 1); - const c = numberOfVertices + (ix + 1) + gridX1 * (iy + 1); - const d = numberOfVertices + (ix + 1) + gridX1 * iy; - indices.push(a, b, d); - indices.push(b, c, d); - groupCount += 6; - } - } - scope.addGroup(groupStart, groupCount, materialIndex); - groupStart += groupCount; - numberOfVertices += vertexCounter; - } - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new _BoxGeometry(data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments); - } -}; -function cloneUniforms(src) { - const dst = {}; - for (const u in src) { - dst[u] = {}; - for (const p in src[u]) { - const property = src[u][p]; - if (property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion)) { - if (property.isRenderTargetTexture) { - console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."); - dst[u][p] = null; - } else { - dst[u][p] = property.clone(); - } - } else if (Array.isArray(property)) { - dst[u][p] = property.slice(); - } else { - dst[u][p] = property; - } - } - } - return dst; -} -function mergeUniforms(uniforms) { - const merged = {}; - for (let u = 0; u < uniforms.length; u++) { - const tmp2 = cloneUniforms(uniforms[u]); - for (const p in tmp2) { - merged[p] = tmp2[p]; - } - } - return merged; -} -function cloneUniformsGroups(src) { - const dst = []; - for (let u = 0; u < src.length; u++) { - dst.push(src[u].clone()); - } - return dst; -} -function getUnlitUniformColorSpace(renderer) { - if (renderer.getRenderTarget() === null) { - return renderer.outputColorSpace; - } - return ColorManagement.workingColorSpace; -} -var UniformsUtils = { clone: cloneUniforms, merge: mergeUniforms }; -var default_vertex = "void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"; -var default_fragment = "void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}"; -var ShaderMaterial = class extends Material { - constructor(parameters) { - super(); - this.isShaderMaterial = true; - this.type = "ShaderMaterial"; - this.defines = {}; - this.uniforms = {}; - this.uniformsGroups = []; - this.vertexShader = default_vertex; - this.fragmentShader = default_fragment; - this.linewidth = 1; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.fog = false; - this.lights = false; - this.clipping = false; - this.forceSinglePass = true; - this.extensions = { - derivatives: false, - // set to use derivatives - fragDepth: false, - // set to use fragment depth values - drawBuffers: false, - // set to use draw buffers - shaderTextureLOD: false - // set to use shader texture LOD - }; - this.defaultAttributeValues = { - "color": [1, 1, 1], - "uv": [0, 0], - "uv1": [0, 0] - }; - this.index0AttributeName = void 0; - this.uniformsNeedUpdate = false; - this.glslVersion = null; - if (parameters !== void 0) { - this.setValues(parameters); - } - } - copy(source) { - super.copy(source); - this.fragmentShader = source.fragmentShader; - this.vertexShader = source.vertexShader; - this.uniforms = cloneUniforms(source.uniforms); - this.uniformsGroups = cloneUniformsGroups(source.uniformsGroups); - this.defines = Object.assign({}, source.defines); - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.fog = source.fog; - this.lights = source.lights; - this.clipping = source.clipping; - this.extensions = Object.assign({}, source.extensions); - this.glslVersion = source.glslVersion; - return this; - } - toJSON(meta) { - const data = super.toJSON(meta); - data.glslVersion = this.glslVersion; - data.uniforms = {}; - for (const name in this.uniforms) { - const uniform = this.uniforms[name]; - const value = uniform.value; - if (value && value.isTexture) { - data.uniforms[name] = { - type: "t", - value: value.toJSON(meta).uuid - }; - } else if (value && value.isColor) { - data.uniforms[name] = { - type: "c", - value: value.getHex() - }; - } else if (value && value.isVector2) { - data.uniforms[name] = { - type: "v2", - value: value.toArray() - }; - } else if (value && value.isVector3) { - data.uniforms[name] = { - type: "v3", - value: value.toArray() - }; - } else if (value && value.isVector4) { - data.uniforms[name] = { - type: "v4", - value: value.toArray() - }; - } else if (value && value.isMatrix3) { - data.uniforms[name] = { - type: "m3", - value: value.toArray() - }; - } else if (value && value.isMatrix4) { - data.uniforms[name] = { - type: "m4", - value: value.toArray() - }; - } else { - data.uniforms[name] = { - value - }; - } - } - if (Object.keys(this.defines).length > 0) - data.defines = this.defines; - data.vertexShader = this.vertexShader; - data.fragmentShader = this.fragmentShader; - data.lights = this.lights; - data.clipping = this.clipping; - const extensions = {}; - for (const key in this.extensions) { - if (this.extensions[key] === true) - extensions[key] = true; - } - if (Object.keys(extensions).length > 0) - data.extensions = extensions; - return data; - } -}; -var Camera = class extends Object3D { - constructor() { - super(); - this.isCamera = true; - this.type = "Camera"; - this.matrixWorldInverse = new Matrix4(); - this.projectionMatrix = new Matrix4(); - this.projectionMatrixInverse = new Matrix4(); - this.coordinateSystem = WebGLCoordinateSystem; - } - copy(source, recursive) { - super.copy(source, recursive); - this.matrixWorldInverse.copy(source.matrixWorldInverse); - this.projectionMatrix.copy(source.projectionMatrix); - this.projectionMatrixInverse.copy(source.projectionMatrixInverse); - this.coordinateSystem = source.coordinateSystem; - return this; - } - getWorldDirection(target) { - return super.getWorldDirection(target).negate(); - } - updateMatrixWorld(force) { - super.updateMatrixWorld(force); - this.matrixWorldInverse.copy(this.matrixWorld).invert(); - } - updateWorldMatrix(updateParents, updateChildren) { - super.updateWorldMatrix(updateParents, updateChildren); - this.matrixWorldInverse.copy(this.matrixWorld).invert(); - } - clone() { - return new this.constructor().copy(this); - } -}; -var PerspectiveCamera = class extends Camera { - constructor(fov2 = 50, aspect2 = 1, near = 0.1, far = 2e3) { - super(); - this.isPerspectiveCamera = true; - this.type = "PerspectiveCamera"; - this.fov = fov2; - this.zoom = 1; - this.near = near; - this.far = far; - this.focus = 10; - this.aspect = aspect2; - this.view = null; - this.filmGauge = 35; - this.filmOffset = 0; - this.updateProjectionMatrix(); - } - copy(source, recursive) { - super.copy(source, recursive); - this.fov = source.fov; - this.zoom = source.zoom; - this.near = source.near; - this.far = source.far; - this.focus = source.focus; - this.aspect = source.aspect; - this.view = source.view === null ? null : Object.assign({}, source.view); - this.filmGauge = source.filmGauge; - this.filmOffset = source.filmOffset; - return this; - } - /** - * Sets the FOV by focal length in respect to the current .filmGauge. - * - * The default film gauge is 35, so that the focal length can be specified for - * a 35mm (full frame) camera. - * - * Values for focal length and film gauge must have the same unit. - */ - setFocalLength(focalLength) { - const vExtentSlope = 0.5 * this.getFilmHeight() / focalLength; - this.fov = RAD2DEG * 2 * Math.atan(vExtentSlope); - this.updateProjectionMatrix(); - } - /** - * Calculates the focal length from the current .fov and .filmGauge. - */ - getFocalLength() { - const vExtentSlope = Math.tan(DEG2RAD * 0.5 * this.fov); - return 0.5 * this.getFilmHeight() / vExtentSlope; - } - getEffectiveFOV() { - return RAD2DEG * 2 * Math.atan( - Math.tan(DEG2RAD * 0.5 * this.fov) / this.zoom - ); - } - getFilmWidth() { - return this.filmGauge * Math.min(this.aspect, 1); - } - getFilmHeight() { - return this.filmGauge / Math.max(this.aspect, 1); - } - /** - * Sets an offset in a larger frustum. This is useful for multi-window or - * multi-monitor/multi-machine setups. - * - * For example, if you have 3x2 monitors and each monitor is 1920x1080 and - * the monitors are in grid like this - * - * +---+---+---+ - * | A | B | C | - * +---+---+---+ - * | D | E | F | - * +---+---+---+ - * - * then for each monitor you would call it like this - * - * const w = 1920; - * const h = 1080; - * const fullWidth = w * 3; - * const fullHeight = h * 2; - * - * --A-- - * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h ); - * --B-- - * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h ); - * --C-- - * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h ); - * --D-- - * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h ); - * --E-- - * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h ); - * --F-- - * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); - * - * Note there is no reason monitors have to be the same size or in a grid. - */ - setViewOffset(fullWidth, fullHeight, x, y, width, height) { - this.aspect = fullWidth / fullHeight; - if (this.view === null) { - this.view = { - enabled: true, - fullWidth: 1, - fullHeight: 1, - offsetX: 0, - offsetY: 0, - width: 1, - height: 1 - }; - } - this.view.enabled = true; - this.view.fullWidth = fullWidth; - this.view.fullHeight = fullHeight; - this.view.offsetX = x; - this.view.offsetY = y; - this.view.width = width; - this.view.height = height; - this.updateProjectionMatrix(); - } - clearViewOffset() { - if (this.view !== null) { - this.view.enabled = false; - } - this.updateProjectionMatrix(); - } - updateProjectionMatrix() { - const near = this.near; - let top = near * Math.tan(DEG2RAD * 0.5 * this.fov) / this.zoom; - let height = 2 * top; - let width = this.aspect * height; - let left = -0.5 * width; - const view = this.view; - if (this.view !== null && this.view.enabled) { - const fullWidth = view.fullWidth, fullHeight = view.fullHeight; - left += view.offsetX * width / fullWidth; - top -= view.offsetY * height / fullHeight; - width *= view.width / fullWidth; - height *= view.height / fullHeight; - } - const skew = this.filmOffset; - if (skew !== 0) - left += near * skew / this.getFilmWidth(); - this.projectionMatrix.makePerspective(left, left + width, top, top - height, near, this.far, this.coordinateSystem); - this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); - } - toJSON(meta) { - const data = super.toJSON(meta); - data.object.fov = this.fov; - data.object.zoom = this.zoom; - data.object.near = this.near; - data.object.far = this.far; - data.object.focus = this.focus; - data.object.aspect = this.aspect; - if (this.view !== null) - data.object.view = Object.assign({}, this.view); - data.object.filmGauge = this.filmGauge; - data.object.filmOffset = this.filmOffset; - return data; - } -}; -var fov = -90; -var aspect = 1; -var CubeCamera = class extends Object3D { - constructor(near, far, renderTarget) { - super(); - this.type = "CubeCamera"; - this.renderTarget = renderTarget; - this.coordinateSystem = null; - this.activeMipmapLevel = 0; - const cameraPX = new PerspectiveCamera(fov, aspect, near, far); - cameraPX.layers = this.layers; - this.add(cameraPX); - const cameraNX = new PerspectiveCamera(fov, aspect, near, far); - cameraNX.layers = this.layers; - this.add(cameraNX); - const cameraPY = new PerspectiveCamera(fov, aspect, near, far); - cameraPY.layers = this.layers; - this.add(cameraPY); - const cameraNY = new PerspectiveCamera(fov, aspect, near, far); - cameraNY.layers = this.layers; - this.add(cameraNY); - const cameraPZ = new PerspectiveCamera(fov, aspect, near, far); - cameraPZ.layers = this.layers; - this.add(cameraPZ); - const cameraNZ = new PerspectiveCamera(fov, aspect, near, far); - cameraNZ.layers = this.layers; - this.add(cameraNZ); - } - updateCoordinateSystem() { - const coordinateSystem = this.coordinateSystem; - const cameras = this.children.concat(); - const [cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ] = cameras; - for (const camera of cameras) - this.remove(camera); - if (coordinateSystem === WebGLCoordinateSystem) { - cameraPX.up.set(0, 1, 0); - cameraPX.lookAt(1, 0, 0); - cameraNX.up.set(0, 1, 0); - cameraNX.lookAt(-1, 0, 0); - cameraPY.up.set(0, 0, -1); - cameraPY.lookAt(0, 1, 0); - cameraNY.up.set(0, 0, 1); - cameraNY.lookAt(0, -1, 0); - cameraPZ.up.set(0, 1, 0); - cameraPZ.lookAt(0, 0, 1); - cameraNZ.up.set(0, 1, 0); - cameraNZ.lookAt(0, 0, -1); - } else if (coordinateSystem === WebGPUCoordinateSystem) { - cameraPX.up.set(0, -1, 0); - cameraPX.lookAt(-1, 0, 0); - cameraNX.up.set(0, -1, 0); - cameraNX.lookAt(1, 0, 0); - cameraPY.up.set(0, 0, 1); - cameraPY.lookAt(0, 1, 0); - cameraNY.up.set(0, 0, -1); - cameraNY.lookAt(0, -1, 0); - cameraPZ.up.set(0, -1, 0); - cameraPZ.lookAt(0, 0, 1); - cameraNZ.up.set(0, -1, 0); - cameraNZ.lookAt(0, 0, -1); - } else { - throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: " + coordinateSystem); - } - for (const camera of cameras) { - this.add(camera); - camera.updateMatrixWorld(); - } - } - update(renderer, scene) { - if (this.parent === null) - this.updateMatrixWorld(); - const { renderTarget, activeMipmapLevel } = this; - if (this.coordinateSystem !== renderer.coordinateSystem) { - this.coordinateSystem = renderer.coordinateSystem; - this.updateCoordinateSystem(); - } - const [cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ] = this.children; - const currentRenderTarget = renderer.getRenderTarget(); - const currentActiveCubeFace = renderer.getActiveCubeFace(); - const currentActiveMipmapLevel = renderer.getActiveMipmapLevel(); - const currentXrEnabled = renderer.xr.enabled; - renderer.xr.enabled = false; - const generateMipmaps = renderTarget.texture.generateMipmaps; - renderTarget.texture.generateMipmaps = false; - renderer.setRenderTarget(renderTarget, 0, activeMipmapLevel); - renderer.render(scene, cameraPX); - renderer.setRenderTarget(renderTarget, 1, activeMipmapLevel); - renderer.render(scene, cameraNX); - renderer.setRenderTarget(renderTarget, 2, activeMipmapLevel); - renderer.render(scene, cameraPY); - renderer.setRenderTarget(renderTarget, 3, activeMipmapLevel); - renderer.render(scene, cameraNY); - renderer.setRenderTarget(renderTarget, 4, activeMipmapLevel); - renderer.render(scene, cameraPZ); - renderTarget.texture.generateMipmaps = generateMipmaps; - renderer.setRenderTarget(renderTarget, 5, activeMipmapLevel); - renderer.render(scene, cameraNZ); - renderer.setRenderTarget(currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel); - renderer.xr.enabled = currentXrEnabled; - renderTarget.texture.needsPMREMUpdate = true; - } -}; -var CubeTexture = class extends Texture { - constructor(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace) { - images = images !== void 0 ? images : []; - mapping = mapping !== void 0 ? mapping : CubeReflectionMapping; - super(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace); - this.isCubeTexture = true; - this.flipY = false; - } - get images() { - return this.image; - } - set images(value) { - this.image = value; - } -}; -var WebGLCubeRenderTarget = class extends WebGLRenderTarget { - constructor(size = 1, options = {}) { - super(size, size, options); - this.isWebGLCubeRenderTarget = true; - const image = { width: size, height: size, depth: 1 }; - const images = [image, image, image, image, image, image]; - if (options.encoding !== void 0) { - warnOnce("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."); - options.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace; - } - this.texture = new CubeTexture(images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace); - this.texture.isRenderTargetTexture = true; - this.texture.generateMipmaps = options.generateMipmaps !== void 0 ? options.generateMipmaps : false; - this.texture.minFilter = options.minFilter !== void 0 ? options.minFilter : LinearFilter; - } - fromEquirectangularTexture(renderer, texture) { - this.texture.type = texture.type; - this.texture.colorSpace = texture.colorSpace; - this.texture.generateMipmaps = texture.generateMipmaps; - this.texture.minFilter = texture.minFilter; - this.texture.magFilter = texture.magFilter; - const shader = { - uniforms: { - tEquirect: { value: null } - }, - vertexShader: ( - /* glsl */ - ` - - varying vec3 vWorldDirection; - - vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); - - } - - void main() { - - vWorldDirection = transformDirection( position, modelMatrix ); - - #include - #include - - } - ` - ), - fragmentShader: ( - /* glsl */ - ` - - uniform sampler2D tEquirect; - - varying vec3 vWorldDirection; - - #include - - void main() { - - vec3 direction = normalize( vWorldDirection ); - - vec2 sampleUV = equirectUv( direction ); - - gl_FragColor = texture2D( tEquirect, sampleUV ); - - } - ` - ) - }; - const geometry = new BoxGeometry(5, 5, 5); - const material = new ShaderMaterial({ - name: "CubemapFromEquirect", - uniforms: cloneUniforms(shader.uniforms), - vertexShader: shader.vertexShader, - fragmentShader: shader.fragmentShader, - side: BackSide, - blending: NoBlending - }); - material.uniforms.tEquirect.value = texture; - const mesh = new Mesh(geometry, material); - const currentMinFilter = texture.minFilter; - if (texture.minFilter === LinearMipmapLinearFilter) - texture.minFilter = LinearFilter; - const camera = new CubeCamera(1, 10, this); - camera.update(renderer, mesh); - texture.minFilter = currentMinFilter; - mesh.geometry.dispose(); - mesh.material.dispose(); - return this; - } - clear(renderer, color, depth, stencil) { - const currentRenderTarget = renderer.getRenderTarget(); - for (let i = 0; i < 6; i++) { - renderer.setRenderTarget(this, i); - renderer.clear(color, depth, stencil); - } - renderer.setRenderTarget(currentRenderTarget); - } -}; -var _vector1 = new Vector3(); -var _vector2 = new Vector3(); -var _normalMatrix = new Matrix3(); -var Plane = class { - constructor(normal = new Vector3(1, 0, 0), constant = 0) { - this.isPlane = true; - this.normal = normal; - this.constant = constant; - } - set(normal, constant) { - this.normal.copy(normal); - this.constant = constant; - return this; - } - setComponents(x, y, z, w) { - this.normal.set(x, y, z); - this.constant = w; - return this; - } - setFromNormalAndCoplanarPoint(normal, point) { - this.normal.copy(normal); - this.constant = -point.dot(this.normal); - return this; - } - setFromCoplanarPoints(a, b, c) { - const normal = _vector1.subVectors(c, b).cross(_vector2.subVectors(a, b)).normalize(); - this.setFromNormalAndCoplanarPoint(normal, a); - return this; - } - copy(plane) { - this.normal.copy(plane.normal); - this.constant = plane.constant; - return this; - } - normalize() { - const inverseNormalLength = 1 / this.normal.length(); - this.normal.multiplyScalar(inverseNormalLength); - this.constant *= inverseNormalLength; - return this; - } - negate() { - this.constant *= -1; - this.normal.negate(); - return this; - } - distanceToPoint(point) { - return this.normal.dot(point) + this.constant; - } - distanceToSphere(sphere) { - return this.distanceToPoint(sphere.center) - sphere.radius; - } - projectPoint(point, target) { - return target.copy(point).addScaledVector(this.normal, -this.distanceToPoint(point)); - } - intersectLine(line, target) { - const direction = line.delta(_vector1); - const denominator = this.normal.dot(direction); - if (denominator === 0) { - if (this.distanceToPoint(line.start) === 0) { - return target.copy(line.start); - } - return null; - } - const t = -(line.start.dot(this.normal) + this.constant) / denominator; - if (t < 0 || t > 1) { - return null; - } - return target.copy(line.start).addScaledVector(direction, t); - } - intersectsLine(line) { - const startSign = this.distanceToPoint(line.start); - const endSign = this.distanceToPoint(line.end); - return startSign < 0 && endSign > 0 || endSign < 0 && startSign > 0; - } - intersectsBox(box) { - return box.intersectsPlane(this); - } - intersectsSphere(sphere) { - return sphere.intersectsPlane(this); - } - coplanarPoint(target) { - return target.copy(this.normal).multiplyScalar(-this.constant); - } - applyMatrix4(matrix, optionalNormalMatrix) { - const normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix(matrix); - const referencePoint = this.coplanarPoint(_vector1).applyMatrix4(matrix); - const normal = this.normal.applyMatrix3(normalMatrix).normalize(); - this.constant = -referencePoint.dot(normal); - return this; - } - translate(offset) { - this.constant -= offset.dot(this.normal); - return this; - } - equals(plane) { - return plane.normal.equals(this.normal) && plane.constant === this.constant; - } - clone() { - return new this.constructor().copy(this); - } -}; -var _sphere$4 = new Sphere(); -var _vector$6 = new Vector3(); -var Frustum = class { - constructor(p0 = new Plane(), p1 = new Plane(), p2 = new Plane(), p3 = new Plane(), p4 = new Plane(), p5 = new Plane()) { - this.planes = [p0, p1, p2, p3, p4, p5]; - } - set(p0, p1, p2, p3, p4, p5) { - const planes = this.planes; - planes[0].copy(p0); - planes[1].copy(p1); - planes[2].copy(p2); - planes[3].copy(p3); - planes[4].copy(p4); - planes[5].copy(p5); - return this; - } - copy(frustum) { - const planes = this.planes; - for (let i = 0; i < 6; i++) { - planes[i].copy(frustum.planes[i]); - } - return this; - } - setFromProjectionMatrix(m, coordinateSystem = WebGLCoordinateSystem) { - const planes = this.planes; - const me = m.elements; - const me0 = me[0], me1 = me[1], me2 = me[2], me3 = me[3]; - const me4 = me[4], me5 = me[5], me6 = me[6], me7 = me[7]; - const me8 = me[8], me9 = me[9], me10 = me[10], me11 = me[11]; - const me12 = me[12], me13 = me[13], me14 = me[14], me15 = me[15]; - planes[0].setComponents(me3 - me0, me7 - me4, me11 - me8, me15 - me12).normalize(); - planes[1].setComponents(me3 + me0, me7 + me4, me11 + me8, me15 + me12).normalize(); - planes[2].setComponents(me3 + me1, me7 + me5, me11 + me9, me15 + me13).normalize(); - planes[3].setComponents(me3 - me1, me7 - me5, me11 - me9, me15 - me13).normalize(); - planes[4].setComponents(me3 - me2, me7 - me6, me11 - me10, me15 - me14).normalize(); - if (coordinateSystem === WebGLCoordinateSystem) { - planes[5].setComponents(me3 + me2, me7 + me6, me11 + me10, me15 + me14).normalize(); - } else if (coordinateSystem === WebGPUCoordinateSystem) { - planes[5].setComponents(me2, me6, me10, me14).normalize(); - } else { - throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: " + coordinateSystem); - } - return this; - } - intersectsObject(object) { - if (object.boundingSphere !== void 0) { - if (object.boundingSphere === null) - object.computeBoundingSphere(); - _sphere$4.copy(object.boundingSphere).applyMatrix4(object.matrixWorld); - } else { - const geometry = object.geometry; - if (geometry.boundingSphere === null) - geometry.computeBoundingSphere(); - _sphere$4.copy(geometry.boundingSphere).applyMatrix4(object.matrixWorld); - } - return this.intersectsSphere(_sphere$4); - } - intersectsSprite(sprite) { - _sphere$4.center.set(0, 0, 0); - _sphere$4.radius = 0.7071067811865476; - _sphere$4.applyMatrix4(sprite.matrixWorld); - return this.intersectsSphere(_sphere$4); - } - intersectsSphere(sphere) { - const planes = this.planes; - const center = sphere.center; - const negRadius = -sphere.radius; - for (let i = 0; i < 6; i++) { - const distance = planes[i].distanceToPoint(center); - if (distance < negRadius) { - return false; - } - } - return true; - } - intersectsBox(box) { - const planes = this.planes; - for (let i = 0; i < 6; i++) { - const plane = planes[i]; - _vector$6.x = plane.normal.x > 0 ? box.max.x : box.min.x; - _vector$6.y = plane.normal.y > 0 ? box.max.y : box.min.y; - _vector$6.z = plane.normal.z > 0 ? box.max.z : box.min.z; - if (plane.distanceToPoint(_vector$6) < 0) { - return false; - } - } - return true; - } - containsPoint(point) { - const planes = this.planes; - for (let i = 0; i < 6; i++) { - if (planes[i].distanceToPoint(point) < 0) { - return false; - } - } - return true; - } - clone() { - return new this.constructor().copy(this); - } -}; -function WebGLAnimation() { - let context = null; - let isAnimating = false; - let animationLoop = null; - let requestId = null; - function onAnimationFrame(time, frame) { - animationLoop(time, frame); - requestId = context.requestAnimationFrame(onAnimationFrame); - } - return { - start: function() { - if (isAnimating === true) - return; - if (animationLoop === null) - return; - requestId = context.requestAnimationFrame(onAnimationFrame); - isAnimating = true; - }, - stop: function() { - context.cancelAnimationFrame(requestId); - isAnimating = false; - }, - setAnimationLoop: function(callback) { - animationLoop = callback; - }, - setContext: function(value) { - context = value; - } - }; -} -function WebGLAttributes(gl, capabilities) { - const isWebGL2 = capabilities.isWebGL2; - const buffers = /* @__PURE__ */ new WeakMap(); - function createBuffer(attribute, bufferType) { - const array = attribute.array; - const usage = attribute.usage; - const buffer = gl.createBuffer(); - gl.bindBuffer(bufferType, buffer); - gl.bufferData(bufferType, array, usage); - attribute.onUploadCallback(); - let type; - if (array instanceof Float32Array) { - type = gl.FLOAT; - } else if (array instanceof Uint16Array) { - if (attribute.isFloat16BufferAttribute) { - if (isWebGL2) { - type = gl.HALF_FLOAT; - } else { - throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."); - } - } else { - type = gl.UNSIGNED_SHORT; - } - } else if (array instanceof Int16Array) { - type = gl.SHORT; - } else if (array instanceof Uint32Array) { - type = gl.UNSIGNED_INT; - } else if (array instanceof Int32Array) { - type = gl.INT; - } else if (array instanceof Int8Array) { - type = gl.BYTE; - } else if (array instanceof Uint8Array) { - type = gl.UNSIGNED_BYTE; - } else if (array instanceof Uint8ClampedArray) { - type = gl.UNSIGNED_BYTE; - } else { - throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: " + array); - } - return { - buffer, - type, - bytesPerElement: array.BYTES_PER_ELEMENT, - version: attribute.version - }; - } - function updateBuffer(buffer, attribute, bufferType) { - const array = attribute.array; - const updateRange = attribute.updateRange; - gl.bindBuffer(bufferType, buffer); - if (updateRange.count === -1) { - gl.bufferSubData(bufferType, 0, array); - } else { - if (isWebGL2) { - gl.bufferSubData( - bufferType, - updateRange.offset * array.BYTES_PER_ELEMENT, - array, - updateRange.offset, - updateRange.count - ); - } else { - gl.bufferSubData( - bufferType, - updateRange.offset * array.BYTES_PER_ELEMENT, - array.subarray(updateRange.offset, updateRange.offset + updateRange.count) - ); - } - updateRange.count = -1; - } - attribute.onUploadCallback(); - } - function get(attribute) { - if (attribute.isInterleavedBufferAttribute) - attribute = attribute.data; - return buffers.get(attribute); - } - function remove(attribute) { - if (attribute.isInterleavedBufferAttribute) - attribute = attribute.data; - const data = buffers.get(attribute); - if (data) { - gl.deleteBuffer(data.buffer); - buffers.delete(attribute); - } - } - function update(attribute, bufferType) { - if (attribute.isGLBufferAttribute) { - const cached = buffers.get(attribute); - if (!cached || cached.version < attribute.version) { - buffers.set(attribute, { - buffer: attribute.buffer, - type: attribute.type, - bytesPerElement: attribute.elementSize, - version: attribute.version - }); - } - return; - } - if (attribute.isInterleavedBufferAttribute) - attribute = attribute.data; - const data = buffers.get(attribute); - if (data === void 0) { - buffers.set(attribute, createBuffer(attribute, bufferType)); - } else if (data.version < attribute.version) { - updateBuffer(data.buffer, attribute, bufferType); - data.version = attribute.version; - } - } - return { - get, - remove, - update - }; -} -var PlaneGeometry = class _PlaneGeometry extends BufferGeometry { - constructor(width = 1, height = 1, widthSegments = 1, heightSegments = 1) { - super(); - this.type = "PlaneGeometry"; - this.parameters = { - width, - height, - widthSegments, - heightSegments - }; - const width_half = width / 2; - const height_half = height / 2; - const gridX = Math.floor(widthSegments); - const gridY = Math.floor(heightSegments); - const gridX1 = gridX + 1; - const gridY1 = gridY + 1; - const segment_width = width / gridX; - const segment_height = height / gridY; - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - for (let iy = 0; iy < gridY1; iy++) { - const y = iy * segment_height - height_half; - for (let ix = 0; ix < gridX1; ix++) { - const x = ix * segment_width - width_half; - vertices.push(x, -y, 0); - normals.push(0, 0, 1); - uvs.push(ix / gridX); - uvs.push(1 - iy / gridY); - } - } - for (let iy = 0; iy < gridY; iy++) { - for (let ix = 0; ix < gridX; ix++) { - const a = ix + gridX1 * iy; - const b = ix + gridX1 * (iy + 1); - const c = ix + 1 + gridX1 * (iy + 1); - const d = ix + 1 + gridX1 * iy; - indices.push(a, b, d); - indices.push(b, c, d); - } - } - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new _PlaneGeometry(data.width, data.height, data.widthSegments, data.heightSegments); - } -}; -var alphahash_fragment = "#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif"; -var alphahash_pars_fragment = "#ifdef USE_ALPHAHASH\n const float ALPHA_HASH_SCALE = 0.05;\n float hash2D( vec2 value ) {\n return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n }\n float hash3D( vec3 value ) {\n return hash2D( vec2( hash2D( value.xy ), value.z ) );\n }\n float getAlphaHashThreshold( vec3 position ) {\n float maxDeriv = max(\n length( dFdx( position.xyz ) ),\n length( dFdy( position.xyz ) )\n );\n float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n vec2 pixScales = vec2(\n exp2( floor( log2( pixScale ) ) ),\n exp2( ceil( log2( pixScale ) ) )\n );\n vec2 alpha = vec2(\n hash3D( floor( pixScales.x * position.xyz ) ),\n hash3D( floor( pixScales.y * position.xyz ) )\n );\n float lerpFactor = fract( log2( pixScale ) );\n float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n float a = min( lerpFactor, 1.0 - lerpFactor );\n vec3 cases = vec3(\n x * x / ( 2.0 * a * ( 1.0 - a ) ),\n ( x - 0.5 * a ) / ( 1.0 - a ),\n 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n );\n float threshold = ( x < ( 1.0 - a ) )\n ? ( ( x < a ) ? cases.x : cases.y )\n : cases.z;\n return clamp( threshold , 1.0e-6, 1.0 );\n }\n#endif"; -var alphamap_fragment = "#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif"; -var alphamap_pars_fragment = "#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif"; -var alphatest_fragment = "#ifdef USE_ALPHATEST\n if ( diffuseColor.a < alphaTest ) discard;\n#endif"; -var alphatest_pars_fragment = "#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif"; -var aomap_fragment = "#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif"; -var aomap_pars_fragment = "#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif"; -var begin_vertex = "vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif"; -var beginnormal_vertex = "vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif"; -var bsdfs = "float G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n} // validated"; -var iridescence_fragment = "#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif"; -var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vBumpMapUv );\n vec2 dSTdy = dFdy( vBumpMapUv );\n float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif"; -var clipping_planes_fragment = "#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n#endif"; -var clipping_planes_pars_fragment = "#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif"; -var clipping_planes_pars_vertex = "#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif"; -var clipping_planes_vertex = "#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif"; -var color_fragment = "#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif"; -var color_pars_fragment = "#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif"; -var color_pars_vertex = "#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n varying vec3 vColor;\n#endif"; -var color_vertex = "#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif"; -var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n return dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated"; -var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_v0 0.339\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_v1 0.276\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_v4 0.046\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_v5 0.016\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_v6 0.0038\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif"; -var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n mat3 m = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n transformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif"; -var displacementmap_pars_vertex = "#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif"; -var displacementmap_vertex = "#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif"; -var emissivemap_fragment = "#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif"; -var emissivemap_pars_fragment = "#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif"; -var colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );"; -var colorspace_pars_fragment = "\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n vec3( 0.8224621, 0.177538, 0.0 ),\n vec3( 0.0331941, 0.9668058, 0.0 ),\n vec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n vec3( 1.2249401, - 0.2249404, 0.0 ),\n vec3( - 0.0420569, 1.0420571, 0.0 ),\n vec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return sRGBTransferOETF( value );\n}"; -var envmap_fragment = "#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif"; -var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif"; -var envmap_pars_fragment = "#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif"; -var envmap_pars_vertex = "#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif"; -var envmap_vertex = "#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif"; -var fog_vertex = "#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif"; -var fog_pars_vertex = "#ifdef USE_FOG\n varying float vFogDepth;\n#endif"; -var fog_fragment = "#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif"; -var fog_pars_fragment = "#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif"; -var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}"; -var lightmap_fragment = "#ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n reflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif"; -var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif"; -var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;"; -var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert"; -var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n #if defined ( LEGACY_LIGHTS )\n if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n }\n return 1.0;\n #else\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n #endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif"; -var envmap_physical_pars_fragment = "#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif"; -var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;"; -var lights_toon_pars_fragment = "varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon"; -var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;"; -var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong"; -var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif"; -var lights_physical_pars_fragment = "struct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return saturate(v);\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColor;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n return saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n return fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n #endif\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n #endif\n vec3 totalScattering = singleScattering + multiScattering;\n vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}"; -var lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif"; -var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif"; -var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif"; -var logdepthbuf_fragment = "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif"; -var logdepthbuf_pars_fragment = "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif"; -var logdepthbuf_pars_vertex = "#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n varying float vIsPerspective;\n #else\n uniform float logDepthBufFC;\n #endif\n#endif"; -var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n #else\n if ( isPerspectiveMatrix( projectionMatrix ) ) {\n gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n gl_Position.z *= gl_Position.w;\n }\n #endif\n#endif"; -var map_fragment = "#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n \n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif"; -var map_pars_fragment = "#ifdef USE_MAP\n uniform sampler2D map;\n#endif"; -var map_particle_fragment = "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif"; -var map_particle_pars_fragment = "#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif"; -var metalnessmap_fragment = "float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif"; -var metalnessmap_pars_fragment = "#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif"; -var morphcolor_vertex = "#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif"; -var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n #endif\n#endif"; -var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n uniform float morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n #else\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[ 8 ];\n #else\n uniform float morphTargetInfluences[ 4 ];\n #endif\n #endif\n#endif"; -var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n transformed += morphTarget0 * morphTargetInfluences[ 0 ];\n transformed += morphTarget1 * morphTargetInfluences[ 1 ];\n transformed += morphTarget2 * morphTargetInfluences[ 2 ];\n transformed += morphTarget3 * morphTargetInfluences[ 3 ];\n #ifndef USE_MORPHNORMALS\n transformed += morphTarget4 * morphTargetInfluences[ 4 ];\n transformed += morphTarget5 * morphTargetInfluences[ 5 ];\n transformed += morphTarget6 * morphTargetInfluences[ 6 ];\n transformed += morphTarget7 * morphTargetInfluences[ 7 ];\n #endif\n #endif\n#endif"; -var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;"; -var normal_fragment_maps = "#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif"; -var normal_pars_fragment = "#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif"; -var normal_pars_vertex = "#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif"; -var normal_vertex = "#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif"; -var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif"; -var clearcoat_normal_fragment_begin = "#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif"; -var clearcoat_normal_fragment_maps = "#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif"; -var clearcoat_pars_fragment = "#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif"; -var iridescence_pars_fragment = "#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif"; -var opaque_fragment = "#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );"; -var packing = "vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * PackFactors ), v );\n r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n return packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}"; -var premultiplied_alpha_fragment = "#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif"; -var project_vertex = "vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;"; -var dithering_fragment = "#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif"; -var dithering_pars_fragment = "#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif"; -var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif"; -var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif"; -var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n float hard_shadow = step( compare , distribution.x );\n if (hard_shadow != 1.0 ) {\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return shadow;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n vec3 lightToPosition = shadowCoord.xyz;\n float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n return (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n#endif"; -var shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif"; -var shadowmap_vertex = "#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif"; -var shadowmask_pars_fragment = "float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}"; -var skinbase_vertex = "#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif"; -var skinning_pars_vertex = "#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n uniform int boneTextureSize;\n mat4 getBoneMatrix( const in float i ) {\n float j = i * 4.0;\n float x = mod( j, float( boneTextureSize ) );\n float y = floor( j / float( boneTextureSize ) );\n float dx = 1.0 / float( boneTextureSize );\n float dy = 1.0 / float( boneTextureSize );\n y = dy * ( y + 0.5 );\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n mat4 bone = mat4( v1, v2, v3, v4 );\n return bone;\n }\n#endif"; -var skinning_vertex = "#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif"; -var skinnormal_vertex = "#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif"; -var specularmap_fragment = "float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif"; -var specularmap_pars_fragment = "#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif"; -var tonemapping_fragment = "#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif"; -var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }"; -var transmission_fragment = "#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif"; -var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif"; -var uv_pars_fragment = "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif"; -var uv_pars_vertex = "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif"; -var uv_vertex = "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif"; -var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif"; -var vertex$h = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}"; -var fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}"; -var vertex$g = "varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}"; -var fragment$g = "#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}"; -var vertex$f = "varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}"; -var fragment$f = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include \n #include \n}"; -var vertex$e = "#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vHighPrecisionZW = gl_Position.zw;\n}"; -var fragment$e = "#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include \n vec4 diffuseColor = vec4( 1.0 );\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include \n #include \n #include \n #include \n #include \n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #endif\n}"; -var vertex$d = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vWorldPosition = worldPosition.xyz;\n}"; -var fragment$d = "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n #include \n vec4 diffuseColor = vec4( 1.0 );\n #include \n #include \n #include \n #include \n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}"; -var vertex$c = "varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n}"; -var fragment$c = "uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include \n #include \n}"; -var vertex$b = "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vLineDistance = scale * lineDistance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}"; -var fragment$b = "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}"; -var vertex$a = "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include \n #include \n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}"; -var fragment$a = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include \n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}"; -var vertex$9 = "#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}"; -var fragment$9 = "#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}"; -var vertex$8 = "#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n}"; -var fragment$8 = "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include \n #include \n #include \n #include \n #include \n #include \n}"; -var vertex$7 = "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}"; -var fragment$7 = "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n gl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}"; -var vertex$6 = "#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}"; -var fragment$6 = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}"; -var vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}"; -var fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include \n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n}"; -var vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n}"; -var fragment$4 = "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n}"; -var vertex$3 = "uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include \n #include \n #include \n #include \n #include \n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include \n #include \n #include \n #include \n}"; -var fragment$3 = "uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}"; -var vertex$2 = "#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}"; -var fragment$2 = "uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include \n #include \n #include \n}"; -var vertex$1 = "uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include \n #include \n #include \n}"; -var fragment$1 = "uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n}"; -var ShaderChunk = { - alphahash_fragment, - alphahash_pars_fragment, - alphamap_fragment, - alphamap_pars_fragment, - alphatest_fragment, - alphatest_pars_fragment, - aomap_fragment, - aomap_pars_fragment, - begin_vertex, - beginnormal_vertex, - bsdfs, - iridescence_fragment, - bumpmap_pars_fragment, - clipping_planes_fragment, - clipping_planes_pars_fragment, - clipping_planes_pars_vertex, - clipping_planes_vertex, - color_fragment, - color_pars_fragment, - color_pars_vertex, - color_vertex, - common, - cube_uv_reflection_fragment, - defaultnormal_vertex, - displacementmap_pars_vertex, - displacementmap_vertex, - emissivemap_fragment, - emissivemap_pars_fragment, - colorspace_fragment, - colorspace_pars_fragment, - envmap_fragment, - envmap_common_pars_fragment, - envmap_pars_fragment, - envmap_pars_vertex, - envmap_physical_pars_fragment, - envmap_vertex, - fog_vertex, - fog_pars_vertex, - fog_fragment, - fog_pars_fragment, - gradientmap_pars_fragment, - lightmap_fragment, - lightmap_pars_fragment, - lights_lambert_fragment, - lights_lambert_pars_fragment, - lights_pars_begin, - lights_toon_fragment, - lights_toon_pars_fragment, - lights_phong_fragment, - lights_phong_pars_fragment, - lights_physical_fragment, - lights_physical_pars_fragment, - lights_fragment_begin, - lights_fragment_maps, - lights_fragment_end, - logdepthbuf_fragment, - logdepthbuf_pars_fragment, - logdepthbuf_pars_vertex, - logdepthbuf_vertex, - map_fragment, - map_pars_fragment, - map_particle_fragment, - map_particle_pars_fragment, - metalnessmap_fragment, - metalnessmap_pars_fragment, - morphcolor_vertex, - morphnormal_vertex, - morphtarget_pars_vertex, - morphtarget_vertex, - normal_fragment_begin, - normal_fragment_maps, - normal_pars_fragment, - normal_pars_vertex, - normal_vertex, - normalmap_pars_fragment, - clearcoat_normal_fragment_begin, - clearcoat_normal_fragment_maps, - clearcoat_pars_fragment, - iridescence_pars_fragment, - opaque_fragment, - packing, - premultiplied_alpha_fragment, - project_vertex, - dithering_fragment, - dithering_pars_fragment, - roughnessmap_fragment, - roughnessmap_pars_fragment, - shadowmap_pars_fragment, - shadowmap_pars_vertex, - shadowmap_vertex, - shadowmask_pars_fragment, - skinbase_vertex, - skinning_pars_vertex, - skinning_vertex, - skinnormal_vertex, - specularmap_fragment, - specularmap_pars_fragment, - tonemapping_fragment, - tonemapping_pars_fragment, - transmission_fragment, - transmission_pars_fragment, - uv_pars_fragment, - uv_pars_vertex, - uv_vertex, - worldpos_vertex, - background_vert: vertex$h, - background_frag: fragment$h, - backgroundCube_vert: vertex$g, - backgroundCube_frag: fragment$g, - cube_vert: vertex$f, - cube_frag: fragment$f, - depth_vert: vertex$e, - depth_frag: fragment$e, - distanceRGBA_vert: vertex$d, - distanceRGBA_frag: fragment$d, - equirect_vert: vertex$c, - equirect_frag: fragment$c, - linedashed_vert: vertex$b, - linedashed_frag: fragment$b, - meshbasic_vert: vertex$a, - meshbasic_frag: fragment$a, - meshlambert_vert: vertex$9, - meshlambert_frag: fragment$9, - meshmatcap_vert: vertex$8, - meshmatcap_frag: fragment$8, - meshnormal_vert: vertex$7, - meshnormal_frag: fragment$7, - meshphong_vert: vertex$6, - meshphong_frag: fragment$6, - meshphysical_vert: vertex$5, - meshphysical_frag: fragment$5, - meshtoon_vert: vertex$4, - meshtoon_frag: fragment$4, - points_vert: vertex$3, - points_frag: fragment$3, - shadow_vert: vertex$2, - shadow_frag: fragment$2, - sprite_vert: vertex$1, - sprite_frag: fragment$1 -}; -var UniformsLib = { - common: { - diffuse: { value: new Color(16777215) }, - opacity: { value: 1 }, - map: { value: null }, - mapTransform: { value: new Matrix3() }, - alphaMap: { value: null }, - alphaMapTransform: { value: new Matrix3() }, - alphaTest: { value: 0 } - }, - specularmap: { - specularMap: { value: null }, - specularMapTransform: { value: new Matrix3() } - }, - envmap: { - envMap: { value: null }, - flipEnvMap: { value: -1 }, - reflectivity: { value: 1 }, - // basic, lambert, phong - ior: { value: 1.5 }, - // physical - refractionRatio: { value: 0.98 } - // basic, lambert, phong - }, - aomap: { - aoMap: { value: null }, - aoMapIntensity: { value: 1 }, - aoMapTransform: { value: new Matrix3() } - }, - lightmap: { - lightMap: { value: null }, - lightMapIntensity: { value: 1 }, - lightMapTransform: { value: new Matrix3() } - }, - bumpmap: { - bumpMap: { value: null }, - bumpMapTransform: { value: new Matrix3() }, - bumpScale: { value: 1 } - }, - normalmap: { - normalMap: { value: null }, - normalMapTransform: { value: new Matrix3() }, - normalScale: { value: new Vector2(1, 1) } - }, - displacementmap: { - displacementMap: { value: null }, - displacementMapTransform: { value: new Matrix3() }, - displacementScale: { value: 1 }, - displacementBias: { value: 0 } - }, - emissivemap: { - emissiveMap: { value: null }, - emissiveMapTransform: { value: new Matrix3() } - }, - metalnessmap: { - metalnessMap: { value: null }, - metalnessMapTransform: { value: new Matrix3() } - }, - roughnessmap: { - roughnessMap: { value: null }, - roughnessMapTransform: { value: new Matrix3() } - }, - gradientmap: { - gradientMap: { value: null } - }, - fog: { - fogDensity: { value: 25e-5 }, - fogNear: { value: 1 }, - fogFar: { value: 2e3 }, - fogColor: { value: new Color(16777215) } - }, - lights: { - ambientLightColor: { value: [] }, - lightProbe: { value: [] }, - directionalLights: { value: [], properties: { - direction: {}, - color: {} - } }, - directionalLightShadows: { value: [], properties: { - shadowBias: {}, - shadowNormalBias: {}, - shadowRadius: {}, - shadowMapSize: {} - } }, - directionalShadowMap: { value: [] }, - directionalShadowMatrix: { value: [] }, - spotLights: { value: [], properties: { - color: {}, - position: {}, - direction: {}, - distance: {}, - coneCos: {}, - penumbraCos: {}, - decay: {} - } }, - spotLightShadows: { value: [], properties: { - shadowBias: {}, - shadowNormalBias: {}, - shadowRadius: {}, - shadowMapSize: {} - } }, - spotLightMap: { value: [] }, - spotShadowMap: { value: [] }, - spotLightMatrix: { value: [] }, - pointLights: { value: [], properties: { - color: {}, - position: {}, - decay: {}, - distance: {} - } }, - pointLightShadows: { value: [], properties: { - shadowBias: {}, - shadowNormalBias: {}, - shadowRadius: {}, - shadowMapSize: {}, - shadowCameraNear: {}, - shadowCameraFar: {} - } }, - pointShadowMap: { value: [] }, - pointShadowMatrix: { value: [] }, - hemisphereLights: { value: [], properties: { - direction: {}, - skyColor: {}, - groundColor: {} - } }, - // TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src - rectAreaLights: { value: [], properties: { - color: {}, - position: {}, - width: {}, - height: {} - } }, - ltc_1: { value: null }, - ltc_2: { value: null } - }, - points: { - diffuse: { value: new Color(16777215) }, - opacity: { value: 1 }, - size: { value: 1 }, - scale: { value: 1 }, - map: { value: null }, - alphaMap: { value: null }, - alphaMapTransform: { value: new Matrix3() }, - alphaTest: { value: 0 }, - uvTransform: { value: new Matrix3() } - }, - sprite: { - diffuse: { value: new Color(16777215) }, - opacity: { value: 1 }, - center: { value: new Vector2(0.5, 0.5) }, - rotation: { value: 0 }, - map: { value: null }, - mapTransform: { value: new Matrix3() }, - alphaMap: { value: null }, - alphaMapTransform: { value: new Matrix3() }, - alphaTest: { value: 0 } - } -}; -var ShaderLib = { - basic: { - uniforms: mergeUniforms([ - UniformsLib.common, - UniformsLib.specularmap, - UniformsLib.envmap, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.fog - ]), - vertexShader: ShaderChunk.meshbasic_vert, - fragmentShader: ShaderChunk.meshbasic_frag - }, - lambert: { - uniforms: mergeUniforms([ - UniformsLib.common, - UniformsLib.specularmap, - UniformsLib.envmap, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - UniformsLib.fog, - UniformsLib.lights, - { - emissive: { value: new Color(0) } - } - ]), - vertexShader: ShaderChunk.meshlambert_vert, - fragmentShader: ShaderChunk.meshlambert_frag - }, - phong: { - uniforms: mergeUniforms([ - UniformsLib.common, - UniformsLib.specularmap, - UniformsLib.envmap, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - UniformsLib.fog, - UniformsLib.lights, - { - emissive: { value: new Color(0) }, - specular: { value: new Color(1118481) }, - shininess: { value: 30 } - } - ]), - vertexShader: ShaderChunk.meshphong_vert, - fragmentShader: ShaderChunk.meshphong_frag - }, - standard: { - uniforms: mergeUniforms([ - UniformsLib.common, - UniformsLib.envmap, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - UniformsLib.roughnessmap, - UniformsLib.metalnessmap, - UniformsLib.fog, - UniformsLib.lights, - { - emissive: { value: new Color(0) }, - roughness: { value: 1 }, - metalness: { value: 0 }, - envMapIntensity: { value: 1 } - // temporary - } - ]), - vertexShader: ShaderChunk.meshphysical_vert, - fragmentShader: ShaderChunk.meshphysical_frag - }, - toon: { - uniforms: mergeUniforms([ - UniformsLib.common, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - UniformsLib.gradientmap, - UniformsLib.fog, - UniformsLib.lights, - { - emissive: { value: new Color(0) } - } - ]), - vertexShader: ShaderChunk.meshtoon_vert, - fragmentShader: ShaderChunk.meshtoon_frag - }, - matcap: { - uniforms: mergeUniforms([ - UniformsLib.common, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - UniformsLib.fog, - { - matcap: { value: null } - } - ]), - vertexShader: ShaderChunk.meshmatcap_vert, - fragmentShader: ShaderChunk.meshmatcap_frag - }, - points: { - uniforms: mergeUniforms([ - UniformsLib.points, - UniformsLib.fog - ]), - vertexShader: ShaderChunk.points_vert, - fragmentShader: ShaderChunk.points_frag - }, - dashed: { - uniforms: mergeUniforms([ - UniformsLib.common, - UniformsLib.fog, - { - scale: { value: 1 }, - dashSize: { value: 1 }, - totalSize: { value: 2 } - } - ]), - vertexShader: ShaderChunk.linedashed_vert, - fragmentShader: ShaderChunk.linedashed_frag - }, - depth: { - uniforms: mergeUniforms([ - UniformsLib.common, - UniformsLib.displacementmap - ]), - vertexShader: ShaderChunk.depth_vert, - fragmentShader: ShaderChunk.depth_frag - }, - normal: { - uniforms: mergeUniforms([ - UniformsLib.common, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - { - opacity: { value: 1 } - } - ]), - vertexShader: ShaderChunk.meshnormal_vert, - fragmentShader: ShaderChunk.meshnormal_frag - }, - sprite: { - uniforms: mergeUniforms([ - UniformsLib.sprite, - UniformsLib.fog - ]), - vertexShader: ShaderChunk.sprite_vert, - fragmentShader: ShaderChunk.sprite_frag - }, - background: { - uniforms: { - uvTransform: { value: new Matrix3() }, - t2D: { value: null }, - backgroundIntensity: { value: 1 } - }, - vertexShader: ShaderChunk.background_vert, - fragmentShader: ShaderChunk.background_frag - }, - backgroundCube: { - uniforms: { - envMap: { value: null }, - flipEnvMap: { value: -1 }, - backgroundBlurriness: { value: 0 }, - backgroundIntensity: { value: 1 } - }, - vertexShader: ShaderChunk.backgroundCube_vert, - fragmentShader: ShaderChunk.backgroundCube_frag - }, - cube: { - uniforms: { - tCube: { value: null }, - tFlip: { value: -1 }, - opacity: { value: 1 } - }, - vertexShader: ShaderChunk.cube_vert, - fragmentShader: ShaderChunk.cube_frag - }, - equirect: { - uniforms: { - tEquirect: { value: null } - }, - vertexShader: ShaderChunk.equirect_vert, - fragmentShader: ShaderChunk.equirect_frag - }, - distanceRGBA: { - uniforms: mergeUniforms([ - UniformsLib.common, - UniformsLib.displacementmap, - { - referencePosition: { value: new Vector3() }, - nearDistance: { value: 1 }, - farDistance: { value: 1e3 } - } - ]), - vertexShader: ShaderChunk.distanceRGBA_vert, - fragmentShader: ShaderChunk.distanceRGBA_frag - }, - shadow: { - uniforms: mergeUniforms([ - UniformsLib.lights, - UniformsLib.fog, - { - color: { value: new Color(0) }, - opacity: { value: 1 } - } - ]), - vertexShader: ShaderChunk.shadow_vert, - fragmentShader: ShaderChunk.shadow_frag - } -}; -ShaderLib.physical = { - uniforms: mergeUniforms([ - ShaderLib.standard.uniforms, - { - clearcoat: { value: 0 }, - clearcoatMap: { value: null }, - clearcoatMapTransform: { value: new Matrix3() }, - clearcoatNormalMap: { value: null }, - clearcoatNormalMapTransform: { value: new Matrix3() }, - clearcoatNormalScale: { value: new Vector2(1, 1) }, - clearcoatRoughness: { value: 0 }, - clearcoatRoughnessMap: { value: null }, - clearcoatRoughnessMapTransform: { value: new Matrix3() }, - iridescence: { value: 0 }, - iridescenceMap: { value: null }, - iridescenceMapTransform: { value: new Matrix3() }, - iridescenceIOR: { value: 1.3 }, - iridescenceThicknessMinimum: { value: 100 }, - iridescenceThicknessMaximum: { value: 400 }, - iridescenceThicknessMap: { value: null }, - iridescenceThicknessMapTransform: { value: new Matrix3() }, - sheen: { value: 0 }, - sheenColor: { value: new Color(0) }, - sheenColorMap: { value: null }, - sheenColorMapTransform: { value: new Matrix3() }, - sheenRoughness: { value: 1 }, - sheenRoughnessMap: { value: null }, - sheenRoughnessMapTransform: { value: new Matrix3() }, - transmission: { value: 0 }, - transmissionMap: { value: null }, - transmissionMapTransform: { value: new Matrix3() }, - transmissionSamplerSize: { value: new Vector2() }, - transmissionSamplerMap: { value: null }, - thickness: { value: 0 }, - thicknessMap: { value: null }, - thicknessMapTransform: { value: new Matrix3() }, - attenuationDistance: { value: 0 }, - attenuationColor: { value: new Color(0) }, - specularColor: { value: new Color(1, 1, 1) }, - specularColorMap: { value: null }, - specularColorMapTransform: { value: new Matrix3() }, - specularIntensity: { value: 1 }, - specularIntensityMap: { value: null }, - specularIntensityMapTransform: { value: new Matrix3() }, - anisotropyVector: { value: new Vector2() }, - anisotropyMap: { value: null }, - anisotropyMapTransform: { value: new Matrix3() } - } - ]), - vertexShader: ShaderChunk.meshphysical_vert, - fragmentShader: ShaderChunk.meshphysical_frag -}; -var _rgb = { r: 0, b: 0, g: 0 }; -function WebGLBackground(renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha) { - const clearColor = new Color(0); - let clearAlpha = alpha === true ? 0 : 1; - let planeMesh; - let boxMesh; - let currentBackground = null; - let currentBackgroundVersion = 0; - let currentTonemapping = null; - function render(renderList, scene) { - let forceClear = false; - let background = scene.isScene === true ? scene.background : null; - if (background && background.isTexture) { - const usePMREM = scene.backgroundBlurriness > 0; - background = (usePMREM ? cubeuvmaps : cubemaps).get(background); - } - if (background === null) { - setClear(clearColor, clearAlpha); - } else if (background && background.isColor) { - setClear(background, 1); - forceClear = true; - } - const environmentBlendMode = renderer.xr.getEnvironmentBlendMode(); - if (environmentBlendMode === "additive") { - state.buffers.color.setClear(0, 0, 0, 1, premultipliedAlpha); - } else if (environmentBlendMode === "alpha-blend") { - state.buffers.color.setClear(0, 0, 0, 0, premultipliedAlpha); - } - if (renderer.autoClear || forceClear) { - renderer.clear(renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil); - } - if (background && (background.isCubeTexture || background.mapping === CubeUVReflectionMapping)) { - if (boxMesh === void 0) { - boxMesh = new Mesh( - new BoxGeometry(1, 1, 1), - new ShaderMaterial({ - name: "BackgroundCubeMaterial", - uniforms: cloneUniforms(ShaderLib.backgroundCube.uniforms), - vertexShader: ShaderLib.backgroundCube.vertexShader, - fragmentShader: ShaderLib.backgroundCube.fragmentShader, - side: BackSide, - depthTest: false, - depthWrite: false, - fog: false - }) - ); - boxMesh.geometry.deleteAttribute("normal"); - boxMesh.geometry.deleteAttribute("uv"); - boxMesh.onBeforeRender = function(renderer2, scene2, camera) { - this.matrixWorld.copyPosition(camera.matrixWorld); - }; - Object.defineProperty(boxMesh.material, "envMap", { - get: function() { - return this.uniforms.envMap.value; - } - }); - objects.update(boxMesh); - } - boxMesh.material.uniforms.envMap.value = background; - boxMesh.material.uniforms.flipEnvMap.value = background.isCubeTexture && background.isRenderTargetTexture === false ? -1 : 1; - boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness; - boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity; - boxMesh.material.toneMapped = ColorManagement.getTransfer(background.colorSpace) !== SRGBTransfer; - if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) { - boxMesh.material.needsUpdate = true; - currentBackground = background; - currentBackgroundVersion = background.version; - currentTonemapping = renderer.toneMapping; - } - boxMesh.layers.enableAll(); - renderList.unshift(boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null); - } else if (background && background.isTexture) { - if (planeMesh === void 0) { - planeMesh = new Mesh( - new PlaneGeometry(2, 2), - new ShaderMaterial({ - name: "BackgroundMaterial", - uniforms: cloneUniforms(ShaderLib.background.uniforms), - vertexShader: ShaderLib.background.vertexShader, - fragmentShader: ShaderLib.background.fragmentShader, - side: FrontSide, - depthTest: false, - depthWrite: false, - fog: false - }) - ); - planeMesh.geometry.deleteAttribute("normal"); - Object.defineProperty(planeMesh.material, "map", { - get: function() { - return this.uniforms.t2D.value; - } - }); - objects.update(planeMesh); - } - planeMesh.material.uniforms.t2D.value = background; - planeMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity; - planeMesh.material.toneMapped = ColorManagement.getTransfer(background.colorSpace) !== SRGBTransfer; - if (background.matrixAutoUpdate === true) { - background.updateMatrix(); - } - planeMesh.material.uniforms.uvTransform.value.copy(background.matrix); - if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) { - planeMesh.material.needsUpdate = true; - currentBackground = background; - currentBackgroundVersion = background.version; - currentTonemapping = renderer.toneMapping; - } - planeMesh.layers.enableAll(); - renderList.unshift(planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null); - } - } - function setClear(color, alpha2) { - color.getRGB(_rgb, getUnlitUniformColorSpace(renderer)); - state.buffers.color.setClear(_rgb.r, _rgb.g, _rgb.b, alpha2, premultipliedAlpha); - } - return { - getClearColor: function() { - return clearColor; - }, - setClearColor: function(color, alpha2 = 1) { - clearColor.set(color); - clearAlpha = alpha2; - setClear(clearColor, clearAlpha); - }, - getClearAlpha: function() { - return clearAlpha; - }, - setClearAlpha: function(alpha2) { - clearAlpha = alpha2; - setClear(clearColor, clearAlpha); - }, - render - }; -} -function WebGLBindingStates(gl, extensions, attributes, capabilities) { - const maxVertexAttributes = gl.getParameter(gl.MAX_VERTEX_ATTRIBS); - const extension = capabilities.isWebGL2 ? null : extensions.get("OES_vertex_array_object"); - const vaoAvailable = capabilities.isWebGL2 || extension !== null; - const bindingStates = {}; - const defaultState = createBindingState(null); - let currentState = defaultState; - let forceUpdate = false; - function setup(object, material, program, geometry, index) { - let updateBuffers = false; - if (vaoAvailable) { - const state = getBindingState(geometry, program, material); - if (currentState !== state) { - currentState = state; - bindVertexArrayObject(currentState.object); - } - updateBuffers = needsUpdate(object, geometry, program, index); - if (updateBuffers) - saveCache(object, geometry, program, index); - } else { - const wireframe = material.wireframe === true; - if (currentState.geometry !== geometry.id || currentState.program !== program.id || currentState.wireframe !== wireframe) { - currentState.geometry = geometry.id; - currentState.program = program.id; - currentState.wireframe = wireframe; - updateBuffers = true; - } - } - if (index !== null) { - attributes.update(index, gl.ELEMENT_ARRAY_BUFFER); - } - if (updateBuffers || forceUpdate) { - forceUpdate = false; - setupVertexAttributes(object, material, program, geometry); - if (index !== null) { - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, attributes.get(index).buffer); - } - } - } - function createVertexArrayObject() { - if (capabilities.isWebGL2) - return gl.createVertexArray(); - return extension.createVertexArrayOES(); - } - function bindVertexArrayObject(vao) { - if (capabilities.isWebGL2) - return gl.bindVertexArray(vao); - return extension.bindVertexArrayOES(vao); - } - function deleteVertexArrayObject(vao) { - if (capabilities.isWebGL2) - return gl.deleteVertexArray(vao); - return extension.deleteVertexArrayOES(vao); - } - function getBindingState(geometry, program, material) { - const wireframe = material.wireframe === true; - let programMap = bindingStates[geometry.id]; - if (programMap === void 0) { - programMap = {}; - bindingStates[geometry.id] = programMap; - } - let stateMap = programMap[program.id]; - if (stateMap === void 0) { - stateMap = {}; - programMap[program.id] = stateMap; - } - let state = stateMap[wireframe]; - if (state === void 0) { - state = createBindingState(createVertexArrayObject()); - stateMap[wireframe] = state; - } - return state; - } - function createBindingState(vao) { - const newAttributes = []; - const enabledAttributes = []; - const attributeDivisors = []; - for (let i = 0; i < maxVertexAttributes; i++) { - newAttributes[i] = 0; - enabledAttributes[i] = 0; - attributeDivisors[i] = 0; - } - return { - // for backward compatibility on non-VAO support browser - geometry: null, - program: null, - wireframe: false, - newAttributes, - enabledAttributes, - attributeDivisors, - object: vao, - attributes: {}, - index: null - }; - } - function needsUpdate(object, geometry, program, index) { - const cachedAttributes = currentState.attributes; - const geometryAttributes = geometry.attributes; - let attributesNum = 0; - const programAttributes = program.getAttributes(); - for (const name in programAttributes) { - const programAttribute = programAttributes[name]; - if (programAttribute.location >= 0) { - const cachedAttribute = cachedAttributes[name]; - let geometryAttribute = geometryAttributes[name]; - if (geometryAttribute === void 0) { - if (name === "instanceMatrix" && object.instanceMatrix) - geometryAttribute = object.instanceMatrix; - if (name === "instanceColor" && object.instanceColor) - geometryAttribute = object.instanceColor; - } - if (cachedAttribute === void 0) - return true; - if (cachedAttribute.attribute !== geometryAttribute) - return true; - if (geometryAttribute && cachedAttribute.data !== geometryAttribute.data) - return true; - attributesNum++; - } - } - if (currentState.attributesNum !== attributesNum) - return true; - if (currentState.index !== index) - return true; - return false; - } - function saveCache(object, geometry, program, index) { - const cache = {}; - const attributes2 = geometry.attributes; - let attributesNum = 0; - const programAttributes = program.getAttributes(); - for (const name in programAttributes) { - const programAttribute = programAttributes[name]; - if (programAttribute.location >= 0) { - let attribute = attributes2[name]; - if (attribute === void 0) { - if (name === "instanceMatrix" && object.instanceMatrix) - attribute = object.instanceMatrix; - if (name === "instanceColor" && object.instanceColor) - attribute = object.instanceColor; - } - const data = {}; - data.attribute = attribute; - if (attribute && attribute.data) { - data.data = attribute.data; - } - cache[name] = data; - attributesNum++; - } - } - currentState.attributes = cache; - currentState.attributesNum = attributesNum; - currentState.index = index; - } - function initAttributes() { - const newAttributes = currentState.newAttributes; - for (let i = 0, il = newAttributes.length; i < il; i++) { - newAttributes[i] = 0; - } - } - function enableAttribute(attribute) { - enableAttributeAndDivisor(attribute, 0); - } - function enableAttributeAndDivisor(attribute, meshPerAttribute) { - const newAttributes = currentState.newAttributes; - const enabledAttributes = currentState.enabledAttributes; - const attributeDivisors = currentState.attributeDivisors; - newAttributes[attribute] = 1; - if (enabledAttributes[attribute] === 0) { - gl.enableVertexAttribArray(attribute); - enabledAttributes[attribute] = 1; - } - if (attributeDivisors[attribute] !== meshPerAttribute) { - const extension2 = capabilities.isWebGL2 ? gl : extensions.get("ANGLE_instanced_arrays"); - extension2[capabilities.isWebGL2 ? "vertexAttribDivisor" : "vertexAttribDivisorANGLE"](attribute, meshPerAttribute); - attributeDivisors[attribute] = meshPerAttribute; - } - } - function disableUnusedAttributes() { - const newAttributes = currentState.newAttributes; - const enabledAttributes = currentState.enabledAttributes; - for (let i = 0, il = enabledAttributes.length; i < il; i++) { - if (enabledAttributes[i] !== newAttributes[i]) { - gl.disableVertexAttribArray(i); - enabledAttributes[i] = 0; - } - } - } - function vertexAttribPointer(index, size, type, normalized, stride, offset, integer) { - if (integer === true) { - gl.vertexAttribIPointer(index, size, type, stride, offset); - } else { - gl.vertexAttribPointer(index, size, type, normalized, stride, offset); - } - } - function setupVertexAttributes(object, material, program, geometry) { - if (capabilities.isWebGL2 === false && (object.isInstancedMesh || geometry.isInstancedBufferGeometry)) { - if (extensions.get("ANGLE_instanced_arrays") === null) - return; - } - initAttributes(); - const geometryAttributes = geometry.attributes; - const programAttributes = program.getAttributes(); - const materialDefaultAttributeValues = material.defaultAttributeValues; - for (const name in programAttributes) { - const programAttribute = programAttributes[name]; - if (programAttribute.location >= 0) { - let geometryAttribute = geometryAttributes[name]; - if (geometryAttribute === void 0) { - if (name === "instanceMatrix" && object.instanceMatrix) - geometryAttribute = object.instanceMatrix; - if (name === "instanceColor" && object.instanceColor) - geometryAttribute = object.instanceColor; - } - if (geometryAttribute !== void 0) { - const normalized = geometryAttribute.normalized; - const size = geometryAttribute.itemSize; - const attribute = attributes.get(geometryAttribute); - if (attribute === void 0) - continue; - const buffer = attribute.buffer; - const type = attribute.type; - const bytesPerElement = attribute.bytesPerElement; - const integer = capabilities.isWebGL2 === true && (type === gl.INT || type === gl.UNSIGNED_INT || geometryAttribute.gpuType === IntType); - if (geometryAttribute.isInterleavedBufferAttribute) { - const data = geometryAttribute.data; - const stride = data.stride; - const offset = geometryAttribute.offset; - if (data.isInstancedInterleavedBuffer) { - for (let i = 0; i < programAttribute.locationSize; i++) { - enableAttributeAndDivisor(programAttribute.location + i, data.meshPerAttribute); - } - if (object.isInstancedMesh !== true && geometry._maxInstanceCount === void 0) { - geometry._maxInstanceCount = data.meshPerAttribute * data.count; - } - } else { - for (let i = 0; i < programAttribute.locationSize; i++) { - enableAttribute(programAttribute.location + i); - } - } - gl.bindBuffer(gl.ARRAY_BUFFER, buffer); - for (let i = 0; i < programAttribute.locationSize; i++) { - vertexAttribPointer( - programAttribute.location + i, - size / programAttribute.locationSize, - type, - normalized, - stride * bytesPerElement, - (offset + size / programAttribute.locationSize * i) * bytesPerElement, - integer - ); - } - } else { - if (geometryAttribute.isInstancedBufferAttribute) { - for (let i = 0; i < programAttribute.locationSize; i++) { - enableAttributeAndDivisor(programAttribute.location + i, geometryAttribute.meshPerAttribute); - } - if (object.isInstancedMesh !== true && geometry._maxInstanceCount === void 0) { - geometry._maxInstanceCount = geometryAttribute.meshPerAttribute * geometryAttribute.count; - } - } else { - for (let i = 0; i < programAttribute.locationSize; i++) { - enableAttribute(programAttribute.location + i); - } - } - gl.bindBuffer(gl.ARRAY_BUFFER, buffer); - for (let i = 0; i < programAttribute.locationSize; i++) { - vertexAttribPointer( - programAttribute.location + i, - size / programAttribute.locationSize, - type, - normalized, - size * bytesPerElement, - size / programAttribute.locationSize * i * bytesPerElement, - integer - ); - } - } - } else if (materialDefaultAttributeValues !== void 0) { - const value = materialDefaultAttributeValues[name]; - if (value !== void 0) { - switch (value.length) { - case 2: - gl.vertexAttrib2fv(programAttribute.location, value); - break; - case 3: - gl.vertexAttrib3fv(programAttribute.location, value); - break; - case 4: - gl.vertexAttrib4fv(programAttribute.location, value); - break; - default: - gl.vertexAttrib1fv(programAttribute.location, value); - } - } - } - } - } - disableUnusedAttributes(); - } - function dispose() { - reset(); - for (const geometryId in bindingStates) { - const programMap = bindingStates[geometryId]; - for (const programId in programMap) { - const stateMap = programMap[programId]; - for (const wireframe in stateMap) { - deleteVertexArrayObject(stateMap[wireframe].object); - delete stateMap[wireframe]; - } - delete programMap[programId]; - } - delete bindingStates[geometryId]; - } - } - function releaseStatesOfGeometry(geometry) { - if (bindingStates[geometry.id] === void 0) - return; - const programMap = bindingStates[geometry.id]; - for (const programId in programMap) { - const stateMap = programMap[programId]; - for (const wireframe in stateMap) { - deleteVertexArrayObject(stateMap[wireframe].object); - delete stateMap[wireframe]; - } - delete programMap[programId]; - } - delete bindingStates[geometry.id]; - } - function releaseStatesOfProgram(program) { - for (const geometryId in bindingStates) { - const programMap = bindingStates[geometryId]; - if (programMap[program.id] === void 0) - continue; - const stateMap = programMap[program.id]; - for (const wireframe in stateMap) { - deleteVertexArrayObject(stateMap[wireframe].object); - delete stateMap[wireframe]; - } - delete programMap[program.id]; - } - } - function reset() { - resetDefaultState(); - forceUpdate = true; - if (currentState === defaultState) - return; - currentState = defaultState; - bindVertexArrayObject(currentState.object); - } - function resetDefaultState() { - defaultState.geometry = null; - defaultState.program = null; - defaultState.wireframe = false; - } - return { - setup, - reset, - resetDefaultState, - dispose, - releaseStatesOfGeometry, - releaseStatesOfProgram, - initAttributes, - enableAttribute, - disableUnusedAttributes - }; -} -function WebGLBufferRenderer(gl, extensions, info, capabilities) { - const isWebGL2 = capabilities.isWebGL2; - let mode; - function setMode(value) { - mode = value; - } - function render(start, count) { - gl.drawArrays(mode, start, count); - info.update(count, mode, 1); - } - function renderInstances(start, count, primcount) { - if (primcount === 0) - return; - let extension, methodName; - if (isWebGL2) { - extension = gl; - methodName = "drawArraysInstanced"; - } else { - extension = extensions.get("ANGLE_instanced_arrays"); - methodName = "drawArraysInstancedANGLE"; - if (extension === null) { - console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."); - return; - } - } - extension[methodName](mode, start, count, primcount); - info.update(count, mode, primcount); - } - this.setMode = setMode; - this.render = render; - this.renderInstances = renderInstances; -} -function WebGLCapabilities(gl, extensions, parameters) { - let maxAnisotropy; - function getMaxAnisotropy() { - if (maxAnisotropy !== void 0) - return maxAnisotropy; - if (extensions.has("EXT_texture_filter_anisotropic") === true) { - const extension = extensions.get("EXT_texture_filter_anisotropic"); - maxAnisotropy = gl.getParameter(extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT); - } else { - maxAnisotropy = 0; - } - return maxAnisotropy; - } - function getMaxPrecision(precision2) { - if (precision2 === "highp") { - if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_FLOAT).precision > 0 && gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT).precision > 0) { - return "highp"; - } - precision2 = "mediump"; - } - if (precision2 === "mediump") { - if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT).precision > 0 && gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT).precision > 0) { - return "mediump"; - } - } - return "lowp"; - } - const isWebGL2 = typeof WebGL2RenderingContext !== "undefined" && gl.constructor.name === "WebGL2RenderingContext"; - let precision = parameters.precision !== void 0 ? parameters.precision : "highp"; - const maxPrecision = getMaxPrecision(precision); - if (maxPrecision !== precision) { - console.warn("THREE.WebGLRenderer:", precision, "not supported, using", maxPrecision, "instead."); - precision = maxPrecision; - } - const drawBuffers = isWebGL2 || extensions.has("WEBGL_draw_buffers"); - const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true; - const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); - const maxVertexTextures = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS); - const maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE); - const maxCubemapSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE); - const maxAttributes = gl.getParameter(gl.MAX_VERTEX_ATTRIBS); - const maxVertexUniforms = gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS); - const maxVaryings = gl.getParameter(gl.MAX_VARYING_VECTORS); - const maxFragmentUniforms = gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS); - const vertexTextures = maxVertexTextures > 0; - const floatFragmentTextures = isWebGL2 || extensions.has("OES_texture_float"); - const floatVertexTextures = vertexTextures && floatFragmentTextures; - const maxSamples = isWebGL2 ? gl.getParameter(gl.MAX_SAMPLES) : 0; - return { - isWebGL2, - drawBuffers, - getMaxAnisotropy, - getMaxPrecision, - precision, - logarithmicDepthBuffer, - maxTextures, - maxVertexTextures, - maxTextureSize, - maxCubemapSize, - maxAttributes, - maxVertexUniforms, - maxVaryings, - maxFragmentUniforms, - vertexTextures, - floatFragmentTextures, - floatVertexTextures, - maxSamples - }; -} -function WebGLClipping(properties) { - const scope = this; - let globalState = null, numGlobalPlanes = 0, localClippingEnabled = false, renderingShadows = false; - const plane = new Plane(), viewNormalMatrix = new Matrix3(), uniform = { value: null, needsUpdate: false }; - this.uniform = uniform; - this.numPlanes = 0; - this.numIntersection = 0; - this.init = function(planes, enableLocalClipping) { - const enabled = planes.length !== 0 || enableLocalClipping || // enable state of previous frame - the clipping code has to - // run another frame in order to reset the state: - numGlobalPlanes !== 0 || localClippingEnabled; - localClippingEnabled = enableLocalClipping; - numGlobalPlanes = planes.length; - return enabled; - }; - this.beginShadows = function() { - renderingShadows = true; - projectPlanes(null); - }; - this.endShadows = function() { - renderingShadows = false; - }; - this.setGlobalState = function(planes, camera) { - globalState = projectPlanes(planes, camera, 0); - }; - this.setState = function(material, camera, useCache) { - const planes = material.clippingPlanes, clipIntersection = material.clipIntersection, clipShadows = material.clipShadows; - const materialProperties = properties.get(material); - if (!localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && !clipShadows) { - if (renderingShadows) { - projectPlanes(null); - } else { - resetGlobalState(); - } - } else { - const nGlobal = renderingShadows ? 0 : numGlobalPlanes, lGlobal = nGlobal * 4; - let dstArray = materialProperties.clippingState || null; - uniform.value = dstArray; - dstArray = projectPlanes(planes, camera, lGlobal, useCache); - for (let i = 0; i !== lGlobal; ++i) { - dstArray[i] = globalState[i]; - } - materialProperties.clippingState = dstArray; - this.numIntersection = clipIntersection ? this.numPlanes : 0; - this.numPlanes += nGlobal; - } - }; - function resetGlobalState() { - if (uniform.value !== globalState) { - uniform.value = globalState; - uniform.needsUpdate = numGlobalPlanes > 0; - } - scope.numPlanes = numGlobalPlanes; - scope.numIntersection = 0; - } - function projectPlanes(planes, camera, dstOffset, skipTransform) { - const nPlanes = planes !== null ? planes.length : 0; - let dstArray = null; - if (nPlanes !== 0) { - dstArray = uniform.value; - if (skipTransform !== true || dstArray === null) { - const flatSize = dstOffset + nPlanes * 4, viewMatrix = camera.matrixWorldInverse; - viewNormalMatrix.getNormalMatrix(viewMatrix); - if (dstArray === null || dstArray.length < flatSize) { - dstArray = new Float32Array(flatSize); - } - for (let i = 0, i4 = dstOffset; i !== nPlanes; ++i, i4 += 4) { - plane.copy(planes[i]).applyMatrix4(viewMatrix, viewNormalMatrix); - plane.normal.toArray(dstArray, i4); - dstArray[i4 + 3] = plane.constant; - } - } - uniform.value = dstArray; - uniform.needsUpdate = true; - } - scope.numPlanes = nPlanes; - scope.numIntersection = 0; - return dstArray; - } -} -function WebGLCubeMaps(renderer) { - let cubemaps = /* @__PURE__ */ new WeakMap(); - function mapTextureMapping(texture, mapping) { - if (mapping === EquirectangularReflectionMapping) { - texture.mapping = CubeReflectionMapping; - } else if (mapping === EquirectangularRefractionMapping) { - texture.mapping = CubeRefractionMapping; - } - return texture; - } - function get(texture) { - if (texture && texture.isTexture && texture.isRenderTargetTexture === false) { - const mapping = texture.mapping; - if (mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping) { - if (cubemaps.has(texture)) { - const cubemap = cubemaps.get(texture).texture; - return mapTextureMapping(cubemap, texture.mapping); - } else { - const image = texture.image; - if (image && image.height > 0) { - const renderTarget = new WebGLCubeRenderTarget(image.height / 2); - renderTarget.fromEquirectangularTexture(renderer, texture); - cubemaps.set(texture, renderTarget); - texture.addEventListener("dispose", onTextureDispose); - return mapTextureMapping(renderTarget.texture, texture.mapping); - } else { - return null; - } - } - } - } - return texture; - } - function onTextureDispose(event) { - const texture = event.target; - texture.removeEventListener("dispose", onTextureDispose); - const cubemap = cubemaps.get(texture); - if (cubemap !== void 0) { - cubemaps.delete(texture); - cubemap.dispose(); - } - } - function dispose() { - cubemaps = /* @__PURE__ */ new WeakMap(); - } - return { - get, - dispose - }; -} -var OrthographicCamera = class extends Camera { - constructor(left = -1, right = 1, top = 1, bottom = -1, near = 0.1, far = 2e3) { - super(); - this.isOrthographicCamera = true; - this.type = "OrthographicCamera"; - this.zoom = 1; - this.view = null; - this.left = left; - this.right = right; - this.top = top; - this.bottom = bottom; - this.near = near; - this.far = far; - this.updateProjectionMatrix(); - } - copy(source, recursive) { - super.copy(source, recursive); - this.left = source.left; - this.right = source.right; - this.top = source.top; - this.bottom = source.bottom; - this.near = source.near; - this.far = source.far; - this.zoom = source.zoom; - this.view = source.view === null ? null : Object.assign({}, source.view); - return this; - } - setViewOffset(fullWidth, fullHeight, x, y, width, height) { - if (this.view === null) { - this.view = { - enabled: true, - fullWidth: 1, - fullHeight: 1, - offsetX: 0, - offsetY: 0, - width: 1, - height: 1 - }; - } - this.view.enabled = true; - this.view.fullWidth = fullWidth; - this.view.fullHeight = fullHeight; - this.view.offsetX = x; - this.view.offsetY = y; - this.view.width = width; - this.view.height = height; - this.updateProjectionMatrix(); - } - clearViewOffset() { - if (this.view !== null) { - this.view.enabled = false; - } - this.updateProjectionMatrix(); - } - updateProjectionMatrix() { - const dx = (this.right - this.left) / (2 * this.zoom); - const dy = (this.top - this.bottom) / (2 * this.zoom); - const cx = (this.right + this.left) / 2; - const cy = (this.top + this.bottom) / 2; - let left = cx - dx; - let right = cx + dx; - let top = cy + dy; - let bottom = cy - dy; - if (this.view !== null && this.view.enabled) { - const scaleW = (this.right - this.left) / this.view.fullWidth / this.zoom; - const scaleH = (this.top - this.bottom) / this.view.fullHeight / this.zoom; - left += scaleW * this.view.offsetX; - right = left + scaleW * this.view.width; - top -= scaleH * this.view.offsetY; - bottom = top - scaleH * this.view.height; - } - this.projectionMatrix.makeOrthographic(left, right, top, bottom, this.near, this.far, this.coordinateSystem); - this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); - } - toJSON(meta) { - const data = super.toJSON(meta); - data.object.zoom = this.zoom; - data.object.left = this.left; - data.object.right = this.right; - data.object.top = this.top; - data.object.bottom = this.bottom; - data.object.near = this.near; - data.object.far = this.far; - if (this.view !== null) - data.object.view = Object.assign({}, this.view); - return data; - } -}; -var LOD_MIN = 4; -var EXTRA_LOD_SIGMA = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582]; -var MAX_SAMPLES = 20; -var _flatCamera = new OrthographicCamera(); -var _clearColor = new Color(); -var _oldTarget = null; -var _oldActiveCubeFace = 0; -var _oldActiveMipmapLevel = 0; -var PHI = (1 + Math.sqrt(5)) / 2; -var INV_PHI = 1 / PHI; -var _axisDirections = [ - new Vector3(1, 1, 1), - new Vector3(-1, 1, 1), - new Vector3(1, 1, -1), - new Vector3(-1, 1, -1), - new Vector3(0, PHI, INV_PHI), - new Vector3(0, PHI, -INV_PHI), - new Vector3(INV_PHI, 0, PHI), - new Vector3(-INV_PHI, 0, PHI), - new Vector3(PHI, INV_PHI, 0), - new Vector3(-PHI, INV_PHI, 0) -]; -var PMREMGenerator = class { - constructor(renderer) { - this._renderer = renderer; - this._pingPongRenderTarget = null; - this._lodMax = 0; - this._cubeSize = 0; - this._lodPlanes = []; - this._sizeLods = []; - this._sigmas = []; - this._blurMaterial = null; - this._cubemapMaterial = null; - this._equirectMaterial = null; - this._compileMaterial(this._blurMaterial); - } - /** - * Generates a PMREM from a supplied Scene, which can be faster than using an - * image if networking bandwidth is low. Optional sigma specifies a blur radius - * in radians to be applied to the scene before PMREM generation. Optional near - * and far planes ensure the scene is rendered in its entirety (the cubeCamera - * is placed at the origin). - */ - fromScene(scene, sigma = 0, near = 0.1, far = 100) { - _oldTarget = this._renderer.getRenderTarget(); - _oldActiveCubeFace = this._renderer.getActiveCubeFace(); - _oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel(); - this._setSize(256); - const cubeUVRenderTarget = this._allocateTargets(); - cubeUVRenderTarget.depthBuffer = true; - this._sceneToCubeUV(scene, near, far, cubeUVRenderTarget); - if (sigma > 0) { - this._blur(cubeUVRenderTarget, 0, 0, sigma); - } - this._applyPMREM(cubeUVRenderTarget); - this._cleanup(cubeUVRenderTarget); - return cubeUVRenderTarget; - } - /** - * Generates a PMREM from an equirectangular texture, which can be either LDR - * or HDR. The ideal input image size is 1k (1024 x 512), - * as this matches best with the 256 x 256 cubemap output. - */ - fromEquirectangular(equirectangular, renderTarget = null) { - return this._fromTexture(equirectangular, renderTarget); - } - /** - * Generates a PMREM from an cubemap texture, which can be either LDR - * or HDR. The ideal input cube size is 256 x 256, - * as this matches best with the 256 x 256 cubemap output. - */ - fromCubemap(cubemap, renderTarget = null) { - return this._fromTexture(cubemap, renderTarget); - } - /** - * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during - * your texture's network fetch for increased concurrency. - */ - compileCubemapShader() { - if (this._cubemapMaterial === null) { - this._cubemapMaterial = _getCubemapMaterial(); - this._compileMaterial(this._cubemapMaterial); - } - } - /** - * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during - * your texture's network fetch for increased concurrency. - */ - compileEquirectangularShader() { - if (this._equirectMaterial === null) { - this._equirectMaterial = _getEquirectMaterial(); - this._compileMaterial(this._equirectMaterial); - } - } - /** - * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class, - * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on - * one of them will cause any others to also become unusable. - */ - dispose() { - this._dispose(); - if (this._cubemapMaterial !== null) - this._cubemapMaterial.dispose(); - if (this._equirectMaterial !== null) - this._equirectMaterial.dispose(); - } - // private interface - _setSize(cubeSize) { - this._lodMax = Math.floor(Math.log2(cubeSize)); - this._cubeSize = Math.pow(2, this._lodMax); - } - _dispose() { - if (this._blurMaterial !== null) - this._blurMaterial.dispose(); - if (this._pingPongRenderTarget !== null) - this._pingPongRenderTarget.dispose(); - for (let i = 0; i < this._lodPlanes.length; i++) { - this._lodPlanes[i].dispose(); - } - } - _cleanup(outputTarget) { - this._renderer.setRenderTarget(_oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel); - outputTarget.scissorTest = false; - _setViewport(outputTarget, 0, 0, outputTarget.width, outputTarget.height); - } - _fromTexture(texture, renderTarget) { - if (texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping) { - this._setSize(texture.image.length === 0 ? 16 : texture.image[0].width || texture.image[0].image.width); - } else { - this._setSize(texture.image.width / 4); - } - _oldTarget = this._renderer.getRenderTarget(); - _oldActiveCubeFace = this._renderer.getActiveCubeFace(); - _oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel(); - const cubeUVRenderTarget = renderTarget || this._allocateTargets(); - this._textureToCubeUV(texture, cubeUVRenderTarget); - this._applyPMREM(cubeUVRenderTarget); - this._cleanup(cubeUVRenderTarget); - return cubeUVRenderTarget; - } - _allocateTargets() { - const width = 3 * Math.max(this._cubeSize, 16 * 7); - const height = 4 * this._cubeSize; - const params = { - magFilter: LinearFilter, - minFilter: LinearFilter, - generateMipmaps: false, - type: HalfFloatType, - format: RGBAFormat, - colorSpace: LinearSRGBColorSpace, - depthBuffer: false - }; - const cubeUVRenderTarget = _createRenderTarget(width, height, params); - if (this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== width || this._pingPongRenderTarget.height !== height) { - if (this._pingPongRenderTarget !== null) { - this._dispose(); - } - this._pingPongRenderTarget = _createRenderTarget(width, height, params); - const { _lodMax } = this; - ({ sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas } = _createPlanes(_lodMax)); - this._blurMaterial = _getBlurShader(_lodMax, width, height); - } - return cubeUVRenderTarget; - } - _compileMaterial(material) { - const tmpMesh = new Mesh(this._lodPlanes[0], material); - this._renderer.compile(tmpMesh, _flatCamera); - } - _sceneToCubeUV(scene, near, far, cubeUVRenderTarget) { - const fov2 = 90; - const aspect2 = 1; - const cubeCamera = new PerspectiveCamera(fov2, aspect2, near, far); - const upSign = [1, -1, 1, 1, 1, 1]; - const forwardSign = [1, 1, 1, -1, -1, -1]; - const renderer = this._renderer; - const originalAutoClear = renderer.autoClear; - const toneMapping = renderer.toneMapping; - renderer.getClearColor(_clearColor); - renderer.toneMapping = NoToneMapping; - renderer.autoClear = false; - const backgroundMaterial = new MeshBasicMaterial({ - name: "PMREM.Background", - side: BackSide, - depthWrite: false, - depthTest: false - }); - const backgroundBox = new Mesh(new BoxGeometry(), backgroundMaterial); - let useSolidColor = false; - const background = scene.background; - if (background) { - if (background.isColor) { - backgroundMaterial.color.copy(background); - scene.background = null; - useSolidColor = true; - } - } else { - backgroundMaterial.color.copy(_clearColor); - useSolidColor = true; - } - for (let i = 0; i < 6; i++) { - const col = i % 3; - if (col === 0) { - cubeCamera.up.set(0, upSign[i], 0); - cubeCamera.lookAt(forwardSign[i], 0, 0); - } else if (col === 1) { - cubeCamera.up.set(0, 0, upSign[i]); - cubeCamera.lookAt(0, forwardSign[i], 0); - } else { - cubeCamera.up.set(0, upSign[i], 0); - cubeCamera.lookAt(0, 0, forwardSign[i]); - } - const size = this._cubeSize; - _setViewport(cubeUVRenderTarget, col * size, i > 2 ? size : 0, size, size); - renderer.setRenderTarget(cubeUVRenderTarget); - if (useSolidColor) { - renderer.render(backgroundBox, cubeCamera); - } - renderer.render(scene, cubeCamera); - } - backgroundBox.geometry.dispose(); - backgroundBox.material.dispose(); - renderer.toneMapping = toneMapping; - renderer.autoClear = originalAutoClear; - scene.background = background; - } - _textureToCubeUV(texture, cubeUVRenderTarget) { - const renderer = this._renderer; - const isCubeTexture = texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping; - if (isCubeTexture) { - if (this._cubemapMaterial === null) { - this._cubemapMaterial = _getCubemapMaterial(); - } - this._cubemapMaterial.uniforms.flipEnvMap.value = texture.isRenderTargetTexture === false ? -1 : 1; - } else { - if (this._equirectMaterial === null) { - this._equirectMaterial = _getEquirectMaterial(); - } - } - const material = isCubeTexture ? this._cubemapMaterial : this._equirectMaterial; - const mesh = new Mesh(this._lodPlanes[0], material); - const uniforms = material.uniforms; - uniforms["envMap"].value = texture; - const size = this._cubeSize; - _setViewport(cubeUVRenderTarget, 0, 0, 3 * size, 2 * size); - renderer.setRenderTarget(cubeUVRenderTarget); - renderer.render(mesh, _flatCamera); - } - _applyPMREM(cubeUVRenderTarget) { - const renderer = this._renderer; - const autoClear = renderer.autoClear; - renderer.autoClear = false; - for (let i = 1; i < this._lodPlanes.length; i++) { - const sigma = Math.sqrt(this._sigmas[i] * this._sigmas[i] - this._sigmas[i - 1] * this._sigmas[i - 1]); - const poleAxis = _axisDirections[(i - 1) % _axisDirections.length]; - this._blur(cubeUVRenderTarget, i - 1, i, sigma, poleAxis); - } - renderer.autoClear = autoClear; - } - /** - * This is a two-pass Gaussian blur for a cubemap. Normally this is done - * vertically and horizontally, but this breaks down on a cube. Here we apply - * the blur latitudinally (around the poles), and then longitudinally (towards - * the poles) to approximate the orthogonally-separable blur. It is least - * accurate at the poles, but still does a decent job. - */ - _blur(cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis) { - const pingPongRenderTarget = this._pingPongRenderTarget; - this._halfBlur( - cubeUVRenderTarget, - pingPongRenderTarget, - lodIn, - lodOut, - sigma, - "latitudinal", - poleAxis - ); - this._halfBlur( - pingPongRenderTarget, - cubeUVRenderTarget, - lodOut, - lodOut, - sigma, - "longitudinal", - poleAxis - ); - } - _halfBlur(targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis) { - const renderer = this._renderer; - const blurMaterial = this._blurMaterial; - if (direction !== "latitudinal" && direction !== "longitudinal") { - console.error( - "blur direction must be either latitudinal or longitudinal!" - ); - } - const STANDARD_DEVIATIONS = 3; - const blurMesh = new Mesh(this._lodPlanes[lodOut], blurMaterial); - const blurUniforms = blurMaterial.uniforms; - const pixels = this._sizeLods[lodIn] - 1; - const radiansPerPixel = isFinite(sigmaRadians) ? Math.PI / (2 * pixels) : 2 * Math.PI / (2 * MAX_SAMPLES - 1); - const sigmaPixels = sigmaRadians / radiansPerPixel; - const samples = isFinite(sigmaRadians) ? 1 + Math.floor(STANDARD_DEVIATIONS * sigmaPixels) : MAX_SAMPLES; - if (samples > MAX_SAMPLES) { - console.warn(`sigmaRadians, ${sigmaRadians}, is too large and will clip, as it requested ${samples} samples when the maximum is set to ${MAX_SAMPLES}`); - } - const weights = []; - let sum = 0; - for (let i = 0; i < MAX_SAMPLES; ++i) { - const x2 = i / sigmaPixels; - const weight = Math.exp(-x2 * x2 / 2); - weights.push(weight); - if (i === 0) { - sum += weight; - } else if (i < samples) { - sum += 2 * weight; - } - } - for (let i = 0; i < weights.length; i++) { - weights[i] = weights[i] / sum; - } - blurUniforms["envMap"].value = targetIn.texture; - blurUniforms["samples"].value = samples; - blurUniforms["weights"].value = weights; - blurUniforms["latitudinal"].value = direction === "latitudinal"; - if (poleAxis) { - blurUniforms["poleAxis"].value = poleAxis; - } - const { _lodMax } = this; - blurUniforms["dTheta"].value = radiansPerPixel; - blurUniforms["mipInt"].value = _lodMax - lodIn; - const outputSize = this._sizeLods[lodOut]; - const x = 3 * outputSize * (lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0); - const y = 4 * (this._cubeSize - outputSize); - _setViewport(targetOut, x, y, 3 * outputSize, 2 * outputSize); - renderer.setRenderTarget(targetOut); - renderer.render(blurMesh, _flatCamera); - } -}; -function _createPlanes(lodMax) { - const lodPlanes = []; - const sizeLods = []; - const sigmas = []; - let lod = lodMax; - const totalLods = lodMax - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length; - for (let i = 0; i < totalLods; i++) { - const sizeLod = Math.pow(2, lod); - sizeLods.push(sizeLod); - let sigma = 1 / sizeLod; - if (i > lodMax - LOD_MIN) { - sigma = EXTRA_LOD_SIGMA[i - lodMax + LOD_MIN - 1]; - } else if (i === 0) { - sigma = 0; - } - sigmas.push(sigma); - const texelSize = 1 / (sizeLod - 2); - const min = -texelSize; - const max = 1 + texelSize; - const uv1 = [min, min, max, min, max, max, min, min, max, max, min, max]; - const cubeFaces = 6; - const vertices = 6; - const positionSize = 3; - const uvSize = 2; - const faceIndexSize = 1; - const position = new Float32Array(positionSize * vertices * cubeFaces); - const uv = new Float32Array(uvSize * vertices * cubeFaces); - const faceIndex = new Float32Array(faceIndexSize * vertices * cubeFaces); - for (let face = 0; face < cubeFaces; face++) { - const x = face % 3 * 2 / 3 - 1; - const y = face > 2 ? 0 : -1; - const coordinates = [ - x, - y, - 0, - x + 2 / 3, - y, - 0, - x + 2 / 3, - y + 1, - 0, - x, - y, - 0, - x + 2 / 3, - y + 1, - 0, - x, - y + 1, - 0 - ]; - position.set(coordinates, positionSize * vertices * face); - uv.set(uv1, uvSize * vertices * face); - const fill = [face, face, face, face, face, face]; - faceIndex.set(fill, faceIndexSize * vertices * face); - } - const planes = new BufferGeometry(); - planes.setAttribute("position", new BufferAttribute(position, positionSize)); - planes.setAttribute("uv", new BufferAttribute(uv, uvSize)); - planes.setAttribute("faceIndex", new BufferAttribute(faceIndex, faceIndexSize)); - lodPlanes.push(planes); - if (lod > LOD_MIN) { - lod--; - } - } - return { lodPlanes, sizeLods, sigmas }; -} -function _createRenderTarget(width, height, params) { - const cubeUVRenderTarget = new WebGLRenderTarget(width, height, params); - cubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping; - cubeUVRenderTarget.texture.name = "PMREM.cubeUv"; - cubeUVRenderTarget.scissorTest = true; - return cubeUVRenderTarget; -} -function _setViewport(target, x, y, width, height) { - target.viewport.set(x, y, width, height); - target.scissor.set(x, y, width, height); -} -function _getBlurShader(lodMax, width, height) { - const weights = new Float32Array(MAX_SAMPLES); - const poleAxis = new Vector3(0, 1, 0); - const shaderMaterial = new ShaderMaterial({ - name: "SphericalGaussianBlur", - defines: { - "n": MAX_SAMPLES, - "CUBEUV_TEXEL_WIDTH": 1 / width, - "CUBEUV_TEXEL_HEIGHT": 1 / height, - "CUBEUV_MAX_MIP": `${lodMax}.0` - }, - uniforms: { - "envMap": { value: null }, - "samples": { value: 1 }, - "weights": { value: weights }, - "latitudinal": { value: false }, - "dTheta": { value: 0 }, - "mipInt": { value: 0 }, - "poleAxis": { value: poleAxis } - }, - vertexShader: _getCommonVertexShader(), - fragmentShader: ( - /* glsl */ - ` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - uniform int samples; - uniform float weights[ n ]; - uniform bool latitudinal; - uniform float dTheta; - uniform float mipInt; - uniform vec3 poleAxis; - - #define ENVMAP_TYPE_CUBE_UV - #include - - vec3 getSample( float theta, vec3 axis ) { - - float cosTheta = cos( theta ); - // Rodrigues' axis-angle rotation - vec3 sampleDirection = vOutputDirection * cosTheta - + cross( axis, vOutputDirection ) * sin( theta ) - + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); - - return bilinearCubeUV( envMap, sampleDirection, mipInt ); - - } - - void main() { - - vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); - - if ( all( equal( axis, vec3( 0.0 ) ) ) ) { - - axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); - - } - - axis = normalize( axis ); - - gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); - - for ( int i = 1; i < n; i++ ) { - - if ( i >= samples ) { - - break; - - } - - float theta = dTheta * float( i ); - gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); - gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); - - } - - } - ` - ), - blending: NoBlending, - depthTest: false, - depthWrite: false - }); - return shaderMaterial; -} -function _getEquirectMaterial() { - return new ShaderMaterial({ - name: "EquirectangularToCubeUV", - uniforms: { - "envMap": { value: null } - }, - vertexShader: _getCommonVertexShader(), - fragmentShader: ( - /* glsl */ - ` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - - #include - - void main() { - - vec3 outputDirection = normalize( vOutputDirection ); - vec2 uv = equirectUv( outputDirection ); - - gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); - - } - ` - ), - blending: NoBlending, - depthTest: false, - depthWrite: false - }); -} -function _getCubemapMaterial() { - return new ShaderMaterial({ - name: "CubemapToCubeUV", - uniforms: { - "envMap": { value: null }, - "flipEnvMap": { value: -1 } - }, - vertexShader: _getCommonVertexShader(), - fragmentShader: ( - /* glsl */ - ` - - precision mediump float; - precision mediump int; - - uniform float flipEnvMap; - - varying vec3 vOutputDirection; - - uniform samplerCube envMap; - - void main() { - - gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); - - } - ` - ), - blending: NoBlending, - depthTest: false, - depthWrite: false - }); -} -function _getCommonVertexShader() { - return ( - /* glsl */ - ` - - precision mediump float; - precision mediump int; - - attribute float faceIndex; - - varying vec3 vOutputDirection; - - // RH coordinate system; PMREM face-indexing convention - vec3 getDirection( vec2 uv, float face ) { - - uv = 2.0 * uv - 1.0; - - vec3 direction = vec3( uv, 1.0 ); - - if ( face == 0.0 ) { - - direction = direction.zyx; // ( 1, v, u ) pos x - - } else if ( face == 1.0 ) { - - direction = direction.xzy; - direction.xz *= -1.0; // ( -u, 1, -v ) pos y - - } else if ( face == 2.0 ) { - - direction.x *= -1.0; // ( -u, v, 1 ) pos z - - } else if ( face == 3.0 ) { - - direction = direction.zyx; - direction.xz *= -1.0; // ( -1, v, -u ) neg x - - } else if ( face == 4.0 ) { - - direction = direction.xzy; - direction.xy *= -1.0; // ( -u, -1, v ) neg y - - } else if ( face == 5.0 ) { - - direction.z *= -1.0; // ( u, v, -1 ) neg z - - } - - return direction; - - } - - void main() { - - vOutputDirection = getDirection( uv, faceIndex ); - gl_Position = vec4( position, 1.0 ); - - } - ` - ); -} -function WebGLCubeUVMaps(renderer) { - let cubeUVmaps = /* @__PURE__ */ new WeakMap(); - let pmremGenerator = null; - function get(texture) { - if (texture && texture.isTexture) { - const mapping = texture.mapping; - const isEquirectMap = mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping; - const isCubeMap = mapping === CubeReflectionMapping || mapping === CubeRefractionMapping; - if (isEquirectMap || isCubeMap) { - if (texture.isRenderTargetTexture && texture.needsPMREMUpdate === true) { - texture.needsPMREMUpdate = false; - let renderTarget = cubeUVmaps.get(texture); - if (pmremGenerator === null) - pmremGenerator = new PMREMGenerator(renderer); - renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular(texture, renderTarget) : pmremGenerator.fromCubemap(texture, renderTarget); - cubeUVmaps.set(texture, renderTarget); - return renderTarget.texture; - } else { - if (cubeUVmaps.has(texture)) { - return cubeUVmaps.get(texture).texture; - } else { - const image = texture.image; - if (isEquirectMap && image && image.height > 0 || isCubeMap && image && isCubeTextureComplete(image)) { - if (pmremGenerator === null) - pmremGenerator = new PMREMGenerator(renderer); - const renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular(texture) : pmremGenerator.fromCubemap(texture); - cubeUVmaps.set(texture, renderTarget); - texture.addEventListener("dispose", onTextureDispose); - return renderTarget.texture; - } else { - return null; - } - } - } - } - } - return texture; - } - function isCubeTextureComplete(image) { - let count = 0; - const length = 6; - for (let i = 0; i < length; i++) { - if (image[i] !== void 0) - count++; - } - return count === length; - } - function onTextureDispose(event) { - const texture = event.target; - texture.removeEventListener("dispose", onTextureDispose); - const cubemapUV = cubeUVmaps.get(texture); - if (cubemapUV !== void 0) { - cubeUVmaps.delete(texture); - cubemapUV.dispose(); - } - } - function dispose() { - cubeUVmaps = /* @__PURE__ */ new WeakMap(); - if (pmremGenerator !== null) { - pmremGenerator.dispose(); - pmremGenerator = null; - } - } - return { - get, - dispose - }; -} -function WebGLExtensions(gl) { - const extensions = {}; - function getExtension(name) { - if (extensions[name] !== void 0) { - return extensions[name]; - } - let extension; - switch (name) { - case "WEBGL_depth_texture": - extension = gl.getExtension("WEBGL_depth_texture") || gl.getExtension("MOZ_WEBGL_depth_texture") || gl.getExtension("WEBKIT_WEBGL_depth_texture"); - break; - case "EXT_texture_filter_anisotropic": - extension = gl.getExtension("EXT_texture_filter_anisotropic") || gl.getExtension("MOZ_EXT_texture_filter_anisotropic") || gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic"); - break; - case "WEBGL_compressed_texture_s3tc": - extension = gl.getExtension("WEBGL_compressed_texture_s3tc") || gl.getExtension("MOZ_WEBGL_compressed_texture_s3tc") || gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"); - break; - case "WEBGL_compressed_texture_pvrtc": - extension = gl.getExtension("WEBGL_compressed_texture_pvrtc") || gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"); - break; - default: - extension = gl.getExtension(name); - } - extensions[name] = extension; - return extension; - } - return { - has: function(name) { - return getExtension(name) !== null; - }, - init: function(capabilities) { - if (capabilities.isWebGL2) { - getExtension("EXT_color_buffer_float"); - } else { - getExtension("WEBGL_depth_texture"); - getExtension("OES_texture_float"); - getExtension("OES_texture_half_float"); - getExtension("OES_texture_half_float_linear"); - getExtension("OES_standard_derivatives"); - getExtension("OES_element_index_uint"); - getExtension("OES_vertex_array_object"); - getExtension("ANGLE_instanced_arrays"); - } - getExtension("OES_texture_float_linear"); - getExtension("EXT_color_buffer_half_float"); - getExtension("WEBGL_multisampled_render_to_texture"); - }, - get: function(name) { - const extension = getExtension(name); - if (extension === null) { - console.warn("THREE.WebGLRenderer: " + name + " extension not supported."); - } - return extension; - } - }; -} -function WebGLGeometries(gl, attributes, info, bindingStates) { - const geometries = {}; - const wireframeAttributes = /* @__PURE__ */ new WeakMap(); - function onGeometryDispose(event) { - const geometry = event.target; - if (geometry.index !== null) { - attributes.remove(geometry.index); - } - for (const name in geometry.attributes) { - attributes.remove(geometry.attributes[name]); - } - for (const name in geometry.morphAttributes) { - const array = geometry.morphAttributes[name]; - for (let i = 0, l = array.length; i < l; i++) { - attributes.remove(array[i]); - } - } - geometry.removeEventListener("dispose", onGeometryDispose); - delete geometries[geometry.id]; - const attribute = wireframeAttributes.get(geometry); - if (attribute) { - attributes.remove(attribute); - wireframeAttributes.delete(geometry); - } - bindingStates.releaseStatesOfGeometry(geometry); - if (geometry.isInstancedBufferGeometry === true) { - delete geometry._maxInstanceCount; - } - info.memory.geometries--; - } - function get(object, geometry) { - if (geometries[geometry.id] === true) - return geometry; - geometry.addEventListener("dispose", onGeometryDispose); - geometries[geometry.id] = true; - info.memory.geometries++; - return geometry; - } - function update(geometry) { - const geometryAttributes = geometry.attributes; - for (const name in geometryAttributes) { - attributes.update(geometryAttributes[name], gl.ARRAY_BUFFER); - } - const morphAttributes = geometry.morphAttributes; - for (const name in morphAttributes) { - const array = morphAttributes[name]; - for (let i = 0, l = array.length; i < l; i++) { - attributes.update(array[i], gl.ARRAY_BUFFER); - } - } - } - function updateWireframeAttribute(geometry) { - const indices = []; - const geometryIndex = geometry.index; - const geometryPosition = geometry.attributes.position; - let version = 0; - if (geometryIndex !== null) { - const array = geometryIndex.array; - version = geometryIndex.version; - for (let i = 0, l = array.length; i < l; i += 3) { - const a = array[i + 0]; - const b = array[i + 1]; - const c = array[i + 2]; - indices.push(a, b, b, c, c, a); - } - } else if (geometryPosition !== void 0) { - const array = geometryPosition.array; - version = geometryPosition.version; - for (let i = 0, l = array.length / 3 - 1; i < l; i += 3) { - const a = i + 0; - const b = i + 1; - const c = i + 2; - indices.push(a, b, b, c, c, a); - } - } else { - return; - } - const attribute = new (arrayNeedsUint32(indices) ? Uint32BufferAttribute : Uint16BufferAttribute)(indices, 1); - attribute.version = version; - const previousAttribute = wireframeAttributes.get(geometry); - if (previousAttribute) - attributes.remove(previousAttribute); - wireframeAttributes.set(geometry, attribute); - } - function getWireframeAttribute(geometry) { - const currentAttribute = wireframeAttributes.get(geometry); - if (currentAttribute) { - const geometryIndex = geometry.index; - if (geometryIndex !== null) { - if (currentAttribute.version < geometryIndex.version) { - updateWireframeAttribute(geometry); - } - } - } else { - updateWireframeAttribute(geometry); - } - return wireframeAttributes.get(geometry); - } - return { - get, - update, - getWireframeAttribute - }; -} -function WebGLIndexedBufferRenderer(gl, extensions, info, capabilities) { - const isWebGL2 = capabilities.isWebGL2; - let mode; - function setMode(value) { - mode = value; - } - let type, bytesPerElement; - function setIndex(value) { - type = value.type; - bytesPerElement = value.bytesPerElement; - } - function render(start, count) { - gl.drawElements(mode, count, type, start * bytesPerElement); - info.update(count, mode, 1); - } - function renderInstances(start, count, primcount) { - if (primcount === 0) - return; - let extension, methodName; - if (isWebGL2) { - extension = gl; - methodName = "drawElementsInstanced"; - } else { - extension = extensions.get("ANGLE_instanced_arrays"); - methodName = "drawElementsInstancedANGLE"; - if (extension === null) { - console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."); - return; - } - } - extension[methodName](mode, count, type, start * bytesPerElement, primcount); - info.update(count, mode, primcount); - } - this.setMode = setMode; - this.setIndex = setIndex; - this.render = render; - this.renderInstances = renderInstances; -} -function WebGLInfo(gl) { - const memory = { - geometries: 0, - textures: 0 - }; - const render = { - frame: 0, - calls: 0, - triangles: 0, - points: 0, - lines: 0 - }; - function update(count, mode, instanceCount) { - render.calls++; - switch (mode) { - case gl.TRIANGLES: - render.triangles += instanceCount * (count / 3); - break; - case gl.LINES: - render.lines += instanceCount * (count / 2); - break; - case gl.LINE_STRIP: - render.lines += instanceCount * (count - 1); - break; - case gl.LINE_LOOP: - render.lines += instanceCount * count; - break; - case gl.POINTS: - render.points += instanceCount * count; - break; - default: - console.error("THREE.WebGLInfo: Unknown draw mode:", mode); - break; - } - } - function reset() { - render.calls = 0; - render.triangles = 0; - render.points = 0; - render.lines = 0; - } - return { - memory, - render, - programs: null, - autoReset: true, - reset, - update - }; -} -function numericalSort(a, b) { - return a[0] - b[0]; -} -function absNumericalSort(a, b) { - return Math.abs(b[1]) - Math.abs(a[1]); -} -function WebGLMorphtargets(gl, capabilities, textures) { - const influencesList = {}; - const morphInfluences = new Float32Array(8); - const morphTextures = /* @__PURE__ */ new WeakMap(); - const morph = new Vector4(); - const workInfluences = []; - for (let i = 0; i < 8; i++) { - workInfluences[i] = [i, 0]; - } - function update(object, geometry, program) { - const objectInfluences = object.morphTargetInfluences; - if (capabilities.isWebGL2 === true) { - const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color; - const morphTargetsCount = morphAttribute !== void 0 ? morphAttribute.length : 0; - let entry = morphTextures.get(geometry); - if (entry === void 0 || entry.count !== morphTargetsCount) { - let disposeTexture = function() { - texture.dispose(); - morphTextures.delete(geometry); - geometry.removeEventListener("dispose", disposeTexture); - }; - if (entry !== void 0) - entry.texture.dispose(); - const hasMorphPosition = geometry.morphAttributes.position !== void 0; - const hasMorphNormals = geometry.morphAttributes.normal !== void 0; - const hasMorphColors = geometry.morphAttributes.color !== void 0; - const morphTargets = geometry.morphAttributes.position || []; - const morphNormals = geometry.morphAttributes.normal || []; - const morphColors = geometry.morphAttributes.color || []; - let vertexDataCount = 0; - if (hasMorphPosition === true) - vertexDataCount = 1; - if (hasMorphNormals === true) - vertexDataCount = 2; - if (hasMorphColors === true) - vertexDataCount = 3; - let width = geometry.attributes.position.count * vertexDataCount; - let height = 1; - if (width > capabilities.maxTextureSize) { - height = Math.ceil(width / capabilities.maxTextureSize); - width = capabilities.maxTextureSize; - } - const buffer = new Float32Array(width * height * 4 * morphTargetsCount); - const texture = new DataArrayTexture(buffer, width, height, morphTargetsCount); - texture.type = FloatType; - texture.needsUpdate = true; - const vertexDataStride = vertexDataCount * 4; - for (let i = 0; i < morphTargetsCount; i++) { - const morphTarget = morphTargets[i]; - const morphNormal = morphNormals[i]; - const morphColor = morphColors[i]; - const offset = width * height * 4 * i; - for (let j = 0; j < morphTarget.count; j++) { - const stride = j * vertexDataStride; - if (hasMorphPosition === true) { - morph.fromBufferAttribute(morphTarget, j); - buffer[offset + stride + 0] = morph.x; - buffer[offset + stride + 1] = morph.y; - buffer[offset + stride + 2] = morph.z; - buffer[offset + stride + 3] = 0; - } - if (hasMorphNormals === true) { - morph.fromBufferAttribute(morphNormal, j); - buffer[offset + stride + 4] = morph.x; - buffer[offset + stride + 5] = morph.y; - buffer[offset + stride + 6] = morph.z; - buffer[offset + stride + 7] = 0; - } - if (hasMorphColors === true) { - morph.fromBufferAttribute(morphColor, j); - buffer[offset + stride + 8] = morph.x; - buffer[offset + stride + 9] = morph.y; - buffer[offset + stride + 10] = morph.z; - buffer[offset + stride + 11] = morphColor.itemSize === 4 ? morph.w : 1; - } - } - } - entry = { - count: morphTargetsCount, - texture, - size: new Vector2(width, height) - }; - morphTextures.set(geometry, entry); - geometry.addEventListener("dispose", disposeTexture); - } - let morphInfluencesSum = 0; - for (let i = 0; i < objectInfluences.length; i++) { - morphInfluencesSum += objectInfluences[i]; - } - const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum; - program.getUniforms().setValue(gl, "morphTargetBaseInfluence", morphBaseInfluence); - program.getUniforms().setValue(gl, "morphTargetInfluences", objectInfluences); - program.getUniforms().setValue(gl, "morphTargetsTexture", entry.texture, textures); - program.getUniforms().setValue(gl, "morphTargetsTextureSize", entry.size); - } else { - const length = objectInfluences === void 0 ? 0 : objectInfluences.length; - let influences = influencesList[geometry.id]; - if (influences === void 0 || influences.length !== length) { - influences = []; - for (let i = 0; i < length; i++) { - influences[i] = [i, 0]; - } - influencesList[geometry.id] = influences; - } - for (let i = 0; i < length; i++) { - const influence = influences[i]; - influence[0] = i; - influence[1] = objectInfluences[i]; - } - influences.sort(absNumericalSort); - for (let i = 0; i < 8; i++) { - if (i < length && influences[i][1]) { - workInfluences[i][0] = influences[i][0]; - workInfluences[i][1] = influences[i][1]; - } else { - workInfluences[i][0] = Number.MAX_SAFE_INTEGER; - workInfluences[i][1] = 0; - } - } - workInfluences.sort(numericalSort); - const morphTargets = geometry.morphAttributes.position; - const morphNormals = geometry.morphAttributes.normal; - let morphInfluencesSum = 0; - for (let i = 0; i < 8; i++) { - const influence = workInfluences[i]; - const index = influence[0]; - const value = influence[1]; - if (index !== Number.MAX_SAFE_INTEGER && value) { - if (morphTargets && geometry.getAttribute("morphTarget" + i) !== morphTargets[index]) { - geometry.setAttribute("morphTarget" + i, morphTargets[index]); - } - if (morphNormals && geometry.getAttribute("morphNormal" + i) !== morphNormals[index]) { - geometry.setAttribute("morphNormal" + i, morphNormals[index]); - } - morphInfluences[i] = value; - morphInfluencesSum += value; - } else { - if (morphTargets && geometry.hasAttribute("morphTarget" + i) === true) { - geometry.deleteAttribute("morphTarget" + i); - } - if (morphNormals && geometry.hasAttribute("morphNormal" + i) === true) { - geometry.deleteAttribute("morphNormal" + i); - } - morphInfluences[i] = 0; - } - } - const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum; - program.getUniforms().setValue(gl, "morphTargetBaseInfluence", morphBaseInfluence); - program.getUniforms().setValue(gl, "morphTargetInfluences", morphInfluences); - } - } - return { - update - }; -} -function WebGLObjects(gl, geometries, attributes, info) { - let updateMap = /* @__PURE__ */ new WeakMap(); - function update(object) { - const frame = info.render.frame; - const geometry = object.geometry; - const buffergeometry = geometries.get(object, geometry); - if (updateMap.get(buffergeometry) !== frame) { - geometries.update(buffergeometry); - updateMap.set(buffergeometry, frame); - } - if (object.isInstancedMesh) { - if (object.hasEventListener("dispose", onInstancedMeshDispose) === false) { - object.addEventListener("dispose", onInstancedMeshDispose); - } - if (updateMap.get(object) !== frame) { - attributes.update(object.instanceMatrix, gl.ARRAY_BUFFER); - if (object.instanceColor !== null) { - attributes.update(object.instanceColor, gl.ARRAY_BUFFER); - } - updateMap.set(object, frame); - } - } - if (object.isSkinnedMesh) { - const skeleton = object.skeleton; - if (updateMap.get(skeleton) !== frame) { - skeleton.update(); - updateMap.set(skeleton, frame); - } - } - return buffergeometry; - } - function dispose() { - updateMap = /* @__PURE__ */ new WeakMap(); - } - function onInstancedMeshDispose(event) { - const instancedMesh = event.target; - instancedMesh.removeEventListener("dispose", onInstancedMeshDispose); - attributes.remove(instancedMesh.instanceMatrix); - if (instancedMesh.instanceColor !== null) - attributes.remove(instancedMesh.instanceColor); - } - return { - update, - dispose - }; -} -var emptyTexture = new Texture(); -var emptyArrayTexture = new DataArrayTexture(); -var empty3dTexture = new Data3DTexture(); -var emptyCubeTexture = new CubeTexture(); -var arrayCacheF32 = []; -var arrayCacheI32 = []; -var mat4array = new Float32Array(16); -var mat3array = new Float32Array(9); -var mat2array = new Float32Array(4); -function flatten(array, nBlocks, blockSize) { - const firstElem = array[0]; - if (firstElem <= 0 || firstElem > 0) - return array; - const n = nBlocks * blockSize; - let r = arrayCacheF32[n]; - if (r === void 0) { - r = new Float32Array(n); - arrayCacheF32[n] = r; - } - if (nBlocks !== 0) { - firstElem.toArray(r, 0); - for (let i = 1, offset = 0; i !== nBlocks; ++i) { - offset += blockSize; - array[i].toArray(r, offset); - } - } - return r; -} -function arraysEqual(a, b) { - if (a.length !== b.length) - return false; - for (let i = 0, l = a.length; i < l; i++) { - if (a[i] !== b[i]) - return false; - } - return true; -} -function copyArray(a, b) { - for (let i = 0, l = b.length; i < l; i++) { - a[i] = b[i]; - } -} -function allocTexUnits(textures, n) { - let r = arrayCacheI32[n]; - if (r === void 0) { - r = new Int32Array(n); - arrayCacheI32[n] = r; - } - for (let i = 0; i !== n; ++i) { - r[i] = textures.allocateTextureUnit(); - } - return r; -} -function setValueV1f(gl, v) { - const cache = this.cache; - if (cache[0] === v) - return; - gl.uniform1f(this.addr, v); - cache[0] = v; -} -function setValueV2f(gl, v) { - const cache = this.cache; - if (v.x !== void 0) { - if (cache[0] !== v.x || cache[1] !== v.y) { - gl.uniform2f(this.addr, v.x, v.y); - cache[0] = v.x; - cache[1] = v.y; - } - } else { - if (arraysEqual(cache, v)) - return; - gl.uniform2fv(this.addr, v); - copyArray(cache, v); - } -} -function setValueV3f(gl, v) { - const cache = this.cache; - if (v.x !== void 0) { - if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) { - gl.uniform3f(this.addr, v.x, v.y, v.z); - cache[0] = v.x; - cache[1] = v.y; - cache[2] = v.z; - } - } else if (v.r !== void 0) { - if (cache[0] !== v.r || cache[1] !== v.g || cache[2] !== v.b) { - gl.uniform3f(this.addr, v.r, v.g, v.b); - cache[0] = v.r; - cache[1] = v.g; - cache[2] = v.b; - } - } else { - if (arraysEqual(cache, v)) - return; - gl.uniform3fv(this.addr, v); - copyArray(cache, v); - } -} -function setValueV4f(gl, v) { - const cache = this.cache; - if (v.x !== void 0) { - if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) { - gl.uniform4f(this.addr, v.x, v.y, v.z, v.w); - cache[0] = v.x; - cache[1] = v.y; - cache[2] = v.z; - cache[3] = v.w; - } - } else { - if (arraysEqual(cache, v)) - return; - gl.uniform4fv(this.addr, v); - copyArray(cache, v); - } -} -function setValueM2(gl, v) { - const cache = this.cache; - const elements = v.elements; - if (elements === void 0) { - if (arraysEqual(cache, v)) - return; - gl.uniformMatrix2fv(this.addr, false, v); - copyArray(cache, v); - } else { - if (arraysEqual(cache, elements)) - return; - mat2array.set(elements); - gl.uniformMatrix2fv(this.addr, false, mat2array); - copyArray(cache, elements); - } -} -function setValueM3(gl, v) { - const cache = this.cache; - const elements = v.elements; - if (elements === void 0) { - if (arraysEqual(cache, v)) - return; - gl.uniformMatrix3fv(this.addr, false, v); - copyArray(cache, v); - } else { - if (arraysEqual(cache, elements)) - return; - mat3array.set(elements); - gl.uniformMatrix3fv(this.addr, false, mat3array); - copyArray(cache, elements); - } -} -function setValueM4(gl, v) { - const cache = this.cache; - const elements = v.elements; - if (elements === void 0) { - if (arraysEqual(cache, v)) - return; - gl.uniformMatrix4fv(this.addr, false, v); - copyArray(cache, v); - } else { - if (arraysEqual(cache, elements)) - return; - mat4array.set(elements); - gl.uniformMatrix4fv(this.addr, false, mat4array); - copyArray(cache, elements); - } -} -function setValueV1i(gl, v) { - const cache = this.cache; - if (cache[0] === v) - return; - gl.uniform1i(this.addr, v); - cache[0] = v; -} -function setValueV2i(gl, v) { - const cache = this.cache; - if (v.x !== void 0) { - if (cache[0] !== v.x || cache[1] !== v.y) { - gl.uniform2i(this.addr, v.x, v.y); - cache[0] = v.x; - cache[1] = v.y; - } - } else { - if (arraysEqual(cache, v)) - return; - gl.uniform2iv(this.addr, v); - copyArray(cache, v); - } -} -function setValueV3i(gl, v) { - const cache = this.cache; - if (v.x !== void 0) { - if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) { - gl.uniform3i(this.addr, v.x, v.y, v.z); - cache[0] = v.x; - cache[1] = v.y; - cache[2] = v.z; - } - } else { - if (arraysEqual(cache, v)) - return; - gl.uniform3iv(this.addr, v); - copyArray(cache, v); - } -} -function setValueV4i(gl, v) { - const cache = this.cache; - if (v.x !== void 0) { - if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) { - gl.uniform4i(this.addr, v.x, v.y, v.z, v.w); - cache[0] = v.x; - cache[1] = v.y; - cache[2] = v.z; - cache[3] = v.w; - } - } else { - if (arraysEqual(cache, v)) - return; - gl.uniform4iv(this.addr, v); - copyArray(cache, v); - } -} -function setValueV1ui(gl, v) { - const cache = this.cache; - if (cache[0] === v) - return; - gl.uniform1ui(this.addr, v); - cache[0] = v; -} -function setValueV2ui(gl, v) { - const cache = this.cache; - if (v.x !== void 0) { - if (cache[0] !== v.x || cache[1] !== v.y) { - gl.uniform2ui(this.addr, v.x, v.y); - cache[0] = v.x; - cache[1] = v.y; - } - } else { - if (arraysEqual(cache, v)) - return; - gl.uniform2uiv(this.addr, v); - copyArray(cache, v); - } -} -function setValueV3ui(gl, v) { - const cache = this.cache; - if (v.x !== void 0) { - if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) { - gl.uniform3ui(this.addr, v.x, v.y, v.z); - cache[0] = v.x; - cache[1] = v.y; - cache[2] = v.z; - } - } else { - if (arraysEqual(cache, v)) - return; - gl.uniform3uiv(this.addr, v); - copyArray(cache, v); - } -} -function setValueV4ui(gl, v) { - const cache = this.cache; - if (v.x !== void 0) { - if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) { - gl.uniform4ui(this.addr, v.x, v.y, v.z, v.w); - cache[0] = v.x; - cache[1] = v.y; - cache[2] = v.z; - cache[3] = v.w; - } - } else { - if (arraysEqual(cache, v)) - return; - gl.uniform4uiv(this.addr, v); - copyArray(cache, v); - } -} -function setValueT1(gl, v, textures) { - const cache = this.cache; - const unit = textures.allocateTextureUnit(); - if (cache[0] !== unit) { - gl.uniform1i(this.addr, unit); - cache[0] = unit; - } - textures.setTexture2D(v || emptyTexture, unit); -} -function setValueT3D1(gl, v, textures) { - const cache = this.cache; - const unit = textures.allocateTextureUnit(); - if (cache[0] !== unit) { - gl.uniform1i(this.addr, unit); - cache[0] = unit; - } - textures.setTexture3D(v || empty3dTexture, unit); -} -function setValueT6(gl, v, textures) { - const cache = this.cache; - const unit = textures.allocateTextureUnit(); - if (cache[0] !== unit) { - gl.uniform1i(this.addr, unit); - cache[0] = unit; - } - textures.setTextureCube(v || emptyCubeTexture, unit); -} -function setValueT2DArray1(gl, v, textures) { - const cache = this.cache; - const unit = textures.allocateTextureUnit(); - if (cache[0] !== unit) { - gl.uniform1i(this.addr, unit); - cache[0] = unit; - } - textures.setTexture2DArray(v || emptyArrayTexture, unit); -} -function getSingularSetter(type) { - switch (type) { - case 5126: - return setValueV1f; - case 35664: - return setValueV2f; - case 35665: - return setValueV3f; - case 35666: - return setValueV4f; - case 35674: - return setValueM2; - case 35675: - return setValueM3; - case 35676: - return setValueM4; - case 5124: - case 35670: - return setValueV1i; - case 35667: - case 35671: - return setValueV2i; - case 35668: - case 35672: - return setValueV3i; - case 35669: - case 35673: - return setValueV4i; - case 5125: - return setValueV1ui; - case 36294: - return setValueV2ui; - case 36295: - return setValueV3ui; - case 36296: - return setValueV4ui; - case 35678: - case 36198: - case 36298: - case 36306: - case 35682: - return setValueT1; - case 35679: - case 36299: - case 36307: - return setValueT3D1; - case 35680: - case 36300: - case 36308: - case 36293: - return setValueT6; - case 36289: - case 36303: - case 36311: - case 36292: - return setValueT2DArray1; - } -} -function setValueV1fArray(gl, v) { - gl.uniform1fv(this.addr, v); -} -function setValueV2fArray(gl, v) { - const data = flatten(v, this.size, 2); - gl.uniform2fv(this.addr, data); -} -function setValueV3fArray(gl, v) { - const data = flatten(v, this.size, 3); - gl.uniform3fv(this.addr, data); -} -function setValueV4fArray(gl, v) { - const data = flatten(v, this.size, 4); - gl.uniform4fv(this.addr, data); -} -function setValueM2Array(gl, v) { - const data = flatten(v, this.size, 4); - gl.uniformMatrix2fv(this.addr, false, data); -} -function setValueM3Array(gl, v) { - const data = flatten(v, this.size, 9); - gl.uniformMatrix3fv(this.addr, false, data); -} -function setValueM4Array(gl, v) { - const data = flatten(v, this.size, 16); - gl.uniformMatrix4fv(this.addr, false, data); -} -function setValueV1iArray(gl, v) { - gl.uniform1iv(this.addr, v); -} -function setValueV2iArray(gl, v) { - gl.uniform2iv(this.addr, v); -} -function setValueV3iArray(gl, v) { - gl.uniform3iv(this.addr, v); -} -function setValueV4iArray(gl, v) { - gl.uniform4iv(this.addr, v); -} -function setValueV1uiArray(gl, v) { - gl.uniform1uiv(this.addr, v); -} -function setValueV2uiArray(gl, v) { - gl.uniform2uiv(this.addr, v); -} -function setValueV3uiArray(gl, v) { - gl.uniform3uiv(this.addr, v); -} -function setValueV4uiArray(gl, v) { - gl.uniform4uiv(this.addr, v); -} -function setValueT1Array(gl, v, textures) { - const cache = this.cache; - const n = v.length; - const units = allocTexUnits(textures, n); - if (!arraysEqual(cache, units)) { - gl.uniform1iv(this.addr, units); - copyArray(cache, units); - } - for (let i = 0; i !== n; ++i) { - textures.setTexture2D(v[i] || emptyTexture, units[i]); - } -} -function setValueT3DArray(gl, v, textures) { - const cache = this.cache; - const n = v.length; - const units = allocTexUnits(textures, n); - if (!arraysEqual(cache, units)) { - gl.uniform1iv(this.addr, units); - copyArray(cache, units); - } - for (let i = 0; i !== n; ++i) { - textures.setTexture3D(v[i] || empty3dTexture, units[i]); - } -} -function setValueT6Array(gl, v, textures) { - const cache = this.cache; - const n = v.length; - const units = allocTexUnits(textures, n); - if (!arraysEqual(cache, units)) { - gl.uniform1iv(this.addr, units); - copyArray(cache, units); - } - for (let i = 0; i !== n; ++i) { - textures.setTextureCube(v[i] || emptyCubeTexture, units[i]); - } -} -function setValueT2DArrayArray(gl, v, textures) { - const cache = this.cache; - const n = v.length; - const units = allocTexUnits(textures, n); - if (!arraysEqual(cache, units)) { - gl.uniform1iv(this.addr, units); - copyArray(cache, units); - } - for (let i = 0; i !== n; ++i) { - textures.setTexture2DArray(v[i] || emptyArrayTexture, units[i]); - } -} -function getPureArraySetter(type) { - switch (type) { - case 5126: - return setValueV1fArray; - case 35664: - return setValueV2fArray; - case 35665: - return setValueV3fArray; - case 35666: - return setValueV4fArray; - case 35674: - return setValueM2Array; - case 35675: - return setValueM3Array; - case 35676: - return setValueM4Array; - case 5124: - case 35670: - return setValueV1iArray; - case 35667: - case 35671: - return setValueV2iArray; - case 35668: - case 35672: - return setValueV3iArray; - case 35669: - case 35673: - return setValueV4iArray; - case 5125: - return setValueV1uiArray; - case 36294: - return setValueV2uiArray; - case 36295: - return setValueV3uiArray; - case 36296: - return setValueV4uiArray; - case 35678: - case 36198: - case 36298: - case 36306: - case 35682: - return setValueT1Array; - case 35679: - case 36299: - case 36307: - return setValueT3DArray; - case 35680: - case 36300: - case 36308: - case 36293: - return setValueT6Array; - case 36289: - case 36303: - case 36311: - case 36292: - return setValueT2DArrayArray; - } -} -var SingleUniform = class { - constructor(id, activeInfo, addr) { - this.id = id; - this.addr = addr; - this.cache = []; - this.setValue = getSingularSetter(activeInfo.type); - } -}; -var PureArrayUniform = class { - constructor(id, activeInfo, addr) { - this.id = id; - this.addr = addr; - this.cache = []; - this.size = activeInfo.size; - this.setValue = getPureArraySetter(activeInfo.type); - } -}; -var StructuredUniform = class { - constructor(id) { - this.id = id; - this.seq = []; - this.map = {}; - } - setValue(gl, value, textures) { - const seq = this.seq; - for (let i = 0, n = seq.length; i !== n; ++i) { - const u = seq[i]; - u.setValue(gl, value[u.id], textures); - } - } -}; -var RePathPart = /(\w+)(\])?(\[|\.)?/g; -function addUniform(container, uniformObject) { - container.seq.push(uniformObject); - container.map[uniformObject.id] = uniformObject; -} -function parseUniform(activeInfo, addr, container) { - const path = activeInfo.name, pathLength = path.length; - RePathPart.lastIndex = 0; - while (true) { - const match = RePathPart.exec(path), matchEnd = RePathPart.lastIndex; - let id = match[1]; - const idIsIndex = match[2] === "]", subscript = match[3]; - if (idIsIndex) - id = id | 0; - if (subscript === void 0 || subscript === "[" && matchEnd + 2 === pathLength) { - addUniform(container, subscript === void 0 ? new SingleUniform(id, activeInfo, addr) : new PureArrayUniform(id, activeInfo, addr)); - break; - } else { - const map = container.map; - let next = map[id]; - if (next === void 0) { - next = new StructuredUniform(id); - addUniform(container, next); - } - container = next; - } - } -} -var WebGLUniforms = class { - constructor(gl, program) { - this.seq = []; - this.map = {}; - const n = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); - for (let i = 0; i < n; ++i) { - const info = gl.getActiveUniform(program, i), addr = gl.getUniformLocation(program, info.name); - parseUniform(info, addr, this); - } - } - setValue(gl, name, value, textures) { - const u = this.map[name]; - if (u !== void 0) - u.setValue(gl, value, textures); - } - setOptional(gl, object, name) { - const v = object[name]; - if (v !== void 0) - this.setValue(gl, name, v); - } - static upload(gl, seq, values, textures) { - for (let i = 0, n = seq.length; i !== n; ++i) { - const u = seq[i], v = values[u.id]; - if (v.needsUpdate !== false) { - u.setValue(gl, v.value, textures); - } - } - } - static seqWithValue(seq, values) { - const r = []; - for (let i = 0, n = seq.length; i !== n; ++i) { - const u = seq[i]; - if (u.id in values) - r.push(u); - } - return r; - } -}; -function WebGLShader(gl, type, string) { - const shader = gl.createShader(type); - gl.shaderSource(shader, string); - gl.compileShader(shader); - return shader; -} -var COMPLETION_STATUS_KHR = 37297; -var programIdCount = 0; -function handleSource(string, errorLine) { - const lines = string.split("\n"); - const lines2 = []; - const from = Math.max(errorLine - 6, 0); - const to = Math.min(errorLine + 6, lines.length); - for (let i = from; i < to; i++) { - const line = i + 1; - lines2.push(`${line === errorLine ? ">" : " "} ${line}: ${lines[i]}`); - } - return lines2.join("\n"); -} -function getEncodingComponents(colorSpace) { - const workingPrimaries = ColorManagement.getPrimaries(ColorManagement.workingColorSpace); - const encodingPrimaries = ColorManagement.getPrimaries(colorSpace); - let gamutMapping; - if (workingPrimaries === encodingPrimaries) { - gamutMapping = ""; - } else if (workingPrimaries === P3Primaries && encodingPrimaries === Rec709Primaries) { - gamutMapping = "LinearDisplayP3ToLinearSRGB"; - } else if (workingPrimaries === Rec709Primaries && encodingPrimaries === P3Primaries) { - gamutMapping = "LinearSRGBToLinearDisplayP3"; - } - switch (colorSpace) { - case LinearSRGBColorSpace: - case LinearDisplayP3ColorSpace: - return [gamutMapping, "LinearTransferOETF"]; - case SRGBColorSpace: - case DisplayP3ColorSpace: - return [gamutMapping, "sRGBTransferOETF"]; - default: - console.warn("THREE.WebGLProgram: Unsupported color space:", colorSpace); - return [gamutMapping, "LinearTransferOETF"]; - } -} -function getShaderErrors(gl, shader, type) { - const status = gl.getShaderParameter(shader, gl.COMPILE_STATUS); - const errors = gl.getShaderInfoLog(shader).trim(); - if (status && errors === "") - return ""; - const errorMatches = /ERROR: 0:(\d+)/.exec(errors); - if (errorMatches) { - const errorLine = parseInt(errorMatches[1]); - return type.toUpperCase() + "\n\n" + errors + "\n\n" + handleSource(gl.getShaderSource(shader), errorLine); - } else { - return errors; - } -} -function getTexelEncodingFunction(functionName, colorSpace) { - const components = getEncodingComponents(colorSpace); - return `vec4 ${functionName}( vec4 value ) { return ${components[0]}( ${components[1]}( value ) ); }`; -} -function getToneMappingFunction(functionName, toneMapping) { - let toneMappingName; - switch (toneMapping) { - case LinearToneMapping: - toneMappingName = "Linear"; - break; - case ReinhardToneMapping: - toneMappingName = "Reinhard"; - break; - case CineonToneMapping: - toneMappingName = "OptimizedCineon"; - break; - case ACESFilmicToneMapping: - toneMappingName = "ACESFilmic"; - break; - case CustomToneMapping: - toneMappingName = "Custom"; - break; - default: - console.warn("THREE.WebGLProgram: Unsupported toneMapping:", toneMapping); - toneMappingName = "Linear"; - } - return "vec3 " + functionName + "( vec3 color ) { return " + toneMappingName + "ToneMapping( color ); }"; -} -function generateExtensions(parameters) { - const chunks = [ - parameters.extensionDerivatives || !!parameters.envMapCubeUVHeight || parameters.bumpMap || parameters.normalMapTangentSpace || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === "physical" ? "#extension GL_OES_standard_derivatives : enable" : "", - (parameters.extensionFragDepth || parameters.logarithmicDepthBuffer) && parameters.rendererExtensionFragDepth ? "#extension GL_EXT_frag_depth : enable" : "", - parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ? "#extension GL_EXT_draw_buffers : require" : "", - (parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission) && parameters.rendererExtensionShaderTextureLod ? "#extension GL_EXT_shader_texture_lod : enable" : "" - ]; - return chunks.filter(filterEmptyLine).join("\n"); -} -function generateDefines(defines) { - const chunks = []; - for (const name in defines) { - const value = defines[name]; - if (value === false) - continue; - chunks.push("#define " + name + " " + value); - } - return chunks.join("\n"); -} -function fetchAttributeLocations(gl, program) { - const attributes = {}; - const n = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES); - for (let i = 0; i < n; i++) { - const info = gl.getActiveAttrib(program, i); - const name = info.name; - let locationSize = 1; - if (info.type === gl.FLOAT_MAT2) - locationSize = 2; - if (info.type === gl.FLOAT_MAT3) - locationSize = 3; - if (info.type === gl.FLOAT_MAT4) - locationSize = 4; - attributes[name] = { - type: info.type, - location: gl.getAttribLocation(program, name), - locationSize - }; - } - return attributes; -} -function filterEmptyLine(string) { - return string !== ""; -} -function replaceLightNums(string, parameters) { - const numSpotLightCoords = parameters.numSpotLightShadows + parameters.numSpotLightMaps - parameters.numSpotLightShadowsWithMaps; - return string.replace(/NUM_DIR_LIGHTS/g, parameters.numDirLights).replace(/NUM_SPOT_LIGHTS/g, parameters.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g, parameters.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g, numSpotLightCoords).replace(/NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, parameters.numPointLights).replace(/NUM_HEMI_LIGHTS/g, parameters.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, parameters.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows); -} -function replaceClippingPlaneNums(string, parameters) { - return string.replace(/NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, parameters.numClippingPlanes - parameters.numClipIntersection); -} -var includePattern = /^[ \t]*#include +<([\w\d./]+)>/gm; -function resolveIncludes(string) { - return string.replace(includePattern, includeReplacer); -} -var shaderChunkMap = /* @__PURE__ */ new Map([ - ["encodings_fragment", "colorspace_fragment"], - // @deprecated, r154 - ["encodings_pars_fragment", "colorspace_pars_fragment"], - // @deprecated, r154 - ["output_fragment", "opaque_fragment"] - // @deprecated, r154 -]); -function includeReplacer(match, include) { - let string = ShaderChunk[include]; - if (string === void 0) { - const newInclude = shaderChunkMap.get(include); - if (newInclude !== void 0) { - string = ShaderChunk[newInclude]; - console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.', include, newInclude); - } else { - throw new Error("Can not resolve #include <" + include + ">"); - } - } - return resolveIncludes(string); -} -var unrollLoopPattern = /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g; -function unrollLoops(string) { - return string.replace(unrollLoopPattern, loopReplacer); -} -function loopReplacer(match, start, end, snippet) { - let string = ""; - for (let i = parseInt(start); i < parseInt(end); i++) { - string += snippet.replace(/\[\s*i\s*\]/g, "[ " + i + " ]").replace(/UNROLLED_LOOP_INDEX/g, i); - } - return string; -} -function generatePrecision(parameters) { - let precisionstring = "precision " + parameters.precision + " float;\nprecision " + parameters.precision + " int;"; - if (parameters.precision === "highp") { - precisionstring += "\n#define HIGH_PRECISION"; - } else if (parameters.precision === "mediump") { - precisionstring += "\n#define MEDIUM_PRECISION"; - } else if (parameters.precision === "lowp") { - precisionstring += "\n#define LOW_PRECISION"; - } - return precisionstring; -} -function generateShadowMapTypeDefine(parameters) { - let shadowMapTypeDefine = "SHADOWMAP_TYPE_BASIC"; - if (parameters.shadowMapType === PCFShadowMap) { - shadowMapTypeDefine = "SHADOWMAP_TYPE_PCF"; - } else if (parameters.shadowMapType === PCFSoftShadowMap) { - shadowMapTypeDefine = "SHADOWMAP_TYPE_PCF_SOFT"; - } else if (parameters.shadowMapType === VSMShadowMap) { - shadowMapTypeDefine = "SHADOWMAP_TYPE_VSM"; - } - return shadowMapTypeDefine; -} -function generateEnvMapTypeDefine(parameters) { - let envMapTypeDefine = "ENVMAP_TYPE_CUBE"; - if (parameters.envMap) { - switch (parameters.envMapMode) { - case CubeReflectionMapping: - case CubeRefractionMapping: - envMapTypeDefine = "ENVMAP_TYPE_CUBE"; - break; - case CubeUVReflectionMapping: - envMapTypeDefine = "ENVMAP_TYPE_CUBE_UV"; - break; - } - } - return envMapTypeDefine; -} -function generateEnvMapModeDefine(parameters) { - let envMapModeDefine = "ENVMAP_MODE_REFLECTION"; - if (parameters.envMap) { - switch (parameters.envMapMode) { - case CubeRefractionMapping: - envMapModeDefine = "ENVMAP_MODE_REFRACTION"; - break; - } - } - return envMapModeDefine; -} -function generateEnvMapBlendingDefine(parameters) { - let envMapBlendingDefine = "ENVMAP_BLENDING_NONE"; - if (parameters.envMap) { - switch (parameters.combine) { - case MultiplyOperation: - envMapBlendingDefine = "ENVMAP_BLENDING_MULTIPLY"; - break; - case MixOperation: - envMapBlendingDefine = "ENVMAP_BLENDING_MIX"; - break; - case AddOperation: - envMapBlendingDefine = "ENVMAP_BLENDING_ADD"; - break; - } - } - return envMapBlendingDefine; -} -function generateCubeUVSize(parameters) { - const imageHeight = parameters.envMapCubeUVHeight; - if (imageHeight === null) - return null; - const maxMip = Math.log2(imageHeight) - 2; - const texelHeight = 1 / imageHeight; - const texelWidth = 1 / (3 * Math.max(Math.pow(2, maxMip), 7 * 16)); - return { texelWidth, texelHeight, maxMip }; -} -function WebGLProgram(renderer, cacheKey, parameters, bindingStates) { - const gl = renderer.getContext(); - const defines = parameters.defines; - let vertexShader = parameters.vertexShader; - let fragmentShader = parameters.fragmentShader; - const shadowMapTypeDefine = generateShadowMapTypeDefine(parameters); - const envMapTypeDefine = generateEnvMapTypeDefine(parameters); - const envMapModeDefine = generateEnvMapModeDefine(parameters); - const envMapBlendingDefine = generateEnvMapBlendingDefine(parameters); - const envMapCubeUVSize = generateCubeUVSize(parameters); - const customExtensions = parameters.isWebGL2 ? "" : generateExtensions(parameters); - const customDefines = generateDefines(defines); - const program = gl.createProgram(); - let prefixVertex, prefixFragment; - let versionString = parameters.glslVersion ? "#version " + parameters.glslVersion + "\n" : ""; - if (parameters.isRawShaderMaterial) { - prefixVertex = [ - "#define SHADER_TYPE " + parameters.shaderType, - "#define SHADER_NAME " + parameters.shaderName, - customDefines - ].filter(filterEmptyLine).join("\n"); - if (prefixVertex.length > 0) { - prefixVertex += "\n"; - } - prefixFragment = [ - customExtensions, - "#define SHADER_TYPE " + parameters.shaderType, - "#define SHADER_NAME " + parameters.shaderName, - customDefines - ].filter(filterEmptyLine).join("\n"); - if (prefixFragment.length > 0) { - prefixFragment += "\n"; - } - } else { - prefixVertex = [ - generatePrecision(parameters), - "#define SHADER_TYPE " + parameters.shaderType, - "#define SHADER_NAME " + parameters.shaderName, - customDefines, - parameters.instancing ? "#define USE_INSTANCING" : "", - parameters.instancingColor ? "#define USE_INSTANCING_COLOR" : "", - parameters.useFog && parameters.fog ? "#define USE_FOG" : "", - parameters.useFog && parameters.fogExp2 ? "#define FOG_EXP2" : "", - parameters.map ? "#define USE_MAP" : "", - parameters.envMap ? "#define USE_ENVMAP" : "", - parameters.envMap ? "#define " + envMapModeDefine : "", - parameters.lightMap ? "#define USE_LIGHTMAP" : "", - parameters.aoMap ? "#define USE_AOMAP" : "", - parameters.bumpMap ? "#define USE_BUMPMAP" : "", - parameters.normalMap ? "#define USE_NORMALMAP" : "", - parameters.normalMapObjectSpace ? "#define USE_NORMALMAP_OBJECTSPACE" : "", - parameters.normalMapTangentSpace ? "#define USE_NORMALMAP_TANGENTSPACE" : "", - parameters.displacementMap ? "#define USE_DISPLACEMENTMAP" : "", - parameters.emissiveMap ? "#define USE_EMISSIVEMAP" : "", - parameters.anisotropy ? "#define USE_ANISOTROPY" : "", - parameters.anisotropyMap ? "#define USE_ANISOTROPYMAP" : "", - parameters.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", - parameters.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", - parameters.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", - parameters.iridescenceMap ? "#define USE_IRIDESCENCEMAP" : "", - parameters.iridescenceThicknessMap ? "#define USE_IRIDESCENCE_THICKNESSMAP" : "", - parameters.specularMap ? "#define USE_SPECULARMAP" : "", - parameters.specularColorMap ? "#define USE_SPECULAR_COLORMAP" : "", - parameters.specularIntensityMap ? "#define USE_SPECULAR_INTENSITYMAP" : "", - parameters.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", - parameters.metalnessMap ? "#define USE_METALNESSMAP" : "", - parameters.alphaMap ? "#define USE_ALPHAMAP" : "", - parameters.alphaHash ? "#define USE_ALPHAHASH" : "", - parameters.transmission ? "#define USE_TRANSMISSION" : "", - parameters.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", - parameters.thicknessMap ? "#define USE_THICKNESSMAP" : "", - parameters.sheenColorMap ? "#define USE_SHEEN_COLORMAP" : "", - parameters.sheenRoughnessMap ? "#define USE_SHEEN_ROUGHNESSMAP" : "", - // - parameters.mapUv ? "#define MAP_UV " + parameters.mapUv : "", - parameters.alphaMapUv ? "#define ALPHAMAP_UV " + parameters.alphaMapUv : "", - parameters.lightMapUv ? "#define LIGHTMAP_UV " + parameters.lightMapUv : "", - parameters.aoMapUv ? "#define AOMAP_UV " + parameters.aoMapUv : "", - parameters.emissiveMapUv ? "#define EMISSIVEMAP_UV " + parameters.emissiveMapUv : "", - parameters.bumpMapUv ? "#define BUMPMAP_UV " + parameters.bumpMapUv : "", - parameters.normalMapUv ? "#define NORMALMAP_UV " + parameters.normalMapUv : "", - parameters.displacementMapUv ? "#define DISPLACEMENTMAP_UV " + parameters.displacementMapUv : "", - parameters.metalnessMapUv ? "#define METALNESSMAP_UV " + parameters.metalnessMapUv : "", - parameters.roughnessMapUv ? "#define ROUGHNESSMAP_UV " + parameters.roughnessMapUv : "", - parameters.anisotropyMapUv ? "#define ANISOTROPYMAP_UV " + parameters.anisotropyMapUv : "", - parameters.clearcoatMapUv ? "#define CLEARCOATMAP_UV " + parameters.clearcoatMapUv : "", - parameters.clearcoatNormalMapUv ? "#define CLEARCOAT_NORMALMAP_UV " + parameters.clearcoatNormalMapUv : "", - parameters.clearcoatRoughnessMapUv ? "#define CLEARCOAT_ROUGHNESSMAP_UV " + parameters.clearcoatRoughnessMapUv : "", - parameters.iridescenceMapUv ? "#define IRIDESCENCEMAP_UV " + parameters.iridescenceMapUv : "", - parameters.iridescenceThicknessMapUv ? "#define IRIDESCENCE_THICKNESSMAP_UV " + parameters.iridescenceThicknessMapUv : "", - parameters.sheenColorMapUv ? "#define SHEEN_COLORMAP_UV " + parameters.sheenColorMapUv : "", - parameters.sheenRoughnessMapUv ? "#define SHEEN_ROUGHNESSMAP_UV " + parameters.sheenRoughnessMapUv : "", - parameters.specularMapUv ? "#define SPECULARMAP_UV " + parameters.specularMapUv : "", - parameters.specularColorMapUv ? "#define SPECULAR_COLORMAP_UV " + parameters.specularColorMapUv : "", - parameters.specularIntensityMapUv ? "#define SPECULAR_INTENSITYMAP_UV " + parameters.specularIntensityMapUv : "", - parameters.transmissionMapUv ? "#define TRANSMISSIONMAP_UV " + parameters.transmissionMapUv : "", - parameters.thicknessMapUv ? "#define THICKNESSMAP_UV " + parameters.thicknessMapUv : "", - // - parameters.vertexTangents && parameters.flatShading === false ? "#define USE_TANGENT" : "", - parameters.vertexColors ? "#define USE_COLOR" : "", - parameters.vertexAlphas ? "#define USE_COLOR_ALPHA" : "", - parameters.vertexUv1s ? "#define USE_UV1" : "", - parameters.vertexUv2s ? "#define USE_UV2" : "", - parameters.vertexUv3s ? "#define USE_UV3" : "", - parameters.pointsUvs ? "#define USE_POINTS_UV" : "", - parameters.flatShading ? "#define FLAT_SHADED" : "", - parameters.skinning ? "#define USE_SKINNING" : "", - parameters.morphTargets ? "#define USE_MORPHTARGETS" : "", - parameters.morphNormals && parameters.flatShading === false ? "#define USE_MORPHNORMALS" : "", - parameters.morphColors && parameters.isWebGL2 ? "#define USE_MORPHCOLORS" : "", - parameters.morphTargetsCount > 0 && parameters.isWebGL2 ? "#define MORPHTARGETS_TEXTURE" : "", - parameters.morphTargetsCount > 0 && parameters.isWebGL2 ? "#define MORPHTARGETS_TEXTURE_STRIDE " + parameters.morphTextureStride : "", - parameters.morphTargetsCount > 0 && parameters.isWebGL2 ? "#define MORPHTARGETS_COUNT " + parameters.morphTargetsCount : "", - parameters.doubleSided ? "#define DOUBLE_SIDED" : "", - parameters.flipSided ? "#define FLIP_SIDED" : "", - parameters.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", - parameters.shadowMapEnabled ? "#define " + shadowMapTypeDefine : "", - parameters.sizeAttenuation ? "#define USE_SIZEATTENUATION" : "", - parameters.numLightProbes > 0 ? "#define USE_LIGHT_PROBES" : "", - parameters.useLegacyLights ? "#define LEGACY_LIGHTS" : "", - parameters.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", - parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ? "#define USE_LOGDEPTHBUF_EXT" : "", - "uniform mat4 modelMatrix;", - "uniform mat4 modelViewMatrix;", - "uniform mat4 projectionMatrix;", - "uniform mat4 viewMatrix;", - "uniform mat3 normalMatrix;", - "uniform vec3 cameraPosition;", - "uniform bool isOrthographic;", - "#ifdef USE_INSTANCING", - " attribute mat4 instanceMatrix;", - "#endif", - "#ifdef USE_INSTANCING_COLOR", - " attribute vec3 instanceColor;", - "#endif", - "attribute vec3 position;", - "attribute vec3 normal;", - "attribute vec2 uv;", - "#ifdef USE_UV1", - " attribute vec2 uv1;", - "#endif", - "#ifdef USE_UV2", - " attribute vec2 uv2;", - "#endif", - "#ifdef USE_UV3", - " attribute vec2 uv3;", - "#endif", - "#ifdef USE_TANGENT", - " attribute vec4 tangent;", - "#endif", - "#if defined( USE_COLOR_ALPHA )", - " attribute vec4 color;", - "#elif defined( USE_COLOR )", - " attribute vec3 color;", - "#endif", - "#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )", - " attribute vec3 morphTarget0;", - " attribute vec3 morphTarget1;", - " attribute vec3 morphTarget2;", - " attribute vec3 morphTarget3;", - " #ifdef USE_MORPHNORMALS", - " attribute vec3 morphNormal0;", - " attribute vec3 morphNormal1;", - " attribute vec3 morphNormal2;", - " attribute vec3 morphNormal3;", - " #else", - " attribute vec3 morphTarget4;", - " attribute vec3 morphTarget5;", - " attribute vec3 morphTarget6;", - " attribute vec3 morphTarget7;", - " #endif", - "#endif", - "#ifdef USE_SKINNING", - " attribute vec4 skinIndex;", - " attribute vec4 skinWeight;", - "#endif", - "\n" - ].filter(filterEmptyLine).join("\n"); - prefixFragment = [ - customExtensions, - generatePrecision(parameters), - "#define SHADER_TYPE " + parameters.shaderType, - "#define SHADER_NAME " + parameters.shaderName, - customDefines, - parameters.useFog && parameters.fog ? "#define USE_FOG" : "", - parameters.useFog && parameters.fogExp2 ? "#define FOG_EXP2" : "", - parameters.map ? "#define USE_MAP" : "", - parameters.matcap ? "#define USE_MATCAP" : "", - parameters.envMap ? "#define USE_ENVMAP" : "", - parameters.envMap ? "#define " + envMapTypeDefine : "", - parameters.envMap ? "#define " + envMapModeDefine : "", - parameters.envMap ? "#define " + envMapBlendingDefine : "", - envMapCubeUVSize ? "#define CUBEUV_TEXEL_WIDTH " + envMapCubeUVSize.texelWidth : "", - envMapCubeUVSize ? "#define CUBEUV_TEXEL_HEIGHT " + envMapCubeUVSize.texelHeight : "", - envMapCubeUVSize ? "#define CUBEUV_MAX_MIP " + envMapCubeUVSize.maxMip + ".0" : "", - parameters.lightMap ? "#define USE_LIGHTMAP" : "", - parameters.aoMap ? "#define USE_AOMAP" : "", - parameters.bumpMap ? "#define USE_BUMPMAP" : "", - parameters.normalMap ? "#define USE_NORMALMAP" : "", - parameters.normalMapObjectSpace ? "#define USE_NORMALMAP_OBJECTSPACE" : "", - parameters.normalMapTangentSpace ? "#define USE_NORMALMAP_TANGENTSPACE" : "", - parameters.emissiveMap ? "#define USE_EMISSIVEMAP" : "", - parameters.anisotropy ? "#define USE_ANISOTROPY" : "", - parameters.anisotropyMap ? "#define USE_ANISOTROPYMAP" : "", - parameters.clearcoat ? "#define USE_CLEARCOAT" : "", - parameters.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", - parameters.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", - parameters.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", - parameters.iridescence ? "#define USE_IRIDESCENCE" : "", - parameters.iridescenceMap ? "#define USE_IRIDESCENCEMAP" : "", - parameters.iridescenceThicknessMap ? "#define USE_IRIDESCENCE_THICKNESSMAP" : "", - parameters.specularMap ? "#define USE_SPECULARMAP" : "", - parameters.specularColorMap ? "#define USE_SPECULAR_COLORMAP" : "", - parameters.specularIntensityMap ? "#define USE_SPECULAR_INTENSITYMAP" : "", - parameters.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", - parameters.metalnessMap ? "#define USE_METALNESSMAP" : "", - parameters.alphaMap ? "#define USE_ALPHAMAP" : "", - parameters.alphaTest ? "#define USE_ALPHATEST" : "", - parameters.alphaHash ? "#define USE_ALPHAHASH" : "", - parameters.sheen ? "#define USE_SHEEN" : "", - parameters.sheenColorMap ? "#define USE_SHEEN_COLORMAP" : "", - parameters.sheenRoughnessMap ? "#define USE_SHEEN_ROUGHNESSMAP" : "", - parameters.transmission ? "#define USE_TRANSMISSION" : "", - parameters.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", - parameters.thicknessMap ? "#define USE_THICKNESSMAP" : "", - parameters.vertexTangents && parameters.flatShading === false ? "#define USE_TANGENT" : "", - parameters.vertexColors || parameters.instancingColor ? "#define USE_COLOR" : "", - parameters.vertexAlphas ? "#define USE_COLOR_ALPHA" : "", - parameters.vertexUv1s ? "#define USE_UV1" : "", - parameters.vertexUv2s ? "#define USE_UV2" : "", - parameters.vertexUv3s ? "#define USE_UV3" : "", - parameters.pointsUvs ? "#define USE_POINTS_UV" : "", - parameters.gradientMap ? "#define USE_GRADIENTMAP" : "", - parameters.flatShading ? "#define FLAT_SHADED" : "", - parameters.doubleSided ? "#define DOUBLE_SIDED" : "", - parameters.flipSided ? "#define FLIP_SIDED" : "", - parameters.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", - parameters.shadowMapEnabled ? "#define " + shadowMapTypeDefine : "", - parameters.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "", - parameters.numLightProbes > 0 ? "#define USE_LIGHT_PROBES" : "", - parameters.useLegacyLights ? "#define LEGACY_LIGHTS" : "", - parameters.decodeVideoTexture ? "#define DECODE_VIDEO_TEXTURE" : "", - parameters.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", - parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ? "#define USE_LOGDEPTHBUF_EXT" : "", - "uniform mat4 viewMatrix;", - "uniform vec3 cameraPosition;", - "uniform bool isOrthographic;", - parameters.toneMapping !== NoToneMapping ? "#define TONE_MAPPING" : "", - parameters.toneMapping !== NoToneMapping ? ShaderChunk["tonemapping_pars_fragment"] : "", - // this code is required here because it is used by the toneMapping() function defined below - parameters.toneMapping !== NoToneMapping ? getToneMappingFunction("toneMapping", parameters.toneMapping) : "", - parameters.dithering ? "#define DITHERING" : "", - parameters.opaque ? "#define OPAQUE" : "", - ShaderChunk["colorspace_pars_fragment"], - // this code is required here because it is used by the various encoding/decoding function defined below - getTexelEncodingFunction("linearToOutputTexel", parameters.outputColorSpace), - parameters.useDepthPacking ? "#define DEPTH_PACKING " + parameters.depthPacking : "", - "\n" - ].filter(filterEmptyLine).join("\n"); - } - vertexShader = resolveIncludes(vertexShader); - vertexShader = replaceLightNums(vertexShader, parameters); - vertexShader = replaceClippingPlaneNums(vertexShader, parameters); - fragmentShader = resolveIncludes(fragmentShader); - fragmentShader = replaceLightNums(fragmentShader, parameters); - fragmentShader = replaceClippingPlaneNums(fragmentShader, parameters); - vertexShader = unrollLoops(vertexShader); - fragmentShader = unrollLoops(fragmentShader); - if (parameters.isWebGL2 && parameters.isRawShaderMaterial !== true) { - versionString = "#version 300 es\n"; - prefixVertex = [ - "precision mediump sampler2DArray;", - "#define attribute in", - "#define varying out", - "#define texture2D texture" - ].join("\n") + "\n" + prefixVertex; - prefixFragment = [ - "precision mediump sampler2DArray;", - "#define varying in", - parameters.glslVersion === GLSL3 ? "" : "layout(location = 0) out highp vec4 pc_fragColor;", - parameters.glslVersion === GLSL3 ? "" : "#define gl_FragColor pc_fragColor", - "#define gl_FragDepthEXT gl_FragDepth", - "#define texture2D texture", - "#define textureCube texture", - "#define texture2DProj textureProj", - "#define texture2DLodEXT textureLod", - "#define texture2DProjLodEXT textureProjLod", - "#define textureCubeLodEXT textureLod", - "#define texture2DGradEXT textureGrad", - "#define texture2DProjGradEXT textureProjGrad", - "#define textureCubeGradEXT textureGrad" - ].join("\n") + "\n" + prefixFragment; - } - const vertexGlsl = versionString + prefixVertex + vertexShader; - const fragmentGlsl = versionString + prefixFragment + fragmentShader; - const glVertexShader = WebGLShader(gl, gl.VERTEX_SHADER, vertexGlsl); - const glFragmentShader = WebGLShader(gl, gl.FRAGMENT_SHADER, fragmentGlsl); - gl.attachShader(program, glVertexShader); - gl.attachShader(program, glFragmentShader); - if (parameters.index0AttributeName !== void 0) { - gl.bindAttribLocation(program, 0, parameters.index0AttributeName); - } else if (parameters.morphTargets === true) { - gl.bindAttribLocation(program, 0, "position"); - } - gl.linkProgram(program); - function onFirstUse(self2) { - if (renderer.debug.checkShaderErrors) { - const programLog = gl.getProgramInfoLog(program).trim(); - const vertexLog = gl.getShaderInfoLog(glVertexShader).trim(); - const fragmentLog = gl.getShaderInfoLog(glFragmentShader).trim(); - let runnable = true; - let haveDiagnostics = true; - if (gl.getProgramParameter(program, gl.LINK_STATUS) === false) { - runnable = false; - if (typeof renderer.debug.onShaderError === "function") { - renderer.debug.onShaderError(gl, program, glVertexShader, glFragmentShader); - } else { - const vertexErrors = getShaderErrors(gl, glVertexShader, "vertex"); - const fragmentErrors = getShaderErrors(gl, glFragmentShader, "fragment"); - console.error( - "THREE.WebGLProgram: Shader Error " + gl.getError() + " - VALIDATE_STATUS " + gl.getProgramParameter(program, gl.VALIDATE_STATUS) + "\n\nProgram Info Log: " + programLog + "\n" + vertexErrors + "\n" + fragmentErrors - ); - } - } else if (programLog !== "") { - console.warn("THREE.WebGLProgram: Program Info Log:", programLog); - } else if (vertexLog === "" || fragmentLog === "") { - haveDiagnostics = false; - } - if (haveDiagnostics) { - self2.diagnostics = { - runnable, - programLog, - vertexShader: { - log: vertexLog, - prefix: prefixVertex - }, - fragmentShader: { - log: fragmentLog, - prefix: prefixFragment - } - }; - } - } - gl.deleteShader(glVertexShader); - gl.deleteShader(glFragmentShader); - cachedUniforms = new WebGLUniforms(gl, program); - cachedAttributes = fetchAttributeLocations(gl, program); - } - let cachedUniforms; - this.getUniforms = function() { - if (cachedUniforms === void 0) { - onFirstUse(this); - } - return cachedUniforms; - }; - let cachedAttributes; - this.getAttributes = function() { - if (cachedAttributes === void 0) { - onFirstUse(this); - } - return cachedAttributes; - }; - let programReady = parameters.rendererExtensionParallelShaderCompile === false; - this.isReady = function() { - if (programReady === false) { - programReady = gl.getProgramParameter(program, COMPLETION_STATUS_KHR); - } - return programReady; - }; - this.destroy = function() { - bindingStates.releaseStatesOfProgram(this); - gl.deleteProgram(program); - this.program = void 0; - }; - this.type = parameters.shaderType; - this.name = parameters.shaderName; - this.id = programIdCount++; - this.cacheKey = cacheKey; - this.usedTimes = 1; - this.program = program; - this.vertexShader = glVertexShader; - this.fragmentShader = glFragmentShader; - return this; -} -var _id$1 = 0; -var WebGLShaderCache = class { - constructor() { - this.shaderCache = /* @__PURE__ */ new Map(); - this.materialCache = /* @__PURE__ */ new Map(); - } - update(material) { - const vertexShader = material.vertexShader; - const fragmentShader = material.fragmentShader; - const vertexShaderStage = this._getShaderStage(vertexShader); - const fragmentShaderStage = this._getShaderStage(fragmentShader); - const materialShaders = this._getShaderCacheForMaterial(material); - if (materialShaders.has(vertexShaderStage) === false) { - materialShaders.add(vertexShaderStage); - vertexShaderStage.usedTimes++; - } - if (materialShaders.has(fragmentShaderStage) === false) { - materialShaders.add(fragmentShaderStage); - fragmentShaderStage.usedTimes++; - } - return this; - } - remove(material) { - const materialShaders = this.materialCache.get(material); - for (const shaderStage of materialShaders) { - shaderStage.usedTimes--; - if (shaderStage.usedTimes === 0) - this.shaderCache.delete(shaderStage.code); - } - this.materialCache.delete(material); - return this; - } - getVertexShaderID(material) { - return this._getShaderStage(material.vertexShader).id; - } - getFragmentShaderID(material) { - return this._getShaderStage(material.fragmentShader).id; - } - dispose() { - this.shaderCache.clear(); - this.materialCache.clear(); - } - _getShaderCacheForMaterial(material) { - const cache = this.materialCache; - let set = cache.get(material); - if (set === void 0) { - set = /* @__PURE__ */ new Set(); - cache.set(material, set); - } - return set; - } - _getShaderStage(code) { - const cache = this.shaderCache; - let stage = cache.get(code); - if (stage === void 0) { - stage = new WebGLShaderStage(code); - cache.set(code, stage); - } - return stage; - } -}; -var WebGLShaderStage = class { - constructor(code) { - this.id = _id$1++; - this.code = code; - this.usedTimes = 0; - } -}; -function WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping) { - const _programLayers = new Layers(); - const _customShaders = new WebGLShaderCache(); - const programs = []; - const IS_WEBGL2 = capabilities.isWebGL2; - const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer; - const SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures; - let precision = capabilities.precision; - const shaderIDs = { - MeshDepthMaterial: "depth", - MeshDistanceMaterial: "distanceRGBA", - MeshNormalMaterial: "normal", - MeshBasicMaterial: "basic", - MeshLambertMaterial: "lambert", - MeshPhongMaterial: "phong", - MeshToonMaterial: "toon", - MeshStandardMaterial: "physical", - MeshPhysicalMaterial: "physical", - MeshMatcapMaterial: "matcap", - LineBasicMaterial: "basic", - LineDashedMaterial: "dashed", - PointsMaterial: "points", - ShadowMaterial: "shadow", - SpriteMaterial: "sprite" - }; - function getChannel(value) { - if (value === 0) - return "uv"; - return `uv${value}`; - } - function getParameters(material, lights, shadows, scene, object) { - const fog = scene.fog; - const geometry = object.geometry; - const environment = material.isMeshStandardMaterial ? scene.environment : null; - const envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || environment); - const envMapCubeUVHeight = !!envMap && envMap.mapping === CubeUVReflectionMapping ? envMap.image.height : null; - const shaderID = shaderIDs[material.type]; - if (material.precision !== null) { - precision = capabilities.getMaxPrecision(material.precision); - if (precision !== material.precision) { - console.warn("THREE.WebGLProgram.getParameters:", material.precision, "not supported, using", precision, "instead."); - } - } - const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color; - const morphTargetsCount = morphAttribute !== void 0 ? morphAttribute.length : 0; - let morphTextureStride = 0; - if (geometry.morphAttributes.position !== void 0) - morphTextureStride = 1; - if (geometry.morphAttributes.normal !== void 0) - morphTextureStride = 2; - if (geometry.morphAttributes.color !== void 0) - morphTextureStride = 3; - let vertexShader, fragmentShader; - let customVertexShaderID, customFragmentShaderID; - if (shaderID) { - const shader = ShaderLib[shaderID]; - vertexShader = shader.vertexShader; - fragmentShader = shader.fragmentShader; - } else { - vertexShader = material.vertexShader; - fragmentShader = material.fragmentShader; - _customShaders.update(material); - customVertexShaderID = _customShaders.getVertexShaderID(material); - customFragmentShaderID = _customShaders.getFragmentShaderID(material); - } - const currentRenderTarget = renderer.getRenderTarget(); - const IS_INSTANCEDMESH = object.isInstancedMesh === true; - const HAS_MAP = !!material.map; - const HAS_MATCAP = !!material.matcap; - const HAS_ENVMAP = !!envMap; - const HAS_AOMAP = !!material.aoMap; - const HAS_LIGHTMAP = !!material.lightMap; - const HAS_BUMPMAP = !!material.bumpMap; - const HAS_NORMALMAP = !!material.normalMap; - const HAS_DISPLACEMENTMAP = !!material.displacementMap; - const HAS_EMISSIVEMAP = !!material.emissiveMap; - const HAS_METALNESSMAP = !!material.metalnessMap; - const HAS_ROUGHNESSMAP = !!material.roughnessMap; - const HAS_ANISOTROPY = material.anisotropy > 0; - const HAS_CLEARCOAT = material.clearcoat > 0; - const HAS_IRIDESCENCE = material.iridescence > 0; - const HAS_SHEEN = material.sheen > 0; - const HAS_TRANSMISSION = material.transmission > 0; - const HAS_ANISOTROPYMAP = HAS_ANISOTROPY && !!material.anisotropyMap; - const HAS_CLEARCOATMAP = HAS_CLEARCOAT && !!material.clearcoatMap; - const HAS_CLEARCOAT_NORMALMAP = HAS_CLEARCOAT && !!material.clearcoatNormalMap; - const HAS_CLEARCOAT_ROUGHNESSMAP = HAS_CLEARCOAT && !!material.clearcoatRoughnessMap; - const HAS_IRIDESCENCEMAP = HAS_IRIDESCENCE && !!material.iridescenceMap; - const HAS_IRIDESCENCE_THICKNESSMAP = HAS_IRIDESCENCE && !!material.iridescenceThicknessMap; - const HAS_SHEEN_COLORMAP = HAS_SHEEN && !!material.sheenColorMap; - const HAS_SHEEN_ROUGHNESSMAP = HAS_SHEEN && !!material.sheenRoughnessMap; - const HAS_SPECULARMAP = !!material.specularMap; - const HAS_SPECULAR_COLORMAP = !!material.specularColorMap; - const HAS_SPECULAR_INTENSITYMAP = !!material.specularIntensityMap; - const HAS_TRANSMISSIONMAP = HAS_TRANSMISSION && !!material.transmissionMap; - const HAS_THICKNESSMAP = HAS_TRANSMISSION && !!material.thicknessMap; - const HAS_GRADIENTMAP = !!material.gradientMap; - const HAS_ALPHAMAP = !!material.alphaMap; - const HAS_ALPHATEST = material.alphaTest > 0; - const HAS_ALPHAHASH = !!material.alphaHash; - const HAS_EXTENSIONS = !!material.extensions; - const HAS_ATTRIBUTE_UV1 = !!geometry.attributes.uv1; - const HAS_ATTRIBUTE_UV2 = !!geometry.attributes.uv2; - const HAS_ATTRIBUTE_UV3 = !!geometry.attributes.uv3; - let toneMapping = NoToneMapping; - if (material.toneMapped) { - if (currentRenderTarget === null || currentRenderTarget.isXRRenderTarget === true) { - toneMapping = renderer.toneMapping; - } - } - const parameters = { - isWebGL2: IS_WEBGL2, - shaderID, - shaderType: material.type, - shaderName: material.name, - vertexShader, - fragmentShader, - defines: material.defines, - customVertexShaderID, - customFragmentShaderID, - isRawShaderMaterial: material.isRawShaderMaterial === true, - glslVersion: material.glslVersion, - precision, - instancing: IS_INSTANCEDMESH, - instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null, - supportsVertexTextures: SUPPORTS_VERTEX_TEXTURES, - outputColorSpace: currentRenderTarget === null ? renderer.outputColorSpace : currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace, - map: HAS_MAP, - matcap: HAS_MATCAP, - envMap: HAS_ENVMAP, - envMapMode: HAS_ENVMAP && envMap.mapping, - envMapCubeUVHeight, - aoMap: HAS_AOMAP, - lightMap: HAS_LIGHTMAP, - bumpMap: HAS_BUMPMAP, - normalMap: HAS_NORMALMAP, - displacementMap: SUPPORTS_VERTEX_TEXTURES && HAS_DISPLACEMENTMAP, - emissiveMap: HAS_EMISSIVEMAP, - normalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === ObjectSpaceNormalMap, - normalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap, - metalnessMap: HAS_METALNESSMAP, - roughnessMap: HAS_ROUGHNESSMAP, - anisotropy: HAS_ANISOTROPY, - anisotropyMap: HAS_ANISOTROPYMAP, - clearcoat: HAS_CLEARCOAT, - clearcoatMap: HAS_CLEARCOATMAP, - clearcoatNormalMap: HAS_CLEARCOAT_NORMALMAP, - clearcoatRoughnessMap: HAS_CLEARCOAT_ROUGHNESSMAP, - iridescence: HAS_IRIDESCENCE, - iridescenceMap: HAS_IRIDESCENCEMAP, - iridescenceThicknessMap: HAS_IRIDESCENCE_THICKNESSMAP, - sheen: HAS_SHEEN, - sheenColorMap: HAS_SHEEN_COLORMAP, - sheenRoughnessMap: HAS_SHEEN_ROUGHNESSMAP, - specularMap: HAS_SPECULARMAP, - specularColorMap: HAS_SPECULAR_COLORMAP, - specularIntensityMap: HAS_SPECULAR_INTENSITYMAP, - transmission: HAS_TRANSMISSION, - transmissionMap: HAS_TRANSMISSIONMAP, - thicknessMap: HAS_THICKNESSMAP, - gradientMap: HAS_GRADIENTMAP, - opaque: material.transparent === false && material.blending === NormalBlending, - alphaMap: HAS_ALPHAMAP, - alphaTest: HAS_ALPHATEST, - alphaHash: HAS_ALPHAHASH, - combine: material.combine, - // - mapUv: HAS_MAP && getChannel(material.map.channel), - aoMapUv: HAS_AOMAP && getChannel(material.aoMap.channel), - lightMapUv: HAS_LIGHTMAP && getChannel(material.lightMap.channel), - bumpMapUv: HAS_BUMPMAP && getChannel(material.bumpMap.channel), - normalMapUv: HAS_NORMALMAP && getChannel(material.normalMap.channel), - displacementMapUv: HAS_DISPLACEMENTMAP && getChannel(material.displacementMap.channel), - emissiveMapUv: HAS_EMISSIVEMAP && getChannel(material.emissiveMap.channel), - metalnessMapUv: HAS_METALNESSMAP && getChannel(material.metalnessMap.channel), - roughnessMapUv: HAS_ROUGHNESSMAP && getChannel(material.roughnessMap.channel), - anisotropyMapUv: HAS_ANISOTROPYMAP && getChannel(material.anisotropyMap.channel), - clearcoatMapUv: HAS_CLEARCOATMAP && getChannel(material.clearcoatMap.channel), - clearcoatNormalMapUv: HAS_CLEARCOAT_NORMALMAP && getChannel(material.clearcoatNormalMap.channel), - clearcoatRoughnessMapUv: HAS_CLEARCOAT_ROUGHNESSMAP && getChannel(material.clearcoatRoughnessMap.channel), - iridescenceMapUv: HAS_IRIDESCENCEMAP && getChannel(material.iridescenceMap.channel), - iridescenceThicknessMapUv: HAS_IRIDESCENCE_THICKNESSMAP && getChannel(material.iridescenceThicknessMap.channel), - sheenColorMapUv: HAS_SHEEN_COLORMAP && getChannel(material.sheenColorMap.channel), - sheenRoughnessMapUv: HAS_SHEEN_ROUGHNESSMAP && getChannel(material.sheenRoughnessMap.channel), - specularMapUv: HAS_SPECULARMAP && getChannel(material.specularMap.channel), - specularColorMapUv: HAS_SPECULAR_COLORMAP && getChannel(material.specularColorMap.channel), - specularIntensityMapUv: HAS_SPECULAR_INTENSITYMAP && getChannel(material.specularIntensityMap.channel), - transmissionMapUv: HAS_TRANSMISSIONMAP && getChannel(material.transmissionMap.channel), - thicknessMapUv: HAS_THICKNESSMAP && getChannel(material.thicknessMap.channel), - alphaMapUv: HAS_ALPHAMAP && getChannel(material.alphaMap.channel), - // - vertexTangents: !!geometry.attributes.tangent && (HAS_NORMALMAP || HAS_ANISOTROPY), - vertexColors: material.vertexColors, - vertexAlphas: material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4, - vertexUv1s: HAS_ATTRIBUTE_UV1, - vertexUv2s: HAS_ATTRIBUTE_UV2, - vertexUv3s: HAS_ATTRIBUTE_UV3, - pointsUvs: object.isPoints === true && !!geometry.attributes.uv && (HAS_MAP || HAS_ALPHAMAP), - fog: !!fog, - useFog: material.fog === true, - fogExp2: fog && fog.isFogExp2, - flatShading: material.flatShading === true, - sizeAttenuation: material.sizeAttenuation === true, - logarithmicDepthBuffer, - skinning: object.isSkinnedMesh === true, - morphTargets: geometry.morphAttributes.position !== void 0, - morphNormals: geometry.morphAttributes.normal !== void 0, - morphColors: geometry.morphAttributes.color !== void 0, - morphTargetsCount, - morphTextureStride, - numDirLights: lights.directional.length, - numPointLights: lights.point.length, - numSpotLights: lights.spot.length, - numSpotLightMaps: lights.spotLightMap.length, - numRectAreaLights: lights.rectArea.length, - numHemiLights: lights.hemi.length, - numDirLightShadows: lights.directionalShadowMap.length, - numPointLightShadows: lights.pointShadowMap.length, - numSpotLightShadows: lights.spotShadowMap.length, - numSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps, - numLightProbes: lights.numLightProbes, - numClippingPlanes: clipping.numPlanes, - numClipIntersection: clipping.numIntersection, - dithering: material.dithering, - shadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0, - shadowMapType: renderer.shadowMap.type, - toneMapping, - useLegacyLights: renderer._useLegacyLights, - decodeVideoTexture: HAS_MAP && material.map.isVideoTexture === true && ColorManagement.getTransfer(material.map.colorSpace) === SRGBTransfer, - premultipliedAlpha: material.premultipliedAlpha, - doubleSided: material.side === DoubleSide, - flipSided: material.side === BackSide, - useDepthPacking: material.depthPacking >= 0, - depthPacking: material.depthPacking || 0, - index0AttributeName: material.index0AttributeName, - extensionDerivatives: HAS_EXTENSIONS && material.extensions.derivatives === true, - extensionFragDepth: HAS_EXTENSIONS && material.extensions.fragDepth === true, - extensionDrawBuffers: HAS_EXTENSIONS && material.extensions.drawBuffers === true, - extensionShaderTextureLOD: HAS_EXTENSIONS && material.extensions.shaderTextureLOD === true, - rendererExtensionFragDepth: IS_WEBGL2 || extensions.has("EXT_frag_depth"), - rendererExtensionDrawBuffers: IS_WEBGL2 || extensions.has("WEBGL_draw_buffers"), - rendererExtensionShaderTextureLod: IS_WEBGL2 || extensions.has("EXT_shader_texture_lod"), - rendererExtensionParallelShaderCompile: extensions.has("KHR_parallel_shader_compile"), - customProgramCacheKey: material.customProgramCacheKey() - }; - return parameters; - } - function getProgramCacheKey(parameters) { - const array = []; - if (parameters.shaderID) { - array.push(parameters.shaderID); - } else { - array.push(parameters.customVertexShaderID); - array.push(parameters.customFragmentShaderID); - } - if (parameters.defines !== void 0) { - for (const name in parameters.defines) { - array.push(name); - array.push(parameters.defines[name]); - } - } - if (parameters.isRawShaderMaterial === false) { - getProgramCacheKeyParameters(array, parameters); - getProgramCacheKeyBooleans(array, parameters); - array.push(renderer.outputColorSpace); - } - array.push(parameters.customProgramCacheKey); - return array.join(); - } - function getProgramCacheKeyParameters(array, parameters) { - array.push(parameters.precision); - array.push(parameters.outputColorSpace); - array.push(parameters.envMapMode); - array.push(parameters.envMapCubeUVHeight); - array.push(parameters.mapUv); - array.push(parameters.alphaMapUv); - array.push(parameters.lightMapUv); - array.push(parameters.aoMapUv); - array.push(parameters.bumpMapUv); - array.push(parameters.normalMapUv); - array.push(parameters.displacementMapUv); - array.push(parameters.emissiveMapUv); - array.push(parameters.metalnessMapUv); - array.push(parameters.roughnessMapUv); - array.push(parameters.anisotropyMapUv); - array.push(parameters.clearcoatMapUv); - array.push(parameters.clearcoatNormalMapUv); - array.push(parameters.clearcoatRoughnessMapUv); - array.push(parameters.iridescenceMapUv); - array.push(parameters.iridescenceThicknessMapUv); - array.push(parameters.sheenColorMapUv); - array.push(parameters.sheenRoughnessMapUv); - array.push(parameters.specularMapUv); - array.push(parameters.specularColorMapUv); - array.push(parameters.specularIntensityMapUv); - array.push(parameters.transmissionMapUv); - array.push(parameters.thicknessMapUv); - array.push(parameters.combine); - array.push(parameters.fogExp2); - array.push(parameters.sizeAttenuation); - array.push(parameters.morphTargetsCount); - array.push(parameters.morphAttributeCount); - array.push(parameters.numDirLights); - array.push(parameters.numPointLights); - array.push(parameters.numSpotLights); - array.push(parameters.numSpotLightMaps); - array.push(parameters.numHemiLights); - array.push(parameters.numRectAreaLights); - array.push(parameters.numDirLightShadows); - array.push(parameters.numPointLightShadows); - array.push(parameters.numSpotLightShadows); - array.push(parameters.numSpotLightShadowsWithMaps); - array.push(parameters.numLightProbes); - array.push(parameters.shadowMapType); - array.push(parameters.toneMapping); - array.push(parameters.numClippingPlanes); - array.push(parameters.numClipIntersection); - array.push(parameters.depthPacking); - } - function getProgramCacheKeyBooleans(array, parameters) { - _programLayers.disableAll(); - if (parameters.isWebGL2) - _programLayers.enable(0); - if (parameters.supportsVertexTextures) - _programLayers.enable(1); - if (parameters.instancing) - _programLayers.enable(2); - if (parameters.instancingColor) - _programLayers.enable(3); - if (parameters.matcap) - _programLayers.enable(4); - if (parameters.envMap) - _programLayers.enable(5); - if (parameters.normalMapObjectSpace) - _programLayers.enable(6); - if (parameters.normalMapTangentSpace) - _programLayers.enable(7); - if (parameters.clearcoat) - _programLayers.enable(8); - if (parameters.iridescence) - _programLayers.enable(9); - if (parameters.alphaTest) - _programLayers.enable(10); - if (parameters.vertexColors) - _programLayers.enable(11); - if (parameters.vertexAlphas) - _programLayers.enable(12); - if (parameters.vertexUv1s) - _programLayers.enable(13); - if (parameters.vertexUv2s) - _programLayers.enable(14); - if (parameters.vertexUv3s) - _programLayers.enable(15); - if (parameters.vertexTangents) - _programLayers.enable(16); - if (parameters.anisotropy) - _programLayers.enable(17); - if (parameters.alphaHash) - _programLayers.enable(18); - array.push(_programLayers.mask); - _programLayers.disableAll(); - if (parameters.fog) - _programLayers.enable(0); - if (parameters.useFog) - _programLayers.enable(1); - if (parameters.flatShading) - _programLayers.enable(2); - if (parameters.logarithmicDepthBuffer) - _programLayers.enable(3); - if (parameters.skinning) - _programLayers.enable(4); - if (parameters.morphTargets) - _programLayers.enable(5); - if (parameters.morphNormals) - _programLayers.enable(6); - if (parameters.morphColors) - _programLayers.enable(7); - if (parameters.premultipliedAlpha) - _programLayers.enable(8); - if (parameters.shadowMapEnabled) - _programLayers.enable(9); - if (parameters.useLegacyLights) - _programLayers.enable(10); - if (parameters.doubleSided) - _programLayers.enable(11); - if (parameters.flipSided) - _programLayers.enable(12); - if (parameters.useDepthPacking) - _programLayers.enable(13); - if (parameters.dithering) - _programLayers.enable(14); - if (parameters.transmission) - _programLayers.enable(15); - if (parameters.sheen) - _programLayers.enable(16); - if (parameters.opaque) - _programLayers.enable(17); - if (parameters.pointsUvs) - _programLayers.enable(18); - if (parameters.decodeVideoTexture) - _programLayers.enable(19); - array.push(_programLayers.mask); - } - function getUniforms(material) { - const shaderID = shaderIDs[material.type]; - let uniforms; - if (shaderID) { - const shader = ShaderLib[shaderID]; - uniforms = UniformsUtils.clone(shader.uniforms); - } else { - uniforms = material.uniforms; - } - return uniforms; - } - function acquireProgram(parameters, cacheKey) { - let program; - for (let p = 0, pl = programs.length; p < pl; p++) { - const preexistingProgram = programs[p]; - if (preexistingProgram.cacheKey === cacheKey) { - program = preexistingProgram; - ++program.usedTimes; - break; - } - } - if (program === void 0) { - program = new WebGLProgram(renderer, cacheKey, parameters, bindingStates); - programs.push(program); - } - return program; - } - function releaseProgram(program) { - if (--program.usedTimes === 0) { - const i = programs.indexOf(program); - programs[i] = programs[programs.length - 1]; - programs.pop(); - program.destroy(); - } - } - function releaseShaderCache(material) { - _customShaders.remove(material); - } - function dispose() { - _customShaders.dispose(); - } - return { - getParameters, - getProgramCacheKey, - getUniforms, - acquireProgram, - releaseProgram, - releaseShaderCache, - // Exposed for resource monitoring & error feedback via renderer.info: - programs, - dispose - }; -} -function WebGLProperties() { - let properties = /* @__PURE__ */ new WeakMap(); - function get(object) { - let map = properties.get(object); - if (map === void 0) { - map = {}; - properties.set(object, map); - } - return map; - } - function remove(object) { - properties.delete(object); - } - function update(object, key, value) { - properties.get(object)[key] = value; - } - function dispose() { - properties = /* @__PURE__ */ new WeakMap(); - } - return { - get, - remove, - update, - dispose - }; -} -function painterSortStable(a, b) { - if (a.groupOrder !== b.groupOrder) { - return a.groupOrder - b.groupOrder; - } else if (a.renderOrder !== b.renderOrder) { - return a.renderOrder - b.renderOrder; - } else if (a.material.id !== b.material.id) { - return a.material.id - b.material.id; - } else if (a.z !== b.z) { - return a.z - b.z; - } else { - return a.id - b.id; - } -} -function reversePainterSortStable(a, b) { - if (a.groupOrder !== b.groupOrder) { - return a.groupOrder - b.groupOrder; - } else if (a.renderOrder !== b.renderOrder) { - return a.renderOrder - b.renderOrder; - } else if (a.z !== b.z) { - return b.z - a.z; - } else { - return a.id - b.id; - } -} -function WebGLRenderList() { - const renderItems = []; - let renderItemsIndex = 0; - const opaque = []; - const transmissive = []; - const transparent = []; - function init() { - renderItemsIndex = 0; - opaque.length = 0; - transmissive.length = 0; - transparent.length = 0; - } - function getNextRenderItem(object, geometry, material, groupOrder, z, group) { - let renderItem = renderItems[renderItemsIndex]; - if (renderItem === void 0) { - renderItem = { - id: object.id, - object, - geometry, - material, - groupOrder, - renderOrder: object.renderOrder, - z, - group - }; - renderItems[renderItemsIndex] = renderItem; - } else { - renderItem.id = object.id; - renderItem.object = object; - renderItem.geometry = geometry; - renderItem.material = material; - renderItem.groupOrder = groupOrder; - renderItem.renderOrder = object.renderOrder; - renderItem.z = z; - renderItem.group = group; - } - renderItemsIndex++; - return renderItem; - } - function push(object, geometry, material, groupOrder, z, group) { - const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group); - if (material.transmission > 0) { - transmissive.push(renderItem); - } else if (material.transparent === true) { - transparent.push(renderItem); - } else { - opaque.push(renderItem); - } - } - function unshift(object, geometry, material, groupOrder, z, group) { - const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group); - if (material.transmission > 0) { - transmissive.unshift(renderItem); - } else if (material.transparent === true) { - transparent.unshift(renderItem); - } else { - opaque.unshift(renderItem); - } - } - function sort(customOpaqueSort, customTransparentSort) { - if (opaque.length > 1) - opaque.sort(customOpaqueSort || painterSortStable); - if (transmissive.length > 1) - transmissive.sort(customTransparentSort || reversePainterSortStable); - if (transparent.length > 1) - transparent.sort(customTransparentSort || reversePainterSortStable); - } - function finish() { - for (let i = renderItemsIndex, il = renderItems.length; i < il; i++) { - const renderItem = renderItems[i]; - if (renderItem.id === null) - break; - renderItem.id = null; - renderItem.object = null; - renderItem.geometry = null; - renderItem.material = null; - renderItem.group = null; - } - } - return { - opaque, - transmissive, - transparent, - init, - push, - unshift, - finish, - sort - }; -} -function WebGLRenderLists() { - let lists = /* @__PURE__ */ new WeakMap(); - function get(scene, renderCallDepth) { - const listArray = lists.get(scene); - let list; - if (listArray === void 0) { - list = new WebGLRenderList(); - lists.set(scene, [list]); - } else { - if (renderCallDepth >= listArray.length) { - list = new WebGLRenderList(); - listArray.push(list); - } else { - list = listArray[renderCallDepth]; - } - } - return list; - } - function dispose() { - lists = /* @__PURE__ */ new WeakMap(); - } - return { - get, - dispose - }; -} -function UniformsCache() { - const lights = {}; - return { - get: function(light) { - if (lights[light.id] !== void 0) { - return lights[light.id]; - } - let uniforms; - switch (light.type) { - case "DirectionalLight": - uniforms = { - direction: new Vector3(), - color: new Color() - }; - break; - case "SpotLight": - uniforms = { - position: new Vector3(), - direction: new Vector3(), - color: new Color(), - distance: 0, - coneCos: 0, - penumbraCos: 0, - decay: 0 - }; - break; - case "PointLight": - uniforms = { - position: new Vector3(), - color: new Color(), - distance: 0, - decay: 0 - }; - break; - case "HemisphereLight": - uniforms = { - direction: new Vector3(), - skyColor: new Color(), - groundColor: new Color() - }; - break; - case "RectAreaLight": - uniforms = { - color: new Color(), - position: new Vector3(), - halfWidth: new Vector3(), - halfHeight: new Vector3() - }; - break; - } - lights[light.id] = uniforms; - return uniforms; - } - }; -} -function ShadowUniformsCache() { - const lights = {}; - return { - get: function(light) { - if (lights[light.id] !== void 0) { - return lights[light.id]; - } - let uniforms; - switch (light.type) { - case "DirectionalLight": - uniforms = { - shadowBias: 0, - shadowNormalBias: 0, - shadowRadius: 1, - shadowMapSize: new Vector2() - }; - break; - case "SpotLight": - uniforms = { - shadowBias: 0, - shadowNormalBias: 0, - shadowRadius: 1, - shadowMapSize: new Vector2() - }; - break; - case "PointLight": - uniforms = { - shadowBias: 0, - shadowNormalBias: 0, - shadowRadius: 1, - shadowMapSize: new Vector2(), - shadowCameraNear: 1, - shadowCameraFar: 1e3 - }; - break; - } - lights[light.id] = uniforms; - return uniforms; - } - }; -} -var nextVersion = 0; -function shadowCastingAndTexturingLightsFirst(lightA, lightB) { - return (lightB.castShadow ? 2 : 0) - (lightA.castShadow ? 2 : 0) + (lightB.map ? 1 : 0) - (lightA.map ? 1 : 0); -} -function WebGLLights(extensions, capabilities) { - const cache = new UniformsCache(); - const shadowCache = ShadowUniformsCache(); - const state = { - version: 0, - hash: { - directionalLength: -1, - pointLength: -1, - spotLength: -1, - rectAreaLength: -1, - hemiLength: -1, - numDirectionalShadows: -1, - numPointShadows: -1, - numSpotShadows: -1, - numSpotMaps: -1, - numLightProbes: -1 - }, - ambient: [0, 0, 0], - probe: [], - directional: [], - directionalShadow: [], - directionalShadowMap: [], - directionalShadowMatrix: [], - spot: [], - spotLightMap: [], - spotShadow: [], - spotShadowMap: [], - spotLightMatrix: [], - rectArea: [], - rectAreaLTC1: null, - rectAreaLTC2: null, - point: [], - pointShadow: [], - pointShadowMap: [], - pointShadowMatrix: [], - hemi: [], - numSpotLightShadowsWithMaps: 0, - numLightProbes: 0 - }; - for (let i = 0; i < 9; i++) - state.probe.push(new Vector3()); - const vector3 = new Vector3(); - const matrix4 = new Matrix4(); - const matrix42 = new Matrix4(); - function setup(lights, useLegacyLights) { - let r = 0, g = 0, b = 0; - for (let i = 0; i < 9; i++) - state.probe[i].set(0, 0, 0); - let directionalLength = 0; - let pointLength = 0; - let spotLength = 0; - let rectAreaLength = 0; - let hemiLength = 0; - let numDirectionalShadows = 0; - let numPointShadows = 0; - let numSpotShadows = 0; - let numSpotMaps = 0; - let numSpotShadowsWithMaps = 0; - let numLightProbes = 0; - lights.sort(shadowCastingAndTexturingLightsFirst); - const scaleFactor = useLegacyLights === true ? Math.PI : 1; - for (let i = 0, l = lights.length; i < l; i++) { - const light = lights[i]; - const color = light.color; - const intensity = light.intensity; - const distance = light.distance; - const shadowMap = light.shadow && light.shadow.map ? light.shadow.map.texture : null; - if (light.isAmbientLight) { - r += color.r * intensity * scaleFactor; - g += color.g * intensity * scaleFactor; - b += color.b * intensity * scaleFactor; - } else if (light.isLightProbe) { - for (let j = 0; j < 9; j++) { - state.probe[j].addScaledVector(light.sh.coefficients[j], intensity); - } - numLightProbes++; - } else if (light.isDirectionalLight) { - const uniforms = cache.get(light); - uniforms.color.copy(light.color).multiplyScalar(light.intensity * scaleFactor); - if (light.castShadow) { - const shadow = light.shadow; - const shadowUniforms = shadowCache.get(light); - shadowUniforms.shadowBias = shadow.bias; - shadowUniforms.shadowNormalBias = shadow.normalBias; - shadowUniforms.shadowRadius = shadow.radius; - shadowUniforms.shadowMapSize = shadow.mapSize; - state.directionalShadow[directionalLength] = shadowUniforms; - state.directionalShadowMap[directionalLength] = shadowMap; - state.directionalShadowMatrix[directionalLength] = light.shadow.matrix; - numDirectionalShadows++; - } - state.directional[directionalLength] = uniforms; - directionalLength++; - } else if (light.isSpotLight) { - const uniforms = cache.get(light); - uniforms.position.setFromMatrixPosition(light.matrixWorld); - uniforms.color.copy(color).multiplyScalar(intensity * scaleFactor); - uniforms.distance = distance; - uniforms.coneCos = Math.cos(light.angle); - uniforms.penumbraCos = Math.cos(light.angle * (1 - light.penumbra)); - uniforms.decay = light.decay; - state.spot[spotLength] = uniforms; - const shadow = light.shadow; - if (light.map) { - state.spotLightMap[numSpotMaps] = light.map; - numSpotMaps++; - shadow.updateMatrices(light); - if (light.castShadow) - numSpotShadowsWithMaps++; - } - state.spotLightMatrix[spotLength] = shadow.matrix; - if (light.castShadow) { - const shadowUniforms = shadowCache.get(light); - shadowUniforms.shadowBias = shadow.bias; - shadowUniforms.shadowNormalBias = shadow.normalBias; - shadowUniforms.shadowRadius = shadow.radius; - shadowUniforms.shadowMapSize = shadow.mapSize; - state.spotShadow[spotLength] = shadowUniforms; - state.spotShadowMap[spotLength] = shadowMap; - numSpotShadows++; - } - spotLength++; - } else if (light.isRectAreaLight) { - const uniforms = cache.get(light); - uniforms.color.copy(color).multiplyScalar(intensity); - uniforms.halfWidth.set(light.width * 0.5, 0, 0); - uniforms.halfHeight.set(0, light.height * 0.5, 0); - state.rectArea[rectAreaLength] = uniforms; - rectAreaLength++; - } else if (light.isPointLight) { - const uniforms = cache.get(light); - uniforms.color.copy(light.color).multiplyScalar(light.intensity * scaleFactor); - uniforms.distance = light.distance; - uniforms.decay = light.decay; - if (light.castShadow) { - const shadow = light.shadow; - const shadowUniforms = shadowCache.get(light); - shadowUniforms.shadowBias = shadow.bias; - shadowUniforms.shadowNormalBias = shadow.normalBias; - shadowUniforms.shadowRadius = shadow.radius; - shadowUniforms.shadowMapSize = shadow.mapSize; - shadowUniforms.shadowCameraNear = shadow.camera.near; - shadowUniforms.shadowCameraFar = shadow.camera.far; - state.pointShadow[pointLength] = shadowUniforms; - state.pointShadowMap[pointLength] = shadowMap; - state.pointShadowMatrix[pointLength] = light.shadow.matrix; - numPointShadows++; - } - state.point[pointLength] = uniforms; - pointLength++; - } else if (light.isHemisphereLight) { - const uniforms = cache.get(light); - uniforms.skyColor.copy(light.color).multiplyScalar(intensity * scaleFactor); - uniforms.groundColor.copy(light.groundColor).multiplyScalar(intensity * scaleFactor); - state.hemi[hemiLength] = uniforms; - hemiLength++; - } - } - if (rectAreaLength > 0) { - if (capabilities.isWebGL2) { - state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1; - state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2; - } else { - if (extensions.has("OES_texture_float_linear") === true) { - state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1; - state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2; - } else if (extensions.has("OES_texture_half_float_linear") === true) { - state.rectAreaLTC1 = UniformsLib.LTC_HALF_1; - state.rectAreaLTC2 = UniformsLib.LTC_HALF_2; - } else { - console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions."); - } - } - } - state.ambient[0] = r; - state.ambient[1] = g; - state.ambient[2] = b; - const hash = state.hash; - if (hash.directionalLength !== directionalLength || hash.pointLength !== pointLength || hash.spotLength !== spotLength || hash.rectAreaLength !== rectAreaLength || hash.hemiLength !== hemiLength || hash.numDirectionalShadows !== numDirectionalShadows || hash.numPointShadows !== numPointShadows || hash.numSpotShadows !== numSpotShadows || hash.numSpotMaps !== numSpotMaps || hash.numLightProbes !== numLightProbes) { - state.directional.length = directionalLength; - state.spot.length = spotLength; - state.rectArea.length = rectAreaLength; - state.point.length = pointLength; - state.hemi.length = hemiLength; - state.directionalShadow.length = numDirectionalShadows; - state.directionalShadowMap.length = numDirectionalShadows; - state.pointShadow.length = numPointShadows; - state.pointShadowMap.length = numPointShadows; - state.spotShadow.length = numSpotShadows; - state.spotShadowMap.length = numSpotShadows; - state.directionalShadowMatrix.length = numDirectionalShadows; - state.pointShadowMatrix.length = numPointShadows; - state.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps; - state.spotLightMap.length = numSpotMaps; - state.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps; - state.numLightProbes = numLightProbes; - hash.directionalLength = directionalLength; - hash.pointLength = pointLength; - hash.spotLength = spotLength; - hash.rectAreaLength = rectAreaLength; - hash.hemiLength = hemiLength; - hash.numDirectionalShadows = numDirectionalShadows; - hash.numPointShadows = numPointShadows; - hash.numSpotShadows = numSpotShadows; - hash.numSpotMaps = numSpotMaps; - hash.numLightProbes = numLightProbes; - state.version = nextVersion++; - } - } - function setupView(lights, camera) { - let directionalLength = 0; - let pointLength = 0; - let spotLength = 0; - let rectAreaLength = 0; - let hemiLength = 0; - const viewMatrix = camera.matrixWorldInverse; - for (let i = 0, l = lights.length; i < l; i++) { - const light = lights[i]; - if (light.isDirectionalLight) { - const uniforms = state.directional[directionalLength]; - uniforms.direction.setFromMatrixPosition(light.matrixWorld); - vector3.setFromMatrixPosition(light.target.matrixWorld); - uniforms.direction.sub(vector3); - uniforms.direction.transformDirection(viewMatrix); - directionalLength++; - } else if (light.isSpotLight) { - const uniforms = state.spot[spotLength]; - uniforms.position.setFromMatrixPosition(light.matrixWorld); - uniforms.position.applyMatrix4(viewMatrix); - uniforms.direction.setFromMatrixPosition(light.matrixWorld); - vector3.setFromMatrixPosition(light.target.matrixWorld); - uniforms.direction.sub(vector3); - uniforms.direction.transformDirection(viewMatrix); - spotLength++; - } else if (light.isRectAreaLight) { - const uniforms = state.rectArea[rectAreaLength]; - uniforms.position.setFromMatrixPosition(light.matrixWorld); - uniforms.position.applyMatrix4(viewMatrix); - matrix42.identity(); - matrix4.copy(light.matrixWorld); - matrix4.premultiply(viewMatrix); - matrix42.extractRotation(matrix4); - uniforms.halfWidth.set(light.width * 0.5, 0, 0); - uniforms.halfHeight.set(0, light.height * 0.5, 0); - uniforms.halfWidth.applyMatrix4(matrix42); - uniforms.halfHeight.applyMatrix4(matrix42); - rectAreaLength++; - } else if (light.isPointLight) { - const uniforms = state.point[pointLength]; - uniforms.position.setFromMatrixPosition(light.matrixWorld); - uniforms.position.applyMatrix4(viewMatrix); - pointLength++; - } else if (light.isHemisphereLight) { - const uniforms = state.hemi[hemiLength]; - uniforms.direction.setFromMatrixPosition(light.matrixWorld); - uniforms.direction.transformDirection(viewMatrix); - hemiLength++; - } - } - } - return { - setup, - setupView, - state - }; -} -function WebGLRenderState(extensions, capabilities) { - const lights = new WebGLLights(extensions, capabilities); - const lightsArray = []; - const shadowsArray = []; - function init() { - lightsArray.length = 0; - shadowsArray.length = 0; - } - function pushLight(light) { - lightsArray.push(light); - } - function pushShadow(shadowLight) { - shadowsArray.push(shadowLight); - } - function setupLights(useLegacyLights) { - lights.setup(lightsArray, useLegacyLights); - } - function setupLightsView(camera) { - lights.setupView(lightsArray, camera); - } - const state = { - lightsArray, - shadowsArray, - lights - }; - return { - init, - state, - setupLights, - setupLightsView, - pushLight, - pushShadow - }; -} -function WebGLRenderStates(extensions, capabilities) { - let renderStates = /* @__PURE__ */ new WeakMap(); - function get(scene, renderCallDepth = 0) { - const renderStateArray = renderStates.get(scene); - let renderState; - if (renderStateArray === void 0) { - renderState = new WebGLRenderState(extensions, capabilities); - renderStates.set(scene, [renderState]); - } else { - if (renderCallDepth >= renderStateArray.length) { - renderState = new WebGLRenderState(extensions, capabilities); - renderStateArray.push(renderState); - } else { - renderState = renderStateArray[renderCallDepth]; - } - } - return renderState; - } - function dispose() { - renderStates = /* @__PURE__ */ new WeakMap(); - } - return { - get, - dispose - }; -} -var MeshDepthMaterial = class extends Material { - constructor(parameters) { - super(); - this.isMeshDepthMaterial = true; - this.type = "MeshDepthMaterial"; - this.depthPacking = BasicDepthPacking; - this.map = null; - this.alphaMap = null; - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.depthPacking = source.depthPacking; - this.map = source.map; - this.alphaMap = source.alphaMap; - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - return this; - } -}; -var MeshDistanceMaterial = class extends Material { - constructor(parameters) { - super(); - this.isMeshDistanceMaterial = true; - this.type = "MeshDistanceMaterial"; - this.map = null; - this.alphaMap = null; - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.map = source.map; - this.alphaMap = source.alphaMap; - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - return this; - } -}; -var vertex = "void main() {\n gl_Position = vec4( position, 1.0 );\n}"; -var fragment = "uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"; -function WebGLShadowMap(_renderer, _objects, _capabilities) { - let _frustum = new Frustum(); - const _shadowMapSize = new Vector2(), _viewportSize = new Vector2(), _viewport = new Vector4(), _depthMaterial = new MeshDepthMaterial({ depthPacking: RGBADepthPacking }), _distanceMaterial = new MeshDistanceMaterial(), _materialCache = {}, _maxTextureSize = _capabilities.maxTextureSize; - const shadowSide = { [FrontSide]: BackSide, [BackSide]: FrontSide, [DoubleSide]: DoubleSide }; - const shadowMaterialVertical = new ShaderMaterial({ - defines: { - VSM_SAMPLES: 8 - }, - uniforms: { - shadow_pass: { value: null }, - resolution: { value: new Vector2() }, - radius: { value: 4 } - }, - vertexShader: vertex, - fragmentShader: fragment - }); - const shadowMaterialHorizontal = shadowMaterialVertical.clone(); - shadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1; - const fullScreenTri = new BufferGeometry(); - fullScreenTri.setAttribute( - "position", - new BufferAttribute( - new Float32Array([-1, -1, 0.5, 3, -1, 0.5, -1, 3, 0.5]), - 3 - ) - ); - const fullScreenMesh = new Mesh(fullScreenTri, shadowMaterialVertical); - const scope = this; - this.enabled = false; - this.autoUpdate = true; - this.needsUpdate = false; - this.type = PCFShadowMap; - let _previousType = this.type; - this.render = function(lights, scene, camera) { - if (scope.enabled === false) - return; - if (scope.autoUpdate === false && scope.needsUpdate === false) - return; - if (lights.length === 0) - return; - const currentRenderTarget = _renderer.getRenderTarget(); - const activeCubeFace = _renderer.getActiveCubeFace(); - const activeMipmapLevel = _renderer.getActiveMipmapLevel(); - const _state = _renderer.state; - _state.setBlending(NoBlending); - _state.buffers.color.setClear(1, 1, 1, 1); - _state.buffers.depth.setTest(true); - _state.setScissorTest(false); - const toVSM = _previousType !== VSMShadowMap && this.type === VSMShadowMap; - const fromVSM = _previousType === VSMShadowMap && this.type !== VSMShadowMap; - for (let i = 0, il = lights.length; i < il; i++) { - const light = lights[i]; - const shadow = light.shadow; - if (shadow === void 0) { - console.warn("THREE.WebGLShadowMap:", light, "has no shadow."); - continue; - } - if (shadow.autoUpdate === false && shadow.needsUpdate === false) - continue; - _shadowMapSize.copy(shadow.mapSize); - const shadowFrameExtents = shadow.getFrameExtents(); - _shadowMapSize.multiply(shadowFrameExtents); - _viewportSize.copy(shadow.mapSize); - if (_shadowMapSize.x > _maxTextureSize || _shadowMapSize.y > _maxTextureSize) { - if (_shadowMapSize.x > _maxTextureSize) { - _viewportSize.x = Math.floor(_maxTextureSize / shadowFrameExtents.x); - _shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x; - shadow.mapSize.x = _viewportSize.x; - } - if (_shadowMapSize.y > _maxTextureSize) { - _viewportSize.y = Math.floor(_maxTextureSize / shadowFrameExtents.y); - _shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y; - shadow.mapSize.y = _viewportSize.y; - } - } - if (shadow.map === null || toVSM === true || fromVSM === true) { - const pars = this.type !== VSMShadowMap ? { minFilter: NearestFilter, magFilter: NearestFilter } : {}; - if (shadow.map !== null) { - shadow.map.dispose(); - } - shadow.map = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y, pars); - shadow.map.texture.name = light.name + ".shadowMap"; - shadow.camera.updateProjectionMatrix(); - } - _renderer.setRenderTarget(shadow.map); - _renderer.clear(); - const viewportCount = shadow.getViewportCount(); - for (let vp = 0; vp < viewportCount; vp++) { - const viewport = shadow.getViewport(vp); - _viewport.set( - _viewportSize.x * viewport.x, - _viewportSize.y * viewport.y, - _viewportSize.x * viewport.z, - _viewportSize.y * viewport.w - ); - _state.viewport(_viewport); - shadow.updateMatrices(light, vp); - _frustum = shadow.getFrustum(); - renderObject(scene, camera, shadow.camera, light, this.type); - } - if (shadow.isPointLightShadow !== true && this.type === VSMShadowMap) { - VSMPass(shadow, camera); - } - shadow.needsUpdate = false; - } - _previousType = this.type; - scope.needsUpdate = false; - _renderer.setRenderTarget(currentRenderTarget, activeCubeFace, activeMipmapLevel); - }; - function VSMPass(shadow, camera) { - const geometry = _objects.update(fullScreenMesh); - if (shadowMaterialVertical.defines.VSM_SAMPLES !== shadow.blurSamples) { - shadowMaterialVertical.defines.VSM_SAMPLES = shadow.blurSamples; - shadowMaterialHorizontal.defines.VSM_SAMPLES = shadow.blurSamples; - shadowMaterialVertical.needsUpdate = true; - shadowMaterialHorizontal.needsUpdate = true; - } - if (shadow.mapPass === null) { - shadow.mapPass = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y); - } - shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture; - shadowMaterialVertical.uniforms.resolution.value = shadow.mapSize; - shadowMaterialVertical.uniforms.radius.value = shadow.radius; - _renderer.setRenderTarget(shadow.mapPass); - _renderer.clear(); - _renderer.renderBufferDirect(camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null); - shadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture; - shadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize; - shadowMaterialHorizontal.uniforms.radius.value = shadow.radius; - _renderer.setRenderTarget(shadow.map); - _renderer.clear(); - _renderer.renderBufferDirect(camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null); - } - function getDepthMaterial(object, material, light, type) { - let result = null; - const customMaterial = light.isPointLight === true ? object.customDistanceMaterial : object.customDepthMaterial; - if (customMaterial !== void 0) { - result = customMaterial; - } else { - result = light.isPointLight === true ? _distanceMaterial : _depthMaterial; - if (_renderer.localClippingEnabled && material.clipShadows === true && Array.isArray(material.clippingPlanes) && material.clippingPlanes.length !== 0 || material.displacementMap && material.displacementScale !== 0 || material.alphaMap && material.alphaTest > 0 || material.map && material.alphaTest > 0) { - const keyA = result.uuid, keyB = material.uuid; - let materialsForVariant = _materialCache[keyA]; - if (materialsForVariant === void 0) { - materialsForVariant = {}; - _materialCache[keyA] = materialsForVariant; - } - let cachedMaterial = materialsForVariant[keyB]; - if (cachedMaterial === void 0) { - cachedMaterial = result.clone(); - materialsForVariant[keyB] = cachedMaterial; - } - result = cachedMaterial; - } - } - result.visible = material.visible; - result.wireframe = material.wireframe; - if (type === VSMShadowMap) { - result.side = material.shadowSide !== null ? material.shadowSide : material.side; - } else { - result.side = material.shadowSide !== null ? material.shadowSide : shadowSide[material.side]; - } - result.alphaMap = material.alphaMap; - result.alphaTest = material.alphaTest; - result.map = material.map; - result.clipShadows = material.clipShadows; - result.clippingPlanes = material.clippingPlanes; - result.clipIntersection = material.clipIntersection; - result.displacementMap = material.displacementMap; - result.displacementScale = material.displacementScale; - result.displacementBias = material.displacementBias; - result.wireframeLinewidth = material.wireframeLinewidth; - result.linewidth = material.linewidth; - if (light.isPointLight === true && result.isMeshDistanceMaterial === true) { - const materialProperties = _renderer.properties.get(result); - materialProperties.light = light; - } - return result; - } - function renderObject(object, camera, shadowCamera, light, type) { - if (object.visible === false) - return; - const visible = object.layers.test(camera.layers); - if (visible && (object.isMesh || object.isLine || object.isPoints)) { - if ((object.castShadow || object.receiveShadow && type === VSMShadowMap) && (!object.frustumCulled || _frustum.intersectsObject(object))) { - object.modelViewMatrix.multiplyMatrices(shadowCamera.matrixWorldInverse, object.matrixWorld); - const geometry = _objects.update(object); - const material = object.material; - if (Array.isArray(material)) { - const groups = geometry.groups; - for (let k = 0, kl = groups.length; k < kl; k++) { - const group = groups[k]; - const groupMaterial = material[group.materialIndex]; - if (groupMaterial && groupMaterial.visible) { - const depthMaterial = getDepthMaterial(object, groupMaterial, light, type); - _renderer.renderBufferDirect(shadowCamera, null, geometry, depthMaterial, object, group); - } - } - } else if (material.visible) { - const depthMaterial = getDepthMaterial(object, material, light, type); - _renderer.renderBufferDirect(shadowCamera, null, geometry, depthMaterial, object, null); - } - } - } - const children = object.children; - for (let i = 0, l = children.length; i < l; i++) { - renderObject(children[i], camera, shadowCamera, light, type); - } - } -} -function WebGLState(gl, extensions, capabilities) { - const isWebGL2 = capabilities.isWebGL2; - function ColorBuffer() { - let locked = false; - const color = new Vector4(); - let currentColorMask = null; - const currentColorClear = new Vector4(0, 0, 0, 0); - return { - setMask: function(colorMask) { - if (currentColorMask !== colorMask && !locked) { - gl.colorMask(colorMask, colorMask, colorMask, colorMask); - currentColorMask = colorMask; - } - }, - setLocked: function(lock) { - locked = lock; - }, - setClear: function(r, g, b, a, premultipliedAlpha) { - if (premultipliedAlpha === true) { - r *= a; - g *= a; - b *= a; - } - color.set(r, g, b, a); - if (currentColorClear.equals(color) === false) { - gl.clearColor(r, g, b, a); - currentColorClear.copy(color); - } - }, - reset: function() { - locked = false; - currentColorMask = null; - currentColorClear.set(-1, 0, 0, 0); - } - }; - } - function DepthBuffer() { - let locked = false; - let currentDepthMask = null; - let currentDepthFunc = null; - let currentDepthClear = null; - return { - setTest: function(depthTest) { - if (depthTest) { - enable(gl.DEPTH_TEST); - } else { - disable(gl.DEPTH_TEST); - } - }, - setMask: function(depthMask) { - if (currentDepthMask !== depthMask && !locked) { - gl.depthMask(depthMask); - currentDepthMask = depthMask; - } - }, - setFunc: function(depthFunc) { - if (currentDepthFunc !== depthFunc) { - switch (depthFunc) { - case NeverDepth: - gl.depthFunc(gl.NEVER); - break; - case AlwaysDepth: - gl.depthFunc(gl.ALWAYS); - break; - case LessDepth: - gl.depthFunc(gl.LESS); - break; - case LessEqualDepth: - gl.depthFunc(gl.LEQUAL); - break; - case EqualDepth: - gl.depthFunc(gl.EQUAL); - break; - case GreaterEqualDepth: - gl.depthFunc(gl.GEQUAL); - break; - case GreaterDepth: - gl.depthFunc(gl.GREATER); - break; - case NotEqualDepth: - gl.depthFunc(gl.NOTEQUAL); - break; - default: - gl.depthFunc(gl.LEQUAL); - } - currentDepthFunc = depthFunc; - } - }, - setLocked: function(lock) { - locked = lock; - }, - setClear: function(depth) { - if (currentDepthClear !== depth) { - gl.clearDepth(depth); - currentDepthClear = depth; - } - }, - reset: function() { - locked = false; - currentDepthMask = null; - currentDepthFunc = null; - currentDepthClear = null; - } - }; - } - function StencilBuffer() { - let locked = false; - let currentStencilMask = null; - let currentStencilFunc = null; - let currentStencilRef = null; - let currentStencilFuncMask = null; - let currentStencilFail = null; - let currentStencilZFail = null; - let currentStencilZPass = null; - let currentStencilClear = null; - return { - setTest: function(stencilTest) { - if (!locked) { - if (stencilTest) { - enable(gl.STENCIL_TEST); - } else { - disable(gl.STENCIL_TEST); - } - } - }, - setMask: function(stencilMask) { - if (currentStencilMask !== stencilMask && !locked) { - gl.stencilMask(stencilMask); - currentStencilMask = stencilMask; - } - }, - setFunc: function(stencilFunc, stencilRef, stencilMask) { - if (currentStencilFunc !== stencilFunc || currentStencilRef !== stencilRef || currentStencilFuncMask !== stencilMask) { - gl.stencilFunc(stencilFunc, stencilRef, stencilMask); - currentStencilFunc = stencilFunc; - currentStencilRef = stencilRef; - currentStencilFuncMask = stencilMask; - } - }, - setOp: function(stencilFail, stencilZFail, stencilZPass) { - if (currentStencilFail !== stencilFail || currentStencilZFail !== stencilZFail || currentStencilZPass !== stencilZPass) { - gl.stencilOp(stencilFail, stencilZFail, stencilZPass); - currentStencilFail = stencilFail; - currentStencilZFail = stencilZFail; - currentStencilZPass = stencilZPass; - } - }, - setLocked: function(lock) { - locked = lock; - }, - setClear: function(stencil) { - if (currentStencilClear !== stencil) { - gl.clearStencil(stencil); - currentStencilClear = stencil; - } - }, - reset: function() { - locked = false; - currentStencilMask = null; - currentStencilFunc = null; - currentStencilRef = null; - currentStencilFuncMask = null; - currentStencilFail = null; - currentStencilZFail = null; - currentStencilZPass = null; - currentStencilClear = null; - } - }; - } - const colorBuffer = new ColorBuffer(); - const depthBuffer = new DepthBuffer(); - const stencilBuffer = new StencilBuffer(); - const uboBindings = /* @__PURE__ */ new WeakMap(); - const uboProgramMap = /* @__PURE__ */ new WeakMap(); - let enabledCapabilities = {}; - let currentBoundFramebuffers = {}; - let currentDrawbuffers = /* @__PURE__ */ new WeakMap(); - let defaultDrawbuffers = []; - let currentProgram = null; - let currentBlendingEnabled = false; - let currentBlending = null; - let currentBlendEquation = null; - let currentBlendSrc = null; - let currentBlendDst = null; - let currentBlendEquationAlpha = null; - let currentBlendSrcAlpha = null; - let currentBlendDstAlpha = null; - let currentBlendColor = new Color(0, 0, 0); - let currentBlendAlpha = 0; - let currentPremultipledAlpha = false; - let currentFlipSided = null; - let currentCullFace = null; - let currentLineWidth = null; - let currentPolygonOffsetFactor = null; - let currentPolygonOffsetUnits = null; - const maxTextures = gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS); - let lineWidthAvailable = false; - let version = 0; - const glVersion = gl.getParameter(gl.VERSION); - if (glVersion.indexOf("WebGL") !== -1) { - version = parseFloat(/^WebGL (\d)/.exec(glVersion)[1]); - lineWidthAvailable = version >= 1; - } else if (glVersion.indexOf("OpenGL ES") !== -1) { - version = parseFloat(/^OpenGL ES (\d)/.exec(glVersion)[1]); - lineWidthAvailable = version >= 2; - } - let currentTextureSlot = null; - let currentBoundTextures = {}; - const scissorParam = gl.getParameter(gl.SCISSOR_BOX); - const viewportParam = gl.getParameter(gl.VIEWPORT); - const currentScissor = new Vector4().fromArray(scissorParam); - const currentViewport = new Vector4().fromArray(viewportParam); - function createTexture(type, target, count, dimensions) { - const data = new Uint8Array(4); - const texture = gl.createTexture(); - gl.bindTexture(type, texture); - gl.texParameteri(type, gl.TEXTURE_MIN_FILTER, gl.NEAREST); - gl.texParameteri(type, gl.TEXTURE_MAG_FILTER, gl.NEAREST); - for (let i = 0; i < count; i++) { - if (isWebGL2 && (type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY)) { - gl.texImage3D(target, 0, gl.RGBA, 1, 1, dimensions, 0, gl.RGBA, gl.UNSIGNED_BYTE, data); - } else { - gl.texImage2D(target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data); - } - } - return texture; - } - const emptyTextures = {}; - emptyTextures[gl.TEXTURE_2D] = createTexture(gl.TEXTURE_2D, gl.TEXTURE_2D, 1); - emptyTextures[gl.TEXTURE_CUBE_MAP] = createTexture(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6); - if (isWebGL2) { - emptyTextures[gl.TEXTURE_2D_ARRAY] = createTexture(gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1); - emptyTextures[gl.TEXTURE_3D] = createTexture(gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1); - } - colorBuffer.setClear(0, 0, 0, 1); - depthBuffer.setClear(1); - stencilBuffer.setClear(0); - enable(gl.DEPTH_TEST); - depthBuffer.setFunc(LessEqualDepth); - setFlipSided(false); - setCullFace(CullFaceBack); - enable(gl.CULL_FACE); - setBlending(NoBlending); - function enable(id) { - if (enabledCapabilities[id] !== true) { - gl.enable(id); - enabledCapabilities[id] = true; - } - } - function disable(id) { - if (enabledCapabilities[id] !== false) { - gl.disable(id); - enabledCapabilities[id] = false; - } - } - function bindFramebuffer(target, framebuffer) { - if (currentBoundFramebuffers[target] !== framebuffer) { - gl.bindFramebuffer(target, framebuffer); - currentBoundFramebuffers[target] = framebuffer; - if (isWebGL2) { - if (target === gl.DRAW_FRAMEBUFFER) { - currentBoundFramebuffers[gl.FRAMEBUFFER] = framebuffer; - } - if (target === gl.FRAMEBUFFER) { - currentBoundFramebuffers[gl.DRAW_FRAMEBUFFER] = framebuffer; - } - } - return true; - } - return false; - } - function drawBuffers(renderTarget, framebuffer) { - let drawBuffers2 = defaultDrawbuffers; - let needsUpdate = false; - if (renderTarget) { - drawBuffers2 = currentDrawbuffers.get(framebuffer); - if (drawBuffers2 === void 0) { - drawBuffers2 = []; - currentDrawbuffers.set(framebuffer, drawBuffers2); - } - if (renderTarget.isWebGLMultipleRenderTargets) { - const textures = renderTarget.texture; - if (drawBuffers2.length !== textures.length || drawBuffers2[0] !== gl.COLOR_ATTACHMENT0) { - for (let i = 0, il = textures.length; i < il; i++) { - drawBuffers2[i] = gl.COLOR_ATTACHMENT0 + i; - } - drawBuffers2.length = textures.length; - needsUpdate = true; - } - } else { - if (drawBuffers2[0] !== gl.COLOR_ATTACHMENT0) { - drawBuffers2[0] = gl.COLOR_ATTACHMENT0; - needsUpdate = true; - } - } - } else { - if (drawBuffers2[0] !== gl.BACK) { - drawBuffers2[0] = gl.BACK; - needsUpdate = true; - } - } - if (needsUpdate) { - if (capabilities.isWebGL2) { - gl.drawBuffers(drawBuffers2); - } else { - extensions.get("WEBGL_draw_buffers").drawBuffersWEBGL(drawBuffers2); - } - } - } - function useProgram(program) { - if (currentProgram !== program) { - gl.useProgram(program); - currentProgram = program; - return true; - } - return false; - } - const equationToGL = { - [AddEquation]: gl.FUNC_ADD, - [SubtractEquation]: gl.FUNC_SUBTRACT, - [ReverseSubtractEquation]: gl.FUNC_REVERSE_SUBTRACT - }; - if (isWebGL2) { - equationToGL[MinEquation] = gl.MIN; - equationToGL[MaxEquation] = gl.MAX; - } else { - const extension = extensions.get("EXT_blend_minmax"); - if (extension !== null) { - equationToGL[MinEquation] = extension.MIN_EXT; - equationToGL[MaxEquation] = extension.MAX_EXT; - } - } - const factorToGL = { - [ZeroFactor]: gl.ZERO, - [OneFactor]: gl.ONE, - [SrcColorFactor]: gl.SRC_COLOR, - [SrcAlphaFactor]: gl.SRC_ALPHA, - [SrcAlphaSaturateFactor]: gl.SRC_ALPHA_SATURATE, - [DstColorFactor]: gl.DST_COLOR, - [DstAlphaFactor]: gl.DST_ALPHA, - [OneMinusSrcColorFactor]: gl.ONE_MINUS_SRC_COLOR, - [OneMinusSrcAlphaFactor]: gl.ONE_MINUS_SRC_ALPHA, - [OneMinusDstColorFactor]: gl.ONE_MINUS_DST_COLOR, - [OneMinusDstAlphaFactor]: gl.ONE_MINUS_DST_ALPHA, - [ConstantColorFactor]: gl.CONSTANT_COLOR, - [OneMinusConstantColorFactor]: gl.ONE_MINUS_CONSTANT_COLOR, - [ConstantAlphaFactor]: gl.CONSTANT_ALPHA, - [OneMinusConstantAlphaFactor]: gl.ONE_MINUS_CONSTANT_ALPHA - }; - function setBlending(blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, blendColor, blendAlpha, premultipliedAlpha) { - if (blending === NoBlending) { - if (currentBlendingEnabled === true) { - disable(gl.BLEND); - currentBlendingEnabled = false; - } - return; - } - if (currentBlendingEnabled === false) { - enable(gl.BLEND); - currentBlendingEnabled = true; - } - if (blending !== CustomBlending) { - if (blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha) { - if (currentBlendEquation !== AddEquation || currentBlendEquationAlpha !== AddEquation) { - gl.blendEquation(gl.FUNC_ADD); - currentBlendEquation = AddEquation; - currentBlendEquationAlpha = AddEquation; - } - if (premultipliedAlpha) { - switch (blending) { - case NormalBlending: - gl.blendFuncSeparate(gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA); - break; - case AdditiveBlending: - gl.blendFunc(gl.ONE, gl.ONE); - break; - case SubtractiveBlending: - gl.blendFuncSeparate(gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE); - break; - case MultiplyBlending: - gl.blendFuncSeparate(gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA); - break; - default: - console.error("THREE.WebGLState: Invalid blending: ", blending); - break; - } - } else { - switch (blending) { - case NormalBlending: - gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA); - break; - case AdditiveBlending: - gl.blendFunc(gl.SRC_ALPHA, gl.ONE); - break; - case SubtractiveBlending: - gl.blendFuncSeparate(gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE); - break; - case MultiplyBlending: - gl.blendFunc(gl.ZERO, gl.SRC_COLOR); - break; - default: - console.error("THREE.WebGLState: Invalid blending: ", blending); - break; - } - } - currentBlendSrc = null; - currentBlendDst = null; - currentBlendSrcAlpha = null; - currentBlendDstAlpha = null; - currentBlendColor.set(0, 0, 0); - currentBlendAlpha = 0; - currentBlending = blending; - currentPremultipledAlpha = premultipliedAlpha; - } - return; - } - blendEquationAlpha = blendEquationAlpha || blendEquation; - blendSrcAlpha = blendSrcAlpha || blendSrc; - blendDstAlpha = blendDstAlpha || blendDst; - if (blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha) { - gl.blendEquationSeparate(equationToGL[blendEquation], equationToGL[blendEquationAlpha]); - currentBlendEquation = blendEquation; - currentBlendEquationAlpha = blendEquationAlpha; - } - if (blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha) { - gl.blendFuncSeparate(factorToGL[blendSrc], factorToGL[blendDst], factorToGL[blendSrcAlpha], factorToGL[blendDstAlpha]); - currentBlendSrc = blendSrc; - currentBlendDst = blendDst; - currentBlendSrcAlpha = blendSrcAlpha; - currentBlendDstAlpha = blendDstAlpha; - } - if (blendColor.equals(currentBlendColor) === false || blendAlpha !== currentBlendAlpha) { - gl.blendColor(blendColor.r, blendColor.g, blendColor.b, blendAlpha); - currentBlendColor.copy(blendColor); - currentBlendAlpha = blendAlpha; - } - currentBlending = blending; - currentPremultipledAlpha = false; - } - function setMaterial(material, frontFaceCW) { - material.side === DoubleSide ? disable(gl.CULL_FACE) : enable(gl.CULL_FACE); - let flipSided = material.side === BackSide; - if (frontFaceCW) - flipSided = !flipSided; - setFlipSided(flipSided); - material.blending === NormalBlending && material.transparent === false ? setBlending(NoBlending) : setBlending(material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.blendColor, material.blendAlpha, material.premultipliedAlpha); - depthBuffer.setFunc(material.depthFunc); - depthBuffer.setTest(material.depthTest); - depthBuffer.setMask(material.depthWrite); - colorBuffer.setMask(material.colorWrite); - const stencilWrite = material.stencilWrite; - stencilBuffer.setTest(stencilWrite); - if (stencilWrite) { - stencilBuffer.setMask(material.stencilWriteMask); - stencilBuffer.setFunc(material.stencilFunc, material.stencilRef, material.stencilFuncMask); - stencilBuffer.setOp(material.stencilFail, material.stencilZFail, material.stencilZPass); - } - setPolygonOffset(material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits); - material.alphaToCoverage === true ? enable(gl.SAMPLE_ALPHA_TO_COVERAGE) : disable(gl.SAMPLE_ALPHA_TO_COVERAGE); - } - function setFlipSided(flipSided) { - if (currentFlipSided !== flipSided) { - if (flipSided) { - gl.frontFace(gl.CW); - } else { - gl.frontFace(gl.CCW); - } - currentFlipSided = flipSided; - } - } - function setCullFace(cullFace) { - if (cullFace !== CullFaceNone) { - enable(gl.CULL_FACE); - if (cullFace !== currentCullFace) { - if (cullFace === CullFaceBack) { - gl.cullFace(gl.BACK); - } else if (cullFace === CullFaceFront) { - gl.cullFace(gl.FRONT); - } else { - gl.cullFace(gl.FRONT_AND_BACK); - } - } - } else { - disable(gl.CULL_FACE); - } - currentCullFace = cullFace; - } - function setLineWidth(width) { - if (width !== currentLineWidth) { - if (lineWidthAvailable) - gl.lineWidth(width); - currentLineWidth = width; - } - } - function setPolygonOffset(polygonOffset, factor, units) { - if (polygonOffset) { - enable(gl.POLYGON_OFFSET_FILL); - if (currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units) { - gl.polygonOffset(factor, units); - currentPolygonOffsetFactor = factor; - currentPolygonOffsetUnits = units; - } - } else { - disable(gl.POLYGON_OFFSET_FILL); - } - } - function setScissorTest(scissorTest) { - if (scissorTest) { - enable(gl.SCISSOR_TEST); - } else { - disable(gl.SCISSOR_TEST); - } - } - function activeTexture(webglSlot) { - if (webglSlot === void 0) - webglSlot = gl.TEXTURE0 + maxTextures - 1; - if (currentTextureSlot !== webglSlot) { - gl.activeTexture(webglSlot); - currentTextureSlot = webglSlot; - } - } - function bindTexture(webglType, webglTexture, webglSlot) { - if (webglSlot === void 0) { - if (currentTextureSlot === null) { - webglSlot = gl.TEXTURE0 + maxTextures - 1; - } else { - webglSlot = currentTextureSlot; - } - } - let boundTexture = currentBoundTextures[webglSlot]; - if (boundTexture === void 0) { - boundTexture = { type: void 0, texture: void 0 }; - currentBoundTextures[webglSlot] = boundTexture; - } - if (boundTexture.type !== webglType || boundTexture.texture !== webglTexture) { - if (currentTextureSlot !== webglSlot) { - gl.activeTexture(webglSlot); - currentTextureSlot = webglSlot; - } - gl.bindTexture(webglType, webglTexture || emptyTextures[webglType]); - boundTexture.type = webglType; - boundTexture.texture = webglTexture; - } - } - function unbindTexture() { - const boundTexture = currentBoundTextures[currentTextureSlot]; - if (boundTexture !== void 0 && boundTexture.type !== void 0) { - gl.bindTexture(boundTexture.type, null); - boundTexture.type = void 0; - boundTexture.texture = void 0; - } - } - function compressedTexImage2D() { - try { - gl.compressedTexImage2D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - function compressedTexImage3D() { - try { - gl.compressedTexImage3D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - function texSubImage2D() { - try { - gl.texSubImage2D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - function texSubImage3D() { - try { - gl.texSubImage3D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - function compressedTexSubImage2D() { - try { - gl.compressedTexSubImage2D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - function compressedTexSubImage3D() { - try { - gl.compressedTexSubImage3D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - function texStorage2D() { - try { - gl.texStorage2D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - function texStorage3D() { - try { - gl.texStorage3D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - function texImage2D() { - try { - gl.texImage2D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - function texImage3D() { - try { - gl.texImage3D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - function scissor(scissor2) { - if (currentScissor.equals(scissor2) === false) { - gl.scissor(scissor2.x, scissor2.y, scissor2.z, scissor2.w); - currentScissor.copy(scissor2); - } - } - function viewport(viewport2) { - if (currentViewport.equals(viewport2) === false) { - gl.viewport(viewport2.x, viewport2.y, viewport2.z, viewport2.w); - currentViewport.copy(viewport2); - } - } - function updateUBOMapping(uniformsGroup, program) { - let mapping = uboProgramMap.get(program); - if (mapping === void 0) { - mapping = /* @__PURE__ */ new WeakMap(); - uboProgramMap.set(program, mapping); - } - let blockIndex = mapping.get(uniformsGroup); - if (blockIndex === void 0) { - blockIndex = gl.getUniformBlockIndex(program, uniformsGroup.name); - mapping.set(uniformsGroup, blockIndex); - } - } - function uniformBlockBinding(uniformsGroup, program) { - const mapping = uboProgramMap.get(program); - const blockIndex = mapping.get(uniformsGroup); - if (uboBindings.get(program) !== blockIndex) { - gl.uniformBlockBinding(program, blockIndex, uniformsGroup.__bindingPointIndex); - uboBindings.set(program, blockIndex); - } - } - function reset() { - gl.disable(gl.BLEND); - gl.disable(gl.CULL_FACE); - gl.disable(gl.DEPTH_TEST); - gl.disable(gl.POLYGON_OFFSET_FILL); - gl.disable(gl.SCISSOR_TEST); - gl.disable(gl.STENCIL_TEST); - gl.disable(gl.SAMPLE_ALPHA_TO_COVERAGE); - gl.blendEquation(gl.FUNC_ADD); - gl.blendFunc(gl.ONE, gl.ZERO); - gl.blendFuncSeparate(gl.ONE, gl.ZERO, gl.ONE, gl.ZERO); - gl.blendColor(0, 0, 0, 0); - gl.colorMask(true, true, true, true); - gl.clearColor(0, 0, 0, 0); - gl.depthMask(true); - gl.depthFunc(gl.LESS); - gl.clearDepth(1); - gl.stencilMask(4294967295); - gl.stencilFunc(gl.ALWAYS, 0, 4294967295); - gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); - gl.clearStencil(0); - gl.cullFace(gl.BACK); - gl.frontFace(gl.CCW); - gl.polygonOffset(0, 0); - gl.activeTexture(gl.TEXTURE0); - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - if (isWebGL2 === true) { - gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null); - gl.bindFramebuffer(gl.READ_FRAMEBUFFER, null); - } - gl.useProgram(null); - gl.lineWidth(1); - gl.scissor(0, 0, gl.canvas.width, gl.canvas.height); - gl.viewport(0, 0, gl.canvas.width, gl.canvas.height); - enabledCapabilities = {}; - currentTextureSlot = null; - currentBoundTextures = {}; - currentBoundFramebuffers = {}; - currentDrawbuffers = /* @__PURE__ */ new WeakMap(); - defaultDrawbuffers = []; - currentProgram = null; - currentBlendingEnabled = false; - currentBlending = null; - currentBlendEquation = null; - currentBlendSrc = null; - currentBlendDst = null; - currentBlendEquationAlpha = null; - currentBlendSrcAlpha = null; - currentBlendDstAlpha = null; - currentBlendColor = new Color(0, 0, 0); - currentBlendAlpha = 0; - currentPremultipledAlpha = false; - currentFlipSided = null; - currentCullFace = null; - currentLineWidth = null; - currentPolygonOffsetFactor = null; - currentPolygonOffsetUnits = null; - currentScissor.set(0, 0, gl.canvas.width, gl.canvas.height); - currentViewport.set(0, 0, gl.canvas.width, gl.canvas.height); - colorBuffer.reset(); - depthBuffer.reset(); - stencilBuffer.reset(); - } - return { - buffers: { - color: colorBuffer, - depth: depthBuffer, - stencil: stencilBuffer - }, - enable, - disable, - bindFramebuffer, - drawBuffers, - useProgram, - setBlending, - setMaterial, - setFlipSided, - setCullFace, - setLineWidth, - setPolygonOffset, - setScissorTest, - activeTexture, - bindTexture, - unbindTexture, - compressedTexImage2D, - compressedTexImage3D, - texImage2D, - texImage3D, - updateUBOMapping, - uniformBlockBinding, - texStorage2D, - texStorage3D, - texSubImage2D, - texSubImage3D, - compressedTexSubImage2D, - compressedTexSubImage3D, - scissor, - viewport, - reset - }; -} -function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, info) { - const isWebGL2 = capabilities.isWebGL2; - const maxTextures = capabilities.maxTextures; - const maxCubemapSize = capabilities.maxCubemapSize; - const maxTextureSize = capabilities.maxTextureSize; - const maxSamples = capabilities.maxSamples; - const multisampledRTTExt = extensions.has("WEBGL_multisampled_render_to_texture") ? extensions.get("WEBGL_multisampled_render_to_texture") : null; - const supportsInvalidateFramebuffer = typeof navigator === "undefined" ? false : /OculusBrowser/g.test(navigator.userAgent); - const _videoTextures = /* @__PURE__ */ new WeakMap(); - let _canvas2; - const _sources = /* @__PURE__ */ new WeakMap(); - let useOffscreenCanvas = false; - try { - useOffscreenCanvas = typeof OffscreenCanvas !== "undefined" && new OffscreenCanvas(1, 1).getContext("2d") !== null; - } catch (err) { - } - function createCanvas(width, height) { - return useOffscreenCanvas ? ( - // eslint-disable-next-line compat/compat - new OffscreenCanvas(width, height) - ) : createElementNS("canvas"); - } - function resizeImage(image, needsPowerOfTwo, needsNewCanvas, maxSize) { - let scale = 1; - if (image.width > maxSize || image.height > maxSize) { - scale = maxSize / Math.max(image.width, image.height); - } - if (scale < 1 || needsPowerOfTwo === true) { - if (typeof HTMLImageElement !== "undefined" && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== "undefined" && image instanceof HTMLCanvasElement || typeof ImageBitmap !== "undefined" && image instanceof ImageBitmap) { - const floor = needsPowerOfTwo ? floorPowerOfTwo : Math.floor; - const width = floor(scale * image.width); - const height = floor(scale * image.height); - if (_canvas2 === void 0) - _canvas2 = createCanvas(width, height); - const canvas = needsNewCanvas ? createCanvas(width, height) : _canvas2; - canvas.width = width; - canvas.height = height; - const context = canvas.getContext("2d"); - context.drawImage(image, 0, 0, width, height); - console.warn("THREE.WebGLRenderer: Texture has been resized from (" + image.width + "x" + image.height + ") to (" + width + "x" + height + ")."); - return canvas; - } else { - if ("data" in image) { - console.warn("THREE.WebGLRenderer: Image in DataTexture is too big (" + image.width + "x" + image.height + ")."); - } - return image; - } - } - return image; - } - function isPowerOfTwo$1(image) { - return isPowerOfTwo(image.width) && isPowerOfTwo(image.height); - } - function textureNeedsPowerOfTwo(texture) { - if (isWebGL2) - return false; - return texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping || texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter; - } - function textureNeedsGenerateMipmaps(texture, supportsMips) { - return texture.generateMipmaps && supportsMips && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter; - } - function generateMipmap(target) { - _gl.generateMipmap(target); - } - function getInternalFormat(internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false) { - if (isWebGL2 === false) - return glFormat; - if (internalFormatName !== null) { - if (_gl[internalFormatName] !== void 0) - return _gl[internalFormatName]; - console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '" + internalFormatName + "'"); - } - let internalFormat = glFormat; - if (glFormat === _gl.RED) { - if (glType === _gl.FLOAT) - internalFormat = _gl.R32F; - if (glType === _gl.HALF_FLOAT) - internalFormat = _gl.R16F; - if (glType === _gl.UNSIGNED_BYTE) - internalFormat = _gl.R8; - } - if (glFormat === _gl.RED_INTEGER) { - if (glType === _gl.UNSIGNED_BYTE) - internalFormat = _gl.R8UI; - if (glType === _gl.UNSIGNED_SHORT) - internalFormat = _gl.R16UI; - if (glType === _gl.UNSIGNED_INT) - internalFormat = _gl.R32UI; - if (glType === _gl.BYTE) - internalFormat = _gl.R8I; - if (glType === _gl.SHORT) - internalFormat = _gl.R16I; - if (glType === _gl.INT) - internalFormat = _gl.R32I; - } - if (glFormat === _gl.RG) { - if (glType === _gl.FLOAT) - internalFormat = _gl.RG32F; - if (glType === _gl.HALF_FLOAT) - internalFormat = _gl.RG16F; - if (glType === _gl.UNSIGNED_BYTE) - internalFormat = _gl.RG8; - } - if (glFormat === _gl.RGBA) { - const transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer(colorSpace); - if (glType === _gl.FLOAT) - internalFormat = _gl.RGBA32F; - if (glType === _gl.HALF_FLOAT) - internalFormat = _gl.RGBA16F; - if (glType === _gl.UNSIGNED_BYTE) - internalFormat = transfer === SRGBTransfer ? _gl.SRGB8_ALPHA8 : _gl.RGBA8; - if (glType === _gl.UNSIGNED_SHORT_4_4_4_4) - internalFormat = _gl.RGBA4; - if (glType === _gl.UNSIGNED_SHORT_5_5_5_1) - internalFormat = _gl.RGB5_A1; - } - if (internalFormat === _gl.R16F || internalFormat === _gl.R32F || internalFormat === _gl.RG16F || internalFormat === _gl.RG32F || internalFormat === _gl.RGBA16F || internalFormat === _gl.RGBA32F) { - extensions.get("EXT_color_buffer_float"); - } - return internalFormat; - } - function getMipLevels(texture, image, supportsMips) { - if (textureNeedsGenerateMipmaps(texture, supportsMips) === true || texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter) { - return Math.log2(Math.max(image.width, image.height)) + 1; - } else if (texture.mipmaps !== void 0 && texture.mipmaps.length > 0) { - return texture.mipmaps.length; - } else if (texture.isCompressedTexture && Array.isArray(texture.image)) { - return image.mipmaps.length; - } else { - return 1; - } - } - function filterFallback(f) { - if (f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter) { - return _gl.NEAREST; - } - return _gl.LINEAR; - } - function onTextureDispose(event) { - const texture = event.target; - texture.removeEventListener("dispose", onTextureDispose); - deallocateTexture(texture); - if (texture.isVideoTexture) { - _videoTextures.delete(texture); - } - } - function onRenderTargetDispose(event) { - const renderTarget = event.target; - renderTarget.removeEventListener("dispose", onRenderTargetDispose); - deallocateRenderTarget(renderTarget); - } - function deallocateTexture(texture) { - const textureProperties = properties.get(texture); - if (textureProperties.__webglInit === void 0) - return; - const source = texture.source; - const webglTextures = _sources.get(source); - if (webglTextures) { - const webglTexture = webglTextures[textureProperties.__cacheKey]; - webglTexture.usedTimes--; - if (webglTexture.usedTimes === 0) { - deleteTexture(texture); - } - if (Object.keys(webglTextures).length === 0) { - _sources.delete(source); - } - } - properties.remove(texture); - } - function deleteTexture(texture) { - const textureProperties = properties.get(texture); - _gl.deleteTexture(textureProperties.__webglTexture); - const source = texture.source; - const webglTextures = _sources.get(source); - delete webglTextures[textureProperties.__cacheKey]; - info.memory.textures--; - } - function deallocateRenderTarget(renderTarget) { - const texture = renderTarget.texture; - const renderTargetProperties = properties.get(renderTarget); - const textureProperties = properties.get(texture); - if (textureProperties.__webglTexture !== void 0) { - _gl.deleteTexture(textureProperties.__webglTexture); - info.memory.textures--; - } - if (renderTarget.depthTexture) { - renderTarget.depthTexture.dispose(); - } - if (renderTarget.isWebGLCubeRenderTarget) { - for (let i = 0; i < 6; i++) { - if (Array.isArray(renderTargetProperties.__webglFramebuffer[i])) { - for (let level = 0; level < renderTargetProperties.__webglFramebuffer[i].length; level++) - _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[i][level]); - } else { - _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[i]); - } - if (renderTargetProperties.__webglDepthbuffer) - _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer[i]); - } - } else { - if (Array.isArray(renderTargetProperties.__webglFramebuffer)) { - for (let level = 0; level < renderTargetProperties.__webglFramebuffer.length; level++) - _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[level]); - } else { - _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer); - } - if (renderTargetProperties.__webglDepthbuffer) - _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer); - if (renderTargetProperties.__webglMultisampledFramebuffer) - _gl.deleteFramebuffer(renderTargetProperties.__webglMultisampledFramebuffer); - if (renderTargetProperties.__webglColorRenderbuffer) { - for (let i = 0; i < renderTargetProperties.__webglColorRenderbuffer.length; i++) { - if (renderTargetProperties.__webglColorRenderbuffer[i]) - _gl.deleteRenderbuffer(renderTargetProperties.__webglColorRenderbuffer[i]); - } - } - if (renderTargetProperties.__webglDepthRenderbuffer) - _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthRenderbuffer); - } - if (renderTarget.isWebGLMultipleRenderTargets) { - for (let i = 0, il = texture.length; i < il; i++) { - const attachmentProperties = properties.get(texture[i]); - if (attachmentProperties.__webglTexture) { - _gl.deleteTexture(attachmentProperties.__webglTexture); - info.memory.textures--; - } - properties.remove(texture[i]); - } - } - properties.remove(texture); - properties.remove(renderTarget); - } - let textureUnits = 0; - function resetTextureUnits() { - textureUnits = 0; - } - function allocateTextureUnit() { - const textureUnit = textureUnits; - if (textureUnit >= maxTextures) { - console.warn("THREE.WebGLTextures: Trying to use " + textureUnit + " texture units while this GPU supports only " + maxTextures); - } - textureUnits += 1; - return textureUnit; - } - function getTextureCacheKey(texture) { - const array = []; - array.push(texture.wrapS); - array.push(texture.wrapT); - array.push(texture.wrapR || 0); - array.push(texture.magFilter); - array.push(texture.minFilter); - array.push(texture.anisotropy); - array.push(texture.internalFormat); - array.push(texture.format); - array.push(texture.type); - array.push(texture.generateMipmaps); - array.push(texture.premultiplyAlpha); - array.push(texture.flipY); - array.push(texture.unpackAlignment); - array.push(texture.colorSpace); - return array.join(); - } - function setTexture2D(texture, slot) { - const textureProperties = properties.get(texture); - if (texture.isVideoTexture) - updateVideoTexture(texture); - if (texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version) { - const image = texture.image; - if (image === null) { - console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found."); - } else if (image.complete === false) { - console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete"); - } else { - uploadTexture(textureProperties, texture, slot); - return; - } - } - state.bindTexture(_gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot); - } - function setTexture2DArray(texture, slot) { - const textureProperties = properties.get(texture); - if (texture.version > 0 && textureProperties.__version !== texture.version) { - uploadTexture(textureProperties, texture, slot); - return; - } - state.bindTexture(_gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot); - } - function setTexture3D(texture, slot) { - const textureProperties = properties.get(texture); - if (texture.version > 0 && textureProperties.__version !== texture.version) { - uploadTexture(textureProperties, texture, slot); - return; - } - state.bindTexture(_gl.TEXTURE_3D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot); - } - function setTextureCube(texture, slot) { - const textureProperties = properties.get(texture); - if (texture.version > 0 && textureProperties.__version !== texture.version) { - uploadCubeTexture(textureProperties, texture, slot); - return; - } - state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot); - } - const wrappingToGL = { - [RepeatWrapping]: _gl.REPEAT, - [ClampToEdgeWrapping]: _gl.CLAMP_TO_EDGE, - [MirroredRepeatWrapping]: _gl.MIRRORED_REPEAT - }; - const filterToGL = { - [NearestFilter]: _gl.NEAREST, - [NearestMipmapNearestFilter]: _gl.NEAREST_MIPMAP_NEAREST, - [NearestMipmapLinearFilter]: _gl.NEAREST_MIPMAP_LINEAR, - [LinearFilter]: _gl.LINEAR, - [LinearMipmapNearestFilter]: _gl.LINEAR_MIPMAP_NEAREST, - [LinearMipmapLinearFilter]: _gl.LINEAR_MIPMAP_LINEAR - }; - const compareToGL = { - [NeverCompare]: _gl.NEVER, - [AlwaysCompare]: _gl.ALWAYS, - [LessCompare]: _gl.LESS, - [LessEqualCompare]: _gl.LEQUAL, - [EqualCompare]: _gl.EQUAL, - [GreaterEqualCompare]: _gl.GEQUAL, - [GreaterCompare]: _gl.GREATER, - [NotEqualCompare]: _gl.NOTEQUAL - }; - function setTextureParameters(textureType, texture, supportsMips) { - if (supportsMips) { - _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[texture.wrapS]); - _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[texture.wrapT]); - if (textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY) { - _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[texture.wrapR]); - } - _gl.texParameteri(textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[texture.magFilter]); - _gl.texParameteri(textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[texture.minFilter]); - } else { - _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE); - _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE); - if (textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY) { - _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_R, _gl.CLAMP_TO_EDGE); - } - if (texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping) { - console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."); - } - _gl.texParameteri(textureType, _gl.TEXTURE_MAG_FILTER, filterFallback(texture.magFilter)); - _gl.texParameteri(textureType, _gl.TEXTURE_MIN_FILTER, filterFallback(texture.minFilter)); - if (texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter) { - console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."); - } - } - if (texture.compareFunction) { - _gl.texParameteri(textureType, _gl.TEXTURE_COMPARE_MODE, _gl.COMPARE_REF_TO_TEXTURE); - _gl.texParameteri(textureType, _gl.TEXTURE_COMPARE_FUNC, compareToGL[texture.compareFunction]); - } - if (extensions.has("EXT_texture_filter_anisotropic") === true) { - const extension = extensions.get("EXT_texture_filter_anisotropic"); - if (texture.magFilter === NearestFilter) - return; - if (texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter) - return; - if (texture.type === FloatType && extensions.has("OES_texture_float_linear") === false) - return; - if (isWebGL2 === false && (texture.type === HalfFloatType && extensions.has("OES_texture_half_float_linear") === false)) - return; - if (texture.anisotropy > 1 || properties.get(texture).__currentAnisotropy) { - _gl.texParameterf(textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(texture.anisotropy, capabilities.getMaxAnisotropy())); - properties.get(texture).__currentAnisotropy = texture.anisotropy; - } - } - } - function initTexture(textureProperties, texture) { - let forceUpload = false; - if (textureProperties.__webglInit === void 0) { - textureProperties.__webglInit = true; - texture.addEventListener("dispose", onTextureDispose); - } - const source = texture.source; - let webglTextures = _sources.get(source); - if (webglTextures === void 0) { - webglTextures = {}; - _sources.set(source, webglTextures); - } - const textureCacheKey = getTextureCacheKey(texture); - if (textureCacheKey !== textureProperties.__cacheKey) { - if (webglTextures[textureCacheKey] === void 0) { - webglTextures[textureCacheKey] = { - texture: _gl.createTexture(), - usedTimes: 0 - }; - info.memory.textures++; - forceUpload = true; - } - webglTextures[textureCacheKey].usedTimes++; - const webglTexture = webglTextures[textureProperties.__cacheKey]; - if (webglTexture !== void 0) { - webglTextures[textureProperties.__cacheKey].usedTimes--; - if (webglTexture.usedTimes === 0) { - deleteTexture(texture); - } - } - textureProperties.__cacheKey = textureCacheKey; - textureProperties.__webglTexture = webglTextures[textureCacheKey].texture; - } - return forceUpload; - } - function uploadTexture(textureProperties, texture, slot) { - let textureType = _gl.TEXTURE_2D; - if (texture.isDataArrayTexture || texture.isCompressedArrayTexture) - textureType = _gl.TEXTURE_2D_ARRAY; - if (texture.isData3DTexture) - textureType = _gl.TEXTURE_3D; - const forceUpload = initTexture(textureProperties, texture); - const source = texture.source; - state.bindTexture(textureType, textureProperties.__webglTexture, _gl.TEXTURE0 + slot); - const sourceProperties = properties.get(source); - if (source.version !== sourceProperties.__version || forceUpload === true) { - state.activeTexture(_gl.TEXTURE0 + slot); - const workingPrimaries = ColorManagement.getPrimaries(ColorManagement.workingColorSpace); - const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries(texture.colorSpace); - const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL; - _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY); - _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha); - _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment); - _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion); - const needsPowerOfTwo = textureNeedsPowerOfTwo(texture) && isPowerOfTwo$1(texture.image) === false; - let image = resizeImage(texture.image, needsPowerOfTwo, false, maxTextureSize); - image = verifyColorSpace(texture, image); - const supportsMips = isPowerOfTwo$1(image) || isWebGL2, glFormat = utils.convert(texture.format, texture.colorSpace); - let glType = utils.convert(texture.type), glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture); - setTextureParameters(textureType, texture, supportsMips); - let mipmap; - const mipmaps = texture.mipmaps; - const useTexStorage = isWebGL2 && texture.isVideoTexture !== true; - const allocateMemory = sourceProperties.__version === void 0 || forceUpload === true; - const levels = getMipLevels(texture, image, supportsMips); - if (texture.isDepthTexture) { - glInternalFormat = _gl.DEPTH_COMPONENT; - if (isWebGL2) { - if (texture.type === FloatType) { - glInternalFormat = _gl.DEPTH_COMPONENT32F; - } else if (texture.type === UnsignedIntType) { - glInternalFormat = _gl.DEPTH_COMPONENT24; - } else if (texture.type === UnsignedInt248Type) { - glInternalFormat = _gl.DEPTH24_STENCIL8; - } else { - glInternalFormat = _gl.DEPTH_COMPONENT16; - } - } else { - if (texture.type === FloatType) { - console.error("WebGLRenderer: Floating point depth texture requires WebGL2."); - } - } - if (texture.format === DepthFormat && glInternalFormat === _gl.DEPTH_COMPONENT) { - if (texture.type !== UnsignedShortType && texture.type !== UnsignedIntType) { - console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."); - texture.type = UnsignedIntType; - glType = utils.convert(texture.type); - } - } - if (texture.format === DepthStencilFormat && glInternalFormat === _gl.DEPTH_COMPONENT) { - glInternalFormat = _gl.DEPTH_STENCIL; - if (texture.type !== UnsignedInt248Type) { - console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."); - texture.type = UnsignedInt248Type; - glType = utils.convert(texture.type); - } - } - if (allocateMemory) { - if (useTexStorage) { - state.texStorage2D(_gl.TEXTURE_2D, 1, glInternalFormat, image.width, image.height); - } else { - state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null); - } - } - } else if (texture.isDataTexture) { - if (mipmaps.length > 0 && supportsMips) { - if (useTexStorage && allocateMemory) { - state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height); - } - for (let i = 0, il = mipmaps.length; i < il; i++) { - mipmap = mipmaps[i]; - if (useTexStorage) { - state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data); - } else { - state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data); - } - } - texture.generateMipmaps = false; - } else { - if (useTexStorage) { - if (allocateMemory) { - state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height); - } - state.texSubImage2D(_gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data); - } else { - state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data); - } - } - } else if (texture.isCompressedTexture) { - if (texture.isCompressedArrayTexture) { - if (useTexStorage && allocateMemory) { - state.texStorage3D(_gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height, image.depth); - } - for (let i = 0, il = mipmaps.length; i < il; i++) { - mipmap = mipmaps[i]; - if (texture.format !== RGBAFormat) { - if (glFormat !== null) { - if (useTexStorage) { - state.compressedTexSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0); - } else { - state.compressedTexImage3D(_gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data, 0, 0); - } - } else { - console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"); - } - } else { - if (useTexStorage) { - state.texSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data); - } else { - state.texImage3D(_gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data); - } - } - } - } else { - if (useTexStorage && allocateMemory) { - state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height); - } - for (let i = 0, il = mipmaps.length; i < il; i++) { - mipmap = mipmaps[i]; - if (texture.format !== RGBAFormat) { - if (glFormat !== null) { - if (useTexStorage) { - state.compressedTexSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data); - } else { - state.compressedTexImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data); - } - } else { - console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"); - } - } else { - if (useTexStorage) { - state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data); - } else { - state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data); - } - } - } - } - } else if (texture.isDataArrayTexture) { - if (useTexStorage) { - if (allocateMemory) { - state.texStorage3D(_gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, image.width, image.height, image.depth); - } - state.texSubImage3D(_gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data); - } else { - state.texImage3D(_gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data); - } - } else if (texture.isData3DTexture) { - if (useTexStorage) { - if (allocateMemory) { - state.texStorage3D(_gl.TEXTURE_3D, levels, glInternalFormat, image.width, image.height, image.depth); - } - state.texSubImage3D(_gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data); - } else { - state.texImage3D(_gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data); - } - } else if (texture.isFramebufferTexture) { - if (allocateMemory) { - if (useTexStorage) { - state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height); - } else { - let width = image.width, height = image.height; - for (let i = 0; i < levels; i++) { - state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, width, height, 0, glFormat, glType, null); - width >>= 1; - height >>= 1; - } - } - } - } else { - if (mipmaps.length > 0 && supportsMips) { - if (useTexStorage && allocateMemory) { - state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height); - } - for (let i = 0, il = mipmaps.length; i < il; i++) { - mipmap = mipmaps[i]; - if (useTexStorage) { - state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, glFormat, glType, mipmap); - } else { - state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, glFormat, glType, mipmap); - } - } - texture.generateMipmaps = false; - } else { - if (useTexStorage) { - if (allocateMemory) { - state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height); - } - state.texSubImage2D(_gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image); - } else { - state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, glFormat, glType, image); - } - } - } - if (textureNeedsGenerateMipmaps(texture, supportsMips)) { - generateMipmap(textureType); - } - sourceProperties.__version = source.version; - if (texture.onUpdate) - texture.onUpdate(texture); - } - textureProperties.__version = texture.version; - } - function uploadCubeTexture(textureProperties, texture, slot) { - if (texture.image.length !== 6) - return; - const forceUpload = initTexture(textureProperties, texture); - const source = texture.source; - state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot); - const sourceProperties = properties.get(source); - if (source.version !== sourceProperties.__version || forceUpload === true) { - state.activeTexture(_gl.TEXTURE0 + slot); - const workingPrimaries = ColorManagement.getPrimaries(ColorManagement.workingColorSpace); - const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries(texture.colorSpace); - const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL; - _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY); - _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha); - _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment); - _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion); - const isCompressed = texture.isCompressedTexture || texture.image[0].isCompressedTexture; - const isDataTexture = texture.image[0] && texture.image[0].isDataTexture; - const cubeImage = []; - for (let i = 0; i < 6; i++) { - if (!isCompressed && !isDataTexture) { - cubeImage[i] = resizeImage(texture.image[i], false, true, maxCubemapSize); - } else { - cubeImage[i] = isDataTexture ? texture.image[i].image : texture.image[i]; - } - cubeImage[i] = verifyColorSpace(texture, cubeImage[i]); - } - const image = cubeImage[0], supportsMips = isPowerOfTwo$1(image) || isWebGL2, glFormat = utils.convert(texture.format, texture.colorSpace), glType = utils.convert(texture.type), glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace); - const useTexStorage = isWebGL2 && texture.isVideoTexture !== true; - const allocateMemory = sourceProperties.__version === void 0 || forceUpload === true; - let levels = getMipLevels(texture, image, supportsMips); - setTextureParameters(_gl.TEXTURE_CUBE_MAP, texture, supportsMips); - let mipmaps; - if (isCompressed) { - if (useTexStorage && allocateMemory) { - state.texStorage2D(_gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, image.width, image.height); - } - for (let i = 0; i < 6; i++) { - mipmaps = cubeImage[i].mipmaps; - for (let j = 0; j < mipmaps.length; j++) { - const mipmap = mipmaps[j]; - if (texture.format !== RGBAFormat) { - if (glFormat !== null) { - if (useTexStorage) { - state.compressedTexSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data); - } else { - state.compressedTexImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data); - } - } else { - console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"); - } - } else { - if (useTexStorage) { - state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data); - } else { - state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data); - } - } - } - } - } else { - mipmaps = texture.mipmaps; - if (useTexStorage && allocateMemory) { - if (mipmaps.length > 0) - levels++; - state.texStorage2D(_gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, cubeImage[0].width, cubeImage[0].height); - } - for (let i = 0; i < 6; i++) { - if (isDataTexture) { - if (useTexStorage) { - state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, cubeImage[i].width, cubeImage[i].height, glFormat, glType, cubeImage[i].data); - } else { - state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, cubeImage[i].width, cubeImage[i].height, 0, glFormat, glType, cubeImage[i].data); - } - for (let j = 0; j < mipmaps.length; j++) { - const mipmap = mipmaps[j]; - const mipmapImage = mipmap.image[i].image; - if (useTexStorage) { - state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data); - } else { - state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data); - } - } - } else { - if (useTexStorage) { - state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, glFormat, glType, cubeImage[i]); - } else { - state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, glFormat, glType, cubeImage[i]); - } - for (let j = 0; j < mipmaps.length; j++) { - const mipmap = mipmaps[j]; - if (useTexStorage) { - state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, glFormat, glType, mipmap.image[i]); - } else { - state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[i]); - } - } - } - } - } - if (textureNeedsGenerateMipmaps(texture, supportsMips)) { - generateMipmap(_gl.TEXTURE_CUBE_MAP); - } - sourceProperties.__version = source.version; - if (texture.onUpdate) - texture.onUpdate(texture); - } - textureProperties.__version = texture.version; - } - function setupFrameBufferTexture(framebuffer, renderTarget, texture, attachment, textureTarget, level) { - const glFormat = utils.convert(texture.format, texture.colorSpace); - const glType = utils.convert(texture.type); - const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace); - const renderTargetProperties = properties.get(renderTarget); - if (!renderTargetProperties.__hasExternalTextures) { - const width = Math.max(1, renderTarget.width >> level); - const height = Math.max(1, renderTarget.height >> level); - if (textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY) { - state.texImage3D(textureTarget, level, glInternalFormat, width, height, renderTarget.depth, 0, glFormat, glType, null); - } else { - state.texImage2D(textureTarget, level, glInternalFormat, width, height, 0, glFormat, glType, null); - } - } - state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer); - if (useMultisampledRTT(renderTarget)) { - multisampledRTTExt.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER, attachment, textureTarget, properties.get(texture).__webglTexture, 0, getRenderTargetSamples(renderTarget)); - } else if (textureTarget === _gl.TEXTURE_2D || textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z) { - _gl.framebufferTexture2D(_gl.FRAMEBUFFER, attachment, textureTarget, properties.get(texture).__webglTexture, level); - } - state.bindFramebuffer(_gl.FRAMEBUFFER, null); - } - function setupRenderBufferStorage(renderbuffer, renderTarget, isMultisample) { - _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderbuffer); - if (renderTarget.depthBuffer && !renderTarget.stencilBuffer) { - let glInternalFormat = isWebGL2 === true ? _gl.DEPTH_COMPONENT24 : _gl.DEPTH_COMPONENT16; - if (isMultisample || useMultisampledRTT(renderTarget)) { - const depthTexture = renderTarget.depthTexture; - if (depthTexture && depthTexture.isDepthTexture) { - if (depthTexture.type === FloatType) { - glInternalFormat = _gl.DEPTH_COMPONENT32F; - } else if (depthTexture.type === UnsignedIntType) { - glInternalFormat = _gl.DEPTH_COMPONENT24; - } - } - const samples = getRenderTargetSamples(renderTarget); - if (useMultisampledRTT(renderTarget)) { - multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height); - } else { - _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height); - } - } else { - _gl.renderbufferStorage(_gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height); - } - _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer); - } else if (renderTarget.depthBuffer && renderTarget.stencilBuffer) { - const samples = getRenderTargetSamples(renderTarget); - if (isMultisample && useMultisampledRTT(renderTarget) === false) { - _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height); - } else if (useMultisampledRTT(renderTarget)) { - multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height); - } else { - _gl.renderbufferStorage(_gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height); - } - _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer); - } else { - const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [renderTarget.texture]; - for (let i = 0; i < textures.length; i++) { - const texture = textures[i]; - const glFormat = utils.convert(texture.format, texture.colorSpace); - const glType = utils.convert(texture.type); - const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace); - const samples = getRenderTargetSamples(renderTarget); - if (isMultisample && useMultisampledRTT(renderTarget) === false) { - _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height); - } else if (useMultisampledRTT(renderTarget)) { - multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height); - } else { - _gl.renderbufferStorage(_gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height); - } - } - } - _gl.bindRenderbuffer(_gl.RENDERBUFFER, null); - } - function setupDepthTexture(framebuffer, renderTarget) { - const isCube = renderTarget && renderTarget.isWebGLCubeRenderTarget; - if (isCube) - throw new Error("Depth Texture with cube render targets is not supported"); - state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer); - if (!(renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture)) { - throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture"); - } - if (!properties.get(renderTarget.depthTexture).__webglTexture || renderTarget.depthTexture.image.width !== renderTarget.width || renderTarget.depthTexture.image.height !== renderTarget.height) { - renderTarget.depthTexture.image.width = renderTarget.width; - renderTarget.depthTexture.image.height = renderTarget.height; - renderTarget.depthTexture.needsUpdate = true; - } - setTexture2D(renderTarget.depthTexture, 0); - const webglDepthTexture = properties.get(renderTarget.depthTexture).__webglTexture; - const samples = getRenderTargetSamples(renderTarget); - if (renderTarget.depthTexture.format === DepthFormat) { - if (useMultisampledRTT(renderTarget)) { - multisampledRTTExt.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples); - } else { - _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0); - } - } else if (renderTarget.depthTexture.format === DepthStencilFormat) { - if (useMultisampledRTT(renderTarget)) { - multisampledRTTExt.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples); - } else { - _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0); - } - } else { - throw new Error("Unknown depthTexture format"); - } - } - function setupDepthRenderbuffer(renderTarget) { - const renderTargetProperties = properties.get(renderTarget); - const isCube = renderTarget.isWebGLCubeRenderTarget === true; - if (renderTarget.depthTexture && !renderTargetProperties.__autoAllocateDepthBuffer) { - if (isCube) - throw new Error("target.depthTexture not supported in Cube render targets"); - setupDepthTexture(renderTargetProperties.__webglFramebuffer, renderTarget); - } else { - if (isCube) { - renderTargetProperties.__webglDepthbuffer = []; - for (let i = 0; i < 6; i++) { - state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[i]); - renderTargetProperties.__webglDepthbuffer[i] = _gl.createRenderbuffer(); - setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer[i], renderTarget, false); - } - } else { - state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer); - renderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer(); - setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer, renderTarget, false); - } - } - state.bindFramebuffer(_gl.FRAMEBUFFER, null); - } - function rebindTextures(renderTarget, colorTexture, depthTexture) { - const renderTargetProperties = properties.get(renderTarget); - if (colorTexture !== void 0) { - setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, 0); - } - if (depthTexture !== void 0) { - setupDepthRenderbuffer(renderTarget); - } - } - function setupRenderTarget(renderTarget) { - const texture = renderTarget.texture; - const renderTargetProperties = properties.get(renderTarget); - const textureProperties = properties.get(texture); - renderTarget.addEventListener("dispose", onRenderTargetDispose); - if (renderTarget.isWebGLMultipleRenderTargets !== true) { - if (textureProperties.__webglTexture === void 0) { - textureProperties.__webglTexture = _gl.createTexture(); - } - textureProperties.__version = texture.version; - info.memory.textures++; - } - const isCube = renderTarget.isWebGLCubeRenderTarget === true; - const isMultipleRenderTargets = renderTarget.isWebGLMultipleRenderTargets === true; - const supportsMips = isPowerOfTwo$1(renderTarget) || isWebGL2; - if (isCube) { - renderTargetProperties.__webglFramebuffer = []; - for (let i = 0; i < 6; i++) { - if (isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0) { - renderTargetProperties.__webglFramebuffer[i] = []; - for (let level = 0; level < texture.mipmaps.length; level++) { - renderTargetProperties.__webglFramebuffer[i][level] = _gl.createFramebuffer(); - } - } else { - renderTargetProperties.__webglFramebuffer[i] = _gl.createFramebuffer(); - } - } - } else { - if (isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0) { - renderTargetProperties.__webglFramebuffer = []; - for (let level = 0; level < texture.mipmaps.length; level++) { - renderTargetProperties.__webglFramebuffer[level] = _gl.createFramebuffer(); - } - } else { - renderTargetProperties.__webglFramebuffer = _gl.createFramebuffer(); - } - if (isMultipleRenderTargets) { - if (capabilities.drawBuffers) { - const textures = renderTarget.texture; - for (let i = 0, il = textures.length; i < il; i++) { - const attachmentProperties = properties.get(textures[i]); - if (attachmentProperties.__webglTexture === void 0) { - attachmentProperties.__webglTexture = _gl.createTexture(); - info.memory.textures++; - } - } - } else { - console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension."); - } - } - if (isWebGL2 && renderTarget.samples > 0 && useMultisampledRTT(renderTarget) === false) { - const textures = isMultipleRenderTargets ? texture : [texture]; - renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer(); - renderTargetProperties.__webglColorRenderbuffer = []; - state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer); - for (let i = 0; i < textures.length; i++) { - const texture2 = textures[i]; - renderTargetProperties.__webglColorRenderbuffer[i] = _gl.createRenderbuffer(); - _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]); - const glFormat = utils.convert(texture2.format, texture2.colorSpace); - const glType = utils.convert(texture2.type); - const glInternalFormat = getInternalFormat(texture2.internalFormat, glFormat, glType, texture2.colorSpace, renderTarget.isXRRenderTarget === true); - const samples = getRenderTargetSamples(renderTarget); - _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height); - _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]); - } - _gl.bindRenderbuffer(_gl.RENDERBUFFER, null); - if (renderTarget.depthBuffer) { - renderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer(); - setupRenderBufferStorage(renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true); - } - state.bindFramebuffer(_gl.FRAMEBUFFER, null); - } - } - if (isCube) { - state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture); - setTextureParameters(_gl.TEXTURE_CUBE_MAP, texture, supportsMips); - for (let i = 0; i < 6; i++) { - if (isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0) { - for (let level = 0; level < texture.mipmaps.length; level++) { - setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[i][level], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level); - } - } else { - setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[i], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0); - } - } - if (textureNeedsGenerateMipmaps(texture, supportsMips)) { - generateMipmap(_gl.TEXTURE_CUBE_MAP); - } - state.unbindTexture(); - } else if (isMultipleRenderTargets) { - const textures = renderTarget.texture; - for (let i = 0, il = textures.length; i < il; i++) { - const attachment = textures[i]; - const attachmentProperties = properties.get(attachment); - state.bindTexture(_gl.TEXTURE_2D, attachmentProperties.__webglTexture); - setTextureParameters(_gl.TEXTURE_2D, attachment, supportsMips); - setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0); - if (textureNeedsGenerateMipmaps(attachment, supportsMips)) { - generateMipmap(_gl.TEXTURE_2D); - } - } - state.unbindTexture(); - } else { - let glTextureType = _gl.TEXTURE_2D; - if (renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget) { - if (isWebGL2) { - glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY; - } else { - console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2."); - } - } - state.bindTexture(glTextureType, textureProperties.__webglTexture); - setTextureParameters(glTextureType, texture, supportsMips); - if (isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0) { - for (let level = 0; level < texture.mipmaps.length; level++) { - setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[level], renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, level); - } - } else { - setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, 0); - } - if (textureNeedsGenerateMipmaps(texture, supportsMips)) { - generateMipmap(glTextureType); - } - state.unbindTexture(); - } - if (renderTarget.depthBuffer) { - setupDepthRenderbuffer(renderTarget); - } - } - function updateRenderTargetMipmap(renderTarget) { - const supportsMips = isPowerOfTwo$1(renderTarget) || isWebGL2; - const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [renderTarget.texture]; - for (let i = 0, il = textures.length; i < il; i++) { - const texture = textures[i]; - if (textureNeedsGenerateMipmaps(texture, supportsMips)) { - const target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D; - const webglTexture = properties.get(texture).__webglTexture; - state.bindTexture(target, webglTexture); - generateMipmap(target); - state.unbindTexture(); - } - } - } - function updateMultisampleRenderTarget(renderTarget) { - if (isWebGL2 && renderTarget.samples > 0 && useMultisampledRTT(renderTarget) === false) { - const textures = renderTarget.isWebGLMultipleRenderTargets ? renderTarget.texture : [renderTarget.texture]; - const width = renderTarget.width; - const height = renderTarget.height; - let mask = _gl.COLOR_BUFFER_BIT; - const invalidationArray = []; - const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT; - const renderTargetProperties = properties.get(renderTarget); - const isMultipleRenderTargets = renderTarget.isWebGLMultipleRenderTargets === true; - if (isMultipleRenderTargets) { - for (let i = 0; i < textures.length; i++) { - state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer); - _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, null); - state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer); - _gl.framebufferTexture2D(_gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, null, 0); - } - } - state.bindFramebuffer(_gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer); - state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer); - for (let i = 0; i < textures.length; i++) { - invalidationArray.push(_gl.COLOR_ATTACHMENT0 + i); - if (renderTarget.depthBuffer) { - invalidationArray.push(depthStyle); - } - const ignoreDepthValues = renderTargetProperties.__ignoreDepthValues !== void 0 ? renderTargetProperties.__ignoreDepthValues : false; - if (ignoreDepthValues === false) { - if (renderTarget.depthBuffer) - mask |= _gl.DEPTH_BUFFER_BIT; - if (renderTarget.stencilBuffer) - mask |= _gl.STENCIL_BUFFER_BIT; - } - if (isMultipleRenderTargets) { - _gl.framebufferRenderbuffer(_gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]); - } - if (ignoreDepthValues === true) { - _gl.invalidateFramebuffer(_gl.READ_FRAMEBUFFER, [depthStyle]); - _gl.invalidateFramebuffer(_gl.DRAW_FRAMEBUFFER, [depthStyle]); - } - if (isMultipleRenderTargets) { - const webglTexture = properties.get(textures[i]).__webglTexture; - _gl.framebufferTexture2D(_gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0); - } - _gl.blitFramebuffer(0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST); - if (supportsInvalidateFramebuffer) { - _gl.invalidateFramebuffer(_gl.READ_FRAMEBUFFER, invalidationArray); - } - } - state.bindFramebuffer(_gl.READ_FRAMEBUFFER, null); - state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, null); - if (isMultipleRenderTargets) { - for (let i = 0; i < textures.length; i++) { - state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer); - _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]); - const webglTexture = properties.get(textures[i]).__webglTexture; - state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer); - _gl.framebufferTexture2D(_gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, webglTexture, 0); - } - } - state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer); - } - } - function getRenderTargetSamples(renderTarget) { - return Math.min(maxSamples, renderTarget.samples); - } - function useMultisampledRTT(renderTarget) { - const renderTargetProperties = properties.get(renderTarget); - return isWebGL2 && renderTarget.samples > 0 && extensions.has("WEBGL_multisampled_render_to_texture") === true && renderTargetProperties.__useRenderToTexture !== false; - } - function updateVideoTexture(texture) { - const frame = info.render.frame; - if (_videoTextures.get(texture) !== frame) { - _videoTextures.set(texture, frame); - texture.update(); - } - } - function verifyColorSpace(texture, image) { - const colorSpace = texture.colorSpace; - const format = texture.format; - const type = texture.type; - if (texture.isCompressedTexture === true || texture.isVideoTexture === true || texture.format === _SRGBAFormat) - return image; - if (colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace) { - if (ColorManagement.getTransfer(colorSpace) === SRGBTransfer) { - if (isWebGL2 === false) { - if (extensions.has("EXT_sRGB") === true && format === RGBAFormat) { - texture.format = _SRGBAFormat; - texture.minFilter = LinearFilter; - texture.generateMipmaps = false; - } else { - image = ImageUtils.sRGBToLinear(image); - } - } else { - if (format !== RGBAFormat || type !== UnsignedByteType) { - console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."); - } - } - } else { - console.error("THREE.WebGLTextures: Unsupported texture color space:", colorSpace); - } - } - return image; - } - this.allocateTextureUnit = allocateTextureUnit; - this.resetTextureUnits = resetTextureUnits; - this.setTexture2D = setTexture2D; - this.setTexture2DArray = setTexture2DArray; - this.setTexture3D = setTexture3D; - this.setTextureCube = setTextureCube; - this.rebindTextures = rebindTextures; - this.setupRenderTarget = setupRenderTarget; - this.updateRenderTargetMipmap = updateRenderTargetMipmap; - this.updateMultisampleRenderTarget = updateMultisampleRenderTarget; - this.setupDepthRenderbuffer = setupDepthRenderbuffer; - this.setupFrameBufferTexture = setupFrameBufferTexture; - this.useMultisampledRTT = useMultisampledRTT; -} -function WebGLUtils(gl, extensions, capabilities) { - const isWebGL2 = capabilities.isWebGL2; - function convert(p, colorSpace = NoColorSpace) { - let extension; - const transfer = ColorManagement.getTransfer(colorSpace); - if (p === UnsignedByteType) - return gl.UNSIGNED_BYTE; - if (p === UnsignedShort4444Type) - return gl.UNSIGNED_SHORT_4_4_4_4; - if (p === UnsignedShort5551Type) - return gl.UNSIGNED_SHORT_5_5_5_1; - if (p === ByteType) - return gl.BYTE; - if (p === ShortType) - return gl.SHORT; - if (p === UnsignedShortType) - return gl.UNSIGNED_SHORT; - if (p === IntType) - return gl.INT; - if (p === UnsignedIntType) - return gl.UNSIGNED_INT; - if (p === FloatType) - return gl.FLOAT; - if (p === HalfFloatType) { - if (isWebGL2) - return gl.HALF_FLOAT; - extension = extensions.get("OES_texture_half_float"); - if (extension !== null) { - return extension.HALF_FLOAT_OES; - } else { - return null; - } - } - if (p === AlphaFormat) - return gl.ALPHA; - if (p === RGBAFormat) - return gl.RGBA; - if (p === LuminanceFormat) - return gl.LUMINANCE; - if (p === LuminanceAlphaFormat) - return gl.LUMINANCE_ALPHA; - if (p === DepthFormat) - return gl.DEPTH_COMPONENT; - if (p === DepthStencilFormat) - return gl.DEPTH_STENCIL; - if (p === _SRGBAFormat) { - extension = extensions.get("EXT_sRGB"); - if (extension !== null) { - return extension.SRGB_ALPHA_EXT; - } else { - return null; - } - } - if (p === RedFormat) - return gl.RED; - if (p === RedIntegerFormat) - return gl.RED_INTEGER; - if (p === RGFormat) - return gl.RG; - if (p === RGIntegerFormat) - return gl.RG_INTEGER; - if (p === RGBAIntegerFormat) - return gl.RGBA_INTEGER; - if (p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format) { - if (transfer === SRGBTransfer) { - extension = extensions.get("WEBGL_compressed_texture_s3tc_srgb"); - if (extension !== null) { - if (p === RGB_S3TC_DXT1_Format) - return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT; - if (p === RGBA_S3TC_DXT1_Format) - return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; - if (p === RGBA_S3TC_DXT3_Format) - return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; - if (p === RGBA_S3TC_DXT5_Format) - return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; - } else { - return null; - } - } else { - extension = extensions.get("WEBGL_compressed_texture_s3tc"); - if (extension !== null) { - if (p === RGB_S3TC_DXT1_Format) - return extension.COMPRESSED_RGB_S3TC_DXT1_EXT; - if (p === RGBA_S3TC_DXT1_Format) - return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT; - if (p === RGBA_S3TC_DXT3_Format) - return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT; - if (p === RGBA_S3TC_DXT5_Format) - return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT; - } else { - return null; - } - } - } - if (p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format || p === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format) { - extension = extensions.get("WEBGL_compressed_texture_pvrtc"); - if (extension !== null) { - if (p === RGB_PVRTC_4BPPV1_Format) - return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; - if (p === RGB_PVRTC_2BPPV1_Format) - return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; - if (p === RGBA_PVRTC_4BPPV1_Format) - return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; - if (p === RGBA_PVRTC_2BPPV1_Format) - return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; - } else { - return null; - } - } - if (p === RGB_ETC1_Format) { - extension = extensions.get("WEBGL_compressed_texture_etc1"); - if (extension !== null) { - return extension.COMPRESSED_RGB_ETC1_WEBGL; - } else { - return null; - } - } - if (p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format) { - extension = extensions.get("WEBGL_compressed_texture_etc"); - if (extension !== null) { - if (p === RGB_ETC2_Format) - return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2; - if (p === RGBA_ETC2_EAC_Format) - return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC; - } else { - return null; - } - } - if (p === RGBA_ASTC_4x4_Format || p === RGBA_ASTC_5x4_Format || p === RGBA_ASTC_5x5_Format || p === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format || p === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format || p === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format || p === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format) { - extension = extensions.get("WEBGL_compressed_texture_astc"); - if (extension !== null) { - if (p === RGBA_ASTC_4x4_Format) - return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR; - if (p === RGBA_ASTC_5x4_Format) - return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR; - if (p === RGBA_ASTC_5x5_Format) - return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR; - if (p === RGBA_ASTC_6x5_Format) - return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR; - if (p === RGBA_ASTC_6x6_Format) - return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR; - if (p === RGBA_ASTC_8x5_Format) - return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR; - if (p === RGBA_ASTC_8x6_Format) - return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR; - if (p === RGBA_ASTC_8x8_Format) - return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR; - if (p === RGBA_ASTC_10x5_Format) - return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR; - if (p === RGBA_ASTC_10x6_Format) - return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR; - if (p === RGBA_ASTC_10x8_Format) - return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR; - if (p === RGBA_ASTC_10x10_Format) - return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR; - if (p === RGBA_ASTC_12x10_Format) - return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR; - if (p === RGBA_ASTC_12x12_Format) - return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR; - } else { - return null; - } - } - if (p === RGBA_BPTC_Format || p === RGB_BPTC_SIGNED_Format || p === RGB_BPTC_UNSIGNED_Format) { - extension = extensions.get("EXT_texture_compression_bptc"); - if (extension !== null) { - if (p === RGBA_BPTC_Format) - return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT; - if (p === RGB_BPTC_SIGNED_Format) - return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT; - if (p === RGB_BPTC_UNSIGNED_Format) - return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT; - } else { - return null; - } - } - if (p === RED_RGTC1_Format || p === SIGNED_RED_RGTC1_Format || p === RED_GREEN_RGTC2_Format || p === SIGNED_RED_GREEN_RGTC2_Format) { - extension = extensions.get("EXT_texture_compression_rgtc"); - if (extension !== null) { - if (p === RGBA_BPTC_Format) - return extension.COMPRESSED_RED_RGTC1_EXT; - if (p === SIGNED_RED_RGTC1_Format) - return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT; - if (p === RED_GREEN_RGTC2_Format) - return extension.COMPRESSED_RED_GREEN_RGTC2_EXT; - if (p === SIGNED_RED_GREEN_RGTC2_Format) - return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT; - } else { - return null; - } - } - if (p === UnsignedInt248Type) { - if (isWebGL2) - return gl.UNSIGNED_INT_24_8; - extension = extensions.get("WEBGL_depth_texture"); - if (extension !== null) { - return extension.UNSIGNED_INT_24_8_WEBGL; - } else { - return null; - } - } - return gl[p] !== void 0 ? gl[p] : null; - } - return { convert }; -} -var ArrayCamera = class extends PerspectiveCamera { - constructor(array = []) { - super(); - this.isArrayCamera = true; - this.cameras = array; - } -}; -var Group = class extends Object3D { - constructor() { - super(); - this.isGroup = true; - this.type = "Group"; - } -}; -var _moveEvent = { type: "move" }; -var WebXRController = class { - constructor() { - this._targetRay = null; - this._grip = null; - this._hand = null; - } - getHandSpace() { - if (this._hand === null) { - this._hand = new Group(); - this._hand.matrixAutoUpdate = false; - this._hand.visible = false; - this._hand.joints = {}; - this._hand.inputState = { pinching: false }; - } - return this._hand; - } - getTargetRaySpace() { - if (this._targetRay === null) { - this._targetRay = new Group(); - this._targetRay.matrixAutoUpdate = false; - this._targetRay.visible = false; - this._targetRay.hasLinearVelocity = false; - this._targetRay.linearVelocity = new Vector3(); - this._targetRay.hasAngularVelocity = false; - this._targetRay.angularVelocity = new Vector3(); - } - return this._targetRay; - } - getGripSpace() { - if (this._grip === null) { - this._grip = new Group(); - this._grip.matrixAutoUpdate = false; - this._grip.visible = false; - this._grip.hasLinearVelocity = false; - this._grip.linearVelocity = new Vector3(); - this._grip.hasAngularVelocity = false; - this._grip.angularVelocity = new Vector3(); - } - return this._grip; - } - dispatchEvent(event) { - if (this._targetRay !== null) { - this._targetRay.dispatchEvent(event); - } - if (this._grip !== null) { - this._grip.dispatchEvent(event); - } - if (this._hand !== null) { - this._hand.dispatchEvent(event); - } - return this; - } - connect(inputSource) { - if (inputSource && inputSource.hand) { - const hand = this._hand; - if (hand) { - for (const inputjoint of inputSource.hand.values()) { - this._getHandJoint(hand, inputjoint); - } - } - } - this.dispatchEvent({ type: "connected", data: inputSource }); - return this; - } - disconnect(inputSource) { - this.dispatchEvent({ type: "disconnected", data: inputSource }); - if (this._targetRay !== null) { - this._targetRay.visible = false; - } - if (this._grip !== null) { - this._grip.visible = false; - } - if (this._hand !== null) { - this._hand.visible = false; - } - return this; - } - update(inputSource, frame, referenceSpace) { - let inputPose = null; - let gripPose = null; - let handPose = null; - const targetRay = this._targetRay; - const grip = this._grip; - const hand = this._hand; - if (inputSource && frame.session.visibilityState !== "visible-blurred") { - if (hand && inputSource.hand) { - handPose = true; - for (const inputjoint of inputSource.hand.values()) { - const jointPose = frame.getJointPose(inputjoint, referenceSpace); - const joint = this._getHandJoint(hand, inputjoint); - if (jointPose !== null) { - joint.matrix.fromArray(jointPose.transform.matrix); - joint.matrix.decompose(joint.position, joint.rotation, joint.scale); - joint.matrixWorldNeedsUpdate = true; - joint.jointRadius = jointPose.radius; - } - joint.visible = jointPose !== null; - } - const indexTip = hand.joints["index-finger-tip"]; - const thumbTip = hand.joints["thumb-tip"]; - const distance = indexTip.position.distanceTo(thumbTip.position); - const distanceToPinch = 0.02; - const threshold = 5e-3; - if (hand.inputState.pinching && distance > distanceToPinch + threshold) { - hand.inputState.pinching = false; - this.dispatchEvent({ - type: "pinchend", - handedness: inputSource.handedness, - target: this - }); - } else if (!hand.inputState.pinching && distance <= distanceToPinch - threshold) { - hand.inputState.pinching = true; - this.dispatchEvent({ - type: "pinchstart", - handedness: inputSource.handedness, - target: this - }); - } - } else { - if (grip !== null && inputSource.gripSpace) { - gripPose = frame.getPose(inputSource.gripSpace, referenceSpace); - if (gripPose !== null) { - grip.matrix.fromArray(gripPose.transform.matrix); - grip.matrix.decompose(grip.position, grip.rotation, grip.scale); - grip.matrixWorldNeedsUpdate = true; - if (gripPose.linearVelocity) { - grip.hasLinearVelocity = true; - grip.linearVelocity.copy(gripPose.linearVelocity); - } else { - grip.hasLinearVelocity = false; - } - if (gripPose.angularVelocity) { - grip.hasAngularVelocity = true; - grip.angularVelocity.copy(gripPose.angularVelocity); - } else { - grip.hasAngularVelocity = false; - } - } - } - } - if (targetRay !== null) { - inputPose = frame.getPose(inputSource.targetRaySpace, referenceSpace); - if (inputPose === null && gripPose !== null) { - inputPose = gripPose; - } - if (inputPose !== null) { - targetRay.matrix.fromArray(inputPose.transform.matrix); - targetRay.matrix.decompose(targetRay.position, targetRay.rotation, targetRay.scale); - targetRay.matrixWorldNeedsUpdate = true; - if (inputPose.linearVelocity) { - targetRay.hasLinearVelocity = true; - targetRay.linearVelocity.copy(inputPose.linearVelocity); - } else { - targetRay.hasLinearVelocity = false; - } - if (inputPose.angularVelocity) { - targetRay.hasAngularVelocity = true; - targetRay.angularVelocity.copy(inputPose.angularVelocity); - } else { - targetRay.hasAngularVelocity = false; - } - this.dispatchEvent(_moveEvent); - } - } - } - if (targetRay !== null) { - targetRay.visible = inputPose !== null; - } - if (grip !== null) { - grip.visible = gripPose !== null; - } - if (hand !== null) { - hand.visible = handPose !== null; - } - return this; - } - // private method - _getHandJoint(hand, inputjoint) { - if (hand.joints[inputjoint.jointName] === void 0) { - const joint = new Group(); - joint.matrixAutoUpdate = false; - joint.visible = false; - hand.joints[inputjoint.jointName] = joint; - hand.add(joint); - } - return hand.joints[inputjoint.jointName]; - } -}; -var DepthTexture = class extends Texture { - constructor(width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format) { - format = format !== void 0 ? format : DepthFormat; - if (format !== DepthFormat && format !== DepthStencilFormat) { - throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat"); - } - if (type === void 0 && format === DepthFormat) - type = UnsignedIntType; - if (type === void 0 && format === DepthStencilFormat) - type = UnsignedInt248Type; - super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy); - this.isDepthTexture = true; - this.image = { width, height }; - this.magFilter = magFilter !== void 0 ? magFilter : NearestFilter; - this.minFilter = minFilter !== void 0 ? minFilter : NearestFilter; - this.flipY = false; - this.generateMipmaps = false; - this.compareFunction = null; - } - copy(source) { - super.copy(source); - this.compareFunction = source.compareFunction; - return this; - } - toJSON(meta) { - const data = super.toJSON(meta); - if (this.compareFunction !== null) - data.compareFunction = this.compareFunction; - return data; - } -}; -var WebXRManager = class extends EventDispatcher { - constructor(renderer, gl) { - super(); - const scope = this; - let session = null; - let framebufferScaleFactor = 1; - let referenceSpace = null; - let referenceSpaceType = "local-floor"; - let foveation = 1; - let customReferenceSpace = null; - let pose = null; - let glBinding = null; - let glProjLayer = null; - let glBaseLayer = null; - let xrFrame = null; - const attributes = gl.getContextAttributes(); - let initialRenderTarget = null; - let newRenderTarget = null; - const controllers = []; - const controllerInputSources = []; - const cameraL = new PerspectiveCamera(); - cameraL.layers.enable(1); - cameraL.viewport = new Vector4(); - const cameraR = new PerspectiveCamera(); - cameraR.layers.enable(2); - cameraR.viewport = new Vector4(); - const cameras = [cameraL, cameraR]; - const cameraXR = new ArrayCamera(); - cameraXR.layers.enable(1); - cameraXR.layers.enable(2); - let _currentDepthNear = null; - let _currentDepthFar = null; - this.cameraAutoUpdate = true; - this.enabled = false; - this.isPresenting = false; - this.getController = function(index) { - let controller = controllers[index]; - if (controller === void 0) { - controller = new WebXRController(); - controllers[index] = controller; - } - return controller.getTargetRaySpace(); - }; - this.getControllerGrip = function(index) { - let controller = controllers[index]; - if (controller === void 0) { - controller = new WebXRController(); - controllers[index] = controller; - } - return controller.getGripSpace(); - }; - this.getHand = function(index) { - let controller = controllers[index]; - if (controller === void 0) { - controller = new WebXRController(); - controllers[index] = controller; - } - return controller.getHandSpace(); - }; - function onSessionEvent(event) { - const controllerIndex = controllerInputSources.indexOf(event.inputSource); - if (controllerIndex === -1) { - return; - } - const controller = controllers[controllerIndex]; - if (controller !== void 0) { - controller.update(event.inputSource, event.frame, customReferenceSpace || referenceSpace); - controller.dispatchEvent({ type: event.type, data: event.inputSource }); - } - } - function onSessionEnd() { - session.removeEventListener("select", onSessionEvent); - session.removeEventListener("selectstart", onSessionEvent); - session.removeEventListener("selectend", onSessionEvent); - session.removeEventListener("squeeze", onSessionEvent); - session.removeEventListener("squeezestart", onSessionEvent); - session.removeEventListener("squeezeend", onSessionEvent); - session.removeEventListener("end", onSessionEnd); - session.removeEventListener("inputsourceschange", onInputSourcesChange); - for (let i = 0; i < controllers.length; i++) { - const inputSource = controllerInputSources[i]; - if (inputSource === null) - continue; - controllerInputSources[i] = null; - controllers[i].disconnect(inputSource); - } - _currentDepthNear = null; - _currentDepthFar = null; - renderer.setRenderTarget(initialRenderTarget); - glBaseLayer = null; - glProjLayer = null; - glBinding = null; - session = null; - newRenderTarget = null; - animation.stop(); - scope.isPresenting = false; - scope.dispatchEvent({ type: "sessionend" }); - } - this.setFramebufferScaleFactor = function(value) { - framebufferScaleFactor = value; - if (scope.isPresenting === true) { - console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting."); - } - }; - this.setReferenceSpaceType = function(value) { - referenceSpaceType = value; - if (scope.isPresenting === true) { - console.warn("THREE.WebXRManager: Cannot change reference space type while presenting."); - } - }; - this.getReferenceSpace = function() { - return customReferenceSpace || referenceSpace; - }; - this.setReferenceSpace = function(space) { - customReferenceSpace = space; - }; - this.getBaseLayer = function() { - return glProjLayer !== null ? glProjLayer : glBaseLayer; - }; - this.getBinding = function() { - return glBinding; - }; - this.getFrame = function() { - return xrFrame; - }; - this.getSession = function() { - return session; - }; - this.setSession = async function(value) { - session = value; - if (session !== null) { - initialRenderTarget = renderer.getRenderTarget(); - session.addEventListener("select", onSessionEvent); - session.addEventListener("selectstart", onSessionEvent); - session.addEventListener("selectend", onSessionEvent); - session.addEventListener("squeeze", onSessionEvent); - session.addEventListener("squeezestart", onSessionEvent); - session.addEventListener("squeezeend", onSessionEvent); - session.addEventListener("end", onSessionEnd); - session.addEventListener("inputsourceschange", onInputSourcesChange); - if (attributes.xrCompatible !== true) { - await gl.makeXRCompatible(); - } - if (session.renderState.layers === void 0 || renderer.capabilities.isWebGL2 === false) { - const layerInit = { - antialias: session.renderState.layers === void 0 ? attributes.antialias : true, - alpha: true, - depth: attributes.depth, - stencil: attributes.stencil, - framebufferScaleFactor - }; - glBaseLayer = new XRWebGLLayer(session, gl, layerInit); - session.updateRenderState({ baseLayer: glBaseLayer }); - newRenderTarget = new WebGLRenderTarget( - glBaseLayer.framebufferWidth, - glBaseLayer.framebufferHeight, - { - format: RGBAFormat, - type: UnsignedByteType, - colorSpace: renderer.outputColorSpace, - stencilBuffer: attributes.stencil - } - ); - } else { - let depthFormat = null; - let depthType = null; - let glDepthFormat = null; - if (attributes.depth) { - glDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24; - depthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat; - depthType = attributes.stencil ? UnsignedInt248Type : UnsignedIntType; - } - const projectionlayerInit = { - colorFormat: gl.RGBA8, - depthFormat: glDepthFormat, - scaleFactor: framebufferScaleFactor - }; - glBinding = new XRWebGLBinding(session, gl); - glProjLayer = glBinding.createProjectionLayer(projectionlayerInit); - session.updateRenderState({ layers: [glProjLayer] }); - newRenderTarget = new WebGLRenderTarget( - glProjLayer.textureWidth, - glProjLayer.textureHeight, - { - format: RGBAFormat, - type: UnsignedByteType, - depthTexture: new DepthTexture(glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, void 0, void 0, void 0, void 0, void 0, void 0, depthFormat), - stencilBuffer: attributes.stencil, - colorSpace: renderer.outputColorSpace, - samples: attributes.antialias ? 4 : 0 - } - ); - const renderTargetProperties = renderer.properties.get(newRenderTarget); - renderTargetProperties.__ignoreDepthValues = glProjLayer.ignoreDepthValues; - } - newRenderTarget.isXRRenderTarget = true; - this.setFoveation(foveation); - customReferenceSpace = null; - referenceSpace = await session.requestReferenceSpace(referenceSpaceType); - animation.setContext(session); - animation.start(); - scope.isPresenting = true; - scope.dispatchEvent({ type: "sessionstart" }); - } - }; - this.getEnvironmentBlendMode = function() { - if (session !== null) { - return session.environmentBlendMode; - } - }; - function onInputSourcesChange(event) { - for (let i = 0; i < event.removed.length; i++) { - const inputSource = event.removed[i]; - const index = controllerInputSources.indexOf(inputSource); - if (index >= 0) { - controllerInputSources[index] = null; - controllers[index].disconnect(inputSource); - } - } - for (let i = 0; i < event.added.length; i++) { - const inputSource = event.added[i]; - let controllerIndex = controllerInputSources.indexOf(inputSource); - if (controllerIndex === -1) { - for (let i2 = 0; i2 < controllers.length; i2++) { - if (i2 >= controllerInputSources.length) { - controllerInputSources.push(inputSource); - controllerIndex = i2; - break; - } else if (controllerInputSources[i2] === null) { - controllerInputSources[i2] = inputSource; - controllerIndex = i2; - break; - } - } - if (controllerIndex === -1) - break; - } - const controller = controllers[controllerIndex]; - if (controller) { - controller.connect(inputSource); - } - } - } - const cameraLPos = new Vector3(); - const cameraRPos = new Vector3(); - function setProjectionFromUnion(camera, cameraL2, cameraR2) { - cameraLPos.setFromMatrixPosition(cameraL2.matrixWorld); - cameraRPos.setFromMatrixPosition(cameraR2.matrixWorld); - const ipd = cameraLPos.distanceTo(cameraRPos); - const projL = cameraL2.projectionMatrix.elements; - const projR = cameraR2.projectionMatrix.elements; - const near = projL[14] / (projL[10] - 1); - const far = projL[14] / (projL[10] + 1); - const topFov = (projL[9] + 1) / projL[5]; - const bottomFov = (projL[9] - 1) / projL[5]; - const leftFov = (projL[8] - 1) / projL[0]; - const rightFov = (projR[8] + 1) / projR[0]; - const left = near * leftFov; - const right = near * rightFov; - const zOffset = ipd / (-leftFov + rightFov); - const xOffset = zOffset * -leftFov; - cameraL2.matrixWorld.decompose(camera.position, camera.quaternion, camera.scale); - camera.translateX(xOffset); - camera.translateZ(zOffset); - camera.matrixWorld.compose(camera.position, camera.quaternion, camera.scale); - camera.matrixWorldInverse.copy(camera.matrixWorld).invert(); - const near2 = near + zOffset; - const far2 = far + zOffset; - const left2 = left - xOffset; - const right2 = right + (ipd - xOffset); - const top2 = topFov * far / far2 * near2; - const bottom2 = bottomFov * far / far2 * near2; - camera.projectionMatrix.makePerspective(left2, right2, top2, bottom2, near2, far2); - camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert(); - } - function updateCamera(camera, parent) { - if (parent === null) { - camera.matrixWorld.copy(camera.matrix); - } else { - camera.matrixWorld.multiplyMatrices(parent.matrixWorld, camera.matrix); - } - camera.matrixWorldInverse.copy(camera.matrixWorld).invert(); - } - this.updateCamera = function(camera) { - if (session === null) - return; - cameraXR.near = cameraR.near = cameraL.near = camera.near; - cameraXR.far = cameraR.far = cameraL.far = camera.far; - if (_currentDepthNear !== cameraXR.near || _currentDepthFar !== cameraXR.far) { - session.updateRenderState({ - depthNear: cameraXR.near, - depthFar: cameraXR.far - }); - _currentDepthNear = cameraXR.near; - _currentDepthFar = cameraXR.far; - } - const parent = camera.parent; - const cameras2 = cameraXR.cameras; - updateCamera(cameraXR, parent); - for (let i = 0; i < cameras2.length; i++) { - updateCamera(cameras2[i], parent); - } - if (cameras2.length === 2) { - setProjectionFromUnion(cameraXR, cameraL, cameraR); - } else { - cameraXR.projectionMatrix.copy(cameraL.projectionMatrix); - } - updateUserCamera(camera, cameraXR, parent); - }; - function updateUserCamera(camera, cameraXR2, parent) { - if (parent === null) { - camera.matrix.copy(cameraXR2.matrixWorld); - } else { - camera.matrix.copy(parent.matrixWorld); - camera.matrix.invert(); - camera.matrix.multiply(cameraXR2.matrixWorld); - } - camera.matrix.decompose(camera.position, camera.quaternion, camera.scale); - camera.updateMatrixWorld(true); - camera.projectionMatrix.copy(cameraXR2.projectionMatrix); - camera.projectionMatrixInverse.copy(cameraXR2.projectionMatrixInverse); - if (camera.isPerspectiveCamera) { - camera.fov = RAD2DEG * 2 * Math.atan(1 / camera.projectionMatrix.elements[5]); - camera.zoom = 1; - } - } - this.getCamera = function() { - return cameraXR; - }; - this.getFoveation = function() { - if (glProjLayer === null && glBaseLayer === null) { - return void 0; - } - return foveation; - }; - this.setFoveation = function(value) { - foveation = value; - if (glProjLayer !== null) { - glProjLayer.fixedFoveation = value; - } - if (glBaseLayer !== null && glBaseLayer.fixedFoveation !== void 0) { - glBaseLayer.fixedFoveation = value; - } - }; - let onAnimationFrameCallback = null; - function onAnimationFrame(time, frame) { - pose = frame.getViewerPose(customReferenceSpace || referenceSpace); - xrFrame = frame; - if (pose !== null) { - const views = pose.views; - if (glBaseLayer !== null) { - renderer.setRenderTargetFramebuffer(newRenderTarget, glBaseLayer.framebuffer); - renderer.setRenderTarget(newRenderTarget); - } - let cameraXRNeedsUpdate = false; - if (views.length !== cameraXR.cameras.length) { - cameraXR.cameras.length = 0; - cameraXRNeedsUpdate = true; - } - for (let i = 0; i < views.length; i++) { - const view = views[i]; - let viewport = null; - if (glBaseLayer !== null) { - viewport = glBaseLayer.getViewport(view); - } else { - const glSubImage = glBinding.getViewSubImage(glProjLayer, view); - viewport = glSubImage.viewport; - if (i === 0) { - renderer.setRenderTargetTextures( - newRenderTarget, - glSubImage.colorTexture, - glProjLayer.ignoreDepthValues ? void 0 : glSubImage.depthStencilTexture - ); - renderer.setRenderTarget(newRenderTarget); - } - } - let camera = cameras[i]; - if (camera === void 0) { - camera = new PerspectiveCamera(); - camera.layers.enable(i); - camera.viewport = new Vector4(); - cameras[i] = camera; - } - camera.matrix.fromArray(view.transform.matrix); - camera.matrix.decompose(camera.position, camera.quaternion, camera.scale); - camera.projectionMatrix.fromArray(view.projectionMatrix); - camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert(); - camera.viewport.set(viewport.x, viewport.y, viewport.width, viewport.height); - if (i === 0) { - cameraXR.matrix.copy(camera.matrix); - cameraXR.matrix.decompose(cameraXR.position, cameraXR.quaternion, cameraXR.scale); - } - if (cameraXRNeedsUpdate === true) { - cameraXR.cameras.push(camera); - } - } - } - for (let i = 0; i < controllers.length; i++) { - const inputSource = controllerInputSources[i]; - const controller = controllers[i]; - if (inputSource !== null && controller !== void 0) { - controller.update(inputSource, frame, customReferenceSpace || referenceSpace); - } - } - if (onAnimationFrameCallback) - onAnimationFrameCallback(time, frame); - if (frame.detectedPlanes) { - scope.dispatchEvent({ type: "planesdetected", data: frame }); - } - xrFrame = null; - } - const animation = new WebGLAnimation(); - animation.setAnimationLoop(onAnimationFrame); - this.setAnimationLoop = function(callback) { - onAnimationFrameCallback = callback; - }; - this.dispose = function() { - }; - } -}; -function WebGLMaterials(renderer, properties) { - function refreshTransformUniform(map, uniform) { - if (map.matrixAutoUpdate === true) { - map.updateMatrix(); - } - uniform.value.copy(map.matrix); - } - function refreshFogUniforms(uniforms, fog) { - fog.color.getRGB(uniforms.fogColor.value, getUnlitUniformColorSpace(renderer)); - if (fog.isFog) { - uniforms.fogNear.value = fog.near; - uniforms.fogFar.value = fog.far; - } else if (fog.isFogExp2) { - uniforms.fogDensity.value = fog.density; - } - } - function refreshMaterialUniforms(uniforms, material, pixelRatio, height, transmissionRenderTarget) { - if (material.isMeshBasicMaterial) { - refreshUniformsCommon(uniforms, material); - } else if (material.isMeshLambertMaterial) { - refreshUniformsCommon(uniforms, material); - } else if (material.isMeshToonMaterial) { - refreshUniformsCommon(uniforms, material); - refreshUniformsToon(uniforms, material); - } else if (material.isMeshPhongMaterial) { - refreshUniformsCommon(uniforms, material); - refreshUniformsPhong(uniforms, material); - } else if (material.isMeshStandardMaterial) { - refreshUniformsCommon(uniforms, material); - refreshUniformsStandard(uniforms, material); - if (material.isMeshPhysicalMaterial) { - refreshUniformsPhysical(uniforms, material, transmissionRenderTarget); - } - } else if (material.isMeshMatcapMaterial) { - refreshUniformsCommon(uniforms, material); - refreshUniformsMatcap(uniforms, material); - } else if (material.isMeshDepthMaterial) { - refreshUniformsCommon(uniforms, material); - } else if (material.isMeshDistanceMaterial) { - refreshUniformsCommon(uniforms, material); - refreshUniformsDistance(uniforms, material); - } else if (material.isMeshNormalMaterial) { - refreshUniformsCommon(uniforms, material); - } else if (material.isLineBasicMaterial) { - refreshUniformsLine(uniforms, material); - if (material.isLineDashedMaterial) { - refreshUniformsDash(uniforms, material); - } - } else if (material.isPointsMaterial) { - refreshUniformsPoints(uniforms, material, pixelRatio, height); - } else if (material.isSpriteMaterial) { - refreshUniformsSprites(uniforms, material); - } else if (material.isShadowMaterial) { - uniforms.color.value.copy(material.color); - uniforms.opacity.value = material.opacity; - } else if (material.isShaderMaterial) { - material.uniformsNeedUpdate = false; - } - } - function refreshUniformsCommon(uniforms, material) { - uniforms.opacity.value = material.opacity; - if (material.color) { - uniforms.diffuse.value.copy(material.color); - } - if (material.emissive) { - uniforms.emissive.value.copy(material.emissive).multiplyScalar(material.emissiveIntensity); - } - if (material.map) { - uniforms.map.value = material.map; - refreshTransformUniform(material.map, uniforms.mapTransform); - } - if (material.alphaMap) { - uniforms.alphaMap.value = material.alphaMap; - refreshTransformUniform(material.alphaMap, uniforms.alphaMapTransform); - } - if (material.bumpMap) { - uniforms.bumpMap.value = material.bumpMap; - refreshTransformUniform(material.bumpMap, uniforms.bumpMapTransform); - uniforms.bumpScale.value = material.bumpScale; - if (material.side === BackSide) { - uniforms.bumpScale.value *= -1; - } - } - if (material.normalMap) { - uniforms.normalMap.value = material.normalMap; - refreshTransformUniform(material.normalMap, uniforms.normalMapTransform); - uniforms.normalScale.value.copy(material.normalScale); - if (material.side === BackSide) { - uniforms.normalScale.value.negate(); - } - } - if (material.displacementMap) { - uniforms.displacementMap.value = material.displacementMap; - refreshTransformUniform(material.displacementMap, uniforms.displacementMapTransform); - uniforms.displacementScale.value = material.displacementScale; - uniforms.displacementBias.value = material.displacementBias; - } - if (material.emissiveMap) { - uniforms.emissiveMap.value = material.emissiveMap; - refreshTransformUniform(material.emissiveMap, uniforms.emissiveMapTransform); - } - if (material.specularMap) { - uniforms.specularMap.value = material.specularMap; - refreshTransformUniform(material.specularMap, uniforms.specularMapTransform); - } - if (material.alphaTest > 0) { - uniforms.alphaTest.value = material.alphaTest; - } - const envMap = properties.get(material).envMap; - if (envMap) { - uniforms.envMap.value = envMap; - uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1; - uniforms.reflectivity.value = material.reflectivity; - uniforms.ior.value = material.ior; - uniforms.refractionRatio.value = material.refractionRatio; - } - if (material.lightMap) { - uniforms.lightMap.value = material.lightMap; - const scaleFactor = renderer._useLegacyLights === true ? Math.PI : 1; - uniforms.lightMapIntensity.value = material.lightMapIntensity * scaleFactor; - refreshTransformUniform(material.lightMap, uniforms.lightMapTransform); - } - if (material.aoMap) { - uniforms.aoMap.value = material.aoMap; - uniforms.aoMapIntensity.value = material.aoMapIntensity; - refreshTransformUniform(material.aoMap, uniforms.aoMapTransform); - } - } - function refreshUniformsLine(uniforms, material) { - uniforms.diffuse.value.copy(material.color); - uniforms.opacity.value = material.opacity; - if (material.map) { - uniforms.map.value = material.map; - refreshTransformUniform(material.map, uniforms.mapTransform); - } - } - function refreshUniformsDash(uniforms, material) { - uniforms.dashSize.value = material.dashSize; - uniforms.totalSize.value = material.dashSize + material.gapSize; - uniforms.scale.value = material.scale; - } - function refreshUniformsPoints(uniforms, material, pixelRatio, height) { - uniforms.diffuse.value.copy(material.color); - uniforms.opacity.value = material.opacity; - uniforms.size.value = material.size * pixelRatio; - uniforms.scale.value = height * 0.5; - if (material.map) { - uniforms.map.value = material.map; - refreshTransformUniform(material.map, uniforms.uvTransform); - } - if (material.alphaMap) { - uniforms.alphaMap.value = material.alphaMap; - refreshTransformUniform(material.alphaMap, uniforms.alphaMapTransform); - } - if (material.alphaTest > 0) { - uniforms.alphaTest.value = material.alphaTest; - } - } - function refreshUniformsSprites(uniforms, material) { - uniforms.diffuse.value.copy(material.color); - uniforms.opacity.value = material.opacity; - uniforms.rotation.value = material.rotation; - if (material.map) { - uniforms.map.value = material.map; - refreshTransformUniform(material.map, uniforms.mapTransform); - } - if (material.alphaMap) { - uniforms.alphaMap.value = material.alphaMap; - refreshTransformUniform(material.alphaMap, uniforms.alphaMapTransform); - } - if (material.alphaTest > 0) { - uniforms.alphaTest.value = material.alphaTest; - } - } - function refreshUniformsPhong(uniforms, material) { - uniforms.specular.value.copy(material.specular); - uniforms.shininess.value = Math.max(material.shininess, 1e-4); - } - function refreshUniformsToon(uniforms, material) { - if (material.gradientMap) { - uniforms.gradientMap.value = material.gradientMap; - } - } - function refreshUniformsStandard(uniforms, material) { - uniforms.metalness.value = material.metalness; - if (material.metalnessMap) { - uniforms.metalnessMap.value = material.metalnessMap; - refreshTransformUniform(material.metalnessMap, uniforms.metalnessMapTransform); - } - uniforms.roughness.value = material.roughness; - if (material.roughnessMap) { - uniforms.roughnessMap.value = material.roughnessMap; - refreshTransformUniform(material.roughnessMap, uniforms.roughnessMapTransform); - } - const envMap = properties.get(material).envMap; - if (envMap) { - uniforms.envMapIntensity.value = material.envMapIntensity; - } - } - function refreshUniformsPhysical(uniforms, material, transmissionRenderTarget) { - uniforms.ior.value = material.ior; - if (material.sheen > 0) { - uniforms.sheenColor.value.copy(material.sheenColor).multiplyScalar(material.sheen); - uniforms.sheenRoughness.value = material.sheenRoughness; - if (material.sheenColorMap) { - uniforms.sheenColorMap.value = material.sheenColorMap; - refreshTransformUniform(material.sheenColorMap, uniforms.sheenColorMapTransform); - } - if (material.sheenRoughnessMap) { - uniforms.sheenRoughnessMap.value = material.sheenRoughnessMap; - refreshTransformUniform(material.sheenRoughnessMap, uniforms.sheenRoughnessMapTransform); - } - } - if (material.clearcoat > 0) { - uniforms.clearcoat.value = material.clearcoat; - uniforms.clearcoatRoughness.value = material.clearcoatRoughness; - if (material.clearcoatMap) { - uniforms.clearcoatMap.value = material.clearcoatMap; - refreshTransformUniform(material.clearcoatMap, uniforms.clearcoatMapTransform); - } - if (material.clearcoatRoughnessMap) { - uniforms.clearcoatRoughnessMap.value = material.clearcoatRoughnessMap; - refreshTransformUniform(material.clearcoatRoughnessMap, uniforms.clearcoatRoughnessMapTransform); - } - if (material.clearcoatNormalMap) { - uniforms.clearcoatNormalMap.value = material.clearcoatNormalMap; - refreshTransformUniform(material.clearcoatNormalMap, uniforms.clearcoatNormalMapTransform); - uniforms.clearcoatNormalScale.value.copy(material.clearcoatNormalScale); - if (material.side === BackSide) { - uniforms.clearcoatNormalScale.value.negate(); - } - } - } - if (material.iridescence > 0) { - uniforms.iridescence.value = material.iridescence; - uniforms.iridescenceIOR.value = material.iridescenceIOR; - uniforms.iridescenceThicknessMinimum.value = material.iridescenceThicknessRange[0]; - uniforms.iridescenceThicknessMaximum.value = material.iridescenceThicknessRange[1]; - if (material.iridescenceMap) { - uniforms.iridescenceMap.value = material.iridescenceMap; - refreshTransformUniform(material.iridescenceMap, uniforms.iridescenceMapTransform); - } - if (material.iridescenceThicknessMap) { - uniforms.iridescenceThicknessMap.value = material.iridescenceThicknessMap; - refreshTransformUniform(material.iridescenceThicknessMap, uniforms.iridescenceThicknessMapTransform); - } - } - if (material.transmission > 0) { - uniforms.transmission.value = material.transmission; - uniforms.transmissionSamplerMap.value = transmissionRenderTarget.texture; - uniforms.transmissionSamplerSize.value.set(transmissionRenderTarget.width, transmissionRenderTarget.height); - if (material.transmissionMap) { - uniforms.transmissionMap.value = material.transmissionMap; - refreshTransformUniform(material.transmissionMap, uniforms.transmissionMapTransform); - } - uniforms.thickness.value = material.thickness; - if (material.thicknessMap) { - uniforms.thicknessMap.value = material.thicknessMap; - refreshTransformUniform(material.thicknessMap, uniforms.thicknessMapTransform); - } - uniforms.attenuationDistance.value = material.attenuationDistance; - uniforms.attenuationColor.value.copy(material.attenuationColor); - } - if (material.anisotropy > 0) { - uniforms.anisotropyVector.value.set(material.anisotropy * Math.cos(material.anisotropyRotation), material.anisotropy * Math.sin(material.anisotropyRotation)); - if (material.anisotropyMap) { - uniforms.anisotropyMap.value = material.anisotropyMap; - refreshTransformUniform(material.anisotropyMap, uniforms.anisotropyMapTransform); - } - } - uniforms.specularIntensity.value = material.specularIntensity; - uniforms.specularColor.value.copy(material.specularColor); - if (material.specularColorMap) { - uniforms.specularColorMap.value = material.specularColorMap; - refreshTransformUniform(material.specularColorMap, uniforms.specularColorMapTransform); - } - if (material.specularIntensityMap) { - uniforms.specularIntensityMap.value = material.specularIntensityMap; - refreshTransformUniform(material.specularIntensityMap, uniforms.specularIntensityMapTransform); - } - } - function refreshUniformsMatcap(uniforms, material) { - if (material.matcap) { - uniforms.matcap.value = material.matcap; - } - } - function refreshUniformsDistance(uniforms, material) { - const light = properties.get(material).light; - uniforms.referencePosition.value.setFromMatrixPosition(light.matrixWorld); - uniforms.nearDistance.value = light.shadow.camera.near; - uniforms.farDistance.value = light.shadow.camera.far; - } - return { - refreshFogUniforms, - refreshMaterialUniforms - }; -} -function WebGLUniformsGroups(gl, info, capabilities, state) { - let buffers = {}; - let updateList = {}; - let allocatedBindingPoints = []; - const maxBindingPoints = capabilities.isWebGL2 ? gl.getParameter(gl.MAX_UNIFORM_BUFFER_BINDINGS) : 0; - function bind(uniformsGroup, program) { - const webglProgram = program.program; - state.uniformBlockBinding(uniformsGroup, webglProgram); - } - function update(uniformsGroup, program) { - let buffer = buffers[uniformsGroup.id]; - if (buffer === void 0) { - prepareUniformsGroup(uniformsGroup); - buffer = createBuffer(uniformsGroup); - buffers[uniformsGroup.id] = buffer; - uniformsGroup.addEventListener("dispose", onUniformsGroupsDispose); - } - const webglProgram = program.program; - state.updateUBOMapping(uniformsGroup, webglProgram); - const frame = info.render.frame; - if (updateList[uniformsGroup.id] !== frame) { - updateBufferData(uniformsGroup); - updateList[uniformsGroup.id] = frame; - } - } - function createBuffer(uniformsGroup) { - const bindingPointIndex = allocateBindingPointIndex(); - uniformsGroup.__bindingPointIndex = bindingPointIndex; - const buffer = gl.createBuffer(); - const size = uniformsGroup.__size; - const usage = uniformsGroup.usage; - gl.bindBuffer(gl.UNIFORM_BUFFER, buffer); - gl.bufferData(gl.UNIFORM_BUFFER, size, usage); - gl.bindBuffer(gl.UNIFORM_BUFFER, null); - gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPointIndex, buffer); - return buffer; - } - function allocateBindingPointIndex() { - for (let i = 0; i < maxBindingPoints; i++) { - if (allocatedBindingPoints.indexOf(i) === -1) { - allocatedBindingPoints.push(i); - return i; - } - } - console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."); - return 0; - } - function updateBufferData(uniformsGroup) { - const buffer = buffers[uniformsGroup.id]; - const uniforms = uniformsGroup.uniforms; - const cache = uniformsGroup.__cache; - gl.bindBuffer(gl.UNIFORM_BUFFER, buffer); - for (let i = 0, il = uniforms.length; i < il; i++) { - const uniform = uniforms[i]; - if (hasUniformChanged(uniform, i, cache) === true) { - const offset = uniform.__offset; - const values = Array.isArray(uniform.value) ? uniform.value : [uniform.value]; - let arrayOffset = 0; - for (let i2 = 0; i2 < values.length; i2++) { - const value = values[i2]; - const info2 = getUniformSize(value); - if (typeof value === "number") { - uniform.__data[0] = value; - gl.bufferSubData(gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data); - } else if (value.isMatrix3) { - uniform.__data[0] = value.elements[0]; - uniform.__data[1] = value.elements[1]; - uniform.__data[2] = value.elements[2]; - uniform.__data[3] = value.elements[0]; - uniform.__data[4] = value.elements[3]; - uniform.__data[5] = value.elements[4]; - uniform.__data[6] = value.elements[5]; - uniform.__data[7] = value.elements[0]; - uniform.__data[8] = value.elements[6]; - uniform.__data[9] = value.elements[7]; - uniform.__data[10] = value.elements[8]; - uniform.__data[11] = value.elements[0]; - } else { - value.toArray(uniform.__data, arrayOffset); - arrayOffset += info2.storage / Float32Array.BYTES_PER_ELEMENT; - } - } - gl.bufferSubData(gl.UNIFORM_BUFFER, offset, uniform.__data); - } - } - gl.bindBuffer(gl.UNIFORM_BUFFER, null); - } - function hasUniformChanged(uniform, index, cache) { - const value = uniform.value; - if (cache[index] === void 0) { - if (typeof value === "number") { - cache[index] = value; - } else { - const values = Array.isArray(value) ? value : [value]; - const tempValues = []; - for (let i = 0; i < values.length; i++) { - tempValues.push(values[i].clone()); - } - cache[index] = tempValues; - } - return true; - } else { - if (typeof value === "number") { - if (cache[index] !== value) { - cache[index] = value; - return true; - } - } else { - const cachedObjects = Array.isArray(cache[index]) ? cache[index] : [cache[index]]; - const values = Array.isArray(value) ? value : [value]; - for (let i = 0; i < cachedObjects.length; i++) { - const cachedObject = cachedObjects[i]; - if (cachedObject.equals(values[i]) === false) { - cachedObject.copy(values[i]); - return true; - } - } - } - } - return false; - } - function prepareUniformsGroup(uniformsGroup) { - const uniforms = uniformsGroup.uniforms; - let offset = 0; - const chunkSize = 16; - let chunkOffset = 0; - for (let i = 0, l = uniforms.length; i < l; i++) { - const uniform = uniforms[i]; - const infos = { - boundary: 0, - // bytes - storage: 0 - // bytes - }; - const values = Array.isArray(uniform.value) ? uniform.value : [uniform.value]; - for (let j = 0, jl = values.length; j < jl; j++) { - const value = values[j]; - const info2 = getUniformSize(value); - infos.boundary += info2.boundary; - infos.storage += info2.storage; - } - uniform.__data = new Float32Array(infos.storage / Float32Array.BYTES_PER_ELEMENT); - uniform.__offset = offset; - if (i > 0) { - chunkOffset = offset % chunkSize; - const remainingSizeInChunk = chunkSize - chunkOffset; - if (chunkOffset !== 0 && remainingSizeInChunk - infos.boundary < 0) { - offset += chunkSize - chunkOffset; - uniform.__offset = offset; - } - } - offset += infos.storage; - } - chunkOffset = offset % chunkSize; - if (chunkOffset > 0) - offset += chunkSize - chunkOffset; - uniformsGroup.__size = offset; - uniformsGroup.__cache = {}; - return this; - } - function getUniformSize(value) { - const info2 = { - boundary: 0, - // bytes - storage: 0 - // bytes - }; - if (typeof value === "number") { - info2.boundary = 4; - info2.storage = 4; - } else if (value.isVector2) { - info2.boundary = 8; - info2.storage = 8; - } else if (value.isVector3 || value.isColor) { - info2.boundary = 16; - info2.storage = 12; - } else if (value.isVector4) { - info2.boundary = 16; - info2.storage = 16; - } else if (value.isMatrix3) { - info2.boundary = 48; - info2.storage = 48; - } else if (value.isMatrix4) { - info2.boundary = 64; - info2.storage = 64; - } else if (value.isTexture) { - console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."); - } else { - console.warn("THREE.WebGLRenderer: Unsupported uniform value type.", value); - } - return info2; - } - function onUniformsGroupsDispose(event) { - const uniformsGroup = event.target; - uniformsGroup.removeEventListener("dispose", onUniformsGroupsDispose); - const index = allocatedBindingPoints.indexOf(uniformsGroup.__bindingPointIndex); - allocatedBindingPoints.splice(index, 1); - gl.deleteBuffer(buffers[uniformsGroup.id]); - delete buffers[uniformsGroup.id]; - delete updateList[uniformsGroup.id]; - } - function dispose() { - for (const id in buffers) { - gl.deleteBuffer(buffers[id]); - } - allocatedBindingPoints = []; - buffers = {}; - updateList = {}; - } - return { - bind, - update, - dispose - }; -} -var WebGLRenderer = class { - constructor(parameters = {}) { - const { - canvas = createCanvasElement(), - context = null, - depth = true, - stencil = true, - alpha = false, - antialias = false, - premultipliedAlpha = true, - preserveDrawingBuffer = false, - powerPreference = "default", - failIfMajorPerformanceCaveat = false - } = parameters; - this.isWebGLRenderer = true; - let _alpha; - if (context !== null) { - _alpha = context.getContextAttributes().alpha; - } else { - _alpha = alpha; - } - const uintClearColor = new Uint32Array(4); - const intClearColor = new Int32Array(4); - let currentRenderList = null; - let currentRenderState = null; - const renderListStack = []; - const renderStateStack = []; - this.domElement = canvas; - this.debug = { - /** - * Enables error checking and reporting when shader programs are being compiled - * @type {boolean} - */ - checkShaderErrors: true, - /** - * Callback for custom error reporting. - * @type {?Function} - */ - onShaderError: null - }; - this.autoClear = true; - this.autoClearColor = true; - this.autoClearDepth = true; - this.autoClearStencil = true; - this.sortObjects = true; - this.clippingPlanes = []; - this.localClippingEnabled = false; - this._outputColorSpace = SRGBColorSpace; - this._useLegacyLights = false; - this.toneMapping = NoToneMapping; - this.toneMappingExposure = 1; - const _this = this; - let _isContextLost = false; - let _currentActiveCubeFace = 0; - let _currentActiveMipmapLevel = 0; - let _currentRenderTarget = null; - let _currentMaterialId = -1; - let _currentCamera = null; - const _currentViewport = new Vector4(); - const _currentScissor = new Vector4(); - let _currentScissorTest = null; - const _currentClearColor = new Color(0); - let _currentClearAlpha = 0; - let _width = canvas.width; - let _height = canvas.height; - let _pixelRatio = 1; - let _opaqueSort = null; - let _transparentSort = null; - const _viewport = new Vector4(0, 0, _width, _height); - const _scissor = new Vector4(0, 0, _width, _height); - let _scissorTest = false; - const _frustum = new Frustum(); - let _clippingEnabled = false; - let _localClippingEnabled = false; - let _transmissionRenderTarget = null; - const _projScreenMatrix2 = new Matrix4(); - const _vector22 = new Vector2(); - const _vector32 = new Vector3(); - const _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true }; - function getTargetPixelRatio() { - return _currentRenderTarget === null ? _pixelRatio : 1; - } - let _gl = context; - function getContext(contextNames, contextAttributes) { - for (let i = 0; i < contextNames.length; i++) { - const contextName = contextNames[i]; - const context2 = canvas.getContext(contextName, contextAttributes); - if (context2 !== null) - return context2; - } - return null; - } - try { - const contextAttributes = { - alpha: true, - depth, - stencil, - antialias, - premultipliedAlpha, - preserveDrawingBuffer, - powerPreference, - failIfMajorPerformanceCaveat - }; - if ("setAttribute" in canvas) - canvas.setAttribute("data-engine", `three.js r${REVISION}`); - canvas.addEventListener("webglcontextlost", onContextLost, false); - canvas.addEventListener("webglcontextrestored", onContextRestore, false); - canvas.addEventListener("webglcontextcreationerror", onContextCreationError, false); - if (_gl === null) { - const contextNames = ["webgl2", "webgl", "experimental-webgl"]; - if (_this.isWebGL1Renderer === true) { - contextNames.shift(); - } - _gl = getContext(contextNames, contextAttributes); - if (_gl === null) { - if (getContext(contextNames)) { - throw new Error("Error creating WebGL context with your selected attributes."); - } else { - throw new Error("Error creating WebGL context."); - } - } - } - if (typeof WebGLRenderingContext !== "undefined" && _gl instanceof WebGLRenderingContext) { - console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."); - } - if (_gl.getShaderPrecisionFormat === void 0) { - _gl.getShaderPrecisionFormat = function() { - return { "rangeMin": 1, "rangeMax": 1, "precision": 1 }; - }; - } - } catch (error) { - console.error("THREE.WebGLRenderer: " + error.message); - throw error; - } - let extensions, capabilities, state, info; - let properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects; - let programCache, materials, renderLists, renderStates, clipping, shadowMap; - let background, morphtargets, bufferRenderer, indexedBufferRenderer; - let utils, bindingStates, uniformsGroups; - function initGLContext() { - extensions = new WebGLExtensions(_gl); - capabilities = new WebGLCapabilities(_gl, extensions, parameters); - extensions.init(capabilities); - utils = new WebGLUtils(_gl, extensions, capabilities); - state = new WebGLState(_gl, extensions, capabilities); - info = new WebGLInfo(_gl); - properties = new WebGLProperties(); - textures = new WebGLTextures(_gl, extensions, state, properties, capabilities, utils, info); - cubemaps = new WebGLCubeMaps(_this); - cubeuvmaps = new WebGLCubeUVMaps(_this); - attributes = new WebGLAttributes(_gl, capabilities); - bindingStates = new WebGLBindingStates(_gl, extensions, attributes, capabilities); - geometries = new WebGLGeometries(_gl, attributes, info, bindingStates); - objects = new WebGLObjects(_gl, geometries, attributes, info); - morphtargets = new WebGLMorphtargets(_gl, capabilities, textures); - clipping = new WebGLClipping(properties); - programCache = new WebGLPrograms(_this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping); - materials = new WebGLMaterials(_this, properties); - renderLists = new WebGLRenderLists(); - renderStates = new WebGLRenderStates(extensions, capabilities); - background = new WebGLBackground(_this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha); - shadowMap = new WebGLShadowMap(_this, objects, capabilities); - uniformsGroups = new WebGLUniformsGroups(_gl, info, capabilities, state); - bufferRenderer = new WebGLBufferRenderer(_gl, extensions, info, capabilities); - indexedBufferRenderer = new WebGLIndexedBufferRenderer(_gl, extensions, info, capabilities); - info.programs = programCache.programs; - _this.capabilities = capabilities; - _this.extensions = extensions; - _this.properties = properties; - _this.renderLists = renderLists; - _this.shadowMap = shadowMap; - _this.state = state; - _this.info = info; - } - initGLContext(); - const xr = new WebXRManager(_this, _gl); - this.xr = xr; - this.getContext = function() { - return _gl; - }; - this.getContextAttributes = function() { - return _gl.getContextAttributes(); - }; - this.forceContextLoss = function() { - const extension = extensions.get("WEBGL_lose_context"); - if (extension) - extension.loseContext(); - }; - this.forceContextRestore = function() { - const extension = extensions.get("WEBGL_lose_context"); - if (extension) - extension.restoreContext(); - }; - this.getPixelRatio = function() { - return _pixelRatio; - }; - this.setPixelRatio = function(value) { - if (value === void 0) - return; - _pixelRatio = value; - this.setSize(_width, _height, false); - }; - this.getSize = function(target) { - return target.set(_width, _height); - }; - this.setSize = function(width, height, updateStyle = true) { - if (xr.isPresenting) { - console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."); - return; - } - _width = width; - _height = height; - canvas.width = Math.floor(width * _pixelRatio); - canvas.height = Math.floor(height * _pixelRatio); - if (updateStyle === true) { - canvas.style.width = width + "px"; - canvas.style.height = height + "px"; - } - this.setViewport(0, 0, width, height); - }; - this.getDrawingBufferSize = function(target) { - return target.set(_width * _pixelRatio, _height * _pixelRatio).floor(); - }; - this.setDrawingBufferSize = function(width, height, pixelRatio) { - _width = width; - _height = height; - _pixelRatio = pixelRatio; - canvas.width = Math.floor(width * pixelRatio); - canvas.height = Math.floor(height * pixelRatio); - this.setViewport(0, 0, width, height); - }; - this.getCurrentViewport = function(target) { - return target.copy(_currentViewport); - }; - this.getViewport = function(target) { - return target.copy(_viewport); - }; - this.setViewport = function(x, y, width, height) { - if (x.isVector4) { - _viewport.set(x.x, x.y, x.z, x.w); - } else { - _viewport.set(x, y, width, height); - } - state.viewport(_currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor()); - }; - this.getScissor = function(target) { - return target.copy(_scissor); - }; - this.setScissor = function(x, y, width, height) { - if (x.isVector4) { - _scissor.set(x.x, x.y, x.z, x.w); - } else { - _scissor.set(x, y, width, height); - } - state.scissor(_currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor()); - }; - this.getScissorTest = function() { - return _scissorTest; - }; - this.setScissorTest = function(boolean) { - state.setScissorTest(_scissorTest = boolean); - }; - this.setOpaqueSort = function(method) { - _opaqueSort = method; - }; - this.setTransparentSort = function(method) { - _transparentSort = method; - }; - this.getClearColor = function(target) { - return target.copy(background.getClearColor()); - }; - this.setClearColor = function() { - background.setClearColor.apply(background, arguments); - }; - this.getClearAlpha = function() { - return background.getClearAlpha(); - }; - this.setClearAlpha = function() { - background.setClearAlpha.apply(background, arguments); - }; - this.clear = function(color = true, depth2 = true, stencil2 = true) { - let bits = 0; - if (color) { - let isIntegerFormat = false; - if (_currentRenderTarget !== null) { - const targetFormat = _currentRenderTarget.texture.format; - isIntegerFormat = targetFormat === RGBAIntegerFormat || targetFormat === RGIntegerFormat || targetFormat === RedIntegerFormat; - } - if (isIntegerFormat) { - const targetType = _currentRenderTarget.texture.type; - const isUnsignedType = targetType === UnsignedByteType || targetType === UnsignedIntType || targetType === UnsignedShortType || targetType === UnsignedInt248Type || targetType === UnsignedShort4444Type || targetType === UnsignedShort5551Type; - const clearColor = background.getClearColor(); - const a = background.getClearAlpha(); - const r = clearColor.r; - const g = clearColor.g; - const b = clearColor.b; - if (isUnsignedType) { - uintClearColor[0] = r; - uintClearColor[1] = g; - uintClearColor[2] = b; - uintClearColor[3] = a; - _gl.clearBufferuiv(_gl.COLOR, 0, uintClearColor); - } else { - intClearColor[0] = r; - intClearColor[1] = g; - intClearColor[2] = b; - intClearColor[3] = a; - _gl.clearBufferiv(_gl.COLOR, 0, intClearColor); - } - } else { - bits |= _gl.COLOR_BUFFER_BIT; - } - } - if (depth2) - bits |= _gl.DEPTH_BUFFER_BIT; - if (stencil2) { - bits |= _gl.STENCIL_BUFFER_BIT; - this.state.buffers.stencil.setMask(4294967295); - } - _gl.clear(bits); - }; - this.clearColor = function() { - this.clear(true, false, false); - }; - this.clearDepth = function() { - this.clear(false, true, false); - }; - this.clearStencil = function() { - this.clear(false, false, true); - }; - this.dispose = function() { - canvas.removeEventListener("webglcontextlost", onContextLost, false); - canvas.removeEventListener("webglcontextrestored", onContextRestore, false); - canvas.removeEventListener("webglcontextcreationerror", onContextCreationError, false); - renderLists.dispose(); - renderStates.dispose(); - properties.dispose(); - cubemaps.dispose(); - cubeuvmaps.dispose(); - objects.dispose(); - bindingStates.dispose(); - uniformsGroups.dispose(); - programCache.dispose(); - xr.dispose(); - xr.removeEventListener("sessionstart", onXRSessionStart); - xr.removeEventListener("sessionend", onXRSessionEnd); - if (_transmissionRenderTarget) { - _transmissionRenderTarget.dispose(); - _transmissionRenderTarget = null; - } - animation.stop(); - }; - function onContextLost(event) { - event.preventDefault(); - console.log("THREE.WebGLRenderer: Context Lost."); - _isContextLost = true; - } - function onContextRestore() { - console.log("THREE.WebGLRenderer: Context Restored."); - _isContextLost = false; - const infoAutoReset = info.autoReset; - const shadowMapEnabled = shadowMap.enabled; - const shadowMapAutoUpdate = shadowMap.autoUpdate; - const shadowMapNeedsUpdate = shadowMap.needsUpdate; - const shadowMapType = shadowMap.type; - initGLContext(); - info.autoReset = infoAutoReset; - shadowMap.enabled = shadowMapEnabled; - shadowMap.autoUpdate = shadowMapAutoUpdate; - shadowMap.needsUpdate = shadowMapNeedsUpdate; - shadowMap.type = shadowMapType; - } - function onContextCreationError(event) { - console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ", event.statusMessage); - } - function onMaterialDispose(event) { - const material = event.target; - material.removeEventListener("dispose", onMaterialDispose); - deallocateMaterial(material); - } - function deallocateMaterial(material) { - releaseMaterialProgramReferences(material); - properties.remove(material); - } - function releaseMaterialProgramReferences(material) { - const programs = properties.get(material).programs; - if (programs !== void 0) { - programs.forEach(function(program) { - programCache.releaseProgram(program); - }); - if (material.isShaderMaterial) { - programCache.releaseShaderCache(material); - } - } - } - this.renderBufferDirect = function(camera, scene, geometry, material, object, group) { - if (scene === null) - scene = _emptyScene; - const frontFaceCW = object.isMesh && object.matrixWorld.determinant() < 0; - const program = setProgram(camera, scene, geometry, material, object); - state.setMaterial(material, frontFaceCW); - let index = geometry.index; - let rangeFactor = 1; - if (material.wireframe === true) { - index = geometries.getWireframeAttribute(geometry); - if (index === void 0) - return; - rangeFactor = 2; - } - const drawRange = geometry.drawRange; - const position = geometry.attributes.position; - let drawStart = drawRange.start * rangeFactor; - let drawEnd = (drawRange.start + drawRange.count) * rangeFactor; - if (group !== null) { - drawStart = Math.max(drawStart, group.start * rangeFactor); - drawEnd = Math.min(drawEnd, (group.start + group.count) * rangeFactor); - } - if (index !== null) { - drawStart = Math.max(drawStart, 0); - drawEnd = Math.min(drawEnd, index.count); - } else if (position !== void 0 && position !== null) { - drawStart = Math.max(drawStart, 0); - drawEnd = Math.min(drawEnd, position.count); - } - const drawCount = drawEnd - drawStart; - if (drawCount < 0 || drawCount === Infinity) - return; - bindingStates.setup(object, material, program, geometry, index); - let attribute; - let renderer = bufferRenderer; - if (index !== null) { - attribute = attributes.get(index); - renderer = indexedBufferRenderer; - renderer.setIndex(attribute); - } - if (object.isMesh) { - if (material.wireframe === true) { - state.setLineWidth(material.wireframeLinewidth * getTargetPixelRatio()); - renderer.setMode(_gl.LINES); - } else { - renderer.setMode(_gl.TRIANGLES); - } - } else if (object.isLine) { - let lineWidth = material.linewidth; - if (lineWidth === void 0) - lineWidth = 1; - state.setLineWidth(lineWidth * getTargetPixelRatio()); - if (object.isLineSegments) { - renderer.setMode(_gl.LINES); - } else if (object.isLineLoop) { - renderer.setMode(_gl.LINE_LOOP); - } else { - renderer.setMode(_gl.LINE_STRIP); - } - } else if (object.isPoints) { - renderer.setMode(_gl.POINTS); - } else if (object.isSprite) { - renderer.setMode(_gl.TRIANGLES); - } - if (object.isInstancedMesh) { - renderer.renderInstances(drawStart, drawCount, object.count); - } else if (geometry.isInstancedBufferGeometry) { - const maxInstanceCount = geometry._maxInstanceCount !== void 0 ? geometry._maxInstanceCount : Infinity; - const instanceCount = Math.min(geometry.instanceCount, maxInstanceCount); - renderer.renderInstances(drawStart, drawCount, instanceCount); - } else { - renderer.render(drawStart, drawCount); - } - }; - function prepareMaterial(material, scene, object) { - if (material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false) { - material.side = BackSide; - material.needsUpdate = true; - getProgram(material, scene, object); - material.side = FrontSide; - material.needsUpdate = true; - getProgram(material, scene, object); - material.side = DoubleSide; - } else { - getProgram(material, scene, object); - } - } - this.compile = function(scene, camera, targetScene = null) { - if (targetScene === null) - targetScene = scene; - currentRenderState = renderStates.get(targetScene); - currentRenderState.init(); - renderStateStack.push(currentRenderState); - targetScene.traverseVisible(function(object) { - if (object.isLight && object.layers.test(camera.layers)) { - currentRenderState.pushLight(object); - if (object.castShadow) { - currentRenderState.pushShadow(object); - } - } - }); - if (scene !== targetScene) { - scene.traverseVisible(function(object) { - if (object.isLight && object.layers.test(camera.layers)) { - currentRenderState.pushLight(object); - if (object.castShadow) { - currentRenderState.pushShadow(object); - } - } - }); - } - currentRenderState.setupLights(_this._useLegacyLights); - const materials2 = /* @__PURE__ */ new Set(); - scene.traverse(function(object) { - const material = object.material; - if (material) { - if (Array.isArray(material)) { - for (let i = 0; i < material.length; i++) { - const material2 = material[i]; - prepareMaterial(material2, targetScene, object); - materials2.add(material2); - } - } else { - prepareMaterial(material, targetScene, object); - materials2.add(material); - } - } - }); - renderStateStack.pop(); - currentRenderState = null; - return materials2; - }; - this.compileAsync = function(scene, camera, targetScene = null) { - const materials2 = this.compile(scene, camera, targetScene); - return new Promise((resolve) => { - function checkMaterialsReady() { - materials2.forEach(function(material) { - const materialProperties = properties.get(material); - const program = materialProperties.currentProgram; - if (program.isReady()) { - materials2.delete(material); - } - }); - if (materials2.size === 0) { - resolve(scene); - return; - } - setTimeout(checkMaterialsReady, 10); - } - if (extensions.get("KHR_parallel_shader_compile") !== null) { - checkMaterialsReady(); - } else { - setTimeout(checkMaterialsReady, 10); - } - }); - }; - let onAnimationFrameCallback = null; - function onAnimationFrame(time) { - if (onAnimationFrameCallback) - onAnimationFrameCallback(time); - } - function onXRSessionStart() { - animation.stop(); - } - function onXRSessionEnd() { - animation.start(); - } - const animation = new WebGLAnimation(); - animation.setAnimationLoop(onAnimationFrame); - if (typeof self !== "undefined") - animation.setContext(self); - this.setAnimationLoop = function(callback) { - onAnimationFrameCallback = callback; - xr.setAnimationLoop(callback); - callback === null ? animation.stop() : animation.start(); - }; - xr.addEventListener("sessionstart", onXRSessionStart); - xr.addEventListener("sessionend", onXRSessionEnd); - this.render = function(scene, camera) { - if (camera !== void 0 && camera.isCamera !== true) { - console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera."); - return; - } - if (_isContextLost === true) - return; - if (scene.matrixWorldAutoUpdate === true) - scene.updateMatrixWorld(); - if (camera.parent === null && camera.matrixWorldAutoUpdate === true) - camera.updateMatrixWorld(); - if (xr.enabled === true && xr.isPresenting === true) { - if (xr.cameraAutoUpdate === true) - xr.updateCamera(camera); - camera = xr.getCamera(); - } - if (scene.isScene === true) - scene.onBeforeRender(_this, scene, camera, _currentRenderTarget); - currentRenderState = renderStates.get(scene, renderStateStack.length); - currentRenderState.init(); - renderStateStack.push(currentRenderState); - _projScreenMatrix2.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); - _frustum.setFromProjectionMatrix(_projScreenMatrix2); - _localClippingEnabled = this.localClippingEnabled; - _clippingEnabled = clipping.init(this.clippingPlanes, _localClippingEnabled); - currentRenderList = renderLists.get(scene, renderListStack.length); - currentRenderList.init(); - renderListStack.push(currentRenderList); - projectObject(scene, camera, 0, _this.sortObjects); - currentRenderList.finish(); - if (_this.sortObjects === true) { - currentRenderList.sort(_opaqueSort, _transparentSort); - } - this.info.render.frame++; - if (_clippingEnabled === true) - clipping.beginShadows(); - const shadowsArray = currentRenderState.state.shadowsArray; - shadowMap.render(shadowsArray, scene, camera); - if (_clippingEnabled === true) - clipping.endShadows(); - if (this.info.autoReset === true) - this.info.reset(); - background.render(currentRenderList, scene); - currentRenderState.setupLights(_this._useLegacyLights); - if (camera.isArrayCamera) { - const cameras = camera.cameras; - for (let i = 0, l = cameras.length; i < l; i++) { - const camera2 = cameras[i]; - renderScene(currentRenderList, scene, camera2, camera2.viewport); - } - } else { - renderScene(currentRenderList, scene, camera); - } - if (_currentRenderTarget !== null) { - textures.updateMultisampleRenderTarget(_currentRenderTarget); - textures.updateRenderTargetMipmap(_currentRenderTarget); - } - if (scene.isScene === true) - scene.onAfterRender(_this, scene, camera); - bindingStates.resetDefaultState(); - _currentMaterialId = -1; - _currentCamera = null; - renderStateStack.pop(); - if (renderStateStack.length > 0) { - currentRenderState = renderStateStack[renderStateStack.length - 1]; - } else { - currentRenderState = null; - } - renderListStack.pop(); - if (renderListStack.length > 0) { - currentRenderList = renderListStack[renderListStack.length - 1]; - } else { - currentRenderList = null; - } - }; - function projectObject(object, camera, groupOrder, sortObjects) { - if (object.visible === false) - return; - const visible = object.layers.test(camera.layers); - if (visible) { - if (object.isGroup) { - groupOrder = object.renderOrder; - } else if (object.isLOD) { - if (object.autoUpdate === true) - object.update(camera); - } else if (object.isLight) { - currentRenderState.pushLight(object); - if (object.castShadow) { - currentRenderState.pushShadow(object); - } - } else if (object.isSprite) { - if (!object.frustumCulled || _frustum.intersectsSprite(object)) { - if (sortObjects) { - _vector32.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix2); - } - const geometry = objects.update(object); - const material = object.material; - if (material.visible) { - currentRenderList.push(object, geometry, material, groupOrder, _vector32.z, null); - } - } - } else if (object.isMesh || object.isLine || object.isPoints) { - if (!object.frustumCulled || _frustum.intersectsObject(object)) { - const geometry = objects.update(object); - const material = object.material; - if (sortObjects) { - if (object.boundingSphere !== void 0) { - if (object.boundingSphere === null) - object.computeBoundingSphere(); - _vector32.copy(object.boundingSphere.center); - } else { - if (geometry.boundingSphere === null) - geometry.computeBoundingSphere(); - _vector32.copy(geometry.boundingSphere.center); - } - _vector32.applyMatrix4(object.matrixWorld).applyMatrix4(_projScreenMatrix2); - } - if (Array.isArray(material)) { - const groups = geometry.groups; - for (let i = 0, l = groups.length; i < l; i++) { - const group = groups[i]; - const groupMaterial = material[group.materialIndex]; - if (groupMaterial && groupMaterial.visible) { - currentRenderList.push(object, geometry, groupMaterial, groupOrder, _vector32.z, group); - } - } - } else if (material.visible) { - currentRenderList.push(object, geometry, material, groupOrder, _vector32.z, null); - } - } - } - } - const children = object.children; - for (let i = 0, l = children.length; i < l; i++) { - projectObject(children[i], camera, groupOrder, sortObjects); - } - } - function renderScene(currentRenderList2, scene, camera, viewport) { - const opaqueObjects = currentRenderList2.opaque; - const transmissiveObjects = currentRenderList2.transmissive; - const transparentObjects = currentRenderList2.transparent; - currentRenderState.setupLightsView(camera); - if (_clippingEnabled === true) - clipping.setGlobalState(_this.clippingPlanes, camera); - if (transmissiveObjects.length > 0) - renderTransmissionPass(opaqueObjects, transmissiveObjects, scene, camera); - if (viewport) - state.viewport(_currentViewport.copy(viewport)); - if (opaqueObjects.length > 0) - renderObjects(opaqueObjects, scene, camera); - if (transmissiveObjects.length > 0) - renderObjects(transmissiveObjects, scene, camera); - if (transparentObjects.length > 0) - renderObjects(transparentObjects, scene, camera); - state.buffers.depth.setTest(true); - state.buffers.depth.setMask(true); - state.buffers.color.setMask(true); - state.setPolygonOffset(false); - } - function renderTransmissionPass(opaqueObjects, transmissiveObjects, scene, camera) { - const overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null; - if (overrideMaterial !== null) { - return; - } - const isWebGL2 = capabilities.isWebGL2; - if (_transmissionRenderTarget === null) { - _transmissionRenderTarget = new WebGLRenderTarget(1, 1, { - generateMipmaps: true, - type: extensions.has("EXT_color_buffer_half_float") ? HalfFloatType : UnsignedByteType, - minFilter: LinearMipmapLinearFilter, - samples: isWebGL2 ? 4 : 0 - }); - } - _this.getDrawingBufferSize(_vector22); - if (isWebGL2) { - _transmissionRenderTarget.setSize(_vector22.x, _vector22.y); - } else { - _transmissionRenderTarget.setSize(floorPowerOfTwo(_vector22.x), floorPowerOfTwo(_vector22.y)); - } - const currentRenderTarget = _this.getRenderTarget(); - _this.setRenderTarget(_transmissionRenderTarget); - _this.getClearColor(_currentClearColor); - _currentClearAlpha = _this.getClearAlpha(); - if (_currentClearAlpha < 1) - _this.setClearColor(16777215, 0.5); - _this.clear(); - const currentToneMapping = _this.toneMapping; - _this.toneMapping = NoToneMapping; - renderObjects(opaqueObjects, scene, camera); - textures.updateMultisampleRenderTarget(_transmissionRenderTarget); - textures.updateRenderTargetMipmap(_transmissionRenderTarget); - let renderTargetNeedsUpdate = false; - for (let i = 0, l = transmissiveObjects.length; i < l; i++) { - const renderItem = transmissiveObjects[i]; - const object = renderItem.object; - const geometry = renderItem.geometry; - const material = renderItem.material; - const group = renderItem.group; - if (material.side === DoubleSide && object.layers.test(camera.layers)) { - const currentSide = material.side; - material.side = BackSide; - material.needsUpdate = true; - renderObject(object, scene, camera, geometry, material, group); - material.side = currentSide; - material.needsUpdate = true; - renderTargetNeedsUpdate = true; - } - } - if (renderTargetNeedsUpdate === true) { - textures.updateMultisampleRenderTarget(_transmissionRenderTarget); - textures.updateRenderTargetMipmap(_transmissionRenderTarget); - } - _this.setRenderTarget(currentRenderTarget); - _this.setClearColor(_currentClearColor, _currentClearAlpha); - _this.toneMapping = currentToneMapping; - } - function renderObjects(renderList, scene, camera) { - const overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null; - for (let i = 0, l = renderList.length; i < l; i++) { - const renderItem = renderList[i]; - const object = renderItem.object; - const geometry = renderItem.geometry; - const material = overrideMaterial === null ? renderItem.material : overrideMaterial; - const group = renderItem.group; - if (object.layers.test(camera.layers)) { - renderObject(object, scene, camera, geometry, material, group); - } - } - } - function renderObject(object, scene, camera, geometry, material, group) { - object.onBeforeRender(_this, scene, camera, geometry, material, group); - object.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, object.matrixWorld); - object.normalMatrix.getNormalMatrix(object.modelViewMatrix); - material.onBeforeRender(_this, scene, camera, geometry, object, group); - if (material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false) { - material.side = BackSide; - material.needsUpdate = true; - _this.renderBufferDirect(camera, scene, geometry, material, object, group); - material.side = FrontSide; - material.needsUpdate = true; - _this.renderBufferDirect(camera, scene, geometry, material, object, group); - material.side = DoubleSide; - } else { - _this.renderBufferDirect(camera, scene, geometry, material, object, group); - } - object.onAfterRender(_this, scene, camera, geometry, material, group); - } - function getProgram(material, scene, object) { - if (scene.isScene !== true) - scene = _emptyScene; - const materialProperties = properties.get(material); - const lights = currentRenderState.state.lights; - const shadowsArray = currentRenderState.state.shadowsArray; - const lightsStateVersion = lights.state.version; - const parameters2 = programCache.getParameters(material, lights.state, shadowsArray, scene, object); - const programCacheKey = programCache.getProgramCacheKey(parameters2); - let programs = materialProperties.programs; - materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null; - materialProperties.fog = scene.fog; - materialProperties.envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || materialProperties.environment); - if (programs === void 0) { - material.addEventListener("dispose", onMaterialDispose); - programs = /* @__PURE__ */ new Map(); - materialProperties.programs = programs; - } - let program = programs.get(programCacheKey); - if (program !== void 0) { - if (materialProperties.currentProgram === program && materialProperties.lightsStateVersion === lightsStateVersion) { - updateCommonMaterialProperties(material, parameters2); - return program; - } - } else { - parameters2.uniforms = programCache.getUniforms(material); - material.onBuild(object, parameters2, _this); - material.onBeforeCompile(parameters2, _this); - program = programCache.acquireProgram(parameters2, programCacheKey); - programs.set(programCacheKey, program); - materialProperties.uniforms = parameters2.uniforms; - } - const uniforms = materialProperties.uniforms; - if (!material.isShaderMaterial && !material.isRawShaderMaterial || material.clipping === true) { - uniforms.clippingPlanes = clipping.uniform; - } - updateCommonMaterialProperties(material, parameters2); - materialProperties.needsLights = materialNeedsLights(material); - materialProperties.lightsStateVersion = lightsStateVersion; - if (materialProperties.needsLights) { - uniforms.ambientLightColor.value = lights.state.ambient; - uniforms.lightProbe.value = lights.state.probe; - uniforms.directionalLights.value = lights.state.directional; - uniforms.directionalLightShadows.value = lights.state.directionalShadow; - uniforms.spotLights.value = lights.state.spot; - uniforms.spotLightShadows.value = lights.state.spotShadow; - uniforms.rectAreaLights.value = lights.state.rectArea; - uniforms.ltc_1.value = lights.state.rectAreaLTC1; - uniforms.ltc_2.value = lights.state.rectAreaLTC2; - uniforms.pointLights.value = lights.state.point; - uniforms.pointLightShadows.value = lights.state.pointShadow; - uniforms.hemisphereLights.value = lights.state.hemi; - uniforms.directionalShadowMap.value = lights.state.directionalShadowMap; - uniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix; - uniforms.spotShadowMap.value = lights.state.spotShadowMap; - uniforms.spotLightMatrix.value = lights.state.spotLightMatrix; - uniforms.spotLightMap.value = lights.state.spotLightMap; - uniforms.pointShadowMap.value = lights.state.pointShadowMap; - uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix; - } - materialProperties.currentProgram = program; - materialProperties.uniformsList = null; - return program; - } - function getUniformList(materialProperties) { - if (materialProperties.uniformsList === null) { - const progUniforms = materialProperties.currentProgram.getUniforms(); - materialProperties.uniformsList = WebGLUniforms.seqWithValue(progUniforms.seq, materialProperties.uniforms); - } - return materialProperties.uniformsList; - } - function updateCommonMaterialProperties(material, parameters2) { - const materialProperties = properties.get(material); - materialProperties.outputColorSpace = parameters2.outputColorSpace; - materialProperties.instancing = parameters2.instancing; - materialProperties.instancingColor = parameters2.instancingColor; - materialProperties.skinning = parameters2.skinning; - materialProperties.morphTargets = parameters2.morphTargets; - materialProperties.morphNormals = parameters2.morphNormals; - materialProperties.morphColors = parameters2.morphColors; - materialProperties.morphTargetsCount = parameters2.morphTargetsCount; - materialProperties.numClippingPlanes = parameters2.numClippingPlanes; - materialProperties.numIntersection = parameters2.numClipIntersection; - materialProperties.vertexAlphas = parameters2.vertexAlphas; - materialProperties.vertexTangents = parameters2.vertexTangents; - materialProperties.toneMapping = parameters2.toneMapping; - } - function setProgram(camera, scene, geometry, material, object) { - if (scene.isScene !== true) - scene = _emptyScene; - textures.resetTextureUnits(); - const fog = scene.fog; - const environment = material.isMeshStandardMaterial ? scene.environment : null; - const colorSpace = _currentRenderTarget === null ? _this.outputColorSpace : _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace; - const envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || environment); - const vertexAlphas = material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4; - const vertexTangents = !!geometry.attributes.tangent && (!!material.normalMap || material.anisotropy > 0); - const morphTargets = !!geometry.morphAttributes.position; - const morphNormals = !!geometry.morphAttributes.normal; - const morphColors = !!geometry.morphAttributes.color; - let toneMapping = NoToneMapping; - if (material.toneMapped) { - if (_currentRenderTarget === null || _currentRenderTarget.isXRRenderTarget === true) { - toneMapping = _this.toneMapping; - } - } - const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color; - const morphTargetsCount = morphAttribute !== void 0 ? morphAttribute.length : 0; - const materialProperties = properties.get(material); - const lights = currentRenderState.state.lights; - if (_clippingEnabled === true) { - if (_localClippingEnabled === true || camera !== _currentCamera) { - const useCache = camera === _currentCamera && material.id === _currentMaterialId; - clipping.setState(material, camera, useCache); - } - } - let needsProgramChange = false; - if (material.version === materialProperties.__version) { - if (materialProperties.needsLights && materialProperties.lightsStateVersion !== lights.state.version) { - needsProgramChange = true; - } else if (materialProperties.outputColorSpace !== colorSpace) { - needsProgramChange = true; - } else if (object.isInstancedMesh && materialProperties.instancing === false) { - needsProgramChange = true; - } else if (!object.isInstancedMesh && materialProperties.instancing === true) { - needsProgramChange = true; - } else if (object.isSkinnedMesh && materialProperties.skinning === false) { - needsProgramChange = true; - } else if (!object.isSkinnedMesh && materialProperties.skinning === true) { - needsProgramChange = true; - } else if (object.isInstancedMesh && materialProperties.instancingColor === true && object.instanceColor === null) { - needsProgramChange = true; - } else if (object.isInstancedMesh && materialProperties.instancingColor === false && object.instanceColor !== null) { - needsProgramChange = true; - } else if (materialProperties.envMap !== envMap) { - needsProgramChange = true; - } else if (material.fog === true && materialProperties.fog !== fog) { - needsProgramChange = true; - } else if (materialProperties.numClippingPlanes !== void 0 && (materialProperties.numClippingPlanes !== clipping.numPlanes || materialProperties.numIntersection !== clipping.numIntersection)) { - needsProgramChange = true; - } else if (materialProperties.vertexAlphas !== vertexAlphas) { - needsProgramChange = true; - } else if (materialProperties.vertexTangents !== vertexTangents) { - needsProgramChange = true; - } else if (materialProperties.morphTargets !== morphTargets) { - needsProgramChange = true; - } else if (materialProperties.morphNormals !== morphNormals) { - needsProgramChange = true; - } else if (materialProperties.morphColors !== morphColors) { - needsProgramChange = true; - } else if (materialProperties.toneMapping !== toneMapping) { - needsProgramChange = true; - } else if (capabilities.isWebGL2 === true && materialProperties.morphTargetsCount !== morphTargetsCount) { - needsProgramChange = true; - } - } else { - needsProgramChange = true; - materialProperties.__version = material.version; - } - let program = materialProperties.currentProgram; - if (needsProgramChange === true) { - program = getProgram(material, scene, object); - } - let refreshProgram = false; - let refreshMaterial = false; - let refreshLights = false; - const p_uniforms = program.getUniforms(), m_uniforms = materialProperties.uniforms; - if (state.useProgram(program.program)) { - refreshProgram = true; - refreshMaterial = true; - refreshLights = true; - } - if (material.id !== _currentMaterialId) { - _currentMaterialId = material.id; - refreshMaterial = true; - } - if (refreshProgram || _currentCamera !== camera) { - p_uniforms.setValue(_gl, "projectionMatrix", camera.projectionMatrix); - p_uniforms.setValue(_gl, "viewMatrix", camera.matrixWorldInverse); - const uCamPos = p_uniforms.map.cameraPosition; - if (uCamPos !== void 0) { - uCamPos.setValue(_gl, _vector32.setFromMatrixPosition(camera.matrixWorld)); - } - if (capabilities.logarithmicDepthBuffer) { - p_uniforms.setValue( - _gl, - "logDepthBufFC", - 2 / (Math.log(camera.far + 1) / Math.LN2) - ); - } - if (material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshLambertMaterial || material.isMeshBasicMaterial || material.isMeshStandardMaterial || material.isShaderMaterial) { - p_uniforms.setValue(_gl, "isOrthographic", camera.isOrthographicCamera === true); - } - if (_currentCamera !== camera) { - _currentCamera = camera; - refreshMaterial = true; - refreshLights = true; - } - } - if (object.isSkinnedMesh) { - p_uniforms.setOptional(_gl, object, "bindMatrix"); - p_uniforms.setOptional(_gl, object, "bindMatrixInverse"); - const skeleton = object.skeleton; - if (skeleton) { - if (capabilities.floatVertexTextures) { - if (skeleton.boneTexture === null) - skeleton.computeBoneTexture(); - p_uniforms.setValue(_gl, "boneTexture", skeleton.boneTexture, textures); - p_uniforms.setValue(_gl, "boneTextureSize", skeleton.boneTextureSize); - } else { - console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."); - } - } - } - const morphAttributes = geometry.morphAttributes; - if (morphAttributes.position !== void 0 || morphAttributes.normal !== void 0 || morphAttributes.color !== void 0 && capabilities.isWebGL2 === true) { - morphtargets.update(object, geometry, program); - } - if (refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow) { - materialProperties.receiveShadow = object.receiveShadow; - p_uniforms.setValue(_gl, "receiveShadow", object.receiveShadow); - } - if (material.isMeshGouraudMaterial && material.envMap !== null) { - m_uniforms.envMap.value = envMap; - m_uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1; - } - if (refreshMaterial) { - p_uniforms.setValue(_gl, "toneMappingExposure", _this.toneMappingExposure); - if (materialProperties.needsLights) { - markUniformsLightsNeedsUpdate(m_uniforms, refreshLights); - } - if (fog && material.fog === true) { - materials.refreshFogUniforms(m_uniforms, fog); - } - materials.refreshMaterialUniforms(m_uniforms, material, _pixelRatio, _height, _transmissionRenderTarget); - WebGLUniforms.upload(_gl, getUniformList(materialProperties), m_uniforms, textures); - } - if (material.isShaderMaterial && material.uniformsNeedUpdate === true) { - WebGLUniforms.upload(_gl, getUniformList(materialProperties), m_uniforms, textures); - material.uniformsNeedUpdate = false; - } - if (material.isSpriteMaterial) { - p_uniforms.setValue(_gl, "center", object.center); - } - p_uniforms.setValue(_gl, "modelViewMatrix", object.modelViewMatrix); - p_uniforms.setValue(_gl, "normalMatrix", object.normalMatrix); - p_uniforms.setValue(_gl, "modelMatrix", object.matrixWorld); - if (material.isShaderMaterial || material.isRawShaderMaterial) { - const groups = material.uniformsGroups; - for (let i = 0, l = groups.length; i < l; i++) { - if (capabilities.isWebGL2) { - const group = groups[i]; - uniformsGroups.update(group, program); - uniformsGroups.bind(group, program); - } else { - console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2."); - } - } - } - return program; - } - function markUniformsLightsNeedsUpdate(uniforms, value) { - uniforms.ambientLightColor.needsUpdate = value; - uniforms.lightProbe.needsUpdate = value; - uniforms.directionalLights.needsUpdate = value; - uniforms.directionalLightShadows.needsUpdate = value; - uniforms.pointLights.needsUpdate = value; - uniforms.pointLightShadows.needsUpdate = value; - uniforms.spotLights.needsUpdate = value; - uniforms.spotLightShadows.needsUpdate = value; - uniforms.rectAreaLights.needsUpdate = value; - uniforms.hemisphereLights.needsUpdate = value; - } - function materialNeedsLights(material) { - return material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial || material.isMeshStandardMaterial || material.isShadowMaterial || material.isShaderMaterial && material.lights === true; - } - this.getActiveCubeFace = function() { - return _currentActiveCubeFace; - }; - this.getActiveMipmapLevel = function() { - return _currentActiveMipmapLevel; - }; - this.getRenderTarget = function() { - return _currentRenderTarget; - }; - this.setRenderTargetTextures = function(renderTarget, colorTexture, depthTexture) { - properties.get(renderTarget.texture).__webglTexture = colorTexture; - properties.get(renderTarget.depthTexture).__webglTexture = depthTexture; - const renderTargetProperties = properties.get(renderTarget); - renderTargetProperties.__hasExternalTextures = true; - if (renderTargetProperties.__hasExternalTextures) { - renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === void 0; - if (!renderTargetProperties.__autoAllocateDepthBuffer) { - if (extensions.has("WEBGL_multisampled_render_to_texture") === true) { - console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"); - renderTargetProperties.__useRenderToTexture = false; - } - } - } - }; - this.setRenderTargetFramebuffer = function(renderTarget, defaultFramebuffer) { - const renderTargetProperties = properties.get(renderTarget); - renderTargetProperties.__webglFramebuffer = defaultFramebuffer; - renderTargetProperties.__useDefaultFramebuffer = defaultFramebuffer === void 0; - }; - this.setRenderTarget = function(renderTarget, activeCubeFace = 0, activeMipmapLevel = 0) { - _currentRenderTarget = renderTarget; - _currentActiveCubeFace = activeCubeFace; - _currentActiveMipmapLevel = activeMipmapLevel; - let useDefaultFramebuffer = true; - let framebuffer = null; - let isCube = false; - let isRenderTarget3D = false; - if (renderTarget) { - const renderTargetProperties = properties.get(renderTarget); - if (renderTargetProperties.__useDefaultFramebuffer !== void 0) { - state.bindFramebuffer(_gl.FRAMEBUFFER, null); - useDefaultFramebuffer = false; - } else if (renderTargetProperties.__webglFramebuffer === void 0) { - textures.setupRenderTarget(renderTarget); - } else if (renderTargetProperties.__hasExternalTextures) { - textures.rebindTextures(renderTarget, properties.get(renderTarget.texture).__webglTexture, properties.get(renderTarget.depthTexture).__webglTexture); - } - const texture = renderTarget.texture; - if (texture.isData3DTexture || texture.isDataArrayTexture || texture.isCompressedArrayTexture) { - isRenderTarget3D = true; - } - const __webglFramebuffer = properties.get(renderTarget).__webglFramebuffer; - if (renderTarget.isWebGLCubeRenderTarget) { - if (Array.isArray(__webglFramebuffer[activeCubeFace])) { - framebuffer = __webglFramebuffer[activeCubeFace][activeMipmapLevel]; - } else { - framebuffer = __webglFramebuffer[activeCubeFace]; - } - isCube = true; - } else if (capabilities.isWebGL2 && renderTarget.samples > 0 && textures.useMultisampledRTT(renderTarget) === false) { - framebuffer = properties.get(renderTarget).__webglMultisampledFramebuffer; - } else { - if (Array.isArray(__webglFramebuffer)) { - framebuffer = __webglFramebuffer[activeMipmapLevel]; - } else { - framebuffer = __webglFramebuffer; - } - } - _currentViewport.copy(renderTarget.viewport); - _currentScissor.copy(renderTarget.scissor); - _currentScissorTest = renderTarget.scissorTest; - } else { - _currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor(); - _currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor(); - _currentScissorTest = _scissorTest; - } - const framebufferBound = state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer); - if (framebufferBound && capabilities.drawBuffers && useDefaultFramebuffer) { - state.drawBuffers(renderTarget, framebuffer); - } - state.viewport(_currentViewport); - state.scissor(_currentScissor); - state.setScissorTest(_currentScissorTest); - if (isCube) { - const textureProperties = properties.get(renderTarget.texture); - _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel); - } else if (isRenderTarget3D) { - const textureProperties = properties.get(renderTarget.texture); - const layer = activeCubeFace || 0; - _gl.framebufferTextureLayer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel || 0, layer); - } - _currentMaterialId = -1; - }; - this.readRenderTargetPixels = function(renderTarget, x, y, width, height, buffer, activeCubeFaceIndex) { - if (!(renderTarget && renderTarget.isWebGLRenderTarget)) { - console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget."); - return; - } - let framebuffer = properties.get(renderTarget).__webglFramebuffer; - if (renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== void 0) { - framebuffer = framebuffer[activeCubeFaceIndex]; - } - if (framebuffer) { - state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer); - try { - const texture = renderTarget.texture; - const textureFormat = texture.format; - const textureType = texture.type; - if (textureFormat !== RGBAFormat && utils.convert(textureFormat) !== _gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_FORMAT)) { - console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."); - return; - } - const halfFloatSupportedByExt = textureType === HalfFloatType && (extensions.has("EXT_color_buffer_half_float") || capabilities.isWebGL2 && extensions.has("EXT_color_buffer_float")); - if (textureType !== UnsignedByteType && utils.convert(textureType) !== _gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_TYPE) && // Edge and Chrome Mac < 52 (#9513) - !(textureType === FloatType && (capabilities.isWebGL2 || extensions.has("OES_texture_float") || extensions.has("WEBGL_color_buffer_float"))) && // Chrome Mac >= 52 and Firefox - !halfFloatSupportedByExt) { - console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type."); - return; - } - if (x >= 0 && x <= renderTarget.width - width && (y >= 0 && y <= renderTarget.height - height)) { - _gl.readPixels(x, y, width, height, utils.convert(textureFormat), utils.convert(textureType), buffer); - } - } finally { - const framebuffer2 = _currentRenderTarget !== null ? properties.get(_currentRenderTarget).__webglFramebuffer : null; - state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer2); - } - } - }; - this.copyFramebufferToTexture = function(position, texture, level = 0) { - const levelScale = Math.pow(2, -level); - const width = Math.floor(texture.image.width * levelScale); - const height = Math.floor(texture.image.height * levelScale); - textures.setTexture2D(texture, 0); - _gl.copyTexSubImage2D(_gl.TEXTURE_2D, level, 0, 0, position.x, position.y, width, height); - state.unbindTexture(); - }; - this.copyTextureToTexture = function(position, srcTexture, dstTexture, level = 0) { - const width = srcTexture.image.width; - const height = srcTexture.image.height; - const glFormat = utils.convert(dstTexture.format); - const glType = utils.convert(dstTexture.type); - textures.setTexture2D(dstTexture, 0); - _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY); - _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha); - _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment); - if (srcTexture.isDataTexture) { - _gl.texSubImage2D(_gl.TEXTURE_2D, level, position.x, position.y, width, height, glFormat, glType, srcTexture.image.data); - } else { - if (srcTexture.isCompressedTexture) { - _gl.compressedTexSubImage2D(_gl.TEXTURE_2D, level, position.x, position.y, srcTexture.mipmaps[0].width, srcTexture.mipmaps[0].height, glFormat, srcTexture.mipmaps[0].data); - } else { - _gl.texSubImage2D(_gl.TEXTURE_2D, level, position.x, position.y, glFormat, glType, srcTexture.image); - } - } - if (level === 0 && dstTexture.generateMipmaps) - _gl.generateMipmap(_gl.TEXTURE_2D); - state.unbindTexture(); - }; - this.copyTextureToTexture3D = function(sourceBox, position, srcTexture, dstTexture, level = 0) { - if (_this.isWebGL1Renderer) { - console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2."); - return; - } - const width = sourceBox.max.x - sourceBox.min.x + 1; - const height = sourceBox.max.y - sourceBox.min.y + 1; - const depth2 = sourceBox.max.z - sourceBox.min.z + 1; - const glFormat = utils.convert(dstTexture.format); - const glType = utils.convert(dstTexture.type); - let glTarget; - if (dstTexture.isData3DTexture) { - textures.setTexture3D(dstTexture, 0); - glTarget = _gl.TEXTURE_3D; - } else if (dstTexture.isDataArrayTexture) { - textures.setTexture2DArray(dstTexture, 0); - glTarget = _gl.TEXTURE_2D_ARRAY; - } else { - console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray."); - return; - } - _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY); - _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha); - _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment); - const unpackRowLen = _gl.getParameter(_gl.UNPACK_ROW_LENGTH); - const unpackImageHeight = _gl.getParameter(_gl.UNPACK_IMAGE_HEIGHT); - const unpackSkipPixels = _gl.getParameter(_gl.UNPACK_SKIP_PIXELS); - const unpackSkipRows = _gl.getParameter(_gl.UNPACK_SKIP_ROWS); - const unpackSkipImages = _gl.getParameter(_gl.UNPACK_SKIP_IMAGES); - const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[0] : srcTexture.image; - _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width); - _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, image.height); - _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, sourceBox.min.x); - _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, sourceBox.min.y); - _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, sourceBox.min.z); - if (srcTexture.isDataTexture || srcTexture.isData3DTexture) { - _gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth2, glFormat, glType, image.data); - } else { - if (srcTexture.isCompressedArrayTexture) { - console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."); - _gl.compressedTexSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth2, glFormat, image.data); - } else { - _gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth2, glFormat, glType, image); - } - } - _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, unpackRowLen); - _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, unpackImageHeight); - _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, unpackSkipPixels); - _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, unpackSkipRows); - _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, unpackSkipImages); - if (level === 0 && dstTexture.generateMipmaps) - _gl.generateMipmap(glTarget); - state.unbindTexture(); - }; - this.initTexture = function(texture) { - if (texture.isCubeTexture) { - textures.setTextureCube(texture, 0); - } else if (texture.isData3DTexture) { - textures.setTexture3D(texture, 0); - } else if (texture.isDataArrayTexture || texture.isCompressedArrayTexture) { - textures.setTexture2DArray(texture, 0); - } else { - textures.setTexture2D(texture, 0); - } - state.unbindTexture(); - }; - this.resetState = function() { - _currentActiveCubeFace = 0; - _currentActiveMipmapLevel = 0; - _currentRenderTarget = null; - state.reset(); - bindingStates.reset(); - }; - if (typeof __THREE_DEVTOOLS__ !== "undefined") { - __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { detail: this })); - } - } - get coordinateSystem() { - return WebGLCoordinateSystem; - } - get outputColorSpace() { - return this._outputColorSpace; - } - set outputColorSpace(colorSpace) { - this._outputColorSpace = colorSpace; - const gl = this.getContext(); - gl.drawingBufferColorSpace = colorSpace === DisplayP3ColorSpace ? "display-p3" : "srgb"; - gl.unpackColorSpace = ColorManagement.workingColorSpace === LinearDisplayP3ColorSpace ? "display-p3" : "srgb"; - } - get physicallyCorrectLights() { - console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."); - return !this.useLegacyLights; - } - set physicallyCorrectLights(value) { - console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."); - this.useLegacyLights = !value; - } - get outputEncoding() { - console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."); - return this.outputColorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding; - } - set outputEncoding(encoding) { - console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."); - this.outputColorSpace = encoding === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace; - } - get useLegacyLights() { - console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."); - return this._useLegacyLights; - } - set useLegacyLights(value) { - console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."); - this._useLegacyLights = value; - } -}; -var WebGL1Renderer = class extends WebGLRenderer { -}; -WebGL1Renderer.prototype.isWebGL1Renderer = true; -var FogExp2 = class _FogExp2 { - constructor(color, density = 25e-5) { - this.isFogExp2 = true; - this.name = ""; - this.color = new Color(color); - this.density = density; - } - clone() { - return new _FogExp2(this.color, this.density); - } - toJSON() { - return { - type: "FogExp2", - name: this.name, - color: this.color.getHex(), - density: this.density - }; - } -}; -var Fog = class _Fog { - constructor(color, near = 1, far = 1e3) { - this.isFog = true; - this.name = ""; - this.color = new Color(color); - this.near = near; - this.far = far; - } - clone() { - return new _Fog(this.color, this.near, this.far); - } - toJSON() { - return { - type: "Fog", - name: this.name, - color: this.color.getHex(), - near: this.near, - far: this.far - }; - } -}; -var Scene = class extends Object3D { - constructor() { - super(); - this.isScene = true; - this.type = "Scene"; - this.background = null; - this.environment = null; - this.fog = null; - this.backgroundBlurriness = 0; - this.backgroundIntensity = 1; - this.overrideMaterial = null; - if (typeof __THREE_DEVTOOLS__ !== "undefined") { - __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { detail: this })); - } - } - copy(source, recursive) { - super.copy(source, recursive); - if (source.background !== null) - this.background = source.background.clone(); - if (source.environment !== null) - this.environment = source.environment.clone(); - if (source.fog !== null) - this.fog = source.fog.clone(); - this.backgroundBlurriness = source.backgroundBlurriness; - this.backgroundIntensity = source.backgroundIntensity; - if (source.overrideMaterial !== null) - this.overrideMaterial = source.overrideMaterial.clone(); - this.matrixAutoUpdate = source.matrixAutoUpdate; - return this; - } - toJSON(meta) { - const data = super.toJSON(meta); - if (this.fog !== null) - data.object.fog = this.fog.toJSON(); - if (this.backgroundBlurriness > 0) - data.object.backgroundBlurriness = this.backgroundBlurriness; - if (this.backgroundIntensity !== 1) - data.object.backgroundIntensity = this.backgroundIntensity; - return data; - } -}; -var InterleavedBuffer = class { - constructor(array, stride) { - this.isInterleavedBuffer = true; - this.array = array; - this.stride = stride; - this.count = array !== void 0 ? array.length / stride : 0; - this.usage = StaticDrawUsage; - this.updateRange = { offset: 0, count: -1 }; - this.version = 0; - this.uuid = generateUUID(); - } - onUploadCallback() { - } - set needsUpdate(value) { - if (value === true) - this.version++; - } - setUsage(value) { - this.usage = value; - return this; - } - copy(source) { - this.array = new source.array.constructor(source.array); - this.count = source.count; - this.stride = source.stride; - this.usage = source.usage; - return this; - } - copyAt(index1, attribute, index2) { - index1 *= this.stride; - index2 *= attribute.stride; - for (let i = 0, l = this.stride; i < l; i++) { - this.array[index1 + i] = attribute.array[index2 + i]; - } - return this; - } - set(value, offset = 0) { - this.array.set(value, offset); - return this; - } - clone(data) { - if (data.arrayBuffers === void 0) { - data.arrayBuffers = {}; - } - if (this.array.buffer._uuid === void 0) { - this.array.buffer._uuid = generateUUID(); - } - if (data.arrayBuffers[this.array.buffer._uuid] === void 0) { - data.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer; - } - const array = new this.array.constructor(data.arrayBuffers[this.array.buffer._uuid]); - const ib = new this.constructor(array, this.stride); - ib.setUsage(this.usage); - return ib; - } - onUpload(callback) { - this.onUploadCallback = callback; - return this; - } - toJSON(data) { - if (data.arrayBuffers === void 0) { - data.arrayBuffers = {}; - } - if (this.array.buffer._uuid === void 0) { - this.array.buffer._uuid = generateUUID(); - } - if (data.arrayBuffers[this.array.buffer._uuid] === void 0) { - data.arrayBuffers[this.array.buffer._uuid] = Array.from(new Uint32Array(this.array.buffer)); - } - return { - uuid: this.uuid, - buffer: this.array.buffer._uuid, - type: this.array.constructor.name, - stride: this.stride - }; - } -}; -var _vector$5 = new Vector3(); -var InterleavedBufferAttribute = class _InterleavedBufferAttribute { - constructor(interleavedBuffer, itemSize, offset, normalized = false) { - this.isInterleavedBufferAttribute = true; - this.name = ""; - this.data = interleavedBuffer; - this.itemSize = itemSize; - this.offset = offset; - this.normalized = normalized; - } - get count() { - return this.data.count; - } - get array() { - return this.data.array; - } - set needsUpdate(value) { - this.data.needsUpdate = value; - } - applyMatrix4(m) { - for (let i = 0, l = this.data.count; i < l; i++) { - _vector$5.fromBufferAttribute(this, i); - _vector$5.applyMatrix4(m); - this.setXYZ(i, _vector$5.x, _vector$5.y, _vector$5.z); - } - return this; - } - applyNormalMatrix(m) { - for (let i = 0, l = this.count; i < l; i++) { - _vector$5.fromBufferAttribute(this, i); - _vector$5.applyNormalMatrix(m); - this.setXYZ(i, _vector$5.x, _vector$5.y, _vector$5.z); - } - return this; - } - transformDirection(m) { - for (let i = 0, l = this.count; i < l; i++) { - _vector$5.fromBufferAttribute(this, i); - _vector$5.transformDirection(m); - this.setXYZ(i, _vector$5.x, _vector$5.y, _vector$5.z); - } - return this; - } - setX(index, x) { - if (this.normalized) - x = normalize(x, this.array); - this.data.array[index * this.data.stride + this.offset] = x; - return this; - } - setY(index, y) { - if (this.normalized) - y = normalize(y, this.array); - this.data.array[index * this.data.stride + this.offset + 1] = y; - return this; - } - setZ(index, z) { - if (this.normalized) - z = normalize(z, this.array); - this.data.array[index * this.data.stride + this.offset + 2] = z; - return this; - } - setW(index, w) { - if (this.normalized) - w = normalize(w, this.array); - this.data.array[index * this.data.stride + this.offset + 3] = w; - return this; - } - getX(index) { - let x = this.data.array[index * this.data.stride + this.offset]; - if (this.normalized) - x = denormalize(x, this.array); - return x; - } - getY(index) { - let y = this.data.array[index * this.data.stride + this.offset + 1]; - if (this.normalized) - y = denormalize(y, this.array); - return y; - } - getZ(index) { - let z = this.data.array[index * this.data.stride + this.offset + 2]; - if (this.normalized) - z = denormalize(z, this.array); - return z; - } - getW(index) { - let w = this.data.array[index * this.data.stride + this.offset + 3]; - if (this.normalized) - w = denormalize(w, this.array); - return w; - } - setXY(index, x, y) { - index = index * this.data.stride + this.offset; - if (this.normalized) { - x = normalize(x, this.array); - y = normalize(y, this.array); - } - this.data.array[index + 0] = x; - this.data.array[index + 1] = y; - return this; - } - setXYZ(index, x, y, z) { - index = index * this.data.stride + this.offset; - if (this.normalized) { - x = normalize(x, this.array); - y = normalize(y, this.array); - z = normalize(z, this.array); - } - this.data.array[index + 0] = x; - this.data.array[index + 1] = y; - this.data.array[index + 2] = z; - return this; - } - setXYZW(index, x, y, z, w) { - index = index * this.data.stride + this.offset; - if (this.normalized) { - x = normalize(x, this.array); - y = normalize(y, this.array); - z = normalize(z, this.array); - w = normalize(w, this.array); - } - this.data.array[index + 0] = x; - this.data.array[index + 1] = y; - this.data.array[index + 2] = z; - this.data.array[index + 3] = w; - return this; - } - clone(data) { - if (data === void 0) { - console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data."); - const array = []; - for (let i = 0; i < this.count; i++) { - const index = i * this.data.stride + this.offset; - for (let j = 0; j < this.itemSize; j++) { - array.push(this.data.array[index + j]); - } - } - return new BufferAttribute(new this.array.constructor(array), this.itemSize, this.normalized); - } else { - if (data.interleavedBuffers === void 0) { - data.interleavedBuffers = {}; - } - if (data.interleavedBuffers[this.data.uuid] === void 0) { - data.interleavedBuffers[this.data.uuid] = this.data.clone(data); - } - return new _InterleavedBufferAttribute(data.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized); - } - } - toJSON(data) { - if (data === void 0) { - console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data."); - const array = []; - for (let i = 0; i < this.count; i++) { - const index = i * this.data.stride + this.offset; - for (let j = 0; j < this.itemSize; j++) { - array.push(this.data.array[index + j]); - } - } - return { - itemSize: this.itemSize, - type: this.array.constructor.name, - array, - normalized: this.normalized - }; - } else { - if (data.interleavedBuffers === void 0) { - data.interleavedBuffers = {}; - } - if (data.interleavedBuffers[this.data.uuid] === void 0) { - data.interleavedBuffers[this.data.uuid] = this.data.toJSON(data); - } - return { - isInterleavedBufferAttribute: true, - itemSize: this.itemSize, - data: this.data.uuid, - offset: this.offset, - normalized: this.normalized - }; - } - } -}; -var SpriteMaterial = class extends Material { - constructor(parameters) { - super(); - this.isSpriteMaterial = true; - this.type = "SpriteMaterial"; - this.color = new Color(16777215); - this.map = null; - this.alphaMap = null; - this.rotation = 0; - this.sizeAttenuation = true; - this.transparent = true; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.color.copy(source.color); - this.map = source.map; - this.alphaMap = source.alphaMap; - this.rotation = source.rotation; - this.sizeAttenuation = source.sizeAttenuation; - this.fog = source.fog; - return this; - } -}; -var _geometry; -var _intersectPoint = new Vector3(); -var _worldScale = new Vector3(); -var _mvPosition = new Vector3(); -var _alignedPosition = new Vector2(); -var _rotatedPosition = new Vector2(); -var _viewWorldMatrix = new Matrix4(); -var _vA = new Vector3(); -var _vB = new Vector3(); -var _vC = new Vector3(); -var _uvA = new Vector2(); -var _uvB = new Vector2(); -var _uvC = new Vector2(); -var Sprite = class extends Object3D { - constructor(material = new SpriteMaterial()) { - super(); - this.isSprite = true; - this.type = "Sprite"; - if (_geometry === void 0) { - _geometry = new BufferGeometry(); - const float32Array = new Float32Array([ - -0.5, - -0.5, - 0, - 0, - 0, - 0.5, - -0.5, - 0, - 1, - 0, - 0.5, - 0.5, - 0, - 1, - 1, - -0.5, - 0.5, - 0, - 0, - 1 - ]); - const interleavedBuffer = new InterleavedBuffer(float32Array, 5); - _geometry.setIndex([0, 1, 2, 0, 2, 3]); - _geometry.setAttribute("position", new InterleavedBufferAttribute(interleavedBuffer, 3, 0, false)); - _geometry.setAttribute("uv", new InterleavedBufferAttribute(interleavedBuffer, 2, 3, false)); - } - this.geometry = _geometry; - this.material = material; - this.center = new Vector2(0.5, 0.5); - } - raycast(raycaster, intersects2) { - if (raycaster.camera === null) { - console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'); - } - _worldScale.setFromMatrixScale(this.matrixWorld); - _viewWorldMatrix.copy(raycaster.camera.matrixWorld); - this.modelViewMatrix.multiplyMatrices(raycaster.camera.matrixWorldInverse, this.matrixWorld); - _mvPosition.setFromMatrixPosition(this.modelViewMatrix); - if (raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false) { - _worldScale.multiplyScalar(-_mvPosition.z); - } - const rotation = this.material.rotation; - let sin, cos; - if (rotation !== 0) { - cos = Math.cos(rotation); - sin = Math.sin(rotation); - } - const center = this.center; - transformVertex(_vA.set(-0.5, -0.5, 0), _mvPosition, center, _worldScale, sin, cos); - transformVertex(_vB.set(0.5, -0.5, 0), _mvPosition, center, _worldScale, sin, cos); - transformVertex(_vC.set(0.5, 0.5, 0), _mvPosition, center, _worldScale, sin, cos); - _uvA.set(0, 0); - _uvB.set(1, 0); - _uvC.set(1, 1); - let intersect = raycaster.ray.intersectTriangle(_vA, _vB, _vC, false, _intersectPoint); - if (intersect === null) { - transformVertex(_vB.set(-0.5, 0.5, 0), _mvPosition, center, _worldScale, sin, cos); - _uvB.set(0, 1); - intersect = raycaster.ray.intersectTriangle(_vA, _vC, _vB, false, _intersectPoint); - if (intersect === null) { - return; - } - } - const distance = raycaster.ray.origin.distanceTo(_intersectPoint); - if (distance < raycaster.near || distance > raycaster.far) - return; - intersects2.push({ - distance, - point: _intersectPoint.clone(), - uv: Triangle.getInterpolation(_intersectPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2()), - face: null, - object: this - }); - } - copy(source, recursive) { - super.copy(source, recursive); - if (source.center !== void 0) - this.center.copy(source.center); - this.material = source.material; - return this; - } -}; -function transformVertex(vertexPosition, mvPosition, center, scale, sin, cos) { - _alignedPosition.subVectors(vertexPosition, center).addScalar(0.5).multiply(scale); - if (sin !== void 0) { - _rotatedPosition.x = cos * _alignedPosition.x - sin * _alignedPosition.y; - _rotatedPosition.y = sin * _alignedPosition.x + cos * _alignedPosition.y; - } else { - _rotatedPosition.copy(_alignedPosition); - } - vertexPosition.copy(mvPosition); - vertexPosition.x += _rotatedPosition.x; - vertexPosition.y += _rotatedPosition.y; - vertexPosition.applyMatrix4(_viewWorldMatrix); -} -var _v1$2 = new Vector3(); -var _v2$1 = new Vector3(); -var LOD = class extends Object3D { - constructor() { - super(); - this._currentLevel = 0; - this.type = "LOD"; - Object.defineProperties(this, { - levels: { - enumerable: true, - value: [] - }, - isLOD: { - value: true - } - }); - this.autoUpdate = true; - } - copy(source) { - super.copy(source, false); - const levels = source.levels; - for (let i = 0, l = levels.length; i < l; i++) { - const level = levels[i]; - this.addLevel(level.object.clone(), level.distance, level.hysteresis); - } - this.autoUpdate = source.autoUpdate; - return this; - } - addLevel(object, distance = 0, hysteresis = 0) { - distance = Math.abs(distance); - const levels = this.levels; - let l; - for (l = 0; l < levels.length; l++) { - if (distance < levels[l].distance) { - break; - } - } - levels.splice(l, 0, { distance, hysteresis, object }); - this.add(object); - return this; - } - getCurrentLevel() { - return this._currentLevel; - } - getObjectForDistance(distance) { - const levels = this.levels; - if (levels.length > 0) { - let i, l; - for (i = 1, l = levels.length; i < l; i++) { - let levelDistance = levels[i].distance; - if (levels[i].object.visible) { - levelDistance -= levelDistance * levels[i].hysteresis; - } - if (distance < levelDistance) { - break; - } - } - return levels[i - 1].object; - } - return null; - } - raycast(raycaster, intersects2) { - const levels = this.levels; - if (levels.length > 0) { - _v1$2.setFromMatrixPosition(this.matrixWorld); - const distance = raycaster.ray.origin.distanceTo(_v1$2); - this.getObjectForDistance(distance).raycast(raycaster, intersects2); - } - } - update(camera) { - const levels = this.levels; - if (levels.length > 1) { - _v1$2.setFromMatrixPosition(camera.matrixWorld); - _v2$1.setFromMatrixPosition(this.matrixWorld); - const distance = _v1$2.distanceTo(_v2$1) / camera.zoom; - levels[0].object.visible = true; - let i, l; - for (i = 1, l = levels.length; i < l; i++) { - let levelDistance = levels[i].distance; - if (levels[i].object.visible) { - levelDistance -= levelDistance * levels[i].hysteresis; - } - if (distance >= levelDistance) { - levels[i - 1].object.visible = false; - levels[i].object.visible = true; - } else { - break; - } - } - this._currentLevel = i - 1; - for (; i < l; i++) { - levels[i].object.visible = false; - } - } - } - toJSON(meta) { - const data = super.toJSON(meta); - if (this.autoUpdate === false) - data.object.autoUpdate = false; - data.object.levels = []; - const levels = this.levels; - for (let i = 0, l = levels.length; i < l; i++) { - const level = levels[i]; - data.object.levels.push({ - object: level.object.uuid, - distance: level.distance, - hysteresis: level.hysteresis - }); - } - return data; - } -}; -var _basePosition = new Vector3(); -var _skinIndex = new Vector4(); -var _skinWeight = new Vector4(); -var _vector3 = new Vector3(); -var _matrix4 = new Matrix4(); -var _vertex = new Vector3(); -var _sphere$3 = new Sphere(); -var _inverseMatrix$2 = new Matrix4(); -var _ray$2 = new Ray(); -var SkinnedMesh = class extends Mesh { - constructor(geometry, material) { - super(geometry, material); - this.isSkinnedMesh = true; - this.type = "SkinnedMesh"; - this.bindMode = AttachedBindMode; - this.bindMatrix = new Matrix4(); - this.bindMatrixInverse = new Matrix4(); - this.boundingBox = null; - this.boundingSphere = null; - } - computeBoundingBox() { - const geometry = this.geometry; - if (this.boundingBox === null) { - this.boundingBox = new Box3(); - } - this.boundingBox.makeEmpty(); - const positionAttribute = geometry.getAttribute("position"); - for (let i = 0; i < positionAttribute.count; i++) { - this.getVertexPosition(i, _vertex); - this.boundingBox.expandByPoint(_vertex); - } - } - computeBoundingSphere() { - const geometry = this.geometry; - if (this.boundingSphere === null) { - this.boundingSphere = new Sphere(); - } - this.boundingSphere.makeEmpty(); - const positionAttribute = geometry.getAttribute("position"); - for (let i = 0; i < positionAttribute.count; i++) { - this.getVertexPosition(i, _vertex); - this.boundingSphere.expandByPoint(_vertex); - } - } - copy(source, recursive) { - super.copy(source, recursive); - this.bindMode = source.bindMode; - this.bindMatrix.copy(source.bindMatrix); - this.bindMatrixInverse.copy(source.bindMatrixInverse); - this.skeleton = source.skeleton; - if (source.boundingBox !== null) - this.boundingBox = source.boundingBox.clone(); - if (source.boundingSphere !== null) - this.boundingSphere = source.boundingSphere.clone(); - return this; - } - raycast(raycaster, intersects2) { - const material = this.material; - const matrixWorld = this.matrixWorld; - if (material === void 0) - return; - if (this.boundingSphere === null) - this.computeBoundingSphere(); - _sphere$3.copy(this.boundingSphere); - _sphere$3.applyMatrix4(matrixWorld); - if (raycaster.ray.intersectsSphere(_sphere$3) === false) - return; - _inverseMatrix$2.copy(matrixWorld).invert(); - _ray$2.copy(raycaster.ray).applyMatrix4(_inverseMatrix$2); - if (this.boundingBox !== null) { - if (_ray$2.intersectsBox(this.boundingBox) === false) - return; - } - this._computeIntersections(raycaster, intersects2, _ray$2); - } - getVertexPosition(index, target) { - super.getVertexPosition(index, target); - this.applyBoneTransform(index, target); - return target; - } - bind(skeleton, bindMatrix) { - this.skeleton = skeleton; - if (bindMatrix === void 0) { - this.updateMatrixWorld(true); - this.skeleton.calculateInverses(); - bindMatrix = this.matrixWorld; - } - this.bindMatrix.copy(bindMatrix); - this.bindMatrixInverse.copy(bindMatrix).invert(); - } - pose() { - this.skeleton.pose(); - } - normalizeSkinWeights() { - const vector = new Vector4(); - const skinWeight = this.geometry.attributes.skinWeight; - for (let i = 0, l = skinWeight.count; i < l; i++) { - vector.fromBufferAttribute(skinWeight, i); - const scale = 1 / vector.manhattanLength(); - if (scale !== Infinity) { - vector.multiplyScalar(scale); - } else { - vector.set(1, 0, 0, 0); - } - skinWeight.setXYZW(i, vector.x, vector.y, vector.z, vector.w); - } - } - updateMatrixWorld(force) { - super.updateMatrixWorld(force); - if (this.bindMode === AttachedBindMode) { - this.bindMatrixInverse.copy(this.matrixWorld).invert(); - } else if (this.bindMode === DetachedBindMode) { - this.bindMatrixInverse.copy(this.bindMatrix).invert(); - } else { - console.warn("THREE.SkinnedMesh: Unrecognized bindMode: " + this.bindMode); - } - } - applyBoneTransform(index, vector) { - const skeleton = this.skeleton; - const geometry = this.geometry; - _skinIndex.fromBufferAttribute(geometry.attributes.skinIndex, index); - _skinWeight.fromBufferAttribute(geometry.attributes.skinWeight, index); - _basePosition.copy(vector).applyMatrix4(this.bindMatrix); - vector.set(0, 0, 0); - for (let i = 0; i < 4; i++) { - const weight = _skinWeight.getComponent(i); - if (weight !== 0) { - const boneIndex = _skinIndex.getComponent(i); - _matrix4.multiplyMatrices(skeleton.bones[boneIndex].matrixWorld, skeleton.boneInverses[boneIndex]); - vector.addScaledVector(_vector3.copy(_basePosition).applyMatrix4(_matrix4), weight); - } - } - return vector.applyMatrix4(this.bindMatrixInverse); - } - boneTransform(index, vector) { - console.warn("THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151."); - return this.applyBoneTransform(index, vector); - } -}; -var Bone = class extends Object3D { - constructor() { - super(); - this.isBone = true; - this.type = "Bone"; - } -}; -var DataTexture = class extends Texture { - constructor(data = null, width = 1, height = 1, format, type, mapping, wrapS, wrapT, magFilter = NearestFilter, minFilter = NearestFilter, anisotropy, colorSpace) { - super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace); - this.isDataTexture = true; - this.image = { data, width, height }; - this.generateMipmaps = false; - this.flipY = false; - this.unpackAlignment = 1; - } -}; -var _offsetMatrix = new Matrix4(); -var _identityMatrix = new Matrix4(); -var Skeleton = class _Skeleton { - constructor(bones = [], boneInverses = []) { - this.uuid = generateUUID(); - this.bones = bones.slice(0); - this.boneInverses = boneInverses; - this.boneMatrices = null; - this.boneTexture = null; - this.boneTextureSize = 0; - this.init(); - } - init() { - const bones = this.bones; - const boneInverses = this.boneInverses; - this.boneMatrices = new Float32Array(bones.length * 16); - if (boneInverses.length === 0) { - this.calculateInverses(); - } else { - if (bones.length !== boneInverses.length) { - console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."); - this.boneInverses = []; - for (let i = 0, il = this.bones.length; i < il; i++) { - this.boneInverses.push(new Matrix4()); - } - } - } - } - calculateInverses() { - this.boneInverses.length = 0; - for (let i = 0, il = this.bones.length; i < il; i++) { - const inverse = new Matrix4(); - if (this.bones[i]) { - inverse.copy(this.bones[i].matrixWorld).invert(); - } - this.boneInverses.push(inverse); - } - } - pose() { - for (let i = 0, il = this.bones.length; i < il; i++) { - const bone = this.bones[i]; - if (bone) { - bone.matrixWorld.copy(this.boneInverses[i]).invert(); - } - } - for (let i = 0, il = this.bones.length; i < il; i++) { - const bone = this.bones[i]; - if (bone) { - if (bone.parent && bone.parent.isBone) { - bone.matrix.copy(bone.parent.matrixWorld).invert(); - bone.matrix.multiply(bone.matrixWorld); - } else { - bone.matrix.copy(bone.matrixWorld); - } - bone.matrix.decompose(bone.position, bone.quaternion, bone.scale); - } - } - } - update() { - const bones = this.bones; - const boneInverses = this.boneInverses; - const boneMatrices = this.boneMatrices; - const boneTexture = this.boneTexture; - for (let i = 0, il = bones.length; i < il; i++) { - const matrix = bones[i] ? bones[i].matrixWorld : _identityMatrix; - _offsetMatrix.multiplyMatrices(matrix, boneInverses[i]); - _offsetMatrix.toArray(boneMatrices, i * 16); - } - if (boneTexture !== null) { - boneTexture.needsUpdate = true; - } - } - clone() { - return new _Skeleton(this.bones, this.boneInverses); - } - computeBoneTexture() { - let size = Math.sqrt(this.bones.length * 4); - size = ceilPowerOfTwo(size); - size = Math.max(size, 4); - const boneMatrices = new Float32Array(size * size * 4); - boneMatrices.set(this.boneMatrices); - const boneTexture = new DataTexture(boneMatrices, size, size, RGBAFormat, FloatType); - boneTexture.needsUpdate = true; - this.boneMatrices = boneMatrices; - this.boneTexture = boneTexture; - this.boneTextureSize = size; - return this; - } - getBoneByName(name) { - for (let i = 0, il = this.bones.length; i < il; i++) { - const bone = this.bones[i]; - if (bone.name === name) { - return bone; - } - } - return void 0; - } - dispose() { - if (this.boneTexture !== null) { - this.boneTexture.dispose(); - this.boneTexture = null; - } - } - fromJSON(json, bones) { - this.uuid = json.uuid; - for (let i = 0, l = json.bones.length; i < l; i++) { - const uuid = json.bones[i]; - let bone = bones[uuid]; - if (bone === void 0) { - console.warn("THREE.Skeleton: No bone found with UUID:", uuid); - bone = new Bone(); - } - this.bones.push(bone); - this.boneInverses.push(new Matrix4().fromArray(json.boneInverses[i])); - } - this.init(); - return this; - } - toJSON() { - const data = { - metadata: { - version: 4.6, - type: "Skeleton", - generator: "Skeleton.toJSON" - }, - bones: [], - boneInverses: [] - }; - data.uuid = this.uuid; - const bones = this.bones; - const boneInverses = this.boneInverses; - for (let i = 0, l = bones.length; i < l; i++) { - const bone = bones[i]; - data.bones.push(bone.uuid); - const boneInverse = boneInverses[i]; - data.boneInverses.push(boneInverse.toArray()); - } - return data; - } -}; -var InstancedBufferAttribute = class extends BufferAttribute { - constructor(array, itemSize, normalized, meshPerAttribute = 1) { - super(array, itemSize, normalized); - this.isInstancedBufferAttribute = true; - this.meshPerAttribute = meshPerAttribute; - } - copy(source) { - super.copy(source); - this.meshPerAttribute = source.meshPerAttribute; - return this; - } - toJSON() { - const data = super.toJSON(); - data.meshPerAttribute = this.meshPerAttribute; - data.isInstancedBufferAttribute = true; - return data; - } -}; -var _instanceLocalMatrix = new Matrix4(); -var _instanceWorldMatrix = new Matrix4(); -var _instanceIntersects = []; -var _box3 = new Box3(); -var _identity = new Matrix4(); -var _mesh = new Mesh(); -var _sphere$2 = new Sphere(); -var InstancedMesh = class extends Mesh { - constructor(geometry, material, count) { - super(geometry, material); - this.isInstancedMesh = true; - this.instanceMatrix = new InstancedBufferAttribute(new Float32Array(count * 16), 16); - this.instanceColor = null; - this.count = count; - this.boundingBox = null; - this.boundingSphere = null; - for (let i = 0; i < count; i++) { - this.setMatrixAt(i, _identity); - } - } - computeBoundingBox() { - const geometry = this.geometry; - const count = this.count; - if (this.boundingBox === null) { - this.boundingBox = new Box3(); - } - if (geometry.boundingBox === null) { - geometry.computeBoundingBox(); - } - this.boundingBox.makeEmpty(); - for (let i = 0; i < count; i++) { - this.getMatrixAt(i, _instanceLocalMatrix); - _box3.copy(geometry.boundingBox).applyMatrix4(_instanceLocalMatrix); - this.boundingBox.union(_box3); - } - } - computeBoundingSphere() { - const geometry = this.geometry; - const count = this.count; - if (this.boundingSphere === null) { - this.boundingSphere = new Sphere(); - } - if (geometry.boundingSphere === null) { - geometry.computeBoundingSphere(); - } - this.boundingSphere.makeEmpty(); - for (let i = 0; i < count; i++) { - this.getMatrixAt(i, _instanceLocalMatrix); - _sphere$2.copy(geometry.boundingSphere).applyMatrix4(_instanceLocalMatrix); - this.boundingSphere.union(_sphere$2); - } - } - copy(source, recursive) { - super.copy(source, recursive); - this.instanceMatrix.copy(source.instanceMatrix); - if (source.instanceColor !== null) - this.instanceColor = source.instanceColor.clone(); - this.count = source.count; - if (source.boundingBox !== null) - this.boundingBox = source.boundingBox.clone(); - if (source.boundingSphere !== null) - this.boundingSphere = source.boundingSphere.clone(); - return this; - } - getColorAt(index, color) { - color.fromArray(this.instanceColor.array, index * 3); - } - getMatrixAt(index, matrix) { - matrix.fromArray(this.instanceMatrix.array, index * 16); - } - raycast(raycaster, intersects2) { - const matrixWorld = this.matrixWorld; - const raycastTimes = this.count; - _mesh.geometry = this.geometry; - _mesh.material = this.material; - if (_mesh.material === void 0) - return; - if (this.boundingSphere === null) - this.computeBoundingSphere(); - _sphere$2.copy(this.boundingSphere); - _sphere$2.applyMatrix4(matrixWorld); - if (raycaster.ray.intersectsSphere(_sphere$2) === false) - return; - for (let instanceId = 0; instanceId < raycastTimes; instanceId++) { - this.getMatrixAt(instanceId, _instanceLocalMatrix); - _instanceWorldMatrix.multiplyMatrices(matrixWorld, _instanceLocalMatrix); - _mesh.matrixWorld = _instanceWorldMatrix; - _mesh.raycast(raycaster, _instanceIntersects); - for (let i = 0, l = _instanceIntersects.length; i < l; i++) { - const intersect = _instanceIntersects[i]; - intersect.instanceId = instanceId; - intersect.object = this; - intersects2.push(intersect); - } - _instanceIntersects.length = 0; - } - } - setColorAt(index, color) { - if (this.instanceColor === null) { - this.instanceColor = new InstancedBufferAttribute(new Float32Array(this.instanceMatrix.count * 3), 3); - } - color.toArray(this.instanceColor.array, index * 3); - } - setMatrixAt(index, matrix) { - matrix.toArray(this.instanceMatrix.array, index * 16); - } - updateMorphTargets() { - } - dispose() { - this.dispatchEvent({ type: "dispose" }); - } -}; -var LineBasicMaterial = class extends Material { - constructor(parameters) { - super(); - this.isLineBasicMaterial = true; - this.type = "LineBasicMaterial"; - this.color = new Color(16777215); - this.map = null; - this.linewidth = 1; - this.linecap = "round"; - this.linejoin = "round"; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.color.copy(source.color); - this.map = source.map; - this.linewidth = source.linewidth; - this.linecap = source.linecap; - this.linejoin = source.linejoin; - this.fog = source.fog; - return this; - } -}; -var _start$1 = new Vector3(); -var _end$1 = new Vector3(); -var _inverseMatrix$1 = new Matrix4(); -var _ray$1 = new Ray(); -var _sphere$1 = new Sphere(); -var Line = class extends Object3D { - constructor(geometry = new BufferGeometry(), material = new LineBasicMaterial()) { - super(); - this.isLine = true; - this.type = "Line"; - this.geometry = geometry; - this.material = material; - this.updateMorphTargets(); - } - copy(source, recursive) { - super.copy(source, recursive); - this.material = Array.isArray(source.material) ? source.material.slice() : source.material; - this.geometry = source.geometry; - return this; - } - computeLineDistances() { - const geometry = this.geometry; - if (geometry.index === null) { - const positionAttribute = geometry.attributes.position; - const lineDistances = [0]; - for (let i = 1, l = positionAttribute.count; i < l; i++) { - _start$1.fromBufferAttribute(positionAttribute, i - 1); - _end$1.fromBufferAttribute(positionAttribute, i); - lineDistances[i] = lineDistances[i - 1]; - lineDistances[i] += _start$1.distanceTo(_end$1); - } - geometry.setAttribute("lineDistance", new Float32BufferAttribute(lineDistances, 1)); - } else { - console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); - } - return this; - } - raycast(raycaster, intersects2) { - const geometry = this.geometry; - const matrixWorld = this.matrixWorld; - const threshold = raycaster.params.Line.threshold; - const drawRange = geometry.drawRange; - if (geometry.boundingSphere === null) - geometry.computeBoundingSphere(); - _sphere$1.copy(geometry.boundingSphere); - _sphere$1.applyMatrix4(matrixWorld); - _sphere$1.radius += threshold; - if (raycaster.ray.intersectsSphere(_sphere$1) === false) - return; - _inverseMatrix$1.copy(matrixWorld).invert(); - _ray$1.copy(raycaster.ray).applyMatrix4(_inverseMatrix$1); - const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3); - const localThresholdSq = localThreshold * localThreshold; - const vStart = new Vector3(); - const vEnd = new Vector3(); - const interSegment = new Vector3(); - const interRay = new Vector3(); - const step = this.isLineSegments ? 2 : 1; - const index = geometry.index; - const attributes = geometry.attributes; - const positionAttribute = attributes.position; - if (index !== null) { - const start = Math.max(0, drawRange.start); - const end = Math.min(index.count, drawRange.start + drawRange.count); - for (let i = start, l = end - 1; i < l; i += step) { - const a = index.getX(i); - const b = index.getX(i + 1); - vStart.fromBufferAttribute(positionAttribute, a); - vEnd.fromBufferAttribute(positionAttribute, b); - const distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment); - if (distSq > localThresholdSq) - continue; - interRay.applyMatrix4(this.matrixWorld); - const distance = raycaster.ray.origin.distanceTo(interRay); - if (distance < raycaster.near || distance > raycaster.far) - continue; - intersects2.push({ - distance, - // What do we want? intersection point on the ray or on the segment?? - // point: raycaster.ray.at( distance ), - point: interSegment.clone().applyMatrix4(this.matrixWorld), - index: i, - face: null, - faceIndex: null, - object: this - }); - } - } else { - const start = Math.max(0, drawRange.start); - const end = Math.min(positionAttribute.count, drawRange.start + drawRange.count); - for (let i = start, l = end - 1; i < l; i += step) { - vStart.fromBufferAttribute(positionAttribute, i); - vEnd.fromBufferAttribute(positionAttribute, i + 1); - const distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment); - if (distSq > localThresholdSq) - continue; - interRay.applyMatrix4(this.matrixWorld); - const distance = raycaster.ray.origin.distanceTo(interRay); - if (distance < raycaster.near || distance > raycaster.far) - continue; - intersects2.push({ - distance, - // What do we want? intersection point on the ray or on the segment?? - // point: raycaster.ray.at( distance ), - point: interSegment.clone().applyMatrix4(this.matrixWorld), - index: i, - face: null, - faceIndex: null, - object: this - }); - } - } - } - updateMorphTargets() { - const geometry = this.geometry; - const morphAttributes = geometry.morphAttributes; - const keys = Object.keys(morphAttributes); - if (keys.length > 0) { - const morphAttribute = morphAttributes[keys[0]]; - if (morphAttribute !== void 0) { - this.morphTargetInfluences = []; - this.morphTargetDictionary = {}; - for (let m = 0, ml = morphAttribute.length; m < ml; m++) { - const name = morphAttribute[m].name || String(m); - this.morphTargetInfluences.push(0); - this.morphTargetDictionary[name] = m; - } - } - } - } -}; -var _start = new Vector3(); -var _end = new Vector3(); -var LineSegments = class extends Line { - constructor(geometry, material) { - super(geometry, material); - this.isLineSegments = true; - this.type = "LineSegments"; - } - computeLineDistances() { - const geometry = this.geometry; - if (geometry.index === null) { - const positionAttribute = geometry.attributes.position; - const lineDistances = []; - for (let i = 0, l = positionAttribute.count; i < l; i += 2) { - _start.fromBufferAttribute(positionAttribute, i); - _end.fromBufferAttribute(positionAttribute, i + 1); - lineDistances[i] = i === 0 ? 0 : lineDistances[i - 1]; - lineDistances[i + 1] = lineDistances[i] + _start.distanceTo(_end); - } - geometry.setAttribute("lineDistance", new Float32BufferAttribute(lineDistances, 1)); - } else { - console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); - } - return this; - } -}; -var LineLoop = class extends Line { - constructor(geometry, material) { - super(geometry, material); - this.isLineLoop = true; - this.type = "LineLoop"; - } -}; -var PointsMaterial = class extends Material { - constructor(parameters) { - super(); - this.isPointsMaterial = true; - this.type = "PointsMaterial"; - this.color = new Color(16777215); - this.map = null; - this.alphaMap = null; - this.size = 1; - this.sizeAttenuation = true; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.color.copy(source.color); - this.map = source.map; - this.alphaMap = source.alphaMap; - this.size = source.size; - this.sizeAttenuation = source.sizeAttenuation; - this.fog = source.fog; - return this; - } -}; -var _inverseMatrix = new Matrix4(); -var _ray = new Ray(); -var _sphere = new Sphere(); -var _position$2 = new Vector3(); -var Points = class extends Object3D { - constructor(geometry = new BufferGeometry(), material = new PointsMaterial()) { - super(); - this.isPoints = true; - this.type = "Points"; - this.geometry = geometry; - this.material = material; - this.updateMorphTargets(); - } - copy(source, recursive) { - super.copy(source, recursive); - this.material = Array.isArray(source.material) ? source.material.slice() : source.material; - this.geometry = source.geometry; - return this; - } - raycast(raycaster, intersects2) { - const geometry = this.geometry; - const matrixWorld = this.matrixWorld; - const threshold = raycaster.params.Points.threshold; - const drawRange = geometry.drawRange; - if (geometry.boundingSphere === null) - geometry.computeBoundingSphere(); - _sphere.copy(geometry.boundingSphere); - _sphere.applyMatrix4(matrixWorld); - _sphere.radius += threshold; - if (raycaster.ray.intersectsSphere(_sphere) === false) - return; - _inverseMatrix.copy(matrixWorld).invert(); - _ray.copy(raycaster.ray).applyMatrix4(_inverseMatrix); - const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3); - const localThresholdSq = localThreshold * localThreshold; - const index = geometry.index; - const attributes = geometry.attributes; - const positionAttribute = attributes.position; - if (index !== null) { - const start = Math.max(0, drawRange.start); - const end = Math.min(index.count, drawRange.start + drawRange.count); - for (let i = start, il = end; i < il; i++) { - const a = index.getX(i); - _position$2.fromBufferAttribute(positionAttribute, a); - testPoint(_position$2, a, localThresholdSq, matrixWorld, raycaster, intersects2, this); - } - } else { - const start = Math.max(0, drawRange.start); - const end = Math.min(positionAttribute.count, drawRange.start + drawRange.count); - for (let i = start, l = end; i < l; i++) { - _position$2.fromBufferAttribute(positionAttribute, i); - testPoint(_position$2, i, localThresholdSq, matrixWorld, raycaster, intersects2, this); - } - } - } - updateMorphTargets() { - const geometry = this.geometry; - const morphAttributes = geometry.morphAttributes; - const keys = Object.keys(morphAttributes); - if (keys.length > 0) { - const morphAttribute = morphAttributes[keys[0]]; - if (morphAttribute !== void 0) { - this.morphTargetInfluences = []; - this.morphTargetDictionary = {}; - for (let m = 0, ml = morphAttribute.length; m < ml; m++) { - const name = morphAttribute[m].name || String(m); - this.morphTargetInfluences.push(0); - this.morphTargetDictionary[name] = m; - } - } - } - } -}; -function testPoint(point, index, localThresholdSq, matrixWorld, raycaster, intersects2, object) { - const rayPointDistanceSq = _ray.distanceSqToPoint(point); - if (rayPointDistanceSq < localThresholdSq) { - const intersectPoint = new Vector3(); - _ray.closestPointToPoint(point, intersectPoint); - intersectPoint.applyMatrix4(matrixWorld); - const distance = raycaster.ray.origin.distanceTo(intersectPoint); - if (distance < raycaster.near || distance > raycaster.far) - return; - intersects2.push({ - distance, - distanceToRay: Math.sqrt(rayPointDistanceSq), - point: intersectPoint, - index, - face: null, - object - }); - } -} -var VideoTexture = class extends Texture { - constructor(video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) { - super(video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy); - this.isVideoTexture = true; - this.minFilter = minFilter !== void 0 ? minFilter : LinearFilter; - this.magFilter = magFilter !== void 0 ? magFilter : LinearFilter; - this.generateMipmaps = false; - const scope = this; - function updateVideo() { - scope.needsUpdate = true; - video.requestVideoFrameCallback(updateVideo); - } - if ("requestVideoFrameCallback" in video) { - video.requestVideoFrameCallback(updateVideo); - } - } - clone() { - return new this.constructor(this.image).copy(this); - } - update() { - const video = this.image; - const hasVideoFrameCallback = "requestVideoFrameCallback" in video; - if (hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA) { - this.needsUpdate = true; - } - } -}; -var FramebufferTexture = class extends Texture { - constructor(width, height) { - super({ width, height }); - this.isFramebufferTexture = true; - this.magFilter = NearestFilter; - this.minFilter = NearestFilter; - this.generateMipmaps = false; - this.needsUpdate = true; - } -}; -var CompressedTexture = class extends Texture { - constructor(mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, colorSpace) { - super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace); - this.isCompressedTexture = true; - this.image = { width, height }; - this.mipmaps = mipmaps; - this.flipY = false; - this.generateMipmaps = false; - } -}; -var CompressedArrayTexture = class extends CompressedTexture { - constructor(mipmaps, width, height, depth, format, type) { - super(mipmaps, width, height, format, type); - this.isCompressedArrayTexture = true; - this.image.depth = depth; - this.wrapR = ClampToEdgeWrapping; - } -}; -var CompressedCubeTexture = class extends CompressedTexture { - constructor(images, format, type) { - super(void 0, images[0].width, images[0].height, format, type, CubeReflectionMapping); - this.isCompressedCubeTexture = true; - this.isCubeTexture = true; - this.image = images; - } -}; -var CanvasTexture = class extends Texture { - constructor(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) { - super(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy); - this.isCanvasTexture = true; - this.needsUpdate = true; - } -}; -var Curve = class { - constructor() { - this.type = "Curve"; - this.arcLengthDivisions = 200; - } - // Virtual base class method to overwrite and implement in subclasses - // - t [0 .. 1] - getPoint() { - console.warn("THREE.Curve: .getPoint() not implemented."); - return null; - } - // Get point at relative position in curve according to arc length - // - u [0 .. 1] - getPointAt(u, optionalTarget) { - const t = this.getUtoTmapping(u); - return this.getPoint(t, optionalTarget); - } - // Get sequence of points using getPoint( t ) - getPoints(divisions = 5) { - const points = []; - for (let d = 0; d <= divisions; d++) { - points.push(this.getPoint(d / divisions)); - } - return points; - } - // Get sequence of points using getPointAt( u ) - getSpacedPoints(divisions = 5) { - const points = []; - for (let d = 0; d <= divisions; d++) { - points.push(this.getPointAt(d / divisions)); - } - return points; - } - // Get total curve arc length - getLength() { - const lengths = this.getLengths(); - return lengths[lengths.length - 1]; - } - // Get list of cumulative segment lengths - getLengths(divisions = this.arcLengthDivisions) { - if (this.cacheArcLengths && this.cacheArcLengths.length === divisions + 1 && !this.needsUpdate) { - return this.cacheArcLengths; - } - this.needsUpdate = false; - const cache = []; - let current, last = this.getPoint(0); - let sum = 0; - cache.push(0); - for (let p = 1; p <= divisions; p++) { - current = this.getPoint(p / divisions); - sum += current.distanceTo(last); - cache.push(sum); - last = current; - } - this.cacheArcLengths = cache; - return cache; - } - updateArcLengths() { - this.needsUpdate = true; - this.getLengths(); - } - // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant - getUtoTmapping(u, distance) { - const arcLengths = this.getLengths(); - let i = 0; - const il = arcLengths.length; - let targetArcLength; - if (distance) { - targetArcLength = distance; - } else { - targetArcLength = u * arcLengths[il - 1]; - } - let low = 0, high = il - 1, comparison; - while (low <= high) { - i = Math.floor(low + (high - low) / 2); - comparison = arcLengths[i] - targetArcLength; - if (comparison < 0) { - low = i + 1; - } else if (comparison > 0) { - high = i - 1; - } else { - high = i; - break; - } - } - i = high; - if (arcLengths[i] === targetArcLength) { - return i / (il - 1); - } - const lengthBefore = arcLengths[i]; - const lengthAfter = arcLengths[i + 1]; - const segmentLength = lengthAfter - lengthBefore; - const segmentFraction = (targetArcLength - lengthBefore) / segmentLength; - const t = (i + segmentFraction) / (il - 1); - return t; - } - // Returns a unit vector tangent at t - // In case any sub curve does not implement its tangent derivation, - // 2 points a small delta apart will be used to find its gradient - // which seems to give a reasonable approximation - getTangent(t, optionalTarget) { - const delta = 1e-4; - let t1 = t - delta; - let t2 = t + delta; - if (t1 < 0) - t1 = 0; - if (t2 > 1) - t2 = 1; - const pt1 = this.getPoint(t1); - const pt2 = this.getPoint(t2); - const tangent = optionalTarget || (pt1.isVector2 ? new Vector2() : new Vector3()); - tangent.copy(pt2).sub(pt1).normalize(); - return tangent; - } - getTangentAt(u, optionalTarget) { - const t = this.getUtoTmapping(u); - return this.getTangent(t, optionalTarget); - } - computeFrenetFrames(segments, closed) { - const normal = new Vector3(); - const tangents = []; - const normals = []; - const binormals = []; - const vec = new Vector3(); - const mat = new Matrix4(); - for (let i = 0; i <= segments; i++) { - const u = i / segments; - tangents[i] = this.getTangentAt(u, new Vector3()); - } - normals[0] = new Vector3(); - binormals[0] = new Vector3(); - let min = Number.MAX_VALUE; - const tx = Math.abs(tangents[0].x); - const ty = Math.abs(tangents[0].y); - const tz = Math.abs(tangents[0].z); - if (tx <= min) { - min = tx; - normal.set(1, 0, 0); - } - if (ty <= min) { - min = ty; - normal.set(0, 1, 0); - } - if (tz <= min) { - normal.set(0, 0, 1); - } - vec.crossVectors(tangents[0], normal).normalize(); - normals[0].crossVectors(tangents[0], vec); - binormals[0].crossVectors(tangents[0], normals[0]); - for (let i = 1; i <= segments; i++) { - normals[i] = normals[i - 1].clone(); - binormals[i] = binormals[i - 1].clone(); - vec.crossVectors(tangents[i - 1], tangents[i]); - if (vec.length() > Number.EPSILON) { - vec.normalize(); - const theta = Math.acos(clamp(tangents[i - 1].dot(tangents[i]), -1, 1)); - normals[i].applyMatrix4(mat.makeRotationAxis(vec, theta)); - } - binormals[i].crossVectors(tangents[i], normals[i]); - } - if (closed === true) { - let theta = Math.acos(clamp(normals[0].dot(normals[segments]), -1, 1)); - theta /= segments; - if (tangents[0].dot(vec.crossVectors(normals[0], normals[segments])) > 0) { - theta = -theta; - } - for (let i = 1; i <= segments; i++) { - normals[i].applyMatrix4(mat.makeRotationAxis(tangents[i], theta * i)); - binormals[i].crossVectors(tangents[i], normals[i]); - } - } - return { - tangents, - normals, - binormals - }; - } - clone() { - return new this.constructor().copy(this); - } - copy(source) { - this.arcLengthDivisions = source.arcLengthDivisions; - return this; - } - toJSON() { - const data = { - metadata: { - version: 4.6, - type: "Curve", - generator: "Curve.toJSON" - } - }; - data.arcLengthDivisions = this.arcLengthDivisions; - data.type = this.type; - return data; - } - fromJSON(json) { - this.arcLengthDivisions = json.arcLengthDivisions; - return this; - } -}; -var EllipseCurve = class extends Curve { - constructor(aX = 0, aY = 0, xRadius = 1, yRadius = 1, aStartAngle = 0, aEndAngle = Math.PI * 2, aClockwise = false, aRotation = 0) { - super(); - this.isEllipseCurve = true; - this.type = "EllipseCurve"; - this.aX = aX; - this.aY = aY; - this.xRadius = xRadius; - this.yRadius = yRadius; - this.aStartAngle = aStartAngle; - this.aEndAngle = aEndAngle; - this.aClockwise = aClockwise; - this.aRotation = aRotation; - } - getPoint(t, optionalTarget) { - const point = optionalTarget || new Vector2(); - const twoPi = Math.PI * 2; - let deltaAngle = this.aEndAngle - this.aStartAngle; - const samePoints = Math.abs(deltaAngle) < Number.EPSILON; - while (deltaAngle < 0) - deltaAngle += twoPi; - while (deltaAngle > twoPi) - deltaAngle -= twoPi; - if (deltaAngle < Number.EPSILON) { - if (samePoints) { - deltaAngle = 0; - } else { - deltaAngle = twoPi; - } - } - if (this.aClockwise === true && !samePoints) { - if (deltaAngle === twoPi) { - deltaAngle = -twoPi; - } else { - deltaAngle = deltaAngle - twoPi; - } - } - const angle = this.aStartAngle + t * deltaAngle; - let x = this.aX + this.xRadius * Math.cos(angle); - let y = this.aY + this.yRadius * Math.sin(angle); - if (this.aRotation !== 0) { - const cos = Math.cos(this.aRotation); - const sin = Math.sin(this.aRotation); - const tx = x - this.aX; - const ty = y - this.aY; - x = tx * cos - ty * sin + this.aX; - y = tx * sin + ty * cos + this.aY; - } - return point.set(x, y); - } - copy(source) { - super.copy(source); - this.aX = source.aX; - this.aY = source.aY; - this.xRadius = source.xRadius; - this.yRadius = source.yRadius; - this.aStartAngle = source.aStartAngle; - this.aEndAngle = source.aEndAngle; - this.aClockwise = source.aClockwise; - this.aRotation = source.aRotation; - return this; - } - toJSON() { - const data = super.toJSON(); - data.aX = this.aX; - data.aY = this.aY; - data.xRadius = this.xRadius; - data.yRadius = this.yRadius; - data.aStartAngle = this.aStartAngle; - data.aEndAngle = this.aEndAngle; - data.aClockwise = this.aClockwise; - data.aRotation = this.aRotation; - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.aX = json.aX; - this.aY = json.aY; - this.xRadius = json.xRadius; - this.yRadius = json.yRadius; - this.aStartAngle = json.aStartAngle; - this.aEndAngle = json.aEndAngle; - this.aClockwise = json.aClockwise; - this.aRotation = json.aRotation; - return this; - } -}; -var ArcCurve = class extends EllipseCurve { - constructor(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { - super(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise); - this.isArcCurve = true; - this.type = "ArcCurve"; - } -}; -function CubicPoly() { - let c0 = 0, c1 = 0, c2 = 0, c3 = 0; - function init(x0, x1, t0, t1) { - c0 = x0; - c1 = t0; - c2 = -3 * x0 + 3 * x1 - 2 * t0 - t1; - c3 = 2 * x0 - 2 * x1 + t0 + t1; - } - return { - initCatmullRom: function(x0, x1, x2, x3, tension) { - init(x1, x2, tension * (x2 - x0), tension * (x3 - x1)); - }, - initNonuniformCatmullRom: function(x0, x1, x2, x3, dt0, dt1, dt2) { - let t1 = (x1 - x0) / dt0 - (x2 - x0) / (dt0 + dt1) + (x2 - x1) / dt1; - let t2 = (x2 - x1) / dt1 - (x3 - x1) / (dt1 + dt2) + (x3 - x2) / dt2; - t1 *= dt1; - t2 *= dt1; - init(x1, x2, t1, t2); - }, - calc: function(t) { - const t2 = t * t; - const t3 = t2 * t; - return c0 + c1 * t + c2 * t2 + c3 * t3; - } - }; -} -var tmp = new Vector3(); -var px = new CubicPoly(); -var py = new CubicPoly(); -var pz = new CubicPoly(); -var CatmullRomCurve3 = class extends Curve { - constructor(points = [], closed = false, curveType = "centripetal", tension = 0.5) { - super(); - this.isCatmullRomCurve3 = true; - this.type = "CatmullRomCurve3"; - this.points = points; - this.closed = closed; - this.curveType = curveType; - this.tension = tension; - } - getPoint(t, optionalTarget = new Vector3()) { - const point = optionalTarget; - const points = this.points; - const l = points.length; - const p = (l - (this.closed ? 0 : 1)) * t; - let intPoint = Math.floor(p); - let weight = p - intPoint; - if (this.closed) { - intPoint += intPoint > 0 ? 0 : (Math.floor(Math.abs(intPoint) / l) + 1) * l; - } else if (weight === 0 && intPoint === l - 1) { - intPoint = l - 2; - weight = 1; - } - let p0, p3; - if (this.closed || intPoint > 0) { - p0 = points[(intPoint - 1) % l]; - } else { - tmp.subVectors(points[0], points[1]).add(points[0]); - p0 = tmp; - } - const p1 = points[intPoint % l]; - const p2 = points[(intPoint + 1) % l]; - if (this.closed || intPoint + 2 < l) { - p3 = points[(intPoint + 2) % l]; - } else { - tmp.subVectors(points[l - 1], points[l - 2]).add(points[l - 1]); - p3 = tmp; - } - if (this.curveType === "centripetal" || this.curveType === "chordal") { - const pow = this.curveType === "chordal" ? 0.5 : 0.25; - let dt0 = Math.pow(p0.distanceToSquared(p1), pow); - let dt1 = Math.pow(p1.distanceToSquared(p2), pow); - let dt2 = Math.pow(p2.distanceToSquared(p3), pow); - if (dt1 < 1e-4) - dt1 = 1; - if (dt0 < 1e-4) - dt0 = dt1; - if (dt2 < 1e-4) - dt2 = dt1; - px.initNonuniformCatmullRom(p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2); - py.initNonuniformCatmullRom(p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2); - pz.initNonuniformCatmullRom(p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2); - } else if (this.curveType === "catmullrom") { - px.initCatmullRom(p0.x, p1.x, p2.x, p3.x, this.tension); - py.initCatmullRom(p0.y, p1.y, p2.y, p3.y, this.tension); - pz.initCatmullRom(p0.z, p1.z, p2.z, p3.z, this.tension); - } - point.set( - px.calc(weight), - py.calc(weight), - pz.calc(weight) - ); - return point; - } - copy(source) { - super.copy(source); - this.points = []; - for (let i = 0, l = source.points.length; i < l; i++) { - const point = source.points[i]; - this.points.push(point.clone()); - } - this.closed = source.closed; - this.curveType = source.curveType; - this.tension = source.tension; - return this; - } - toJSON() { - const data = super.toJSON(); - data.points = []; - for (let i = 0, l = this.points.length; i < l; i++) { - const point = this.points[i]; - data.points.push(point.toArray()); - } - data.closed = this.closed; - data.curveType = this.curveType; - data.tension = this.tension; - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.points = []; - for (let i = 0, l = json.points.length; i < l; i++) { - const point = json.points[i]; - this.points.push(new Vector3().fromArray(point)); - } - this.closed = json.closed; - this.curveType = json.curveType; - this.tension = json.tension; - return this; - } -}; -function CatmullRom(t, p0, p1, p2, p3) { - const v0 = (p2 - p0) * 0.5; - const v1 = (p3 - p1) * 0.5; - const t2 = t * t; - const t3 = t * t2; - return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1; -} -function QuadraticBezierP0(t, p) { - const k = 1 - t; - return k * k * p; -} -function QuadraticBezierP1(t, p) { - return 2 * (1 - t) * t * p; -} -function QuadraticBezierP2(t, p) { - return t * t * p; -} -function QuadraticBezier(t, p0, p1, p2) { - return QuadraticBezierP0(t, p0) + QuadraticBezierP1(t, p1) + QuadraticBezierP2(t, p2); -} -function CubicBezierP0(t, p) { - const k = 1 - t; - return k * k * k * p; -} -function CubicBezierP1(t, p) { - const k = 1 - t; - return 3 * k * k * t * p; -} -function CubicBezierP2(t, p) { - return 3 * (1 - t) * t * t * p; -} -function CubicBezierP3(t, p) { - return t * t * t * p; -} -function CubicBezier(t, p0, p1, p2, p3) { - return CubicBezierP0(t, p0) + CubicBezierP1(t, p1) + CubicBezierP2(t, p2) + CubicBezierP3(t, p3); -} -var CubicBezierCurve = class extends Curve { - constructor(v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2(), v3 = new Vector2()) { - super(); - this.isCubicBezierCurve = true; - this.type = "CubicBezierCurve"; - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - this.v3 = v3; - } - getPoint(t, optionalTarget = new Vector2()) { - const point = optionalTarget; - const v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3; - point.set( - CubicBezier(t, v0.x, v1.x, v2.x, v3.x), - CubicBezier(t, v0.y, v1.y, v2.y, v3.y) - ); - return point; - } - copy(source) { - super.copy(source); - this.v0.copy(source.v0); - this.v1.copy(source.v1); - this.v2.copy(source.v2); - this.v3.copy(source.v3); - return this; - } - toJSON() { - const data = super.toJSON(); - data.v0 = this.v0.toArray(); - data.v1 = this.v1.toArray(); - data.v2 = this.v2.toArray(); - data.v3 = this.v3.toArray(); - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.v0.fromArray(json.v0); - this.v1.fromArray(json.v1); - this.v2.fromArray(json.v2); - this.v3.fromArray(json.v3); - return this; - } -}; -var CubicBezierCurve3 = class extends Curve { - constructor(v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3(), v3 = new Vector3()) { - super(); - this.isCubicBezierCurve3 = true; - this.type = "CubicBezierCurve3"; - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - this.v3 = v3; - } - getPoint(t, optionalTarget = new Vector3()) { - const point = optionalTarget; - const v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3; - point.set( - CubicBezier(t, v0.x, v1.x, v2.x, v3.x), - CubicBezier(t, v0.y, v1.y, v2.y, v3.y), - CubicBezier(t, v0.z, v1.z, v2.z, v3.z) - ); - return point; - } - copy(source) { - super.copy(source); - this.v0.copy(source.v0); - this.v1.copy(source.v1); - this.v2.copy(source.v2); - this.v3.copy(source.v3); - return this; - } - toJSON() { - const data = super.toJSON(); - data.v0 = this.v0.toArray(); - data.v1 = this.v1.toArray(); - data.v2 = this.v2.toArray(); - data.v3 = this.v3.toArray(); - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.v0.fromArray(json.v0); - this.v1.fromArray(json.v1); - this.v2.fromArray(json.v2); - this.v3.fromArray(json.v3); - return this; - } -}; -var LineCurve = class extends Curve { - constructor(v1 = new Vector2(), v2 = new Vector2()) { - super(); - this.isLineCurve = true; - this.type = "LineCurve"; - this.v1 = v1; - this.v2 = v2; - } - getPoint(t, optionalTarget = new Vector2()) { - const point = optionalTarget; - if (t === 1) { - point.copy(this.v2); - } else { - point.copy(this.v2).sub(this.v1); - point.multiplyScalar(t).add(this.v1); - } - return point; - } - // Line curve is linear, so we can overwrite default getPointAt - getPointAt(u, optionalTarget) { - return this.getPoint(u, optionalTarget); - } - getTangent(t, optionalTarget = new Vector2()) { - return optionalTarget.subVectors(this.v2, this.v1).normalize(); - } - getTangentAt(u, optionalTarget) { - return this.getTangent(u, optionalTarget); - } - copy(source) { - super.copy(source); - this.v1.copy(source.v1); - this.v2.copy(source.v2); - return this; - } - toJSON() { - const data = super.toJSON(); - data.v1 = this.v1.toArray(); - data.v2 = this.v2.toArray(); - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.v1.fromArray(json.v1); - this.v2.fromArray(json.v2); - return this; - } -}; -var LineCurve3 = class extends Curve { - constructor(v1 = new Vector3(), v2 = new Vector3()) { - super(); - this.isLineCurve3 = true; - this.type = "LineCurve3"; - this.v1 = v1; - this.v2 = v2; - } - getPoint(t, optionalTarget = new Vector3()) { - const point = optionalTarget; - if (t === 1) { - point.copy(this.v2); - } else { - point.copy(this.v2).sub(this.v1); - point.multiplyScalar(t).add(this.v1); - } - return point; - } - // Line curve is linear, so we can overwrite default getPointAt - getPointAt(u, optionalTarget) { - return this.getPoint(u, optionalTarget); - } - getTangent(t, optionalTarget = new Vector3()) { - return optionalTarget.subVectors(this.v2, this.v1).normalize(); - } - getTangentAt(u, optionalTarget) { - return this.getTangent(u, optionalTarget); - } - copy(source) { - super.copy(source); - this.v1.copy(source.v1); - this.v2.copy(source.v2); - return this; - } - toJSON() { - const data = super.toJSON(); - data.v1 = this.v1.toArray(); - data.v2 = this.v2.toArray(); - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.v1.fromArray(json.v1); - this.v2.fromArray(json.v2); - return this; - } -}; -var QuadraticBezierCurve = class extends Curve { - constructor(v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2()) { - super(); - this.isQuadraticBezierCurve = true; - this.type = "QuadraticBezierCurve"; - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - } - getPoint(t, optionalTarget = new Vector2()) { - const point = optionalTarget; - const v0 = this.v0, v1 = this.v1, v2 = this.v2; - point.set( - QuadraticBezier(t, v0.x, v1.x, v2.x), - QuadraticBezier(t, v0.y, v1.y, v2.y) - ); - return point; - } - copy(source) { - super.copy(source); - this.v0.copy(source.v0); - this.v1.copy(source.v1); - this.v2.copy(source.v2); - return this; - } - toJSON() { - const data = super.toJSON(); - data.v0 = this.v0.toArray(); - data.v1 = this.v1.toArray(); - data.v2 = this.v2.toArray(); - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.v0.fromArray(json.v0); - this.v1.fromArray(json.v1); - this.v2.fromArray(json.v2); - return this; - } -}; -var QuadraticBezierCurve3 = class extends Curve { - constructor(v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3()) { - super(); - this.isQuadraticBezierCurve3 = true; - this.type = "QuadraticBezierCurve3"; - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - } - getPoint(t, optionalTarget = new Vector3()) { - const point = optionalTarget; - const v0 = this.v0, v1 = this.v1, v2 = this.v2; - point.set( - QuadraticBezier(t, v0.x, v1.x, v2.x), - QuadraticBezier(t, v0.y, v1.y, v2.y), - QuadraticBezier(t, v0.z, v1.z, v2.z) - ); - return point; - } - copy(source) { - super.copy(source); - this.v0.copy(source.v0); - this.v1.copy(source.v1); - this.v2.copy(source.v2); - return this; - } - toJSON() { - const data = super.toJSON(); - data.v0 = this.v0.toArray(); - data.v1 = this.v1.toArray(); - data.v2 = this.v2.toArray(); - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.v0.fromArray(json.v0); - this.v1.fromArray(json.v1); - this.v2.fromArray(json.v2); - return this; - } -}; -var SplineCurve = class extends Curve { - constructor(points = []) { - super(); - this.isSplineCurve = true; - this.type = "SplineCurve"; - this.points = points; - } - getPoint(t, optionalTarget = new Vector2()) { - const point = optionalTarget; - const points = this.points; - const p = (points.length - 1) * t; - const intPoint = Math.floor(p); - const weight = p - intPoint; - const p0 = points[intPoint === 0 ? intPoint : intPoint - 1]; - const p1 = points[intPoint]; - const p2 = points[intPoint > points.length - 2 ? points.length - 1 : intPoint + 1]; - const p3 = points[intPoint > points.length - 3 ? points.length - 1 : intPoint + 2]; - point.set( - CatmullRom(weight, p0.x, p1.x, p2.x, p3.x), - CatmullRom(weight, p0.y, p1.y, p2.y, p3.y) - ); - return point; - } - copy(source) { - super.copy(source); - this.points = []; - for (let i = 0, l = source.points.length; i < l; i++) { - const point = source.points[i]; - this.points.push(point.clone()); - } - return this; - } - toJSON() { - const data = super.toJSON(); - data.points = []; - for (let i = 0, l = this.points.length; i < l; i++) { - const point = this.points[i]; - data.points.push(point.toArray()); - } - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.points = []; - for (let i = 0, l = json.points.length; i < l; i++) { - const point = json.points[i]; - this.points.push(new Vector2().fromArray(point)); - } - return this; - } -}; -var Curves = Object.freeze({ - __proto__: null, - ArcCurve, - CatmullRomCurve3, - CubicBezierCurve, - CubicBezierCurve3, - EllipseCurve, - LineCurve, - LineCurve3, - QuadraticBezierCurve, - QuadraticBezierCurve3, - SplineCurve -}); -var CurvePath = class extends Curve { - constructor() { - super(); - this.type = "CurvePath"; - this.curves = []; - this.autoClose = false; - } - add(curve) { - this.curves.push(curve); - } - closePath() { - const startPoint = this.curves[0].getPoint(0); - const endPoint = this.curves[this.curves.length - 1].getPoint(1); - if (!startPoint.equals(endPoint)) { - const lineType = startPoint.isVector2 === true ? "LineCurve" : "LineCurve3"; - this.curves.push(new Curves[lineType](endPoint, startPoint)); - } - return this; - } - // To get accurate point with reference to - // entire path distance at time t, - // following has to be done: - // 1. Length of each sub path have to be known - // 2. Locate and identify type of curve - // 3. Get t for the curve - // 4. Return curve.getPointAt(t') - getPoint(t, optionalTarget) { - const d = t * this.getLength(); - const curveLengths = this.getCurveLengths(); - let i = 0; - while (i < curveLengths.length) { - if (curveLengths[i] >= d) { - const diff = curveLengths[i] - d; - const curve = this.curves[i]; - const segmentLength = curve.getLength(); - const u = segmentLength === 0 ? 0 : 1 - diff / segmentLength; - return curve.getPointAt(u, optionalTarget); - } - i++; - } - return null; - } - // We cannot use the default THREE.Curve getPoint() with getLength() because in - // THREE.Curve, getLength() depends on getPoint() but in THREE.CurvePath - // getPoint() depends on getLength - getLength() { - const lens = this.getCurveLengths(); - return lens[lens.length - 1]; - } - // cacheLengths must be recalculated. - updateArcLengths() { - this.needsUpdate = true; - this.cacheLengths = null; - this.getCurveLengths(); - } - // Compute lengths and cache them - // We cannot overwrite getLengths() because UtoT mapping uses it. - getCurveLengths() { - if (this.cacheLengths && this.cacheLengths.length === this.curves.length) { - return this.cacheLengths; - } - const lengths = []; - let sums = 0; - for (let i = 0, l = this.curves.length; i < l; i++) { - sums += this.curves[i].getLength(); - lengths.push(sums); - } - this.cacheLengths = lengths; - return lengths; - } - getSpacedPoints(divisions = 40) { - const points = []; - for (let i = 0; i <= divisions; i++) { - points.push(this.getPoint(i / divisions)); - } - if (this.autoClose) { - points.push(points[0]); - } - return points; - } - getPoints(divisions = 12) { - const points = []; - let last; - for (let i = 0, curves = this.curves; i < curves.length; i++) { - const curve = curves[i]; - const resolution = curve.isEllipseCurve ? divisions * 2 : curve.isLineCurve || curve.isLineCurve3 ? 1 : curve.isSplineCurve ? divisions * curve.points.length : divisions; - const pts = curve.getPoints(resolution); - for (let j = 0; j < pts.length; j++) { - const point = pts[j]; - if (last && last.equals(point)) - continue; - points.push(point); - last = point; - } - } - if (this.autoClose && points.length > 1 && !points[points.length - 1].equals(points[0])) { - points.push(points[0]); - } - return points; - } - copy(source) { - super.copy(source); - this.curves = []; - for (let i = 0, l = source.curves.length; i < l; i++) { - const curve = source.curves[i]; - this.curves.push(curve.clone()); - } - this.autoClose = source.autoClose; - return this; - } - toJSON() { - const data = super.toJSON(); - data.autoClose = this.autoClose; - data.curves = []; - for (let i = 0, l = this.curves.length; i < l; i++) { - const curve = this.curves[i]; - data.curves.push(curve.toJSON()); - } - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.autoClose = json.autoClose; - this.curves = []; - for (let i = 0, l = json.curves.length; i < l; i++) { - const curve = json.curves[i]; - this.curves.push(new Curves[curve.type]().fromJSON(curve)); - } - return this; - } -}; -var Path = class extends CurvePath { - constructor(points) { - super(); - this.type = "Path"; - this.currentPoint = new Vector2(); - if (points) { - this.setFromPoints(points); - } - } - setFromPoints(points) { - this.moveTo(points[0].x, points[0].y); - for (let i = 1, l = points.length; i < l; i++) { - this.lineTo(points[i].x, points[i].y); - } - return this; - } - moveTo(x, y) { - this.currentPoint.set(x, y); - return this; - } - lineTo(x, y) { - const curve = new LineCurve(this.currentPoint.clone(), new Vector2(x, y)); - this.curves.push(curve); - this.currentPoint.set(x, y); - return this; - } - quadraticCurveTo(aCPx, aCPy, aX, aY) { - const curve = new QuadraticBezierCurve( - this.currentPoint.clone(), - new Vector2(aCPx, aCPy), - new Vector2(aX, aY) - ); - this.curves.push(curve); - this.currentPoint.set(aX, aY); - return this; - } - bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) { - const curve = new CubicBezierCurve( - this.currentPoint.clone(), - new Vector2(aCP1x, aCP1y), - new Vector2(aCP2x, aCP2y), - new Vector2(aX, aY) - ); - this.curves.push(curve); - this.currentPoint.set(aX, aY); - return this; - } - splineThru(pts) { - const npts = [this.currentPoint.clone()].concat(pts); - const curve = new SplineCurve(npts); - this.curves.push(curve); - this.currentPoint.copy(pts[pts.length - 1]); - return this; - } - arc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { - const x0 = this.currentPoint.x; - const y0 = this.currentPoint.y; - this.absarc( - aX + x0, - aY + y0, - aRadius, - aStartAngle, - aEndAngle, - aClockwise - ); - return this; - } - absarc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { - this.absellipse(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise); - return this; - } - ellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) { - const x0 = this.currentPoint.x; - const y0 = this.currentPoint.y; - this.absellipse(aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation); - return this; - } - absellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) { - const curve = new EllipseCurve(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation); - if (this.curves.length > 0) { - const firstPoint = curve.getPoint(0); - if (!firstPoint.equals(this.currentPoint)) { - this.lineTo(firstPoint.x, firstPoint.y); - } - } - this.curves.push(curve); - const lastPoint = curve.getPoint(1); - this.currentPoint.copy(lastPoint); - return this; - } - copy(source) { - super.copy(source); - this.currentPoint.copy(source.currentPoint); - return this; - } - toJSON() { - const data = super.toJSON(); - data.currentPoint = this.currentPoint.toArray(); - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.currentPoint.fromArray(json.currentPoint); - return this; - } -}; -var LatheGeometry = class _LatheGeometry extends BufferGeometry { - constructor(points = [new Vector2(0, -0.5), new Vector2(0.5, 0), new Vector2(0, 0.5)], segments = 12, phiStart = 0, phiLength = Math.PI * 2) { - super(); - this.type = "LatheGeometry"; - this.parameters = { - points, - segments, - phiStart, - phiLength - }; - segments = Math.floor(segments); - phiLength = clamp(phiLength, 0, Math.PI * 2); - const indices = []; - const vertices = []; - const uvs = []; - const initNormals = []; - const normals = []; - const inverseSegments = 1 / segments; - const vertex2 = new Vector3(); - const uv = new Vector2(); - const normal = new Vector3(); - const curNormal = new Vector3(); - const prevNormal = new Vector3(); - let dx = 0; - let dy = 0; - for (let j = 0; j <= points.length - 1; j++) { - switch (j) { - case 0: - dx = points[j + 1].x - points[j].x; - dy = points[j + 1].y - points[j].y; - normal.x = dy * 1; - normal.y = -dx; - normal.z = dy * 0; - prevNormal.copy(normal); - normal.normalize(); - initNormals.push(normal.x, normal.y, normal.z); - break; - case points.length - 1: - initNormals.push(prevNormal.x, prevNormal.y, prevNormal.z); - break; - default: - dx = points[j + 1].x - points[j].x; - dy = points[j + 1].y - points[j].y; - normal.x = dy * 1; - normal.y = -dx; - normal.z = dy * 0; - curNormal.copy(normal); - normal.x += prevNormal.x; - normal.y += prevNormal.y; - normal.z += prevNormal.z; - normal.normalize(); - initNormals.push(normal.x, normal.y, normal.z); - prevNormal.copy(curNormal); - } - } - for (let i = 0; i <= segments; i++) { - const phi = phiStart + i * inverseSegments * phiLength; - const sin = Math.sin(phi); - const cos = Math.cos(phi); - for (let j = 0; j <= points.length - 1; j++) { - vertex2.x = points[j].x * sin; - vertex2.y = points[j].y; - vertex2.z = points[j].x * cos; - vertices.push(vertex2.x, vertex2.y, vertex2.z); - uv.x = i / segments; - uv.y = j / (points.length - 1); - uvs.push(uv.x, uv.y); - const x = initNormals[3 * j + 0] * sin; - const y = initNormals[3 * j + 1]; - const z = initNormals[3 * j + 0] * cos; - normals.push(x, y, z); - } - } - for (let i = 0; i < segments; i++) { - for (let j = 0; j < points.length - 1; j++) { - const base = j + i * points.length; - const a = base; - const b = base + points.length; - const c = base + points.length + 1; - const d = base + 1; - indices.push(a, b, d); - indices.push(c, d, b); - } - } - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new _LatheGeometry(data.points, data.segments, data.phiStart, data.phiLength); - } -}; -var CapsuleGeometry = class _CapsuleGeometry extends LatheGeometry { - constructor(radius = 1, length = 1, capSegments = 4, radialSegments = 8) { - const path = new Path(); - path.absarc(0, -length / 2, radius, Math.PI * 1.5, 0); - path.absarc(0, length / 2, radius, 0, Math.PI * 0.5); - super(path.getPoints(capSegments), radialSegments); - this.type = "CapsuleGeometry"; - this.parameters = { - radius, - length, - capSegments, - radialSegments - }; - } - static fromJSON(data) { - return new _CapsuleGeometry(data.radius, data.length, data.capSegments, data.radialSegments); - } -}; -var CircleGeometry = class _CircleGeometry extends BufferGeometry { - constructor(radius = 1, segments = 32, thetaStart = 0, thetaLength = Math.PI * 2) { - super(); - this.type = "CircleGeometry"; - this.parameters = { - radius, - segments, - thetaStart, - thetaLength - }; - segments = Math.max(3, segments); - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - const vertex2 = new Vector3(); - const uv = new Vector2(); - vertices.push(0, 0, 0); - normals.push(0, 0, 1); - uvs.push(0.5, 0.5); - for (let s = 0, i = 3; s <= segments; s++, i += 3) { - const segment = thetaStart + s / segments * thetaLength; - vertex2.x = radius * Math.cos(segment); - vertex2.y = radius * Math.sin(segment); - vertices.push(vertex2.x, vertex2.y, vertex2.z); - normals.push(0, 0, 1); - uv.x = (vertices[i] / radius + 1) / 2; - uv.y = (vertices[i + 1] / radius + 1) / 2; - uvs.push(uv.x, uv.y); - } - for (let i = 1; i <= segments; i++) { - indices.push(i, i + 1, 0); - } - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new _CircleGeometry(data.radius, data.segments, data.thetaStart, data.thetaLength); - } -}; -var CylinderGeometry = class _CylinderGeometry extends BufferGeometry { - constructor(radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2) { - super(); - this.type = "CylinderGeometry"; - this.parameters = { - radiusTop, - radiusBottom, - height, - radialSegments, - heightSegments, - openEnded, - thetaStart, - thetaLength - }; - const scope = this; - radialSegments = Math.floor(radialSegments); - heightSegments = Math.floor(heightSegments); - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - let index = 0; - const indexArray = []; - const halfHeight = height / 2; - let groupStart = 0; - generateTorso(); - if (openEnded === false) { - if (radiusTop > 0) - generateCap(true); - if (radiusBottom > 0) - generateCap(false); - } - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - function generateTorso() { - const normal = new Vector3(); - const vertex2 = new Vector3(); - let groupCount = 0; - const slope = (radiusBottom - radiusTop) / height; - for (let y = 0; y <= heightSegments; y++) { - const indexRow = []; - const v = y / heightSegments; - const radius = v * (radiusBottom - radiusTop) + radiusTop; - for (let x = 0; x <= radialSegments; x++) { - const u = x / radialSegments; - const theta = u * thetaLength + thetaStart; - const sinTheta = Math.sin(theta); - const cosTheta = Math.cos(theta); - vertex2.x = radius * sinTheta; - vertex2.y = -v * height + halfHeight; - vertex2.z = radius * cosTheta; - vertices.push(vertex2.x, vertex2.y, vertex2.z); - normal.set(sinTheta, slope, cosTheta).normalize(); - normals.push(normal.x, normal.y, normal.z); - uvs.push(u, 1 - v); - indexRow.push(index++); - } - indexArray.push(indexRow); - } - for (let x = 0; x < radialSegments; x++) { - for (let y = 0; y < heightSegments; y++) { - const a = indexArray[y][x]; - const b = indexArray[y + 1][x]; - const c = indexArray[y + 1][x + 1]; - const d = indexArray[y][x + 1]; - indices.push(a, b, d); - indices.push(b, c, d); - groupCount += 6; - } - } - scope.addGroup(groupStart, groupCount, 0); - groupStart += groupCount; - } - function generateCap(top) { - const centerIndexStart = index; - const uv = new Vector2(); - const vertex2 = new Vector3(); - let groupCount = 0; - const radius = top === true ? radiusTop : radiusBottom; - const sign2 = top === true ? 1 : -1; - for (let x = 1; x <= radialSegments; x++) { - vertices.push(0, halfHeight * sign2, 0); - normals.push(0, sign2, 0); - uvs.push(0.5, 0.5); - index++; - } - const centerIndexEnd = index; - for (let x = 0; x <= radialSegments; x++) { - const u = x / radialSegments; - const theta = u * thetaLength + thetaStart; - const cosTheta = Math.cos(theta); - const sinTheta = Math.sin(theta); - vertex2.x = radius * sinTheta; - vertex2.y = halfHeight * sign2; - vertex2.z = radius * cosTheta; - vertices.push(vertex2.x, vertex2.y, vertex2.z); - normals.push(0, sign2, 0); - uv.x = cosTheta * 0.5 + 0.5; - uv.y = sinTheta * 0.5 * sign2 + 0.5; - uvs.push(uv.x, uv.y); - index++; - } - for (let x = 0; x < radialSegments; x++) { - const c = centerIndexStart + x; - const i = centerIndexEnd + x; - if (top === true) { - indices.push(i, i + 1, c); - } else { - indices.push(i + 1, i, c); - } - groupCount += 3; - } - scope.addGroup(groupStart, groupCount, top === true ? 1 : 2); - groupStart += groupCount; - } - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new _CylinderGeometry(data.radiusTop, data.radiusBottom, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength); - } -}; -var ConeGeometry = class _ConeGeometry extends CylinderGeometry { - constructor(radius = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2) { - super(0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength); - this.type = "ConeGeometry"; - this.parameters = { - radius, - height, - radialSegments, - heightSegments, - openEnded, - thetaStart, - thetaLength - }; - } - static fromJSON(data) { - return new _ConeGeometry(data.radius, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength); - } -}; -var PolyhedronGeometry = class _PolyhedronGeometry extends BufferGeometry { - constructor(vertices = [], indices = [], radius = 1, detail = 0) { - super(); - this.type = "PolyhedronGeometry"; - this.parameters = { - vertices, - indices, - radius, - detail - }; - const vertexBuffer = []; - const uvBuffer = []; - subdivide(detail); - applyRadius(radius); - generateUVs(); - this.setAttribute("position", new Float32BufferAttribute(vertexBuffer, 3)); - this.setAttribute("normal", new Float32BufferAttribute(vertexBuffer.slice(), 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvBuffer, 2)); - if (detail === 0) { - this.computeVertexNormals(); - } else { - this.normalizeNormals(); - } - function subdivide(detail2) { - const a = new Vector3(); - const b = new Vector3(); - const c = new Vector3(); - for (let i = 0; i < indices.length; i += 3) { - getVertexByIndex(indices[i + 0], a); - getVertexByIndex(indices[i + 1], b); - getVertexByIndex(indices[i + 2], c); - subdivideFace(a, b, c, detail2); - } - } - function subdivideFace(a, b, c, detail2) { - const cols = detail2 + 1; - const v = []; - for (let i = 0; i <= cols; i++) { - v[i] = []; - const aj = a.clone().lerp(c, i / cols); - const bj = b.clone().lerp(c, i / cols); - const rows = cols - i; - for (let j = 0; j <= rows; j++) { - if (j === 0 && i === cols) { - v[i][j] = aj; - } else { - v[i][j] = aj.clone().lerp(bj, j / rows); - } - } - } - for (let i = 0; i < cols; i++) { - for (let j = 0; j < 2 * (cols - i) - 1; j++) { - const k = Math.floor(j / 2); - if (j % 2 === 0) { - pushVertex(v[i][k + 1]); - pushVertex(v[i + 1][k]); - pushVertex(v[i][k]); - } else { - pushVertex(v[i][k + 1]); - pushVertex(v[i + 1][k + 1]); - pushVertex(v[i + 1][k]); - } - } - } - } - function applyRadius(radius2) { - const vertex2 = new Vector3(); - for (let i = 0; i < vertexBuffer.length; i += 3) { - vertex2.x = vertexBuffer[i + 0]; - vertex2.y = vertexBuffer[i + 1]; - vertex2.z = vertexBuffer[i + 2]; - vertex2.normalize().multiplyScalar(radius2); - vertexBuffer[i + 0] = vertex2.x; - vertexBuffer[i + 1] = vertex2.y; - vertexBuffer[i + 2] = vertex2.z; - } - } - function generateUVs() { - const vertex2 = new Vector3(); - for (let i = 0; i < vertexBuffer.length; i += 3) { - vertex2.x = vertexBuffer[i + 0]; - vertex2.y = vertexBuffer[i + 1]; - vertex2.z = vertexBuffer[i + 2]; - const u = azimuth(vertex2) / 2 / Math.PI + 0.5; - const v = inclination(vertex2) / Math.PI + 0.5; - uvBuffer.push(u, 1 - v); - } - correctUVs(); - correctSeam(); - } - function correctSeam() { - for (let i = 0; i < uvBuffer.length; i += 6) { - const x0 = uvBuffer[i + 0]; - const x1 = uvBuffer[i + 2]; - const x2 = uvBuffer[i + 4]; - const max = Math.max(x0, x1, x2); - const min = Math.min(x0, x1, x2); - if (max > 0.9 && min < 0.1) { - if (x0 < 0.2) - uvBuffer[i + 0] += 1; - if (x1 < 0.2) - uvBuffer[i + 2] += 1; - if (x2 < 0.2) - uvBuffer[i + 4] += 1; - } - } - } - function pushVertex(vertex2) { - vertexBuffer.push(vertex2.x, vertex2.y, vertex2.z); - } - function getVertexByIndex(index, vertex2) { - const stride = index * 3; - vertex2.x = vertices[stride + 0]; - vertex2.y = vertices[stride + 1]; - vertex2.z = vertices[stride + 2]; - } - function correctUVs() { - const a = new Vector3(); - const b = new Vector3(); - const c = new Vector3(); - const centroid = new Vector3(); - const uvA = new Vector2(); - const uvB = new Vector2(); - const uvC = new Vector2(); - for (let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6) { - a.set(vertexBuffer[i + 0], vertexBuffer[i + 1], vertexBuffer[i + 2]); - b.set(vertexBuffer[i + 3], vertexBuffer[i + 4], vertexBuffer[i + 5]); - c.set(vertexBuffer[i + 6], vertexBuffer[i + 7], vertexBuffer[i + 8]); - uvA.set(uvBuffer[j + 0], uvBuffer[j + 1]); - uvB.set(uvBuffer[j + 2], uvBuffer[j + 3]); - uvC.set(uvBuffer[j + 4], uvBuffer[j + 5]); - centroid.copy(a).add(b).add(c).divideScalar(3); - const azi = azimuth(centroid); - correctUV(uvA, j + 0, a, azi); - correctUV(uvB, j + 2, b, azi); - correctUV(uvC, j + 4, c, azi); - } - } - function correctUV(uv, stride, vector, azimuth2) { - if (azimuth2 < 0 && uv.x === 1) { - uvBuffer[stride] = uv.x - 1; - } - if (vector.x === 0 && vector.z === 0) { - uvBuffer[stride] = azimuth2 / 2 / Math.PI + 0.5; - } - } - function azimuth(vector) { - return Math.atan2(vector.z, -vector.x); - } - function inclination(vector) { - return Math.atan2(-vector.y, Math.sqrt(vector.x * vector.x + vector.z * vector.z)); - } - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new _PolyhedronGeometry(data.vertices, data.indices, data.radius, data.details); - } -}; -var DodecahedronGeometry = class _DodecahedronGeometry extends PolyhedronGeometry { - constructor(radius = 1, detail = 0) { - const t = (1 + Math.sqrt(5)) / 2; - const r = 1 / t; - const vertices = [ - // (±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, - // (0, ±1/φ, ±φ) - 0, - -r, - -t, - 0, - -r, - t, - 0, - r, - -t, - 0, - r, - t, - // (±1/φ, ±φ, 0) - -r, - -t, - 0, - -r, - t, - 0, - r, - -t, - 0, - r, - t, - 0, - // (±φ, 0, ±1/φ) - -t, - 0, - -r, - t, - 0, - -r, - -t, - 0, - r, - t, - 0, - r - ]; - const indices = [ - 3, - 11, - 7, - 3, - 7, - 15, - 3, - 15, - 13, - 7, - 19, - 17, - 7, - 17, - 6, - 7, - 6, - 15, - 17, - 4, - 8, - 17, - 8, - 10, - 17, - 10, - 6, - 8, - 0, - 16, - 8, - 16, - 2, - 8, - 2, - 10, - 0, - 12, - 1, - 0, - 1, - 18, - 0, - 18, - 16, - 6, - 10, - 2, - 6, - 2, - 13, - 6, - 13, - 15, - 2, - 16, - 18, - 2, - 18, - 3, - 2, - 3, - 13, - 18, - 1, - 9, - 18, - 9, - 11, - 18, - 11, - 3, - 4, - 14, - 12, - 4, - 12, - 0, - 4, - 0, - 8, - 11, - 9, - 5, - 11, - 5, - 19, - 11, - 19, - 7, - 19, - 5, - 14, - 19, - 14, - 4, - 19, - 4, - 17, - 1, - 12, - 14, - 1, - 14, - 5, - 1, - 5, - 9 - ]; - super(vertices, indices, radius, detail); - this.type = "DodecahedronGeometry"; - this.parameters = { - radius, - detail - }; - } - static fromJSON(data) { - return new _DodecahedronGeometry(data.radius, data.detail); - } -}; -var _v0 = new Vector3(); -var _v1$1 = new Vector3(); -var _normal = new Vector3(); -var _triangle = new Triangle(); -var EdgesGeometry = class extends BufferGeometry { - constructor(geometry = null, thresholdAngle = 1) { - super(); - this.type = "EdgesGeometry"; - this.parameters = { - geometry, - thresholdAngle - }; - if (geometry !== null) { - const precisionPoints = 4; - const precision = Math.pow(10, precisionPoints); - const thresholdDot = Math.cos(DEG2RAD * thresholdAngle); - const indexAttr = geometry.getIndex(); - const positionAttr = geometry.getAttribute("position"); - const indexCount = indexAttr ? indexAttr.count : positionAttr.count; - const indexArr = [0, 0, 0]; - const vertKeys = ["a", "b", "c"]; - const hashes = new Array(3); - const edgeData = {}; - const vertices = []; - for (let i = 0; i < indexCount; i += 3) { - if (indexAttr) { - indexArr[0] = indexAttr.getX(i); - indexArr[1] = indexAttr.getX(i + 1); - indexArr[2] = indexAttr.getX(i + 2); - } else { - indexArr[0] = i; - indexArr[1] = i + 1; - indexArr[2] = i + 2; - } - const { a, b, c } = _triangle; - a.fromBufferAttribute(positionAttr, indexArr[0]); - b.fromBufferAttribute(positionAttr, indexArr[1]); - c.fromBufferAttribute(positionAttr, indexArr[2]); - _triangle.getNormal(_normal); - hashes[0] = `${Math.round(a.x * precision)},${Math.round(a.y * precision)},${Math.round(a.z * precision)}`; - hashes[1] = `${Math.round(b.x * precision)},${Math.round(b.y * precision)},${Math.round(b.z * precision)}`; - hashes[2] = `${Math.round(c.x * precision)},${Math.round(c.y * precision)},${Math.round(c.z * precision)}`; - if (hashes[0] === hashes[1] || hashes[1] === hashes[2] || hashes[2] === hashes[0]) { - continue; - } - for (let j = 0; j < 3; j++) { - const jNext = (j + 1) % 3; - const vecHash0 = hashes[j]; - const vecHash1 = hashes[jNext]; - const v0 = _triangle[vertKeys[j]]; - const v1 = _triangle[vertKeys[jNext]]; - const hash = `${vecHash0}_${vecHash1}`; - const reverseHash = `${vecHash1}_${vecHash0}`; - if (reverseHash in edgeData && edgeData[reverseHash]) { - if (_normal.dot(edgeData[reverseHash].normal) <= thresholdDot) { - vertices.push(v0.x, v0.y, v0.z); - vertices.push(v1.x, v1.y, v1.z); - } - edgeData[reverseHash] = null; - } else if (!(hash in edgeData)) { - edgeData[hash] = { - index0: indexArr[j], - index1: indexArr[jNext], - normal: _normal.clone() - }; - } - } - } - for (const key in edgeData) { - if (edgeData[key]) { - const { index0, index1 } = edgeData[key]; - _v0.fromBufferAttribute(positionAttr, index0); - _v1$1.fromBufferAttribute(positionAttr, index1); - vertices.push(_v0.x, _v0.y, _v0.z); - vertices.push(_v1$1.x, _v1$1.y, _v1$1.z); - } - } - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - } - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } -}; -var Shape = class extends Path { - constructor(points) { - super(points); - this.uuid = generateUUID(); - this.type = "Shape"; - this.holes = []; - } - getPointsHoles(divisions) { - const holesPts = []; - for (let i = 0, l = this.holes.length; i < l; i++) { - holesPts[i] = this.holes[i].getPoints(divisions); - } - return holesPts; - } - // get points of shape and holes (keypoints based on segments parameter) - extractPoints(divisions) { - return { - shape: this.getPoints(divisions), - holes: this.getPointsHoles(divisions) - }; - } - copy(source) { - super.copy(source); - this.holes = []; - for (let i = 0, l = source.holes.length; i < l; i++) { - const hole = source.holes[i]; - this.holes.push(hole.clone()); - } - return this; - } - toJSON() { - const data = super.toJSON(); - data.uuid = this.uuid; - data.holes = []; - for (let i = 0, l = this.holes.length; i < l; i++) { - const hole = this.holes[i]; - data.holes.push(hole.toJSON()); - } - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.uuid = json.uuid; - this.holes = []; - for (let i = 0, l = json.holes.length; i < l; i++) { - const hole = json.holes[i]; - this.holes.push(new Path().fromJSON(hole)); - } - return this; - } -}; -var Earcut = { - triangulate: function(data, holeIndices, dim = 2) { - const hasHoles = holeIndices && holeIndices.length; - const outerLen = hasHoles ? holeIndices[0] * dim : data.length; - let outerNode = linkedList(data, 0, outerLen, dim, true); - const triangles = []; - if (!outerNode || outerNode.next === outerNode.prev) - return triangles; - let minX, minY, maxX, maxY, x, y, invSize; - if (hasHoles) - outerNode = eliminateHoles(data, holeIndices, outerNode, dim); - if (data.length > 80 * dim) { - minX = maxX = data[0]; - minY = maxY = data[1]; - for (let i = dim; i < outerLen; i += dim) { - x = data[i]; - y = data[i + 1]; - if (x < minX) - minX = x; - if (y < minY) - minY = y; - if (x > maxX) - maxX = x; - if (y > maxY) - maxY = y; - } - invSize = Math.max(maxX - minX, maxY - minY); - invSize = invSize !== 0 ? 32767 / invSize : 0; - } - earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0); - return triangles; - } -}; -function linkedList(data, start, end, dim, clockwise) { - let i, last; - if (clockwise === signedArea(data, start, end, dim) > 0) { - for (i = start; i < end; i += dim) - last = insertNode(i, data[i], data[i + 1], last); - } else { - for (i = end - dim; i >= start; i -= dim) - last = insertNode(i, data[i], data[i + 1], last); - } - if (last && equals(last, last.next)) { - removeNode(last); - last = last.next; - } - return last; -} -function filterPoints(start, end) { - if (!start) - return start; - if (!end) - end = start; - let p = start, again; - do { - again = false; - if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { - removeNode(p); - p = end = p.prev; - if (p === p.next) - break; - again = true; - } else { - p = p.next; - } - } while (again || p !== end); - return end; -} -function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { - if (!ear) - return; - if (!pass && invSize) - indexCurve(ear, minX, minY, invSize); - let stop = ear, prev, next; - while (ear.prev !== ear.next) { - prev = ear.prev; - next = ear.next; - if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) { - triangles.push(prev.i / dim | 0); - triangles.push(ear.i / dim | 0); - triangles.push(next.i / dim | 0); - removeNode(ear); - ear = next.next; - stop = next.next; - continue; - } - ear = next; - if (ear === stop) { - if (!pass) { - earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); - } else if (pass === 1) { - ear = cureLocalIntersections(filterPoints(ear), triangles, dim); - earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); - } else if (pass === 2) { - splitEarcut(ear, triangles, dim, minX, minY, invSize); - } - break; - } - } -} -function isEar(ear) { - const a = ear.prev, b = ear, c = ear.next; - if (area(a, b, c) >= 0) - return false; - const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y; - const x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy; - let p = c.next; - while (p !== a) { - if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) - return false; - p = p.next; - } - return true; -} -function isEarHashed(ear, minX, minY, invSize) { - const a = ear.prev, b = ear, c = ear.next; - if (area(a, b, c) >= 0) - return false; - const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y; - const x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy; - const minZ = zOrder(x0, y0, minX, minY, invSize), maxZ = zOrder(x1, y1, minX, minY, invSize); - let p = ear.prevZ, n = ear.nextZ; - while (p && p.z >= minZ && n && n.z <= maxZ) { - if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) - return false; - p = p.prevZ; - if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) - return false; - n = n.nextZ; - } - while (p && p.z >= minZ) { - if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) - return false; - p = p.prevZ; - } - while (n && n.z <= maxZ) { - if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) - return false; - n = n.nextZ; - } - return true; -} -function cureLocalIntersections(start, triangles, dim) { - let p = start; - do { - const a = p.prev, b = p.next.next; - if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { - triangles.push(a.i / dim | 0); - triangles.push(p.i / dim | 0); - triangles.push(b.i / dim | 0); - removeNode(p); - removeNode(p.next); - p = start = b; - } - p = p.next; - } while (p !== start); - return filterPoints(p); -} -function splitEarcut(start, triangles, dim, minX, minY, invSize) { - let a = start; - do { - let b = a.next.next; - while (b !== a.prev) { - if (a.i !== b.i && isValidDiagonal(a, b)) { - let c = splitPolygon(a, b); - a = filterPoints(a, a.next); - c = filterPoints(c, c.next); - earcutLinked(a, triangles, dim, minX, minY, invSize, 0); - earcutLinked(c, triangles, dim, minX, minY, invSize, 0); - return; - } - b = b.next; - } - a = a.next; - } while (a !== start); -} -function eliminateHoles(data, holeIndices, outerNode, dim) { - const queue = []; - let i, len, start, end, list; - for (i = 0, len = holeIndices.length; i < len; i++) { - start = holeIndices[i] * dim; - end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; - list = linkedList(data, start, end, dim, false); - if (list === list.next) - list.steiner = true; - queue.push(getLeftmost(list)); - } - queue.sort(compareX); - for (i = 0; i < queue.length; i++) { - outerNode = eliminateHole(queue[i], outerNode); - } - return outerNode; -} -function compareX(a, b) { - return a.x - b.x; -} -function eliminateHole(hole, outerNode) { - const bridge = findHoleBridge(hole, outerNode); - if (!bridge) { - return outerNode; - } - const bridgeReverse = splitPolygon(bridge, hole); - filterPoints(bridgeReverse, bridgeReverse.next); - return filterPoints(bridge, bridge.next); -} -function findHoleBridge(hole, outerNode) { - let p = outerNode, qx = -Infinity, m; - const hx = hole.x, hy = hole.y; - do { - if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { - const x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); - if (x <= hx && x > qx) { - qx = x; - m = p.x < p.next.x ? p : p.next; - if (x === hx) - return m; - } - } - p = p.next; - } while (p !== outerNode); - if (!m) - return null; - const stop = m, mx = m.x, my = m.y; - let tanMin = Infinity, tan; - p = m; - do { - if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { - tan = Math.abs(hy - p.y) / (hx - p.x); - if (locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && sectorContainsSector(m, p)))) { - m = p; - tanMin = tan; - } - } - p = p.next; - } while (p !== stop); - return m; -} -function sectorContainsSector(m, p) { - return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0; -} -function indexCurve(start, minX, minY, invSize) { - let p = start; - do { - if (p.z === 0) - p.z = zOrder(p.x, p.y, minX, minY, invSize); - p.prevZ = p.prev; - p.nextZ = p.next; - p = p.next; - } while (p !== start); - p.prevZ.nextZ = null; - p.prevZ = null; - sortLinked(p); -} -function sortLinked(list) { - let i, p, q, e, tail, numMerges, pSize, qSize, inSize = 1; - do { - p = list; - list = null; - tail = null; - numMerges = 0; - while (p) { - numMerges++; - q = p; - pSize = 0; - for (i = 0; i < inSize; i++) { - pSize++; - q = q.nextZ; - if (!q) - break; - } - qSize = inSize; - while (pSize > 0 || qSize > 0 && q) { - if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { - e = p; - p = p.nextZ; - pSize--; - } else { - e = q; - q = q.nextZ; - qSize--; - } - if (tail) - tail.nextZ = e; - else - list = e; - e.prevZ = tail; - tail = e; - } - p = q; - } - tail.nextZ = null; - inSize *= 2; - } while (numMerges > 1); - return list; -} -function zOrder(x, y, minX, minY, invSize) { - x = (x - minX) * invSize | 0; - y = (y - minY) * invSize | 0; - x = (x | x << 8) & 16711935; - x = (x | x << 4) & 252645135; - x = (x | x << 2) & 858993459; - x = (x | x << 1) & 1431655765; - y = (y | y << 8) & 16711935; - y = (y | y << 4) & 252645135; - y = (y | y << 2) & 858993459; - y = (y | y << 1) & 1431655765; - return x | y << 1; -} -function getLeftmost(start) { - let p = start, leftmost = start; - do { - if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) - leftmost = p; - p = p.next; - } while (p !== start); - return leftmost; -} -function pointInTriangle(ax, ay, bx, by, cx, cy, px2, py2) { - return (cx - px2) * (ay - py2) >= (ax - px2) * (cy - py2) && (ax - px2) * (by - py2) >= (bx - px2) * (ay - py2) && (bx - px2) * (cy - py2) >= (cx - px2) * (by - py2); -} -function isValidDiagonal(a, b) { - return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges - (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible - (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors - equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); -} -function area(p, q, r) { - return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); -} -function equals(p1, p2) { - return p1.x === p2.x && p1.y === p2.y; -} -function intersects(p1, q1, p2, q2) { - const o1 = sign(area(p1, q1, p2)); - const o2 = sign(area(p1, q1, q2)); - const o3 = sign(area(p2, q2, p1)); - const o4 = sign(area(p2, q2, q1)); - if (o1 !== o2 && o3 !== o4) - return true; - if (o1 === 0 && onSegment(p1, p2, q1)) - return true; - if (o2 === 0 && onSegment(p1, q2, q1)) - return true; - if (o3 === 0 && onSegment(p2, p1, q2)) - return true; - if (o4 === 0 && onSegment(p2, q1, q2)) - return true; - return false; -} -function onSegment(p, q, r) { - return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y); -} -function sign(num) { - return num > 0 ? 1 : num < 0 ? -1 : 0; -} -function intersectsPolygon(a, b) { - let p = a; - do { - if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) - return true; - p = p.next; - } while (p !== a); - return false; -} -function locallyInside(a, b) { - return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; -} -function middleInside(a, b) { - let p = a, inside = false; - const px2 = (a.x + b.x) / 2, py2 = (a.y + b.y) / 2; - do { - if (p.y > py2 !== p.next.y > py2 && p.next.y !== p.y && px2 < (p.next.x - p.x) * (py2 - p.y) / (p.next.y - p.y) + p.x) - inside = !inside; - p = p.next; - } while (p !== a); - return inside; -} -function splitPolygon(a, b) { - const a2 = new Node(a.i, a.x, a.y), b2 = new Node(b.i, b.x, b.y), an = a.next, bp = b.prev; - a.next = b; - b.prev = a; - a2.next = an; - an.prev = a2; - b2.next = a2; - a2.prev = b2; - bp.next = b2; - b2.prev = bp; - return b2; -} -function insertNode(i, x, y, last) { - const p = new Node(i, x, y); - if (!last) { - p.prev = p; - p.next = p; - } else { - p.next = last.next; - p.prev = last; - last.next.prev = p; - last.next = p; - } - return p; -} -function removeNode(p) { - p.next.prev = p.prev; - p.prev.next = p.next; - if (p.prevZ) - p.prevZ.nextZ = p.nextZ; - if (p.nextZ) - p.nextZ.prevZ = p.prevZ; -} -function Node(i, x, y) { - this.i = i; - this.x = x; - this.y = y; - this.prev = null; - this.next = null; - this.z = 0; - this.prevZ = null; - this.nextZ = null; - this.steiner = false; -} -function signedArea(data, start, end, dim) { - let sum = 0; - for (let i = start, j = end - dim; i < end; i += dim) { - sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); - j = i; - } - return sum; -} -var ShapeUtils = class _ShapeUtils { - // calculate area of the contour polygon - static area(contour) { - const n = contour.length; - let a = 0; - for (let p = n - 1, q = 0; q < n; p = q++) { - a += contour[p].x * contour[q].y - contour[q].x * contour[p].y; - } - return a * 0.5; - } - static isClockWise(pts) { - return _ShapeUtils.area(pts) < 0; - } - static triangulateShape(contour, holes) { - const vertices = []; - const holeIndices = []; - const faces = []; - removeDupEndPts(contour); - addContour(vertices, contour); - let holeIndex = contour.length; - holes.forEach(removeDupEndPts); - for (let i = 0; i < holes.length; i++) { - holeIndices.push(holeIndex); - holeIndex += holes[i].length; - addContour(vertices, holes[i]); - } - const triangles = Earcut.triangulate(vertices, holeIndices); - for (let i = 0; i < triangles.length; i += 3) { - faces.push(triangles.slice(i, i + 3)); - } - return faces; - } -}; -function removeDupEndPts(points) { - const l = points.length; - if (l > 2 && points[l - 1].equals(points[0])) { - points.pop(); - } -} -function addContour(vertices, contour) { - for (let i = 0; i < contour.length; i++) { - vertices.push(contour[i].x); - vertices.push(contour[i].y); - } -} -var ExtrudeGeometry = class _ExtrudeGeometry extends BufferGeometry { - constructor(shapes = new Shape([new Vector2(0.5, 0.5), new Vector2(-0.5, 0.5), new Vector2(-0.5, -0.5), new Vector2(0.5, -0.5)]), options = {}) { - super(); - this.type = "ExtrudeGeometry"; - this.parameters = { - shapes, - options - }; - shapes = Array.isArray(shapes) ? shapes : [shapes]; - const scope = this; - const verticesArray = []; - const uvArray = []; - for (let i = 0, l = shapes.length; i < l; i++) { - const shape = shapes[i]; - addShape(shape); - } - this.setAttribute("position", new Float32BufferAttribute(verticesArray, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvArray, 2)); - this.computeVertexNormals(); - function addShape(shape) { - const placeholder = []; - const curveSegments = options.curveSegments !== void 0 ? options.curveSegments : 12; - const steps = options.steps !== void 0 ? options.steps : 1; - const depth = options.depth !== void 0 ? options.depth : 1; - let bevelEnabled = options.bevelEnabled !== void 0 ? options.bevelEnabled : true; - let bevelThickness = options.bevelThickness !== void 0 ? options.bevelThickness : 0.2; - let bevelSize = options.bevelSize !== void 0 ? options.bevelSize : bevelThickness - 0.1; - let bevelOffset = options.bevelOffset !== void 0 ? options.bevelOffset : 0; - let bevelSegments = options.bevelSegments !== void 0 ? options.bevelSegments : 3; - const extrudePath = options.extrudePath; - const uvgen = options.UVGenerator !== void 0 ? options.UVGenerator : WorldUVGenerator; - let extrudePts, extrudeByPath = false; - let splineTube, binormal, normal, position2; - if (extrudePath) { - extrudePts = extrudePath.getSpacedPoints(steps); - extrudeByPath = true; - bevelEnabled = false; - splineTube = extrudePath.computeFrenetFrames(steps, false); - binormal = new Vector3(); - normal = new Vector3(); - position2 = new Vector3(); - } - if (!bevelEnabled) { - bevelSegments = 0; - bevelThickness = 0; - bevelSize = 0; - bevelOffset = 0; - } - const shapePoints = shape.extractPoints(curveSegments); - let vertices = shapePoints.shape; - const holes = shapePoints.holes; - const reverse = !ShapeUtils.isClockWise(vertices); - if (reverse) { - vertices = vertices.reverse(); - for (let h = 0, hl = holes.length; h < hl; h++) { - const ahole = holes[h]; - if (ShapeUtils.isClockWise(ahole)) { - holes[h] = ahole.reverse(); - } - } - } - const faces = ShapeUtils.triangulateShape(vertices, holes); - const contour = vertices; - for (let h = 0, hl = holes.length; h < hl; h++) { - const ahole = holes[h]; - vertices = vertices.concat(ahole); - } - function scalePt2(pt, vec, size) { - if (!vec) - console.error("THREE.ExtrudeGeometry: vec does not exist"); - return pt.clone().addScaledVector(vec, size); - } - const vlen = vertices.length, flen = faces.length; - function getBevelVec(inPt, inPrev, inNext) { - let v_trans_x, v_trans_y, shrink_by; - const v_prev_x = inPt.x - inPrev.x, v_prev_y = inPt.y - inPrev.y; - const v_next_x = inNext.x - inPt.x, v_next_y = inNext.y - inPt.y; - const v_prev_lensq = v_prev_x * v_prev_x + v_prev_y * v_prev_y; - const collinear0 = v_prev_x * v_next_y - v_prev_y * v_next_x; - if (Math.abs(collinear0) > Number.EPSILON) { - const v_prev_len = Math.sqrt(v_prev_lensq); - const v_next_len = Math.sqrt(v_next_x * v_next_x + v_next_y * v_next_y); - const ptPrevShift_x = inPrev.x - v_prev_y / v_prev_len; - const ptPrevShift_y = inPrev.y + v_prev_x / v_prev_len; - const ptNextShift_x = inNext.x - v_next_y / v_next_len; - const ptNextShift_y = inNext.y + v_next_x / v_next_len; - const sf = ((ptNextShift_x - ptPrevShift_x) * v_next_y - (ptNextShift_y - ptPrevShift_y) * v_next_x) / (v_prev_x * v_next_y - v_prev_y * v_next_x); - v_trans_x = ptPrevShift_x + v_prev_x * sf - inPt.x; - v_trans_y = ptPrevShift_y + v_prev_y * sf - inPt.y; - const v_trans_lensq = v_trans_x * v_trans_x + v_trans_y * v_trans_y; - if (v_trans_lensq <= 2) { - return new Vector2(v_trans_x, v_trans_y); - } else { - shrink_by = Math.sqrt(v_trans_lensq / 2); - } - } else { - let direction_eq = false; - if (v_prev_x > Number.EPSILON) { - if (v_next_x > Number.EPSILON) { - direction_eq = true; - } - } else { - if (v_prev_x < -Number.EPSILON) { - if (v_next_x < -Number.EPSILON) { - direction_eq = true; - } - } else { - if (Math.sign(v_prev_y) === Math.sign(v_next_y)) { - direction_eq = true; - } - } - } - if (direction_eq) { - v_trans_x = -v_prev_y; - v_trans_y = v_prev_x; - shrink_by = Math.sqrt(v_prev_lensq); - } else { - v_trans_x = v_prev_x; - v_trans_y = v_prev_y; - shrink_by = Math.sqrt(v_prev_lensq / 2); - } - } - return new Vector2(v_trans_x / shrink_by, v_trans_y / shrink_by); - } - const contourMovements = []; - for (let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i++, j++, k++) { - if (j === il) - j = 0; - if (k === il) - k = 0; - contourMovements[i] = getBevelVec(contour[i], contour[j], contour[k]); - } - const holesMovements = []; - let oneHoleMovements, verticesMovements = contourMovements.concat(); - for (let h = 0, hl = holes.length; h < hl; h++) { - const ahole = holes[h]; - oneHoleMovements = []; - for (let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i++, j++, k++) { - if (j === il) - j = 0; - if (k === il) - k = 0; - oneHoleMovements[i] = getBevelVec(ahole[i], ahole[j], ahole[k]); - } - holesMovements.push(oneHoleMovements); - verticesMovements = verticesMovements.concat(oneHoleMovements); - } - for (let b = 0; b < bevelSegments; b++) { - const t = b / bevelSegments; - const z = bevelThickness * Math.cos(t * Math.PI / 2); - const bs2 = bevelSize * Math.sin(t * Math.PI / 2) + bevelOffset; - for (let i = 0, il = contour.length; i < il; i++) { - const vert = scalePt2(contour[i], contourMovements[i], bs2); - v(vert.x, vert.y, -z); - } - for (let h = 0, hl = holes.length; h < hl; h++) { - const ahole = holes[h]; - oneHoleMovements = holesMovements[h]; - for (let i = 0, il = ahole.length; i < il; i++) { - const vert = scalePt2(ahole[i], oneHoleMovements[i], bs2); - v(vert.x, vert.y, -z); - } - } - } - const bs = bevelSize + bevelOffset; - for (let i = 0; i < vlen; i++) { - const vert = bevelEnabled ? scalePt2(vertices[i], verticesMovements[i], bs) : vertices[i]; - if (!extrudeByPath) { - v(vert.x, vert.y, 0); - } else { - normal.copy(splineTube.normals[0]).multiplyScalar(vert.x); - binormal.copy(splineTube.binormals[0]).multiplyScalar(vert.y); - position2.copy(extrudePts[0]).add(normal).add(binormal); - v(position2.x, position2.y, position2.z); - } - } - for (let s = 1; s <= steps; s++) { - for (let i = 0; i < vlen; i++) { - const vert = bevelEnabled ? scalePt2(vertices[i], verticesMovements[i], bs) : vertices[i]; - if (!extrudeByPath) { - v(vert.x, vert.y, depth / steps * s); - } else { - normal.copy(splineTube.normals[s]).multiplyScalar(vert.x); - binormal.copy(splineTube.binormals[s]).multiplyScalar(vert.y); - position2.copy(extrudePts[s]).add(normal).add(binormal); - v(position2.x, position2.y, position2.z); - } - } - } - for (let b = bevelSegments - 1; b >= 0; b--) { - const t = b / bevelSegments; - const z = bevelThickness * Math.cos(t * Math.PI / 2); - const bs2 = bevelSize * Math.sin(t * Math.PI / 2) + bevelOffset; - for (let i = 0, il = contour.length; i < il; i++) { - const vert = scalePt2(contour[i], contourMovements[i], bs2); - v(vert.x, vert.y, depth + z); - } - for (let h = 0, hl = holes.length; h < hl; h++) { - const ahole = holes[h]; - oneHoleMovements = holesMovements[h]; - for (let i = 0, il = ahole.length; i < il; i++) { - const vert = scalePt2(ahole[i], oneHoleMovements[i], bs2); - if (!extrudeByPath) { - v(vert.x, vert.y, depth + z); - } else { - v(vert.x, vert.y + extrudePts[steps - 1].y, extrudePts[steps - 1].x + z); - } - } - } - } - buildLidFaces(); - buildSideFaces(); - function buildLidFaces() { - const start = verticesArray.length / 3; - if (bevelEnabled) { - let layer = 0; - let offset = vlen * layer; - for (let i = 0; i < flen; i++) { - const face = faces[i]; - f3(face[2] + offset, face[1] + offset, face[0] + offset); - } - layer = steps + bevelSegments * 2; - offset = vlen * layer; - for (let i = 0; i < flen; i++) { - const face = faces[i]; - f3(face[0] + offset, face[1] + offset, face[2] + offset); - } - } else { - for (let i = 0; i < flen; i++) { - const face = faces[i]; - f3(face[2], face[1], face[0]); - } - for (let i = 0; i < flen; i++) { - const face = faces[i]; - f3(face[0] + vlen * steps, face[1] + vlen * steps, face[2] + vlen * steps); - } - } - scope.addGroup(start, verticesArray.length / 3 - start, 0); - } - function buildSideFaces() { - const start = verticesArray.length / 3; - let layeroffset = 0; - sidewalls(contour, layeroffset); - layeroffset += contour.length; - for (let h = 0, hl = holes.length; h < hl; h++) { - const ahole = holes[h]; - sidewalls(ahole, layeroffset); - layeroffset += ahole.length; - } - scope.addGroup(start, verticesArray.length / 3 - start, 1); - } - function sidewalls(contour2, layeroffset) { - let i = contour2.length; - while (--i >= 0) { - const j = i; - let k = i - 1; - if (k < 0) - k = contour2.length - 1; - for (let s = 0, sl = steps + bevelSegments * 2; s < sl; s++) { - const slen1 = vlen * s; - const slen2 = vlen * (s + 1); - const a = layeroffset + j + slen1, b = layeroffset + k + slen1, c = layeroffset + k + slen2, d = layeroffset + j + slen2; - f4(a, b, c, d); - } - } - } - function v(x, y, z) { - placeholder.push(x); - placeholder.push(y); - placeholder.push(z); - } - function f3(a, b, c) { - addVertex(a); - addVertex(b); - addVertex(c); - const nextIndex = verticesArray.length / 3; - const uvs = uvgen.generateTopUV(scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1); - addUV(uvs[0]); - addUV(uvs[1]); - addUV(uvs[2]); - } - function f4(a, b, c, d) { - addVertex(a); - addVertex(b); - addVertex(d); - addVertex(b); - addVertex(c); - addVertex(d); - const nextIndex = verticesArray.length / 3; - const uvs = uvgen.generateSideWallUV(scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1); - addUV(uvs[0]); - addUV(uvs[1]); - addUV(uvs[3]); - addUV(uvs[1]); - addUV(uvs[2]); - addUV(uvs[3]); - } - function addVertex(index) { - verticesArray.push(placeholder[index * 3 + 0]); - verticesArray.push(placeholder[index * 3 + 1]); - verticesArray.push(placeholder[index * 3 + 2]); - } - function addUV(vector2) { - uvArray.push(vector2.x); - uvArray.push(vector2.y); - } - } - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - toJSON() { - const data = super.toJSON(); - const shapes = this.parameters.shapes; - const options = this.parameters.options; - return toJSON$1(shapes, options, data); - } - static fromJSON(data, shapes) { - const geometryShapes = []; - for (let j = 0, jl = data.shapes.length; j < jl; j++) { - const shape = shapes[data.shapes[j]]; - geometryShapes.push(shape); - } - const extrudePath = data.options.extrudePath; - if (extrudePath !== void 0) { - data.options.extrudePath = new Curves[extrudePath.type]().fromJSON(extrudePath); - } - return new _ExtrudeGeometry(geometryShapes, data.options); - } -}; -var WorldUVGenerator = { - generateTopUV: function(geometry, vertices, indexA, indexB, indexC) { - const a_x = vertices[indexA * 3]; - const a_y = vertices[indexA * 3 + 1]; - const b_x = vertices[indexB * 3]; - const b_y = vertices[indexB * 3 + 1]; - const c_x = vertices[indexC * 3]; - const c_y = vertices[indexC * 3 + 1]; - return [ - new Vector2(a_x, a_y), - new Vector2(b_x, b_y), - new Vector2(c_x, c_y) - ]; - }, - generateSideWallUV: function(geometry, vertices, indexA, indexB, indexC, indexD) { - const a_x = vertices[indexA * 3]; - const a_y = vertices[indexA * 3 + 1]; - const a_z = vertices[indexA * 3 + 2]; - const b_x = vertices[indexB * 3]; - const b_y = vertices[indexB * 3 + 1]; - const b_z = vertices[indexB * 3 + 2]; - const c_x = vertices[indexC * 3]; - const c_y = vertices[indexC * 3 + 1]; - const c_z = vertices[indexC * 3 + 2]; - const d_x = vertices[indexD * 3]; - const d_y = vertices[indexD * 3 + 1]; - const d_z = vertices[indexD * 3 + 2]; - if (Math.abs(a_y - b_y) < Math.abs(a_x - b_x)) { - return [ - new Vector2(a_x, 1 - a_z), - new Vector2(b_x, 1 - b_z), - new Vector2(c_x, 1 - c_z), - new Vector2(d_x, 1 - d_z) - ]; - } else { - return [ - new Vector2(a_y, 1 - a_z), - new Vector2(b_y, 1 - b_z), - new Vector2(c_y, 1 - c_z), - new Vector2(d_y, 1 - d_z) - ]; - } - } -}; -function toJSON$1(shapes, options, data) { - data.shapes = []; - if (Array.isArray(shapes)) { - for (let i = 0, l = shapes.length; i < l; i++) { - const shape = shapes[i]; - data.shapes.push(shape.uuid); - } - } else { - data.shapes.push(shapes.uuid); - } - data.options = Object.assign({}, options); - if (options.extrudePath !== void 0) - data.options.extrudePath = options.extrudePath.toJSON(); - return data; -} -var IcosahedronGeometry = class _IcosahedronGeometry extends PolyhedronGeometry { - constructor(radius = 1, detail = 0) { - const t = (1 + Math.sqrt(5)) / 2; - const vertices = [ - -1, - t, - 0, - 1, - t, - 0, - -1, - -t, - 0, - 1, - -t, - 0, - 0, - -1, - t, - 0, - 1, - t, - 0, - -1, - -t, - 0, - 1, - -t, - t, - 0, - -1, - t, - 0, - 1, - -t, - 0, - -1, - -t, - 0, - 1 - ]; - const indices = [ - 0, - 11, - 5, - 0, - 5, - 1, - 0, - 1, - 7, - 0, - 7, - 10, - 0, - 10, - 11, - 1, - 5, - 9, - 5, - 11, - 4, - 11, - 10, - 2, - 10, - 7, - 6, - 7, - 1, - 8, - 3, - 9, - 4, - 3, - 4, - 2, - 3, - 2, - 6, - 3, - 6, - 8, - 3, - 8, - 9, - 4, - 9, - 5, - 2, - 4, - 11, - 6, - 2, - 10, - 8, - 6, - 7, - 9, - 8, - 1 - ]; - super(vertices, indices, radius, detail); - this.type = "IcosahedronGeometry"; - this.parameters = { - radius, - detail - }; - } - static fromJSON(data) { - return new _IcosahedronGeometry(data.radius, data.detail); - } -}; -var OctahedronGeometry = class _OctahedronGeometry extends PolyhedronGeometry { - constructor(radius = 1, detail = 0) { - const vertices = [ - 1, - 0, - 0, - -1, - 0, - 0, - 0, - 1, - 0, - 0, - -1, - 0, - 0, - 0, - 1, - 0, - 0, - -1 - ]; - const indices = [ - 0, - 2, - 4, - 0, - 4, - 3, - 0, - 3, - 5, - 0, - 5, - 2, - 1, - 2, - 5, - 1, - 5, - 3, - 1, - 3, - 4, - 1, - 4, - 2 - ]; - super(vertices, indices, radius, detail); - this.type = "OctahedronGeometry"; - this.parameters = { - radius, - detail - }; - } - static fromJSON(data) { - return new _OctahedronGeometry(data.radius, data.detail); - } -}; -var RingGeometry = class _RingGeometry extends BufferGeometry { - constructor(innerRadius = 0.5, outerRadius = 1, thetaSegments = 32, phiSegments = 1, thetaStart = 0, thetaLength = Math.PI * 2) { - super(); - this.type = "RingGeometry"; - this.parameters = { - innerRadius, - outerRadius, - thetaSegments, - phiSegments, - thetaStart, - thetaLength - }; - thetaSegments = Math.max(3, thetaSegments); - phiSegments = Math.max(1, phiSegments); - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - let radius = innerRadius; - const radiusStep = (outerRadius - innerRadius) / phiSegments; - const vertex2 = new Vector3(); - const uv = new Vector2(); - for (let j = 0; j <= phiSegments; j++) { - for (let i = 0; i <= thetaSegments; i++) { - const segment = thetaStart + i / thetaSegments * thetaLength; - vertex2.x = radius * Math.cos(segment); - vertex2.y = radius * Math.sin(segment); - vertices.push(vertex2.x, vertex2.y, vertex2.z); - normals.push(0, 0, 1); - uv.x = (vertex2.x / outerRadius + 1) / 2; - uv.y = (vertex2.y / outerRadius + 1) / 2; - uvs.push(uv.x, uv.y); - } - radius += radiusStep; - } - for (let j = 0; j < phiSegments; j++) { - const thetaSegmentLevel = j * (thetaSegments + 1); - for (let i = 0; i < thetaSegments; i++) { - const segment = i + thetaSegmentLevel; - const a = segment; - const b = segment + thetaSegments + 1; - const c = segment + thetaSegments + 2; - const d = segment + 1; - indices.push(a, b, d); - indices.push(b, c, d); - } - } - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new _RingGeometry(data.innerRadius, data.outerRadius, data.thetaSegments, data.phiSegments, data.thetaStart, data.thetaLength); - } -}; -var ShapeGeometry = class _ShapeGeometry extends BufferGeometry { - constructor(shapes = new Shape([new Vector2(0, 0.5), new Vector2(-0.5, -0.5), new Vector2(0.5, -0.5)]), curveSegments = 12) { - super(); - this.type = "ShapeGeometry"; - this.parameters = { - shapes, - curveSegments - }; - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - let groupStart = 0; - let groupCount = 0; - if (Array.isArray(shapes) === false) { - addShape(shapes); - } else { - for (let i = 0; i < shapes.length; i++) { - addShape(shapes[i]); - this.addGroup(groupStart, groupCount, i); - groupStart += groupCount; - groupCount = 0; - } - } - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - function addShape(shape) { - const indexOffset = vertices.length / 3; - const points = shape.extractPoints(curveSegments); - let shapeVertices = points.shape; - const shapeHoles = points.holes; - if (ShapeUtils.isClockWise(shapeVertices) === false) { - shapeVertices = shapeVertices.reverse(); - } - for (let i = 0, l = shapeHoles.length; i < l; i++) { - const shapeHole = shapeHoles[i]; - if (ShapeUtils.isClockWise(shapeHole) === true) { - shapeHoles[i] = shapeHole.reverse(); - } - } - const faces = ShapeUtils.triangulateShape(shapeVertices, shapeHoles); - for (let i = 0, l = shapeHoles.length; i < l; i++) { - const shapeHole = shapeHoles[i]; - shapeVertices = shapeVertices.concat(shapeHole); - } - for (let i = 0, l = shapeVertices.length; i < l; i++) { - const vertex2 = shapeVertices[i]; - vertices.push(vertex2.x, vertex2.y, 0); - normals.push(0, 0, 1); - uvs.push(vertex2.x, vertex2.y); - } - for (let i = 0, l = faces.length; i < l; i++) { - const face = faces[i]; - const a = face[0] + indexOffset; - const b = face[1] + indexOffset; - const c = face[2] + indexOffset; - indices.push(a, b, c); - groupCount += 3; - } - } - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - toJSON() { - const data = super.toJSON(); - const shapes = this.parameters.shapes; - return toJSON(shapes, data); - } - static fromJSON(data, shapes) { - const geometryShapes = []; - for (let j = 0, jl = data.shapes.length; j < jl; j++) { - const shape = shapes[data.shapes[j]]; - geometryShapes.push(shape); - } - return new _ShapeGeometry(geometryShapes, data.curveSegments); - } -}; -function toJSON(shapes, data) { - data.shapes = []; - if (Array.isArray(shapes)) { - for (let i = 0, l = shapes.length; i < l; i++) { - const shape = shapes[i]; - data.shapes.push(shape.uuid); - } - } else { - data.shapes.push(shapes.uuid); - } - return data; -} -var SphereGeometry = class _SphereGeometry extends BufferGeometry { - constructor(radius = 1, widthSegments = 32, heightSegments = 16, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI) { - super(); - this.type = "SphereGeometry"; - this.parameters = { - radius, - widthSegments, - heightSegments, - phiStart, - phiLength, - thetaStart, - thetaLength - }; - widthSegments = Math.max(3, Math.floor(widthSegments)); - heightSegments = Math.max(2, Math.floor(heightSegments)); - const thetaEnd = Math.min(thetaStart + thetaLength, Math.PI); - let index = 0; - const grid = []; - const vertex2 = new Vector3(); - const normal = new Vector3(); - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - for (let iy = 0; iy <= heightSegments; iy++) { - const verticesRow = []; - const v = iy / heightSegments; - let uOffset = 0; - if (iy === 0 && thetaStart === 0) { - uOffset = 0.5 / widthSegments; - } else if (iy === heightSegments && thetaEnd === Math.PI) { - uOffset = -0.5 / widthSegments; - } - for (let ix = 0; ix <= widthSegments; ix++) { - const u = ix / widthSegments; - vertex2.x = -radius * Math.cos(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength); - vertex2.y = radius * Math.cos(thetaStart + v * thetaLength); - vertex2.z = radius * Math.sin(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength); - vertices.push(vertex2.x, vertex2.y, vertex2.z); - normal.copy(vertex2).normalize(); - normals.push(normal.x, normal.y, normal.z); - uvs.push(u + uOffset, 1 - v); - verticesRow.push(index++); - } - grid.push(verticesRow); - } - for (let iy = 0; iy < heightSegments; iy++) { - for (let ix = 0; ix < widthSegments; ix++) { - const a = grid[iy][ix + 1]; - const b = grid[iy][ix]; - const c = grid[iy + 1][ix]; - const d = grid[iy + 1][ix + 1]; - if (iy !== 0 || thetaStart > 0) - indices.push(a, b, d); - if (iy !== heightSegments - 1 || thetaEnd < Math.PI) - indices.push(b, c, d); - } - } - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new _SphereGeometry(data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength); - } -}; -var TetrahedronGeometry = class _TetrahedronGeometry extends PolyhedronGeometry { - constructor(radius = 1, detail = 0) { - const vertices = [ - 1, - 1, - 1, - -1, - -1, - 1, - -1, - 1, - -1, - 1, - -1, - -1 - ]; - const indices = [ - 2, - 1, - 0, - 0, - 3, - 2, - 1, - 3, - 0, - 2, - 3, - 1 - ]; - super(vertices, indices, radius, detail); - this.type = "TetrahedronGeometry"; - this.parameters = { - radius, - detail - }; - } - static fromJSON(data) { - return new _TetrahedronGeometry(data.radius, data.detail); - } -}; -var TorusGeometry = class _TorusGeometry extends BufferGeometry { - constructor(radius = 1, tube = 0.4, radialSegments = 12, tubularSegments = 48, arc = Math.PI * 2) { - super(); - this.type = "TorusGeometry"; - this.parameters = { - radius, - tube, - radialSegments, - tubularSegments, - arc - }; - radialSegments = Math.floor(radialSegments); - tubularSegments = Math.floor(tubularSegments); - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - const center = new Vector3(); - const vertex2 = new Vector3(); - const normal = new Vector3(); - for (let j = 0; j <= radialSegments; j++) { - for (let i = 0; i <= tubularSegments; i++) { - const u = i / tubularSegments * arc; - const v = j / radialSegments * Math.PI * 2; - vertex2.x = (radius + tube * Math.cos(v)) * Math.cos(u); - vertex2.y = (radius + tube * Math.cos(v)) * Math.sin(u); - vertex2.z = tube * Math.sin(v); - vertices.push(vertex2.x, vertex2.y, vertex2.z); - center.x = radius * Math.cos(u); - center.y = radius * Math.sin(u); - normal.subVectors(vertex2, center).normalize(); - normals.push(normal.x, normal.y, normal.z); - uvs.push(i / tubularSegments); - uvs.push(j / radialSegments); - } - } - for (let j = 1; j <= radialSegments; j++) { - for (let i = 1; i <= tubularSegments; i++) { - const a = (tubularSegments + 1) * j + i - 1; - const b = (tubularSegments + 1) * (j - 1) + i - 1; - const c = (tubularSegments + 1) * (j - 1) + i; - const d = (tubularSegments + 1) * j + i; - indices.push(a, b, d); - indices.push(b, c, d); - } - } - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new _TorusGeometry(data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc); - } -}; -var TorusKnotGeometry = class _TorusKnotGeometry extends BufferGeometry { - constructor(radius = 1, tube = 0.4, tubularSegments = 64, radialSegments = 8, p = 2, q = 3) { - super(); - this.type = "TorusKnotGeometry"; - this.parameters = { - radius, - tube, - tubularSegments, - radialSegments, - p, - q - }; - tubularSegments = Math.floor(tubularSegments); - radialSegments = Math.floor(radialSegments); - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - const vertex2 = new Vector3(); - const normal = new Vector3(); - const P1 = new Vector3(); - const P2 = new Vector3(); - const B = new Vector3(); - const T = new Vector3(); - const N = new Vector3(); - for (let i = 0; i <= tubularSegments; ++i) { - const u = i / tubularSegments * p * Math.PI * 2; - calculatePositionOnCurve(u, p, q, radius, P1); - calculatePositionOnCurve(u + 0.01, p, q, radius, P2); - T.subVectors(P2, P1); - N.addVectors(P2, P1); - B.crossVectors(T, N); - N.crossVectors(B, T); - B.normalize(); - N.normalize(); - for (let j = 0; j <= radialSegments; ++j) { - const v = j / radialSegments * Math.PI * 2; - const cx = -tube * Math.cos(v); - const cy = tube * Math.sin(v); - vertex2.x = P1.x + (cx * N.x + cy * B.x); - vertex2.y = P1.y + (cx * N.y + cy * B.y); - vertex2.z = P1.z + (cx * N.z + cy * B.z); - vertices.push(vertex2.x, vertex2.y, vertex2.z); - normal.subVectors(vertex2, P1).normalize(); - normals.push(normal.x, normal.y, normal.z); - uvs.push(i / tubularSegments); - uvs.push(j / radialSegments); - } - } - for (let j = 1; j <= tubularSegments; j++) { - for (let i = 1; i <= radialSegments; i++) { - const a = (radialSegments + 1) * (j - 1) + (i - 1); - const b = (radialSegments + 1) * j + (i - 1); - const c = (radialSegments + 1) * j + i; - const d = (radialSegments + 1) * (j - 1) + i; - indices.push(a, b, d); - indices.push(b, c, d); - } - } - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - function calculatePositionOnCurve(u, p2, q2, radius2, position) { - const cu = Math.cos(u); - const su = Math.sin(u); - const quOverP = q2 / p2 * u; - const cs = Math.cos(quOverP); - position.x = radius2 * (2 + cs) * 0.5 * cu; - position.y = radius2 * (2 + cs) * su * 0.5; - position.z = radius2 * Math.sin(quOverP) * 0.5; - } - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new _TorusKnotGeometry(data.radius, data.tube, data.tubularSegments, data.radialSegments, data.p, data.q); - } -}; -var TubeGeometry = class _TubeGeometry extends BufferGeometry { - constructor(path = new QuadraticBezierCurve3(new Vector3(-1, -1, 0), new Vector3(-1, 1, 0), new Vector3(1, 1, 0)), tubularSegments = 64, radius = 1, radialSegments = 8, closed = false) { - super(); - this.type = "TubeGeometry"; - this.parameters = { - path, - tubularSegments, - radius, - radialSegments, - closed - }; - const frames = path.computeFrenetFrames(tubularSegments, closed); - this.tangents = frames.tangents; - this.normals = frames.normals; - this.binormals = frames.binormals; - const vertex2 = new Vector3(); - const normal = new Vector3(); - const uv = new Vector2(); - let P = new Vector3(); - const vertices = []; - const normals = []; - const uvs = []; - const indices = []; - generateBufferData(); - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - function generateBufferData() { - for (let i = 0; i < tubularSegments; i++) { - generateSegment(i); - } - generateSegment(closed === false ? tubularSegments : 0); - generateUVs(); - generateIndices(); - } - function generateSegment(i) { - P = path.getPointAt(i / tubularSegments, P); - const N = frames.normals[i]; - const B = frames.binormals[i]; - for (let j = 0; j <= radialSegments; j++) { - const v = j / radialSegments * Math.PI * 2; - const sin = Math.sin(v); - const cos = -Math.cos(v); - normal.x = cos * N.x + sin * B.x; - normal.y = cos * N.y + sin * B.y; - normal.z = cos * N.z + sin * B.z; - normal.normalize(); - normals.push(normal.x, normal.y, normal.z); - vertex2.x = P.x + radius * normal.x; - vertex2.y = P.y + radius * normal.y; - vertex2.z = P.z + radius * normal.z; - vertices.push(vertex2.x, vertex2.y, vertex2.z); - } - } - function generateIndices() { - for (let j = 1; j <= tubularSegments; j++) { - for (let i = 1; i <= radialSegments; i++) { - const a = (radialSegments + 1) * (j - 1) + (i - 1); - const b = (radialSegments + 1) * j + (i - 1); - const c = (radialSegments + 1) * j + i; - const d = (radialSegments + 1) * (j - 1) + i; - indices.push(a, b, d); - indices.push(b, c, d); - } - } - } - function generateUVs() { - for (let i = 0; i <= tubularSegments; i++) { - for (let j = 0; j <= radialSegments; j++) { - uv.x = i / tubularSegments; - uv.y = j / radialSegments; - uvs.push(uv.x, uv.y); - } - } - } - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - toJSON() { - const data = super.toJSON(); - data.path = this.parameters.path.toJSON(); - return data; - } - static fromJSON(data) { - return new _TubeGeometry( - new Curves[data.path.type]().fromJSON(data.path), - data.tubularSegments, - data.radius, - data.radialSegments, - data.closed - ); - } -}; -var WireframeGeometry = class extends BufferGeometry { - constructor(geometry = null) { - super(); - this.type = "WireframeGeometry"; - this.parameters = { - geometry - }; - if (geometry !== null) { - const vertices = []; - const edges = /* @__PURE__ */ new Set(); - const start = new Vector3(); - const end = new Vector3(); - if (geometry.index !== null) { - const position = geometry.attributes.position; - const indices = geometry.index; - let groups = geometry.groups; - if (groups.length === 0) { - groups = [{ start: 0, count: indices.count, materialIndex: 0 }]; - } - for (let o = 0, ol = groups.length; o < ol; ++o) { - const group = groups[o]; - const groupStart = group.start; - const groupCount = group.count; - for (let i = groupStart, l = groupStart + groupCount; i < l; i += 3) { - for (let j = 0; j < 3; j++) { - const index1 = indices.getX(i + j); - const index2 = indices.getX(i + (j + 1) % 3); - start.fromBufferAttribute(position, index1); - end.fromBufferAttribute(position, index2); - if (isUniqueEdge(start, end, edges) === true) { - vertices.push(start.x, start.y, start.z); - vertices.push(end.x, end.y, end.z); - } - } - } - } - } else { - const position = geometry.attributes.position; - for (let i = 0, l = position.count / 3; i < l; i++) { - for (let j = 0; j < 3; j++) { - const index1 = 3 * i + j; - const index2 = 3 * i + (j + 1) % 3; - start.fromBufferAttribute(position, index1); - end.fromBufferAttribute(position, index2); - if (isUniqueEdge(start, end, edges) === true) { - vertices.push(start.x, start.y, start.z); - vertices.push(end.x, end.y, end.z); - } - } - } - } - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - } - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } -}; -function isUniqueEdge(start, end, edges) { - const hash1 = `${start.x},${start.y},${start.z}-${end.x},${end.y},${end.z}`; - const hash2 = `${end.x},${end.y},${end.z}-${start.x},${start.y},${start.z}`; - if (edges.has(hash1) === true || edges.has(hash2) === true) { - return false; - } else { - edges.add(hash1); - edges.add(hash2); - return true; - } -} -var Geometries = Object.freeze({ - __proto__: null, - BoxGeometry, - CapsuleGeometry, - CircleGeometry, - ConeGeometry, - CylinderGeometry, - DodecahedronGeometry, - EdgesGeometry, - ExtrudeGeometry, - IcosahedronGeometry, - LatheGeometry, - OctahedronGeometry, - PlaneGeometry, - PolyhedronGeometry, - RingGeometry, - ShapeGeometry, - SphereGeometry, - TetrahedronGeometry, - TorusGeometry, - TorusKnotGeometry, - TubeGeometry, - WireframeGeometry -}); -var ShadowMaterial = class extends Material { - constructor(parameters) { - super(); - this.isShadowMaterial = true; - this.type = "ShadowMaterial"; - this.color = new Color(0); - this.transparent = true; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.color.copy(source.color); - this.fog = source.fog; - return this; - } -}; -var RawShaderMaterial = class extends ShaderMaterial { - constructor(parameters) { - super(parameters); - this.isRawShaderMaterial = true; - this.type = "RawShaderMaterial"; - } -}; -var MeshStandardMaterial = class extends Material { - constructor(parameters) { - super(); - this.isMeshStandardMaterial = true; - this.defines = { "STANDARD": "" }; - this.type = "MeshStandardMaterial"; - this.color = new Color(16777215); - this.roughness = 1; - this.metalness = 0; - this.map = null; - this.lightMap = null; - this.lightMapIntensity = 1; - this.aoMap = null; - this.aoMapIntensity = 1; - this.emissive = new Color(0); - this.emissiveIntensity = 1; - this.emissiveMap = null; - this.bumpMap = null; - this.bumpScale = 1; - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2(1, 1); - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.roughnessMap = null; - this.metalnessMap = null; - this.alphaMap = null; - this.envMap = null; - this.envMapIntensity = 1; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = "round"; - this.wireframeLinejoin = "round"; - this.flatShading = false; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.defines = { "STANDARD": "" }; - this.color.copy(source.color); - this.roughness = source.roughness; - this.metalness = source.metalness; - this.map = source.map; - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - this.emissive.copy(source.emissive); - this.emissiveMap = source.emissiveMap; - this.emissiveIntensity = source.emissiveIntensity; - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - this.normalMap = source.normalMap; - this.normalMapType = source.normalMapType; - this.normalScale.copy(source.normalScale); - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - this.roughnessMap = source.roughnessMap; - this.metalnessMap = source.metalnessMap; - this.alphaMap = source.alphaMap; - this.envMap = source.envMap; - this.envMapIntensity = source.envMapIntensity; - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - this.flatShading = source.flatShading; - this.fog = source.fog; - return this; - } -}; -var MeshPhysicalMaterial = class extends MeshStandardMaterial { - constructor(parameters) { - super(); - this.isMeshPhysicalMaterial = true; - this.defines = { - "STANDARD": "", - "PHYSICAL": "" - }; - this.type = "MeshPhysicalMaterial"; - this.anisotropyRotation = 0; - this.anisotropyMap = null; - this.clearcoatMap = null; - this.clearcoatRoughness = 0; - this.clearcoatRoughnessMap = null; - this.clearcoatNormalScale = new Vector2(1, 1); - this.clearcoatNormalMap = null; - this.ior = 1.5; - Object.defineProperty(this, "reflectivity", { - get: function() { - return clamp(2.5 * (this.ior - 1) / (this.ior + 1), 0, 1); - }, - set: function(reflectivity) { - this.ior = (1 + 0.4 * reflectivity) / (1 - 0.4 * reflectivity); - } - }); - this.iridescenceMap = null; - this.iridescenceIOR = 1.3; - this.iridescenceThicknessRange = [100, 400]; - this.iridescenceThicknessMap = null; - this.sheenColor = new Color(0); - this.sheenColorMap = null; - this.sheenRoughness = 1; - this.sheenRoughnessMap = null; - this.transmissionMap = null; - this.thickness = 0; - this.thicknessMap = null; - this.attenuationDistance = Infinity; - this.attenuationColor = new Color(1, 1, 1); - this.specularIntensity = 1; - this.specularIntensityMap = null; - this.specularColor = new Color(1, 1, 1); - this.specularColorMap = null; - this._anisotropy = 0; - this._clearcoat = 0; - this._iridescence = 0; - this._sheen = 0; - this._transmission = 0; - this.setValues(parameters); - } - get anisotropy() { - return this._anisotropy; - } - set anisotropy(value) { - if (this._anisotropy > 0 !== value > 0) { - this.version++; - } - this._anisotropy = value; - } - get clearcoat() { - return this._clearcoat; - } - set clearcoat(value) { - if (this._clearcoat > 0 !== value > 0) { - this.version++; - } - this._clearcoat = value; - } - get iridescence() { - return this._iridescence; - } - set iridescence(value) { - if (this._iridescence > 0 !== value > 0) { - this.version++; - } - this._iridescence = value; - } - get sheen() { - return this._sheen; - } - set sheen(value) { - if (this._sheen > 0 !== value > 0) { - this.version++; - } - this._sheen = value; - } - get transmission() { - return this._transmission; - } - set transmission(value) { - if (this._transmission > 0 !== value > 0) { - this.version++; - } - this._transmission = value; - } - copy(source) { - super.copy(source); - this.defines = { - "STANDARD": "", - "PHYSICAL": "" - }; - this.anisotropy = source.anisotropy; - this.anisotropyRotation = source.anisotropyRotation; - this.anisotropyMap = source.anisotropyMap; - this.clearcoat = source.clearcoat; - this.clearcoatMap = source.clearcoatMap; - this.clearcoatRoughness = source.clearcoatRoughness; - this.clearcoatRoughnessMap = source.clearcoatRoughnessMap; - this.clearcoatNormalMap = source.clearcoatNormalMap; - this.clearcoatNormalScale.copy(source.clearcoatNormalScale); - this.ior = source.ior; - this.iridescence = source.iridescence; - this.iridescenceMap = source.iridescenceMap; - this.iridescenceIOR = source.iridescenceIOR; - this.iridescenceThicknessRange = [...source.iridescenceThicknessRange]; - this.iridescenceThicknessMap = source.iridescenceThicknessMap; - this.sheen = source.sheen; - this.sheenColor.copy(source.sheenColor); - this.sheenColorMap = source.sheenColorMap; - this.sheenRoughness = source.sheenRoughness; - this.sheenRoughnessMap = source.sheenRoughnessMap; - this.transmission = source.transmission; - this.transmissionMap = source.transmissionMap; - this.thickness = source.thickness; - this.thicknessMap = source.thicknessMap; - this.attenuationDistance = source.attenuationDistance; - this.attenuationColor.copy(source.attenuationColor); - this.specularIntensity = source.specularIntensity; - this.specularIntensityMap = source.specularIntensityMap; - this.specularColor.copy(source.specularColor); - this.specularColorMap = source.specularColorMap; - return this; - } -}; -var MeshPhongMaterial = class extends Material { - constructor(parameters) { - super(); - this.isMeshPhongMaterial = true; - this.type = "MeshPhongMaterial"; - this.color = new Color(16777215); - this.specular = new Color(1118481); - this.shininess = 30; - this.map = null; - this.lightMap = null; - this.lightMapIntensity = 1; - this.aoMap = null; - this.aoMapIntensity = 1; - this.emissive = new Color(0); - this.emissiveIntensity = 1; - this.emissiveMap = null; - this.bumpMap = null; - this.bumpScale = 1; - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2(1, 1); - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.specularMap = null; - this.alphaMap = null; - this.envMap = null; - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = "round"; - this.wireframeLinejoin = "round"; - this.flatShading = false; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.color.copy(source.color); - this.specular.copy(source.specular); - this.shininess = source.shininess; - this.map = source.map; - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - this.emissive.copy(source.emissive); - this.emissiveMap = source.emissiveMap; - this.emissiveIntensity = source.emissiveIntensity; - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - this.normalMap = source.normalMap; - this.normalMapType = source.normalMapType; - this.normalScale.copy(source.normalScale); - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - this.specularMap = source.specularMap; - this.alphaMap = source.alphaMap; - this.envMap = source.envMap; - this.combine = source.combine; - this.reflectivity = source.reflectivity; - this.refractionRatio = source.refractionRatio; - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - this.flatShading = source.flatShading; - this.fog = source.fog; - return this; - } -}; -var MeshToonMaterial = class extends Material { - constructor(parameters) { - super(); - this.isMeshToonMaterial = true; - this.defines = { "TOON": "" }; - this.type = "MeshToonMaterial"; - this.color = new Color(16777215); - this.map = null; - this.gradientMap = null; - this.lightMap = null; - this.lightMapIntensity = 1; - this.aoMap = null; - this.aoMapIntensity = 1; - this.emissive = new Color(0); - this.emissiveIntensity = 1; - this.emissiveMap = null; - this.bumpMap = null; - this.bumpScale = 1; - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2(1, 1); - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.alphaMap = null; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = "round"; - this.wireframeLinejoin = "round"; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.color.copy(source.color); - this.map = source.map; - this.gradientMap = source.gradientMap; - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - this.emissive.copy(source.emissive); - this.emissiveMap = source.emissiveMap; - this.emissiveIntensity = source.emissiveIntensity; - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - this.normalMap = source.normalMap; - this.normalMapType = source.normalMapType; - this.normalScale.copy(source.normalScale); - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - this.alphaMap = source.alphaMap; - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - this.fog = source.fog; - return this; - } -}; -var MeshNormalMaterial = class extends Material { - constructor(parameters) { - super(); - this.isMeshNormalMaterial = true; - this.type = "MeshNormalMaterial"; - this.bumpMap = null; - this.bumpScale = 1; - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2(1, 1); - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.flatShading = false; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - this.normalMap = source.normalMap; - this.normalMapType = source.normalMapType; - this.normalScale.copy(source.normalScale); - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.flatShading = source.flatShading; - return this; - } -}; -var MeshLambertMaterial = class extends Material { - constructor(parameters) { - super(); - this.isMeshLambertMaterial = true; - this.type = "MeshLambertMaterial"; - this.color = new Color(16777215); - this.map = null; - this.lightMap = null; - this.lightMapIntensity = 1; - this.aoMap = null; - this.aoMapIntensity = 1; - this.emissive = new Color(0); - this.emissiveIntensity = 1; - this.emissiveMap = null; - this.bumpMap = null; - this.bumpScale = 1; - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2(1, 1); - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.specularMap = null; - this.alphaMap = null; - this.envMap = null; - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = "round"; - this.wireframeLinejoin = "round"; - this.flatShading = false; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.color.copy(source.color); - this.map = source.map; - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - this.emissive.copy(source.emissive); - this.emissiveMap = source.emissiveMap; - this.emissiveIntensity = source.emissiveIntensity; - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - this.normalMap = source.normalMap; - this.normalMapType = source.normalMapType; - this.normalScale.copy(source.normalScale); - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - this.specularMap = source.specularMap; - this.alphaMap = source.alphaMap; - this.envMap = source.envMap; - this.combine = source.combine; - this.reflectivity = source.reflectivity; - this.refractionRatio = source.refractionRatio; - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - this.flatShading = source.flatShading; - this.fog = source.fog; - return this; - } -}; -var MeshMatcapMaterial = class extends Material { - constructor(parameters) { - super(); - this.isMeshMatcapMaterial = true; - this.defines = { "MATCAP": "" }; - this.type = "MeshMatcapMaterial"; - this.color = new Color(16777215); - this.matcap = null; - this.map = null; - this.bumpMap = null; - this.bumpScale = 1; - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2(1, 1); - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.alphaMap = null; - this.flatShading = false; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.defines = { "MATCAP": "" }; - this.color.copy(source.color); - this.matcap = source.matcap; - this.map = source.map; - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - this.normalMap = source.normalMap; - this.normalMapType = source.normalMapType; - this.normalScale.copy(source.normalScale); - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - this.alphaMap = source.alphaMap; - this.flatShading = source.flatShading; - this.fog = source.fog; - return this; - } -}; -var LineDashedMaterial = class extends LineBasicMaterial { - constructor(parameters) { - super(); - this.isLineDashedMaterial = true; - this.type = "LineDashedMaterial"; - this.scale = 1; - this.dashSize = 3; - this.gapSize = 1; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.scale = source.scale; - this.dashSize = source.dashSize; - this.gapSize = source.gapSize; - return this; - } -}; -function convertArray(array, type, forceClone) { - if (!array || // let 'undefined' and 'null' pass - !forceClone && array.constructor === type) - return array; - if (typeof type.BYTES_PER_ELEMENT === "number") { - return new type(array); - } - return Array.prototype.slice.call(array); -} -function isTypedArray(object) { - return ArrayBuffer.isView(object) && !(object instanceof DataView); -} -function getKeyframeOrder(times) { - function compareTime(i, j) { - return times[i] - times[j]; - } - const n = times.length; - const result = new Array(n); - for (let i = 0; i !== n; ++i) - result[i] = i; - result.sort(compareTime); - return result; -} -function sortedArray(values, stride, order) { - const nValues = values.length; - const result = new values.constructor(nValues); - for (let i = 0, dstOffset = 0; dstOffset !== nValues; ++i) { - const srcOffset = order[i] * stride; - for (let j = 0; j !== stride; ++j) { - result[dstOffset++] = values[srcOffset + j]; - } - } - return result; -} -function flattenJSON(jsonKeys, times, values, valuePropertyName) { - let i = 1, key = jsonKeys[0]; - while (key !== void 0 && key[valuePropertyName] === void 0) { - key = jsonKeys[i++]; - } - if (key === void 0) - return; - let value = key[valuePropertyName]; - if (value === void 0) - return; - if (Array.isArray(value)) { - do { - value = key[valuePropertyName]; - if (value !== void 0) { - times.push(key.time); - values.push.apply(values, value); - } - key = jsonKeys[i++]; - } while (key !== void 0); - } else if (value.toArray !== void 0) { - do { - value = key[valuePropertyName]; - if (value !== void 0) { - times.push(key.time); - value.toArray(values, values.length); - } - key = jsonKeys[i++]; - } while (key !== void 0); - } else { - do { - value = key[valuePropertyName]; - if (value !== void 0) { - times.push(key.time); - values.push(value); - } - key = jsonKeys[i++]; - } while (key !== void 0); - } -} -function subclip(sourceClip, name, startFrame, endFrame, fps = 30) { - const clip = sourceClip.clone(); - clip.name = name; - const tracks = []; - for (let i = 0; i < clip.tracks.length; ++i) { - const track = clip.tracks[i]; - const valueSize = track.getValueSize(); - const times = []; - const values = []; - for (let j = 0; j < track.times.length; ++j) { - const frame = track.times[j] * fps; - if (frame < startFrame || frame >= endFrame) - continue; - times.push(track.times[j]); - for (let k = 0; k < valueSize; ++k) { - values.push(track.values[j * valueSize + k]); - } - } - if (times.length === 0) - continue; - track.times = convertArray(times, track.times.constructor); - track.values = convertArray(values, track.values.constructor); - tracks.push(track); - } - clip.tracks = tracks; - let minStartTime = Infinity; - for (let i = 0; i < clip.tracks.length; ++i) { - if (minStartTime > clip.tracks[i].times[0]) { - minStartTime = clip.tracks[i].times[0]; - } - } - for (let i = 0; i < clip.tracks.length; ++i) { - clip.tracks[i].shift(-1 * minStartTime); - } - clip.resetDuration(); - return clip; -} -function makeClipAdditive(targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30) { - if (fps <= 0) - fps = 30; - const numTracks = referenceClip.tracks.length; - const referenceTime = referenceFrame / fps; - for (let i = 0; i < numTracks; ++i) { - const referenceTrack = referenceClip.tracks[i]; - const referenceTrackType = referenceTrack.ValueTypeName; - if (referenceTrackType === "bool" || referenceTrackType === "string") - continue; - const targetTrack = targetClip.tracks.find(function(track) { - return track.name === referenceTrack.name && track.ValueTypeName === referenceTrackType; - }); - if (targetTrack === void 0) - continue; - let referenceOffset = 0; - const referenceValueSize = referenceTrack.getValueSize(); - if (referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) { - referenceOffset = referenceValueSize / 3; - } - let targetOffset = 0; - const targetValueSize = targetTrack.getValueSize(); - if (targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) { - targetOffset = targetValueSize / 3; - } - const lastIndex = referenceTrack.times.length - 1; - let referenceValue; - if (referenceTime <= referenceTrack.times[0]) { - const startIndex = referenceOffset; - const endIndex = referenceValueSize - referenceOffset; - referenceValue = referenceTrack.values.slice(startIndex, endIndex); - } else if (referenceTime >= referenceTrack.times[lastIndex]) { - const startIndex = lastIndex * referenceValueSize + referenceOffset; - const endIndex = startIndex + referenceValueSize - referenceOffset; - referenceValue = referenceTrack.values.slice(startIndex, endIndex); - } else { - const interpolant = referenceTrack.createInterpolant(); - const startIndex = referenceOffset; - const endIndex = referenceValueSize - referenceOffset; - interpolant.evaluate(referenceTime); - referenceValue = interpolant.resultBuffer.slice(startIndex, endIndex); - } - if (referenceTrackType === "quaternion") { - const referenceQuat = new Quaternion().fromArray(referenceValue).normalize().conjugate(); - referenceQuat.toArray(referenceValue); - } - const numTimes = targetTrack.times.length; - for (let j = 0; j < numTimes; ++j) { - const valueStart = j * targetValueSize + targetOffset; - if (referenceTrackType === "quaternion") { - Quaternion.multiplyQuaternionsFlat( - targetTrack.values, - valueStart, - referenceValue, - 0, - targetTrack.values, - valueStart - ); - } else { - const valueEnd = targetValueSize - targetOffset * 2; - for (let k = 0; k < valueEnd; ++k) { - targetTrack.values[valueStart + k] -= referenceValue[k]; - } - } - } - } - targetClip.blendMode = AdditiveAnimationBlendMode; - return targetClip; -} -var AnimationUtils = { - convertArray, - isTypedArray, - getKeyframeOrder, - sortedArray, - flattenJSON, - subclip, - makeClipAdditive -}; -var Interpolant = class { - constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { - this.parameterPositions = parameterPositions; - this._cachedIndex = 0; - this.resultBuffer = resultBuffer !== void 0 ? resultBuffer : new sampleValues.constructor(sampleSize); - this.sampleValues = sampleValues; - this.valueSize = sampleSize; - this.settings = null; - this.DefaultSettings_ = {}; - } - evaluate(t) { - const pp = this.parameterPositions; - let i1 = this._cachedIndex, t1 = pp[i1], t0 = pp[i1 - 1]; - validate_interval: { - seek: { - let right; - linear_scan: { - forward_scan: - if (!(t < t1)) { - for (let giveUpAt = i1 + 2; ; ) { - if (t1 === void 0) { - if (t < t0) - break forward_scan; - i1 = pp.length; - this._cachedIndex = i1; - return this.copySampleValue_(i1 - 1); - } - if (i1 === giveUpAt) - break; - t0 = t1; - t1 = pp[++i1]; - if (t < t1) { - break seek; - } - } - right = pp.length; - break linear_scan; - } - if (!(t >= t0)) { - const t1global = pp[1]; - if (t < t1global) { - i1 = 2; - t0 = t1global; - } - for (let giveUpAt = i1 - 2; ; ) { - if (t0 === void 0) { - this._cachedIndex = 0; - return this.copySampleValue_(0); - } - if (i1 === giveUpAt) - break; - t1 = t0; - t0 = pp[--i1 - 1]; - if (t >= t0) { - break seek; - } - } - right = i1; - i1 = 0; - break linear_scan; - } - break validate_interval; - } - while (i1 < right) { - const mid = i1 + right >>> 1; - if (t < pp[mid]) { - right = mid; - } else { - i1 = mid + 1; - } - } - t1 = pp[i1]; - t0 = pp[i1 - 1]; - if (t0 === void 0) { - this._cachedIndex = 0; - return this.copySampleValue_(0); - } - if (t1 === void 0) { - i1 = pp.length; - this._cachedIndex = i1; - return this.copySampleValue_(i1 - 1); - } - } - this._cachedIndex = i1; - this.intervalChanged_(i1, t0, t1); - } - return this.interpolate_(i1, t0, t, t1); - } - getSettings_() { - return this.settings || this.DefaultSettings_; - } - copySampleValue_(index) { - const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, offset = index * stride; - for (let i = 0; i !== stride; ++i) { - result[i] = values[offset + i]; - } - return result; - } - // Template methods for derived classes: - interpolate_() { - throw new Error("call to abstract method"); - } - intervalChanged_() { - } -}; -var CubicInterpolant = class extends Interpolant { - constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { - super(parameterPositions, sampleValues, sampleSize, resultBuffer); - this._weightPrev = -0; - this._offsetPrev = -0; - this._weightNext = -0; - this._offsetNext = -0; - this.DefaultSettings_ = { - endingStart: ZeroCurvatureEnding, - endingEnd: ZeroCurvatureEnding - }; - } - intervalChanged_(i1, t0, t1) { - const pp = this.parameterPositions; - let iPrev = i1 - 2, iNext = i1 + 1, tPrev = pp[iPrev], tNext = pp[iNext]; - if (tPrev === void 0) { - switch (this.getSettings_().endingStart) { - case ZeroSlopeEnding: - iPrev = i1; - tPrev = 2 * t0 - t1; - break; - case WrapAroundEnding: - iPrev = pp.length - 2; - tPrev = t0 + pp[iPrev] - pp[iPrev + 1]; - break; - default: - iPrev = i1; - tPrev = t1; - } - } - if (tNext === void 0) { - switch (this.getSettings_().endingEnd) { - case ZeroSlopeEnding: - iNext = i1; - tNext = 2 * t1 - t0; - break; - case WrapAroundEnding: - iNext = 1; - tNext = t1 + pp[1] - pp[0]; - break; - default: - iNext = i1 - 1; - tNext = t0; - } - } - const halfDt = (t1 - t0) * 0.5, stride = this.valueSize; - this._weightPrev = halfDt / (t0 - tPrev); - this._weightNext = halfDt / (tNext - t1); - this._offsetPrev = iPrev * stride; - this._offsetNext = iNext * stride; - } - interpolate_(i1, t0, t, t1) { - const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, o1 = i1 * stride, o0 = o1 - stride, oP = this._offsetPrev, oN = this._offsetNext, wP = this._weightPrev, wN = this._weightNext, p = (t - t0) / (t1 - t0), pp = p * p, ppp = pp * p; - const sP = -wP * ppp + 2 * wP * pp - wP * p; - const s0 = (1 + wP) * ppp + (-1.5 - 2 * wP) * pp + (-0.5 + wP) * p + 1; - const s1 = (-1 - wN) * ppp + (1.5 + wN) * pp + 0.5 * p; - const sN = wN * ppp - wN * pp; - for (let i = 0; i !== stride; ++i) { - result[i] = sP * values[oP + i] + s0 * values[o0 + i] + s1 * values[o1 + i] + sN * values[oN + i]; - } - return result; - } -}; -var LinearInterpolant = class extends Interpolant { - constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { - super(parameterPositions, sampleValues, sampleSize, resultBuffer); - } - interpolate_(i1, t0, t, t1) { - const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, offset1 = i1 * stride, offset0 = offset1 - stride, weight1 = (t - t0) / (t1 - t0), weight0 = 1 - weight1; - for (let i = 0; i !== stride; ++i) { - result[i] = values[offset0 + i] * weight0 + values[offset1 + i] * weight1; - } - return result; - } -}; -var DiscreteInterpolant = class extends Interpolant { - constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { - super(parameterPositions, sampleValues, sampleSize, resultBuffer); - } - interpolate_(i1) { - return this.copySampleValue_(i1 - 1); - } -}; -var KeyframeTrack = class { - constructor(name, times, values, interpolation) { - if (name === void 0) - throw new Error("THREE.KeyframeTrack: track name is undefined"); - if (times === void 0 || times.length === 0) - throw new Error("THREE.KeyframeTrack: no keyframes in track named " + name); - this.name = name; - this.times = convertArray(times, this.TimeBufferType); - this.values = convertArray(values, this.ValueBufferType); - this.setInterpolation(interpolation || this.DefaultInterpolation); - } - // Serialization (in static context, because of constructor invocation - // and automatic invocation of .toJSON): - static toJSON(track) { - const trackType = track.constructor; - let json; - if (trackType.toJSON !== this.toJSON) { - json = trackType.toJSON(track); - } else { - json = { - "name": track.name, - "times": convertArray(track.times, Array), - "values": convertArray(track.values, Array) - }; - const interpolation = track.getInterpolation(); - if (interpolation !== track.DefaultInterpolation) { - json.interpolation = interpolation; - } - } - json.type = track.ValueTypeName; - return json; - } - InterpolantFactoryMethodDiscrete(result) { - return new DiscreteInterpolant(this.times, this.values, this.getValueSize(), result); - } - InterpolantFactoryMethodLinear(result) { - return new LinearInterpolant(this.times, this.values, this.getValueSize(), result); - } - InterpolantFactoryMethodSmooth(result) { - return new CubicInterpolant(this.times, this.values, this.getValueSize(), result); - } - setInterpolation(interpolation) { - let factoryMethod; - switch (interpolation) { - case InterpolateDiscrete: - factoryMethod = this.InterpolantFactoryMethodDiscrete; - break; - case InterpolateLinear: - factoryMethod = this.InterpolantFactoryMethodLinear; - break; - case InterpolateSmooth: - factoryMethod = this.InterpolantFactoryMethodSmooth; - break; - } - if (factoryMethod === void 0) { - const message = "unsupported interpolation for " + this.ValueTypeName + " keyframe track named " + this.name; - if (this.createInterpolant === void 0) { - if (interpolation !== this.DefaultInterpolation) { - this.setInterpolation(this.DefaultInterpolation); - } else { - throw new Error(message); - } - } - console.warn("THREE.KeyframeTrack:", message); - return this; - } - this.createInterpolant = factoryMethod; - return this; - } - getInterpolation() { - switch (this.createInterpolant) { - case this.InterpolantFactoryMethodDiscrete: - return InterpolateDiscrete; - case this.InterpolantFactoryMethodLinear: - return InterpolateLinear; - case this.InterpolantFactoryMethodSmooth: - return InterpolateSmooth; - } - } - getValueSize() { - return this.values.length / this.times.length; - } - // move all keyframes either forwards or backwards in time - shift(timeOffset) { - if (timeOffset !== 0) { - const times = this.times; - for (let i = 0, n = times.length; i !== n; ++i) { - times[i] += timeOffset; - } - } - return this; - } - // scale all keyframe times by a factor (useful for frame <-> seconds conversions) - scale(timeScale) { - if (timeScale !== 1) { - const times = this.times; - for (let i = 0, n = times.length; i !== n; ++i) { - times[i] *= timeScale; - } - } - return this; - } - // removes keyframes before and after animation without changing any values within the range [startTime, endTime]. - // IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values - trim(startTime, endTime) { - const times = this.times, nKeys = times.length; - let from = 0, to = nKeys - 1; - while (from !== nKeys && times[from] < startTime) { - ++from; - } - while (to !== -1 && times[to] > endTime) { - --to; - } - ++to; - if (from !== 0 || to !== nKeys) { - if (from >= to) { - to = Math.max(to, 1); - from = to - 1; - } - const stride = this.getValueSize(); - this.times = times.slice(from, to); - this.values = this.values.slice(from * stride, to * stride); - } - return this; - } - // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable - validate() { - let valid = true; - const valueSize = this.getValueSize(); - if (valueSize - Math.floor(valueSize) !== 0) { - console.error("THREE.KeyframeTrack: Invalid value size in track.", this); - valid = false; - } - const times = this.times, values = this.values, nKeys = times.length; - if (nKeys === 0) { - console.error("THREE.KeyframeTrack: Track is empty.", this); - valid = false; - } - let prevTime = null; - for (let i = 0; i !== nKeys; i++) { - const currTime = times[i]; - if (typeof currTime === "number" && isNaN(currTime)) { - console.error("THREE.KeyframeTrack: Time is not a valid number.", this, i, currTime); - valid = false; - break; - } - if (prevTime !== null && prevTime > currTime) { - console.error("THREE.KeyframeTrack: Out of order keys.", this, i, currTime, prevTime); - valid = false; - break; - } - prevTime = currTime; - } - if (values !== void 0) { - if (isTypedArray(values)) { - for (let i = 0, n = values.length; i !== n; ++i) { - const value = values[i]; - if (isNaN(value)) { - console.error("THREE.KeyframeTrack: Value is not a valid number.", this, i, value); - valid = false; - break; - } - } - } - } - return valid; - } - // removes equivalent sequential keys as common in morph target sequences - // (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0) - optimize() { - const times = this.times.slice(), values = this.values.slice(), stride = this.getValueSize(), smoothInterpolation = this.getInterpolation() === InterpolateSmooth, lastIndex = times.length - 1; - let writeIndex = 1; - for (let i = 1; i < lastIndex; ++i) { - let keep = false; - const time = times[i]; - const timeNext = times[i + 1]; - if (time !== timeNext && (i !== 1 || time !== times[0])) { - if (!smoothInterpolation) { - const offset = i * stride, offsetP = offset - stride, offsetN = offset + stride; - for (let j = 0; j !== stride; ++j) { - const value = values[offset + j]; - if (value !== values[offsetP + j] || value !== values[offsetN + j]) { - keep = true; - break; - } - } - } else { - keep = true; - } - } - if (keep) { - if (i !== writeIndex) { - times[writeIndex] = times[i]; - const readOffset = i * stride, writeOffset = writeIndex * stride; - for (let j = 0; j !== stride; ++j) { - values[writeOffset + j] = values[readOffset + j]; - } - } - ++writeIndex; - } - } - if (lastIndex > 0) { - times[writeIndex] = times[lastIndex]; - for (let readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++j) { - values[writeOffset + j] = values[readOffset + j]; - } - ++writeIndex; - } - if (writeIndex !== times.length) { - this.times = times.slice(0, writeIndex); - this.values = values.slice(0, writeIndex * stride); - } else { - this.times = times; - this.values = values; - } - return this; - } - clone() { - const times = this.times.slice(); - const values = this.values.slice(); - const TypedKeyframeTrack = this.constructor; - const track = new TypedKeyframeTrack(this.name, times, values); - track.createInterpolant = this.createInterpolant; - return track; - } -}; -KeyframeTrack.prototype.TimeBufferType = Float32Array; -KeyframeTrack.prototype.ValueBufferType = Float32Array; -KeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear; -var BooleanKeyframeTrack = class extends KeyframeTrack { -}; -BooleanKeyframeTrack.prototype.ValueTypeName = "bool"; -BooleanKeyframeTrack.prototype.ValueBufferType = Array; -BooleanKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete; -BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear = void 0; -BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = void 0; -var ColorKeyframeTrack = class extends KeyframeTrack { -}; -ColorKeyframeTrack.prototype.ValueTypeName = "color"; -var NumberKeyframeTrack = class extends KeyframeTrack { -}; -NumberKeyframeTrack.prototype.ValueTypeName = "number"; -var QuaternionLinearInterpolant = class extends Interpolant { - constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { - super(parameterPositions, sampleValues, sampleSize, resultBuffer); - } - interpolate_(i1, t0, t, t1) { - const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, alpha = (t - t0) / (t1 - t0); - let offset = i1 * stride; - for (let end = offset + stride; offset !== end; offset += 4) { - Quaternion.slerpFlat(result, 0, values, offset - stride, values, offset, alpha); - } - return result; - } -}; -var QuaternionKeyframeTrack = class extends KeyframeTrack { - InterpolantFactoryMethodLinear(result) { - return new QuaternionLinearInterpolant(this.times, this.values, this.getValueSize(), result); - } -}; -QuaternionKeyframeTrack.prototype.ValueTypeName = "quaternion"; -QuaternionKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear; -QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = void 0; -var StringKeyframeTrack = class extends KeyframeTrack { -}; -StringKeyframeTrack.prototype.ValueTypeName = "string"; -StringKeyframeTrack.prototype.ValueBufferType = Array; -StringKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete; -StringKeyframeTrack.prototype.InterpolantFactoryMethodLinear = void 0; -StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = void 0; -var VectorKeyframeTrack = class extends KeyframeTrack { -}; -VectorKeyframeTrack.prototype.ValueTypeName = "vector"; -var AnimationClip = class { - constructor(name, duration = -1, tracks, blendMode = NormalAnimationBlendMode) { - this.name = name; - this.tracks = tracks; - this.duration = duration; - this.blendMode = blendMode; - this.uuid = generateUUID(); - if (this.duration < 0) { - this.resetDuration(); - } - } - static parse(json) { - const tracks = [], jsonTracks = json.tracks, frameTime = 1 / (json.fps || 1); - for (let i = 0, n = jsonTracks.length; i !== n; ++i) { - tracks.push(parseKeyframeTrack(jsonTracks[i]).scale(frameTime)); - } - const clip = new this(json.name, json.duration, tracks, json.blendMode); - clip.uuid = json.uuid; - return clip; - } - static toJSON(clip) { - const tracks = [], clipTracks = clip.tracks; - const json = { - "name": clip.name, - "duration": clip.duration, - "tracks": tracks, - "uuid": clip.uuid, - "blendMode": clip.blendMode - }; - for (let i = 0, n = clipTracks.length; i !== n; ++i) { - tracks.push(KeyframeTrack.toJSON(clipTracks[i])); - } - return json; - } - static CreateFromMorphTargetSequence(name, morphTargetSequence, fps, noLoop) { - const numMorphTargets = morphTargetSequence.length; - const tracks = []; - for (let i = 0; i < numMorphTargets; i++) { - let times = []; - let values = []; - times.push( - (i + numMorphTargets - 1) % numMorphTargets, - i, - (i + 1) % numMorphTargets - ); - values.push(0, 1, 0); - const order = getKeyframeOrder(times); - times = sortedArray(times, 1, order); - values = sortedArray(values, 1, order); - if (!noLoop && times[0] === 0) { - times.push(numMorphTargets); - values.push(values[0]); - } - tracks.push( - new NumberKeyframeTrack( - ".morphTargetInfluences[" + morphTargetSequence[i].name + "]", - times, - values - ).scale(1 / fps) - ); - } - return new this(name, -1, tracks); - } - static findByName(objectOrClipArray, name) { - let clipArray = objectOrClipArray; - if (!Array.isArray(objectOrClipArray)) { - const o = objectOrClipArray; - clipArray = o.geometry && o.geometry.animations || o.animations; - } - for (let i = 0; i < clipArray.length; i++) { - if (clipArray[i].name === name) { - return clipArray[i]; - } - } - return null; - } - static CreateClipsFromMorphTargetSequences(morphTargets, fps, noLoop) { - const animationToMorphTargets = {}; - const pattern = /^([\w-]*?)([\d]+)$/; - for (let i = 0, il = morphTargets.length; i < il; i++) { - const morphTarget = morphTargets[i]; - const parts = morphTarget.name.match(pattern); - if (parts && parts.length > 1) { - const name = parts[1]; - let animationMorphTargets = animationToMorphTargets[name]; - if (!animationMorphTargets) { - animationToMorphTargets[name] = animationMorphTargets = []; - } - animationMorphTargets.push(morphTarget); - } - } - const clips = []; - for (const name in animationToMorphTargets) { - clips.push(this.CreateFromMorphTargetSequence(name, animationToMorphTargets[name], fps, noLoop)); - } - return clips; - } - // parse the animation.hierarchy format - static parseAnimation(animation, bones) { - if (!animation) { - console.error("THREE.AnimationClip: No animation in JSONLoader data."); - return null; - } - const addNonemptyTrack = function(trackType, trackName, animationKeys, propertyName, destTracks) { - if (animationKeys.length !== 0) { - const times = []; - const values = []; - flattenJSON(animationKeys, times, values, propertyName); - if (times.length !== 0) { - destTracks.push(new trackType(trackName, times, values)); - } - } - }; - const tracks = []; - const clipName = animation.name || "default"; - const fps = animation.fps || 30; - const blendMode = animation.blendMode; - let duration = animation.length || -1; - const hierarchyTracks = animation.hierarchy || []; - for (let h = 0; h < hierarchyTracks.length; h++) { - const animationKeys = hierarchyTracks[h].keys; - if (!animationKeys || animationKeys.length === 0) - continue; - if (animationKeys[0].morphTargets) { - const morphTargetNames = {}; - let k; - for (k = 0; k < animationKeys.length; k++) { - if (animationKeys[k].morphTargets) { - for (let m = 0; m < animationKeys[k].morphTargets.length; m++) { - morphTargetNames[animationKeys[k].morphTargets[m]] = -1; - } - } - } - for (const morphTargetName in morphTargetNames) { - const times = []; - const values = []; - for (let m = 0; m !== animationKeys[k].morphTargets.length; ++m) { - const animationKey = animationKeys[k]; - times.push(animationKey.time); - values.push(animationKey.morphTarget === morphTargetName ? 1 : 0); - } - tracks.push(new NumberKeyframeTrack(".morphTargetInfluence[" + morphTargetName + "]", times, values)); - } - duration = morphTargetNames.length * fps; - } else { - const boneName = ".bones[" + bones[h].name + "]"; - addNonemptyTrack( - VectorKeyframeTrack, - boneName + ".position", - animationKeys, - "pos", - tracks - ); - addNonemptyTrack( - QuaternionKeyframeTrack, - boneName + ".quaternion", - animationKeys, - "rot", - tracks - ); - addNonemptyTrack( - VectorKeyframeTrack, - boneName + ".scale", - animationKeys, - "scl", - tracks - ); - } - } - if (tracks.length === 0) { - return null; - } - const clip = new this(clipName, duration, tracks, blendMode); - return clip; - } - resetDuration() { - const tracks = this.tracks; - let duration = 0; - for (let i = 0, n = tracks.length; i !== n; ++i) { - const track = this.tracks[i]; - duration = Math.max(duration, track.times[track.times.length - 1]); - } - this.duration = duration; - return this; - } - trim() { - for (let i = 0; i < this.tracks.length; i++) { - this.tracks[i].trim(0, this.duration); - } - return this; - } - validate() { - let valid = true; - for (let i = 0; i < this.tracks.length; i++) { - valid = valid && this.tracks[i].validate(); - } - return valid; - } - optimize() { - for (let i = 0; i < this.tracks.length; i++) { - this.tracks[i].optimize(); - } - return this; - } - clone() { - const tracks = []; - for (let i = 0; i < this.tracks.length; i++) { - tracks.push(this.tracks[i].clone()); - } - return new this.constructor(this.name, this.duration, tracks, this.blendMode); - } - toJSON() { - return this.constructor.toJSON(this); - } -}; -function getTrackTypeForValueTypeName(typeName) { - switch (typeName.toLowerCase()) { - case "scalar": - case "double": - case "float": - case "number": - case "integer": - return NumberKeyframeTrack; - case "vector": - case "vector2": - case "vector3": - case "vector4": - return VectorKeyframeTrack; - case "color": - return ColorKeyframeTrack; - case "quaternion": - return QuaternionKeyframeTrack; - case "bool": - case "boolean": - return BooleanKeyframeTrack; - case "string": - return StringKeyframeTrack; - } - throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + typeName); -} -function parseKeyframeTrack(json) { - if (json.type === void 0) { - throw new Error("THREE.KeyframeTrack: track type undefined, can not parse"); - } - const trackType = getTrackTypeForValueTypeName(json.type); - if (json.times === void 0) { - const times = [], values = []; - flattenJSON(json.keys, times, values, "value"); - json.times = times; - json.values = values; - } - if (trackType.parse !== void 0) { - return trackType.parse(json); - } else { - return new trackType(json.name, json.times, json.values, json.interpolation); - } -} -var Cache = { - enabled: false, - files: {}, - add: function(key, file) { - if (this.enabled === false) - return; - this.files[key] = file; - }, - get: function(key) { - if (this.enabled === false) - return; - return this.files[key]; - }, - remove: function(key) { - delete this.files[key]; - }, - clear: function() { - this.files = {}; - } -}; -var LoadingManager = class { - constructor(onLoad, onProgress, onError) { - const scope = this; - let isLoading = false; - let itemsLoaded = 0; - let itemsTotal = 0; - let urlModifier = void 0; - const handlers = []; - this.onStart = void 0; - this.onLoad = onLoad; - this.onProgress = onProgress; - this.onError = onError; - this.itemStart = function(url) { - itemsTotal++; - if (isLoading === false) { - if (scope.onStart !== void 0) { - scope.onStart(url, itemsLoaded, itemsTotal); - } - } - isLoading = true; - }; - this.itemEnd = function(url) { - itemsLoaded++; - if (scope.onProgress !== void 0) { - scope.onProgress(url, itemsLoaded, itemsTotal); - } - if (itemsLoaded === itemsTotal) { - isLoading = false; - if (scope.onLoad !== void 0) { - scope.onLoad(); - } - } - }; - this.itemError = function(url) { - if (scope.onError !== void 0) { - scope.onError(url); - } - }; - this.resolveURL = function(url) { - if (urlModifier) { - return urlModifier(url); - } - return url; - }; - this.setURLModifier = function(transform) { - urlModifier = transform; - return this; - }; - this.addHandler = function(regex, loader) { - handlers.push(regex, loader); - return this; - }; - this.removeHandler = function(regex) { - const index = handlers.indexOf(regex); - if (index !== -1) { - handlers.splice(index, 2); - } - return this; - }; - this.getHandler = function(file) { - for (let i = 0, l = handlers.length; i < l; i += 2) { - const regex = handlers[i]; - const loader = handlers[i + 1]; - if (regex.global) - regex.lastIndex = 0; - if (regex.test(file)) { - return loader; - } - } - return null; - }; - } -}; -var DefaultLoadingManager = new LoadingManager(); -var Loader = class { - constructor(manager) { - this.manager = manager !== void 0 ? manager : DefaultLoadingManager; - this.crossOrigin = "anonymous"; - this.withCredentials = false; - this.path = ""; - this.resourcePath = ""; - this.requestHeader = {}; - } - load() { - } - loadAsync(url, onProgress) { - const scope = this; - return new Promise(function(resolve, reject) { - scope.load(url, resolve, onProgress, reject); - }); - } - parse() { - } - setCrossOrigin(crossOrigin) { - this.crossOrigin = crossOrigin; - return this; - } - setWithCredentials(value) { - this.withCredentials = value; - return this; - } - setPath(path) { - this.path = path; - return this; - } - setResourcePath(resourcePath) { - this.resourcePath = resourcePath; - return this; - } - setRequestHeader(requestHeader) { - this.requestHeader = requestHeader; - return this; - } -}; -Loader.DEFAULT_MATERIAL_NAME = "__DEFAULT"; -var loading = {}; -var HttpError = class extends Error { - constructor(message, response) { - super(message); - this.response = response; - } -}; -var FileLoader = class extends Loader { - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - if (url === void 0) - url = ""; - if (this.path !== void 0) - url = this.path + url; - url = this.manager.resolveURL(url); - const cached = Cache.get(url); - if (cached !== void 0) { - this.manager.itemStart(url); - setTimeout(() => { - if (onLoad) - onLoad(cached); - this.manager.itemEnd(url); - }, 0); - return cached; - } - if (loading[url] !== void 0) { - loading[url].push({ - onLoad, - onProgress, - onError - }); - return; - } - loading[url] = []; - loading[url].push({ - onLoad, - onProgress, - onError - }); - const req = new Request(url, { - headers: new Headers(this.requestHeader), - credentials: this.withCredentials ? "include" : "same-origin" - // An abort controller could be added within a future PR - }); - const mimeType = this.mimeType; - const responseType = this.responseType; - fetch(req).then((response) => { - if (response.status === 200 || response.status === 0) { - if (response.status === 0) { - console.warn("THREE.FileLoader: HTTP Status 0 received."); - } - if (typeof ReadableStream === "undefined" || response.body === void 0 || response.body.getReader === void 0) { - return response; - } - const callbacks = loading[url]; - const reader = response.body.getReader(); - const contentLength = response.headers.get("Content-Length") || response.headers.get("X-File-Size"); - const total = contentLength ? parseInt(contentLength) : 0; - const lengthComputable = total !== 0; - let loaded = 0; - const stream = new ReadableStream({ - start(controller) { - readData(); - function readData() { - reader.read().then(({ done, value }) => { - if (done) { - controller.close(); - } else { - loaded += value.byteLength; - const event = new ProgressEvent("progress", { lengthComputable, loaded, total }); - for (let i = 0, il = callbacks.length; i < il; i++) { - const callback = callbacks[i]; - if (callback.onProgress) - callback.onProgress(event); - } - controller.enqueue(value); - readData(); - } - }); - } - } - }); - return new Response(stream); - } else { - throw new HttpError(`fetch for "${response.url}" responded with ${response.status}: ${response.statusText}`, response); - } - }).then((response) => { - switch (responseType) { - case "arraybuffer": - return response.arrayBuffer(); - case "blob": - return response.blob(); - case "document": - return response.text().then((text) => { - const parser = new DOMParser(); - return parser.parseFromString(text, mimeType); - }); - case "json": - return response.json(); - default: - if (mimeType === void 0) { - return response.text(); - } else { - const re = /charset="?([^;"\s]*)"?/i; - const exec = re.exec(mimeType); - const label = exec && exec[1] ? exec[1].toLowerCase() : void 0; - const decoder = new TextDecoder(label); - return response.arrayBuffer().then((ab) => decoder.decode(ab)); - } - } - }).then((data) => { - Cache.add(url, data); - const callbacks = loading[url]; - delete loading[url]; - for (let i = 0, il = callbacks.length; i < il; i++) { - const callback = callbacks[i]; - if (callback.onLoad) - callback.onLoad(data); - } - }).catch((err) => { - const callbacks = loading[url]; - if (callbacks === void 0) { - this.manager.itemError(url); - throw err; - } - delete loading[url]; - for (let i = 0, il = callbacks.length; i < il; i++) { - const callback = callbacks[i]; - if (callback.onError) - callback.onError(err); - } - this.manager.itemError(url); - }).finally(() => { - this.manager.itemEnd(url); - }); - this.manager.itemStart(url); - } - setResponseType(value) { - this.responseType = value; - return this; - } - setMimeType(value) { - this.mimeType = value; - return this; - } -}; -var AnimationLoader = class extends Loader { - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - const scope = this; - const loader = new FileLoader(this.manager); - loader.setPath(this.path); - loader.setRequestHeader(this.requestHeader); - loader.setWithCredentials(this.withCredentials); - loader.load(url, function(text) { - try { - onLoad(scope.parse(JSON.parse(text))); - } catch (e) { - if (onError) { - onError(e); - } else { - console.error(e); - } - scope.manager.itemError(url); - } - }, onProgress, onError); - } - parse(json) { - const animations = []; - for (let i = 0; i < json.length; i++) { - const clip = AnimationClip.parse(json[i]); - animations.push(clip); - } - return animations; - } -}; -var CompressedTextureLoader = class extends Loader { - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - const scope = this; - const images = []; - const texture = new CompressedTexture(); - const loader = new FileLoader(this.manager); - loader.setPath(this.path); - loader.setResponseType("arraybuffer"); - loader.setRequestHeader(this.requestHeader); - loader.setWithCredentials(scope.withCredentials); - let loaded = 0; - function loadTexture(i) { - loader.load(url[i], function(buffer) { - const texDatas = scope.parse(buffer, true); - images[i] = { - width: texDatas.width, - height: texDatas.height, - format: texDatas.format, - mipmaps: texDatas.mipmaps - }; - loaded += 1; - if (loaded === 6) { - if (texDatas.mipmapCount === 1) - texture.minFilter = LinearFilter; - texture.image = images; - texture.format = texDatas.format; - texture.needsUpdate = true; - if (onLoad) - onLoad(texture); - } - }, onProgress, onError); - } - if (Array.isArray(url)) { - for (let i = 0, il = url.length; i < il; ++i) { - loadTexture(i); - } - } else { - loader.load(url, function(buffer) { - const texDatas = scope.parse(buffer, true); - if (texDatas.isCubemap) { - const faces = texDatas.mipmaps.length / texDatas.mipmapCount; - for (let f = 0; f < faces; f++) { - images[f] = { mipmaps: [] }; - for (let i = 0; i < texDatas.mipmapCount; i++) { - images[f].mipmaps.push(texDatas.mipmaps[f * texDatas.mipmapCount + i]); - images[f].format = texDatas.format; - images[f].width = texDatas.width; - images[f].height = texDatas.height; - } - } - texture.image = images; - } else { - texture.image.width = texDatas.width; - texture.image.height = texDatas.height; - texture.mipmaps = texDatas.mipmaps; - } - if (texDatas.mipmapCount === 1) { - texture.minFilter = LinearFilter; - } - texture.format = texDatas.format; - texture.needsUpdate = true; - if (onLoad) - onLoad(texture); - }, onProgress, onError); - } - return texture; - } -}; -var ImageLoader = class extends Loader { - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - if (this.path !== void 0) - url = this.path + url; - url = this.manager.resolveURL(url); - const scope = this; - const cached = Cache.get(url); - if (cached !== void 0) { - scope.manager.itemStart(url); - setTimeout(function() { - if (onLoad) - onLoad(cached); - scope.manager.itemEnd(url); - }, 0); - return cached; - } - const image = createElementNS("img"); - function onImageLoad() { - removeEventListeners(); - Cache.add(url, this); - if (onLoad) - onLoad(this); - scope.manager.itemEnd(url); - } - function onImageError(event) { - removeEventListeners(); - if (onError) - onError(event); - scope.manager.itemError(url); - scope.manager.itemEnd(url); - } - function removeEventListeners() { - image.removeEventListener("load", onImageLoad, false); - image.removeEventListener("error", onImageError, false); - } - image.addEventListener("load", onImageLoad, false); - image.addEventListener("error", onImageError, false); - if (url.slice(0, 5) !== "data:") { - if (this.crossOrigin !== void 0) - image.crossOrigin = this.crossOrigin; - } - scope.manager.itemStart(url); - image.src = url; - return image; - } -}; -var CubeTextureLoader = class extends Loader { - constructor(manager) { - super(manager); - } - load(urls, onLoad, onProgress, onError) { - const texture = new CubeTexture(); - texture.colorSpace = SRGBColorSpace; - const loader = new ImageLoader(this.manager); - loader.setCrossOrigin(this.crossOrigin); - loader.setPath(this.path); - let loaded = 0; - function loadTexture(i) { - loader.load(urls[i], function(image) { - texture.images[i] = image; - loaded++; - if (loaded === 6) { - texture.needsUpdate = true; - if (onLoad) - onLoad(texture); - } - }, void 0, onError); - } - for (let i = 0; i < urls.length; ++i) { - loadTexture(i); - } - return texture; - } -}; -var DataTextureLoader = class extends Loader { - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - const scope = this; - const texture = new DataTexture(); - const loader = new FileLoader(this.manager); - loader.setResponseType("arraybuffer"); - loader.setRequestHeader(this.requestHeader); - loader.setPath(this.path); - loader.setWithCredentials(scope.withCredentials); - loader.load(url, function(buffer) { - let texData; - try { - texData = scope.parse(buffer); - } catch (error) { - if (onError !== void 0) { - onError(error); - } else { - console.error(error); - return; - } - } - if (texData.image !== void 0) { - texture.image = texData.image; - } else if (texData.data !== void 0) { - texture.image.width = texData.width; - texture.image.height = texData.height; - texture.image.data = texData.data; - } - texture.wrapS = texData.wrapS !== void 0 ? texData.wrapS : ClampToEdgeWrapping; - texture.wrapT = texData.wrapT !== void 0 ? texData.wrapT : ClampToEdgeWrapping; - texture.magFilter = texData.magFilter !== void 0 ? texData.magFilter : LinearFilter; - texture.minFilter = texData.minFilter !== void 0 ? texData.minFilter : LinearFilter; - texture.anisotropy = texData.anisotropy !== void 0 ? texData.anisotropy : 1; - if (texData.colorSpace !== void 0) { - texture.colorSpace = texData.colorSpace; - } else if (texData.encoding !== void 0) { - texture.encoding = texData.encoding; - } - if (texData.flipY !== void 0) { - texture.flipY = texData.flipY; - } - if (texData.format !== void 0) { - texture.format = texData.format; - } - if (texData.type !== void 0) { - texture.type = texData.type; - } - if (texData.mipmaps !== void 0) { - texture.mipmaps = texData.mipmaps; - texture.minFilter = LinearMipmapLinearFilter; - } - if (texData.mipmapCount === 1) { - texture.minFilter = LinearFilter; - } - if (texData.generateMipmaps !== void 0) { - texture.generateMipmaps = texData.generateMipmaps; - } - texture.needsUpdate = true; - if (onLoad) - onLoad(texture, texData); - }, onProgress, onError); - return texture; - } -}; -var TextureLoader = class extends Loader { - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - const texture = new Texture(); - const loader = new ImageLoader(this.manager); - loader.setCrossOrigin(this.crossOrigin); - loader.setPath(this.path); - loader.load(url, function(image) { - texture.image = image; - texture.needsUpdate = true; - if (onLoad !== void 0) { - onLoad(texture); - } - }, onProgress, onError); - return texture; - } -}; -var Light = class extends Object3D { - constructor(color, intensity = 1) { - super(); - this.isLight = true; - this.type = "Light"; - this.color = new Color(color); - this.intensity = intensity; - } - dispose() { - } - copy(source, recursive) { - super.copy(source, recursive); - this.color.copy(source.color); - this.intensity = source.intensity; - return this; - } - toJSON(meta) { - const data = super.toJSON(meta); - data.object.color = this.color.getHex(); - data.object.intensity = this.intensity; - if (this.groundColor !== void 0) - data.object.groundColor = this.groundColor.getHex(); - if (this.distance !== void 0) - data.object.distance = this.distance; - if (this.angle !== void 0) - data.object.angle = this.angle; - if (this.decay !== void 0) - data.object.decay = this.decay; - if (this.penumbra !== void 0) - data.object.penumbra = this.penumbra; - if (this.shadow !== void 0) - data.object.shadow = this.shadow.toJSON(); - return data; - } -}; -var HemisphereLight = class extends Light { - constructor(skyColor, groundColor, intensity) { - super(skyColor, intensity); - this.isHemisphereLight = true; - this.type = "HemisphereLight"; - this.position.copy(Object3D.DEFAULT_UP); - this.updateMatrix(); - this.groundColor = new Color(groundColor); - } - copy(source, recursive) { - super.copy(source, recursive); - this.groundColor.copy(source.groundColor); - return this; - } -}; -var _projScreenMatrix$1 = new Matrix4(); -var _lightPositionWorld$1 = new Vector3(); -var _lookTarget$1 = new Vector3(); -var LightShadow = class { - constructor(camera) { - this.camera = camera; - this.bias = 0; - this.normalBias = 0; - this.radius = 1; - this.blurSamples = 8; - this.mapSize = new Vector2(512, 512); - this.map = null; - this.mapPass = null; - this.matrix = new Matrix4(); - this.autoUpdate = true; - this.needsUpdate = false; - this._frustum = new Frustum(); - this._frameExtents = new Vector2(1, 1); - this._viewportCount = 1; - this._viewports = [ - new Vector4(0, 0, 1, 1) - ]; - } - getViewportCount() { - return this._viewportCount; - } - getFrustum() { - return this._frustum; - } - updateMatrices(light) { - const shadowCamera = this.camera; - const shadowMatrix = this.matrix; - _lightPositionWorld$1.setFromMatrixPosition(light.matrixWorld); - shadowCamera.position.copy(_lightPositionWorld$1); - _lookTarget$1.setFromMatrixPosition(light.target.matrixWorld); - shadowCamera.lookAt(_lookTarget$1); - shadowCamera.updateMatrixWorld(); - _projScreenMatrix$1.multiplyMatrices(shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse); - this._frustum.setFromProjectionMatrix(_projScreenMatrix$1); - shadowMatrix.set( - 0.5, - 0, - 0, - 0.5, - 0, - 0.5, - 0, - 0.5, - 0, - 0, - 0.5, - 0.5, - 0, - 0, - 0, - 1 - ); - shadowMatrix.multiply(_projScreenMatrix$1); - } - getViewport(viewportIndex) { - return this._viewports[viewportIndex]; - } - getFrameExtents() { - return this._frameExtents; - } - dispose() { - if (this.map) { - this.map.dispose(); - } - if (this.mapPass) { - this.mapPass.dispose(); - } - } - copy(source) { - this.camera = source.camera.clone(); - this.bias = source.bias; - this.radius = source.radius; - this.mapSize.copy(source.mapSize); - return this; - } - clone() { - return new this.constructor().copy(this); - } - toJSON() { - const object = {}; - if (this.bias !== 0) - object.bias = this.bias; - if (this.normalBias !== 0) - object.normalBias = this.normalBias; - if (this.radius !== 1) - object.radius = this.radius; - if (this.mapSize.x !== 512 || this.mapSize.y !== 512) - object.mapSize = this.mapSize.toArray(); - object.camera = this.camera.toJSON(false).object; - delete object.camera.matrix; - return object; - } -}; -var SpotLightShadow = class extends LightShadow { - constructor() { - super(new PerspectiveCamera(50, 1, 0.5, 500)); - this.isSpotLightShadow = true; - this.focus = 1; - } - updateMatrices(light) { - const camera = this.camera; - const fov2 = RAD2DEG * 2 * light.angle * this.focus; - const aspect2 = this.mapSize.width / this.mapSize.height; - const far = light.distance || camera.far; - if (fov2 !== camera.fov || aspect2 !== camera.aspect || far !== camera.far) { - camera.fov = fov2; - camera.aspect = aspect2; - camera.far = far; - camera.updateProjectionMatrix(); - } - super.updateMatrices(light); - } - copy(source) { - super.copy(source); - this.focus = source.focus; - return this; - } -}; -var SpotLight = class extends Light { - constructor(color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 2) { - super(color, intensity); - this.isSpotLight = true; - this.type = "SpotLight"; - this.position.copy(Object3D.DEFAULT_UP); - this.updateMatrix(); - this.target = new Object3D(); - this.distance = distance; - this.angle = angle; - this.penumbra = penumbra; - this.decay = decay; - this.map = null; - this.shadow = new SpotLightShadow(); - } - get power() { - return this.intensity * Math.PI; - } - set power(power) { - this.intensity = power / Math.PI; - } - dispose() { - this.shadow.dispose(); - } - copy(source, recursive) { - super.copy(source, recursive); - this.distance = source.distance; - this.angle = source.angle; - this.penumbra = source.penumbra; - this.decay = source.decay; - this.target = source.target.clone(); - this.shadow = source.shadow.clone(); - return this; - } -}; -var _projScreenMatrix = new Matrix4(); -var _lightPositionWorld = new Vector3(); -var _lookTarget = new Vector3(); -var PointLightShadow = class extends LightShadow { - constructor() { - super(new PerspectiveCamera(90, 1, 0.5, 500)); - this.isPointLightShadow = true; - this._frameExtents = new Vector2(4, 2); - this._viewportCount = 6; - this._viewports = [ - // These viewports map a cube-map onto a 2D texture with the - // following orientation: - // - // xzXZ - // y Y - // - // X - Positive x direction - // x - Negative x direction - // Y - Positive y direction - // y - Negative y direction - // Z - Positive z direction - // z - Negative z direction - // positive X - new Vector4(2, 1, 1, 1), - // negative X - new Vector4(0, 1, 1, 1), - // positive Z - new Vector4(3, 1, 1, 1), - // negative Z - new Vector4(1, 1, 1, 1), - // positive Y - new Vector4(3, 0, 1, 1), - // negative Y - new Vector4(1, 0, 1, 1) - ]; - this._cubeDirections = [ - new Vector3(1, 0, 0), - new Vector3(-1, 0, 0), - new Vector3(0, 0, 1), - new Vector3(0, 0, -1), - new Vector3(0, 1, 0), - new Vector3(0, -1, 0) - ]; - this._cubeUps = [ - new Vector3(0, 1, 0), - new Vector3(0, 1, 0), - new Vector3(0, 1, 0), - new Vector3(0, 1, 0), - new Vector3(0, 0, 1), - new Vector3(0, 0, -1) - ]; - } - updateMatrices(light, viewportIndex = 0) { - const camera = this.camera; - const shadowMatrix = this.matrix; - const far = light.distance || camera.far; - if (far !== camera.far) { - camera.far = far; - camera.updateProjectionMatrix(); - } - _lightPositionWorld.setFromMatrixPosition(light.matrixWorld); - camera.position.copy(_lightPositionWorld); - _lookTarget.copy(camera.position); - _lookTarget.add(this._cubeDirections[viewportIndex]); - camera.up.copy(this._cubeUps[viewportIndex]); - camera.lookAt(_lookTarget); - camera.updateMatrixWorld(); - shadowMatrix.makeTranslation(-_lightPositionWorld.x, -_lightPositionWorld.y, -_lightPositionWorld.z); - _projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); - this._frustum.setFromProjectionMatrix(_projScreenMatrix); - } -}; -var PointLight = class extends Light { - constructor(color, intensity, distance = 0, decay = 2) { - super(color, intensity); - this.isPointLight = true; - this.type = "PointLight"; - this.distance = distance; - this.decay = decay; - this.shadow = new PointLightShadow(); - } - get power() { - return this.intensity * 4 * Math.PI; - } - set power(power) { - this.intensity = power / (4 * Math.PI); - } - dispose() { - this.shadow.dispose(); - } - copy(source, recursive) { - super.copy(source, recursive); - this.distance = source.distance; - this.decay = source.decay; - this.shadow = source.shadow.clone(); - return this; - } -}; -var DirectionalLightShadow = class extends LightShadow { - constructor() { - super(new OrthographicCamera(-5, 5, 5, -5, 0.5, 500)); - this.isDirectionalLightShadow = true; - } -}; -var DirectionalLight = class extends Light { - constructor(color, intensity) { - super(color, intensity); - this.isDirectionalLight = true; - this.type = "DirectionalLight"; - this.position.copy(Object3D.DEFAULT_UP); - this.updateMatrix(); - this.target = new Object3D(); - this.shadow = new DirectionalLightShadow(); - } - dispose() { - this.shadow.dispose(); - } - copy(source) { - super.copy(source); - this.target = source.target.clone(); - this.shadow = source.shadow.clone(); - return this; - } -}; -var AmbientLight = class extends Light { - constructor(color, intensity) { - super(color, intensity); - this.isAmbientLight = true; - this.type = "AmbientLight"; - } -}; -var RectAreaLight = class extends Light { - constructor(color, intensity, width = 10, height = 10) { - super(color, intensity); - this.isRectAreaLight = true; - this.type = "RectAreaLight"; - this.width = width; - this.height = height; - } - get power() { - return this.intensity * this.width * this.height * Math.PI; - } - set power(power) { - this.intensity = power / (this.width * this.height * Math.PI); - } - copy(source) { - super.copy(source); - this.width = source.width; - this.height = source.height; - return this; - } - toJSON(meta) { - const data = super.toJSON(meta); - data.object.width = this.width; - data.object.height = this.height; - return data; - } -}; -var SphericalHarmonics3 = class { - constructor() { - this.isSphericalHarmonics3 = true; - this.coefficients = []; - for (let i = 0; i < 9; i++) { - this.coefficients.push(new Vector3()); - } - } - set(coefficients) { - for (let i = 0; i < 9; i++) { - this.coefficients[i].copy(coefficients[i]); - } - return this; - } - zero() { - for (let i = 0; i < 9; i++) { - this.coefficients[i].set(0, 0, 0); - } - return this; - } - // get the radiance in the direction of the normal - // target is a Vector3 - getAt(normal, target) { - const x = normal.x, y = normal.y, z = normal.z; - const coeff = this.coefficients; - target.copy(coeff[0]).multiplyScalar(0.282095); - target.addScaledVector(coeff[1], 0.488603 * y); - target.addScaledVector(coeff[2], 0.488603 * z); - target.addScaledVector(coeff[3], 0.488603 * x); - target.addScaledVector(coeff[4], 1.092548 * (x * y)); - target.addScaledVector(coeff[5], 1.092548 * (y * z)); - target.addScaledVector(coeff[6], 0.315392 * (3 * z * z - 1)); - target.addScaledVector(coeff[7], 1.092548 * (x * z)); - target.addScaledVector(coeff[8], 0.546274 * (x * x - y * y)); - return target; - } - // get the irradiance (radiance convolved with cosine lobe) in the direction of the normal - // target is a Vector3 - // https://graphics.stanford.edu/papers/envmap/envmap.pdf - getIrradianceAt(normal, target) { - const x = normal.x, y = normal.y, z = normal.z; - const coeff = this.coefficients; - target.copy(coeff[0]).multiplyScalar(0.886227); - target.addScaledVector(coeff[1], 2 * 0.511664 * y); - target.addScaledVector(coeff[2], 2 * 0.511664 * z); - target.addScaledVector(coeff[3], 2 * 0.511664 * x); - target.addScaledVector(coeff[4], 2 * 0.429043 * x * y); - target.addScaledVector(coeff[5], 2 * 0.429043 * y * z); - target.addScaledVector(coeff[6], 0.743125 * z * z - 0.247708); - target.addScaledVector(coeff[7], 2 * 0.429043 * x * z); - target.addScaledVector(coeff[8], 0.429043 * (x * x - y * y)); - return target; - } - add(sh) { - for (let i = 0; i < 9; i++) { - this.coefficients[i].add(sh.coefficients[i]); - } - return this; - } - addScaledSH(sh, s) { - for (let i = 0; i < 9; i++) { - this.coefficients[i].addScaledVector(sh.coefficients[i], s); - } - return this; - } - scale(s) { - for (let i = 0; i < 9; i++) { - this.coefficients[i].multiplyScalar(s); - } - return this; - } - lerp(sh, alpha) { - for (let i = 0; i < 9; i++) { - this.coefficients[i].lerp(sh.coefficients[i], alpha); - } - return this; - } - equals(sh) { - for (let i = 0; i < 9; i++) { - if (!this.coefficients[i].equals(sh.coefficients[i])) { - return false; - } - } - return true; - } - copy(sh) { - return this.set(sh.coefficients); - } - clone() { - return new this.constructor().copy(this); - } - fromArray(array, offset = 0) { - const coefficients = this.coefficients; - for (let i = 0; i < 9; i++) { - coefficients[i].fromArray(array, offset + i * 3); - } - return this; - } - toArray(array = [], offset = 0) { - const coefficients = this.coefficients; - for (let i = 0; i < 9; i++) { - coefficients[i].toArray(array, offset + i * 3); - } - return array; - } - // evaluate the basis functions - // shBasis is an Array[ 9 ] - static getBasisAt(normal, shBasis) { - const x = normal.x, y = normal.y, z = normal.z; - shBasis[0] = 0.282095; - shBasis[1] = 0.488603 * y; - shBasis[2] = 0.488603 * z; - shBasis[3] = 0.488603 * x; - shBasis[4] = 1.092548 * x * y; - shBasis[5] = 1.092548 * y * z; - shBasis[6] = 0.315392 * (3 * z * z - 1); - shBasis[7] = 1.092548 * x * z; - shBasis[8] = 0.546274 * (x * x - y * y); - } -}; -var LightProbe = class extends Light { - constructor(sh = new SphericalHarmonics3(), intensity = 1) { - super(void 0, intensity); - this.isLightProbe = true; - this.sh = sh; - } - copy(source) { - super.copy(source); - this.sh.copy(source.sh); - return this; - } - fromJSON(json) { - this.intensity = json.intensity; - this.sh.fromArray(json.sh); - return this; - } - toJSON(meta) { - const data = super.toJSON(meta); - data.object.sh = this.sh.toArray(); - return data; - } -}; -var MaterialLoader = class _MaterialLoader extends Loader { - constructor(manager) { - super(manager); - this.textures = {}; - } - load(url, onLoad, onProgress, onError) { - const scope = this; - const loader = new FileLoader(scope.manager); - loader.setPath(scope.path); - loader.setRequestHeader(scope.requestHeader); - loader.setWithCredentials(scope.withCredentials); - loader.load(url, function(text) { - try { - onLoad(scope.parse(JSON.parse(text))); - } catch (e) { - if (onError) { - onError(e); - } else { - console.error(e); - } - scope.manager.itemError(url); - } - }, onProgress, onError); - } - parse(json) { - const textures = this.textures; - function getTexture(name) { - if (textures[name] === void 0) { - console.warn("THREE.MaterialLoader: Undefined texture", name); - } - return textures[name]; - } - const material = _MaterialLoader.createMaterialFromType(json.type); - if (json.uuid !== void 0) - material.uuid = json.uuid; - if (json.name !== void 0) - material.name = json.name; - if (json.color !== void 0 && material.color !== void 0) - material.color.setHex(json.color); - if (json.roughness !== void 0) - material.roughness = json.roughness; - if (json.metalness !== void 0) - material.metalness = json.metalness; - if (json.sheen !== void 0) - material.sheen = json.sheen; - if (json.sheenColor !== void 0) - material.sheenColor = new Color().setHex(json.sheenColor); - if (json.sheenRoughness !== void 0) - material.sheenRoughness = json.sheenRoughness; - if (json.emissive !== void 0 && material.emissive !== void 0) - material.emissive.setHex(json.emissive); - if (json.specular !== void 0 && material.specular !== void 0) - material.specular.setHex(json.specular); - if (json.specularIntensity !== void 0) - material.specularIntensity = json.specularIntensity; - if (json.specularColor !== void 0 && material.specularColor !== void 0) - material.specularColor.setHex(json.specularColor); - if (json.shininess !== void 0) - material.shininess = json.shininess; - if (json.clearcoat !== void 0) - material.clearcoat = json.clearcoat; - if (json.clearcoatRoughness !== void 0) - material.clearcoatRoughness = json.clearcoatRoughness; - if (json.iridescence !== void 0) - material.iridescence = json.iridescence; - if (json.iridescenceIOR !== void 0) - material.iridescenceIOR = json.iridescenceIOR; - if (json.iridescenceThicknessRange !== void 0) - material.iridescenceThicknessRange = json.iridescenceThicknessRange; - if (json.transmission !== void 0) - material.transmission = json.transmission; - if (json.thickness !== void 0) - material.thickness = json.thickness; - if (json.attenuationDistance !== void 0) - material.attenuationDistance = json.attenuationDistance; - if (json.attenuationColor !== void 0 && material.attenuationColor !== void 0) - material.attenuationColor.setHex(json.attenuationColor); - if (json.anisotropy !== void 0) - material.anisotropy = json.anisotropy; - if (json.anisotropyRotation !== void 0) - material.anisotropyRotation = json.anisotropyRotation; - if (json.fog !== void 0) - material.fog = json.fog; - if (json.flatShading !== void 0) - material.flatShading = json.flatShading; - if (json.blending !== void 0) - material.blending = json.blending; - if (json.combine !== void 0) - material.combine = json.combine; - if (json.side !== void 0) - material.side = json.side; - if (json.shadowSide !== void 0) - material.shadowSide = json.shadowSide; - if (json.opacity !== void 0) - material.opacity = json.opacity; - if (json.transparent !== void 0) - material.transparent = json.transparent; - if (json.alphaTest !== void 0) - material.alphaTest = json.alphaTest; - if (json.alphaHash !== void 0) - material.alphaHash = json.alphaHash; - if (json.depthFunc !== void 0) - material.depthFunc = json.depthFunc; - if (json.depthTest !== void 0) - material.depthTest = json.depthTest; - if (json.depthWrite !== void 0) - material.depthWrite = json.depthWrite; - if (json.colorWrite !== void 0) - material.colorWrite = json.colorWrite; - if (json.blendSrc !== void 0) - material.blendSrc = json.blendSrc; - if (json.blendDst !== void 0) - material.blendDst = json.blendDst; - if (json.blendEquation !== void 0) - material.blendEquation = json.blendEquation; - if (json.blendSrcAlpha !== void 0) - material.blendSrcAlpha = json.blendSrcAlpha; - if (json.blendDstAlpha !== void 0) - material.blendDstAlpha = json.blendDstAlpha; - if (json.blendEquationAlpha !== void 0) - material.blendEquationAlpha = json.blendEquationAlpha; - if (json.blendColor !== void 0 && material.blendColor !== void 0) - material.blendColor.setHex(json.blendColor); - if (json.blendAlpha !== void 0) - material.blendAlpha = json.blendAlpha; - if (json.stencilWriteMask !== void 0) - material.stencilWriteMask = json.stencilWriteMask; - if (json.stencilFunc !== void 0) - material.stencilFunc = json.stencilFunc; - if (json.stencilRef !== void 0) - material.stencilRef = json.stencilRef; - if (json.stencilFuncMask !== void 0) - material.stencilFuncMask = json.stencilFuncMask; - if (json.stencilFail !== void 0) - material.stencilFail = json.stencilFail; - if (json.stencilZFail !== void 0) - material.stencilZFail = json.stencilZFail; - if (json.stencilZPass !== void 0) - material.stencilZPass = json.stencilZPass; - if (json.stencilWrite !== void 0) - material.stencilWrite = json.stencilWrite; - if (json.wireframe !== void 0) - material.wireframe = json.wireframe; - if (json.wireframeLinewidth !== void 0) - material.wireframeLinewidth = json.wireframeLinewidth; - if (json.wireframeLinecap !== void 0) - material.wireframeLinecap = json.wireframeLinecap; - if (json.wireframeLinejoin !== void 0) - material.wireframeLinejoin = json.wireframeLinejoin; - if (json.rotation !== void 0) - material.rotation = json.rotation; - if (json.linewidth !== void 0) - material.linewidth = json.linewidth; - if (json.dashSize !== void 0) - material.dashSize = json.dashSize; - if (json.gapSize !== void 0) - material.gapSize = json.gapSize; - if (json.scale !== void 0) - material.scale = json.scale; - if (json.polygonOffset !== void 0) - material.polygonOffset = json.polygonOffset; - if (json.polygonOffsetFactor !== void 0) - material.polygonOffsetFactor = json.polygonOffsetFactor; - if (json.polygonOffsetUnits !== void 0) - material.polygonOffsetUnits = json.polygonOffsetUnits; - if (json.dithering !== void 0) - material.dithering = json.dithering; - if (json.alphaToCoverage !== void 0) - material.alphaToCoverage = json.alphaToCoverage; - if (json.premultipliedAlpha !== void 0) - material.premultipliedAlpha = json.premultipliedAlpha; - if (json.forceSinglePass !== void 0) - material.forceSinglePass = json.forceSinglePass; - if (json.visible !== void 0) - material.visible = json.visible; - if (json.toneMapped !== void 0) - material.toneMapped = json.toneMapped; - if (json.userData !== void 0) - material.userData = json.userData; - if (json.vertexColors !== void 0) { - if (typeof json.vertexColors === "number") { - material.vertexColors = json.vertexColors > 0 ? true : false; - } else { - material.vertexColors = json.vertexColors; - } - } - if (json.uniforms !== void 0) { - for (const name in json.uniforms) { - const uniform = json.uniforms[name]; - material.uniforms[name] = {}; - switch (uniform.type) { - case "t": - material.uniforms[name].value = getTexture(uniform.value); - break; - case "c": - material.uniforms[name].value = new Color().setHex(uniform.value); - break; - case "v2": - material.uniforms[name].value = new Vector2().fromArray(uniform.value); - break; - case "v3": - material.uniforms[name].value = new Vector3().fromArray(uniform.value); - break; - case "v4": - material.uniforms[name].value = new Vector4().fromArray(uniform.value); - break; - case "m3": - material.uniforms[name].value = new Matrix3().fromArray(uniform.value); - break; - case "m4": - material.uniforms[name].value = new Matrix4().fromArray(uniform.value); - break; - default: - material.uniforms[name].value = uniform.value; - } - } - } - if (json.defines !== void 0) - material.defines = json.defines; - if (json.vertexShader !== void 0) - material.vertexShader = json.vertexShader; - if (json.fragmentShader !== void 0) - material.fragmentShader = json.fragmentShader; - if (json.glslVersion !== void 0) - material.glslVersion = json.glslVersion; - if (json.extensions !== void 0) { - for (const key in json.extensions) { - material.extensions[key] = json.extensions[key]; - } - } - if (json.lights !== void 0) - material.lights = json.lights; - if (json.clipping !== void 0) - material.clipping = json.clipping; - if (json.size !== void 0) - material.size = json.size; - if (json.sizeAttenuation !== void 0) - material.sizeAttenuation = json.sizeAttenuation; - if (json.map !== void 0) - material.map = getTexture(json.map); - if (json.matcap !== void 0) - material.matcap = getTexture(json.matcap); - if (json.alphaMap !== void 0) - material.alphaMap = getTexture(json.alphaMap); - if (json.bumpMap !== void 0) - material.bumpMap = getTexture(json.bumpMap); - if (json.bumpScale !== void 0) - material.bumpScale = json.bumpScale; - if (json.normalMap !== void 0) - material.normalMap = getTexture(json.normalMap); - if (json.normalMapType !== void 0) - material.normalMapType = json.normalMapType; - if (json.normalScale !== void 0) { - let normalScale = json.normalScale; - if (Array.isArray(normalScale) === false) { - normalScale = [normalScale, normalScale]; - } - material.normalScale = new Vector2().fromArray(normalScale); - } - if (json.displacementMap !== void 0) - material.displacementMap = getTexture(json.displacementMap); - if (json.displacementScale !== void 0) - material.displacementScale = json.displacementScale; - if (json.displacementBias !== void 0) - material.displacementBias = json.displacementBias; - if (json.roughnessMap !== void 0) - material.roughnessMap = getTexture(json.roughnessMap); - if (json.metalnessMap !== void 0) - material.metalnessMap = getTexture(json.metalnessMap); - if (json.emissiveMap !== void 0) - material.emissiveMap = getTexture(json.emissiveMap); - if (json.emissiveIntensity !== void 0) - material.emissiveIntensity = json.emissiveIntensity; - if (json.specularMap !== void 0) - material.specularMap = getTexture(json.specularMap); - if (json.specularIntensityMap !== void 0) - material.specularIntensityMap = getTexture(json.specularIntensityMap); - if (json.specularColorMap !== void 0) - material.specularColorMap = getTexture(json.specularColorMap); - if (json.envMap !== void 0) - material.envMap = getTexture(json.envMap); - if (json.envMapIntensity !== void 0) - material.envMapIntensity = json.envMapIntensity; - if (json.reflectivity !== void 0) - material.reflectivity = json.reflectivity; - if (json.refractionRatio !== void 0) - material.refractionRatio = json.refractionRatio; - if (json.lightMap !== void 0) - material.lightMap = getTexture(json.lightMap); - if (json.lightMapIntensity !== void 0) - material.lightMapIntensity = json.lightMapIntensity; - if (json.aoMap !== void 0) - material.aoMap = getTexture(json.aoMap); - if (json.aoMapIntensity !== void 0) - material.aoMapIntensity = json.aoMapIntensity; - if (json.gradientMap !== void 0) - material.gradientMap = getTexture(json.gradientMap); - if (json.clearcoatMap !== void 0) - material.clearcoatMap = getTexture(json.clearcoatMap); - if (json.clearcoatRoughnessMap !== void 0) - material.clearcoatRoughnessMap = getTexture(json.clearcoatRoughnessMap); - if (json.clearcoatNormalMap !== void 0) - material.clearcoatNormalMap = getTexture(json.clearcoatNormalMap); - if (json.clearcoatNormalScale !== void 0) - material.clearcoatNormalScale = new Vector2().fromArray(json.clearcoatNormalScale); - if (json.iridescenceMap !== void 0) - material.iridescenceMap = getTexture(json.iridescenceMap); - if (json.iridescenceThicknessMap !== void 0) - material.iridescenceThicknessMap = getTexture(json.iridescenceThicknessMap); - if (json.transmissionMap !== void 0) - material.transmissionMap = getTexture(json.transmissionMap); - if (json.thicknessMap !== void 0) - material.thicknessMap = getTexture(json.thicknessMap); - if (json.anisotropyMap !== void 0) - material.anisotropyMap = getTexture(json.anisotropyMap); - if (json.sheenColorMap !== void 0) - material.sheenColorMap = getTexture(json.sheenColorMap); - if (json.sheenRoughnessMap !== void 0) - material.sheenRoughnessMap = getTexture(json.sheenRoughnessMap); - return material; - } - setTextures(value) { - this.textures = value; - return this; - } - static createMaterialFromType(type) { - const materialLib = { - ShadowMaterial, - SpriteMaterial, - RawShaderMaterial, - ShaderMaterial, - PointsMaterial, - MeshPhysicalMaterial, - MeshStandardMaterial, - MeshPhongMaterial, - MeshToonMaterial, - MeshNormalMaterial, - MeshLambertMaterial, - MeshDepthMaterial, - MeshDistanceMaterial, - MeshBasicMaterial, - MeshMatcapMaterial, - LineDashedMaterial, - LineBasicMaterial, - Material - }; - return new materialLib[type](); - } -}; -var LoaderUtils = class { - static decodeText(array) { - if (typeof TextDecoder !== "undefined") { - return new TextDecoder().decode(array); - } - let s = ""; - for (let i = 0, il = array.length; i < il; i++) { - s += String.fromCharCode(array[i]); - } - try { - return decodeURIComponent(escape(s)); - } catch (e) { - return s; - } - } - static extractUrlBase(url) { - const index = url.lastIndexOf("/"); - if (index === -1) - return "./"; - return url.slice(0, index + 1); - } - static resolveURL(url, path) { - if (typeof url !== "string" || url === "") - return ""; - if (/^https?:\/\//i.test(path) && /^\//.test(url)) { - path = path.replace(/(^https?:\/\/[^\/]+).*/i, "$1"); - } - if (/^(https?:)?\/\//i.test(url)) - return url; - if (/^data:.*,.*$/i.test(url)) - return url; - if (/^blob:.*$/i.test(url)) - return url; - return path + url; - } -}; -var InstancedBufferGeometry = class extends BufferGeometry { - constructor() { - super(); - this.isInstancedBufferGeometry = true; - this.type = "InstancedBufferGeometry"; - this.instanceCount = Infinity; - } - copy(source) { - super.copy(source); - this.instanceCount = source.instanceCount; - return this; - } - toJSON() { - const data = super.toJSON(); - data.instanceCount = this.instanceCount; - data.isInstancedBufferGeometry = true; - return data; - } -}; -var BufferGeometryLoader = class extends Loader { - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - const scope = this; - const loader = new FileLoader(scope.manager); - loader.setPath(scope.path); - loader.setRequestHeader(scope.requestHeader); - loader.setWithCredentials(scope.withCredentials); - loader.load(url, function(text) { - try { - onLoad(scope.parse(JSON.parse(text))); - } catch (e) { - if (onError) { - onError(e); - } else { - console.error(e); - } - scope.manager.itemError(url); - } - }, onProgress, onError); - } - parse(json) { - const interleavedBufferMap = {}; - const arrayBufferMap = {}; - function getInterleavedBuffer(json2, uuid) { - if (interleavedBufferMap[uuid] !== void 0) - return interleavedBufferMap[uuid]; - const interleavedBuffers = json2.interleavedBuffers; - const interleavedBuffer = interleavedBuffers[uuid]; - const buffer = getArrayBuffer(json2, interleavedBuffer.buffer); - const array = getTypedArray(interleavedBuffer.type, buffer); - const ib = new InterleavedBuffer(array, interleavedBuffer.stride); - ib.uuid = interleavedBuffer.uuid; - interleavedBufferMap[uuid] = ib; - return ib; - } - function getArrayBuffer(json2, uuid) { - if (arrayBufferMap[uuid] !== void 0) - return arrayBufferMap[uuid]; - const arrayBuffers = json2.arrayBuffers; - const arrayBuffer = arrayBuffers[uuid]; - const ab = new Uint32Array(arrayBuffer).buffer; - arrayBufferMap[uuid] = ab; - return ab; - } - const geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry(); - const index = json.data.index; - if (index !== void 0) { - const typedArray = getTypedArray(index.type, index.array); - geometry.setIndex(new BufferAttribute(typedArray, 1)); - } - const attributes = json.data.attributes; - for (const key in attributes) { - const attribute = attributes[key]; - let bufferAttribute; - if (attribute.isInterleavedBufferAttribute) { - const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data); - bufferAttribute = new InterleavedBufferAttribute(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized); - } else { - const typedArray = getTypedArray(attribute.type, attribute.array); - const bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute; - bufferAttribute = new bufferAttributeConstr(typedArray, attribute.itemSize, attribute.normalized); - } - if (attribute.name !== void 0) - bufferAttribute.name = attribute.name; - if (attribute.usage !== void 0) - bufferAttribute.setUsage(attribute.usage); - if (attribute.updateRange !== void 0) { - bufferAttribute.updateRange.offset = attribute.updateRange.offset; - bufferAttribute.updateRange.count = attribute.updateRange.count; - } - geometry.setAttribute(key, bufferAttribute); - } - const morphAttributes = json.data.morphAttributes; - if (morphAttributes) { - for (const key in morphAttributes) { - const attributeArray = morphAttributes[key]; - const array = []; - for (let i = 0, il = attributeArray.length; i < il; i++) { - const attribute = attributeArray[i]; - let bufferAttribute; - if (attribute.isInterleavedBufferAttribute) { - const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data); - bufferAttribute = new InterleavedBufferAttribute(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized); - } else { - const typedArray = getTypedArray(attribute.type, attribute.array); - bufferAttribute = new BufferAttribute(typedArray, attribute.itemSize, attribute.normalized); - } - if (attribute.name !== void 0) - bufferAttribute.name = attribute.name; - array.push(bufferAttribute); - } - geometry.morphAttributes[key] = array; - } - } - const morphTargetsRelative = json.data.morphTargetsRelative; - if (morphTargetsRelative) { - geometry.morphTargetsRelative = true; - } - const groups = json.data.groups || json.data.drawcalls || json.data.offsets; - if (groups !== void 0) { - for (let i = 0, n = groups.length; i !== n; ++i) { - const group = groups[i]; - geometry.addGroup(group.start, group.count, group.materialIndex); - } - } - const boundingSphere = json.data.boundingSphere; - if (boundingSphere !== void 0) { - const center = new Vector3(); - if (boundingSphere.center !== void 0) { - center.fromArray(boundingSphere.center); - } - geometry.boundingSphere = new Sphere(center, boundingSphere.radius); - } - if (json.name) - geometry.name = json.name; - if (json.userData) - geometry.userData = json.userData; - return geometry; - } -}; -var ObjectLoader = class extends Loader { - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - const scope = this; - const path = this.path === "" ? LoaderUtils.extractUrlBase(url) : this.path; - this.resourcePath = this.resourcePath || path; - const loader = new FileLoader(this.manager); - loader.setPath(this.path); - loader.setRequestHeader(this.requestHeader); - loader.setWithCredentials(this.withCredentials); - loader.load(url, function(text) { - let json = null; - try { - json = JSON.parse(text); - } catch (error) { - if (onError !== void 0) - onError(error); - console.error("THREE:ObjectLoader: Can't parse " + url + ".", error.message); - return; - } - const metadata = json.metadata; - if (metadata === void 0 || metadata.type === void 0 || metadata.type.toLowerCase() === "geometry") { - if (onError !== void 0) - onError(new Error("THREE.ObjectLoader: Can't load " + url)); - console.error("THREE.ObjectLoader: Can't load " + url); - return; - } - scope.parse(json, onLoad); - }, onProgress, onError); - } - async loadAsync(url, onProgress) { - const scope = this; - const path = this.path === "" ? LoaderUtils.extractUrlBase(url) : this.path; - this.resourcePath = this.resourcePath || path; - const loader = new FileLoader(this.manager); - loader.setPath(this.path); - loader.setRequestHeader(this.requestHeader); - loader.setWithCredentials(this.withCredentials); - const text = await loader.loadAsync(url, onProgress); - const json = JSON.parse(text); - const metadata = json.metadata; - if (metadata === void 0 || metadata.type === void 0 || metadata.type.toLowerCase() === "geometry") { - throw new Error("THREE.ObjectLoader: Can't load " + url); - } - return await scope.parseAsync(json); - } - parse(json, onLoad) { - const animations = this.parseAnimations(json.animations); - const shapes = this.parseShapes(json.shapes); - const geometries = this.parseGeometries(json.geometries, shapes); - const images = this.parseImages(json.images, function() { - if (onLoad !== void 0) - onLoad(object); - }); - const textures = this.parseTextures(json.textures, images); - const materials = this.parseMaterials(json.materials, textures); - const object = this.parseObject(json.object, geometries, materials, textures, animations); - const skeletons = this.parseSkeletons(json.skeletons, object); - this.bindSkeletons(object, skeletons); - if (onLoad !== void 0) { - let hasImages = false; - for (const uuid in images) { - if (images[uuid].data instanceof HTMLImageElement) { - hasImages = true; - break; - } - } - if (hasImages === false) - onLoad(object); - } - return object; - } - async parseAsync(json) { - const animations = this.parseAnimations(json.animations); - const shapes = this.parseShapes(json.shapes); - const geometries = this.parseGeometries(json.geometries, shapes); - const images = await this.parseImagesAsync(json.images); - const textures = this.parseTextures(json.textures, images); - const materials = this.parseMaterials(json.materials, textures); - const object = this.parseObject(json.object, geometries, materials, textures, animations); - const skeletons = this.parseSkeletons(json.skeletons, object); - this.bindSkeletons(object, skeletons); - return object; - } - parseShapes(json) { - const shapes = {}; - if (json !== void 0) { - for (let i = 0, l = json.length; i < l; i++) { - const shape = new Shape().fromJSON(json[i]); - shapes[shape.uuid] = shape; - } - } - return shapes; - } - parseSkeletons(json, object) { - const skeletons = {}; - const bones = {}; - object.traverse(function(child) { - if (child.isBone) - bones[child.uuid] = child; - }); - if (json !== void 0) { - for (let i = 0, l = json.length; i < l; i++) { - const skeleton = new Skeleton().fromJSON(json[i], bones); - skeletons[skeleton.uuid] = skeleton; - } - } - return skeletons; - } - parseGeometries(json, shapes) { - const geometries = {}; - if (json !== void 0) { - const bufferGeometryLoader = new BufferGeometryLoader(); - for (let i = 0, l = json.length; i < l; i++) { - let geometry; - const data = json[i]; - switch (data.type) { - case "BufferGeometry": - case "InstancedBufferGeometry": - geometry = bufferGeometryLoader.parse(data); - break; - default: - if (data.type in Geometries) { - geometry = Geometries[data.type].fromJSON(data, shapes); - } else { - console.warn(`THREE.ObjectLoader: Unsupported geometry type "${data.type}"`); - } - } - geometry.uuid = data.uuid; - if (data.name !== void 0) - geometry.name = data.name; - if (data.userData !== void 0) - geometry.userData = data.userData; - geometries[data.uuid] = geometry; - } - } - return geometries; - } - parseMaterials(json, textures) { - const cache = {}; - const materials = {}; - if (json !== void 0) { - const loader = new MaterialLoader(); - loader.setTextures(textures); - for (let i = 0, l = json.length; i < l; i++) { - const data = json[i]; - if (cache[data.uuid] === void 0) { - cache[data.uuid] = loader.parse(data); - } - materials[data.uuid] = cache[data.uuid]; - } - } - return materials; - } - parseAnimations(json) { - const animations = {}; - if (json !== void 0) { - for (let i = 0; i < json.length; i++) { - const data = json[i]; - const clip = AnimationClip.parse(data); - animations[clip.uuid] = clip; - } - } - return animations; - } - parseImages(json, onLoad) { - const scope = this; - const images = {}; - let loader; - function loadImage(url) { - scope.manager.itemStart(url); - return loader.load(url, function() { - scope.manager.itemEnd(url); - }, void 0, function() { - scope.manager.itemError(url); - scope.manager.itemEnd(url); - }); - } - function deserializeImage(image) { - if (typeof image === "string") { - const url = image; - const path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(url) ? url : scope.resourcePath + url; - return loadImage(path); - } else { - if (image.data) { - return { - data: getTypedArray(image.type, image.data), - width: image.width, - height: image.height - }; - } else { - return null; - } - } - } - if (json !== void 0 && json.length > 0) { - const manager = new LoadingManager(onLoad); - loader = new ImageLoader(manager); - loader.setCrossOrigin(this.crossOrigin); - for (let i = 0, il = json.length; i < il; i++) { - const image = json[i]; - const url = image.url; - if (Array.isArray(url)) { - const imageArray = []; - for (let j = 0, jl = url.length; j < jl; j++) { - const currentUrl = url[j]; - const deserializedImage = deserializeImage(currentUrl); - if (deserializedImage !== null) { - if (deserializedImage instanceof HTMLImageElement) { - imageArray.push(deserializedImage); - } else { - imageArray.push(new DataTexture(deserializedImage.data, deserializedImage.width, deserializedImage.height)); - } - } - } - images[image.uuid] = new Source(imageArray); - } else { - const deserializedImage = deserializeImage(image.url); - images[image.uuid] = new Source(deserializedImage); - } - } - } - return images; - } - async parseImagesAsync(json) { - const scope = this; - const images = {}; - let loader; - async function deserializeImage(image) { - if (typeof image === "string") { - const url = image; - const path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(url) ? url : scope.resourcePath + url; - return await loader.loadAsync(path); - } else { - if (image.data) { - return { - data: getTypedArray(image.type, image.data), - width: image.width, - height: image.height - }; - } else { - return null; - } - } - } - if (json !== void 0 && json.length > 0) { - loader = new ImageLoader(this.manager); - loader.setCrossOrigin(this.crossOrigin); - for (let i = 0, il = json.length; i < il; i++) { - const image = json[i]; - const url = image.url; - if (Array.isArray(url)) { - const imageArray = []; - for (let j = 0, jl = url.length; j < jl; j++) { - const currentUrl = url[j]; - const deserializedImage = await deserializeImage(currentUrl); - if (deserializedImage !== null) { - if (deserializedImage instanceof HTMLImageElement) { - imageArray.push(deserializedImage); - } else { - imageArray.push(new DataTexture(deserializedImage.data, deserializedImage.width, deserializedImage.height)); - } - } - } - images[image.uuid] = new Source(imageArray); - } else { - const deserializedImage = await deserializeImage(image.url); - images[image.uuid] = new Source(deserializedImage); - } - } - } - return images; - } - parseTextures(json, images) { - function parseConstant(value, type) { - if (typeof value === "number") - return value; - console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.", value); - return type[value]; - } - const textures = {}; - if (json !== void 0) { - for (let i = 0, l = json.length; i < l; i++) { - const data = json[i]; - if (data.image === void 0) { - console.warn('THREE.ObjectLoader: No "image" specified for', data.uuid); - } - if (images[data.image] === void 0) { - console.warn("THREE.ObjectLoader: Undefined image", data.image); - } - const source = images[data.image]; - const image = source.data; - let texture; - if (Array.isArray(image)) { - texture = new CubeTexture(); - if (image.length === 6) - texture.needsUpdate = true; - } else { - if (image && image.data) { - texture = new DataTexture(); - } else { - texture = new Texture(); - } - if (image) - texture.needsUpdate = true; - } - texture.source = source; - texture.uuid = data.uuid; - if (data.name !== void 0) - texture.name = data.name; - if (data.mapping !== void 0) - texture.mapping = parseConstant(data.mapping, TEXTURE_MAPPING); - if (data.channel !== void 0) - texture.channel = data.channel; - if (data.offset !== void 0) - texture.offset.fromArray(data.offset); - if (data.repeat !== void 0) - texture.repeat.fromArray(data.repeat); - if (data.center !== void 0) - texture.center.fromArray(data.center); - if (data.rotation !== void 0) - texture.rotation = data.rotation; - if (data.wrap !== void 0) { - texture.wrapS = parseConstant(data.wrap[0], TEXTURE_WRAPPING); - texture.wrapT = parseConstant(data.wrap[1], TEXTURE_WRAPPING); - } - if (data.format !== void 0) - texture.format = data.format; - if (data.internalFormat !== void 0) - texture.internalFormat = data.internalFormat; - if (data.type !== void 0) - texture.type = data.type; - if (data.colorSpace !== void 0) - texture.colorSpace = data.colorSpace; - if (data.encoding !== void 0) - texture.encoding = data.encoding; - if (data.minFilter !== void 0) - texture.minFilter = parseConstant(data.minFilter, TEXTURE_FILTER); - if (data.magFilter !== void 0) - texture.magFilter = parseConstant(data.magFilter, TEXTURE_FILTER); - if (data.anisotropy !== void 0) - texture.anisotropy = data.anisotropy; - if (data.flipY !== void 0) - texture.flipY = data.flipY; - if (data.generateMipmaps !== void 0) - texture.generateMipmaps = data.generateMipmaps; - if (data.premultiplyAlpha !== void 0) - texture.premultiplyAlpha = data.premultiplyAlpha; - if (data.unpackAlignment !== void 0) - texture.unpackAlignment = data.unpackAlignment; - if (data.compareFunction !== void 0) - texture.compareFunction = data.compareFunction; - if (data.userData !== void 0) - texture.userData = data.userData; - textures[data.uuid] = texture; - } - } - return textures; - } - parseObject(data, geometries, materials, textures, animations) { - let object; - function getGeometry(name) { - if (geometries[name] === void 0) { - console.warn("THREE.ObjectLoader: Undefined geometry", name); - } - return geometries[name]; - } - function getMaterial(name) { - if (name === void 0) - return void 0; - if (Array.isArray(name)) { - const array = []; - for (let i = 0, l = name.length; i < l; i++) { - const uuid = name[i]; - if (materials[uuid] === void 0) { - console.warn("THREE.ObjectLoader: Undefined material", uuid); - } - array.push(materials[uuid]); - } - return array; - } - if (materials[name] === void 0) { - console.warn("THREE.ObjectLoader: Undefined material", name); - } - return materials[name]; - } - function getTexture(uuid) { - if (textures[uuid] === void 0) { - console.warn("THREE.ObjectLoader: Undefined texture", uuid); - } - return textures[uuid]; - } - let geometry, material; - switch (data.type) { - case "Scene": - object = new Scene(); - if (data.background !== void 0) { - if (Number.isInteger(data.background)) { - object.background = new Color(data.background); - } else { - object.background = getTexture(data.background); - } - } - if (data.environment !== void 0) { - object.environment = getTexture(data.environment); - } - if (data.fog !== void 0) { - if (data.fog.type === "Fog") { - object.fog = new Fog(data.fog.color, data.fog.near, data.fog.far); - } else if (data.fog.type === "FogExp2") { - object.fog = new FogExp2(data.fog.color, data.fog.density); - } - if (data.fog.name !== "") { - object.fog.name = data.fog.name; - } - } - if (data.backgroundBlurriness !== void 0) - object.backgroundBlurriness = data.backgroundBlurriness; - if (data.backgroundIntensity !== void 0) - object.backgroundIntensity = data.backgroundIntensity; - break; - case "PerspectiveCamera": - object = new PerspectiveCamera(data.fov, data.aspect, data.near, data.far); - if (data.focus !== void 0) - object.focus = data.focus; - if (data.zoom !== void 0) - object.zoom = data.zoom; - if (data.filmGauge !== void 0) - object.filmGauge = data.filmGauge; - if (data.filmOffset !== void 0) - object.filmOffset = data.filmOffset; - if (data.view !== void 0) - object.view = Object.assign({}, data.view); - break; - case "OrthographicCamera": - object = new OrthographicCamera(data.left, data.right, data.top, data.bottom, data.near, data.far); - if (data.zoom !== void 0) - object.zoom = data.zoom; - if (data.view !== void 0) - object.view = Object.assign({}, data.view); - break; - case "AmbientLight": - object = new AmbientLight(data.color, data.intensity); - break; - case "DirectionalLight": - object = new DirectionalLight(data.color, data.intensity); - break; - case "PointLight": - object = new PointLight(data.color, data.intensity, data.distance, data.decay); - break; - case "RectAreaLight": - object = new RectAreaLight(data.color, data.intensity, data.width, data.height); - break; - case "SpotLight": - object = new SpotLight(data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay); - break; - case "HemisphereLight": - object = new HemisphereLight(data.color, data.groundColor, data.intensity); - break; - case "LightProbe": - object = new LightProbe().fromJSON(data); - break; - case "SkinnedMesh": - geometry = getGeometry(data.geometry); - material = getMaterial(data.material); - object = new SkinnedMesh(geometry, material); - if (data.bindMode !== void 0) - object.bindMode = data.bindMode; - if (data.bindMatrix !== void 0) - object.bindMatrix.fromArray(data.bindMatrix); - if (data.skeleton !== void 0) - object.skeleton = data.skeleton; - break; - case "Mesh": - geometry = getGeometry(data.geometry); - material = getMaterial(data.material); - object = new Mesh(geometry, material); - break; - case "InstancedMesh": - geometry = getGeometry(data.geometry); - material = getMaterial(data.material); - const count = data.count; - const instanceMatrix = data.instanceMatrix; - const instanceColor = data.instanceColor; - object = new InstancedMesh(geometry, material, count); - object.instanceMatrix = new InstancedBufferAttribute(new Float32Array(instanceMatrix.array), 16); - if (instanceColor !== void 0) - object.instanceColor = new InstancedBufferAttribute(new Float32Array(instanceColor.array), instanceColor.itemSize); - break; - case "LOD": - object = new LOD(); - break; - case "Line": - object = new Line(getGeometry(data.geometry), getMaterial(data.material)); - break; - case "LineLoop": - object = new LineLoop(getGeometry(data.geometry), getMaterial(data.material)); - break; - case "LineSegments": - object = new LineSegments(getGeometry(data.geometry), getMaterial(data.material)); - break; - case "PointCloud": - case "Points": - object = new Points(getGeometry(data.geometry), getMaterial(data.material)); - break; - case "Sprite": - object = new Sprite(getMaterial(data.material)); - break; - case "Group": - object = new Group(); - break; - case "Bone": - object = new Bone(); - break; - default: - object = new Object3D(); - } - object.uuid = data.uuid; - if (data.name !== void 0) - object.name = data.name; - if (data.matrix !== void 0) { - object.matrix.fromArray(data.matrix); - if (data.matrixAutoUpdate !== void 0) - object.matrixAutoUpdate = data.matrixAutoUpdate; - if (object.matrixAutoUpdate) - object.matrix.decompose(object.position, object.quaternion, object.scale); - } else { - if (data.position !== void 0) - object.position.fromArray(data.position); - if (data.rotation !== void 0) - object.rotation.fromArray(data.rotation); - if (data.quaternion !== void 0) - object.quaternion.fromArray(data.quaternion); - if (data.scale !== void 0) - object.scale.fromArray(data.scale); - } - if (data.up !== void 0) - object.up.fromArray(data.up); - if (data.castShadow !== void 0) - object.castShadow = data.castShadow; - if (data.receiveShadow !== void 0) - object.receiveShadow = data.receiveShadow; - if (data.shadow) { - if (data.shadow.bias !== void 0) - object.shadow.bias = data.shadow.bias; - if (data.shadow.normalBias !== void 0) - object.shadow.normalBias = data.shadow.normalBias; - if (data.shadow.radius !== void 0) - object.shadow.radius = data.shadow.radius; - if (data.shadow.mapSize !== void 0) - object.shadow.mapSize.fromArray(data.shadow.mapSize); - if (data.shadow.camera !== void 0) - object.shadow.camera = this.parseObject(data.shadow.camera); - } - if (data.visible !== void 0) - object.visible = data.visible; - if (data.frustumCulled !== void 0) - object.frustumCulled = data.frustumCulled; - if (data.renderOrder !== void 0) - object.renderOrder = data.renderOrder; - if (data.userData !== void 0) - object.userData = data.userData; - if (data.layers !== void 0) - object.layers.mask = data.layers; - if (data.children !== void 0) { - const children = data.children; - for (let i = 0; i < children.length; i++) { - object.add(this.parseObject(children[i], geometries, materials, textures, animations)); - } - } - if (data.animations !== void 0) { - const objectAnimations = data.animations; - for (let i = 0; i < objectAnimations.length; i++) { - const uuid = objectAnimations[i]; - object.animations.push(animations[uuid]); - } - } - if (data.type === "LOD") { - if (data.autoUpdate !== void 0) - object.autoUpdate = data.autoUpdate; - const levels = data.levels; - for (let l = 0; l < levels.length; l++) { - const level = levels[l]; - const child = object.getObjectByProperty("uuid", level.object); - if (child !== void 0) { - object.addLevel(child, level.distance, level.hysteresis); - } - } - } - return object; - } - bindSkeletons(object, skeletons) { - if (Object.keys(skeletons).length === 0) - return; - object.traverse(function(child) { - if (child.isSkinnedMesh === true && child.skeleton !== void 0) { - const skeleton = skeletons[child.skeleton]; - if (skeleton === void 0) { - console.warn("THREE.ObjectLoader: No skeleton found with UUID:", child.skeleton); - } else { - child.bind(skeleton, child.bindMatrix); - } - } - }); - } -}; -var TEXTURE_MAPPING = { - UVMapping, - CubeReflectionMapping, - CubeRefractionMapping, - EquirectangularReflectionMapping, - EquirectangularRefractionMapping, - CubeUVReflectionMapping -}; -var TEXTURE_WRAPPING = { - RepeatWrapping, - ClampToEdgeWrapping, - MirroredRepeatWrapping -}; -var TEXTURE_FILTER = { - NearestFilter, - NearestMipmapNearestFilter, - NearestMipmapLinearFilter, - LinearFilter, - LinearMipmapNearestFilter, - LinearMipmapLinearFilter -}; -var ImageBitmapLoader = class extends Loader { - constructor(manager) { - super(manager); - this.isImageBitmapLoader = true; - if (typeof createImageBitmap === "undefined") { - console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."); - } - if (typeof fetch === "undefined") { - console.warn("THREE.ImageBitmapLoader: fetch() not supported."); - } - this.options = { premultiplyAlpha: "none" }; - } - setOptions(options) { - this.options = options; - return this; - } - load(url, onLoad, onProgress, onError) { - if (url === void 0) - url = ""; - if (this.path !== void 0) - url = this.path + url; - url = this.manager.resolveURL(url); - const scope = this; - const cached = Cache.get(url); - if (cached !== void 0) { - scope.manager.itemStart(url); - setTimeout(function() { - if (onLoad) - onLoad(cached); - scope.manager.itemEnd(url); - }, 0); - return cached; - } - const fetchOptions = {}; - fetchOptions.credentials = this.crossOrigin === "anonymous" ? "same-origin" : "include"; - fetchOptions.headers = this.requestHeader; - fetch(url, fetchOptions).then(function(res) { - return res.blob(); - }).then(function(blob) { - return createImageBitmap(blob, Object.assign(scope.options, { colorSpaceConversion: "none" })); - }).then(function(imageBitmap) { - Cache.add(url, imageBitmap); - if (onLoad) - onLoad(imageBitmap); - scope.manager.itemEnd(url); - }).catch(function(e) { - if (onError) - onError(e); - scope.manager.itemError(url); - scope.manager.itemEnd(url); - }); - scope.manager.itemStart(url); - } -}; -var _context; -var AudioContext = class { - static getContext() { - if (_context === void 0) { - _context = new (window.AudioContext || window.webkitAudioContext)(); - } - return _context; - } - static setContext(value) { - _context = value; - } -}; -var AudioLoader = class extends Loader { - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - const scope = this; - const loader = new FileLoader(this.manager); - loader.setResponseType("arraybuffer"); - loader.setPath(this.path); - loader.setRequestHeader(this.requestHeader); - loader.setWithCredentials(this.withCredentials); - loader.load(url, function(buffer) { - try { - const bufferCopy = buffer.slice(0); - const context = AudioContext.getContext(); - context.decodeAudioData(bufferCopy, function(audioBuffer) { - onLoad(audioBuffer); - }, handleError); - } catch (e) { - handleError(e); - } - }, onProgress, onError); - function handleError(e) { - if (onError) { - onError(e); - } else { - console.error(e); - } - scope.manager.itemError(url); - } - } -}; -var _eyeRight = new Matrix4(); -var _eyeLeft = new Matrix4(); -var _projectionMatrix = new Matrix4(); -var StereoCamera = class { - constructor() { - this.type = "StereoCamera"; - this.aspect = 1; - this.eyeSep = 0.064; - this.cameraL = new PerspectiveCamera(); - this.cameraL.layers.enable(1); - this.cameraL.matrixAutoUpdate = false; - this.cameraR = new PerspectiveCamera(); - this.cameraR.layers.enable(2); - this.cameraR.matrixAutoUpdate = false; - this._cache = { - focus: null, - fov: null, - aspect: null, - near: null, - far: null, - zoom: null, - eyeSep: null - }; - } - update(camera) { - const cache = this._cache; - const needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov || cache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near || cache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep; - if (needsUpdate) { - cache.focus = camera.focus; - cache.fov = camera.fov; - cache.aspect = camera.aspect * this.aspect; - cache.near = camera.near; - cache.far = camera.far; - cache.zoom = camera.zoom; - cache.eyeSep = this.eyeSep; - _projectionMatrix.copy(camera.projectionMatrix); - const eyeSepHalf = cache.eyeSep / 2; - const eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus; - const ymax = cache.near * Math.tan(DEG2RAD * cache.fov * 0.5) / cache.zoom; - let xmin, xmax; - _eyeLeft.elements[12] = -eyeSepHalf; - _eyeRight.elements[12] = eyeSepHalf; - xmin = -ymax * cache.aspect + eyeSepOnProjection; - xmax = ymax * cache.aspect + eyeSepOnProjection; - _projectionMatrix.elements[0] = 2 * cache.near / (xmax - xmin); - _projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin); - this.cameraL.projectionMatrix.copy(_projectionMatrix); - xmin = -ymax * cache.aspect - eyeSepOnProjection; - xmax = ymax * cache.aspect - eyeSepOnProjection; - _projectionMatrix.elements[0] = 2 * cache.near / (xmax - xmin); - _projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin); - this.cameraR.projectionMatrix.copy(_projectionMatrix); - } - this.cameraL.matrixWorld.copy(camera.matrixWorld).multiply(_eyeLeft); - this.cameraR.matrixWorld.copy(camera.matrixWorld).multiply(_eyeRight); - } -}; -var Clock = class { - constructor(autoStart = true) { - this.autoStart = autoStart; - this.startTime = 0; - this.oldTime = 0; - this.elapsedTime = 0; - this.running = false; - } - start() { - this.startTime = now(); - this.oldTime = this.startTime; - this.elapsedTime = 0; - this.running = true; - } - stop() { - this.getElapsedTime(); - this.running = false; - this.autoStart = false; - } - getElapsedTime() { - this.getDelta(); - return this.elapsedTime; - } - getDelta() { - let diff = 0; - if (this.autoStart && !this.running) { - this.start(); - return 0; - } - if (this.running) { - const newTime = now(); - diff = (newTime - this.oldTime) / 1e3; - this.oldTime = newTime; - this.elapsedTime += diff; - } - return diff; - } -}; -function now() { - return (typeof performance === "undefined" ? Date : performance).now(); -} -var _position$1 = new Vector3(); -var _quaternion$1 = new Quaternion(); -var _scale$1 = new Vector3(); -var _orientation$1 = new Vector3(); -var AudioListener = class extends Object3D { - constructor() { - super(); - this.type = "AudioListener"; - this.context = AudioContext.getContext(); - this.gain = this.context.createGain(); - this.gain.connect(this.context.destination); - this.filter = null; - this.timeDelta = 0; - this._clock = new Clock(); - } - getInput() { - return this.gain; - } - removeFilter() { - if (this.filter !== null) { - this.gain.disconnect(this.filter); - this.filter.disconnect(this.context.destination); - this.gain.connect(this.context.destination); - this.filter = null; - } - return this; - } - getFilter() { - return this.filter; - } - setFilter(value) { - if (this.filter !== null) { - this.gain.disconnect(this.filter); - this.filter.disconnect(this.context.destination); - } else { - this.gain.disconnect(this.context.destination); - } - this.filter = value; - this.gain.connect(this.filter); - this.filter.connect(this.context.destination); - return this; - } - getMasterVolume() { - return this.gain.gain.value; - } - setMasterVolume(value) { - this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01); - return this; - } - updateMatrixWorld(force) { - super.updateMatrixWorld(force); - const listener = this.context.listener; - const up = this.up; - this.timeDelta = this._clock.getDelta(); - this.matrixWorld.decompose(_position$1, _quaternion$1, _scale$1); - _orientation$1.set(0, 0, -1).applyQuaternion(_quaternion$1); - if (listener.positionX) { - const endTime = this.context.currentTime + this.timeDelta; - listener.positionX.linearRampToValueAtTime(_position$1.x, endTime); - listener.positionY.linearRampToValueAtTime(_position$1.y, endTime); - listener.positionZ.linearRampToValueAtTime(_position$1.z, endTime); - listener.forwardX.linearRampToValueAtTime(_orientation$1.x, endTime); - listener.forwardY.linearRampToValueAtTime(_orientation$1.y, endTime); - listener.forwardZ.linearRampToValueAtTime(_orientation$1.z, endTime); - listener.upX.linearRampToValueAtTime(up.x, endTime); - listener.upY.linearRampToValueAtTime(up.y, endTime); - listener.upZ.linearRampToValueAtTime(up.z, endTime); - } else { - listener.setPosition(_position$1.x, _position$1.y, _position$1.z); - listener.setOrientation(_orientation$1.x, _orientation$1.y, _orientation$1.z, up.x, up.y, up.z); - } - } -}; -var Audio = class extends Object3D { - constructor(listener) { - super(); - this.type = "Audio"; - this.listener = listener; - this.context = listener.context; - this.gain = this.context.createGain(); - this.gain.connect(listener.getInput()); - this.autoplay = false; - this.buffer = null; - this.detune = 0; - this.loop = false; - this.loopStart = 0; - this.loopEnd = 0; - this.offset = 0; - this.duration = void 0; - this.playbackRate = 1; - this.isPlaying = false; - this.hasPlaybackControl = true; - this.source = null; - this.sourceType = "empty"; - this._startedAt = 0; - this._progress = 0; - this._connected = false; - this.filters = []; - } - getOutput() { - return this.gain; - } - setNodeSource(audioNode) { - this.hasPlaybackControl = false; - this.sourceType = "audioNode"; - this.source = audioNode; - this.connect(); - return this; - } - setMediaElementSource(mediaElement) { - this.hasPlaybackControl = false; - this.sourceType = "mediaNode"; - this.source = this.context.createMediaElementSource(mediaElement); - this.connect(); - return this; - } - setMediaStreamSource(mediaStream) { - this.hasPlaybackControl = false; - this.sourceType = "mediaStreamNode"; - this.source = this.context.createMediaStreamSource(mediaStream); - this.connect(); - return this; - } - setBuffer(audioBuffer) { - this.buffer = audioBuffer; - this.sourceType = "buffer"; - if (this.autoplay) - this.play(); - return this; - } - play(delay = 0) { - if (this.isPlaying === true) { - console.warn("THREE.Audio: Audio is already playing."); - return; - } - if (this.hasPlaybackControl === false) { - console.warn("THREE.Audio: this Audio has no playback control."); - return; - } - this._startedAt = this.context.currentTime + delay; - const source = this.context.createBufferSource(); - source.buffer = this.buffer; - source.loop = this.loop; - source.loopStart = this.loopStart; - source.loopEnd = this.loopEnd; - source.onended = this.onEnded.bind(this); - source.start(this._startedAt, this._progress + this.offset, this.duration); - this.isPlaying = true; - this.source = source; - this.setDetune(this.detune); - this.setPlaybackRate(this.playbackRate); - return this.connect(); - } - pause() { - if (this.hasPlaybackControl === false) { - console.warn("THREE.Audio: this Audio has no playback control."); - return; - } - if (this.isPlaying === true) { - this._progress += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate; - if (this.loop === true) { - this._progress = this._progress % (this.duration || this.buffer.duration); - } - this.source.stop(); - this.source.onended = null; - this.isPlaying = false; - } - return this; - } - stop() { - if (this.hasPlaybackControl === false) { - console.warn("THREE.Audio: this Audio has no playback control."); - return; - } - this._progress = 0; - if (this.source !== null) { - this.source.stop(); - this.source.onended = null; - } - this.isPlaying = false; - return this; - } - connect() { - if (this.filters.length > 0) { - this.source.connect(this.filters[0]); - for (let i = 1, l = this.filters.length; i < l; i++) { - this.filters[i - 1].connect(this.filters[i]); - } - this.filters[this.filters.length - 1].connect(this.getOutput()); - } else { - this.source.connect(this.getOutput()); - } - this._connected = true; - return this; - } - disconnect() { - if (this._connected === false) { - return; - } - if (this.filters.length > 0) { - this.source.disconnect(this.filters[0]); - for (let i = 1, l = this.filters.length; i < l; i++) { - this.filters[i - 1].disconnect(this.filters[i]); - } - this.filters[this.filters.length - 1].disconnect(this.getOutput()); - } else { - this.source.disconnect(this.getOutput()); - } - this._connected = false; - return this; - } - getFilters() { - return this.filters; - } - setFilters(value) { - if (!value) - value = []; - if (this._connected === true) { - this.disconnect(); - this.filters = value.slice(); - this.connect(); - } else { - this.filters = value.slice(); - } - return this; - } - setDetune(value) { - this.detune = value; - if (this.source.detune === void 0) - return; - if (this.isPlaying === true) { - this.source.detune.setTargetAtTime(this.detune, this.context.currentTime, 0.01); - } - return this; - } - getDetune() { - return this.detune; - } - getFilter() { - return this.getFilters()[0]; - } - setFilter(filter) { - return this.setFilters(filter ? [filter] : []); - } - setPlaybackRate(value) { - if (this.hasPlaybackControl === false) { - console.warn("THREE.Audio: this Audio has no playback control."); - return; - } - this.playbackRate = value; - if (this.isPlaying === true) { - this.source.playbackRate.setTargetAtTime(this.playbackRate, this.context.currentTime, 0.01); - } - return this; - } - getPlaybackRate() { - return this.playbackRate; - } - onEnded() { - this.isPlaying = false; - } - getLoop() { - if (this.hasPlaybackControl === false) { - console.warn("THREE.Audio: this Audio has no playback control."); - return false; - } - return this.loop; - } - setLoop(value) { - if (this.hasPlaybackControl === false) { - console.warn("THREE.Audio: this Audio has no playback control."); - return; - } - this.loop = value; - if (this.isPlaying === true) { - this.source.loop = this.loop; - } - return this; - } - setLoopStart(value) { - this.loopStart = value; - return this; - } - setLoopEnd(value) { - this.loopEnd = value; - return this; - } - getVolume() { - return this.gain.gain.value; - } - setVolume(value) { - this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01); - return this; - } -}; -var _position = new Vector3(); -var _quaternion = new Quaternion(); -var _scale = new Vector3(); -var _orientation = new Vector3(); -var PositionalAudio = class extends Audio { - constructor(listener) { - super(listener); - this.panner = this.context.createPanner(); - this.panner.panningModel = "HRTF"; - this.panner.connect(this.gain); - } - connect() { - super.connect(); - this.panner.connect(this.gain); - } - disconnect() { - super.disconnect(); - this.panner.disconnect(this.gain); - } - getOutput() { - return this.panner; - } - getRefDistance() { - return this.panner.refDistance; - } - setRefDistance(value) { - this.panner.refDistance = value; - return this; - } - getRolloffFactor() { - return this.panner.rolloffFactor; - } - setRolloffFactor(value) { - this.panner.rolloffFactor = value; - return this; - } - getDistanceModel() { - return this.panner.distanceModel; - } - setDistanceModel(value) { - this.panner.distanceModel = value; - return this; - } - getMaxDistance() { - return this.panner.maxDistance; - } - setMaxDistance(value) { - this.panner.maxDistance = value; - return this; - } - setDirectionalCone(coneInnerAngle, coneOuterAngle, coneOuterGain) { - this.panner.coneInnerAngle = coneInnerAngle; - this.panner.coneOuterAngle = coneOuterAngle; - this.panner.coneOuterGain = coneOuterGain; - return this; - } - updateMatrixWorld(force) { - super.updateMatrixWorld(force); - if (this.hasPlaybackControl === true && this.isPlaying === false) - return; - this.matrixWorld.decompose(_position, _quaternion, _scale); - _orientation.set(0, 0, 1).applyQuaternion(_quaternion); - const panner = this.panner; - if (panner.positionX) { - const endTime = this.context.currentTime + this.listener.timeDelta; - panner.positionX.linearRampToValueAtTime(_position.x, endTime); - panner.positionY.linearRampToValueAtTime(_position.y, endTime); - panner.positionZ.linearRampToValueAtTime(_position.z, endTime); - panner.orientationX.linearRampToValueAtTime(_orientation.x, endTime); - panner.orientationY.linearRampToValueAtTime(_orientation.y, endTime); - panner.orientationZ.linearRampToValueAtTime(_orientation.z, endTime); - } else { - panner.setPosition(_position.x, _position.y, _position.z); - panner.setOrientation(_orientation.x, _orientation.y, _orientation.z); - } - } -}; -var AudioAnalyser = class { - constructor(audio, fftSize = 2048) { - this.analyser = audio.context.createAnalyser(); - this.analyser.fftSize = fftSize; - this.data = new Uint8Array(this.analyser.frequencyBinCount); - audio.getOutput().connect(this.analyser); - } - getFrequencyData() { - this.analyser.getByteFrequencyData(this.data); - return this.data; - } - getAverageFrequency() { - let value = 0; - const data = this.getFrequencyData(); - for (let i = 0; i < data.length; i++) { - value += data[i]; - } - return value / data.length; - } -}; -var PropertyMixer = class { - constructor(binding, typeName, valueSize) { - this.binding = binding; - this.valueSize = valueSize; - let mixFunction, mixFunctionAdditive, setIdentity; - switch (typeName) { - case "quaternion": - mixFunction = this._slerp; - mixFunctionAdditive = this._slerpAdditive; - setIdentity = this._setAdditiveIdentityQuaternion; - this.buffer = new Float64Array(valueSize * 6); - this._workIndex = 5; - break; - case "string": - case "bool": - mixFunction = this._select; - mixFunctionAdditive = this._select; - setIdentity = this._setAdditiveIdentityOther; - this.buffer = new Array(valueSize * 5); - break; - default: - mixFunction = this._lerp; - mixFunctionAdditive = this._lerpAdditive; - setIdentity = this._setAdditiveIdentityNumeric; - this.buffer = new Float64Array(valueSize * 5); - } - this._mixBufferRegion = mixFunction; - this._mixBufferRegionAdditive = mixFunctionAdditive; - this._setIdentity = setIdentity; - this._origIndex = 3; - this._addIndex = 4; - this.cumulativeWeight = 0; - this.cumulativeWeightAdditive = 0; - this.useCount = 0; - this.referenceCount = 0; - } - // accumulate data in the 'incoming' region into 'accu' - accumulate(accuIndex, weight) { - const buffer = this.buffer, stride = this.valueSize, offset = accuIndex * stride + stride; - let currentWeight = this.cumulativeWeight; - if (currentWeight === 0) { - for (let i = 0; i !== stride; ++i) { - buffer[offset + i] = buffer[i]; - } - currentWeight = weight; - } else { - currentWeight += weight; - const mix = weight / currentWeight; - this._mixBufferRegion(buffer, offset, 0, mix, stride); - } - this.cumulativeWeight = currentWeight; - } - // accumulate data in the 'incoming' region into 'add' - accumulateAdditive(weight) { - const buffer = this.buffer, stride = this.valueSize, offset = stride * this._addIndex; - if (this.cumulativeWeightAdditive === 0) { - this._setIdentity(); - } - this._mixBufferRegionAdditive(buffer, offset, 0, weight, stride); - this.cumulativeWeightAdditive += weight; - } - // apply the state of 'accu' to the binding when accus differ - apply(accuIndex) { - const stride = this.valueSize, buffer = this.buffer, offset = accuIndex * stride + stride, weight = this.cumulativeWeight, weightAdditive = this.cumulativeWeightAdditive, binding = this.binding; - this.cumulativeWeight = 0; - this.cumulativeWeightAdditive = 0; - if (weight < 1) { - const originalValueOffset = stride * this._origIndex; - this._mixBufferRegion( - buffer, - offset, - originalValueOffset, - 1 - weight, - stride - ); - } - if (weightAdditive > 0) { - this._mixBufferRegionAdditive(buffer, offset, this._addIndex * stride, 1, stride); - } - for (let i = stride, e = stride + stride; i !== e; ++i) { - if (buffer[i] !== buffer[i + stride]) { - binding.setValue(buffer, offset); - break; - } - } - } - // remember the state of the bound property and copy it to both accus - saveOriginalState() { - const binding = this.binding; - const buffer = this.buffer, stride = this.valueSize, originalValueOffset = stride * this._origIndex; - binding.getValue(buffer, originalValueOffset); - for (let i = stride, e = originalValueOffset; i !== e; ++i) { - buffer[i] = buffer[originalValueOffset + i % stride]; - } - this._setIdentity(); - this.cumulativeWeight = 0; - this.cumulativeWeightAdditive = 0; - } - // apply the state previously taken via 'saveOriginalState' to the binding - restoreOriginalState() { - const originalValueOffset = this.valueSize * 3; - this.binding.setValue(this.buffer, originalValueOffset); - } - _setAdditiveIdentityNumeric() { - const startIndex = this._addIndex * this.valueSize; - const endIndex = startIndex + this.valueSize; - for (let i = startIndex; i < endIndex; i++) { - this.buffer[i] = 0; - } - } - _setAdditiveIdentityQuaternion() { - this._setAdditiveIdentityNumeric(); - this.buffer[this._addIndex * this.valueSize + 3] = 1; - } - _setAdditiveIdentityOther() { - const startIndex = this._origIndex * this.valueSize; - const targetIndex = this._addIndex * this.valueSize; - for (let i = 0; i < this.valueSize; i++) { - this.buffer[targetIndex + i] = this.buffer[startIndex + i]; - } - } - // mix functions - _select(buffer, dstOffset, srcOffset, t, stride) { - if (t >= 0.5) { - for (let i = 0; i !== stride; ++i) { - buffer[dstOffset + i] = buffer[srcOffset + i]; - } - } - } - _slerp(buffer, dstOffset, srcOffset, t) { - Quaternion.slerpFlat(buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t); - } - _slerpAdditive(buffer, dstOffset, srcOffset, t, stride) { - const workOffset = this._workIndex * stride; - Quaternion.multiplyQuaternionsFlat(buffer, workOffset, buffer, dstOffset, buffer, srcOffset); - Quaternion.slerpFlat(buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t); - } - _lerp(buffer, dstOffset, srcOffset, t, stride) { - const s = 1 - t; - for (let i = 0; i !== stride; ++i) { - const j = dstOffset + i; - buffer[j] = buffer[j] * s + buffer[srcOffset + i] * t; - } - } - _lerpAdditive(buffer, dstOffset, srcOffset, t, stride) { - for (let i = 0; i !== stride; ++i) { - const j = dstOffset + i; - buffer[j] = buffer[j] + buffer[srcOffset + i] * t; - } - } -}; -var _RESERVED_CHARS_RE = "\\[\\]\\.:\\/"; -var _reservedRe = new RegExp("[" + _RESERVED_CHARS_RE + "]", "g"); -var _wordChar = "[^" + _RESERVED_CHARS_RE + "]"; -var _wordCharOrDot = "[^" + _RESERVED_CHARS_RE.replace("\\.", "") + "]"; -var _directoryRe = /((?:WC+[\/:])*)/.source.replace("WC", _wordChar); -var _nodeRe = /(WCOD+)?/.source.replace("WCOD", _wordCharOrDot); -var _objectRe = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", _wordChar); -var _propertyRe = /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", _wordChar); -var _trackRe = new RegExp( - "^" + _directoryRe + _nodeRe + _objectRe + _propertyRe + "$" -); -var _supportedObjectNames = ["material", "materials", "bones", "map"]; -var Composite = class { - constructor(targetGroup, path, optionalParsedPath) { - const parsedPath = optionalParsedPath || PropertyBinding.parseTrackName(path); - this._targetGroup = targetGroup; - this._bindings = targetGroup.subscribe_(path, parsedPath); - } - getValue(array, offset) { - this.bind(); - const firstValidIndex = this._targetGroup.nCachedObjects_, binding = this._bindings[firstValidIndex]; - if (binding !== void 0) - binding.getValue(array, offset); - } - setValue(array, offset) { - const bindings = this._bindings; - for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { - bindings[i].setValue(array, offset); - } - } - bind() { - const bindings = this._bindings; - for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { - bindings[i].bind(); - } - } - unbind() { - const bindings = this._bindings; - for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { - bindings[i].unbind(); - } - } -}; -var PropertyBinding = class _PropertyBinding { - constructor(rootNode, path, parsedPath) { - this.path = path; - this.parsedPath = parsedPath || _PropertyBinding.parseTrackName(path); - this.node = _PropertyBinding.findNode(rootNode, this.parsedPath.nodeName); - this.rootNode = rootNode; - this.getValue = this._getValue_unbound; - this.setValue = this._setValue_unbound; - } - static create(root, path, parsedPath) { - if (!(root && root.isAnimationObjectGroup)) { - return new _PropertyBinding(root, path, parsedPath); - } else { - return new _PropertyBinding.Composite(root, path, parsedPath); - } - } - /** - * Replaces spaces with underscores and removes unsupported characters from - * node names, to ensure compatibility with parseTrackName(). - * - * @param {string} name Node name to be sanitized. - * @return {string} - */ - static sanitizeNodeName(name) { - return name.replace(/\s/g, "_").replace(_reservedRe, ""); - } - static parseTrackName(trackName) { - const matches = _trackRe.exec(trackName); - if (matches === null) { - throw new Error("PropertyBinding: Cannot parse trackName: " + trackName); - } - const results = { - // directoryName: matches[ 1 ], // (tschw) currently unused - nodeName: matches[2], - objectName: matches[3], - objectIndex: matches[4], - propertyName: matches[5], - // required - propertyIndex: matches[6] - }; - const lastDot = results.nodeName && results.nodeName.lastIndexOf("."); - if (lastDot !== void 0 && lastDot !== -1) { - const objectName = results.nodeName.substring(lastDot + 1); - if (_supportedObjectNames.indexOf(objectName) !== -1) { - results.nodeName = results.nodeName.substring(0, lastDot); - results.objectName = objectName; - } - } - if (results.propertyName === null || results.propertyName.length === 0) { - throw new Error("PropertyBinding: can not parse propertyName from trackName: " + trackName); - } - return results; - } - static findNode(root, nodeName) { - if (nodeName === void 0 || nodeName === "" || nodeName === "." || nodeName === -1 || nodeName === root.name || nodeName === root.uuid) { - return root; - } - if (root.skeleton) { - const bone = root.skeleton.getBoneByName(nodeName); - if (bone !== void 0) { - return bone; - } - } - if (root.children) { - const searchNodeSubtree = function(children) { - for (let i = 0; i < children.length; i++) { - const childNode = children[i]; - if (childNode.name === nodeName || childNode.uuid === nodeName) { - return childNode; - } - const result = searchNodeSubtree(childNode.children); - if (result) - return result; - } - return null; - }; - const subTreeNode = searchNodeSubtree(root.children); - if (subTreeNode) { - return subTreeNode; - } - } - return null; - } - // these are used to "bind" a nonexistent property - _getValue_unavailable() { - } - _setValue_unavailable() { - } - // Getters - _getValue_direct(buffer, offset) { - buffer[offset] = this.targetObject[this.propertyName]; - } - _getValue_array(buffer, offset) { - const source = this.resolvedProperty; - for (let i = 0, n = source.length; i !== n; ++i) { - buffer[offset++] = source[i]; - } - } - _getValue_arrayElement(buffer, offset) { - buffer[offset] = this.resolvedProperty[this.propertyIndex]; - } - _getValue_toArray(buffer, offset) { - this.resolvedProperty.toArray(buffer, offset); - } - // Direct - _setValue_direct(buffer, offset) { - this.targetObject[this.propertyName] = buffer[offset]; - } - _setValue_direct_setNeedsUpdate(buffer, offset) { - this.targetObject[this.propertyName] = buffer[offset]; - this.targetObject.needsUpdate = true; - } - _setValue_direct_setMatrixWorldNeedsUpdate(buffer, offset) { - this.targetObject[this.propertyName] = buffer[offset]; - this.targetObject.matrixWorldNeedsUpdate = true; - } - // EntireArray - _setValue_array(buffer, offset) { - const dest = this.resolvedProperty; - for (let i = 0, n = dest.length; i !== n; ++i) { - dest[i] = buffer[offset++]; - } - } - _setValue_array_setNeedsUpdate(buffer, offset) { - const dest = this.resolvedProperty; - for (let i = 0, n = dest.length; i !== n; ++i) { - dest[i] = buffer[offset++]; - } - this.targetObject.needsUpdate = true; - } - _setValue_array_setMatrixWorldNeedsUpdate(buffer, offset) { - const dest = this.resolvedProperty; - for (let i = 0, n = dest.length; i !== n; ++i) { - dest[i] = buffer[offset++]; - } - this.targetObject.matrixWorldNeedsUpdate = true; - } - // ArrayElement - _setValue_arrayElement(buffer, offset) { - this.resolvedProperty[this.propertyIndex] = buffer[offset]; - } - _setValue_arrayElement_setNeedsUpdate(buffer, offset) { - this.resolvedProperty[this.propertyIndex] = buffer[offset]; - this.targetObject.needsUpdate = true; - } - _setValue_arrayElement_setMatrixWorldNeedsUpdate(buffer, offset) { - this.resolvedProperty[this.propertyIndex] = buffer[offset]; - this.targetObject.matrixWorldNeedsUpdate = true; - } - // HasToFromArray - _setValue_fromArray(buffer, offset) { - this.resolvedProperty.fromArray(buffer, offset); - } - _setValue_fromArray_setNeedsUpdate(buffer, offset) { - this.resolvedProperty.fromArray(buffer, offset); - this.targetObject.needsUpdate = true; - } - _setValue_fromArray_setMatrixWorldNeedsUpdate(buffer, offset) { - this.resolvedProperty.fromArray(buffer, offset); - this.targetObject.matrixWorldNeedsUpdate = true; - } - _getValue_unbound(targetArray, offset) { - this.bind(); - this.getValue(targetArray, offset); - } - _setValue_unbound(sourceArray, offset) { - this.bind(); - this.setValue(sourceArray, offset); - } - // create getter / setter pair for a property in the scene graph - bind() { - let targetObject = this.node; - const parsedPath = this.parsedPath; - const objectName = parsedPath.objectName; - const propertyName = parsedPath.propertyName; - let propertyIndex = parsedPath.propertyIndex; - if (!targetObject) { - targetObject = _PropertyBinding.findNode(this.rootNode, parsedPath.nodeName); - this.node = targetObject; - } - this.getValue = this._getValue_unavailable; - this.setValue = this._setValue_unavailable; - if (!targetObject) { - console.warn("THREE.PropertyBinding: No target node found for track: " + this.path + "."); - return; - } - if (objectName) { - let objectIndex = parsedPath.objectIndex; - switch (objectName) { - case "materials": - if (!targetObject.material) { - console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.", this); - return; - } - if (!targetObject.material.materials) { - console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.", this); - return; - } - targetObject = targetObject.material.materials; - break; - case "bones": - if (!targetObject.skeleton) { - console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.", this); - return; - } - targetObject = targetObject.skeleton.bones; - for (let i = 0; i < targetObject.length; i++) { - if (targetObject[i].name === objectIndex) { - objectIndex = i; - break; - } - } - break; - case "map": - if ("map" in targetObject) { - targetObject = targetObject.map; - break; - } - if (!targetObject.material) { - console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.", this); - return; - } - if (!targetObject.material.map) { - console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.", this); - return; - } - targetObject = targetObject.material.map; - break; - default: - if (targetObject[objectName] === void 0) { - console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.", this); - return; - } - targetObject = targetObject[objectName]; - } - if (objectIndex !== void 0) { - if (targetObject[objectIndex] === void 0) { - console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.", this, targetObject); - return; - } - targetObject = targetObject[objectIndex]; - } - } - const nodeProperty = targetObject[propertyName]; - if (nodeProperty === void 0) { - const nodeName = parsedPath.nodeName; - console.error("THREE.PropertyBinding: Trying to update property for track: " + nodeName + "." + propertyName + " but it wasn't found.", targetObject); - return; - } - let versioning = this.Versioning.None; - this.targetObject = targetObject; - if (targetObject.needsUpdate !== void 0) { - versioning = this.Versioning.NeedsUpdate; - } else if (targetObject.matrixWorldNeedsUpdate !== void 0) { - versioning = this.Versioning.MatrixWorldNeedsUpdate; - } - let bindingType = this.BindingType.Direct; - if (propertyIndex !== void 0) { - if (propertyName === "morphTargetInfluences") { - if (!targetObject.geometry) { - console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.", this); - return; - } - if (!targetObject.geometry.morphAttributes) { - console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.", this); - return; - } - if (targetObject.morphTargetDictionary[propertyIndex] !== void 0) { - propertyIndex = targetObject.morphTargetDictionary[propertyIndex]; - } - } - bindingType = this.BindingType.ArrayElement; - this.resolvedProperty = nodeProperty; - this.propertyIndex = propertyIndex; - } else if (nodeProperty.fromArray !== void 0 && nodeProperty.toArray !== void 0) { - bindingType = this.BindingType.HasFromToArray; - this.resolvedProperty = nodeProperty; - } else if (Array.isArray(nodeProperty)) { - bindingType = this.BindingType.EntireArray; - this.resolvedProperty = nodeProperty; - } else { - this.propertyName = propertyName; - } - this.getValue = this.GetterByBindingType[bindingType]; - this.setValue = this.SetterByBindingTypeAndVersioning[bindingType][versioning]; - } - unbind() { - this.node = null; - this.getValue = this._getValue_unbound; - this.setValue = this._setValue_unbound; - } -}; -PropertyBinding.Composite = Composite; -PropertyBinding.prototype.BindingType = { - Direct: 0, - EntireArray: 1, - ArrayElement: 2, - HasFromToArray: 3 -}; -PropertyBinding.prototype.Versioning = { - None: 0, - NeedsUpdate: 1, - MatrixWorldNeedsUpdate: 2 -}; -PropertyBinding.prototype.GetterByBindingType = [ - PropertyBinding.prototype._getValue_direct, - PropertyBinding.prototype._getValue_array, - PropertyBinding.prototype._getValue_arrayElement, - PropertyBinding.prototype._getValue_toArray -]; -PropertyBinding.prototype.SetterByBindingTypeAndVersioning = [ - [ - // Direct - PropertyBinding.prototype._setValue_direct, - PropertyBinding.prototype._setValue_direct_setNeedsUpdate, - PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate - ], - [ - // EntireArray - PropertyBinding.prototype._setValue_array, - PropertyBinding.prototype._setValue_array_setNeedsUpdate, - PropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate - ], - [ - // ArrayElement - PropertyBinding.prototype._setValue_arrayElement, - PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate, - PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate - ], - [ - // HasToFromArray - PropertyBinding.prototype._setValue_fromArray, - PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate, - PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate - ] -]; -var AnimationObjectGroup = class { - constructor() { - this.isAnimationObjectGroup = true; - this.uuid = generateUUID(); - this._objects = Array.prototype.slice.call(arguments); - this.nCachedObjects_ = 0; - const indices = {}; - this._indicesByUUID = indices; - for (let i = 0, n = arguments.length; i !== n; ++i) { - indices[arguments[i].uuid] = i; - } - this._paths = []; - this._parsedPaths = []; - this._bindings = []; - this._bindingsIndicesByPath = {}; - const scope = this; - this.stats = { - objects: { - get total() { - return scope._objects.length; - }, - get inUse() { - return this.total - scope.nCachedObjects_; - } - }, - get bindingsPerObject() { - return scope._bindings.length; - } - }; - } - add() { - const objects = this._objects, indicesByUUID = this._indicesByUUID, paths = this._paths, parsedPaths = this._parsedPaths, bindings = this._bindings, nBindings = bindings.length; - let knownObject = void 0, nObjects = objects.length, nCachedObjects = this.nCachedObjects_; - for (let i = 0, n = arguments.length; i !== n; ++i) { - const object = arguments[i], uuid = object.uuid; - let index = indicesByUUID[uuid]; - if (index === void 0) { - index = nObjects++; - indicesByUUID[uuid] = index; - objects.push(object); - for (let j = 0, m = nBindings; j !== m; ++j) { - bindings[j].push(new PropertyBinding(object, paths[j], parsedPaths[j])); - } - } else if (index < nCachedObjects) { - knownObject = objects[index]; - const firstActiveIndex = --nCachedObjects, lastCachedObject = objects[firstActiveIndex]; - indicesByUUID[lastCachedObject.uuid] = index; - objects[index] = lastCachedObject; - indicesByUUID[uuid] = firstActiveIndex; - objects[firstActiveIndex] = object; - for (let j = 0, m = nBindings; j !== m; ++j) { - const bindingsForPath = bindings[j], lastCached = bindingsForPath[firstActiveIndex]; - let binding = bindingsForPath[index]; - bindingsForPath[index] = lastCached; - if (binding === void 0) { - binding = new PropertyBinding(object, paths[j], parsedPaths[j]); - } - bindingsForPath[firstActiveIndex] = binding; - } - } else if (objects[index] !== knownObject) { - console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes."); - } - } - this.nCachedObjects_ = nCachedObjects; - } - remove() { - const objects = this._objects, indicesByUUID = this._indicesByUUID, bindings = this._bindings, nBindings = bindings.length; - let nCachedObjects = this.nCachedObjects_; - for (let i = 0, n = arguments.length; i !== n; ++i) { - const object = arguments[i], uuid = object.uuid, index = indicesByUUID[uuid]; - if (index !== void 0 && index >= nCachedObjects) { - const lastCachedIndex = nCachedObjects++, firstActiveObject = objects[lastCachedIndex]; - indicesByUUID[firstActiveObject.uuid] = index; - objects[index] = firstActiveObject; - indicesByUUID[uuid] = lastCachedIndex; - objects[lastCachedIndex] = object; - for (let j = 0, m = nBindings; j !== m; ++j) { - const bindingsForPath = bindings[j], firstActive = bindingsForPath[lastCachedIndex], binding = bindingsForPath[index]; - bindingsForPath[index] = firstActive; - bindingsForPath[lastCachedIndex] = binding; - } - } - } - this.nCachedObjects_ = nCachedObjects; - } - // remove & forget - uncache() { - const objects = this._objects, indicesByUUID = this._indicesByUUID, bindings = this._bindings, nBindings = bindings.length; - let nCachedObjects = this.nCachedObjects_, nObjects = objects.length; - for (let i = 0, n = arguments.length; i !== n; ++i) { - const object = arguments[i], uuid = object.uuid, index = indicesByUUID[uuid]; - if (index !== void 0) { - delete indicesByUUID[uuid]; - if (index < nCachedObjects) { - const firstActiveIndex = --nCachedObjects, lastCachedObject = objects[firstActiveIndex], lastIndex = --nObjects, lastObject = objects[lastIndex]; - indicesByUUID[lastCachedObject.uuid] = index; - objects[index] = lastCachedObject; - indicesByUUID[lastObject.uuid] = firstActiveIndex; - objects[firstActiveIndex] = lastObject; - objects.pop(); - for (let j = 0, m = nBindings; j !== m; ++j) { - const bindingsForPath = bindings[j], lastCached = bindingsForPath[firstActiveIndex], last = bindingsForPath[lastIndex]; - bindingsForPath[index] = lastCached; - bindingsForPath[firstActiveIndex] = last; - bindingsForPath.pop(); - } - } else { - const lastIndex = --nObjects, lastObject = objects[lastIndex]; - if (lastIndex > 0) { - indicesByUUID[lastObject.uuid] = index; - } - objects[index] = lastObject; - objects.pop(); - for (let j = 0, m = nBindings; j !== m; ++j) { - const bindingsForPath = bindings[j]; - bindingsForPath[index] = bindingsForPath[lastIndex]; - bindingsForPath.pop(); - } - } - } - } - this.nCachedObjects_ = nCachedObjects; - } - // Internal interface used by befriended PropertyBinding.Composite: - subscribe_(path, parsedPath) { - const indicesByPath = this._bindingsIndicesByPath; - let index = indicesByPath[path]; - const bindings = this._bindings; - if (index !== void 0) - return bindings[index]; - const paths = this._paths, parsedPaths = this._parsedPaths, objects = this._objects, nObjects = objects.length, nCachedObjects = this.nCachedObjects_, bindingsForPath = new Array(nObjects); - index = bindings.length; - indicesByPath[path] = index; - paths.push(path); - parsedPaths.push(parsedPath); - bindings.push(bindingsForPath); - for (let i = nCachedObjects, n = objects.length; i !== n; ++i) { - const object = objects[i]; - bindingsForPath[i] = new PropertyBinding(object, path, parsedPath); - } - return bindingsForPath; - } - unsubscribe_(path) { - const indicesByPath = this._bindingsIndicesByPath, index = indicesByPath[path]; - if (index !== void 0) { - const paths = this._paths, parsedPaths = this._parsedPaths, bindings = this._bindings, lastBindingsIndex = bindings.length - 1, lastBindings = bindings[lastBindingsIndex], lastBindingsPath = path[lastBindingsIndex]; - indicesByPath[lastBindingsPath] = index; - bindings[index] = lastBindings; - bindings.pop(); - parsedPaths[index] = parsedPaths[lastBindingsIndex]; - parsedPaths.pop(); - paths[index] = paths[lastBindingsIndex]; - paths.pop(); - } - } -}; -var AnimationAction = class { - constructor(mixer, clip, localRoot = null, blendMode = clip.blendMode) { - this._mixer = mixer; - this._clip = clip; - this._localRoot = localRoot; - this.blendMode = blendMode; - const tracks = clip.tracks, nTracks = tracks.length, interpolants = new Array(nTracks); - const interpolantSettings = { - endingStart: ZeroCurvatureEnding, - endingEnd: ZeroCurvatureEnding - }; - for (let i = 0; i !== nTracks; ++i) { - const interpolant = tracks[i].createInterpolant(null); - interpolants[i] = interpolant; - interpolant.settings = interpolantSettings; - } - this._interpolantSettings = interpolantSettings; - this._interpolants = interpolants; - this._propertyBindings = new Array(nTracks); - this._cacheIndex = null; - this._byClipCacheIndex = null; - this._timeScaleInterpolant = null; - this._weightInterpolant = null; - this.loop = LoopRepeat; - this._loopCount = -1; - this._startTime = null; - this.time = 0; - this.timeScale = 1; - this._effectiveTimeScale = 1; - this.weight = 1; - this._effectiveWeight = 1; - this.repetitions = Infinity; - this.paused = false; - this.enabled = true; - this.clampWhenFinished = false; - this.zeroSlopeAtStart = true; - this.zeroSlopeAtEnd = true; - } - // State & Scheduling - play() { - this._mixer._activateAction(this); - return this; - } - stop() { - this._mixer._deactivateAction(this); - return this.reset(); - } - reset() { - this.paused = false; - this.enabled = true; - this.time = 0; - this._loopCount = -1; - this._startTime = null; - return this.stopFading().stopWarping(); - } - isRunning() { - return this.enabled && !this.paused && this.timeScale !== 0 && this._startTime === null && this._mixer._isActiveAction(this); - } - // return true when play has been called - isScheduled() { - return this._mixer._isActiveAction(this); - } - startAt(time) { - this._startTime = time; - return this; - } - setLoop(mode, repetitions) { - this.loop = mode; - this.repetitions = repetitions; - return this; - } - // Weight - // set the weight stopping any scheduled fading - // although .enabled = false yields an effective weight of zero, this - // method does *not* change .enabled, because it would be confusing - setEffectiveWeight(weight) { - this.weight = weight; - this._effectiveWeight = this.enabled ? weight : 0; - return this.stopFading(); - } - // return the weight considering fading and .enabled - getEffectiveWeight() { - return this._effectiveWeight; - } - fadeIn(duration) { - return this._scheduleFading(duration, 0, 1); - } - fadeOut(duration) { - return this._scheduleFading(duration, 1, 0); - } - crossFadeFrom(fadeOutAction, duration, warp) { - fadeOutAction.fadeOut(duration); - this.fadeIn(duration); - if (warp) { - const fadeInDuration = this._clip.duration, fadeOutDuration = fadeOutAction._clip.duration, startEndRatio = fadeOutDuration / fadeInDuration, endStartRatio = fadeInDuration / fadeOutDuration; - fadeOutAction.warp(1, startEndRatio, duration); - this.warp(endStartRatio, 1, duration); - } - return this; - } - crossFadeTo(fadeInAction, duration, warp) { - return fadeInAction.crossFadeFrom(this, duration, warp); - } - stopFading() { - const weightInterpolant = this._weightInterpolant; - if (weightInterpolant !== null) { - this._weightInterpolant = null; - this._mixer._takeBackControlInterpolant(weightInterpolant); - } - return this; - } - // Time Scale Control - // set the time scale stopping any scheduled warping - // although .paused = true yields an effective time scale of zero, this - // method does *not* change .paused, because it would be confusing - setEffectiveTimeScale(timeScale) { - this.timeScale = timeScale; - this._effectiveTimeScale = this.paused ? 0 : timeScale; - return this.stopWarping(); - } - // return the time scale considering warping and .paused - getEffectiveTimeScale() { - return this._effectiveTimeScale; - } - setDuration(duration) { - this.timeScale = this._clip.duration / duration; - return this.stopWarping(); - } - syncWith(action) { - this.time = action.time; - this.timeScale = action.timeScale; - return this.stopWarping(); - } - halt(duration) { - return this.warp(this._effectiveTimeScale, 0, duration); - } - warp(startTimeScale, endTimeScale, duration) { - const mixer = this._mixer, now2 = mixer.time, timeScale = this.timeScale; - let interpolant = this._timeScaleInterpolant; - if (interpolant === null) { - interpolant = mixer._lendControlInterpolant(); - this._timeScaleInterpolant = interpolant; - } - const times = interpolant.parameterPositions, values = interpolant.sampleValues; - times[0] = now2; - times[1] = now2 + duration; - values[0] = startTimeScale / timeScale; - values[1] = endTimeScale / timeScale; - return this; - } - stopWarping() { - const timeScaleInterpolant = this._timeScaleInterpolant; - if (timeScaleInterpolant !== null) { - this._timeScaleInterpolant = null; - this._mixer._takeBackControlInterpolant(timeScaleInterpolant); - } - return this; - } - // Object Accessors - getMixer() { - return this._mixer; - } - getClip() { - return this._clip; - } - getRoot() { - return this._localRoot || this._mixer._root; - } - // Interna - _update(time, deltaTime, timeDirection, accuIndex) { - if (!this.enabled) { - this._updateWeight(time); - return; - } - const startTime = this._startTime; - if (startTime !== null) { - const timeRunning = (time - startTime) * timeDirection; - if (timeRunning < 0 || timeDirection === 0) { - deltaTime = 0; - } else { - this._startTime = null; - deltaTime = timeDirection * timeRunning; - } - } - deltaTime *= this._updateTimeScale(time); - const clipTime = this._updateTime(deltaTime); - const weight = this._updateWeight(time); - if (weight > 0) { - const interpolants = this._interpolants; - const propertyMixers = this._propertyBindings; - switch (this.blendMode) { - case AdditiveAnimationBlendMode: - for (let j = 0, m = interpolants.length; j !== m; ++j) { - interpolants[j].evaluate(clipTime); - propertyMixers[j].accumulateAdditive(weight); - } - break; - case NormalAnimationBlendMode: - default: - for (let j = 0, m = interpolants.length; j !== m; ++j) { - interpolants[j].evaluate(clipTime); - propertyMixers[j].accumulate(accuIndex, weight); - } - } - } - } - _updateWeight(time) { - let weight = 0; - if (this.enabled) { - weight = this.weight; - const interpolant = this._weightInterpolant; - if (interpolant !== null) { - const interpolantValue = interpolant.evaluate(time)[0]; - weight *= interpolantValue; - if (time > interpolant.parameterPositions[1]) { - this.stopFading(); - if (interpolantValue === 0) { - this.enabled = false; - } - } - } - } - this._effectiveWeight = weight; - return weight; - } - _updateTimeScale(time) { - let timeScale = 0; - if (!this.paused) { - timeScale = this.timeScale; - const interpolant = this._timeScaleInterpolant; - if (interpolant !== null) { - const interpolantValue = interpolant.evaluate(time)[0]; - timeScale *= interpolantValue; - if (time > interpolant.parameterPositions[1]) { - this.stopWarping(); - if (timeScale === 0) { - this.paused = true; - } else { - this.timeScale = timeScale; - } - } - } - } - this._effectiveTimeScale = timeScale; - return timeScale; - } - _updateTime(deltaTime) { - const duration = this._clip.duration; - const loop = this.loop; - let time = this.time + deltaTime; - let loopCount = this._loopCount; - const pingPong = loop === LoopPingPong; - if (deltaTime === 0) { - if (loopCount === -1) - return time; - return pingPong && (loopCount & 1) === 1 ? duration - time : time; - } - if (loop === LoopOnce) { - if (loopCount === -1) { - this._loopCount = 0; - this._setEndings(true, true, false); - } - handle_stop: { - if (time >= duration) { - time = duration; - } else if (time < 0) { - time = 0; - } else { - this.time = time; - break handle_stop; - } - if (this.clampWhenFinished) - this.paused = true; - else - this.enabled = false; - this.time = time; - this._mixer.dispatchEvent({ - type: "finished", - action: this, - direction: deltaTime < 0 ? -1 : 1 - }); - } - } else { - if (loopCount === -1) { - if (deltaTime >= 0) { - loopCount = 0; - this._setEndings(true, this.repetitions === 0, pingPong); - } else { - this._setEndings(this.repetitions === 0, true, pingPong); - } - } - if (time >= duration || time < 0) { - const loopDelta = Math.floor(time / duration); - time -= duration * loopDelta; - loopCount += Math.abs(loopDelta); - const pending = this.repetitions - loopCount; - if (pending <= 0) { - if (this.clampWhenFinished) - this.paused = true; - else - this.enabled = false; - time = deltaTime > 0 ? duration : 0; - this.time = time; - this._mixer.dispatchEvent({ - type: "finished", - action: this, - direction: deltaTime > 0 ? 1 : -1 - }); - } else { - if (pending === 1) { - const atStart = deltaTime < 0; - this._setEndings(atStart, !atStart, pingPong); - } else { - this._setEndings(false, false, pingPong); - } - this._loopCount = loopCount; - this.time = time; - this._mixer.dispatchEvent({ - type: "loop", - action: this, - loopDelta - }); - } - } else { - this.time = time; - } - if (pingPong && (loopCount & 1) === 1) { - return duration - time; - } - } - return time; - } - _setEndings(atStart, atEnd, pingPong) { - const settings = this._interpolantSettings; - if (pingPong) { - settings.endingStart = ZeroSlopeEnding; - settings.endingEnd = ZeroSlopeEnding; - } else { - if (atStart) { - settings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding; - } else { - settings.endingStart = WrapAroundEnding; - } - if (atEnd) { - settings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding; - } else { - settings.endingEnd = WrapAroundEnding; - } - } - } - _scheduleFading(duration, weightNow, weightThen) { - const mixer = this._mixer, now2 = mixer.time; - let interpolant = this._weightInterpolant; - if (interpolant === null) { - interpolant = mixer._lendControlInterpolant(); - this._weightInterpolant = interpolant; - } - const times = interpolant.parameterPositions, values = interpolant.sampleValues; - times[0] = now2; - values[0] = weightNow; - times[1] = now2 + duration; - values[1] = weightThen; - return this; - } -}; -var _controlInterpolantsResultBuffer = new Float32Array(1); -var AnimationMixer = class extends EventDispatcher { - constructor(root) { - super(); - this._root = root; - this._initMemoryManager(); - this._accuIndex = 0; - this.time = 0; - this.timeScale = 1; - } - _bindAction(action, prototypeAction) { - const root = action._localRoot || this._root, tracks = action._clip.tracks, nTracks = tracks.length, bindings = action._propertyBindings, interpolants = action._interpolants, rootUuid = root.uuid, bindingsByRoot = this._bindingsByRootAndName; - let bindingsByName = bindingsByRoot[rootUuid]; - if (bindingsByName === void 0) { - bindingsByName = {}; - bindingsByRoot[rootUuid] = bindingsByName; - } - for (let i = 0; i !== nTracks; ++i) { - const track = tracks[i], trackName = track.name; - let binding = bindingsByName[trackName]; - if (binding !== void 0) { - ++binding.referenceCount; - bindings[i] = binding; - } else { - binding = bindings[i]; - if (binding !== void 0) { - if (binding._cacheIndex === null) { - ++binding.referenceCount; - this._addInactiveBinding(binding, rootUuid, trackName); - } - continue; - } - const path = prototypeAction && prototypeAction._propertyBindings[i].binding.parsedPath; - binding = new PropertyMixer( - PropertyBinding.create(root, trackName, path), - track.ValueTypeName, - track.getValueSize() - ); - ++binding.referenceCount; - this._addInactiveBinding(binding, rootUuid, trackName); - bindings[i] = binding; - } - interpolants[i].resultBuffer = binding.buffer; - } - } - _activateAction(action) { - if (!this._isActiveAction(action)) { - if (action._cacheIndex === null) { - const rootUuid = (action._localRoot || this._root).uuid, clipUuid = action._clip.uuid, actionsForClip = this._actionsByClip[clipUuid]; - this._bindAction( - action, - actionsForClip && actionsForClip.knownActions[0] - ); - this._addInactiveAction(action, clipUuid, rootUuid); - } - const bindings = action._propertyBindings; - for (let i = 0, n = bindings.length; i !== n; ++i) { - const binding = bindings[i]; - if (binding.useCount++ === 0) { - this._lendBinding(binding); - binding.saveOriginalState(); - } - } - this._lendAction(action); - } - } - _deactivateAction(action) { - if (this._isActiveAction(action)) { - const bindings = action._propertyBindings; - for (let i = 0, n = bindings.length; i !== n; ++i) { - const binding = bindings[i]; - if (--binding.useCount === 0) { - binding.restoreOriginalState(); - this._takeBackBinding(binding); - } - } - this._takeBackAction(action); - } - } - // Memory manager - _initMemoryManager() { - this._actions = []; - this._nActiveActions = 0; - this._actionsByClip = {}; - this._bindings = []; - this._nActiveBindings = 0; - this._bindingsByRootAndName = {}; - this._controlInterpolants = []; - this._nActiveControlInterpolants = 0; - const scope = this; - this.stats = { - actions: { - get total() { - return scope._actions.length; - }, - get inUse() { - return scope._nActiveActions; - } - }, - bindings: { - get total() { - return scope._bindings.length; - }, - get inUse() { - return scope._nActiveBindings; - } - }, - controlInterpolants: { - get total() { - return scope._controlInterpolants.length; - }, - get inUse() { - return scope._nActiveControlInterpolants; - } - } - }; - } - // Memory management for AnimationAction objects - _isActiveAction(action) { - const index = action._cacheIndex; - return index !== null && index < this._nActiveActions; - } - _addInactiveAction(action, clipUuid, rootUuid) { - const actions = this._actions, actionsByClip = this._actionsByClip; - let actionsForClip = actionsByClip[clipUuid]; - if (actionsForClip === void 0) { - actionsForClip = { - knownActions: [action], - actionByRoot: {} - }; - action._byClipCacheIndex = 0; - actionsByClip[clipUuid] = actionsForClip; - } else { - const knownActions = actionsForClip.knownActions; - action._byClipCacheIndex = knownActions.length; - knownActions.push(action); - } - action._cacheIndex = actions.length; - actions.push(action); - actionsForClip.actionByRoot[rootUuid] = action; - } - _removeInactiveAction(action) { - const actions = this._actions, lastInactiveAction = actions[actions.length - 1], cacheIndex = action._cacheIndex; - lastInactiveAction._cacheIndex = cacheIndex; - actions[cacheIndex] = lastInactiveAction; - actions.pop(); - action._cacheIndex = null; - const clipUuid = action._clip.uuid, actionsByClip = this._actionsByClip, actionsForClip = actionsByClip[clipUuid], knownActionsForClip = actionsForClip.knownActions, lastKnownAction = knownActionsForClip[knownActionsForClip.length - 1], byClipCacheIndex = action._byClipCacheIndex; - lastKnownAction._byClipCacheIndex = byClipCacheIndex; - knownActionsForClip[byClipCacheIndex] = lastKnownAction; - knownActionsForClip.pop(); - action._byClipCacheIndex = null; - const actionByRoot = actionsForClip.actionByRoot, rootUuid = (action._localRoot || this._root).uuid; - delete actionByRoot[rootUuid]; - if (knownActionsForClip.length === 0) { - delete actionsByClip[clipUuid]; - } - this._removeInactiveBindingsForAction(action); - } - _removeInactiveBindingsForAction(action) { - const bindings = action._propertyBindings; - for (let i = 0, n = bindings.length; i !== n; ++i) { - const binding = bindings[i]; - if (--binding.referenceCount === 0) { - this._removeInactiveBinding(binding); - } - } - } - _lendAction(action) { - const actions = this._actions, prevIndex = action._cacheIndex, lastActiveIndex = this._nActiveActions++, firstInactiveAction = actions[lastActiveIndex]; - action._cacheIndex = lastActiveIndex; - actions[lastActiveIndex] = action; - firstInactiveAction._cacheIndex = prevIndex; - actions[prevIndex] = firstInactiveAction; - } - _takeBackAction(action) { - const actions = this._actions, prevIndex = action._cacheIndex, firstInactiveIndex = --this._nActiveActions, lastActiveAction = actions[firstInactiveIndex]; - action._cacheIndex = firstInactiveIndex; - actions[firstInactiveIndex] = action; - lastActiveAction._cacheIndex = prevIndex; - actions[prevIndex] = lastActiveAction; - } - // Memory management for PropertyMixer objects - _addInactiveBinding(binding, rootUuid, trackName) { - const bindingsByRoot = this._bindingsByRootAndName, bindings = this._bindings; - let bindingByName = bindingsByRoot[rootUuid]; - if (bindingByName === void 0) { - bindingByName = {}; - bindingsByRoot[rootUuid] = bindingByName; - } - bindingByName[trackName] = binding; - binding._cacheIndex = bindings.length; - bindings.push(binding); - } - _removeInactiveBinding(binding) { - const bindings = this._bindings, propBinding = binding.binding, rootUuid = propBinding.rootNode.uuid, trackName = propBinding.path, bindingsByRoot = this._bindingsByRootAndName, bindingByName = bindingsByRoot[rootUuid], lastInactiveBinding = bindings[bindings.length - 1], cacheIndex = binding._cacheIndex; - lastInactiveBinding._cacheIndex = cacheIndex; - bindings[cacheIndex] = lastInactiveBinding; - bindings.pop(); - delete bindingByName[trackName]; - if (Object.keys(bindingByName).length === 0) { - delete bindingsByRoot[rootUuid]; - } - } - _lendBinding(binding) { - const bindings = this._bindings, prevIndex = binding._cacheIndex, lastActiveIndex = this._nActiveBindings++, firstInactiveBinding = bindings[lastActiveIndex]; - binding._cacheIndex = lastActiveIndex; - bindings[lastActiveIndex] = binding; - firstInactiveBinding._cacheIndex = prevIndex; - bindings[prevIndex] = firstInactiveBinding; - } - _takeBackBinding(binding) { - const bindings = this._bindings, prevIndex = binding._cacheIndex, firstInactiveIndex = --this._nActiveBindings, lastActiveBinding = bindings[firstInactiveIndex]; - binding._cacheIndex = firstInactiveIndex; - bindings[firstInactiveIndex] = binding; - lastActiveBinding._cacheIndex = prevIndex; - bindings[prevIndex] = lastActiveBinding; - } - // Memory management of Interpolants for weight and time scale - _lendControlInterpolant() { - const interpolants = this._controlInterpolants, lastActiveIndex = this._nActiveControlInterpolants++; - let interpolant = interpolants[lastActiveIndex]; - if (interpolant === void 0) { - interpolant = new LinearInterpolant( - new Float32Array(2), - new Float32Array(2), - 1, - _controlInterpolantsResultBuffer - ); - interpolant.__cacheIndex = lastActiveIndex; - interpolants[lastActiveIndex] = interpolant; - } - return interpolant; - } - _takeBackControlInterpolant(interpolant) { - const interpolants = this._controlInterpolants, prevIndex = interpolant.__cacheIndex, firstInactiveIndex = --this._nActiveControlInterpolants, lastActiveInterpolant = interpolants[firstInactiveIndex]; - interpolant.__cacheIndex = firstInactiveIndex; - interpolants[firstInactiveIndex] = interpolant; - lastActiveInterpolant.__cacheIndex = prevIndex; - interpolants[prevIndex] = lastActiveInterpolant; - } - // return an action for a clip optionally using a custom root target - // object (this method allocates a lot of dynamic memory in case a - // previously unknown clip/root combination is specified) - clipAction(clip, optionalRoot, blendMode) { - const root = optionalRoot || this._root, rootUuid = root.uuid; - let clipObject = typeof clip === "string" ? AnimationClip.findByName(root, clip) : clip; - const clipUuid = clipObject !== null ? clipObject.uuid : clip; - const actionsForClip = this._actionsByClip[clipUuid]; - let prototypeAction = null; - if (blendMode === void 0) { - if (clipObject !== null) { - blendMode = clipObject.blendMode; - } else { - blendMode = NormalAnimationBlendMode; - } - } - if (actionsForClip !== void 0) { - const existingAction = actionsForClip.actionByRoot[rootUuid]; - if (existingAction !== void 0 && existingAction.blendMode === blendMode) { - return existingAction; - } - prototypeAction = actionsForClip.knownActions[0]; - if (clipObject === null) - clipObject = prototypeAction._clip; - } - if (clipObject === null) - return null; - const newAction = new AnimationAction(this, clipObject, optionalRoot, blendMode); - this._bindAction(newAction, prototypeAction); - this._addInactiveAction(newAction, clipUuid, rootUuid); - return newAction; - } - // get an existing action - existingAction(clip, optionalRoot) { - const root = optionalRoot || this._root, rootUuid = root.uuid, clipObject = typeof clip === "string" ? AnimationClip.findByName(root, clip) : clip, clipUuid = clipObject ? clipObject.uuid : clip, actionsForClip = this._actionsByClip[clipUuid]; - if (actionsForClip !== void 0) { - return actionsForClip.actionByRoot[rootUuid] || null; - } - return null; - } - // deactivates all previously scheduled actions - stopAllAction() { - const actions = this._actions, nActions = this._nActiveActions; - for (let i = nActions - 1; i >= 0; --i) { - actions[i].stop(); - } - return this; - } - // advance the time and update apply the animation - update(deltaTime) { - deltaTime *= this.timeScale; - const actions = this._actions, nActions = this._nActiveActions, time = this.time += deltaTime, timeDirection = Math.sign(deltaTime), accuIndex = this._accuIndex ^= 1; - for (let i = 0; i !== nActions; ++i) { - const action = actions[i]; - action._update(time, deltaTime, timeDirection, accuIndex); - } - const bindings = this._bindings, nBindings = this._nActiveBindings; - for (let i = 0; i !== nBindings; ++i) { - bindings[i].apply(accuIndex); - } - return this; - } - // Allows you to seek to a specific time in an animation. - setTime(timeInSeconds) { - this.time = 0; - for (let i = 0; i < this._actions.length; i++) { - this._actions[i].time = 0; - } - return this.update(timeInSeconds); - } - // return this mixer's root target object - getRoot() { - return this._root; - } - // free all resources specific to a particular clip - uncacheClip(clip) { - const actions = this._actions, clipUuid = clip.uuid, actionsByClip = this._actionsByClip, actionsForClip = actionsByClip[clipUuid]; - if (actionsForClip !== void 0) { - const actionsToRemove = actionsForClip.knownActions; - for (let i = 0, n = actionsToRemove.length; i !== n; ++i) { - const action = actionsToRemove[i]; - this._deactivateAction(action); - const cacheIndex = action._cacheIndex, lastInactiveAction = actions[actions.length - 1]; - action._cacheIndex = null; - action._byClipCacheIndex = null; - lastInactiveAction._cacheIndex = cacheIndex; - actions[cacheIndex] = lastInactiveAction; - actions.pop(); - this._removeInactiveBindingsForAction(action); - } - delete actionsByClip[clipUuid]; - } - } - // free all resources specific to a particular root target object - uncacheRoot(root) { - const rootUuid = root.uuid, actionsByClip = this._actionsByClip; - for (const clipUuid in actionsByClip) { - const actionByRoot = actionsByClip[clipUuid].actionByRoot, action = actionByRoot[rootUuid]; - if (action !== void 0) { - this._deactivateAction(action); - this._removeInactiveAction(action); - } - } - const bindingsByRoot = this._bindingsByRootAndName, bindingByName = bindingsByRoot[rootUuid]; - if (bindingByName !== void 0) { - for (const trackName in bindingByName) { - const binding = bindingByName[trackName]; - binding.restoreOriginalState(); - this._removeInactiveBinding(binding); - } - } - } - // remove a targeted clip from the cache - uncacheAction(clip, optionalRoot) { - const action = this.existingAction(clip, optionalRoot); - if (action !== null) { - this._deactivateAction(action); - this._removeInactiveAction(action); - } - } -}; -var Uniform = class _Uniform { - constructor(value) { - this.value = value; - } - clone() { - return new _Uniform(this.value.clone === void 0 ? this.value : this.value.clone()); - } -}; -var _id = 0; -var UniformsGroup = class extends EventDispatcher { - constructor() { - super(); - this.isUniformsGroup = true; - Object.defineProperty(this, "id", { value: _id++ }); - this.name = ""; - this.usage = StaticDrawUsage; - this.uniforms = []; - } - add(uniform) { - this.uniforms.push(uniform); - return this; - } - remove(uniform) { - const index = this.uniforms.indexOf(uniform); - if (index !== -1) - this.uniforms.splice(index, 1); - return this; - } - setName(name) { - this.name = name; - return this; - } - setUsage(value) { - this.usage = value; - return this; - } - dispose() { - this.dispatchEvent({ type: "dispose" }); - return this; - } - copy(source) { - this.name = source.name; - this.usage = source.usage; - const uniformsSource = source.uniforms; - this.uniforms.length = 0; - for (let i = 0, l = uniformsSource.length; i < l; i++) { - this.uniforms.push(uniformsSource[i].clone()); - } - return this; - } - clone() { - return new this.constructor().copy(this); - } -}; -var InstancedInterleavedBuffer = class extends InterleavedBuffer { - constructor(array, stride, meshPerAttribute = 1) { - super(array, stride); - this.isInstancedInterleavedBuffer = true; - this.meshPerAttribute = meshPerAttribute; - } - copy(source) { - super.copy(source); - this.meshPerAttribute = source.meshPerAttribute; - return this; - } - clone(data) { - const ib = super.clone(data); - ib.meshPerAttribute = this.meshPerAttribute; - return ib; - } - toJSON(data) { - const json = super.toJSON(data); - json.isInstancedInterleavedBuffer = true; - json.meshPerAttribute = this.meshPerAttribute; - return json; - } -}; -var GLBufferAttribute = class { - constructor(buffer, type, itemSize, elementSize, count) { - this.isGLBufferAttribute = true; - this.name = ""; - this.buffer = buffer; - this.type = type; - this.itemSize = itemSize; - this.elementSize = elementSize; - this.count = count; - this.version = 0; - } - set needsUpdate(value) { - if (value === true) - this.version++; - } - setBuffer(buffer) { - this.buffer = buffer; - return this; - } - setType(type, elementSize) { - this.type = type; - this.elementSize = elementSize; - return this; - } - setItemSize(itemSize) { - this.itemSize = itemSize; - return this; - } - setCount(count) { - this.count = count; - return this; - } -}; -var Raycaster = class { - constructor(origin, direction, near = 0, far = Infinity) { - this.ray = new Ray(origin, direction); - this.near = near; - this.far = far; - this.camera = null; - this.layers = new Layers(); - this.params = { - Mesh: {}, - Line: { threshold: 1 }, - LOD: {}, - Points: { threshold: 1 }, - Sprite: {} - }; - } - set(origin, direction) { - this.ray.set(origin, direction); - } - setFromCamera(coords, camera) { - if (camera.isPerspectiveCamera) { - this.ray.origin.setFromMatrixPosition(camera.matrixWorld); - this.ray.direction.set(coords.x, coords.y, 0.5).unproject(camera).sub(this.ray.origin).normalize(); - this.camera = camera; - } else if (camera.isOrthographicCamera) { - this.ray.origin.set(coords.x, coords.y, (camera.near + camera.far) / (camera.near - camera.far)).unproject(camera); - this.ray.direction.set(0, 0, -1).transformDirection(camera.matrixWorld); - this.camera = camera; - } else { - console.error("THREE.Raycaster: Unsupported camera type: " + camera.type); - } - } - intersectObject(object, recursive = true, intersects2 = []) { - intersectObject(object, this, intersects2, recursive); - intersects2.sort(ascSort); - return intersects2; - } - intersectObjects(objects, recursive = true, intersects2 = []) { - for (let i = 0, l = objects.length; i < l; i++) { - intersectObject(objects[i], this, intersects2, recursive); - } - intersects2.sort(ascSort); - return intersects2; - } -}; -function ascSort(a, b) { - return a.distance - b.distance; -} -function intersectObject(object, raycaster, intersects2, recursive) { - if (object.layers.test(raycaster.layers)) { - object.raycast(raycaster, intersects2); - } - if (recursive === true) { - const children = object.children; - for (let i = 0, l = children.length; i < l; i++) { - intersectObject(children[i], raycaster, intersects2, true); - } - } -} -var Spherical = class { - constructor(radius = 1, phi = 0, theta = 0) { - this.radius = radius; - this.phi = phi; - this.theta = theta; - return this; - } - set(radius, phi, theta) { - this.radius = radius; - this.phi = phi; - this.theta = theta; - return this; - } - copy(other) { - this.radius = other.radius; - this.phi = other.phi; - this.theta = other.theta; - return this; - } - // restrict phi to be between EPS and PI-EPS - makeSafe() { - const EPS = 1e-6; - this.phi = Math.max(EPS, Math.min(Math.PI - EPS, this.phi)); - return this; - } - setFromVector3(v) { - return this.setFromCartesianCoords(v.x, v.y, v.z); - } - setFromCartesianCoords(x, y, z) { - this.radius = Math.sqrt(x * x + y * y + z * z); - if (this.radius === 0) { - this.theta = 0; - this.phi = 0; - } else { - this.theta = Math.atan2(x, z); - this.phi = Math.acos(clamp(y / this.radius, -1, 1)); - } - return this; - } - clone() { - return new this.constructor().copy(this); - } -}; -var Cylindrical = class { - constructor(radius = 1, theta = 0, y = 0) { - this.radius = radius; - this.theta = theta; - this.y = y; - return this; - } - set(radius, theta, y) { - this.radius = radius; - this.theta = theta; - this.y = y; - return this; - } - copy(other) { - this.radius = other.radius; - this.theta = other.theta; - this.y = other.y; - return this; - } - setFromVector3(v) { - return this.setFromCartesianCoords(v.x, v.y, v.z); - } - setFromCartesianCoords(x, y, z) { - this.radius = Math.sqrt(x * x + z * z); - this.theta = Math.atan2(x, z); - this.y = y; - return this; - } - clone() { - return new this.constructor().copy(this); - } -}; -var _vector$4 = new Vector2(); -var Box2 = class { - constructor(min = new Vector2(Infinity, Infinity), max = new Vector2(-Infinity, -Infinity)) { - this.isBox2 = true; - this.min = min; - this.max = max; - } - set(min, max) { - this.min.copy(min); - this.max.copy(max); - return this; - } - setFromPoints(points) { - this.makeEmpty(); - for (let i = 0, il = points.length; i < il; i++) { - this.expandByPoint(points[i]); - } - return this; - } - setFromCenterAndSize(center, size) { - const halfSize = _vector$4.copy(size).multiplyScalar(0.5); - this.min.copy(center).sub(halfSize); - this.max.copy(center).add(halfSize); - return this; - } - clone() { - return new this.constructor().copy(this); - } - copy(box) { - this.min.copy(box.min); - this.max.copy(box.max); - return this; - } - makeEmpty() { - this.min.x = this.min.y = Infinity; - this.max.x = this.max.y = -Infinity; - return this; - } - isEmpty() { - return this.max.x < this.min.x || this.max.y < this.min.y; - } - getCenter(target) { - return this.isEmpty() ? target.set(0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5); - } - getSize(target) { - return this.isEmpty() ? target.set(0, 0) : target.subVectors(this.max, this.min); - } - expandByPoint(point) { - this.min.min(point); - this.max.max(point); - return this; - } - expandByVector(vector) { - this.min.sub(vector); - this.max.add(vector); - return this; - } - expandByScalar(scalar) { - this.min.addScalar(-scalar); - this.max.addScalar(scalar); - return this; - } - containsPoint(point) { - return point.x < this.min.x || point.x > this.max.x || point.y < this.min.y || point.y > this.max.y ? false : true; - } - containsBox(box) { - return this.min.x <= box.min.x && box.max.x <= this.max.x && this.min.y <= box.min.y && box.max.y <= this.max.y; - } - getParameter(point, target) { - return target.set( - (point.x - this.min.x) / (this.max.x - this.min.x), - (point.y - this.min.y) / (this.max.y - this.min.y) - ); - } - intersectsBox(box) { - return box.max.x < this.min.x || box.min.x > this.max.x || box.max.y < this.min.y || box.min.y > this.max.y ? false : true; - } - clampPoint(point, target) { - return target.copy(point).clamp(this.min, this.max); - } - distanceToPoint(point) { - return this.clampPoint(point, _vector$4).distanceTo(point); - } - intersect(box) { - this.min.max(box.min); - this.max.min(box.max); - if (this.isEmpty()) - this.makeEmpty(); - return this; - } - union(box) { - this.min.min(box.min); - this.max.max(box.max); - return this; - } - translate(offset) { - this.min.add(offset); - this.max.add(offset); - return this; - } - equals(box) { - return box.min.equals(this.min) && box.max.equals(this.max); - } -}; -var _startP = new Vector3(); -var _startEnd = new Vector3(); -var Line3 = class { - constructor(start = new Vector3(), end = new Vector3()) { - this.start = start; - this.end = end; - } - set(start, end) { - this.start.copy(start); - this.end.copy(end); - return this; - } - copy(line) { - this.start.copy(line.start); - this.end.copy(line.end); - return this; - } - getCenter(target) { - return target.addVectors(this.start, this.end).multiplyScalar(0.5); - } - delta(target) { - return target.subVectors(this.end, this.start); - } - distanceSq() { - return this.start.distanceToSquared(this.end); - } - distance() { - return this.start.distanceTo(this.end); - } - at(t, target) { - return this.delta(target).multiplyScalar(t).add(this.start); - } - closestPointToPointParameter(point, clampToLine) { - _startP.subVectors(point, this.start); - _startEnd.subVectors(this.end, this.start); - const startEnd2 = _startEnd.dot(_startEnd); - const startEnd_startP = _startEnd.dot(_startP); - let t = startEnd_startP / startEnd2; - if (clampToLine) { - t = clamp(t, 0, 1); - } - return t; - } - closestPointToPoint(point, clampToLine, target) { - const t = this.closestPointToPointParameter(point, clampToLine); - return this.delta(target).multiplyScalar(t).add(this.start); - } - applyMatrix4(matrix) { - this.start.applyMatrix4(matrix); - this.end.applyMatrix4(matrix); - return this; - } - equals(line) { - return line.start.equals(this.start) && line.end.equals(this.end); - } - clone() { - return new this.constructor().copy(this); - } -}; -var _vector$3 = new Vector3(); -var SpotLightHelper = class extends Object3D { - constructor(light, color) { - super(); - this.light = light; - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - this.color = color; - this.type = "SpotLightHelper"; - const geometry = new BufferGeometry(); - const positions = [ - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - -1, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - -1, - 1 - ]; - for (let i = 0, j = 1, l = 32; i < l; i++, j++) { - const p1 = i / l * Math.PI * 2; - const p2 = j / l * Math.PI * 2; - positions.push( - Math.cos(p1), - Math.sin(p1), - 1, - Math.cos(p2), - Math.sin(p2), - 1 - ); - } - geometry.setAttribute("position", new Float32BufferAttribute(positions, 3)); - const material = new LineBasicMaterial({ fog: false, toneMapped: false }); - this.cone = new LineSegments(geometry, material); - this.add(this.cone); - this.update(); - } - dispose() { - this.cone.geometry.dispose(); - this.cone.material.dispose(); - } - update() { - this.light.updateWorldMatrix(true, false); - this.light.target.updateWorldMatrix(true, false); - const coneLength = this.light.distance ? this.light.distance : 1e3; - const coneWidth = coneLength * Math.tan(this.light.angle); - this.cone.scale.set(coneWidth, coneWidth, coneLength); - _vector$3.setFromMatrixPosition(this.light.target.matrixWorld); - this.cone.lookAt(_vector$3); - if (this.color !== void 0) { - this.cone.material.color.set(this.color); - } else { - this.cone.material.color.copy(this.light.color); - } - } -}; -var _vector$2 = new Vector3(); -var _boneMatrix = new Matrix4(); -var _matrixWorldInv = new Matrix4(); -var SkeletonHelper = class extends LineSegments { - constructor(object) { - const bones = getBoneList(object); - const geometry = new BufferGeometry(); - const vertices = []; - const colors = []; - const color1 = new Color(0, 0, 1); - const color2 = new Color(0, 1, 0); - for (let i = 0; i < bones.length; i++) { - const bone = bones[i]; - if (bone.parent && bone.parent.isBone) { - vertices.push(0, 0, 0); - vertices.push(0, 0, 0); - colors.push(color1.r, color1.g, color1.b); - colors.push(color2.r, color2.g, color2.b); - } - } - geometry.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - geometry.setAttribute("color", new Float32BufferAttribute(colors, 3)); - const material = new LineBasicMaterial({ vertexColors: true, depthTest: false, depthWrite: false, toneMapped: false, transparent: true }); - super(geometry, material); - this.isSkeletonHelper = true; - this.type = "SkeletonHelper"; - this.root = object; - this.bones = bones; - this.matrix = object.matrixWorld; - this.matrixAutoUpdate = false; - } - updateMatrixWorld(force) { - const bones = this.bones; - const geometry = this.geometry; - const position = geometry.getAttribute("position"); - _matrixWorldInv.copy(this.root.matrixWorld).invert(); - for (let i = 0, j = 0; i < bones.length; i++) { - const bone = bones[i]; - if (bone.parent && bone.parent.isBone) { - _boneMatrix.multiplyMatrices(_matrixWorldInv, bone.matrixWorld); - _vector$2.setFromMatrixPosition(_boneMatrix); - position.setXYZ(j, _vector$2.x, _vector$2.y, _vector$2.z); - _boneMatrix.multiplyMatrices(_matrixWorldInv, bone.parent.matrixWorld); - _vector$2.setFromMatrixPosition(_boneMatrix); - position.setXYZ(j + 1, _vector$2.x, _vector$2.y, _vector$2.z); - j += 2; - } - } - geometry.getAttribute("position").needsUpdate = true; - super.updateMatrixWorld(force); - } - dispose() { - this.geometry.dispose(); - this.material.dispose(); - } -}; -function getBoneList(object) { - const boneList = []; - if (object.isBone === true) { - boneList.push(object); - } - for (let i = 0; i < object.children.length; i++) { - boneList.push.apply(boneList, getBoneList(object.children[i])); - } - return boneList; -} -var PointLightHelper = class extends Mesh { - constructor(light, sphereSize, color) { - const geometry = new SphereGeometry(sphereSize, 4, 2); - const material = new MeshBasicMaterial({ wireframe: true, fog: false, toneMapped: false }); - super(geometry, material); - this.light = light; - this.color = color; - this.type = "PointLightHelper"; - this.matrix = this.light.matrixWorld; - this.matrixAutoUpdate = false; - this.update(); - } - dispose() { - this.geometry.dispose(); - this.material.dispose(); - } - update() { - this.light.updateWorldMatrix(true, false); - if (this.color !== void 0) { - this.material.color.set(this.color); - } else { - this.material.color.copy(this.light.color); - } - } -}; -var _vector$1 = new Vector3(); -var _color1 = new Color(); -var _color2 = new Color(); -var HemisphereLightHelper = class extends Object3D { - constructor(light, size, color) { - super(); - this.light = light; - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - this.color = color; - this.type = "HemisphereLightHelper"; - const geometry = new OctahedronGeometry(size); - geometry.rotateY(Math.PI * 0.5); - this.material = new MeshBasicMaterial({ wireframe: true, fog: false, toneMapped: false }); - if (this.color === void 0) - this.material.vertexColors = true; - const position = geometry.getAttribute("position"); - const colors = new Float32Array(position.count * 3); - geometry.setAttribute("color", new BufferAttribute(colors, 3)); - this.add(new Mesh(geometry, this.material)); - this.update(); - } - dispose() { - this.children[0].geometry.dispose(); - this.children[0].material.dispose(); - } - update() { - const mesh = this.children[0]; - if (this.color !== void 0) { - this.material.color.set(this.color); - } else { - const colors = mesh.geometry.getAttribute("color"); - _color1.copy(this.light.color); - _color2.copy(this.light.groundColor); - for (let i = 0, l = colors.count; i < l; i++) { - const color = i < l / 2 ? _color1 : _color2; - colors.setXYZ(i, color.r, color.g, color.b); - } - colors.needsUpdate = true; - } - this.light.updateWorldMatrix(true, false); - mesh.lookAt(_vector$1.setFromMatrixPosition(this.light.matrixWorld).negate()); - } -}; -var GridHelper = class extends LineSegments { - constructor(size = 10, divisions = 10, color1 = 4473924, color2 = 8947848) { - color1 = new Color(color1); - color2 = new Color(color2); - const center = divisions / 2; - const step = size / divisions; - const halfSize = size / 2; - const vertices = [], colors = []; - for (let i = 0, j = 0, k = -halfSize; i <= divisions; i++, k += step) { - vertices.push(-halfSize, 0, k, halfSize, 0, k); - vertices.push(k, 0, -halfSize, k, 0, halfSize); - const color = i === center ? color1 : color2; - color.toArray(colors, j); - j += 3; - color.toArray(colors, j); - j += 3; - color.toArray(colors, j); - j += 3; - color.toArray(colors, j); - j += 3; - } - const geometry = new BufferGeometry(); - geometry.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - geometry.setAttribute("color", new Float32BufferAttribute(colors, 3)); - const material = new LineBasicMaterial({ vertexColors: true, toneMapped: false }); - super(geometry, material); - this.type = "GridHelper"; - } - dispose() { - this.geometry.dispose(); - this.material.dispose(); - } -}; -var PolarGridHelper = class extends LineSegments { - constructor(radius = 10, sectors = 16, rings = 8, divisions = 64, color1 = 4473924, color2 = 8947848) { - color1 = new Color(color1); - color2 = new Color(color2); - const vertices = []; - const colors = []; - if (sectors > 1) { - for (let i = 0; i < sectors; i++) { - const v = i / sectors * (Math.PI * 2); - const x = Math.sin(v) * radius; - const z = Math.cos(v) * radius; - vertices.push(0, 0, 0); - vertices.push(x, 0, z); - const color = i & 1 ? color1 : color2; - colors.push(color.r, color.g, color.b); - colors.push(color.r, color.g, color.b); - } - } - for (let i = 0; i < rings; i++) { - const color = i & 1 ? color1 : color2; - const r = radius - radius / rings * i; - for (let j = 0; j < divisions; j++) { - let v = j / divisions * (Math.PI * 2); - let x = Math.sin(v) * r; - let z = Math.cos(v) * r; - vertices.push(x, 0, z); - colors.push(color.r, color.g, color.b); - v = (j + 1) / divisions * (Math.PI * 2); - x = Math.sin(v) * r; - z = Math.cos(v) * r; - vertices.push(x, 0, z); - colors.push(color.r, color.g, color.b); - } - } - const geometry = new BufferGeometry(); - geometry.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - geometry.setAttribute("color", new Float32BufferAttribute(colors, 3)); - const material = new LineBasicMaterial({ vertexColors: true, toneMapped: false }); - super(geometry, material); - this.type = "PolarGridHelper"; - } - dispose() { - this.geometry.dispose(); - this.material.dispose(); - } -}; -var _v1 = new Vector3(); -var _v2 = new Vector3(); -var _v3 = new Vector3(); -var DirectionalLightHelper = class extends Object3D { - constructor(light, size, color) { - super(); - this.light = light; - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - this.color = color; - this.type = "DirectionalLightHelper"; - if (size === void 0) - size = 1; - let geometry = new BufferGeometry(); - geometry.setAttribute("position", new Float32BufferAttribute([ - -size, - size, - 0, - size, - size, - 0, - size, - -size, - 0, - -size, - -size, - 0, - -size, - size, - 0 - ], 3)); - const material = new LineBasicMaterial({ fog: false, toneMapped: false }); - this.lightPlane = new Line(geometry, material); - this.add(this.lightPlane); - geometry = new BufferGeometry(); - geometry.setAttribute("position", new Float32BufferAttribute([0, 0, 0, 0, 0, 1], 3)); - this.targetLine = new Line(geometry, material); - this.add(this.targetLine); - this.update(); - } - dispose() { - this.lightPlane.geometry.dispose(); - this.lightPlane.material.dispose(); - this.targetLine.geometry.dispose(); - this.targetLine.material.dispose(); - } - update() { - this.light.updateWorldMatrix(true, false); - this.light.target.updateWorldMatrix(true, false); - _v1.setFromMatrixPosition(this.light.matrixWorld); - _v2.setFromMatrixPosition(this.light.target.matrixWorld); - _v3.subVectors(_v2, _v1); - this.lightPlane.lookAt(_v2); - if (this.color !== void 0) { - this.lightPlane.material.color.set(this.color); - this.targetLine.material.color.set(this.color); - } else { - this.lightPlane.material.color.copy(this.light.color); - this.targetLine.material.color.copy(this.light.color); - } - this.targetLine.lookAt(_v2); - this.targetLine.scale.z = _v3.length(); - } -}; -var _vector = new Vector3(); -var _camera = new Camera(); -var CameraHelper = class extends LineSegments { - constructor(camera) { - const geometry = new BufferGeometry(); - const material = new LineBasicMaterial({ color: 16777215, vertexColors: true, toneMapped: false }); - const vertices = []; - const colors = []; - const pointMap = {}; - addLine("n1", "n2"); - addLine("n2", "n4"); - addLine("n4", "n3"); - addLine("n3", "n1"); - addLine("f1", "f2"); - addLine("f2", "f4"); - addLine("f4", "f3"); - addLine("f3", "f1"); - addLine("n1", "f1"); - addLine("n2", "f2"); - addLine("n3", "f3"); - addLine("n4", "f4"); - addLine("p", "n1"); - addLine("p", "n2"); - addLine("p", "n3"); - addLine("p", "n4"); - addLine("u1", "u2"); - addLine("u2", "u3"); - addLine("u3", "u1"); - addLine("c", "t"); - addLine("p", "c"); - addLine("cn1", "cn2"); - addLine("cn3", "cn4"); - addLine("cf1", "cf2"); - addLine("cf3", "cf4"); - function addLine(a, b) { - addPoint(a); - addPoint(b); - } - function addPoint(id) { - vertices.push(0, 0, 0); - colors.push(0, 0, 0); - if (pointMap[id] === void 0) { - pointMap[id] = []; - } - pointMap[id].push(vertices.length / 3 - 1); - } - geometry.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - geometry.setAttribute("color", new Float32BufferAttribute(colors, 3)); - super(geometry, material); - this.type = "CameraHelper"; - this.camera = camera; - if (this.camera.updateProjectionMatrix) - this.camera.updateProjectionMatrix(); - this.matrix = camera.matrixWorld; - this.matrixAutoUpdate = false; - this.pointMap = pointMap; - this.update(); - const colorFrustum = new Color(16755200); - const colorCone = new Color(16711680); - const colorUp = new Color(43775); - const colorTarget = new Color(16777215); - const colorCross = new Color(3355443); - this.setColors(colorFrustum, colorCone, colorUp, colorTarget, colorCross); - } - setColors(frustum, cone, up, target, cross) { - const geometry = this.geometry; - const colorAttribute = geometry.getAttribute("color"); - colorAttribute.setXYZ(0, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(1, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(2, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(3, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(4, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(5, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(6, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(7, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(8, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(9, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(10, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(11, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(12, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(13, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(14, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(15, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(16, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(17, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(18, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(19, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(20, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(21, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(22, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(23, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(24, cone.r, cone.g, cone.b); - colorAttribute.setXYZ(25, cone.r, cone.g, cone.b); - colorAttribute.setXYZ(26, cone.r, cone.g, cone.b); - colorAttribute.setXYZ(27, cone.r, cone.g, cone.b); - colorAttribute.setXYZ(28, cone.r, cone.g, cone.b); - colorAttribute.setXYZ(29, cone.r, cone.g, cone.b); - colorAttribute.setXYZ(30, cone.r, cone.g, cone.b); - colorAttribute.setXYZ(31, cone.r, cone.g, cone.b); - colorAttribute.setXYZ(32, up.r, up.g, up.b); - colorAttribute.setXYZ(33, up.r, up.g, up.b); - colorAttribute.setXYZ(34, up.r, up.g, up.b); - colorAttribute.setXYZ(35, up.r, up.g, up.b); - colorAttribute.setXYZ(36, up.r, up.g, up.b); - colorAttribute.setXYZ(37, up.r, up.g, up.b); - colorAttribute.setXYZ(38, target.r, target.g, target.b); - colorAttribute.setXYZ(39, target.r, target.g, target.b); - colorAttribute.setXYZ(40, cross.r, cross.g, cross.b); - colorAttribute.setXYZ(41, cross.r, cross.g, cross.b); - colorAttribute.setXYZ(42, cross.r, cross.g, cross.b); - colorAttribute.setXYZ(43, cross.r, cross.g, cross.b); - colorAttribute.setXYZ(44, cross.r, cross.g, cross.b); - colorAttribute.setXYZ(45, cross.r, cross.g, cross.b); - colorAttribute.setXYZ(46, cross.r, cross.g, cross.b); - colorAttribute.setXYZ(47, cross.r, cross.g, cross.b); - colorAttribute.setXYZ(48, cross.r, cross.g, cross.b); - colorAttribute.setXYZ(49, cross.r, cross.g, cross.b); - colorAttribute.needsUpdate = true; - } - update() { - const geometry = this.geometry; - const pointMap = this.pointMap; - const w = 1, h = 1; - _camera.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse); - setPoint("c", pointMap, geometry, _camera, 0, 0, -1); - setPoint("t", pointMap, geometry, _camera, 0, 0, 1); - setPoint("n1", pointMap, geometry, _camera, -w, -h, -1); - setPoint("n2", pointMap, geometry, _camera, w, -h, -1); - setPoint("n3", pointMap, geometry, _camera, -w, h, -1); - setPoint("n4", pointMap, geometry, _camera, w, h, -1); - setPoint("f1", pointMap, geometry, _camera, -w, -h, 1); - setPoint("f2", pointMap, geometry, _camera, w, -h, 1); - setPoint("f3", pointMap, geometry, _camera, -w, h, 1); - setPoint("f4", pointMap, geometry, _camera, w, h, 1); - setPoint("u1", pointMap, geometry, _camera, w * 0.7, h * 1.1, -1); - setPoint("u2", pointMap, geometry, _camera, -w * 0.7, h * 1.1, -1); - setPoint("u3", pointMap, geometry, _camera, 0, h * 2, -1); - setPoint("cf1", pointMap, geometry, _camera, -w, 0, 1); - setPoint("cf2", pointMap, geometry, _camera, w, 0, 1); - setPoint("cf3", pointMap, geometry, _camera, 0, -h, 1); - setPoint("cf4", pointMap, geometry, _camera, 0, h, 1); - setPoint("cn1", pointMap, geometry, _camera, -w, 0, -1); - setPoint("cn2", pointMap, geometry, _camera, w, 0, -1); - setPoint("cn3", pointMap, geometry, _camera, 0, -h, -1); - setPoint("cn4", pointMap, geometry, _camera, 0, h, -1); - geometry.getAttribute("position").needsUpdate = true; - } - dispose() { - this.geometry.dispose(); - this.material.dispose(); - } -}; -function setPoint(point, pointMap, geometry, camera, x, y, z) { - _vector.set(x, y, z).unproject(camera); - const points = pointMap[point]; - if (points !== void 0) { - const position = geometry.getAttribute("position"); - for (let i = 0, l = points.length; i < l; i++) { - position.setXYZ(points[i], _vector.x, _vector.y, _vector.z); - } - } -} -var _box = new Box3(); -var BoxHelper = class extends LineSegments { - constructor(object, color = 16776960) { - const indices = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]); - const positions = new Float32Array(8 * 3); - const geometry = new BufferGeometry(); - geometry.setIndex(new BufferAttribute(indices, 1)); - geometry.setAttribute("position", new BufferAttribute(positions, 3)); - super(geometry, new LineBasicMaterial({ color, toneMapped: false })); - this.object = object; - this.type = "BoxHelper"; - this.matrixAutoUpdate = false; - this.update(); - } - update(object) { - if (object !== void 0) { - console.warn("THREE.BoxHelper: .update() has no longer arguments."); - } - if (this.object !== void 0) { - _box.setFromObject(this.object); - } - if (_box.isEmpty()) - return; - const min = _box.min; - const max = _box.max; - const position = this.geometry.attributes.position; - const array = position.array; - array[0] = max.x; - array[1] = max.y; - array[2] = max.z; - array[3] = min.x; - array[4] = max.y; - array[5] = max.z; - array[6] = min.x; - array[7] = min.y; - array[8] = max.z; - array[9] = max.x; - array[10] = min.y; - array[11] = max.z; - array[12] = max.x; - array[13] = max.y; - array[14] = min.z; - array[15] = min.x; - array[16] = max.y; - array[17] = min.z; - array[18] = min.x; - array[19] = min.y; - array[20] = min.z; - array[21] = max.x; - array[22] = min.y; - array[23] = min.z; - position.needsUpdate = true; - this.geometry.computeBoundingSphere(); - } - setFromObject(object) { - this.object = object; - this.update(); - return this; - } - copy(source, recursive) { - super.copy(source, recursive); - this.object = source.object; - return this; - } - dispose() { - this.geometry.dispose(); - this.material.dispose(); - } -}; -var Box3Helper = class extends LineSegments { - constructor(box, color = 16776960) { - const indices = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]); - const positions = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1]; - const geometry = new BufferGeometry(); - geometry.setIndex(new BufferAttribute(indices, 1)); - geometry.setAttribute("position", new Float32BufferAttribute(positions, 3)); - super(geometry, new LineBasicMaterial({ color, toneMapped: false })); - this.box = box; - this.type = "Box3Helper"; - this.geometry.computeBoundingSphere(); - } - updateMatrixWorld(force) { - const box = this.box; - if (box.isEmpty()) - return; - box.getCenter(this.position); - box.getSize(this.scale); - this.scale.multiplyScalar(0.5); - super.updateMatrixWorld(force); - } - dispose() { - this.geometry.dispose(); - this.material.dispose(); - } -}; -var PlaneHelper = class extends Line { - constructor(plane, size = 1, hex = 16776960) { - const color = hex; - const positions = [1, -1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0]; - const geometry = new BufferGeometry(); - geometry.setAttribute("position", new Float32BufferAttribute(positions, 3)); - geometry.computeBoundingSphere(); - super(geometry, new LineBasicMaterial({ color, toneMapped: false })); - this.type = "PlaneHelper"; - this.plane = plane; - this.size = size; - const positions2 = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0]; - const geometry2 = new BufferGeometry(); - geometry2.setAttribute("position", new Float32BufferAttribute(positions2, 3)); - geometry2.computeBoundingSphere(); - this.add(new Mesh(geometry2, new MeshBasicMaterial({ color, opacity: 0.2, transparent: true, depthWrite: false, toneMapped: false }))); - } - updateMatrixWorld(force) { - this.position.set(0, 0, 0); - this.scale.set(0.5 * this.size, 0.5 * this.size, 1); - this.lookAt(this.plane.normal); - this.translateZ(-this.plane.constant); - super.updateMatrixWorld(force); - } - dispose() { - this.geometry.dispose(); - this.material.dispose(); - this.children[0].geometry.dispose(); - this.children[0].material.dispose(); - } -}; -var _axis = new Vector3(); -var _lineGeometry; -var _coneGeometry; -var ArrowHelper = class extends Object3D { - // dir is assumed to be normalized - constructor(dir = new Vector3(0, 0, 1), origin = new Vector3(0, 0, 0), length = 1, color = 16776960, headLength = length * 0.2, headWidth = headLength * 0.2) { - super(); - this.type = "ArrowHelper"; - if (_lineGeometry === void 0) { - _lineGeometry = new BufferGeometry(); - _lineGeometry.setAttribute("position", new Float32BufferAttribute([0, 0, 0, 0, 1, 0], 3)); - _coneGeometry = new CylinderGeometry(0, 0.5, 1, 5, 1); - _coneGeometry.translate(0, -0.5, 0); - } - this.position.copy(origin); - this.line = new Line(_lineGeometry, new LineBasicMaterial({ color, toneMapped: false })); - this.line.matrixAutoUpdate = false; - this.add(this.line); - this.cone = new Mesh(_coneGeometry, new MeshBasicMaterial({ color, toneMapped: false })); - this.cone.matrixAutoUpdate = false; - this.add(this.cone); - this.setDirection(dir); - this.setLength(length, headLength, headWidth); - } - setDirection(dir) { - if (dir.y > 0.99999) { - this.quaternion.set(0, 0, 0, 1); - } else if (dir.y < -0.99999) { - this.quaternion.set(1, 0, 0, 0); - } else { - _axis.set(dir.z, 0, -dir.x).normalize(); - const radians = Math.acos(dir.y); - this.quaternion.setFromAxisAngle(_axis, radians); - } - } - setLength(length, headLength = length * 0.2, headWidth = headLength * 0.2) { - this.line.scale.set(1, Math.max(1e-4, length - headLength), 1); - this.line.updateMatrix(); - this.cone.scale.set(headWidth, headLength, headWidth); - this.cone.position.y = length; - this.cone.updateMatrix(); - } - setColor(color) { - this.line.material.color.set(color); - this.cone.material.color.set(color); - } - copy(source) { - super.copy(source, false); - this.line.copy(source.line); - this.cone.copy(source.cone); - return this; - } - dispose() { - this.line.geometry.dispose(); - this.line.material.dispose(); - this.cone.geometry.dispose(); - this.cone.material.dispose(); - } -}; -var AxesHelper = class extends LineSegments { - constructor(size = 1) { - const vertices = [ - 0, - 0, - 0, - size, - 0, - 0, - 0, - 0, - 0, - 0, - size, - 0, - 0, - 0, - 0, - 0, - 0, - size - ]; - const colors = [ - 1, - 0, - 0, - 1, - 0.6, - 0, - 0, - 1, - 0, - 0.6, - 1, - 0, - 0, - 0, - 1, - 0, - 0.6, - 1 - ]; - const geometry = new BufferGeometry(); - geometry.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - geometry.setAttribute("color", new Float32BufferAttribute(colors, 3)); - const material = new LineBasicMaterial({ vertexColors: true, toneMapped: false }); - super(geometry, material); - this.type = "AxesHelper"; - } - setColors(xAxisColor, yAxisColor, zAxisColor) { - const color = new Color(); - const array = this.geometry.attributes.color.array; - color.set(xAxisColor); - color.toArray(array, 0); - color.toArray(array, 3); - color.set(yAxisColor); - color.toArray(array, 6); - color.toArray(array, 9); - color.set(zAxisColor); - color.toArray(array, 12); - color.toArray(array, 15); - this.geometry.attributes.color.needsUpdate = true; - return this; - } - dispose() { - this.geometry.dispose(); - this.material.dispose(); - } -}; -var ShapePath = class { - constructor() { - this.type = "ShapePath"; - this.color = new Color(); - this.subPaths = []; - this.currentPath = null; - } - moveTo(x, y) { - this.currentPath = new Path(); - this.subPaths.push(this.currentPath); - this.currentPath.moveTo(x, y); - return this; - } - lineTo(x, y) { - this.currentPath.lineTo(x, y); - return this; - } - quadraticCurveTo(aCPx, aCPy, aX, aY) { - this.currentPath.quadraticCurveTo(aCPx, aCPy, aX, aY); - return this; - } - bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) { - this.currentPath.bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY); - return this; - } - splineThru(pts) { - this.currentPath.splineThru(pts); - return this; - } - toShapes(isCCW) { - function toShapesNoHoles(inSubpaths) { - const shapes2 = []; - for (let i = 0, l = inSubpaths.length; i < l; i++) { - const tmpPath2 = inSubpaths[i]; - const tmpShape2 = new Shape(); - tmpShape2.curves = tmpPath2.curves; - shapes2.push(tmpShape2); - } - return shapes2; - } - function isPointInsidePolygon(inPt, inPolygon) { - const polyLen = inPolygon.length; - let inside = false; - for (let p = polyLen - 1, q = 0; q < polyLen; p = q++) { - let edgeLowPt = inPolygon[p]; - let edgeHighPt = inPolygon[q]; - let edgeDx = edgeHighPt.x - edgeLowPt.x; - let edgeDy = edgeHighPt.y - edgeLowPt.y; - if (Math.abs(edgeDy) > Number.EPSILON) { - if (edgeDy < 0) { - edgeLowPt = inPolygon[q]; - edgeDx = -edgeDx; - edgeHighPt = inPolygon[p]; - edgeDy = -edgeDy; - } - if (inPt.y < edgeLowPt.y || inPt.y > edgeHighPt.y) - continue; - if (inPt.y === edgeLowPt.y) { - if (inPt.x === edgeLowPt.x) - return true; - } else { - const perpEdge = edgeDy * (inPt.x - edgeLowPt.x) - edgeDx * (inPt.y - edgeLowPt.y); - if (perpEdge === 0) - return true; - if (perpEdge < 0) - continue; - inside = !inside; - } - } else { - if (inPt.y !== edgeLowPt.y) - continue; - if (edgeHighPt.x <= inPt.x && inPt.x <= edgeLowPt.x || edgeLowPt.x <= inPt.x && inPt.x <= edgeHighPt.x) - return true; - } - } - return inside; - } - const isClockWise = ShapeUtils.isClockWise; - const subPaths = this.subPaths; - if (subPaths.length === 0) - return []; - let solid, tmpPath, tmpShape; - const shapes = []; - if (subPaths.length === 1) { - tmpPath = subPaths[0]; - tmpShape = new Shape(); - tmpShape.curves = tmpPath.curves; - shapes.push(tmpShape); - return shapes; - } - let holesFirst = !isClockWise(subPaths[0].getPoints()); - holesFirst = isCCW ? !holesFirst : holesFirst; - const betterShapeHoles = []; - const newShapes = []; - let newShapeHoles = []; - let mainIdx = 0; - let tmpPoints; - newShapes[mainIdx] = void 0; - newShapeHoles[mainIdx] = []; - for (let i = 0, l = subPaths.length; i < l; i++) { - tmpPath = subPaths[i]; - tmpPoints = tmpPath.getPoints(); - solid = isClockWise(tmpPoints); - solid = isCCW ? !solid : solid; - if (solid) { - if (!holesFirst && newShapes[mainIdx]) - mainIdx++; - newShapes[mainIdx] = { s: new Shape(), p: tmpPoints }; - newShapes[mainIdx].s.curves = tmpPath.curves; - if (holesFirst) - mainIdx++; - newShapeHoles[mainIdx] = []; - } else { - newShapeHoles[mainIdx].push({ h: tmpPath, p: tmpPoints[0] }); - } - } - if (!newShapes[0]) - return toShapesNoHoles(subPaths); - if (newShapes.length > 1) { - let ambiguous = false; - let toChange = 0; - for (let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++) { - betterShapeHoles[sIdx] = []; - } - for (let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++) { - const sho = newShapeHoles[sIdx]; - for (let hIdx = 0; hIdx < sho.length; hIdx++) { - const ho = sho[hIdx]; - let hole_unassigned = true; - for (let s2Idx = 0; s2Idx < newShapes.length; s2Idx++) { - if (isPointInsidePolygon(ho.p, newShapes[s2Idx].p)) { - if (sIdx !== s2Idx) - toChange++; - if (hole_unassigned) { - hole_unassigned = false; - betterShapeHoles[s2Idx].push(ho); - } else { - ambiguous = true; - } - } - } - if (hole_unassigned) { - betterShapeHoles[sIdx].push(ho); - } - } - } - if (toChange > 0 && ambiguous === false) { - newShapeHoles = betterShapeHoles; - } - } - let tmpHoles; - for (let i = 0, il = newShapes.length; i < il; i++) { - tmpShape = newShapes[i].s; - shapes.push(tmpShape); - tmpHoles = newShapeHoles[i]; - for (let j = 0, jl = tmpHoles.length; j < jl; j++) { - tmpShape.holes.push(tmpHoles[j].h); - } - } - return shapes; - } -}; -if (typeof __THREE_DEVTOOLS__ !== "undefined") { - __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", { detail: { - revision: REVISION - } })); -} -if (typeof window !== "undefined") { - if (window.__THREE__) { - console.warn("WARNING: Multiple instances of Three.js being imported."); - } else { - window.__THREE__ = REVISION; - } -} - -export { - REVISION, - MOUSE, - TOUCH, - CullFaceNone, - CullFaceBack, - CullFaceFront, - CullFaceFrontBack, - BasicShadowMap, - PCFShadowMap, - PCFSoftShadowMap, - VSMShadowMap, - FrontSide, - BackSide, - DoubleSide, - TwoPassDoubleSide, - NoBlending, - NormalBlending, - AdditiveBlending, - SubtractiveBlending, - MultiplyBlending, - CustomBlending, - AddEquation, - SubtractEquation, - ReverseSubtractEquation, - MinEquation, - MaxEquation, - ZeroFactor, - OneFactor, - SrcColorFactor, - OneMinusSrcColorFactor, - SrcAlphaFactor, - OneMinusSrcAlphaFactor, - DstAlphaFactor, - OneMinusDstAlphaFactor, - DstColorFactor, - OneMinusDstColorFactor, - SrcAlphaSaturateFactor, - ConstantColorFactor, - OneMinusConstantColorFactor, - ConstantAlphaFactor, - OneMinusConstantAlphaFactor, - NeverDepth, - AlwaysDepth, - LessDepth, - LessEqualDepth, - EqualDepth, - GreaterEqualDepth, - GreaterDepth, - NotEqualDepth, - MultiplyOperation, - MixOperation, - AddOperation, - NoToneMapping, - LinearToneMapping, - ReinhardToneMapping, - CineonToneMapping, - ACESFilmicToneMapping, - CustomToneMapping, - AttachedBindMode, - DetachedBindMode, - UVMapping, - CubeReflectionMapping, - CubeRefractionMapping, - EquirectangularReflectionMapping, - EquirectangularRefractionMapping, - CubeUVReflectionMapping, - RepeatWrapping, - ClampToEdgeWrapping, - MirroredRepeatWrapping, - NearestFilter, - NearestMipmapNearestFilter, - NearestMipMapNearestFilter, - NearestMipmapLinearFilter, - NearestMipMapLinearFilter, - LinearFilter, - LinearMipmapNearestFilter, - LinearMipMapNearestFilter, - LinearMipmapLinearFilter, - LinearMipMapLinearFilter, - UnsignedByteType, - ByteType, - ShortType, - UnsignedShortType, - IntType, - UnsignedIntType, - FloatType, - HalfFloatType, - UnsignedShort4444Type, - UnsignedShort5551Type, - UnsignedInt248Type, - AlphaFormat, - RGBAFormat, - LuminanceFormat, - LuminanceAlphaFormat, - DepthFormat, - DepthStencilFormat, - RedFormat, - RedIntegerFormat, - RGFormat, - RGIntegerFormat, - RGBAIntegerFormat, - RGB_S3TC_DXT1_Format, - RGBA_S3TC_DXT1_Format, - RGBA_S3TC_DXT3_Format, - RGBA_S3TC_DXT5_Format, - RGB_PVRTC_4BPPV1_Format, - RGB_PVRTC_2BPPV1_Format, - RGBA_PVRTC_4BPPV1_Format, - RGBA_PVRTC_2BPPV1_Format, - RGB_ETC1_Format, - RGB_ETC2_Format, - RGBA_ETC2_EAC_Format, - RGBA_ASTC_4x4_Format, - RGBA_ASTC_5x4_Format, - RGBA_ASTC_5x5_Format, - RGBA_ASTC_6x5_Format, - RGBA_ASTC_6x6_Format, - RGBA_ASTC_8x5_Format, - RGBA_ASTC_8x6_Format, - RGBA_ASTC_8x8_Format, - RGBA_ASTC_10x5_Format, - RGBA_ASTC_10x6_Format, - RGBA_ASTC_10x8_Format, - RGBA_ASTC_10x10_Format, - RGBA_ASTC_12x10_Format, - RGBA_ASTC_12x12_Format, - RGBA_BPTC_Format, - RGB_BPTC_SIGNED_Format, - RGB_BPTC_UNSIGNED_Format, - RED_RGTC1_Format, - SIGNED_RED_RGTC1_Format, - RED_GREEN_RGTC2_Format, - SIGNED_RED_GREEN_RGTC2_Format, - LoopOnce, - LoopRepeat, - LoopPingPong, - InterpolateDiscrete, - InterpolateLinear, - InterpolateSmooth, - ZeroCurvatureEnding, - ZeroSlopeEnding, - WrapAroundEnding, - NormalAnimationBlendMode, - AdditiveAnimationBlendMode, - TrianglesDrawMode, - TriangleStripDrawMode, - TriangleFanDrawMode, - LinearEncoding, - sRGBEncoding, - BasicDepthPacking, - RGBADepthPacking, - TangentSpaceNormalMap, - ObjectSpaceNormalMap, - NoColorSpace, - SRGBColorSpace, - LinearSRGBColorSpace, - DisplayP3ColorSpace, - LinearDisplayP3ColorSpace, - LinearTransfer, - SRGBTransfer, - Rec709Primaries, - P3Primaries, - ZeroStencilOp, - KeepStencilOp, - ReplaceStencilOp, - IncrementStencilOp, - DecrementStencilOp, - IncrementWrapStencilOp, - DecrementWrapStencilOp, - InvertStencilOp, - NeverStencilFunc, - LessStencilFunc, - EqualStencilFunc, - LessEqualStencilFunc, - GreaterStencilFunc, - NotEqualStencilFunc, - GreaterEqualStencilFunc, - AlwaysStencilFunc, - NeverCompare, - LessCompare, - EqualCompare, - LessEqualCompare, - GreaterCompare, - NotEqualCompare, - GreaterEqualCompare, - AlwaysCompare, - StaticDrawUsage, - DynamicDrawUsage, - StreamDrawUsage, - StaticReadUsage, - DynamicReadUsage, - StreamReadUsage, - StaticCopyUsage, - DynamicCopyUsage, - StreamCopyUsage, - GLSL1, - GLSL3, - _SRGBAFormat, - WebGLCoordinateSystem, - WebGPUCoordinateSystem, - EventDispatcher, - MathUtils, - Vector2, - Matrix3, - createCanvasElement, - ColorManagement, - ImageUtils, - Source, - Texture, - Vector4, - RenderTarget, - WebGLRenderTarget, - DataArrayTexture, - WebGLArrayRenderTarget, - Data3DTexture, - WebGL3DRenderTarget, - WebGLMultipleRenderTargets, - Quaternion, - Vector3, - Box3, - Sphere, - Ray, - Matrix4, - Euler, - Layers, - Object3D, - Triangle, - Color, - Material, - MeshBasicMaterial, - DataUtils, - BufferAttribute, - Int8BufferAttribute, - Uint8BufferAttribute, - Uint8ClampedBufferAttribute, - Int16BufferAttribute, - Uint16BufferAttribute, - Int32BufferAttribute, - Uint32BufferAttribute, - Float16BufferAttribute, - Float32BufferAttribute, - Float64BufferAttribute, - BufferGeometry, - Mesh, - BoxGeometry, - UniformsUtils, - ShaderMaterial, - Camera, - PerspectiveCamera, - CubeCamera, - CubeTexture, - WebGLCubeRenderTarget, - Plane, - Frustum, - PlaneGeometry, - ShaderChunk, - UniformsLib, - ShaderLib, - OrthographicCamera, - PMREMGenerator, - MeshDepthMaterial, - MeshDistanceMaterial, - WebGLUtils, - ArrayCamera, - Group, - DepthTexture, - WebGLRenderer, - WebGL1Renderer, - FogExp2, - Fog, - Scene, - InterleavedBuffer, - InterleavedBufferAttribute, - SpriteMaterial, - Sprite, - LOD, - SkinnedMesh, - Bone, - DataTexture, - Skeleton, - InstancedBufferAttribute, - InstancedMesh, - LineBasicMaterial, - Line, - LineSegments, - LineLoop, - PointsMaterial, - Points, - VideoTexture, - FramebufferTexture, - CompressedTexture, - CompressedArrayTexture, - CompressedCubeTexture, - CanvasTexture, - Curve, - EllipseCurve, - ArcCurve, - CatmullRomCurve3, - CubicBezierCurve, - CubicBezierCurve3, - LineCurve, - LineCurve3, - QuadraticBezierCurve, - QuadraticBezierCurve3, - SplineCurve, - CurvePath, - Path, - LatheGeometry, - CapsuleGeometry, - CircleGeometry, - CylinderGeometry, - ConeGeometry, - PolyhedronGeometry, - DodecahedronGeometry, - EdgesGeometry, - Shape, - ShapeUtils, - ExtrudeGeometry, - IcosahedronGeometry, - OctahedronGeometry, - RingGeometry, - ShapeGeometry, - SphereGeometry, - TetrahedronGeometry, - TorusGeometry, - TorusKnotGeometry, - TubeGeometry, - WireframeGeometry, - ShadowMaterial, - RawShaderMaterial, - MeshStandardMaterial, - MeshPhysicalMaterial, - MeshPhongMaterial, - MeshToonMaterial, - MeshNormalMaterial, - MeshLambertMaterial, - MeshMatcapMaterial, - LineDashedMaterial, - AnimationUtils, - Interpolant, - CubicInterpolant, - LinearInterpolant, - DiscreteInterpolant, - KeyframeTrack, - BooleanKeyframeTrack, - ColorKeyframeTrack, - NumberKeyframeTrack, - QuaternionLinearInterpolant, - QuaternionKeyframeTrack, - StringKeyframeTrack, - VectorKeyframeTrack, - AnimationClip, - Cache, - LoadingManager, - DefaultLoadingManager, - Loader, - FileLoader, - AnimationLoader, - CompressedTextureLoader, - ImageLoader, - CubeTextureLoader, - DataTextureLoader, - TextureLoader, - Light, - HemisphereLight, - SpotLight, - PointLight, - DirectionalLight, - AmbientLight, - RectAreaLight, - SphericalHarmonics3, - LightProbe, - MaterialLoader, - LoaderUtils, - InstancedBufferGeometry, - BufferGeometryLoader, - ObjectLoader, - ImageBitmapLoader, - AudioContext, - AudioLoader, - StereoCamera, - Clock, - AudioListener, - Audio, - PositionalAudio, - AudioAnalyser, - PropertyMixer, - PropertyBinding, - AnimationObjectGroup, - AnimationAction, - AnimationMixer, - Uniform, - UniformsGroup, - InstancedInterleavedBuffer, - GLBufferAttribute, - Raycaster, - Spherical, - Cylindrical, - Box2, - Line3, - SpotLightHelper, - SkeletonHelper, - PointLightHelper, - HemisphereLightHelper, - GridHelper, - PolarGridHelper, - DirectionalLightHelper, - CameraHelper, - BoxHelper, - Box3Helper, - PlaneHelper, - ArrowHelper, - AxesHelper, - ShapePath -}; -/*! Bundled license information: - -three/build/three.module.js: - (** - * @license - * Copyright 2010-2023 Three.js Authors - * SPDX-License-Identifier: MIT - *) -*/ -//# sourceMappingURL=chunk-6P5T4EWA.js.map diff --git a/node_modules/.vite/deps/chunk-6P5T4EWA.js.map b/node_modules/.vite/deps/chunk-6P5T4EWA.js.map deleted file mode 100644 index c0a13ce0..00000000 --- a/node_modules/.vite/deps/chunk-6P5T4EWA.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../../three/build/three.module.js"], - "sourcesContent": ["/**\n * @license\n * Copyright 2010-2023 Three.js Authors\n * SPDX-License-Identifier: MIT\n */\nconst REVISION = '158';\n\nconst MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };\nconst TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };\nconst CullFaceNone = 0;\nconst CullFaceBack = 1;\nconst CullFaceFront = 2;\nconst CullFaceFrontBack = 3;\nconst BasicShadowMap = 0;\nconst PCFShadowMap = 1;\nconst PCFSoftShadowMap = 2;\nconst VSMShadowMap = 3;\nconst FrontSide = 0;\nconst BackSide = 1;\nconst DoubleSide = 2;\nconst TwoPassDoubleSide = 2; // r149\nconst NoBlending = 0;\nconst NormalBlending = 1;\nconst AdditiveBlending = 2;\nconst SubtractiveBlending = 3;\nconst MultiplyBlending = 4;\nconst CustomBlending = 5;\nconst AddEquation = 100;\nconst SubtractEquation = 101;\nconst ReverseSubtractEquation = 102;\nconst MinEquation = 103;\nconst MaxEquation = 104;\nconst ZeroFactor = 200;\nconst OneFactor = 201;\nconst SrcColorFactor = 202;\nconst OneMinusSrcColorFactor = 203;\nconst SrcAlphaFactor = 204;\nconst OneMinusSrcAlphaFactor = 205;\nconst DstAlphaFactor = 206;\nconst OneMinusDstAlphaFactor = 207;\nconst DstColorFactor = 208;\nconst OneMinusDstColorFactor = 209;\nconst SrcAlphaSaturateFactor = 210;\nconst ConstantColorFactor = 211;\nconst OneMinusConstantColorFactor = 212;\nconst ConstantAlphaFactor = 213;\nconst OneMinusConstantAlphaFactor = 214;\nconst NeverDepth = 0;\nconst AlwaysDepth = 1;\nconst LessDepth = 2;\nconst LessEqualDepth = 3;\nconst EqualDepth = 4;\nconst GreaterEqualDepth = 5;\nconst GreaterDepth = 6;\nconst NotEqualDepth = 7;\nconst MultiplyOperation = 0;\nconst MixOperation = 1;\nconst AddOperation = 2;\nconst NoToneMapping = 0;\nconst LinearToneMapping = 1;\nconst ReinhardToneMapping = 2;\nconst CineonToneMapping = 3;\nconst ACESFilmicToneMapping = 4;\nconst CustomToneMapping = 5;\nconst AttachedBindMode = 'attached';\nconst DetachedBindMode = 'detached';\n\nconst UVMapping = 300;\nconst CubeReflectionMapping = 301;\nconst CubeRefractionMapping = 302;\nconst EquirectangularReflectionMapping = 303;\nconst EquirectangularRefractionMapping = 304;\nconst CubeUVReflectionMapping = 306;\nconst RepeatWrapping = 1000;\nconst ClampToEdgeWrapping = 1001;\nconst MirroredRepeatWrapping = 1002;\nconst NearestFilter = 1003;\nconst NearestMipmapNearestFilter = 1004;\nconst NearestMipMapNearestFilter = 1004;\nconst NearestMipmapLinearFilter = 1005;\nconst NearestMipMapLinearFilter = 1005;\nconst LinearFilter = 1006;\nconst LinearMipmapNearestFilter = 1007;\nconst LinearMipMapNearestFilter = 1007;\nconst LinearMipmapLinearFilter = 1008;\nconst LinearMipMapLinearFilter = 1008;\nconst UnsignedByteType = 1009;\nconst ByteType = 1010;\nconst ShortType = 1011;\nconst UnsignedShortType = 1012;\nconst IntType = 1013;\nconst UnsignedIntType = 1014;\nconst FloatType = 1015;\nconst HalfFloatType = 1016;\nconst UnsignedShort4444Type = 1017;\nconst UnsignedShort5551Type = 1018;\nconst UnsignedInt248Type = 1020;\nconst AlphaFormat = 1021;\nconst RGBAFormat = 1023;\nconst LuminanceFormat = 1024;\nconst LuminanceAlphaFormat = 1025;\nconst DepthFormat = 1026;\nconst DepthStencilFormat = 1027;\nconst RedFormat = 1028;\nconst RedIntegerFormat = 1029;\nconst RGFormat = 1030;\nconst RGIntegerFormat = 1031;\nconst RGBAIntegerFormat = 1033;\n\nconst RGB_S3TC_DXT1_Format = 33776;\nconst RGBA_S3TC_DXT1_Format = 33777;\nconst RGBA_S3TC_DXT3_Format = 33778;\nconst RGBA_S3TC_DXT5_Format = 33779;\nconst RGB_PVRTC_4BPPV1_Format = 35840;\nconst RGB_PVRTC_2BPPV1_Format = 35841;\nconst RGBA_PVRTC_4BPPV1_Format = 35842;\nconst RGBA_PVRTC_2BPPV1_Format = 35843;\nconst RGB_ETC1_Format = 36196;\nconst RGB_ETC2_Format = 37492;\nconst RGBA_ETC2_EAC_Format = 37496;\nconst RGBA_ASTC_4x4_Format = 37808;\nconst RGBA_ASTC_5x4_Format = 37809;\nconst RGBA_ASTC_5x5_Format = 37810;\nconst RGBA_ASTC_6x5_Format = 37811;\nconst RGBA_ASTC_6x6_Format = 37812;\nconst RGBA_ASTC_8x5_Format = 37813;\nconst RGBA_ASTC_8x6_Format = 37814;\nconst RGBA_ASTC_8x8_Format = 37815;\nconst RGBA_ASTC_10x5_Format = 37816;\nconst RGBA_ASTC_10x6_Format = 37817;\nconst RGBA_ASTC_10x8_Format = 37818;\nconst RGBA_ASTC_10x10_Format = 37819;\nconst RGBA_ASTC_12x10_Format = 37820;\nconst RGBA_ASTC_12x12_Format = 37821;\nconst RGBA_BPTC_Format = 36492;\nconst RGB_BPTC_SIGNED_Format = 36494;\nconst RGB_BPTC_UNSIGNED_Format = 36495;\nconst RED_RGTC1_Format = 36283;\nconst SIGNED_RED_RGTC1_Format = 36284;\nconst RED_GREEN_RGTC2_Format = 36285;\nconst SIGNED_RED_GREEN_RGTC2_Format = 36286;\nconst LoopOnce = 2200;\nconst LoopRepeat = 2201;\nconst LoopPingPong = 2202;\nconst InterpolateDiscrete = 2300;\nconst InterpolateLinear = 2301;\nconst InterpolateSmooth = 2302;\nconst ZeroCurvatureEnding = 2400;\nconst ZeroSlopeEnding = 2401;\nconst WrapAroundEnding = 2402;\nconst NormalAnimationBlendMode = 2500;\nconst AdditiveAnimationBlendMode = 2501;\nconst TrianglesDrawMode = 0;\nconst TriangleStripDrawMode = 1;\nconst TriangleFanDrawMode = 2;\n/** @deprecated Use LinearSRGBColorSpace or NoColorSpace in three.js r152+. */\nconst LinearEncoding = 3000;\n/** @deprecated Use SRGBColorSpace in three.js r152+. */\nconst sRGBEncoding = 3001;\nconst BasicDepthPacking = 3200;\nconst RGBADepthPacking = 3201;\nconst TangentSpaceNormalMap = 0;\nconst ObjectSpaceNormalMap = 1;\n\n// Color space string identifiers, matching CSS Color Module Level 4 and WebGPU names where available.\nconst NoColorSpace = '';\nconst SRGBColorSpace = 'srgb';\nconst LinearSRGBColorSpace = 'srgb-linear';\nconst DisplayP3ColorSpace = 'display-p3';\nconst LinearDisplayP3ColorSpace = 'display-p3-linear';\n\nconst LinearTransfer = 'linear';\nconst SRGBTransfer = 'srgb';\n\nconst Rec709Primaries = 'rec709';\nconst P3Primaries = 'p3';\n\nconst ZeroStencilOp = 0;\nconst KeepStencilOp = 7680;\nconst ReplaceStencilOp = 7681;\nconst IncrementStencilOp = 7682;\nconst DecrementStencilOp = 7683;\nconst IncrementWrapStencilOp = 34055;\nconst DecrementWrapStencilOp = 34056;\nconst InvertStencilOp = 5386;\n\nconst NeverStencilFunc = 512;\nconst LessStencilFunc = 513;\nconst EqualStencilFunc = 514;\nconst LessEqualStencilFunc = 515;\nconst GreaterStencilFunc = 516;\nconst NotEqualStencilFunc = 517;\nconst GreaterEqualStencilFunc = 518;\nconst AlwaysStencilFunc = 519;\n\nconst NeverCompare = 512;\nconst LessCompare = 513;\nconst EqualCompare = 514;\nconst LessEqualCompare = 515;\nconst GreaterCompare = 516;\nconst NotEqualCompare = 517;\nconst GreaterEqualCompare = 518;\nconst AlwaysCompare = 519;\n\nconst StaticDrawUsage = 35044;\nconst DynamicDrawUsage = 35048;\nconst StreamDrawUsage = 35040;\nconst StaticReadUsage = 35045;\nconst DynamicReadUsage = 35049;\nconst StreamReadUsage = 35041;\nconst StaticCopyUsage = 35046;\nconst DynamicCopyUsage = 35050;\nconst StreamCopyUsage = 35042;\n\nconst GLSL1 = '100';\nconst GLSL3 = '300 es';\n\nconst _SRGBAFormat = 1035; // fallback for WebGL 1\n\nconst WebGLCoordinateSystem = 2000;\nconst WebGPUCoordinateSystem = 2001;\n\n/**\n * https://github.com/mrdoob/eventdispatcher.js/\n */\n\nclass EventDispatcher {\n\n\taddEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) this._listeners = {};\n\n\t\tconst listeners = this._listeners;\n\n\t\tif ( listeners[ type ] === undefined ) {\n\n\t\t\tlisteners[ type ] = [];\n\n\t\t}\n\n\t\tif ( listeners[ type ].indexOf( listener ) === - 1 ) {\n\n\t\t\tlisteners[ type ].push( listener );\n\n\t\t}\n\n\t}\n\n\thasEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) return false;\n\n\t\tconst listeners = this._listeners;\n\n\t\treturn listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1;\n\n\t}\n\n\tremoveEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) return;\n\n\t\tconst listeners = this._listeners;\n\t\tconst listenerArray = listeners[ type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tconst index = listenerArray.indexOf( listener );\n\n\t\t\tif ( index !== - 1 ) {\n\n\t\t\t\tlistenerArray.splice( index, 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tdispatchEvent( event ) {\n\n\t\tif ( this._listeners === undefined ) return;\n\n\t\tconst listeners = this._listeners;\n\t\tconst listenerArray = listeners[ event.type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tevent.target = this;\n\n\t\t\t// Make a copy, in case listeners are removed while iterating.\n\t\t\tconst array = listenerArray.slice( 0 );\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tarray[ i ].call( this, event );\n\n\t\t\t}\n\n\t\t\tevent.target = null;\n\n\t\t}\n\n\t}\n\n}\n\nconst _lut = [ '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '0a', '0b', '0c', '0d', '0e', '0f', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '1a', '1b', '1c', '1d', '1e', '1f', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '2a', '2b', '2c', '2d', '2e', '2f', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '3a', '3b', '3c', '3d', '3e', '3f', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '4a', '4b', '4c', '4d', '4e', '4f', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '5a', '5b', '5c', '5d', '5e', '5f', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '6a', '6b', '6c', '6d', '6e', '6f', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '7a', '7b', '7c', '7d', '7e', '7f', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '8a', '8b', '8c', '8d', '8e', '8f', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '9a', '9b', '9c', '9d', '9e', '9f', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'aa', 'ab', 'ac', 'ad', 'ae', 'af', 'b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8', 'b9', 'ba', 'bb', 'bc', 'bd', 'be', 'bf', 'c0', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9', 'ca', 'cb', 'cc', 'cd', 'ce', 'cf', 'd0', 'd1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'd9', 'da', 'db', 'dc', 'dd', 'de', 'df', 'e0', 'e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8', 'e9', 'ea', 'eb', 'ec', 'ed', 'ee', 'ef', 'f0', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'fa', 'fb', 'fc', 'fd', 'fe', 'ff' ];\n\nlet _seed = 1234567;\n\n\nconst DEG2RAD = Math.PI / 180;\nconst RAD2DEG = 180 / Math.PI;\n\n// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136\nfunction generateUUID() {\n\n\tconst d0 = Math.random() * 0xffffffff | 0;\n\tconst d1 = Math.random() * 0xffffffff | 0;\n\tconst d2 = Math.random() * 0xffffffff | 0;\n\tconst d3 = Math.random() * 0xffffffff | 0;\n\tconst uuid = _lut[ d0 & 0xff ] + _lut[ d0 >> 8 & 0xff ] + _lut[ d0 >> 16 & 0xff ] + _lut[ d0 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d1 & 0xff ] + _lut[ d1 >> 8 & 0xff ] + '-' + _lut[ d1 >> 16 & 0x0f | 0x40 ] + _lut[ d1 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d2 & 0x3f | 0x80 ] + _lut[ d2 >> 8 & 0xff ] + '-' + _lut[ d2 >> 16 & 0xff ] + _lut[ d2 >> 24 & 0xff ] +\n\t\t\t_lut[ d3 & 0xff ] + _lut[ d3 >> 8 & 0xff ] + _lut[ d3 >> 16 & 0xff ] + _lut[ d3 >> 24 & 0xff ];\n\n\t// .toLowerCase() here flattens concatenated strings to save heap memory space.\n\treturn uuid.toLowerCase();\n\n}\n\nfunction clamp( value, min, max ) {\n\n\treturn Math.max( min, Math.min( max, value ) );\n\n}\n\n// compute euclidean modulo of m % n\n// https://en.wikipedia.org/wiki/Modulo_operation\nfunction euclideanModulo( n, m ) {\n\n\treturn ( ( n % m ) + m ) % m;\n\n}\n\n// Linear mapping from range to range \nfunction mapLinear( x, a1, a2, b1, b2 ) {\n\n\treturn b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );\n\n}\n\n// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/\nfunction inverseLerp( x, y, value ) {\n\n\tif ( x !== y ) {\n\n\t\treturn ( value - x ) / ( y - x );\n\n\t} else {\n\n\t\treturn 0;\n\n\t}\n\n}\n\n// https://en.wikipedia.org/wiki/Linear_interpolation\nfunction lerp( x, y, t ) {\n\n\treturn ( 1 - t ) * x + t * y;\n\n}\n\n// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/\nfunction damp( x, y, lambda, dt ) {\n\n\treturn lerp( x, y, 1 - Math.exp( - lambda * dt ) );\n\n}\n\n// https://www.desmos.com/calculator/vcsjnyz7x4\nfunction pingpong( x, length = 1 ) {\n\n\treturn length - Math.abs( euclideanModulo( x, length * 2 ) - length );\n\n}\n\n// http://en.wikipedia.org/wiki/Smoothstep\nfunction smoothstep( x, min, max ) {\n\n\tif ( x <= min ) return 0;\n\tif ( x >= max ) return 1;\n\n\tx = ( x - min ) / ( max - min );\n\n\treturn x * x * ( 3 - 2 * x );\n\n}\n\nfunction smootherstep( x, min, max ) {\n\n\tif ( x <= min ) return 0;\n\tif ( x >= max ) return 1;\n\n\tx = ( x - min ) / ( max - min );\n\n\treturn x * x * x * ( x * ( x * 6 - 15 ) + 10 );\n\n}\n\n// Random integer from interval\nfunction randInt( low, high ) {\n\n\treturn low + Math.floor( Math.random() * ( high - low + 1 ) );\n\n}\n\n// Random float from interval\nfunction randFloat( low, high ) {\n\n\treturn low + Math.random() * ( high - low );\n\n}\n\n// Random float from <-range/2, range/2> interval\nfunction randFloatSpread( range ) {\n\n\treturn range * ( 0.5 - Math.random() );\n\n}\n\n// Deterministic pseudo-random float in the interval [ 0, 1 ]\nfunction seededRandom( s ) {\n\n\tif ( s !== undefined ) _seed = s;\n\n\t// Mulberry32 generator\n\n\tlet t = _seed += 0x6D2B79F5;\n\n\tt = Math.imul( t ^ t >>> 15, t | 1 );\n\n\tt ^= t + Math.imul( t ^ t >>> 7, t | 61 );\n\n\treturn ( ( t ^ t >>> 14 ) >>> 0 ) / 4294967296;\n\n}\n\nfunction degToRad( degrees ) {\n\n\treturn degrees * DEG2RAD;\n\n}\n\nfunction radToDeg( radians ) {\n\n\treturn radians * RAD2DEG;\n\n}\n\nfunction isPowerOfTwo( value ) {\n\n\treturn ( value & ( value - 1 ) ) === 0 && value !== 0;\n\n}\n\nfunction ceilPowerOfTwo( value ) {\n\n\treturn Math.pow( 2, Math.ceil( Math.log( value ) / Math.LN2 ) );\n\n}\n\nfunction floorPowerOfTwo( value ) {\n\n\treturn Math.pow( 2, Math.floor( Math.log( value ) / Math.LN2 ) );\n\n}\n\nfunction setQuaternionFromProperEuler( q, a, b, c, order ) {\n\n\t// Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles\n\n\t// rotations are applied to the axes in the order specified by 'order'\n\t// rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'\n\t// angles are in radians\n\n\tconst cos = Math.cos;\n\tconst sin = Math.sin;\n\n\tconst c2 = cos( b / 2 );\n\tconst s2 = sin( b / 2 );\n\n\tconst c13 = cos( ( a + c ) / 2 );\n\tconst s13 = sin( ( a + c ) / 2 );\n\n\tconst c1_3 = cos( ( a - c ) / 2 );\n\tconst s1_3 = sin( ( a - c ) / 2 );\n\n\tconst c3_1 = cos( ( c - a ) / 2 );\n\tconst s3_1 = sin( ( c - a ) / 2 );\n\n\tswitch ( order ) {\n\n\t\tcase 'XYX':\n\t\t\tq.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'YZY':\n\t\t\tq.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'ZXZ':\n\t\t\tq.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'XZX':\n\t\t\tq.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'YXY':\n\t\t\tq.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'ZYZ':\n\t\t\tq.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order );\n\n\t}\n\n}\n\nfunction denormalize( value, array ) {\n\n\tswitch ( array.constructor ) {\n\n\t\tcase Float32Array:\n\n\t\t\treturn value;\n\n\t\tcase Uint32Array:\n\n\t\t\treturn value / 4294967295.0;\n\n\t\tcase Uint16Array:\n\n\t\t\treturn value / 65535.0;\n\n\t\tcase Uint8Array:\n\n\t\t\treturn value / 255.0;\n\n\t\tcase Int32Array:\n\n\t\t\treturn Math.max( value / 2147483647.0, - 1.0 );\n\n\t\tcase Int16Array:\n\n\t\t\treturn Math.max( value / 32767.0, - 1.0 );\n\n\t\tcase Int8Array:\n\n\t\t\treturn Math.max( value / 127.0, - 1.0 );\n\n\t\tdefault:\n\n\t\t\tthrow new Error( 'Invalid component type.' );\n\n\t}\n\n}\n\nfunction normalize( value, array ) {\n\n\tswitch ( array.constructor ) {\n\n\t\tcase Float32Array:\n\n\t\t\treturn value;\n\n\t\tcase Uint32Array:\n\n\t\t\treturn Math.round( value * 4294967295.0 );\n\n\t\tcase Uint16Array:\n\n\t\t\treturn Math.round( value * 65535.0 );\n\n\t\tcase Uint8Array:\n\n\t\t\treturn Math.round( value * 255.0 );\n\n\t\tcase Int32Array:\n\n\t\t\treturn Math.round( value * 2147483647.0 );\n\n\t\tcase Int16Array:\n\n\t\t\treturn Math.round( value * 32767.0 );\n\n\t\tcase Int8Array:\n\n\t\t\treturn Math.round( value * 127.0 );\n\n\t\tdefault:\n\n\t\t\tthrow new Error( 'Invalid component type.' );\n\n\t}\n\n}\n\nconst MathUtils = {\n\tDEG2RAD: DEG2RAD,\n\tRAD2DEG: RAD2DEG,\n\tgenerateUUID: generateUUID,\n\tclamp: clamp,\n\teuclideanModulo: euclideanModulo,\n\tmapLinear: mapLinear,\n\tinverseLerp: inverseLerp,\n\tlerp: lerp,\n\tdamp: damp,\n\tpingpong: pingpong,\n\tsmoothstep: smoothstep,\n\tsmootherstep: smootherstep,\n\trandInt: randInt,\n\trandFloat: randFloat,\n\trandFloatSpread: randFloatSpread,\n\tseededRandom: seededRandom,\n\tdegToRad: degToRad,\n\tradToDeg: radToDeg,\n\tisPowerOfTwo: isPowerOfTwo,\n\tceilPowerOfTwo: ceilPowerOfTwo,\n\tfloorPowerOfTwo: floorPowerOfTwo,\n\tsetQuaternionFromProperEuler: setQuaternionFromProperEuler,\n\tnormalize: normalize,\n\tdenormalize: denormalize\n};\n\nclass Vector2 {\n\n\tconstructor( x = 0, y = 0 ) {\n\n\t\tVector2.prototype.isVector2 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\n\t}\n\n\tget width() {\n\n\t\treturn this.x;\n\n\t}\n\n\tset width( value ) {\n\n\t\tthis.x = value;\n\n\t}\n\n\tget height() {\n\n\t\treturn this.y;\n\n\t}\n\n\tset height( value ) {\n\n\t\tthis.y = value;\n\n\t}\n\n\tset( x, y ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst x = this.x, y = this.y;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ];\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ];\n\n\t\treturn this;\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y;\n\n\t}\n\n\tcross( v ) {\n\n\t\treturn this.x * v.y - this.y * v.x;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tangle() {\n\n\t\t// computes the angle in radians with respect to the positive x-axis\n\n\t\tconst angle = Math.atan2( - this.y, - this.x ) + Math.PI;\n\n\t\treturn angle;\n\n\t}\n\n\tangleTo( v ) {\n\n\t\tconst denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\n\n\t\tif ( denominator === 0 ) return Math.PI / 2;\n\n\t\tconst theta = this.dot( v ) / denominator;\n\n\t\t// clamp, to handle numerical problems\n\n\t\treturn Math.acos( clamp( theta, - 1, 1 ) );\n\n\t}\n\n\tdistanceTo( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t}\n\n\tdistanceToSquared( v ) {\n\n\t\tconst dx = this.x - v.x, dy = this.y - v.y;\n\t\treturn dx * dx + dy * dy;\n\n\t}\n\n\tmanhattanDistanceTo( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\n\t\treturn this;\n\n\t}\n\n\trotateAround( center, angle ) {\n\n\t\tconst c = Math.cos( angle ), s = Math.sin( angle );\n\n\t\tconst x = this.x - center.x;\n\t\tconst y = this.y - center.y;\n\n\t\tthis.x = x * c - y * s + center.x;\n\t\tthis.y = x * s + y * c + center.y;\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\n\t}\n\n}\n\nclass Matrix3 {\n\n\tconstructor( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\n\n\t\tMatrix3.prototype.isMatrix3 = true;\n\n\t\tthis.elements = [\n\n\t\t\t1, 0, 0,\n\t\t\t0, 1, 0,\n\t\t\t0, 0, 1\n\n\t\t];\n\n\t\tif ( n11 !== undefined ) {\n\n\t\t\tthis.set( n11, n12, n13, n21, n22, n23, n31, n32, n33 );\n\n\t\t}\n\n\t}\n\n\tset( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 1 ] = n21; te[ 2 ] = n31;\n\t\tte[ 3 ] = n12; te[ 4 ] = n22; te[ 5 ] = n32;\n\t\tte[ 6 ] = n13; te[ 7 ] = n23; te[ 8 ] = n33;\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0,\n\t\t\t0, 1, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tcopy( m ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ];\n\t\tte[ 3 ] = me[ 3 ]; te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ];\n\t\tte[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ]; te[ 8 ] = me[ 8 ];\n\n\t\treturn this;\n\n\t}\n\n\textractBasis( xAxis, yAxis, zAxis ) {\n\n\t\txAxis.setFromMatrix3Column( this, 0 );\n\t\tyAxis.setFromMatrix3Column( this, 1 );\n\t\tzAxis.setFromMatrix3Column( this, 2 );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrix4( m ) {\n\n\t\tconst me = m.elements;\n\n\t\tthis.set(\n\n\t\t\tme[ 0 ], me[ 4 ], me[ 8 ],\n\t\t\tme[ 1 ], me[ 5 ], me[ 9 ],\n\t\t\tme[ 2 ], me[ 6 ], me[ 10 ]\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( m ) {\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t}\n\n\tpremultiply( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t}\n\n\tmultiplyMatrices( a, b ) {\n\n\t\tconst ae = a.elements;\n\t\tconst be = b.elements;\n\t\tconst te = this.elements;\n\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 3 ], a13 = ae[ 6 ];\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 4 ], a23 = ae[ 7 ];\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 5 ], a33 = ae[ 8 ];\n\n\t\tconst b11 = be[ 0 ], b12 = be[ 3 ], b13 = be[ 6 ];\n\t\tconst b21 = be[ 1 ], b22 = be[ 4 ], b23 = be[ 7 ];\n\t\tconst b31 = be[ 2 ], b32 = be[ 5 ], b33 = be[ 8 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31;\n\t\tte[ 3 ] = a11 * b12 + a12 * b22 + a13 * b32;\n\t\tte[ 6 ] = a11 * b13 + a12 * b23 + a13 * b33;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31;\n\t\tte[ 4 ] = a21 * b12 + a22 * b22 + a23 * b32;\n\t\tte[ 7 ] = a21 * b13 + a22 * b23 + a23 * b33;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31;\n\t\tte[ 5 ] = a31 * b12 + a32 * b22 + a33 * b32;\n\t\tte[ 8 ] = a31 * b13 + a32 * b23 + a33 * b33;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 3 ] *= s; te[ 6 ] *= s;\n\t\tte[ 1 ] *= s; te[ 4 ] *= s; te[ 7 ] *= s;\n\t\tte[ 2 ] *= s; te[ 5 ] *= s; te[ 8 ] *= s;\n\n\t\treturn this;\n\n\t}\n\n\tdeterminant() {\n\n\t\tconst te = this.elements;\n\n\t\tconst a = te[ 0 ], b = te[ 1 ], c = te[ 2 ],\n\t\t\td = te[ 3 ], e = te[ 4 ], f = te[ 5 ],\n\t\t\tg = te[ 6 ], h = te[ 7 ], i = te[ 8 ];\n\n\t\treturn a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;\n\n\t}\n\n\tinvert() {\n\n\t\tconst te = this.elements,\n\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ],\n\t\t\tn12 = te[ 3 ], n22 = te[ 4 ], n32 = te[ 5 ],\n\t\t\tn13 = te[ 6 ], n23 = te[ 7 ], n33 = te[ 8 ],\n\n\t\t\tt11 = n33 * n22 - n32 * n23,\n\t\t\tt12 = n32 * n13 - n33 * n12,\n\t\t\tt13 = n23 * n12 - n22 * n13,\n\n\t\t\tdet = n11 * t11 + n21 * t12 + n31 * t13;\n\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0 );\n\n\t\tconst detInv = 1 / det;\n\n\t\tte[ 0 ] = t11 * detInv;\n\t\tte[ 1 ] = ( n31 * n23 - n33 * n21 ) * detInv;\n\t\tte[ 2 ] = ( n32 * n21 - n31 * n22 ) * detInv;\n\n\t\tte[ 3 ] = t12 * detInv;\n\t\tte[ 4 ] = ( n33 * n11 - n31 * n13 ) * detInv;\n\t\tte[ 5 ] = ( n31 * n12 - n32 * n11 ) * detInv;\n\n\t\tte[ 6 ] = t13 * detInv;\n\t\tte[ 7 ] = ( n21 * n13 - n23 * n11 ) * detInv;\n\t\tte[ 8 ] = ( n22 * n11 - n21 * n12 ) * detInv;\n\n\t\treturn this;\n\n\t}\n\n\ttranspose() {\n\n\t\tlet tmp;\n\t\tconst m = this.elements;\n\n\t\ttmp = m[ 1 ]; m[ 1 ] = m[ 3 ]; m[ 3 ] = tmp;\n\t\ttmp = m[ 2 ]; m[ 2 ] = m[ 6 ]; m[ 6 ] = tmp;\n\t\ttmp = m[ 5 ]; m[ 5 ] = m[ 7 ]; m[ 7 ] = tmp;\n\n\t\treturn this;\n\n\t}\n\n\tgetNormalMatrix( matrix4 ) {\n\n\t\treturn this.setFromMatrix4( matrix4 ).invert().transpose();\n\n\t}\n\n\ttransposeIntoArray( r ) {\n\n\t\tconst m = this.elements;\n\n\t\tr[ 0 ] = m[ 0 ];\n\t\tr[ 1 ] = m[ 3 ];\n\t\tr[ 2 ] = m[ 6 ];\n\t\tr[ 3 ] = m[ 1 ];\n\t\tr[ 4 ] = m[ 4 ];\n\t\tr[ 5 ] = m[ 7 ];\n\t\tr[ 6 ] = m[ 2 ];\n\t\tr[ 7 ] = m[ 5 ];\n\t\tr[ 8 ] = m[ 8 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetUvTransform( tx, ty, sx, sy, rotation, cx, cy ) {\n\n\t\tconst c = Math.cos( rotation );\n\t\tconst s = Math.sin( rotation );\n\n\t\tthis.set(\n\t\t\tsx * c, sx * s, - sx * ( c * cx + s * cy ) + cx + tx,\n\t\t\t- sy * s, sy * c, - sy * ( - s * cx + c * cy ) + cy + ty,\n\t\t\t0, 0, 1\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t//\n\n\tscale( sx, sy ) {\n\n\t\tthis.premultiply( _m3.makeScale( sx, sy ) );\n\n\t\treturn this;\n\n\t}\n\n\trotate( theta ) {\n\n\t\tthis.premultiply( _m3.makeRotation( - theta ) );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( tx, ty ) {\n\n\t\tthis.premultiply( _m3.makeTranslation( tx, ty ) );\n\n\t\treturn this;\n\n\t}\n\n\t// for 2D Transforms\n\n\tmakeTranslation( x, y ) {\n\n\t\tif ( x.isVector2 ) {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, x.x,\n\t\t\t\t0, 1, x.y,\n\t\t\t\t0, 0, 1\n\n\t\t\t);\n\n\t\t} else {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, x,\n\t\t\t\t0, 1, y,\n\t\t\t\t0, 0, 1\n\n\t\t\t);\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotation( theta ) {\n\n\t\t// counterclockwise\n\n\t\tconst c = Math.cos( theta );\n\t\tconst s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\tc, - s, 0,\n\t\t\ts, c, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeScale( x, y ) {\n\n\t\tthis.set(\n\n\t\t\tx, 0, 0,\n\t\t\t0, y, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t//\n\n\tequals( matrix ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = matrix.elements;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\n\t\treturn array;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().fromArray( this.elements );\n\n\t}\n\n}\n\nconst _m3 = /*@__PURE__*/ new Matrix3();\n\nfunction arrayNeedsUint32( array ) {\n\n\t// assumes larger values usually on last\n\n\tfor ( let i = array.length - 1; i >= 0; -- i ) {\n\n\t\tif ( array[ i ] >= 65535 ) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565\n\n\t}\n\n\treturn false;\n\n}\n\nconst TYPED_ARRAYS = {\n\tInt8Array: Int8Array,\n\tUint8Array: Uint8Array,\n\tUint8ClampedArray: Uint8ClampedArray,\n\tInt16Array: Int16Array,\n\tUint16Array: Uint16Array,\n\tInt32Array: Int32Array,\n\tUint32Array: Uint32Array,\n\tFloat32Array: Float32Array,\n\tFloat64Array: Float64Array\n};\n\nfunction getTypedArray( type, buffer ) {\n\n\treturn new TYPED_ARRAYS[ type ]( buffer );\n\n}\n\nfunction createElementNS( name ) {\n\n\treturn document.createElementNS( 'http://www.w3.org/1999/xhtml', name );\n\n}\n\nfunction createCanvasElement() {\n\n\tconst canvas = createElementNS( 'canvas' );\n\tcanvas.style.display = 'block';\n\treturn canvas;\n\n}\n\nconst _cache = {};\n\nfunction warnOnce( message ) {\n\n\tif ( message in _cache ) return;\n\n\t_cache[ message ] = true;\n\n\tconsole.warn( message );\n\n}\n\n/**\n * Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping\n * or clipping. Based on W3C specifications for sRGB and Display P3,\n * and ICC specifications for the D50 connection space. Values in/out\n * are _linear_ sRGB and _linear_ Display P3.\n *\n * Note that both sRGB and Display P3 use the sRGB transfer functions.\n *\n * Reference:\n * - http://www.russellcottrell.com/photo/matrixCalculator.htm\n */\n\nconst LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new Matrix3().set(\n\t0.8224621, 0.177538, 0.0,\n\t0.0331941, 0.9668058, 0.0,\n\t0.0170827, 0.0723974, 0.9105199,\n);\n\nconst LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().set(\n\t1.2249401, - 0.2249404, 0.0,\n\t- 0.0420569, 1.0420571, 0.0,\n\t- 0.0196376, - 0.0786361, 1.0982735\n);\n\n/**\n * Defines supported color spaces by transfer function and primaries,\n * and provides conversions to/from the Linear-sRGB reference space.\n */\nconst COLOR_SPACES = {\n\t[ LinearSRGBColorSpace ]: {\n\t\ttransfer: LinearTransfer,\n\t\tprimaries: Rec709Primaries,\n\t\ttoReference: ( color ) => color,\n\t\tfromReference: ( color ) => color,\n\t},\n\t[ SRGBColorSpace ]: {\n\t\ttransfer: SRGBTransfer,\n\t\tprimaries: Rec709Primaries,\n\t\ttoReference: ( color ) => color.convertSRGBToLinear(),\n\t\tfromReference: ( color ) => color.convertLinearToSRGB(),\n\t},\n\t[ LinearDisplayP3ColorSpace ]: {\n\t\ttransfer: LinearTransfer,\n\t\tprimaries: P3Primaries,\n\t\ttoReference: ( color ) => color.applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),\n\t\tfromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ),\n\t},\n\t[ DisplayP3ColorSpace ]: {\n\t\ttransfer: SRGBTransfer,\n\t\tprimaries: P3Primaries,\n\t\ttoReference: ( color ) => color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),\n\t\tfromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB(),\n\t},\n};\n\nconst SUPPORTED_WORKING_COLOR_SPACES = new Set( [ LinearSRGBColorSpace, LinearDisplayP3ColorSpace ] );\n\nconst ColorManagement = {\n\n\tenabled: true,\n\n\t_workingColorSpace: LinearSRGBColorSpace,\n\n\tget legacyMode() {\n\n\t\tconsole.warn( 'THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.' );\n\n\t\treturn ! this.enabled;\n\n\t},\n\n\tset legacyMode( legacyMode ) {\n\n\t\tconsole.warn( 'THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.' );\n\n\t\tthis.enabled = ! legacyMode;\n\n\t},\n\n\tget workingColorSpace() {\n\n\t\treturn this._workingColorSpace;\n\n\t},\n\n\tset workingColorSpace( colorSpace ) {\n\n\t\tif ( ! SUPPORTED_WORKING_COLOR_SPACES.has( colorSpace ) ) {\n\n\t\t\tthrow new Error( `Unsupported working color space, \"${ colorSpace }\".` );\n\n\t\t}\n\n\t\tthis._workingColorSpace = colorSpace;\n\n\t},\n\n\tconvert: function ( color, sourceColorSpace, targetColorSpace ) {\n\n\t\tif ( this.enabled === false || sourceColorSpace === targetColorSpace || ! sourceColorSpace || ! targetColorSpace ) {\n\n\t\t\treturn color;\n\n\t\t}\n\n\t\tconst sourceToReference = COLOR_SPACES[ sourceColorSpace ].toReference;\n\t\tconst targetFromReference = COLOR_SPACES[ targetColorSpace ].fromReference;\n\n\t\treturn targetFromReference( sourceToReference( color ) );\n\n\t},\n\n\tfromWorkingColorSpace: function ( color, targetColorSpace ) {\n\n\t\treturn this.convert( color, this._workingColorSpace, targetColorSpace );\n\n\t},\n\n\ttoWorkingColorSpace: function ( color, sourceColorSpace ) {\n\n\t\treturn this.convert( color, sourceColorSpace, this._workingColorSpace );\n\n\t},\n\n\tgetPrimaries: function ( colorSpace ) {\n\n\t\treturn COLOR_SPACES[ colorSpace ].primaries;\n\n\t},\n\n\tgetTransfer: function ( colorSpace ) {\n\n\t\tif ( colorSpace === NoColorSpace ) return LinearTransfer;\n\n\t\treturn COLOR_SPACES[ colorSpace ].transfer;\n\n\t},\n\n};\n\n\nfunction SRGBToLinear( c ) {\n\n\treturn ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );\n\n}\n\nfunction LinearToSRGB( c ) {\n\n\treturn ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;\n\n}\n\nlet _canvas;\n\nclass ImageUtils {\n\n\tstatic getDataURL( image ) {\n\n\t\tif ( /^data:/i.test( image.src ) ) {\n\n\t\t\treturn image.src;\n\n\t\t}\n\n\t\tif ( typeof HTMLCanvasElement === 'undefined' ) {\n\n\t\t\treturn image.src;\n\n\t\t}\n\n\t\tlet canvas;\n\n\t\tif ( image instanceof HTMLCanvasElement ) {\n\n\t\t\tcanvas = image;\n\n\t\t} else {\n\n\t\t\tif ( _canvas === undefined ) _canvas = createElementNS( 'canvas' );\n\n\t\t\t_canvas.width = image.width;\n\t\t\t_canvas.height = image.height;\n\n\t\t\tconst context = _canvas.getContext( '2d' );\n\n\t\t\tif ( image instanceof ImageData ) {\n\n\t\t\t\tcontext.putImageData( image, 0, 0 );\n\n\t\t\t} else {\n\n\t\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\n\n\t\t\t}\n\n\t\t\tcanvas = _canvas;\n\n\t\t}\n\n\t\tif ( canvas.width > 2048 || canvas.height > 2048 ) {\n\n\t\t\tconsole.warn( 'THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons', image );\n\n\t\t\treturn canvas.toDataURL( 'image/jpeg', 0.6 );\n\n\t\t} else {\n\n\t\t\treturn canvas.toDataURL( 'image/png' );\n\n\t\t}\n\n\t}\n\n\tstatic sRGBToLinear( image ) {\n\n\t\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t\tconst canvas = createElementNS( 'canvas' );\n\n\t\t\tcanvas.width = image.width;\n\t\t\tcanvas.height = image.height;\n\n\t\t\tconst context = canvas.getContext( '2d' );\n\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\n\n\t\t\tconst imageData = context.getImageData( 0, 0, image.width, image.height );\n\t\t\tconst data = imageData.data;\n\n\t\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\t\tdata[ i ] = SRGBToLinear( data[ i ] / 255 ) * 255;\n\n\t\t\t}\n\n\t\t\tcontext.putImageData( imageData, 0, 0 );\n\n\t\t\treturn canvas;\n\n\t\t} else if ( image.data ) {\n\n\t\t\tconst data = image.data.slice( 0 );\n\n\t\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\t\tif ( data instanceof Uint8Array || data instanceof Uint8ClampedArray ) {\n\n\t\t\t\t\tdata[ i ] = Math.floor( SRGBToLinear( data[ i ] / 255 ) * 255 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// assuming float\n\n\t\t\t\t\tdata[ i ] = SRGBToLinear( data[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tdata: data,\n\t\t\t\twidth: image.width,\n\t\t\t\theight: image.height\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.' );\n\t\t\treturn image;\n\n\t\t}\n\n\t}\n\n}\n\nlet _sourceId = 0;\n\nclass Source {\n\n\tconstructor( data = null ) {\n\n\t\tthis.isSource = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _sourceId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.data = data;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( ! isRootObject && meta.images[ this.uuid ] !== undefined ) {\n\n\t\t\treturn meta.images[ this.uuid ];\n\n\t\t}\n\n\t\tconst output = {\n\t\t\tuuid: this.uuid,\n\t\t\turl: ''\n\t\t};\n\n\t\tconst data = this.data;\n\n\t\tif ( data !== null ) {\n\n\t\t\tlet url;\n\n\t\t\tif ( Array.isArray( data ) ) {\n\n\t\t\t\t// cube texture\n\n\t\t\t\turl = [];\n\n\t\t\t\tfor ( let i = 0, l = data.length; i < l; i ++ ) {\n\n\t\t\t\t\tif ( data[ i ].isDataTexture ) {\n\n\t\t\t\t\t\turl.push( serializeImage( data[ i ].image ) );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\turl.push( serializeImage( data[ i ] ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// texture\n\n\t\t\t\turl = serializeImage( data );\n\n\t\t\t}\n\n\t\t\toutput.url = url;\n\n\t\t}\n\n\t\tif ( ! isRootObject ) {\n\n\t\t\tmeta.images[ this.uuid ] = output;\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n}\n\nfunction serializeImage( image ) {\n\n\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t// default images\n\n\t\treturn ImageUtils.getDataURL( image );\n\n\t} else {\n\n\t\tif ( image.data ) {\n\n\t\t\t// images of DataTexture\n\n\t\t\treturn {\n\t\t\t\tdata: Array.from( image.data ),\n\t\t\t\twidth: image.width,\n\t\t\t\theight: image.height,\n\t\t\t\ttype: image.data.constructor.name\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.Texture: Unable to serialize Texture.' );\n\t\t\treturn {};\n\n\t\t}\n\n\t}\n\n}\n\nlet _textureId = 0;\n\nclass Texture extends EventDispatcher {\n\n\tconstructor( image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = Texture.DEFAULT_ANISOTROPY, colorSpace = NoColorSpace ) {\n\n\t\tsuper();\n\n\t\tthis.isTexture = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _textureId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\n\t\tthis.source = new Source( image );\n\t\tthis.mipmaps = [];\n\n\t\tthis.mapping = mapping;\n\t\tthis.channel = 0;\n\n\t\tthis.wrapS = wrapS;\n\t\tthis.wrapT = wrapT;\n\n\t\tthis.magFilter = magFilter;\n\t\tthis.minFilter = minFilter;\n\n\t\tthis.anisotropy = anisotropy;\n\n\t\tthis.format = format;\n\t\tthis.internalFormat = null;\n\t\tthis.type = type;\n\n\t\tthis.offset = new Vector2( 0, 0 );\n\t\tthis.repeat = new Vector2( 1, 1 );\n\t\tthis.center = new Vector2( 0, 0 );\n\t\tthis.rotation = 0;\n\n\t\tthis.matrixAutoUpdate = true;\n\t\tthis.matrix = new Matrix3();\n\n\t\tthis.generateMipmaps = true;\n\t\tthis.premultiplyAlpha = false;\n\t\tthis.flipY = true;\n\t\tthis.unpackAlignment = 4;\t// valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)\n\n\t\tif ( typeof colorSpace === 'string' ) {\n\n\t\t\tthis.colorSpace = colorSpace;\n\n\t\t} else { // @deprecated, r152\n\n\t\t\twarnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );\n\t\t\tthis.colorSpace = colorSpace === sRGBEncoding ? SRGBColorSpace : NoColorSpace;\n\n\t\t}\n\n\n\t\tthis.userData = {};\n\n\t\tthis.version = 0;\n\t\tthis.onUpdate = null;\n\n\t\tthis.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not\n\t\tthis.needsPMREMUpdate = false; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)\n\n\t}\n\n\tget image() {\n\n\t\treturn this.source.data;\n\n\t}\n\n\tset image( value = null ) {\n\n\t\tthis.source.data = value;\n\n\t}\n\n\tupdateMatrix() {\n\n\t\tthis.matrix.setUvTransform( this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.source = source.source;\n\t\tthis.mipmaps = source.mipmaps.slice( 0 );\n\n\t\tthis.mapping = source.mapping;\n\t\tthis.channel = source.channel;\n\n\t\tthis.wrapS = source.wrapS;\n\t\tthis.wrapT = source.wrapT;\n\n\t\tthis.magFilter = source.magFilter;\n\t\tthis.minFilter = source.minFilter;\n\n\t\tthis.anisotropy = source.anisotropy;\n\n\t\tthis.format = source.format;\n\t\tthis.internalFormat = source.internalFormat;\n\t\tthis.type = source.type;\n\n\t\tthis.offset.copy( source.offset );\n\t\tthis.repeat.copy( source.repeat );\n\t\tthis.center.copy( source.center );\n\t\tthis.rotation = source.rotation;\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\t\tthis.matrix.copy( source.matrix );\n\n\t\tthis.generateMipmaps = source.generateMipmaps;\n\t\tthis.premultiplyAlpha = source.premultiplyAlpha;\n\t\tthis.flipY = source.flipY;\n\t\tthis.unpackAlignment = source.unpackAlignment;\n\t\tthis.colorSpace = source.colorSpace;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\tthis.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( ! isRootObject && meta.textures[ this.uuid ] !== undefined ) {\n\n\t\t\treturn meta.textures[ this.uuid ];\n\n\t\t}\n\n\t\tconst output = {\n\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Texture',\n\t\t\t\tgenerator: 'Texture.toJSON'\n\t\t\t},\n\n\t\t\tuuid: this.uuid,\n\t\t\tname: this.name,\n\n\t\t\timage: this.source.toJSON( meta ).uuid,\n\n\t\t\tmapping: this.mapping,\n\t\t\tchannel: this.channel,\n\n\t\t\trepeat: [ this.repeat.x, this.repeat.y ],\n\t\t\toffset: [ this.offset.x, this.offset.y ],\n\t\t\tcenter: [ this.center.x, this.center.y ],\n\t\t\trotation: this.rotation,\n\n\t\t\twrap: [ this.wrapS, this.wrapT ],\n\n\t\t\tformat: this.format,\n\t\t\tinternalFormat: this.internalFormat,\n\t\t\ttype: this.type,\n\t\t\tcolorSpace: this.colorSpace,\n\n\t\t\tminFilter: this.minFilter,\n\t\t\tmagFilter: this.magFilter,\n\t\t\tanisotropy: this.anisotropy,\n\n\t\t\tflipY: this.flipY,\n\n\t\t\tgenerateMipmaps: this.generateMipmaps,\n\t\t\tpremultiplyAlpha: this.premultiplyAlpha,\n\t\t\tunpackAlignment: this.unpackAlignment\n\n\t\t};\n\n\t\tif ( Object.keys( this.userData ).length > 0 ) output.userData = this.userData;\n\n\t\tif ( ! isRootObject ) {\n\n\t\t\tmeta.textures[ this.uuid ] = output;\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\ttransformUv( uv ) {\n\n\t\tif ( this.mapping !== UVMapping ) return uv;\n\n\t\tuv.applyMatrix3( this.matrix );\n\n\t\tif ( uv.x < 0 || uv.x > 1 ) {\n\n\t\t\tswitch ( this.wrapS ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.x = uv.x < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.x ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.x = Math.ceil( uv.x ) - uv.x;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( uv.y < 0 || uv.y > 1 ) {\n\n\t\t\tswitch ( this.wrapT ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.y = uv.y < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.y ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.y = Math.ceil( uv.y ) - uv.y;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.flipY ) {\n\n\t\t\tuv.y = 1 - uv.y;\n\n\t\t}\n\n\t\treturn uv;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.version ++;\n\t\t\tthis.source.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tget encoding() { // @deprecated, r152\n\n\t\twarnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );\n\t\treturn this.colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;\n\n\t}\n\n\tset encoding( encoding ) { // @deprecated, r152\n\n\t\twarnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );\n\t\tthis.colorSpace = encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;\n\n\t}\n\n}\n\nTexture.DEFAULT_IMAGE = null;\nTexture.DEFAULT_MAPPING = UVMapping;\nTexture.DEFAULT_ANISOTROPY = 1;\n\nclass Vector4 {\n\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\n\n\t\tVector4.prototype.isVector4 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\t\tthis.w = w;\n\n\t}\n\n\tget width() {\n\n\t\treturn this.z;\n\n\t}\n\n\tset width( value ) {\n\n\t\tthis.z = value;\n\n\t}\n\n\tget height() {\n\n\t\treturn this.w;\n\n\t}\n\n\tset height( value ) {\n\n\t\tthis.w = value;\n\n\t}\n\n\tset( x, y, z, w ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\t\tthis.w = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetW( w ) {\n\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tcase 3: this.w = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tcase 3: return this.w;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y, this.z, this.w );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\t\tthis.w = ( v.w !== undefined ) ? v.w : 1;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\t\tthis.w += v.w;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\t\tthis.w += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\t\tthis.w = a.w + b.w;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\t\tthis.w += v.w * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\t\tthis.w -= v.w;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\t\tthis.w -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\t\tthis.w = a.w - b.w;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\t\tthis.w *= v.w;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\t\tthis.w *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z, w = this.w;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w;\n\t\tthis.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tsetAxisAngleFromQuaternion( q ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm\n\n\t\t// q is assumed to be normalized\n\n\t\tthis.w = 2 * Math.acos( q.w );\n\n\t\tconst s = Math.sqrt( 1 - q.w * q.w );\n\n\t\tif ( s < 0.0001 ) {\n\n\t\t\tthis.x = 1;\n\t\t\tthis.y = 0;\n\t\t\tthis.z = 0;\n\n\t\t} else {\n\n\t\t\tthis.x = q.x / s;\n\t\t\tthis.y = q.y / s;\n\t\t\tthis.z = q.z / s;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetAxisAngleFromRotationMatrix( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tlet angle, x, y, z; // variables for result\n\t\tconst epsilon = 0.01,\t\t// margin to allow for rounding errors\n\t\t\tepsilon2 = 0.1,\t\t// margin to distinguish between 0 and 180 degrees\n\n\t\t\tte = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tif ( ( Math.abs( m12 - m21 ) < epsilon ) &&\n\t\t ( Math.abs( m13 - m31 ) < epsilon ) &&\n\t\t ( Math.abs( m23 - m32 ) < epsilon ) ) {\n\n\t\t\t// singularity found\n\t\t\t// first check for identity matrix which must have +1 for all terms\n\t\t\t// in leading diagonal and zero in other terms\n\n\t\t\tif ( ( Math.abs( m12 + m21 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m13 + m31 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m23 + m32 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) {\n\n\t\t\t\t// this singularity is identity matrix so angle = 0\n\n\t\t\t\tthis.set( 1, 0, 0, 0 );\n\n\t\t\t\treturn this; // zero angle, arbitrary axis\n\n\t\t\t}\n\n\t\t\t// otherwise this singularity is angle = 180\n\n\t\t\tangle = Math.PI;\n\n\t\t\tconst xx = ( m11 + 1 ) / 2;\n\t\t\tconst yy = ( m22 + 1 ) / 2;\n\t\t\tconst zz = ( m33 + 1 ) / 2;\n\t\t\tconst xy = ( m12 + m21 ) / 4;\n\t\t\tconst xz = ( m13 + m31 ) / 4;\n\t\t\tconst yz = ( m23 + m32 ) / 4;\n\n\t\t\tif ( ( xx > yy ) && ( xx > zz ) ) {\n\n\t\t\t\t// m11 is the largest diagonal term\n\n\t\t\t\tif ( xx < epsilon ) {\n\n\t\t\t\t\tx = 0;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tx = Math.sqrt( xx );\n\t\t\t\t\ty = xy / x;\n\t\t\t\t\tz = xz / x;\n\n\t\t\t\t}\n\n\t\t\t} else if ( yy > zz ) {\n\n\t\t\t\t// m22 is the largest diagonal term\n\n\t\t\t\tif ( yy < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ty = Math.sqrt( yy );\n\t\t\t\t\tx = xy / y;\n\t\t\t\t\tz = yz / y;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// m33 is the largest diagonal term so base result on this\n\n\t\t\t\tif ( zz < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tz = Math.sqrt( zz );\n\t\t\t\t\tx = xz / z;\n\t\t\t\t\ty = yz / z;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.set( x, y, z, angle );\n\n\t\t\treturn this; // return 180 deg rotation\n\n\t\t}\n\n\t\t// as we have reached here there are no singularities so we can handle normally\n\n\t\tlet s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) +\n\t\t\t( m13 - m31 ) * ( m13 - m31 ) +\n\t\t\t( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize\n\n\t\tif ( Math.abs( s ) < 0.001 ) s = 1;\n\n\t\t// prevent divide by zero, should not happen if matrix is orthogonal and should be\n\t\t// caught by singularity test above, but I've left it in just in case\n\n\t\tthis.x = ( m32 - m23 ) / s;\n\t\tthis.y = ( m13 - m31 ) / s;\n\t\tthis.z = ( m21 - m12 ) / s;\n\t\tthis.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 );\n\n\t\treturn this;\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\t\tthis.w = Math.min( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\t\tthis.w = Math.max( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\t\tthis.z = Math.max( min.z, Math.min( max.z, this.z ) );\n\t\tthis.w = Math.max( min.w, Math.min( max.w, this.w ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\t\tthis.z = Math.max( minVal, Math.min( maxVal, this.z ) );\n\t\tthis.w = Math.max( minVal, Math.min( maxVal, this.w ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\t\tthis.w = Math.floor( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\t\tthis.w = Math.ceil( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\t\tthis.w = Math.round( this.w );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\t\tthis.z = Math.trunc( this.z );\n\t\tthis.w = Math.trunc( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\t\tthis.w = - this.w;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\t\tthis.w += ( v.w - this.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\n\t\tthis.w = v1.w + ( v2.w - v1.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\t\tthis.w = array[ offset + 3 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\t\tarray[ offset + 3 ] = this.w;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\t\tthis.w = attribute.getW( index );\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\t\tthis.z = Math.random();\n\t\tthis.w = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\t\tyield this.z;\n\t\tyield this.w;\n\n\t}\n\n}\n\n/*\n In options, we can specify:\n * Texture parameters for an auto-generated target texture\n * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers\n*/\nclass RenderTarget extends EventDispatcher {\n\n\tconstructor( width = 1, height = 1, options = {} ) {\n\n\t\tsuper();\n\n\t\tthis.isRenderTarget = true;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\t\tthis.depth = 1;\n\n\t\tthis.scissor = new Vector4( 0, 0, width, height );\n\t\tthis.scissorTest = false;\n\n\t\tthis.viewport = new Vector4( 0, 0, width, height );\n\n\t\tconst image = { width: width, height: height, depth: 1 };\n\n\t\tif ( options.encoding !== undefined ) {\n\n\t\t\t// @deprecated, r152\n\t\t\twarnOnce( 'THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace.' );\n\t\t\toptions.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;\n\n\t\t}\n\n\t\toptions = Object.assign( {\n\t\t\tgenerateMipmaps: false,\n\t\t\tinternalFormat: null,\n\t\t\tminFilter: LinearFilter,\n\t\t\tdepthBuffer: true,\n\t\t\tstencilBuffer: false,\n\t\t\tdepthTexture: null,\n\t\t\tsamples: 0\n\t\t}, options );\n\n\t\tthis.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t\tthis.texture.flipY = false;\n\t\tthis.texture.generateMipmaps = options.generateMipmaps;\n\t\tthis.texture.internalFormat = options.internalFormat;\n\n\t\tthis.depthBuffer = options.depthBuffer;\n\t\tthis.stencilBuffer = options.stencilBuffer;\n\n\t\tthis.depthTexture = options.depthTexture;\n\n\t\tthis.samples = options.samples;\n\n\t}\n\n\tsetSize( width, height, depth = 1 ) {\n\n\t\tif ( this.width !== width || this.height !== height || this.depth !== depth ) {\n\n\t\t\tthis.width = width;\n\t\t\tthis.height = height;\n\t\t\tthis.depth = depth;\n\n\t\t\tthis.texture.image.width = width;\n\t\t\tthis.texture.image.height = height;\n\t\t\tthis.texture.image.depth = depth;\n\n\t\t\tthis.dispose();\n\n\t\t}\n\n\t\tthis.viewport.set( 0, 0, width, height );\n\t\tthis.scissor.set( 0, 0, width, height );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\t\tthis.depth = source.depth;\n\n\t\tthis.scissor.copy( source.scissor );\n\t\tthis.scissorTest = source.scissorTest;\n\n\t\tthis.viewport.copy( source.viewport );\n\n\t\tthis.texture = source.texture.clone();\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t\t// ensure image object is not shared, see #20328\n\n\t\tconst image = Object.assign( {}, source.texture.image );\n\t\tthis.texture.source = new Source( image );\n\n\t\tthis.depthBuffer = source.depthBuffer;\n\t\tthis.stencilBuffer = source.stencilBuffer;\n\n\t\tif ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();\n\n\t\tthis.samples = source.samples;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nclass WebGLRenderTarget extends RenderTarget {\n\n\tconstructor( width = 1, height = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\tthis.isWebGLRenderTarget = true;\n\n\t}\n\n}\n\nclass DataArrayTexture extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, depth = 1 ) {\n\n\t\tsuper( null );\n\n\t\tthis.isDataArrayTexture = true;\n\n\t\tthis.image = { data, width, height, depth };\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t}\n\n}\n\nclass WebGLArrayRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( width = 1, height = 1, depth = 1 ) {\n\n\t\tsuper( width, height );\n\n\t\tthis.isWebGLArrayRenderTarget = true;\n\n\t\tthis.depth = depth;\n\n\t\tthis.texture = new DataArrayTexture( null, width, height, depth );\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t}\n\n}\n\nclass Data3DTexture extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, depth = 1 ) {\n\n\t\t// We're going to add .setXXX() methods for setting properties later.\n\t\t// Users can still set in DataTexture3D directly.\n\t\t//\n\t\t//\tconst texture = new THREE.DataTexture3D( data, width, height, depth );\n\t\t// \ttexture.anisotropy = 16;\n\t\t//\n\t\t// See #14839\n\n\t\tsuper( null );\n\n\t\tthis.isData3DTexture = true;\n\n\t\tthis.image = { data, width, height, depth };\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t}\n\n}\n\nclass WebGL3DRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( width = 1, height = 1, depth = 1 ) {\n\n\t\tsuper( width, height );\n\n\t\tthis.isWebGL3DRenderTarget = true;\n\n\t\tthis.depth = depth;\n\n\t\tthis.texture = new Data3DTexture( null, width, height, depth );\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t}\n\n}\n\nclass WebGLMultipleRenderTargets extends WebGLRenderTarget {\n\n\tconstructor( width = 1, height = 1, count = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\tthis.isWebGLMultipleRenderTargets = true;\n\n\t\tconst texture = this.texture;\n\n\t\tthis.texture = [];\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.texture[ i ] = texture.clone();\n\t\t\tthis.texture[ i ].isRenderTargetTexture = true;\n\n\t\t}\n\n\t}\n\n\tsetSize( width, height, depth = 1 ) {\n\n\t\tif ( this.width !== width || this.height !== height || this.depth !== depth ) {\n\n\t\t\tthis.width = width;\n\t\t\tthis.height = height;\n\t\t\tthis.depth = depth;\n\n\t\t\tfor ( let i = 0, il = this.texture.length; i < il; i ++ ) {\n\n\t\t\t\tthis.texture[ i ].image.width = width;\n\t\t\t\tthis.texture[ i ].image.height = height;\n\t\t\t\tthis.texture[ i ].image.depth = depth;\n\n\t\t\t}\n\n\t\t\tthis.dispose();\n\n\t\t}\n\n\t\tthis.viewport.set( 0, 0, width, height );\n\t\tthis.scissor.set( 0, 0, width, height );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.dispose();\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\t\tthis.depth = source.depth;\n\n\t\tthis.scissor.copy( source.scissor );\n\t\tthis.scissorTest = source.scissorTest;\n\n\t\tthis.viewport.copy( source.viewport );\n\n\t\tthis.depthBuffer = source.depthBuffer;\n\t\tthis.stencilBuffer = source.stencilBuffer;\n\n\t\tif ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();\n\n\t\tthis.texture.length = 0;\n\n\t\tfor ( let i = 0, il = source.texture.length; i < il; i ++ ) {\n\n\t\t\tthis.texture[ i ] = source.texture[ i ].clone();\n\t\t\tthis.texture[ i ].isRenderTargetTexture = true;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Quaternion {\n\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\n\n\t\tthis.isQuaternion = true;\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._w = w;\n\n\t}\n\n\tstatic slerpFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) {\n\n\t\t// fuzz-free, array-based Quaternion SLERP operation\n\n\t\tlet x0 = src0[ srcOffset0 + 0 ],\n\t\t\ty0 = src0[ srcOffset0 + 1 ],\n\t\t\tz0 = src0[ srcOffset0 + 2 ],\n\t\t\tw0 = src0[ srcOffset0 + 3 ];\n\n\t\tconst x1 = src1[ srcOffset1 + 0 ],\n\t\t\ty1 = src1[ srcOffset1 + 1 ],\n\t\t\tz1 = src1[ srcOffset1 + 2 ],\n\t\t\tw1 = src1[ srcOffset1 + 3 ];\n\n\t\tif ( t === 0 ) {\n\n\t\t\tdst[ dstOffset + 0 ] = x0;\n\t\t\tdst[ dstOffset + 1 ] = y0;\n\t\t\tdst[ dstOffset + 2 ] = z0;\n\t\t\tdst[ dstOffset + 3 ] = w0;\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( t === 1 ) {\n\n\t\t\tdst[ dstOffset + 0 ] = x1;\n\t\t\tdst[ dstOffset + 1 ] = y1;\n\t\t\tdst[ dstOffset + 2 ] = z1;\n\t\t\tdst[ dstOffset + 3 ] = w1;\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1 ) {\n\n\t\t\tlet s = 1 - t;\n\t\t\tconst cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,\n\t\t\t\tdir = ( cos >= 0 ? 1 : - 1 ),\n\t\t\t\tsqrSin = 1 - cos * cos;\n\n\t\t\t// Skip the Slerp for tiny steps to avoid numeric problems:\n\t\t\tif ( sqrSin > Number.EPSILON ) {\n\n\t\t\t\tconst sin = Math.sqrt( sqrSin ),\n\t\t\t\t\tlen = Math.atan2( sin, cos * dir );\n\n\t\t\t\ts = Math.sin( s * len ) / sin;\n\t\t\t\tt = Math.sin( t * len ) / sin;\n\n\t\t\t}\n\n\t\t\tconst tDir = t * dir;\n\n\t\t\tx0 = x0 * s + x1 * tDir;\n\t\t\ty0 = y0 * s + y1 * tDir;\n\t\t\tz0 = z0 * s + z1 * tDir;\n\t\t\tw0 = w0 * s + w1 * tDir;\n\n\t\t\t// Normalize in case we just did a lerp:\n\t\t\tif ( s === 1 - t ) {\n\n\t\t\t\tconst f = 1 / Math.sqrt( x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0 );\n\n\t\t\t\tx0 *= f;\n\t\t\t\ty0 *= f;\n\t\t\t\tz0 *= f;\n\t\t\t\tw0 *= f;\n\n\t\t\t}\n\n\t\t}\n\n\t\tdst[ dstOffset ] = x0;\n\t\tdst[ dstOffset + 1 ] = y0;\n\t\tdst[ dstOffset + 2 ] = z0;\n\t\tdst[ dstOffset + 3 ] = w0;\n\n\t}\n\n\tstatic multiplyQuaternionsFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1 ) {\n\n\t\tconst x0 = src0[ srcOffset0 ];\n\t\tconst y0 = src0[ srcOffset0 + 1 ];\n\t\tconst z0 = src0[ srcOffset0 + 2 ];\n\t\tconst w0 = src0[ srcOffset0 + 3 ];\n\n\t\tconst x1 = src1[ srcOffset1 ];\n\t\tconst y1 = src1[ srcOffset1 + 1 ];\n\t\tconst z1 = src1[ srcOffset1 + 2 ];\n\t\tconst w1 = src1[ srcOffset1 + 3 ];\n\n\t\tdst[ dstOffset ] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;\n\t\tdst[ dstOffset + 1 ] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;\n\t\tdst[ dstOffset + 2 ] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;\n\t\tdst[ dstOffset + 3 ] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;\n\n\t\treturn dst;\n\n\t}\n\n\tget x() {\n\n\t\treturn this._x;\n\n\t}\n\n\tset x( value ) {\n\n\t\tthis._x = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget y() {\n\n\t\treturn this._y;\n\n\t}\n\n\tset y( value ) {\n\n\t\tthis._y = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget z() {\n\n\t\treturn this._z;\n\n\t}\n\n\tset z( value ) {\n\n\t\tthis._z = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget w() {\n\n\t\treturn this._w;\n\n\t}\n\n\tset w( value ) {\n\n\t\tthis._w = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tset( x, y, z, w ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._w = w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._w );\n\n\t}\n\n\tcopy( quaternion ) {\n\n\t\tthis._x = quaternion.x;\n\t\tthis._y = quaternion.y;\n\t\tthis._z = quaternion.z;\n\t\tthis._w = quaternion.w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromEuler( euler, update ) {\n\n\t\tconst x = euler._x, y = euler._y, z = euler._z, order = euler._order;\n\n\t\t// http://www.mathworks.com/matlabcentral/fileexchange/\n\t\t// \t20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/\n\t\t//\tcontent/SpinCalc.m\n\n\t\tconst cos = Math.cos;\n\t\tconst sin = Math.sin;\n\n\t\tconst c1 = cos( x / 2 );\n\t\tconst c2 = cos( y / 2 );\n\t\tconst c3 = cos( z / 2 );\n\n\t\tconst s1 = sin( x / 2 );\n\t\tconst s2 = sin( y / 2 );\n\t\tconst s3 = sin( z / 2 );\n\n\t\tswitch ( order ) {\n\n\t\t\tcase 'XYZ':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'YXZ':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZXY':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZYX':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'YZX':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'XZY':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tconsole.warn( 'THREE.Quaternion: .setFromEuler() encountered an unknown order: ' + order );\n\n\t\t}\n\n\t\tif ( update !== false ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromAxisAngle( axis, angle ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n\n\t\t// assumes axis is normalized\n\n\t\tconst halfAngle = angle / 2, s = Math.sin( halfAngle );\n\n\t\tthis._x = axis.x * s;\n\t\tthis._y = axis.y * s;\n\t\tthis._z = axis.z * s;\n\t\tthis._w = Math.cos( halfAngle );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromRotationMatrix( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tconst te = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ],\n\n\t\t\ttrace = m11 + m22 + m33;\n\n\t\tif ( trace > 0 ) {\n\n\t\t\tconst s = 0.5 / Math.sqrt( trace + 1.0 );\n\n\t\t\tthis._w = 0.25 / s;\n\t\t\tthis._x = ( m32 - m23 ) * s;\n\t\t\tthis._y = ( m13 - m31 ) * s;\n\t\t\tthis._z = ( m21 - m12 ) * s;\n\n\t\t} else if ( m11 > m22 && m11 > m33 ) {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 );\n\n\t\t\tthis._w = ( m32 - m23 ) / s;\n\t\t\tthis._x = 0.25 * s;\n\t\t\tthis._y = ( m12 + m21 ) / s;\n\t\t\tthis._z = ( m13 + m31 ) / s;\n\n\t\t} else if ( m22 > m33 ) {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 );\n\n\t\t\tthis._w = ( m13 - m31 ) / s;\n\t\t\tthis._x = ( m12 + m21 ) / s;\n\t\t\tthis._y = 0.25 * s;\n\t\t\tthis._z = ( m23 + m32 ) / s;\n\n\t\t} else {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 );\n\n\t\t\tthis._w = ( m21 - m12 ) / s;\n\t\t\tthis._x = ( m13 + m31 ) / s;\n\t\t\tthis._y = ( m23 + m32 ) / s;\n\t\t\tthis._z = 0.25 * s;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromUnitVectors( vFrom, vTo ) {\n\n\t\t// assumes direction vectors vFrom and vTo are normalized\n\n\t\tlet r = vFrom.dot( vTo ) + 1;\n\n\t\tif ( r < Number.EPSILON ) {\n\n\t\t\t// vFrom and vTo point in opposite directions\n\n\t\t\tr = 0;\n\n\t\t\tif ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\n\n\t\t\t\tthis._x = - vFrom.y;\n\t\t\t\tthis._y = vFrom.x;\n\t\t\t\tthis._z = 0;\n\t\t\t\tthis._w = r;\n\n\t\t\t} else {\n\n\t\t\t\tthis._x = 0;\n\t\t\t\tthis._y = - vFrom.z;\n\t\t\t\tthis._z = vFrom.y;\n\t\t\t\tthis._w = r;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3\n\n\t\t\tthis._x = vFrom.y * vTo.z - vFrom.z * vTo.y;\n\t\t\tthis._y = vFrom.z * vTo.x - vFrom.x * vTo.z;\n\t\t\tthis._z = vFrom.x * vTo.y - vFrom.y * vTo.x;\n\t\t\tthis._w = r;\n\n\t\t}\n\n\t\treturn this.normalize();\n\n\t}\n\n\tangleTo( q ) {\n\n\t\treturn 2 * Math.acos( Math.abs( clamp( this.dot( q ), - 1, 1 ) ) );\n\n\t}\n\n\trotateTowards( q, step ) {\n\n\t\tconst angle = this.angleTo( q );\n\n\t\tif ( angle === 0 ) return this;\n\n\t\tconst t = Math.min( 1, step / angle );\n\n\t\tthis.slerp( q, t );\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\treturn this.set( 0, 0, 0, 1 );\n\n\t}\n\n\tinvert() {\n\n\t\t// quaternion is assumed to have unit length\n\n\t\treturn this.conjugate();\n\n\t}\n\n\tconjugate() {\n\n\t\tthis._x *= - 1;\n\t\tthis._y *= - 1;\n\t\tthis._z *= - 1;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w );\n\n\t}\n\n\tnormalize() {\n\n\t\tlet l = this.length();\n\n\t\tif ( l === 0 ) {\n\n\t\t\tthis._x = 0;\n\t\t\tthis._y = 0;\n\t\t\tthis._z = 0;\n\t\t\tthis._w = 1;\n\n\t\t} else {\n\n\t\t\tl = 1 / l;\n\n\t\t\tthis._x = this._x * l;\n\t\t\tthis._y = this._y * l;\n\t\t\tthis._z = this._z * l;\n\t\t\tthis._w = this._w * l;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( q ) {\n\n\t\treturn this.multiplyQuaternions( this, q );\n\n\t}\n\n\tpremultiply( q ) {\n\n\t\treturn this.multiplyQuaternions( q, this );\n\n\t}\n\n\tmultiplyQuaternions( a, b ) {\n\n\t\t// from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n\n\t\tconst qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;\n\t\tconst qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;\n\n\t\tthis._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n\t\tthis._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n\t\tthis._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n\t\tthis._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tslerp( qb, t ) {\n\n\t\tif ( t === 0 ) return this;\n\t\tif ( t === 1 ) return this.copy( qb );\n\n\t\tconst x = this._x, y = this._y, z = this._z, w = this._w;\n\n\t\t// http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n\n\t\tlet cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;\n\n\t\tif ( cosHalfTheta < 0 ) {\n\n\t\t\tthis._w = - qb._w;\n\t\t\tthis._x = - qb._x;\n\t\t\tthis._y = - qb._y;\n\t\t\tthis._z = - qb._z;\n\n\t\t\tcosHalfTheta = - cosHalfTheta;\n\n\t\t} else {\n\n\t\t\tthis.copy( qb );\n\n\t\t}\n\n\t\tif ( cosHalfTheta >= 1.0 ) {\n\n\t\t\tthis._w = w;\n\t\t\tthis._x = x;\n\t\t\tthis._y = y;\n\t\t\tthis._z = z;\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;\n\n\t\tif ( sqrSinHalfTheta <= Number.EPSILON ) {\n\n\t\t\tconst s = 1 - t;\n\t\t\tthis._w = s * w + t * this._w;\n\t\t\tthis._x = s * x + t * this._x;\n\t\t\tthis._y = s * y + t * this._y;\n\t\t\tthis._z = s * z + t * this._z;\n\n\t\t\tthis.normalize();\n\t\t\tthis._onChangeCallback();\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst sinHalfTheta = Math.sqrt( sqrSinHalfTheta );\n\t\tconst halfTheta = Math.atan2( sinHalfTheta, cosHalfTheta );\n\t\tconst ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\n\t\t\tratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\n\n\t\tthis._w = ( w * ratioA + this._w * ratioB );\n\t\tthis._x = ( x * ratioA + this._x * ratioB );\n\t\tthis._y = ( y * ratioA + this._y * ratioB );\n\t\tthis._z = ( z * ratioA + this._z * ratioB );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tslerpQuaternions( qa, qb, t ) {\n\n\t\treturn this.copy( qa ).slerp( qb, t );\n\n\t}\n\n\trandom() {\n\n\t\t// Derived from http://planning.cs.uiuc.edu/node198.html\n\t\t// Note, this source uses w, x, y, z ordering,\n\t\t// so we swap the order below.\n\n\t\tconst u1 = Math.random();\n\t\tconst sqrt1u1 = Math.sqrt( 1 - u1 );\n\t\tconst sqrtu1 = Math.sqrt( u1 );\n\n\t\tconst u2 = 2 * Math.PI * Math.random();\n\n\t\tconst u3 = 2 * Math.PI * Math.random();\n\n\t\treturn this.set(\n\t\t\tsqrt1u1 * Math.cos( u2 ),\n\t\t\tsqrtu1 * Math.sin( u3 ),\n\t\t\tsqrtu1 * Math.cos( u3 ),\n\t\t\tsqrt1u1 * Math.sin( u2 ),\n\t\t);\n\n\t}\n\n\tequals( quaternion ) {\n\n\t\treturn ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis._x = array[ offset ];\n\t\tthis._y = array[ offset + 1 ];\n\t\tthis._z = array[ offset + 2 ];\n\t\tthis._w = array[ offset + 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._w;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis._x = attribute.getX( index );\n\t\tthis._y = attribute.getY( index );\n\t\tthis._z = attribute.getZ( index );\n\t\tthis._w = attribute.getW( index );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.toArray();\n\n\t}\n\n\t_onChange( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t_onChangeCallback() {}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this._x;\n\t\tyield this._y;\n\t\tyield this._z;\n\t\tyield this._w;\n\n\t}\n\n}\n\nclass Vector3 {\n\n\tconstructor( x = 0, y = 0, z = 0 ) {\n\n\t\tVector3.prototype.isVector3 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\n\t}\n\n\tset( x, y, z ) {\n\n\t\tif ( z === undefined ) z = this.z; // sprite.scale.set(x,y)\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y, this.z );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyVectors( a, b ) {\n\n\t\tthis.x = a.x * b.x;\n\t\tthis.y = a.y * b.y;\n\t\tthis.z = a.z * b.z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyEuler( euler ) {\n\n\t\treturn this.applyQuaternion( _quaternion$4.setFromEuler( euler ) );\n\n\t}\n\n\tapplyAxisAngle( axis, angle ) {\n\n\t\treturn this.applyQuaternion( _quaternion$4.setFromAxisAngle( axis, angle ) );\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\treturn this.applyMatrix3( m ).normalize();\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tconst w = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] );\n\n\t\tthis.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * w;\n\t\tthis.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * w;\n\t\tthis.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * w;\n\n\t\treturn this;\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\t// quaternion q is assumed to have unit length\n\n\t\tconst vx = this.x, vy = this.y, vz = this.z;\n\t\tconst qx = q.x, qy = q.y, qz = q.z, qw = q.w;\n\n\t\t// t = 2 * cross( q.xyz, v );\n\t\tconst tx = 2 * ( qy * vz - qz * vy );\n\t\tconst ty = 2 * ( qz * vx - qx * vz );\n\t\tconst tz = 2 * ( qx * vy - qy * vx );\n\n\t\t// v + q.w * t + cross( q.xyz, t );\n\t\tthis.x = vx + qw * tx + qy * tz - qz * ty;\n\t\tthis.y = vy + qw * ty + qz * tx - qx * tz;\n\t\tthis.z = vz + qw * tz + qx * ty - qy * tx;\n\n\t\treturn this;\n\n\t}\n\n\tproject( camera ) {\n\n\t\treturn this.applyMatrix4( camera.matrixWorldInverse ).applyMatrix4( camera.projectionMatrix );\n\n\t}\n\n\tunproject( camera ) {\n\n\t\treturn this.applyMatrix4( camera.projectionMatrixInverse ).applyMatrix4( camera.matrixWorld );\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\t// input: THREE.Matrix4 affine matrix\n\t\t// vector interpreted as a direction\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z;\n\n\t\treturn this.normalize();\n\n\t}\n\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\t\tthis.z /= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\t\tthis.z = Math.max( min.z, Math.min( max.z, this.z ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\t\tthis.z = Math.max( minVal, Math.min( maxVal, this.z ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\t\tthis.z = Math.trunc( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z;\n\n\t}\n\n\t// TODO lengthSquared?\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tcross( v ) {\n\n\t\treturn this.crossVectors( this, v );\n\n\t}\n\n\tcrossVectors( a, b ) {\n\n\t\tconst ax = a.x, ay = a.y, az = a.z;\n\t\tconst bx = b.x, by = b.y, bz = b.z;\n\n\t\tthis.x = ay * bz - az * by;\n\t\tthis.y = az * bx - ax * bz;\n\t\tthis.z = ax * by - ay * bx;\n\n\t\treturn this;\n\n\t}\n\n\tprojectOnVector( v ) {\n\n\t\tconst denominator = v.lengthSq();\n\n\t\tif ( denominator === 0 ) return this.set( 0, 0, 0 );\n\n\t\tconst scalar = v.dot( this ) / denominator;\n\n\t\treturn this.copy( v ).multiplyScalar( scalar );\n\n\t}\n\n\tprojectOnPlane( planeNormal ) {\n\n\t\t_vector$b.copy( this ).projectOnVector( planeNormal );\n\n\t\treturn this.sub( _vector$b );\n\n\t}\n\n\treflect( normal ) {\n\n\t\t// reflect incident vector off plane orthogonal to normal\n\t\t// normal is assumed to have unit length\n\n\t\treturn this.sub( _vector$b.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );\n\n\t}\n\n\tangleTo( v ) {\n\n\t\tconst denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\n\n\t\tif ( denominator === 0 ) return Math.PI / 2;\n\n\t\tconst theta = this.dot( v ) / denominator;\n\n\t\t// clamp, to handle numerical problems\n\n\t\treturn Math.acos( clamp( theta, - 1, 1 ) );\n\n\t}\n\n\tdistanceTo( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t}\n\n\tdistanceToSquared( v ) {\n\n\t\tconst dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;\n\n\t\treturn dx * dx + dy * dy + dz * dz;\n\n\t}\n\n\tmanhattanDistanceTo( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ) + Math.abs( this.z - v.z );\n\n\t}\n\n\tsetFromSpherical( s ) {\n\n\t\treturn this.setFromSphericalCoords( s.radius, s.phi, s.theta );\n\n\t}\n\n\tsetFromSphericalCoords( radius, phi, theta ) {\n\n\t\tconst sinPhiRadius = Math.sin( phi ) * radius;\n\n\t\tthis.x = sinPhiRadius * Math.sin( theta );\n\t\tthis.y = Math.cos( phi ) * radius;\n\t\tthis.z = sinPhiRadius * Math.cos( theta );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCylindrical( c ) {\n\n\t\treturn this.setFromCylindricalCoords( c.radius, c.theta, c.y );\n\n\t}\n\n\tsetFromCylindricalCoords( radius, theta, y ) {\n\n\t\tthis.x = radius * Math.sin( theta );\n\t\tthis.y = y;\n\t\tthis.z = radius * Math.cos( theta );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixPosition( m ) {\n\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 12 ];\n\t\tthis.y = e[ 13 ];\n\t\tthis.z = e[ 14 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixScale( m ) {\n\n\t\tconst sx = this.setFromMatrixColumn( m, 0 ).length();\n\t\tconst sy = this.setFromMatrixColumn( m, 1 ).length();\n\t\tconst sz = this.setFromMatrixColumn( m, 2 ).length();\n\n\t\tthis.x = sx;\n\t\tthis.y = sy;\n\t\tthis.z = sz;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixColumn( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 4 );\n\n\t}\n\n\tsetFromMatrix3Column( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 3 );\n\n\t}\n\n\tsetFromEuler( e ) {\n\n\t\tthis.x = e._x;\n\t\tthis.y = e._y;\n\t\tthis.z = e._z;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromColor( c ) {\n\n\t\tthis.x = c.r;\n\t\tthis.y = c.g;\n\t\tthis.z = c.b;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\t\tthis.z = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\trandomDirection() {\n\n\t\t// Derived from https://mathworld.wolfram.com/SpherePointPicking.html\n\n\t\tconst u = ( Math.random() - 0.5 ) * 2;\n\t\tconst t = Math.random() * Math.PI * 2;\n\t\tconst f = Math.sqrt( 1 - u ** 2 );\n\n\t\tthis.x = f * Math.cos( t );\n\t\tthis.y = f * Math.sin( t );\n\t\tthis.z = u;\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\t\tyield this.z;\n\n\t}\n\n}\n\nconst _vector$b = /*@__PURE__*/ new Vector3();\nconst _quaternion$4 = /*@__PURE__*/ new Quaternion();\n\nclass Box3 {\n\n\tconstructor( min = new Vector3( + Infinity, + Infinity, + Infinity ), max = new Vector3( - Infinity, - Infinity, - Infinity ) ) {\n\n\t\tthis.isBox3 = true;\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tset( min, max ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromArray( array ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = array.length; i < il; i += 3 ) {\n\n\t\t\tthis.expandByPoint( _vector$a.fromArray( array, i ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromBufferAttribute( attribute ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = attribute.count; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( _vector$a.fromBufferAttribute( attribute, i ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( points[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCenterAndSize( center, size ) {\n\n\t\tconst halfSize = _vector$a.copy( size ).multiplyScalar( 0.5 );\n\n\t\tthis.min.copy( center ).sub( halfSize );\n\t\tthis.max.copy( center ).add( halfSize );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromObject( object, precise = false ) {\n\n\t\tthis.makeEmpty();\n\n\t\treturn this.expandByObject( object, precise );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( box ) {\n\n\t\tthis.min.copy( box.min );\n\t\tthis.max.copy( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.min.x = this.min.y = this.min.z = + Infinity;\n\t\tthis.max.x = this.max.y = this.max.z = - Infinity;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z );\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\n\n\t}\n\n\tgetSize( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.subVectors( this.max, this.min );\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tthis.min.min( point );\n\t\tthis.max.max( point );\n\n\t\treturn this;\n\n\t}\n\n\texpandByVector( vector ) {\n\n\t\tthis.min.sub( vector );\n\t\tthis.max.add( vector );\n\n\t\treturn this;\n\n\t}\n\n\texpandByScalar( scalar ) {\n\n\t\tthis.min.addScalar( - scalar );\n\t\tthis.max.addScalar( scalar );\n\n\t\treturn this;\n\n\t}\n\n\texpandByObject( object, precise = false ) {\n\n\t\t// Computes the world-axis-aligned bounding box of an object (including its children),\n\t\t// accounting for both the object's, and children's, world transforms\n\n\t\tobject.updateWorldMatrix( false, false );\n\n\t\tconst geometry = object.geometry;\n\n\t\tif ( geometry !== undefined ) {\n\n\t\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\t\t// precise AABB computation based on vertex data requires at least a position attribute.\n\t\t\t// instancing isn't supported so far and uses the normal (conservative) code path.\n\n\t\t\tif ( precise === true && positionAttribute !== undefined && object.isInstancedMesh !== true ) {\n\n\t\t\t\tfor ( let i = 0, l = positionAttribute.count; i < l; i ++ ) {\n\n\t\t\t\t\tif ( object.isMesh === true ) {\n\n\t\t\t\t\t\tobject.getVertexPosition( i, _vector$a );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_vector$a.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_vector$a.applyMatrix4( object.matrixWorld );\n\t\t\t\t\tthis.expandByPoint( _vector$a );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( object.boundingBox !== undefined ) {\n\n\t\t\t\t\t// object-level bounding box\n\n\t\t\t\t\tif ( object.boundingBox === null ) {\n\n\t\t\t\t\t\tobject.computeBoundingBox();\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_box$3.copy( object.boundingBox );\n\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// geometry-level bounding box\n\n\t\t\t\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\t\t\t\tgeometry.computeBoundingBox();\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_box$3.copy( geometry.boundingBox );\n\n\t\t\t\t}\n\n\t\t\t\t_box$3.applyMatrix4( object.matrixWorld );\n\n\t\t\t\tthis.union( _box$3 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tthis.expandByObject( children[ i ], precise );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn point.x < this.min.x || point.x > this.max.x ||\n\t\t\tpoint.y < this.min.y || point.y > this.max.y ||\n\t\t\tpoint.z < this.min.z || point.z > this.max.z ? false : true;\n\n\t}\n\n\tcontainsBox( box ) {\n\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y &&\n\t\t\tthis.min.z <= box.min.z && box.max.z <= this.max.z;\n\n\t}\n\n\tgetParameter( point, target ) {\n\n\t\t// This can potentially have a divide by zero if the box\n\t\t// has a size dimension of 0.\n\n\t\treturn target.set(\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y ),\n\t\t\t( point.z - this.min.z ) / ( this.max.z - this.min.z )\n\t\t);\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\t// using 6 splitting planes to rule out intersections.\n\t\treturn box.max.x < this.min.x || box.min.x > this.max.x ||\n\t\t\tbox.max.y < this.min.y || box.min.y > this.max.y ||\n\t\t\tbox.max.z < this.min.z || box.min.z > this.max.z ? false : true;\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\t// Find the point on the AABB closest to the sphere center.\n\t\tthis.clampPoint( sphere.center, _vector$a );\n\n\t\t// If that point is inside the sphere, the AABB and sphere intersect.\n\t\treturn _vector$a.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\t// We compute the minimum and maximum dot product values. If those values\n\t\t// are on the same side (back or front) of the plane, then there is no intersection.\n\n\t\tlet min, max;\n\n\t\tif ( plane.normal.x > 0 ) {\n\n\t\t\tmin = plane.normal.x * this.min.x;\n\t\t\tmax = plane.normal.x * this.max.x;\n\n\t\t} else {\n\n\t\t\tmin = plane.normal.x * this.max.x;\n\t\t\tmax = plane.normal.x * this.min.x;\n\n\t\t}\n\n\t\tif ( plane.normal.y > 0 ) {\n\n\t\t\tmin += plane.normal.y * this.min.y;\n\t\t\tmax += plane.normal.y * this.max.y;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.y * this.max.y;\n\t\t\tmax += plane.normal.y * this.min.y;\n\n\t\t}\n\n\t\tif ( plane.normal.z > 0 ) {\n\n\t\t\tmin += plane.normal.z * this.min.z;\n\t\t\tmax += plane.normal.z * this.max.z;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.z * this.max.z;\n\t\t\tmax += plane.normal.z * this.min.z;\n\n\t\t}\n\n\t\treturn ( min <= - plane.constant && max >= - plane.constant );\n\n\t}\n\n\tintersectsTriangle( triangle ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// compute box center and extents\n\t\tthis.getCenter( _center );\n\t\t_extents.subVectors( this.max, _center );\n\n\t\t// translate triangle to aabb origin\n\t\t_v0$2.subVectors( triangle.a, _center );\n\t\t_v1$7.subVectors( triangle.b, _center );\n\t\t_v2$4.subVectors( triangle.c, _center );\n\n\t\t// compute edge vectors for triangle\n\t\t_f0.subVectors( _v1$7, _v0$2 );\n\t\t_f1.subVectors( _v2$4, _v1$7 );\n\t\t_f2.subVectors( _v0$2, _v2$4 );\n\n\t\t// test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb\n\t\t// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation\n\t\t// axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)\n\t\tlet axes = [\n\t\t\t0, - _f0.z, _f0.y, 0, - _f1.z, _f1.y, 0, - _f2.z, _f2.y,\n\t\t\t_f0.z, 0, - _f0.x, _f1.z, 0, - _f1.x, _f2.z, 0, - _f2.x,\n\t\t\t- _f0.y, _f0.x, 0, - _f1.y, _f1.x, 0, - _f2.y, _f2.x, 0\n\t\t];\n\t\tif ( ! satForAxes( axes, _v0$2, _v1$7, _v2$4, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// test 3 face normals from the aabb\n\t\taxes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];\n\t\tif ( ! satForAxes( axes, _v0$2, _v1$7, _v2$4, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// finally testing the face normal of the triangle\n\t\t// use already existing triangle edge vectors here\n\t\t_triangleNormal.crossVectors( _f0, _f1 );\n\t\taxes = [ _triangleNormal.x, _triangleNormal.y, _triangleNormal.z ];\n\n\t\treturn satForAxes( axes, _v0$2, _v1$7, _v2$4, _extents );\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\treturn target.copy( point ).clamp( this.min, this.max );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.clampPoint( point, _vector$a ).distanceTo( point );\n\n\t}\n\n\tgetBoundingSphere( target ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\ttarget.makeEmpty();\n\n\t\t} else {\n\n\t\t\tthis.getCenter( target.center );\n\n\t\t\ttarget.radius = this.getSize( _vector$a ).length() * 0.5;\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\tintersect( box ) {\n\n\t\tthis.min.max( box.min );\n\t\tthis.max.min( box.max );\n\n\t\t// ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.\n\t\tif ( this.isEmpty() ) this.makeEmpty();\n\n\t\treturn this;\n\n\t}\n\n\tunion( box ) {\n\n\t\tthis.min.min( box.min );\n\t\tthis.max.max( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\t// transform of empty box is an empty box.\n\t\tif ( this.isEmpty() ) return this;\n\n\t\t// NOTE: I am using a binary pattern to specify all 2^3 combinations below\n\t\t_points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000\n\t\t_points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001\n\t\t_points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010\n\t\t_points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011\n\t\t_points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100\n\t\t_points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101\n\t\t_points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110\n\t\t_points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111\n\n\t\tthis.setFromPoints( _points );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.min.add( offset );\n\t\tthis.max.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\tequals( box ) {\n\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\n\n\t}\n\n}\n\nconst _points = [\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3()\n];\n\nconst _vector$a = /*@__PURE__*/ new Vector3();\n\nconst _box$3 = /*@__PURE__*/ new Box3();\n\n// triangle centered vertices\n\nconst _v0$2 = /*@__PURE__*/ new Vector3();\nconst _v1$7 = /*@__PURE__*/ new Vector3();\nconst _v2$4 = /*@__PURE__*/ new Vector3();\n\n// triangle edge vectors\n\nconst _f0 = /*@__PURE__*/ new Vector3();\nconst _f1 = /*@__PURE__*/ new Vector3();\nconst _f2 = /*@__PURE__*/ new Vector3();\n\nconst _center = /*@__PURE__*/ new Vector3();\nconst _extents = /*@__PURE__*/ new Vector3();\nconst _triangleNormal = /*@__PURE__*/ new Vector3();\nconst _testAxis = /*@__PURE__*/ new Vector3();\n\nfunction satForAxes( axes, v0, v1, v2, extents ) {\n\n\tfor ( let i = 0, j = axes.length - 3; i <= j; i += 3 ) {\n\n\t\t_testAxis.fromArray( axes, i );\n\t\t// project the aabb onto the separating axis\n\t\tconst r = extents.x * Math.abs( _testAxis.x ) + extents.y * Math.abs( _testAxis.y ) + extents.z * Math.abs( _testAxis.z );\n\t\t// project all 3 vertices of the triangle onto the separating axis\n\t\tconst p0 = v0.dot( _testAxis );\n\t\tconst p1 = v1.dot( _testAxis );\n\t\tconst p2 = v2.dot( _testAxis );\n\t\t// actual test, basically see if either of the most extreme of the triangle points intersects r\n\t\tif ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {\n\n\t\t\t// points of the projected triangle are outside the projected half-length of the aabb\n\t\t\t// the axis is separating and we can exit\n\t\t\treturn false;\n\n\t\t}\n\n\t}\n\n\treturn true;\n\n}\n\nconst _box$2 = /*@__PURE__*/ new Box3();\nconst _v1$6 = /*@__PURE__*/ new Vector3();\nconst _v2$3 = /*@__PURE__*/ new Vector3();\n\nclass Sphere {\n\n\tconstructor( center = new Vector3(), radius = - 1 ) {\n\n\t\tthis.center = center;\n\t\tthis.radius = radius;\n\n\t}\n\n\tset( center, radius ) {\n\n\t\tthis.center.copy( center );\n\t\tthis.radius = radius;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points, optionalCenter ) {\n\n\t\tconst center = this.center;\n\n\t\tif ( optionalCenter !== undefined ) {\n\n\t\t\tcenter.copy( optionalCenter );\n\n\t\t} else {\n\n\t\t\t_box$2.setFromPoints( points ).getCenter( center );\n\n\t\t}\n\n\t\tlet maxRadiusSq = 0;\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );\n\n\t\t}\n\n\t\tthis.radius = Math.sqrt( maxRadiusSq );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( sphere ) {\n\n\t\tthis.center.copy( sphere.center );\n\t\tthis.radius = sphere.radius;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\treturn ( this.radius < 0 );\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.center.set( 0, 0, 0 );\n\t\tthis.radius = - 1;\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn ( point.distanceTo( this.center ) - this.radius );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\tconst radiusSum = this.radius + sphere.radius;\n\n\t\treturn sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsSphere( this );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\treturn Math.abs( plane.distanceToPoint( this.center ) ) <= this.radius;\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\tconst deltaLengthSq = this.center.distanceToSquared( point );\n\n\t\ttarget.copy( point );\n\n\t\tif ( deltaLengthSq > ( this.radius * this.radius ) ) {\n\n\t\t\ttarget.sub( this.center ).normalize();\n\t\t\ttarget.multiplyScalar( this.radius ).add( this.center );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\t// Empty sphere produces empty bounding box\n\t\t\ttarget.makeEmpty();\n\t\t\treturn target;\n\n\t\t}\n\n\t\ttarget.set( this.center, this.center );\n\t\ttarget.expandByScalar( this.radius );\n\n\t\treturn target;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tthis.center.applyMatrix4( matrix );\n\t\tthis.radius = this.radius * matrix.getMaxScaleOnAxis();\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.center.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\tthis.center.copy( point );\n\n\t\t\tthis.radius = 0;\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\t_v1$6.subVectors( point, this.center );\n\n\t\tconst lengthSq = _v1$6.lengthSq();\n\n\t\tif ( lengthSq > ( this.radius * this.radius ) ) {\n\n\t\t\t// calculate the minimal sphere\n\n\t\t\tconst length = Math.sqrt( lengthSq );\n\n\t\t\tconst delta = ( length - this.radius ) * 0.5;\n\n\t\t\tthis.center.addScaledVector( _v1$6, delta / length );\n\n\t\t\tthis.radius += delta;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tunion( sphere ) {\n\n\t\tif ( sphere.isEmpty() ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\tthis.copy( sphere );\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( this.center.equals( sphere.center ) === true ) {\n\n\t\t\t this.radius = Math.max( this.radius, sphere.radius );\n\n\t\t} else {\n\n\t\t\t_v2$3.subVectors( sphere.center, this.center ).setLength( sphere.radius );\n\n\t\t\tthis.expandByPoint( _v1$6.copy( sphere.center ).add( _v2$3 ) );\n\n\t\t\tthis.expandByPoint( _v1$6.copy( sphere.center ).sub( _v2$3 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tequals( sphere ) {\n\n\t\treturn sphere.center.equals( this.center ) && ( sphere.radius === this.radius );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$9 = /*@__PURE__*/ new Vector3();\nconst _segCenter = /*@__PURE__*/ new Vector3();\nconst _segDir = /*@__PURE__*/ new Vector3();\nconst _diff = /*@__PURE__*/ new Vector3();\n\nconst _edge1 = /*@__PURE__*/ new Vector3();\nconst _edge2 = /*@__PURE__*/ new Vector3();\nconst _normal$1 = /*@__PURE__*/ new Vector3();\n\nclass Ray {\n\n\tconstructor( origin = new Vector3(), direction = new Vector3( 0, 0, - 1 ) ) {\n\n\t\tthis.origin = origin;\n\t\tthis.direction = direction;\n\n\t}\n\n\tset( origin, direction ) {\n\n\t\tthis.origin.copy( origin );\n\t\tthis.direction.copy( direction );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( ray ) {\n\n\t\tthis.origin.copy( ray.origin );\n\t\tthis.direction.copy( ray.direction );\n\n\t\treturn this;\n\n\t}\n\n\tat( t, target ) {\n\n\t\treturn target.copy( this.origin ).addScaledVector( this.direction, t );\n\n\t}\n\n\tlookAt( v ) {\n\n\t\tthis.direction.copy( v ).sub( this.origin ).normalize();\n\n\t\treturn this;\n\n\t}\n\n\trecast( t ) {\n\n\t\tthis.origin.copy( this.at( t, _vector$9 ) );\n\n\t\treturn this;\n\n\t}\n\n\tclosestPointToPoint( point, target ) {\n\n\t\ttarget.subVectors( point, this.origin );\n\n\t\tconst directionDistance = target.dot( this.direction );\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn target.copy( this.origin );\n\n\t\t}\n\n\t\treturn target.copy( this.origin ).addScaledVector( this.direction, directionDistance );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn Math.sqrt( this.distanceSqToPoint( point ) );\n\n\t}\n\n\tdistanceSqToPoint( point ) {\n\n\t\tconst directionDistance = _vector$9.subVectors( point, this.origin ).dot( this.direction );\n\n\t\t// point behind the ray\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn this.origin.distanceToSquared( point );\n\n\t\t}\n\n\t\t_vector$9.copy( this.origin ).addScaledVector( this.direction, directionDistance );\n\n\t\treturn _vector$9.distanceToSquared( point );\n\n\t}\n\n\tdistanceSqToSegment( v0, v1, optionalPointOnRay, optionalPointOnSegment ) {\n\n\t\t// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteDistRaySegment.h\n\t\t// It returns the min distance between the ray and the segment\n\t\t// defined by v0 and v1\n\t\t// It can also set two optional targets :\n\t\t// - The closest point on the ray\n\t\t// - The closest point on the segment\n\n\t\t_segCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 );\n\t\t_segDir.copy( v1 ).sub( v0 ).normalize();\n\t\t_diff.copy( this.origin ).sub( _segCenter );\n\n\t\tconst segExtent = v0.distanceTo( v1 ) * 0.5;\n\t\tconst a01 = - this.direction.dot( _segDir );\n\t\tconst b0 = _diff.dot( this.direction );\n\t\tconst b1 = - _diff.dot( _segDir );\n\t\tconst c = _diff.lengthSq();\n\t\tconst det = Math.abs( 1 - a01 * a01 );\n\t\tlet s0, s1, sqrDist, extDet;\n\n\t\tif ( det > 0 ) {\n\n\t\t\t// The ray and segment are not parallel.\n\n\t\t\ts0 = a01 * b1 - b0;\n\t\t\ts1 = a01 * b0 - b1;\n\t\t\textDet = segExtent * det;\n\n\t\t\tif ( s0 >= 0 ) {\n\n\t\t\t\tif ( s1 >= - extDet ) {\n\n\t\t\t\t\tif ( s1 <= extDet ) {\n\n\t\t\t\t\t\t// region 0\n\t\t\t\t\t\t// Minimum at interior points of ray and segment.\n\n\t\t\t\t\t\tconst invDet = 1 / det;\n\t\t\t\t\t\ts0 *= invDet;\n\t\t\t\t\t\ts1 *= invDet;\n\t\t\t\t\t\tsqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// region 1\n\n\t\t\t\t\t\ts1 = segExtent;\n\t\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 5\n\n\t\t\t\t\ts1 = - segExtent;\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( s1 <= - extDet ) {\n\n\t\t\t\t\t// region 4\n\n\t\t\t\t\ts0 = Math.max( 0, - ( - a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else if ( s1 <= extDet ) {\n\n\t\t\t\t\t// region 3\n\n\t\t\t\t\ts0 = 0;\n\t\t\t\t\ts1 = Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 2\n\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// Ray and segment are parallel.\n\n\t\t\ts1 = ( a01 > 0 ) ? - segExtent : segExtent;\n\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t}\n\n\t\tif ( optionalPointOnRay ) {\n\n\t\t\toptionalPointOnRay.copy( this.origin ).addScaledVector( this.direction, s0 );\n\n\t\t}\n\n\t\tif ( optionalPointOnSegment ) {\n\n\t\t\toptionalPointOnSegment.copy( _segCenter ).addScaledVector( _segDir, s1 );\n\n\t\t}\n\n\t\treturn sqrDist;\n\n\t}\n\n\tintersectSphere( sphere, target ) {\n\n\t\t_vector$9.subVectors( sphere.center, this.origin );\n\t\tconst tca = _vector$9.dot( this.direction );\n\t\tconst d2 = _vector$9.dot( _vector$9 ) - tca * tca;\n\t\tconst radius2 = sphere.radius * sphere.radius;\n\n\t\tif ( d2 > radius2 ) return null;\n\n\t\tconst thc = Math.sqrt( radius2 - d2 );\n\n\t\t// t0 = first intersect point - entrance on front of sphere\n\t\tconst t0 = tca - thc;\n\n\t\t// t1 = second intersect point - exit point on back of sphere\n\t\tconst t1 = tca + thc;\n\n\t\t// test to see if t1 is behind the ray - if so, return null\n\t\tif ( t1 < 0 ) return null;\n\n\t\t// test to see if t0 is behind the ray:\n\t\t// if it is, the ray is inside the sphere, so return the second exit point scaled by t1,\n\t\t// in order to always return an intersect point that is in front of the ray.\n\t\tif ( t0 < 0 ) return this.at( t1, target );\n\n\t\t// else t0 is in front of the ray, so return the first collision point scaled by t0\n\t\treturn this.at( t0, target );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn this.distanceSqToPoint( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t}\n\n\tdistanceToPlane( plane ) {\n\n\t\tconst denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( plane.distanceToPoint( this.origin ) === 0 ) {\n\n\t\t\t\treturn 0;\n\n\t\t\t}\n\n\t\t\t// Null is preferable to undefined since undefined means.... it is undefined\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator;\n\n\t\t// Return if the ray never intersects the plane\n\n\t\treturn t >= 0 ? t : null;\n\n\t}\n\n\tintersectPlane( plane, target ) {\n\n\t\tconst t = this.distanceToPlane( plane );\n\n\t\tif ( t === null ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn this.at( t, target );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\t// check if the ray lies on the plane first\n\n\t\tconst distToPoint = plane.distanceToPoint( this.origin );\n\n\t\tif ( distToPoint === 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\tconst denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator * distToPoint < 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\t// ray origin is behind the plane (and is pointing behind it)\n\n\t\treturn false;\n\n\t}\n\n\tintersectBox( box, target ) {\n\n\t\tlet tmin, tmax, tymin, tymax, tzmin, tzmax;\n\n\t\tconst invdirx = 1 / this.direction.x,\n\t\t\tinvdiry = 1 / this.direction.y,\n\t\t\tinvdirz = 1 / this.direction.z;\n\n\t\tconst origin = this.origin;\n\n\t\tif ( invdirx >= 0 ) {\n\n\t\t\ttmin = ( box.min.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.max.x - origin.x ) * invdirx;\n\n\t\t} else {\n\n\t\t\ttmin = ( box.max.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.min.x - origin.x ) * invdirx;\n\n\t\t}\n\n\t\tif ( invdiry >= 0 ) {\n\n\t\t\ttymin = ( box.min.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.max.y - origin.y ) * invdiry;\n\n\t\t} else {\n\n\t\t\ttymin = ( box.max.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.min.y - origin.y ) * invdiry;\n\n\t\t}\n\n\t\tif ( ( tmin > tymax ) || ( tymin > tmax ) ) return null;\n\n\t\tif ( tymin > tmin || isNaN( tmin ) ) tmin = tymin;\n\n\t\tif ( tymax < tmax || isNaN( tmax ) ) tmax = tymax;\n\n\t\tif ( invdirz >= 0 ) {\n\n\t\t\ttzmin = ( box.min.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.max.z - origin.z ) * invdirz;\n\n\t\t} else {\n\n\t\t\ttzmin = ( box.max.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.min.z - origin.z ) * invdirz;\n\n\t\t}\n\n\t\tif ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null;\n\n\t\tif ( tzmin > tmin || tmin !== tmin ) tmin = tzmin;\n\n\t\tif ( tzmax < tmax || tmax !== tmax ) tmax = tzmax;\n\n\t\t//return point closest to the ray (positive side)\n\n\t\tif ( tmax < 0 ) return null;\n\n\t\treturn this.at( tmin >= 0 ? tmin : tmax, target );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn this.intersectBox( box, _vector$9 ) !== null;\n\n\t}\n\n\tintersectTriangle( a, b, c, backfaceCulling, target ) {\n\n\t\t// Compute the offset origin, edges, and normal.\n\n\t\t// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h\n\n\t\t_edge1.subVectors( b, a );\n\t\t_edge2.subVectors( c, a );\n\t\t_normal$1.crossVectors( _edge1, _edge2 );\n\n\t\t// Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,\n\t\t// E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by\n\t\t// |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))\n\t\t// |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))\n\t\t// |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)\n\t\tlet DdN = this.direction.dot( _normal$1 );\n\t\tlet sign;\n\n\t\tif ( DdN > 0 ) {\n\n\t\t\tif ( backfaceCulling ) return null;\n\t\t\tsign = 1;\n\n\t\t} else if ( DdN < 0 ) {\n\n\t\t\tsign = - 1;\n\t\t\tDdN = - DdN;\n\n\t\t} else {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t_diff.subVectors( this.origin, a );\n\t\tconst DdQxE2 = sign * this.direction.dot( _edge2.crossVectors( _diff, _edge2 ) );\n\n\t\t// b1 < 0, no intersection\n\t\tif ( DdQxE2 < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst DdE1xQ = sign * this.direction.dot( _edge1.cross( _diff ) );\n\n\t\t// b2 < 0, no intersection\n\t\tif ( DdE1xQ < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// b1+b2 > 1, no intersection\n\t\tif ( DdQxE2 + DdE1xQ > DdN ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Line intersects triangle, check if ray does.\n\t\tconst QdN = - sign * _diff.dot( _normal$1 );\n\n\t\t// t < 0, no intersection\n\t\tif ( QdN < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Ray intersects triangle.\n\t\treturn this.at( QdN / DdN, target );\n\n\t}\n\n\tapplyMatrix4( matrix4 ) {\n\n\t\tthis.origin.applyMatrix4( matrix4 );\n\t\tthis.direction.transformDirection( matrix4 );\n\n\t\treturn this;\n\n\t}\n\n\tequals( ray ) {\n\n\t\treturn ray.origin.equals( this.origin ) && ray.direction.equals( this.direction );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nclass Matrix4 {\n\n\tconstructor( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\n\n\t\tMatrix4.prototype.isMatrix4 = true;\n\n\t\tthis.elements = [\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, 1, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t];\n\n\t\tif ( n11 !== undefined ) {\n\n\t\t\tthis.set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 );\n\n\t\t}\n\n\t}\n\n\tset( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14;\n\t\tte[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24;\n\t\tte[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34;\n\t\tte[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44;\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, 1, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Matrix4().fromArray( this.elements );\n\n\t}\n\n\tcopy( m ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ]; te[ 3 ] = me[ 3 ];\n\t\tte[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ]; te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ];\n\t\tte[ 8 ] = me[ 8 ]; te[ 9 ] = me[ 9 ]; te[ 10 ] = me[ 10 ]; te[ 11 ] = me[ 11 ];\n\t\tte[ 12 ] = me[ 12 ]; te[ 13 ] = me[ 13 ]; te[ 14 ] = me[ 14 ]; te[ 15 ] = me[ 15 ];\n\n\t\treturn this;\n\n\t}\n\n\tcopyPosition( m ) {\n\n\t\tconst te = this.elements, me = m.elements;\n\n\t\tte[ 12 ] = me[ 12 ];\n\t\tte[ 13 ] = me[ 13 ];\n\t\tte[ 14 ] = me[ 14 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrix3( m ) {\n\n\t\tconst me = m.elements;\n\n\t\tthis.set(\n\n\t\t\tme[ 0 ], me[ 3 ], me[ 6 ], 0,\n\t\t\tme[ 1 ], me[ 4 ], me[ 7 ], 0,\n\t\t\tme[ 2 ], me[ 5 ], me[ 8 ], 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\textractBasis( xAxis, yAxis, zAxis ) {\n\n\t\txAxis.setFromMatrixColumn( this, 0 );\n\t\tyAxis.setFromMatrixColumn( this, 1 );\n\t\tzAxis.setFromMatrixColumn( this, 2 );\n\n\t\treturn this;\n\n\t}\n\n\tmakeBasis( xAxis, yAxis, zAxis ) {\n\n\t\tthis.set(\n\t\t\txAxis.x, yAxis.x, zAxis.x, 0,\n\t\t\txAxis.y, yAxis.y, zAxis.y, 0,\n\t\t\txAxis.z, yAxis.z, zAxis.z, 0,\n\t\t\t0, 0, 0, 1\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\textractRotation( m ) {\n\n\t\t// this method does not support reflection matrices\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tconst scaleX = 1 / _v1$5.setFromMatrixColumn( m, 0 ).length();\n\t\tconst scaleY = 1 / _v1$5.setFromMatrixColumn( m, 1 ).length();\n\t\tconst scaleZ = 1 / _v1$5.setFromMatrixColumn( m, 2 ).length();\n\n\t\tte[ 0 ] = me[ 0 ] * scaleX;\n\t\tte[ 1 ] = me[ 1 ] * scaleX;\n\t\tte[ 2 ] = me[ 2 ] * scaleX;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = me[ 4 ] * scaleY;\n\t\tte[ 5 ] = me[ 5 ] * scaleY;\n\t\tte[ 6 ] = me[ 6 ] * scaleY;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = me[ 8 ] * scaleZ;\n\t\tte[ 9 ] = me[ 9 ] * scaleZ;\n\t\tte[ 10 ] = me[ 10 ] * scaleZ;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationFromEuler( euler ) {\n\n\t\tconst te = this.elements;\n\n\t\tconst x = euler.x, y = euler.y, z = euler.z;\n\t\tconst a = Math.cos( x ), b = Math.sin( x );\n\t\tconst c = Math.cos( y ), d = Math.sin( y );\n\t\tconst e = Math.cos( z ), f = Math.sin( z );\n\n\t\tif ( euler.order === 'XYZ' ) {\n\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - c * f;\n\t\t\tte[ 8 ] = d;\n\n\t\t\tte[ 1 ] = af + be * d;\n\t\t\tte[ 5 ] = ae - bf * d;\n\t\t\tte[ 9 ] = - b * c;\n\n\t\t\tte[ 2 ] = bf - ae * d;\n\t\t\tte[ 6 ] = be + af * d;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YXZ' ) {\n\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce + df * b;\n\t\t\tte[ 4 ] = de * b - cf;\n\t\t\tte[ 8 ] = a * d;\n\n\t\t\tte[ 1 ] = a * f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b;\n\n\t\t\tte[ 2 ] = cf * b - de;\n\t\t\tte[ 6 ] = df + ce * b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZXY' ) {\n\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce - df * b;\n\t\t\tte[ 4 ] = - a * f;\n\t\t\tte[ 8 ] = de + cf * b;\n\n\t\t\tte[ 1 ] = cf + de * b;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = df - ce * b;\n\n\t\t\tte[ 2 ] = - a * d;\n\t\t\tte[ 6 ] = b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZYX' ) {\n\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = be * d - af;\n\t\t\tte[ 8 ] = ae * d + bf;\n\n\t\t\tte[ 1 ] = c * f;\n\t\t\tte[ 5 ] = bf * d + ae;\n\t\t\tte[ 9 ] = af * d - be;\n\n\t\t\tte[ 2 ] = - d;\n\t\t\tte[ 6 ] = b * c;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YZX' ) {\n\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = bd - ac * f;\n\t\t\tte[ 8 ] = bc * f + ad;\n\n\t\t\tte[ 1 ] = f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b * e;\n\n\t\t\tte[ 2 ] = - d * e;\n\t\t\tte[ 6 ] = ad * f + bc;\n\t\t\tte[ 10 ] = ac - bd * f;\n\n\t\t} else if ( euler.order === 'XZY' ) {\n\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - f;\n\t\t\tte[ 8 ] = d * e;\n\n\t\t\tte[ 1 ] = ac * f + bd;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = ad * f - bc;\n\n\t\t\tte[ 2 ] = bc * f - ad;\n\t\t\tte[ 6 ] = b * e;\n\t\t\tte[ 10 ] = bd * f + ac;\n\n\t\t}\n\n\t\t// bottom row\n\t\tte[ 3 ] = 0;\n\t\tte[ 7 ] = 0;\n\t\tte[ 11 ] = 0;\n\n\t\t// last column\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationFromQuaternion( q ) {\n\n\t\treturn this.compose( _zero, q, _one );\n\n\t}\n\n\tlookAt( eye, target, up ) {\n\n\t\tconst te = this.elements;\n\n\t\t_z.subVectors( eye, target );\n\n\t\tif ( _z.lengthSq() === 0 ) {\n\n\t\t\t// eye and target are in the same position\n\n\t\t\t_z.z = 1;\n\n\t\t}\n\n\t\t_z.normalize();\n\t\t_x.crossVectors( up, _z );\n\n\t\tif ( _x.lengthSq() === 0 ) {\n\n\t\t\t// up and z are parallel\n\n\t\t\tif ( Math.abs( up.z ) === 1 ) {\n\n\t\t\t\t_z.x += 0.0001;\n\n\t\t\t} else {\n\n\t\t\t\t_z.z += 0.0001;\n\n\t\t\t}\n\n\t\t\t_z.normalize();\n\t\t\t_x.crossVectors( up, _z );\n\n\t\t}\n\n\t\t_x.normalize();\n\t\t_y.crossVectors( _z, _x );\n\n\t\tte[ 0 ] = _x.x; te[ 4 ] = _y.x; te[ 8 ] = _z.x;\n\t\tte[ 1 ] = _x.y; te[ 5 ] = _y.y; te[ 9 ] = _z.y;\n\t\tte[ 2 ] = _x.z; te[ 6 ] = _y.z; te[ 10 ] = _z.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( m ) {\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t}\n\n\tpremultiply( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t}\n\n\tmultiplyMatrices( a, b ) {\n\n\t\tconst ae = a.elements;\n\t\tconst be = b.elements;\n\t\tconst te = this.elements;\n\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ];\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ];\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ];\n\t\tconst a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ];\n\n\t\tconst b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ];\n\t\tconst b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ];\n\t\tconst b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ];\n\t\tconst b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;\n\t\tte[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;\n\t\tte[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;\n\t\tte[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;\n\t\tte[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;\n\t\tte[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;\n\t\tte[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;\n\t\tte[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;\n\t\tte[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;\n\t\tte[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;\n\n\t\tte[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;\n\t\tte[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;\n\t\tte[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;\n\t\tte[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s;\n\t\tte[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s;\n\t\tte[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s;\n\t\tte[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s;\n\n\t\treturn this;\n\n\t}\n\n\tdeterminant() {\n\n\t\tconst te = this.elements;\n\n\t\tconst n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ];\n\t\tconst n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ];\n\t\tconst n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ];\n\t\tconst n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ];\n\n\t\t//TODO: make this more efficient\n\t\t//( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )\n\n\t\treturn (\n\t\t\tn41 * (\n\t\t\t\t+ n14 * n23 * n32\n\t\t\t\t - n13 * n24 * n32\n\t\t\t\t - n14 * n22 * n33\n\t\t\t\t + n12 * n24 * n33\n\t\t\t\t + n13 * n22 * n34\n\t\t\t\t - n12 * n23 * n34\n\t\t\t) +\n\t\t\tn42 * (\n\t\t\t\t+ n11 * n23 * n34\n\t\t\t\t - n11 * n24 * n33\n\t\t\t\t + n14 * n21 * n33\n\t\t\t\t - n13 * n21 * n34\n\t\t\t\t + n13 * n24 * n31\n\t\t\t\t - n14 * n23 * n31\n\t\t\t) +\n\t\t\tn43 * (\n\t\t\t\t+ n11 * n24 * n32\n\t\t\t\t - n11 * n22 * n34\n\t\t\t\t - n14 * n21 * n32\n\t\t\t\t + n12 * n21 * n34\n\t\t\t\t + n14 * n22 * n31\n\t\t\t\t - n12 * n24 * n31\n\t\t\t) +\n\t\t\tn44 * (\n\t\t\t\t- n13 * n22 * n31\n\t\t\t\t - n11 * n23 * n32\n\t\t\t\t + n11 * n22 * n33\n\t\t\t\t + n13 * n21 * n32\n\t\t\t\t - n12 * n21 * n33\n\t\t\t\t + n12 * n23 * n31\n\t\t\t)\n\n\t\t);\n\n\t}\n\n\ttranspose() {\n\n\t\tconst te = this.elements;\n\t\tlet tmp;\n\n\t\ttmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp;\n\t\ttmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp;\n\t\ttmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp;\n\n\t\ttmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp;\n\t\ttmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp;\n\t\ttmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp;\n\n\t\treturn this;\n\n\t}\n\n\tsetPosition( x, y, z ) {\n\n\t\tconst te = this.elements;\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\tte[ 12 ] = x.x;\n\t\t\tte[ 13 ] = x.y;\n\t\t\tte[ 14 ] = x.z;\n\n\t\t} else {\n\n\t\t\tte[ 12 ] = x;\n\t\t\tte[ 13 ] = y;\n\t\t\tte[ 14 ] = z;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tinvert() {\n\n\t\t// based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm\n\t\tconst te = this.elements,\n\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ], n41 = te[ 3 ],\n\t\t\tn12 = te[ 4 ], n22 = te[ 5 ], n32 = te[ 6 ], n42 = te[ 7 ],\n\t\t\tn13 = te[ 8 ], n23 = te[ 9 ], n33 = te[ 10 ], n43 = te[ 11 ],\n\t\t\tn14 = te[ 12 ], n24 = te[ 13 ], n34 = te[ 14 ], n44 = te[ 15 ],\n\n\t\t\tt11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44,\n\t\t\tt12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44,\n\t\t\tt13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44,\n\t\t\tt14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;\n\n\t\tconst det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;\n\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );\n\n\t\tconst detInv = 1 / det;\n\n\t\tte[ 0 ] = t11 * detInv;\n\t\tte[ 1 ] = ( n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44 ) * detInv;\n\t\tte[ 2 ] = ( n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44 ) * detInv;\n\t\tte[ 3 ] = ( n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43 ) * detInv;\n\n\t\tte[ 4 ] = t12 * detInv;\n\t\tte[ 5 ] = ( n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44 ) * detInv;\n\t\tte[ 6 ] = ( n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44 ) * detInv;\n\t\tte[ 7 ] = ( n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43 ) * detInv;\n\n\t\tte[ 8 ] = t13 * detInv;\n\t\tte[ 9 ] = ( n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44 ) * detInv;\n\t\tte[ 10 ] = ( n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44 ) * detInv;\n\t\tte[ 11 ] = ( n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43 ) * detInv;\n\n\t\tte[ 12 ] = t14 * detInv;\n\t\tte[ 13 ] = ( n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34 ) * detInv;\n\t\tte[ 14 ] = ( n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34 ) * detInv;\n\t\tte[ 15 ] = ( n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33 ) * detInv;\n\n\t\treturn this;\n\n\t}\n\n\tscale( v ) {\n\n\t\tconst te = this.elements;\n\t\tconst x = v.x, y = v.y, z = v.z;\n\n\t\tte[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z;\n\t\tte[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z;\n\t\tte[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z;\n\t\tte[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z;\n\n\t\treturn this;\n\n\t}\n\n\tgetMaxScaleOnAxis() {\n\n\t\tconst te = this.elements;\n\n\t\tconst scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ];\n\t\tconst scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ];\n\t\tconst scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ];\n\n\t\treturn Math.sqrt( Math.max( scaleXSq, scaleYSq, scaleZSq ) );\n\n\t}\n\n\tmakeTranslation( x, y, z ) {\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, 0, x.x,\n\t\t\t\t0, 1, 0, x.y,\n\t\t\t\t0, 0, 1, x.z,\n\t\t\t\t0, 0, 0, 1\n\n\t\t\t);\n\n\t\t} else {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, 0, x,\n\t\t\t\t0, 1, 0, y,\n\t\t\t\t0, 0, 1, z,\n\t\t\t\t0, 0, 0, 1\n\n\t\t\t);\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationX( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, c, - s, 0,\n\t\t\t0, s, c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationY( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t c, 0, s, 0,\n\t\t\t 0, 1, 0, 0,\n\t\t\t- s, 0, c, 0,\n\t\t\t 0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationZ( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\tc, - s, 0, 0,\n\t\t\ts, c, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationAxis( axis, angle ) {\n\n\t\t// Based on http://www.gamedev.net/reference/articles/article1199.asp\n\n\t\tconst c = Math.cos( angle );\n\t\tconst s = Math.sin( angle );\n\t\tconst t = 1 - c;\n\t\tconst x = axis.x, y = axis.y, z = axis.z;\n\t\tconst tx = t * x, ty = t * y;\n\n\t\tthis.set(\n\n\t\t\ttx * x + c, tx * y - s * z, tx * z + s * y, 0,\n\t\t\ttx * y + s * z, ty * y + c, ty * z - s * x, 0,\n\t\t\ttx * z - s * y, ty * z + s * x, t * z * z + c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeScale( x, y, z ) {\n\n\t\tthis.set(\n\n\t\t\tx, 0, 0, 0,\n\t\t\t0, y, 0, 0,\n\t\t\t0, 0, z, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeShear( xy, xz, yx, yz, zx, zy ) {\n\n\t\tthis.set(\n\n\t\t\t1, yx, zx, 0,\n\t\t\txy, 1, zy, 0,\n\t\t\txz, yz, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tcompose( position, quaternion, scale ) {\n\n\t\tconst te = this.elements;\n\n\t\tconst x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w;\n\t\tconst x2 = x + x,\ty2 = y + y, z2 = z + z;\n\t\tconst xx = x * x2, xy = x * y2, xz = x * z2;\n\t\tconst yy = y * y2, yz = y * z2, zz = z * z2;\n\t\tconst wx = w * x2, wy = w * y2, wz = w * z2;\n\n\t\tconst sx = scale.x, sy = scale.y, sz = scale.z;\n\n\t\tte[ 0 ] = ( 1 - ( yy + zz ) ) * sx;\n\t\tte[ 1 ] = ( xy + wz ) * sx;\n\t\tte[ 2 ] = ( xz - wy ) * sx;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = ( xy - wz ) * sy;\n\t\tte[ 5 ] = ( 1 - ( xx + zz ) ) * sy;\n\t\tte[ 6 ] = ( yz + wx ) * sy;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = ( xz + wy ) * sz;\n\t\tte[ 9 ] = ( yz - wx ) * sz;\n\t\tte[ 10 ] = ( 1 - ( xx + yy ) ) * sz;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = position.x;\n\t\tte[ 13 ] = position.y;\n\t\tte[ 14 ] = position.z;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tdecompose( position, quaternion, scale ) {\n\n\t\tconst te = this.elements;\n\n\t\tlet sx = _v1$5.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();\n\t\tconst sy = _v1$5.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();\n\t\tconst sz = _v1$5.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();\n\n\t\t// if determine is negative, we need to invert one scale\n\t\tconst det = this.determinant();\n\t\tif ( det < 0 ) sx = - sx;\n\n\t\tposition.x = te[ 12 ];\n\t\tposition.y = te[ 13 ];\n\t\tposition.z = te[ 14 ];\n\n\t\t// scale the rotation part\n\t\t_m1$2.copy( this );\n\n\t\tconst invSX = 1 / sx;\n\t\tconst invSY = 1 / sy;\n\t\tconst invSZ = 1 / sz;\n\n\t\t_m1$2.elements[ 0 ] *= invSX;\n\t\t_m1$2.elements[ 1 ] *= invSX;\n\t\t_m1$2.elements[ 2 ] *= invSX;\n\n\t\t_m1$2.elements[ 4 ] *= invSY;\n\t\t_m1$2.elements[ 5 ] *= invSY;\n\t\t_m1$2.elements[ 6 ] *= invSY;\n\n\t\t_m1$2.elements[ 8 ] *= invSZ;\n\t\t_m1$2.elements[ 9 ] *= invSZ;\n\t\t_m1$2.elements[ 10 ] *= invSZ;\n\n\t\tquaternion.setFromRotationMatrix( _m1$2 );\n\n\t\tscale.x = sx;\n\t\tscale.y = sy;\n\t\tscale.z = sz;\n\n\t\treturn this;\n\n\t}\n\n\tmakePerspective( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst te = this.elements;\n\t\tconst x = 2 * near / ( right - left );\n\t\tconst y = 2 * near / ( top - bottom );\n\n\t\tconst a = ( right + left ) / ( right - left );\n\t\tconst b = ( top + bottom ) / ( top - bottom );\n\n\t\tlet c, d;\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tc = - ( far + near ) / ( far - near );\n\t\t\td = ( - 2 * far * near ) / ( far - near );\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tc = - far / ( far - near );\n\t\t\td = ( - far * near ) / ( far - near );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Matrix4.makePerspective(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tte[ 0 ] = x;\tte[ 4 ] = 0;\tte[ 8 ] = a; \tte[ 12 ] = 0;\n\t\tte[ 1 ] = 0;\tte[ 5 ] = y;\tte[ 9 ] = b; \tte[ 13 ] = 0;\n\t\tte[ 2 ] = 0;\tte[ 6 ] = 0;\tte[ 10 ] = c; \tte[ 14 ] = d;\n\t\tte[ 3 ] = 0;\tte[ 7 ] = 0;\tte[ 11 ] = - 1;\tte[ 15 ] = 0;\n\n\t\treturn this;\n\n\t}\n\n\tmakeOrthographic( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst te = this.elements;\n\t\tconst w = 1.0 / ( right - left );\n\t\tconst h = 1.0 / ( top - bottom );\n\t\tconst p = 1.0 / ( far - near );\n\n\t\tconst x = ( right + left ) * w;\n\t\tconst y = ( top + bottom ) * h;\n\n\t\tlet z, zInv;\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tz = ( far + near ) * p;\n\t\t\tzInv = - 2 * p;\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tz = near * p;\n\t\t\tzInv = - 1 * p;\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Matrix4.makeOrthographic(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tte[ 0 ] = 2 * w;\tte[ 4 ] = 0;\t\tte[ 8 ] = 0; \t\tte[ 12 ] = - x;\n\t\tte[ 1 ] = 0; \t\tte[ 5 ] = 2 * h;\tte[ 9 ] = 0; \t\tte[ 13 ] = - y;\n\t\tte[ 2 ] = 0; \t\tte[ 6 ] = 0;\t\tte[ 10 ] = zInv;\tte[ 14 ] = - z;\n\t\tte[ 3 ] = 0; \t\tte[ 7 ] = 0;\t\tte[ 11 ] = 0;\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tequals( matrix ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = matrix.elements;\n\n\t\tfor ( let i = 0; i < 16; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 16; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\t\tarray[ offset + 9 ] = te[ 9 ];\n\t\tarray[ offset + 10 ] = te[ 10 ];\n\t\tarray[ offset + 11 ] = te[ 11 ];\n\n\t\tarray[ offset + 12 ] = te[ 12 ];\n\t\tarray[ offset + 13 ] = te[ 13 ];\n\t\tarray[ offset + 14 ] = te[ 14 ];\n\t\tarray[ offset + 15 ] = te[ 15 ];\n\n\t\treturn array;\n\n\t}\n\n}\n\nconst _v1$5 = /*@__PURE__*/ new Vector3();\nconst _m1$2 = /*@__PURE__*/ new Matrix4();\nconst _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );\nconst _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );\nconst _x = /*@__PURE__*/ new Vector3();\nconst _y = /*@__PURE__*/ new Vector3();\nconst _z = /*@__PURE__*/ new Vector3();\n\nconst _matrix = /*@__PURE__*/ new Matrix4();\nconst _quaternion$3 = /*@__PURE__*/ new Quaternion();\n\nclass Euler {\n\n\tconstructor( x = 0, y = 0, z = 0, order = Euler.DEFAULT_ORDER ) {\n\n\t\tthis.isEuler = true;\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._order = order;\n\n\t}\n\n\tget x() {\n\n\t\treturn this._x;\n\n\t}\n\n\tset x( value ) {\n\n\t\tthis._x = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget y() {\n\n\t\treturn this._y;\n\n\t}\n\n\tset y( value ) {\n\n\t\tthis._y = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget z() {\n\n\t\treturn this._z;\n\n\t}\n\n\tset z( value ) {\n\n\t\tthis._z = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget order() {\n\n\t\treturn this._order;\n\n\t}\n\n\tset order( value ) {\n\n\t\tthis._order = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tset( x, y, z, order = this._order ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._order = order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._order );\n\n\t}\n\n\tcopy( euler ) {\n\n\t\tthis._x = euler._x;\n\t\tthis._y = euler._y;\n\t\tthis._z = euler._z;\n\t\tthis._order = euler._order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromRotationMatrix( m, order = this._order, update = true ) {\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tconst te = m.elements;\n\t\tconst m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ];\n\t\tconst m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ];\n\t\tconst m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tswitch ( order ) {\n\n\t\t\tcase 'XYZ':\n\n\t\t\t\tthis._y = Math.asin( clamp( m13, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m13 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\t\tthis._z = Math.atan2( - m12, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\t\tthis._z = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'YXZ':\n\n\t\t\t\tthis._x = Math.asin( - clamp( m23, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m23 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\t\t\t\t\tthis._z = Math.atan2( m21, m22 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\t\t\t\t\tthis._z = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZXY':\n\n\t\t\t\tthis._x = Math.asin( clamp( m32, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m32 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._y = Math.atan2( - m31, m33 );\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._y = 0;\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZYX':\n\n\t\t\t\tthis._y = Math.asin( - clamp( m31, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m31 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m33 );\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = 0;\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'YZX':\n\n\t\t\t\tthis._z = Math.asin( clamp( m21, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m21 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m22 );\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = 0;\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'XZY':\n\n\t\t\t\tthis._z = Math.asin( - clamp( m12, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m12 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\t\tthis._y = Math.atan2( m13, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\t\tthis._y = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tconsole.warn( 'THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' + order );\n\n\t\t}\n\n\t\tthis._order = order;\n\n\t\tif ( update === true ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromQuaternion( q, order, update ) {\n\n\t\t_matrix.makeRotationFromQuaternion( q );\n\n\t\treturn this.setFromRotationMatrix( _matrix, order, update );\n\n\t}\n\n\tsetFromVector3( v, order = this._order ) {\n\n\t\treturn this.set( v.x, v.y, v.z, order );\n\n\t}\n\n\treorder( newOrder ) {\n\n\t\t// WARNING: this discards revolution information -bhouston\n\n\t\t_quaternion$3.setFromEuler( this );\n\n\t\treturn this.setFromQuaternion( _quaternion$3, newOrder );\n\n\t}\n\n\tequals( euler ) {\n\n\t\treturn ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order );\n\n\t}\n\n\tfromArray( array ) {\n\n\t\tthis._x = array[ 0 ];\n\t\tthis._y = array[ 1 ];\n\t\tthis._z = array[ 2 ];\n\t\tif ( array[ 3 ] !== undefined ) this._order = array[ 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._order;\n\n\t\treturn array;\n\n\t}\n\n\t_onChange( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t_onChangeCallback() {}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this._x;\n\t\tyield this._y;\n\t\tyield this._z;\n\t\tyield this._order;\n\n\t}\n\n}\n\nEuler.DEFAULT_ORDER = 'XYZ';\n\nclass Layers {\n\n\tconstructor() {\n\n\t\tthis.mask = 1 | 0;\n\n\t}\n\n\tset( channel ) {\n\n\t\tthis.mask = ( 1 << channel | 0 ) >>> 0;\n\n\t}\n\n\tenable( channel ) {\n\n\t\tthis.mask |= 1 << channel | 0;\n\n\t}\n\n\tenableAll() {\n\n\t\tthis.mask = 0xffffffff | 0;\n\n\t}\n\n\ttoggle( channel ) {\n\n\t\tthis.mask ^= 1 << channel | 0;\n\n\t}\n\n\tdisable( channel ) {\n\n\t\tthis.mask &= ~ ( 1 << channel | 0 );\n\n\t}\n\n\tdisableAll() {\n\n\t\tthis.mask = 0;\n\n\t}\n\n\ttest( layers ) {\n\n\t\treturn ( this.mask & layers.mask ) !== 0;\n\n\t}\n\n\tisEnabled( channel ) {\n\n\t\treturn ( this.mask & ( 1 << channel | 0 ) ) !== 0;\n\n\t}\n\n}\n\nlet _object3DId = 0;\n\nconst _v1$4 = /*@__PURE__*/ new Vector3();\nconst _q1 = /*@__PURE__*/ new Quaternion();\nconst _m1$1 = /*@__PURE__*/ new Matrix4();\nconst _target = /*@__PURE__*/ new Vector3();\n\nconst _position$3 = /*@__PURE__*/ new Vector3();\nconst _scale$2 = /*@__PURE__*/ new Vector3();\nconst _quaternion$2 = /*@__PURE__*/ new Quaternion();\n\nconst _xAxis = /*@__PURE__*/ new Vector3( 1, 0, 0 );\nconst _yAxis = /*@__PURE__*/ new Vector3( 0, 1, 0 );\nconst _zAxis = /*@__PURE__*/ new Vector3( 0, 0, 1 );\n\nconst _addedEvent = { type: 'added' };\nconst _removedEvent = { type: 'removed' };\n\nclass Object3D extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isObject3D = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _object3DId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'Object3D';\n\n\t\tthis.parent = null;\n\t\tthis.children = [];\n\n\t\tthis.up = Object3D.DEFAULT_UP.clone();\n\n\t\tconst position = new Vector3();\n\t\tconst rotation = new Euler();\n\t\tconst quaternion = new Quaternion();\n\t\tconst scale = new Vector3( 1, 1, 1 );\n\n\t\tfunction onRotationChange() {\n\n\t\t\tquaternion.setFromEuler( rotation, false );\n\n\t\t}\n\n\t\tfunction onQuaternionChange() {\n\n\t\t\trotation.setFromQuaternion( quaternion, undefined, false );\n\n\t\t}\n\n\t\trotation._onChange( onRotationChange );\n\t\tquaternion._onChange( onQuaternionChange );\n\n\t\tObject.defineProperties( this, {\n\t\t\tposition: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: position\n\t\t\t},\n\t\t\trotation: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: rotation\n\t\t\t},\n\t\t\tquaternion: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: quaternion\n\t\t\t},\n\t\t\tscale: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: scale\n\t\t\t},\n\t\t\tmodelViewMatrix: {\n\t\t\t\tvalue: new Matrix4()\n\t\t\t},\n\t\t\tnormalMatrix: {\n\t\t\t\tvalue: new Matrix3()\n\t\t\t}\n\t\t} );\n\n\t\tthis.matrix = new Matrix4();\n\t\tthis.matrixWorld = new Matrix4();\n\n\t\tthis.matrixAutoUpdate = Object3D.DEFAULT_MATRIX_AUTO_UPDATE;\n\t\tthis.matrixWorldNeedsUpdate = false;\n\n\t\tthis.matrixWorldAutoUpdate = Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer\n\n\t\tthis.layers = new Layers();\n\t\tthis.visible = true;\n\n\t\tthis.castShadow = false;\n\t\tthis.receiveShadow = false;\n\n\t\tthis.frustumCulled = true;\n\t\tthis.renderOrder = 0;\n\n\t\tthis.animations = [];\n\n\t\tthis.userData = {};\n\n\t}\n\n\tonBeforeRender( /* renderer, scene, camera, geometry, material, group */ ) {}\n\n\tonAfterRender( /* renderer, scene, camera, geometry, material, group */ ) {}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tthis.matrix.premultiply( matrix );\n\n\t\tthis.matrix.decompose( this.position, this.quaternion, this.scale );\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\tthis.quaternion.premultiply( q );\n\n\t\treturn this;\n\n\t}\n\n\tsetRotationFromAxisAngle( axis, angle ) {\n\n\t\t// assumes axis is normalized\n\n\t\tthis.quaternion.setFromAxisAngle( axis, angle );\n\n\t}\n\n\tsetRotationFromEuler( euler ) {\n\n\t\tthis.quaternion.setFromEuler( euler, true );\n\n\t}\n\n\tsetRotationFromMatrix( m ) {\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tthis.quaternion.setFromRotationMatrix( m );\n\n\t}\n\n\tsetRotationFromQuaternion( q ) {\n\n\t\t// assumes q is normalized\n\n\t\tthis.quaternion.copy( q );\n\n\t}\n\n\trotateOnAxis( axis, angle ) {\n\n\t\t// rotate object on axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.multiply( _q1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateOnWorldAxis( axis, angle ) {\n\n\t\t// rotate object on axis in world space\n\t\t// axis is assumed to be normalized\n\t\t// method assumes no rotated parent\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.premultiply( _q1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateX( angle ) {\n\n\t\treturn this.rotateOnAxis( _xAxis, angle );\n\n\t}\n\n\trotateY( angle ) {\n\n\t\treturn this.rotateOnAxis( _yAxis, angle );\n\n\t}\n\n\trotateZ( angle ) {\n\n\t\treturn this.rotateOnAxis( _zAxis, angle );\n\n\t}\n\n\ttranslateOnAxis( axis, distance ) {\n\n\t\t// translate object by distance along axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_v1$4.copy( axis ).applyQuaternion( this.quaternion );\n\n\t\tthis.position.add( _v1$4.multiplyScalar( distance ) );\n\n\t\treturn this;\n\n\t}\n\n\ttranslateX( distance ) {\n\n\t\treturn this.translateOnAxis( _xAxis, distance );\n\n\t}\n\n\ttranslateY( distance ) {\n\n\t\treturn this.translateOnAxis( _yAxis, distance );\n\n\t}\n\n\ttranslateZ( distance ) {\n\n\t\treturn this.translateOnAxis( _zAxis, distance );\n\n\t}\n\n\tlocalToWorld( vector ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn vector.applyMatrix4( this.matrixWorld );\n\n\t}\n\n\tworldToLocal( vector ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn vector.applyMatrix4( _m1$1.copy( this.matrixWorld ).invert() );\n\n\t}\n\n\tlookAt( x, y, z ) {\n\n\t\t// This method does not support objects having non-uniformly-scaled parent(s)\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\t_target.copy( x );\n\n\t\t} else {\n\n\t\t\t_target.set( x, y, z );\n\n\t\t}\n\n\t\tconst parent = this.parent;\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_position$3.setFromMatrixPosition( this.matrixWorld );\n\n\t\tif ( this.isCamera || this.isLight ) {\n\n\t\t\t_m1$1.lookAt( _position$3, _target, this.up );\n\n\t\t} else {\n\n\t\t\t_m1$1.lookAt( _target, _position$3, this.up );\n\n\t\t}\n\n\t\tthis.quaternion.setFromRotationMatrix( _m1$1 );\n\n\t\tif ( parent ) {\n\n\t\t\t_m1$1.extractRotation( parent.matrixWorld );\n\t\t\t_q1.setFromRotationMatrix( _m1$1 );\n\t\t\tthis.quaternion.premultiply( _q1.invert() );\n\n\t\t}\n\n\t}\n\n\tadd( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.add( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( object === this ) {\n\n\t\t\tconsole.error( 'THREE.Object3D.add: object can\\'t be added as a child of itself.', object );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( object && object.isObject3D ) {\n\n\t\t\tif ( object.parent !== null ) {\n\n\t\t\t\tobject.parent.remove( object );\n\n\t\t\t}\n\n\t\t\tobject.parent = this;\n\t\t\tthis.children.push( object );\n\n\t\t\tobject.dispatchEvent( _addedEvent );\n\n\t\t} else {\n\n\t\t\tconsole.error( 'THREE.Object3D.add: object not an instance of THREE.Object3D.', object );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremove( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.remove( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst index = this.children.indexOf( object );\n\n\t\tif ( index !== - 1 ) {\n\n\t\t\tobject.parent = null;\n\t\t\tthis.children.splice( index, 1 );\n\n\t\t\tobject.dispatchEvent( _removedEvent );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremoveFromParent() {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( parent !== null ) {\n\n\t\t\tparent.remove( this );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclear() {\n\n\t\treturn this.remove( ... this.children );\n\n\t}\n\n\tattach( object ) {\n\n\t\t// adds object as a child of this, while maintaining the object's world transform\n\n\t\t// Note: This method does not support scene graphs having non-uniformly-scaled nodes(s)\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_m1$1.copy( this.matrixWorld ).invert();\n\n\t\tif ( object.parent !== null ) {\n\n\t\t\tobject.parent.updateWorldMatrix( true, false );\n\n\t\t\t_m1$1.multiply( object.parent.matrixWorld );\n\n\t\t}\n\n\t\tobject.applyMatrix4( _m1$1 );\n\n\t\tthis.add( object );\n\n\t\tobject.updateWorldMatrix( false, true );\n\n\t\treturn this;\n\n\t}\n\n\tgetObjectById( id ) {\n\n\t\treturn this.getObjectByProperty( 'id', id );\n\n\t}\n\n\tgetObjectByName( name ) {\n\n\t\treturn this.getObjectByProperty( 'name', name );\n\n\t}\n\n\tgetObjectByProperty( name, value ) {\n\n\t\tif ( this[ name ] === value ) return this;\n\n\t\tfor ( let i = 0, l = this.children.length; i < l; i ++ ) {\n\n\t\t\tconst child = this.children[ i ];\n\t\t\tconst object = child.getObjectByProperty( name, value );\n\n\t\t\tif ( object !== undefined ) {\n\n\t\t\t\treturn object;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn undefined;\n\n\t}\n\n\tgetObjectsByProperty( name, value ) {\n\n\t\tlet result = [];\n\n\t\tif ( this[ name ] === value ) result.push( this );\n\n\t\tfor ( let i = 0, l = this.children.length; i < l; i ++ ) {\n\n\t\t\tconst childResult = this.children[ i ].getObjectsByProperty( name, value );\n\n\t\t\tif ( childResult.length > 0 ) {\n\n\t\t\t\tresult = result.concat( childResult );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tgetWorldPosition( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn target.setFromMatrixPosition( this.matrixWorld );\n\n\t}\n\n\tgetWorldQuaternion( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tthis.matrixWorld.decompose( _position$3, target, _scale$2 );\n\n\t\treturn target;\n\n\t}\n\n\tgetWorldScale( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tthis.matrixWorld.decompose( _position$3, _quaternion$2, target );\n\n\t\treturn target;\n\n\t}\n\n\tgetWorldDirection( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tconst e = this.matrixWorld.elements;\n\n\t\treturn target.set( e[ 8 ], e[ 9 ], e[ 10 ] ).normalize();\n\n\t}\n\n\traycast( /* raycaster, intersects */ ) {}\n\n\ttraverse( callback ) {\n\n\t\tcallback( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverse( callback );\n\n\t\t}\n\n\t}\n\n\ttraverseVisible( callback ) {\n\n\t\tif ( this.visible === false ) return;\n\n\t\tcallback( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverseVisible( callback );\n\n\t\t}\n\n\t}\n\n\ttraverseAncestors( callback ) {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( parent !== null ) {\n\n\t\t\tcallback( parent );\n\n\t\t\tparent.traverseAncestors( callback );\n\n\t\t}\n\n\t}\n\n\tupdateMatrix() {\n\n\t\tthis.matrix.compose( this.position, this.quaternion, this.scale );\n\n\t\tthis.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.matrixWorldNeedsUpdate || force ) {\n\n\t\t\tif ( this.parent === null ) {\n\n\t\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t\t} else {\n\n\t\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t\t}\n\n\t\t\tthis.matrixWorldNeedsUpdate = false;\n\n\t\t\tforce = true;\n\n\t\t}\n\n\t\t// update children\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tconst child = children[ i ];\n\n\t\t\tif ( child.matrixWorldAutoUpdate === true || force === true ) {\n\n\t\t\t\tchild.updateMatrixWorld( force );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateWorldMatrix( updateParents, updateChildren ) {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( updateParents === true && parent !== null && parent.matrixWorldAutoUpdate === true ) {\n\n\t\t\tparent.updateWorldMatrix( true, false );\n\n\t\t}\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.parent === null ) {\n\n\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t} else {\n\n\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t}\n\n\t\t// update children\n\n\t\tif ( updateChildren === true ) {\n\n\t\t\tconst children = this.children;\n\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tconst child = children[ i ];\n\n\t\t\t\tif ( child.matrixWorldAutoUpdate === true ) {\n\n\t\t\t\t\tchild.updateWorldMatrix( false, true );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\t// meta is a string when called from JSON.stringify\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tconst output = {};\n\n\t\t// meta is a hash used to collect geometries, materials.\n\t\t// not providing it implies that this is the root object\n\t\t// being serialized.\n\t\tif ( isRootObject ) {\n\n\t\t\t// initialize meta obj\n\t\t\tmeta = {\n\t\t\t\tgeometries: {},\n\t\t\t\tmaterials: {},\n\t\t\t\ttextures: {},\n\t\t\t\timages: {},\n\t\t\t\tshapes: {},\n\t\t\t\tskeletons: {},\n\t\t\t\tanimations: {},\n\t\t\t\tnodes: {}\n\t\t\t};\n\n\t\t\toutput.metadata = {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Object',\n\t\t\t\tgenerator: 'Object3D.toJSON'\n\t\t\t};\n\n\t\t}\n\n\t\t// standard Object3D serialization\n\n\t\tconst object = {};\n\n\t\tobject.uuid = this.uuid;\n\t\tobject.type = this.type;\n\n\t\tif ( this.name !== '' ) object.name = this.name;\n\t\tif ( this.castShadow === true ) object.castShadow = true;\n\t\tif ( this.receiveShadow === true ) object.receiveShadow = true;\n\t\tif ( this.visible === false ) object.visible = false;\n\t\tif ( this.frustumCulled === false ) object.frustumCulled = false;\n\t\tif ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder;\n\t\tif ( Object.keys( this.userData ).length > 0 ) object.userData = this.userData;\n\n\t\tobject.layers = this.layers.mask;\n\t\tobject.matrix = this.matrix.toArray();\n\t\tobject.up = this.up.toArray();\n\n\t\tif ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;\n\n\t\t// object specific properties\n\n\t\tif ( this.isInstancedMesh ) {\n\n\t\t\tobject.type = 'InstancedMesh';\n\t\t\tobject.count = this.count;\n\t\t\tobject.instanceMatrix = this.instanceMatrix.toJSON();\n\t\t\tif ( this.instanceColor !== null ) object.instanceColor = this.instanceColor.toJSON();\n\n\t\t}\n\n\t\t//\n\n\t\tfunction serialize( library, element ) {\n\n\t\t\tif ( library[ element.uuid ] === undefined ) {\n\n\t\t\t\tlibrary[ element.uuid ] = element.toJSON( meta );\n\n\t\t\t}\n\n\t\t\treturn element.uuid;\n\n\t\t}\n\n\t\tif ( this.isScene ) {\n\n\t\t\tif ( this.background ) {\n\n\t\t\t\tif ( this.background.isColor ) {\n\n\t\t\t\t\tobject.background = this.background.toJSON();\n\n\t\t\t\t} else if ( this.background.isTexture ) {\n\n\t\t\t\t\tobject.background = this.background.toJSON( meta ).uuid;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== true ) {\n\n\t\t\t\tobject.environment = this.environment.toJSON( meta ).uuid;\n\n\t\t\t}\n\n\t\t} else if ( this.isMesh || this.isLine || this.isPoints ) {\n\n\t\t\tobject.geometry = serialize( meta.geometries, this.geometry );\n\n\t\t\tconst parameters = this.geometry.parameters;\n\n\t\t\tif ( parameters !== undefined && parameters.shapes !== undefined ) {\n\n\t\t\t\tconst shapes = parameters.shapes;\n\n\t\t\t\tif ( Array.isArray( shapes ) ) {\n\n\t\t\t\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\t\t\t\tconst shape = shapes[ i ];\n\n\t\t\t\t\t\tserialize( meta.shapes, shape );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tserialize( meta.shapes, shapes );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.isSkinnedMesh ) {\n\n\t\t\tobject.bindMode = this.bindMode;\n\t\t\tobject.bindMatrix = this.bindMatrix.toArray();\n\n\t\t\tif ( this.skeleton !== undefined ) {\n\n\t\t\t\tserialize( meta.skeletons, this.skeleton );\n\n\t\t\t\tobject.skeleton = this.skeleton.uuid;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.material !== undefined ) {\n\n\t\t\tif ( Array.isArray( this.material ) ) {\n\n\t\t\t\tconst uuids = [];\n\n\t\t\t\tfor ( let i = 0, l = this.material.length; i < l; i ++ ) {\n\n\t\t\t\t\tuuids.push( serialize( meta.materials, this.material[ i ] ) );\n\n\t\t\t\t}\n\n\t\t\t\tobject.material = uuids;\n\n\t\t\t} else {\n\n\t\t\t\tobject.material = serialize( meta.materials, this.material );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.children.length > 0 ) {\n\n\t\t\tobject.children = [];\n\n\t\t\tfor ( let i = 0; i < this.children.length; i ++ ) {\n\n\t\t\t\tobject.children.push( this.children[ i ].toJSON( meta ).object );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.animations.length > 0 ) {\n\n\t\t\tobject.animations = [];\n\n\t\t\tfor ( let i = 0; i < this.animations.length; i ++ ) {\n\n\t\t\t\tconst animation = this.animations[ i ];\n\n\t\t\t\tobject.animations.push( serialize( meta.animations, animation ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( isRootObject ) {\n\n\t\t\tconst geometries = extractFromCache( meta.geometries );\n\t\t\tconst materials = extractFromCache( meta.materials );\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\t\t\tconst shapes = extractFromCache( meta.shapes );\n\t\t\tconst skeletons = extractFromCache( meta.skeletons );\n\t\t\tconst animations = extractFromCache( meta.animations );\n\t\t\tconst nodes = extractFromCache( meta.nodes );\n\n\t\t\tif ( geometries.length > 0 ) output.geometries = geometries;\n\t\t\tif ( materials.length > 0 ) output.materials = materials;\n\t\t\tif ( textures.length > 0 ) output.textures = textures;\n\t\t\tif ( images.length > 0 ) output.images = images;\n\t\t\tif ( shapes.length > 0 ) output.shapes = shapes;\n\t\t\tif ( skeletons.length > 0 ) output.skeletons = skeletons;\n\t\t\tif ( animations.length > 0 ) output.animations = animations;\n\t\t\tif ( nodes.length > 0 ) output.nodes = nodes;\n\n\t\t}\n\n\t\toutput.object = object;\n\n\t\treturn output;\n\n\t\t// extract data from the cache hash\n\t\t// remove metadata on each item\n\t\t// and return as array\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t}\n\n\tclone( recursive ) {\n\n\t\treturn new this.constructor().copy( this, recursive );\n\n\t}\n\n\tcopy( source, recursive = true ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.up.copy( source.up );\n\n\t\tthis.position.copy( source.position );\n\t\tthis.rotation.order = source.rotation.order;\n\t\tthis.quaternion.copy( source.quaternion );\n\t\tthis.scale.copy( source.scale );\n\n\t\tthis.matrix.copy( source.matrix );\n\t\tthis.matrixWorld.copy( source.matrixWorld );\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\t\tthis.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;\n\n\t\tthis.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;\n\n\t\tthis.layers.mask = source.layers.mask;\n\t\tthis.visible = source.visible;\n\n\t\tthis.castShadow = source.castShadow;\n\t\tthis.receiveShadow = source.receiveShadow;\n\n\t\tthis.frustumCulled = source.frustumCulled;\n\t\tthis.renderOrder = source.renderOrder;\n\n\t\tthis.animations = source.animations.slice();\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\tif ( recursive === true ) {\n\n\t\t\tfor ( let i = 0; i < source.children.length; i ++ ) {\n\n\t\t\t\tconst child = source.children[ i ];\n\t\t\t\tthis.add( child.clone() );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nObject3D.DEFAULT_UP = /*@__PURE__*/ new Vector3( 0, 1, 0 );\nObject3D.DEFAULT_MATRIX_AUTO_UPDATE = true;\nObject3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true;\n\nconst _v0$1 = /*@__PURE__*/ new Vector3();\nconst _v1$3 = /*@__PURE__*/ new Vector3();\nconst _v2$2 = /*@__PURE__*/ new Vector3();\nconst _v3$1 = /*@__PURE__*/ new Vector3();\n\nconst _vab = /*@__PURE__*/ new Vector3();\nconst _vac = /*@__PURE__*/ new Vector3();\nconst _vbc = /*@__PURE__*/ new Vector3();\nconst _vap = /*@__PURE__*/ new Vector3();\nconst _vbp = /*@__PURE__*/ new Vector3();\nconst _vcp = /*@__PURE__*/ new Vector3();\n\nlet warnedGetUV = false;\n\nclass Triangle {\n\n\tconstructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {\n\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t\tthis.c = c;\n\n\t}\n\n\tstatic getNormal( a, b, c, target ) {\n\n\t\ttarget.subVectors( c, b );\n\t\t_v0$1.subVectors( a, b );\n\t\ttarget.cross( _v0$1 );\n\n\t\tconst targetLengthSq = target.lengthSq();\n\t\tif ( targetLengthSq > 0 ) {\n\n\t\t\treturn target.multiplyScalar( 1 / Math.sqrt( targetLengthSq ) );\n\n\t\t}\n\n\t\treturn target.set( 0, 0, 0 );\n\n\t}\n\n\t// static/instance method to calculate barycentric coordinates\n\t// based on: http://www.blackpawn.com/texts/pointinpoly/default.html\n\tstatic getBarycoord( point, a, b, c, target ) {\n\n\t\t_v0$1.subVectors( c, a );\n\t\t_v1$3.subVectors( b, a );\n\t\t_v2$2.subVectors( point, a );\n\n\t\tconst dot00 = _v0$1.dot( _v0$1 );\n\t\tconst dot01 = _v0$1.dot( _v1$3 );\n\t\tconst dot02 = _v0$1.dot( _v2$2 );\n\t\tconst dot11 = _v1$3.dot( _v1$3 );\n\t\tconst dot12 = _v1$3.dot( _v2$2 );\n\n\t\tconst denom = ( dot00 * dot11 - dot01 * dot01 );\n\n\t\t// collinear or singular triangle\n\t\tif ( denom === 0 ) {\n\n\t\t\t// arbitrary location outside of triangle?\n\t\t\t// not sure if this is the best idea, maybe should be returning undefined\n\t\t\treturn target.set( - 2, - 1, - 1 );\n\n\t\t}\n\n\t\tconst invDenom = 1 / denom;\n\t\tconst u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom;\n\t\tconst v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom;\n\n\t\t// barycentric coordinates must always sum to 1\n\t\treturn target.set( 1 - u - v, v, u );\n\n\t}\n\n\tstatic containsPoint( point, a, b, c ) {\n\n\t\tthis.getBarycoord( point, a, b, c, _v3$1 );\n\n\t\treturn ( _v3$1.x >= 0 ) && ( _v3$1.y >= 0 ) && ( ( _v3$1.x + _v3$1.y ) <= 1 );\n\n\t}\n\n\tstatic getUV( point, p1, p2, p3, uv1, uv2, uv3, target ) { // @deprecated, r151\n\n\t\tif ( warnedGetUV === false ) {\n\n\t\t\tconsole.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );\n\n\t\t\twarnedGetUV = true;\n\n\t\t}\n\n\t\treturn this.getInterpolation( point, p1, p2, p3, uv1, uv2, uv3, target );\n\n\t}\n\n\tstatic getInterpolation( point, p1, p2, p3, v1, v2, v3, target ) {\n\n\t\tthis.getBarycoord( point, p1, p2, p3, _v3$1 );\n\n\t\ttarget.setScalar( 0 );\n\t\ttarget.addScaledVector( v1, _v3$1.x );\n\t\ttarget.addScaledVector( v2, _v3$1.y );\n\t\ttarget.addScaledVector( v3, _v3$1.z );\n\n\t\treturn target;\n\n\t}\n\n\tstatic isFrontFacing( a, b, c, direction ) {\n\n\t\t_v0$1.subVectors( c, b );\n\t\t_v1$3.subVectors( a, b );\n\n\t\t// strictly front facing\n\t\treturn ( _v0$1.cross( _v1$3 ).dot( direction ) < 0 ) ? true : false;\n\n\t}\n\n\tset( a, b, c ) {\n\n\t\tthis.a.copy( a );\n\t\tthis.b.copy( b );\n\t\tthis.c.copy( c );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPointsAndIndices( points, i0, i1, i2 ) {\n\n\t\tthis.a.copy( points[ i0 ] );\n\t\tthis.b.copy( points[ i1 ] );\n\t\tthis.c.copy( points[ i2 ] );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromAttributeAndIndices( attribute, i0, i1, i2 ) {\n\n\t\tthis.a.fromBufferAttribute( attribute, i0 );\n\t\tthis.b.fromBufferAttribute( attribute, i1 );\n\t\tthis.c.fromBufferAttribute( attribute, i2 );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( triangle ) {\n\n\t\tthis.a.copy( triangle.a );\n\t\tthis.b.copy( triangle.b );\n\t\tthis.c.copy( triangle.c );\n\n\t\treturn this;\n\n\t}\n\n\tgetArea() {\n\n\t\t_v0$1.subVectors( this.c, this.b );\n\t\t_v1$3.subVectors( this.a, this.b );\n\n\t\treturn _v0$1.cross( _v1$3 ).length() * 0.5;\n\n\t}\n\n\tgetMidpoint( target ) {\n\n\t\treturn target.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 );\n\n\t}\n\n\tgetNormal( target ) {\n\n\t\treturn Triangle.getNormal( this.a, this.b, this.c, target );\n\n\t}\n\n\tgetPlane( target ) {\n\n\t\treturn target.setFromCoplanarPoints( this.a, this.b, this.c );\n\n\t}\n\n\tgetBarycoord( point, target ) {\n\n\t\treturn Triangle.getBarycoord( point, this.a, this.b, this.c, target );\n\n\t}\n\n\tgetUV( point, uv1, uv2, uv3, target ) { // @deprecated, r151\n\n\t\tif ( warnedGetUV === false ) {\n\n\t\t\tconsole.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );\n\n\t\t\twarnedGetUV = true;\n\n\t\t}\n\n\t\treturn Triangle.getInterpolation( point, this.a, this.b, this.c, uv1, uv2, uv3, target );\n\n\t}\n\n\tgetInterpolation( point, v1, v2, v3, target ) {\n\n\t\treturn Triangle.getInterpolation( point, this.a, this.b, this.c, v1, v2, v3, target );\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn Triangle.containsPoint( point, this.a, this.b, this.c );\n\n\t}\n\n\tisFrontFacing( direction ) {\n\n\t\treturn Triangle.isFrontFacing( this.a, this.b, this.c, direction );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsTriangle( this );\n\n\t}\n\n\tclosestPointToPoint( p, target ) {\n\n\t\tconst a = this.a, b = this.b, c = this.c;\n\t\tlet v, w;\n\n\t\t// algorithm thanks to Real-Time Collision Detection by Christer Ericson,\n\t\t// published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,\n\t\t// under the accompanying license; see chapter 5.1.5 for detailed explanation.\n\t\t// basically, we're distinguishing which of the voronoi regions of the triangle\n\t\t// the point lies in with the minimum amount of redundant computation.\n\n\t\t_vab.subVectors( b, a );\n\t\t_vac.subVectors( c, a );\n\t\t_vap.subVectors( p, a );\n\t\tconst d1 = _vab.dot( _vap );\n\t\tconst d2 = _vac.dot( _vap );\n\t\tif ( d1 <= 0 && d2 <= 0 ) {\n\n\t\t\t// vertex region of A; barycentric coords (1, 0, 0)\n\t\t\treturn target.copy( a );\n\n\t\t}\n\n\t\t_vbp.subVectors( p, b );\n\t\tconst d3 = _vab.dot( _vbp );\n\t\tconst d4 = _vac.dot( _vbp );\n\t\tif ( d3 >= 0 && d4 <= d3 ) {\n\n\t\t\t// vertex region of B; barycentric coords (0, 1, 0)\n\t\t\treturn target.copy( b );\n\n\t\t}\n\n\t\tconst vc = d1 * d4 - d3 * d2;\n\t\tif ( vc <= 0 && d1 >= 0 && d3 <= 0 ) {\n\n\t\t\tv = d1 / ( d1 - d3 );\n\t\t\t// edge region of AB; barycentric coords (1-v, v, 0)\n\t\t\treturn target.copy( a ).addScaledVector( _vab, v );\n\n\t\t}\n\n\t\t_vcp.subVectors( p, c );\n\t\tconst d5 = _vab.dot( _vcp );\n\t\tconst d6 = _vac.dot( _vcp );\n\t\tif ( d6 >= 0 && d5 <= d6 ) {\n\n\t\t\t// vertex region of C; barycentric coords (0, 0, 1)\n\t\t\treturn target.copy( c );\n\n\t\t}\n\n\t\tconst vb = d5 * d2 - d1 * d6;\n\t\tif ( vb <= 0 && d2 >= 0 && d6 <= 0 ) {\n\n\t\t\tw = d2 / ( d2 - d6 );\n\t\t\t// edge region of AC; barycentric coords (1-w, 0, w)\n\t\t\treturn target.copy( a ).addScaledVector( _vac, w );\n\n\t\t}\n\n\t\tconst va = d3 * d6 - d5 * d4;\n\t\tif ( va <= 0 && ( d4 - d3 ) >= 0 && ( d5 - d6 ) >= 0 ) {\n\n\t\t\t_vbc.subVectors( c, b );\n\t\t\tw = ( d4 - d3 ) / ( ( d4 - d3 ) + ( d5 - d6 ) );\n\t\t\t// edge region of BC; barycentric coords (0, 1-w, w)\n\t\t\treturn target.copy( b ).addScaledVector( _vbc, w ); // edge region of BC\n\n\t\t}\n\n\t\t// face region\n\t\tconst denom = 1 / ( va + vb + vc );\n\t\t// u = va * denom\n\t\tv = vb * denom;\n\t\tw = vc * denom;\n\n\t\treturn target.copy( a ).addScaledVector( _vab, v ).addScaledVector( _vac, w );\n\n\t}\n\n\tequals( triangle ) {\n\n\t\treturn triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c );\n\n\t}\n\n}\n\nconst _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF,\n\t'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2,\n\t'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50,\n\t'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B,\n\t'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B,\n\t'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F,\n\t'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3,\n\t'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222,\n\t'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700,\n\t'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4,\n\t'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00,\n\t'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3,\n\t'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA,\n\t'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32,\n\t'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3,\n\t'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC,\n\t'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD,\n\t'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6,\n\t'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9,\n\t'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'rebeccapurple': 0x663399, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F,\n\t'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE,\n\t'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA,\n\t'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0,\n\t'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 };\n\nconst _hslA = { h: 0, s: 0, l: 0 };\nconst _hslB = { h: 0, s: 0, l: 0 };\n\nfunction hue2rgb( p, q, t ) {\n\n\tif ( t < 0 ) t += 1;\n\tif ( t > 1 ) t -= 1;\n\tif ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;\n\tif ( t < 1 / 2 ) return q;\n\tif ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );\n\treturn p;\n\n}\n\nclass Color {\n\n\tconstructor( r, g, b ) {\n\n\t\tthis.isColor = true;\n\n\t\tthis.r = 1;\n\t\tthis.g = 1;\n\t\tthis.b = 1;\n\n\t\treturn this.set( r, g, b );\n\n\t}\n\n\tset( r, g, b ) {\n\n\t\tif ( g === undefined && b === undefined ) {\n\n\t\t\t// r is THREE.Color, hex or string\n\n\t\t\tconst value = r;\n\n\t\t\tif ( value && value.isColor ) {\n\n\t\t\t\tthis.copy( value );\n\n\t\t\t} else if ( typeof value === 'number' ) {\n\n\t\t\t\tthis.setHex( value );\n\n\t\t\t} else if ( typeof value === 'string' ) {\n\n\t\t\t\tthis.setStyle( value );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthis.setRGB( r, g, b );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.r = scalar;\n\t\tthis.g = scalar;\n\t\tthis.b = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetHex( hex, colorSpace = SRGBColorSpace ) {\n\n\t\thex = Math.floor( hex );\n\n\t\tthis.r = ( hex >> 16 & 255 ) / 255;\n\t\tthis.g = ( hex >> 8 & 255 ) / 255;\n\t\tthis.b = ( hex & 255 ) / 255;\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetRGB( r, g, b, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\tthis.r = r;\n\t\tthis.g = g;\n\t\tthis.b = b;\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetHSL( h, s, l, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\t\th = euclideanModulo( h, 1 );\n\t\ts = clamp( s, 0, 1 );\n\t\tl = clamp( l, 0, 1 );\n\n\t\tif ( s === 0 ) {\n\n\t\t\tthis.r = this.g = this.b = l;\n\n\t\t} else {\n\n\t\t\tconst p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );\n\t\t\tconst q = ( 2 * l ) - p;\n\n\t\t\tthis.r = hue2rgb( q, p, h + 1 / 3 );\n\t\t\tthis.g = hue2rgb( q, p, h );\n\t\t\tthis.b = hue2rgb( q, p, h - 1 / 3 );\n\n\t\t}\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetStyle( style, colorSpace = SRGBColorSpace ) {\n\n\t\tfunction handleAlpha( string ) {\n\n\t\t\tif ( string === undefined ) return;\n\n\t\t\tif ( parseFloat( string ) < 1 ) {\n\n\t\t\t\tconsole.warn( 'THREE.Color: Alpha component of ' + style + ' will be ignored.' );\n\n\t\t\t}\n\n\t\t}\n\n\n\t\tlet m;\n\n\t\tif ( m = /^(\\w+)\\(([^\\)]*)\\)/.exec( style ) ) {\n\n\t\t\t// rgb / hsl\n\n\t\t\tlet color;\n\t\t\tconst name = m[ 1 ];\n\t\t\tconst components = m[ 2 ];\n\n\t\t\tswitch ( name ) {\n\n\t\t\t\tcase 'rgb':\n\t\t\t\tcase 'rgba':\n\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(255,0,0) rgba(255,0,0,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setRGB(\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 1 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 2 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 3 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setRGB(\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 1 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 2 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 3 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'hsl':\n\t\t\t\tcase 'hsla':\n\n\t\t\t\t\tif ( color = /^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// hsl(120,50%,50%) hsla(120,50%,50%,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setHSL(\n\t\t\t\t\t\t\tparseFloat( color[ 1 ] ) / 360,\n\t\t\t\t\t\t\tparseFloat( color[ 2 ] ) / 100,\n\t\t\t\t\t\t\tparseFloat( color[ 3 ] ) / 100,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tconsole.warn( 'THREE.Color: Unknown color model ' + style );\n\n\t\t\t}\n\n\t\t} else if ( m = /^\\#([A-Fa-f\\d]+)$/.exec( style ) ) {\n\n\t\t\t// hex color\n\n\t\t\tconst hex = m[ 1 ];\n\t\t\tconst size = hex.length;\n\n\t\t\tif ( size === 3 ) {\n\n\t\t\t\t// #ff0\n\t\t\t\treturn this.setRGB(\n\t\t\t\t\tparseInt( hex.charAt( 0 ), 16 ) / 15,\n\t\t\t\t\tparseInt( hex.charAt( 1 ), 16 ) / 15,\n\t\t\t\t\tparseInt( hex.charAt( 2 ), 16 ) / 15,\n\t\t\t\t\tcolorSpace\n\t\t\t\t);\n\n\t\t\t} else if ( size === 6 ) {\n\n\t\t\t\t// #ff0000\n\t\t\t\treturn this.setHex( parseInt( hex, 16 ), colorSpace );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'THREE.Color: Invalid hex color ' + style );\n\n\t\t\t}\n\n\t\t} else if ( style && style.length > 0 ) {\n\n\t\t\treturn this.setColorName( style, colorSpace );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetColorName( style, colorSpace = SRGBColorSpace ) {\n\n\t\t// color keywords\n\t\tconst hex = _colorKeywords[ style.toLowerCase() ];\n\n\t\tif ( hex !== undefined ) {\n\n\t\t\t// red\n\t\t\tthis.setHex( hex, colorSpace );\n\n\t\t} else {\n\n\t\t\t// unknown color\n\t\t\tconsole.warn( 'THREE.Color: Unknown color ' + style );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.r, this.g, this.b );\n\n\t}\n\n\tcopy( color ) {\n\n\t\tthis.r = color.r;\n\t\tthis.g = color.g;\n\t\tthis.b = color.b;\n\n\t\treturn this;\n\n\t}\n\n\tcopySRGBToLinear( color ) {\n\n\t\tthis.r = SRGBToLinear( color.r );\n\t\tthis.g = SRGBToLinear( color.g );\n\t\tthis.b = SRGBToLinear( color.b );\n\n\t\treturn this;\n\n\t}\n\n\tcopyLinearToSRGB( color ) {\n\n\t\tthis.r = LinearToSRGB( color.r );\n\t\tthis.g = LinearToSRGB( color.g );\n\t\tthis.b = LinearToSRGB( color.b );\n\n\t\treturn this;\n\n\t}\n\n\tconvertSRGBToLinear() {\n\n\t\tthis.copySRGBToLinear( this );\n\n\t\treturn this;\n\n\t}\n\n\tconvertLinearToSRGB() {\n\n\t\tthis.copyLinearToSRGB( this );\n\n\t\treturn this;\n\n\t}\n\n\tgetHex( colorSpace = SRGBColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\treturn Math.round( clamp( _color.r * 255, 0, 255 ) ) * 65536 + Math.round( clamp( _color.g * 255, 0, 255 ) ) * 256 + Math.round( clamp( _color.b * 255, 0, 255 ) );\n\n\t}\n\n\tgetHexString( colorSpace = SRGBColorSpace ) {\n\n\t\treturn ( '000000' + this.getHex( colorSpace ).toString( 16 ) ).slice( - 6 );\n\n\t}\n\n\tgetHSL( target, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\tconst r = _color.r, g = _color.g, b = _color.b;\n\n\t\tconst max = Math.max( r, g, b );\n\t\tconst min = Math.min( r, g, b );\n\n\t\tlet hue, saturation;\n\t\tconst lightness = ( min + max ) / 2.0;\n\n\t\tif ( min === max ) {\n\n\t\t\thue = 0;\n\t\t\tsaturation = 0;\n\n\t\t} else {\n\n\t\t\tconst delta = max - min;\n\n\t\t\tsaturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min );\n\n\t\t\tswitch ( max ) {\n\n\t\t\t\tcase r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break;\n\t\t\t\tcase g: hue = ( b - r ) / delta + 2; break;\n\t\t\t\tcase b: hue = ( r - g ) / delta + 4; break;\n\n\t\t\t}\n\n\t\t\thue /= 6;\n\n\t\t}\n\n\t\ttarget.h = hue;\n\t\ttarget.s = saturation;\n\t\ttarget.l = lightness;\n\n\t\treturn target;\n\n\t}\n\n\tgetRGB( target, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\ttarget.r = _color.r;\n\t\ttarget.g = _color.g;\n\t\ttarget.b = _color.b;\n\n\t\treturn target;\n\n\t}\n\n\tgetStyle( colorSpace = SRGBColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\tconst r = _color.r, g = _color.g, b = _color.b;\n\n\t\tif ( colorSpace !== SRGBColorSpace ) {\n\n\t\t\t// Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).\n\t\t\treturn `color(${ colorSpace } ${ r.toFixed( 3 ) } ${ g.toFixed( 3 ) } ${ b.toFixed( 3 ) })`;\n\n\t\t}\n\n\t\treturn `rgb(${ Math.round( r * 255 ) },${ Math.round( g * 255 ) },${ Math.round( b * 255 ) })`;\n\n\t}\n\n\toffsetHSL( h, s, l ) {\n\n\t\tthis.getHSL( _hslA );\n\n\t\treturn this.setHSL( _hslA.h + h, _hslA.s + s, _hslA.l + l );\n\n\t}\n\n\tadd( color ) {\n\n\t\tthis.r += color.r;\n\t\tthis.g += color.g;\n\t\tthis.b += color.b;\n\n\t\treturn this;\n\n\t}\n\n\taddColors( color1, color2 ) {\n\n\t\tthis.r = color1.r + color2.r;\n\t\tthis.g = color1.g + color2.g;\n\t\tthis.b = color1.b + color2.b;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.r += s;\n\t\tthis.g += s;\n\t\tthis.b += s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( color ) {\n\n\t\tthis.r = Math.max( 0, this.r - color.r );\n\t\tthis.g = Math.max( 0, this.g - color.g );\n\t\tthis.b = Math.max( 0, this.b - color.b );\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( color ) {\n\n\t\tthis.r *= color.r;\n\t\tthis.g *= color.g;\n\t\tthis.b *= color.b;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tthis.r *= s;\n\t\tthis.g *= s;\n\t\tthis.b *= s;\n\n\t\treturn this;\n\n\t}\n\n\tlerp( color, alpha ) {\n\n\t\tthis.r += ( color.r - this.r ) * alpha;\n\t\tthis.g += ( color.g - this.g ) * alpha;\n\t\tthis.b += ( color.b - this.b ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpColors( color1, color2, alpha ) {\n\n\t\tthis.r = color1.r + ( color2.r - color1.r ) * alpha;\n\t\tthis.g = color1.g + ( color2.g - color1.g ) * alpha;\n\t\tthis.b = color1.b + ( color2.b - color1.b ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpHSL( color, alpha ) {\n\n\t\tthis.getHSL( _hslA );\n\t\tcolor.getHSL( _hslB );\n\n\t\tconst h = lerp( _hslA.h, _hslB.h, alpha );\n\t\tconst s = lerp( _hslA.s, _hslB.s, alpha );\n\t\tconst l = lerp( _hslA.l, _hslB.l, alpha );\n\n\t\tthis.setHSL( h, s, l );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\tthis.r = v.x;\n\t\tthis.g = v.y;\n\t\tthis.b = v.z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst r = this.r, g = this.g, b = this.b;\n\t\tconst e = m.elements;\n\n\t\tthis.r = e[ 0 ] * r + e[ 3 ] * g + e[ 6 ] * b;\n\t\tthis.g = e[ 1 ] * r + e[ 4 ] * g + e[ 7 ] * b;\n\t\tthis.b = e[ 2 ] * r + e[ 5 ] * g + e[ 8 ] * b;\n\n\t\treturn this;\n\n\t}\n\n\tequals( c ) {\n\n\t\treturn ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.r = array[ offset ];\n\t\tthis.g = array[ offset + 1 ];\n\t\tthis.b = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.r;\n\t\tarray[ offset + 1 ] = this.g;\n\t\tarray[ offset + 2 ] = this.b;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.r = attribute.getX( index );\n\t\tthis.g = attribute.getY( index );\n\t\tthis.b = attribute.getZ( index );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.getHex();\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.r;\n\t\tyield this.g;\n\t\tyield this.b;\n\n\t}\n\n}\n\nconst _color = /*@__PURE__*/ new Color();\n\nColor.NAMES = _colorKeywords;\n\nlet _materialId = 0;\n\nclass Material extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isMaterial = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _materialId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'Material';\n\n\t\tthis.blending = NormalBlending;\n\t\tthis.side = FrontSide;\n\t\tthis.vertexColors = false;\n\n\t\tthis.opacity = 1;\n\t\tthis.transparent = false;\n\t\tthis.alphaHash = false;\n\n\t\tthis.blendSrc = SrcAlphaFactor;\n\t\tthis.blendDst = OneMinusSrcAlphaFactor;\n\t\tthis.blendEquation = AddEquation;\n\t\tthis.blendSrcAlpha = null;\n\t\tthis.blendDstAlpha = null;\n\t\tthis.blendEquationAlpha = null;\n\t\tthis.blendColor = new Color( 0, 0, 0 );\n\t\tthis.blendAlpha = 0;\n\n\t\tthis.depthFunc = LessEqualDepth;\n\t\tthis.depthTest = true;\n\t\tthis.depthWrite = true;\n\n\t\tthis.stencilWriteMask = 0xff;\n\t\tthis.stencilFunc = AlwaysStencilFunc;\n\t\tthis.stencilRef = 0;\n\t\tthis.stencilFuncMask = 0xff;\n\t\tthis.stencilFail = KeepStencilOp;\n\t\tthis.stencilZFail = KeepStencilOp;\n\t\tthis.stencilZPass = KeepStencilOp;\n\t\tthis.stencilWrite = false;\n\n\t\tthis.clippingPlanes = null;\n\t\tthis.clipIntersection = false;\n\t\tthis.clipShadows = false;\n\n\t\tthis.shadowSide = null;\n\n\t\tthis.colorWrite = true;\n\n\t\tthis.precision = null; // override the renderer's default precision for this material\n\n\t\tthis.polygonOffset = false;\n\t\tthis.polygonOffsetFactor = 0;\n\t\tthis.polygonOffsetUnits = 0;\n\n\t\tthis.dithering = false;\n\n\t\tthis.alphaToCoverage = false;\n\t\tthis.premultipliedAlpha = false;\n\t\tthis.forceSinglePass = false;\n\n\t\tthis.visible = true;\n\n\t\tthis.toneMapped = true;\n\n\t\tthis.userData = {};\n\n\t\tthis.version = 0;\n\n\t\tthis._alphaTest = 0;\n\n\t}\n\n\tget alphaTest() {\n\n\t\treturn this._alphaTest;\n\n\t}\n\n\tset alphaTest( value ) {\n\n\t\tif ( this._alphaTest > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._alphaTest = value;\n\n\t}\n\n\tonBuild( /* shaderobject, renderer */ ) {}\n\n\tonBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {}\n\n\tonBeforeCompile( /* shaderobject, renderer */ ) {}\n\n\tcustomProgramCacheKey() {\n\n\t\treturn this.onBeforeCompile.toString();\n\n\t}\n\n\tsetValues( values ) {\n\n\t\tif ( values === undefined ) return;\n\n\t\tfor ( const key in values ) {\n\n\t\t\tconst newValue = values[ key ];\n\n\t\t\tif ( newValue === undefined ) {\n\n\t\t\t\tconsole.warn( `THREE.Material: parameter '${ key }' has value of undefined.` );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tconst currentValue = this[ key ];\n\n\t\t\tif ( currentValue === undefined ) {\n\n\t\t\t\tconsole.warn( `THREE.Material: '${ key }' is not a property of THREE.${ this.type }.` );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( currentValue && currentValue.isColor ) {\n\n\t\t\t\tcurrentValue.set( newValue );\n\n\t\t\t} else if ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) ) {\n\n\t\t\t\tcurrentValue.copy( newValue );\n\n\t\t\t} else {\n\n\t\t\t\tthis[ key ] = newValue;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( isRootObject ) {\n\n\t\t\tmeta = {\n\t\t\t\ttextures: {},\n\t\t\t\timages: {}\n\t\t\t};\n\n\t\t}\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Material',\n\t\t\t\tgenerator: 'Material.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard Material serialization\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\n\t\tif ( this.name !== '' ) data.name = this.name;\n\n\t\tif ( this.color && this.color.isColor ) data.color = this.color.getHex();\n\n\t\tif ( this.roughness !== undefined ) data.roughness = this.roughness;\n\t\tif ( this.metalness !== undefined ) data.metalness = this.metalness;\n\n\t\tif ( this.sheen !== undefined ) data.sheen = this.sheen;\n\t\tif ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();\n\t\tif ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;\n\t\tif ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();\n\t\tif ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;\n\n\t\tif ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();\n\t\tif ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;\n\t\tif ( this.specularColor && this.specularColor.isColor ) data.specularColor = this.specularColor.getHex();\n\t\tif ( this.shininess !== undefined ) data.shininess = this.shininess;\n\t\tif ( this.clearcoat !== undefined ) data.clearcoat = this.clearcoat;\n\t\tif ( this.clearcoatRoughness !== undefined ) data.clearcoatRoughness = this.clearcoatRoughness;\n\n\t\tif ( this.clearcoatMap && this.clearcoatMap.isTexture ) {\n\n\t\t\tdata.clearcoatMap = this.clearcoatMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture ) {\n\n\t\t\tdata.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture ) {\n\n\t\t\tdata.clearcoatNormalMap = this.clearcoatNormalMap.toJSON( meta ).uuid;\n\t\t\tdata.clearcoatNormalScale = this.clearcoatNormalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.iridescence !== undefined ) data.iridescence = this.iridescence;\n\t\tif ( this.iridescenceIOR !== undefined ) data.iridescenceIOR = this.iridescenceIOR;\n\t\tif ( this.iridescenceThicknessRange !== undefined ) data.iridescenceThicknessRange = this.iridescenceThicknessRange;\n\n\t\tif ( this.iridescenceMap && this.iridescenceMap.isTexture ) {\n\n\t\t\tdata.iridescenceMap = this.iridescenceMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture ) {\n\n\t\t\tdata.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.anisotropy !== undefined ) data.anisotropy = this.anisotropy;\n\t\tif ( this.anisotropyRotation !== undefined ) data.anisotropyRotation = this.anisotropyRotation;\n\n\t\tif ( this.anisotropyMap && this.anisotropyMap.isTexture ) {\n\n\t\t\tdata.anisotropyMap = this.anisotropyMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.map && this.map.isTexture ) data.map = this.map.toJSON( meta ).uuid;\n\t\tif ( this.matcap && this.matcap.isTexture ) data.matcap = this.matcap.toJSON( meta ).uuid;\n\t\tif ( this.alphaMap && this.alphaMap.isTexture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid;\n\n\t\tif ( this.lightMap && this.lightMap.isTexture ) {\n\n\t\t\tdata.lightMap = this.lightMap.toJSON( meta ).uuid;\n\t\t\tdata.lightMapIntensity = this.lightMapIntensity;\n\n\t\t}\n\n\t\tif ( this.aoMap && this.aoMap.isTexture ) {\n\n\t\t\tdata.aoMap = this.aoMap.toJSON( meta ).uuid;\n\t\t\tdata.aoMapIntensity = this.aoMapIntensity;\n\n\t\t}\n\n\t\tif ( this.bumpMap && this.bumpMap.isTexture ) {\n\n\t\t\tdata.bumpMap = this.bumpMap.toJSON( meta ).uuid;\n\t\t\tdata.bumpScale = this.bumpScale;\n\n\t\t}\n\n\t\tif ( this.normalMap && this.normalMap.isTexture ) {\n\n\t\t\tdata.normalMap = this.normalMap.toJSON( meta ).uuid;\n\t\t\tdata.normalMapType = this.normalMapType;\n\t\t\tdata.normalScale = this.normalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.displacementMap && this.displacementMap.isTexture ) {\n\n\t\t\tdata.displacementMap = this.displacementMap.toJSON( meta ).uuid;\n\t\t\tdata.displacementScale = this.displacementScale;\n\t\t\tdata.displacementBias = this.displacementBias;\n\n\t\t}\n\n\t\tif ( this.roughnessMap && this.roughnessMap.isTexture ) data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid;\n\t\tif ( this.metalnessMap && this.metalnessMap.isTexture ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid;\n\n\t\tif ( this.emissiveMap && this.emissiveMap.isTexture ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid;\n\t\tif ( this.specularMap && this.specularMap.isTexture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;\n\t\tif ( this.specularIntensityMap && this.specularIntensityMap.isTexture ) data.specularIntensityMap = this.specularIntensityMap.toJSON( meta ).uuid;\n\t\tif ( this.specularColorMap && this.specularColorMap.isTexture ) data.specularColorMap = this.specularColorMap.toJSON( meta ).uuid;\n\n\t\tif ( this.envMap && this.envMap.isTexture ) {\n\n\t\t\tdata.envMap = this.envMap.toJSON( meta ).uuid;\n\n\t\t\tif ( this.combine !== undefined ) data.combine = this.combine;\n\n\t\t}\n\n\t\tif ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity;\n\t\tif ( this.reflectivity !== undefined ) data.reflectivity = this.reflectivity;\n\t\tif ( this.refractionRatio !== undefined ) data.refractionRatio = this.refractionRatio;\n\n\t\tif ( this.gradientMap && this.gradientMap.isTexture ) {\n\n\t\t\tdata.gradientMap = this.gradientMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.transmission !== undefined ) data.transmission = this.transmission;\n\t\tif ( this.transmissionMap && this.transmissionMap.isTexture ) data.transmissionMap = this.transmissionMap.toJSON( meta ).uuid;\n\t\tif ( this.thickness !== undefined ) data.thickness = this.thickness;\n\t\tif ( this.thicknessMap && this.thicknessMap.isTexture ) data.thicknessMap = this.thicknessMap.toJSON( meta ).uuid;\n\t\tif ( this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity ) data.attenuationDistance = this.attenuationDistance;\n\t\tif ( this.attenuationColor !== undefined ) data.attenuationColor = this.attenuationColor.getHex();\n\n\t\tif ( this.size !== undefined ) data.size = this.size;\n\t\tif ( this.shadowSide !== null ) data.shadowSide = this.shadowSide;\n\t\tif ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;\n\n\t\tif ( this.blending !== NormalBlending ) data.blending = this.blending;\n\t\tif ( this.side !== FrontSide ) data.side = this.side;\n\t\tif ( this.vertexColors === true ) data.vertexColors = true;\n\n\t\tif ( this.opacity < 1 ) data.opacity = this.opacity;\n\t\tif ( this.transparent === true ) data.transparent = true;\n\n\t\tif ( this.blendSrc !== SrcAlphaFactor ) data.blendSrc = this.blendSrc;\n\t\tif ( this.blendDst !== OneMinusSrcAlphaFactor ) data.blendDst = this.blendDst;\n\t\tif ( this.blendEquation !== AddEquation ) data.blendEquation = this.blendEquation;\n\t\tif ( this.blendSrcAlpha !== null ) data.blendSrcAlpha = this.blendSrcAlpha;\n\t\tif ( this.blendDstAlpha !== null ) data.blendDstAlpha = this.blendDstAlpha;\n\t\tif ( this.blendEquationAlpha !== null ) data.blendEquationAlpha = this.blendEquationAlpha;\n\t\tif ( this.blendColor && this.blendColor.isColor ) data.blendColor = this.blendColor.getHex();\n\t\tif ( this.blendAlpha !== 0 ) data.blendAlpha = this.blendAlpha;\n\n\t\tif ( this.depthFunc !== LessEqualDepth ) data.depthFunc = this.depthFunc;\n\t\tif ( this.depthTest === false ) data.depthTest = this.depthTest;\n\t\tif ( this.depthWrite === false ) data.depthWrite = this.depthWrite;\n\t\tif ( this.colorWrite === false ) data.colorWrite = this.colorWrite;\n\n\t\tif ( this.stencilWriteMask !== 0xff ) data.stencilWriteMask = this.stencilWriteMask;\n\t\tif ( this.stencilFunc !== AlwaysStencilFunc ) data.stencilFunc = this.stencilFunc;\n\t\tif ( this.stencilRef !== 0 ) data.stencilRef = this.stencilRef;\n\t\tif ( this.stencilFuncMask !== 0xff ) data.stencilFuncMask = this.stencilFuncMask;\n\t\tif ( this.stencilFail !== KeepStencilOp ) data.stencilFail = this.stencilFail;\n\t\tif ( this.stencilZFail !== KeepStencilOp ) data.stencilZFail = this.stencilZFail;\n\t\tif ( this.stencilZPass !== KeepStencilOp ) data.stencilZPass = this.stencilZPass;\n\t\tif ( this.stencilWrite === true ) data.stencilWrite = this.stencilWrite;\n\n\t\t// rotation (SpriteMaterial)\n\t\tif ( this.rotation !== undefined && this.rotation !== 0 ) data.rotation = this.rotation;\n\n\t\tif ( this.polygonOffset === true ) data.polygonOffset = true;\n\t\tif ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;\n\t\tif ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;\n\n\t\tif ( this.linewidth !== undefined && this.linewidth !== 1 ) data.linewidth = this.linewidth;\n\t\tif ( this.dashSize !== undefined ) data.dashSize = this.dashSize;\n\t\tif ( this.gapSize !== undefined ) data.gapSize = this.gapSize;\n\t\tif ( this.scale !== undefined ) data.scale = this.scale;\n\n\t\tif ( this.dithering === true ) data.dithering = true;\n\n\t\tif ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;\n\t\tif ( this.alphaHash === true ) data.alphaHash = true;\n\t\tif ( this.alphaToCoverage === true ) data.alphaToCoverage = true;\n\t\tif ( this.premultipliedAlpha === true ) data.premultipliedAlpha = true;\n\t\tif ( this.forceSinglePass === true ) data.forceSinglePass = true;\n\n\t\tif ( this.wireframe === true ) data.wireframe = true;\n\t\tif ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;\n\t\tif ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;\n\t\tif ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;\n\n\t\tif ( this.flatShading === true ) data.flatShading = true;\n\n\t\tif ( this.visible === false ) data.visible = false;\n\n\t\tif ( this.toneMapped === false ) data.toneMapped = false;\n\n\t\tif ( this.fog === false ) data.fog = false;\n\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\n\n\t\t// TODO: Copied from Object3D.toJSON\n\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t\tif ( isRootObject ) {\n\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\n\t\t\tif ( textures.length > 0 ) data.textures = textures;\n\t\t\tif ( images.length > 0 ) data.images = images;\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.blending = source.blending;\n\t\tthis.side = source.side;\n\t\tthis.vertexColors = source.vertexColors;\n\n\t\tthis.opacity = source.opacity;\n\t\tthis.transparent = source.transparent;\n\n\t\tthis.blendSrc = source.blendSrc;\n\t\tthis.blendDst = source.blendDst;\n\t\tthis.blendEquation = source.blendEquation;\n\t\tthis.blendSrcAlpha = source.blendSrcAlpha;\n\t\tthis.blendDstAlpha = source.blendDstAlpha;\n\t\tthis.blendEquationAlpha = source.blendEquationAlpha;\n\t\tthis.blendColor.copy( source.blendColor );\n\t\tthis.blendAlpha = source.blendAlpha;\n\n\t\tthis.depthFunc = source.depthFunc;\n\t\tthis.depthTest = source.depthTest;\n\t\tthis.depthWrite = source.depthWrite;\n\n\t\tthis.stencilWriteMask = source.stencilWriteMask;\n\t\tthis.stencilFunc = source.stencilFunc;\n\t\tthis.stencilRef = source.stencilRef;\n\t\tthis.stencilFuncMask = source.stencilFuncMask;\n\t\tthis.stencilFail = source.stencilFail;\n\t\tthis.stencilZFail = source.stencilZFail;\n\t\tthis.stencilZPass = source.stencilZPass;\n\t\tthis.stencilWrite = source.stencilWrite;\n\n\t\tconst srcPlanes = source.clippingPlanes;\n\t\tlet dstPlanes = null;\n\n\t\tif ( srcPlanes !== null ) {\n\n\t\t\tconst n = srcPlanes.length;\n\t\t\tdstPlanes = new Array( n );\n\n\t\t\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\t\t\tdstPlanes[ i ] = srcPlanes[ i ].clone();\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.clippingPlanes = dstPlanes;\n\t\tthis.clipIntersection = source.clipIntersection;\n\t\tthis.clipShadows = source.clipShadows;\n\n\t\tthis.shadowSide = source.shadowSide;\n\n\t\tthis.colorWrite = source.colorWrite;\n\n\t\tthis.precision = source.precision;\n\n\t\tthis.polygonOffset = source.polygonOffset;\n\t\tthis.polygonOffsetFactor = source.polygonOffsetFactor;\n\t\tthis.polygonOffsetUnits = source.polygonOffsetUnits;\n\n\t\tthis.dithering = source.dithering;\n\n\t\tthis.alphaTest = source.alphaTest;\n\t\tthis.alphaHash = source.alphaHash;\n\t\tthis.alphaToCoverage = source.alphaToCoverage;\n\t\tthis.premultipliedAlpha = source.premultipliedAlpha;\n\t\tthis.forceSinglePass = source.forceSinglePass;\n\n\t\tthis.visible = source.visible;\n\n\t\tthis.toneMapped = source.toneMapped;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n}\n\nclass MeshBasicMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshBasicMaterial = true;\n\n\t\tthis.type = 'MeshBasicMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // emissive\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\n// Fast Half Float Conversions, http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n\nconst _tables = /*@__PURE__*/ _generateTables();\n\nfunction _generateTables() {\n\n\t// float32 to float16 helpers\n\n\tconst buffer = new ArrayBuffer( 4 );\n\tconst floatView = new Float32Array( buffer );\n\tconst uint32View = new Uint32Array( buffer );\n\n\tconst baseTable = new Uint32Array( 512 );\n\tconst shiftTable = new Uint32Array( 512 );\n\n\tfor ( let i = 0; i < 256; ++ i ) {\n\n\t\tconst e = i - 127;\n\n\t\t// very small number (0, -0)\n\n\t\tif ( e < - 27 ) {\n\n\t\t\tbaseTable[ i ] = 0x0000;\n\t\t\tbaseTable[ i | 0x100 ] = 0x8000;\n\t\t\tshiftTable[ i ] = 24;\n\t\t\tshiftTable[ i | 0x100 ] = 24;\n\n\t\t\t// small number (denorm)\n\n\t\t} else if ( e < - 14 ) {\n\n\t\t\tbaseTable[ i ] = 0x0400 >> ( - e - 14 );\n\t\t\tbaseTable[ i | 0x100 ] = ( 0x0400 >> ( - e - 14 ) ) | 0x8000;\n\t\t\tshiftTable[ i ] = - e - 1;\n\t\t\tshiftTable[ i | 0x100 ] = - e - 1;\n\n\t\t\t// normal number\n\n\t\t} else if ( e <= 15 ) {\n\n\t\t\tbaseTable[ i ] = ( e + 15 ) << 10;\n\t\t\tbaseTable[ i | 0x100 ] = ( ( e + 15 ) << 10 ) | 0x8000;\n\t\t\tshiftTable[ i ] = 13;\n\t\t\tshiftTable[ i | 0x100 ] = 13;\n\n\t\t\t// large number (Infinity, -Infinity)\n\n\t\t} else if ( e < 128 ) {\n\n\t\t\tbaseTable[ i ] = 0x7c00;\n\t\t\tbaseTable[ i | 0x100 ] = 0xfc00;\n\t\t\tshiftTable[ i ] = 24;\n\t\t\tshiftTable[ i | 0x100 ] = 24;\n\n\t\t\t// stay (NaN, Infinity, -Infinity)\n\n\t\t} else {\n\n\t\t\tbaseTable[ i ] = 0x7c00;\n\t\t\tbaseTable[ i | 0x100 ] = 0xfc00;\n\t\t\tshiftTable[ i ] = 13;\n\t\t\tshiftTable[ i | 0x100 ] = 13;\n\n\t\t}\n\n\t}\n\n\t// float16 to float32 helpers\n\n\tconst mantissaTable = new Uint32Array( 2048 );\n\tconst exponentTable = new Uint32Array( 64 );\n\tconst offsetTable = new Uint32Array( 64 );\n\n\tfor ( let i = 1; i < 1024; ++ i ) {\n\n\t\tlet m = i << 13; // zero pad mantissa bits\n\t\tlet e = 0; // zero exponent\n\n\t\t// normalized\n\t\twhile ( ( m & 0x00800000 ) === 0 ) {\n\n\t\t\tm <<= 1;\n\t\t\te -= 0x00800000; // decrement exponent\n\n\t\t}\n\n\t\tm &= ~ 0x00800000; // clear leading 1 bit\n\t\te += 0x38800000; // adjust bias\n\n\t\tmantissaTable[ i ] = m | e;\n\n\t}\n\n\tfor ( let i = 1024; i < 2048; ++ i ) {\n\n\t\tmantissaTable[ i ] = 0x38000000 + ( ( i - 1024 ) << 13 );\n\n\t}\n\n\tfor ( let i = 1; i < 31; ++ i ) {\n\n\t\texponentTable[ i ] = i << 23;\n\n\t}\n\n\texponentTable[ 31 ] = 0x47800000;\n\texponentTable[ 32 ] = 0x80000000;\n\n\tfor ( let i = 33; i < 63; ++ i ) {\n\n\t\texponentTable[ i ] = 0x80000000 + ( ( i - 32 ) << 23 );\n\n\t}\n\n\texponentTable[ 63 ] = 0xc7800000;\n\n\tfor ( let i = 1; i < 64; ++ i ) {\n\n\t\tif ( i !== 32 ) {\n\n\t\t\toffsetTable[ i ] = 1024;\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tfloatView: floatView,\n\t\tuint32View: uint32View,\n\t\tbaseTable: baseTable,\n\t\tshiftTable: shiftTable,\n\t\tmantissaTable: mantissaTable,\n\t\texponentTable: exponentTable,\n\t\toffsetTable: offsetTable\n\t};\n\n}\n\n// float32 to float16\n\nfunction toHalfFloat( val ) {\n\n\tif ( Math.abs( val ) > 65504 ) console.warn( 'THREE.DataUtils.toHalfFloat(): Value out of range.' );\n\n\tval = clamp( val, - 65504, 65504 );\n\n\t_tables.floatView[ 0 ] = val;\n\tconst f = _tables.uint32View[ 0 ];\n\tconst e = ( f >> 23 ) & 0x1ff;\n\treturn _tables.baseTable[ e ] + ( ( f & 0x007fffff ) >> _tables.shiftTable[ e ] );\n\n}\n\n// float16 to float32\n\nfunction fromHalfFloat( val ) {\n\n\tconst m = val >> 10;\n\t_tables.uint32View[ 0 ] = _tables.mantissaTable[ _tables.offsetTable[ m ] + ( val & 0x3ff ) ] + _tables.exponentTable[ m ];\n\treturn _tables.floatView[ 0 ];\n\n}\n\nconst DataUtils = {\n\ttoHalfFloat: toHalfFloat,\n\tfromHalfFloat: fromHalfFloat,\n};\n\nconst _vector$8 = /*@__PURE__*/ new Vector3();\nconst _vector2$1 = /*@__PURE__*/ new Vector2();\n\nclass BufferAttribute {\n\n\tconstructor( array, itemSize, normalized = false ) {\n\n\t\tif ( Array.isArray( array ) ) {\n\n\t\t\tthrow new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' );\n\n\t\t}\n\n\t\tthis.isBufferAttribute = true;\n\n\t\tthis.name = '';\n\n\t\tthis.array = array;\n\t\tthis.itemSize = itemSize;\n\t\tthis.count = array !== undefined ? array.length / itemSize : 0;\n\t\tthis.normalized = normalized;\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis.updateRange = { offset: 0, count: - 1 };\n\t\tthis.gpuType = FloatType;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tonUploadCallback() {}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\t\tthis.array = new source.array.constructor( source.array );\n\t\tthis.itemSize = source.itemSize;\n\t\tthis.count = source.count;\n\t\tthis.normalized = source.normalized;\n\n\t\tthis.usage = source.usage;\n\t\tthis.gpuType = source.gpuType;\n\n\t\treturn this;\n\n\t}\n\n\tcopyAt( index1, attribute, index2 ) {\n\n\t\tindex1 *= this.itemSize;\n\t\tindex2 *= attribute.itemSize;\n\n\t\tfor ( let i = 0, l = this.itemSize; i < l; i ++ ) {\n\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcopyArray( array ) {\n\n\t\tthis.array.set( array );\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tif ( this.itemSize === 2 ) {\n\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t\t_vector2$1.fromBufferAttribute( this, i );\n\t\t\t\t_vector2$1.applyMatrix3( m );\n\n\t\t\t\tthis.setXY( i, _vector2$1.x, _vector2$1.y );\n\n\t\t\t}\n\n\t\t} else if ( this.itemSize === 3 ) {\n\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t\t_vector$8.fromBufferAttribute( this, i );\n\t\t\t\t_vector$8.applyMatrix3( m );\n\n\t\t\t\tthis.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$8.fromBufferAttribute( this, i );\n\n\t\t\t_vector$8.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$8.fromBufferAttribute( this, i );\n\n\t\t\t_vector$8.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$8.fromBufferAttribute( this, i );\n\n\t\t\t_vector$8.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tset( value, offset = 0 ) {\n\n\t\t// Matching BufferAttribute constructor, do not normalize the array.\n\t\tthis.array.set( value, offset );\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index, component ) {\n\n\t\tlet value = this.array[ index * this.itemSize + component ];\n\n\t\tif ( this.normalized ) value = denormalize( value, this.array );\n\n\t\treturn value;\n\n\t}\n\n\tsetComponent( index, component, value ) {\n\n\t\tif ( this.normalized ) value = normalize( value, this.array );\n\n\t\tthis.array[ index * this.itemSize + component ] = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = this.array[ index * this.itemSize ];\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.array[ index * this.itemSize ] = x;\n\n\t\treturn this;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = this.array[ index * this.itemSize + 1 ];\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.array[ index * this.itemSize + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = this.array[ index * this.itemSize + 2 ];\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.array[ index * this.itemSize + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = this.array[ index * this.itemSize + 3 ];\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.array[ index * this.itemSize + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\t\tthis.array[ index + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tonUpload( callback ) {\n\n\t\tthis.onUploadCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.array, this.itemSize ).copy( this );\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\titemSize: this.itemSize,\n\t\t\ttype: this.array.constructor.name,\n\t\t\tarray: Array.from( this.array ),\n\t\t\tnormalized: this.normalized\n\t\t};\n\n\t\tif ( this.name !== '' ) data.name = this.name;\n\t\tif ( this.usage !== StaticDrawUsage ) data.usage = this.usage;\n\t\tif ( this.updateRange.offset !== 0 || this.updateRange.count !== - 1 ) data.updateRange = this.updateRange;\n\n\t\treturn data;\n\n\t}\n\n}\n\n//\n\nclass Int8BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int8Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint8BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint8Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint8ClampedBufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint8ClampedArray( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Int16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int16Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Int32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Float16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\n\n\t\tthis.isFloat16BufferAttribute = true;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = fromHalfFloat( this.array[ index * this.itemSize ] );\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.array[ index * this.itemSize ] = toHalfFloat( x );\n\n\t\treturn this;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = fromHalfFloat( this.array[ index * this.itemSize + 1 ] );\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.array[ index * this.itemSize + 1 ] = toHalfFloat( y );\n\n\t\treturn this;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = fromHalfFloat( this.array[ index * this.itemSize + 2 ] );\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.array[ index * this.itemSize + 2 ] = toHalfFloat( z );\n\n\t\treturn this;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = fromHalfFloat( this.array[ index * this.itemSize + 3 ] );\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.array[ index * this.itemSize + 3 ] = toHalfFloat( w );\n\n\t\treturn this;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\t\tthis.array[ index + 2 ] = toHalfFloat( z );\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\t\tthis.array[ index + 2 ] = toHalfFloat( z );\n\t\tthis.array[ index + 3 ] = toHalfFloat( w );\n\n\t\treturn this;\n\n\t}\n\n}\n\n\nclass Float32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Float32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Float64BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Float64Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nlet _id$2 = 0;\n\nconst _m1 = /*@__PURE__*/ new Matrix4();\nconst _obj = /*@__PURE__*/ new Object3D();\nconst _offset = /*@__PURE__*/ new Vector3();\nconst _box$1 = /*@__PURE__*/ new Box3();\nconst _boxMorphTargets = /*@__PURE__*/ new Box3();\nconst _vector$7 = /*@__PURE__*/ new Vector3();\n\nclass BufferGeometry extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isBufferGeometry = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _id$2 ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'BufferGeometry';\n\n\t\tthis.index = null;\n\t\tthis.attributes = {};\n\n\t\tthis.morphAttributes = {};\n\t\tthis.morphTargetsRelative = false;\n\n\t\tthis.groups = [];\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\tthis.drawRange = { start: 0, count: Infinity };\n\n\t\tthis.userData = {};\n\n\t}\n\n\tgetIndex() {\n\n\t\treturn this.index;\n\n\t}\n\n\tsetIndex( index ) {\n\n\t\tif ( Array.isArray( index ) ) {\n\n\t\t\tthis.index = new ( arrayNeedsUint32( index ) ? Uint32BufferAttribute : Uint16BufferAttribute )( index, 1 );\n\n\t\t} else {\n\n\t\t\tthis.index = index;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetAttribute( name ) {\n\n\t\treturn this.attributes[ name ];\n\n\t}\n\n\tsetAttribute( name, attribute ) {\n\n\t\tthis.attributes[ name ] = attribute;\n\n\t\treturn this;\n\n\t}\n\n\tdeleteAttribute( name ) {\n\n\t\tdelete this.attributes[ name ];\n\n\t\treturn this;\n\n\t}\n\n\thasAttribute( name ) {\n\n\t\treturn this.attributes[ name ] !== undefined;\n\n\t}\n\n\taddGroup( start, count, materialIndex = 0 ) {\n\n\t\tthis.groups.push( {\n\n\t\t\tstart: start,\n\t\t\tcount: count,\n\t\t\tmaterialIndex: materialIndex\n\n\t\t} );\n\n\t}\n\n\tclearGroups() {\n\n\t\tthis.groups = [];\n\n\t}\n\n\tsetDrawRange( start, count ) {\n\n\t\tthis.drawRange.start = start;\n\t\tthis.drawRange.count = count;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tconst position = this.attributes.position;\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tposition.applyMatrix4( matrix );\n\n\t\t\tposition.needsUpdate = true;\n\n\t\t}\n\n\t\tconst normal = this.attributes.normal;\n\n\t\tif ( normal !== undefined ) {\n\n\t\t\tconst normalMatrix = new Matrix3().getNormalMatrix( matrix );\n\n\t\t\tnormal.applyNormalMatrix( normalMatrix );\n\n\t\t\tnormal.needsUpdate = true;\n\n\t\t}\n\n\t\tconst tangent = this.attributes.tangent;\n\n\t\tif ( tangent !== undefined ) {\n\n\t\t\ttangent.transformDirection( matrix );\n\n\t\t\ttangent.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tthis.computeBoundingBox();\n\n\t\t}\n\n\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\tthis.computeBoundingSphere();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\t_m1.makeRotationFromQuaternion( q );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateX( angle ) {\n\n\t\t// rotate geometry around world x-axis\n\n\t\t_m1.makeRotationX( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateY( angle ) {\n\n\t\t// rotate geometry around world y-axis\n\n\t\t_m1.makeRotationY( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateZ( angle ) {\n\n\t\t// rotate geometry around world z-axis\n\n\t\t_m1.makeRotationZ( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( x, y, z ) {\n\n\t\t// translate geometry\n\n\t\t_m1.makeTranslation( x, y, z );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\tscale( x, y, z ) {\n\n\t\t// scale geometry\n\n\t\t_m1.makeScale( x, y, z );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\tlookAt( vector ) {\n\n\t\t_obj.lookAt( vector );\n\n\t\t_obj.updateMatrix();\n\n\t\tthis.applyMatrix4( _obj.matrix );\n\n\t\treturn this;\n\n\t}\n\n\tcenter() {\n\n\t\tthis.computeBoundingBox();\n\n\t\tthis.boundingBox.getCenter( _offset ).negate();\n\n\t\tthis.translate( _offset.x, _offset.y, _offset.z );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tconst position = [];\n\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tconst point = points[ i ];\n\t\t\tposition.push( point.x, point.y, point.z || 0 );\n\n\t\t}\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) );\n\n\t\treturn this;\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tconst position = this.attributes.position;\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position && position.isGLBufferAttribute ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set \"mesh.frustumCulled\" to \"false\".', this );\n\n\t\t\tthis.boundingBox.set(\n\t\t\t\tnew Vector3( - Infinity, - Infinity, - Infinity ),\n\t\t\t\tnew Vector3( + Infinity, + Infinity, + Infinity )\n\t\t\t);\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tthis.boundingBox.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_box$1.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$7.addVectors( this.boundingBox.min, _box$1.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$7 );\n\n\t\t\t\t\t\t_vector$7.addVectors( this.boundingBox.max, _box$1.max );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$7 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$1.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$1.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthis.boundingBox.makeEmpty();\n\n\t\t}\n\n\t\tif ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tconst position = this.attributes.position;\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position && position.isGLBufferAttribute ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set \"mesh.frustumCulled\" to \"false\".', this );\n\n\t\t\tthis.boundingSphere.set( new Vector3(), Infinity );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( position ) {\n\n\t\t\t// first, find the center of the bounding sphere\n\n\t\t\tconst center = this.boundingSphere.center;\n\n\t\t\t_box$1.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_boxMorphTargets.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$7.addVectors( _box$1.min, _boxMorphTargets.min );\n\t\t\t\t\t\t_box$1.expandByPoint( _vector$7 );\n\n\t\t\t\t\t\t_vector$7.addVectors( _box$1.max, _boxMorphTargets.max );\n\t\t\t\t\t\t_box$1.expandByPoint( _vector$7 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_box$1.expandByPoint( _boxMorphTargets.min );\n\t\t\t\t\t\t_box$1.expandByPoint( _boxMorphTargets.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_box$1.getCenter( center );\n\n\t\t\t// second, try to find a boundingSphere with a radius smaller than the\n\t\t\t// boundingSphere of the boundingBox: sqrt(3) smaller in the best case\n\n\t\t\tlet maxRadiusSq = 0;\n\n\t\t\tfor ( let i = 0, il = position.count; i < il; i ++ ) {\n\n\t\t\t\t_vector$7.fromBufferAttribute( position, i );\n\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$7 ) );\n\n\t\t\t}\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\tconst morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t\t\t\tfor ( let j = 0, jl = morphAttribute.count; j < jl; j ++ ) {\n\n\t\t\t\t\t\t_vector$7.fromBufferAttribute( morphAttribute, j );\n\n\t\t\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t\t\t_offset.fromBufferAttribute( position, j );\n\t\t\t\t\t\t\t_vector$7.add( _offset );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$7 ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.boundingSphere.radius = Math.sqrt( maxRadiusSq );\n\n\t\t\tif ( isNaN( this.boundingSphere.radius ) ) {\n\n\t\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcomputeTangents() {\n\n\t\tconst index = this.index;\n\t\tconst attributes = this.attributes;\n\n\t\t// based on http://www.terathon.com/code/tangent.html\n\t\t// (per vertex tangents)\n\n\t\tif ( index === null ||\n\t\t\t attributes.position === undefined ||\n\t\t\t attributes.normal === undefined ||\n\t\t\t attributes.uv === undefined ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst indices = index.array;\n\t\tconst positions = attributes.position.array;\n\t\tconst normals = attributes.normal.array;\n\t\tconst uvs = attributes.uv.array;\n\n\t\tconst nVertices = positions.length / 3;\n\n\t\tif ( this.hasAttribute( 'tangent' ) === false ) {\n\n\t\t\tthis.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );\n\n\t\t}\n\n\t\tconst tangents = this.getAttribute( 'tangent' ).array;\n\n\t\tconst tan1 = [], tan2 = [];\n\n\t\tfor ( let i = 0; i < nVertices; i ++ ) {\n\n\t\t\ttan1[ i ] = new Vector3();\n\t\t\ttan2[ i ] = new Vector3();\n\n\t\t}\n\n\t\tconst vA = new Vector3(),\n\t\t\tvB = new Vector3(),\n\t\t\tvC = new Vector3(),\n\n\t\t\tuvA = new Vector2(),\n\t\t\tuvB = new Vector2(),\n\t\t\tuvC = new Vector2(),\n\n\t\t\tsdir = new Vector3(),\n\t\t\ttdir = new Vector3();\n\n\t\tfunction handleTriangle( a, b, c ) {\n\n\t\t\tvA.fromArray( positions, a * 3 );\n\t\t\tvB.fromArray( positions, b * 3 );\n\t\t\tvC.fromArray( positions, c * 3 );\n\n\t\t\tuvA.fromArray( uvs, a * 2 );\n\t\t\tuvB.fromArray( uvs, b * 2 );\n\t\t\tuvC.fromArray( uvs, c * 2 );\n\n\t\t\tvB.sub( vA );\n\t\t\tvC.sub( vA );\n\n\t\t\tuvB.sub( uvA );\n\t\t\tuvC.sub( uvA );\n\n\t\t\tconst r = 1.0 / ( uvB.x * uvC.y - uvC.x * uvB.y );\n\n\t\t\t// silently ignore degenerate uv triangles having coincident or colinear vertices\n\n\t\t\tif ( ! isFinite( r ) ) return;\n\n\t\t\tsdir.copy( vB ).multiplyScalar( uvC.y ).addScaledVector( vC, - uvB.y ).multiplyScalar( r );\n\t\t\ttdir.copy( vC ).multiplyScalar( uvB.x ).addScaledVector( vB, - uvC.x ).multiplyScalar( r );\n\n\t\t\ttan1[ a ].add( sdir );\n\t\t\ttan1[ b ].add( sdir );\n\t\t\ttan1[ c ].add( sdir );\n\n\t\t\ttan2[ a ].add( tdir );\n\t\t\ttan2[ b ].add( tdir );\n\t\t\ttan2[ c ].add( tdir );\n\n\t\t}\n\n\t\tlet groups = this.groups;\n\n\t\tif ( groups.length === 0 ) {\n\n\t\t\tgroups = [ {\n\t\t\t\tstart: 0,\n\t\t\t\tcount: indices.length\n\t\t\t} ];\n\n\t\t}\n\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\n\n\t\t\tconst group = groups[ i ];\n\n\t\t\tconst start = group.start;\n\t\t\tconst count = group.count;\n\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\n\n\t\t\t\thandleTriangle(\n\t\t\t\t\tindices[ j + 0 ],\n\t\t\t\t\tindices[ j + 1 ],\n\t\t\t\t\tindices[ j + 2 ]\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst tmp = new Vector3(), tmp2 = new Vector3();\n\t\tconst n = new Vector3(), n2 = new Vector3();\n\n\t\tfunction handleVertex( v ) {\n\n\t\t\tn.fromArray( normals, v * 3 );\n\t\t\tn2.copy( n );\n\n\t\t\tconst t = tan1[ v ];\n\n\t\t\t// Gram-Schmidt orthogonalize\n\n\t\t\ttmp.copy( t );\n\t\t\ttmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize();\n\n\t\t\t// Calculate handedness\n\n\t\t\ttmp2.crossVectors( n2, t );\n\t\t\tconst test = tmp2.dot( tan2[ v ] );\n\t\t\tconst w = ( test < 0.0 ) ? - 1.0 : 1.0;\n\n\t\t\ttangents[ v * 4 ] = tmp.x;\n\t\t\ttangents[ v * 4 + 1 ] = tmp.y;\n\t\t\ttangents[ v * 4 + 2 ] = tmp.z;\n\t\t\ttangents[ v * 4 + 3 ] = w;\n\n\t\t}\n\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\n\n\t\t\tconst group = groups[ i ];\n\n\t\t\tconst start = group.start;\n\t\t\tconst count = group.count;\n\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\n\n\t\t\t\thandleVertex( indices[ j + 0 ] );\n\t\t\t\thandleVertex( indices[ j + 1 ] );\n\t\t\t\thandleVertex( indices[ j + 2 ] );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcomputeVertexNormals() {\n\n\t\tconst index = this.index;\n\t\tconst positionAttribute = this.getAttribute( 'position' );\n\n\t\tif ( positionAttribute !== undefined ) {\n\n\t\t\tlet normalAttribute = this.getAttribute( 'normal' );\n\n\t\t\tif ( normalAttribute === undefined ) {\n\n\t\t\t\tnormalAttribute = new BufferAttribute( new Float32Array( positionAttribute.count * 3 ), 3 );\n\t\t\t\tthis.setAttribute( 'normal', normalAttribute );\n\n\t\t\t} else {\n\n\t\t\t\t// reset existing normals to zero\n\n\t\t\t\tfor ( let i = 0, il = normalAttribute.count; i < il; i ++ ) {\n\n\t\t\t\t\tnormalAttribute.setXYZ( i, 0, 0, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst pA = new Vector3(), pB = new Vector3(), pC = new Vector3();\n\t\t\tconst nA = new Vector3(), nB = new Vector3(), nC = new Vector3();\n\t\t\tconst cb = new Vector3(), ab = new Vector3();\n\n\t\t\t// indexed elements\n\n\t\t\tif ( index ) {\n\n\t\t\t\tfor ( let i = 0, il = index.count; i < il; i += 3 ) {\n\n\t\t\t\t\tconst vA = index.getX( i + 0 );\n\t\t\t\t\tconst vB = index.getX( i + 1 );\n\t\t\t\t\tconst vC = index.getX( i + 2 );\n\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, vA );\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, vB );\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, vC );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnA.fromBufferAttribute( normalAttribute, vA );\n\t\t\t\t\tnB.fromBufferAttribute( normalAttribute, vB );\n\t\t\t\t\tnC.fromBufferAttribute( normalAttribute, vC );\n\n\t\t\t\t\tnA.add( cb );\n\t\t\t\t\tnB.add( cb );\n\t\t\t\t\tnC.add( cb );\n\n\t\t\t\t\tnormalAttribute.setXYZ( vA, nA.x, nA.y, nA.z );\n\t\t\t\t\tnormalAttribute.setXYZ( vB, nB.x, nB.y, nB.z );\n\t\t\t\t\tnormalAttribute.setXYZ( vC, nC.x, nC.y, nC.z );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// non-indexed elements (unconnected triangle soup)\n\n\t\t\t\tfor ( let i = 0, il = positionAttribute.count; i < il; i += 3 ) {\n\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, i + 0 );\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, i + 1 );\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, i + 2 );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnormalAttribute.setXYZ( i + 0, cb.x, cb.y, cb.z );\n\t\t\t\t\tnormalAttribute.setXYZ( i + 1, cb.x, cb.y, cb.z );\n\t\t\t\t\tnormalAttribute.setXYZ( i + 2, cb.x, cb.y, cb.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.normalizeNormals();\n\n\t\t\tnormalAttribute.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tnormalizeNormals() {\n\n\t\tconst normals = this.attributes.normal;\n\n\t\tfor ( let i = 0, il = normals.count; i < il; i ++ ) {\n\n\t\t\t_vector$7.fromBufferAttribute( normals, i );\n\n\t\t\t_vector$7.normalize();\n\n\t\t\tnormals.setXYZ( i, _vector$7.x, _vector$7.y, _vector$7.z );\n\n\t\t}\n\n\t}\n\n\ttoNonIndexed() {\n\n\t\tfunction convertBufferAttribute( attribute, indices ) {\n\n\t\t\tconst array = attribute.array;\n\t\t\tconst itemSize = attribute.itemSize;\n\t\t\tconst normalized = attribute.normalized;\n\n\t\t\tconst array2 = new array.constructor( indices.length * itemSize );\n\n\t\t\tlet index = 0, index2 = 0;\n\n\t\t\tfor ( let i = 0, l = indices.length; i < l; i ++ ) {\n\n\t\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\tindex = indices[ i ] * attribute.data.stride + attribute.offset;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tindex = indices[ i ] * itemSize;\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let j = 0; j < itemSize; j ++ ) {\n\n\t\t\t\t\tarray2[ index2 ++ ] = array[ index ++ ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new BufferAttribute( array2, itemSize, normalized );\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.index === null ) {\n\n\t\t\tconsole.warn( 'THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.' );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst geometry2 = new BufferGeometry();\n\n\t\tconst indices = this.index.array;\n\t\tconst attributes = this.attributes;\n\n\t\t// attributes\n\n\t\tfor ( const name in attributes ) {\n\n\t\t\tconst attribute = attributes[ name ];\n\n\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\tgeometry2.setAttribute( name, newAttribute );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tconst morphAttributes = this.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst morphArray = [];\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( let i = 0, il = morphAttribute.length; i < il; i ++ ) {\n\n\t\t\t\tconst attribute = morphAttribute[ i ];\n\n\t\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\t\tmorphArray.push( newAttribute );\n\n\t\t\t}\n\n\t\t\tgeometry2.morphAttributes[ name ] = morphArray;\n\n\t\t}\n\n\t\tgeometry2.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tconst groups = this.groups;\n\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tconst group = groups[ i ];\n\t\t\tgeometry2.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\treturn geometry2;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'BufferGeometry',\n\t\t\t\tgenerator: 'BufferGeometry.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard BufferGeometry serialization\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\t\tif ( this.name !== '' ) data.name = this.name;\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\n\n\t\tif ( this.parameters !== undefined ) {\n\n\t\t\tconst parameters = this.parameters;\n\n\t\t\tfor ( const key in parameters ) {\n\n\t\t\t\tif ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ];\n\n\t\t\t}\n\n\t\t\treturn data;\n\n\t\t}\n\n\t\t// for simplicity the code assumes attributes are not shared across geometries, see #15811\n\n\t\tdata.data = { attributes: {} };\n\n\t\tconst index = this.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tdata.data.index = {\n\t\t\t\ttype: index.array.constructor.name,\n\t\t\t\tarray: Array.prototype.slice.call( index.array )\n\t\t\t};\n\n\t\t}\n\n\t\tconst attributes = this.attributes;\n\n\t\tfor ( const key in attributes ) {\n\n\t\t\tconst attribute = attributes[ key ];\n\n\t\t\tdata.data.attributes[ key ] = attribute.toJSON( data.data );\n\n\t\t}\n\n\t\tconst morphAttributes = {};\n\t\tlet hasMorphAttributes = false;\n\n\t\tfor ( const key in this.morphAttributes ) {\n\n\t\t\tconst attributeArray = this.morphAttributes[ key ];\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0, il = attributeArray.length; i < il; i ++ ) {\n\n\t\t\t\tconst attribute = attributeArray[ i ];\n\n\t\t\t\tarray.push( attribute.toJSON( data.data ) );\n\n\t\t\t}\n\n\t\t\tif ( array.length > 0 ) {\n\n\t\t\t\tmorphAttributes[ key ] = array;\n\n\t\t\t\thasMorphAttributes = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( hasMorphAttributes ) {\n\n\t\t\tdata.data.morphAttributes = morphAttributes;\n\t\t\tdata.data.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t}\n\n\t\tconst groups = this.groups;\n\n\t\tif ( groups.length > 0 ) {\n\n\t\t\tdata.data.groups = JSON.parse( JSON.stringify( groups ) );\n\n\t\t}\n\n\t\tconst boundingSphere = this.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tdata.data.boundingSphere = {\n\t\t\t\tcenter: boundingSphere.center.toArray(),\n\t\t\t\tradius: boundingSphere.radius\n\t\t\t};\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\t// reset\n\n\t\tthis.index = null;\n\t\tthis.attributes = {};\n\t\tthis.morphAttributes = {};\n\t\tthis.groups = [];\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\t// used for storing cloned, shared data\n\n\t\tconst data = {};\n\n\t\t// name\n\n\t\tthis.name = source.name;\n\n\t\t// index\n\n\t\tconst index = source.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tthis.setIndex( index.clone( data ) );\n\n\t\t}\n\n\t\t// attributes\n\n\t\tconst attributes = source.attributes;\n\n\t\tfor ( const name in attributes ) {\n\n\t\t\tconst attribute = attributes[ name ];\n\t\t\tthis.setAttribute( name, attribute.clone( data ) );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tconst morphAttributes = source.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst array = [];\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( let i = 0, l = morphAttribute.length; i < l; i ++ ) {\n\n\t\t\t\tarray.push( morphAttribute[ i ].clone( data ) );\n\n\t\t\t}\n\n\t\t\tthis.morphAttributes[ name ] = array;\n\n\t\t}\n\n\t\tthis.morphTargetsRelative = source.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tconst groups = source.groups;\n\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tconst group = groups[ i ];\n\t\t\tthis.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\t// bounding box\n\n\t\tconst boundingBox = source.boundingBox;\n\n\t\tif ( boundingBox !== null ) {\n\n\t\t\tthis.boundingBox = boundingBox.clone();\n\n\t\t}\n\n\t\t// bounding sphere\n\n\t\tconst boundingSphere = source.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tthis.boundingSphere = boundingSphere.clone();\n\n\t\t}\n\n\t\t// draw range\n\n\t\tthis.drawRange.start = source.drawRange.start;\n\t\tthis.drawRange.count = source.drawRange.count;\n\n\t\t// user data\n\n\t\tthis.userData = source.userData;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nconst _inverseMatrix$3 = /*@__PURE__*/ new Matrix4();\nconst _ray$3 = /*@__PURE__*/ new Ray();\nconst _sphere$5 = /*@__PURE__*/ new Sphere();\nconst _sphereHitAt = /*@__PURE__*/ new Vector3();\n\nconst _vA$1 = /*@__PURE__*/ new Vector3();\nconst _vB$1 = /*@__PURE__*/ new Vector3();\nconst _vC$1 = /*@__PURE__*/ new Vector3();\n\nconst _tempA = /*@__PURE__*/ new Vector3();\nconst _morphA = /*@__PURE__*/ new Vector3();\n\nconst _uvA$1 = /*@__PURE__*/ new Vector2();\nconst _uvB$1 = /*@__PURE__*/ new Vector2();\nconst _uvC$1 = /*@__PURE__*/ new Vector2();\n\nconst _normalA = /*@__PURE__*/ new Vector3();\nconst _normalB = /*@__PURE__*/ new Vector3();\nconst _normalC = /*@__PURE__*/ new Vector3();\n\nconst _intersectionPoint = /*@__PURE__*/ new Vector3();\nconst _intersectionPointWorld = /*@__PURE__*/ new Vector3();\n\nclass Mesh extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new MeshBasicMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isMesh = true;\n\n\t\tthis.type = 'Mesh';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.morphTargetInfluences !== undefined ) {\n\n\t\t\tthis.morphTargetInfluences = source.morphTargetInfluences.slice();\n\n\t\t}\n\n\t\tif ( source.morphTargetDictionary !== undefined ) {\n\n\t\t\tthis.morphTargetDictionary = Object.assign( {}, source.morphTargetDictionary );\n\n\t\t}\n\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tgetVertexPosition( index, target ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst position = geometry.attributes.position;\n\t\tconst morphPosition = geometry.morphAttributes.position;\n\t\tconst morphTargetsRelative = geometry.morphTargetsRelative;\n\n\t\ttarget.fromBufferAttribute( position, index );\n\n\t\tconst morphInfluences = this.morphTargetInfluences;\n\n\t\tif ( morphPosition && morphInfluences ) {\n\n\t\t\t_morphA.set( 0, 0, 0 );\n\n\t\t\tfor ( let i = 0, il = morphPosition.length; i < il; i ++ ) {\n\n\t\t\t\tconst influence = morphInfluences[ i ];\n\t\t\t\tconst morphAttribute = morphPosition[ i ];\n\n\t\t\t\tif ( influence === 0 ) continue;\n\n\t\t\t\t_tempA.fromBufferAttribute( morphAttribute, index );\n\n\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA, influence );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA.sub( target ), influence );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\ttarget.add( _morphA );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst material = this.material;\n\t\tconst matrixWorld = this.matrixWorld;\n\n\t\tif ( material === undefined ) return;\n\n\t\t// test with bounding sphere in world space\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$5.copy( geometry.boundingSphere );\n\t\t_sphere$5.applyMatrix4( matrixWorld );\n\n\t\t// check distance from ray origin to bounding sphere\n\n\t\t_ray$3.copy( raycaster.ray ).recast( raycaster.near );\n\n\t\tif ( _sphere$5.containsPoint( _ray$3.origin ) === false ) {\n\n\t\t\tif ( _ray$3.intersectSphere( _sphere$5, _sphereHitAt ) === null ) return;\n\n\t\t\tif ( _ray$3.origin.distanceToSquared( _sphereHitAt ) > ( raycaster.far - raycaster.near ) ** 2 ) return;\n\n\t\t}\n\n\t\t// convert ray to local space of mesh\n\n\t\t_inverseMatrix$3.copy( matrixWorld ).invert();\n\t\t_ray$3.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$3 );\n\n\t\t// test with bounding box in local space\n\n\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\tif ( _ray$3.intersectsBox( geometry.boundingBox ) === false ) return;\n\n\t\t}\n\n\t\t// test for intersections with geometry\n\n\t\tthis._computeIntersections( raycaster, intersects, _ray$3 );\n\n\t}\n\n\t_computeIntersections( raycaster, intersects, rayLocalSpace ) {\n\n\t\tlet intersection;\n\n\t\tconst geometry = this.geometry;\n\t\tconst material = this.material;\n\n\t\tconst index = geometry.index;\n\t\tconst position = geometry.attributes.position;\n\t\tconst uv = geometry.attributes.uv;\n\t\tconst uv1 = geometry.attributes.uv1;\n\t\tconst normal = geometry.attributes.normal;\n\t\tconst groups = geometry.groups;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\tif ( index !== null ) {\n\n\t\t\t// indexed buffer geometry\n\n\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\n\t\t\t\t\tconst end = Math.min( index.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\n\n\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\tconst a = index.getX( j );\n\t\t\t\t\t\tconst b = index.getX( j + 1 );\n\t\t\t\t\t\tconst c = index.getX( j + 2 );\n\n\t\t\t\t\t\tintersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\tconst a = index.getX( i );\n\t\t\t\t\tconst b = index.getX( i + 1 );\n\t\t\t\t\tconst c = index.getX( i + 2 );\n\n\t\t\t\t\tintersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else if ( position !== undefined ) {\n\n\t\t\t// non-indexed buffer geometry\n\n\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\n\t\t\t\t\tconst end = Math.min( position.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\n\n\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\tconst a = j;\n\t\t\t\t\t\tconst b = j + 1;\n\t\t\t\t\t\tconst c = j + 2;\n\n\t\t\t\t\t\tintersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( position.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\tconst a = i;\n\t\t\t\t\tconst b = i + 1;\n\t\t\t\t\tconst c = i + 2;\n\n\t\t\t\t\tintersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\n\n\tlet intersect;\n\n\tif ( material.side === BackSide ) {\n\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\n\n\t} else {\n\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, ( material.side === FrontSide ), point );\n\n\t}\n\n\tif ( intersect === null ) return null;\n\n\t_intersectionPointWorld.copy( point );\n\t_intersectionPointWorld.applyMatrix4( object.matrixWorld );\n\n\tconst distance = raycaster.ray.origin.distanceTo( _intersectionPointWorld );\n\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\n\n\treturn {\n\t\tdistance: distance,\n\t\tpoint: _intersectionPointWorld.clone(),\n\t\tobject: object\n\t};\n\n}\n\nfunction checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, normal, a, b, c ) {\n\n\tobject.getVertexPosition( a, _vA$1 );\n\tobject.getVertexPosition( b, _vB$1 );\n\tobject.getVertexPosition( c, _vC$1 );\n\n\tconst intersection = checkIntersection( object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint );\n\n\tif ( intersection ) {\n\n\t\tif ( uv ) {\n\n\t\t\t_uvA$1.fromBufferAttribute( uv, a );\n\t\t\t_uvB$1.fromBufferAttribute( uv, b );\n\t\t\t_uvC$1.fromBufferAttribute( uv, c );\n\n\t\t\tintersection.uv = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );\n\n\t\t}\n\n\t\tif ( uv1 ) {\n\n\t\t\t_uvA$1.fromBufferAttribute( uv1, a );\n\t\t\t_uvB$1.fromBufferAttribute( uv1, b );\n\t\t\t_uvC$1.fromBufferAttribute( uv1, c );\n\n\t\t\tintersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );\n\t\t\tintersection.uv2 = intersection.uv1; // @deprecated, r152\n\n\t\t}\n\n\t\tif ( normal ) {\n\n\t\t\t_normalA.fromBufferAttribute( normal, a );\n\t\t\t_normalB.fromBufferAttribute( normal, b );\n\t\t\t_normalC.fromBufferAttribute( normal, c );\n\n\t\t\tintersection.normal = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _normalA, _normalB, _normalC, new Vector3() );\n\n\t\t\tif ( intersection.normal.dot( ray.direction ) > 0 ) {\n\n\t\t\t\tintersection.normal.multiplyScalar( - 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst face = {\n\t\t\ta: a,\n\t\t\tb: b,\n\t\t\tc: c,\n\t\t\tnormal: new Vector3(),\n\t\t\tmaterialIndex: 0\n\t\t};\n\n\t\tTriangle.getNormal( _vA$1, _vB$1, _vC$1, face.normal );\n\n\t\tintersection.face = face;\n\n\t}\n\n\treturn intersection;\n\n}\n\nclass BoxGeometry extends BufferGeometry {\n\n\tconstructor( width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'BoxGeometry';\n\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\tdepth: depth,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tdepthSegments: depthSegments\n\t\t};\n\n\t\tconst scope = this;\n\n\t\t// segments\n\n\t\twidthSegments = Math.floor( widthSegments );\n\t\theightSegments = Math.floor( heightSegments );\n\t\tdepthSegments = Math.floor( depthSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet numberOfVertices = 0;\n\t\tlet groupStart = 0;\n\n\t\t// build each side of the box geometry\n\n\t\tbuildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px\n\t\tbuildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx\n\t\tbuildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py\n\t\tbuildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny\n\t\tbuildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz\n\t\tbuildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\tfunction buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) {\n\n\t\t\tconst segmentWidth = width / gridX;\n\t\t\tconst segmentHeight = height / gridY;\n\n\t\t\tconst widthHalf = width / 2;\n\t\t\tconst heightHalf = height / 2;\n\t\t\tconst depthHalf = depth / 2;\n\n\t\t\tconst gridX1 = gridX + 1;\n\t\t\tconst gridY1 = gridY + 1;\n\n\t\t\tlet vertexCounter = 0;\n\t\t\tlet groupCount = 0;\n\n\t\t\tconst vector = new Vector3();\n\n\t\t\t// generate vertices, normals and uvs\n\n\t\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\n\n\t\t\t\tconst y = iy * segmentHeight - heightHalf;\n\n\t\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\t\t\tconst x = ix * segmentWidth - widthHalf;\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = x * udir;\n\t\t\t\t\tvector[ v ] = y * vdir;\n\t\t\t\t\tvector[ w ] = depthHalf;\n\n\t\t\t\t\t// now apply vector to vertex buffer\n\n\t\t\t\t\tvertices.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = 0;\n\t\t\t\t\tvector[ v ] = 0;\n\t\t\t\t\tvector[ w ] = depth > 0 ? 1 : - 1;\n\n\t\t\t\t\t// now apply vector to normal buffer\n\n\t\t\t\t\tnormals.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// uvs\n\n\t\t\t\t\tuvs.push( ix / gridX );\n\t\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t\t\t\t// counters\n\n\t\t\t\t\tvertexCounter += 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// indices\n\n\t\t\t// 1. you need three indices to draw a single face\n\t\t\t// 2. a single segment consists of two faces\n\t\t\t// 3. so we need to generate six (2*3) indices per segment\n\n\t\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\n\n\t\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\t\t\tconst a = numberOfVertices + ix + gridX1 * iy;\n\t\t\t\t\tconst b = numberOfVertices + ix + gridX1 * ( iy + 1 );\n\t\t\t\t\tconst c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\t\t\tconst d = numberOfVertices + ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t\t// increase counter\n\n\t\t\t\t\tgroupCount += 6;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, materialIndex );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t\t// update total number of vertices\n\n\t\t\tnumberOfVertices += vertexCounter;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new BoxGeometry( data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments );\n\n\t}\n\n}\n\n/**\n * Uniform Utilities\n */\n\nfunction cloneUniforms( src ) {\n\n\tconst dst = {};\n\n\tfor ( const u in src ) {\n\n\t\tdst[ u ] = {};\n\n\t\tfor ( const p in src[ u ] ) {\n\n\t\t\tconst property = src[ u ][ p ];\n\n\t\t\tif ( property && ( property.isColor ||\n\t\t\t\tproperty.isMatrix3 || property.isMatrix4 ||\n\t\t\t\tproperty.isVector2 || property.isVector3 || property.isVector4 ||\n\t\t\t\tproperty.isTexture || property.isQuaternion ) ) {\n\n\t\t\t\tif ( property.isRenderTargetTexture ) {\n\n\t\t\t\t\tconsole.warn( 'UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().' );\n\t\t\t\t\tdst[ u ][ p ] = null;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdst[ u ][ p ] = property.clone();\n\n\t\t\t\t}\n\n\t\t\t} else if ( Array.isArray( property ) ) {\n\n\t\t\t\tdst[ u ][ p ] = property.slice();\n\n\t\t\t} else {\n\n\t\t\t\tdst[ u ][ p ] = property;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn dst;\n\n}\n\nfunction mergeUniforms( uniforms ) {\n\n\tconst merged = {};\n\n\tfor ( let u = 0; u < uniforms.length; u ++ ) {\n\n\t\tconst tmp = cloneUniforms( uniforms[ u ] );\n\n\t\tfor ( const p in tmp ) {\n\n\t\t\tmerged[ p ] = tmp[ p ];\n\n\t\t}\n\n\t}\n\n\treturn merged;\n\n}\n\nfunction cloneUniformsGroups( src ) {\n\n\tconst dst = [];\n\n\tfor ( let u = 0; u < src.length; u ++ ) {\n\n\t\tdst.push( src[ u ].clone() );\n\n\t}\n\n\treturn dst;\n\n}\n\nfunction getUnlitUniformColorSpace( renderer ) {\n\n\tif ( renderer.getRenderTarget() === null ) {\n\n\t\t// https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398\n\t\treturn renderer.outputColorSpace;\n\n\t}\n\n\treturn ColorManagement.workingColorSpace;\n\n}\n\n// Legacy\n\nconst UniformsUtils = { clone: cloneUniforms, merge: mergeUniforms };\n\nvar default_vertex = \"void main() {\\n\\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\\n}\";\n\nvar default_fragment = \"void main() {\\n\\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\\n}\";\n\nclass ShaderMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isShaderMaterial = true;\n\n\t\tthis.type = 'ShaderMaterial';\n\n\t\tthis.defines = {};\n\t\tthis.uniforms = {};\n\t\tthis.uniformsGroups = [];\n\n\t\tthis.vertexShader = default_vertex;\n\t\tthis.fragmentShader = default_fragment;\n\n\t\tthis.linewidth = 1;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.fog = false; // set to use scene fog\n\t\tthis.lights = false; // set to use scene lights\n\t\tthis.clipping = false; // set to use user-defined clipping planes\n\n\t\tthis.forceSinglePass = true;\n\n\t\tthis.extensions = {\n\t\t\tderivatives: false, // set to use derivatives\n\t\t\tfragDepth: false, // set to use fragment depth values\n\t\t\tdrawBuffers: false, // set to use draw buffers\n\t\t\tshaderTextureLOD: false // set to use shader texture LOD\n\t\t};\n\n\t\t// When rendered geometry doesn't include these attributes but the material does,\n\t\t// use these default values in WebGL. This avoids errors when buffer data is missing.\n\t\tthis.defaultAttributeValues = {\n\t\t\t'color': [ 1, 1, 1 ],\n\t\t\t'uv': [ 0, 0 ],\n\t\t\t'uv1': [ 0, 0 ]\n\t\t};\n\n\t\tthis.index0AttributeName = undefined;\n\t\tthis.uniformsNeedUpdate = false;\n\n\t\tthis.glslVersion = null;\n\n\t\tif ( parameters !== undefined ) {\n\n\t\t\tthis.setValues( parameters );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.fragmentShader = source.fragmentShader;\n\t\tthis.vertexShader = source.vertexShader;\n\n\t\tthis.uniforms = cloneUniforms( source.uniforms );\n\t\tthis.uniformsGroups = cloneUniformsGroups( source.uniformsGroups );\n\n\t\tthis.defines = Object.assign( {}, source.defines );\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\tthis.fog = source.fog;\n\t\tthis.lights = source.lights;\n\t\tthis.clipping = source.clipping;\n\n\t\tthis.extensions = Object.assign( {}, source.extensions );\n\n\t\tthis.glslVersion = source.glslVersion;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.glslVersion = this.glslVersion;\n\t\tdata.uniforms = {};\n\n\t\tfor ( const name in this.uniforms ) {\n\n\t\t\tconst uniform = this.uniforms[ name ];\n\t\t\tconst value = uniform.value;\n\n\t\t\tif ( value && value.isTexture ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 't',\n\t\t\t\t\tvalue: value.toJSON( meta ).uuid\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isColor ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'c',\n\t\t\t\t\tvalue: value.getHex()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector2 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v2',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector3 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v3',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector4 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v4',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isMatrix3 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'm3',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isMatrix4 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'm4',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\tvalue: value\n\t\t\t\t};\n\n\t\t\t\t// note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( Object.keys( this.defines ).length > 0 ) data.defines = this.defines;\n\n\t\tdata.vertexShader = this.vertexShader;\n\t\tdata.fragmentShader = this.fragmentShader;\n\n\t\tdata.lights = this.lights;\n\t\tdata.clipping = this.clipping;\n\n\t\tconst extensions = {};\n\n\t\tfor ( const key in this.extensions ) {\n\n\t\t\tif ( this.extensions[ key ] === true ) extensions[ key ] = true;\n\n\t\t}\n\n\t\tif ( Object.keys( extensions ).length > 0 ) data.extensions = extensions;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass Camera extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isCamera = true;\n\n\t\tthis.type = 'Camera';\n\n\t\tthis.matrixWorldInverse = new Matrix4();\n\n\t\tthis.projectionMatrix = new Matrix4();\n\t\tthis.projectionMatrixInverse = new Matrix4();\n\n\t\tthis.coordinateSystem = WebGLCoordinateSystem;\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.matrixWorldInverse.copy( source.matrixWorldInverse );\n\n\t\tthis.projectionMatrix.copy( source.projectionMatrix );\n\t\tthis.projectionMatrixInverse.copy( source.projectionMatrixInverse );\n\n\t\tthis.coordinateSystem = source.coordinateSystem;\n\n\t\treturn this;\n\n\t}\n\n\tgetWorldDirection( target ) {\n\n\t\treturn super.getWorldDirection( target ).negate();\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\n\n\t}\n\n\tupdateWorldMatrix( updateParents, updateChildren ) {\n\n\t\tsuper.updateWorldMatrix( updateParents, updateChildren );\n\n\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nclass PerspectiveCamera extends Camera {\n\n\tconstructor( fov = 50, aspect = 1, near = 0.1, far = 2000 ) {\n\n\t\tsuper();\n\n\t\tthis.isPerspectiveCamera = true;\n\n\t\tthis.type = 'PerspectiveCamera';\n\n\t\tthis.fov = fov;\n\t\tthis.zoom = 1;\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\t\tthis.focus = 10;\n\n\t\tthis.aspect = aspect;\n\t\tthis.view = null;\n\n\t\tthis.filmGauge = 35;\t// width of the film (default in millimeters)\n\t\tthis.filmOffset = 0;\t// horizontal film offset (same unit as gauge)\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.fov = source.fov;\n\t\tthis.zoom = source.zoom;\n\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\t\tthis.focus = source.focus;\n\n\t\tthis.aspect = source.aspect;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\tthis.filmGauge = source.filmGauge;\n\t\tthis.filmOffset = source.filmOffset;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the FOV by focal length in respect to the current .filmGauge.\n\t *\n\t * The default film gauge is 35, so that the focal length can be specified for\n\t * a 35mm (full frame) camera.\n\t *\n\t * Values for focal length and film gauge must have the same unit.\n\t */\n\tsetFocalLength( focalLength ) {\n\n\t\t/** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */\n\t\tconst vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;\n\n\t\tthis.fov = RAD2DEG * 2 * Math.atan( vExtentSlope );\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\t/**\n\t * Calculates the focal length from the current .fov and .filmGauge.\n\t */\n\tgetFocalLength() {\n\n\t\tconst vExtentSlope = Math.tan( DEG2RAD * 0.5 * this.fov );\n\n\t\treturn 0.5 * this.getFilmHeight() / vExtentSlope;\n\n\t}\n\n\tgetEffectiveFOV() {\n\n\t\treturn RAD2DEG * 2 * Math.atan(\n\t\t\tMath.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom );\n\n\t}\n\n\tgetFilmWidth() {\n\n\t\t// film not completely covered in portrait format (aspect < 1)\n\t\treturn this.filmGauge * Math.min( this.aspect, 1 );\n\n\t}\n\n\tgetFilmHeight() {\n\n\t\t// film not completely covered in landscape format (aspect > 1)\n\t\treturn this.filmGauge / Math.max( this.aspect, 1 );\n\n\t}\n\n\t/**\n\t * Sets an offset in a larger frustum. This is useful for multi-window or\n\t * multi-monitor/multi-machine setups.\n\t *\n\t * For example, if you have 3x2 monitors and each monitor is 1920x1080 and\n\t * the monitors are in grid like this\n\t *\n\t * +---+---+---+\n\t * | A | B | C |\n\t * +---+---+---+\n\t * | D | E | F |\n\t * +---+---+---+\n\t *\n\t * then for each monitor you would call it like this\n\t *\n\t * const w = 1920;\n\t * const h = 1080;\n\t * const fullWidth = w * 3;\n\t * const fullHeight = h * 2;\n\t *\n\t * --A--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );\n\t * --B--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );\n\t * --C--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );\n\t * --D--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );\n\t * --E--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );\n\t * --F--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );\n\t *\n\t * Note there is no reason monitors have to be the same size or in a grid.\n\t */\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tthis.aspect = fullWidth / fullHeight;\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tclearViewOffset() {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tupdateProjectionMatrix() {\n\n\t\tconst near = this.near;\n\t\tlet top = near * Math.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom;\n\t\tlet height = 2 * top;\n\t\tlet width = this.aspect * height;\n\t\tlet left = - 0.5 * width;\n\t\tconst view = this.view;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tconst fullWidth = view.fullWidth,\n\t\t\t\tfullHeight = view.fullHeight;\n\n\t\t\tleft += view.offsetX * width / fullWidth;\n\t\t\ttop -= view.offsetY * height / fullHeight;\n\t\t\twidth *= view.width / fullWidth;\n\t\t\theight *= view.height / fullHeight;\n\n\t\t}\n\n\t\tconst skew = this.filmOffset;\n\t\tif ( skew !== 0 ) left += near * skew / this.getFilmWidth();\n\n\t\tthis.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far, this.coordinateSystem );\n\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.fov = this.fov;\n\t\tdata.object.zoom = this.zoom;\n\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\t\tdata.object.focus = this.focus;\n\n\t\tdata.object.aspect = this.aspect;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\tdata.object.filmGauge = this.filmGauge;\n\t\tdata.object.filmOffset = this.filmOffset;\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst fov = - 90; // negative fov is not an error\nconst aspect = 1;\n\nclass CubeCamera extends Object3D {\n\n\tconstructor( near, far, renderTarget ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CubeCamera';\n\n\t\tthis.renderTarget = renderTarget;\n\t\tthis.coordinateSystem = null;\n\t\tthis.activeMipmapLevel = 0;\n\n\t\tconst cameraPX = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPX.layers = this.layers;\n\t\tthis.add( cameraPX );\n\n\t\tconst cameraNX = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNX.layers = this.layers;\n\t\tthis.add( cameraNX );\n\n\t\tconst cameraPY = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPY.layers = this.layers;\n\t\tthis.add( cameraPY );\n\n\t\tconst cameraNY = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNY.layers = this.layers;\n\t\tthis.add( cameraNY );\n\n\t\tconst cameraPZ = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPZ.layers = this.layers;\n\t\tthis.add( cameraPZ );\n\n\t\tconst cameraNZ = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNZ.layers = this.layers;\n\t\tthis.add( cameraNZ );\n\n\t}\n\n\tupdateCoordinateSystem() {\n\n\t\tconst coordinateSystem = this.coordinateSystem;\n\n\t\tconst cameras = this.children.concat();\n\n\t\tconst [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = cameras;\n\n\t\tfor ( const camera of cameras ) this.remove( camera );\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tcameraPX.up.set( 0, 1, 0 );\n\t\t\tcameraPX.lookAt( 1, 0, 0 );\n\n\t\t\tcameraNX.up.set( 0, 1, 0 );\n\t\t\tcameraNX.lookAt( - 1, 0, 0 );\n\n\t\t\tcameraPY.up.set( 0, 0, - 1 );\n\t\t\tcameraPY.lookAt( 0, 1, 0 );\n\n\t\t\tcameraNY.up.set( 0, 0, 1 );\n\t\t\tcameraNY.lookAt( 0, - 1, 0 );\n\n\t\t\tcameraPZ.up.set( 0, 1, 0 );\n\t\t\tcameraPZ.lookAt( 0, 0, 1 );\n\n\t\t\tcameraNZ.up.set( 0, 1, 0 );\n\t\t\tcameraNZ.lookAt( 0, 0, - 1 );\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tcameraPX.up.set( 0, - 1, 0 );\n\t\t\tcameraPX.lookAt( - 1, 0, 0 );\n\n\t\t\tcameraNX.up.set( 0, - 1, 0 );\n\t\t\tcameraNX.lookAt( 1, 0, 0 );\n\n\t\t\tcameraPY.up.set( 0, 0, 1 );\n\t\t\tcameraPY.lookAt( 0, 1, 0 );\n\n\t\t\tcameraNY.up.set( 0, 0, - 1 );\n\t\t\tcameraNY.lookAt( 0, - 1, 0 );\n\n\t\t\tcameraPZ.up.set( 0, - 1, 0 );\n\t\t\tcameraPZ.lookAt( 0, 0, 1 );\n\n\t\t\tcameraNZ.up.set( 0, - 1, 0 );\n\t\t\tcameraNZ.lookAt( 0, 0, - 1 );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tfor ( const camera of cameras ) {\n\n\t\t\tthis.add( camera );\n\n\t\t\tcamera.updateMatrixWorld();\n\n\t\t}\n\n\t}\n\n\tupdate( renderer, scene ) {\n\n\t\tif ( this.parent === null ) this.updateMatrixWorld();\n\n\t\tconst { renderTarget, activeMipmapLevel } = this;\n\n\t\tif ( this.coordinateSystem !== renderer.coordinateSystem ) {\n\n\t\t\tthis.coordinateSystem = renderer.coordinateSystem;\n\n\t\t\tthis.updateCoordinateSystem();\n\n\t\t}\n\n\t\tconst [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = this.children;\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\t\tconst currentActiveCubeFace = renderer.getActiveCubeFace();\n\t\tconst currentActiveMipmapLevel = renderer.getActiveMipmapLevel();\n\n\t\tconst currentXrEnabled = renderer.xr.enabled;\n\n\t\trenderer.xr.enabled = false;\n\n\t\tconst generateMipmaps = renderTarget.texture.generateMipmaps;\n\n\t\trenderTarget.texture.generateMipmaps = false;\n\n\t\trenderer.setRenderTarget( renderTarget, 0, activeMipmapLevel );\n\t\trenderer.render( scene, cameraPX );\n\n\t\trenderer.setRenderTarget( renderTarget, 1, activeMipmapLevel );\n\t\trenderer.render( scene, cameraNX );\n\n\t\trenderer.setRenderTarget( renderTarget, 2, activeMipmapLevel );\n\t\trenderer.render( scene, cameraPY );\n\n\t\trenderer.setRenderTarget( renderTarget, 3, activeMipmapLevel );\n\t\trenderer.render( scene, cameraNY );\n\n\t\trenderer.setRenderTarget( renderTarget, 4, activeMipmapLevel );\n\t\trenderer.render( scene, cameraPZ );\n\n\t\t// mipmaps are generated during the last call of render()\n\t\t// at this point, all sides of the cube render target are defined\n\n\t\trenderTarget.texture.generateMipmaps = generateMipmaps;\n\n\t\trenderer.setRenderTarget( renderTarget, 5, activeMipmapLevel );\n\t\trenderer.render( scene, cameraNZ );\n\n\t\trenderer.setRenderTarget( currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel );\n\n\t\trenderer.xr.enabled = currentXrEnabled;\n\n\t\trenderTarget.texture.needsPMREMUpdate = true;\n\n\t}\n\n}\n\nclass CubeTexture extends Texture {\n\n\tconstructor( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace ) {\n\n\t\timages = images !== undefined ? images : [];\n\t\tmapping = mapping !== undefined ? mapping : CubeReflectionMapping;\n\n\t\tsuper( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\tthis.isCubeTexture = true;\n\n\t\tthis.flipY = false;\n\n\t}\n\n\tget images() {\n\n\t\treturn this.image;\n\n\t}\n\n\tset images( value ) {\n\n\t\tthis.image = value;\n\n\t}\n\n}\n\nclass WebGLCubeRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( size = 1, options = {} ) {\n\n\t\tsuper( size, size, options );\n\n\t\tthis.isWebGLCubeRenderTarget = true;\n\n\t\tconst image = { width: size, height: size, depth: 1 };\n\t\tconst images = [ image, image, image, image, image, image ];\n\n\t\tif ( options.encoding !== undefined ) {\n\n\t\t\t// @deprecated, r152\n\t\t\twarnOnce( 'THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace.' );\n\t\t\toptions.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;\n\n\t\t}\n\n\t\tthis.texture = new CubeTexture( images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );\n\n\t\t// By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)\n\t\t// in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,\n\t\t// in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly.\n\n\t\t// three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped\n\t\t// and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture\n\t\t// as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures).\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t\tthis.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;\n\t\tthis.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;\n\n\t}\n\n\tfromEquirectangularTexture( renderer, texture ) {\n\n\t\tthis.texture.type = texture.type;\n\t\tthis.texture.colorSpace = texture.colorSpace;\n\n\t\tthis.texture.generateMipmaps = texture.generateMipmaps;\n\t\tthis.texture.minFilter = texture.minFilter;\n\t\tthis.texture.magFilter = texture.magFilter;\n\n\t\tconst shader = {\n\n\t\t\tuniforms: {\n\t\t\t\ttEquirect: { value: null },\n\t\t\t},\n\n\t\t\tvertexShader: /* glsl */`\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t`,\n\n\t\t\tfragmentShader: /* glsl */`\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t`\n\t\t};\n\n\t\tconst geometry = new BoxGeometry( 5, 5, 5 );\n\n\t\tconst material = new ShaderMaterial( {\n\n\t\t\tname: 'CubemapFromEquirect',\n\n\t\t\tuniforms: cloneUniforms( shader.uniforms ),\n\t\t\tvertexShader: shader.vertexShader,\n\t\t\tfragmentShader: shader.fragmentShader,\n\t\t\tside: BackSide,\n\t\t\tblending: NoBlending\n\n\t\t} );\n\n\t\tmaterial.uniforms.tEquirect.value = texture;\n\n\t\tconst mesh = new Mesh( geometry, material );\n\n\t\tconst currentMinFilter = texture.minFilter;\n\n\t\t// Avoid blurred poles\n\t\tif ( texture.minFilter === LinearMipmapLinearFilter ) texture.minFilter = LinearFilter;\n\n\t\tconst camera = new CubeCamera( 1, 10, this );\n\t\tcamera.update( renderer, mesh );\n\n\t\ttexture.minFilter = currentMinFilter;\n\n\t\tmesh.geometry.dispose();\n\t\tmesh.material.dispose();\n\n\t\treturn this;\n\n\t}\n\n\tclear( renderer, color, depth, stencil ) {\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\trenderer.setRenderTarget( this, i );\n\n\t\t\trenderer.clear( color, depth, stencil );\n\n\t\t}\n\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\n\t}\n\n}\n\nconst _vector1 = /*@__PURE__*/ new Vector3();\nconst _vector2 = /*@__PURE__*/ new Vector3();\nconst _normalMatrix = /*@__PURE__*/ new Matrix3();\n\nclass Plane {\n\n\tconstructor( normal = new Vector3( 1, 0, 0 ), constant = 0 ) {\n\n\t\tthis.isPlane = true;\n\n\t\t// normal is assumed to be normalized\n\n\t\tthis.normal = normal;\n\t\tthis.constant = constant;\n\n\t}\n\n\tset( normal, constant ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = constant;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponents( x, y, z, w ) {\n\n\t\tthis.normal.set( x, y, z );\n\t\tthis.constant = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromNormalAndCoplanarPoint( normal, point ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = - point.dot( this.normal );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCoplanarPoints( a, b, c ) {\n\n\t\tconst normal = _vector1.subVectors( c, b ).cross( _vector2.subVectors( a, b ) ).normalize();\n\n\t\t// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?\n\n\t\tthis.setFromNormalAndCoplanarPoint( normal, a );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( plane ) {\n\n\t\tthis.normal.copy( plane.normal );\n\t\tthis.constant = plane.constant;\n\n\t\treturn this;\n\n\t}\n\n\tnormalize() {\n\n\t\t// Note: will lead to a divide by zero if the plane is invalid.\n\n\t\tconst inverseNormalLength = 1.0 / this.normal.length();\n\t\tthis.normal.multiplyScalar( inverseNormalLength );\n\t\tthis.constant *= inverseNormalLength;\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.constant *= - 1;\n\t\tthis.normal.negate();\n\n\t\treturn this;\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.normal.dot( point ) + this.constant;\n\n\t}\n\n\tdistanceToSphere( sphere ) {\n\n\t\treturn this.distanceToPoint( sphere.center ) - sphere.radius;\n\n\t}\n\n\tprojectPoint( point, target ) {\n\n\t\treturn target.copy( point ).addScaledVector( this.normal, - this.distanceToPoint( point ) );\n\n\t}\n\n\tintersectLine( line, target ) {\n\n\t\tconst direction = line.delta( _vector1 );\n\n\t\tconst denominator = this.normal.dot( direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( this.distanceToPoint( line.start ) === 0 ) {\n\n\t\t\t\treturn target.copy( line.start );\n\n\t\t\t}\n\n\t\t\t// Unsure if this is the correct method to handle this case.\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;\n\n\t\tif ( t < 0 || t > 1 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn target.copy( line.start ).addScaledVector( direction, t );\n\n\t}\n\n\tintersectsLine( line ) {\n\n\t\t// Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.\n\n\t\tconst startSign = this.distanceToPoint( line.start );\n\t\tconst endSign = this.distanceToPoint( line.end );\n\n\t\treturn ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsPlane( this );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn sphere.intersectsPlane( this );\n\n\t}\n\n\tcoplanarPoint( target ) {\n\n\t\treturn target.copy( this.normal ).multiplyScalar( - this.constant );\n\n\t}\n\n\tapplyMatrix4( matrix, optionalNormalMatrix ) {\n\n\t\tconst normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix( matrix );\n\n\t\tconst referencePoint = this.coplanarPoint( _vector1 ).applyMatrix4( matrix );\n\n\t\tconst normal = this.normal.applyMatrix3( normalMatrix ).normalize();\n\n\t\tthis.constant = - referencePoint.dot( normal );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.constant -= offset.dot( this.normal );\n\n\t\treturn this;\n\n\t}\n\n\tequals( plane ) {\n\n\t\treturn plane.normal.equals( this.normal ) && ( plane.constant === this.constant );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _sphere$4 = /*@__PURE__*/ new Sphere();\nconst _vector$6 = /*@__PURE__*/ new Vector3();\n\nclass Frustum {\n\n\tconstructor( p0 = new Plane(), p1 = new Plane(), p2 = new Plane(), p3 = new Plane(), p4 = new Plane(), p5 = new Plane() ) {\n\n\t\tthis.planes = [ p0, p1, p2, p3, p4, p5 ];\n\n\t}\n\n\tset( p0, p1, p2, p3, p4, p5 ) {\n\n\t\tconst planes = this.planes;\n\n\t\tplanes[ 0 ].copy( p0 );\n\t\tplanes[ 1 ].copy( p1 );\n\t\tplanes[ 2 ].copy( p2 );\n\t\tplanes[ 3 ].copy( p3 );\n\t\tplanes[ 4 ].copy( p4 );\n\t\tplanes[ 5 ].copy( p5 );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( frustum ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tplanes[ i ].copy( frustum.planes[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromProjectionMatrix( m, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst planes = this.planes;\n\t\tconst me = m.elements;\n\t\tconst me0 = me[ 0 ], me1 = me[ 1 ], me2 = me[ 2 ], me3 = me[ 3 ];\n\t\tconst me4 = me[ 4 ], me5 = me[ 5 ], me6 = me[ 6 ], me7 = me[ 7 ];\n\t\tconst me8 = me[ 8 ], me9 = me[ 9 ], me10 = me[ 10 ], me11 = me[ 11 ];\n\t\tconst me12 = me[ 12 ], me13 = me[ 13 ], me14 = me[ 14 ], me15 = me[ 15 ];\n\n\t\tplanes[ 0 ].setComponents( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ).normalize();\n\t\tplanes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize();\n\t\tplanes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize();\n\t\tplanes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize();\n\t\tplanes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize();\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tplanes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize();\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tplanes[ 5 ].setComponents( me2, me6, me10, me14 ).normalize();\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tintersectsObject( object ) {\n\n\t\tif ( object.boundingSphere !== undefined ) {\n\n\t\t\tif ( object.boundingSphere === null ) object.computeBoundingSphere();\n\n\t\t\t_sphere$4.copy( object.boundingSphere ).applyMatrix4( object.matrixWorld );\n\n\t\t} else {\n\n\t\t\tconst geometry = object.geometry;\n\n\t\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t\t_sphere$4.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );\n\n\t\t}\n\n\t\treturn this.intersectsSphere( _sphere$4 );\n\n\t}\n\n\tintersectsSprite( sprite ) {\n\n\t\t_sphere$4.center.set( 0, 0, 0 );\n\t\t_sphere$4.radius = 0.7071067811865476;\n\t\t_sphere$4.applyMatrix4( sprite.matrixWorld );\n\n\t\treturn this.intersectsSphere( _sphere$4 );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\tconst planes = this.planes;\n\t\tconst center = sphere.center;\n\t\tconst negRadius = - sphere.radius;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst distance = planes[ i ].distanceToPoint( center );\n\n\t\t\tif ( distance < negRadius ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst plane = planes[ i ];\n\n\t\t\t// corner at max distance\n\n\t\t\t_vector$6.x = plane.normal.x > 0 ? box.max.x : box.min.x;\n\t\t\t_vector$6.y = plane.normal.y > 0 ? box.max.y : box.min.y;\n\t\t\t_vector$6.z = plane.normal.z > 0 ? box.max.z : box.min.z;\n\n\t\t\tif ( plane.distanceToPoint( _vector$6 ) < 0 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tif ( planes[ i ].distanceToPoint( point ) < 0 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nfunction WebGLAnimation() {\n\n\tlet context = null;\n\tlet isAnimating = false;\n\tlet animationLoop = null;\n\tlet requestId = null;\n\n\tfunction onAnimationFrame( time, frame ) {\n\n\t\tanimationLoop( time, frame );\n\n\t\trequestId = context.requestAnimationFrame( onAnimationFrame );\n\n\t}\n\n\treturn {\n\n\t\tstart: function () {\n\n\t\t\tif ( isAnimating === true ) return;\n\t\t\tif ( animationLoop === null ) return;\n\n\t\t\trequestId = context.requestAnimationFrame( onAnimationFrame );\n\n\t\t\tisAnimating = true;\n\n\t\t},\n\n\t\tstop: function () {\n\n\t\t\tcontext.cancelAnimationFrame( requestId );\n\n\t\t\tisAnimating = false;\n\n\t\t},\n\n\t\tsetAnimationLoop: function ( callback ) {\n\n\t\t\tanimationLoop = callback;\n\n\t\t},\n\n\t\tsetContext: function ( value ) {\n\n\t\t\tcontext = value;\n\n\t\t}\n\n\t};\n\n}\n\nfunction WebGLAttributes( gl, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tconst buffers = new WeakMap();\n\n\tfunction createBuffer( attribute, bufferType ) {\n\n\t\tconst array = attribute.array;\n\t\tconst usage = attribute.usage;\n\n\t\tconst buffer = gl.createBuffer();\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\t\tgl.bufferData( bufferType, array, usage );\n\n\t\tattribute.onUploadCallback();\n\n\t\tlet type;\n\n\t\tif ( array instanceof Float32Array ) {\n\n\t\t\ttype = gl.FLOAT;\n\n\t\t} else if ( array instanceof Uint16Array ) {\n\n\t\t\tif ( attribute.isFloat16BufferAttribute ) {\n\n\t\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t\ttype = gl.HALF_FLOAT;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new Error( 'THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.' );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\ttype = gl.UNSIGNED_SHORT;\n\n\t\t\t}\n\n\t\t} else if ( array instanceof Int16Array ) {\n\n\t\t\ttype = gl.SHORT;\n\n\t\t} else if ( array instanceof Uint32Array ) {\n\n\t\t\ttype = gl.UNSIGNED_INT;\n\n\t\t} else if ( array instanceof Int32Array ) {\n\n\t\t\ttype = gl.INT;\n\n\t\t} else if ( array instanceof Int8Array ) {\n\n\t\t\ttype = gl.BYTE;\n\n\t\t} else if ( array instanceof Uint8Array ) {\n\n\t\t\ttype = gl.UNSIGNED_BYTE;\n\n\t\t} else if ( array instanceof Uint8ClampedArray ) {\n\n\t\t\ttype = gl.UNSIGNED_BYTE;\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.WebGLAttributes: Unsupported buffer data format: ' + array );\n\n\t\t}\n\n\t\treturn {\n\t\t\tbuffer: buffer,\n\t\t\ttype: type,\n\t\t\tbytesPerElement: array.BYTES_PER_ELEMENT,\n\t\t\tversion: attribute.version\n\t\t};\n\n\t}\n\n\tfunction updateBuffer( buffer, attribute, bufferType ) {\n\n\t\tconst array = attribute.array;\n\t\tconst updateRange = attribute.updateRange;\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\n\t\tif ( updateRange.count === - 1 ) {\n\n\t\t\t// Not using update ranges\n\n\t\t\tgl.bufferSubData( bufferType, 0, array );\n\n\t\t} else {\n\n\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\tgl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,\n\t\t\t\t\tarray, updateRange.offset, updateRange.count );\n\n\t\t\t} else {\n\n\t\t\t\tgl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,\n\t\t\t\t\tarray.subarray( updateRange.offset, updateRange.offset + updateRange.count ) );\n\n\t\t\t}\n\n\t\t\tupdateRange.count = - 1; // reset range\n\n\t\t}\n\n\t\tattribute.onUploadCallback();\n\n\t}\n\n\t//\n\n\tfunction get( attribute ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\treturn buffers.get( attribute );\n\n\t}\n\n\tfunction remove( attribute ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\tconst data = buffers.get( attribute );\n\n\t\tif ( data ) {\n\n\t\t\tgl.deleteBuffer( data.buffer );\n\n\t\t\tbuffers.delete( attribute );\n\n\t\t}\n\n\t}\n\n\tfunction update( attribute, bufferType ) {\n\n\t\tif ( attribute.isGLBufferAttribute ) {\n\n\t\t\tconst cached = buffers.get( attribute );\n\n\t\t\tif ( ! cached || cached.version < attribute.version ) {\n\n\t\t\t\tbuffers.set( attribute, {\n\t\t\t\t\tbuffer: attribute.buffer,\n\t\t\t\t\ttype: attribute.type,\n\t\t\t\t\tbytesPerElement: attribute.elementSize,\n\t\t\t\t\tversion: attribute.version\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\tconst data = buffers.get( attribute );\n\n\t\tif ( data === undefined ) {\n\n\t\t\tbuffers.set( attribute, createBuffer( attribute, bufferType ) );\n\n\t\t} else if ( data.version < attribute.version ) {\n\n\t\t\tupdateBuffer( data.buffer, attribute, bufferType );\n\n\t\t\tdata.version = attribute.version;\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\tget: get,\n\t\tremove: remove,\n\t\tupdate: update\n\n\t};\n\n}\n\nclass PlaneGeometry extends BufferGeometry {\n\n\tconstructor( width = 1, height = 1, widthSegments = 1, heightSegments = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'PlaneGeometry';\n\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments\n\t\t};\n\n\t\tconst width_half = width / 2;\n\t\tconst height_half = height / 2;\n\n\t\tconst gridX = Math.floor( widthSegments );\n\t\tconst gridY = Math.floor( heightSegments );\n\n\t\tconst gridX1 = gridX + 1;\n\t\tconst gridY1 = gridY + 1;\n\n\t\tconst segment_width = width / gridX;\n\t\tconst segment_height = height / gridY;\n\n\t\t//\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\n\n\t\t\tconst y = iy * segment_height - height_half;\n\n\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\t\tconst x = ix * segment_width - width_half;\n\n\t\t\t\tvertices.push( x, - y, 0 );\n\n\t\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t\tuvs.push( ix / gridX );\n\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\n\n\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\t\tconst a = ix + gridX1 * iy;\n\t\t\t\tconst b = ix + gridX1 * ( iy + 1 );\n\t\t\t\tconst c = ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\t\tconst d = ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new PlaneGeometry( data.width, data.height, data.widthSegments, data.heightSegments );\n\n\t}\n\n}\n\nvar alphahash_fragment = \"#ifdef USE_ALPHAHASH\\n\\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\\n#endif\";\n\nvar alphahash_pars_fragment = \"#ifdef USE_ALPHAHASH\\n\\tconst float ALPHA_HASH_SCALE = 0.05;\\n\\tfloat hash2D( vec2 value ) {\\n\\t\\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\\n\\t}\\n\\tfloat hash3D( vec3 value ) {\\n\\t\\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\\n\\t}\\n\\tfloat getAlphaHashThreshold( vec3 position ) {\\n\\t\\tfloat maxDeriv = max(\\n\\t\\t\\tlength( dFdx( position.xyz ) ),\\n\\t\\t\\tlength( dFdy( position.xyz ) )\\n\\t\\t);\\n\\t\\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\\n\\t\\tvec2 pixScales = vec2(\\n\\t\\t\\texp2( floor( log2( pixScale ) ) ),\\n\\t\\t\\texp2( ceil( log2( pixScale ) ) )\\n\\t\\t);\\n\\t\\tvec2 alpha = vec2(\\n\\t\\t\\thash3D( floor( pixScales.x * position.xyz ) ),\\n\\t\\t\\thash3D( floor( pixScales.y * position.xyz ) )\\n\\t\\t);\\n\\t\\tfloat lerpFactor = fract( log2( pixScale ) );\\n\\t\\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\\n\\t\\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\\n\\t\\tvec3 cases = vec3(\\n\\t\\t\\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\\n\\t\\t\\t( x - 0.5 * a ) / ( 1.0 - a ),\\n\\t\\t\\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\\n\\t\\t);\\n\\t\\tfloat threshold = ( x < ( 1.0 - a ) )\\n\\t\\t\\t? ( ( x < a ) ? cases.x : cases.y )\\n\\t\\t\\t: cases.z;\\n\\t\\treturn clamp( threshold , 1.0e-6, 1.0 );\\n\\t}\\n#endif\";\n\nvar alphamap_fragment = \"#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\\n#endif\";\n\nvar alphamap_pars_fragment = \"#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\n\nvar alphatest_fragment = \"#ifdef USE_ALPHATEST\\n\\tif ( diffuseColor.a < alphaTest ) discard;\\n#endif\";\n\nvar alphatest_pars_fragment = \"#ifdef USE_ALPHATEST\\n\\tuniform float alphaTest;\\n#endif\";\n\nvar aomap_fragment = \"#ifdef USE_AOMAP\\n\\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\\n\\treflectedLight.indirectDiffuse *= ambientOcclusion;\\n\\t#if defined( USE_CLEARCOAT ) \\n\\t\\tclearcoatSpecularIndirect *= ambientOcclusion;\\n\\t#endif\\n\\t#if defined( USE_SHEEN ) \\n\\t\\tsheenSpecularIndirect *= ambientOcclusion;\\n\\t#endif\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD )\\n\\t\\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\\n\\t\\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\\n\\t#endif\\n#endif\";\n\nvar aomap_pars_fragment = \"#ifdef USE_AOMAP\\n\\tuniform sampler2D aoMap;\\n\\tuniform float aoMapIntensity;\\n#endif\";\n\nvar begin_vertex = \"vec3 transformed = vec3( position );\\n#ifdef USE_ALPHAHASH\\n\\tvPosition = vec3( position );\\n#endif\";\n\nvar beginnormal_vertex = \"vec3 objectNormal = vec3( normal );\\n#ifdef USE_TANGENT\\n\\tvec3 objectTangent = vec3( tangent.xyz );\\n#endif\";\n\nvar bsdfs = \"float G_BlinnPhong_Implicit( ) {\\n\\treturn 0.25;\\n}\\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\\n\\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\\n}\\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\\n\\tfloat G = G_BlinnPhong_Implicit( );\\n\\tfloat D = D_BlinnPhong( shininess, dotNH );\\n\\treturn F * ( G * D );\\n} // validated\";\n\nvar iridescence_fragment = \"#ifdef USE_IRIDESCENCE\\n\\tconst mat3 XYZ_TO_REC709 = mat3(\\n\\t\\t 3.2404542, -0.9692660, 0.0556434,\\n\\t\\t-1.5371385, 1.8760108, -0.2040259,\\n\\t\\t-0.4985314, 0.0415560, 1.0572252\\n\\t);\\n\\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\\n\\t\\tvec3 sqrtF0 = sqrt( fresnel0 );\\n\\t\\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\\n\\t}\\n\\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\\n\\t\\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\\n\\t}\\n\\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\\n\\t\\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\\n\\t}\\n\\tvec3 evalSensitivity( float OPD, vec3 shift ) {\\n\\t\\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\\n\\t\\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\\n\\t\\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\\n\\t\\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\\n\\t\\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\\n\\t\\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\\n\\t\\txyz /= 1.0685e-7;\\n\\t\\tvec3 rgb = XYZ_TO_REC709 * xyz;\\n\\t\\treturn rgb;\\n\\t}\\n\\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\\n\\t\\tvec3 I;\\n\\t\\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\\n\\t\\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\\n\\t\\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\\n\\t\\tif ( cosTheta2Sq < 0.0 ) {\\n\\t\\t\\treturn vec3( 1.0 );\\n\\t\\t}\\n\\t\\tfloat cosTheta2 = sqrt( cosTheta2Sq );\\n\\t\\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\\n\\t\\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\\n\\t\\tfloat T121 = 1.0 - R12;\\n\\t\\tfloat phi12 = 0.0;\\n\\t\\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\\n\\t\\tfloat phi21 = PI - phi12;\\n\\t\\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\\t\\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\\n\\t\\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\\n\\t\\tvec3 phi23 = vec3( 0.0 );\\n\\t\\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\\n\\t\\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\\n\\t\\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\\n\\t\\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\\n\\t\\tvec3 phi = vec3( phi21 ) + phi23;\\n\\t\\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\\n\\t\\tvec3 r123 = sqrt( R123 );\\n\\t\\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\\n\\t\\tvec3 C0 = R12 + Rs;\\n\\t\\tI = C0;\\n\\t\\tvec3 Cm = Rs - T121;\\n\\t\\tfor ( int m = 1; m <= 2; ++ m ) {\\n\\t\\t\\tCm *= r123;\\n\\t\\t\\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\\n\\t\\t\\tI += Cm * Sm;\\n\\t\\t}\\n\\t\\treturn max( I, vec3( 0.0 ) );\\n\\t}\\n#endif\";\n\nvar bumpmap_pars_fragment = \"#ifdef USE_BUMPMAP\\n\\tuniform sampler2D bumpMap;\\n\\tuniform float bumpScale;\\n\\tvec2 dHdxy_fwd() {\\n\\t\\tvec2 dSTdx = dFdx( vBumpMapUv );\\n\\t\\tvec2 dSTdy = dFdy( vBumpMapUv );\\n\\t\\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\\n\\t\\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\\n\\t\\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\\n\\t\\treturn vec2( dBx, dBy );\\n\\t}\\n\\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\\n\\t\\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\\n\\t\\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\\n\\t\\tvec3 vN = surf_norm;\\n\\t\\tvec3 R1 = cross( vSigmaY, vN );\\n\\t\\tvec3 R2 = cross( vN, vSigmaX );\\n\\t\\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\\n\\t\\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\\n\\t\\treturn normalize( abs( fDet ) * surf_norm - vGrad );\\n\\t}\\n#endif\";\n\nvar clipping_planes_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvec4 plane;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\\n\\t\\tplane = clippingPlanes[ i ];\\n\\t\\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\\n\\t\\tbool clipped = true;\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t\\tif ( clipped ) discard;\\n\\t#endif\\n#endif\";\n\nvar clipping_planes_pars_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n\\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\\n#endif\";\n\nvar clipping_planes_pars_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n#endif\";\n\nvar clipping_planes_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvClipPosition = - mvPosition.xyz;\\n#endif\";\n\nvar color_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\\tdiffuseColor *= vColor;\\n#elif defined( USE_COLOR )\\n\\tdiffuseColor.rgb *= vColor;\\n#endif\";\n\nvar color_pars_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\\tvarying vec4 vColor;\\n#elif defined( USE_COLOR )\\n\\tvarying vec3 vColor;\\n#endif\";\n\nvar color_pars_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\\tvarying vec4 vColor;\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\\n\\tvarying vec3 vColor;\\n#endif\";\n\nvar color_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\\tvColor = vec4( 1.0 );\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\\n\\tvColor = vec3( 1.0 );\\n#endif\\n#ifdef USE_COLOR\\n\\tvColor *= color;\\n#endif\\n#ifdef USE_INSTANCING_COLOR\\n\\tvColor.xyz *= instanceColor.xyz;\\n#endif\";\n\nvar common = \"#define PI 3.141592653589793\\n#define PI2 6.283185307179586\\n#define PI_HALF 1.5707963267948966\\n#define RECIPROCAL_PI 0.3183098861837907\\n#define RECIPROCAL_PI2 0.15915494309189535\\n#define EPSILON 1e-6\\n#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\\nfloat pow2( const in float x ) { return x*x; }\\nvec3 pow2( const in vec3 x ) { return x*x; }\\nfloat pow3( const in float x ) { return x*x*x; }\\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\\nhighp float rand( const in vec2 uv ) {\\n\\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\\n\\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\\n\\treturn fract( sin( sn ) * c );\\n}\\n#ifdef HIGH_PRECISION\\n\\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\\n#else\\n\\tfloat precisionSafeLength( vec3 v ) {\\n\\t\\tfloat maxComponent = max3( abs( v ) );\\n\\t\\treturn length( v / maxComponent ) * maxComponent;\\n\\t}\\n#endif\\nstruct IncidentLight {\\n\\tvec3 color;\\n\\tvec3 direction;\\n\\tbool visible;\\n};\\nstruct ReflectedLight {\\n\\tvec3 directDiffuse;\\n\\tvec3 directSpecular;\\n\\tvec3 indirectDiffuse;\\n\\tvec3 indirectSpecular;\\n};\\n#ifdef USE_ALPHAHASH\\n\\tvarying vec3 vPosition;\\n#endif\\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\\n\\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\\n}\\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\\n\\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\\n}\\nmat3 transposeMat3( const in mat3 m ) {\\n\\tmat3 tmp;\\n\\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\\n\\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\\n\\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\\n\\treturn tmp;\\n}\\nfloat luminance( const in vec3 rgb ) {\\n\\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\\n\\treturn dot( weights, rgb );\\n}\\nbool isPerspectiveMatrix( mat4 m ) {\\n\\treturn m[ 2 ][ 3 ] == - 1.0;\\n}\\nvec2 equirectUv( in vec3 dir ) {\\n\\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\\n\\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\\n\\treturn vec2( u, v );\\n}\\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\\n\\treturn RECIPROCAL_PI * diffuseColor;\\n}\\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\\n\\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n}\\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\\n\\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n} // validated\";\n\nvar cube_uv_reflection_fragment = \"#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t#define cubeUV_minMipLevel 4.0\\n\\t#define cubeUV_minTileSize 16.0\\n\\tfloat getFace( vec3 direction ) {\\n\\t\\tvec3 absDirection = abs( direction );\\n\\t\\tfloat face = - 1.0;\\n\\t\\tif ( absDirection.x > absDirection.z ) {\\n\\t\\t\\tif ( absDirection.x > absDirection.y )\\n\\t\\t\\t\\tface = direction.x > 0.0 ? 0.0 : 3.0;\\n\\t\\t\\telse\\n\\t\\t\\t\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\\t\\t} else {\\n\\t\\t\\tif ( absDirection.z > absDirection.y )\\n\\t\\t\\t\\tface = direction.z > 0.0 ? 2.0 : 5.0;\\n\\t\\t\\telse\\n\\t\\t\\t\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\\t\\t}\\n\\t\\treturn face;\\n\\t}\\n\\tvec2 getUV( vec3 direction, float face ) {\\n\\t\\tvec2 uv;\\n\\t\\tif ( face == 0.0 ) {\\n\\t\\t\\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\\n\\t\\t} else if ( face == 1.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\\n\\t\\t} else if ( face == 2.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\\n\\t\\t} else if ( face == 3.0 ) {\\n\\t\\t\\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\\n\\t\\t} else if ( face == 4.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\\n\\t\\t} else {\\n\\t\\t\\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\\n\\t\\t}\\n\\t\\treturn 0.5 * ( uv + 1.0 );\\n\\t}\\n\\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\\n\\t\\tfloat face = getFace( direction );\\n\\t\\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\\n\\t\\tmipInt = max( mipInt, cubeUV_minMipLevel );\\n\\t\\tfloat faceSize = exp2( mipInt );\\n\\t\\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\\n\\t\\tif ( face > 2.0 ) {\\n\\t\\t\\tuv.y += faceSize;\\n\\t\\t\\tface -= 3.0;\\n\\t\\t}\\n\\t\\tuv.x += face * faceSize;\\n\\t\\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\\n\\t\\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\\n\\t\\tuv.x *= CUBEUV_TEXEL_WIDTH;\\n\\t\\tuv.y *= CUBEUV_TEXEL_HEIGHT;\\n\\t\\t#ifdef texture2DGradEXT\\n\\t\\t\\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\\n\\t\\t#else\\n\\t\\t\\treturn texture2D( envMap, uv ).rgb;\\n\\t\\t#endif\\n\\t}\\n\\t#define cubeUV_r0 1.0\\n\\t#define cubeUV_v0 0.339\\n\\t#define cubeUV_m0 - 2.0\\n\\t#define cubeUV_r1 0.8\\n\\t#define cubeUV_v1 0.276\\n\\t#define cubeUV_m1 - 1.0\\n\\t#define cubeUV_r4 0.4\\n\\t#define cubeUV_v4 0.046\\n\\t#define cubeUV_m4 2.0\\n\\t#define cubeUV_r5 0.305\\n\\t#define cubeUV_v5 0.016\\n\\t#define cubeUV_m5 3.0\\n\\t#define cubeUV_r6 0.21\\n\\t#define cubeUV_v6 0.0038\\n\\t#define cubeUV_m6 4.0\\n\\tfloat roughnessToMip( float roughness ) {\\n\\t\\tfloat mip = 0.0;\\n\\t\\tif ( roughness >= cubeUV_r1 ) {\\n\\t\\t\\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\\n\\t\\t} else if ( roughness >= cubeUV_r4 ) {\\n\\t\\t\\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\\n\\t\\t} else if ( roughness >= cubeUV_r5 ) {\\n\\t\\t\\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\\n\\t\\t} else if ( roughness >= cubeUV_r6 ) {\\n\\t\\t\\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\\n\\t\\t} else {\\n\\t\\t\\tmip = - 2.0 * log2( 1.16 * roughness );\\t\\t}\\n\\t\\treturn mip;\\n\\t}\\n\\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\\n\\t\\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\\n\\t\\tfloat mipF = fract( mip );\\n\\t\\tfloat mipInt = floor( mip );\\n\\t\\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\\n\\t\\tif ( mipF == 0.0 ) {\\n\\t\\t\\treturn vec4( color0, 1.0 );\\n\\t\\t} else {\\n\\t\\t\\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\\n\\t\\t\\treturn vec4( mix( color0, color1, mipF ), 1.0 );\\n\\t\\t}\\n\\t}\\n#endif\";\n\nvar defaultnormal_vertex = \"vec3 transformedNormal = objectNormal;\\n#ifdef USE_INSTANCING\\n\\tmat3 m = mat3( instanceMatrix );\\n\\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\\n\\ttransformedNormal = m * transformedNormal;\\n#endif\\ntransformedNormal = normalMatrix * transformedNormal;\\n#ifdef FLIP_SIDED\\n\\ttransformedNormal = - transformedNormal;\\n#endif\\n#ifdef USE_TANGENT\\n\\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\\n\\t#ifdef FLIP_SIDED\\n\\t\\ttransformedTangent = - transformedTangent;\\n\\t#endif\\n#endif\";\n\nvar displacementmap_pars_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\tuniform sampler2D displacementMap;\\n\\tuniform float displacementScale;\\n\\tuniform float displacementBias;\\n#endif\";\n\nvar displacementmap_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\\n#endif\";\n\nvar emissivemap_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\\n\\ttotalEmissiveRadiance *= emissiveColor.rgb;\\n#endif\";\n\nvar emissivemap_pars_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tuniform sampler2D emissiveMap;\\n#endif\";\n\nvar colorspace_fragment = \"gl_FragColor = linearToOutputTexel( gl_FragColor );\";\n\nvar colorspace_pars_fragment = \"\\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\\n\\tvec3( 0.8224621, 0.177538, 0.0 ),\\n\\tvec3( 0.0331941, 0.9668058, 0.0 ),\\n\\tvec3( 0.0170827, 0.0723974, 0.9105199 )\\n);\\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\\n\\tvec3( 1.2249401, - 0.2249404, 0.0 ),\\n\\tvec3( - 0.0420569, 1.0420571, 0.0 ),\\n\\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\\n);\\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\\n\\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\\n}\\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\\n\\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\\n}\\nvec4 LinearTransferOETF( in vec4 value ) {\\n\\treturn value;\\n}\\nvec4 sRGBTransferOETF( in vec4 value ) {\\n\\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\\n}\\nvec4 LinearToLinear( in vec4 value ) {\\n\\treturn value;\\n}\\nvec4 LinearTosRGB( in vec4 value ) {\\n\\treturn sRGBTransferOETF( value );\\n}\";\n\nvar envmap_fragment = \"#ifdef USE_ENVMAP\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvec3 cameraToFrag;\\n\\t\\tif ( isOrthographic ) {\\n\\t\\t\\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\\t\\t} else {\\n\\t\\t\\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\\n\\t\\t}\\n\\t\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\t\\t\\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\\n\\t\\t#else\\n\\t\\t\\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\\n\\t\\t#endif\\n\\t#else\\n\\t\\tvec3 reflectVec = vReflect;\\n\\t#endif\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\\n\\t#else\\n\\t\\tvec4 envColor = vec4( 0.0 );\\n\\t#endif\\n\\t#ifdef ENVMAP_BLENDING_MULTIPLY\\n\\t\\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\\n\\t#elif defined( ENVMAP_BLENDING_MIX )\\n\\t\\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\\n\\t#elif defined( ENVMAP_BLENDING_ADD )\\n\\t\\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\\n\\t#endif\\n#endif\";\n\nvar envmap_common_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float envMapIntensity;\\n\\tuniform float flipEnvMap;\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tuniform samplerCube envMap;\\n\\t#else\\n\\t\\tuniform sampler2D envMap;\\n\\t#endif\\n\\t\\n#endif\";\n\nvar envmap_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float reflectivity;\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\n\\t\\t#define ENV_WORLDPOS\\n\\t#endif\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvarying vec3 vWorldPosition;\\n\\t\\tuniform float refractionRatio;\\n\\t#else\\n\\t\\tvarying vec3 vReflect;\\n\\t#endif\\n#endif\";\n\nvar envmap_pars_vertex = \"#ifdef USE_ENVMAP\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\n\\t\\t#define ENV_WORLDPOS\\n\\t#endif\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\t\\n\\t\\tvarying vec3 vWorldPosition;\\n\\t#else\\n\\t\\tvarying vec3 vReflect;\\n\\t\\tuniform float refractionRatio;\\n\\t#endif\\n#endif\";\n\nvar envmap_vertex = \"#ifdef USE_ENVMAP\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvWorldPosition = worldPosition.xyz;\\n\\t#else\\n\\t\\tvec3 cameraToVertex;\\n\\t\\tif ( isOrthographic ) {\\n\\t\\t\\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\\t\\t} else {\\n\\t\\t\\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\\n\\t\\t}\\n\\t\\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\n\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\t\\t\\tvReflect = reflect( cameraToVertex, worldNormal );\\n\\t\\t#else\\n\\t\\t\\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar fog_vertex = \"#ifdef USE_FOG\\n\\tvFogDepth = - mvPosition.z;\\n#endif\";\n\nvar fog_pars_vertex = \"#ifdef USE_FOG\\n\\tvarying float vFogDepth;\\n#endif\";\n\nvar fog_fragment = \"#ifdef USE_FOG\\n\\t#ifdef FOG_EXP2\\n\\t\\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\\n\\t#else\\n\\t\\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\\n\\t#endif\\n\\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\\n#endif\";\n\nvar fog_pars_fragment = \"#ifdef USE_FOG\\n\\tuniform vec3 fogColor;\\n\\tvarying float vFogDepth;\\n\\t#ifdef FOG_EXP2\\n\\t\\tuniform float fogDensity;\\n\\t#else\\n\\t\\tuniform float fogNear;\\n\\t\\tuniform float fogFar;\\n\\t#endif\\n#endif\";\n\nvar gradientmap_pars_fragment = \"#ifdef USE_GRADIENTMAP\\n\\tuniform sampler2D gradientMap;\\n#endif\\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\\n\\tfloat dotNL = dot( normal, lightDirection );\\n\\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\\n\\t#ifdef USE_GRADIENTMAP\\n\\t\\treturn vec3( texture2D( gradientMap, coord ).r );\\n\\t#else\\n\\t\\tvec2 fw = fwidth( coord ) * 0.5;\\n\\t\\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\\n\\t#endif\\n}\";\n\nvar lightmap_fragment = \"#ifdef USE_LIGHTMAP\\n\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\\n\\treflectedLight.indirectDiffuse += lightMapIrradiance;\\n#endif\";\n\nvar lightmap_pars_fragment = \"#ifdef USE_LIGHTMAP\\n\\tuniform sampler2D lightMap;\\n\\tuniform float lightMapIntensity;\\n#endif\";\n\nvar lights_lambert_fragment = \"LambertMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularStrength = specularStrength;\";\n\nvar lights_lambert_pars_fragment = \"varying vec3 vViewPosition;\\nstruct LambertMaterial {\\n\\tvec3 diffuseColor;\\n\\tfloat specularStrength;\\n};\\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Lambert\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Lambert\";\n\nvar lights_pars_begin = \"uniform bool receiveShadow;\\nuniform vec3 ambientLightColor;\\n#if defined( USE_LIGHT_PROBES )\\n\\tuniform vec3 lightProbe[ 9 ];\\n#endif\\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\\n\\tfloat x = normal.x, y = normal.y, z = normal.z;\\n\\tvec3 result = shCoefficients[ 0 ] * 0.886227;\\n\\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\\n\\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\\n\\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\\n\\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\\n\\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\\n\\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\\n\\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\\n\\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\\n\\treturn result;\\n}\\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\\n\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\\n\\treturn irradiance;\\n}\\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\\n\\tvec3 irradiance = ambientLightColor;\\n\\treturn irradiance;\\n}\\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\\n\\t#if defined ( LEGACY_LIGHTS )\\n\\t\\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\\n\\t\\t\\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\\n\\t\\t}\\n\\t\\treturn 1.0;\\n\\t#else\\n\\t\\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\\n\\t\\tif ( cutoffDistance > 0.0 ) {\\n\\t\\t\\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\\n\\t\\t}\\n\\t\\treturn distanceFalloff;\\n\\t#endif\\n}\\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\\n\\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\\n}\\n#if NUM_DIR_LIGHTS > 0\\n\\tstruct DirectionalLight {\\n\\t\\tvec3 direction;\\n\\t\\tvec3 color;\\n\\t};\\n\\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\\n\\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\\n\\t\\tlight.color = directionalLight.color;\\n\\t\\tlight.direction = directionalLight.direction;\\n\\t\\tlight.visible = true;\\n\\t}\\n#endif\\n#if NUM_POINT_LIGHTS > 0\\n\\tstruct PointLight {\\n\\t\\tvec3 position;\\n\\t\\tvec3 color;\\n\\t\\tfloat distance;\\n\\t\\tfloat decay;\\n\\t};\\n\\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\\n\\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\\n\\t\\tvec3 lVector = pointLight.position - geometryPosition;\\n\\t\\tlight.direction = normalize( lVector );\\n\\t\\tfloat lightDistance = length( lVector );\\n\\t\\tlight.color = pointLight.color;\\n\\t\\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\\n\\t\\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\\t}\\n#endif\\n#if NUM_SPOT_LIGHTS > 0\\n\\tstruct SpotLight {\\n\\t\\tvec3 position;\\n\\t\\tvec3 direction;\\n\\t\\tvec3 color;\\n\\t\\tfloat distance;\\n\\t\\tfloat decay;\\n\\t\\tfloat coneCos;\\n\\t\\tfloat penumbraCos;\\n\\t};\\n\\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\\n\\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\\n\\t\\tvec3 lVector = spotLight.position - geometryPosition;\\n\\t\\tlight.direction = normalize( lVector );\\n\\t\\tfloat angleCos = dot( light.direction, spotLight.direction );\\n\\t\\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\\n\\t\\tif ( spotAttenuation > 0.0 ) {\\n\\t\\t\\tfloat lightDistance = length( lVector );\\n\\t\\t\\tlight.color = spotLight.color * spotAttenuation;\\n\\t\\t\\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\\n\\t\\t\\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\\t\\t} else {\\n\\t\\t\\tlight.color = vec3( 0.0 );\\n\\t\\t\\tlight.visible = false;\\n\\t\\t}\\n\\t}\\n#endif\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\\tstruct RectAreaLight {\\n\\t\\tvec3 color;\\n\\t\\tvec3 position;\\n\\t\\tvec3 halfWidth;\\n\\t\\tvec3 halfHeight;\\n\\t};\\n\\tuniform sampler2D ltc_1;\\tuniform sampler2D ltc_2;\\n\\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\\n#endif\\n#if NUM_HEMI_LIGHTS > 0\\n\\tstruct HemisphereLight {\\n\\t\\tvec3 direction;\\n\\t\\tvec3 skyColor;\\n\\t\\tvec3 groundColor;\\n\\t};\\n\\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\\n\\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\\n\\t\\tfloat dotNL = dot( normal, hemiLight.direction );\\n\\t\\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\\n\\t\\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\\n\\t\\treturn irradiance;\\n\\t}\\n#endif\";\n\nvar envmap_physical_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tvec3 getIBLIrradiance( const in vec3 normal ) {\\n\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\\n\\t\\t\\treturn PI * envMapColor.rgb * envMapIntensity;\\n\\t\\t#else\\n\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t#endif\\n\\t}\\n\\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\\n\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\tvec3 reflectVec = reflect( - viewDir, normal );\\n\\t\\t\\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\\n\\t\\t\\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\\n\\t\\t\\treturn envMapColor.rgb * envMapIntensity;\\n\\t\\t#else\\n\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t#endif\\n\\t}\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\\n\\t\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\t\\tvec3 bentNormal = cross( bitangent, viewDir );\\n\\t\\t\\t\\tbentNormal = normalize( cross( bentNormal, bitangent ) );\\n\\t\\t\\t\\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\\n\\t\\t\\t\\treturn getIBLRadiance( viewDir, bentNormal, roughness );\\n\\t\\t\\t#else\\n\\t\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t\\t#endif\\n\\t\\t}\\n\\t#endif\\n#endif\";\n\nvar lights_toon_fragment = \"ToonMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\";\n\nvar lights_toon_pars_fragment = \"varying vec3 vViewPosition;\\nstruct ToonMaterial {\\n\\tvec3 diffuseColor;\\n};\\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Toon\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Toon\";\n\nvar lights_phong_fragment = \"BlinnPhongMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularColor = specular;\\nmaterial.specularShininess = shininess;\\nmaterial.specularStrength = specularStrength;\";\n\nvar lights_phong_pars_fragment = \"varying vec3 vViewPosition;\\nstruct BlinnPhongMaterial {\\n\\tvec3 diffuseColor;\\n\\tvec3 specularColor;\\n\\tfloat specularShininess;\\n\\tfloat specularStrength;\\n};\\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n\\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\\n}\\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_BlinnPhong\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_BlinnPhong\";\n\nvar lights_physical_fragment = \"PhysicalMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\\nmaterial.roughness = min( material.roughness, 1.0 );\\n#ifdef IOR\\n\\tmaterial.ior = ior;\\n\\t#ifdef USE_SPECULAR\\n\\t\\tfloat specularIntensityFactor = specularIntensity;\\n\\t\\tvec3 specularColorFactor = specularColor;\\n\\t\\t#ifdef USE_SPECULAR_COLORMAP\\n\\t\\t\\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\\n\\t\\t#endif\\n\\t\\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\\t\\t\\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\\n\\t\\t#endif\\n\\t\\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\\n\\t#else\\n\\t\\tfloat specularIntensityFactor = 1.0;\\n\\t\\tvec3 specularColorFactor = vec3( 1.0 );\\n\\t\\tmaterial.specularF90 = 1.0;\\n\\t#endif\\n\\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\\n#else\\n\\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\\n\\tmaterial.specularF90 = 1.0;\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tmaterial.clearcoat = clearcoat;\\n\\tmaterial.clearcoatRoughness = clearcoatRoughness;\\n\\tmaterial.clearcoatF0 = vec3( 0.04 );\\n\\tmaterial.clearcoatF90 = 1.0;\\n\\t#ifdef USE_CLEARCOATMAP\\n\\t\\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\t\\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\\n\\t#endif\\n\\tmaterial.clearcoat = saturate( material.clearcoat );\\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\\n\\tmaterial.clearcoatRoughness += geometryRoughness;\\n\\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tmaterial.iridescence = iridescence;\\n\\tmaterial.iridescenceIOR = iridescenceIOR;\\n\\t#ifdef USE_IRIDESCENCEMAP\\n\\t\\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\\n\\t#endif\\n\\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\t\\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\\n\\t#else\\n\\t\\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\\n\\t#endif\\n#endif\\n#ifdef USE_SHEEN\\n\\tmaterial.sheenColor = sheenColor;\\n\\t#ifdef USE_SHEEN_COLORMAP\\n\\t\\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\\n\\t#endif\\n\\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\\n\\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\t\\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\\n\\t#endif\\n#endif\\n#ifdef USE_ANISOTROPY\\n\\t#ifdef USE_ANISOTROPYMAP\\n\\t\\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\\n\\t\\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\\n\\t\\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\\n\\t#else\\n\\t\\tvec2 anisotropyV = anisotropyVector;\\n\\t#endif\\n\\tmaterial.anisotropy = length( anisotropyV );\\n\\tanisotropyV /= material.anisotropy;\\n\\tmaterial.anisotropy = saturate( material.anisotropy );\\n\\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\\n\\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\\n\\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\\n#endif\";\n\nvar lights_physical_pars_fragment = \"struct PhysicalMaterial {\\n\\tvec3 diffuseColor;\\n\\tfloat roughness;\\n\\tvec3 specularColor;\\n\\tfloat specularF90;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat clearcoat;\\n\\t\\tfloat clearcoatRoughness;\\n\\t\\tvec3 clearcoatF0;\\n\\t\\tfloat clearcoatF90;\\n\\t#endif\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tfloat iridescence;\\n\\t\\tfloat iridescenceIOR;\\n\\t\\tfloat iridescenceThickness;\\n\\t\\tvec3 iridescenceFresnel;\\n\\t\\tvec3 iridescenceF0;\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tvec3 sheenColor;\\n\\t\\tfloat sheenRoughness;\\n\\t#endif\\n\\t#ifdef IOR\\n\\t\\tfloat ior;\\n\\t#endif\\n\\t#ifdef USE_TRANSMISSION\\n\\t\\tfloat transmission;\\n\\t\\tfloat transmissionAlpha;\\n\\t\\tfloat thickness;\\n\\t\\tfloat attenuationDistance;\\n\\t\\tvec3 attenuationColor;\\n\\t#endif\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tfloat anisotropy;\\n\\t\\tfloat alphaT;\\n\\t\\tvec3 anisotropyT;\\n\\t\\tvec3 anisotropyB;\\n\\t#endif\\n};\\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\\nvec3 sheenSpecularDirect = vec3( 0.0 );\\nvec3 sheenSpecularIndirect = vec3(0.0 );\\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\\n float x2 = x * x;\\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\\n}\\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\\n\\tfloat a2 = pow2( alpha );\\n\\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\\n\\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\\n\\treturn 0.5 / max( gv + gl, EPSILON );\\n}\\nfloat D_GGX( const in float alpha, const in float dotNH ) {\\n\\tfloat a2 = pow2( alpha );\\n\\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\\n\\treturn RECIPROCAL_PI * a2 / pow2( denom );\\n}\\n#ifdef USE_ANISOTROPY\\n\\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\\n\\t\\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\\n\\t\\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\\n\\t\\tfloat v = 0.5 / ( gv + gl );\\n\\t\\treturn saturate(v);\\n\\t}\\n\\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\\n\\t\\tfloat a2 = alphaT * alphaB;\\n\\t\\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\\n\\t\\thighp float v2 = dot( v, v );\\n\\t\\tfloat w2 = a2 / v2;\\n\\t\\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\\n\\t}\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\\n\\t\\tvec3 f0 = material.clearcoatF0;\\n\\t\\tfloat f90 = material.clearcoatF90;\\n\\t\\tfloat roughness = material.clearcoatRoughness;\\n\\t\\tfloat alpha = pow2( roughness );\\n\\t\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\t\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\t\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\t\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\t\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\t\\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\\t\\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\\t\\tfloat D = D_GGX( alpha, dotNH );\\n\\t\\treturn F * ( V * D );\\n\\t}\\n#endif\\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\\n\\tvec3 f0 = material.specularColor;\\n\\tfloat f90 = material.specularF90;\\n\\tfloat roughness = material.roughness;\\n\\tfloat alpha = pow2( roughness );\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tF = mix( F, material.iridescenceFresnel, material.iridescence );\\n\\t#endif\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tfloat dotTL = dot( material.anisotropyT, lightDir );\\n\\t\\tfloat dotTV = dot( material.anisotropyT, viewDir );\\n\\t\\tfloat dotTH = dot( material.anisotropyT, halfDir );\\n\\t\\tfloat dotBL = dot( material.anisotropyB, lightDir );\\n\\t\\tfloat dotBV = dot( material.anisotropyB, viewDir );\\n\\t\\tfloat dotBH = dot( material.anisotropyB, halfDir );\\n\\t\\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\\n\\t\\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\\n\\t#else\\n\\t\\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\\t\\tfloat D = D_GGX( alpha, dotNH );\\n\\t#endif\\n\\treturn F * ( V * D );\\n}\\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\\n\\tconst float LUT_SIZE = 64.0;\\n\\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\\n\\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\\n\\tfloat dotNV = saturate( dot( N, V ) );\\n\\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\\n\\tuv = uv * LUT_SCALE + LUT_BIAS;\\n\\treturn uv;\\n}\\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\\n\\tfloat l = length( f );\\n\\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\\n}\\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\\n\\tfloat x = dot( v1, v2 );\\n\\tfloat y = abs( x );\\n\\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\\n\\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\\n\\tfloat v = a / b;\\n\\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\\n\\treturn cross( v1, v2 ) * theta_sintheta;\\n}\\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\\n\\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\\n\\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\\n\\tvec3 lightNormal = cross( v1, v2 );\\n\\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\\n\\tvec3 T1, T2;\\n\\tT1 = normalize( V - N * dot( V, N ) );\\n\\tT2 = - cross( N, T1 );\\n\\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\\n\\tvec3 coords[ 4 ];\\n\\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\\n\\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\\n\\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\\n\\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\\n\\tcoords[ 0 ] = normalize( coords[ 0 ] );\\n\\tcoords[ 1 ] = normalize( coords[ 1 ] );\\n\\tcoords[ 2 ] = normalize( coords[ 2 ] );\\n\\tcoords[ 3 ] = normalize( coords[ 3 ] );\\n\\tvec3 vectorFormFactor = vec3( 0.0 );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\\n\\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\\n\\treturn vec3( result );\\n}\\n#if defined( USE_SHEEN )\\nfloat D_Charlie( float roughness, float dotNH ) {\\n\\tfloat alpha = pow2( roughness );\\n\\tfloat invAlpha = 1.0 / alpha;\\n\\tfloat cos2h = dotNH * dotNH;\\n\\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\\n\\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\\n}\\nfloat V_Neubelt( float dotNV, float dotNL ) {\\n\\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\\n}\\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat D = D_Charlie( sheenRoughness, dotNH );\\n\\tfloat V = V_Neubelt( dotNV, dotNL );\\n\\treturn sheenColor * ( D * V );\\n}\\n#endif\\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat r2 = roughness * roughness;\\n\\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\\n\\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\\n\\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\\n\\treturn saturate( DG * RECIPROCAL_PI );\\n}\\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\\n\\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\\n\\tvec4 r = roughness * c0 + c1;\\n\\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\\n\\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\\n\\treturn fab;\\n}\\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\\n\\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\\treturn specularColor * fab.x + specularF90 * fab.y;\\n}\\n#ifdef USE_IRIDESCENCE\\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#else\\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#endif\\n\\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\\n\\t#else\\n\\t\\tvec3 Fr = specularColor;\\n\\t#endif\\n\\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\\n\\tfloat Ess = fab.x + fab.y;\\n\\tfloat Ems = 1.0 - Ess;\\n\\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\\n\\tsingleScatter += FssEss;\\n\\tmultiScatter += Fms * Ems;\\n}\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\t\\tvec3 normal = geometryNormal;\\n\\t\\tvec3 viewDir = geometryViewDir;\\n\\t\\tvec3 position = geometryPosition;\\n\\t\\tvec3 lightPos = rectAreaLight.position;\\n\\t\\tvec3 halfWidth = rectAreaLight.halfWidth;\\n\\t\\tvec3 halfHeight = rectAreaLight.halfHeight;\\n\\t\\tvec3 lightColor = rectAreaLight.color;\\n\\t\\tfloat roughness = material.roughness;\\n\\t\\tvec3 rectCoords[ 4 ];\\n\\t\\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\\t\\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\\n\\t\\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\\n\\t\\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\\n\\t\\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\\n\\t\\tvec4 t1 = texture2D( ltc_1, uv );\\n\\t\\tvec4 t2 = texture2D( ltc_2, uv );\\n\\t\\tmat3 mInv = mat3(\\n\\t\\t\\tvec3( t1.x, 0, t1.y ),\\n\\t\\t\\tvec3( 0, 1, 0 ),\\n\\t\\t\\tvec3( t1.z, 0, t1.w )\\n\\t\\t);\\n\\t\\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\\n\\t\\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\\n\\t\\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\\n\\t}\\n#endif\\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\\n\\t\\tvec3 ccIrradiance = dotNLcc * directLight.color;\\n\\t\\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\\n\\t#endif\\n\\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\\n\\t#endif\\n\\tvec3 singleScattering = vec3( 0.0 );\\n\\tvec3 multiScattering = vec3( 0.0 );\\n\\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\\n\\t#else\\n\\t\\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\\n\\t#endif\\n\\tvec3 totalScattering = singleScattering + multiScattering;\\n\\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\\n\\treflectedLight.indirectSpecular += radiance * singleScattering;\\n\\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\\n\\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Physical\\n#define RE_Direct_RectArea\\t\\tRE_Direct_RectArea_Physical\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Physical\\n#define RE_IndirectSpecular\\t\\tRE_IndirectSpecular_Physical\\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\\n\\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\\n}\";\n\nvar lights_fragment_begin = \"\\nvec3 geometryPosition = - vViewPosition;\\nvec3 geometryNormal = normal;\\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\\nvec3 geometryClearcoatNormal = vec3( 0.0 );\\n#ifdef USE_CLEARCOAT\\n\\tgeometryClearcoatNormal = clearcoatNormal;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\\n\\tif ( material.iridescenceThickness == 0.0 ) {\\n\\t\\tmaterial.iridescence = 0.0;\\n\\t} else {\\n\\t\\tmaterial.iridescence = saturate( material.iridescence );\\n\\t}\\n\\tif ( material.iridescence > 0.0 ) {\\n\\t\\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\\n\\t\\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\\n\\t}\\n#endif\\nIncidentLight directLight;\\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tPointLight pointLight;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\\n\\tPointLightShadow pointLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\\n\\t\\tpointLight = pointLights[ i ];\\n\\t\\tgetPointLightInfo( pointLight, geometryPosition, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\\n\\t\\tpointLightShadow = pointLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tSpotLight spotLight;\\n\\tvec4 spotColor;\\n\\tvec3 spotLightCoord;\\n\\tbool inSpotLightMap;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\\n\\tSpotLightShadow spotLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\\n\\t\\tspotLight = spotLights[ i ];\\n\\t\\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\\n\\t\\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\\n\\t\\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\\n\\t\\t#else\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\\t\\t#endif\\n\\t\\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\\n\\t\\t\\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\\n\\t\\t\\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\\n\\t\\t\\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\\n\\t\\t\\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\\n\\t\\t#endif\\n\\t\\t#undef SPOT_LIGHT_MAP_INDEX\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\tspotLightShadow = spotLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tDirectionalLight directionalLight;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\\n\\tDirectionalLightShadow directionalLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\\n\\t\\tdirectionalLight = directionalLights[ i ];\\n\\t\\tgetDirectionalLightInfo( directionalLight, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\\n\\t\\tdirectionalLightShadow = directionalLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\\n\\tRectAreaLight rectAreaLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\\n\\t\\trectAreaLight = rectAreaLights[ i ];\\n\\t\\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if defined( RE_IndirectDiffuse )\\n\\tvec3 iblIrradiance = vec3( 0.0 );\\n\\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\\n\\t#if defined( USE_LIGHT_PROBES )\\n\\t\\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\\n\\t#endif\\n\\t#if ( NUM_HEMI_LIGHTS > 0 )\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\\n\\t\\t\\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\\tvec3 radiance = vec3( 0.0 );\\n\\tvec3 clearcoatRadiance = vec3( 0.0 );\\n#endif\";\n\nvar lights_fragment_maps = \"#if defined( RE_IndirectDiffuse )\\n\\t#ifdef USE_LIGHTMAP\\n\\t\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\t\\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\\n\\t\\tirradiance += lightMapIrradiance;\\n\\t#endif\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tiblIrradiance += getIBLIrradiance( geometryNormal );\\n\\t#endif\\n#endif\\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\\n\\t#else\\n\\t\\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\\n\\t#endif\\n#endif\";\n\nvar lights_fragment_end = \"#if defined( RE_IndirectDiffuse )\\n\\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n#endif\";\n\nvar logdepthbuf_fragment = \"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\\n\\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\\n#endif\";\n\nvar logdepthbuf_pars_fragment = \"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\\n\\tuniform float logDepthBufFC;\\n\\tvarying float vFragDepth;\\n\\tvarying float vIsPerspective;\\n#endif\";\n\nvar logdepthbuf_pars_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\t#ifdef USE_LOGDEPTHBUF_EXT\\n\\t\\tvarying float vFragDepth;\\n\\t\\tvarying float vIsPerspective;\\n\\t#else\\n\\t\\tuniform float logDepthBufFC;\\n\\t#endif\\n#endif\";\n\nvar logdepthbuf_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\t#ifdef USE_LOGDEPTHBUF_EXT\\n\\t\\tvFragDepth = 1.0 + gl_Position.w;\\n\\t\\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\\n\\t#else\\n\\t\\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\\n\\t\\t\\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\\n\\t\\t\\tgl_Position.z *= gl_Position.w;\\n\\t\\t}\\n\\t#endif\\n#endif\";\n\nvar map_fragment = \"#ifdef USE_MAP\\n\\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\\n\\t#ifdef DECODE_VIDEO_TEXTURE\\n\\t\\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\\n\\t\\n\\t#endif\\n\\tdiffuseColor *= sampledDiffuseColor;\\n#endif\";\n\nvar map_pars_fragment = \"#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\";\n\nvar map_particle_fragment = \"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\t#if defined( USE_POINTS_UV )\\n\\t\\tvec2 uv = vUv;\\n\\t#else\\n\\t\\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\\n\\t#endif\\n#endif\\n#ifdef USE_MAP\\n\\tdiffuseColor *= texture2D( map, uv );\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\\n#endif\";\n\nvar map_particle_pars_fragment = \"#if defined( USE_POINTS_UV )\\n\\tvarying vec2 vUv;\\n#else\\n\\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\t\\tuniform mat3 uvTransform;\\n\\t#endif\\n#endif\\n#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\n\nvar metalnessmap_fragment = \"float metalnessFactor = metalness;\\n#ifdef USE_METALNESSMAP\\n\\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\\n\\tmetalnessFactor *= texelMetalness.b;\\n#endif\";\n\nvar metalnessmap_pars_fragment = \"#ifdef USE_METALNESSMAP\\n\\tuniform sampler2D metalnessMap;\\n#endif\";\n\nvar morphcolor_vertex = \"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\\n\\tvColor *= morphTargetBaseInfluence;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t#if defined( USE_COLOR_ALPHA )\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\\n\\t\\t#elif defined( USE_COLOR )\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\\n\\t\\t#endif\\n\\t}\\n#endif\";\n\nvar morphnormal_vertex = \"#ifdef USE_MORPHNORMALS\\n\\tobjectNormal *= morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\\n\\t\\t}\\n\\t#else\\n\\t\\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\\n\\t\\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\\n\\t\\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\\n\\t\\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\\n\\t#endif\\n#endif\";\n\nvar morphtarget_pars_vertex = \"#ifdef USE_MORPHTARGETS\\n\\tuniform float morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\\n\\t\\tuniform sampler2DArray morphTargetsTexture;\\n\\t\\tuniform ivec2 morphTargetsTextureSize;\\n\\t\\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\\n\\t\\t\\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\\n\\t\\t\\tint y = texelIndex / morphTargetsTextureSize.x;\\n\\t\\t\\tint x = texelIndex - y * morphTargetsTextureSize.x;\\n\\t\\t\\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\\n\\t\\t\\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\\n\\t\\t}\\n\\t#else\\n\\t\\t#ifndef USE_MORPHNORMALS\\n\\t\\t\\tuniform float morphTargetInfluences[ 8 ];\\n\\t\\t#else\\n\\t\\t\\tuniform float morphTargetInfluences[ 4 ];\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar morphtarget_vertex = \"#ifdef USE_MORPHTARGETS\\n\\ttransformed *= morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\\n\\t\\t}\\n\\t#else\\n\\t\\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\\n\\t\\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\\n\\t\\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\\n\\t\\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\\n\\t\\t#ifndef USE_MORPHNORMALS\\n\\t\\t\\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\\n\\t\\t\\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\\n\\t\\t\\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\\n\\t\\t\\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar normal_fragment_begin = \"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\\n#ifdef FLAT_SHADED\\n\\tvec3 fdx = dFdx( vViewPosition );\\n\\tvec3 fdy = dFdy( vViewPosition );\\n\\tvec3 normal = normalize( cross( fdx, fdy ) );\\n#else\\n\\tvec3 normal = normalize( vNormal );\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal *= faceDirection;\\n\\t#endif\\n#endif\\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\\n\\t#ifdef USE_TANGENT\\n\\t\\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\\t#else\\n\\t\\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\\n\\t\\t#if defined( USE_NORMALMAP )\\n\\t\\t\\tvNormalMapUv\\n\\t\\t#elif defined( USE_CLEARCOAT_NORMALMAP )\\n\\t\\t\\tvClearcoatNormalMapUv\\n\\t\\t#else\\n\\t\\t\\tvUv\\n\\t\\t#endif\\n\\t\\t);\\n\\t#endif\\n\\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\\t\\ttbn[0] *= faceDirection;\\n\\t\\ttbn[1] *= faceDirection;\\n\\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\t#ifdef USE_TANGENT\\n\\t\\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\\t#else\\n\\t\\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\\n\\t#endif\\n\\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\\t\\ttbn2[0] *= faceDirection;\\n\\t\\ttbn2[1] *= faceDirection;\\n\\t#endif\\n#endif\\nvec3 nonPerturbedNormal = normal;\";\n\nvar normal_fragment_maps = \"#ifdef USE_NORMALMAP_OBJECTSPACE\\n\\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\\t#ifdef FLIP_SIDED\\n\\t\\tnormal = - normal;\\n\\t#endif\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal = normal * faceDirection;\\n\\t#endif\\n\\tnormal = normalize( normalMatrix * normal );\\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\\tmapN.xy *= normalScale;\\n\\tnormal = normalize( tbn * mapN );\\n#elif defined( USE_BUMPMAP )\\n\\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\\n#endif\";\n\nvar normal_pars_fragment = \"#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\";\n\nvar normal_pars_vertex = \"#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\";\n\nvar normal_vertex = \"#ifndef FLAT_SHADED\\n\\tvNormal = normalize( transformedNormal );\\n\\t#ifdef USE_TANGENT\\n\\t\\tvTangent = normalize( transformedTangent );\\n\\t\\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\\n\\t#endif\\n#endif\";\n\nvar normalmap_pars_fragment = \"#ifdef USE_NORMALMAP\\n\\tuniform sampler2D normalMap;\\n\\tuniform vec2 normalScale;\\n#endif\\n#ifdef USE_NORMALMAP_OBJECTSPACE\\n\\tuniform mat3 normalMatrix;\\n#endif\\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\\n\\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\\n\\t\\tvec3 q0 = dFdx( eye_pos.xyz );\\n\\t\\tvec3 q1 = dFdy( eye_pos.xyz );\\n\\t\\tvec2 st0 = dFdx( uv.st );\\n\\t\\tvec2 st1 = dFdy( uv.st );\\n\\t\\tvec3 N = surf_norm;\\n\\t\\tvec3 q1perp = cross( q1, N );\\n\\t\\tvec3 q0perp = cross( N, q0 );\\n\\t\\tvec3 T = q1perp * st0.x + q0perp * st1.x;\\n\\t\\tvec3 B = q1perp * st0.y + q0perp * st1.y;\\n\\t\\tfloat det = max( dot( T, T ), dot( B, B ) );\\n\\t\\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\\n\\t\\treturn mat3( T * scale, B * scale, N );\\n\\t}\\n#endif\";\n\nvar clearcoat_normal_fragment_begin = \"#ifdef USE_CLEARCOAT\\n\\tvec3 clearcoatNormal = nonPerturbedNormal;\\n#endif\";\n\nvar clearcoat_normal_fragment_maps = \"#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\\n\\tclearcoatMapN.xy *= clearcoatNormalScale;\\n\\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\\n#endif\";\n\nvar clearcoat_pars_fragment = \"#ifdef USE_CLEARCOATMAP\\n\\tuniform sampler2D clearcoatMap;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tuniform sampler2D clearcoatNormalMap;\\n\\tuniform vec2 clearcoatNormalScale;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tuniform sampler2D clearcoatRoughnessMap;\\n#endif\";\n\nvar iridescence_pars_fragment = \"#ifdef USE_IRIDESCENCEMAP\\n\\tuniform sampler2D iridescenceMap;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tuniform sampler2D iridescenceThicknessMap;\\n#endif\";\n\nvar opaque_fragment = \"#ifdef OPAQUE\\ndiffuseColor.a = 1.0;\\n#endif\\n#ifdef USE_TRANSMISSION\\ndiffuseColor.a *= material.transmissionAlpha;\\n#endif\\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\";\n\nvar packing = \"vec3 packNormalToRGB( const in vec3 normal ) {\\n\\treturn normalize( normal ) * 0.5 + 0.5;\\n}\\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\\n\\treturn 2.0 * rgb.xyz - 1.0;\\n}\\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\\nconst float ShiftRight8 = 1. / 256.;\\nvec4 packDepthToRGBA( const in float v ) {\\n\\tvec4 r = vec4( fract( v * PackFactors ), v );\\n\\tr.yzw -= r.xyz * ShiftRight8;\\treturn r * PackUpscale;\\n}\\nfloat unpackRGBAToDepth( const in vec4 v ) {\\n\\treturn dot( v, UnpackFactors );\\n}\\nvec2 packDepthToRG( in highp float v ) {\\n\\treturn packDepthToRGBA( v ).yx;\\n}\\nfloat unpackRGToDepth( const in highp vec2 v ) {\\n\\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\\n}\\nvec4 pack2HalfToRGBA( vec2 v ) {\\n\\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\\n\\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\\n}\\nvec2 unpackRGBATo2Half( vec4 v ) {\\n\\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\\n}\\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\\n\\treturn ( viewZ + near ) / ( near - far );\\n}\\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\\n\\treturn depth * ( near - far ) - near;\\n}\\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\\n\\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\\n}\\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\\n\\treturn ( near * far ) / ( ( far - near ) * depth - far );\\n}\";\n\nvar premultiplied_alpha_fragment = \"#ifdef PREMULTIPLIED_ALPHA\\n\\tgl_FragColor.rgb *= gl_FragColor.a;\\n#endif\";\n\nvar project_vertex = \"vec4 mvPosition = vec4( transformed, 1.0 );\\n#ifdef USE_INSTANCING\\n\\tmvPosition = instanceMatrix * mvPosition;\\n#endif\\nmvPosition = modelViewMatrix * mvPosition;\\ngl_Position = projectionMatrix * mvPosition;\";\n\nvar dithering_fragment = \"#ifdef DITHERING\\n\\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\\n#endif\";\n\nvar dithering_pars_fragment = \"#ifdef DITHERING\\n\\tvec3 dithering( vec3 color ) {\\n\\t\\tfloat grid_position = rand( gl_FragCoord.xy );\\n\\t\\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\\n\\t\\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\\n\\t\\treturn color + dither_shift_RGB;\\n\\t}\\n#endif\";\n\nvar roughnessmap_fragment = \"float roughnessFactor = roughness;\\n#ifdef USE_ROUGHNESSMAP\\n\\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\\n\\troughnessFactor *= texelRoughness.g;\\n#endif\";\n\nvar roughnessmap_pars_fragment = \"#ifdef USE_ROUGHNESSMAP\\n\\tuniform sampler2D roughnessMap;\\n#endif\";\n\nvar shadowmap_pars_fragment = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#if NUM_SPOT_LIGHT_MAPS > 0\\n\\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tstruct DirectionalLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t\\tstruct SpotLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tstruct PointLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t\\tfloat shadowCameraNear;\\n\\t\\t\\tfloat shadowCameraFar;\\n\\t\\t};\\n\\t\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\\n\\t\\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\\n\\t}\\n\\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\\n\\t\\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\\n\\t}\\n\\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\\n\\t\\tfloat occlusion = 1.0;\\n\\t\\tvec2 distribution = texture2DDistribution( shadow, uv );\\n\\t\\tfloat hard_shadow = step( compare , distribution.x );\\n\\t\\tif (hard_shadow != 1.0 ) {\\n\\t\\t\\tfloat distance = compare - distribution.x ;\\n\\t\\t\\tfloat variance = max( 0.00000, distribution.y * distribution.y );\\n\\t\\t\\tfloat softness_probability = variance / (variance + distance * distance );\\t\\t\\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\\t\\t\\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\\n\\t\\t}\\n\\t\\treturn occlusion;\\n\\t}\\n\\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\\n\\t\\tfloat shadow = 1.0;\\n\\t\\tshadowCoord.xyz /= shadowCoord.w;\\n\\t\\tshadowCoord.z += shadowBias;\\n\\t\\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\\n\\t\\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\\n\\t\\tif ( frustumTest ) {\\n\\t\\t#if defined( SHADOWMAP_TYPE_PCF )\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\\n\\t\\t\\tfloat dx0 = - texelSize.x * shadowRadius;\\n\\t\\t\\tfloat dy0 = - texelSize.y * shadowRadius;\\n\\t\\t\\tfloat dx1 = + texelSize.x * shadowRadius;\\n\\t\\t\\tfloat dy1 = + texelSize.y * shadowRadius;\\n\\t\\t\\tfloat dx2 = dx0 / 2.0;\\n\\t\\t\\tfloat dy2 = dy0 / 2.0;\\n\\t\\t\\tfloat dx3 = dx1 / 2.0;\\n\\t\\t\\tfloat dy3 = dy1 / 2.0;\\n\\t\\t\\tshadow = (\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\\n\\t\\t\\t) * ( 1.0 / 17.0 );\\n\\t\\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\\n\\t\\t\\tfloat dx = texelSize.x;\\n\\t\\t\\tfloat dy = texelSize.y;\\n\\t\\t\\tvec2 uv = shadowCoord.xy;\\n\\t\\t\\tvec2 f = fract( uv * shadowMapSize + 0.5 );\\n\\t\\t\\tuv -= f * texelSize;\\n\\t\\t\\tshadow = (\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.x ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.x ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.y ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.y ) +\\n\\t\\t\\t\\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t f.x ),\\n\\t\\t\\t\\t\\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t f.x ),\\n\\t\\t\\t\\t\\t f.y )\\n\\t\\t\\t) * ( 1.0 / 9.0 );\\n\\t\\t#elif defined( SHADOWMAP_TYPE_VSM )\\n\\t\\t\\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\\n\\t\\t#else\\n\\t\\t\\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\\n\\t\\t#endif\\n\\t\\t}\\n\\t\\treturn shadow;\\n\\t}\\n\\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\\n\\t\\tvec3 absV = abs( v );\\n\\t\\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\\n\\t\\tabsV *= scaleToCube;\\n\\t\\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\\n\\t\\tvec2 planar = v.xy;\\n\\t\\tfloat almostATexel = 1.5 * texelSizeY;\\n\\t\\tfloat almostOne = 1.0 - almostATexel;\\n\\t\\tif ( absV.z >= almostOne ) {\\n\\t\\t\\tif ( v.z > 0.0 )\\n\\t\\t\\t\\tplanar.x = 4.0 - v.x;\\n\\t\\t} else if ( absV.x >= almostOne ) {\\n\\t\\t\\tfloat signX = sign( v.x );\\n\\t\\t\\tplanar.x = v.z * signX + 2.0 * signX;\\n\\t\\t} else if ( absV.y >= almostOne ) {\\n\\t\\t\\tfloat signY = sign( v.y );\\n\\t\\t\\tplanar.x = v.x + 2.0 * signY + 2.0;\\n\\t\\t\\tplanar.y = v.z * signY - 2.0;\\n\\t\\t}\\n\\t\\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\\n\\t}\\n\\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\\n\\t\\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\\n\\t\\tvec3 lightToPosition = shadowCoord.xyz;\\n\\t\\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\\t\\tdp += shadowBias;\\n\\t\\tvec3 bd3D = normalize( lightToPosition );\\n\\t\\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\\n\\t\\t\\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\\n\\t\\t\\treturn (\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\\n\\t\\t\\t) * ( 1.0 / 9.0 );\\n\\t\\t#else\\n\\t\\t\\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\\n\\t\\t#endif\\n\\t}\\n#endif\";\n\nvar shadowmap_pars_vertex = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\\n\\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tstruct DirectionalLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\tstruct SpotLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tstruct PointLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t\\tfloat shadowCameraNear;\\n\\t\\t\\tfloat shadowCameraFar;\\n\\t\\t};\\n\\t\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n#endif\";\n\nvar shadowmap_vertex = \"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\\n\\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\n\\tvec4 shadowWorldPosition;\\n#endif\\n#if defined( USE_SHADOWMAP )\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\\t\\t\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\\n\\t\\t\\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\t\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\\n\\t\\t\\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n#endif\\n#if NUM_SPOT_LIGHT_COORDS > 0\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\\n\\t\\tshadowWorldPosition = worldPosition;\\n\\t\\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\t\\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\\n\\t\\t#endif\\n\\t\\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\";\n\nvar shadowmask_pars_fragment = \"float getShadowMask() {\\n\\tfloat shadow = 1.0;\\n\\t#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\tDirectionalLightShadow directionalLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tdirectionalLight = directionalLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\tSpotLightShadow spotLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tspotLight = spotLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\tPointLightShadow pointLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tpointLight = pointLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#endif\\n\\treturn shadow;\\n}\";\n\nvar skinbase_vertex = \"#ifdef USE_SKINNING\\n\\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\\n\\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\\n\\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\\n\\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\\n#endif\";\n\nvar skinning_pars_vertex = \"#ifdef USE_SKINNING\\n\\tuniform mat4 bindMatrix;\\n\\tuniform mat4 bindMatrixInverse;\\n\\tuniform highp sampler2D boneTexture;\\n\\tuniform int boneTextureSize;\\n\\tmat4 getBoneMatrix( const in float i ) {\\n\\t\\tfloat j = i * 4.0;\\n\\t\\tfloat x = mod( j, float( boneTextureSize ) );\\n\\t\\tfloat y = floor( j / float( boneTextureSize ) );\\n\\t\\tfloat dx = 1.0 / float( boneTextureSize );\\n\\t\\tfloat dy = 1.0 / float( boneTextureSize );\\n\\t\\ty = dy * ( y + 0.5 );\\n\\t\\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\\n\\t\\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\\n\\t\\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\\n\\t\\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\\n\\t\\tmat4 bone = mat4( v1, v2, v3, v4 );\\n\\t\\treturn bone;\\n\\t}\\n#endif\";\n\nvar skinning_vertex = \"#ifdef USE_SKINNING\\n\\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\\n\\tvec4 skinned = vec4( 0.0 );\\n\\tskinned += boneMatX * skinVertex * skinWeight.x;\\n\\tskinned += boneMatY * skinVertex * skinWeight.y;\\n\\tskinned += boneMatZ * skinVertex * skinWeight.z;\\n\\tskinned += boneMatW * skinVertex * skinWeight.w;\\n\\ttransformed = ( bindMatrixInverse * skinned ).xyz;\\n#endif\";\n\nvar skinnormal_vertex = \"#ifdef USE_SKINNING\\n\\tmat4 skinMatrix = mat4( 0.0 );\\n\\tskinMatrix += skinWeight.x * boneMatX;\\n\\tskinMatrix += skinWeight.y * boneMatY;\\n\\tskinMatrix += skinWeight.z * boneMatZ;\\n\\tskinMatrix += skinWeight.w * boneMatW;\\n\\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\\n\\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\\n\\t#ifdef USE_TANGENT\\n\\t\\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\\n\\t#endif\\n#endif\";\n\nvar specularmap_fragment = \"float specularStrength;\\n#ifdef USE_SPECULARMAP\\n\\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\\n\\tspecularStrength = texelSpecular.r;\\n#else\\n\\tspecularStrength = 1.0;\\n#endif\";\n\nvar specularmap_pars_fragment = \"#ifdef USE_SPECULARMAP\\n\\tuniform sampler2D specularMap;\\n#endif\";\n\nvar tonemapping_fragment = \"#if defined( TONE_MAPPING )\\n\\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\\n#endif\";\n\nvar tonemapping_pars_fragment = \"#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\nuniform float toneMappingExposure;\\nvec3 LinearToneMapping( vec3 color ) {\\n\\treturn saturate( toneMappingExposure * color );\\n}\\nvec3 ReinhardToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\treturn saturate( color / ( vec3( 1.0 ) + color ) );\\n}\\nvec3 OptimizedCineonToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\tcolor = max( vec3( 0.0 ), color - 0.004 );\\n\\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\\n}\\nvec3 RRTAndODTFit( vec3 v ) {\\n\\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\\n\\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\\n\\treturn a / b;\\n}\\nvec3 ACESFilmicToneMapping( vec3 color ) {\\n\\tconst mat3 ACESInputMat = mat3(\\n\\t\\tvec3( 0.59719, 0.07600, 0.02840 ),\\t\\tvec3( 0.35458, 0.90834, 0.13383 ),\\n\\t\\tvec3( 0.04823, 0.01566, 0.83777 )\\n\\t);\\n\\tconst mat3 ACESOutputMat = mat3(\\n\\t\\tvec3( 1.60475, -0.10208, -0.00327 ),\\t\\tvec3( -0.53108, 1.10813, -0.07276 ),\\n\\t\\tvec3( -0.07367, -0.00605, 1.07602 )\\n\\t);\\n\\tcolor *= toneMappingExposure / 0.6;\\n\\tcolor = ACESInputMat * color;\\n\\tcolor = RRTAndODTFit( color );\\n\\tcolor = ACESOutputMat * color;\\n\\treturn saturate( color );\\n}\\nvec3 CustomToneMapping( vec3 color ) { return color; }\";\n\nvar transmission_fragment = \"#ifdef USE_TRANSMISSION\\n\\tmaterial.transmission = transmission;\\n\\tmaterial.transmissionAlpha = 1.0;\\n\\tmaterial.thickness = thickness;\\n\\tmaterial.attenuationDistance = attenuationDistance;\\n\\tmaterial.attenuationColor = attenuationColor;\\n\\t#ifdef USE_TRANSMISSIONMAP\\n\\t\\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\\n\\t#endif\\n\\t#ifdef USE_THICKNESSMAP\\n\\t\\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\\n\\t#endif\\n\\tvec3 pos = vWorldPosition;\\n\\tvec3 v = normalize( cameraPosition - pos );\\n\\tvec3 n = inverseTransformDirection( normal, viewMatrix );\\n\\tvec4 transmitted = getIBLVolumeRefraction(\\n\\t\\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\\n\\t\\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\\n\\t\\tmaterial.attenuationColor, material.attenuationDistance );\\n\\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\\n\\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\\n#endif\";\n\nvar transmission_pars_fragment = \"#ifdef USE_TRANSMISSION\\n\\tuniform float transmission;\\n\\tuniform float thickness;\\n\\tuniform float attenuationDistance;\\n\\tuniform vec3 attenuationColor;\\n\\t#ifdef USE_TRANSMISSIONMAP\\n\\t\\tuniform sampler2D transmissionMap;\\n\\t#endif\\n\\t#ifdef USE_THICKNESSMAP\\n\\t\\tuniform sampler2D thicknessMap;\\n\\t#endif\\n\\tuniform vec2 transmissionSamplerSize;\\n\\tuniform sampler2D transmissionSamplerMap;\\n\\tuniform mat4 modelMatrix;\\n\\tuniform mat4 projectionMatrix;\\n\\tvarying vec3 vWorldPosition;\\n\\tfloat w0( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\\n\\t}\\n\\tfloat w1( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\\n\\t}\\n\\tfloat w2( float a ){\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\\n\\t}\\n\\tfloat w3( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * a * a );\\n\\t}\\n\\tfloat g0( float a ) {\\n\\t\\treturn w0( a ) + w1( a );\\n\\t}\\n\\tfloat g1( float a ) {\\n\\t\\treturn w2( a ) + w3( a );\\n\\t}\\n\\tfloat h0( float a ) {\\n\\t\\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\\n\\t}\\n\\tfloat h1( float a ) {\\n\\t\\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\\n\\t}\\n\\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\\n\\t\\tuv = uv * texelSize.zw + 0.5;\\n\\t\\tvec2 iuv = floor( uv );\\n\\t\\tvec2 fuv = fract( uv );\\n\\t\\tfloat g0x = g0( fuv.x );\\n\\t\\tfloat g1x = g1( fuv.x );\\n\\t\\tfloat h0x = h0( fuv.x );\\n\\t\\tfloat h1x = h1( fuv.x );\\n\\t\\tfloat h0y = h0( fuv.y );\\n\\t\\tfloat h1y = h1( fuv.y );\\n\\t\\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\\t\\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\\n\\t\\t\\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\\n\\t}\\n\\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\\n\\t\\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\\n\\t\\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\\n\\t\\tvec2 fLodSizeInv = 1.0 / fLodSize;\\n\\t\\tvec2 cLodSizeInv = 1.0 / cLodSize;\\n\\t\\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\\n\\t\\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\\n\\t\\treturn mix( fSample, cSample, fract( lod ) );\\n\\t}\\n\\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\\n\\t\\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\\n\\t\\tvec3 modelScale;\\n\\t\\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\\n\\t\\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\\n\\t\\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\\n\\t\\treturn normalize( refractionVector ) * thickness * modelScale;\\n\\t}\\n\\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\\n\\t\\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\\n\\t}\\n\\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\\n\\t\\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\\n\\t\\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\\n\\t}\\n\\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\\n\\t\\tif ( isinf( attenuationDistance ) ) {\\n\\t\\t\\treturn vec3( 1.0 );\\n\\t\\t} else {\\n\\t\\t\\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\\n\\t\\t\\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\\t\\t\\treturn transmittance;\\n\\t\\t}\\n\\t}\\n\\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\\n\\t\\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\\n\\t\\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\\n\\t\\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\\n\\t\\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\\n\\t\\tvec3 refractedRayExit = position + transmissionRay;\\n\\t\\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\n\\t\\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\n\\t\\trefractionCoords += 1.0;\\n\\t\\trefractionCoords /= 2.0;\\n\\t\\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\\n\\t\\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\\n\\t\\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\\n\\t\\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\\n\\t\\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\\n\\t\\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\\n\\t}\\n#endif\";\n\nvar uv_pars_fragment = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_MAP\\n\\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tvarying vec2 vAnisotropyMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tuniform mat3 transmissionMapTransform;\\n\\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tuniform mat3 thicknessMapTransform;\\n\\tvarying vec2 vThicknessMapUv;\\n#endif\";\n\nvar uv_pars_vertex = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_MAP\\n\\tuniform mat3 mapTransform;\\n\\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tuniform mat3 alphaMapTransform;\\n\\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tuniform mat3 lightMapTransform;\\n\\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\\tuniform mat3 aoMapTransform;\\n\\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tuniform mat3 bumpMapTransform;\\n\\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tuniform mat3 normalMapTransform;\\n\\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\\tuniform mat3 displacementMapTransform;\\n\\tvarying vec2 vDisplacementMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tuniform mat3 emissiveMapTransform;\\n\\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tuniform mat3 metalnessMapTransform;\\n\\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tuniform mat3 roughnessMapTransform;\\n\\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tuniform mat3 anisotropyMapTransform;\\n\\tvarying vec2 vAnisotropyMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tuniform mat3 clearcoatMapTransform;\\n\\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tuniform mat3 clearcoatNormalMapTransform;\\n\\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tuniform mat3 clearcoatRoughnessMapTransform;\\n\\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tuniform mat3 sheenColorMapTransform;\\n\\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tuniform mat3 sheenRoughnessMapTransform;\\n\\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tuniform mat3 iridescenceMapTransform;\\n\\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tuniform mat3 iridescenceThicknessMapTransform;\\n\\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tuniform mat3 specularMapTransform;\\n\\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tuniform mat3 specularColorMapTransform;\\n\\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tuniform mat3 specularIntensityMapTransform;\\n\\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tuniform mat3 transmissionMapTransform;\\n\\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tuniform mat3 thicknessMapTransform;\\n\\tvarying vec2 vThicknessMapUv;\\n#endif\";\n\nvar uv_vertex = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvUv = vec3( uv, 1 ).xy;\\n#endif\\n#ifdef USE_MAP\\n\\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_AOMAP\\n\\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\";\n\nvar worldpos_vertex = \"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\\n\\tvec4 worldPosition = vec4( transformed, 1.0 );\\n\\t#ifdef USE_INSTANCING\\n\\t\\tworldPosition = instanceMatrix * worldPosition;\\n\\t#endif\\n\\tworldPosition = modelMatrix * worldPosition;\\n#endif\";\n\nconst vertex$h = \"varying vec2 vUv;\\nuniform mat3 uvTransform;\\nvoid main() {\\n\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n\\tgl_Position = vec4( position.xy, 1.0, 1.0 );\\n}\";\n\nconst fragment$h = \"uniform sampler2D t2D;\\nuniform float backgroundIntensity;\\nvarying vec2 vUv;\\nvoid main() {\\n\\tvec4 texColor = texture2D( t2D, vUv );\\n\\t#ifdef DECODE_VIDEO_TEXTURE\\n\\t\\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\\n\\t#endif\\n\\ttexColor.rgb *= backgroundIntensity;\\n\\tgl_FragColor = texColor;\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$g = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n\\tgl_Position.z = gl_Position.w;\\n}\";\n\nconst fragment$g = \"#ifdef ENVMAP_TYPE_CUBE\\n\\tuniform samplerCube envMap;\\n#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\tuniform sampler2D envMap;\\n#endif\\nuniform float flipEnvMap;\\nuniform float backgroundBlurriness;\\nuniform float backgroundIntensity;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\\n\\t#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\\n\\t#else\\n\\t\\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\\n\\t#endif\\n\\ttexColor.rgb *= backgroundIntensity;\\n\\tgl_FragColor = texColor;\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$f = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n\\tgl_Position.z = gl_Position.w;\\n}\";\n\nconst fragment$f = \"uniform samplerCube tCube;\\nuniform float tFlip;\\nuniform float opacity;\\nvarying vec3 vWorldDirection;\\nvoid main() {\\n\\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\\n\\tgl_FragColor = texColor;\\n\\tgl_FragColor.a *= opacity;\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$e = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvHighPrecisionZW = gl_Position.zw;\\n}\";\n\nconst fragment$e = \"#if DEPTH_PACKING == 3200\\n\\tuniform float opacity;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#if DEPTH_PACKING == 3200\\n\\t\\tdiffuseColor.a = opacity;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\\n\\t#if DEPTH_PACKING == 3200\\n\\t\\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\\n\\t#elif DEPTH_PACKING == 3201\\n\\t\\tgl_FragColor = packDepthToRGBA( fragCoordZ );\\n\\t#endif\\n}\";\n\nconst vertex$d = \"#define DISTANCE\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvWorldPosition = worldPosition.xyz;\\n}\";\n\nconst fragment$d = \"#define DISTANCE\\nuniform vec3 referencePosition;\\nuniform float nearDistance;\\nuniform float farDistance;\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main () {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tfloat dist = length( vWorldPosition - referencePosition );\\n\\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\\n\\tdist = saturate( dist );\\n\\tgl_FragColor = packDepthToRGBA( dist );\\n}\";\n\nconst vertex$c = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$c = \"uniform sampler2D tEquirect;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvec3 direction = normalize( vWorldDirection );\\n\\tvec2 sampleUV = equirectUv( direction );\\n\\tgl_FragColor = texture2D( tEquirect, sampleUV );\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$b = \"uniform float scale;\\nattribute float lineDistance;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvLineDistance = scale * lineDistance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$b = \"uniform vec3 diffuse;\\nuniform float opacity;\\nuniform float dashSize;\\nuniform float totalSize;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\\n\\t\\tdiscard;\\n\\t}\\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$a = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$a = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\t#ifdef USE_LIGHTMAP\\n\\t\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\t\\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\\n\\t#else\\n\\t\\treflectedLight.indirectDiffuse += vec3( 1.0 );\\n\\t#endif\\n\\t#include \\n\\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\\n\\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$9 = \"#define LAMBERT\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$9 = \"#define LAMBERT\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$8 = \"#define MATCAP\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n}\";\n\nconst fragment$8 = \"#define MATCAP\\nuniform vec3 diffuse;\\nuniform float opacity;\\nuniform sampler2D matcap;\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 viewDir = normalize( vViewPosition );\\n\\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\\n\\tvec3 y = cross( viewDir, x );\\n\\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\\n\\t#ifdef USE_MATCAP\\n\\t\\tvec4 matcapColor = texture2D( matcap, uv );\\n\\t#else\\n\\t\\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\\n\\t#endif\\n\\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$7 = \"#define NORMAL\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvarying vec3 vViewPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvViewPosition = - mvPosition.xyz;\\n#endif\\n}\";\n\nconst fragment$7 = \"#define NORMAL\\nuniform float opacity;\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvarying vec3 vViewPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\\n\\t#ifdef OPAQUE\\n\\t\\tgl_FragColor.a = 1.0;\\n\\t#endif\\n}\";\n\nconst vertex$6 = \"#define PHONG\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$6 = \"#define PHONG\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform vec3 specular;\\nuniform float shininess;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$5 = \"#define STANDARD\\nvarying vec3 vViewPosition;\\n#ifdef USE_TRANSMISSION\\n\\tvarying vec3 vWorldPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n#ifdef USE_TRANSMISSION\\n\\tvWorldPosition = worldPosition.xyz;\\n#endif\\n}\";\n\nconst fragment$5 = \"#define STANDARD\\n#ifdef PHYSICAL\\n\\t#define IOR\\n\\t#define USE_SPECULAR\\n#endif\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float roughness;\\nuniform float metalness;\\nuniform float opacity;\\n#ifdef IOR\\n\\tuniform float ior;\\n#endif\\n#ifdef USE_SPECULAR\\n\\tuniform float specularIntensity;\\n\\tuniform vec3 specularColor;\\n\\t#ifdef USE_SPECULAR_COLORMAP\\n\\t\\tuniform sampler2D specularColorMap;\\n\\t#endif\\n\\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\\t\\tuniform sampler2D specularIntensityMap;\\n\\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tuniform float clearcoat;\\n\\tuniform float clearcoatRoughness;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tuniform float iridescence;\\n\\tuniform float iridescenceIOR;\\n\\tuniform float iridescenceThicknessMinimum;\\n\\tuniform float iridescenceThicknessMaximum;\\n#endif\\n#ifdef USE_SHEEN\\n\\tuniform vec3 sheenColor;\\n\\tuniform float sheenRoughness;\\n\\t#ifdef USE_SHEEN_COLORMAP\\n\\t\\tuniform sampler2D sheenColorMap;\\n\\t#endif\\n\\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\t\\tuniform sampler2D sheenRoughnessMap;\\n\\t#endif\\n#endif\\n#ifdef USE_ANISOTROPY\\n\\tuniform vec2 anisotropyVector;\\n\\t#ifdef USE_ANISOTROPYMAP\\n\\t\\tuniform sampler2D anisotropyMap;\\n\\t#endif\\n#endif\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\\n\\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\\n\\t#include \\n\\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\\n\\t#ifdef USE_SHEEN\\n\\t\\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\\n\\t\\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\\n\\t\\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\\n\\t\\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$4 = \"#define TOON\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$4 = \"#define TOON\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$3 = \"uniform float size;\\nuniform float scale;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#ifdef USE_POINTS_UV\\n\\tvarying vec2 vUv;\\n\\tuniform mat3 uvTransform;\\n#endif\\nvoid main() {\\n\\t#ifdef USE_POINTS_UV\\n\\t\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tgl_PointSize = size;\\n\\t#ifdef USE_SIZEATTENUATION\\n\\t\\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\\n\\t\\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$3 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$2 = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$2 = \"uniform vec3 color;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$1 = \"uniform float rotation;\\nuniform vec2 center;\\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\\n\\tvec2 scale;\\n\\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\\n\\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\\n\\t#ifndef USE_SIZEATTENUATION\\n\\t\\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\\n\\t\\tif ( isPerspective ) scale *= - mvPosition.z;\\n\\t#endif\\n\\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\\n\\tvec2 rotatedPosition;\\n\\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\\n\\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\\n\\tmvPosition.xy += rotatedPosition;\\n\\tgl_Position = projectionMatrix * mvPosition;\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$1 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst ShaderChunk = {\n\talphahash_fragment: alphahash_fragment,\n\talphahash_pars_fragment: alphahash_pars_fragment,\n\talphamap_fragment: alphamap_fragment,\n\talphamap_pars_fragment: alphamap_pars_fragment,\n\talphatest_fragment: alphatest_fragment,\n\talphatest_pars_fragment: alphatest_pars_fragment,\n\taomap_fragment: aomap_fragment,\n\taomap_pars_fragment: aomap_pars_fragment,\n\tbegin_vertex: begin_vertex,\n\tbeginnormal_vertex: beginnormal_vertex,\n\tbsdfs: bsdfs,\n\tiridescence_fragment: iridescence_fragment,\n\tbumpmap_pars_fragment: bumpmap_pars_fragment,\n\tclipping_planes_fragment: clipping_planes_fragment,\n\tclipping_planes_pars_fragment: clipping_planes_pars_fragment,\n\tclipping_planes_pars_vertex: clipping_planes_pars_vertex,\n\tclipping_planes_vertex: clipping_planes_vertex,\n\tcolor_fragment: color_fragment,\n\tcolor_pars_fragment: color_pars_fragment,\n\tcolor_pars_vertex: color_pars_vertex,\n\tcolor_vertex: color_vertex,\n\tcommon: common,\n\tcube_uv_reflection_fragment: cube_uv_reflection_fragment,\n\tdefaultnormal_vertex: defaultnormal_vertex,\n\tdisplacementmap_pars_vertex: displacementmap_pars_vertex,\n\tdisplacementmap_vertex: displacementmap_vertex,\n\temissivemap_fragment: emissivemap_fragment,\n\temissivemap_pars_fragment: emissivemap_pars_fragment,\n\tcolorspace_fragment: colorspace_fragment,\n\tcolorspace_pars_fragment: colorspace_pars_fragment,\n\tenvmap_fragment: envmap_fragment,\n\tenvmap_common_pars_fragment: envmap_common_pars_fragment,\n\tenvmap_pars_fragment: envmap_pars_fragment,\n\tenvmap_pars_vertex: envmap_pars_vertex,\n\tenvmap_physical_pars_fragment: envmap_physical_pars_fragment,\n\tenvmap_vertex: envmap_vertex,\n\tfog_vertex: fog_vertex,\n\tfog_pars_vertex: fog_pars_vertex,\n\tfog_fragment: fog_fragment,\n\tfog_pars_fragment: fog_pars_fragment,\n\tgradientmap_pars_fragment: gradientmap_pars_fragment,\n\tlightmap_fragment: lightmap_fragment,\n\tlightmap_pars_fragment: lightmap_pars_fragment,\n\tlights_lambert_fragment: lights_lambert_fragment,\n\tlights_lambert_pars_fragment: lights_lambert_pars_fragment,\n\tlights_pars_begin: lights_pars_begin,\n\tlights_toon_fragment: lights_toon_fragment,\n\tlights_toon_pars_fragment: lights_toon_pars_fragment,\n\tlights_phong_fragment: lights_phong_fragment,\n\tlights_phong_pars_fragment: lights_phong_pars_fragment,\n\tlights_physical_fragment: lights_physical_fragment,\n\tlights_physical_pars_fragment: lights_physical_pars_fragment,\n\tlights_fragment_begin: lights_fragment_begin,\n\tlights_fragment_maps: lights_fragment_maps,\n\tlights_fragment_end: lights_fragment_end,\n\tlogdepthbuf_fragment: logdepthbuf_fragment,\n\tlogdepthbuf_pars_fragment: logdepthbuf_pars_fragment,\n\tlogdepthbuf_pars_vertex: logdepthbuf_pars_vertex,\n\tlogdepthbuf_vertex: logdepthbuf_vertex,\n\tmap_fragment: map_fragment,\n\tmap_pars_fragment: map_pars_fragment,\n\tmap_particle_fragment: map_particle_fragment,\n\tmap_particle_pars_fragment: map_particle_pars_fragment,\n\tmetalnessmap_fragment: metalnessmap_fragment,\n\tmetalnessmap_pars_fragment: metalnessmap_pars_fragment,\n\tmorphcolor_vertex: morphcolor_vertex,\n\tmorphnormal_vertex: morphnormal_vertex,\n\tmorphtarget_pars_vertex: morphtarget_pars_vertex,\n\tmorphtarget_vertex: morphtarget_vertex,\n\tnormal_fragment_begin: normal_fragment_begin,\n\tnormal_fragment_maps: normal_fragment_maps,\n\tnormal_pars_fragment: normal_pars_fragment,\n\tnormal_pars_vertex: normal_pars_vertex,\n\tnormal_vertex: normal_vertex,\n\tnormalmap_pars_fragment: normalmap_pars_fragment,\n\tclearcoat_normal_fragment_begin: clearcoat_normal_fragment_begin,\n\tclearcoat_normal_fragment_maps: clearcoat_normal_fragment_maps,\n\tclearcoat_pars_fragment: clearcoat_pars_fragment,\n\tiridescence_pars_fragment: iridescence_pars_fragment,\n\topaque_fragment: opaque_fragment,\n\tpacking: packing,\n\tpremultiplied_alpha_fragment: premultiplied_alpha_fragment,\n\tproject_vertex: project_vertex,\n\tdithering_fragment: dithering_fragment,\n\tdithering_pars_fragment: dithering_pars_fragment,\n\troughnessmap_fragment: roughnessmap_fragment,\n\troughnessmap_pars_fragment: roughnessmap_pars_fragment,\n\tshadowmap_pars_fragment: shadowmap_pars_fragment,\n\tshadowmap_pars_vertex: shadowmap_pars_vertex,\n\tshadowmap_vertex: shadowmap_vertex,\n\tshadowmask_pars_fragment: shadowmask_pars_fragment,\n\tskinbase_vertex: skinbase_vertex,\n\tskinning_pars_vertex: skinning_pars_vertex,\n\tskinning_vertex: skinning_vertex,\n\tskinnormal_vertex: skinnormal_vertex,\n\tspecularmap_fragment: specularmap_fragment,\n\tspecularmap_pars_fragment: specularmap_pars_fragment,\n\ttonemapping_fragment: tonemapping_fragment,\n\ttonemapping_pars_fragment: tonemapping_pars_fragment,\n\ttransmission_fragment: transmission_fragment,\n\ttransmission_pars_fragment: transmission_pars_fragment,\n\tuv_pars_fragment: uv_pars_fragment,\n\tuv_pars_vertex: uv_pars_vertex,\n\tuv_vertex: uv_vertex,\n\tworldpos_vertex: worldpos_vertex,\n\n\tbackground_vert: vertex$h,\n\tbackground_frag: fragment$h,\n\tbackgroundCube_vert: vertex$g,\n\tbackgroundCube_frag: fragment$g,\n\tcube_vert: vertex$f,\n\tcube_frag: fragment$f,\n\tdepth_vert: vertex$e,\n\tdepth_frag: fragment$e,\n\tdistanceRGBA_vert: vertex$d,\n\tdistanceRGBA_frag: fragment$d,\n\tequirect_vert: vertex$c,\n\tequirect_frag: fragment$c,\n\tlinedashed_vert: vertex$b,\n\tlinedashed_frag: fragment$b,\n\tmeshbasic_vert: vertex$a,\n\tmeshbasic_frag: fragment$a,\n\tmeshlambert_vert: vertex$9,\n\tmeshlambert_frag: fragment$9,\n\tmeshmatcap_vert: vertex$8,\n\tmeshmatcap_frag: fragment$8,\n\tmeshnormal_vert: vertex$7,\n\tmeshnormal_frag: fragment$7,\n\tmeshphong_vert: vertex$6,\n\tmeshphong_frag: fragment$6,\n\tmeshphysical_vert: vertex$5,\n\tmeshphysical_frag: fragment$5,\n\tmeshtoon_vert: vertex$4,\n\tmeshtoon_frag: fragment$4,\n\tpoints_vert: vertex$3,\n\tpoints_frag: fragment$3,\n\tshadow_vert: vertex$2,\n\tshadow_frag: fragment$2,\n\tsprite_vert: vertex$1,\n\tsprite_frag: fragment$1\n};\n\n/**\n * Uniforms library for shared webgl shaders\n */\n\nconst UniformsLib = {\n\n\tcommon: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\n\t\tmap: { value: null },\n\t\tmapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\n\t\talphaTest: { value: 0 }\n\n\t},\n\n\tspecularmap: {\n\n\t\tspecularMap: { value: null },\n\t\tspecularMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tenvmap: {\n\n\t\tenvMap: { value: null },\n\t\tflipEnvMap: { value: - 1 },\n\t\treflectivity: { value: 1.0 }, // basic, lambert, phong\n\t\tior: { value: 1.5 }, // physical\n\t\trefractionRatio: { value: 0.98 }, // basic, lambert, phong\n\n\t},\n\n\taomap: {\n\n\t\taoMap: { value: null },\n\t\taoMapIntensity: { value: 1 },\n\t\taoMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tlightmap: {\n\n\t\tlightMap: { value: null },\n\t\tlightMapIntensity: { value: 1 },\n\t\tlightMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tbumpmap: {\n\n\t\tbumpMap: { value: null },\n\t\tbumpMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tbumpScale: { value: 1 }\n\n\t},\n\n\tnormalmap: {\n\n\t\tnormalMap: { value: null },\n\t\tnormalMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tnormalScale: { value: /*@__PURE__*/ new Vector2( 1, 1 ) }\n\n\t},\n\n\tdisplacementmap: {\n\n\t\tdisplacementMap: { value: null },\n\t\tdisplacementMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tdisplacementScale: { value: 1 },\n\t\tdisplacementBias: { value: 0 }\n\n\t},\n\n\temissivemap: {\n\n\t\temissiveMap: { value: null },\n\t\temissiveMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tmetalnessmap: {\n\n\t\tmetalnessMap: { value: null },\n\t\tmetalnessMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\troughnessmap: {\n\n\t\troughnessMap: { value: null },\n\t\troughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tgradientmap: {\n\n\t\tgradientMap: { value: null }\n\n\t},\n\n\tfog: {\n\n\t\tfogDensity: { value: 0.00025 },\n\t\tfogNear: { value: 1 },\n\t\tfogFar: { value: 2000 },\n\t\tfogColor: { value: /*@__PURE__*/ new Color( 0xffffff ) }\n\n\t},\n\n\tlights: {\n\n\t\tambientLightColor: { value: [] },\n\n\t\tlightProbe: { value: [] },\n\n\t\tdirectionalLights: { value: [], properties: {\n\t\t\tdirection: {},\n\t\t\tcolor: {}\n\t\t} },\n\n\t\tdirectionalLightShadows: { value: [], properties: {\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {}\n\t\t} },\n\n\t\tdirectionalShadowMap: { value: [] },\n\t\tdirectionalShadowMatrix: { value: [] },\n\n\t\tspotLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\tdirection: {},\n\t\t\tdistance: {},\n\t\t\tconeCos: {},\n\t\t\tpenumbraCos: {},\n\t\t\tdecay: {}\n\t\t} },\n\n\t\tspotLightShadows: { value: [], properties: {\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {}\n\t\t} },\n\n\t\tspotLightMap: { value: [] },\n\t\tspotShadowMap: { value: [] },\n\t\tspotLightMatrix: { value: [] },\n\n\t\tpointLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\tdecay: {},\n\t\t\tdistance: {}\n\t\t} },\n\n\t\tpointLightShadows: { value: [], properties: {\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {},\n\t\t\tshadowCameraNear: {},\n\t\t\tshadowCameraFar: {}\n\t\t} },\n\n\t\tpointShadowMap: { value: [] },\n\t\tpointShadowMatrix: { value: [] },\n\n\t\themisphereLights: { value: [], properties: {\n\t\t\tdirection: {},\n\t\t\tskyColor: {},\n\t\t\tgroundColor: {}\n\t\t} },\n\n\t\t// TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src\n\t\trectAreaLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\twidth: {},\n\t\t\theight: {}\n\t\t} },\n\n\t\tltc_1: { value: null },\n\t\tltc_2: { value: null }\n\n\t},\n\n\tpoints: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\t\tsize: { value: 1.0 },\n\t\tscale: { value: 1.0 },\n\t\tmap: { value: null },\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaTest: { value: 0 },\n\t\tuvTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tsprite: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\t\tcenter: { value: /*@__PURE__*/ new Vector2( 0.5, 0.5 ) },\n\t\trotation: { value: 0.0 },\n\t\tmap: { value: null },\n\t\tmapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaTest: { value: 0 }\n\n\t}\n\n};\n\nconst ShaderLib = {\n\n\tbasic: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshbasic_vert,\n\t\tfragmentShader: ShaderChunk.meshbasic_frag\n\n\t},\n\n\tlambert: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshlambert_vert,\n\t\tfragmentShader: ShaderChunk.meshlambert_frag\n\n\t},\n\n\tphong: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\t\tspecular: { value: /*@__PURE__*/ new Color( 0x111111 ) },\n\t\t\t\tshininess: { value: 30 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshphong_vert,\n\t\tfragmentShader: ShaderChunk.meshphong_frag\n\n\t},\n\n\tstandard: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.roughnessmap,\n\t\t\tUniformsLib.metalnessmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\t\troughness: { value: 1.0 },\n\t\t\t\tmetalness: { value: 0.0 },\n\t\t\t\tenvMapIntensity: { value: 1 } // temporary\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshphysical_vert,\n\t\tfragmentShader: ShaderChunk.meshphysical_frag\n\n\t},\n\n\ttoon: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.gradientmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshtoon_vert,\n\t\tfragmentShader: ShaderChunk.meshtoon_frag\n\n\t},\n\n\tmatcap: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tmatcap: { value: null }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshmatcap_vert,\n\t\tfragmentShader: ShaderChunk.meshmatcap_frag\n\n\t},\n\n\tpoints: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.points,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.points_vert,\n\t\tfragmentShader: ShaderChunk.points_frag\n\n\t},\n\n\tdashed: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tscale: { value: 1 },\n\t\t\t\tdashSize: { value: 1 },\n\t\t\t\ttotalSize: { value: 2 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.linedashed_vert,\n\t\tfragmentShader: ShaderChunk.linedashed_frag\n\n\t},\n\n\tdepth: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.displacementmap\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.depth_vert,\n\t\tfragmentShader: ShaderChunk.depth_frag\n\n\t},\n\n\tnormal: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\t{\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshnormal_vert,\n\t\tfragmentShader: ShaderChunk.meshnormal_frag\n\n\t},\n\n\tsprite: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.sprite,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.sprite_vert,\n\t\tfragmentShader: ShaderChunk.sprite_frag\n\n\t},\n\n\tbackground: {\n\n\t\tuniforms: {\n\t\t\tuvTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tt2D: { value: null },\n\t\t\tbackgroundIntensity: { value: 1 }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.background_vert,\n\t\tfragmentShader: ShaderChunk.background_frag\n\n\t},\n\n\tbackgroundCube: {\n\n\t\tuniforms: {\n\t\t\tenvMap: { value: null },\n\t\t\tflipEnvMap: { value: - 1 },\n\t\t\tbackgroundBlurriness: { value: 0 },\n\t\t\tbackgroundIntensity: { value: 1 }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.backgroundCube_vert,\n\t\tfragmentShader: ShaderChunk.backgroundCube_frag\n\n\t},\n\n\tcube: {\n\n\t\tuniforms: {\n\t\t\ttCube: { value: null },\n\t\t\ttFlip: { value: - 1 },\n\t\t\topacity: { value: 1.0 }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.cube_vert,\n\t\tfragmentShader: ShaderChunk.cube_frag\n\n\t},\n\n\tequirect: {\n\n\t\tuniforms: {\n\t\t\ttEquirect: { value: null },\n\t\t},\n\n\t\tvertexShader: ShaderChunk.equirect_vert,\n\t\tfragmentShader: ShaderChunk.equirect_frag\n\n\t},\n\n\tdistanceRGBA: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.displacementmap,\n\t\t\t{\n\t\t\t\treferencePosition: { value: /*@__PURE__*/ new Vector3() },\n\t\t\t\tnearDistance: { value: 1 },\n\t\t\t\tfarDistance: { value: 1000 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.distanceRGBA_vert,\n\t\tfragmentShader: ShaderChunk.distanceRGBA_frag\n\n\t},\n\n\tshadow: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.lights,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tcolor: { value: /*@__PURE__*/ new Color( 0x00000 ) },\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t},\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.shadow_vert,\n\t\tfragmentShader: ShaderChunk.shadow_frag\n\n\t}\n\n};\n\nShaderLib.physical = {\n\n\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\tShaderLib.standard.uniforms,\n\t\t{\n\t\t\tclearcoat: { value: 0 },\n\t\t\tclearcoatMap: { value: null },\n\t\t\tclearcoatMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tclearcoatNormalMap: { value: null },\n\t\t\tclearcoatNormalMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tclearcoatNormalScale: { value: /*@__PURE__*/ new Vector2( 1, 1 ) },\n\t\t\tclearcoatRoughness: { value: 0 },\n\t\t\tclearcoatRoughnessMap: { value: null },\n\t\t\tclearcoatRoughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tiridescence: { value: 0 },\n\t\t\tiridescenceMap: { value: null },\n\t\t\tiridescenceMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tiridescenceIOR: { value: 1.3 },\n\t\t\tiridescenceThicknessMinimum: { value: 100 },\n\t\t\tiridescenceThicknessMaximum: { value: 400 },\n\t\t\tiridescenceThicknessMap: { value: null },\n\t\t\tiridescenceThicknessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tsheen: { value: 0 },\n\t\t\tsheenColor: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\tsheenColorMap: { value: null },\n\t\t\tsheenColorMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tsheenRoughness: { value: 1 },\n\t\t\tsheenRoughnessMap: { value: null },\n\t\t\tsheenRoughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\ttransmission: { value: 0 },\n\t\t\ttransmissionMap: { value: null },\n\t\t\ttransmissionMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\ttransmissionSamplerSize: { value: /*@__PURE__*/ new Vector2() },\n\t\t\ttransmissionSamplerMap: { value: null },\n\t\t\tthickness: { value: 0 },\n\t\t\tthicknessMap: { value: null },\n\t\t\tthicknessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tattenuationDistance: { value: 0 },\n\t\t\tattenuationColor: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\tspecularColor: { value: /*@__PURE__*/ new Color( 1, 1, 1 ) },\n\t\t\tspecularColorMap: { value: null },\n\t\t\tspecularColorMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tspecularIntensity: { value: 1 },\n\t\t\tspecularIntensityMap: { value: null },\n\t\t\tspecularIntensityMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tanisotropyVector: { value: /*@__PURE__*/ new Vector2() },\n\t\t\tanisotropyMap: { value: null },\n\t\t\tanisotropyMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t}\n\t] ),\n\n\tvertexShader: ShaderChunk.meshphysical_vert,\n\tfragmentShader: ShaderChunk.meshphysical_frag\n\n};\n\nconst _rgb = { r: 0, b: 0, g: 0 };\n\nfunction WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha ) {\n\n\tconst clearColor = new Color( 0x000000 );\n\tlet clearAlpha = alpha === true ? 0 : 1;\n\n\tlet planeMesh;\n\tlet boxMesh;\n\n\tlet currentBackground = null;\n\tlet currentBackgroundVersion = 0;\n\tlet currentTonemapping = null;\n\n\tfunction render( renderList, scene ) {\n\n\t\tlet forceClear = false;\n\t\tlet background = scene.isScene === true ? scene.background : null;\n\n\t\tif ( background && background.isTexture ) {\n\n\t\t\tconst usePMREM = scene.backgroundBlurriness > 0; // use PMREM if the user wants to blur the background\n\t\t\tbackground = ( usePMREM ? cubeuvmaps : cubemaps ).get( background );\n\n\t\t}\n\n\t\tif ( background === null ) {\n\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t} else if ( background && background.isColor ) {\n\n\t\t\tsetClear( background, 1 );\n\t\t\tforceClear = true;\n\n\t\t}\n\n\t\tconst environmentBlendMode = renderer.xr.getEnvironmentBlendMode();\n\n\t\tif ( environmentBlendMode === 'additive' ) {\n\n\t\t\tstate.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );\n\n\t\t} else if ( environmentBlendMode === 'alpha-blend' ) {\n\n\t\t\tstate.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );\n\n\t\t}\n\n\t\tif ( renderer.autoClear || forceClear ) {\n\n\t\t\trenderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );\n\n\t\t}\n\n\t\tif ( background && ( background.isCubeTexture || background.mapping === CubeUVReflectionMapping ) ) {\n\n\t\t\tif ( boxMesh === undefined ) {\n\n\t\t\t\tboxMesh = new Mesh(\n\t\t\t\t\tnew BoxGeometry( 1, 1, 1 ),\n\t\t\t\t\tnew ShaderMaterial( {\n\t\t\t\t\t\tname: 'BackgroundCubeMaterial',\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.backgroundCube.uniforms ),\n\t\t\t\t\t\tvertexShader: ShaderLib.backgroundCube.vertexShader,\n\t\t\t\t\t\tfragmentShader: ShaderLib.backgroundCube.fragmentShader,\n\t\t\t\t\t\tside: BackSide,\n\t\t\t\t\t\tdepthTest: false,\n\t\t\t\t\t\tdepthWrite: false,\n\t\t\t\t\t\tfog: false\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'normal' );\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'uv' );\n\n\t\t\t\tboxMesh.onBeforeRender = function ( renderer, scene, camera ) {\n\n\t\t\t\t\tthis.matrixWorld.copyPosition( camera.matrixWorld );\n\n\t\t\t\t};\n\n\t\t\t\t// add \"envMap\" material property so the renderer can evaluate it like for built-in materials\n\t\t\t\tObject.defineProperty( boxMesh.material, 'envMap', {\n\n\t\t\t\t\tget: function () {\n\n\t\t\t\t\t\treturn this.uniforms.envMap.value;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\tobjects.update( boxMesh );\n\n\t\t\t}\n\n\t\t\tboxMesh.material.uniforms.envMap.value = background;\n\t\t\tboxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;\n\t\t\tboxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;\n\t\t\tboxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n\t\t\tboxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;\n\n\t\t\tif ( currentBackground !== background ||\n\t\t\t\tcurrentBackgroundVersion !== background.version ||\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\n\n\t\t\t\tboxMesh.material.needsUpdate = true;\n\n\t\t\t\tcurrentBackground = background;\n\t\t\t\tcurrentBackgroundVersion = background.version;\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t\tboxMesh.layers.enableAll();\n\n\t\t\t// push to the pre-sorted opaque render list\n\t\t\trenderList.unshift( boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null );\n\n\t\t} else if ( background && background.isTexture ) {\n\n\t\t\tif ( planeMesh === undefined ) {\n\n\t\t\t\tplaneMesh = new Mesh(\n\t\t\t\t\tnew PlaneGeometry( 2, 2 ),\n\t\t\t\t\tnew ShaderMaterial( {\n\t\t\t\t\t\tname: 'BackgroundMaterial',\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.background.uniforms ),\n\t\t\t\t\t\tvertexShader: ShaderLib.background.vertexShader,\n\t\t\t\t\t\tfragmentShader: ShaderLib.background.fragmentShader,\n\t\t\t\t\t\tside: FrontSide,\n\t\t\t\t\t\tdepthTest: false,\n\t\t\t\t\t\tdepthWrite: false,\n\t\t\t\t\t\tfog: false\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tplaneMesh.geometry.deleteAttribute( 'normal' );\n\n\t\t\t\t// add \"map\" material property so the renderer can evaluate it like for built-in materials\n\t\t\t\tObject.defineProperty( planeMesh.material, 'map', {\n\n\t\t\t\t\tget: function () {\n\n\t\t\t\t\t\treturn this.uniforms.t2D.value;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\tobjects.update( planeMesh );\n\n\t\t\t}\n\n\t\t\tplaneMesh.material.uniforms.t2D.value = background;\n\t\t\tplaneMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n\t\t\tplaneMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;\n\n\t\t\tif ( background.matrixAutoUpdate === true ) {\n\n\t\t\t\tbackground.updateMatrix();\n\n\t\t\t}\n\n\t\t\tplaneMesh.material.uniforms.uvTransform.value.copy( background.matrix );\n\n\t\t\tif ( currentBackground !== background ||\n\t\t\t\tcurrentBackgroundVersion !== background.version ||\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\n\n\t\t\t\tplaneMesh.material.needsUpdate = true;\n\n\t\t\t\tcurrentBackground = background;\n\t\t\t\tcurrentBackgroundVersion = background.version;\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t\tplaneMesh.layers.enableAll();\n\n\t\t\t// push to the pre-sorted opaque render list\n\t\t\trenderList.unshift( planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null );\n\n\t\t}\n\n\t}\n\n\tfunction setClear( color, alpha ) {\n\n\t\tcolor.getRGB( _rgb, getUnlitUniformColorSpace( renderer ) );\n\n\t\tstate.buffers.color.setClear( _rgb.r, _rgb.g, _rgb.b, alpha, premultipliedAlpha );\n\n\t}\n\n\treturn {\n\n\t\tgetClearColor: function () {\n\n\t\t\treturn clearColor;\n\n\t\t},\n\t\tsetClearColor: function ( color, alpha = 1 ) {\n\n\t\t\tclearColor.set( color );\n\t\t\tclearAlpha = alpha;\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t},\n\t\tgetClearAlpha: function () {\n\n\t\t\treturn clearAlpha;\n\n\t\t},\n\t\tsetClearAlpha: function ( alpha ) {\n\n\t\t\tclearAlpha = alpha;\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t},\n\t\trender: render\n\n\t};\n\n}\n\nfunction WebGLBindingStates( gl, extensions, attributes, capabilities ) {\n\n\tconst maxVertexAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );\n\n\tconst extension = capabilities.isWebGL2 ? null : extensions.get( 'OES_vertex_array_object' );\n\tconst vaoAvailable = capabilities.isWebGL2 || extension !== null;\n\n\tconst bindingStates = {};\n\n\tconst defaultState = createBindingState( null );\n\tlet currentState = defaultState;\n\tlet forceUpdate = false;\n\n\tfunction setup( object, material, program, geometry, index ) {\n\n\t\tlet updateBuffers = false;\n\n\t\tif ( vaoAvailable ) {\n\n\t\t\tconst state = getBindingState( geometry, program, material );\n\n\t\t\tif ( currentState !== state ) {\n\n\t\t\t\tcurrentState = state;\n\t\t\t\tbindVertexArrayObject( currentState.object );\n\n\t\t\t}\n\n\t\t\tupdateBuffers = needsUpdate( object, geometry, program, index );\n\n\t\t\tif ( updateBuffers ) saveCache( object, geometry, program, index );\n\n\t\t} else {\n\n\t\t\tconst wireframe = ( material.wireframe === true );\n\n\t\t\tif ( currentState.geometry !== geometry.id ||\n\t\t\t\tcurrentState.program !== program.id ||\n\t\t\t\tcurrentState.wireframe !== wireframe ) {\n\n\t\t\t\tcurrentState.geometry = geometry.id;\n\t\t\t\tcurrentState.program = program.id;\n\t\t\t\tcurrentState.wireframe = wireframe;\n\n\t\t\t\tupdateBuffers = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( index !== null ) {\n\n\t\t\tattributes.update( index, gl.ELEMENT_ARRAY_BUFFER );\n\n\t\t}\n\n\t\tif ( updateBuffers || forceUpdate ) {\n\n\t\t\tforceUpdate = false;\n\n\t\t\tsetupVertexAttributes( object, material, program, geometry );\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tgl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, attributes.get( index ).buffer );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction createVertexArrayObject() {\n\n\t\tif ( capabilities.isWebGL2 ) return gl.createVertexArray();\n\n\t\treturn extension.createVertexArrayOES();\n\n\t}\n\n\tfunction bindVertexArrayObject( vao ) {\n\n\t\tif ( capabilities.isWebGL2 ) return gl.bindVertexArray( vao );\n\n\t\treturn extension.bindVertexArrayOES( vao );\n\n\t}\n\n\tfunction deleteVertexArrayObject( vao ) {\n\n\t\tif ( capabilities.isWebGL2 ) return gl.deleteVertexArray( vao );\n\n\t\treturn extension.deleteVertexArrayOES( vao );\n\n\t}\n\n\tfunction getBindingState( geometry, program, material ) {\n\n\t\tconst wireframe = ( material.wireframe === true );\n\n\t\tlet programMap = bindingStates[ geometry.id ];\n\n\t\tif ( programMap === undefined ) {\n\n\t\t\tprogramMap = {};\n\t\t\tbindingStates[ geometry.id ] = programMap;\n\n\t\t}\n\n\t\tlet stateMap = programMap[ program.id ];\n\n\t\tif ( stateMap === undefined ) {\n\n\t\t\tstateMap = {};\n\t\t\tprogramMap[ program.id ] = stateMap;\n\n\t\t}\n\n\t\tlet state = stateMap[ wireframe ];\n\n\t\tif ( state === undefined ) {\n\n\t\t\tstate = createBindingState( createVertexArrayObject() );\n\t\t\tstateMap[ wireframe ] = state;\n\n\t\t}\n\n\t\treturn state;\n\n\t}\n\n\tfunction createBindingState( vao ) {\n\n\t\tconst newAttributes = [];\n\t\tconst enabledAttributes = [];\n\t\tconst attributeDivisors = [];\n\n\t\tfor ( let i = 0; i < maxVertexAttributes; i ++ ) {\n\n\t\t\tnewAttributes[ i ] = 0;\n\t\t\tenabledAttributes[ i ] = 0;\n\t\t\tattributeDivisors[ i ] = 0;\n\n\t\t}\n\n\t\treturn {\n\n\t\t\t// for backward compatibility on non-VAO support browser\n\t\t\tgeometry: null,\n\t\t\tprogram: null,\n\t\t\twireframe: false,\n\n\t\t\tnewAttributes: newAttributes,\n\t\t\tenabledAttributes: enabledAttributes,\n\t\t\tattributeDivisors: attributeDivisors,\n\t\t\tobject: vao,\n\t\t\tattributes: {},\n\t\t\tindex: null\n\n\t\t};\n\n\t}\n\n\tfunction needsUpdate( object, geometry, program, index ) {\n\n\t\tconst cachedAttributes = currentState.attributes;\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\tlet attributesNum = 0;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tconst cachedAttribute = cachedAttributes[ name ];\n\t\t\t\tlet geometryAttribute = geometryAttributes[ name ];\n\n\t\t\t\tif ( geometryAttribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) geometryAttribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) geometryAttribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tif ( cachedAttribute === undefined ) return true;\n\n\t\t\t\tif ( cachedAttribute.attribute !== geometryAttribute ) return true;\n\n\t\t\t\tif ( geometryAttribute && cachedAttribute.data !== geometryAttribute.data ) return true;\n\n\t\t\t\tattributesNum ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( currentState.attributesNum !== attributesNum ) return true;\n\n\t\tif ( currentState.index !== index ) return true;\n\n\t\treturn false;\n\n\t}\n\n\tfunction saveCache( object, geometry, program, index ) {\n\n\t\tconst cache = {};\n\t\tconst attributes = geometry.attributes;\n\t\tlet attributesNum = 0;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tlet attribute = attributes[ name ];\n\n\t\t\t\tif ( attribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) attribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) attribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tconst data = {};\n\t\t\t\tdata.attribute = attribute;\n\n\t\t\t\tif ( attribute && attribute.data ) {\n\n\t\t\t\t\tdata.data = attribute.data;\n\n\t\t\t\t}\n\n\t\t\t\tcache[ name ] = data;\n\n\t\t\t\tattributesNum ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tcurrentState.attributes = cache;\n\t\tcurrentState.attributesNum = attributesNum;\n\n\t\tcurrentState.index = index;\n\n\t}\n\n\tfunction initAttributes() {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\n\t\tfor ( let i = 0, il = newAttributes.length; i < il; i ++ ) {\n\n\t\t\tnewAttributes[ i ] = 0;\n\n\t\t}\n\n\t}\n\n\tfunction enableAttribute( attribute ) {\n\n\t\tenableAttributeAndDivisor( attribute, 0 );\n\n\t}\n\n\tfunction enableAttributeAndDivisor( attribute, meshPerAttribute ) {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\t\tconst enabledAttributes = currentState.enabledAttributes;\n\t\tconst attributeDivisors = currentState.attributeDivisors;\n\n\t\tnewAttributes[ attribute ] = 1;\n\n\t\tif ( enabledAttributes[ attribute ] === 0 ) {\n\n\t\t\tgl.enableVertexAttribArray( attribute );\n\t\t\tenabledAttributes[ attribute ] = 1;\n\n\t\t}\n\n\t\tif ( attributeDivisors[ attribute ] !== meshPerAttribute ) {\n\n\t\t\tconst extension = capabilities.isWebGL2 ? gl : extensions.get( 'ANGLE_instanced_arrays' );\n\n\t\t\textension[ capabilities.isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE' ]( attribute, meshPerAttribute );\n\t\t\tattributeDivisors[ attribute ] = meshPerAttribute;\n\n\t\t}\n\n\t}\n\n\tfunction disableUnusedAttributes() {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\t\tconst enabledAttributes = currentState.enabledAttributes;\n\n\t\tfor ( let i = 0, il = enabledAttributes.length; i < il; i ++ ) {\n\n\t\t\tif ( enabledAttributes[ i ] !== newAttributes[ i ] ) {\n\n\t\t\t\tgl.disableVertexAttribArray( i );\n\t\t\t\tenabledAttributes[ i ] = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction vertexAttribPointer( index, size, type, normalized, stride, offset, integer ) {\n\n\t\tif ( integer === true ) {\n\n\t\t\tgl.vertexAttribIPointer( index, size, type, stride, offset );\n\n\t\t} else {\n\n\t\t\tgl.vertexAttribPointer( index, size, type, normalized, stride, offset );\n\n\t\t}\n\n\t}\n\n\tfunction setupVertexAttributes( object, material, program, geometry ) {\n\n\t\tif ( capabilities.isWebGL2 === false && ( object.isInstancedMesh || geometry.isInstancedBufferGeometry ) ) {\n\n\t\t\tif ( extensions.get( 'ANGLE_instanced_arrays' ) === null ) return;\n\n\t\t}\n\n\t\tinitAttributes();\n\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tconst materialDefaultAttributeValues = material.defaultAttributeValues;\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tlet geometryAttribute = geometryAttributes[ name ];\n\n\t\t\t\tif ( geometryAttribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) geometryAttribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) geometryAttribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tif ( geometryAttribute !== undefined ) {\n\n\t\t\t\t\tconst normalized = geometryAttribute.normalized;\n\t\t\t\t\tconst size = geometryAttribute.itemSize;\n\n\t\t\t\t\tconst attribute = attributes.get( geometryAttribute );\n\n\t\t\t\t\t// TODO Attribute may not be available on context restore\n\n\t\t\t\t\tif ( attribute === undefined ) continue;\n\n\t\t\t\t\tconst buffer = attribute.buffer;\n\t\t\t\t\tconst type = attribute.type;\n\t\t\t\t\tconst bytesPerElement = attribute.bytesPerElement;\n\n\t\t\t\t\t// check for integer attributes (WebGL 2 only)\n\n\t\t\t\t\tconst integer = ( capabilities.isWebGL2 === true && ( type === gl.INT || type === gl.UNSIGNED_INT || geometryAttribute.gpuType === IntType ) );\n\n\t\t\t\t\tif ( geometryAttribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\t\tconst data = geometryAttribute.data;\n\t\t\t\t\t\tconst stride = data.stride;\n\t\t\t\t\t\tconst offset = geometryAttribute.offset;\n\n\t\t\t\t\t\tif ( data.isInstancedInterleavedBuffer ) {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttributeAndDivisor( programAttribute.location + i, data.meshPerAttribute );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined ) {\n\n\t\t\t\t\t\t\t\tgeometry._maxInstanceCount = data.meshPerAttribute * data.count;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttribute( programAttribute.location + i );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgl.bindBuffer( gl.ARRAY_BUFFER, buffer );\n\n\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\tvertexAttribPointer(\n\t\t\t\t\t\t\t\tprogramAttribute.location + i,\n\t\t\t\t\t\t\t\tsize / programAttribute.locationSize,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\tnormalized,\n\t\t\t\t\t\t\t\tstride * bytesPerElement,\n\t\t\t\t\t\t\t\t( offset + ( size / programAttribute.locationSize ) * i ) * bytesPerElement,\n\t\t\t\t\t\t\t\tinteger\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( geometryAttribute.isInstancedBufferAttribute ) {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttributeAndDivisor( programAttribute.location + i, geometryAttribute.meshPerAttribute );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined ) {\n\n\t\t\t\t\t\t\t\tgeometry._maxInstanceCount = geometryAttribute.meshPerAttribute * geometryAttribute.count;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttribute( programAttribute.location + i );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgl.bindBuffer( gl.ARRAY_BUFFER, buffer );\n\n\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\tvertexAttribPointer(\n\t\t\t\t\t\t\t\tprogramAttribute.location + i,\n\t\t\t\t\t\t\t\tsize / programAttribute.locationSize,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\tnormalized,\n\t\t\t\t\t\t\t\tsize * bytesPerElement,\n\t\t\t\t\t\t\t\t( size / programAttribute.locationSize ) * i * bytesPerElement,\n\t\t\t\t\t\t\t\tinteger\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( materialDefaultAttributeValues !== undefined ) {\n\n\t\t\t\t\tconst value = materialDefaultAttributeValues[ name ];\n\n\t\t\t\t\tif ( value !== undefined ) {\n\n\t\t\t\t\t\tswitch ( value.length ) {\n\n\t\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\t\tgl.vertexAttrib2fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 3:\n\t\t\t\t\t\t\t\tgl.vertexAttrib3fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 4:\n\t\t\t\t\t\t\t\tgl.vertexAttrib4fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tgl.vertexAttrib1fv( programAttribute.location, value );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tdisableUnusedAttributes();\n\n\t}\n\n\tfunction dispose() {\n\n\t\treset();\n\n\t\tfor ( const geometryId in bindingStates ) {\n\n\t\t\tconst programMap = bindingStates[ geometryId ];\n\n\t\t\tfor ( const programId in programMap ) {\n\n\t\t\t\tconst stateMap = programMap[ programId ];\n\n\t\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t\t}\n\n\t\t\t\tdelete programMap[ programId ];\n\n\t\t\t}\n\n\t\t\tdelete bindingStates[ geometryId ];\n\n\t\t}\n\n\t}\n\n\tfunction releaseStatesOfGeometry( geometry ) {\n\n\t\tif ( bindingStates[ geometry.id ] === undefined ) return;\n\n\t\tconst programMap = bindingStates[ geometry.id ];\n\n\t\tfor ( const programId in programMap ) {\n\n\t\t\tconst stateMap = programMap[ programId ];\n\n\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t}\n\n\t\t\tdelete programMap[ programId ];\n\n\t\t}\n\n\t\tdelete bindingStates[ geometry.id ];\n\n\t}\n\n\tfunction releaseStatesOfProgram( program ) {\n\n\t\tfor ( const geometryId in bindingStates ) {\n\n\t\t\tconst programMap = bindingStates[ geometryId ];\n\n\t\t\tif ( programMap[ program.id ] === undefined ) continue;\n\n\t\t\tconst stateMap = programMap[ program.id ];\n\n\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t}\n\n\t\t\tdelete programMap[ program.id ];\n\n\t\t}\n\n\t}\n\n\tfunction reset() {\n\n\t\tresetDefaultState();\n\t\tforceUpdate = true;\n\n\t\tif ( currentState === defaultState ) return;\n\n\t\tcurrentState = defaultState;\n\t\tbindVertexArrayObject( currentState.object );\n\n\t}\n\n\t// for backward-compatibility\n\n\tfunction resetDefaultState() {\n\n\t\tdefaultState.geometry = null;\n\t\tdefaultState.program = null;\n\t\tdefaultState.wireframe = false;\n\n\t}\n\n\treturn {\n\n\t\tsetup: setup,\n\t\treset: reset,\n\t\tresetDefaultState: resetDefaultState,\n\t\tdispose: dispose,\n\t\treleaseStatesOfGeometry: releaseStatesOfGeometry,\n\t\treleaseStatesOfProgram: releaseStatesOfProgram,\n\n\t\tinitAttributes: initAttributes,\n\t\tenableAttribute: enableAttribute,\n\t\tdisableUnusedAttributes: disableUnusedAttributes\n\n\t};\n\n}\n\nfunction WebGLBufferRenderer( gl, extensions, info, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tlet mode;\n\n\tfunction setMode( value ) {\n\n\t\tmode = value;\n\n\t}\n\n\tfunction render( start, count ) {\n\n\t\tgl.drawArrays( mode, start, count );\n\n\t\tinfo.update( count, mode, 1 );\n\n\t}\n\n\tfunction renderInstances( start, count, primcount ) {\n\n\t\tif ( primcount === 0 ) return;\n\n\t\tlet extension, methodName;\n\n\t\tif ( isWebGL2 ) {\n\n\t\t\textension = gl;\n\t\t\tmethodName = 'drawArraysInstanced';\n\n\t\t} else {\n\n\t\t\textension = extensions.get( 'ANGLE_instanced_arrays' );\n\t\t\tmethodName = 'drawArraysInstancedANGLE';\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\textension[ methodName ]( mode, start, count, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\n}\n\nfunction WebGLCapabilities( gl, extensions, parameters ) {\n\n\tlet maxAnisotropy;\n\n\tfunction getMaxAnisotropy() {\n\n\t\tif ( maxAnisotropy !== undefined ) return maxAnisotropy;\n\n\t\tif ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {\n\n\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\n\n\t\t\tmaxAnisotropy = gl.getParameter( extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT );\n\n\t\t} else {\n\n\t\t\tmaxAnisotropy = 0;\n\n\t\t}\n\n\t\treturn maxAnisotropy;\n\n\t}\n\n\tfunction getMaxPrecision( precision ) {\n\n\t\tif ( precision === 'highp' ) {\n\n\t\t\tif ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.HIGH_FLOAT ).precision > 0 &&\n\t\t\t\tgl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.HIGH_FLOAT ).precision > 0 ) {\n\n\t\t\t\treturn 'highp';\n\n\t\t\t}\n\n\t\t\tprecision = 'mediump';\n\n\t\t}\n\n\t\tif ( precision === 'mediump' ) {\n\n\t\t\tif ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.MEDIUM_FLOAT ).precision > 0 &&\n\t\t\t\tgl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT ).precision > 0 ) {\n\n\t\t\t\treturn 'mediump';\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn 'lowp';\n\n\t}\n\n\tconst isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl.constructor.name === 'WebGL2RenderingContext';\n\n\tlet precision = parameters.precision !== undefined ? parameters.precision : 'highp';\n\tconst maxPrecision = getMaxPrecision( precision );\n\n\tif ( maxPrecision !== precision ) {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.' );\n\t\tprecision = maxPrecision;\n\n\t}\n\n\tconst drawBuffers = isWebGL2 || extensions.has( 'WEBGL_draw_buffers' );\n\n\tconst logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;\n\n\tconst maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );\n\tconst maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );\n\tconst maxTextureSize = gl.getParameter( gl.MAX_TEXTURE_SIZE );\n\tconst maxCubemapSize = gl.getParameter( gl.MAX_CUBE_MAP_TEXTURE_SIZE );\n\n\tconst maxAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );\n\tconst maxVertexUniforms = gl.getParameter( gl.MAX_VERTEX_UNIFORM_VECTORS );\n\tconst maxVaryings = gl.getParameter( gl.MAX_VARYING_VECTORS );\n\tconst maxFragmentUniforms = gl.getParameter( gl.MAX_FRAGMENT_UNIFORM_VECTORS );\n\n\tconst vertexTextures = maxVertexTextures > 0;\n\tconst floatFragmentTextures = isWebGL2 || extensions.has( 'OES_texture_float' );\n\tconst floatVertexTextures = vertexTextures && floatFragmentTextures;\n\n\tconst maxSamples = isWebGL2 ? gl.getParameter( gl.MAX_SAMPLES ) : 0;\n\n\treturn {\n\n\t\tisWebGL2: isWebGL2,\n\n\t\tdrawBuffers: drawBuffers,\n\n\t\tgetMaxAnisotropy: getMaxAnisotropy,\n\t\tgetMaxPrecision: getMaxPrecision,\n\n\t\tprecision: precision,\n\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\n\n\t\tmaxTextures: maxTextures,\n\t\tmaxVertexTextures: maxVertexTextures,\n\t\tmaxTextureSize: maxTextureSize,\n\t\tmaxCubemapSize: maxCubemapSize,\n\n\t\tmaxAttributes: maxAttributes,\n\t\tmaxVertexUniforms: maxVertexUniforms,\n\t\tmaxVaryings: maxVaryings,\n\t\tmaxFragmentUniforms: maxFragmentUniforms,\n\n\t\tvertexTextures: vertexTextures,\n\t\tfloatFragmentTextures: floatFragmentTextures,\n\t\tfloatVertexTextures: floatVertexTextures,\n\n\t\tmaxSamples: maxSamples\n\n\t};\n\n}\n\nfunction WebGLClipping( properties ) {\n\n\tconst scope = this;\n\n\tlet globalState = null,\n\t\tnumGlobalPlanes = 0,\n\t\tlocalClippingEnabled = false,\n\t\trenderingShadows = false;\n\n\tconst plane = new Plane(),\n\t\tviewNormalMatrix = new Matrix3(),\n\n\t\tuniform = { value: null, needsUpdate: false };\n\n\tthis.uniform = uniform;\n\tthis.numPlanes = 0;\n\tthis.numIntersection = 0;\n\n\tthis.init = function ( planes, enableLocalClipping ) {\n\n\t\tconst enabled =\n\t\t\tplanes.length !== 0 ||\n\t\t\tenableLocalClipping ||\n\t\t\t// enable state of previous frame - the clipping code has to\n\t\t\t// run another frame in order to reset the state:\n\t\t\tnumGlobalPlanes !== 0 ||\n\t\t\tlocalClippingEnabled;\n\n\t\tlocalClippingEnabled = enableLocalClipping;\n\n\t\tnumGlobalPlanes = planes.length;\n\n\t\treturn enabled;\n\n\t};\n\n\tthis.beginShadows = function () {\n\n\t\trenderingShadows = true;\n\t\tprojectPlanes( null );\n\n\t};\n\n\tthis.endShadows = function () {\n\n\t\trenderingShadows = false;\n\n\t};\n\n\tthis.setGlobalState = function ( planes, camera ) {\n\n\t\tglobalState = projectPlanes( planes, camera, 0 );\n\n\t};\n\n\tthis.setState = function ( material, camera, useCache ) {\n\n\t\tconst planes = material.clippingPlanes,\n\t\t\tclipIntersection = material.clipIntersection,\n\t\t\tclipShadows = material.clipShadows;\n\n\t\tconst materialProperties = properties.get( material );\n\n\t\tif ( ! localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && ! clipShadows ) {\n\n\t\t\t// there's no local clipping\n\n\t\t\tif ( renderingShadows ) {\n\n\t\t\t\t// there's no global clipping\n\n\t\t\t\tprojectPlanes( null );\n\n\t\t\t} else {\n\n\t\t\t\tresetGlobalState();\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst nGlobal = renderingShadows ? 0 : numGlobalPlanes,\n\t\t\t\tlGlobal = nGlobal * 4;\n\n\t\t\tlet dstArray = materialProperties.clippingState || null;\n\n\t\t\tuniform.value = dstArray; // ensure unique state\n\n\t\t\tdstArray = projectPlanes( planes, camera, lGlobal, useCache );\n\n\t\t\tfor ( let i = 0; i !== lGlobal; ++ i ) {\n\n\t\t\t\tdstArray[ i ] = globalState[ i ];\n\n\t\t\t}\n\n\t\t\tmaterialProperties.clippingState = dstArray;\n\t\t\tthis.numIntersection = clipIntersection ? this.numPlanes : 0;\n\t\t\tthis.numPlanes += nGlobal;\n\n\t\t}\n\n\n\t};\n\n\tfunction resetGlobalState() {\n\n\t\tif ( uniform.value !== globalState ) {\n\n\t\t\tuniform.value = globalState;\n\t\t\tuniform.needsUpdate = numGlobalPlanes > 0;\n\n\t\t}\n\n\t\tscope.numPlanes = numGlobalPlanes;\n\t\tscope.numIntersection = 0;\n\n\t}\n\n\tfunction projectPlanes( planes, camera, dstOffset, skipTransform ) {\n\n\t\tconst nPlanes = planes !== null ? planes.length : 0;\n\t\tlet dstArray = null;\n\n\t\tif ( nPlanes !== 0 ) {\n\n\t\t\tdstArray = uniform.value;\n\n\t\t\tif ( skipTransform !== true || dstArray === null ) {\n\n\t\t\t\tconst flatSize = dstOffset + nPlanes * 4,\n\t\t\t\t\tviewMatrix = camera.matrixWorldInverse;\n\n\t\t\t\tviewNormalMatrix.getNormalMatrix( viewMatrix );\n\n\t\t\t\tif ( dstArray === null || dstArray.length < flatSize ) {\n\n\t\t\t\t\tdstArray = new Float32Array( flatSize );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0, i4 = dstOffset; i !== nPlanes; ++ i, i4 += 4 ) {\n\n\t\t\t\t\tplane.copy( planes[ i ] ).applyMatrix4( viewMatrix, viewNormalMatrix );\n\n\t\t\t\t\tplane.normal.toArray( dstArray, i4 );\n\t\t\t\t\tdstArray[ i4 + 3 ] = plane.constant;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tuniform.value = dstArray;\n\t\t\tuniform.needsUpdate = true;\n\n\t\t}\n\n\t\tscope.numPlanes = nPlanes;\n\t\tscope.numIntersection = 0;\n\n\t\treturn dstArray;\n\n\t}\n\n}\n\nfunction WebGLCubeMaps( renderer ) {\n\n\tlet cubemaps = new WeakMap();\n\n\tfunction mapTextureMapping( texture, mapping ) {\n\n\t\tif ( mapping === EquirectangularReflectionMapping ) {\n\n\t\t\ttexture.mapping = CubeReflectionMapping;\n\n\t\t} else if ( mapping === EquirectangularRefractionMapping ) {\n\n\t\t\ttexture.mapping = CubeRefractionMapping;\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction get( texture ) {\n\n\t\tif ( texture && texture.isTexture && texture.isRenderTargetTexture === false ) {\n\n\t\t\tconst mapping = texture.mapping;\n\n\t\t\tif ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping ) {\n\n\t\t\t\tif ( cubemaps.has( texture ) ) {\n\n\t\t\t\t\tconst cubemap = cubemaps.get( texture ).texture;\n\t\t\t\t\treturn mapTextureMapping( cubemap, texture.mapping );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconst image = texture.image;\n\n\t\t\t\t\tif ( image && image.height > 0 ) {\n\n\t\t\t\t\t\tconst renderTarget = new WebGLCubeRenderTarget( image.height / 2 );\n\t\t\t\t\t\trenderTarget.fromEquirectangularTexture( renderer, texture );\n\t\t\t\t\t\tcubemaps.set( texture, renderTarget );\n\n\t\t\t\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t\t\t\t\treturn mapTextureMapping( renderTarget.texture, texture.mapping );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// image not yet ready. try the conversion next frame\n\n\t\t\t\t\t\treturn null;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tconst cubemap = cubemaps.get( texture );\n\n\t\tif ( cubemap !== undefined ) {\n\n\t\t\tcubemaps.delete( texture );\n\t\t\tcubemap.dispose();\n\n\t\t}\n\n\t}\n\n\tfunction dispose() {\n\n\t\tcubemaps = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nclass OrthographicCamera extends Camera {\n\n\tconstructor( left = - 1, right = 1, top = 1, bottom = - 1, near = 0.1, far = 2000 ) {\n\n\t\tsuper();\n\n\t\tthis.isOrthographicCamera = true;\n\n\t\tthis.type = 'OrthographicCamera';\n\n\t\tthis.zoom = 1;\n\t\tthis.view = null;\n\n\t\tthis.left = left;\n\t\tthis.right = right;\n\t\tthis.top = top;\n\t\tthis.bottom = bottom;\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.left = source.left;\n\t\tthis.right = source.right;\n\t\tthis.top = source.top;\n\t\tthis.bottom = source.bottom;\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\n\t\tthis.zoom = source.zoom;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\treturn this;\n\n\t}\n\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tclearViewOffset() {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tupdateProjectionMatrix() {\n\n\t\tconst dx = ( this.right - this.left ) / ( 2 * this.zoom );\n\t\tconst dy = ( this.top - this.bottom ) / ( 2 * this.zoom );\n\t\tconst cx = ( this.right + this.left ) / 2;\n\t\tconst cy = ( this.top + this.bottom ) / 2;\n\n\t\tlet left = cx - dx;\n\t\tlet right = cx + dx;\n\t\tlet top = cy + dy;\n\t\tlet bottom = cy - dy;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tconst scaleW = ( this.right - this.left ) / this.view.fullWidth / this.zoom;\n\t\t\tconst scaleH = ( this.top - this.bottom ) / this.view.fullHeight / this.zoom;\n\n\t\t\tleft += scaleW * this.view.offsetX;\n\t\t\tright = left + scaleW * this.view.width;\n\t\t\ttop -= scaleH * this.view.offsetY;\n\t\t\tbottom = top - scaleH * this.view.height;\n\n\t\t}\n\n\t\tthis.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far, this.coordinateSystem );\n\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.zoom = this.zoom;\n\t\tdata.object.left = this.left;\n\t\tdata.object.right = this.right;\n\t\tdata.object.top = this.top;\n\t\tdata.object.bottom = this.bottom;\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst LOD_MIN = 4;\n\n// The standard deviations (radians) associated with the extra mips. These are\n// chosen to approximate a Trowbridge-Reitz distribution function times the\n// geometric shadowing function. These sigma values squared must match the\n// variance #defines in cube_uv_reflection_fragment.glsl.js.\nconst EXTRA_LOD_SIGMA = [ 0.125, 0.215, 0.35, 0.446, 0.526, 0.582 ];\n\n// The maximum length of the blur for loop. Smaller sigmas will use fewer\n// samples and exit early, but not recompile the shader.\nconst MAX_SAMPLES = 20;\n\nconst _flatCamera = /*@__PURE__*/ new OrthographicCamera();\nconst _clearColor = /*@__PURE__*/ new Color();\nlet _oldTarget = null;\nlet _oldActiveCubeFace = 0;\nlet _oldActiveMipmapLevel = 0;\n\n// Golden Ratio\nconst PHI = ( 1 + Math.sqrt( 5 ) ) / 2;\nconst INV_PHI = 1 / PHI;\n\n// Vertices of a dodecahedron (except the opposites, which represent the\n// same axis), used as axis directions evenly spread on a sphere.\nconst _axisDirections = [\n\t/*@__PURE__*/ new Vector3( 1, 1, 1 ),\n\t/*@__PURE__*/ new Vector3( - 1, 1, 1 ),\n\t/*@__PURE__*/ new Vector3( 1, 1, - 1 ),\n\t/*@__PURE__*/ new Vector3( - 1, 1, - 1 ),\n\t/*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),\n\t/*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),\n\t/*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new Vector3( - INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new Vector3( PHI, INV_PHI, 0 ),\n\t/*@__PURE__*/ new Vector3( - PHI, INV_PHI, 0 ) ];\n\n/**\n * This class generates a Prefiltered, Mipmapped Radiance Environment Map\n * (PMREM) from a cubeMap environment texture. This allows different levels of\n * blur to be quickly accessed based on material roughness. It is packed into a\n * special CubeUV format that allows us to perform custom interpolation so that\n * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap\n * chain, it only goes down to the LOD_MIN level (above), and then creates extra\n * even more filtered 'mips' at the same LOD_MIN resolution, associated with\n * higher roughness levels. In this way we maintain resolution to smoothly\n * interpolate diffuse lighting while limiting sampling computation.\n *\n * Paper: Fast, Accurate Image-Based Lighting\n * https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view\n*/\n\nclass PMREMGenerator {\n\n\tconstructor( renderer ) {\n\n\t\tthis._renderer = renderer;\n\t\tthis._pingPongRenderTarget = null;\n\n\t\tthis._lodMax = 0;\n\t\tthis._cubeSize = 0;\n\t\tthis._lodPlanes = [];\n\t\tthis._sizeLods = [];\n\t\tthis._sigmas = [];\n\n\t\tthis._blurMaterial = null;\n\t\tthis._cubemapMaterial = null;\n\t\tthis._equirectMaterial = null;\n\n\t\tthis._compileMaterial( this._blurMaterial );\n\n\t}\n\n\t/**\n\t * Generates a PMREM from a supplied Scene, which can be faster than using an\n\t * image if networking bandwidth is low. Optional sigma specifies a blur radius\n\t * in radians to be applied to the scene before PMREM generation. Optional near\n\t * and far planes ensure the scene is rendered in its entirety (the cubeCamera\n\t * is placed at the origin).\n\t */\n\tfromScene( scene, sigma = 0, near = 0.1, far = 100 ) {\n\n\t\t_oldTarget = this._renderer.getRenderTarget();\n\t\t_oldActiveCubeFace = this._renderer.getActiveCubeFace();\n\t\t_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();\n\n\t\tthis._setSize( 256 );\n\n\t\tconst cubeUVRenderTarget = this._allocateTargets();\n\t\tcubeUVRenderTarget.depthBuffer = true;\n\n\t\tthis._sceneToCubeUV( scene, near, far, cubeUVRenderTarget );\n\n\t\tif ( sigma > 0 ) {\n\n\t\t\tthis._blur( cubeUVRenderTarget, 0, 0, sigma );\n\n\t\t}\n\n\t\tthis._applyPMREM( cubeUVRenderTarget );\n\t\tthis._cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t/**\n\t * Generates a PMREM from an equirectangular texture, which can be either LDR\n\t * or HDR. The ideal input image size is 1k (1024 x 512),\n\t * as this matches best with the 256 x 256 cubemap output.\n\t */\n\tfromEquirectangular( equirectangular, renderTarget = null ) {\n\n\t\treturn this._fromTexture( equirectangular, renderTarget );\n\n\t}\n\n\t/**\n\t * Generates a PMREM from an cubemap texture, which can be either LDR\n\t * or HDR. The ideal input cube size is 256 x 256,\n\t * as this matches best with the 256 x 256 cubemap output.\n\t */\n\tfromCubemap( cubemap, renderTarget = null ) {\n\n\t\treturn this._fromTexture( cubemap, renderTarget );\n\n\t}\n\n\t/**\n\t * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileCubemapShader() {\n\n\t\tif ( this._cubemapMaterial === null ) {\n\n\t\t\tthis._cubemapMaterial = _getCubemapMaterial();\n\t\t\tthis._compileMaterial( this._cubemapMaterial );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileEquirectangularShader() {\n\n\t\tif ( this._equirectMaterial === null ) {\n\n\t\t\tthis._equirectMaterial = _getEquirectMaterial();\n\t\t\tthis._compileMaterial( this._equirectMaterial );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,\n\t * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on\n\t * one of them will cause any others to also become unusable.\n\t */\n\tdispose() {\n\n\t\tthis._dispose();\n\n\t\tif ( this._cubemapMaterial !== null ) this._cubemapMaterial.dispose();\n\t\tif ( this._equirectMaterial !== null ) this._equirectMaterial.dispose();\n\n\t}\n\n\t// private interface\n\n\t_setSize( cubeSize ) {\n\n\t\tthis._lodMax = Math.floor( Math.log2( cubeSize ) );\n\t\tthis._cubeSize = Math.pow( 2, this._lodMax );\n\n\t}\n\n\t_dispose() {\n\n\t\tif ( this._blurMaterial !== null ) this._blurMaterial.dispose();\n\n\t\tif ( this._pingPongRenderTarget !== null ) this._pingPongRenderTarget.dispose();\n\n\t\tfor ( let i = 0; i < this._lodPlanes.length; i ++ ) {\n\n\t\t\tthis._lodPlanes[ i ].dispose();\n\n\t\t}\n\n\t}\n\n\t_cleanup( outputTarget ) {\n\n\t\tthis._renderer.setRenderTarget( _oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel );\n\t\toutputTarget.scissorTest = false;\n\t\t_setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );\n\n\t}\n\n\t_fromTexture( texture, renderTarget ) {\n\n\t\tif ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping ) {\n\n\t\t\tthis._setSize( texture.image.length === 0 ? 16 : ( texture.image[ 0 ].width || texture.image[ 0 ].image.width ) );\n\n\t\t} else { // Equirectangular\n\n\t\t\tthis._setSize( texture.image.width / 4 );\n\n\t\t}\n\n\t\t_oldTarget = this._renderer.getRenderTarget();\n\t\t_oldActiveCubeFace = this._renderer.getActiveCubeFace();\n\t\t_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();\n\n\t\tconst cubeUVRenderTarget = renderTarget || this._allocateTargets();\n\t\tthis._textureToCubeUV( texture, cubeUVRenderTarget );\n\t\tthis._applyPMREM( cubeUVRenderTarget );\n\t\tthis._cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t_allocateTargets() {\n\n\t\tconst width = 3 * Math.max( this._cubeSize, 16 * 7 );\n\t\tconst height = 4 * this._cubeSize;\n\n\t\tconst params = {\n\t\t\tmagFilter: LinearFilter,\n\t\t\tminFilter: LinearFilter,\n\t\t\tgenerateMipmaps: false,\n\t\t\ttype: HalfFloatType,\n\t\t\tformat: RGBAFormat,\n\t\t\tcolorSpace: LinearSRGBColorSpace,\n\t\t\tdepthBuffer: false\n\t\t};\n\n\t\tconst cubeUVRenderTarget = _createRenderTarget( width, height, params );\n\n\t\tif ( this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== width || this._pingPongRenderTarget.height !== height ) {\n\n\t\t\tif ( this._pingPongRenderTarget !== null ) {\n\n\t\t\t\tthis._dispose();\n\n\t\t\t}\n\n\t\t\tthis._pingPongRenderTarget = _createRenderTarget( width, height, params );\n\n\t\t\tconst { _lodMax } = this;\n\t\t\t( { sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas } = _createPlanes( _lodMax ) );\n\n\t\t\tthis._blurMaterial = _getBlurShader( _lodMax, width, height );\n\n\t\t}\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t_compileMaterial( material ) {\n\n\t\tconst tmpMesh = new Mesh( this._lodPlanes[ 0 ], material );\n\t\tthis._renderer.compile( tmpMesh, _flatCamera );\n\n\t}\n\n\t_sceneToCubeUV( scene, near, far, cubeUVRenderTarget ) {\n\n\t\tconst fov = 90;\n\t\tconst aspect = 1;\n\t\tconst cubeCamera = new PerspectiveCamera( fov, aspect, near, far );\n\t\tconst upSign = [ 1, - 1, 1, 1, 1, 1 ];\n\t\tconst forwardSign = [ 1, 1, 1, - 1, - 1, - 1 ];\n\t\tconst renderer = this._renderer;\n\n\t\tconst originalAutoClear = renderer.autoClear;\n\t\tconst toneMapping = renderer.toneMapping;\n\t\trenderer.getClearColor( _clearColor );\n\n\t\trenderer.toneMapping = NoToneMapping;\n\t\trenderer.autoClear = false;\n\n\t\tconst backgroundMaterial = new MeshBasicMaterial( {\n\t\t\tname: 'PMREM.Background',\n\t\t\tside: BackSide,\n\t\t\tdepthWrite: false,\n\t\t\tdepthTest: false,\n\t\t} );\n\n\t\tconst backgroundBox = new Mesh( new BoxGeometry(), backgroundMaterial );\n\n\t\tlet useSolidColor = false;\n\t\tconst background = scene.background;\n\n\t\tif ( background ) {\n\n\t\t\tif ( background.isColor ) {\n\n\t\t\t\tbackgroundMaterial.color.copy( background );\n\t\t\t\tscene.background = null;\n\t\t\t\tuseSolidColor = true;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tbackgroundMaterial.color.copy( _clearColor );\n\t\t\tuseSolidColor = true;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst col = i % 3;\n\n\t\t\tif ( col === 0 ) {\n\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\t\tcubeCamera.lookAt( forwardSign[ i ], 0, 0 );\n\n\t\t\t} else if ( col === 1 ) {\n\n\t\t\t\tcubeCamera.up.set( 0, 0, upSign[ i ] );\n\t\t\t\tcubeCamera.lookAt( 0, forwardSign[ i ], 0 );\n\n\t\t\t} else {\n\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\t\tcubeCamera.lookAt( 0, 0, forwardSign[ i ] );\n\n\t\t\t}\n\n\t\t\tconst size = this._cubeSize;\n\n\t\t\t_setViewport( cubeUVRenderTarget, col * size, i > 2 ? size : 0, size, size );\n\n\t\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\n\t\t\tif ( useSolidColor ) {\n\n\t\t\t\trenderer.render( backgroundBox, cubeCamera );\n\n\t\t\t}\n\n\t\t\trenderer.render( scene, cubeCamera );\n\n\t\t}\n\n\t\tbackgroundBox.geometry.dispose();\n\t\tbackgroundBox.material.dispose();\n\n\t\trenderer.toneMapping = toneMapping;\n\t\trenderer.autoClear = originalAutoClear;\n\t\tscene.background = background;\n\n\t}\n\n\t_textureToCubeUV( texture, cubeUVRenderTarget ) {\n\n\t\tconst renderer = this._renderer;\n\n\t\tconst isCubeTexture = ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping );\n\n\t\tif ( isCubeTexture ) {\n\n\t\t\tif ( this._cubemapMaterial === null ) {\n\n\t\t\t\tthis._cubemapMaterial = _getCubemapMaterial();\n\n\t\t\t}\n\n\t\t\tthis._cubemapMaterial.uniforms.flipEnvMap.value = ( texture.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t} else {\n\n\t\t\tif ( this._equirectMaterial === null ) {\n\n\t\t\t\tthis._equirectMaterial = _getEquirectMaterial();\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst material = isCubeTexture ? this._cubemapMaterial : this._equirectMaterial;\n\t\tconst mesh = new Mesh( this._lodPlanes[ 0 ], material );\n\n\t\tconst uniforms = material.uniforms;\n\n\t\tuniforms[ 'envMap' ].value = texture;\n\n\t\tconst size = this._cubeSize;\n\n\t\t_setViewport( cubeUVRenderTarget, 0, 0, 3 * size, 2 * size );\n\n\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\t\trenderer.render( mesh, _flatCamera );\n\n\t}\n\n\t_applyPMREM( cubeUVRenderTarget ) {\n\n\t\tconst renderer = this._renderer;\n\t\tconst autoClear = renderer.autoClear;\n\t\trenderer.autoClear = false;\n\n\t\tfor ( let i = 1; i < this._lodPlanes.length; i ++ ) {\n\n\t\t\tconst sigma = Math.sqrt( this._sigmas[ i ] * this._sigmas[ i ] - this._sigmas[ i - 1 ] * this._sigmas[ i - 1 ] );\n\n\t\t\tconst poleAxis = _axisDirections[ ( i - 1 ) % _axisDirections.length ];\n\n\t\t\tthis._blur( cubeUVRenderTarget, i - 1, i, sigma, poleAxis );\n\n\t\t}\n\n\t\trenderer.autoClear = autoClear;\n\n\t}\n\n\t/**\n\t * This is a two-pass Gaussian blur for a cubemap. Normally this is done\n\t * vertically and horizontally, but this breaks down on a cube. Here we apply\n\t * the blur latitudinally (around the poles), and then longitudinally (towards\n\t * the poles) to approximate the orthogonally-separable blur. It is least\n\t * accurate at the poles, but still does a decent job.\n\t */\n\t_blur( cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis ) {\n\n\t\tconst pingPongRenderTarget = this._pingPongRenderTarget;\n\n\t\tthis._halfBlur(\n\t\t\tcubeUVRenderTarget,\n\t\t\tpingPongRenderTarget,\n\t\t\tlodIn,\n\t\t\tlodOut,\n\t\t\tsigma,\n\t\t\t'latitudinal',\n\t\t\tpoleAxis );\n\n\t\tthis._halfBlur(\n\t\t\tpingPongRenderTarget,\n\t\t\tcubeUVRenderTarget,\n\t\t\tlodOut,\n\t\t\tlodOut,\n\t\t\tsigma,\n\t\t\t'longitudinal',\n\t\t\tpoleAxis );\n\n\t}\n\n\t_halfBlur( targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis ) {\n\n\t\tconst renderer = this._renderer;\n\t\tconst blurMaterial = this._blurMaterial;\n\n\t\tif ( direction !== 'latitudinal' && direction !== 'longitudinal' ) {\n\n\t\t\tconsole.error(\n\t\t\t\t'blur direction must be either latitudinal or longitudinal!' );\n\n\t\t}\n\n\t\t// Number of standard deviations at which to cut off the discrete approximation.\n\t\tconst STANDARD_DEVIATIONS = 3;\n\n\t\tconst blurMesh = new Mesh( this._lodPlanes[ lodOut ], blurMaterial );\n\t\tconst blurUniforms = blurMaterial.uniforms;\n\n\t\tconst pixels = this._sizeLods[ lodIn ] - 1;\n\t\tconst radiansPerPixel = isFinite( sigmaRadians ) ? Math.PI / ( 2 * pixels ) : 2 * Math.PI / ( 2 * MAX_SAMPLES - 1 );\n\t\tconst sigmaPixels = sigmaRadians / radiansPerPixel;\n\t\tconst samples = isFinite( sigmaRadians ) ? 1 + Math.floor( STANDARD_DEVIATIONS * sigmaPixels ) : MAX_SAMPLES;\n\n\t\tif ( samples > MAX_SAMPLES ) {\n\n\t\t\tconsole.warn( `sigmaRadians, ${\n\t\t\t\tsigmaRadians}, is too large and will clip, as it requested ${\n\t\t\t\tsamples} samples when the maximum is set to ${MAX_SAMPLES}` );\n\n\t\t}\n\n\t\tconst weights = [];\n\t\tlet sum = 0;\n\n\t\tfor ( let i = 0; i < MAX_SAMPLES; ++ i ) {\n\n\t\t\tconst x = i / sigmaPixels;\n\t\t\tconst weight = Math.exp( - x * x / 2 );\n\t\t\tweights.push( weight );\n\n\t\t\tif ( i === 0 ) {\n\n\t\t\t\tsum += weight;\n\n\t\t\t} else if ( i < samples ) {\n\n\t\t\t\tsum += 2 * weight;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < weights.length; i ++ ) {\n\n\t\t\tweights[ i ] = weights[ i ] / sum;\n\n\t\t}\n\n\t\tblurUniforms[ 'envMap' ].value = targetIn.texture;\n\t\tblurUniforms[ 'samples' ].value = samples;\n\t\tblurUniforms[ 'weights' ].value = weights;\n\t\tblurUniforms[ 'latitudinal' ].value = direction === 'latitudinal';\n\n\t\tif ( poleAxis ) {\n\n\t\t\tblurUniforms[ 'poleAxis' ].value = poleAxis;\n\n\t\t}\n\n\t\tconst { _lodMax } = this;\n\t\tblurUniforms[ 'dTheta' ].value = radiansPerPixel;\n\t\tblurUniforms[ 'mipInt' ].value = _lodMax - lodIn;\n\n\t\tconst outputSize = this._sizeLods[ lodOut ];\n\t\tconst x = 3 * outputSize * ( lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0 );\n\t\tconst y = 4 * ( this._cubeSize - outputSize );\n\n\t\t_setViewport( targetOut, x, y, 3 * outputSize, 2 * outputSize );\n\t\trenderer.setRenderTarget( targetOut );\n\t\trenderer.render( blurMesh, _flatCamera );\n\n\t}\n\n}\n\n\n\nfunction _createPlanes( lodMax ) {\n\n\tconst lodPlanes = [];\n\tconst sizeLods = [];\n\tconst sigmas = [];\n\n\tlet lod = lodMax;\n\n\tconst totalLods = lodMax - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length;\n\n\tfor ( let i = 0; i < totalLods; i ++ ) {\n\n\t\tconst sizeLod = Math.pow( 2, lod );\n\t\tsizeLods.push( sizeLod );\n\t\tlet sigma = 1.0 / sizeLod;\n\n\t\tif ( i > lodMax - LOD_MIN ) {\n\n\t\t\tsigma = EXTRA_LOD_SIGMA[ i - lodMax + LOD_MIN - 1 ];\n\n\t\t} else if ( i === 0 ) {\n\n\t\t\tsigma = 0;\n\n\t\t}\n\n\t\tsigmas.push( sigma );\n\n\t\tconst texelSize = 1.0 / ( sizeLod - 2 );\n\t\tconst min = - texelSize;\n\t\tconst max = 1 + texelSize;\n\t\tconst uv1 = [ min, min, max, min, max, max, min, min, max, max, min, max ];\n\n\t\tconst cubeFaces = 6;\n\t\tconst vertices = 6;\n\t\tconst positionSize = 3;\n\t\tconst uvSize = 2;\n\t\tconst faceIndexSize = 1;\n\n\t\tconst position = new Float32Array( positionSize * vertices * cubeFaces );\n\t\tconst uv = new Float32Array( uvSize * vertices * cubeFaces );\n\t\tconst faceIndex = new Float32Array( faceIndexSize * vertices * cubeFaces );\n\n\t\tfor ( let face = 0; face < cubeFaces; face ++ ) {\n\n\t\t\tconst x = ( face % 3 ) * 2 / 3 - 1;\n\t\t\tconst y = face > 2 ? 0 : - 1;\n\t\t\tconst coordinates = [\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y + 1, 0\n\t\t\t];\n\t\t\tposition.set( coordinates, positionSize * vertices * face );\n\t\t\tuv.set( uv1, uvSize * vertices * face );\n\t\t\tconst fill = [ face, face, face, face, face, face ];\n\t\t\tfaceIndex.set( fill, faceIndexSize * vertices * face );\n\n\t\t}\n\n\t\tconst planes = new BufferGeometry();\n\t\tplanes.setAttribute( 'position', new BufferAttribute( position, positionSize ) );\n\t\tplanes.setAttribute( 'uv', new BufferAttribute( uv, uvSize ) );\n\t\tplanes.setAttribute( 'faceIndex', new BufferAttribute( faceIndex, faceIndexSize ) );\n\t\tlodPlanes.push( planes );\n\n\t\tif ( lod > LOD_MIN ) {\n\n\t\t\tlod --;\n\n\t\t}\n\n\t}\n\n\treturn { lodPlanes, sizeLods, sigmas };\n\n}\n\nfunction _createRenderTarget( width, height, params ) {\n\n\tconst cubeUVRenderTarget = new WebGLRenderTarget( width, height, params );\n\tcubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping;\n\tcubeUVRenderTarget.texture.name = 'PMREM.cubeUv';\n\tcubeUVRenderTarget.scissorTest = true;\n\treturn cubeUVRenderTarget;\n\n}\n\nfunction _setViewport( target, x, y, width, height ) {\n\n\ttarget.viewport.set( x, y, width, height );\n\ttarget.scissor.set( x, y, width, height );\n\n}\n\nfunction _getBlurShader( lodMax, width, height ) {\n\n\tconst weights = new Float32Array( MAX_SAMPLES );\n\tconst poleAxis = new Vector3( 0, 1, 0 );\n\tconst shaderMaterial = new ShaderMaterial( {\n\n\t\tname: 'SphericalGaussianBlur',\n\n\t\tdefines: {\n\t\t\t'n': MAX_SAMPLES,\n\t\t\t'CUBEUV_TEXEL_WIDTH': 1.0 / width,\n\t\t\t'CUBEUV_TEXEL_HEIGHT': 1.0 / height,\n\t\t\t'CUBEUV_MAX_MIP': `${lodMax}.0`,\n\t\t},\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'samples': { value: 1 },\n\t\t\t'weights': { value: weights },\n\t\t\t'latitudinal': { value: false },\n\t\t\t'dTheta': { value: 0 },\n\t\t\t'mipInt': { value: 0 },\n\t\t\t'poleAxis': { value: poleAxis }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n\treturn shaderMaterial;\n\n}\n\nfunction _getEquirectMaterial() {\n\n\treturn new ShaderMaterial( {\n\n\t\tname: 'EquirectangularToCubeUV',\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n}\n\nfunction _getCubemapMaterial() {\n\n\treturn new ShaderMaterial( {\n\n\t\tname: 'CubemapToCubeUV',\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'flipEnvMap': { value: - 1 }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n}\n\nfunction _getCommonVertexShader() {\n\n\treturn /* glsl */`\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t`;\n\n}\n\nfunction WebGLCubeUVMaps( renderer ) {\n\n\tlet cubeUVmaps = new WeakMap();\n\n\tlet pmremGenerator = null;\n\n\tfunction get( texture ) {\n\n\t\tif ( texture && texture.isTexture ) {\n\n\t\t\tconst mapping = texture.mapping;\n\n\t\t\tconst isEquirectMap = ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping );\n\t\t\tconst isCubeMap = ( mapping === CubeReflectionMapping || mapping === CubeRefractionMapping );\n\n\t\t\t// equirect/cube map to cubeUV conversion\n\n\t\t\tif ( isEquirectMap || isCubeMap ) {\n\n\t\t\t\tif ( texture.isRenderTargetTexture && texture.needsPMREMUpdate === true ) {\n\n\t\t\t\t\ttexture.needsPMREMUpdate = false;\n\n\t\t\t\t\tlet renderTarget = cubeUVmaps.get( texture );\n\n\t\t\t\t\tif ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );\n\n\t\t\t\t\trenderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture, renderTarget ) : pmremGenerator.fromCubemap( texture, renderTarget );\n\t\t\t\t\tcubeUVmaps.set( texture, renderTarget );\n\n\t\t\t\t\treturn renderTarget.texture;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( cubeUVmaps.has( texture ) ) {\n\n\t\t\t\t\t\treturn cubeUVmaps.get( texture ).texture;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst image = texture.image;\n\n\t\t\t\t\t\tif ( ( isEquirectMap && image && image.height > 0 ) || ( isCubeMap && image && isCubeTextureComplete( image ) ) ) {\n\n\t\t\t\t\t\t\tif ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );\n\n\t\t\t\t\t\t\tconst renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture ) : pmremGenerator.fromCubemap( texture );\n\t\t\t\t\t\t\tcubeUVmaps.set( texture, renderTarget );\n\n\t\t\t\t\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t\t\t\t\t\treturn renderTarget.texture;\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// image not yet ready. try the conversion next frame\n\n\t\t\t\t\t\t\treturn null;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction isCubeTextureComplete( image ) {\n\n\t\tlet count = 0;\n\t\tconst length = 6;\n\n\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\tif ( image[ i ] !== undefined ) count ++;\n\n\t\t}\n\n\t\treturn count === length;\n\n\n\t}\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tconst cubemapUV = cubeUVmaps.get( texture );\n\n\t\tif ( cubemapUV !== undefined ) {\n\n\t\t\tcubeUVmaps.delete( texture );\n\t\t\tcubemapUV.dispose();\n\n\t\t}\n\n\t}\n\n\tfunction dispose() {\n\n\t\tcubeUVmaps = new WeakMap();\n\n\t\tif ( pmremGenerator !== null ) {\n\n\t\t\tpmremGenerator.dispose();\n\t\t\tpmremGenerator = null;\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction WebGLExtensions( gl ) {\n\n\tconst extensions = {};\n\n\tfunction getExtension( name ) {\n\n\t\tif ( extensions[ name ] !== undefined ) {\n\n\t\t\treturn extensions[ name ];\n\n\t\t}\n\n\t\tlet extension;\n\n\t\tswitch ( name ) {\n\n\t\t\tcase 'WEBGL_depth_texture':\n\t\t\t\textension = gl.getExtension( 'WEBGL_depth_texture' ) || gl.getExtension( 'MOZ_WEBGL_depth_texture' ) || gl.getExtension( 'WEBKIT_WEBGL_depth_texture' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'EXT_texture_filter_anisotropic':\n\t\t\t\textension = gl.getExtension( 'EXT_texture_filter_anisotropic' ) || gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'WEBGL_compressed_texture_s3tc':\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'WEBGL_compressed_texture_pvrtc':\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\textension = gl.getExtension( name );\n\n\t\t}\n\n\t\textensions[ name ] = extension;\n\n\t\treturn extension;\n\n\t}\n\n\treturn {\n\n\t\thas: function ( name ) {\n\n\t\t\treturn getExtension( name ) !== null;\n\n\t\t},\n\n\t\tinit: function ( capabilities ) {\n\n\t\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t\tgetExtension( 'EXT_color_buffer_float' );\n\n\t\t\t} else {\n\n\t\t\t\tgetExtension( 'WEBGL_depth_texture' );\n\t\t\t\tgetExtension( 'OES_texture_float' );\n\t\t\t\tgetExtension( 'OES_texture_half_float' );\n\t\t\t\tgetExtension( 'OES_texture_half_float_linear' );\n\t\t\t\tgetExtension( 'OES_standard_derivatives' );\n\t\t\t\tgetExtension( 'OES_element_index_uint' );\n\t\t\t\tgetExtension( 'OES_vertex_array_object' );\n\t\t\t\tgetExtension( 'ANGLE_instanced_arrays' );\n\n\t\t\t}\n\n\t\t\tgetExtension( 'OES_texture_float_linear' );\n\t\t\tgetExtension( 'EXT_color_buffer_half_float' );\n\t\t\tgetExtension( 'WEBGL_multisampled_render_to_texture' );\n\n\t\t},\n\n\t\tget: function ( name ) {\n\n\t\t\tconst extension = getExtension( name );\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: ' + name + ' extension not supported.' );\n\n\t\t\t}\n\n\t\t\treturn extension;\n\n\t\t}\n\n\t};\n\n}\n\nfunction WebGLGeometries( gl, attributes, info, bindingStates ) {\n\n\tconst geometries = {};\n\tconst wireframeAttributes = new WeakMap();\n\n\tfunction onGeometryDispose( event ) {\n\n\t\tconst geometry = event.target;\n\n\t\tif ( geometry.index !== null ) {\n\n\t\t\tattributes.remove( geometry.index );\n\n\t\t}\n\n\t\tfor ( const name in geometry.attributes ) {\n\n\t\t\tattributes.remove( geometry.attributes[ name ] );\n\n\t\t}\n\n\t\tfor ( const name in geometry.morphAttributes ) {\n\n\t\t\tconst array = geometry.morphAttributes[ name ];\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tattributes.remove( array[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.removeEventListener( 'dispose', onGeometryDispose );\n\n\t\tdelete geometries[ geometry.id ];\n\n\t\tconst attribute = wireframeAttributes.get( geometry );\n\n\t\tif ( attribute ) {\n\n\t\t\tattributes.remove( attribute );\n\t\t\twireframeAttributes.delete( geometry );\n\n\t\t}\n\n\t\tbindingStates.releaseStatesOfGeometry( geometry );\n\n\t\tif ( geometry.isInstancedBufferGeometry === true ) {\n\n\t\t\tdelete geometry._maxInstanceCount;\n\n\t\t}\n\n\t\t//\n\n\t\tinfo.memory.geometries --;\n\n\t}\n\n\tfunction get( object, geometry ) {\n\n\t\tif ( geometries[ geometry.id ] === true ) return geometry;\n\n\t\tgeometry.addEventListener( 'dispose', onGeometryDispose );\n\n\t\tgeometries[ geometry.id ] = true;\n\n\t\tinfo.memory.geometries ++;\n\n\t\treturn geometry;\n\n\t}\n\n\tfunction update( geometry ) {\n\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\t// Updating index buffer in VAO now. See WebGLBindingStates.\n\n\t\tfor ( const name in geometryAttributes ) {\n\n\t\t\tattributes.update( geometryAttributes[ name ], gl.ARRAY_BUFFER );\n\n\t\t}\n\n\t\t// morph targets\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst array = morphAttributes[ name ];\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tattributes.update( array[ i ], gl.ARRAY_BUFFER );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction updateWireframeAttribute( geometry ) {\n\n\t\tconst indices = [];\n\n\t\tconst geometryIndex = geometry.index;\n\t\tconst geometryPosition = geometry.attributes.position;\n\t\tlet version = 0;\n\n\t\tif ( geometryIndex !== null ) {\n\n\t\t\tconst array = geometryIndex.array;\n\t\t\tversion = geometryIndex.version;\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i += 3 ) {\n\n\t\t\t\tconst a = array[ i + 0 ];\n\t\t\t\tconst b = array[ i + 1 ];\n\t\t\t\tconst c = array[ i + 2 ];\n\n\t\t\t\tindices.push( a, b, b, c, c, a );\n\n\t\t\t}\n\n\t\t} else if ( geometryPosition !== undefined ) {\n\n\t\t\tconst array = geometryPosition.array;\n\t\t\tversion = geometryPosition.version;\n\n\t\t\tfor ( let i = 0, l = ( array.length / 3 ) - 1; i < l; i += 3 ) {\n\n\t\t\t\tconst a = i + 0;\n\t\t\t\tconst b = i + 1;\n\t\t\t\tconst c = i + 2;\n\n\t\t\t\tindices.push( a, b, b, c, c, a );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst attribute = new ( arrayNeedsUint32( indices ) ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );\n\t\tattribute.version = version;\n\n\t\t// Updating index buffer in VAO now. See WebGLBindingStates\n\n\t\t//\n\n\t\tconst previousAttribute = wireframeAttributes.get( geometry );\n\n\t\tif ( previousAttribute ) attributes.remove( previousAttribute );\n\n\t\t//\n\n\t\twireframeAttributes.set( geometry, attribute );\n\n\t}\n\n\tfunction getWireframeAttribute( geometry ) {\n\n\t\tconst currentAttribute = wireframeAttributes.get( geometry );\n\n\t\tif ( currentAttribute ) {\n\n\t\t\tconst geometryIndex = geometry.index;\n\n\t\t\tif ( geometryIndex !== null ) {\n\n\t\t\t\t// if the attribute is obsolete, create a new one\n\n\t\t\t\tif ( currentAttribute.version < geometryIndex.version ) {\n\n\t\t\t\t\tupdateWireframeAttribute( geometry );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tupdateWireframeAttribute( geometry );\n\n\t\t}\n\n\t\treturn wireframeAttributes.get( geometry );\n\n\t}\n\n\treturn {\n\n\t\tget: get,\n\t\tupdate: update,\n\n\t\tgetWireframeAttribute: getWireframeAttribute\n\n\t};\n\n}\n\nfunction WebGLIndexedBufferRenderer( gl, extensions, info, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tlet mode;\n\n\tfunction setMode( value ) {\n\n\t\tmode = value;\n\n\t}\n\n\tlet type, bytesPerElement;\n\n\tfunction setIndex( value ) {\n\n\t\ttype = value.type;\n\t\tbytesPerElement = value.bytesPerElement;\n\n\t}\n\n\tfunction render( start, count ) {\n\n\t\tgl.drawElements( mode, count, type, start * bytesPerElement );\n\n\t\tinfo.update( count, mode, 1 );\n\n\t}\n\n\tfunction renderInstances( start, count, primcount ) {\n\n\t\tif ( primcount === 0 ) return;\n\n\t\tlet extension, methodName;\n\n\t\tif ( isWebGL2 ) {\n\n\t\t\textension = gl;\n\t\t\tmethodName = 'drawElementsInstanced';\n\n\t\t} else {\n\n\t\t\textension = extensions.get( 'ANGLE_instanced_arrays' );\n\t\t\tmethodName = 'drawElementsInstancedANGLE';\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\textension[ methodName ]( mode, count, type, start * bytesPerElement, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.setIndex = setIndex;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\n}\n\nfunction WebGLInfo( gl ) {\n\n\tconst memory = {\n\t\tgeometries: 0,\n\t\ttextures: 0\n\t};\n\n\tconst render = {\n\t\tframe: 0,\n\t\tcalls: 0,\n\t\ttriangles: 0,\n\t\tpoints: 0,\n\t\tlines: 0\n\t};\n\n\tfunction update( count, mode, instanceCount ) {\n\n\t\trender.calls ++;\n\n\t\tswitch ( mode ) {\n\n\t\t\tcase gl.TRIANGLES:\n\t\t\t\trender.triangles += instanceCount * ( count / 3 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINES:\n\t\t\t\trender.lines += instanceCount * ( count / 2 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINE_STRIP:\n\t\t\t\trender.lines += instanceCount * ( count - 1 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINE_LOOP:\n\t\t\t\trender.lines += instanceCount * count;\n\t\t\t\tbreak;\n\n\t\t\tcase gl.POINTS:\n\t\t\t\trender.points += instanceCount * count;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tconsole.error( 'THREE.WebGLInfo: Unknown draw mode:', mode );\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\tfunction reset() {\n\n\t\trender.calls = 0;\n\t\trender.triangles = 0;\n\t\trender.points = 0;\n\t\trender.lines = 0;\n\n\t}\n\n\treturn {\n\t\tmemory: memory,\n\t\trender: render,\n\t\tprograms: null,\n\t\tautoReset: true,\n\t\treset: reset,\n\t\tupdate: update\n\t};\n\n}\n\nfunction numericalSort( a, b ) {\n\n\treturn a[ 0 ] - b[ 0 ];\n\n}\n\nfunction absNumericalSort( a, b ) {\n\n\treturn Math.abs( b[ 1 ] ) - Math.abs( a[ 1 ] );\n\n}\n\nfunction WebGLMorphtargets( gl, capabilities, textures ) {\n\n\tconst influencesList = {};\n\tconst morphInfluences = new Float32Array( 8 );\n\tconst morphTextures = new WeakMap();\n\tconst morph = new Vector4();\n\n\tconst workInfluences = [];\n\n\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\tworkInfluences[ i ] = [ i, 0 ];\n\n\t}\n\n\tfunction update( object, geometry, program ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\tif ( capabilities.isWebGL2 === true ) {\n\n\t\t\t// instead of using attributes, the WebGL 2 code path encodes morph targets\n\t\t\t// into an array of data textures. Each layer represents a single morph target.\n\n\t\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\t\tlet entry = morphTextures.get( geometry );\n\n\t\t\tif ( entry === undefined || entry.count !== morphTargetsCount ) {\n\n\t\t\t\tif ( entry !== undefined ) entry.texture.dispose();\n\n\t\t\t\tconst hasMorphPosition = geometry.morphAttributes.position !== undefined;\n\t\t\t\tconst hasMorphNormals = geometry.morphAttributes.normal !== undefined;\n\t\t\t\tconst hasMorphColors = geometry.morphAttributes.color !== undefined;\n\n\t\t\t\tconst morphTargets = geometry.morphAttributes.position || [];\n\t\t\t\tconst morphNormals = geometry.morphAttributes.normal || [];\n\t\t\t\tconst morphColors = geometry.morphAttributes.color || [];\n\n\t\t\t\tlet vertexDataCount = 0;\n\n\t\t\t\tif ( hasMorphPosition === true ) vertexDataCount = 1;\n\t\t\t\tif ( hasMorphNormals === true ) vertexDataCount = 2;\n\t\t\t\tif ( hasMorphColors === true ) vertexDataCount = 3;\n\n\t\t\t\tlet width = geometry.attributes.position.count * vertexDataCount;\n\t\t\t\tlet height = 1;\n\n\t\t\t\tif ( width > capabilities.maxTextureSize ) {\n\n\t\t\t\t\theight = Math.ceil( width / capabilities.maxTextureSize );\n\t\t\t\t\twidth = capabilities.maxTextureSize;\n\n\t\t\t\t}\n\n\t\t\t\tconst buffer = new Float32Array( width * height * 4 * morphTargetsCount );\n\n\t\t\t\tconst texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );\n\t\t\t\ttexture.type = FloatType;\n\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t// fill buffer\n\n\t\t\t\tconst vertexDataStride = vertexDataCount * 4;\n\n\t\t\t\tfor ( let i = 0; i < morphTargetsCount; i ++ ) {\n\n\t\t\t\t\tconst morphTarget = morphTargets[ i ];\n\t\t\t\t\tconst morphNormal = morphNormals[ i ];\n\t\t\t\t\tconst morphColor = morphColors[ i ];\n\n\t\t\t\t\tconst offset = width * height * 4 * i;\n\n\t\t\t\t\tfor ( let j = 0; j < morphTarget.count; j ++ ) {\n\n\t\t\t\t\t\tconst stride = j * vertexDataStride;\n\n\t\t\t\t\t\tif ( hasMorphPosition === true ) {\n\n\t\t\t\t\t\t\tmorph.fromBufferAttribute( morphTarget, j );\n\n\t\t\t\t\t\t\tbuffer[ offset + stride + 0 ] = morph.x;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 1 ] = morph.y;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 2 ] = morph.z;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 3 ] = 0;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( hasMorphNormals === true ) {\n\n\t\t\t\t\t\t\tmorph.fromBufferAttribute( morphNormal, j );\n\n\t\t\t\t\t\t\tbuffer[ offset + stride + 4 ] = morph.x;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 5 ] = morph.y;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 6 ] = morph.z;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 7 ] = 0;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( hasMorphColors === true ) {\n\n\t\t\t\t\t\t\tmorph.fromBufferAttribute( morphColor, j );\n\n\t\t\t\t\t\t\tbuffer[ offset + stride + 8 ] = morph.x;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 9 ] = morph.y;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 10 ] = morph.z;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tentry = {\n\t\t\t\t\tcount: morphTargetsCount,\n\t\t\t\t\ttexture: texture,\n\t\t\t\t\tsize: new Vector2( width, height )\n\t\t\t\t};\n\n\t\t\t\tmorphTextures.set( geometry, entry );\n\n\t\t\t\tfunction disposeTexture() {\n\n\t\t\t\t\ttexture.dispose();\n\n\t\t\t\t\tmorphTextures.delete( geometry );\n\n\t\t\t\t\tgeometry.removeEventListener( 'dispose', disposeTexture );\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.addEventListener( 'dispose', disposeTexture );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet morphInfluencesSum = 0;\n\n\t\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\n\n\t\t\t\tmorphInfluencesSum += objectInfluences[ i ];\n\n\t\t\t}\n\n\t\t\tconst morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );\n\n\n\t\t} else {\n\n\t\t\t// When object doesn't have morph target influences defined, we treat it as a 0-length array\n\t\t\t// This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences\n\n\t\t\tconst length = objectInfluences === undefined ? 0 : objectInfluences.length;\n\n\t\t\tlet influences = influencesList[ geometry.id ];\n\n\t\t\tif ( influences === undefined || influences.length !== length ) {\n\n\t\t\t\t// initialise list\n\n\t\t\t\tinfluences = [];\n\n\t\t\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\t\t\tinfluences[ i ] = [ i, 0 ];\n\n\t\t\t\t}\n\n\t\t\t\tinfluencesList[ geometry.id ] = influences;\n\n\t\t\t}\n\n\t\t\t// Collect influences\n\n\t\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\t\tconst influence = influences[ i ];\n\n\t\t\t\tinfluence[ 0 ] = i;\n\t\t\t\tinfluence[ 1 ] = objectInfluences[ i ];\n\n\t\t\t}\n\n\t\t\tinfluences.sort( absNumericalSort );\n\n\t\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\t\tif ( i < length && influences[ i ][ 1 ] ) {\n\n\t\t\t\t\tworkInfluences[ i ][ 0 ] = influences[ i ][ 0 ];\n\t\t\t\t\tworkInfluences[ i ][ 1 ] = influences[ i ][ 1 ];\n\n\t\t\t\t} else {\n\n\t\t\t\t\tworkInfluences[ i ][ 0 ] = Number.MAX_SAFE_INTEGER;\n\t\t\t\t\tworkInfluences[ i ][ 1 ] = 0;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tworkInfluences.sort( numericalSort );\n\n\t\t\tconst morphTargets = geometry.morphAttributes.position;\n\t\t\tconst morphNormals = geometry.morphAttributes.normal;\n\n\t\t\tlet morphInfluencesSum = 0;\n\n\t\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\t\tconst influence = workInfluences[ i ];\n\t\t\t\tconst index = influence[ 0 ];\n\t\t\t\tconst value = influence[ 1 ];\n\n\t\t\t\tif ( index !== Number.MAX_SAFE_INTEGER && value ) {\n\n\t\t\t\t\tif ( morphTargets && geometry.getAttribute( 'morphTarget' + i ) !== morphTargets[ index ] ) {\n\n\t\t\t\t\t\tgeometry.setAttribute( 'morphTarget' + i, morphTargets[ index ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( morphNormals && geometry.getAttribute( 'morphNormal' + i ) !== morphNormals[ index ] ) {\n\n\t\t\t\t\t\tgeometry.setAttribute( 'morphNormal' + i, morphNormals[ index ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tmorphInfluences[ i ] = value;\n\t\t\t\t\tmorphInfluencesSum += value;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( morphTargets && geometry.hasAttribute( 'morphTarget' + i ) === true ) {\n\n\t\t\t\t\t\tgeometry.deleteAttribute( 'morphTarget' + i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( morphNormals && geometry.hasAttribute( 'morphNormal' + i ) === true ) {\n\n\t\t\t\t\t\tgeometry.deleteAttribute( 'morphNormal' + i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tmorphInfluences[ i ] = 0;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// GLSL shader uses formula baseinfluence * base + sum(target * influence)\n\t\t\t// This allows us to switch between absolute morphs and relative morphs without changing shader code\n\t\t\t// When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence)\n\t\t\tconst morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetInfluences', morphInfluences );\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\tupdate: update\n\n\t};\n\n}\n\nfunction WebGLObjects( gl, geometries, attributes, info ) {\n\n\tlet updateMap = new WeakMap();\n\n\tfunction update( object ) {\n\n\t\tconst frame = info.render.frame;\n\n\t\tconst geometry = object.geometry;\n\t\tconst buffergeometry = geometries.get( object, geometry );\n\n\t\t// Update once per frame\n\n\t\tif ( updateMap.get( buffergeometry ) !== frame ) {\n\n\t\t\tgeometries.update( buffergeometry );\n\n\t\t\tupdateMap.set( buffergeometry, frame );\n\n\t\t}\n\n\t\tif ( object.isInstancedMesh ) {\n\n\t\t\tif ( object.hasEventListener( 'dispose', onInstancedMeshDispose ) === false ) {\n\n\t\t\t\tobject.addEventListener( 'dispose', onInstancedMeshDispose );\n\n\t\t\t}\n\n\t\t\tif ( updateMap.get( object ) !== frame ) {\n\n\t\t\t\tattributes.update( object.instanceMatrix, gl.ARRAY_BUFFER );\n\n\t\t\t\tif ( object.instanceColor !== null ) {\n\n\t\t\t\t\tattributes.update( object.instanceColor, gl.ARRAY_BUFFER );\n\n\t\t\t\t}\n\n\t\t\t\tupdateMap.set( object, frame );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( object.isSkinnedMesh ) {\n\n\t\t\tconst skeleton = object.skeleton;\n\n\t\t\tif ( updateMap.get( skeleton ) !== frame ) {\n\n\t\t\t\tskeleton.update();\n\n\t\t\t\tupdateMap.set( skeleton, frame );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn buffergeometry;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tupdateMap = new WeakMap();\n\n\t}\n\n\tfunction onInstancedMeshDispose( event ) {\n\n\t\tconst instancedMesh = event.target;\n\n\t\tinstancedMesh.removeEventListener( 'dispose', onInstancedMeshDispose );\n\n\t\tattributes.remove( instancedMesh.instanceMatrix );\n\n\t\tif ( instancedMesh.instanceColor !== null ) attributes.remove( instancedMesh.instanceColor );\n\n\t}\n\n\treturn {\n\n\t\tupdate: update,\n\t\tdispose: dispose\n\n\t};\n\n}\n\n/**\n * Uniforms of a program.\n * Those form a tree structure with a special top-level container for the root,\n * which you get by calling 'new WebGLUniforms( gl, program )'.\n *\n *\n * Properties of inner nodes including the top-level container:\n *\n * .seq - array of nested uniforms\n * .map - nested uniforms by name\n *\n *\n * Methods of all nodes except the top-level container:\n *\n * .setValue( gl, value, [textures] )\n *\n * \t\tuploads a uniform value(s)\n * \tthe 'textures' parameter is needed for sampler uniforms\n *\n *\n * Static methods of the top-level container (textures factorizations):\n *\n * .upload( gl, seq, values, textures )\n *\n * \t\tsets uniforms in 'seq' to 'values[id].value'\n *\n * .seqWithValue( seq, values ) : filteredSeq\n *\n * \t\tfilters 'seq' entries with corresponding entry in values\n *\n *\n * Methods of the top-level container (textures factorizations):\n *\n * .setValue( gl, name, value, textures )\n *\n * \t\tsets uniform with name 'name' to 'value'\n *\n * .setOptional( gl, obj, prop )\n *\n * \t\tlike .set for an optional property of the object\n *\n */\n\n\nconst emptyTexture = /*@__PURE__*/ new Texture();\nconst emptyArrayTexture = /*@__PURE__*/ new DataArrayTexture();\nconst empty3dTexture = /*@__PURE__*/ new Data3DTexture();\nconst emptyCubeTexture = /*@__PURE__*/ new CubeTexture();\n\n// --- Utilities ---\n\n// Array Caches (provide typed arrays for temporary by size)\n\nconst arrayCacheF32 = [];\nconst arrayCacheI32 = [];\n\n// Float32Array caches used for uploading Matrix uniforms\n\nconst mat4array = new Float32Array( 16 );\nconst mat3array = new Float32Array( 9 );\nconst mat2array = new Float32Array( 4 );\n\n// Flattening for arrays of vectors and matrices\n\nfunction flatten( array, nBlocks, blockSize ) {\n\n\tconst firstElem = array[ 0 ];\n\n\tif ( firstElem <= 0 || firstElem > 0 ) return array;\n\t// unoptimized: ! isNaN( firstElem )\n\t// see http://jacksondunstan.com/articles/983\n\n\tconst n = nBlocks * blockSize;\n\tlet r = arrayCacheF32[ n ];\n\n\tif ( r === undefined ) {\n\n\t\tr = new Float32Array( n );\n\t\tarrayCacheF32[ n ] = r;\n\n\t}\n\n\tif ( nBlocks !== 0 ) {\n\n\t\tfirstElem.toArray( r, 0 );\n\n\t\tfor ( let i = 1, offset = 0; i !== nBlocks; ++ i ) {\n\n\t\t\toffset += blockSize;\n\t\t\tarray[ i ].toArray( r, offset );\n\n\t\t}\n\n\t}\n\n\treturn r;\n\n}\n\nfunction arraysEqual( a, b ) {\n\n\tif ( a.length !== b.length ) return false;\n\n\tfor ( let i = 0, l = a.length; i < l; i ++ ) {\n\n\t\tif ( a[ i ] !== b[ i ] ) return false;\n\n\t}\n\n\treturn true;\n\n}\n\nfunction copyArray( a, b ) {\n\n\tfor ( let i = 0, l = b.length; i < l; i ++ ) {\n\n\t\ta[ i ] = b[ i ];\n\n\t}\n\n}\n\n// Texture unit allocation\n\nfunction allocTexUnits( textures, n ) {\n\n\tlet r = arrayCacheI32[ n ];\n\n\tif ( r === undefined ) {\n\n\t\tr = new Int32Array( n );\n\t\tarrayCacheI32[ n ] = r;\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\tr[ i ] = textures.allocateTextureUnit();\n\n\t}\n\n\treturn r;\n\n}\n\n// --- Setters ---\n\n// Note: Defining these methods externally, because they come in a bunch\n// and this way their names minify.\n\n// Single scalar\n\nfunction setValueV1f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1f( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single float vector (from flat array or THREE.VectorN)\n\nfunction setValueV2f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2f( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3f( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else if ( v.r !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.r || cache[ 1 ] !== v.g || cache[ 2 ] !== v.b ) {\n\n\t\t\tgl.uniform3f( this.addr, v.r, v.g, v.b );\n\n\t\t\tcache[ 0 ] = v.r;\n\t\t\tcache[ 1 ] = v.g;\n\t\t\tcache[ 2 ] = v.b;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4f( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n// Single matrix (from flat array or THREE.MatrixN)\n\nfunction setValueM2( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix2fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat2array.set( elements );\n\n\t\tgl.uniformMatrix2fv( this.addr, false, mat2array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\nfunction setValueM3( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix3fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat3array.set( elements );\n\n\t\tgl.uniformMatrix3fv( this.addr, false, mat3array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\nfunction setValueM4( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix4fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat4array.set( elements );\n\n\t\tgl.uniformMatrix4fv( this.addr, false, mat4array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\n// Single integer / boolean\n\nfunction setValueV1i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1i( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single integer / boolean vector (from flat array or THREE.VectorN)\n\nfunction setValueV2i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2i( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3i( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4i( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n// Single unsigned integer\n\nfunction setValueV1ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1ui( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single unsigned integer vector (from flat array or THREE.VectorN)\n\nfunction setValueV2ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2ui( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3ui( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4ui( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n\n// Single texture (2D / Cube)\n\nfunction setValueT1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture2D( v || emptyTexture, unit );\n\n}\n\nfunction setValueT3D1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture3D( v || empty3dTexture, unit );\n\n}\n\nfunction setValueT6( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTextureCube( v || emptyCubeTexture, unit );\n\n}\n\nfunction setValueT2DArray1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture2DArray( v || emptyArrayTexture, unit );\n\n}\n\n// Helper to pick the right setter for the singular case\n\nfunction getSingularSetter( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase 0x1406: return setValueV1f; // FLOAT\n\t\tcase 0x8b50: return setValueV2f; // _VEC2\n\t\tcase 0x8b51: return setValueV3f; // _VEC3\n\t\tcase 0x8b52: return setValueV4f; // _VEC4\n\n\t\tcase 0x8b5a: return setValueM2; // _MAT2\n\t\tcase 0x8b5b: return setValueM3; // _MAT3\n\t\tcase 0x8b5c: return setValueM4; // _MAT4\n\n\t\tcase 0x1404: case 0x8b56: return setValueV1i; // INT, BOOL\n\t\tcase 0x8b53: case 0x8b57: return setValueV2i; // _VEC2\n\t\tcase 0x8b54: case 0x8b58: return setValueV3i; // _VEC3\n\t\tcase 0x8b55: case 0x8b59: return setValueV4i; // _VEC4\n\n\t\tcase 0x1405: return setValueV1ui; // UINT\n\t\tcase 0x8dc6: return setValueV2ui; // _VEC2\n\t\tcase 0x8dc7: return setValueV3ui; // _VEC3\n\t\tcase 0x8dc8: return setValueV4ui; // _VEC4\n\n\t\tcase 0x8b5e: // SAMPLER_2D\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\n\t\tcase 0x8dca: // INT_SAMPLER_2D\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\n\t\t\treturn setValueT1;\n\n\t\tcase 0x8b5f: // SAMPLER_3D\n\t\tcase 0x8dcb: // INT_SAMPLER_3D\n\t\tcase 0x8dd3: // UNSIGNED_INT_SAMPLER_3D\n\t\t\treturn setValueT3D1;\n\n\t\tcase 0x8b60: // SAMPLER_CUBE\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\n\t\t\treturn setValueT6;\n\n\t\tcase 0x8dc1: // SAMPLER_2D_ARRAY\n\t\tcase 0x8dcf: // INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW\n\t\t\treturn setValueT2DArray1;\n\n\t}\n\n}\n\n\n// Array of scalars\n\nfunction setValueV1fArray( gl, v ) {\n\n\tgl.uniform1fv( this.addr, v );\n\n}\n\n// Array of vectors (from flat array or array of THREE.VectorN)\n\nfunction setValueV2fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 2 );\n\n\tgl.uniform2fv( this.addr, data );\n\n}\n\nfunction setValueV3fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 3 );\n\n\tgl.uniform3fv( this.addr, data );\n\n}\n\nfunction setValueV4fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 4 );\n\n\tgl.uniform4fv( this.addr, data );\n\n}\n\n// Array of matrices (from flat array or array of THREE.MatrixN)\n\nfunction setValueM2Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 4 );\n\n\tgl.uniformMatrix2fv( this.addr, false, data );\n\n}\n\nfunction setValueM3Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 9 );\n\n\tgl.uniformMatrix3fv( this.addr, false, data );\n\n}\n\nfunction setValueM4Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 16 );\n\n\tgl.uniformMatrix4fv( this.addr, false, data );\n\n}\n\n// Array of integer / boolean\n\nfunction setValueV1iArray( gl, v ) {\n\n\tgl.uniform1iv( this.addr, v );\n\n}\n\n// Array of integer / boolean vectors (from flat array)\n\nfunction setValueV2iArray( gl, v ) {\n\n\tgl.uniform2iv( this.addr, v );\n\n}\n\nfunction setValueV3iArray( gl, v ) {\n\n\tgl.uniform3iv( this.addr, v );\n\n}\n\nfunction setValueV4iArray( gl, v ) {\n\n\tgl.uniform4iv( this.addr, v );\n\n}\n\n// Array of unsigned integer\n\nfunction setValueV1uiArray( gl, v ) {\n\n\tgl.uniform1uiv( this.addr, v );\n\n}\n\n// Array of unsigned integer vectors (from flat array)\n\nfunction setValueV2uiArray( gl, v ) {\n\n\tgl.uniform2uiv( this.addr, v );\n\n}\n\nfunction setValueV3uiArray( gl, v ) {\n\n\tgl.uniform3uiv( this.addr, v );\n\n}\n\nfunction setValueV4uiArray( gl, v ) {\n\n\tgl.uniform4uiv( this.addr, v );\n\n}\n\n\n// Array of textures (2D / 3D / Cube / 2DArray)\n\nfunction setValueT1Array( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture2D( v[ i ] || emptyTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT3DArray( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture3D( v[ i ] || empty3dTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT6Array( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTextureCube( v[ i ] || emptyCubeTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT2DArrayArray( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture2DArray( v[ i ] || emptyArrayTexture, units[ i ] );\n\n\t}\n\n}\n\n\n// Helper to pick the right setter for a pure (bottom-level) array\n\nfunction getPureArraySetter( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase 0x1406: return setValueV1fArray; // FLOAT\n\t\tcase 0x8b50: return setValueV2fArray; // _VEC2\n\t\tcase 0x8b51: return setValueV3fArray; // _VEC3\n\t\tcase 0x8b52: return setValueV4fArray; // _VEC4\n\n\t\tcase 0x8b5a: return setValueM2Array; // _MAT2\n\t\tcase 0x8b5b: return setValueM3Array; // _MAT3\n\t\tcase 0x8b5c: return setValueM4Array; // _MAT4\n\n\t\tcase 0x1404: case 0x8b56: return setValueV1iArray; // INT, BOOL\n\t\tcase 0x8b53: case 0x8b57: return setValueV2iArray; // _VEC2\n\t\tcase 0x8b54: case 0x8b58: return setValueV3iArray; // _VEC3\n\t\tcase 0x8b55: case 0x8b59: return setValueV4iArray; // _VEC4\n\n\t\tcase 0x1405: return setValueV1uiArray; // UINT\n\t\tcase 0x8dc6: return setValueV2uiArray; // _VEC2\n\t\tcase 0x8dc7: return setValueV3uiArray; // _VEC3\n\t\tcase 0x8dc8: return setValueV4uiArray; // _VEC4\n\n\t\tcase 0x8b5e: // SAMPLER_2D\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\n\t\tcase 0x8dca: // INT_SAMPLER_2D\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\n\t\t\treturn setValueT1Array;\n\n\t\tcase 0x8b5f: // SAMPLER_3D\n\t\tcase 0x8dcb: // INT_SAMPLER_3D\n\t\tcase 0x8dd3: // UNSIGNED_INT_SAMPLER_3D\n\t\t\treturn setValueT3DArray;\n\n\t\tcase 0x8b60: // SAMPLER_CUBE\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\n\t\t\treturn setValueT6Array;\n\n\t\tcase 0x8dc1: // SAMPLER_2D_ARRAY\n\t\tcase 0x8dcf: // INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW\n\t\t\treturn setValueT2DArrayArray;\n\n\t}\n\n}\n\n// --- Uniform Classes ---\n\nclass SingleUniform {\n\n\tconstructor( id, activeInfo, addr ) {\n\n\t\tthis.id = id;\n\t\tthis.addr = addr;\n\t\tthis.cache = [];\n\t\tthis.setValue = getSingularSetter( activeInfo.type );\n\n\t\t// this.path = activeInfo.name; // DEBUG\n\n\t}\n\n}\n\nclass PureArrayUniform {\n\n\tconstructor( id, activeInfo, addr ) {\n\n\t\tthis.id = id;\n\t\tthis.addr = addr;\n\t\tthis.cache = [];\n\t\tthis.size = activeInfo.size;\n\t\tthis.setValue = getPureArraySetter( activeInfo.type );\n\n\t\t// this.path = activeInfo.name; // DEBUG\n\n\t}\n\n}\n\nclass StructuredUniform {\n\n\tconstructor( id ) {\n\n\t\tthis.id = id;\n\n\t\tthis.seq = [];\n\t\tthis.map = {};\n\n\t}\n\n\tsetValue( gl, value, textures ) {\n\n\t\tconst seq = this.seq;\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ];\n\t\t\tu.setValue( gl, value[ u.id ], textures );\n\n\t\t}\n\n\t}\n\n}\n\n// --- Top-level ---\n\n// Parser - builds up the property tree from the path strings\n\nconst RePathPart = /(\\w+)(\\])?(\\[|\\.)?/g;\n\n// extracts\n// \t- the identifier (member name or array index)\n// - followed by an optional right bracket (found when array index)\n// - followed by an optional left bracket or dot (type of subscript)\n//\n// Note: These portions can be read in a non-overlapping fashion and\n// allow straightforward parsing of the hierarchy that WebGL encodes\n// in the uniform names.\n\nfunction addUniform( container, uniformObject ) {\n\n\tcontainer.seq.push( uniformObject );\n\tcontainer.map[ uniformObject.id ] = uniformObject;\n\n}\n\nfunction parseUniform( activeInfo, addr, container ) {\n\n\tconst path = activeInfo.name,\n\t\tpathLength = path.length;\n\n\t// reset RegExp object, because of the early exit of a previous run\n\tRePathPart.lastIndex = 0;\n\n\twhile ( true ) {\n\n\t\tconst match = RePathPart.exec( path ),\n\t\t\tmatchEnd = RePathPart.lastIndex;\n\n\t\tlet id = match[ 1 ];\n\t\tconst idIsIndex = match[ 2 ] === ']',\n\t\t\tsubscript = match[ 3 ];\n\n\t\tif ( idIsIndex ) id = id | 0; // convert to integer\n\n\t\tif ( subscript === undefined || subscript === '[' && matchEnd + 2 === pathLength ) {\n\n\t\t\t// bare name or \"pure\" bottom-level array \"[0]\" suffix\n\n\t\t\taddUniform( container, subscript === undefined ?\n\t\t\t\tnew SingleUniform( id, activeInfo, addr ) :\n\t\t\t\tnew PureArrayUniform( id, activeInfo, addr ) );\n\n\t\t\tbreak;\n\n\t\t} else {\n\n\t\t\t// step into inner node / create it in case it doesn't exist\n\n\t\t\tconst map = container.map;\n\t\t\tlet next = map[ id ];\n\n\t\t\tif ( next === undefined ) {\n\n\t\t\t\tnext = new StructuredUniform( id );\n\t\t\t\taddUniform( container, next );\n\n\t\t\t}\n\n\t\t\tcontainer = next;\n\n\t\t}\n\n\t}\n\n}\n\n// Root Container\n\nclass WebGLUniforms {\n\n\tconstructor( gl, program ) {\n\n\t\tthis.seq = [];\n\t\tthis.map = {};\n\n\t\tconst n = gl.getProgramParameter( program, gl.ACTIVE_UNIFORMS );\n\n\t\tfor ( let i = 0; i < n; ++ i ) {\n\n\t\t\tconst info = gl.getActiveUniform( program, i ),\n\t\t\t\taddr = gl.getUniformLocation( program, info.name );\n\n\t\t\tparseUniform( info, addr, this );\n\n\t\t}\n\n\t}\n\n\tsetValue( gl, name, value, textures ) {\n\n\t\tconst u = this.map[ name ];\n\n\t\tif ( u !== undefined ) u.setValue( gl, value, textures );\n\n\t}\n\n\tsetOptional( gl, object, name ) {\n\n\t\tconst v = object[ name ];\n\n\t\tif ( v !== undefined ) this.setValue( gl, name, v );\n\n\t}\n\n\tstatic upload( gl, seq, values, textures ) {\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ],\n\t\t\t\tv = values[ u.id ];\n\n\t\t\tif ( v.needsUpdate !== false ) {\n\n\t\t\t\t// note: always updating when .needsUpdate is undefined\n\t\t\t\tu.setValue( gl, v.value, textures );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tstatic seqWithValue( seq, values ) {\n\n\t\tconst r = [];\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ];\n\t\t\tif ( u.id in values ) r.push( u );\n\n\t\t}\n\n\t\treturn r;\n\n\t}\n\n}\n\nfunction WebGLShader( gl, type, string ) {\n\n\tconst shader = gl.createShader( type );\n\n\tgl.shaderSource( shader, string );\n\tgl.compileShader( shader );\n\n\treturn shader;\n\n}\n\n// From https://www.khronos.org/registry/webgl/extensions/KHR_parallel_shader_compile/\nconst COMPLETION_STATUS_KHR = 0x91B1;\n\nlet programIdCount = 0;\n\nfunction handleSource( string, errorLine ) {\n\n\tconst lines = string.split( '\\n' );\n\tconst lines2 = [];\n\n\tconst from = Math.max( errorLine - 6, 0 );\n\tconst to = Math.min( errorLine + 6, lines.length );\n\n\tfor ( let i = from; i < to; i ++ ) {\n\n\t\tconst line = i + 1;\n\t\tlines2.push( `${line === errorLine ? '>' : ' '} ${line}: ${lines[ i ]}` );\n\n\t}\n\n\treturn lines2.join( '\\n' );\n\n}\n\nfunction getEncodingComponents( colorSpace ) {\n\n\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\tconst encodingPrimaries = ColorManagement.getPrimaries( colorSpace );\n\n\tlet gamutMapping;\n\n\tif ( workingPrimaries === encodingPrimaries ) {\n\n\t\tgamutMapping = '';\n\n\t} else if ( workingPrimaries === P3Primaries && encodingPrimaries === Rec709Primaries ) {\n\n\t\tgamutMapping = 'LinearDisplayP3ToLinearSRGB';\n\n\t} else if ( workingPrimaries === Rec709Primaries && encodingPrimaries === P3Primaries ) {\n\n\t\tgamutMapping = 'LinearSRGBToLinearDisplayP3';\n\n\t}\n\n\tswitch ( colorSpace ) {\n\n\t\tcase LinearSRGBColorSpace:\n\t\tcase LinearDisplayP3ColorSpace:\n\t\t\treturn [ gamutMapping, 'LinearTransferOETF' ];\n\n\t\tcase SRGBColorSpace:\n\t\tcase DisplayP3ColorSpace:\n\t\t\treturn [ gamutMapping, 'sRGBTransferOETF' ];\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Unsupported color space:', colorSpace );\n\t\t\treturn [ gamutMapping, 'LinearTransferOETF' ];\n\n\t}\n\n}\n\nfunction getShaderErrors( gl, shader, type ) {\n\n\tconst status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );\n\tconst errors = gl.getShaderInfoLog( shader ).trim();\n\n\tif ( status && errors === '' ) return '';\n\n\tconst errorMatches = /ERROR: 0:(\\d+)/.exec( errors );\n\tif ( errorMatches ) {\n\n\t\t// --enable-privileged-webgl-extension\n\t\t// console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );\n\n\t\tconst errorLine = parseInt( errorMatches[ 1 ] );\n\t\treturn type.toUpperCase() + '\\n\\n' + errors + '\\n\\n' + handleSource( gl.getShaderSource( shader ), errorLine );\n\n\t} else {\n\n\t\treturn errors;\n\n\t}\n\n}\n\nfunction getTexelEncodingFunction( functionName, colorSpace ) {\n\n\tconst components = getEncodingComponents( colorSpace );\n\treturn `vec4 ${functionName}( vec4 value ) { return ${components[ 0 ]}( ${components[ 1 ]}( value ) ); }`;\n\n}\n\nfunction getToneMappingFunction( functionName, toneMapping ) {\n\n\tlet toneMappingName;\n\n\tswitch ( toneMapping ) {\n\n\t\tcase LinearToneMapping:\n\t\t\ttoneMappingName = 'Linear';\n\t\t\tbreak;\n\n\t\tcase ReinhardToneMapping:\n\t\t\ttoneMappingName = 'Reinhard';\n\t\t\tbreak;\n\n\t\tcase CineonToneMapping:\n\t\t\ttoneMappingName = 'OptimizedCineon';\n\t\t\tbreak;\n\n\t\tcase ACESFilmicToneMapping:\n\t\t\ttoneMappingName = 'ACESFilmic';\n\t\t\tbreak;\n\n\t\tcase CustomToneMapping:\n\t\t\ttoneMappingName = 'Custom';\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Unsupported toneMapping:', toneMapping );\n\t\t\ttoneMappingName = 'Linear';\n\n\t}\n\n\treturn 'vec3 ' + functionName + '( vec3 color ) { return ' + toneMappingName + 'ToneMapping( color ); }';\n\n}\n\nfunction generateExtensions( parameters ) {\n\n\tconst chunks = [\n\t\t( parameters.extensionDerivatives || !! parameters.envMapCubeUVHeight || parameters.bumpMap || parameters.normalMapTangentSpace || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '',\n\t\t( parameters.extensionFragDepth || parameters.logarithmicDepthBuffer ) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '',\n\t\t( parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ) ? '#extension GL_EXT_draw_buffers : require' : '',\n\t\t( parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission ) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : ''\n\t];\n\n\treturn chunks.filter( filterEmptyLine ).join( '\\n' );\n\n}\n\nfunction generateDefines( defines ) {\n\n\tconst chunks = [];\n\n\tfor ( const name in defines ) {\n\n\t\tconst value = defines[ name ];\n\n\t\tif ( value === false ) continue;\n\n\t\tchunks.push( '#define ' + name + ' ' + value );\n\n\t}\n\n\treturn chunks.join( '\\n' );\n\n}\n\nfunction fetchAttributeLocations( gl, program ) {\n\n\tconst attributes = {};\n\n\tconst n = gl.getProgramParameter( program, gl.ACTIVE_ATTRIBUTES );\n\n\tfor ( let i = 0; i < n; i ++ ) {\n\n\t\tconst info = gl.getActiveAttrib( program, i );\n\t\tconst name = info.name;\n\n\t\tlet locationSize = 1;\n\t\tif ( info.type === gl.FLOAT_MAT2 ) locationSize = 2;\n\t\tif ( info.type === gl.FLOAT_MAT3 ) locationSize = 3;\n\t\tif ( info.type === gl.FLOAT_MAT4 ) locationSize = 4;\n\n\t\t// console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );\n\n\t\tattributes[ name ] = {\n\t\t\ttype: info.type,\n\t\t\tlocation: gl.getAttribLocation( program, name ),\n\t\t\tlocationSize: locationSize\n\t\t};\n\n\t}\n\n\treturn attributes;\n\n}\n\nfunction filterEmptyLine( string ) {\n\n\treturn string !== '';\n\n}\n\nfunction replaceLightNums( string, parameters ) {\n\n\tconst numSpotLightCoords = parameters.numSpotLightShadows + parameters.numSpotLightMaps - parameters.numSpotLightShadowsWithMaps;\n\n\treturn string\n\t\t.replace( /NUM_DIR_LIGHTS/g, parameters.numDirLights )\n\t\t.replace( /NUM_SPOT_LIGHTS/g, parameters.numSpotLights )\n\t\t.replace( /NUM_SPOT_LIGHT_MAPS/g, parameters.numSpotLightMaps )\n\t\t.replace( /NUM_SPOT_LIGHT_COORDS/g, numSpotLightCoords )\n\t\t.replace( /NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights )\n\t\t.replace( /NUM_POINT_LIGHTS/g, parameters.numPointLights )\n\t\t.replace( /NUM_HEMI_LIGHTS/g, parameters.numHemiLights )\n\t\t.replace( /NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows )\n\t\t.replace( /NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, parameters.numSpotLightShadowsWithMaps )\n\t\t.replace( /NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows )\n\t\t.replace( /NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows );\n\n}\n\nfunction replaceClippingPlaneNums( string, parameters ) {\n\n\treturn string\n\t\t.replace( /NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes )\n\t\t.replace( /UNION_CLIPPING_PLANES/g, ( parameters.numClippingPlanes - parameters.numClipIntersection ) );\n\n}\n\n// Resolve Includes\n\nconst includePattern = /^[ \\t]*#include +<([\\w\\d./]+)>/gm;\n\nfunction resolveIncludes( string ) {\n\n\treturn string.replace( includePattern, includeReplacer );\n\n}\n\nconst shaderChunkMap = new Map( [\n\t[ 'encodings_fragment', 'colorspace_fragment' ], // @deprecated, r154\n\t[ 'encodings_pars_fragment', 'colorspace_pars_fragment' ], // @deprecated, r154\n\t[ 'output_fragment', 'opaque_fragment' ], // @deprecated, r154\n] );\n\nfunction includeReplacer( match, include ) {\n\n\tlet string = ShaderChunk[ include ];\n\n\tif ( string === undefined ) {\n\n\t\tconst newInclude = shaderChunkMap.get( include );\n\n\t\tif ( newInclude !== undefined ) {\n\n\t\t\tstring = ShaderChunk[ newInclude ];\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Shader chunk \"%s\" has been deprecated. Use \"%s\" instead.', include, newInclude );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'Can not resolve #include <' + include + '>' );\n\n\t\t}\n\n\t}\n\n\treturn resolveIncludes( string );\n\n}\n\n// Unroll Loops\n\nconst unrollLoopPattern = /#pragma unroll_loop_start\\s+for\\s*\\(\\s*int\\s+i\\s*=\\s*(\\d+)\\s*;\\s*i\\s*<\\s*(\\d+)\\s*;\\s*i\\s*\\+\\+\\s*\\)\\s*{([\\s\\S]+?)}\\s+#pragma unroll_loop_end/g;\n\nfunction unrollLoops( string ) {\n\n\treturn string.replace( unrollLoopPattern, loopReplacer );\n\n}\n\nfunction loopReplacer( match, start, end, snippet ) {\n\n\tlet string = '';\n\n\tfor ( let i = parseInt( start ); i < parseInt( end ); i ++ ) {\n\n\t\tstring += snippet\n\t\t\t.replace( /\\[\\s*i\\s*\\]/g, '[ ' + i + ' ]' )\n\t\t\t.replace( /UNROLLED_LOOP_INDEX/g, i );\n\n\t}\n\n\treturn string;\n\n}\n\n//\n\nfunction generatePrecision( parameters ) {\n\n\tlet precisionstring = 'precision ' + parameters.precision + ' float;\\nprecision ' + parameters.precision + ' int;';\n\n\tif ( parameters.precision === 'highp' ) {\n\n\t\tprecisionstring += '\\n#define HIGH_PRECISION';\n\n\t} else if ( parameters.precision === 'mediump' ) {\n\n\t\tprecisionstring += '\\n#define MEDIUM_PRECISION';\n\n\t} else if ( parameters.precision === 'lowp' ) {\n\n\t\tprecisionstring += '\\n#define LOW_PRECISION';\n\n\t}\n\n\treturn precisionstring;\n\n}\n\nfunction generateShadowMapTypeDefine( parameters ) {\n\n\tlet shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC';\n\n\tif ( parameters.shadowMapType === PCFShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF';\n\n\t} else if ( parameters.shadowMapType === PCFSoftShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF_SOFT';\n\n\t} else if ( parameters.shadowMapType === VSMShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_VSM';\n\n\t}\n\n\treturn shadowMapTypeDefine;\n\n}\n\nfunction generateEnvMapTypeDefine( parameters ) {\n\n\tlet envMapTypeDefine = 'ENVMAP_TYPE_CUBE';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.envMapMode ) {\n\n\t\t\tcase CubeReflectionMapping:\n\t\t\tcase CubeRefractionMapping:\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE';\n\t\t\t\tbreak;\n\n\t\t\tcase CubeUVReflectionMapping:\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapTypeDefine;\n\n}\n\nfunction generateEnvMapModeDefine( parameters ) {\n\n\tlet envMapModeDefine = 'ENVMAP_MODE_REFLECTION';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.envMapMode ) {\n\n\t\t\tcase CubeRefractionMapping:\n\n\t\t\t\tenvMapModeDefine = 'ENVMAP_MODE_REFRACTION';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapModeDefine;\n\n}\n\nfunction generateEnvMapBlendingDefine( parameters ) {\n\n\tlet envMapBlendingDefine = 'ENVMAP_BLENDING_NONE';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.combine ) {\n\n\t\t\tcase MultiplyOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY';\n\t\t\t\tbreak;\n\n\t\t\tcase MixOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MIX';\n\t\t\t\tbreak;\n\n\t\t\tcase AddOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_ADD';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapBlendingDefine;\n\n}\n\nfunction generateCubeUVSize( parameters ) {\n\n\tconst imageHeight = parameters.envMapCubeUVHeight;\n\n\tif ( imageHeight === null ) return null;\n\n\tconst maxMip = Math.log2( imageHeight ) - 2;\n\n\tconst texelHeight = 1.0 / imageHeight;\n\n\tconst texelWidth = 1.0 / ( 3 * Math.max( Math.pow( 2, maxMip ), 7 * 16 ) );\n\n\treturn { texelWidth, texelHeight, maxMip };\n\n}\n\nfunction WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {\n\n\t// TODO Send this event to Three.js DevTools\n\t// console.log( 'WebGLProgram', cacheKey );\n\n\tconst gl = renderer.getContext();\n\n\tconst defines = parameters.defines;\n\n\tlet vertexShader = parameters.vertexShader;\n\tlet fragmentShader = parameters.fragmentShader;\n\n\tconst shadowMapTypeDefine = generateShadowMapTypeDefine( parameters );\n\tconst envMapTypeDefine = generateEnvMapTypeDefine( parameters );\n\tconst envMapModeDefine = generateEnvMapModeDefine( parameters );\n\tconst envMapBlendingDefine = generateEnvMapBlendingDefine( parameters );\n\tconst envMapCubeUVSize = generateCubeUVSize( parameters );\n\n\tconst customExtensions = parameters.isWebGL2 ? '' : generateExtensions( parameters );\n\n\tconst customDefines = generateDefines( defines );\n\n\tconst program = gl.createProgram();\n\n\tlet prefixVertex, prefixFragment;\n\tlet versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\\n' : '';\n\n\tif ( parameters.isRawShaderMaterial ) {\n\n\t\tprefixVertex = [\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tif ( prefixVertex.length > 0 ) {\n\n\t\t\tprefixVertex += '\\n';\n\n\t\t}\n\n\t\tprefixFragment = [\n\n\t\t\tcustomExtensions,\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tif ( prefixFragment.length > 0 ) {\n\n\t\t\tprefixFragment += '\\n';\n\n\t\t}\n\n\t} else {\n\n\t\tprefixVertex = [\n\n\t\t\tgeneratePrecision( parameters ),\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines,\n\n\t\t\tparameters.instancing ? '#define USE_INSTANCING' : '',\n\t\t\tparameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',\n\n\t\t\tparameters.useFog && parameters.fog ? '#define USE_FOG' : '',\n\t\t\tparameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',\n\n\t\t\tparameters.map ? '#define USE_MAP' : '',\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\n\t\t\tparameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '',\n\t\t\tparameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '',\n\t\t\tparameters.displacementMap ? '#define USE_DISPLACEMENTMAP' : '',\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\n\n\t\t\tparameters.anisotropy ? '#define USE_ANISOTROPY' : '',\n\t\t\tparameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',\n\n\t\t\tparameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',\n\t\t\tparameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\n\n\t\t\tparameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',\n\t\t\tparameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',\n\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\n\t\t\tparameters.specularColorMap ? '#define USE_SPECULAR_COLORMAP' : '',\n\t\t\tparameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '',\n\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\n\t\t\tparameters.alphaHash ? '#define USE_ALPHAHASH' : '',\n\n\t\t\tparameters.transmission ? '#define USE_TRANSMISSION' : '',\n\t\t\tparameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',\n\t\t\tparameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',\n\n\t\t\tparameters.sheenColorMap ? '#define USE_SHEEN_COLORMAP' : '',\n\t\t\tparameters.sheenRoughnessMap ? '#define USE_SHEEN_ROUGHNESSMAP' : '',\n\n\t\t\t//\n\n\t\t\tparameters.mapUv ? '#define MAP_UV ' + parameters.mapUv : '',\n\t\t\tparameters.alphaMapUv ? '#define ALPHAMAP_UV ' + parameters.alphaMapUv : '',\n\t\t\tparameters.lightMapUv ? '#define LIGHTMAP_UV ' + parameters.lightMapUv : '',\n\t\t\tparameters.aoMapUv ? '#define AOMAP_UV ' + parameters.aoMapUv : '',\n\t\t\tparameters.emissiveMapUv ? '#define EMISSIVEMAP_UV ' + parameters.emissiveMapUv : '',\n\t\t\tparameters.bumpMapUv ? '#define BUMPMAP_UV ' + parameters.bumpMapUv : '',\n\t\t\tparameters.normalMapUv ? '#define NORMALMAP_UV ' + parameters.normalMapUv : '',\n\t\t\tparameters.displacementMapUv ? '#define DISPLACEMENTMAP_UV ' + parameters.displacementMapUv : '',\n\n\t\t\tparameters.metalnessMapUv ? '#define METALNESSMAP_UV ' + parameters.metalnessMapUv : '',\n\t\t\tparameters.roughnessMapUv ? '#define ROUGHNESSMAP_UV ' + parameters.roughnessMapUv : '',\n\n\t\t\tparameters.anisotropyMapUv ? '#define ANISOTROPYMAP_UV ' + parameters.anisotropyMapUv : '',\n\n\t\t\tparameters.clearcoatMapUv ? '#define CLEARCOATMAP_UV ' + parameters.clearcoatMapUv : '',\n\t\t\tparameters.clearcoatNormalMapUv ? '#define CLEARCOAT_NORMALMAP_UV ' + parameters.clearcoatNormalMapUv : '',\n\t\t\tparameters.clearcoatRoughnessMapUv ? '#define CLEARCOAT_ROUGHNESSMAP_UV ' + parameters.clearcoatRoughnessMapUv : '',\n\n\t\t\tparameters.iridescenceMapUv ? '#define IRIDESCENCEMAP_UV ' + parameters.iridescenceMapUv : '',\n\t\t\tparameters.iridescenceThicknessMapUv ? '#define IRIDESCENCE_THICKNESSMAP_UV ' + parameters.iridescenceThicknessMapUv : '',\n\n\t\t\tparameters.sheenColorMapUv ? '#define SHEEN_COLORMAP_UV ' + parameters.sheenColorMapUv : '',\n\t\t\tparameters.sheenRoughnessMapUv ? '#define SHEEN_ROUGHNESSMAP_UV ' + parameters.sheenRoughnessMapUv : '',\n\n\t\t\tparameters.specularMapUv ? '#define SPECULARMAP_UV ' + parameters.specularMapUv : '',\n\t\t\tparameters.specularColorMapUv ? '#define SPECULAR_COLORMAP_UV ' + parameters.specularColorMapUv : '',\n\t\t\tparameters.specularIntensityMapUv ? '#define SPECULAR_INTENSITYMAP_UV ' + parameters.specularIntensityMapUv : '',\n\n\t\t\tparameters.transmissionMapUv ? '#define TRANSMISSIONMAP_UV ' + parameters.transmissionMapUv : '',\n\t\t\tparameters.thicknessMapUv ? '#define THICKNESSMAP_UV ' + parameters.thicknessMapUv : '',\n\n\t\t\t//\n\n\t\t\tparameters.vertexTangents && parameters.flatShading === false ? '#define USE_TANGENT' : '',\n\t\t\tparameters.vertexColors ? '#define USE_COLOR' : '',\n\t\t\tparameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',\n\t\t\tparameters.vertexUv1s ? '#define USE_UV1' : '',\n\t\t\tparameters.vertexUv2s ? '#define USE_UV2' : '',\n\t\t\tparameters.vertexUv3s ? '#define USE_UV3' : '',\n\n\t\t\tparameters.pointsUvs ? '#define USE_POINTS_UV' : '',\n\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\n\n\t\t\tparameters.skinning ? '#define USE_SKINNING' : '',\n\n\t\t\tparameters.morphTargets ? '#define USE_MORPHTARGETS' : '',\n\t\t\tparameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',\n\t\t\t( parameters.morphColors && parameters.isWebGL2 ) ? '#define USE_MORPHCOLORS' : '',\n\t\t\t( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE' : '',\n\t\t\t( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',\n\t\t\t( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\n\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\n\n\t\t\tparameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',\n\n\t\t\tparameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',\n\n\t\t\tparameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\n\t\t\t( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',\n\n\t\t\t'uniform mat4 modelMatrix;',\n\t\t\t'uniform mat4 modelViewMatrix;',\n\t\t\t'uniform mat4 projectionMatrix;',\n\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t'uniform mat3 normalMatrix;',\n\t\t\t'uniform vec3 cameraPosition;',\n\t\t\t'uniform bool isOrthographic;',\n\n\t\t\t'#ifdef USE_INSTANCING',\n\n\t\t\t'\tattribute mat4 instanceMatrix;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_INSTANCING_COLOR',\n\n\t\t\t'\tattribute vec3 instanceColor;',\n\n\t\t\t'#endif',\n\n\t\t\t'attribute vec3 position;',\n\t\t\t'attribute vec3 normal;',\n\t\t\t'attribute vec2 uv;',\n\n\t\t\t'#ifdef USE_UV1',\n\n\t\t\t'\tattribute vec2 uv1;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_UV2',\n\n\t\t\t'\tattribute vec2 uv2;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_UV3',\n\n\t\t\t'\tattribute vec2 uv3;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_TANGENT',\n\n\t\t\t'\tattribute vec4 tangent;',\n\n\t\t\t'#endif',\n\n\t\t\t'#if defined( USE_COLOR_ALPHA )',\n\n\t\t\t'\tattribute vec4 color;',\n\n\t\t\t'#elif defined( USE_COLOR )',\n\n\t\t\t'\tattribute vec3 color;',\n\n\t\t\t'#endif',\n\n\t\t\t'#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )',\n\n\t\t\t'\tattribute vec3 morphTarget0;',\n\t\t\t'\tattribute vec3 morphTarget1;',\n\t\t\t'\tattribute vec3 morphTarget2;',\n\t\t\t'\tattribute vec3 morphTarget3;',\n\n\t\t\t'\t#ifdef USE_MORPHNORMALS',\n\n\t\t\t'\t\tattribute vec3 morphNormal0;',\n\t\t\t'\t\tattribute vec3 morphNormal1;',\n\t\t\t'\t\tattribute vec3 morphNormal2;',\n\t\t\t'\t\tattribute vec3 morphNormal3;',\n\n\t\t\t'\t#else',\n\n\t\t\t'\t\tattribute vec3 morphTarget4;',\n\t\t\t'\t\tattribute vec3 morphTarget5;',\n\t\t\t'\t\tattribute vec3 morphTarget6;',\n\t\t\t'\t\tattribute vec3 morphTarget7;',\n\n\t\t\t'\t#endif',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_SKINNING',\n\n\t\t\t'\tattribute vec4 skinIndex;',\n\t\t\t'\tattribute vec4 skinWeight;',\n\n\t\t\t'#endif',\n\n\t\t\t'\\n'\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tprefixFragment = [\n\n\t\t\tcustomExtensions,\n\n\t\t\tgeneratePrecision( parameters ),\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines,\n\n\t\t\tparameters.useFog && parameters.fog ? '#define USE_FOG' : '',\n\t\t\tparameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',\n\n\t\t\tparameters.map ? '#define USE_MAP' : '',\n\t\t\tparameters.matcap ? '#define USE_MATCAP' : '',\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\n\t\t\tparameters.envMap ? '#define ' + envMapTypeDefine : '',\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\n\t\t\tparameters.envMap ? '#define ' + envMapBlendingDefine : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_TEXEL_WIDTH ' + envMapCubeUVSize.texelWidth : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_TEXEL_HEIGHT ' + envMapCubeUVSize.texelHeight : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_MAX_MIP ' + envMapCubeUVSize.maxMip + '.0' : '',\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\n\t\t\tparameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '',\n\t\t\tparameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '',\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\n\n\t\t\tparameters.anisotropy ? '#define USE_ANISOTROPY' : '',\n\t\t\tparameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',\n\n\t\t\tparameters.clearcoat ? '#define USE_CLEARCOAT' : '',\n\t\t\tparameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',\n\t\t\tparameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\n\n\t\t\tparameters.iridescence ? '#define USE_IRIDESCENCE' : '',\n\t\t\tparameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',\n\t\t\tparameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',\n\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\n\t\t\tparameters.specularColorMap ? '#define USE_SPECULAR_COLORMAP' : '',\n\t\t\tparameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '',\n\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\n\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\n\t\t\tparameters.alphaTest ? '#define USE_ALPHATEST' : '',\n\t\t\tparameters.alphaHash ? '#define USE_ALPHAHASH' : '',\n\n\t\t\tparameters.sheen ? '#define USE_SHEEN' : '',\n\t\t\tparameters.sheenColorMap ? '#define USE_SHEEN_COLORMAP' : '',\n\t\t\tparameters.sheenRoughnessMap ? '#define USE_SHEEN_ROUGHNESSMAP' : '',\n\n\t\t\tparameters.transmission ? '#define USE_TRANSMISSION' : '',\n\t\t\tparameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',\n\t\t\tparameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',\n\n\t\t\tparameters.vertexTangents && parameters.flatShading === false ? '#define USE_TANGENT' : '',\n\t\t\tparameters.vertexColors || parameters.instancingColor ? '#define USE_COLOR' : '',\n\t\t\tparameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',\n\t\t\tparameters.vertexUv1s ? '#define USE_UV1' : '',\n\t\t\tparameters.vertexUv2s ? '#define USE_UV2' : '',\n\t\t\tparameters.vertexUv3s ? '#define USE_UV3' : '',\n\n\t\t\tparameters.pointsUvs ? '#define USE_POINTS_UV' : '',\n\n\t\t\tparameters.gradientMap ? '#define USE_GRADIENTMAP' : '',\n\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\n\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\n\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\n\n\t\t\tparameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '',\n\n\t\t\tparameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',\n\n\t\t\tparameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',\n\n\t\t\tparameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\n\t\t\t( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',\n\n\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t'uniform vec3 cameraPosition;',\n\t\t\t'uniform bool isOrthographic;',\n\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? '#define TONE_MAPPING' : '',\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? ShaderChunk[ 'tonemapping_pars_fragment' ] : '', // this code is required here because it is used by the toneMapping() function defined below\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( 'toneMapping', parameters.toneMapping ) : '',\n\n\t\t\tparameters.dithering ? '#define DITHERING' : '',\n\t\t\tparameters.opaque ? '#define OPAQUE' : '',\n\n\t\t\tShaderChunk[ 'colorspace_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below\n\t\t\tgetTexelEncodingFunction( 'linearToOutputTexel', parameters.outputColorSpace ),\n\n\t\t\tparameters.useDepthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '',\n\n\t\t\t'\\n'\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t}\n\n\tvertexShader = resolveIncludes( vertexShader );\n\tvertexShader = replaceLightNums( vertexShader, parameters );\n\tvertexShader = replaceClippingPlaneNums( vertexShader, parameters );\n\n\tfragmentShader = resolveIncludes( fragmentShader );\n\tfragmentShader = replaceLightNums( fragmentShader, parameters );\n\tfragmentShader = replaceClippingPlaneNums( fragmentShader, parameters );\n\n\tvertexShader = unrollLoops( vertexShader );\n\tfragmentShader = unrollLoops( fragmentShader );\n\n\tif ( parameters.isWebGL2 && parameters.isRawShaderMaterial !== true ) {\n\n\t\t// GLSL 3.0 conversion for built-in materials and ShaderMaterial\n\n\t\tversionString = '#version 300 es\\n';\n\n\t\tprefixVertex = [\n\t\t\t'precision mediump sampler2DArray;',\n\t\t\t'#define attribute in',\n\t\t\t'#define varying out',\n\t\t\t'#define texture2D texture'\n\t\t].join( '\\n' ) + '\\n' + prefixVertex;\n\n\t\tprefixFragment = [\n\t\t\t'precision mediump sampler2DArray;',\n\t\t\t'#define varying in',\n\t\t\t( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;',\n\t\t\t( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',\n\t\t\t'#define gl_FragDepthEXT gl_FragDepth',\n\t\t\t'#define texture2D texture',\n\t\t\t'#define textureCube texture',\n\t\t\t'#define texture2DProj textureProj',\n\t\t\t'#define texture2DLodEXT textureLod',\n\t\t\t'#define texture2DProjLodEXT textureProjLod',\n\t\t\t'#define textureCubeLodEXT textureLod',\n\t\t\t'#define texture2DGradEXT textureGrad',\n\t\t\t'#define texture2DProjGradEXT textureProjGrad',\n\t\t\t'#define textureCubeGradEXT textureGrad'\n\t\t].join( '\\n' ) + '\\n' + prefixFragment;\n\n\t}\n\n\tconst vertexGlsl = versionString + prefixVertex + vertexShader;\n\tconst fragmentGlsl = versionString + prefixFragment + fragmentShader;\n\n\t// console.log( '*VERTEX*', vertexGlsl );\n\t// console.log( '*FRAGMENT*', fragmentGlsl );\n\n\tconst glVertexShader = WebGLShader( gl, gl.VERTEX_SHADER, vertexGlsl );\n\tconst glFragmentShader = WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentGlsl );\n\n\tgl.attachShader( program, glVertexShader );\n\tgl.attachShader( program, glFragmentShader );\n\n\t// Force a particular attribute to index 0.\n\n\tif ( parameters.index0AttributeName !== undefined ) {\n\n\t\tgl.bindAttribLocation( program, 0, parameters.index0AttributeName );\n\n\t} else if ( parameters.morphTargets === true ) {\n\n\t\t// programs with morphTargets displace position out of attribute 0\n\t\tgl.bindAttribLocation( program, 0, 'position' );\n\n\t}\n\n\tgl.linkProgram( program );\n\n\tfunction onFirstUse( self ) {\n\n\t\t// check for link errors\n\t\tif ( renderer.debug.checkShaderErrors ) {\n\n\t\t\tconst programLog = gl.getProgramInfoLog( program ).trim();\n\t\t\tconst vertexLog = gl.getShaderInfoLog( glVertexShader ).trim();\n\t\t\tconst fragmentLog = gl.getShaderInfoLog( glFragmentShader ).trim();\n\n\t\t\tlet runnable = true;\n\t\t\tlet haveDiagnostics = true;\n\n\t\t\tif ( gl.getProgramParameter( program, gl.LINK_STATUS ) === false ) {\n\n\t\t\t\trunnable = false;\n\n\t\t\t\tif ( typeof renderer.debug.onShaderError === 'function' ) {\n\n\t\t\t\t\trenderer.debug.onShaderError( gl, program, glVertexShader, glFragmentShader );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// default error reporting\n\n\t\t\t\t\tconst vertexErrors = getShaderErrors( gl, glVertexShader, 'vertex' );\n\t\t\t\t\tconst fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );\n\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t'THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' +\n\t\t\t\t\t\t'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\\n\\n' +\n\t\t\t\t\t\t'Program Info Log: ' + programLog + '\\n' +\n\t\t\t\t\t\tvertexErrors + '\\n' +\n\t\t\t\t\t\tfragmentErrors\n\t\t\t\t\t);\n\n\t\t\t\t}\n\n\t\t\t} else if ( programLog !== '' ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLProgram: Program Info Log:', programLog );\n\n\t\t\t} else if ( vertexLog === '' || fragmentLog === '' ) {\n\n\t\t\t\thaveDiagnostics = false;\n\n\t\t\t}\n\n\t\t\tif ( haveDiagnostics ) {\n\n\t\t\t\tself.diagnostics = {\n\n\t\t\t\t\trunnable: runnable,\n\n\t\t\t\t\tprogramLog: programLog,\n\n\t\t\t\t\tvertexShader: {\n\n\t\t\t\t\t\tlog: vertexLog,\n\t\t\t\t\t\tprefix: prefixVertex\n\n\t\t\t\t\t},\n\n\t\t\t\t\tfragmentShader: {\n\n\t\t\t\t\t\tlog: fragmentLog,\n\t\t\t\t\t\tprefix: prefixFragment\n\n\t\t\t\t\t}\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Clean up\n\n\t\t// Crashes in iOS9 and iOS10. #18402\n\t\t// gl.detachShader( program, glVertexShader );\n\t\t// gl.detachShader( program, glFragmentShader );\n\n\t\tgl.deleteShader( glVertexShader );\n\t\tgl.deleteShader( glFragmentShader );\n\n\t\tcachedUniforms = new WebGLUniforms( gl, program );\n\t\tcachedAttributes = fetchAttributeLocations( gl, program );\n\n\t}\n\n\t// set up caching for uniform locations\n\n\tlet cachedUniforms;\n\n\tthis.getUniforms = function () {\n\n\t\tif ( cachedUniforms === undefined ) {\n\n\t\t\t// Populates cachedUniforms and cachedAttributes\n\t\t\tonFirstUse( this );\n\n\t\t}\n\n\t\treturn cachedUniforms;\n\n\t};\n\n\t// set up caching for attribute locations\n\n\tlet cachedAttributes;\n\n\tthis.getAttributes = function () {\n\n\t\tif ( cachedAttributes === undefined ) {\n\n\t\t\t// Populates cachedAttributes and cachedUniforms\n\t\t\tonFirstUse( this );\n\n\t\t}\n\n\t\treturn cachedAttributes;\n\n\t};\n\n\t// indicate when the program is ready to be used. if the KHR_parallel_shader_compile extension isn't supported,\n\t// flag the program as ready immediately. It may cause a stall when it's first used.\n\n\tlet programReady = ( parameters.rendererExtensionParallelShaderCompile === false );\n\n\tthis.isReady = function () {\n\n\t\tif ( programReady === false ) {\n\n\t\t\tprogramReady = gl.getProgramParameter( program, COMPLETION_STATUS_KHR );\n\n\t\t}\n\n\t\treturn programReady;\n\n\t};\n\n\t// free resource\n\n\tthis.destroy = function () {\n\n\t\tbindingStates.releaseStatesOfProgram( this );\n\n\t\tgl.deleteProgram( program );\n\t\tthis.program = undefined;\n\n\t};\n\n\t//\n\n\tthis.type = parameters.shaderType;\n\tthis.name = parameters.shaderName;\n\tthis.id = programIdCount ++;\n\tthis.cacheKey = cacheKey;\n\tthis.usedTimes = 1;\n\tthis.program = program;\n\tthis.vertexShader = glVertexShader;\n\tthis.fragmentShader = glFragmentShader;\n\n\treturn this;\n\n}\n\nlet _id$1 = 0;\n\nclass WebGLShaderCache {\n\n\tconstructor() {\n\n\t\tthis.shaderCache = new Map();\n\t\tthis.materialCache = new Map();\n\n\t}\n\n\tupdate( material ) {\n\n\t\tconst vertexShader = material.vertexShader;\n\t\tconst fragmentShader = material.fragmentShader;\n\n\t\tconst vertexShaderStage = this._getShaderStage( vertexShader );\n\t\tconst fragmentShaderStage = this._getShaderStage( fragmentShader );\n\n\t\tconst materialShaders = this._getShaderCacheForMaterial( material );\n\n\t\tif ( materialShaders.has( vertexShaderStage ) === false ) {\n\n\t\t\tmaterialShaders.add( vertexShaderStage );\n\t\t\tvertexShaderStage.usedTimes ++;\n\n\t\t}\n\n\t\tif ( materialShaders.has( fragmentShaderStage ) === false ) {\n\n\t\t\tmaterialShaders.add( fragmentShaderStage );\n\t\t\tfragmentShaderStage.usedTimes ++;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremove( material ) {\n\n\t\tconst materialShaders = this.materialCache.get( material );\n\n\t\tfor ( const shaderStage of materialShaders ) {\n\n\t\t\tshaderStage.usedTimes --;\n\n\t\t\tif ( shaderStage.usedTimes === 0 ) this.shaderCache.delete( shaderStage.code );\n\n\t\t}\n\n\t\tthis.materialCache.delete( material );\n\n\t\treturn this;\n\n\t}\n\n\tgetVertexShaderID( material ) {\n\n\t\treturn this._getShaderStage( material.vertexShader ).id;\n\n\t}\n\n\tgetFragmentShaderID( material ) {\n\n\t\treturn this._getShaderStage( material.fragmentShader ).id;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shaderCache.clear();\n\t\tthis.materialCache.clear();\n\n\t}\n\n\t_getShaderCacheForMaterial( material ) {\n\n\t\tconst cache = this.materialCache;\n\t\tlet set = cache.get( material );\n\n\t\tif ( set === undefined ) {\n\n\t\t\tset = new Set();\n\t\t\tcache.set( material, set );\n\n\t\t}\n\n\t\treturn set;\n\n\t}\n\n\t_getShaderStage( code ) {\n\n\t\tconst cache = this.shaderCache;\n\t\tlet stage = cache.get( code );\n\n\t\tif ( stage === undefined ) {\n\n\t\t\tstage = new WebGLShaderStage( code );\n\t\t\tcache.set( code, stage );\n\n\t\t}\n\n\t\treturn stage;\n\n\t}\n\n}\n\nclass WebGLShaderStage {\n\n\tconstructor( code ) {\n\n\t\tthis.id = _id$1 ++;\n\n\t\tthis.code = code;\n\t\tthis.usedTimes = 0;\n\n\t}\n\n}\n\nfunction WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping ) {\n\n\tconst _programLayers = new Layers();\n\tconst _customShaders = new WebGLShaderCache();\n\tconst programs = [];\n\n\tconst IS_WEBGL2 = capabilities.isWebGL2;\n\tconst logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;\n\tconst SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;\n\n\tlet precision = capabilities.precision;\n\n\tconst shaderIDs = {\n\t\tMeshDepthMaterial: 'depth',\n\t\tMeshDistanceMaterial: 'distanceRGBA',\n\t\tMeshNormalMaterial: 'normal',\n\t\tMeshBasicMaterial: 'basic',\n\t\tMeshLambertMaterial: 'lambert',\n\t\tMeshPhongMaterial: 'phong',\n\t\tMeshToonMaterial: 'toon',\n\t\tMeshStandardMaterial: 'physical',\n\t\tMeshPhysicalMaterial: 'physical',\n\t\tMeshMatcapMaterial: 'matcap',\n\t\tLineBasicMaterial: 'basic',\n\t\tLineDashedMaterial: 'dashed',\n\t\tPointsMaterial: 'points',\n\t\tShadowMaterial: 'shadow',\n\t\tSpriteMaterial: 'sprite'\n\t};\n\n\tfunction getChannel( value ) {\n\n\t\tif ( value === 0 ) return 'uv';\n\n\t\treturn `uv${ value }`;\n\n\t}\n\n\tfunction getParameters( material, lights, shadows, scene, object ) {\n\n\t\tconst fog = scene.fog;\n\t\tconst geometry = object.geometry;\n\t\tconst environment = material.isMeshStandardMaterial ? scene.environment : null;\n\n\t\tconst envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );\n\t\tconst envMapCubeUVHeight = ( !! envMap ) && ( envMap.mapping === CubeUVReflectionMapping ) ? envMap.image.height : null;\n\n\t\tconst shaderID = shaderIDs[ material.type ];\n\n\t\t// heuristics to create shader parameters according to lights in the scene\n\t\t// (not to blow over maxLights budget)\n\n\t\tif ( material.precision !== null ) {\n\n\t\t\tprecision = capabilities.getMaxPrecision( material.precision );\n\n\t\t\tif ( precision !== material.precision ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.' );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\tlet morphTextureStride = 0;\n\n\t\tif ( geometry.morphAttributes.position !== undefined ) morphTextureStride = 1;\n\t\tif ( geometry.morphAttributes.normal !== undefined ) morphTextureStride = 2;\n\t\tif ( geometry.morphAttributes.color !== undefined ) morphTextureStride = 3;\n\n\t\t//\n\n\t\tlet vertexShader, fragmentShader;\n\t\tlet customVertexShaderID, customFragmentShaderID;\n\n\t\tif ( shaderID ) {\n\n\t\t\tconst shader = ShaderLib[ shaderID ];\n\n\t\t\tvertexShader = shader.vertexShader;\n\t\t\tfragmentShader = shader.fragmentShader;\n\n\t\t} else {\n\n\t\t\tvertexShader = material.vertexShader;\n\t\t\tfragmentShader = material.fragmentShader;\n\n\t\t\t_customShaders.update( material );\n\n\t\t\tcustomVertexShaderID = _customShaders.getVertexShaderID( material );\n\t\t\tcustomFragmentShaderID = _customShaders.getFragmentShaderID( material );\n\n\t\t}\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\tconst IS_INSTANCEDMESH = object.isInstancedMesh === true;\n\n\t\tconst HAS_MAP = !! material.map;\n\t\tconst HAS_MATCAP = !! material.matcap;\n\t\tconst HAS_ENVMAP = !! envMap;\n\t\tconst HAS_AOMAP = !! material.aoMap;\n\t\tconst HAS_LIGHTMAP = !! material.lightMap;\n\t\tconst HAS_BUMPMAP = !! material.bumpMap;\n\t\tconst HAS_NORMALMAP = !! material.normalMap;\n\t\tconst HAS_DISPLACEMENTMAP = !! material.displacementMap;\n\t\tconst HAS_EMISSIVEMAP = !! material.emissiveMap;\n\n\t\tconst HAS_METALNESSMAP = !! material.metalnessMap;\n\t\tconst HAS_ROUGHNESSMAP = !! material.roughnessMap;\n\n\t\tconst HAS_ANISOTROPY = material.anisotropy > 0;\n\t\tconst HAS_CLEARCOAT = material.clearcoat > 0;\n\t\tconst HAS_IRIDESCENCE = material.iridescence > 0;\n\t\tconst HAS_SHEEN = material.sheen > 0;\n\t\tconst HAS_TRANSMISSION = material.transmission > 0;\n\n\t\tconst HAS_ANISOTROPYMAP = HAS_ANISOTROPY && !! material.anisotropyMap;\n\n\t\tconst HAS_CLEARCOATMAP = HAS_CLEARCOAT && !! material.clearcoatMap;\n\t\tconst HAS_CLEARCOAT_NORMALMAP = HAS_CLEARCOAT && !! material.clearcoatNormalMap;\n\t\tconst HAS_CLEARCOAT_ROUGHNESSMAP = HAS_CLEARCOAT && !! material.clearcoatRoughnessMap;\n\n\t\tconst HAS_IRIDESCENCEMAP = HAS_IRIDESCENCE && !! material.iridescenceMap;\n\t\tconst HAS_IRIDESCENCE_THICKNESSMAP = HAS_IRIDESCENCE && !! material.iridescenceThicknessMap;\n\n\t\tconst HAS_SHEEN_COLORMAP = HAS_SHEEN && !! material.sheenColorMap;\n\t\tconst HAS_SHEEN_ROUGHNESSMAP = HAS_SHEEN && !! material.sheenRoughnessMap;\n\n\t\tconst HAS_SPECULARMAP = !! material.specularMap;\n\t\tconst HAS_SPECULAR_COLORMAP = !! material.specularColorMap;\n\t\tconst HAS_SPECULAR_INTENSITYMAP = !! material.specularIntensityMap;\n\n\t\tconst HAS_TRANSMISSIONMAP = HAS_TRANSMISSION && !! material.transmissionMap;\n\t\tconst HAS_THICKNESSMAP = HAS_TRANSMISSION && !! material.thicknessMap;\n\n\t\tconst HAS_GRADIENTMAP = !! material.gradientMap;\n\n\t\tconst HAS_ALPHAMAP = !! material.alphaMap;\n\n\t\tconst HAS_ALPHATEST = material.alphaTest > 0;\n\n\t\tconst HAS_ALPHAHASH = !! material.alphaHash;\n\n\t\tconst HAS_EXTENSIONS = !! material.extensions;\n\n\t\tconst HAS_ATTRIBUTE_UV1 = !! geometry.attributes.uv1;\n\t\tconst HAS_ATTRIBUTE_UV2 = !! geometry.attributes.uv2;\n\t\tconst HAS_ATTRIBUTE_UV3 = !! geometry.attributes.uv3;\n\n\t\tlet toneMapping = NoToneMapping;\n\n\t\tif ( material.toneMapped ) {\n\n\t\t\tif ( currentRenderTarget === null || currentRenderTarget.isXRRenderTarget === true ) {\n\n\t\t\t\ttoneMapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst parameters = {\n\n\t\t\tisWebGL2: IS_WEBGL2,\n\n\t\t\tshaderID: shaderID,\n\t\t\tshaderType: material.type,\n\t\t\tshaderName: material.name,\n\n\t\t\tvertexShader: vertexShader,\n\t\t\tfragmentShader: fragmentShader,\n\t\t\tdefines: material.defines,\n\n\t\t\tcustomVertexShaderID: customVertexShaderID,\n\t\t\tcustomFragmentShaderID: customFragmentShaderID,\n\n\t\t\tisRawShaderMaterial: material.isRawShaderMaterial === true,\n\t\t\tglslVersion: material.glslVersion,\n\n\t\t\tprecision: precision,\n\n\t\t\tinstancing: IS_INSTANCEDMESH,\n\t\t\tinstancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,\n\n\t\t\tsupportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,\n\t\t\toutputColorSpace: ( currentRenderTarget === null ) ? renderer.outputColorSpace : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace ),\n\n\t\t\tmap: HAS_MAP,\n\t\t\tmatcap: HAS_MATCAP,\n\t\t\tenvMap: HAS_ENVMAP,\n\t\t\tenvMapMode: HAS_ENVMAP && envMap.mapping,\n\t\t\tenvMapCubeUVHeight: envMapCubeUVHeight,\n\t\t\taoMap: HAS_AOMAP,\n\t\t\tlightMap: HAS_LIGHTMAP,\n\t\t\tbumpMap: HAS_BUMPMAP,\n\t\t\tnormalMap: HAS_NORMALMAP,\n\t\t\tdisplacementMap: SUPPORTS_VERTEX_TEXTURES && HAS_DISPLACEMENTMAP,\n\t\t\temissiveMap: HAS_EMISSIVEMAP,\n\n\t\t\tnormalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === ObjectSpaceNormalMap,\n\t\t\tnormalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap,\n\n\t\t\tmetalnessMap: HAS_METALNESSMAP,\n\t\t\troughnessMap: HAS_ROUGHNESSMAP,\n\n\t\t\tanisotropy: HAS_ANISOTROPY,\n\t\t\tanisotropyMap: HAS_ANISOTROPYMAP,\n\n\t\t\tclearcoat: HAS_CLEARCOAT,\n\t\t\tclearcoatMap: HAS_CLEARCOATMAP,\n\t\t\tclearcoatNormalMap: HAS_CLEARCOAT_NORMALMAP,\n\t\t\tclearcoatRoughnessMap: HAS_CLEARCOAT_ROUGHNESSMAP,\n\n\t\t\tiridescence: HAS_IRIDESCENCE,\n\t\t\tiridescenceMap: HAS_IRIDESCENCEMAP,\n\t\t\tiridescenceThicknessMap: HAS_IRIDESCENCE_THICKNESSMAP,\n\n\t\t\tsheen: HAS_SHEEN,\n\t\t\tsheenColorMap: HAS_SHEEN_COLORMAP,\n\t\t\tsheenRoughnessMap: HAS_SHEEN_ROUGHNESSMAP,\n\n\t\t\tspecularMap: HAS_SPECULARMAP,\n\t\t\tspecularColorMap: HAS_SPECULAR_COLORMAP,\n\t\t\tspecularIntensityMap: HAS_SPECULAR_INTENSITYMAP,\n\n\t\t\ttransmission: HAS_TRANSMISSION,\n\t\t\ttransmissionMap: HAS_TRANSMISSIONMAP,\n\t\t\tthicknessMap: HAS_THICKNESSMAP,\n\n\t\t\tgradientMap: HAS_GRADIENTMAP,\n\n\t\t\topaque: material.transparent === false && material.blending === NormalBlending,\n\n\t\t\talphaMap: HAS_ALPHAMAP,\n\t\t\talphaTest: HAS_ALPHATEST,\n\t\t\talphaHash: HAS_ALPHAHASH,\n\n\t\t\tcombine: material.combine,\n\n\t\t\t//\n\n\t\t\tmapUv: HAS_MAP && getChannel( material.map.channel ),\n\t\t\taoMapUv: HAS_AOMAP && getChannel( material.aoMap.channel ),\n\t\t\tlightMapUv: HAS_LIGHTMAP && getChannel( material.lightMap.channel ),\n\t\t\tbumpMapUv: HAS_BUMPMAP && getChannel( material.bumpMap.channel ),\n\t\t\tnormalMapUv: HAS_NORMALMAP && getChannel( material.normalMap.channel ),\n\t\t\tdisplacementMapUv: HAS_DISPLACEMENTMAP && getChannel( material.displacementMap.channel ),\n\t\t\temissiveMapUv: HAS_EMISSIVEMAP && getChannel( material.emissiveMap.channel ),\n\n\t\t\tmetalnessMapUv: HAS_METALNESSMAP && getChannel( material.metalnessMap.channel ),\n\t\t\troughnessMapUv: HAS_ROUGHNESSMAP && getChannel( material.roughnessMap.channel ),\n\n\t\t\tanisotropyMapUv: HAS_ANISOTROPYMAP && getChannel( material.anisotropyMap.channel ),\n\n\t\t\tclearcoatMapUv: HAS_CLEARCOATMAP && getChannel( material.clearcoatMap.channel ),\n\t\t\tclearcoatNormalMapUv: HAS_CLEARCOAT_NORMALMAP && getChannel( material.clearcoatNormalMap.channel ),\n\t\t\tclearcoatRoughnessMapUv: HAS_CLEARCOAT_ROUGHNESSMAP && getChannel( material.clearcoatRoughnessMap.channel ),\n\n\t\t\tiridescenceMapUv: HAS_IRIDESCENCEMAP && getChannel( material.iridescenceMap.channel ),\n\t\t\tiridescenceThicknessMapUv: HAS_IRIDESCENCE_THICKNESSMAP && getChannel( material.iridescenceThicknessMap.channel ),\n\n\t\t\tsheenColorMapUv: HAS_SHEEN_COLORMAP && getChannel( material.sheenColorMap.channel ),\n\t\t\tsheenRoughnessMapUv: HAS_SHEEN_ROUGHNESSMAP && getChannel( material.sheenRoughnessMap.channel ),\n\n\t\t\tspecularMapUv: HAS_SPECULARMAP && getChannel( material.specularMap.channel ),\n\t\t\tspecularColorMapUv: HAS_SPECULAR_COLORMAP && getChannel( material.specularColorMap.channel ),\n\t\t\tspecularIntensityMapUv: HAS_SPECULAR_INTENSITYMAP && getChannel( material.specularIntensityMap.channel ),\n\n\t\t\ttransmissionMapUv: HAS_TRANSMISSIONMAP && getChannel( material.transmissionMap.channel ),\n\t\t\tthicknessMapUv: HAS_THICKNESSMAP && getChannel( material.thicknessMap.channel ),\n\n\t\t\talphaMapUv: HAS_ALPHAMAP && getChannel( material.alphaMap.channel ),\n\n\t\t\t//\n\n\t\t\tvertexTangents: !! geometry.attributes.tangent && ( HAS_NORMALMAP || HAS_ANISOTROPY ),\n\t\t\tvertexColors: material.vertexColors,\n\t\t\tvertexAlphas: material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4,\n\t\t\tvertexUv1s: HAS_ATTRIBUTE_UV1,\n\t\t\tvertexUv2s: HAS_ATTRIBUTE_UV2,\n\t\t\tvertexUv3s: HAS_ATTRIBUTE_UV3,\n\n\t\t\tpointsUvs: object.isPoints === true && !! geometry.attributes.uv && ( HAS_MAP || HAS_ALPHAMAP ),\n\n\t\t\tfog: !! fog,\n\t\t\tuseFog: material.fog === true,\n\t\t\tfogExp2: ( fog && fog.isFogExp2 ),\n\n\t\t\tflatShading: material.flatShading === true,\n\n\t\t\tsizeAttenuation: material.sizeAttenuation === true,\n\t\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\n\n\t\t\tskinning: object.isSkinnedMesh === true,\n\n\t\t\tmorphTargets: geometry.morphAttributes.position !== undefined,\n\t\t\tmorphNormals: geometry.morphAttributes.normal !== undefined,\n\t\t\tmorphColors: geometry.morphAttributes.color !== undefined,\n\t\t\tmorphTargetsCount: morphTargetsCount,\n\t\t\tmorphTextureStride: morphTextureStride,\n\n\t\t\tnumDirLights: lights.directional.length,\n\t\t\tnumPointLights: lights.point.length,\n\t\t\tnumSpotLights: lights.spot.length,\n\t\t\tnumSpotLightMaps: lights.spotLightMap.length,\n\t\t\tnumRectAreaLights: lights.rectArea.length,\n\t\t\tnumHemiLights: lights.hemi.length,\n\n\t\t\tnumDirLightShadows: lights.directionalShadowMap.length,\n\t\t\tnumPointLightShadows: lights.pointShadowMap.length,\n\t\t\tnumSpotLightShadows: lights.spotShadowMap.length,\n\t\t\tnumSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,\n\n\t\t\tnumLightProbes: lights.numLightProbes,\n\n\t\t\tnumClippingPlanes: clipping.numPlanes,\n\t\t\tnumClipIntersection: clipping.numIntersection,\n\n\t\t\tdithering: material.dithering,\n\n\t\t\tshadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,\n\t\t\tshadowMapType: renderer.shadowMap.type,\n\n\t\t\ttoneMapping: toneMapping,\n\t\t\tuseLegacyLights: renderer._useLegacyLights,\n\n\t\t\tdecodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( ColorManagement.getTransfer( material.map.colorSpace ) === SRGBTransfer ),\n\n\t\t\tpremultipliedAlpha: material.premultipliedAlpha,\n\n\t\t\tdoubleSided: material.side === DoubleSide,\n\t\t\tflipSided: material.side === BackSide,\n\n\t\t\tuseDepthPacking: material.depthPacking >= 0,\n\t\t\tdepthPacking: material.depthPacking || 0,\n\n\t\t\tindex0AttributeName: material.index0AttributeName,\n\n\t\t\textensionDerivatives: HAS_EXTENSIONS && material.extensions.derivatives === true,\n\t\t\textensionFragDepth: HAS_EXTENSIONS && material.extensions.fragDepth === true,\n\t\t\textensionDrawBuffers: HAS_EXTENSIONS && material.extensions.drawBuffers === true,\n\t\t\textensionShaderTextureLOD: HAS_EXTENSIONS && material.extensions.shaderTextureLOD === true,\n\n\t\t\trendererExtensionFragDepth: IS_WEBGL2 || extensions.has( 'EXT_frag_depth' ),\n\t\t\trendererExtensionDrawBuffers: IS_WEBGL2 || extensions.has( 'WEBGL_draw_buffers' ),\n\t\t\trendererExtensionShaderTextureLod: IS_WEBGL2 || extensions.has( 'EXT_shader_texture_lod' ),\n\t\t\trendererExtensionParallelShaderCompile: extensions.has( 'KHR_parallel_shader_compile' ),\n\n\t\t\tcustomProgramCacheKey: material.customProgramCacheKey()\n\n\t\t};\n\n\t\treturn parameters;\n\n\t}\n\n\tfunction getProgramCacheKey( parameters ) {\n\n\t\tconst array = [];\n\n\t\tif ( parameters.shaderID ) {\n\n\t\t\tarray.push( parameters.shaderID );\n\n\t\t} else {\n\n\t\t\tarray.push( parameters.customVertexShaderID );\n\t\t\tarray.push( parameters.customFragmentShaderID );\n\n\t\t}\n\n\t\tif ( parameters.defines !== undefined ) {\n\n\t\t\tfor ( const name in parameters.defines ) {\n\n\t\t\t\tarray.push( name );\n\t\t\t\tarray.push( parameters.defines[ name ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( parameters.isRawShaderMaterial === false ) {\n\n\t\t\tgetProgramCacheKeyParameters( array, parameters );\n\t\t\tgetProgramCacheKeyBooleans( array, parameters );\n\t\t\tarray.push( renderer.outputColorSpace );\n\n\t\t}\n\n\t\tarray.push( parameters.customProgramCacheKey );\n\n\t\treturn array.join();\n\n\t}\n\n\tfunction getProgramCacheKeyParameters( array, parameters ) {\n\n\t\tarray.push( parameters.precision );\n\t\tarray.push( parameters.outputColorSpace );\n\t\tarray.push( parameters.envMapMode );\n\t\tarray.push( parameters.envMapCubeUVHeight );\n\t\tarray.push( parameters.mapUv );\n\t\tarray.push( parameters.alphaMapUv );\n\t\tarray.push( parameters.lightMapUv );\n\t\tarray.push( parameters.aoMapUv );\n\t\tarray.push( parameters.bumpMapUv );\n\t\tarray.push( parameters.normalMapUv );\n\t\tarray.push( parameters.displacementMapUv );\n\t\tarray.push( parameters.emissiveMapUv );\n\t\tarray.push( parameters.metalnessMapUv );\n\t\tarray.push( parameters.roughnessMapUv );\n\t\tarray.push( parameters.anisotropyMapUv );\n\t\tarray.push( parameters.clearcoatMapUv );\n\t\tarray.push( parameters.clearcoatNormalMapUv );\n\t\tarray.push( parameters.clearcoatRoughnessMapUv );\n\t\tarray.push( parameters.iridescenceMapUv );\n\t\tarray.push( parameters.iridescenceThicknessMapUv );\n\t\tarray.push( parameters.sheenColorMapUv );\n\t\tarray.push( parameters.sheenRoughnessMapUv );\n\t\tarray.push( parameters.specularMapUv );\n\t\tarray.push( parameters.specularColorMapUv );\n\t\tarray.push( parameters.specularIntensityMapUv );\n\t\tarray.push( parameters.transmissionMapUv );\n\t\tarray.push( parameters.thicknessMapUv );\n\t\tarray.push( parameters.combine );\n\t\tarray.push( parameters.fogExp2 );\n\t\tarray.push( parameters.sizeAttenuation );\n\t\tarray.push( parameters.morphTargetsCount );\n\t\tarray.push( parameters.morphAttributeCount );\n\t\tarray.push( parameters.numDirLights );\n\t\tarray.push( parameters.numPointLights );\n\t\tarray.push( parameters.numSpotLights );\n\t\tarray.push( parameters.numSpotLightMaps );\n\t\tarray.push( parameters.numHemiLights );\n\t\tarray.push( parameters.numRectAreaLights );\n\t\tarray.push( parameters.numDirLightShadows );\n\t\tarray.push( parameters.numPointLightShadows );\n\t\tarray.push( parameters.numSpotLightShadows );\n\t\tarray.push( parameters.numSpotLightShadowsWithMaps );\n\t\tarray.push( parameters.numLightProbes );\n\t\tarray.push( parameters.shadowMapType );\n\t\tarray.push( parameters.toneMapping );\n\t\tarray.push( parameters.numClippingPlanes );\n\t\tarray.push( parameters.numClipIntersection );\n\t\tarray.push( parameters.depthPacking );\n\n\t}\n\n\tfunction getProgramCacheKeyBooleans( array, parameters ) {\n\n\t\t_programLayers.disableAll();\n\n\t\tif ( parameters.isWebGL2 )\n\t\t\t_programLayers.enable( 0 );\n\t\tif ( parameters.supportsVertexTextures )\n\t\t\t_programLayers.enable( 1 );\n\t\tif ( parameters.instancing )\n\t\t\t_programLayers.enable( 2 );\n\t\tif ( parameters.instancingColor )\n\t\t\t_programLayers.enable( 3 );\n\t\tif ( parameters.matcap )\n\t\t\t_programLayers.enable( 4 );\n\t\tif ( parameters.envMap )\n\t\t\t_programLayers.enable( 5 );\n\t\tif ( parameters.normalMapObjectSpace )\n\t\t\t_programLayers.enable( 6 );\n\t\tif ( parameters.normalMapTangentSpace )\n\t\t\t_programLayers.enable( 7 );\n\t\tif ( parameters.clearcoat )\n\t\t\t_programLayers.enable( 8 );\n\t\tif ( parameters.iridescence )\n\t\t\t_programLayers.enable( 9 );\n\t\tif ( parameters.alphaTest )\n\t\t\t_programLayers.enable( 10 );\n\t\tif ( parameters.vertexColors )\n\t\t\t_programLayers.enable( 11 );\n\t\tif ( parameters.vertexAlphas )\n\t\t\t_programLayers.enable( 12 );\n\t\tif ( parameters.vertexUv1s )\n\t\t\t_programLayers.enable( 13 );\n\t\tif ( parameters.vertexUv2s )\n\t\t\t_programLayers.enable( 14 );\n\t\tif ( parameters.vertexUv3s )\n\t\t\t_programLayers.enable( 15 );\n\t\tif ( parameters.vertexTangents )\n\t\t\t_programLayers.enable( 16 );\n\t\tif ( parameters.anisotropy )\n\t\t\t_programLayers.enable( 17 );\n\t\tif ( parameters.alphaHash )\n\t\t\t_programLayers.enable( 18 );\n\n\t\tarray.push( _programLayers.mask );\n\t\t_programLayers.disableAll();\n\n\t\tif ( parameters.fog )\n\t\t\t_programLayers.enable( 0 );\n\t\tif ( parameters.useFog )\n\t\t\t_programLayers.enable( 1 );\n\t\tif ( parameters.flatShading )\n\t\t\t_programLayers.enable( 2 );\n\t\tif ( parameters.logarithmicDepthBuffer )\n\t\t\t_programLayers.enable( 3 );\n\t\tif ( parameters.skinning )\n\t\t\t_programLayers.enable( 4 );\n\t\tif ( parameters.morphTargets )\n\t\t\t_programLayers.enable( 5 );\n\t\tif ( parameters.morphNormals )\n\t\t\t_programLayers.enable( 6 );\n\t\tif ( parameters.morphColors )\n\t\t\t_programLayers.enable( 7 );\n\t\tif ( parameters.premultipliedAlpha )\n\t\t\t_programLayers.enable( 8 );\n\t\tif ( parameters.shadowMapEnabled )\n\t\t\t_programLayers.enable( 9 );\n\t\tif ( parameters.useLegacyLights )\n\t\t\t_programLayers.enable( 10 );\n\t\tif ( parameters.doubleSided )\n\t\t\t_programLayers.enable( 11 );\n\t\tif ( parameters.flipSided )\n\t\t\t_programLayers.enable( 12 );\n\t\tif ( parameters.useDepthPacking )\n\t\t\t_programLayers.enable( 13 );\n\t\tif ( parameters.dithering )\n\t\t\t_programLayers.enable( 14 );\n\t\tif ( parameters.transmission )\n\t\t\t_programLayers.enable( 15 );\n\t\tif ( parameters.sheen )\n\t\t\t_programLayers.enable( 16 );\n\t\tif ( parameters.opaque )\n\t\t\t_programLayers.enable( 17 );\n\t\tif ( parameters.pointsUvs )\n\t\t\t_programLayers.enable( 18 );\n\t\tif ( parameters.decodeVideoTexture )\n\t\t\t_programLayers.enable( 19 );\n\n\t\tarray.push( _programLayers.mask );\n\n\t}\n\n\tfunction getUniforms( material ) {\n\n\t\tconst shaderID = shaderIDs[ material.type ];\n\t\tlet uniforms;\n\n\t\tif ( shaderID ) {\n\n\t\t\tconst shader = ShaderLib[ shaderID ];\n\t\t\tuniforms = UniformsUtils.clone( shader.uniforms );\n\n\t\t} else {\n\n\t\t\tuniforms = material.uniforms;\n\n\t\t}\n\n\t\treturn uniforms;\n\n\t}\n\n\tfunction acquireProgram( parameters, cacheKey ) {\n\n\t\tlet program;\n\n\t\t// Check if code has been already compiled\n\t\tfor ( let p = 0, pl = programs.length; p < pl; p ++ ) {\n\n\t\t\tconst preexistingProgram = programs[ p ];\n\n\t\t\tif ( preexistingProgram.cacheKey === cacheKey ) {\n\n\t\t\t\tprogram = preexistingProgram;\n\t\t\t\t++ program.usedTimes;\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( program === undefined ) {\n\n\t\t\tprogram = new WebGLProgram( renderer, cacheKey, parameters, bindingStates );\n\t\t\tprograms.push( program );\n\n\t\t}\n\n\t\treturn program;\n\n\t}\n\n\tfunction releaseProgram( program ) {\n\n\t\tif ( -- program.usedTimes === 0 ) {\n\n\t\t\t// Remove from unordered set\n\t\t\tconst i = programs.indexOf( program );\n\t\t\tprograms[ i ] = programs[ programs.length - 1 ];\n\t\t\tprograms.pop();\n\n\t\t\t// Free WebGL resources\n\t\t\tprogram.destroy();\n\n\t\t}\n\n\t}\n\n\tfunction releaseShaderCache( material ) {\n\n\t\t_customShaders.remove( material );\n\n\t}\n\n\tfunction dispose() {\n\n\t\t_customShaders.dispose();\n\n\t}\n\n\treturn {\n\t\tgetParameters: getParameters,\n\t\tgetProgramCacheKey: getProgramCacheKey,\n\t\tgetUniforms: getUniforms,\n\t\tacquireProgram: acquireProgram,\n\t\treleaseProgram: releaseProgram,\n\t\treleaseShaderCache: releaseShaderCache,\n\t\t// Exposed for resource monitoring & error feedback via renderer.info:\n\t\tprograms: programs,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction WebGLProperties() {\n\n\tlet properties = new WeakMap();\n\n\tfunction get( object ) {\n\n\t\tlet map = properties.get( object );\n\n\t\tif ( map === undefined ) {\n\n\t\t\tmap = {};\n\t\t\tproperties.set( object, map );\n\n\t\t}\n\n\t\treturn map;\n\n\t}\n\n\tfunction remove( object ) {\n\n\t\tproperties.delete( object );\n\n\t}\n\n\tfunction update( object, key, value ) {\n\n\t\tproperties.get( object )[ key ] = value;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tproperties = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tremove: remove,\n\t\tupdate: update,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction painterSortStable( a, b ) {\n\n\tif ( a.groupOrder !== b.groupOrder ) {\n\n\t\treturn a.groupOrder - b.groupOrder;\n\n\t} else if ( a.renderOrder !== b.renderOrder ) {\n\n\t\treturn a.renderOrder - b.renderOrder;\n\n\t} else if ( a.material.id !== b.material.id ) {\n\n\t\treturn a.material.id - b.material.id;\n\n\t} else if ( a.z !== b.z ) {\n\n\t\treturn a.z - b.z;\n\n\t} else {\n\n\t\treturn a.id - b.id;\n\n\t}\n\n}\n\nfunction reversePainterSortStable( a, b ) {\n\n\tif ( a.groupOrder !== b.groupOrder ) {\n\n\t\treturn a.groupOrder - b.groupOrder;\n\n\t} else if ( a.renderOrder !== b.renderOrder ) {\n\n\t\treturn a.renderOrder - b.renderOrder;\n\n\t} else if ( a.z !== b.z ) {\n\n\t\treturn b.z - a.z;\n\n\t} else {\n\n\t\treturn a.id - b.id;\n\n\t}\n\n}\n\n\nfunction WebGLRenderList() {\n\n\tconst renderItems = [];\n\tlet renderItemsIndex = 0;\n\n\tconst opaque = [];\n\tconst transmissive = [];\n\tconst transparent = [];\n\n\tfunction init() {\n\n\t\trenderItemsIndex = 0;\n\n\t\topaque.length = 0;\n\t\ttransmissive.length = 0;\n\t\ttransparent.length = 0;\n\n\t}\n\n\tfunction getNextRenderItem( object, geometry, material, groupOrder, z, group ) {\n\n\t\tlet renderItem = renderItems[ renderItemsIndex ];\n\n\t\tif ( renderItem === undefined ) {\n\n\t\t\trenderItem = {\n\t\t\t\tid: object.id,\n\t\t\t\tobject: object,\n\t\t\t\tgeometry: geometry,\n\t\t\t\tmaterial: material,\n\t\t\t\tgroupOrder: groupOrder,\n\t\t\t\trenderOrder: object.renderOrder,\n\t\t\t\tz: z,\n\t\t\t\tgroup: group\n\t\t\t};\n\n\t\t\trenderItems[ renderItemsIndex ] = renderItem;\n\n\t\t} else {\n\n\t\t\trenderItem.id = object.id;\n\t\t\trenderItem.object = object;\n\t\t\trenderItem.geometry = geometry;\n\t\t\trenderItem.material = material;\n\t\t\trenderItem.groupOrder = groupOrder;\n\t\t\trenderItem.renderOrder = object.renderOrder;\n\t\t\trenderItem.z = z;\n\t\t\trenderItem.group = group;\n\n\t\t}\n\n\t\trenderItemsIndex ++;\n\n\t\treturn renderItem;\n\n\t}\n\n\tfunction push( object, geometry, material, groupOrder, z, group ) {\n\n\t\tconst renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\n\n\t\tif ( material.transmission > 0.0 ) {\n\n\t\t\ttransmissive.push( renderItem );\n\n\t\t} else if ( material.transparent === true ) {\n\n\t\t\ttransparent.push( renderItem );\n\n\t\t} else {\n\n\t\t\topaque.push( renderItem );\n\n\t\t}\n\n\t}\n\n\tfunction unshift( object, geometry, material, groupOrder, z, group ) {\n\n\t\tconst renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\n\n\t\tif ( material.transmission > 0.0 ) {\n\n\t\t\ttransmissive.unshift( renderItem );\n\n\t\t} else if ( material.transparent === true ) {\n\n\t\t\ttransparent.unshift( renderItem );\n\n\t\t} else {\n\n\t\t\topaque.unshift( renderItem );\n\n\t\t}\n\n\t}\n\n\tfunction sort( customOpaqueSort, customTransparentSort ) {\n\n\t\tif ( opaque.length > 1 ) opaque.sort( customOpaqueSort || painterSortStable );\n\t\tif ( transmissive.length > 1 ) transmissive.sort( customTransparentSort || reversePainterSortStable );\n\t\tif ( transparent.length > 1 ) transparent.sort( customTransparentSort || reversePainterSortStable );\n\n\t}\n\n\tfunction finish() {\n\n\t\t// Clear references from inactive renderItems in the list\n\n\t\tfor ( let i = renderItemsIndex, il = renderItems.length; i < il; i ++ ) {\n\n\t\t\tconst renderItem = renderItems[ i ];\n\n\t\t\tif ( renderItem.id === null ) break;\n\n\t\t\trenderItem.id = null;\n\t\t\trenderItem.object = null;\n\t\t\trenderItem.geometry = null;\n\t\t\trenderItem.material = null;\n\t\t\trenderItem.group = null;\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\topaque: opaque,\n\t\ttransmissive: transmissive,\n\t\ttransparent: transparent,\n\n\t\tinit: init,\n\t\tpush: push,\n\t\tunshift: unshift,\n\t\tfinish: finish,\n\n\t\tsort: sort\n\t};\n\n}\n\nfunction WebGLRenderLists() {\n\n\tlet lists = new WeakMap();\n\n\tfunction get( scene, renderCallDepth ) {\n\n\t\tconst listArray = lists.get( scene );\n\t\tlet list;\n\n\t\tif ( listArray === undefined ) {\n\n\t\t\tlist = new WebGLRenderList();\n\t\t\tlists.set( scene, [ list ] );\n\n\t\t} else {\n\n\t\t\tif ( renderCallDepth >= listArray.length ) {\n\n\t\t\t\tlist = new WebGLRenderList();\n\t\t\t\tlistArray.push( list );\n\n\t\t\t} else {\n\n\t\t\t\tlist = listArray[ renderCallDepth ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn list;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tlists = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction UniformsCache() {\n\n\tconst lights = {};\n\n\treturn {\n\n\t\tget: function ( light ) {\n\n\t\t\tif ( lights[ light.id ] !== undefined ) {\n\n\t\t\t\treturn lights[ light.id ];\n\n\t\t\t}\n\n\t\t\tlet uniforms;\n\n\t\t\tswitch ( light.type ) {\n\n\t\t\t\tcase 'DirectionalLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tcolor: new Color()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'SpotLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tdistance: 0,\n\t\t\t\t\t\tconeCos: 0,\n\t\t\t\t\t\tpenumbraCos: 0,\n\t\t\t\t\t\tdecay: 0\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'PointLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tdistance: 0,\n\t\t\t\t\t\tdecay: 0\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'HemisphereLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tskyColor: new Color(),\n\t\t\t\t\t\tgroundColor: new Color()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'RectAreaLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\thalfWidth: new Vector3(),\n\t\t\t\t\t\thalfHeight: new Vector3()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tlights[ light.id ] = uniforms;\n\n\t\t\treturn uniforms;\n\n\t\t}\n\n\t};\n\n}\n\nfunction ShadowUniformsCache() {\n\n\tconst lights = {};\n\n\treturn {\n\n\t\tget: function ( light ) {\n\n\t\t\tif ( lights[ light.id ] !== undefined ) {\n\n\t\t\t\treturn lights[ light.id ];\n\n\t\t\t}\n\n\t\t\tlet uniforms;\n\n\t\t\tswitch ( light.type ) {\n\n\t\t\t\tcase 'DirectionalLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'SpotLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'PointLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2(),\n\t\t\t\t\t\tshadowCameraNear: 1,\n\t\t\t\t\t\tshadowCameraFar: 1000\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\t// TODO (abelnation): set RectAreaLight shadow uniforms\n\n\t\t\t}\n\n\t\t\tlights[ light.id ] = uniforms;\n\n\t\t\treturn uniforms;\n\n\t\t}\n\n\t};\n\n}\n\n\n\nlet nextVersion = 0;\n\nfunction shadowCastingAndTexturingLightsFirst( lightA, lightB ) {\n\n\treturn ( lightB.castShadow ? 2 : 0 ) - ( lightA.castShadow ? 2 : 0 ) + ( lightB.map ? 1 : 0 ) - ( lightA.map ? 1 : 0 );\n\n}\n\nfunction WebGLLights( extensions, capabilities ) {\n\n\tconst cache = new UniformsCache();\n\n\tconst shadowCache = ShadowUniformsCache();\n\n\tconst state = {\n\n\t\tversion: 0,\n\n\t\thash: {\n\t\t\tdirectionalLength: - 1,\n\t\t\tpointLength: - 1,\n\t\t\tspotLength: - 1,\n\t\t\trectAreaLength: - 1,\n\t\t\themiLength: - 1,\n\n\t\t\tnumDirectionalShadows: - 1,\n\t\t\tnumPointShadows: - 1,\n\t\t\tnumSpotShadows: - 1,\n\t\t\tnumSpotMaps: - 1,\n\n\t\t\tnumLightProbes: - 1\n\t\t},\n\n\t\tambient: [ 0, 0, 0 ],\n\t\tprobe: [],\n\t\tdirectional: [],\n\t\tdirectionalShadow: [],\n\t\tdirectionalShadowMap: [],\n\t\tdirectionalShadowMatrix: [],\n\t\tspot: [],\n\t\tspotLightMap: [],\n\t\tspotShadow: [],\n\t\tspotShadowMap: [],\n\t\tspotLightMatrix: [],\n\t\trectArea: [],\n\t\trectAreaLTC1: null,\n\t\trectAreaLTC2: null,\n\t\tpoint: [],\n\t\tpointShadow: [],\n\t\tpointShadowMap: [],\n\t\tpointShadowMatrix: [],\n\t\themi: [],\n\t\tnumSpotLightShadowsWithMaps: 0,\n\t\tnumLightProbes: 0\n\n\t};\n\n\tfor ( let i = 0; i < 9; i ++ ) state.probe.push( new Vector3() );\n\n\tconst vector3 = new Vector3();\n\tconst matrix4 = new Matrix4();\n\tconst matrix42 = new Matrix4();\n\n\tfunction setup( lights, useLegacyLights ) {\n\n\t\tlet r = 0, g = 0, b = 0;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) state.probe[ i ].set( 0, 0, 0 );\n\n\t\tlet directionalLength = 0;\n\t\tlet pointLength = 0;\n\t\tlet spotLength = 0;\n\t\tlet rectAreaLength = 0;\n\t\tlet hemiLength = 0;\n\n\t\tlet numDirectionalShadows = 0;\n\t\tlet numPointShadows = 0;\n\t\tlet numSpotShadows = 0;\n\t\tlet numSpotMaps = 0;\n\t\tlet numSpotShadowsWithMaps = 0;\n\n\t\tlet numLightProbes = 0;\n\n\t\t// ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]\n\t\tlights.sort( shadowCastingAndTexturingLightsFirst );\n\n\t\t// artist-friendly light intensity scaling factor\n\t\tconst scaleFactor = ( useLegacyLights === true ) ? Math.PI : 1;\n\n\t\tfor ( let i = 0, l = lights.length; i < l; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\n\t\t\tconst color = light.color;\n\t\t\tconst intensity = light.intensity;\n\t\t\tconst distance = light.distance;\n\n\t\t\tconst shadowMap = ( light.shadow && light.shadow.map ) ? light.shadow.map.texture : null;\n\n\t\t\tif ( light.isAmbientLight ) {\n\n\t\t\t\tr += color.r * intensity * scaleFactor;\n\t\t\t\tg += color.g * intensity * scaleFactor;\n\t\t\t\tb += color.b * intensity * scaleFactor;\n\n\t\t\t} else if ( light.isLightProbe ) {\n\n\t\t\t\tfor ( let j = 0; j < 9; j ++ ) {\n\n\t\t\t\t\tstate.probe[ j ].addScaledVector( light.sh.coefficients[ j ], intensity );\n\n\t\t\t\t}\n\n\t\t\t\tnumLightProbes ++;\n\n\t\t\t} else if ( light.isDirectionalLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity * scaleFactor );\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\n\t\t\t\t\tstate.directionalShadow[ directionalLength ] = shadowUniforms;\n\t\t\t\t\tstate.directionalShadowMap[ directionalLength ] = shadowMap;\n\t\t\t\t\tstate.directionalShadowMatrix[ directionalLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumDirectionalShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.directional[ directionalLength ] = uniforms;\n\n\t\t\t\tdirectionalLength ++;\n\n\t\t\t} else if ( light.isSpotLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity * scaleFactor );\n\t\t\t\tuniforms.distance = distance;\n\n\t\t\t\tuniforms.coneCos = Math.cos( light.angle );\n\t\t\t\tuniforms.penumbraCos = Math.cos( light.angle * ( 1 - light.penumbra ) );\n\t\t\t\tuniforms.decay = light.decay;\n\n\t\t\t\tstate.spot[ spotLength ] = uniforms;\n\n\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\tif ( light.map ) {\n\n\t\t\t\t\tstate.spotLightMap[ numSpotMaps ] = light.map;\n\t\t\t\t\tnumSpotMaps ++;\n\n\t\t\t\t\t// make sure the lightMatrix is up to date\n\t\t\t\t\t// TODO : do it if required only\n\t\t\t\t\tshadow.updateMatrices( light );\n\n\t\t\t\t\tif ( light.castShadow ) numSpotShadowsWithMaps ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.spotLightMatrix[ spotLength ] = shadow.matrix;\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\n\t\t\t\t\tstate.spotShadow[ spotLength ] = shadowUniforms;\n\t\t\t\t\tstate.spotShadowMap[ spotLength ] = shadowMap;\n\n\t\t\t\t\tnumSpotShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tspotLength ++;\n\n\t\t\t} else if ( light.isRectAreaLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity );\n\n\t\t\t\tuniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );\n\t\t\t\tuniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 );\n\n\t\t\t\tstate.rectArea[ rectAreaLength ] = uniforms;\n\n\t\t\t\trectAreaLength ++;\n\n\t\t\t} else if ( light.isPointLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity * scaleFactor );\n\t\t\t\tuniforms.distance = light.distance;\n\t\t\t\tuniforms.decay = light.decay;\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\t\t\t\t\tshadowUniforms.shadowCameraNear = shadow.camera.near;\n\t\t\t\t\tshadowUniforms.shadowCameraFar = shadow.camera.far;\n\n\t\t\t\t\tstate.pointShadow[ pointLength ] = shadowUniforms;\n\t\t\t\t\tstate.pointShadowMap[ pointLength ] = shadowMap;\n\t\t\t\t\tstate.pointShadowMatrix[ pointLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumPointShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.point[ pointLength ] = uniforms;\n\n\t\t\t\tpointLength ++;\n\n\t\t\t} else if ( light.isHemisphereLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.skyColor.copy( light.color ).multiplyScalar( intensity * scaleFactor );\n\t\t\t\tuniforms.groundColor.copy( light.groundColor ).multiplyScalar( intensity * scaleFactor );\n\n\t\t\t\tstate.hemi[ hemiLength ] = uniforms;\n\n\t\t\t\themiLength ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( rectAreaLength > 0 ) {\n\n\t\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t\t// WebGL 2\n\n\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;\n\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;\n\n\t\t\t} else {\n\n\t\t\t\t// WebGL 1\n\n\t\t\t\tif ( extensions.has( 'OES_texture_float_linear' ) === true ) {\n\n\t\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;\n\t\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;\n\n\t\t\t\t} else if ( extensions.has( 'OES_texture_half_float_linear' ) === true ) {\n\n\t\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_HALF_1;\n\t\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_HALF_2;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.ambient[ 0 ] = r;\n\t\tstate.ambient[ 1 ] = g;\n\t\tstate.ambient[ 2 ] = b;\n\n\t\tconst hash = state.hash;\n\n\t\tif ( hash.directionalLength !== directionalLength ||\n\t\t\thash.pointLength !== pointLength ||\n\t\t\thash.spotLength !== spotLength ||\n\t\t\thash.rectAreaLength !== rectAreaLength ||\n\t\t\thash.hemiLength !== hemiLength ||\n\t\t\thash.numDirectionalShadows !== numDirectionalShadows ||\n\t\t\thash.numPointShadows !== numPointShadows ||\n\t\t\thash.numSpotShadows !== numSpotShadows ||\n\t\t\thash.numSpotMaps !== numSpotMaps ||\n\t\t\thash.numLightProbes !== numLightProbes ) {\n\n\t\t\tstate.directional.length = directionalLength;\n\t\t\tstate.spot.length = spotLength;\n\t\t\tstate.rectArea.length = rectAreaLength;\n\t\t\tstate.point.length = pointLength;\n\t\t\tstate.hemi.length = hemiLength;\n\n\t\t\tstate.directionalShadow.length = numDirectionalShadows;\n\t\t\tstate.directionalShadowMap.length = numDirectionalShadows;\n\t\t\tstate.pointShadow.length = numPointShadows;\n\t\t\tstate.pointShadowMap.length = numPointShadows;\n\t\t\tstate.spotShadow.length = numSpotShadows;\n\t\t\tstate.spotShadowMap.length = numSpotShadows;\n\t\t\tstate.directionalShadowMatrix.length = numDirectionalShadows;\n\t\t\tstate.pointShadowMatrix.length = numPointShadows;\n\t\t\tstate.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps;\n\t\t\tstate.spotLightMap.length = numSpotMaps;\n\t\t\tstate.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps;\n\t\t\tstate.numLightProbes = numLightProbes;\n\n\t\t\thash.directionalLength = directionalLength;\n\t\t\thash.pointLength = pointLength;\n\t\t\thash.spotLength = spotLength;\n\t\t\thash.rectAreaLength = rectAreaLength;\n\t\t\thash.hemiLength = hemiLength;\n\n\t\t\thash.numDirectionalShadows = numDirectionalShadows;\n\t\t\thash.numPointShadows = numPointShadows;\n\t\t\thash.numSpotShadows = numSpotShadows;\n\t\t\thash.numSpotMaps = numSpotMaps;\n\n\t\t\thash.numLightProbes = numLightProbes;\n\n\t\t\tstate.version = nextVersion ++;\n\n\t\t}\n\n\t}\n\n\tfunction setupView( lights, camera ) {\n\n\t\tlet directionalLength = 0;\n\t\tlet pointLength = 0;\n\t\tlet spotLength = 0;\n\t\tlet rectAreaLength = 0;\n\t\tlet hemiLength = 0;\n\n\t\tconst viewMatrix = camera.matrixWorldInverse;\n\n\t\tfor ( let i = 0, l = lights.length; i < l; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\n\t\t\tif ( light.isDirectionalLight ) {\n\n\t\t\t\tconst uniforms = state.directional[ directionalLength ];\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\n\t\t\t\tuniforms.direction.sub( vector3 );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\tdirectionalLength ++;\n\n\t\t\t} else if ( light.isSpotLight ) {\n\n\t\t\t\tconst uniforms = state.spot[ spotLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\n\t\t\t\tuniforms.direction.sub( vector3 );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\tspotLength ++;\n\n\t\t\t} else if ( light.isRectAreaLight ) {\n\n\t\t\t\tconst uniforms = state.rectArea[ rectAreaLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\t// extract local rotation of light to derive width/height half vectors\n\t\t\t\tmatrix42.identity();\n\t\t\t\tmatrix4.copy( light.matrixWorld );\n\t\t\t\tmatrix4.premultiply( viewMatrix );\n\t\t\t\tmatrix42.extractRotation( matrix4 );\n\n\t\t\t\tuniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );\n\t\t\t\tuniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 );\n\n\t\t\t\tuniforms.halfWidth.applyMatrix4( matrix42 );\n\t\t\t\tuniforms.halfHeight.applyMatrix4( matrix42 );\n\n\t\t\t\trectAreaLength ++;\n\n\t\t\t} else if ( light.isPointLight ) {\n\n\t\t\t\tconst uniforms = state.point[ pointLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\tpointLength ++;\n\n\t\t\t} else if ( light.isHemisphereLight ) {\n\n\t\t\t\tconst uniforms = state.hemi[ hemiLength ];\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\themiLength ++;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tsetup: setup,\n\t\tsetupView: setupView,\n\t\tstate: state\n\t};\n\n}\n\nfunction WebGLRenderState( extensions, capabilities ) {\n\n\tconst lights = new WebGLLights( extensions, capabilities );\n\n\tconst lightsArray = [];\n\tconst shadowsArray = [];\n\n\tfunction init() {\n\n\t\tlightsArray.length = 0;\n\t\tshadowsArray.length = 0;\n\n\t}\n\n\tfunction pushLight( light ) {\n\n\t\tlightsArray.push( light );\n\n\t}\n\n\tfunction pushShadow( shadowLight ) {\n\n\t\tshadowsArray.push( shadowLight );\n\n\t}\n\n\tfunction setupLights( useLegacyLights ) {\n\n\t\tlights.setup( lightsArray, useLegacyLights );\n\n\t}\n\n\tfunction setupLightsView( camera ) {\n\n\t\tlights.setupView( lightsArray, camera );\n\n\t}\n\n\tconst state = {\n\t\tlightsArray: lightsArray,\n\t\tshadowsArray: shadowsArray,\n\n\t\tlights: lights\n\t};\n\n\treturn {\n\t\tinit: init,\n\t\tstate: state,\n\t\tsetupLights: setupLights,\n\t\tsetupLightsView: setupLightsView,\n\n\t\tpushLight: pushLight,\n\t\tpushShadow: pushShadow\n\t};\n\n}\n\nfunction WebGLRenderStates( extensions, capabilities ) {\n\n\tlet renderStates = new WeakMap();\n\n\tfunction get( scene, renderCallDepth = 0 ) {\n\n\t\tconst renderStateArray = renderStates.get( scene );\n\t\tlet renderState;\n\n\t\tif ( renderStateArray === undefined ) {\n\n\t\t\trenderState = new WebGLRenderState( extensions, capabilities );\n\t\t\trenderStates.set( scene, [ renderState ] );\n\n\t\t} else {\n\n\t\t\tif ( renderCallDepth >= renderStateArray.length ) {\n\n\t\t\t\trenderState = new WebGLRenderState( extensions, capabilities );\n\t\t\t\trenderStateArray.push( renderState );\n\n\t\t\t} else {\n\n\t\t\t\trenderState = renderStateArray[ renderCallDepth ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn renderState;\n\n\t}\n\n\tfunction dispose() {\n\n\t\trenderStates = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nclass MeshDepthMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshDepthMaterial = true;\n\n\t\tthis.type = 'MeshDepthMaterial';\n\n\t\tthis.depthPacking = BasicDepthPacking;\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.depthPacking = source.depthPacking;\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshDistanceMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshDistanceMaterial = true;\n\n\t\tthis.type = 'MeshDistanceMaterial';\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst vertex = \"void main() {\\n\\tgl_Position = vec4( position, 1.0 );\\n}\";\n\nconst fragment = \"uniform sampler2D shadow_pass;\\nuniform vec2 resolution;\\nuniform float radius;\\n#include \\nvoid main() {\\n\\tconst float samples = float( VSM_SAMPLES );\\n\\tfloat mean = 0.0;\\n\\tfloat squared_mean = 0.0;\\n\\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\\n\\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\\n\\tfor ( float i = 0.0; i < samples; i ++ ) {\\n\\t\\tfloat uvOffset = uvStart + i * uvStride;\\n\\t\\t#ifdef HORIZONTAL_PASS\\n\\t\\t\\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\\n\\t\\t\\tmean += distribution.x;\\n\\t\\t\\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\\n\\t\\t#else\\n\\t\\t\\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\\n\\t\\t\\tmean += depth;\\n\\t\\t\\tsquared_mean += depth * depth;\\n\\t\\t#endif\\n\\t}\\n\\tmean = mean / samples;\\n\\tsquared_mean = squared_mean / samples;\\n\\tfloat std_dev = sqrt( squared_mean - mean * mean );\\n\\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\\n}\";\n\nfunction WebGLShadowMap( _renderer, _objects, _capabilities ) {\n\n\tlet _frustum = new Frustum();\n\n\tconst _shadowMapSize = new Vector2(),\n\t\t_viewportSize = new Vector2(),\n\n\t\t_viewport = new Vector4(),\n\n\t\t_depthMaterial = new MeshDepthMaterial( { depthPacking: RGBADepthPacking } ),\n\t\t_distanceMaterial = new MeshDistanceMaterial(),\n\n\t\t_materialCache = {},\n\n\t\t_maxTextureSize = _capabilities.maxTextureSize;\n\n\tconst shadowSide = { [ FrontSide ]: BackSide, [ BackSide ]: FrontSide, [ DoubleSide ]: DoubleSide };\n\n\tconst shadowMaterialVertical = new ShaderMaterial( {\n\t\tdefines: {\n\t\t\tVSM_SAMPLES: 8\n\t\t},\n\t\tuniforms: {\n\t\t\tshadow_pass: { value: null },\n\t\t\tresolution: { value: new Vector2() },\n\t\t\tradius: { value: 4.0 }\n\t\t},\n\n\t\tvertexShader: vertex,\n\t\tfragmentShader: fragment\n\n\t} );\n\n\tconst shadowMaterialHorizontal = shadowMaterialVertical.clone();\n\tshadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1;\n\n\tconst fullScreenTri = new BufferGeometry();\n\tfullScreenTri.setAttribute(\n\t\t'position',\n\t\tnew BufferAttribute(\n\t\t\tnew Float32Array( [ - 1, - 1, 0.5, 3, - 1, 0.5, - 1, 3, 0.5 ] ),\n\t\t\t3\n\t\t)\n\t);\n\n\tconst fullScreenMesh = new Mesh( fullScreenTri, shadowMaterialVertical );\n\n\tconst scope = this;\n\n\tthis.enabled = false;\n\n\tthis.autoUpdate = true;\n\tthis.needsUpdate = false;\n\n\tthis.type = PCFShadowMap;\n\tlet _previousType = this.type;\n\n\tthis.render = function ( lights, scene, camera ) {\n\n\t\tif ( scope.enabled === false ) return;\n\t\tif ( scope.autoUpdate === false && scope.needsUpdate === false ) return;\n\n\t\tif ( lights.length === 0 ) return;\n\n\t\tconst currentRenderTarget = _renderer.getRenderTarget();\n\t\tconst activeCubeFace = _renderer.getActiveCubeFace();\n\t\tconst activeMipmapLevel = _renderer.getActiveMipmapLevel();\n\n\t\tconst _state = _renderer.state;\n\n\t\t// Set GL state for depth map.\n\t\t_state.setBlending( NoBlending );\n\t\t_state.buffers.color.setClear( 1, 1, 1, 1 );\n\t\t_state.buffers.depth.setTest( true );\n\t\t_state.setScissorTest( false );\n\n\t\t// check for shadow map type changes\n\n\t\tconst toVSM = ( _previousType !== VSMShadowMap && this.type === VSMShadowMap );\n\t\tconst fromVSM = ( _previousType === VSMShadowMap && this.type !== VSMShadowMap );\n\n\t\t// render depth map\n\n\t\tfor ( let i = 0, il = lights.length; i < il; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\t\t\tconst shadow = light.shadow;\n\n\t\t\tif ( shadow === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLShadowMap:', light, 'has no shadow.' );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( shadow.autoUpdate === false && shadow.needsUpdate === false ) continue;\n\n\t\t\t_shadowMapSize.copy( shadow.mapSize );\n\n\t\t\tconst shadowFrameExtents = shadow.getFrameExtents();\n\n\t\t\t_shadowMapSize.multiply( shadowFrameExtents );\n\n\t\t\t_viewportSize.copy( shadow.mapSize );\n\n\t\t\tif ( _shadowMapSize.x > _maxTextureSize || _shadowMapSize.y > _maxTextureSize ) {\n\n\t\t\t\tif ( _shadowMapSize.x > _maxTextureSize ) {\n\n\t\t\t\t\t_viewportSize.x = Math.floor( _maxTextureSize / shadowFrameExtents.x );\n\t\t\t\t\t_shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x;\n\t\t\t\t\tshadow.mapSize.x = _viewportSize.x;\n\n\t\t\t\t}\n\n\t\t\t\tif ( _shadowMapSize.y > _maxTextureSize ) {\n\n\t\t\t\t\t_viewportSize.y = Math.floor( _maxTextureSize / shadowFrameExtents.y );\n\t\t\t\t\t_shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y;\n\t\t\t\t\tshadow.mapSize.y = _viewportSize.y;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( shadow.map === null || toVSM === true || fromVSM === true ) {\n\n\t\t\t\tconst pars = ( this.type !== VSMShadowMap ) ? { minFilter: NearestFilter, magFilter: NearestFilter } : {};\n\n\t\t\t\tif ( shadow.map !== null ) {\n\n\t\t\t\t\tshadow.map.dispose();\n\n\t\t\t\t}\n\n\t\t\t\tshadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );\n\t\t\t\tshadow.map.texture.name = light.name + '.shadowMap';\n\n\t\t\t\tshadow.camera.updateProjectionMatrix();\n\n\t\t\t}\n\n\t\t\t_renderer.setRenderTarget( shadow.map );\n\t\t\t_renderer.clear();\n\n\t\t\tconst viewportCount = shadow.getViewportCount();\n\n\t\t\tfor ( let vp = 0; vp < viewportCount; vp ++ ) {\n\n\t\t\t\tconst viewport = shadow.getViewport( vp );\n\n\t\t\t\t_viewport.set(\n\t\t\t\t\t_viewportSize.x * viewport.x,\n\t\t\t\t\t_viewportSize.y * viewport.y,\n\t\t\t\t\t_viewportSize.x * viewport.z,\n\t\t\t\t\t_viewportSize.y * viewport.w\n\t\t\t\t);\n\n\t\t\t\t_state.viewport( _viewport );\n\n\t\t\t\tshadow.updateMatrices( light, vp );\n\n\t\t\t\t_frustum = shadow.getFrustum();\n\n\t\t\t\trenderObject( scene, camera, shadow.camera, light, this.type );\n\n\t\t\t}\n\n\t\t\t// do blur pass for VSM\n\n\t\t\tif ( shadow.isPointLightShadow !== true && this.type === VSMShadowMap ) {\n\n\t\t\t\tVSMPass( shadow, camera );\n\n\t\t\t}\n\n\t\t\tshadow.needsUpdate = false;\n\n\t\t}\n\n\t\t_previousType = this.type;\n\n\t\tscope.needsUpdate = false;\n\n\t\t_renderer.setRenderTarget( currentRenderTarget, activeCubeFace, activeMipmapLevel );\n\n\t};\n\n\tfunction VSMPass( shadow, camera ) {\n\n\t\tconst geometry = _objects.update( fullScreenMesh );\n\n\t\tif ( shadowMaterialVertical.defines.VSM_SAMPLES !== shadow.blurSamples ) {\n\n\t\t\tshadowMaterialVertical.defines.VSM_SAMPLES = shadow.blurSamples;\n\t\t\tshadowMaterialHorizontal.defines.VSM_SAMPLES = shadow.blurSamples;\n\n\t\t\tshadowMaterialVertical.needsUpdate = true;\n\t\t\tshadowMaterialHorizontal.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( shadow.mapPass === null ) {\n\n\t\t\tshadow.mapPass = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y );\n\n\t\t}\n\n\t\t// vertical pass\n\n\t\tshadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture;\n\t\tshadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;\n\t\tshadowMaterialVertical.uniforms.radius.value = shadow.radius;\n\t\t_renderer.setRenderTarget( shadow.mapPass );\n\t\t_renderer.clear();\n\t\t_renderer.renderBufferDirect( camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null );\n\n\t\t// horizontal pass\n\n\t\tshadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;\n\t\tshadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;\n\t\tshadowMaterialHorizontal.uniforms.radius.value = shadow.radius;\n\t\t_renderer.setRenderTarget( shadow.map );\n\t\t_renderer.clear();\n\t\t_renderer.renderBufferDirect( camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null );\n\n\t}\n\n\tfunction getDepthMaterial( object, material, light, type ) {\n\n\t\tlet result = null;\n\n\t\tconst customMaterial = ( light.isPointLight === true ) ? object.customDistanceMaterial : object.customDepthMaterial;\n\n\t\tif ( customMaterial !== undefined ) {\n\n\t\t\tresult = customMaterial;\n\n\t\t} else {\n\n\t\t\tresult = ( light.isPointLight === true ) ? _distanceMaterial : _depthMaterial;\n\n\t\t\tif ( ( _renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) ||\n\t\t\t\t( material.displacementMap && material.displacementScale !== 0 ) ||\n\t\t\t\t( material.alphaMap && material.alphaTest > 0 ) ||\n\t\t\t\t( material.map && material.alphaTest > 0 ) ) {\n\n\t\t\t\t// in this case we need a unique material instance reflecting the\n\t\t\t\t// appropriate state\n\n\t\t\t\tconst keyA = result.uuid, keyB = material.uuid;\n\n\t\t\t\tlet materialsForVariant = _materialCache[ keyA ];\n\n\t\t\t\tif ( materialsForVariant === undefined ) {\n\n\t\t\t\t\tmaterialsForVariant = {};\n\t\t\t\t\t_materialCache[ keyA ] = materialsForVariant;\n\n\t\t\t\t}\n\n\t\t\t\tlet cachedMaterial = materialsForVariant[ keyB ];\n\n\t\t\t\tif ( cachedMaterial === undefined ) {\n\n\t\t\t\t\tcachedMaterial = result.clone();\n\t\t\t\t\tmaterialsForVariant[ keyB ] = cachedMaterial;\n\n\t\t\t\t}\n\n\t\t\t\tresult = cachedMaterial;\n\n\t\t\t}\n\n\t\t}\n\n\t\tresult.visible = material.visible;\n\t\tresult.wireframe = material.wireframe;\n\n\t\tif ( type === VSMShadowMap ) {\n\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : material.side;\n\n\t\t} else {\n\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : shadowSide[ material.side ];\n\n\t\t}\n\n\t\tresult.alphaMap = material.alphaMap;\n\t\tresult.alphaTest = material.alphaTest;\n\t\tresult.map = material.map;\n\n\t\tresult.clipShadows = material.clipShadows;\n\t\tresult.clippingPlanes = material.clippingPlanes;\n\t\tresult.clipIntersection = material.clipIntersection;\n\n\t\tresult.displacementMap = material.displacementMap;\n\t\tresult.displacementScale = material.displacementScale;\n\t\tresult.displacementBias = material.displacementBias;\n\n\t\tresult.wireframeLinewidth = material.wireframeLinewidth;\n\t\tresult.linewidth = material.linewidth;\n\n\t\tif ( light.isPointLight === true && result.isMeshDistanceMaterial === true ) {\n\n\t\t\tconst materialProperties = _renderer.properties.get( result );\n\t\t\tmaterialProperties.light = light;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tfunction renderObject( object, camera, shadowCamera, light, type ) {\n\n\t\tif ( object.visible === false ) return;\n\n\t\tconst visible = object.layers.test( camera.layers );\n\n\t\tif ( visible && ( object.isMesh || object.isLine || object.isPoints ) ) {\n\n\t\t\tif ( ( object.castShadow || ( object.receiveShadow && type === VSMShadowMap ) ) && ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) ) {\n\n\t\t\t\tobject.modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld );\n\n\t\t\t\tconst geometry = _objects.update( object );\n\t\t\t\tconst material = object.material;\n\n\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\tconst groups = geometry.groups;\n\n\t\t\t\t\tfor ( let k = 0, kl = groups.length; k < kl; k ++ ) {\n\n\t\t\t\t\t\tconst group = groups[ k ];\n\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\n\n\t\t\t\t\t\t\tconst depthMaterial = getDepthMaterial( object, groupMaterial, light, type );\n\n\t\t\t\t\t\t\t_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( material.visible ) {\n\n\t\t\t\t\tconst depthMaterial = getDepthMaterial( object, material, light, type );\n\n\t\t\t\t\t_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\trenderObject( children[ i ], camera, shadowCamera, light, type );\n\n\t\t}\n\n\t}\n\n}\n\nfunction WebGLState( gl, extensions, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tfunction ColorBuffer() {\n\n\t\tlet locked = false;\n\n\t\tconst color = new Vector4();\n\t\tlet currentColorMask = null;\n\t\tconst currentColorClear = new Vector4( 0, 0, 0, 0 );\n\n\t\treturn {\n\n\t\t\tsetMask: function ( colorMask ) {\n\n\t\t\t\tif ( currentColorMask !== colorMask && ! locked ) {\n\n\t\t\t\t\tgl.colorMask( colorMask, colorMask, colorMask, colorMask );\n\t\t\t\t\tcurrentColorMask = colorMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( r, g, b, a, premultipliedAlpha ) {\n\n\t\t\t\tif ( premultipliedAlpha === true ) {\n\n\t\t\t\t\tr *= a; g *= a; b *= a;\n\n\t\t\t\t}\n\n\t\t\t\tcolor.set( r, g, b, a );\n\n\t\t\t\tif ( currentColorClear.equals( color ) === false ) {\n\n\t\t\t\t\tgl.clearColor( r, g, b, a );\n\t\t\t\t\tcurrentColorClear.copy( color );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentColorMask = null;\n\t\t\t\tcurrentColorClear.set( - 1, 0, 0, 0 ); // set to invalid state\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tfunction DepthBuffer() {\n\n\t\tlet locked = false;\n\n\t\tlet currentDepthMask = null;\n\t\tlet currentDepthFunc = null;\n\t\tlet currentDepthClear = null;\n\n\t\treturn {\n\n\t\t\tsetTest: function ( depthTest ) {\n\n\t\t\t\tif ( depthTest ) {\n\n\t\t\t\t\tenable( gl.DEPTH_TEST );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdisable( gl.DEPTH_TEST );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetMask: function ( depthMask ) {\n\n\t\t\t\tif ( currentDepthMask !== depthMask && ! locked ) {\n\n\t\t\t\t\tgl.depthMask( depthMask );\n\t\t\t\t\tcurrentDepthMask = depthMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetFunc: function ( depthFunc ) {\n\n\t\t\t\tif ( currentDepthFunc !== depthFunc ) {\n\n\t\t\t\t\tswitch ( depthFunc ) {\n\n\t\t\t\t\t\tcase NeverDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.NEVER );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AlwaysDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.ALWAYS );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase LessDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LESS );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase LessEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase EqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.EQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase GreaterEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.GEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase GreaterDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.GREATER );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase NotEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.NOTEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrentDepthFunc = depthFunc;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( depth ) {\n\n\t\t\t\tif ( currentDepthClear !== depth ) {\n\n\t\t\t\t\tgl.clearDepth( depth );\n\t\t\t\t\tcurrentDepthClear = depth;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentDepthMask = null;\n\t\t\t\tcurrentDepthFunc = null;\n\t\t\t\tcurrentDepthClear = null;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tfunction StencilBuffer() {\n\n\t\tlet locked = false;\n\n\t\tlet currentStencilMask = null;\n\t\tlet currentStencilFunc = null;\n\t\tlet currentStencilRef = null;\n\t\tlet currentStencilFuncMask = null;\n\t\tlet currentStencilFail = null;\n\t\tlet currentStencilZFail = null;\n\t\tlet currentStencilZPass = null;\n\t\tlet currentStencilClear = null;\n\n\t\treturn {\n\n\t\t\tsetTest: function ( stencilTest ) {\n\n\t\t\t\tif ( ! locked ) {\n\n\t\t\t\t\tif ( stencilTest ) {\n\n\t\t\t\t\t\tenable( gl.STENCIL_TEST );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tdisable( gl.STENCIL_TEST );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetMask: function ( stencilMask ) {\n\n\t\t\t\tif ( currentStencilMask !== stencilMask && ! locked ) {\n\n\t\t\t\t\tgl.stencilMask( stencilMask );\n\t\t\t\t\tcurrentStencilMask = stencilMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetFunc: function ( stencilFunc, stencilRef, stencilMask ) {\n\n\t\t\t\tif ( currentStencilFunc !== stencilFunc ||\n\t\t\t\t currentStencilRef !== stencilRef ||\n\t\t\t\t currentStencilFuncMask !== stencilMask ) {\n\n\t\t\t\t\tgl.stencilFunc( stencilFunc, stencilRef, stencilMask );\n\n\t\t\t\t\tcurrentStencilFunc = stencilFunc;\n\t\t\t\t\tcurrentStencilRef = stencilRef;\n\t\t\t\t\tcurrentStencilFuncMask = stencilMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetOp: function ( stencilFail, stencilZFail, stencilZPass ) {\n\n\t\t\t\tif ( currentStencilFail !== stencilFail ||\n\t\t\t\t currentStencilZFail !== stencilZFail ||\n\t\t\t\t currentStencilZPass !== stencilZPass ) {\n\n\t\t\t\t\tgl.stencilOp( stencilFail, stencilZFail, stencilZPass );\n\n\t\t\t\t\tcurrentStencilFail = stencilFail;\n\t\t\t\t\tcurrentStencilZFail = stencilZFail;\n\t\t\t\t\tcurrentStencilZPass = stencilZPass;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( stencil ) {\n\n\t\t\t\tif ( currentStencilClear !== stencil ) {\n\n\t\t\t\t\tgl.clearStencil( stencil );\n\t\t\t\t\tcurrentStencilClear = stencil;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentStencilMask = null;\n\t\t\t\tcurrentStencilFunc = null;\n\t\t\t\tcurrentStencilRef = null;\n\t\t\t\tcurrentStencilFuncMask = null;\n\t\t\t\tcurrentStencilFail = null;\n\t\t\t\tcurrentStencilZFail = null;\n\t\t\t\tcurrentStencilZPass = null;\n\t\t\t\tcurrentStencilClear = null;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\t//\n\n\tconst colorBuffer = new ColorBuffer();\n\tconst depthBuffer = new DepthBuffer();\n\tconst stencilBuffer = new StencilBuffer();\n\n\tconst uboBindings = new WeakMap();\n\tconst uboProgramMap = new WeakMap();\n\n\tlet enabledCapabilities = {};\n\n\tlet currentBoundFramebuffers = {};\n\tlet currentDrawbuffers = new WeakMap();\n\tlet defaultDrawbuffers = [];\n\n\tlet currentProgram = null;\n\n\tlet currentBlendingEnabled = false;\n\tlet currentBlending = null;\n\tlet currentBlendEquation = null;\n\tlet currentBlendSrc = null;\n\tlet currentBlendDst = null;\n\tlet currentBlendEquationAlpha = null;\n\tlet currentBlendSrcAlpha = null;\n\tlet currentBlendDstAlpha = null;\n\tlet currentBlendColor = new Color( 0, 0, 0 );\n\tlet currentBlendAlpha = 0;\n\tlet currentPremultipledAlpha = false;\n\n\tlet currentFlipSided = null;\n\tlet currentCullFace = null;\n\n\tlet currentLineWidth = null;\n\n\tlet currentPolygonOffsetFactor = null;\n\tlet currentPolygonOffsetUnits = null;\n\n\tconst maxTextures = gl.getParameter( gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS );\n\n\tlet lineWidthAvailable = false;\n\tlet version = 0;\n\tconst glVersion = gl.getParameter( gl.VERSION );\n\n\tif ( glVersion.indexOf( 'WebGL' ) !== - 1 ) {\n\n\t\tversion = parseFloat( /^WebGL (\\d)/.exec( glVersion )[ 1 ] );\n\t\tlineWidthAvailable = ( version >= 1.0 );\n\n\t} else if ( glVersion.indexOf( 'OpenGL ES' ) !== - 1 ) {\n\n\t\tversion = parseFloat( /^OpenGL ES (\\d)/.exec( glVersion )[ 1 ] );\n\t\tlineWidthAvailable = ( version >= 2.0 );\n\n\t}\n\n\tlet currentTextureSlot = null;\n\tlet currentBoundTextures = {};\n\n\tconst scissorParam = gl.getParameter( gl.SCISSOR_BOX );\n\tconst viewportParam = gl.getParameter( gl.VIEWPORT );\n\n\tconst currentScissor = new Vector4().fromArray( scissorParam );\n\tconst currentViewport = new Vector4().fromArray( viewportParam );\n\n\tfunction createTexture( type, target, count, dimensions ) {\n\n\t\tconst data = new Uint8Array( 4 ); // 4 is required to match default unpack alignment of 4.\n\t\tconst texture = gl.createTexture();\n\n\t\tgl.bindTexture( type, texture );\n\t\tgl.texParameteri( type, gl.TEXTURE_MIN_FILTER, gl.NEAREST );\n\t\tgl.texParameteri( type, gl.TEXTURE_MAG_FILTER, gl.NEAREST );\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tif ( isWebGL2 && ( type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY ) ) {\n\n\t\t\t\tgl.texImage3D( target, 0, gl.RGBA, 1, 1, dimensions, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );\n\n\t\t\t} else {\n\n\t\t\t\tgl.texImage2D( target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tconst emptyTextures = {};\n\temptyTextures[ gl.TEXTURE_2D ] = createTexture( gl.TEXTURE_2D, gl.TEXTURE_2D, 1 );\n\temptyTextures[ gl.TEXTURE_CUBE_MAP ] = createTexture( gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6 );\n\n\tif ( isWebGL2 ) {\n\n\t\temptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );\n\t\temptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );\n\n\t}\n\n\t// init\n\n\tcolorBuffer.setClear( 0, 0, 0, 1 );\n\tdepthBuffer.setClear( 1 );\n\tstencilBuffer.setClear( 0 );\n\n\tenable( gl.DEPTH_TEST );\n\tdepthBuffer.setFunc( LessEqualDepth );\n\n\tsetFlipSided( false );\n\tsetCullFace( CullFaceBack );\n\tenable( gl.CULL_FACE );\n\n\tsetBlending( NoBlending );\n\n\t//\n\n\tfunction enable( id ) {\n\n\t\tif ( enabledCapabilities[ id ] !== true ) {\n\n\t\t\tgl.enable( id );\n\t\t\tenabledCapabilities[ id ] = true;\n\n\t\t}\n\n\t}\n\n\tfunction disable( id ) {\n\n\t\tif ( enabledCapabilities[ id ] !== false ) {\n\n\t\t\tgl.disable( id );\n\t\t\tenabledCapabilities[ id ] = false;\n\n\t\t}\n\n\t}\n\n\tfunction bindFramebuffer( target, framebuffer ) {\n\n\t\tif ( currentBoundFramebuffers[ target ] !== framebuffer ) {\n\n\t\t\tgl.bindFramebuffer( target, framebuffer );\n\n\t\t\tcurrentBoundFramebuffers[ target ] = framebuffer;\n\n\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t// gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER\n\n\t\t\t\tif ( target === gl.DRAW_FRAMEBUFFER ) {\n\n\t\t\t\t\tcurrentBoundFramebuffers[ gl.FRAMEBUFFER ] = framebuffer;\n\n\t\t\t\t}\n\n\t\t\t\tif ( target === gl.FRAMEBUFFER ) {\n\n\t\t\t\t\tcurrentBoundFramebuffers[ gl.DRAW_FRAMEBUFFER ] = framebuffer;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tfunction drawBuffers( renderTarget, framebuffer ) {\n\n\t\tlet drawBuffers = defaultDrawbuffers;\n\n\t\tlet needsUpdate = false;\n\n\t\tif ( renderTarget ) {\n\n\t\t\tdrawBuffers = currentDrawbuffers.get( framebuffer );\n\n\t\t\tif ( drawBuffers === undefined ) {\n\n\t\t\t\tdrawBuffers = [];\n\t\t\t\tcurrentDrawbuffers.set( framebuffer, drawBuffers );\n\n\t\t\t}\n\n\t\t\tif ( renderTarget.isWebGLMultipleRenderTargets ) {\n\n\t\t\t\tconst textures = renderTarget.texture;\n\n\t\t\t\tif ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {\n\n\t\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tdrawBuffers[ i ] = gl.COLOR_ATTACHMENT0 + i;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tdrawBuffers.length = textures.length;\n\n\t\t\t\t\tneedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {\n\n\t\t\t\t\tdrawBuffers[ 0 ] = gl.COLOR_ATTACHMENT0;\n\n\t\t\t\t\tneedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( drawBuffers[ 0 ] !== gl.BACK ) {\n\n\t\t\t\tdrawBuffers[ 0 ] = gl.BACK;\n\n\t\t\t\tneedsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( needsUpdate ) {\n\n\t\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t\tgl.drawBuffers( drawBuffers );\n\n\t\t\t} else {\n\n\t\t\t\textensions.get( 'WEBGL_draw_buffers' ).drawBuffersWEBGL( drawBuffers );\n\n\t\t\t}\n\n\t\t}\n\n\n\t}\n\n\tfunction useProgram( program ) {\n\n\t\tif ( currentProgram !== program ) {\n\n\t\t\tgl.useProgram( program );\n\n\t\t\tcurrentProgram = program;\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tconst equationToGL = {\n\t\t[ AddEquation ]: gl.FUNC_ADD,\n\t\t[ SubtractEquation ]: gl.FUNC_SUBTRACT,\n\t\t[ ReverseSubtractEquation ]: gl.FUNC_REVERSE_SUBTRACT\n\t};\n\n\tif ( isWebGL2 ) {\n\n\t\tequationToGL[ MinEquation ] = gl.MIN;\n\t\tequationToGL[ MaxEquation ] = gl.MAX;\n\n\t} else {\n\n\t\tconst extension = extensions.get( 'EXT_blend_minmax' );\n\n\t\tif ( extension !== null ) {\n\n\t\t\tequationToGL[ MinEquation ] = extension.MIN_EXT;\n\t\t\tequationToGL[ MaxEquation ] = extension.MAX_EXT;\n\n\t\t}\n\n\t}\n\n\tconst factorToGL = {\n\t\t[ ZeroFactor ]: gl.ZERO,\n\t\t[ OneFactor ]: gl.ONE,\n\t\t[ SrcColorFactor ]: gl.SRC_COLOR,\n\t\t[ SrcAlphaFactor ]: gl.SRC_ALPHA,\n\t\t[ SrcAlphaSaturateFactor ]: gl.SRC_ALPHA_SATURATE,\n\t\t[ DstColorFactor ]: gl.DST_COLOR,\n\t\t[ DstAlphaFactor ]: gl.DST_ALPHA,\n\t\t[ OneMinusSrcColorFactor ]: gl.ONE_MINUS_SRC_COLOR,\n\t\t[ OneMinusSrcAlphaFactor ]: gl.ONE_MINUS_SRC_ALPHA,\n\t\t[ OneMinusDstColorFactor ]: gl.ONE_MINUS_DST_COLOR,\n\t\t[ OneMinusDstAlphaFactor ]: gl.ONE_MINUS_DST_ALPHA,\n\t\t[ ConstantColorFactor ]: gl.CONSTANT_COLOR,\n\t\t[ OneMinusConstantColorFactor ]: gl.ONE_MINUS_CONSTANT_COLOR,\n\t\t[ ConstantAlphaFactor ]: gl.CONSTANT_ALPHA,\n\t\t[ OneMinusConstantAlphaFactor ]: gl.ONE_MINUS_CONSTANT_ALPHA\n\t};\n\n\tfunction setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, blendColor, blendAlpha, premultipliedAlpha ) {\n\n\t\tif ( blending === NoBlending ) {\n\n\t\t\tif ( currentBlendingEnabled === true ) {\n\n\t\t\t\tdisable( gl.BLEND );\n\t\t\t\tcurrentBlendingEnabled = false;\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( currentBlendingEnabled === false ) {\n\n\t\t\tenable( gl.BLEND );\n\t\t\tcurrentBlendingEnabled = true;\n\n\t\t}\n\n\t\tif ( blending !== CustomBlending ) {\n\n\t\t\tif ( blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha ) {\n\n\t\t\t\tif ( currentBlendEquation !== AddEquation || currentBlendEquationAlpha !== AddEquation ) {\n\n\t\t\t\t\tgl.blendEquation( gl.FUNC_ADD );\n\n\t\t\t\t\tcurrentBlendEquation = AddEquation;\n\t\t\t\t\tcurrentBlendEquationAlpha = AddEquation;\n\n\t\t\t\t}\n\n\t\t\t\tif ( premultipliedAlpha ) {\n\n\t\t\t\t\tswitch ( blending ) {\n\n\t\t\t\t\t\tcase NormalBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AdditiveBlending:\n\t\t\t\t\t\t\tgl.blendFunc( gl.ONE, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase SubtractiveBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase MultiplyBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLState: Invalid blending: ', blending );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tswitch ( blending ) {\n\n\t\t\t\t\t\tcase NormalBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AdditiveBlending:\n\t\t\t\t\t\t\tgl.blendFunc( gl.SRC_ALPHA, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase SubtractiveBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase MultiplyBlending:\n\t\t\t\t\t\t\tgl.blendFunc( gl.ZERO, gl.SRC_COLOR );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLState: Invalid blending: ', blending );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tcurrentBlendSrc = null;\n\t\t\t\tcurrentBlendDst = null;\n\t\t\t\tcurrentBlendSrcAlpha = null;\n\t\t\t\tcurrentBlendDstAlpha = null;\n\t\t\t\tcurrentBlendColor.set( 0, 0, 0 );\n\t\t\t\tcurrentBlendAlpha = 0;\n\n\t\t\t\tcurrentBlending = blending;\n\t\t\t\tcurrentPremultipledAlpha = premultipliedAlpha;\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// custom blending\n\n\t\tblendEquationAlpha = blendEquationAlpha || blendEquation;\n\t\tblendSrcAlpha = blendSrcAlpha || blendSrc;\n\t\tblendDstAlpha = blendDstAlpha || blendDst;\n\n\t\tif ( blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha ) {\n\n\t\t\tgl.blendEquationSeparate( equationToGL[ blendEquation ], equationToGL[ blendEquationAlpha ] );\n\n\t\t\tcurrentBlendEquation = blendEquation;\n\t\t\tcurrentBlendEquationAlpha = blendEquationAlpha;\n\n\t\t}\n\n\t\tif ( blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha ) {\n\n\t\t\tgl.blendFuncSeparate( factorToGL[ blendSrc ], factorToGL[ blendDst ], factorToGL[ blendSrcAlpha ], factorToGL[ blendDstAlpha ] );\n\n\t\t\tcurrentBlendSrc = blendSrc;\n\t\t\tcurrentBlendDst = blendDst;\n\t\t\tcurrentBlendSrcAlpha = blendSrcAlpha;\n\t\t\tcurrentBlendDstAlpha = blendDstAlpha;\n\n\t\t}\n\n\t\tif ( blendColor.equals( currentBlendColor ) === false || blendAlpha !== currentBlendAlpha ) {\n\n\t\t\tgl.blendColor( blendColor.r, blendColor.g, blendColor.b, blendAlpha );\n\n\t\t\tcurrentBlendColor.copy( blendColor );\n\t\t\tcurrentBlendAlpha = blendAlpha;\n\n\t\t}\n\n\t\tcurrentBlending = blending;\n\t\tcurrentPremultipledAlpha = false;\n\n\t}\n\n\tfunction setMaterial( material, frontFaceCW ) {\n\n\t\tmaterial.side === DoubleSide\n\t\t\t? disable( gl.CULL_FACE )\n\t\t\t: enable( gl.CULL_FACE );\n\n\t\tlet flipSided = ( material.side === BackSide );\n\t\tif ( frontFaceCW ) flipSided = ! flipSided;\n\n\t\tsetFlipSided( flipSided );\n\n\t\t( material.blending === NormalBlending && material.transparent === false )\n\t\t\t? setBlending( NoBlending )\n\t\t\t: setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.blendColor, material.blendAlpha, material.premultipliedAlpha );\n\n\t\tdepthBuffer.setFunc( material.depthFunc );\n\t\tdepthBuffer.setTest( material.depthTest );\n\t\tdepthBuffer.setMask( material.depthWrite );\n\t\tcolorBuffer.setMask( material.colorWrite );\n\n\t\tconst stencilWrite = material.stencilWrite;\n\t\tstencilBuffer.setTest( stencilWrite );\n\t\tif ( stencilWrite ) {\n\n\t\t\tstencilBuffer.setMask( material.stencilWriteMask );\n\t\t\tstencilBuffer.setFunc( material.stencilFunc, material.stencilRef, material.stencilFuncMask );\n\t\t\tstencilBuffer.setOp( material.stencilFail, material.stencilZFail, material.stencilZPass );\n\n\t\t}\n\n\t\tsetPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );\n\n\t\tmaterial.alphaToCoverage === true\n\t\t\t? enable( gl.SAMPLE_ALPHA_TO_COVERAGE )\n\t\t\t: disable( gl.SAMPLE_ALPHA_TO_COVERAGE );\n\n\t}\n\n\t//\n\n\tfunction setFlipSided( flipSided ) {\n\n\t\tif ( currentFlipSided !== flipSided ) {\n\n\t\t\tif ( flipSided ) {\n\n\t\t\t\tgl.frontFace( gl.CW );\n\n\t\t\t} else {\n\n\t\t\t\tgl.frontFace( gl.CCW );\n\n\t\t\t}\n\n\t\t\tcurrentFlipSided = flipSided;\n\n\t\t}\n\n\t}\n\n\tfunction setCullFace( cullFace ) {\n\n\t\tif ( cullFace !== CullFaceNone ) {\n\n\t\t\tenable( gl.CULL_FACE );\n\n\t\t\tif ( cullFace !== currentCullFace ) {\n\n\t\t\t\tif ( cullFace === CullFaceBack ) {\n\n\t\t\t\t\tgl.cullFace( gl.BACK );\n\n\t\t\t\t} else if ( cullFace === CullFaceFront ) {\n\n\t\t\t\t\tgl.cullFace( gl.FRONT );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tgl.cullFace( gl.FRONT_AND_BACK );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tdisable( gl.CULL_FACE );\n\n\t\t}\n\n\t\tcurrentCullFace = cullFace;\n\n\t}\n\n\tfunction setLineWidth( width ) {\n\n\t\tif ( width !== currentLineWidth ) {\n\n\t\t\tif ( lineWidthAvailable ) gl.lineWidth( width );\n\n\t\t\tcurrentLineWidth = width;\n\n\t\t}\n\n\t}\n\n\tfunction setPolygonOffset( polygonOffset, factor, units ) {\n\n\t\tif ( polygonOffset ) {\n\n\t\t\tenable( gl.POLYGON_OFFSET_FILL );\n\n\t\t\tif ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) {\n\n\t\t\t\tgl.polygonOffset( factor, units );\n\n\t\t\t\tcurrentPolygonOffsetFactor = factor;\n\t\t\t\tcurrentPolygonOffsetUnits = units;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tdisable( gl.POLYGON_OFFSET_FILL );\n\n\t\t}\n\n\t}\n\n\tfunction setScissorTest( scissorTest ) {\n\n\t\tif ( scissorTest ) {\n\n\t\t\tenable( gl.SCISSOR_TEST );\n\n\t\t} else {\n\n\t\t\tdisable( gl.SCISSOR_TEST );\n\n\t\t}\n\n\t}\n\n\t// texture\n\n\tfunction activeTexture( webglSlot ) {\n\n\t\tif ( webglSlot === undefined ) webglSlot = gl.TEXTURE0 + maxTextures - 1;\n\n\t\tif ( currentTextureSlot !== webglSlot ) {\n\n\t\t\tgl.activeTexture( webglSlot );\n\t\t\tcurrentTextureSlot = webglSlot;\n\n\t\t}\n\n\t}\n\n\tfunction bindTexture( webglType, webglTexture, webglSlot ) {\n\n\t\tif ( webglSlot === undefined ) {\n\n\t\t\tif ( currentTextureSlot === null ) {\n\n\t\t\t\twebglSlot = gl.TEXTURE0 + maxTextures - 1;\n\n\t\t\t} else {\n\n\t\t\t\twebglSlot = currentTextureSlot;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet boundTexture = currentBoundTextures[ webglSlot ];\n\n\t\tif ( boundTexture === undefined ) {\n\n\t\t\tboundTexture = { type: undefined, texture: undefined };\n\t\t\tcurrentBoundTextures[ webglSlot ] = boundTexture;\n\n\t\t}\n\n\t\tif ( boundTexture.type !== webglType || boundTexture.texture !== webglTexture ) {\n\n\t\t\tif ( currentTextureSlot !== webglSlot ) {\n\n\t\t\t\tgl.activeTexture( webglSlot );\n\t\t\t\tcurrentTextureSlot = webglSlot;\n\n\t\t\t}\n\n\t\t\tgl.bindTexture( webglType, webglTexture || emptyTextures[ webglType ] );\n\n\t\t\tboundTexture.type = webglType;\n\t\t\tboundTexture.texture = webglTexture;\n\n\t\t}\n\n\t}\n\n\tfunction unbindTexture() {\n\n\t\tconst boundTexture = currentBoundTextures[ currentTextureSlot ];\n\n\t\tif ( boundTexture !== undefined && boundTexture.type !== undefined ) {\n\n\t\t\tgl.bindTexture( boundTexture.type, null );\n\n\t\t\tboundTexture.type = undefined;\n\t\t\tboundTexture.texture = undefined;\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texSubImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texSubImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texSubImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texSubImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexSubImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexSubImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexSubImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexSubImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texStorage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texStorage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texStorage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texStorage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction scissor( scissor ) {\n\n\t\tif ( currentScissor.equals( scissor ) === false ) {\n\n\t\t\tgl.scissor( scissor.x, scissor.y, scissor.z, scissor.w );\n\t\t\tcurrentScissor.copy( scissor );\n\n\t\t}\n\n\t}\n\n\tfunction viewport( viewport ) {\n\n\t\tif ( currentViewport.equals( viewport ) === false ) {\n\n\t\t\tgl.viewport( viewport.x, viewport.y, viewport.z, viewport.w );\n\t\t\tcurrentViewport.copy( viewport );\n\n\t\t}\n\n\t}\n\n\tfunction updateUBOMapping( uniformsGroup, program ) {\n\n\t\tlet mapping = uboProgramMap.get( program );\n\n\t\tif ( mapping === undefined ) {\n\n\t\t\tmapping = new WeakMap();\n\n\t\t\tuboProgramMap.set( program, mapping );\n\n\t\t}\n\n\t\tlet blockIndex = mapping.get( uniformsGroup );\n\n\t\tif ( blockIndex === undefined ) {\n\n\t\t\tblockIndex = gl.getUniformBlockIndex( program, uniformsGroup.name );\n\n\t\t\tmapping.set( uniformsGroup, blockIndex );\n\n\t\t}\n\n\t}\n\n\tfunction uniformBlockBinding( uniformsGroup, program ) {\n\n\t\tconst mapping = uboProgramMap.get( program );\n\t\tconst blockIndex = mapping.get( uniformsGroup );\n\n\t\tif ( uboBindings.get( program ) !== blockIndex ) {\n\n\t\t\t// bind shader specific block index to global block point\n\t\t\tgl.uniformBlockBinding( program, blockIndex, uniformsGroup.__bindingPointIndex );\n\n\t\t\tuboBindings.set( program, blockIndex );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction reset() {\n\n\t\t// reset state\n\n\t\tgl.disable( gl.BLEND );\n\t\tgl.disable( gl.CULL_FACE );\n\t\tgl.disable( gl.DEPTH_TEST );\n\t\tgl.disable( gl.POLYGON_OFFSET_FILL );\n\t\tgl.disable( gl.SCISSOR_TEST );\n\t\tgl.disable( gl.STENCIL_TEST );\n\t\tgl.disable( gl.SAMPLE_ALPHA_TO_COVERAGE );\n\n\t\tgl.blendEquation( gl.FUNC_ADD );\n\t\tgl.blendFunc( gl.ONE, gl.ZERO );\n\t\tgl.blendFuncSeparate( gl.ONE, gl.ZERO, gl.ONE, gl.ZERO );\n\t\tgl.blendColor( 0, 0, 0, 0 );\n\n\t\tgl.colorMask( true, true, true, true );\n\t\tgl.clearColor( 0, 0, 0, 0 );\n\n\t\tgl.depthMask( true );\n\t\tgl.depthFunc( gl.LESS );\n\t\tgl.clearDepth( 1 );\n\n\t\tgl.stencilMask( 0xffffffff );\n\t\tgl.stencilFunc( gl.ALWAYS, 0, 0xffffffff );\n\t\tgl.stencilOp( gl.KEEP, gl.KEEP, gl.KEEP );\n\t\tgl.clearStencil( 0 );\n\n\t\tgl.cullFace( gl.BACK );\n\t\tgl.frontFace( gl.CCW );\n\n\t\tgl.polygonOffset( 0, 0 );\n\n\t\tgl.activeTexture( gl.TEXTURE0 );\n\n\t\tgl.bindFramebuffer( gl.FRAMEBUFFER, null );\n\n\t\tif ( isWebGL2 === true ) {\n\n\t\t\tgl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );\n\t\t\tgl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );\n\n\t\t}\n\n\t\tgl.useProgram( null );\n\n\t\tgl.lineWidth( 1 );\n\n\t\tgl.scissor( 0, 0, gl.canvas.width, gl.canvas.height );\n\t\tgl.viewport( 0, 0, gl.canvas.width, gl.canvas.height );\n\n\t\t// reset internals\n\n\t\tenabledCapabilities = {};\n\n\t\tcurrentTextureSlot = null;\n\t\tcurrentBoundTextures = {};\n\n\t\tcurrentBoundFramebuffers = {};\n\t\tcurrentDrawbuffers = new WeakMap();\n\t\tdefaultDrawbuffers = [];\n\n\t\tcurrentProgram = null;\n\n\t\tcurrentBlendingEnabled = false;\n\t\tcurrentBlending = null;\n\t\tcurrentBlendEquation = null;\n\t\tcurrentBlendSrc = null;\n\t\tcurrentBlendDst = null;\n\t\tcurrentBlendEquationAlpha = null;\n\t\tcurrentBlendSrcAlpha = null;\n\t\tcurrentBlendDstAlpha = null;\n\t\tcurrentBlendColor = new Color( 0, 0, 0 );\n\t\tcurrentBlendAlpha = 0;\n\t\tcurrentPremultipledAlpha = false;\n\n\t\tcurrentFlipSided = null;\n\t\tcurrentCullFace = null;\n\n\t\tcurrentLineWidth = null;\n\n\t\tcurrentPolygonOffsetFactor = null;\n\t\tcurrentPolygonOffsetUnits = null;\n\n\t\tcurrentScissor.set( 0, 0, gl.canvas.width, gl.canvas.height );\n\t\tcurrentViewport.set( 0, 0, gl.canvas.width, gl.canvas.height );\n\n\t\tcolorBuffer.reset();\n\t\tdepthBuffer.reset();\n\t\tstencilBuffer.reset();\n\n\t}\n\n\treturn {\n\n\t\tbuffers: {\n\t\t\tcolor: colorBuffer,\n\t\t\tdepth: depthBuffer,\n\t\t\tstencil: stencilBuffer\n\t\t},\n\n\t\tenable: enable,\n\t\tdisable: disable,\n\n\t\tbindFramebuffer: bindFramebuffer,\n\t\tdrawBuffers: drawBuffers,\n\n\t\tuseProgram: useProgram,\n\n\t\tsetBlending: setBlending,\n\t\tsetMaterial: setMaterial,\n\n\t\tsetFlipSided: setFlipSided,\n\t\tsetCullFace: setCullFace,\n\n\t\tsetLineWidth: setLineWidth,\n\t\tsetPolygonOffset: setPolygonOffset,\n\n\t\tsetScissorTest: setScissorTest,\n\n\t\tactiveTexture: activeTexture,\n\t\tbindTexture: bindTexture,\n\t\tunbindTexture: unbindTexture,\n\t\tcompressedTexImage2D: compressedTexImage2D,\n\t\tcompressedTexImage3D: compressedTexImage3D,\n\t\ttexImage2D: texImage2D,\n\t\ttexImage3D: texImage3D,\n\n\t\tupdateUBOMapping: updateUBOMapping,\n\t\tuniformBlockBinding: uniformBlockBinding,\n\n\t\ttexStorage2D: texStorage2D,\n\t\ttexStorage3D: texStorage3D,\n\t\ttexSubImage2D: texSubImage2D,\n\t\ttexSubImage3D: texSubImage3D,\n\t\tcompressedTexSubImage2D: compressedTexSubImage2D,\n\t\tcompressedTexSubImage3D: compressedTexSubImage3D,\n\n\t\tscissor: scissor,\n\t\tviewport: viewport,\n\n\t\treset: reset\n\n\t};\n\n}\n\nfunction WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\tconst maxTextures = capabilities.maxTextures;\n\tconst maxCubemapSize = capabilities.maxCubemapSize;\n\tconst maxTextureSize = capabilities.maxTextureSize;\n\tconst maxSamples = capabilities.maxSamples;\n\tconst multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;\n\tconst supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );\n\n\tconst _videoTextures = new WeakMap();\n\tlet _canvas;\n\n\tconst _sources = new WeakMap(); // maps WebglTexture objects to instances of Source\n\n\t// cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,\n\t// also OffscreenCanvas.getContext(\"webgl\"), but not OffscreenCanvas.getContext(\"2d\")!\n\t// Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).\n\n\tlet useOffscreenCanvas = false;\n\n\ttry {\n\n\t\tuseOffscreenCanvas = typeof OffscreenCanvas !== 'undefined'\n\t\t\t// eslint-disable-next-line compat/compat\n\t\t\t&& ( new OffscreenCanvas( 1, 1 ).getContext( '2d' ) ) !== null;\n\n\t} catch ( err ) {\n\n\t\t// Ignore any errors\n\n\t}\n\n\tfunction createCanvas( width, height ) {\n\n\t\t// Use OffscreenCanvas when available. Specially needed in web workers\n\n\t\treturn useOffscreenCanvas ?\n\t\t\t// eslint-disable-next-line compat/compat\n\t\t\tnew OffscreenCanvas( width, height ) : createElementNS( 'canvas' );\n\n\t}\n\n\tfunction resizeImage( image, needsPowerOfTwo, needsNewCanvas, maxSize ) {\n\n\t\tlet scale = 1;\n\n\t\t// handle case if texture exceeds max size\n\n\t\tif ( image.width > maxSize || image.height > maxSize ) {\n\n\t\t\tscale = maxSize / Math.max( image.width, image.height );\n\n\t\t}\n\n\t\t// only perform resize if necessary\n\n\t\tif ( scale < 1 || needsPowerOfTwo === true ) {\n\n\t\t\t// only perform resize for certain image types\n\n\t\t\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t\t\tconst floor = needsPowerOfTwo ? floorPowerOfTwo : Math.floor;\n\n\t\t\t\tconst width = floor( scale * image.width );\n\t\t\t\tconst height = floor( scale * image.height );\n\n\t\t\t\tif ( _canvas === undefined ) _canvas = createCanvas( width, height );\n\n\t\t\t\t// cube textures can't reuse the same canvas\n\n\t\t\t\tconst canvas = needsNewCanvas ? createCanvas( width, height ) : _canvas;\n\n\t\t\t\tcanvas.width = width;\n\t\t\t\tcanvas.height = height;\n\n\t\t\t\tconst context = canvas.getContext( '2d' );\n\t\t\t\tcontext.drawImage( image, 0, 0, width, height );\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture has been resized from (' + image.width + 'x' + image.height + ') to (' + width + 'x' + height + ').' );\n\n\t\t\t\treturn canvas;\n\n\t\t\t} else {\n\n\t\t\t\tif ( 'data' in image ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Image in DataTexture is too big (' + image.width + 'x' + image.height + ').' );\n\n\t\t\t\t}\n\n\t\t\t\treturn image;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn image;\n\n\t}\n\n\tfunction isPowerOfTwo$1( image ) {\n\n\t\treturn isPowerOfTwo( image.width ) && isPowerOfTwo( image.height );\n\n\t}\n\n\tfunction textureNeedsPowerOfTwo( texture ) {\n\n\t\tif ( isWebGL2 ) return false;\n\n\t\treturn ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) ||\n\t\t\t( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter );\n\n\t}\n\n\tfunction textureNeedsGenerateMipmaps( texture, supportsMips ) {\n\n\t\treturn texture.generateMipmaps && supportsMips &&\n\t\t\ttexture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;\n\n\t}\n\n\tfunction generateMipmap( target ) {\n\n\t\t_gl.generateMipmap( target );\n\n\t}\n\n\tfunction getInternalFormat( internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false ) {\n\n\t\tif ( isWebGL2 === false ) return glFormat;\n\n\t\tif ( internalFormatName !== null ) {\n\n\t\t\tif ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ];\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \\'' + internalFormatName + '\\'' );\n\n\t\t}\n\n\t\tlet internalFormat = glFormat;\n\n\t\tif ( glFormat === _gl.RED ) {\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.R32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.R16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RED_INTEGER ) {\n\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8UI;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.R16UI;\n\t\t\tif ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.R32UI;\n\t\t\tif ( glType === _gl.BYTE ) internalFormat = _gl.R8I;\n\t\t\tif ( glType === _gl.SHORT ) internalFormat = _gl.R16I;\n\t\t\tif ( glType === _gl.INT ) internalFormat = _gl.R32I;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RG ) {\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.RG32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RG16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RGBA ) {\n\n\t\t\tconst transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.RGBA32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RGBA16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( transfer === SRGBTransfer ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT_4_4_4_4 ) internalFormat = _gl.RGBA4;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT_5_5_5_1 ) internalFormat = _gl.RGB5_A1;\n\n\t\t}\n\n\t\tif ( internalFormat === _gl.R16F || internalFormat === _gl.R32F ||\n\t\t\tinternalFormat === _gl.RG16F || internalFormat === _gl.RG32F ||\n\t\t\tinternalFormat === _gl.RGBA16F || internalFormat === _gl.RGBA32F ) {\n\n\t\t\textensions.get( 'EXT_color_buffer_float' );\n\n\t\t}\n\n\t\treturn internalFormat;\n\n\t}\n\n\tfunction getMipLevels( texture, image, supportsMips ) {\n\n\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) === true || ( texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) ) {\n\n\t\t\treturn Math.log2( Math.max( image.width, image.height ) ) + 1;\n\n\t\t} else if ( texture.mipmaps !== undefined && texture.mipmaps.length > 0 ) {\n\n\t\t\t// user-defined mipmaps\n\n\t\t\treturn texture.mipmaps.length;\n\n\t\t} else if ( texture.isCompressedTexture && Array.isArray( texture.image ) ) {\n\n\t\t\treturn image.mipmaps.length;\n\n\t\t} else {\n\n\t\t\t// texture without mipmaps (only base level)\n\n\t\t\treturn 1;\n\n\t\t}\n\n\t}\n\n\t// Fallback filters for non-power-of-2 textures\n\n\tfunction filterFallback( f ) {\n\n\t\tif ( f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter ) {\n\n\t\t\treturn _gl.NEAREST;\n\n\t\t}\n\n\t\treturn _gl.LINEAR;\n\n\t}\n\n\t//\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tdeallocateTexture( texture );\n\n\t\tif ( texture.isVideoTexture ) {\n\n\t\t\t_videoTextures.delete( texture );\n\n\t\t}\n\n\t}\n\n\tfunction onRenderTargetDispose( event ) {\n\n\t\tconst renderTarget = event.target;\n\n\t\trenderTarget.removeEventListener( 'dispose', onRenderTargetDispose );\n\n\t\tdeallocateRenderTarget( renderTarget );\n\n\t}\n\n\t//\n\n\tfunction deallocateTexture( texture ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( textureProperties.__webglInit === undefined ) return;\n\n\t\t// check if it's necessary to remove the WebGLTexture object\n\n\t\tconst source = texture.source;\n\t\tconst webglTextures = _sources.get( source );\n\n\t\tif ( webglTextures ) {\n\n\t\t\tconst webglTexture = webglTextures[ textureProperties.__cacheKey ];\n\t\t\twebglTexture.usedTimes --;\n\n\t\t\t// the WebGLTexture object is not used anymore, remove it\n\n\t\t\tif ( webglTexture.usedTimes === 0 ) {\n\n\t\t\t\tdeleteTexture( texture );\n\n\t\t\t}\n\n\t\t\t// remove the weak map entry if no WebGLTexture uses the source anymore\n\n\t\t\tif ( Object.keys( webglTextures ).length === 0 ) {\n\n\t\t\t\t_sources.delete( source );\n\n\t\t\t}\n\n\t\t}\n\n\t\tproperties.remove( texture );\n\n\t}\n\n\tfunction deleteTexture( texture ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\t\t_gl.deleteTexture( textureProperties.__webglTexture );\n\n\t\tconst source = texture.source;\n\t\tconst webglTextures = _sources.get( source );\n\t\tdelete webglTextures[ textureProperties.__cacheKey ];\n\n\t\tinfo.memory.textures --;\n\n\t}\n\n\tfunction deallocateRenderTarget( renderTarget ) {\n\n\t\tconst texture = renderTarget.texture;\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( textureProperties.__webglTexture !== undefined ) {\n\n\t\t\t_gl.deleteTexture( textureProperties.__webglTexture );\n\n\t\t\tinfo.memory.textures --;\n\n\t\t}\n\n\t\tif ( renderTarget.depthTexture ) {\n\n\t\t\trenderTarget.depthTexture.dispose();\n\n\t\t}\n\n\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( Array.isArray( renderTargetProperties.__webglFramebuffer[ i ] ) ) {\n\n\t\t\t\t\tfor ( let level = 0; level < renderTargetProperties.__webglFramebuffer[ i ].length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ][ level ] );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( Array.isArray( renderTargetProperties.__webglFramebuffer ) ) {\n\n\t\t\t\tfor ( let level = 0; level < renderTargetProperties.__webglFramebuffer.length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ level ] );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer );\n\n\t\t\t}\n\n\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer );\n\t\t\tif ( renderTargetProperties.__webglMultisampledFramebuffer ) _gl.deleteFramebuffer( renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\tif ( renderTargetProperties.__webglColorRenderbuffer ) {\n\n\t\t\t\tfor ( let i = 0; i < renderTargetProperties.__webglColorRenderbuffer.length; i ++ ) {\n\n\t\t\t\t\tif ( renderTargetProperties.__webglColorRenderbuffer[ i ] ) _gl.deleteRenderbuffer( renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( renderTargetProperties.__webglDepthRenderbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthRenderbuffer );\n\n\t\t}\n\n\t\tif ( renderTarget.isWebGLMultipleRenderTargets ) {\n\n\t\t\tfor ( let i = 0, il = texture.length; i < il; i ++ ) {\n\n\t\t\t\tconst attachmentProperties = properties.get( texture[ i ] );\n\n\t\t\t\tif ( attachmentProperties.__webglTexture ) {\n\n\t\t\t\t\t_gl.deleteTexture( attachmentProperties.__webglTexture );\n\n\t\t\t\t\tinfo.memory.textures --;\n\n\t\t\t\t}\n\n\t\t\t\tproperties.remove( texture[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tproperties.remove( texture );\n\t\tproperties.remove( renderTarget );\n\n\t}\n\n\t//\n\n\tlet textureUnits = 0;\n\n\tfunction resetTextureUnits() {\n\n\t\ttextureUnits = 0;\n\n\t}\n\n\tfunction allocateTextureUnit() {\n\n\t\tconst textureUnit = textureUnits;\n\n\t\tif ( textureUnit >= maxTextures ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + maxTextures );\n\n\t\t}\n\n\t\ttextureUnits += 1;\n\n\t\treturn textureUnit;\n\n\t}\n\n\tfunction getTextureCacheKey( texture ) {\n\n\t\tconst array = [];\n\n\t\tarray.push( texture.wrapS );\n\t\tarray.push( texture.wrapT );\n\t\tarray.push( texture.wrapR || 0 );\n\t\tarray.push( texture.magFilter );\n\t\tarray.push( texture.minFilter );\n\t\tarray.push( texture.anisotropy );\n\t\tarray.push( texture.internalFormat );\n\t\tarray.push( texture.format );\n\t\tarray.push( texture.type );\n\t\tarray.push( texture.generateMipmaps );\n\t\tarray.push( texture.premultiplyAlpha );\n\t\tarray.push( texture.flipY );\n\t\tarray.push( texture.unpackAlignment );\n\t\tarray.push( texture.colorSpace );\n\n\t\treturn array.join();\n\n\t}\n\n\t//\n\n\tfunction setTexture2D( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.isVideoTexture ) updateVideoTexture( texture );\n\n\t\tif ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tconst image = texture.image;\n\n\t\t\tif ( image === null ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but no image data found.' );\n\n\t\t\t} else if ( image.complete === false ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but image is incomplete' );\n\n\t\t\t} else {\n\n\t\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTexture2DArray( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTexture3D( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_3D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTextureCube( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadCubeTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tconst wrappingToGL = {\n\t\t[ RepeatWrapping ]: _gl.REPEAT,\n\t\t[ ClampToEdgeWrapping ]: _gl.CLAMP_TO_EDGE,\n\t\t[ MirroredRepeatWrapping ]: _gl.MIRRORED_REPEAT\n\t};\n\n\tconst filterToGL = {\n\t\t[ NearestFilter ]: _gl.NEAREST,\n\t\t[ NearestMipmapNearestFilter ]: _gl.NEAREST_MIPMAP_NEAREST,\n\t\t[ NearestMipmapLinearFilter ]: _gl.NEAREST_MIPMAP_LINEAR,\n\n\t\t[ LinearFilter ]: _gl.LINEAR,\n\t\t[ LinearMipmapNearestFilter ]: _gl.LINEAR_MIPMAP_NEAREST,\n\t\t[ LinearMipmapLinearFilter ]: _gl.LINEAR_MIPMAP_LINEAR\n\t};\n\n\tconst compareToGL = {\n\t\t[ NeverCompare ]: _gl.NEVER,\n\t\t[ AlwaysCompare ]: _gl.ALWAYS,\n\t\t[ LessCompare ]: _gl.LESS,\n\t\t[ LessEqualCompare ]: _gl.LEQUAL,\n\t\t[ EqualCompare ]: _gl.EQUAL,\n\t\t[ GreaterEqualCompare ]: _gl.GEQUAL,\n\t\t[ GreaterCompare ]: _gl.GREATER,\n\t\t[ NotEqualCompare ]: _gl.NOTEQUAL\n\t};\n\n\tfunction setTextureParameters( textureType, texture, supportsMips ) {\n\n\t\tif ( supportsMips ) {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );\n\n\t\t\tif ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );\n\n\t\t\t}\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );\n\n\t\t} else {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );\n\n\t\t\tif ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, _gl.CLAMP_TO_EDGE );\n\n\t\t\t}\n\n\t\t\tif ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.' );\n\n\t\t\t}\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterFallback( texture.magFilter ) );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterFallback( texture.minFilter ) );\n\n\t\t\tif ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.' );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( texture.compareFunction ) {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_MODE, _gl.COMPARE_REF_TO_TEXTURE );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_FUNC, compareToGL[ texture.compareFunction ] );\n\n\t\t}\n\n\t\tif ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {\n\n\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\n\n\t\t\tif ( texture.magFilter === NearestFilter ) return;\n\t\t\tif ( texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter ) return;\n\t\t\tif ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension for WebGL 1 and WebGL 2\n\t\t\tif ( isWebGL2 === false && ( texture.type === HalfFloatType && extensions.has( 'OES_texture_half_float_linear' ) === false ) ) return; // verify extension for WebGL 1 only\n\n\t\t\tif ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {\n\n\t\t\t\t_gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, capabilities.getMaxAnisotropy() ) );\n\t\t\t\tproperties.get( texture ).__currentAnisotropy = texture.anisotropy;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction initTexture( textureProperties, texture ) {\n\n\t\tlet forceUpload = false;\n\n\t\tif ( textureProperties.__webglInit === undefined ) {\n\n\t\t\ttextureProperties.__webglInit = true;\n\n\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t}\n\n\t\t// create Source <-> WebGLTextures mapping if necessary\n\n\t\tconst source = texture.source;\n\t\tlet webglTextures = _sources.get( source );\n\n\t\tif ( webglTextures === undefined ) {\n\n\t\t\twebglTextures = {};\n\t\t\t_sources.set( source, webglTextures );\n\n\t\t}\n\n\t\t// check if there is already a WebGLTexture object for the given texture parameters\n\n\t\tconst textureCacheKey = getTextureCacheKey( texture );\n\n\t\tif ( textureCacheKey !== textureProperties.__cacheKey ) {\n\n\t\t\t// if not, create a new instance of WebGLTexture\n\n\t\t\tif ( webglTextures[ textureCacheKey ] === undefined ) {\n\n\t\t\t\t// create new entry\n\n\t\t\t\twebglTextures[ textureCacheKey ] = {\n\t\t\t\t\ttexture: _gl.createTexture(),\n\t\t\t\t\tusedTimes: 0\n\t\t\t\t};\n\n\t\t\t\tinfo.memory.textures ++;\n\n\t\t\t\t// when a new instance of WebGLTexture was created, a texture upload is required\n\t\t\t\t// even if the image contents are identical\n\n\t\t\t\tforceUpload = true;\n\n\t\t\t}\n\n\t\t\twebglTextures[ textureCacheKey ].usedTimes ++;\n\n\t\t\t// every time the texture cache key changes, it's necessary to check if an instance of\n\t\t\t// WebGLTexture can be deleted in order to avoid a memory leak.\n\n\t\t\tconst webglTexture = webglTextures[ textureProperties.__cacheKey ];\n\n\t\t\tif ( webglTexture !== undefined ) {\n\n\t\t\t\twebglTextures[ textureProperties.__cacheKey ].usedTimes --;\n\n\t\t\t\tif ( webglTexture.usedTimes === 0 ) {\n\n\t\t\t\t\tdeleteTexture( texture );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// store references to cache key and WebGLTexture object\n\n\t\t\ttextureProperties.__cacheKey = textureCacheKey;\n\t\t\ttextureProperties.__webglTexture = webglTextures[ textureCacheKey ].texture;\n\n\t\t}\n\n\t\treturn forceUpload;\n\n\t}\n\n\tfunction uploadTexture( textureProperties, texture, slot ) {\n\n\t\tlet textureType = _gl.TEXTURE_2D;\n\n\t\tif ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) textureType = _gl.TEXTURE_2D_ARRAY;\n\t\tif ( texture.isData3DTexture ) textureType = _gl.TEXTURE_3D;\n\n\t\tconst forceUpload = initTexture( textureProperties, texture );\n\t\tconst source = texture.source;\n\n\t\tstate.bindTexture( textureType, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t\tconst sourceProperties = properties.get( source );\n\n\t\tif ( source.version !== sourceProperties.__version || forceUpload === true ) {\n\n\t\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\n\n\t\t\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\t\t\tconst texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );\n\t\t\tconst unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );\n\n\t\t\tconst needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo$1( texture.image ) === false;\n\t\t\tlet image = resizeImage( texture.image, needsPowerOfTwo, false, maxTextureSize );\n\t\t\timage = verifyColorSpace( texture, image );\n\n\t\t\tconst supportsMips = isPowerOfTwo$1( image ) || isWebGL2,\n\t\t\t\tglFormat = utils.convert( texture.format, texture.colorSpace );\n\n\t\t\tlet glType = utils.convert( texture.type ),\n\t\t\t\tglInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture );\n\n\t\t\tsetTextureParameters( textureType, texture, supportsMips );\n\n\t\t\tlet mipmap;\n\t\t\tconst mipmaps = texture.mipmaps;\n\n\t\t\tconst useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\n\t\t\tconst levels = getMipLevels( texture, image, supportsMips );\n\n\t\t\tif ( texture.isDepthTexture ) {\n\n\t\t\t\t// populate depth texture with dummy data\n\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT;\n\n\t\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t\tif ( texture.type === FloatType ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT32F;\n\n\t\t\t\t\t} else if ( texture.type === UnsignedIntType ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT24;\n\n\t\t\t\t\t} else if ( texture.type === UnsignedInt248Type ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH24_STENCIL8;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT16; // WebGL2 requires sized internalformat for glTexImage2D\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( texture.type === FloatType ) {\n\n\t\t\t\t\t\tconsole.error( 'WebGLRenderer: Floating point depth texture requires WebGL2.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// validation checks for WebGL 1\n\n\t\t\t\tif ( texture.format === DepthFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {\n\n\t\t\t\t\t// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are\n\t\t\t\t\t// DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT\n\t\t\t\t\t// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n\t\t\t\t\tif ( texture.type !== UnsignedShortType && texture.type !== UnsignedIntType ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.' );\n\n\t\t\t\t\t\ttexture.type = UnsignedIntType;\n\t\t\t\t\t\tglType = utils.convert( texture.type );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( texture.format === DepthStencilFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {\n\n\t\t\t\t\t// Depth stencil textures need the DEPTH_STENCIL internal format\n\t\t\t\t\t// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n\t\t\t\t\tglInternalFormat = _gl.DEPTH_STENCIL;\n\n\t\t\t\t\t// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are\n\t\t\t\t\t// DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.\n\t\t\t\t\t// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n\t\t\t\t\tif ( texture.type !== UnsignedInt248Type ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.' );\n\n\t\t\t\t\t\ttexture.type = UnsignedInt248Type;\n\t\t\t\t\t\tglType = utils.convert( texture.type );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t//\n\n\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, 1, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isDataTexture ) {\n\n\t\t\t\t// use manually created mipmaps if available\n\t\t\t\t// if there are no manual mipmaps\n\t\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\n\n\t\t\t\tif ( mipmaps.length > 0 && supportsMips ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.generateMipmaps = false;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isCompressedTexture ) {\n\n\t\t\t\tif ( texture.isCompressedArrayTexture ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0 );\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data, 0, 0 );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isDataArrayTexture ) {\n\n\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, image.width, image.height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isData3DTexture ) {\n\n\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_3D, levels, glInternalFormat, image.width, image.height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isFramebufferTexture ) {\n\n\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tlet width = image.width, height = image.height;\n\n\t\t\t\t\t\tfor ( let i = 0; i < levels; i ++ ) {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, width, height, 0, glFormat, glType, null );\n\n\t\t\t\t\t\t\twidth >>= 1;\n\t\t\t\t\t\t\theight >>= 1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// regular Texture (image, video, canvas)\n\n\t\t\t\t// use manually created mipmaps if available\n\t\t\t\t// if there are no manual mipmaps\n\t\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\n\n\t\t\t\tif ( mipmaps.length > 0 && supportsMips ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, glFormat, glType, mipmap );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, glFormat, glType, mipmap );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.generateMipmaps = false;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, glFormat, glType, image );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\tgenerateMipmap( textureType );\n\n\t\t\t}\n\n\t\t\tsourceProperties.__version = source.version;\n\n\t\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\n\n\t\t}\n\n\t\ttextureProperties.__version = texture.version;\n\n\t}\n\n\tfunction uploadCubeTexture( textureProperties, texture, slot ) {\n\n\t\tif ( texture.image.length !== 6 ) return;\n\n\t\tconst forceUpload = initTexture( textureProperties, texture );\n\t\tconst source = texture.source;\n\n\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t\tconst sourceProperties = properties.get( source );\n\n\t\tif ( source.version !== sourceProperties.__version || forceUpload === true ) {\n\n\t\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\n\n\t\t\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\t\t\tconst texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );\n\t\t\tconst unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );\n\n\t\t\tconst isCompressed = ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture );\n\t\t\tconst isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );\n\n\t\t\tconst cubeImage = [];\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( ! isCompressed && ! isDataTexture ) {\n\n\t\t\t\t\tcubeImage[ i ] = resizeImage( texture.image[ i ], false, true, maxCubemapSize );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tcubeImage[ i ] = isDataTexture ? texture.image[ i ].image : texture.image[ i ];\n\n\t\t\t\t}\n\n\t\t\t\tcubeImage[ i ] = verifyColorSpace( texture, cubeImage[ i ] );\n\n\t\t\t}\n\n\t\t\tconst image = cubeImage[ 0 ],\n\t\t\t\tsupportsMips = isPowerOfTwo$1( image ) || isWebGL2,\n\t\t\t\tglFormat = utils.convert( texture.format, texture.colorSpace ),\n\t\t\t\tglType = utils.convert( texture.type ),\n\t\t\t\tglInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\n\t\t\tconst useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\n\t\t\tlet levels = getMipLevels( texture, image, supportsMips );\n\n\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, supportsMips );\n\n\t\t\tlet mipmaps;\n\n\t\t\tif ( isCompressed ) {\n\n\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tmipmaps = cubeImage[ i ].mipmaps;\n\n\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tmipmaps = texture.mipmaps;\n\n\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t// TODO: Uniformly handle mipmap definitions\n\t\t\t\t\t// Normal textures and compressed cube textures define base level + mips with their mipmap array\n\t\t\t\t\t// Uncompressed cube textures use their mipmap array only for mips (no base level)\n\n\t\t\t\t\tif ( mipmaps.length > 0 ) levels ++;\n\n\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, cubeImage[ 0 ].width, cubeImage[ 0 ].height );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tif ( isDataTexture ) {\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, cubeImage[ i ].width, cubeImage[ i ].height, glFormat, glType, cubeImage[ i ].data );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\t\t\t\t\t\t\tconst mipmapImage = mipmap.image[ i ].image;\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, glFormat, glType, cubeImage[ i ] );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, glFormat, glType, cubeImage[ i ] );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, glFormat, glType, mipmap.image[ i ] );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[ i ] );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\t// We assume images for cube map have the same size.\n\t\t\t\tgenerateMipmap( _gl.TEXTURE_CUBE_MAP );\n\n\t\t\t}\n\n\t\t\tsourceProperties.__version = source.version;\n\n\t\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\n\n\t\t}\n\n\t\ttextureProperties.__version = texture.version;\n\n\t}\n\n\t// Render targets\n\n\t// Setup storage for target texture and bind it to correct framebuffer\n\tfunction setupFrameBufferTexture( framebuffer, renderTarget, texture, attachment, textureTarget, level ) {\n\n\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\tconst glType = utils.convert( texture.type );\n\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\tif ( ! renderTargetProperties.__hasExternalTextures ) {\n\n\t\t\tconst width = Math.max( 1, renderTarget.width >> level );\n\t\t\tconst height = Math.max( 1, renderTarget.height >> level );\n\n\t\t\tif ( textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t\tstate.texImage3D( textureTarget, level, glInternalFormat, width, height, renderTarget.depth, 0, glFormat, glType, null );\n\n\t\t\t} else {\n\n\t\t\t\tstate.texImage2D( textureTarget, level, glInternalFormat, width, height, 0, glFormat, glType, null );\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, 0, getRenderTargetSamples( renderTarget ) );\n\n\t\t} else if ( textureTarget === _gl.TEXTURE_2D || ( textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z ) ) { // see #24753\n\n\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, level );\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t}\n\n\n\t// Setup storage for internal depth/stencil buffers and bind to correct framebuffer\n\tfunction setupRenderBufferStorage( renderbuffer, renderTarget, isMultisample ) {\n\n\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );\n\n\t\tif ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {\n\n\t\t\tlet glInternalFormat = ( isWebGL2 === true ) ? _gl.DEPTH_COMPONENT24 : _gl.DEPTH_COMPONENT16;\n\n\t\t\tif ( isMultisample || useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tconst depthTexture = renderTarget.depthTexture;\n\n\t\t\t\tif ( depthTexture && depthTexture.isDepthTexture ) {\n\n\t\t\t\t\tif ( depthTexture.type === FloatType ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT32F;\n\n\t\t\t\t\t} else if ( depthTexture.type === UnsignedIntType ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT24;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );\n\n\t\t} else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) {\n\n\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\t\tif ( isMultisample && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height );\n\n\t\t\t} else if ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\n\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );\n\n\t\t} else {\n\n\t\t\tconst textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [ renderTarget.texture ];\n\n\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\tconst texture = textures[ i ];\n\n\t\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\t\t\tconst glType = utils.convert( texture.type );\n\t\t\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\t\t\tif ( isMultisample && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t} else if ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );\n\n\t}\n\n\t// Setup resources for a Depth Texture for a FBO (needs an extension)\n\tfunction setupDepthTexture( framebuffer, renderTarget ) {\n\n\t\tconst isCube = ( renderTarget && renderTarget.isWebGLCubeRenderTarget );\n\t\tif ( isCube ) throw new Error( 'Depth Texture with cube render targets is not supported' );\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\tif ( ! ( renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture ) ) {\n\n\t\t\tthrow new Error( 'renderTarget.depthTexture must be an instance of THREE.DepthTexture' );\n\n\t\t}\n\n\t\t// upload an empty depth texture with framebuffer size\n\t\tif ( ! properties.get( renderTarget.depthTexture ).__webglTexture ||\n\t\t\t\trenderTarget.depthTexture.image.width !== renderTarget.width ||\n\t\t\t\trenderTarget.depthTexture.image.height !== renderTarget.height ) {\n\n\t\t\trenderTarget.depthTexture.image.width = renderTarget.width;\n\t\t\trenderTarget.depthTexture.image.height = renderTarget.height;\n\t\t\trenderTarget.depthTexture.needsUpdate = true;\n\n\t\t}\n\n\t\tsetTexture2D( renderTarget.depthTexture, 0 );\n\n\t\tconst webglDepthTexture = properties.get( renderTarget.depthTexture ).__webglTexture;\n\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\tif ( renderTarget.depthTexture.format === DepthFormat ) {\n\n\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );\n\n\t\t\t}\n\n\t\t} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {\n\n\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'Unknown depthTexture format' );\n\n\t\t}\n\n\t}\n\n\t// Setup GL resources for a non-texture depth buffer\n\tfunction setupDepthRenderbuffer( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\n\t\tif ( renderTarget.depthTexture && ! renderTargetProperties.__autoAllocateDepthBuffer ) {\n\n\t\t\tif ( isCube ) throw new Error( 'target.depthTexture not supported in Cube render targets' );\n\n\t\t\tsetupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget );\n\n\t\t} else {\n\n\t\t\tif ( isCube ) {\n\n\t\t\t\trenderTargetProperties.__webglDepthbuffer = [];\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ i ] );\n\t\t\t\t\trenderTargetProperties.__webglDepthbuffer[ i ] = _gl.createRenderbuffer();\n\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer[ i ], renderTarget, false );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\t\t\trenderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();\n\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer, renderTarget, false );\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t}\n\n\t// rebind framebuffer with external textures\n\tfunction rebindTextures( renderTarget, colorTexture, depthTexture ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\tif ( colorTexture !== undefined ) {\n\n\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, 0 );\n\n\t\t}\n\n\t\tif ( depthTexture !== undefined ) {\n\n\t\t\tsetupDepthRenderbuffer( renderTarget );\n\n\t\t}\n\n\t}\n\n\t// Set up GL resources for the render target\n\tfunction setupRenderTarget( renderTarget ) {\n\n\t\tconst texture = renderTarget.texture;\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst textureProperties = properties.get( texture );\n\n\t\trenderTarget.addEventListener( 'dispose', onRenderTargetDispose );\n\n\t\tif ( renderTarget.isWebGLMultipleRenderTargets !== true ) {\n\n\t\t\tif ( textureProperties.__webglTexture === undefined ) {\n\n\t\t\t\ttextureProperties.__webglTexture = _gl.createTexture();\n\n\t\t\t}\n\n\t\t\ttextureProperties.__version = texture.version;\n\t\t\tinfo.memory.textures ++;\n\n\t\t}\n\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\t\tconst isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );\n\t\tconst supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;\n\n\t\t// Setup framebuffer\n\n\t\tif ( isCube ) {\n\n\t\t\trenderTargetProperties.__webglFramebuffer = [];\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ] = [];\n\n\t\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ][ level ] = _gl.createFramebuffer();\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ] = _gl.createFramebuffer();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\trenderTargetProperties.__webglFramebuffer = [];\n\n\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ level ] = _gl.createFramebuffer();\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\trenderTargetProperties.__webglFramebuffer = _gl.createFramebuffer();\n\n\t\t\t}\n\n\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\tif ( capabilities.drawBuffers ) {\n\n\t\t\t\t\tconst textures = renderTarget.texture;\n\n\t\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst attachmentProperties = properties.get( textures[ i ] );\n\n\t\t\t\t\t\tif ( attachmentProperties.__webglTexture === undefined ) {\n\n\t\t\t\t\t\t\tattachmentProperties.__webglTexture = _gl.createTexture();\n\n\t\t\t\t\t\t\tinfo.memory.textures ++;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\tconst textures = isMultipleRenderTargets ? texture : [ texture ];\n\n\t\t\t\trenderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();\n\t\t\t\trenderTargetProperties.__webglColorRenderbuffer = [];\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tconst texture = textures[ i ];\n\t\t\t\t\trenderTargetProperties.__webglColorRenderbuffer[ i ] = _gl.createRenderbuffer();\n\n\t\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\t\t\t\tconst glType = utils.convert( texture.type );\n\t\t\t\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, renderTarget.isXRRenderTarget === true );\n\t\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );\n\n\t\t\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\t\t\trenderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer();\n\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true );\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Setup color buffer\n\n\t\tif ( isCube ) {\n\n\t\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, supportsMips );\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ][ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\tgenerateMipmap( _gl.TEXTURE_CUBE_MAP );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t} else if ( isMultipleRenderTargets ) {\n\n\t\t\tconst textures = renderTarget.texture;\n\n\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\tconst attachment = textures[ i ];\n\t\t\t\tconst attachmentProperties = properties.get( attachment );\n\n\t\t\t\tstate.bindTexture( _gl.TEXTURE_2D, attachmentProperties.__webglTexture );\n\t\t\t\tsetTextureParameters( _gl.TEXTURE_2D, attachment, supportsMips );\n\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0 );\n\n\t\t\t\tif ( textureNeedsGenerateMipmaps( attachment, supportsMips ) ) {\n\n\t\t\t\t\tgenerateMipmap( _gl.TEXTURE_2D );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t} else {\n\n\t\t\tlet glTextureType = _gl.TEXTURE_2D;\n\n\t\t\tif ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {\n\n\t\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t\tglTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( 'THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.bindTexture( glTextureType, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( glTextureType, texture, supportsMips );\n\n\t\t\tif ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, level );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, 0 );\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\tgenerateMipmap( glTextureType );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t}\n\n\t\t// Setup depth and stencil buffers\n\n\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\tsetupDepthRenderbuffer( renderTarget );\n\n\t\t}\n\n\t}\n\n\tfunction updateRenderTargetMipmap( renderTarget ) {\n\n\t\tconst supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;\n\n\t\tconst textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [ renderTarget.texture ];\n\n\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\tconst texture = textures[ i ];\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\tconst target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D;\n\t\t\t\tconst webglTexture = properties.get( texture ).__webglTexture;\n\n\t\t\t\tstate.bindTexture( target, webglTexture );\n\t\t\t\tgenerateMipmap( target );\n\t\t\t\tstate.unbindTexture();\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction updateMultisampleRenderTarget( renderTarget ) {\n\n\t\tif ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\tconst textures = renderTarget.isWebGLMultipleRenderTargets ? renderTarget.texture : [ renderTarget.texture ];\n\t\t\tconst width = renderTarget.width;\n\t\t\tconst height = renderTarget.height;\n\t\t\tlet mask = _gl.COLOR_BUFFER_BIT;\n\t\t\tconst invalidationArray = [];\n\t\t\tconst depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\tconst isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );\n\n\t\t\t// If MRT we need to remove FBO attachments\n\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, null );\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, null, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\n\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\tinvalidationArray.push( _gl.COLOR_ATTACHMENT0 + i );\n\n\t\t\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\t\t\tinvalidationArray.push( depthStyle );\n\n\t\t\t\t}\n\n\t\t\t\tconst ignoreDepthValues = ( renderTargetProperties.__ignoreDepthValues !== undefined ) ? renderTargetProperties.__ignoreDepthValues : false;\n\n\t\t\t\tif ( ignoreDepthValues === false ) {\n\n\t\t\t\t\tif ( renderTarget.depthBuffer ) mask |= _gl.DEPTH_BUFFER_BIT;\n\t\t\t\t\tif ( renderTarget.stencilBuffer ) mask |= _gl.STENCIL_BUFFER_BIT;\n\n\t\t\t\t}\n\n\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\tif ( ignoreDepthValues === true ) {\n\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, [ depthStyle ] );\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );\n\n\t\t\t\t}\n\n\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\n\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0 );\n\n\t\t\t\t}\n\n\t\t\t\t_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST );\n\n\t\t\t\tif ( supportsInvalidateFramebuffer ) {\n\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, invalidationArray );\n\n\t\t\t\t}\n\n\n\t\t\t}\n\n\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, null );\n\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, null );\n\n\t\t\t// If MRT since pre-blit we removed the FBO we need to reconstruct the attachments\n\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, webglTexture, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t}\n\n\t}\n\n\tfunction getRenderTargetSamples( renderTarget ) {\n\n\t\treturn Math.min( maxSamples, renderTarget.samples );\n\n\t}\n\n\tfunction useMultisampledRTT( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\treturn isWebGL2 && renderTarget.samples > 0 && extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTargetProperties.__useRenderToTexture !== false;\n\n\t}\n\n\tfunction updateVideoTexture( texture ) {\n\n\t\tconst frame = info.render.frame;\n\n\t\t// Check the last frame we updated the VideoTexture\n\n\t\tif ( _videoTextures.get( texture ) !== frame ) {\n\n\t\t\t_videoTextures.set( texture, frame );\n\t\t\ttexture.update();\n\n\t\t}\n\n\t}\n\n\tfunction verifyColorSpace( texture, image ) {\n\n\t\tconst colorSpace = texture.colorSpace;\n\t\tconst format = texture.format;\n\t\tconst type = texture.type;\n\n\t\tif ( texture.isCompressedTexture === true || texture.isVideoTexture === true || texture.format === _SRGBAFormat ) return image;\n\n\t\tif ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {\n\n\t\t\t// sRGB\n\n\t\t\tif ( ColorManagement.getTransfer( colorSpace ) === SRGBTransfer ) {\n\n\t\t\t\tif ( isWebGL2 === false ) {\n\n\t\t\t\t\t// in WebGL 1, try to use EXT_sRGB extension and unsized formats\n\n\t\t\t\t\tif ( extensions.has( 'EXT_sRGB' ) === true && format === RGBAFormat ) {\n\n\t\t\t\t\t\ttexture.format = _SRGBAFormat;\n\n\t\t\t\t\t\t// it's not possible to generate mips in WebGL 1 with this extension\n\n\t\t\t\t\t\ttexture.minFilter = LinearFilter;\n\t\t\t\t\t\ttexture.generateMipmaps = false;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// slow fallback (CPU decode)\n\n\t\t\t\t\t\timage = ImageUtils.sRGBToLinear( image );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format\n\n\t\t\t\t\tif ( format !== RGBAFormat || type !== UnsignedByteType ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconsole.error( 'THREE.WebGLTextures: Unsupported texture color space:', colorSpace );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn image;\n\n\t}\n\n\t//\n\n\tthis.allocateTextureUnit = allocateTextureUnit;\n\tthis.resetTextureUnits = resetTextureUnits;\n\n\tthis.setTexture2D = setTexture2D;\n\tthis.setTexture2DArray = setTexture2DArray;\n\tthis.setTexture3D = setTexture3D;\n\tthis.setTextureCube = setTextureCube;\n\tthis.rebindTextures = rebindTextures;\n\tthis.setupRenderTarget = setupRenderTarget;\n\tthis.updateRenderTargetMipmap = updateRenderTargetMipmap;\n\tthis.updateMultisampleRenderTarget = updateMultisampleRenderTarget;\n\tthis.setupDepthRenderbuffer = setupDepthRenderbuffer;\n\tthis.setupFrameBufferTexture = setupFrameBufferTexture;\n\tthis.useMultisampledRTT = useMultisampledRTT;\n\n}\n\nfunction WebGLUtils( gl, extensions, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tfunction convert( p, colorSpace = NoColorSpace ) {\n\n\t\tlet extension;\n\n\t\tconst transfer = ColorManagement.getTransfer( colorSpace );\n\n\t\tif ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;\n\t\tif ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;\n\t\tif ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;\n\n\t\tif ( p === ByteType ) return gl.BYTE;\n\t\tif ( p === ShortType ) return gl.SHORT;\n\t\tif ( p === UnsignedShortType ) return gl.UNSIGNED_SHORT;\n\t\tif ( p === IntType ) return gl.INT;\n\t\tif ( p === UnsignedIntType ) return gl.UNSIGNED_INT;\n\t\tif ( p === FloatType ) return gl.FLOAT;\n\n\t\tif ( p === HalfFloatType ) {\n\n\t\t\tif ( isWebGL2 ) return gl.HALF_FLOAT;\n\n\t\t\textension = extensions.get( 'OES_texture_half_float' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.HALF_FLOAT_OES;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( p === AlphaFormat ) return gl.ALPHA;\n\t\tif ( p === RGBAFormat ) return gl.RGBA;\n\t\tif ( p === LuminanceFormat ) return gl.LUMINANCE;\n\t\tif ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;\n\t\tif ( p === DepthFormat ) return gl.DEPTH_COMPONENT;\n\t\tif ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;\n\n\t\t// WebGL 1 sRGB fallback\n\n\t\tif ( p === _SRGBAFormat ) {\n\n\t\t\textension = extensions.get( 'EXT_sRGB' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.SRGB_ALPHA_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// WebGL2 formats.\n\n\t\tif ( p === RedFormat ) return gl.RED;\n\t\tif ( p === RedIntegerFormat ) return gl.RED_INTEGER;\n\t\tif ( p === RGFormat ) return gl.RG;\n\t\tif ( p === RGIntegerFormat ) return gl.RG_INTEGER;\n\t\tif ( p === RGBAIntegerFormat ) return gl.RGBA_INTEGER;\n\n\t\t// S3TC\n\n\t\tif ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {\n\n\t\t\tif ( transfer === SRGBTransfer ) {\n\n\t\t\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc_srgb' );\n\n\t\t\t\tif ( extension !== null ) {\n\n\t\t\t\t\tif ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc' );\n\n\t\t\t\tif ( extension !== null ) {\n\n\t\t\t\t\tif ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// PVRTC\n\n\t\tif ( p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format || p === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_pvrtc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGB_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;\n\t\t\t\tif ( p === RGB_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;\n\t\t\t\tif ( p === RGBA_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;\n\t\t\t\tif ( p === RGBA_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ETC1\n\n\t\tif ( p === RGB_ETC1_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_etc1' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.COMPRESSED_RGB_ETC1_WEBGL;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ETC2\n\n\t\tif ( p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_etc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;\n\t\t\t\tif ( p === RGBA_ETC2_EAC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ASTC\n\n\t\tif ( p === RGBA_ASTC_4x4_Format || p === RGBA_ASTC_5x4_Format || p === RGBA_ASTC_5x5_Format ||\n\t\t\tp === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format ||\n\t\t\tp === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format ||\n\t\t\tp === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format ||\n\t\t\tp === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_astc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_ASTC_4x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_5x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_5x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_6x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_6x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_12x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_12x12_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// BPTC\n\n\t\tif ( p === RGBA_BPTC_Format || p === RGB_BPTC_SIGNED_Format || p === RGB_BPTC_UNSIGNED_Format ) {\n\n\t\t\textension = extensions.get( 'EXT_texture_compression_bptc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_BPTC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;\n\t\t\t\tif ( p === RGB_BPTC_SIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;\n\t\t\t\tif ( p === RGB_BPTC_UNSIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// RGTC\n\n\t\tif ( p === RED_RGTC1_Format || p === SIGNED_RED_RGTC1_Format || p === RED_GREEN_RGTC2_Format || p === SIGNED_RED_GREEN_RGTC2_Format ) {\n\n\t\t\textension = extensions.get( 'EXT_texture_compression_rgtc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_BPTC_Format ) return extension.COMPRESSED_RED_RGTC1_EXT;\n\t\t\t\tif ( p === SIGNED_RED_RGTC1_Format ) return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT;\n\t\t\t\tif ( p === RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;\n\t\t\t\tif ( p === SIGNED_RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( p === UnsignedInt248Type ) {\n\n\t\t\tif ( isWebGL2 ) return gl.UNSIGNED_INT_24_8;\n\n\t\t\textension = extensions.get( 'WEBGL_depth_texture' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.UNSIGNED_INT_24_8_WEBGL;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// if \"p\" can't be resolved, assume the user defines a WebGL constant as a string (fallback/workaround for packed RGB formats)\n\n\t\treturn ( gl[ p ] !== undefined ) ? gl[ p ] : null;\n\n\t}\n\n\treturn { convert: convert };\n\n}\n\nclass ArrayCamera extends PerspectiveCamera {\n\n\tconstructor( array = [] ) {\n\n\t\tsuper();\n\n\t\tthis.isArrayCamera = true;\n\n\t\tthis.cameras = array;\n\n\t}\n\n}\n\nclass Group extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isGroup = true;\n\n\t\tthis.type = 'Group';\n\n\t}\n\n}\n\nconst _moveEvent = { type: 'move' };\n\nclass WebXRController {\n\n\tconstructor() {\n\n\t\tthis._targetRay = null;\n\t\tthis._grip = null;\n\t\tthis._hand = null;\n\n\t}\n\n\tgetHandSpace() {\n\n\t\tif ( this._hand === null ) {\n\n\t\t\tthis._hand = new Group();\n\t\t\tthis._hand.matrixAutoUpdate = false;\n\t\t\tthis._hand.visible = false;\n\n\t\t\tthis._hand.joints = {};\n\t\t\tthis._hand.inputState = { pinching: false };\n\n\t\t}\n\n\t\treturn this._hand;\n\n\t}\n\n\tgetTargetRaySpace() {\n\n\t\tif ( this._targetRay === null ) {\n\n\t\t\tthis._targetRay = new Group();\n\t\t\tthis._targetRay.matrixAutoUpdate = false;\n\t\t\tthis._targetRay.visible = false;\n\t\t\tthis._targetRay.hasLinearVelocity = false;\n\t\t\tthis._targetRay.linearVelocity = new Vector3();\n\t\t\tthis._targetRay.hasAngularVelocity = false;\n\t\t\tthis._targetRay.angularVelocity = new Vector3();\n\n\t\t}\n\n\t\treturn this._targetRay;\n\n\t}\n\n\tgetGripSpace() {\n\n\t\tif ( this._grip === null ) {\n\n\t\t\tthis._grip = new Group();\n\t\t\tthis._grip.matrixAutoUpdate = false;\n\t\t\tthis._grip.visible = false;\n\t\t\tthis._grip.hasLinearVelocity = false;\n\t\t\tthis._grip.linearVelocity = new Vector3();\n\t\t\tthis._grip.hasAngularVelocity = false;\n\t\t\tthis._grip.angularVelocity = new Vector3();\n\n\t\t}\n\n\t\treturn this._grip;\n\n\t}\n\n\tdispatchEvent( event ) {\n\n\t\tif ( this._targetRay !== null ) {\n\n\t\t\tthis._targetRay.dispatchEvent( event );\n\n\t\t}\n\n\t\tif ( this._grip !== null ) {\n\n\t\t\tthis._grip.dispatchEvent( event );\n\n\t\t}\n\n\t\tif ( this._hand !== null ) {\n\n\t\t\tthis._hand.dispatchEvent( event );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tconnect( inputSource ) {\n\n\t\tif ( inputSource && inputSource.hand ) {\n\n\t\t\tconst hand = this._hand;\n\n\t\t\tif ( hand ) {\n\n\t\t\t\tfor ( const inputjoint of inputSource.hand.values() ) {\n\n\t\t\t\t\t// Initialize hand with joints when connected\n\t\t\t\t\tthis._getHandJoint( hand, inputjoint );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.dispatchEvent( { type: 'connected', data: inputSource } );\n\n\t\treturn this;\n\n\t}\n\n\tdisconnect( inputSource ) {\n\n\t\tthis.dispatchEvent( { type: 'disconnected', data: inputSource } );\n\n\t\tif ( this._targetRay !== null ) {\n\n\t\t\tthis._targetRay.visible = false;\n\n\t\t}\n\n\t\tif ( this._grip !== null ) {\n\n\t\t\tthis._grip.visible = false;\n\n\t\t}\n\n\t\tif ( this._hand !== null ) {\n\n\t\t\tthis._hand.visible = false;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tupdate( inputSource, frame, referenceSpace ) {\n\n\t\tlet inputPose = null;\n\t\tlet gripPose = null;\n\t\tlet handPose = null;\n\n\t\tconst targetRay = this._targetRay;\n\t\tconst grip = this._grip;\n\t\tconst hand = this._hand;\n\n\t\tif ( inputSource && frame.session.visibilityState !== 'visible-blurred' ) {\n\n\t\t\tif ( hand && inputSource.hand ) {\n\n\t\t\t\thandPose = true;\n\n\t\t\t\tfor ( const inputjoint of inputSource.hand.values() ) {\n\n\t\t\t\t\t// Update the joints groups with the XRJoint poses\n\t\t\t\t\tconst jointPose = frame.getJointPose( inputjoint, referenceSpace );\n\n\t\t\t\t\t// The transform of this joint will be updated with the joint pose on each frame\n\t\t\t\t\tconst joint = this._getHandJoint( hand, inputjoint );\n\n\t\t\t\t\tif ( jointPose !== null ) {\n\n\t\t\t\t\t\tjoint.matrix.fromArray( jointPose.transform.matrix );\n\t\t\t\t\t\tjoint.matrix.decompose( joint.position, joint.rotation, joint.scale );\n\t\t\t\t\t\tjoint.matrixWorldNeedsUpdate = true;\n\t\t\t\t\t\tjoint.jointRadius = jointPose.radius;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tjoint.visible = jointPose !== null;\n\n\t\t\t\t}\n\n\t\t\t\t// Custom events\n\n\t\t\t\t// Check pinchz\n\t\t\t\tconst indexTip = hand.joints[ 'index-finger-tip' ];\n\t\t\t\tconst thumbTip = hand.joints[ 'thumb-tip' ];\n\t\t\t\tconst distance = indexTip.position.distanceTo( thumbTip.position );\n\n\t\t\t\tconst distanceToPinch = 0.02;\n\t\t\t\tconst threshold = 0.005;\n\n\t\t\t\tif ( hand.inputState.pinching && distance > distanceToPinch + threshold ) {\n\n\t\t\t\t\thand.inputState.pinching = false;\n\t\t\t\t\tthis.dispatchEvent( {\n\t\t\t\t\t\ttype: 'pinchend',\n\t\t\t\t\t\thandedness: inputSource.handedness,\n\t\t\t\t\t\ttarget: this\n\t\t\t\t\t} );\n\n\t\t\t\t} else if ( ! hand.inputState.pinching && distance <= distanceToPinch - threshold ) {\n\n\t\t\t\t\thand.inputState.pinching = true;\n\t\t\t\t\tthis.dispatchEvent( {\n\t\t\t\t\t\ttype: 'pinchstart',\n\t\t\t\t\t\thandedness: inputSource.handedness,\n\t\t\t\t\t\ttarget: this\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( grip !== null && inputSource.gripSpace ) {\n\n\t\t\t\t\tgripPose = frame.getPose( inputSource.gripSpace, referenceSpace );\n\n\t\t\t\t\tif ( gripPose !== null ) {\n\n\t\t\t\t\t\tgrip.matrix.fromArray( gripPose.transform.matrix );\n\t\t\t\t\t\tgrip.matrix.decompose( grip.position, grip.rotation, grip.scale );\n\t\t\t\t\t\tgrip.matrixWorldNeedsUpdate = true;\n\n\t\t\t\t\t\tif ( gripPose.linearVelocity ) {\n\n\t\t\t\t\t\t\tgrip.hasLinearVelocity = true;\n\t\t\t\t\t\t\tgrip.linearVelocity.copy( gripPose.linearVelocity );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tgrip.hasLinearVelocity = false;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( gripPose.angularVelocity ) {\n\n\t\t\t\t\t\t\tgrip.hasAngularVelocity = true;\n\t\t\t\t\t\t\tgrip.angularVelocity.copy( gripPose.angularVelocity );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tgrip.hasAngularVelocity = false;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( targetRay !== null ) {\n\n\t\t\t\tinputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );\n\n\t\t\t\t// Some runtimes (namely Vive Cosmos with Vive OpenXR Runtime) have only grip space and ray space is equal to it\n\t\t\t\tif ( inputPose === null && gripPose !== null ) {\n\n\t\t\t\t\tinputPose = gripPose;\n\n\t\t\t\t}\n\n\t\t\t\tif ( inputPose !== null ) {\n\n\t\t\t\t\ttargetRay.matrix.fromArray( inputPose.transform.matrix );\n\t\t\t\t\ttargetRay.matrix.decompose( targetRay.position, targetRay.rotation, targetRay.scale );\n\t\t\t\t\ttargetRay.matrixWorldNeedsUpdate = true;\n\n\t\t\t\t\tif ( inputPose.linearVelocity ) {\n\n\t\t\t\t\t\ttargetRay.hasLinearVelocity = true;\n\t\t\t\t\t\ttargetRay.linearVelocity.copy( inputPose.linearVelocity );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttargetRay.hasLinearVelocity = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( inputPose.angularVelocity ) {\n\n\t\t\t\t\t\ttargetRay.hasAngularVelocity = true;\n\t\t\t\t\t\ttargetRay.angularVelocity.copy( inputPose.angularVelocity );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttargetRay.hasAngularVelocity = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.dispatchEvent( _moveEvent );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t}\n\n\t\tif ( targetRay !== null ) {\n\n\t\t\ttargetRay.visible = ( inputPose !== null );\n\n\t\t}\n\n\t\tif ( grip !== null ) {\n\n\t\t\tgrip.visible = ( gripPose !== null );\n\n\t\t}\n\n\t\tif ( hand !== null ) {\n\n\t\t\thand.visible = ( handPose !== null );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// private method\n\n\t_getHandJoint( hand, inputjoint ) {\n\n\t\tif ( hand.joints[ inputjoint.jointName ] === undefined ) {\n\n\t\t\tconst joint = new Group();\n\t\t\tjoint.matrixAutoUpdate = false;\n\t\t\tjoint.visible = false;\n\t\t\thand.joints[ inputjoint.jointName ] = joint;\n\n\t\t\thand.add( joint );\n\n\t\t}\n\n\t\treturn hand.joints[ inputjoint.jointName ];\n\n\t}\n\n}\n\nclass DepthTexture extends Texture {\n\n\tconstructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {\n\n\t\tformat = format !== undefined ? format : DepthFormat;\n\n\t\tif ( format !== DepthFormat && format !== DepthStencilFormat ) {\n\n\t\t\tthrow new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );\n\n\t\t}\n\n\t\tif ( type === undefined && format === DepthFormat ) type = UnsignedIntType;\n\t\tif ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type;\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.isDepthTexture = true;\n\n\t\tthis.image = { width: width, height: height };\n\n\t\tthis.magFilter = magFilter !== undefined ? magFilter : NearestFilter;\n\t\tthis.minFilter = minFilter !== undefined ? minFilter : NearestFilter;\n\n\t\tthis.flipY = false;\n\t\tthis.generateMipmaps = false;\n\n\t\tthis.compareFunction = null;\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.compareFunction = source.compareFunction;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.compareFunction !== null ) data.compareFunction = this.compareFunction;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass WebXRManager extends EventDispatcher {\n\n\tconstructor( renderer, gl ) {\n\n\t\tsuper();\n\n\t\tconst scope = this;\n\n\t\tlet session = null;\n\n\t\tlet framebufferScaleFactor = 1.0;\n\n\t\tlet referenceSpace = null;\n\t\tlet referenceSpaceType = 'local-floor';\n\t\t// Set default foveation to maximum.\n\t\tlet foveation = 1.0;\n\t\tlet customReferenceSpace = null;\n\n\t\tlet pose = null;\n\t\tlet glBinding = null;\n\t\tlet glProjLayer = null;\n\t\tlet glBaseLayer = null;\n\t\tlet xrFrame = null;\n\t\tconst attributes = gl.getContextAttributes();\n\t\tlet initialRenderTarget = null;\n\t\tlet newRenderTarget = null;\n\n\t\tconst controllers = [];\n\t\tconst controllerInputSources = [];\n\n\t\t//\n\n\t\tconst cameraL = new PerspectiveCamera();\n\t\tcameraL.layers.enable( 1 );\n\t\tcameraL.viewport = new Vector4();\n\n\t\tconst cameraR = new PerspectiveCamera();\n\t\tcameraR.layers.enable( 2 );\n\t\tcameraR.viewport = new Vector4();\n\n\t\tconst cameras = [ cameraL, cameraR ];\n\n\t\tconst cameraXR = new ArrayCamera();\n\t\tcameraXR.layers.enable( 1 );\n\t\tcameraXR.layers.enable( 2 );\n\n\t\tlet _currentDepthNear = null;\n\t\tlet _currentDepthFar = null;\n\n\t\t//\n\n\t\tthis.cameraAutoUpdate = true;\n\t\tthis.enabled = false;\n\n\t\tthis.isPresenting = false;\n\n\t\tthis.getController = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getTargetRaySpace();\n\n\t\t};\n\n\t\tthis.getControllerGrip = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getGripSpace();\n\n\t\t};\n\n\t\tthis.getHand = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getHandSpace();\n\n\t\t};\n\n\t\t//\n\n\t\tfunction onSessionEvent( event ) {\n\n\t\t\tconst controllerIndex = controllerInputSources.indexOf( event.inputSource );\n\n\t\t\tif ( controllerIndex === - 1 ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst controller = controllers[ controllerIndex ];\n\n\t\t\tif ( controller !== undefined ) {\n\n\t\t\t\tcontroller.update( event.inputSource, event.frame, customReferenceSpace || referenceSpace );\n\t\t\t\tcontroller.dispatchEvent( { type: event.type, data: event.inputSource } );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onSessionEnd() {\n\n\t\t\tsession.removeEventListener( 'select', onSessionEvent );\n\t\t\tsession.removeEventListener( 'selectstart', onSessionEvent );\n\t\t\tsession.removeEventListener( 'selectend', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeeze', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeezestart', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeezeend', onSessionEvent );\n\t\t\tsession.removeEventListener( 'end', onSessionEnd );\n\t\t\tsession.removeEventListener( 'inputsourceschange', onInputSourcesChange );\n\n\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\tconst inputSource = controllerInputSources[ i ];\n\n\t\t\t\tif ( inputSource === null ) continue;\n\n\t\t\t\tcontrollerInputSources[ i ] = null;\n\n\t\t\t\tcontrollers[ i ].disconnect( inputSource );\n\n\t\t\t}\n\n\t\t\t_currentDepthNear = null;\n\t\t\t_currentDepthFar = null;\n\n\t\t\t// restore framebuffer/rendering state\n\n\t\t\trenderer.setRenderTarget( initialRenderTarget );\n\n\t\t\tglBaseLayer = null;\n\t\t\tglProjLayer = null;\n\t\t\tglBinding = null;\n\t\t\tsession = null;\n\t\t\tnewRenderTarget = null;\n\n\t\t\t//\n\n\t\t\tanimation.stop();\n\n\t\t\tscope.isPresenting = false;\n\n\t\t\tscope.dispatchEvent( { type: 'sessionend' } );\n\n\t\t}\n\n\t\tthis.setFramebufferScaleFactor = function ( value ) {\n\n\t\t\tframebufferScaleFactor = value;\n\n\t\t\tif ( scope.isPresenting === true ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebXRManager: Cannot change framebuffer scale while presenting.' );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.setReferenceSpaceType = function ( value ) {\n\n\t\t\treferenceSpaceType = value;\n\n\t\t\tif ( scope.isPresenting === true ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebXRManager: Cannot change reference space type while presenting.' );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.getReferenceSpace = function () {\n\n\t\t\treturn customReferenceSpace || referenceSpace;\n\n\t\t};\n\n\t\tthis.setReferenceSpace = function ( space ) {\n\n\t\t\tcustomReferenceSpace = space;\n\n\t\t};\n\n\t\tthis.getBaseLayer = function () {\n\n\t\t\treturn glProjLayer !== null ? glProjLayer : glBaseLayer;\n\n\t\t};\n\n\t\tthis.getBinding = function () {\n\n\t\t\treturn glBinding;\n\n\t\t};\n\n\t\tthis.getFrame = function () {\n\n\t\t\treturn xrFrame;\n\n\t\t};\n\n\t\tthis.getSession = function () {\n\n\t\t\treturn session;\n\n\t\t};\n\n\t\tthis.setSession = async function ( value ) {\n\n\t\t\tsession = value;\n\n\t\t\tif ( session !== null ) {\n\n\t\t\t\tinitialRenderTarget = renderer.getRenderTarget();\n\n\t\t\t\tsession.addEventListener( 'select', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'selectstart', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'selectend', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeeze', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeezestart', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeezeend', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'end', onSessionEnd );\n\t\t\t\tsession.addEventListener( 'inputsourceschange', onInputSourcesChange );\n\n\t\t\t\tif ( attributes.xrCompatible !== true ) {\n\n\t\t\t\t\tawait gl.makeXRCompatible();\n\n\t\t\t\t}\n\n\t\t\t\tif ( ( session.renderState.layers === undefined ) || ( renderer.capabilities.isWebGL2 === false ) ) {\n\n\t\t\t\t\tconst layerInit = {\n\t\t\t\t\t\tantialias: ( session.renderState.layers === undefined ) ? attributes.antialias : true,\n\t\t\t\t\t\talpha: true,\n\t\t\t\t\t\tdepth: attributes.depth,\n\t\t\t\t\t\tstencil: attributes.stencil,\n\t\t\t\t\t\tframebufferScaleFactor: framebufferScaleFactor\n\t\t\t\t\t};\n\n\t\t\t\t\tglBaseLayer = new XRWebGLLayer( session, gl, layerInit );\n\n\t\t\t\t\tsession.updateRenderState( { baseLayer: glBaseLayer } );\n\n\t\t\t\t\tnewRenderTarget = new WebGLRenderTarget(\n\t\t\t\t\t\tglBaseLayer.framebufferWidth,\n\t\t\t\t\t\tglBaseLayer.framebufferHeight,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformat: RGBAFormat,\n\t\t\t\t\t\t\ttype: UnsignedByteType,\n\t\t\t\t\t\t\tcolorSpace: renderer.outputColorSpace,\n\t\t\t\t\t\t\tstencilBuffer: attributes.stencil\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t} else {\n\n\t\t\t\t\tlet depthFormat = null;\n\t\t\t\t\tlet depthType = null;\n\t\t\t\t\tlet glDepthFormat = null;\n\n\t\t\t\t\tif ( attributes.depth ) {\n\n\t\t\t\t\t\tglDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;\n\t\t\t\t\t\tdepthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat;\n\t\t\t\t\t\tdepthType = attributes.stencil ? UnsignedInt248Type : UnsignedIntType;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst projectionlayerInit = {\n\t\t\t\t\t\tcolorFormat: gl.RGBA8,\n\t\t\t\t\t\tdepthFormat: glDepthFormat,\n\t\t\t\t\t\tscaleFactor: framebufferScaleFactor\n\t\t\t\t\t};\n\n\t\t\t\t\tglBinding = new XRWebGLBinding( session, gl );\n\n\t\t\t\t\tglProjLayer = glBinding.createProjectionLayer( projectionlayerInit );\n\n\t\t\t\t\tsession.updateRenderState( { layers: [ glProjLayer ] } );\n\n\t\t\t\t\tnewRenderTarget = new WebGLRenderTarget(\n\t\t\t\t\t\tglProjLayer.textureWidth,\n\t\t\t\t\t\tglProjLayer.textureHeight,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformat: RGBAFormat,\n\t\t\t\t\t\t\ttype: UnsignedByteType,\n\t\t\t\t\t\t\tdepthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),\n\t\t\t\t\t\t\tstencilBuffer: attributes.stencil,\n\t\t\t\t\t\t\tcolorSpace: renderer.outputColorSpace,\n\t\t\t\t\t\t\tsamples: attributes.antialias ? 4 : 0\n\t\t\t\t\t\t} );\n\n\t\t\t\t\tconst renderTargetProperties = renderer.properties.get( newRenderTarget );\n\t\t\t\t\trenderTargetProperties.__ignoreDepthValues = glProjLayer.ignoreDepthValues;\n\n\t\t\t\t}\n\n\t\t\t\tnewRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278\n\n\t\t\t\tthis.setFoveation( foveation );\n\n\t\t\t\tcustomReferenceSpace = null;\n\t\t\t\treferenceSpace = await session.requestReferenceSpace( referenceSpaceType );\n\n\t\t\t\tanimation.setContext( session );\n\t\t\t\tanimation.start();\n\n\t\t\t\tscope.isPresenting = true;\n\n\t\t\t\tscope.dispatchEvent( { type: 'sessionstart' } );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.getEnvironmentBlendMode = function () {\n\n\t\t\tif ( session !== null ) {\n\n\t\t\t\treturn session.environmentBlendMode;\n\n\t\t\t}\n\n\t\t};\n\n\t\tfunction onInputSourcesChange( event ) {\n\n\t\t\t// Notify disconnected\n\n\t\t\tfor ( let i = 0; i < event.removed.length; i ++ ) {\n\n\t\t\t\tconst inputSource = event.removed[ i ];\n\t\t\t\tconst index = controllerInputSources.indexOf( inputSource );\n\n\t\t\t\tif ( index >= 0 ) {\n\n\t\t\t\t\tcontrollerInputSources[ index ] = null;\n\t\t\t\t\tcontrollers[ index ].disconnect( inputSource );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Notify connected\n\n\t\t\tfor ( let i = 0; i < event.added.length; i ++ ) {\n\n\t\t\t\tconst inputSource = event.added[ i ];\n\n\t\t\t\tlet controllerIndex = controllerInputSources.indexOf( inputSource );\n\n\t\t\t\tif ( controllerIndex === - 1 ) {\n\n\t\t\t\t\t// Assign input source a controller that currently has no input source\n\n\t\t\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\t\t\tif ( i >= controllerInputSources.length ) {\n\n\t\t\t\t\t\t\tcontrollerInputSources.push( inputSource );\n\t\t\t\t\t\t\tcontrollerIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t} else if ( controllerInputSources[ i ] === null ) {\n\n\t\t\t\t\t\t\tcontrollerInputSources[ i ] = inputSource;\n\t\t\t\t\t\t\tcontrollerIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// If all controllers do currently receive input we ignore new ones\n\n\t\t\t\t\tif ( controllerIndex === - 1 ) break;\n\n\t\t\t\t}\n\n\t\t\t\tconst controller = controllers[ controllerIndex ];\n\n\t\t\t\tif ( controller ) {\n\n\t\t\t\t\tcontroller.connect( inputSource );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tconst cameraLPos = new Vector3();\n\t\tconst cameraRPos = new Vector3();\n\n\t\t/**\n\t\t * Assumes 2 cameras that are parallel and share an X-axis, and that\n\t\t * the cameras' projection and world matrices have already been set.\n\t\t * And that near and far planes are identical for both cameras.\n\t\t * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765\n\t\t */\n\t\tfunction setProjectionFromUnion( camera, cameraL, cameraR ) {\n\n\t\t\tcameraLPos.setFromMatrixPosition( cameraL.matrixWorld );\n\t\t\tcameraRPos.setFromMatrixPosition( cameraR.matrixWorld );\n\n\t\t\tconst ipd = cameraLPos.distanceTo( cameraRPos );\n\n\t\t\tconst projL = cameraL.projectionMatrix.elements;\n\t\t\tconst projR = cameraR.projectionMatrix.elements;\n\n\t\t\t// VR systems will have identical far and near planes, and\n\t\t\t// most likely identical top and bottom frustum extents.\n\t\t\t// Use the left camera for these values.\n\t\t\tconst near = projL[ 14 ] / ( projL[ 10 ] - 1 );\n\t\t\tconst far = projL[ 14 ] / ( projL[ 10 ] + 1 );\n\t\t\tconst topFov = ( projL[ 9 ] + 1 ) / projL[ 5 ];\n\t\t\tconst bottomFov = ( projL[ 9 ] - 1 ) / projL[ 5 ];\n\n\t\t\tconst leftFov = ( projL[ 8 ] - 1 ) / projL[ 0 ];\n\t\t\tconst rightFov = ( projR[ 8 ] + 1 ) / projR[ 0 ];\n\t\t\tconst left = near * leftFov;\n\t\t\tconst right = near * rightFov;\n\n\t\t\t// Calculate the new camera's position offset from the\n\t\t\t// left camera. xOffset should be roughly half `ipd`.\n\t\t\tconst zOffset = ipd / ( - leftFov + rightFov );\n\t\t\tconst xOffset = zOffset * - leftFov;\n\n\t\t\t// TODO: Better way to apply this offset?\n\t\t\tcameraL.matrixWorld.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.translateX( xOffset );\n\t\t\tcamera.translateZ( zOffset );\n\t\t\tcamera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.matrixWorldInverse.copy( camera.matrixWorld ).invert();\n\n\t\t\t// Find the union of the frustum values of the cameras and scale\n\t\t\t// the values so that the near plane's position does not change in world space,\n\t\t\t// although must now be relative to the new union camera.\n\t\t\tconst near2 = near + zOffset;\n\t\t\tconst far2 = far + zOffset;\n\t\t\tconst left2 = left - xOffset;\n\t\t\tconst right2 = right + ( ipd - xOffset );\n\t\t\tconst top2 = topFov * far / far2 * near2;\n\t\t\tconst bottom2 = bottomFov * far / far2 * near2;\n\n\t\t\tcamera.projectionMatrix.makePerspective( left2, right2, top2, bottom2, near2, far2 );\n\t\t\tcamera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();\n\n\t\t}\n\n\t\tfunction updateCamera( camera, parent ) {\n\n\t\t\tif ( parent === null ) {\n\n\t\t\t\tcamera.matrixWorld.copy( camera.matrix );\n\n\t\t\t} else {\n\n\t\t\t\tcamera.matrixWorld.multiplyMatrices( parent.matrixWorld, camera.matrix );\n\n\t\t\t}\n\n\t\t\tcamera.matrixWorldInverse.copy( camera.matrixWorld ).invert();\n\n\t\t}\n\n\t\tthis.updateCamera = function ( camera ) {\n\n\t\t\tif ( session === null ) return;\n\n\t\t\tcameraXR.near = cameraR.near = cameraL.near = camera.near;\n\t\t\tcameraXR.far = cameraR.far = cameraL.far = camera.far;\n\n\t\t\tif ( _currentDepthNear !== cameraXR.near || _currentDepthFar !== cameraXR.far ) {\n\n\t\t\t\t// Note that the new renderState won't apply until the next frame. See #18320\n\n\t\t\t\tsession.updateRenderState( {\n\t\t\t\t\tdepthNear: cameraXR.near,\n\t\t\t\t\tdepthFar: cameraXR.far\n\t\t\t\t} );\n\n\t\t\t\t_currentDepthNear = cameraXR.near;\n\t\t\t\t_currentDepthFar = cameraXR.far;\n\n\t\t\t}\n\n\t\t\tconst parent = camera.parent;\n\t\t\tconst cameras = cameraXR.cameras;\n\n\t\t\tupdateCamera( cameraXR, parent );\n\n\t\t\tfor ( let i = 0; i < cameras.length; i ++ ) {\n\n\t\t\t\tupdateCamera( cameras[ i ], parent );\n\n\t\t\t}\n\n\t\t\t// update projection matrix for proper view frustum culling\n\n\t\t\tif ( cameras.length === 2 ) {\n\n\t\t\t\tsetProjectionFromUnion( cameraXR, cameraL, cameraR );\n\n\t\t\t} else {\n\n\t\t\t\t// assume single camera setup (AR)\n\n\t\t\t\tcameraXR.projectionMatrix.copy( cameraL.projectionMatrix );\n\n\t\t\t}\n\n\t\t\t// update user camera and its children\n\n\t\t\tupdateUserCamera( camera, cameraXR, parent );\n\n\t\t};\n\n\t\tfunction updateUserCamera( camera, cameraXR, parent ) {\n\n\t\t\tif ( parent === null ) {\n\n\t\t\t\tcamera.matrix.copy( cameraXR.matrixWorld );\n\n\t\t\t} else {\n\n\t\t\t\tcamera.matrix.copy( parent.matrixWorld );\n\t\t\t\tcamera.matrix.invert();\n\t\t\t\tcamera.matrix.multiply( cameraXR.matrixWorld );\n\n\t\t\t}\n\n\t\t\tcamera.matrix.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.updateMatrixWorld( true );\n\n\t\t\tcamera.projectionMatrix.copy( cameraXR.projectionMatrix );\n\t\t\tcamera.projectionMatrixInverse.copy( cameraXR.projectionMatrixInverse );\n\n\t\t\tif ( camera.isPerspectiveCamera ) {\n\n\t\t\t\tcamera.fov = RAD2DEG * 2 * Math.atan( 1 / camera.projectionMatrix.elements[ 5 ] );\n\t\t\t\tcamera.zoom = 1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.getCamera = function () {\n\n\t\t\treturn cameraXR;\n\n\t\t};\n\n\t\tthis.getFoveation = function () {\n\n\t\t\tif ( glProjLayer === null && glBaseLayer === null ) {\n\n\t\t\t\treturn undefined;\n\n\t\t\t}\n\n\t\t\treturn foveation;\n\n\t\t};\n\n\t\tthis.setFoveation = function ( value ) {\n\n\t\t\t// 0 = no foveation = full resolution\n\t\t\t// 1 = maximum foveation = the edges render at lower resolution\n\n\t\t\tfoveation = value;\n\n\t\t\tif ( glProjLayer !== null ) {\n\n\t\t\t\tglProjLayer.fixedFoveation = value;\n\n\t\t\t}\n\n\t\t\tif ( glBaseLayer !== null && glBaseLayer.fixedFoveation !== undefined ) {\n\n\t\t\t\tglBaseLayer.fixedFoveation = value;\n\n\t\t\t}\n\n\t\t};\n\n\t\t// Animation Loop\n\n\t\tlet onAnimationFrameCallback = null;\n\n\t\tfunction onAnimationFrame( time, frame ) {\n\n\t\t\tpose = frame.getViewerPose( customReferenceSpace || referenceSpace );\n\t\t\txrFrame = frame;\n\n\t\t\tif ( pose !== null ) {\n\n\t\t\t\tconst views = pose.views;\n\n\t\t\t\tif ( glBaseLayer !== null ) {\n\n\t\t\t\t\trenderer.setRenderTargetFramebuffer( newRenderTarget, glBaseLayer.framebuffer );\n\t\t\t\t\trenderer.setRenderTarget( newRenderTarget );\n\n\t\t\t\t}\n\n\t\t\t\tlet cameraXRNeedsUpdate = false;\n\n\t\t\t\t// check if it's necessary to rebuild cameraXR's camera list\n\n\t\t\t\tif ( views.length !== cameraXR.cameras.length ) {\n\n\t\t\t\t\tcameraXR.cameras.length = 0;\n\t\t\t\t\tcameraXRNeedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < views.length; i ++ ) {\n\n\t\t\t\t\tconst view = views[ i ];\n\n\t\t\t\t\tlet viewport = null;\n\n\t\t\t\t\tif ( glBaseLayer !== null ) {\n\n\t\t\t\t\t\tviewport = glBaseLayer.getViewport( view );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst glSubImage = glBinding.getViewSubImage( glProjLayer, view );\n\t\t\t\t\t\tviewport = glSubImage.viewport;\n\n\t\t\t\t\t\t// For side-by-side projection, we only produce a single texture for both eyes.\n\t\t\t\t\t\tif ( i === 0 ) {\n\n\t\t\t\t\t\t\trenderer.setRenderTargetTextures(\n\t\t\t\t\t\t\t\tnewRenderTarget,\n\t\t\t\t\t\t\t\tglSubImage.colorTexture,\n\t\t\t\t\t\t\t\tglProjLayer.ignoreDepthValues ? undefined : glSubImage.depthStencilTexture );\n\n\t\t\t\t\t\t\trenderer.setRenderTarget( newRenderTarget );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tlet camera = cameras[ i ];\n\n\t\t\t\t\tif ( camera === undefined ) {\n\n\t\t\t\t\t\tcamera = new PerspectiveCamera();\n\t\t\t\t\t\tcamera.layers.enable( i );\n\t\t\t\t\t\tcamera.viewport = new Vector4();\n\t\t\t\t\t\tcameras[ i ] = camera;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcamera.matrix.fromArray( view.transform.matrix );\n\t\t\t\t\tcamera.matrix.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\t\t\tcamera.projectionMatrix.fromArray( view.projectionMatrix );\n\t\t\t\t\tcamera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();\n\t\t\t\t\tcamera.viewport.set( viewport.x, viewport.y, viewport.width, viewport.height );\n\n\t\t\t\t\tif ( i === 0 ) {\n\n\t\t\t\t\t\tcameraXR.matrix.copy( camera.matrix );\n\t\t\t\t\t\tcameraXR.matrix.decompose( cameraXR.position, cameraXR.quaternion, cameraXR.scale );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( cameraXRNeedsUpdate === true ) {\n\n\t\t\t\t\t\tcameraXR.cameras.push( camera );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\tconst inputSource = controllerInputSources[ i ];\n\t\t\t\tconst controller = controllers[ i ];\n\n\t\t\t\tif ( inputSource !== null && controller !== undefined ) {\n\n\t\t\t\t\tcontroller.update( inputSource, frame, customReferenceSpace || referenceSpace );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time, frame );\n\n\t\t\tif ( frame.detectedPlanes ) {\n\n\t\t\t\tscope.dispatchEvent( { type: 'planesdetected', data: frame } );\n\n\t\t\t}\n\n\t\t\txrFrame = null;\n\n\t\t}\n\n\t\tconst animation = new WebGLAnimation();\n\n\t\tanimation.setAnimationLoop( onAnimationFrame );\n\n\t\tthis.setAnimationLoop = function ( callback ) {\n\n\t\t\tonAnimationFrameCallback = callback;\n\n\t\t};\n\n\t\tthis.dispose = function () {};\n\n\t}\n\n}\n\nfunction WebGLMaterials( renderer, properties ) {\n\n\tfunction refreshTransformUniform( map, uniform ) {\n\n\t\tif ( map.matrixAutoUpdate === true ) {\n\n\t\t\tmap.updateMatrix();\n\n\t\t}\n\n\t\tuniform.value.copy( map.matrix );\n\n\t}\n\n\tfunction refreshFogUniforms( uniforms, fog ) {\n\n\t\tfog.color.getRGB( uniforms.fogColor.value, getUnlitUniformColorSpace( renderer ) );\n\n\t\tif ( fog.isFog ) {\n\n\t\t\tuniforms.fogNear.value = fog.near;\n\t\t\tuniforms.fogFar.value = fog.far;\n\n\t\t} else if ( fog.isFogExp2 ) {\n\n\t\t\tuniforms.fogDensity.value = fog.density;\n\n\t\t}\n\n\t}\n\n\tfunction refreshMaterialUniforms( uniforms, material, pixelRatio, height, transmissionRenderTarget ) {\n\n\t\tif ( material.isMeshBasicMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshLambertMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshToonMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsToon( uniforms, material );\n\n\t\t} else if ( material.isMeshPhongMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsPhong( uniforms, material );\n\n\t\t} else if ( material.isMeshStandardMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsStandard( uniforms, material );\n\n\t\t\tif ( material.isMeshPhysicalMaterial ) {\n\n\t\t\t\trefreshUniformsPhysical( uniforms, material, transmissionRenderTarget );\n\n\t\t\t}\n\n\t\t} else if ( material.isMeshMatcapMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsMatcap( uniforms, material );\n\n\t\t} else if ( material.isMeshDepthMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshDistanceMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsDistance( uniforms, material );\n\n\t\t} else if ( material.isMeshNormalMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isLineBasicMaterial ) {\n\n\t\t\trefreshUniformsLine( uniforms, material );\n\n\t\t\tif ( material.isLineDashedMaterial ) {\n\n\t\t\t\trefreshUniformsDash( uniforms, material );\n\n\t\t\t}\n\n\t\t} else if ( material.isPointsMaterial ) {\n\n\t\t\trefreshUniformsPoints( uniforms, material, pixelRatio, height );\n\n\t\t} else if ( material.isSpriteMaterial ) {\n\n\t\t\trefreshUniformsSprites( uniforms, material );\n\n\t\t} else if ( material.isShadowMaterial ) {\n\n\t\t\tuniforms.color.value.copy( material.color );\n\t\t\tuniforms.opacity.value = material.opacity;\n\n\t\t} else if ( material.isShaderMaterial ) {\n\n\t\t\tmaterial.uniformsNeedUpdate = false; // #15581\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsCommon( uniforms, material ) {\n\n\t\tuniforms.opacity.value = material.opacity;\n\n\t\tif ( material.color ) {\n\n\t\t\tuniforms.diffuse.value.copy( material.color );\n\n\t\t}\n\n\t\tif ( material.emissive ) {\n\n\t\t\tuniforms.emissive.value.copy( material.emissive ).multiplyScalar( material.emissiveIntensity );\n\n\t\t}\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.bumpMap ) {\n\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\n\n\t\t\trefreshTransformUniform( material.bumpMap, uniforms.bumpMapTransform );\n\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\n\n\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\tuniforms.bumpScale.value *= - 1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.normalMap ) {\n\n\t\t\tuniforms.normalMap.value = material.normalMap;\n\n\t\t\trefreshTransformUniform( material.normalMap, uniforms.normalMapTransform );\n\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\n\n\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\tuniforms.normalScale.value.negate();\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\n\t\t\trefreshTransformUniform( material.displacementMap, uniforms.displacementMapTransform );\n\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t\tif ( material.emissiveMap ) {\n\n\t\t\tuniforms.emissiveMap.value = material.emissiveMap;\n\n\t\t\trefreshTransformUniform( material.emissiveMap, uniforms.emissiveMapTransform );\n\n\t\t}\n\n\t\tif ( material.specularMap ) {\n\n\t\t\tuniforms.specularMap.value = material.specularMap;\n\n\t\t\trefreshTransformUniform( material.specularMap, uniforms.specularMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t\tconst envMap = properties.get( material ).envMap;\n\n\t\tif ( envMap ) {\n\n\t\t\tuniforms.envMap.value = envMap;\n\n\t\t\tuniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t\tuniforms.reflectivity.value = material.reflectivity;\n\t\t\tuniforms.ior.value = material.ior;\n\t\t\tuniforms.refractionRatio.value = material.refractionRatio;\n\n\t\t}\n\n\t\tif ( material.lightMap ) {\n\n\t\t\tuniforms.lightMap.value = material.lightMap;\n\n\t\t\t// artist-friendly light intensity scaling factor\n\t\t\tconst scaleFactor = ( renderer._useLegacyLights === true ) ? Math.PI : 1;\n\n\t\t\tuniforms.lightMapIntensity.value = material.lightMapIntensity * scaleFactor;\n\n\t\t\trefreshTransformUniform( material.lightMap, uniforms.lightMapTransform );\n\n\t\t}\n\n\t\tif ( material.aoMap ) {\n\n\t\t\tuniforms.aoMap.value = material.aoMap;\n\t\t\tuniforms.aoMapIntensity.value = material.aoMapIntensity;\n\n\t\t\trefreshTransformUniform( material.aoMap, uniforms.aoMapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsLine( uniforms, material ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsDash( uniforms, material ) {\n\n\t\tuniforms.dashSize.value = material.dashSize;\n\t\tuniforms.totalSize.value = material.dashSize + material.gapSize;\n\t\tuniforms.scale.value = material.scale;\n\n\t}\n\n\tfunction refreshUniformsPoints( uniforms, material, pixelRatio, height ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\t\tuniforms.size.value = material.size * pixelRatio;\n\t\tuniforms.scale.value = height * 0.5;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.uvTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsSprites( uniforms, material ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\t\tuniforms.rotation.value = material.rotation;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsPhong( uniforms, material ) {\n\n\t\tuniforms.specular.value.copy( material.specular );\n\t\tuniforms.shininess.value = Math.max( material.shininess, 1e-4 ); // to prevent pow( 0.0, 0.0 )\n\n\t}\n\n\tfunction refreshUniformsToon( uniforms, material ) {\n\n\t\tif ( material.gradientMap ) {\n\n\t\t\tuniforms.gradientMap.value = material.gradientMap;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsStandard( uniforms, material ) {\n\n\t\tuniforms.metalness.value = material.metalness;\n\n\t\tif ( material.metalnessMap ) {\n\n\t\t\tuniforms.metalnessMap.value = material.metalnessMap;\n\n\t\t\trefreshTransformUniform( material.metalnessMap, uniforms.metalnessMapTransform );\n\n\t\t}\n\n\t\tuniforms.roughness.value = material.roughness;\n\n\t\tif ( material.roughnessMap ) {\n\n\t\t\tuniforms.roughnessMap.value = material.roughnessMap;\n\n\t\t\trefreshTransformUniform( material.roughnessMap, uniforms.roughnessMapTransform );\n\n\t\t}\n\n\t\tconst envMap = properties.get( material ).envMap;\n\n\t\tif ( envMap ) {\n\n\t\t\t//uniforms.envMap.value = material.envMap; // part of uniforms common\n\t\t\tuniforms.envMapIntensity.value = material.envMapIntensity;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsPhysical( uniforms, material, transmissionRenderTarget ) {\n\n\t\tuniforms.ior.value = material.ior; // also part of uniforms common\n\n\t\tif ( material.sheen > 0 ) {\n\n\t\t\tuniforms.sheenColor.value.copy( material.sheenColor ).multiplyScalar( material.sheen );\n\n\t\t\tuniforms.sheenRoughness.value = material.sheenRoughness;\n\n\t\t\tif ( material.sheenColorMap ) {\n\n\t\t\t\tuniforms.sheenColorMap.value = material.sheenColorMap;\n\n\t\t\t\trefreshTransformUniform( material.sheenColorMap, uniforms.sheenColorMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.sheenRoughnessMap ) {\n\n\t\t\t\tuniforms.sheenRoughnessMap.value = material.sheenRoughnessMap;\n\n\t\t\t\trefreshTransformUniform( material.sheenRoughnessMap, uniforms.sheenRoughnessMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.clearcoat > 0 ) {\n\n\t\t\tuniforms.clearcoat.value = material.clearcoat;\n\t\t\tuniforms.clearcoatRoughness.value = material.clearcoatRoughness;\n\n\t\t\tif ( material.clearcoatMap ) {\n\n\t\t\t\tuniforms.clearcoatMap.value = material.clearcoatMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatMap, uniforms.clearcoatMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.clearcoatRoughnessMap ) {\n\n\t\t\t\tuniforms.clearcoatRoughnessMap.value = material.clearcoatRoughnessMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatRoughnessMap, uniforms.clearcoatRoughnessMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.clearcoatNormalMap ) {\n\n\t\t\t\tuniforms.clearcoatNormalMap.value = material.clearcoatNormalMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatNormalMap, uniforms.clearcoatNormalMapTransform );\n\n\t\t\t\tuniforms.clearcoatNormalScale.value.copy( material.clearcoatNormalScale );\n\n\t\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\t\tuniforms.clearcoatNormalScale.value.negate();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.iridescence > 0 ) {\n\n\t\t\tuniforms.iridescence.value = material.iridescence;\n\t\t\tuniforms.iridescenceIOR.value = material.iridescenceIOR;\n\t\t\tuniforms.iridescenceThicknessMinimum.value = material.iridescenceThicknessRange[ 0 ];\n\t\t\tuniforms.iridescenceThicknessMaximum.value = material.iridescenceThicknessRange[ 1 ];\n\n\t\t\tif ( material.iridescenceMap ) {\n\n\t\t\t\tuniforms.iridescenceMap.value = material.iridescenceMap;\n\n\t\t\t\trefreshTransformUniform( material.iridescenceMap, uniforms.iridescenceMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.iridescenceThicknessMap ) {\n\n\t\t\t\tuniforms.iridescenceThicknessMap.value = material.iridescenceThicknessMap;\n\n\t\t\t\trefreshTransformUniform( material.iridescenceThicknessMap, uniforms.iridescenceThicknessMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.transmission > 0 ) {\n\n\t\t\tuniforms.transmission.value = material.transmission;\n\t\t\tuniforms.transmissionSamplerMap.value = transmissionRenderTarget.texture;\n\t\t\tuniforms.transmissionSamplerSize.value.set( transmissionRenderTarget.width, transmissionRenderTarget.height );\n\n\t\t\tif ( material.transmissionMap ) {\n\n\t\t\t\tuniforms.transmissionMap.value = material.transmissionMap;\n\n\t\t\t\trefreshTransformUniform( material.transmissionMap, uniforms.transmissionMapTransform );\n\n\t\t\t}\n\n\t\t\tuniforms.thickness.value = material.thickness;\n\n\t\t\tif ( material.thicknessMap ) {\n\n\t\t\t\tuniforms.thicknessMap.value = material.thicknessMap;\n\n\t\t\t\trefreshTransformUniform( material.thicknessMap, uniforms.thicknessMapTransform );\n\n\t\t\t}\n\n\t\t\tuniforms.attenuationDistance.value = material.attenuationDistance;\n\t\t\tuniforms.attenuationColor.value.copy( material.attenuationColor );\n\n\t\t}\n\n\t\tif ( material.anisotropy > 0 ) {\n\n\t\t\tuniforms.anisotropyVector.value.set( material.anisotropy * Math.cos( material.anisotropyRotation ), material.anisotropy * Math.sin( material.anisotropyRotation ) );\n\n\t\t\tif ( material.anisotropyMap ) {\n\n\t\t\t\tuniforms.anisotropyMap.value = material.anisotropyMap;\n\n\t\t\t\trefreshTransformUniform( material.anisotropyMap, uniforms.anisotropyMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tuniforms.specularIntensity.value = material.specularIntensity;\n\t\tuniforms.specularColor.value.copy( material.specularColor );\n\n\t\tif ( material.specularColorMap ) {\n\n\t\t\tuniforms.specularColorMap.value = material.specularColorMap;\n\n\t\t\trefreshTransformUniform( material.specularColorMap, uniforms.specularColorMapTransform );\n\n\t\t}\n\n\t\tif ( material.specularIntensityMap ) {\n\n\t\t\tuniforms.specularIntensityMap.value = material.specularIntensityMap;\n\n\t\t\trefreshTransformUniform( material.specularIntensityMap, uniforms.specularIntensityMapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsMatcap( uniforms, material ) {\n\n\t\tif ( material.matcap ) {\n\n\t\t\tuniforms.matcap.value = material.matcap;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsDistance( uniforms, material ) {\n\n\t\tconst light = properties.get( material ).light;\n\n\t\tuniforms.referencePosition.value.setFromMatrixPosition( light.matrixWorld );\n\t\tuniforms.nearDistance.value = light.shadow.camera.near;\n\t\tuniforms.farDistance.value = light.shadow.camera.far;\n\n\t}\n\n\treturn {\n\t\trefreshFogUniforms: refreshFogUniforms,\n\t\trefreshMaterialUniforms: refreshMaterialUniforms\n\t};\n\n}\n\nfunction WebGLUniformsGroups( gl, info, capabilities, state ) {\n\n\tlet buffers = {};\n\tlet updateList = {};\n\tlet allocatedBindingPoints = [];\n\n\tconst maxBindingPoints = ( capabilities.isWebGL2 ) ? gl.getParameter( gl.MAX_UNIFORM_BUFFER_BINDINGS ) : 0; // binding points are global whereas block indices are per shader program\n\n\tfunction bind( uniformsGroup, program ) {\n\n\t\tconst webglProgram = program.program;\n\t\tstate.uniformBlockBinding( uniformsGroup, webglProgram );\n\n\t}\n\n\tfunction update( uniformsGroup, program ) {\n\n\t\tlet buffer = buffers[ uniformsGroup.id ];\n\n\t\tif ( buffer === undefined ) {\n\n\t\t\tprepareUniformsGroup( uniformsGroup );\n\n\t\t\tbuffer = createBuffer( uniformsGroup );\n\t\t\tbuffers[ uniformsGroup.id ] = buffer;\n\n\t\t\tuniformsGroup.addEventListener( 'dispose', onUniformsGroupsDispose );\n\n\t\t}\n\n\t\t// ensure to update the binding points/block indices mapping for this program\n\n\t\tconst webglProgram = program.program;\n\t\tstate.updateUBOMapping( uniformsGroup, webglProgram );\n\n\t\t// update UBO once per frame\n\n\t\tconst frame = info.render.frame;\n\n\t\tif ( updateList[ uniformsGroup.id ] !== frame ) {\n\n\t\t\tupdateBufferData( uniformsGroup );\n\n\t\t\tupdateList[ uniformsGroup.id ] = frame;\n\n\t\t}\n\n\t}\n\n\tfunction createBuffer( uniformsGroup ) {\n\n\t\t// the setup of an UBO is independent of a particular shader program but global\n\n\t\tconst bindingPointIndex = allocateBindingPointIndex();\n\t\tuniformsGroup.__bindingPointIndex = bindingPointIndex;\n\n\t\tconst buffer = gl.createBuffer();\n\t\tconst size = uniformsGroup.__size;\n\t\tconst usage = uniformsGroup.usage;\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, buffer );\n\t\tgl.bufferData( gl.UNIFORM_BUFFER, size, usage );\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, null );\n\t\tgl.bindBufferBase( gl.UNIFORM_BUFFER, bindingPointIndex, buffer );\n\n\t\treturn buffer;\n\n\t}\n\n\tfunction allocateBindingPointIndex() {\n\n\t\tfor ( let i = 0; i < maxBindingPoints; i ++ ) {\n\n\t\t\tif ( allocatedBindingPoints.indexOf( i ) === - 1 ) {\n\n\t\t\t\tallocatedBindingPoints.push( i );\n\t\t\t\treturn i;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconsole.error( 'THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.' );\n\n\t\treturn 0;\n\n\t}\n\n\tfunction updateBufferData( uniformsGroup ) {\n\n\t\tconst buffer = buffers[ uniformsGroup.id ];\n\t\tconst uniforms = uniformsGroup.uniforms;\n\t\tconst cache = uniformsGroup.__cache;\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, buffer );\n\n\t\tfor ( let i = 0, il = uniforms.length; i < il; i ++ ) {\n\n\t\t\tconst uniform = uniforms[ i ];\n\n\t\t\t// partly update the buffer if necessary\n\n\t\t\tif ( hasUniformChanged( uniform, i, cache ) === true ) {\n\n\t\t\t\tconst offset = uniform.__offset;\n\n\t\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\n\n\t\t\t\tlet arrayOffset = 0;\n\n\t\t\t\tfor ( let i = 0; i < values.length; i ++ ) {\n\n\t\t\t\t\tconst value = values[ i ];\n\n\t\t\t\t\tconst info = getUniformSize( value );\n\n\t\t\t\t\tif ( typeof value === 'number' ) {\n\n\t\t\t\t\t\tuniform.__data[ 0 ] = value;\n\t\t\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data );\n\n\t\t\t\t\t} else if ( value.isMatrix3 ) {\n\n\t\t\t\t\t\t// manually converting 3x3 to 3x4\n\n\t\t\t\t\t\tuniform.__data[ 0 ] = value.elements[ 0 ];\n\t\t\t\t\t\tuniform.__data[ 1 ] = value.elements[ 1 ];\n\t\t\t\t\t\tuniform.__data[ 2 ] = value.elements[ 2 ];\n\t\t\t\t\t\tuniform.__data[ 3 ] = value.elements[ 0 ];\n\t\t\t\t\t\tuniform.__data[ 4 ] = value.elements[ 3 ];\n\t\t\t\t\t\tuniform.__data[ 5 ] = value.elements[ 4 ];\n\t\t\t\t\t\tuniform.__data[ 6 ] = value.elements[ 5 ];\n\t\t\t\t\t\tuniform.__data[ 7 ] = value.elements[ 0 ];\n\t\t\t\t\t\tuniform.__data[ 8 ] = value.elements[ 6 ];\n\t\t\t\t\t\tuniform.__data[ 9 ] = value.elements[ 7 ];\n\t\t\t\t\t\tuniform.__data[ 10 ] = value.elements[ 8 ];\n\t\t\t\t\t\tuniform.__data[ 11 ] = value.elements[ 0 ];\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tvalue.toArray( uniform.__data, arrayOffset );\n\n\t\t\t\t\t\tarrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );\n\n\t\t\t}\n\n\t\t}\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, null );\n\n\t}\n\n\tfunction hasUniformChanged( uniform, index, cache ) {\n\n\t\tconst value = uniform.value;\n\n\t\tif ( cache[ index ] === undefined ) {\n\n\t\t\t// cache entry does not exist so far\n\n\t\t\tif ( typeof value === 'number' ) {\n\n\t\t\t\tcache[ index ] = value;\n\n\t\t\t} else {\n\n\t\t\t\tconst values = Array.isArray( value ) ? value : [ value ];\n\n\t\t\t\tconst tempValues = [];\n\n\t\t\t\tfor ( let i = 0; i < values.length; i ++ ) {\n\n\t\t\t\t\ttempValues.push( values[ i ].clone() );\n\n\t\t\t\t}\n\n\t\t\t\tcache[ index ] = tempValues;\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t} else {\n\n\t\t\t// compare current value with cached entry\n\n\t\t\tif ( typeof value === 'number' ) {\n\n\t\t\t\tif ( cache[ index ] !== value ) {\n\n\t\t\t\t\tcache[ index ] = value;\n\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst cachedObjects = Array.isArray( cache[ index ] ) ? cache[ index ] : [ cache[ index ] ];\n\t\t\t\tconst values = Array.isArray( value ) ? value : [ value ];\n\n\t\t\t\tfor ( let i = 0; i < cachedObjects.length; i ++ ) {\n\n\t\t\t\t\tconst cachedObject = cachedObjects[ i ];\n\n\t\t\t\t\tif ( cachedObject.equals( values[ i ] ) === false ) {\n\n\t\t\t\t\t\tcachedObject.copy( values[ i ] );\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tfunction prepareUniformsGroup( uniformsGroup ) {\n\n\t\t// determine total buffer size according to the STD140 layout\n\t\t// Hint: STD140 is the only supported layout in WebGL 2\n\n\t\tconst uniforms = uniformsGroup.uniforms;\n\n\t\tlet offset = 0; // global buffer offset in bytes\n\t\tconst chunkSize = 16; // size of a chunk in bytes\n\t\tlet chunkOffset = 0; // offset within a single chunk in bytes\n\n\t\tfor ( let i = 0, l = uniforms.length; i < l; i ++ ) {\n\n\t\t\tconst uniform = uniforms[ i ];\n\n\t\t\tconst infos = {\n\t\t\t\tboundary: 0, // bytes\n\t\t\t\tstorage: 0 // bytes\n\t\t\t};\n\n\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\n\n\t\t\tfor ( let j = 0, jl = values.length; j < jl; j ++ ) {\n\n\t\t\t\tconst value = values[ j ];\n\n\t\t\t\tconst info = getUniformSize( value );\n\n\t\t\t\tinfos.boundary += info.boundary;\n\t\t\t\tinfos.storage += info.storage;\n\n\t\t\t}\n\n\t\t\t// the following two properties will be used for partial buffer updates\n\n\t\t\tuniform.__data = new Float32Array( infos.storage / Float32Array.BYTES_PER_ELEMENT );\n\t\t\tuniform.__offset = offset;\n\n\t\t\t//\n\n\t\t\tif ( i > 0 ) {\n\n\t\t\t\tchunkOffset = offset % chunkSize;\n\n\t\t\t\tconst remainingSizeInChunk = chunkSize - chunkOffset;\n\n\t\t\t\t// check for chunk overflow\n\n\t\t\t\tif ( chunkOffset !== 0 && ( remainingSizeInChunk - infos.boundary ) < 0 ) {\n\n\t\t\t\t\t// add padding and adjust offset\n\n\t\t\t\t\toffset += ( chunkSize - chunkOffset );\n\t\t\t\t\tuniform.__offset = offset;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\toffset += infos.storage;\n\n\t\t}\n\n\t\t// ensure correct final padding\n\n\t\tchunkOffset = offset % chunkSize;\n\n\t\tif ( chunkOffset > 0 ) offset += ( chunkSize - chunkOffset );\n\n\t\t//\n\n\t\tuniformsGroup.__size = offset;\n\t\tuniformsGroup.__cache = {};\n\n\t\treturn this;\n\n\t}\n\n\tfunction getUniformSize( value ) {\n\n\t\tconst info = {\n\t\t\tboundary: 0, // bytes\n\t\t\tstorage: 0 // bytes\n\t\t};\n\n\t\t// determine sizes according to STD140\n\n\t\tif ( typeof value === 'number' ) {\n\n\t\t\t// float/int\n\n\t\t\tinfo.boundary = 4;\n\t\t\tinfo.storage = 4;\n\n\t\t} else if ( value.isVector2 ) {\n\n\t\t\t// vec2\n\n\t\t\tinfo.boundary = 8;\n\t\t\tinfo.storage = 8;\n\n\t\t} else if ( value.isVector3 || value.isColor ) {\n\n\t\t\t// vec3\n\n\t\t\tinfo.boundary = 16;\n\t\t\tinfo.storage = 12; // evil: vec3 must start on a 16-byte boundary but it only consumes 12 bytes\n\n\t\t} else if ( value.isVector4 ) {\n\n\t\t\t// vec4\n\n\t\t\tinfo.boundary = 16;\n\t\t\tinfo.storage = 16;\n\n\t\t} else if ( value.isMatrix3 ) {\n\n\t\t\t// mat3 (in STD140 a 3x3 matrix is represented as 3x4)\n\n\t\t\tinfo.boundary = 48;\n\t\t\tinfo.storage = 48;\n\n\t\t} else if ( value.isMatrix4 ) {\n\n\t\t\t// mat4\n\n\t\t\tinfo.boundary = 64;\n\t\t\tinfo.storage = 64;\n\n\t\t} else if ( value.isTexture ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.' );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Unsupported uniform value type.', value );\n\n\t\t}\n\n\t\treturn info;\n\n\t}\n\n\tfunction onUniformsGroupsDispose( event ) {\n\n\t\tconst uniformsGroup = event.target;\n\n\t\tuniformsGroup.removeEventListener( 'dispose', onUniformsGroupsDispose );\n\n\t\tconst index = allocatedBindingPoints.indexOf( uniformsGroup.__bindingPointIndex );\n\t\tallocatedBindingPoints.splice( index, 1 );\n\n\t\tgl.deleteBuffer( buffers[ uniformsGroup.id ] );\n\n\t\tdelete buffers[ uniformsGroup.id ];\n\t\tdelete updateList[ uniformsGroup.id ];\n\n\t}\n\n\tfunction dispose() {\n\n\t\tfor ( const id in buffers ) {\n\n\t\t\tgl.deleteBuffer( buffers[ id ] );\n\n\t\t}\n\n\t\tallocatedBindingPoints = [];\n\t\tbuffers = {};\n\t\tupdateList = {};\n\n\t}\n\n\treturn {\n\n\t\tbind: bind,\n\t\tupdate: update,\n\n\t\tdispose: dispose\n\n\t};\n\n}\n\nclass WebGLRenderer {\n\n\tconstructor( parameters = {} ) {\n\n\t\tconst {\n\t\t\tcanvas = createCanvasElement(),\n\t\t\tcontext = null,\n\t\t\tdepth = true,\n\t\t\tstencil = true,\n\t\t\talpha = false,\n\t\t\tantialias = false,\n\t\t\tpremultipliedAlpha = true,\n\t\t\tpreserveDrawingBuffer = false,\n\t\t\tpowerPreference = 'default',\n\t\t\tfailIfMajorPerformanceCaveat = false,\n\t\t} = parameters;\n\n\t\tthis.isWebGLRenderer = true;\n\n\t\tlet _alpha;\n\n\t\tif ( context !== null ) {\n\n\t\t\t_alpha = context.getContextAttributes().alpha;\n\n\t\t} else {\n\n\t\t\t_alpha = alpha;\n\n\t\t}\n\n\t\tconst uintClearColor = new Uint32Array( 4 );\n\t\tconst intClearColor = new Int32Array( 4 );\n\n\t\tlet currentRenderList = null;\n\t\tlet currentRenderState = null;\n\n\t\t// render() can be called from within a callback triggered by another render.\n\t\t// We track this so that the nested render call gets its list and state isolated from the parent render call.\n\n\t\tconst renderListStack = [];\n\t\tconst renderStateStack = [];\n\n\t\t// public properties\n\n\t\tthis.domElement = canvas;\n\n\t\t// Debug configuration container\n\t\tthis.debug = {\n\n\t\t\t/**\n\t\t\t * Enables error checking and reporting when shader programs are being compiled\n\t\t\t * @type {boolean}\n\t\t\t */\n\t\t\tcheckShaderErrors: true,\n\t\t\t/**\n\t\t\t * Callback for custom error reporting.\n\t\t\t * @type {?Function}\n\t\t\t */\n\t\t\tonShaderError: null\n\t\t};\n\n\t\t// clearing\n\n\t\tthis.autoClear = true;\n\t\tthis.autoClearColor = true;\n\t\tthis.autoClearDepth = true;\n\t\tthis.autoClearStencil = true;\n\n\t\t// scene graph\n\n\t\tthis.sortObjects = true;\n\n\t\t// user-defined clipping\n\n\t\tthis.clippingPlanes = [];\n\t\tthis.localClippingEnabled = false;\n\n\t\t// physically based shading\n\n\t\tthis._outputColorSpace = SRGBColorSpace;\n\n\t\t// physical lights\n\n\t\tthis._useLegacyLights = false;\n\n\t\t// tone mapping\n\n\t\tthis.toneMapping = NoToneMapping;\n\t\tthis.toneMappingExposure = 1.0;\n\n\t\t// internal properties\n\n\t\tconst _this = this;\n\n\t\tlet _isContextLost = false;\n\n\t\t// internal state cache\n\n\t\tlet _currentActiveCubeFace = 0;\n\t\tlet _currentActiveMipmapLevel = 0;\n\t\tlet _currentRenderTarget = null;\n\t\tlet _currentMaterialId = - 1;\n\n\t\tlet _currentCamera = null;\n\n\t\tconst _currentViewport = new Vector4();\n\t\tconst _currentScissor = new Vector4();\n\t\tlet _currentScissorTest = null;\n\n\t\tconst _currentClearColor = new Color( 0x000000 );\n\t\tlet _currentClearAlpha = 0;\n\n\t\t//\n\n\t\tlet _width = canvas.width;\n\t\tlet _height = canvas.height;\n\n\t\tlet _pixelRatio = 1;\n\t\tlet _opaqueSort = null;\n\t\tlet _transparentSort = null;\n\n\t\tconst _viewport = new Vector4( 0, 0, _width, _height );\n\t\tconst _scissor = new Vector4( 0, 0, _width, _height );\n\t\tlet _scissorTest = false;\n\n\t\t// frustum\n\n\t\tconst _frustum = new Frustum();\n\n\t\t// clipping\n\n\t\tlet _clippingEnabled = false;\n\t\tlet _localClippingEnabled = false;\n\n\t\t// transmission\n\n\t\tlet _transmissionRenderTarget = null;\n\n\t\t// camera matrices cache\n\n\t\tconst _projScreenMatrix = new Matrix4();\n\n\t\tconst _vector2 = new Vector2();\n\t\tconst _vector3 = new Vector3();\n\n\t\tconst _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };\n\n\t\tfunction getTargetPixelRatio() {\n\n\t\t\treturn _currentRenderTarget === null ? _pixelRatio : 1;\n\n\t\t}\n\n\t\t// initialize\n\n\t\tlet _gl = context;\n\n\t\tfunction getContext( contextNames, contextAttributes ) {\n\n\t\t\tfor ( let i = 0; i < contextNames.length; i ++ ) {\n\n\t\t\t\tconst contextName = contextNames[ i ];\n\t\t\t\tconst context = canvas.getContext( contextName, contextAttributes );\n\t\t\t\tif ( context !== null ) return context;\n\n\t\t\t}\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\ttry {\n\n\t\t\tconst contextAttributes = {\n\t\t\t\talpha: true,\n\t\t\t\tdepth,\n\t\t\t\tstencil,\n\t\t\t\tantialias,\n\t\t\t\tpremultipliedAlpha,\n\t\t\t\tpreserveDrawingBuffer,\n\t\t\t\tpowerPreference,\n\t\t\t\tfailIfMajorPerformanceCaveat,\n\t\t\t};\n\n\t\t\t// OffscreenCanvas does not have setAttribute, see #22811\n\t\t\tif ( 'setAttribute' in canvas ) canvas.setAttribute( 'data-engine', `three.js r${REVISION}` );\n\n\t\t\t// event listeners must be registered before WebGL context is created, see #12753\n\t\t\tcanvas.addEventListener( 'webglcontextlost', onContextLost, false );\n\t\t\tcanvas.addEventListener( 'webglcontextrestored', onContextRestore, false );\n\t\t\tcanvas.addEventListener( 'webglcontextcreationerror', onContextCreationError, false );\n\n\t\t\tif ( _gl === null ) {\n\n\t\t\t\tconst contextNames = [ 'webgl2', 'webgl', 'experimental-webgl' ];\n\n\t\t\t\tif ( _this.isWebGL1Renderer === true ) {\n\n\t\t\t\t\tcontextNames.shift();\n\n\t\t\t\t}\n\n\t\t\t\t_gl = getContext( contextNames, contextAttributes );\n\n\t\t\t\tif ( _gl === null ) {\n\n\t\t\t\t\tif ( getContext( contextNames ) ) {\n\n\t\t\t\t\t\tthrow new Error( 'Error creating WebGL context with your selected attributes.' );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthrow new Error( 'Error creating WebGL context.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( typeof WebGLRenderingContext !== 'undefined' && _gl instanceof WebGLRenderingContext ) { // @deprecated, r153\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163.' );\n\n\t\t\t}\n\n\t\t\t// Some experimental-webgl implementations do not have getShaderPrecisionFormat\n\n\t\t\tif ( _gl.getShaderPrecisionFormat === undefined ) {\n\n\t\t\t\t_gl.getShaderPrecisionFormat = function () {\n\n\t\t\t\t\treturn { 'rangeMin': 1, 'rangeMax': 1, 'precision': 1 };\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLRenderer: ' + error.message );\n\t\t\tthrow error;\n\n\t\t}\n\n\t\tlet extensions, capabilities, state, info;\n\t\tlet properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects;\n\t\tlet programCache, materials, renderLists, renderStates, clipping, shadowMap;\n\n\t\tlet background, morphtargets, bufferRenderer, indexedBufferRenderer;\n\n\t\tlet utils, bindingStates, uniformsGroups;\n\n\t\tfunction initGLContext() {\n\n\t\t\textensions = new WebGLExtensions( _gl );\n\n\t\t\tcapabilities = new WebGLCapabilities( _gl, extensions, parameters );\n\n\t\t\textensions.init( capabilities );\n\n\t\t\tutils = new WebGLUtils( _gl, extensions, capabilities );\n\n\t\t\tstate = new WebGLState( _gl, extensions, capabilities );\n\n\t\t\tinfo = new WebGLInfo( _gl );\n\t\t\tproperties = new WebGLProperties();\n\t\t\ttextures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );\n\t\t\tcubemaps = new WebGLCubeMaps( _this );\n\t\t\tcubeuvmaps = new WebGLCubeUVMaps( _this );\n\t\t\tattributes = new WebGLAttributes( _gl, capabilities );\n\t\t\tbindingStates = new WebGLBindingStates( _gl, extensions, attributes, capabilities );\n\t\t\tgeometries = new WebGLGeometries( _gl, attributes, info, bindingStates );\n\t\t\tobjects = new WebGLObjects( _gl, geometries, attributes, info );\n\t\t\tmorphtargets = new WebGLMorphtargets( _gl, capabilities, textures );\n\t\t\tclipping = new WebGLClipping( properties );\n\t\t\tprogramCache = new WebGLPrograms( _this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping );\n\t\t\tmaterials = new WebGLMaterials( _this, properties );\n\t\t\trenderLists = new WebGLRenderLists();\n\t\t\trenderStates = new WebGLRenderStates( extensions, capabilities );\n\t\t\tbackground = new WebGLBackground( _this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha );\n\t\t\tshadowMap = new WebGLShadowMap( _this, objects, capabilities );\n\t\t\tuniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );\n\n\t\t\tbufferRenderer = new WebGLBufferRenderer( _gl, extensions, info, capabilities );\n\t\t\tindexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info, capabilities );\n\n\t\t\tinfo.programs = programCache.programs;\n\n\t\t\t_this.capabilities = capabilities;\n\t\t\t_this.extensions = extensions;\n\t\t\t_this.properties = properties;\n\t\t\t_this.renderLists = renderLists;\n\t\t\t_this.shadowMap = shadowMap;\n\t\t\t_this.state = state;\n\t\t\t_this.info = info;\n\n\t\t}\n\n\t\tinitGLContext();\n\n\t\t// xr\n\n\t\tconst xr = new WebXRManager( _this, _gl );\n\n\t\tthis.xr = xr;\n\n\t\t// API\n\n\t\tthis.getContext = function () {\n\n\t\t\treturn _gl;\n\n\t\t};\n\n\t\tthis.getContextAttributes = function () {\n\n\t\t\treturn _gl.getContextAttributes();\n\n\t\t};\n\n\t\tthis.forceContextLoss = function () {\n\n\t\t\tconst extension = extensions.get( 'WEBGL_lose_context' );\n\t\t\tif ( extension ) extension.loseContext();\n\n\t\t};\n\n\t\tthis.forceContextRestore = function () {\n\n\t\t\tconst extension = extensions.get( 'WEBGL_lose_context' );\n\t\t\tif ( extension ) extension.restoreContext();\n\n\t\t};\n\n\t\tthis.getPixelRatio = function () {\n\n\t\t\treturn _pixelRatio;\n\n\t\t};\n\n\t\tthis.setPixelRatio = function ( value ) {\n\n\t\t\tif ( value === undefined ) return;\n\n\t\t\t_pixelRatio = value;\n\n\t\t\tthis.setSize( _width, _height, false );\n\n\t\t};\n\n\t\tthis.getSize = function ( target ) {\n\n\t\t\treturn target.set( _width, _height );\n\n\t\t};\n\n\t\tthis.setSize = function ( width, height, updateStyle = true ) {\n\n\t\t\tif ( xr.isPresenting ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Can\\'t change size while VR device is presenting.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\t_width = width;\n\t\t\t_height = height;\n\n\t\t\tcanvas.width = Math.floor( width * _pixelRatio );\n\t\t\tcanvas.height = Math.floor( height * _pixelRatio );\n\n\t\t\tif ( updateStyle === true ) {\n\n\t\t\t\tcanvas.style.width = width + 'px';\n\t\t\t\tcanvas.style.height = height + 'px';\n\n\t\t\t}\n\n\t\t\tthis.setViewport( 0, 0, width, height );\n\n\t\t};\n\n\t\tthis.getDrawingBufferSize = function ( target ) {\n\n\t\t\treturn target.set( _width * _pixelRatio, _height * _pixelRatio ).floor();\n\n\t\t};\n\n\t\tthis.setDrawingBufferSize = function ( width, height, pixelRatio ) {\n\n\t\t\t_width = width;\n\t\t\t_height = height;\n\n\t\t\t_pixelRatio = pixelRatio;\n\n\t\t\tcanvas.width = Math.floor( width * pixelRatio );\n\t\t\tcanvas.height = Math.floor( height * pixelRatio );\n\n\t\t\tthis.setViewport( 0, 0, width, height );\n\n\t\t};\n\n\t\tthis.getCurrentViewport = function ( target ) {\n\n\t\t\treturn target.copy( _currentViewport );\n\n\t\t};\n\n\t\tthis.getViewport = function ( target ) {\n\n\t\t\treturn target.copy( _viewport );\n\n\t\t};\n\n\t\tthis.setViewport = function ( x, y, width, height ) {\n\n\t\t\tif ( x.isVector4 ) {\n\n\t\t\t\t_viewport.set( x.x, x.y, x.z, x.w );\n\n\t\t\t} else {\n\n\t\t\t\t_viewport.set( x, y, width, height );\n\n\t\t\t}\n\n\t\t\tstate.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor() );\n\n\t\t};\n\n\t\tthis.getScissor = function ( target ) {\n\n\t\t\treturn target.copy( _scissor );\n\n\t\t};\n\n\t\tthis.setScissor = function ( x, y, width, height ) {\n\n\t\t\tif ( x.isVector4 ) {\n\n\t\t\t\t_scissor.set( x.x, x.y, x.z, x.w );\n\n\t\t\t} else {\n\n\t\t\t\t_scissor.set( x, y, width, height );\n\n\t\t\t}\n\n\t\t\tstate.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor() );\n\n\t\t};\n\n\t\tthis.getScissorTest = function () {\n\n\t\t\treturn _scissorTest;\n\n\t\t};\n\n\t\tthis.setScissorTest = function ( boolean ) {\n\n\t\t\tstate.setScissorTest( _scissorTest = boolean );\n\n\t\t};\n\n\t\tthis.setOpaqueSort = function ( method ) {\n\n\t\t\t_opaqueSort = method;\n\n\t\t};\n\n\t\tthis.setTransparentSort = function ( method ) {\n\n\t\t\t_transparentSort = method;\n\n\t\t};\n\n\t\t// Clearing\n\n\t\tthis.getClearColor = function ( target ) {\n\n\t\t\treturn target.copy( background.getClearColor() );\n\n\t\t};\n\n\t\tthis.setClearColor = function () {\n\n\t\t\tbackground.setClearColor.apply( background, arguments );\n\n\t\t};\n\n\t\tthis.getClearAlpha = function () {\n\n\t\t\treturn background.getClearAlpha();\n\n\t\t};\n\n\t\tthis.setClearAlpha = function () {\n\n\t\t\tbackground.setClearAlpha.apply( background, arguments );\n\n\t\t};\n\n\t\tthis.clear = function ( color = true, depth = true, stencil = true ) {\n\n\t\t\tlet bits = 0;\n\n\t\t\tif ( color ) {\n\n\t\t\t\t// check if we're trying to clear an integer target\n\t\t\t\tlet isIntegerFormat = false;\n\t\t\t\tif ( _currentRenderTarget !== null ) {\n\n\t\t\t\t\tconst targetFormat = _currentRenderTarget.texture.format;\n\t\t\t\t\tisIntegerFormat = targetFormat === RGBAIntegerFormat ||\n\t\t\t\t\t\ttargetFormat === RGIntegerFormat ||\n\t\t\t\t\t\ttargetFormat === RedIntegerFormat;\n\n\t\t\t\t}\n\n\t\t\t\t// use the appropriate clear functions to clear the target if it's a signed\n\t\t\t\t// or unsigned integer target\n\t\t\t\tif ( isIntegerFormat ) {\n\n\t\t\t\t\tconst targetType = _currentRenderTarget.texture.type;\n\t\t\t\t\tconst isUnsignedType = targetType === UnsignedByteType ||\n\t\t\t\t\t\ttargetType === UnsignedIntType ||\n\t\t\t\t\t\ttargetType === UnsignedShortType ||\n\t\t\t\t\t\ttargetType === UnsignedInt248Type ||\n\t\t\t\t\t\ttargetType === UnsignedShort4444Type ||\n\t\t\t\t\t\ttargetType === UnsignedShort5551Type;\n\n\t\t\t\t\tconst clearColor = background.getClearColor();\n\t\t\t\t\tconst a = background.getClearAlpha();\n\t\t\t\t\tconst r = clearColor.r;\n\t\t\t\t\tconst g = clearColor.g;\n\t\t\t\t\tconst b = clearColor.b;\n\n\t\t\t\t\tif ( isUnsignedType ) {\n\n\t\t\t\t\t\tuintClearColor[ 0 ] = r;\n\t\t\t\t\t\tuintClearColor[ 1 ] = g;\n\t\t\t\t\t\tuintClearColor[ 2 ] = b;\n\t\t\t\t\t\tuintClearColor[ 3 ] = a;\n\t\t\t\t\t\t_gl.clearBufferuiv( _gl.COLOR, 0, uintClearColor );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tintClearColor[ 0 ] = r;\n\t\t\t\t\t\tintClearColor[ 1 ] = g;\n\t\t\t\t\t\tintClearColor[ 2 ] = b;\n\t\t\t\t\t\tintClearColor[ 3 ] = a;\n\t\t\t\t\t\t_gl.clearBufferiv( _gl.COLOR, 0, intClearColor );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbits |= _gl.COLOR_BUFFER_BIT;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( depth ) bits |= _gl.DEPTH_BUFFER_BIT;\n\t\t\tif ( stencil ) {\n\n\t\t\t\tbits |= _gl.STENCIL_BUFFER_BIT;\n\t\t\t\tthis.state.buffers.stencil.setMask( 0xffffffff );\n\n\t\t\t}\n\n\t\t\t_gl.clear( bits );\n\n\t\t};\n\n\t\tthis.clearColor = function () {\n\n\t\t\tthis.clear( true, false, false );\n\n\t\t};\n\n\t\tthis.clearDepth = function () {\n\n\t\t\tthis.clear( false, true, false );\n\n\t\t};\n\n\t\tthis.clearStencil = function () {\n\n\t\t\tthis.clear( false, false, true );\n\n\t\t};\n\n\t\t//\n\n\t\tthis.dispose = function () {\n\n\t\t\tcanvas.removeEventListener( 'webglcontextlost', onContextLost, false );\n\t\t\tcanvas.removeEventListener( 'webglcontextrestored', onContextRestore, false );\n\t\t\tcanvas.removeEventListener( 'webglcontextcreationerror', onContextCreationError, false );\n\n\t\t\trenderLists.dispose();\n\t\t\trenderStates.dispose();\n\t\t\tproperties.dispose();\n\t\t\tcubemaps.dispose();\n\t\t\tcubeuvmaps.dispose();\n\t\t\tobjects.dispose();\n\t\t\tbindingStates.dispose();\n\t\t\tuniformsGroups.dispose();\n\t\t\tprogramCache.dispose();\n\n\t\t\txr.dispose();\n\n\t\t\txr.removeEventListener( 'sessionstart', onXRSessionStart );\n\t\t\txr.removeEventListener( 'sessionend', onXRSessionEnd );\n\n\t\t\tif ( _transmissionRenderTarget ) {\n\n\t\t\t\t_transmissionRenderTarget.dispose();\n\t\t\t\t_transmissionRenderTarget = null;\n\n\t\t\t}\n\n\t\t\tanimation.stop();\n\n\t\t};\n\n\t\t// Events\n\n\t\tfunction onContextLost( event ) {\n\n\t\t\tevent.preventDefault();\n\n\t\t\tconsole.log( 'THREE.WebGLRenderer: Context Lost.' );\n\n\t\t\t_isContextLost = true;\n\n\t\t}\n\n\t\tfunction onContextRestore( /* event */ ) {\n\n\t\t\tconsole.log( 'THREE.WebGLRenderer: Context Restored.' );\n\n\t\t\t_isContextLost = false;\n\n\t\t\tconst infoAutoReset = info.autoReset;\n\t\t\tconst shadowMapEnabled = shadowMap.enabled;\n\t\t\tconst shadowMapAutoUpdate = shadowMap.autoUpdate;\n\t\t\tconst shadowMapNeedsUpdate = shadowMap.needsUpdate;\n\t\t\tconst shadowMapType = shadowMap.type;\n\n\t\t\tinitGLContext();\n\n\t\t\tinfo.autoReset = infoAutoReset;\n\t\t\tshadowMap.enabled = shadowMapEnabled;\n\t\t\tshadowMap.autoUpdate = shadowMapAutoUpdate;\n\t\t\tshadowMap.needsUpdate = shadowMapNeedsUpdate;\n\t\t\tshadowMap.type = shadowMapType;\n\n\t\t}\n\n\t\tfunction onContextCreationError( event ) {\n\n\t\t\tconsole.error( 'THREE.WebGLRenderer: A WebGL context could not be created. Reason: ', event.statusMessage );\n\n\t\t}\n\n\t\tfunction onMaterialDispose( event ) {\n\n\t\t\tconst material = event.target;\n\n\t\t\tmaterial.removeEventListener( 'dispose', onMaterialDispose );\n\n\t\t\tdeallocateMaterial( material );\n\n\t\t}\n\n\t\t// Buffer deallocation\n\n\t\tfunction deallocateMaterial( material ) {\n\n\t\t\treleaseMaterialProgramReferences( material );\n\n\t\t\tproperties.remove( material );\n\n\t\t}\n\n\n\t\tfunction releaseMaterialProgramReferences( material ) {\n\n\t\t\tconst programs = properties.get( material ).programs;\n\n\t\t\tif ( programs !== undefined ) {\n\n\t\t\t\tprograms.forEach( function ( program ) {\n\n\t\t\t\t\tprogramCache.releaseProgram( program );\n\n\t\t\t\t} );\n\n\t\t\t\tif ( material.isShaderMaterial ) {\n\n\t\t\t\t\tprogramCache.releaseShaderCache( material );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Buffer rendering\n\n\t\tthis.renderBufferDirect = function ( camera, scene, geometry, material, object, group ) {\n\n\t\t\tif ( scene === null ) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)\n\n\t\t\tconst frontFaceCW = ( object.isMesh && object.matrixWorld.determinant() < 0 );\n\n\t\t\tconst program = setProgram( camera, scene, geometry, material, object );\n\n\t\t\tstate.setMaterial( material, frontFaceCW );\n\n\t\t\t//\n\n\t\t\tlet index = geometry.index;\n\t\t\tlet rangeFactor = 1;\n\n\t\t\tif ( material.wireframe === true ) {\n\n\t\t\t\tindex = geometries.getWireframeAttribute( geometry );\n\n\t\t\t\tif ( index === undefined ) return;\n\n\t\t\t\trangeFactor = 2;\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tconst drawRange = geometry.drawRange;\n\t\t\tconst position = geometry.attributes.position;\n\n\t\t\tlet drawStart = drawRange.start * rangeFactor;\n\t\t\tlet drawEnd = ( drawRange.start + drawRange.count ) * rangeFactor;\n\n\t\t\tif ( group !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, group.start * rangeFactor );\n\t\t\t\tdrawEnd = Math.min( drawEnd, ( group.start + group.count ) * rangeFactor );\n\n\t\t\t}\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, 0 );\n\t\t\t\tdrawEnd = Math.min( drawEnd, index.count );\n\n\t\t\t} else if ( position !== undefined && position !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, 0 );\n\t\t\t\tdrawEnd = Math.min( drawEnd, position.count );\n\n\t\t\t}\n\n\t\t\tconst drawCount = drawEnd - drawStart;\n\n\t\t\tif ( drawCount < 0 || drawCount === Infinity ) return;\n\n\t\t\t//\n\n\t\t\tbindingStates.setup( object, material, program, geometry, index );\n\n\t\t\tlet attribute;\n\t\t\tlet renderer = bufferRenderer;\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tattribute = attributes.get( index );\n\n\t\t\t\trenderer = indexedBufferRenderer;\n\t\t\t\trenderer.setIndex( attribute );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( object.isMesh ) {\n\n\t\t\t\tif ( material.wireframe === true ) {\n\n\t\t\t\t\tstate.setLineWidth( material.wireframeLinewidth * getTargetPixelRatio() );\n\t\t\t\t\trenderer.setMode( _gl.LINES );\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderer.setMode( _gl.TRIANGLES );\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isLine ) {\n\n\t\t\t\tlet lineWidth = material.linewidth;\n\n\t\t\t\tif ( lineWidth === undefined ) lineWidth = 1; // Not using Line*Material\n\n\t\t\t\tstate.setLineWidth( lineWidth * getTargetPixelRatio() );\n\n\t\t\t\tif ( object.isLineSegments ) {\n\n\t\t\t\t\trenderer.setMode( _gl.LINES );\n\n\t\t\t\t} else if ( object.isLineLoop ) {\n\n\t\t\t\t\trenderer.setMode( _gl.LINE_LOOP );\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderer.setMode( _gl.LINE_STRIP );\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isPoints ) {\n\n\t\t\t\trenderer.setMode( _gl.POINTS );\n\n\t\t\t} else if ( object.isSprite ) {\n\n\t\t\t\trenderer.setMode( _gl.TRIANGLES );\n\n\t\t\t}\n\n\t\t\tif ( object.isInstancedMesh ) {\n\n\t\t\t\trenderer.renderInstances( drawStart, drawCount, object.count );\n\n\t\t\t} else if ( geometry.isInstancedBufferGeometry ) {\n\n\t\t\t\tconst maxInstanceCount = geometry._maxInstanceCount !== undefined ? geometry._maxInstanceCount : Infinity;\n\t\t\t\tconst instanceCount = Math.min( geometry.instanceCount, maxInstanceCount );\n\n\t\t\t\trenderer.renderInstances( drawStart, drawCount, instanceCount );\n\n\t\t\t} else {\n\n\t\t\t\trenderer.render( drawStart, drawCount );\n\n\t\t\t}\n\n\t\t};\n\n\t\t// Compile\n\n\t\tfunction prepareMaterial( material, scene, object ) {\n\n\t\t\tif ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {\n\n\t\t\t\tmaterial.side = BackSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t\tmaterial.side = FrontSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t\tmaterial.side = DoubleSide;\n\n\t\t\t} else {\n\n\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.compile = function ( scene, camera, targetScene = null ) {\n\n\t\t\tif ( targetScene === null ) targetScene = scene;\n\n\t\t\tcurrentRenderState = renderStates.get( targetScene );\n\t\t\tcurrentRenderState.init();\n\n\t\t\trenderStateStack.push( currentRenderState );\n\n\t\t\t// gather lights from both the target scene and the new object that will be added to the scene.\n\n\t\t\ttargetScene.traverseVisible( function ( object ) {\n\n\t\t\t\tif ( object.isLight && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\tif ( scene !== targetScene ) {\n\n\t\t\t\tscene.traverseVisible( function ( object ) {\n\n\t\t\t\t\tif ( object.isLight && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\tcurrentRenderState.setupLights( _this._useLegacyLights );\n\n\t\t\t// Only initialize materials in the new scene, not the targetScene.\n\n\t\t\tconst materials = new Set();\n\n\t\t\tscene.traverse( function ( object ) {\n\n\t\t\t\tconst material = object.material;\n\n\t\t\t\tif ( material ) {\n\n\t\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\t\tfor ( let i = 0; i < material.length; i ++ ) {\n\n\t\t\t\t\t\t\tconst material2 = material[ i ];\n\n\t\t\t\t\t\t\tprepareMaterial( material2, targetScene, object );\n\t\t\t\t\t\t\tmaterials.add( material2 );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tprepareMaterial( material, targetScene, object );\n\t\t\t\t\t\tmaterials.add( material );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\trenderStateStack.pop();\n\t\t\tcurrentRenderState = null;\n\n\t\t\treturn materials;\n\n\t\t};\n\n\t\t// compileAsync\n\n\t\tthis.compileAsync = function ( scene, camera, targetScene = null ) {\n\n\t\t\tconst materials = this.compile( scene, camera, targetScene );\n\n\t\t\t// Wait for all the materials in the new object to indicate that they're\n\t\t\t// ready to be used before resolving the promise.\n\n\t\t\treturn new Promise( ( resolve ) => {\n\n\t\t\t\tfunction checkMaterialsReady() {\n\n\t\t\t\t\tmaterials.forEach( function ( material ) {\n\n\t\t\t\t\t\tconst materialProperties = properties.get( material );\n\t\t\t\t\t\tconst program = materialProperties.currentProgram;\n\n\t\t\t\t\t\tif ( program.isReady() ) {\n\n\t\t\t\t\t\t\t// remove any programs that report they're ready to use from the list\n\t\t\t\t\t\t\tmaterials.delete( material );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} );\n\n\t\t\t\t\t// once the list of compiling materials is empty, call the callback\n\n\t\t\t\t\tif ( materials.size === 0 ) {\n\n\t\t\t\t\t\tresolve( scene );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// if some materials are still not ready, wait a bit and check again\n\n\t\t\t\t\tsetTimeout( checkMaterialsReady, 10 );\n\n\t\t\t\t}\n\n\t\t\t\tif ( extensions.get( 'KHR_parallel_shader_compile' ) !== null ) {\n\n\t\t\t\t\t// If we can check the compilation status of the materials without\n\t\t\t\t\t// blocking then do so right away.\n\n\t\t\t\t\tcheckMaterialsReady();\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Otherwise start by waiting a bit to give the materials we just\n\t\t\t\t\t// initialized a chance to finish.\n\n\t\t\t\t\tsetTimeout( checkMaterialsReady, 10 );\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t};\n\n\t\t// Animation Loop\n\n\t\tlet onAnimationFrameCallback = null;\n\n\t\tfunction onAnimationFrame( time ) {\n\n\t\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time );\n\n\t\t}\n\n\t\tfunction onXRSessionStart() {\n\n\t\t\tanimation.stop();\n\n\t\t}\n\n\t\tfunction onXRSessionEnd() {\n\n\t\t\tanimation.start();\n\n\t\t}\n\n\t\tconst animation = new WebGLAnimation();\n\t\tanimation.setAnimationLoop( onAnimationFrame );\n\n\t\tif ( typeof self !== 'undefined' ) animation.setContext( self );\n\n\t\tthis.setAnimationLoop = function ( callback ) {\n\n\t\t\tonAnimationFrameCallback = callback;\n\t\t\txr.setAnimationLoop( callback );\n\n\t\t\t( callback === null ) ? animation.stop() : animation.start();\n\n\t\t};\n\n\t\txr.addEventListener( 'sessionstart', onXRSessionStart );\n\t\txr.addEventListener( 'sessionend', onXRSessionEnd );\n\n\t\t// Rendering\n\n\t\tthis.render = function ( scene, camera ) {\n\n\t\t\tif ( camera !== undefined && camera.isCamera !== true ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tif ( _isContextLost === true ) return;\n\n\t\t\t// update scene graph\n\n\t\t\tif ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();\n\n\t\t\t// update camera matrices and frustum\n\n\t\t\tif ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld();\n\n\t\t\tif ( xr.enabled === true && xr.isPresenting === true ) {\n\n\t\t\t\tif ( xr.cameraAutoUpdate === true ) xr.updateCamera( camera );\n\n\t\t\t\tcamera = xr.getCamera(); // use XR camera for rendering\n\n\t\t\t}\n\n\t\t\t//\n\t\t\tif ( scene.isScene === true ) scene.onBeforeRender( _this, scene, camera, _currentRenderTarget );\n\n\t\t\tcurrentRenderState = renderStates.get( scene, renderStateStack.length );\n\t\t\tcurrentRenderState.init();\n\n\t\t\trenderStateStack.push( currentRenderState );\n\n\t\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\n\t\t\t_frustum.setFromProjectionMatrix( _projScreenMatrix );\n\n\t\t\t_localClippingEnabled = this.localClippingEnabled;\n\t\t\t_clippingEnabled = clipping.init( this.clippingPlanes, _localClippingEnabled );\n\n\t\t\tcurrentRenderList = renderLists.get( scene, renderListStack.length );\n\t\t\tcurrentRenderList.init();\n\n\t\t\trenderListStack.push( currentRenderList );\n\n\t\t\tprojectObject( scene, camera, 0, _this.sortObjects );\n\n\t\t\tcurrentRenderList.finish();\n\n\t\t\tif ( _this.sortObjects === true ) {\n\n\t\t\t\tcurrentRenderList.sort( _opaqueSort, _transparentSort );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tthis.info.render.frame ++;\n\n\t\t\tif ( _clippingEnabled === true ) clipping.beginShadows();\n\n\t\t\tconst shadowsArray = currentRenderState.state.shadowsArray;\n\n\t\t\tshadowMap.render( shadowsArray, scene, camera );\n\n\t\t\tif ( _clippingEnabled === true ) clipping.endShadows();\n\n\t\t\t//\n\n\t\t\tif ( this.info.autoReset === true ) this.info.reset();\n\n\n\t\t\t//\n\n\t\t\tbackground.render( currentRenderList, scene );\n\n\t\t\t// render scene\n\n\t\t\tcurrentRenderState.setupLights( _this._useLegacyLights );\n\n\t\t\tif ( camera.isArrayCamera ) {\n\n\t\t\t\tconst cameras = camera.cameras;\n\n\t\t\t\tfor ( let i = 0, l = cameras.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst camera2 = cameras[ i ];\n\n\t\t\t\t\trenderScene( currentRenderList, scene, camera2, camera2.viewport );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\trenderScene( currentRenderList, scene, camera );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( _currentRenderTarget !== null ) {\n\n\t\t\t\t// resolve multisample renderbuffers to a single-sample texture if necessary\n\n\t\t\t\ttextures.updateMultisampleRenderTarget( _currentRenderTarget );\n\n\t\t\t\t// Generate mipmap if we're using any kind of mipmap filtering\n\n\t\t\t\ttextures.updateRenderTargetMipmap( _currentRenderTarget );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );\n\n\t\t\t// _gl.finish();\n\n\t\t\tbindingStates.resetDefaultState();\n\t\t\t_currentMaterialId = - 1;\n\t\t\t_currentCamera = null;\n\n\t\t\trenderStateStack.pop();\n\n\t\t\tif ( renderStateStack.length > 0 ) {\n\n\t\t\t\tcurrentRenderState = renderStateStack[ renderStateStack.length - 1 ];\n\n\t\t\t} else {\n\n\t\t\t\tcurrentRenderState = null;\n\n\t\t\t}\n\n\t\t\trenderListStack.pop();\n\n\t\t\tif ( renderListStack.length > 0 ) {\n\n\t\t\t\tcurrentRenderList = renderListStack[ renderListStack.length - 1 ];\n\n\t\t\t} else {\n\n\t\t\t\tcurrentRenderList = null;\n\n\t\t\t}\n\n\t\t};\n\n\t\tfunction projectObject( object, camera, groupOrder, sortObjects ) {\n\n\t\t\tif ( object.visible === false ) return;\n\n\t\t\tconst visible = object.layers.test( camera.layers );\n\n\t\t\tif ( visible ) {\n\n\t\t\t\tif ( object.isGroup ) {\n\n\t\t\t\t\tgroupOrder = object.renderOrder;\n\n\t\t\t\t} else if ( object.isLOD ) {\n\n\t\t\t\t\tif ( object.autoUpdate === true ) object.update( camera );\n\n\t\t\t\t} else if ( object.isLight ) {\n\n\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( object.isSprite ) {\n\n\t\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsSprite( object ) ) {\n\n\t\t\t\t\t\tif ( sortObjects ) {\n\n\t\t\t\t\t\t\t_vector3.setFromMatrixPosition( object.matrixWorld )\n\t\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst geometry = objects.update( object );\n\t\t\t\t\t\tconst material = object.material;\n\n\t\t\t\t\t\tif ( material.visible ) {\n\n\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector3.z, null );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( object.isMesh || object.isLine || object.isPoints ) {\n\n\t\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) {\n\n\t\t\t\t\t\tconst geometry = objects.update( object );\n\t\t\t\t\t\tconst material = object.material;\n\n\t\t\t\t\t\tif ( sortObjects ) {\n\n\t\t\t\t\t\t\tif ( object.boundingSphere !== undefined ) {\n\n\t\t\t\t\t\t\t\tif ( object.boundingSphere === null ) object.computeBoundingSphere();\n\t\t\t\t\t\t\t\t_vector3.copy( object.boundingSphere.center );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\t\t\t\t\t\t\t\t_vector3.copy( geometry.boundingSphere.center );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t_vector3\n\t\t\t\t\t\t\t\t.applyMatrix4( object.matrixWorld )\n\t\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\t\t\tconst groups = geometry.groups;\n\n\t\t\t\t\t\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\t\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\n\n\t\t\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, groupMaterial, groupOrder, _vector3.z, group );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else if ( material.visible ) {\n\n\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector3.z, null );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst children = object.children;\n\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tprojectObject( children[ i ], camera, groupOrder, sortObjects );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction renderScene( currentRenderList, scene, camera, viewport ) {\n\n\t\t\tconst opaqueObjects = currentRenderList.opaque;\n\t\t\tconst transmissiveObjects = currentRenderList.transmissive;\n\t\t\tconst transparentObjects = currentRenderList.transparent;\n\n\t\t\tcurrentRenderState.setupLightsView( camera );\n\n\t\t\tif ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, camera );\n\n\t\t\tif ( transmissiveObjects.length > 0 ) renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera );\n\n\t\t\tif ( viewport ) state.viewport( _currentViewport.copy( viewport ) );\n\n\t\t\tif ( opaqueObjects.length > 0 ) renderObjects( opaqueObjects, scene, camera );\n\t\t\tif ( transmissiveObjects.length > 0 ) renderObjects( transmissiveObjects, scene, camera );\n\t\t\tif ( transparentObjects.length > 0 ) renderObjects( transparentObjects, scene, camera );\n\n\t\t\t// Ensure depth buffer writing is enabled so it can be cleared on next render\n\n\t\t\tstate.buffers.depth.setTest( true );\n\t\t\tstate.buffers.depth.setMask( true );\n\t\t\tstate.buffers.color.setMask( true );\n\n\t\t\tstate.setPolygonOffset( false );\n\n\t\t}\n\n\t\tfunction renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera ) {\n\n\t\t\tconst overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\n\n\t\t\tif ( overrideMaterial !== null ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst isWebGL2 = capabilities.isWebGL2;\n\n\t\t\tif ( _transmissionRenderTarget === null ) {\n\n\t\t\t\t_transmissionRenderTarget = new WebGLRenderTarget( 1, 1, {\n\t\t\t\t\tgenerateMipmaps: true,\n\t\t\t\t\ttype: extensions.has( 'EXT_color_buffer_half_float' ) ? HalfFloatType : UnsignedByteType,\n\t\t\t\t\tminFilter: LinearMipmapLinearFilter,\n\t\t\t\t\tsamples: ( isWebGL2 ) ? 4 : 0\n\t\t\t\t} );\n\n\t\t\t\t// debug\n\n\t\t\t\t/*\n\t\t\t\tconst geometry = new PlaneGeometry();\n\t\t\t\tconst material = new MeshBasicMaterial( { map: _transmissionRenderTarget.texture } );\n\n\t\t\t\tconst mesh = new Mesh( geometry, material );\n\t\t\t\tscene.add( mesh );\n\t\t\t\t*/\n\n\t\t\t}\n\n\t\t\t_this.getDrawingBufferSize( _vector2 );\n\n\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t_transmissionRenderTarget.setSize( _vector2.x, _vector2.y );\n\n\t\t\t} else {\n\n\t\t\t\t_transmissionRenderTarget.setSize( floorPowerOfTwo( _vector2.x ), floorPowerOfTwo( _vector2.y ) );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tconst currentRenderTarget = _this.getRenderTarget();\n\t\t\t_this.setRenderTarget( _transmissionRenderTarget );\n\n\t\t\t_this.getClearColor( _currentClearColor );\n\t\t\t_currentClearAlpha = _this.getClearAlpha();\n\t\t\tif ( _currentClearAlpha < 1 ) _this.setClearColor( 0xffffff, 0.5 );\n\n\t\t\t_this.clear();\n\n\t\t\t// Turn off the features which can affect the frag color for opaque objects pass.\n\t\t\t// Otherwise they are applied twice in opaque objects pass and transmission objects pass.\n\t\t\tconst currentToneMapping = _this.toneMapping;\n\t\t\t_this.toneMapping = NoToneMapping;\n\n\t\t\trenderObjects( opaqueObjects, scene, camera );\n\n\t\t\ttextures.updateMultisampleRenderTarget( _transmissionRenderTarget );\n\t\t\ttextures.updateRenderTargetMipmap( _transmissionRenderTarget );\n\n\t\t\tlet renderTargetNeedsUpdate = false;\n\n\t\t\tfor ( let i = 0, l = transmissiveObjects.length; i < l; i ++ ) {\n\n\t\t\t\tconst renderItem = transmissiveObjects[ i ];\n\n\t\t\t\tconst object = renderItem.object;\n\t\t\t\tconst geometry = renderItem.geometry;\n\t\t\t\tconst material = renderItem.material;\n\t\t\t\tconst group = renderItem.group;\n\n\t\t\t\tif ( material.side === DoubleSide && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\tconst currentSide = material.side;\n\n\t\t\t\t\tmaterial.side = BackSide;\n\t\t\t\t\tmaterial.needsUpdate = true;\n\n\t\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\n\n\t\t\t\t\tmaterial.side = currentSide;\n\t\t\t\t\tmaterial.needsUpdate = true;\n\n\t\t\t\t\trenderTargetNeedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( renderTargetNeedsUpdate === true ) {\n\n\t\t\t\ttextures.updateMultisampleRenderTarget( _transmissionRenderTarget );\n\t\t\t\ttextures.updateRenderTargetMipmap( _transmissionRenderTarget );\n\n\t\t\t}\n\n\t\t\t_this.setRenderTarget( currentRenderTarget );\n\n\t\t\t_this.setClearColor( _currentClearColor, _currentClearAlpha );\n\n\t\t\t_this.toneMapping = currentToneMapping;\n\n\t\t}\n\n\t\tfunction renderObjects( renderList, scene, camera ) {\n\n\t\t\tconst overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\n\n\t\t\tfor ( let i = 0, l = renderList.length; i < l; i ++ ) {\n\n\t\t\t\tconst renderItem = renderList[ i ];\n\n\t\t\t\tconst object = renderItem.object;\n\t\t\t\tconst geometry = renderItem.geometry;\n\t\t\t\tconst material = overrideMaterial === null ? renderItem.material : overrideMaterial;\n\t\t\t\tconst group = renderItem.group;\n\n\t\t\t\tif ( object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction renderObject( object, scene, camera, geometry, material, group ) {\n\n\t\t\tobject.onBeforeRender( _this, scene, camera, geometry, material, group );\n\n\t\t\tobject.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );\n\t\t\tobject.normalMatrix.getNormalMatrix( object.modelViewMatrix );\n\n\t\t\tmaterial.onBeforeRender( _this, scene, camera, geometry, object, group );\n\n\t\t\tif ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {\n\n\t\t\t\tmaterial.side = BackSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t\tmaterial.side = FrontSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t\tmaterial.side = DoubleSide;\n\n\t\t\t} else {\n\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t}\n\n\t\t\tobject.onAfterRender( _this, scene, camera, geometry, material, group );\n\n\t\t}\n\n\t\tfunction getProgram( material, scene, object ) {\n\n\t\t\tif ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n\n\t\t\tconst materialProperties = properties.get( material );\n\n\t\t\tconst lights = currentRenderState.state.lights;\n\t\t\tconst shadowsArray = currentRenderState.state.shadowsArray;\n\n\t\t\tconst lightsStateVersion = lights.state.version;\n\n\t\t\tconst parameters = programCache.getParameters( material, lights.state, shadowsArray, scene, object );\n\t\t\tconst programCacheKey = programCache.getProgramCacheKey( parameters );\n\n\t\t\tlet programs = materialProperties.programs;\n\n\t\t\t// always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change\n\n\t\t\tmaterialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;\n\t\t\tmaterialProperties.fog = scene.fog;\n\t\t\tmaterialProperties.envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || materialProperties.environment );\n\n\t\t\tif ( programs === undefined ) {\n\n\t\t\t\t// new material\n\n\t\t\t\tmaterial.addEventListener( 'dispose', onMaterialDispose );\n\n\t\t\t\tprograms = new Map();\n\t\t\t\tmaterialProperties.programs = programs;\n\n\t\t\t}\n\n\t\t\tlet program = programs.get( programCacheKey );\n\n\t\t\tif ( program !== undefined ) {\n\n\t\t\t\t// early out if program and light state is identical\n\n\t\t\t\tif ( materialProperties.currentProgram === program && materialProperties.lightsStateVersion === lightsStateVersion ) {\n\n\t\t\t\t\tupdateCommonMaterialProperties( material, parameters );\n\n\t\t\t\t\treturn program;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tparameters.uniforms = programCache.getUniforms( material );\n\n\t\t\t\tmaterial.onBuild( object, parameters, _this );\n\n\t\t\t\tmaterial.onBeforeCompile( parameters, _this );\n\n\t\t\t\tprogram = programCache.acquireProgram( parameters, programCacheKey );\n\t\t\t\tprograms.set( programCacheKey, program );\n\n\t\t\t\tmaterialProperties.uniforms = parameters.uniforms;\n\n\t\t\t}\n\n\t\t\tconst uniforms = materialProperties.uniforms;\n\n\t\t\tif ( ( ! material.isShaderMaterial && ! material.isRawShaderMaterial ) || material.clipping === true ) {\n\n\t\t\t\tuniforms.clippingPlanes = clipping.uniform;\n\n\t\t\t}\n\n\t\t\tupdateCommonMaterialProperties( material, parameters );\n\n\t\t\t// store the light setup it was created for\n\n\t\t\tmaterialProperties.needsLights = materialNeedsLights( material );\n\t\t\tmaterialProperties.lightsStateVersion = lightsStateVersion;\n\n\t\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t\t// wire up the material to this renderer's lighting state\n\n\t\t\t\tuniforms.ambientLightColor.value = lights.state.ambient;\n\t\t\t\tuniforms.lightProbe.value = lights.state.probe;\n\t\t\t\tuniforms.directionalLights.value = lights.state.directional;\n\t\t\t\tuniforms.directionalLightShadows.value = lights.state.directionalShadow;\n\t\t\t\tuniforms.spotLights.value = lights.state.spot;\n\t\t\t\tuniforms.spotLightShadows.value = lights.state.spotShadow;\n\t\t\t\tuniforms.rectAreaLights.value = lights.state.rectArea;\n\t\t\t\tuniforms.ltc_1.value = lights.state.rectAreaLTC1;\n\t\t\t\tuniforms.ltc_2.value = lights.state.rectAreaLTC2;\n\t\t\t\tuniforms.pointLights.value = lights.state.point;\n\t\t\t\tuniforms.pointLightShadows.value = lights.state.pointShadow;\n\t\t\t\tuniforms.hemisphereLights.value = lights.state.hemi;\n\n\t\t\t\tuniforms.directionalShadowMap.value = lights.state.directionalShadowMap;\n\t\t\t\tuniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;\n\t\t\t\tuniforms.spotShadowMap.value = lights.state.spotShadowMap;\n\t\t\t\tuniforms.spotLightMatrix.value = lights.state.spotLightMatrix;\n\t\t\t\tuniforms.spotLightMap.value = lights.state.spotLightMap;\n\t\t\t\tuniforms.pointShadowMap.value = lights.state.pointShadowMap;\n\t\t\t\tuniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;\n\t\t\t\t// TODO (abelnation): add area lights shadow info to uniforms\n\n\t\t\t}\n\n\t\t\tmaterialProperties.currentProgram = program;\n\t\t\tmaterialProperties.uniformsList = null;\n\n\t\t\treturn program;\n\n\t\t}\n\n\t\tfunction getUniformList( materialProperties ) {\n\n\t\t\tif ( materialProperties.uniformsList === null ) {\n\n\t\t\t\tconst progUniforms = materialProperties.currentProgram.getUniforms();\n\t\t\t\tmaterialProperties.uniformsList = WebGLUniforms.seqWithValue( progUniforms.seq, materialProperties.uniforms );\n\n\t\t\t}\n\n\t\t\treturn materialProperties.uniformsList;\n\n\t\t}\n\n\t\tfunction updateCommonMaterialProperties( material, parameters ) {\n\n\t\t\tconst materialProperties = properties.get( material );\n\n\t\t\tmaterialProperties.outputColorSpace = parameters.outputColorSpace;\n\t\t\tmaterialProperties.instancing = parameters.instancing;\n\t\t\tmaterialProperties.instancingColor = parameters.instancingColor;\n\t\t\tmaterialProperties.skinning = parameters.skinning;\n\t\t\tmaterialProperties.morphTargets = parameters.morphTargets;\n\t\t\tmaterialProperties.morphNormals = parameters.morphNormals;\n\t\t\tmaterialProperties.morphColors = parameters.morphColors;\n\t\t\tmaterialProperties.morphTargetsCount = parameters.morphTargetsCount;\n\t\t\tmaterialProperties.numClippingPlanes = parameters.numClippingPlanes;\n\t\t\tmaterialProperties.numIntersection = parameters.numClipIntersection;\n\t\t\tmaterialProperties.vertexAlphas = parameters.vertexAlphas;\n\t\t\tmaterialProperties.vertexTangents = parameters.vertexTangents;\n\t\t\tmaterialProperties.toneMapping = parameters.toneMapping;\n\n\t\t}\n\n\t\tfunction setProgram( camera, scene, geometry, material, object ) {\n\n\t\t\tif ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n\n\t\t\ttextures.resetTextureUnits();\n\n\t\t\tconst fog = scene.fog;\n\t\t\tconst environment = material.isMeshStandardMaterial ? scene.environment : null;\n\t\t\tconst colorSpace = ( _currentRenderTarget === null ) ? _this.outputColorSpace : ( _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace );\n\t\t\tconst envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );\n\t\t\tconst vertexAlphas = material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;\n\t\t\tconst vertexTangents = !! geometry.attributes.tangent && ( !! material.normalMap || material.anisotropy > 0 );\n\t\t\tconst morphTargets = !! geometry.morphAttributes.position;\n\t\t\tconst morphNormals = !! geometry.morphAttributes.normal;\n\t\t\tconst morphColors = !! geometry.morphAttributes.color;\n\n\t\t\tlet toneMapping = NoToneMapping;\n\n\t\t\tif ( material.toneMapped ) {\n\n\t\t\t\tif ( _currentRenderTarget === null || _currentRenderTarget.isXRRenderTarget === true ) {\n\n\t\t\t\t\ttoneMapping = _this.toneMapping;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\t\tconst materialProperties = properties.get( material );\n\t\t\tconst lights = currentRenderState.state.lights;\n\n\t\t\tif ( _clippingEnabled === true ) {\n\n\t\t\t\tif ( _localClippingEnabled === true || camera !== _currentCamera ) {\n\n\t\t\t\t\tconst useCache =\n\t\t\t\t\t\tcamera === _currentCamera &&\n\t\t\t\t\t\tmaterial.id === _currentMaterialId;\n\n\t\t\t\t\t// we might want to call this function with some ClippingGroup\n\t\t\t\t\t// object instead of the material, once it becomes feasible\n\t\t\t\t\t// (#8465, #8379)\n\t\t\t\t\tclipping.setState( material, camera, useCache );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet needsProgramChange = false;\n\n\t\t\tif ( material.version === materialProperties.__version ) {\n\n\t\t\t\tif ( materialProperties.needsLights && ( materialProperties.lightsStateVersion !== lights.state.version ) ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.outputColorSpace !== colorSpace ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancing === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isInstancedMesh && materialProperties.instancing === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isSkinnedMesh && materialProperties.skinning === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isSkinnedMesh && materialProperties.skinning === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingColor === true && object.instanceColor === null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingColor === false && object.instanceColor !== null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.envMap !== envMap ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( material.fog === true && materialProperties.fog !== fog ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.numClippingPlanes !== undefined &&\n\t\t\t\t\t( materialProperties.numClippingPlanes !== clipping.numPlanes ||\n\t\t\t\t\tmaterialProperties.numIntersection !== clipping.numIntersection ) ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.vertexAlphas !== vertexAlphas ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.vertexTangents !== vertexTangents ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphTargets !== morphTargets ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphNormals !== morphNormals ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphColors !== morphColors ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.toneMapping !== toneMapping ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( capabilities.isWebGL2 === true && materialProperties.morphTargetsCount !== morphTargetsCount ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tneedsProgramChange = true;\n\t\t\t\tmaterialProperties.__version = material.version;\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet program = materialProperties.currentProgram;\n\n\t\t\tif ( needsProgramChange === true ) {\n\n\t\t\t\tprogram = getProgram( material, scene, object );\n\n\t\t\t}\n\n\t\t\tlet refreshProgram = false;\n\t\t\tlet refreshMaterial = false;\n\t\t\tlet refreshLights = false;\n\n\t\t\tconst p_uniforms = program.getUniforms(),\n\t\t\t\tm_uniforms = materialProperties.uniforms;\n\n\t\t\tif ( state.useProgram( program.program ) ) {\n\n\t\t\t\trefreshProgram = true;\n\t\t\t\trefreshMaterial = true;\n\t\t\t\trefreshLights = true;\n\n\t\t\t}\n\n\t\t\tif ( material.id !== _currentMaterialId ) {\n\n\t\t\t\t_currentMaterialId = material.id;\n\n\t\t\t\trefreshMaterial = true;\n\n\t\t\t}\n\n\t\t\tif ( refreshProgram || _currentCamera !== camera ) {\n\n\t\t\t\t// common camera uniforms\n\n\t\t\t\tp_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );\n\t\t\t\tp_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );\n\n\t\t\t\tconst uCamPos = p_uniforms.map.cameraPosition;\n\n\t\t\t\tif ( uCamPos !== undefined ) {\n\n\t\t\t\t\tuCamPos.setValue( _gl, _vector3.setFromMatrixPosition( camera.matrixWorld ) );\n\n\t\t\t\t}\n\n\t\t\t\tif ( capabilities.logarithmicDepthBuffer ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'logDepthBufFC',\n\t\t\t\t\t\t2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );\n\n\t\t\t\t}\n\n\t\t\t\t// consider moving isOrthographic to UniformLib and WebGLMaterials, see https://github.com/mrdoob/three.js/pull/26467#issuecomment-1645185067\n\n\t\t\t\tif ( material.isMeshPhongMaterial ||\n\t\t\t\t\tmaterial.isMeshToonMaterial ||\n\t\t\t\t\tmaterial.isMeshLambertMaterial ||\n\t\t\t\t\tmaterial.isMeshBasicMaterial ||\n\t\t\t\t\tmaterial.isMeshStandardMaterial ||\n\t\t\t\t\tmaterial.isShaderMaterial ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'isOrthographic', camera.isOrthographicCamera === true );\n\n\t\t\t\t}\n\n\t\t\t\tif ( _currentCamera !== camera ) {\n\n\t\t\t\t\t_currentCamera = camera;\n\n\t\t\t\t\t// lighting uniforms depend on the camera so enforce an update\n\t\t\t\t\t// now, in case this material supports lights - or later, when\n\t\t\t\t\t// the next material that does gets activated:\n\n\t\t\t\t\trefreshMaterial = true;\t\t// set to true on material change\n\t\t\t\t\trefreshLights = true;\t\t// remains set until update done\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// skinning and morph target uniforms must be set even if material didn't change\n\t\t\t// auto-setting of texture unit for bone and morph texture must go before other textures\n\t\t\t// otherwise textures used for skinning and morphing can take over texture units reserved for other material textures\n\n\t\t\tif ( object.isSkinnedMesh ) {\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrix' );\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrixInverse' );\n\n\t\t\t\tconst skeleton = object.skeleton;\n\n\t\t\t\tif ( skeleton ) {\n\n\t\t\t\t\tif ( capabilities.floatVertexTextures ) {\n\n\t\t\t\t\t\tif ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();\n\n\t\t\t\t\t\tp_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );\n\t\t\t\t\t\tp_uniforms.setValue( _gl, 'boneTextureSize', skeleton.boneTextureSize );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst morphAttributes = geometry.morphAttributes;\n\n\t\t\tif ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined && capabilities.isWebGL2 === true ) ) {\n\n\t\t\t\tmorphtargets.update( object, geometry, program );\n\n\t\t\t}\n\n\t\t\tif ( refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow ) {\n\n\t\t\t\tmaterialProperties.receiveShadow = object.receiveShadow;\n\t\t\t\tp_uniforms.setValue( _gl, 'receiveShadow', object.receiveShadow );\n\n\t\t\t}\n\n\t\t\t// https://github.com/mrdoob/three.js/pull/24467#issuecomment-1209031512\n\n\t\t\tif ( material.isMeshGouraudMaterial && material.envMap !== null ) {\n\n\t\t\t\tm_uniforms.envMap.value = envMap;\n\n\t\t\t\tm_uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t\t}\n\n\t\t\tif ( refreshMaterial ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );\n\n\t\t\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t\t\t// the current material requires lighting info\n\n\t\t\t\t\t// note: all lighting uniforms are always set correctly\n\t\t\t\t\t// they simply reference the renderer's state for their\n\t\t\t\t\t// values\n\t\t\t\t\t//\n\t\t\t\t\t// use the current material's .needsUpdate flags to set\n\t\t\t\t\t// the GL state when required\n\n\t\t\t\t\tmarkUniformsLightsNeedsUpdate( m_uniforms, refreshLights );\n\n\t\t\t\t}\n\n\t\t\t\t// refresh uniforms common to several materials\n\n\t\t\t\tif ( fog && material.fog === true ) {\n\n\t\t\t\t\tmaterials.refreshFogUniforms( m_uniforms, fog );\n\n\t\t\t\t}\n\n\t\t\t\tmaterials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, _transmissionRenderTarget );\n\n\t\t\t\tWebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );\n\n\t\t\t}\n\n\t\t\tif ( material.isShaderMaterial && material.uniformsNeedUpdate === true ) {\n\n\t\t\t\tWebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );\n\t\t\t\tmaterial.uniformsNeedUpdate = false;\n\n\t\t\t}\n\n\t\t\tif ( material.isSpriteMaterial ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'center', object.center );\n\n\t\t\t}\n\n\t\t\t// common matrices\n\n\t\t\tp_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );\n\t\t\tp_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );\n\t\t\tp_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld );\n\n\t\t\t// UBOs\n\n\t\t\tif ( material.isShaderMaterial || material.isRawShaderMaterial ) {\n\n\t\t\t\tconst groups = material.uniformsGroups;\n\n\t\t\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\t\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t\t\t\tconst group = groups[ i ];\n\n\t\t\t\t\t\tuniformsGroups.update( group, program );\n\t\t\t\t\t\tuniformsGroups.bind( group, program );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn program;\n\n\t\t}\n\n\t\t// If uniforms are marked as clean, they don't need to be loaded to the GPU.\n\n\t\tfunction markUniformsLightsNeedsUpdate( uniforms, value ) {\n\n\t\t\tuniforms.ambientLightColor.needsUpdate = value;\n\t\t\tuniforms.lightProbe.needsUpdate = value;\n\n\t\t\tuniforms.directionalLights.needsUpdate = value;\n\t\t\tuniforms.directionalLightShadows.needsUpdate = value;\n\t\t\tuniforms.pointLights.needsUpdate = value;\n\t\t\tuniforms.pointLightShadows.needsUpdate = value;\n\t\t\tuniforms.spotLights.needsUpdate = value;\n\t\t\tuniforms.spotLightShadows.needsUpdate = value;\n\t\t\tuniforms.rectAreaLights.needsUpdate = value;\n\t\t\tuniforms.hemisphereLights.needsUpdate = value;\n\n\t\t}\n\n\t\tfunction materialNeedsLights( material ) {\n\n\t\t\treturn material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial ||\n\t\t\t\tmaterial.isMeshStandardMaterial || material.isShadowMaterial ||\n\t\t\t\t( material.isShaderMaterial && material.lights === true );\n\n\t\t}\n\n\t\tthis.getActiveCubeFace = function () {\n\n\t\t\treturn _currentActiveCubeFace;\n\n\t\t};\n\n\t\tthis.getActiveMipmapLevel = function () {\n\n\t\t\treturn _currentActiveMipmapLevel;\n\n\t\t};\n\n\t\tthis.getRenderTarget = function () {\n\n\t\t\treturn _currentRenderTarget;\n\n\t\t};\n\n\t\tthis.setRenderTargetTextures = function ( renderTarget, colorTexture, depthTexture ) {\n\n\t\t\tproperties.get( renderTarget.texture ).__webglTexture = colorTexture;\n\t\t\tproperties.get( renderTarget.depthTexture ).__webglTexture = depthTexture;\n\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\trenderTargetProperties.__hasExternalTextures = true;\n\n\t\t\tif ( renderTargetProperties.__hasExternalTextures ) {\n\n\t\t\t\trenderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;\n\n\t\t\t\tif ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {\n\n\t\t\t\t\t// The multisample_render_to_texture extension doesn't work properly if there\n\t\t\t\t\t// are midframe flushes and an external depth buffer. Disable use of the extension.\n\t\t\t\t\tif ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );\n\t\t\t\t\t\trenderTargetProperties.__useRenderToTexture = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.setRenderTargetFramebuffer = function ( renderTarget, defaultFramebuffer ) {\n\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\trenderTargetProperties.__webglFramebuffer = defaultFramebuffer;\n\t\t\trenderTargetProperties.__useDefaultFramebuffer = defaultFramebuffer === undefined;\n\n\t\t};\n\n\t\tthis.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {\n\n\t\t\t_currentRenderTarget = renderTarget;\n\t\t\t_currentActiveCubeFace = activeCubeFace;\n\t\t\t_currentActiveMipmapLevel = activeMipmapLevel;\n\n\t\t\tlet useDefaultFramebuffer = true;\n\t\t\tlet framebuffer = null;\n\t\t\tlet isCube = false;\n\t\t\tlet isRenderTarget3D = false;\n\n\t\t\tif ( renderTarget ) {\n\n\t\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\t\t\tif ( renderTargetProperties.__useDefaultFramebuffer !== undefined ) {\n\n\t\t\t\t\t// We need to make sure to rebind the framebuffer.\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\t\t\t\t\tuseDefaultFramebuffer = false;\n\n\t\t\t\t} else if ( renderTargetProperties.__webglFramebuffer === undefined ) {\n\n\t\t\t\t\ttextures.setupRenderTarget( renderTarget );\n\n\t\t\t\t} else if ( renderTargetProperties.__hasExternalTextures ) {\n\n\t\t\t\t\t// Color and depth texture must be rebound in order for the swapchain to update.\n\t\t\t\t\ttextures.rebindTextures( renderTarget, properties.get( renderTarget.texture ).__webglTexture, properties.get( renderTarget.depthTexture ).__webglTexture );\n\n\t\t\t\t}\n\n\t\t\t\tconst texture = renderTarget.texture;\n\n\t\t\t\tif ( texture.isData3DTexture || texture.isDataArrayTexture || texture.isCompressedArrayTexture ) {\n\n\t\t\t\t\tisRenderTarget3D = true;\n\n\t\t\t\t}\n\n\t\t\t\tconst __webglFramebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\n\t\t\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\n\n\t\t\t\t\tif ( Array.isArray( __webglFramebuffer[ activeCubeFace ] ) ) {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeCubeFace ][ activeMipmapLevel ];\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeCubeFace ];\n\n\t\t\t\t\t}\n\n\t\t\t\t\tisCube = true;\n\n\t\t\t\t} else if ( ( capabilities.isWebGL2 && renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\t\tframebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( Array.isArray( __webglFramebuffer ) ) {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeMipmapLevel ];\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t_currentViewport.copy( renderTarget.viewport );\n\t\t\t\t_currentScissor.copy( renderTarget.scissor );\n\t\t\t\t_currentScissorTest = renderTarget.scissorTest;\n\n\t\t\t} else {\n\n\t\t\t\t_currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor();\n\t\t\t\t_currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor();\n\t\t\t\t_currentScissorTest = _scissorTest;\n\n\t\t\t}\n\n\t\t\tconst framebufferBound = state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\tif ( framebufferBound && capabilities.drawBuffers && useDefaultFramebuffer ) {\n\n\t\t\t\tstate.drawBuffers( renderTarget, framebuffer );\n\n\t\t\t}\n\n\t\t\tstate.viewport( _currentViewport );\n\t\t\tstate.scissor( _currentScissor );\n\t\t\tstate.setScissorTest( _currentScissorTest );\n\n\t\t\tif ( isCube ) {\n\n\t\t\t\tconst textureProperties = properties.get( renderTarget.texture );\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel );\n\n\t\t\t} else if ( isRenderTarget3D ) {\n\n\t\t\t\tconst textureProperties = properties.get( renderTarget.texture );\n\t\t\t\tconst layer = activeCubeFace || 0;\n\t\t\t\t_gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel || 0, layer );\n\n\t\t\t}\n\n\t\t\t_currentMaterialId = - 1; // reset current material to ensure correct uniform bindings\n\n\t\t};\n\n\t\tthis.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {\n\n\t\t\tif ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tlet framebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\n\t\t\tif ( renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined ) {\n\n\t\t\t\tframebuffer = framebuffer[ activeCubeFaceIndex ];\n\n\t\t\t}\n\n\t\t\tif ( framebuffer ) {\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\t\ttry {\n\n\t\t\t\t\tconst texture = renderTarget.texture;\n\t\t\t\t\tconst textureFormat = texture.format;\n\t\t\t\t\tconst textureType = texture.type;\n\n\t\t\t\t\tif ( textureFormat !== RGBAFormat && utils.convert( textureFormat ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_FORMAT ) ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || ( capabilities.isWebGL2 && extensions.has( 'EXT_color_buffer_float' ) ) );\n\n\t\t\t\t\tif ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)\n\t\t\t\t\t\t! ( textureType === FloatType && ( capabilities.isWebGL2 || extensions.has( 'OES_texture_float' ) || extensions.has( 'WEBGL_color_buffer_float' ) ) ) && // Chrome Mac >= 52 and Firefox\n\t\t\t\t\t\t! halfFloatSupportedByExt ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)\n\n\t\t\t\t\tif ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {\n\n\t\t\t\t\t\t_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), buffer );\n\n\t\t\t\t\t}\n\n\t\t\t\t} finally {\n\n\t\t\t\t\t// restore framebuffer of current render target if necessary\n\n\t\t\t\t\tconst framebuffer = ( _currentRenderTarget !== null ) ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.copyFramebufferToTexture = function ( position, texture, level = 0 ) {\n\n\t\t\tconst levelScale = Math.pow( 2, - level );\n\t\t\tconst width = Math.floor( texture.image.width * levelScale );\n\t\t\tconst height = Math.floor( texture.image.height * levelScale );\n\n\t\t\ttextures.setTexture2D( texture, 0 );\n\n\t\t\t_gl.copyTexSubImage2D( _gl.TEXTURE_2D, level, 0, 0, position.x, position.y, width, height );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.copyTextureToTexture = function ( position, srcTexture, dstTexture, level = 0 ) {\n\n\t\t\tconst width = srcTexture.image.width;\n\t\t\tconst height = srcTexture.image.height;\n\t\t\tconst glFormat = utils.convert( dstTexture.format );\n\t\t\tconst glType = utils.convert( dstTexture.type );\n\n\t\t\ttextures.setTexture2D( dstTexture, 0 );\n\n\t\t\t// As another texture upload may have changed pixelStorei\n\t\t\t// parameters, make sure they are correct for the dstTexture\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );\n\n\t\t\tif ( srcTexture.isDataTexture ) {\n\n\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, width, height, glFormat, glType, srcTexture.image.data );\n\n\t\t\t} else {\n\n\t\t\t\tif ( srcTexture.isCompressedTexture ) {\n\n\t\t\t\t\t_gl.compressedTexSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, srcTexture.mipmaps[ 0 ].width, srcTexture.mipmaps[ 0 ].height, glFormat, srcTexture.mipmaps[ 0 ].data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, glFormat, glType, srcTexture.image );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Generate mipmaps only when copying level 0\n\t\t\tif ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( _gl.TEXTURE_2D );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.copyTextureToTexture3D = function ( sourceBox, position, srcTexture, dstTexture, level = 0 ) {\n\n\t\t\tif ( _this.isWebGL1Renderer ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst width = sourceBox.max.x - sourceBox.min.x + 1;\n\t\t\tconst height = sourceBox.max.y - sourceBox.min.y + 1;\n\t\t\tconst depth = sourceBox.max.z - sourceBox.min.z + 1;\n\t\t\tconst glFormat = utils.convert( dstTexture.format );\n\t\t\tconst glType = utils.convert( dstTexture.type );\n\t\t\tlet glTarget;\n\n\t\t\tif ( dstTexture.isData3DTexture ) {\n\n\t\t\t\ttextures.setTexture3D( dstTexture, 0 );\n\t\t\t\tglTarget = _gl.TEXTURE_3D;\n\n\t\t\t} else if ( dstTexture.isDataArrayTexture ) {\n\n\t\t\t\ttextures.setTexture2DArray( dstTexture, 0 );\n\t\t\t\tglTarget = _gl.TEXTURE_2D_ARRAY;\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );\n\n\t\t\tconst unpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );\n\t\t\tconst unpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );\n\t\t\tconst unpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );\n\t\t\tconst unpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );\n\t\t\tconst unpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );\n\n\t\t\tconst image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ 0 ] : srcTexture.image;\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, sourceBox.min.x );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, sourceBox.min.y );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, sourceBox.min.z );\n\n\t\t\tif ( srcTexture.isDataTexture || srcTexture.isData3DTexture ) {\n\n\t\t\t\t_gl.texSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data );\n\n\t\t\t} else {\n\n\t\t\t\tif ( srcTexture.isCompressedArrayTexture ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.' );\n\t\t\t\t\t_gl.compressedTexSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.texSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, unpackRowLen );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, unpackImageHeight );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, unpackSkipPixels );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, unpackSkipRows );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, unpackSkipImages );\n\n\t\t\t// Generate mipmaps only when copying level 0\n\t\t\tif ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( glTarget );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.initTexture = function ( texture ) {\n\n\t\t\tif ( texture.isCubeTexture ) {\n\n\t\t\t\ttextures.setTextureCube( texture, 0 );\n\n\t\t\t} else if ( texture.isData3DTexture ) {\n\n\t\t\t\ttextures.setTexture3D( texture, 0 );\n\n\t\t\t} else if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) {\n\n\t\t\t\ttextures.setTexture2DArray( texture, 0 );\n\n\t\t\t} else {\n\n\t\t\t\ttextures.setTexture2D( texture, 0 );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.resetState = function () {\n\n\t\t\t_currentActiveCubeFace = 0;\n\t\t\t_currentActiveMipmapLevel = 0;\n\t\t\t_currentRenderTarget = null;\n\n\t\t\tstate.reset();\n\t\t\tbindingStates.reset();\n\n\t\t};\n\n\t\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );\n\n\t\t}\n\n\t}\n\n\tget coordinateSystem() {\n\n\t\treturn WebGLCoordinateSystem;\n\n\t}\n\n\tget outputColorSpace() {\n\n\t\treturn this._outputColorSpace;\n\n\t}\n\n\tset outputColorSpace( colorSpace ) {\n\n\t\tthis._outputColorSpace = colorSpace;\n\n\t\tconst gl = this.getContext();\n\t\tgl.drawingBufferColorSpace = colorSpace === DisplayP3ColorSpace ? 'display-p3' : 'srgb';\n\t\tgl.unpackColorSpace = ColorManagement.workingColorSpace === LinearDisplayP3ColorSpace ? 'display-p3' : 'srgb';\n\n\t}\n\n\tget physicallyCorrectLights() { // @deprecated, r150\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );\n\t\treturn ! this.useLegacyLights;\n\n\t}\n\n\tset physicallyCorrectLights( value ) { // @deprecated, r150\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );\n\t\tthis.useLegacyLights = ! value;\n\n\t}\n\n\tget outputEncoding() { // @deprecated, r152\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );\n\t\treturn this.outputColorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;\n\n\t}\n\n\tset outputEncoding( encoding ) { // @deprecated, r152\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );\n\t\tthis.outputColorSpace = encoding === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;\n\n\t}\n\n\tget useLegacyLights() { // @deprecated, r155\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );\n\t\treturn this._useLegacyLights;\n\n\t}\n\n\tset useLegacyLights( value ) { // @deprecated, r155\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );\n\t\tthis._useLegacyLights = value;\n\n\t}\n\n}\n\nclass WebGL1Renderer extends WebGLRenderer {}\n\nWebGL1Renderer.prototype.isWebGL1Renderer = true;\n\nclass FogExp2 {\n\n\tconstructor( color, density = 0.00025 ) {\n\n\t\tthis.isFogExp2 = true;\n\n\t\tthis.name = '';\n\n\t\tthis.color = new Color( color );\n\t\tthis.density = density;\n\n\t}\n\n\tclone() {\n\n\t\treturn new FogExp2( this.color, this.density );\n\n\t}\n\n\ttoJSON( /* meta */ ) {\n\n\t\treturn {\n\t\t\ttype: 'FogExp2',\n\t\t\tname: this.name,\n\t\t\tcolor: this.color.getHex(),\n\t\t\tdensity: this.density\n\t\t};\n\n\t}\n\n}\n\nclass Fog {\n\n\tconstructor( color, near = 1, far = 1000 ) {\n\n\t\tthis.isFog = true;\n\n\t\tthis.name = '';\n\n\t\tthis.color = new Color( color );\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Fog( this.color, this.near, this.far );\n\n\t}\n\n\ttoJSON( /* meta */ ) {\n\n\t\treturn {\n\t\t\ttype: 'Fog',\n\t\t\tname: this.name,\n\t\t\tcolor: this.color.getHex(),\n\t\t\tnear: this.near,\n\t\t\tfar: this.far\n\t\t};\n\n\t}\n\n}\n\nclass Scene extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isScene = true;\n\n\t\tthis.type = 'Scene';\n\n\t\tthis.background = null;\n\t\tthis.environment = null;\n\t\tthis.fog = null;\n\n\t\tthis.backgroundBlurriness = 0;\n\t\tthis.backgroundIntensity = 1;\n\n\t\tthis.overrideMaterial = null;\n\n\t\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.background !== null ) this.background = source.background.clone();\n\t\tif ( source.environment !== null ) this.environment = source.environment.clone();\n\t\tif ( source.fog !== null ) this.fog = source.fog.clone();\n\n\t\tthis.backgroundBlurriness = source.backgroundBlurriness;\n\t\tthis.backgroundIntensity = source.backgroundIntensity;\n\n\t\tif ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.fog !== null ) data.object.fog = this.fog.toJSON();\n\t\tif ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;\n\t\tif ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass InterleavedBuffer {\n\n\tconstructor( array, stride ) {\n\n\t\tthis.isInterleavedBuffer = true;\n\n\t\tthis.array = array;\n\t\tthis.stride = stride;\n\t\tthis.count = array !== undefined ? array.length / stride : 0;\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis.updateRange = { offset: 0, count: - 1 };\n\n\t\tthis.version = 0;\n\n\t\tthis.uuid = generateUUID();\n\n\t}\n\n\tonUploadCallback() {}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.array = new source.array.constructor( source.array );\n\t\tthis.count = source.count;\n\t\tthis.stride = source.stride;\n\t\tthis.usage = source.usage;\n\n\t\treturn this;\n\n\t}\n\n\tcopyAt( index1, attribute, index2 ) {\n\n\t\tindex1 *= this.stride;\n\t\tindex2 *= attribute.stride;\n\n\t\tfor ( let i = 0, l = this.stride; i < l; i ++ ) {\n\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tset( value, offset = 0 ) {\n\n\t\tthis.array.set( value, offset );\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tif ( data.arrayBuffers === undefined ) {\n\n\t\t\tdata.arrayBuffers = {};\n\n\t\t}\n\n\t\tif ( this.array.buffer._uuid === undefined ) {\n\n\t\t\tthis.array.buffer._uuid = generateUUID();\n\n\t\t}\n\n\t\tif ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {\n\n\t\t\tdata.arrayBuffers[ this.array.buffer._uuid ] = this.array.slice( 0 ).buffer;\n\n\t\t}\n\n\t\tconst array = new this.array.constructor( data.arrayBuffers[ this.array.buffer._uuid ] );\n\n\t\tconst ib = new this.constructor( array, this.stride );\n\t\tib.setUsage( this.usage );\n\n\t\treturn ib;\n\n\t}\n\n\tonUpload( callback ) {\n\n\t\tthis.onUploadCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tif ( data.arrayBuffers === undefined ) {\n\n\t\t\tdata.arrayBuffers = {};\n\n\t\t}\n\n\t\t// generate UUID for array buffer if necessary\n\n\t\tif ( this.array.buffer._uuid === undefined ) {\n\n\t\t\tthis.array.buffer._uuid = generateUUID();\n\n\t\t}\n\n\t\tif ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {\n\n\t\t\tdata.arrayBuffers[ this.array.buffer._uuid ] = Array.from( new Uint32Array( this.array.buffer ) );\n\n\t\t}\n\n\t\t//\n\n\t\treturn {\n\t\t\tuuid: this.uuid,\n\t\t\tbuffer: this.array.buffer._uuid,\n\t\t\ttype: this.array.constructor.name,\n\t\t\tstride: this.stride\n\t\t};\n\n\t}\n\n}\n\nconst _vector$5 = /*@__PURE__*/ new Vector3();\n\nclass InterleavedBufferAttribute {\n\n\tconstructor( interleavedBuffer, itemSize, offset, normalized = false ) {\n\n\t\tthis.isInterleavedBufferAttribute = true;\n\n\t\tthis.name = '';\n\n\t\tthis.data = interleavedBuffer;\n\t\tthis.itemSize = itemSize;\n\t\tthis.offset = offset;\n\n\t\tthis.normalized = normalized;\n\n\t}\n\n\tget count() {\n\n\t\treturn this.data.count;\n\n\t}\n\n\tget array() {\n\n\t\treturn this.data.array;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tthis.data.needsUpdate = value;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tfor ( let i = 0, l = this.data.count; i < l; i ++ ) {\n\n\t\t\t_vector$5.fromBufferAttribute( this, i );\n\n\t\t\t_vector$5.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$5.x, _vector$5.y, _vector$5.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$5.fromBufferAttribute( this, i );\n\n\t\t\t_vector$5.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$5.x, _vector$5.y, _vector$5.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$5.fromBufferAttribute( this, i );\n\n\t\t\t_vector$5.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$5.x, _vector$5.y, _vector$5.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset ] = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = this.data.array[ index * this.data.stride + this.offset ];\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = this.data.array[ index * this.data.stride + this.offset + 1 ];\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = this.data.array[ index * this.data.stride + this.offset + 2 ];\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = this.data.array[ index * this.data.stride + this.offset + 3 ];\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\t\tthis.data.array[ index + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\t\tthis.data.array[ index + 2 ] = z;\n\t\tthis.data.array[ index + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tif ( data === undefined ) {\n\n\t\t\tconsole.log( 'THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.' );\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0; i < this.count; i ++ ) {\n\n\t\t\t\tconst index = i * this.data.stride + this.offset;\n\n\t\t\t\tfor ( let j = 0; j < this.itemSize; j ++ ) {\n\n\t\t\t\t\tarray.push( this.data.array[ index + j ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new BufferAttribute( new this.array.constructor( array ), this.itemSize, this.normalized );\n\n\t\t} else {\n\n\t\t\tif ( data.interleavedBuffers === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers = {};\n\n\t\t\t}\n\n\t\t\tif ( data.interleavedBuffers[ this.data.uuid ] === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers[ this.data.uuid ] = this.data.clone( data );\n\n\t\t\t}\n\n\t\t\treturn new InterleavedBufferAttribute( data.interleavedBuffers[ this.data.uuid ], this.itemSize, this.offset, this.normalized );\n\n\t\t}\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tif ( data === undefined ) {\n\n\t\t\tconsole.log( 'THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.' );\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0; i < this.count; i ++ ) {\n\n\t\t\t\tconst index = i * this.data.stride + this.offset;\n\n\t\t\t\tfor ( let j = 0; j < this.itemSize; j ++ ) {\n\n\t\t\t\t\tarray.push( this.data.array[ index + j ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// de-interleave data and save it as an ordinary buffer attribute for now\n\n\t\t\treturn {\n\t\t\t\titemSize: this.itemSize,\n\t\t\t\ttype: this.array.constructor.name,\n\t\t\t\tarray: array,\n\t\t\t\tnormalized: this.normalized\n\t\t\t};\n\n\t\t} else {\n\n\t\t\t// save as true interleaved attribute\n\n\t\t\tif ( data.interleavedBuffers === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers = {};\n\n\t\t\t}\n\n\t\t\tif ( data.interleavedBuffers[ this.data.uuid ] === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers[ this.data.uuid ] = this.data.toJSON( data );\n\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tisInterleavedBufferAttribute: true,\n\t\t\t\titemSize: this.itemSize,\n\t\t\t\tdata: this.data.uuid,\n\t\t\t\toffset: this.offset,\n\t\t\t\tnormalized: this.normalized\n\t\t\t};\n\n\t\t}\n\n\t}\n\n}\n\nclass SpriteMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isSpriteMaterial = true;\n\n\t\tthis.type = 'SpriteMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.rotation = 0;\n\n\t\tthis.sizeAttenuation = true;\n\n\t\tthis.transparent = true;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.rotation = source.rotation;\n\n\t\tthis.sizeAttenuation = source.sizeAttenuation;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nlet _geometry;\n\nconst _intersectPoint = /*@__PURE__*/ new Vector3();\nconst _worldScale = /*@__PURE__*/ new Vector3();\nconst _mvPosition = /*@__PURE__*/ new Vector3();\n\nconst _alignedPosition = /*@__PURE__*/ new Vector2();\nconst _rotatedPosition = /*@__PURE__*/ new Vector2();\nconst _viewWorldMatrix = /*@__PURE__*/ new Matrix4();\n\nconst _vA = /*@__PURE__*/ new Vector3();\nconst _vB = /*@__PURE__*/ new Vector3();\nconst _vC = /*@__PURE__*/ new Vector3();\n\nconst _uvA = /*@__PURE__*/ new Vector2();\nconst _uvB = /*@__PURE__*/ new Vector2();\nconst _uvC = /*@__PURE__*/ new Vector2();\n\nclass Sprite extends Object3D {\n\n\tconstructor( material = new SpriteMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isSprite = true;\n\n\t\tthis.type = 'Sprite';\n\n\t\tif ( _geometry === undefined ) {\n\n\t\t\t_geometry = new BufferGeometry();\n\n\t\t\tconst float32Array = new Float32Array( [\n\t\t\t\t- 0.5, - 0.5, 0, 0, 0,\n\t\t\t\t0.5, - 0.5, 0, 1, 0,\n\t\t\t\t0.5, 0.5, 0, 1, 1,\n\t\t\t\t- 0.5, 0.5, 0, 0, 1\n\t\t\t] );\n\n\t\t\tconst interleavedBuffer = new InterleavedBuffer( float32Array, 5 );\n\n\t\t\t_geometry.setIndex( [ 0, 1, 2,\t0, 2, 3 ] );\n\t\t\t_geometry.setAttribute( 'position', new InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );\n\t\t\t_geometry.setAttribute( 'uv', new InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );\n\n\t\t}\n\n\t\tthis.geometry = _geometry;\n\t\tthis.material = material;\n\n\t\tthis.center = new Vector2( 0.5, 0.5 );\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tif ( raycaster.camera === null ) {\n\n\t\t\tconsole.error( 'THREE.Sprite: \"Raycaster.camera\" needs to be set in order to raycast against sprites.' );\n\n\t\t}\n\n\t\t_worldScale.setFromMatrixScale( this.matrixWorld );\n\n\t\t_viewWorldMatrix.copy( raycaster.camera.matrixWorld );\n\t\tthis.modelViewMatrix.multiplyMatrices( raycaster.camera.matrixWorldInverse, this.matrixWorld );\n\n\t\t_mvPosition.setFromMatrixPosition( this.modelViewMatrix );\n\n\t\tif ( raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false ) {\n\n\t\t\t_worldScale.multiplyScalar( - _mvPosition.z );\n\n\t\t}\n\n\t\tconst rotation = this.material.rotation;\n\t\tlet sin, cos;\n\n\t\tif ( rotation !== 0 ) {\n\n\t\t\tcos = Math.cos( rotation );\n\t\t\tsin = Math.sin( rotation );\n\n\t\t}\n\n\t\tconst center = this.center;\n\n\t\ttransformVertex( _vA.set( - 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\ttransformVertex( _vB.set( 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\ttransformVertex( _vC.set( 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\n\t\t_uvA.set( 0, 0 );\n\t\t_uvB.set( 1, 0 );\n\t\t_uvC.set( 1, 1 );\n\n\t\t// check first triangle\n\t\tlet intersect = raycaster.ray.intersectTriangle( _vA, _vB, _vC, false, _intersectPoint );\n\n\t\tif ( intersect === null ) {\n\n\t\t\t// check second triangle\n\t\t\ttransformVertex( _vB.set( - 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\t\t_uvB.set( 0, 1 );\n\n\t\t\tintersect = raycaster.ray.intersectTriangle( _vA, _vC, _vB, false, _intersectPoint );\n\t\t\tif ( intersect === null ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst distance = raycaster.ray.origin.distanceTo( _intersectPoint );\n\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\t\tintersects.push( {\n\n\t\t\tdistance: distance,\n\t\t\tpoint: _intersectPoint.clone(),\n\t\t\tuv: Triangle.getInterpolation( _intersectPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() ),\n\t\t\tface: null,\n\t\t\tobject: this\n\n\t\t} );\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.center !== undefined ) this.center.copy( source.center );\n\n\t\tthis.material = source.material;\n\n\t\treturn this;\n\n\t}\n\n}\n\nfunction transformVertex( vertexPosition, mvPosition, center, scale, sin, cos ) {\n\n\t// compute position in camera space\n\t_alignedPosition.subVectors( vertexPosition, center ).addScalar( 0.5 ).multiply( scale );\n\n\t// to check if rotation is not zero\n\tif ( sin !== undefined ) {\n\n\t\t_rotatedPosition.x = ( cos * _alignedPosition.x ) - ( sin * _alignedPosition.y );\n\t\t_rotatedPosition.y = ( sin * _alignedPosition.x ) + ( cos * _alignedPosition.y );\n\n\t} else {\n\n\t\t_rotatedPosition.copy( _alignedPosition );\n\n\t}\n\n\n\tvertexPosition.copy( mvPosition );\n\tvertexPosition.x += _rotatedPosition.x;\n\tvertexPosition.y += _rotatedPosition.y;\n\n\t// transform to world space\n\tvertexPosition.applyMatrix4( _viewWorldMatrix );\n\n}\n\nconst _v1$2 = /*@__PURE__*/ new Vector3();\nconst _v2$1 = /*@__PURE__*/ new Vector3();\n\nclass LOD extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis._currentLevel = 0;\n\n\t\tthis.type = 'LOD';\n\n\t\tObject.defineProperties( this, {\n\t\t\tlevels: {\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: []\n\t\t\t},\n\t\t\tisLOD: {\n\t\t\t\tvalue: true,\n\t\t\t}\n\t\t} );\n\n\t\tthis.autoUpdate = true;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source, false );\n\n\t\tconst levels = source.levels;\n\n\t\tfor ( let i = 0, l = levels.length; i < l; i ++ ) {\n\n\t\t\tconst level = levels[ i ];\n\n\t\t\tthis.addLevel( level.object.clone(), level.distance, level.hysteresis );\n\n\t\t}\n\n\t\tthis.autoUpdate = source.autoUpdate;\n\n\t\treturn this;\n\n\t}\n\n\taddLevel( object, distance = 0, hysteresis = 0 ) {\n\n\t\tdistance = Math.abs( distance );\n\n\t\tconst levels = this.levels;\n\n\t\tlet l;\n\n\t\tfor ( l = 0; l < levels.length; l ++ ) {\n\n\t\t\tif ( distance < levels[ l ].distance ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlevels.splice( l, 0, { distance: distance, hysteresis: hysteresis, object: object } );\n\n\t\tthis.add( object );\n\n\t\treturn this;\n\n\t}\n\n\tgetCurrentLevel() {\n\n\t\treturn this._currentLevel;\n\n\t}\n\n\n\n\tgetObjectForDistance( distance ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 0 ) {\n\n\t\t\tlet i, l;\n\n\t\t\tfor ( i = 1, l = levels.length; i < l; i ++ ) {\n\n\t\t\t\tlet levelDistance = levels[ i ].distance;\n\n\t\t\t\tif ( levels[ i ].object.visible ) {\n\n\t\t\t\t\tlevelDistance -= levelDistance * levels[ i ].hysteresis;\n\n\t\t\t\t}\n\n\t\t\t\tif ( distance < levelDistance ) {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn levels[ i - 1 ].object;\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 0 ) {\n\n\t\t\t_v1$2.setFromMatrixPosition( this.matrixWorld );\n\n\t\t\tconst distance = raycaster.ray.origin.distanceTo( _v1$2 );\n\n\t\t\tthis.getObjectForDistance( distance ).raycast( raycaster, intersects );\n\n\t\t}\n\n\t}\n\n\tupdate( camera ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 1 ) {\n\n\t\t\t_v1$2.setFromMatrixPosition( camera.matrixWorld );\n\t\t\t_v2$1.setFromMatrixPosition( this.matrixWorld );\n\n\t\t\tconst distance = _v1$2.distanceTo( _v2$1 ) / camera.zoom;\n\n\t\t\tlevels[ 0 ].object.visible = true;\n\n\t\t\tlet i, l;\n\n\t\t\tfor ( i = 1, l = levels.length; i < l; i ++ ) {\n\n\t\t\t\tlet levelDistance = levels[ i ].distance;\n\n\t\t\t\tif ( levels[ i ].object.visible ) {\n\n\t\t\t\t\tlevelDistance -= levelDistance * levels[ i ].hysteresis;\n\n\t\t\t\t}\n\n\t\t\t\tif ( distance >= levelDistance ) {\n\n\t\t\t\t\tlevels[ i - 1 ].object.visible = false;\n\t\t\t\t\tlevels[ i ].object.visible = true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._currentLevel = i - 1;\n\n\t\t\tfor ( ; i < l; i ++ ) {\n\n\t\t\t\tlevels[ i ].object.visible = false;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.autoUpdate === false ) data.object.autoUpdate = false;\n\n\t\tdata.object.levels = [];\n\n\t\tconst levels = this.levels;\n\n\t\tfor ( let i = 0, l = levels.length; i < l; i ++ ) {\n\n\t\t\tconst level = levels[ i ];\n\n\t\t\tdata.object.levels.push( {\n\t\t\t\tobject: level.object.uuid,\n\t\t\t\tdistance: level.distance,\n\t\t\t\thysteresis: level.hysteresis\n\t\t\t} );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst _basePosition = /*@__PURE__*/ new Vector3();\n\nconst _skinIndex = /*@__PURE__*/ new Vector4();\nconst _skinWeight = /*@__PURE__*/ new Vector4();\n\nconst _vector3 = /*@__PURE__*/ new Vector3();\nconst _matrix4 = /*@__PURE__*/ new Matrix4();\nconst _vertex = /*@__PURE__*/ new Vector3();\n\nconst _sphere$3 = /*@__PURE__*/ new Sphere();\nconst _inverseMatrix$2 = /*@__PURE__*/ new Matrix4();\nconst _ray$2 = /*@__PURE__*/ new Ray();\n\nclass SkinnedMesh extends Mesh {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isSkinnedMesh = true;\n\n\t\tthis.type = 'SkinnedMesh';\n\n\t\tthis.bindMode = AttachedBindMode;\n\t\tthis.bindMatrix = new Matrix4();\n\t\tthis.bindMatrixInverse = new Matrix4();\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tthis.boundingBox.makeEmpty();\n\n\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\n\n\t\t\tthis.getVertexPosition( i, _vertex );\n\t\t\tthis.boundingBox.expandByPoint( _vertex );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tthis.boundingSphere.makeEmpty();\n\n\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\n\n\t\t\tthis.getVertexPosition( i, _vertex );\n\t\t\tthis.boundingSphere.expandByPoint( _vertex );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.bindMode = source.bindMode;\n\t\tthis.bindMatrix.copy( source.bindMatrix );\n\t\tthis.bindMatrixInverse.copy( source.bindMatrixInverse );\n\n\t\tthis.skeleton = source.skeleton;\n\n\t\tif ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();\n\t\tif ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst material = this.material;\n\t\tconst matrixWorld = this.matrixWorld;\n\n\t\tif ( material === undefined ) return;\n\n\t\t// test with bounding sphere in world space\n\n\t\tif ( this.boundingSphere === null ) this.computeBoundingSphere();\n\n\t\t_sphere$3.copy( this.boundingSphere );\n\t\t_sphere$3.applyMatrix4( matrixWorld );\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$3 ) === false ) return;\n\n\t\t// convert ray to local space of skinned mesh\n\n\t\t_inverseMatrix$2.copy( matrixWorld ).invert();\n\t\t_ray$2.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$2 );\n\n\t\t// test with bounding box in local space\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tif ( _ray$2.intersectsBox( this.boundingBox ) === false ) return;\n\n\t\t}\n\n\t\t// test for intersections with geometry\n\n\t\tthis._computeIntersections( raycaster, intersects, _ray$2 );\n\n\t}\n\n\tgetVertexPosition( index, target ) {\n\n\t\tsuper.getVertexPosition( index, target );\n\n\t\tthis.applyBoneTransform( index, target );\n\n\t\treturn target;\n\n\t}\n\n\tbind( skeleton, bindMatrix ) {\n\n\t\tthis.skeleton = skeleton;\n\n\t\tif ( bindMatrix === undefined ) {\n\n\t\t\tthis.updateMatrixWorld( true );\n\n\t\t\tthis.skeleton.calculateInverses();\n\n\t\t\tbindMatrix = this.matrixWorld;\n\n\t\t}\n\n\t\tthis.bindMatrix.copy( bindMatrix );\n\t\tthis.bindMatrixInverse.copy( bindMatrix ).invert();\n\n\t}\n\n\tpose() {\n\n\t\tthis.skeleton.pose();\n\n\t}\n\n\tnormalizeSkinWeights() {\n\n\t\tconst vector = new Vector4();\n\n\t\tconst skinWeight = this.geometry.attributes.skinWeight;\n\n\t\tfor ( let i = 0, l = skinWeight.count; i < l; i ++ ) {\n\n\t\t\tvector.fromBufferAttribute( skinWeight, i );\n\n\t\t\tconst scale = 1.0 / vector.manhattanLength();\n\n\t\t\tif ( scale !== Infinity ) {\n\n\t\t\t\tvector.multiplyScalar( scale );\n\n\t\t\t} else {\n\n\t\t\t\tvector.set( 1, 0, 0, 0 ); // do something reasonable\n\n\t\t\t}\n\n\t\t\tskinWeight.setXYZW( i, vector.x, vector.y, vector.z, vector.w );\n\n\t\t}\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tif ( this.bindMode === AttachedBindMode ) {\n\n\t\t\tthis.bindMatrixInverse.copy( this.matrixWorld ).invert();\n\n\t\t} else if ( this.bindMode === DetachedBindMode ) {\n\n\t\t\tthis.bindMatrixInverse.copy( this.bindMatrix ).invert();\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.SkinnedMesh: Unrecognized bindMode: ' + this.bindMode );\n\n\t\t}\n\n\t}\n\n\tapplyBoneTransform( index, vector ) {\n\n\t\tconst skeleton = this.skeleton;\n\t\tconst geometry = this.geometry;\n\n\t\t_skinIndex.fromBufferAttribute( geometry.attributes.skinIndex, index );\n\t\t_skinWeight.fromBufferAttribute( geometry.attributes.skinWeight, index );\n\n\t\t_basePosition.copy( vector ).applyMatrix4( this.bindMatrix );\n\n\t\tvector.set( 0, 0, 0 );\n\n\t\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\t\tconst weight = _skinWeight.getComponent( i );\n\n\t\t\tif ( weight !== 0 ) {\n\n\t\t\t\tconst boneIndex = _skinIndex.getComponent( i );\n\n\t\t\t\t_matrix4.multiplyMatrices( skeleton.bones[ boneIndex ].matrixWorld, skeleton.boneInverses[ boneIndex ] );\n\n\t\t\t\tvector.addScaledVector( _vector3.copy( _basePosition ).applyMatrix4( _matrix4 ), weight );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn vector.applyMatrix4( this.bindMatrixInverse );\n\n\t}\n\n\tboneTransform( index, vector ) { // @deprecated, r151\n\n\t\tconsole.warn( 'THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151.' );\n\t\treturn this.applyBoneTransform( index, vector );\n\n\t}\n\n\n}\n\nclass Bone extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isBone = true;\n\n\t\tthis.type = 'Bone';\n\n\t}\n\n}\n\nclass DataTexture extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, format, type, mapping, wrapS, wrapT, magFilter = NearestFilter, minFilter = NearestFilter, anisotropy, colorSpace ) {\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\tthis.isDataTexture = true;\n\n\t\tthis.image = { data: data, width: width, height: height };\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t}\n\n}\n\nconst _offsetMatrix = /*@__PURE__*/ new Matrix4();\nconst _identityMatrix = /*@__PURE__*/ new Matrix4();\n\nclass Skeleton {\n\n\tconstructor( bones = [], boneInverses = [] ) {\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.bones = bones.slice( 0 );\n\t\tthis.boneInverses = boneInverses;\n\t\tthis.boneMatrices = null;\n\n\t\tthis.boneTexture = null;\n\t\tthis.boneTextureSize = 0;\n\n\t\tthis.init();\n\n\t}\n\n\tinit() {\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\n\t\tthis.boneMatrices = new Float32Array( bones.length * 16 );\n\n\t\t// calculate inverse bone matrices if necessary\n\n\t\tif ( boneInverses.length === 0 ) {\n\n\t\t\tthis.calculateInverses();\n\n\t\t} else {\n\n\t\t\t// handle special case\n\n\t\t\tif ( bones.length !== boneInverses.length ) {\n\n\t\t\t\tconsole.warn( 'THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.' );\n\n\t\t\t\tthis.boneInverses = [];\n\n\t\t\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\t\t\tthis.boneInverses.push( new Matrix4() );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcalculateInverses() {\n\n\t\tthis.boneInverses.length = 0;\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst inverse = new Matrix4();\n\n\t\t\tif ( this.bones[ i ] ) {\n\n\t\t\t\tinverse.copy( this.bones[ i ].matrixWorld ).invert();\n\n\t\t\t}\n\n\t\t\tthis.boneInverses.push( inverse );\n\n\t\t}\n\n\t}\n\n\tpose() {\n\n\t\t// recover the bind-time world matrices\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone ) {\n\n\t\t\t\tbone.matrixWorld.copy( this.boneInverses[ i ] ).invert();\n\n\t\t\t}\n\n\t\t}\n\n\t\t// compute the local matrices, positions, rotations and scales\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone ) {\n\n\t\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\t\tbone.matrix.copy( bone.parent.matrixWorld ).invert();\n\t\t\t\t\tbone.matrix.multiply( bone.matrixWorld );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbone.matrix.copy( bone.matrixWorld );\n\n\t\t\t\t}\n\n\t\t\t\tbone.matrix.decompose( bone.position, bone.quaternion, bone.scale );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdate() {\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\t\tconst boneMatrices = this.boneMatrices;\n\t\tconst boneTexture = this.boneTexture;\n\n\t\t// flatten bone matrices to array\n\n\t\tfor ( let i = 0, il = bones.length; i < il; i ++ ) {\n\n\t\t\t// compute the offset between the current and the original transform\n\n\t\t\tconst matrix = bones[ i ] ? bones[ i ].matrixWorld : _identityMatrix;\n\n\t\t\t_offsetMatrix.multiplyMatrices( matrix, boneInverses[ i ] );\n\t\t\t_offsetMatrix.toArray( boneMatrices, i * 16 );\n\n\t\t}\n\n\t\tif ( boneTexture !== null ) {\n\n\t\t\tboneTexture.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new Skeleton( this.bones, this.boneInverses );\n\n\t}\n\n\tcomputeBoneTexture() {\n\n\t\t// layout (1 matrix = 4 pixels)\n\t\t// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\n\t\t// with 8x8 pixel texture max 16 bones * 4 pixels = (8 * 8)\n\t\t// 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16)\n\t\t// 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32)\n\t\t// 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)\n\n\t\tlet size = Math.sqrt( this.bones.length * 4 ); // 4 pixels needed for 1 matrix\n\t\tsize = ceilPowerOfTwo( size );\n\t\tsize = Math.max( size, 4 );\n\n\t\tconst boneMatrices = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel\n\t\tboneMatrices.set( this.boneMatrices ); // copy current values\n\n\t\tconst boneTexture = new DataTexture( boneMatrices, size, size, RGBAFormat, FloatType );\n\t\tboneTexture.needsUpdate = true;\n\n\t\tthis.boneMatrices = boneMatrices;\n\t\tthis.boneTexture = boneTexture;\n\t\tthis.boneTextureSize = size;\n\n\t\treturn this;\n\n\t}\n\n\tgetBoneByName( name ) {\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone.name === name ) {\n\n\t\t\t\treturn bone;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn undefined;\n\n\t}\n\n\tdispose( ) {\n\n\t\tif ( this.boneTexture !== null ) {\n\n\t\t\tthis.boneTexture.dispose();\n\n\t\t\tthis.boneTexture = null;\n\n\t\t}\n\n\t}\n\n\tfromJSON( json, bones ) {\n\n\t\tthis.uuid = json.uuid;\n\n\t\tfor ( let i = 0, l = json.bones.length; i < l; i ++ ) {\n\n\t\t\tconst uuid = json.bones[ i ];\n\t\t\tlet bone = bones[ uuid ];\n\n\t\t\tif ( bone === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.Skeleton: No bone found with UUID:', uuid );\n\t\t\t\tbone = new Bone();\n\n\t\t\t}\n\n\t\t\tthis.bones.push( bone );\n\t\t\tthis.boneInverses.push( new Matrix4().fromArray( json.boneInverses[ i ] ) );\n\n\t\t}\n\n\t\tthis.init();\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Skeleton',\n\t\t\t\tgenerator: 'Skeleton.toJSON'\n\t\t\t},\n\t\t\tbones: [],\n\t\t\tboneInverses: []\n\t\t};\n\n\t\tdata.uuid = this.uuid;\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\n\t\tfor ( let i = 0, l = bones.length; i < l; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\t\t\tdata.bones.push( bone.uuid );\n\n\t\t\tconst boneInverse = boneInverses[ i ];\n\t\t\tdata.boneInverses.push( boneInverse.toArray() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass InstancedBufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized, meshPerAttribute = 1 ) {\n\n\t\tsuper( array, itemSize, normalized );\n\n\t\tthis.isInstancedBufferAttribute = true;\n\n\t\tthis.meshPerAttribute = meshPerAttribute;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.meshPerAttribute = this.meshPerAttribute;\n\n\t\tdata.isInstancedBufferAttribute = true;\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst _instanceLocalMatrix = /*@__PURE__*/ new Matrix4();\nconst _instanceWorldMatrix = /*@__PURE__*/ new Matrix4();\n\nconst _instanceIntersects = [];\n\nconst _box3 = /*@__PURE__*/ new Box3();\nconst _identity = /*@__PURE__*/ new Matrix4();\nconst _mesh = /*@__PURE__*/ new Mesh();\nconst _sphere$2 = /*@__PURE__*/ new Sphere();\n\nclass InstancedMesh extends Mesh {\n\n\tconstructor( geometry, material, count ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isInstancedMesh = true;\n\n\t\tthis.instanceMatrix = new InstancedBufferAttribute( new Float32Array( count * 16 ), 16 );\n\t\tthis.instanceColor = null;\n\n\t\tthis.count = count;\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.setMatrixAt( i, _identity );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst count = this.count;\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\tgeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tthis.boundingBox.makeEmpty();\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.getMatrixAt( i, _instanceLocalMatrix );\n\n\t\t\t_box3.copy( geometry.boundingBox ).applyMatrix4( _instanceLocalMatrix );\n\n\t\t\tthis.boundingBox.union( _box3 );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst count = this.count;\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tif ( geometry.boundingSphere === null ) {\n\n\t\t\tgeometry.computeBoundingSphere();\n\n\t\t}\n\n\t\tthis.boundingSphere.makeEmpty();\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.getMatrixAt( i, _instanceLocalMatrix );\n\n\t\t\t_sphere$2.copy( geometry.boundingSphere ).applyMatrix4( _instanceLocalMatrix );\n\n\t\t\tthis.boundingSphere.union( _sphere$2 );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.instanceMatrix.copy( source.instanceMatrix );\n\n\t\tif ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();\n\n\t\tthis.count = source.count;\n\n\t\tif ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();\n\t\tif ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();\n\n\t\treturn this;\n\n\t}\n\n\tgetColorAt( index, color ) {\n\n\t\tcolor.fromArray( this.instanceColor.array, index * 3 );\n\n\t}\n\n\tgetMatrixAt( index, matrix ) {\n\n\t\tmatrix.fromArray( this.instanceMatrix.array, index * 16 );\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst raycastTimes = this.count;\n\n\t\t_mesh.geometry = this.geometry;\n\t\t_mesh.material = this.material;\n\n\t\tif ( _mesh.material === undefined ) return;\n\n\t\t// test with bounding sphere first\n\n\t\tif ( this.boundingSphere === null ) this.computeBoundingSphere();\n\n\t\t_sphere$2.copy( this.boundingSphere );\n\t\t_sphere$2.applyMatrix4( matrixWorld );\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$2 ) === false ) return;\n\n\t\t// now test each instance\n\n\t\tfor ( let instanceId = 0; instanceId < raycastTimes; instanceId ++ ) {\n\n\t\t\t// calculate the world matrix for each instance\n\n\t\t\tthis.getMatrixAt( instanceId, _instanceLocalMatrix );\n\n\t\t\t_instanceWorldMatrix.multiplyMatrices( matrixWorld, _instanceLocalMatrix );\n\n\t\t\t// the mesh represents this single instance\n\n\t\t\t_mesh.matrixWorld = _instanceWorldMatrix;\n\n\t\t\t_mesh.raycast( raycaster, _instanceIntersects );\n\n\t\t\t// process the result of raycast\n\n\t\t\tfor ( let i = 0, l = _instanceIntersects.length; i < l; i ++ ) {\n\n\t\t\t\tconst intersect = _instanceIntersects[ i ];\n\t\t\t\tintersect.instanceId = instanceId;\n\t\t\t\tintersect.object = this;\n\t\t\t\tintersects.push( intersect );\n\n\t\t\t}\n\n\t\t\t_instanceIntersects.length = 0;\n\n\t\t}\n\n\t}\n\n\tsetColorAt( index, color ) {\n\n\t\tif ( this.instanceColor === null ) {\n\n\t\t\tthis.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ), 3 );\n\n\t\t}\n\n\t\tcolor.toArray( this.instanceColor.array, index * 3 );\n\n\t}\n\n\tsetMatrixAt( index, matrix ) {\n\n\t\tmatrix.toArray( this.instanceMatrix.array, index * 16 );\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nclass LineBasicMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isLineBasicMaterial = true;\n\n\t\tthis.type = 'LineBasicMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.linewidth = 1;\n\t\tthis.linecap = 'round';\n\t\tthis.linejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.linewidth = source.linewidth;\n\t\tthis.linecap = source.linecap;\n\t\tthis.linejoin = source.linejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _start$1 = /*@__PURE__*/ new Vector3();\nconst _end$1 = /*@__PURE__*/ new Vector3();\nconst _inverseMatrix$1 = /*@__PURE__*/ new Matrix4();\nconst _ray$1 = /*@__PURE__*/ new Ray();\nconst _sphere$1 = /*@__PURE__*/ new Sphere();\n\nclass Line extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new LineBasicMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isLine = true;\n\n\t\tthis.type = 'Line';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\tcomputeLineDistances() {\n\n\t\tconst geometry = this.geometry;\n\n\t\t// we assume non-indexed geometry\n\n\t\tif ( geometry.index === null ) {\n\n\t\t\tconst positionAttribute = geometry.attributes.position;\n\t\t\tconst lineDistances = [ 0 ];\n\n\t\t\tfor ( let i = 1, l = positionAttribute.count; i < l; i ++ ) {\n\n\t\t\t\t_start$1.fromBufferAttribute( positionAttribute, i - 1 );\n\t\t\t\t_end$1.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\tlineDistances[ i ] = lineDistances[ i - 1 ];\n\t\t\t\tlineDistances[ i ] += _start$1.distanceTo( _end$1 );\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst threshold = raycaster.params.Line.threshold;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$1.copy( geometry.boundingSphere );\n\t\t_sphere$1.applyMatrix4( matrixWorld );\n\t\t_sphere$1.radius += threshold;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$1 ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix$1.copy( matrixWorld ).invert();\n\t\t_ray$1.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$1 );\n\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tconst localThresholdSq = localThreshold * localThreshold;\n\n\t\tconst vStart = new Vector3();\n\t\tconst vEnd = new Vector3();\n\t\tconst interSegment = new Vector3();\n\t\tconst interRay = new Vector3();\n\t\tconst step = this.isLineSegments ? 2 : 1;\n\n\t\tconst index = geometry.index;\n\t\tconst attributes = geometry.attributes;\n\t\tconst positionAttribute = attributes.position;\n\n\t\tif ( index !== null ) {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\n\n\t\t\t\tconst a = index.getX( i );\n\t\t\t\tconst b = index.getX( i + 1 );\n\n\t\t\t\tvStart.fromBufferAttribute( positionAttribute, a );\n\t\t\t\tvEnd.fromBufferAttribute( positionAttribute, b );\n\n\t\t\t\tconst distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\n\n\t\t\t\tif ( distSq > localThresholdSq ) continue;\n\n\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\n\n\t\t\t\tconst distance = raycaster.ray.origin.distanceTo( interRay );\n\n\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\n\n\t\t\t\tintersects.push( {\n\n\t\t\t\t\tdistance: distance,\n\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t\t\t\t// point: raycaster.ray.at( distance ),\n\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\n\t\t\t\t\tindex: i,\n\t\t\t\t\tface: null,\n\t\t\t\t\tfaceIndex: null,\n\t\t\t\t\tobject: this\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\n\n\t\t\t\tvStart.fromBufferAttribute( positionAttribute, i );\n\t\t\t\tvEnd.fromBufferAttribute( positionAttribute, i + 1 );\n\n\t\t\t\tconst distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\n\n\t\t\t\tif ( distSq > localThresholdSq ) continue;\n\n\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\n\n\t\t\t\tconst distance = raycaster.ray.origin.distanceTo( interRay );\n\n\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\n\n\t\t\t\tintersects.push( {\n\n\t\t\t\t\tdistance: distance,\n\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t\t\t\t// point: raycaster.ray.at( distance ),\n\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\n\t\t\t\t\tindex: i,\n\t\t\t\t\tface: null,\n\t\t\t\t\tfaceIndex: null,\n\t\t\t\t\tobject: this\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nconst _start = /*@__PURE__*/ new Vector3();\nconst _end = /*@__PURE__*/ new Vector3();\n\nclass LineSegments extends Line {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isLineSegments = true;\n\n\t\tthis.type = 'LineSegments';\n\n\t}\n\n\tcomputeLineDistances() {\n\n\t\tconst geometry = this.geometry;\n\n\t\t// we assume non-indexed geometry\n\n\t\tif ( geometry.index === null ) {\n\n\t\t\tconst positionAttribute = geometry.attributes.position;\n\t\t\tconst lineDistances = [];\n\n\t\t\tfor ( let i = 0, l = positionAttribute.count; i < l; i += 2 ) {\n\n\t\t\t\t_start.fromBufferAttribute( positionAttribute, i );\n\t\t\t\t_end.fromBufferAttribute( positionAttribute, i + 1 );\n\n\t\t\t\tlineDistances[ i ] = ( i === 0 ) ? 0 : lineDistances[ i - 1 ];\n\t\t\t\tlineDistances[ i + 1 ] = lineDistances[ i ] + _start.distanceTo( _end );\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineLoop extends Line {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isLineLoop = true;\n\n\t\tthis.type = 'LineLoop';\n\n\t}\n\n}\n\nclass PointsMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isPointsMaterial = true;\n\n\t\tthis.type = 'PointsMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.size = 1;\n\t\tthis.sizeAttenuation = true;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.size = source.size;\n\t\tthis.sizeAttenuation = source.sizeAttenuation;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _inverseMatrix = /*@__PURE__*/ new Matrix4();\nconst _ray = /*@__PURE__*/ new Ray();\nconst _sphere = /*@__PURE__*/ new Sphere();\nconst _position$2 = /*@__PURE__*/ new Vector3();\n\nclass Points extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new PointsMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isPoints = true;\n\n\t\tthis.type = 'Points';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst threshold = raycaster.params.Points.threshold;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere.copy( geometry.boundingSphere );\n\t\t_sphere.applyMatrix4( matrixWorld );\n\t\t_sphere.radius += threshold;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix.copy( matrixWorld ).invert();\n\t\t_ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix );\n\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tconst localThresholdSq = localThreshold * localThreshold;\n\n\t\tconst index = geometry.index;\n\t\tconst attributes = geometry.attributes;\n\t\tconst positionAttribute = attributes.position;\n\n\t\tif ( index !== null ) {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, il = end; i < il; i ++ ) {\n\n\t\t\t\tconst a = index.getX( i );\n\n\t\t\t\t_position$2.fromBufferAttribute( positionAttribute, a );\n\n\t\t\t\ttestPoint( _position$2, a, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end; i < l; i ++ ) {\n\n\t\t\t\t_position$2.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\ttestPoint( _position$2, i, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction testPoint( point, index, localThresholdSq, matrixWorld, raycaster, intersects, object ) {\n\n\tconst rayPointDistanceSq = _ray.distanceSqToPoint( point );\n\n\tif ( rayPointDistanceSq < localThresholdSq ) {\n\n\t\tconst intersectPoint = new Vector3();\n\n\t\t_ray.closestPointToPoint( point, intersectPoint );\n\t\tintersectPoint.applyMatrix4( matrixWorld );\n\n\t\tconst distance = raycaster.ray.origin.distanceTo( intersectPoint );\n\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\t\tintersects.push( {\n\n\t\t\tdistance: distance,\n\t\t\tdistanceToRay: Math.sqrt( rayPointDistanceSq ),\n\t\t\tpoint: intersectPoint,\n\t\t\tindex: index,\n\t\t\tface: null,\n\t\t\tobject: object\n\n\t\t} );\n\n\t}\n\n}\n\nclass VideoTexture extends Texture {\n\n\tconstructor( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\n\n\t\tsuper( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.isVideoTexture = true;\n\n\t\tthis.minFilter = minFilter !== undefined ? minFilter : LinearFilter;\n\t\tthis.magFilter = magFilter !== undefined ? magFilter : LinearFilter;\n\n\t\tthis.generateMipmaps = false;\n\n\t\tconst scope = this;\n\n\t\tfunction updateVideo() {\n\n\t\t\tscope.needsUpdate = true;\n\t\t\tvideo.requestVideoFrameCallback( updateVideo );\n\n\t\t}\n\n\t\tif ( 'requestVideoFrameCallback' in video ) {\n\n\t\t\tvideo.requestVideoFrameCallback( updateVideo );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.image ).copy( this );\n\n\t}\n\n\tupdate() {\n\n\t\tconst video = this.image;\n\t\tconst hasVideoFrameCallback = 'requestVideoFrameCallback' in video;\n\n\t\tif ( hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA ) {\n\n\t\t\tthis.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n}\n\nclass FramebufferTexture extends Texture {\n\n\tconstructor( width, height ) {\n\n\t\tsuper( { width, height } );\n\n\t\tthis.isFramebufferTexture = true;\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.generateMipmaps = false;\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\nclass CompressedTexture extends Texture {\n\n\tconstructor( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, colorSpace ) {\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\tthis.isCompressedTexture = true;\n\n\t\tthis.image = { width: width, height: height };\n\t\tthis.mipmaps = mipmaps;\n\n\t\t// no flipping for cube textures\n\t\t// (also flipping doesn't work for compressed textures )\n\n\t\tthis.flipY = false;\n\n\t\t// can't generate mipmaps for compressed textures\n\t\t// mips must be embedded in DDS files\n\n\t\tthis.generateMipmaps = false;\n\n\t}\n\n}\n\nclass CompressedArrayTexture extends CompressedTexture {\n\n\tconstructor( mipmaps, width, height, depth, format, type ) {\n\n\t\tsuper( mipmaps, width, height, format, type );\n\n\t\tthis.isCompressedArrayTexture = true;\n\t\tthis.image.depth = depth;\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t}\n\n}\n\nclass CompressedCubeTexture extends CompressedTexture {\n\n\tconstructor( images, format, type ) {\n\n\t\tsuper( undefined, images[ 0 ].width, images[ 0 ].height, format, type, CubeReflectionMapping );\n\n\t\tthis.isCompressedCubeTexture = true;\n\t\tthis.isCubeTexture = true;\n\n\t\tthis.image = images;\n\n\t}\n\n}\n\nclass CanvasTexture extends Texture {\n\n\tconstructor( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\n\n\t\tsuper( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.isCanvasTexture = true;\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\n/**\n * Extensible curve object.\n *\n * Some common of curve methods:\n * .getPoint( t, optionalTarget ), .getTangent( t, optionalTarget )\n * .getPointAt( u, optionalTarget ), .getTangentAt( u, optionalTarget )\n * .getPoints(), .getSpacedPoints()\n * .getLength()\n * .updateArcLengths()\n *\n * This following curves inherit from THREE.Curve:\n *\n * -- 2D curves --\n * THREE.ArcCurve\n * THREE.CubicBezierCurve\n * THREE.EllipseCurve\n * THREE.LineCurve\n * THREE.QuadraticBezierCurve\n * THREE.SplineCurve\n *\n * -- 3D curves --\n * THREE.CatmullRomCurve3\n * THREE.CubicBezierCurve3\n * THREE.LineCurve3\n * THREE.QuadraticBezierCurve3\n *\n * A series of curves can be represented as a THREE.CurvePath.\n *\n **/\n\nclass Curve {\n\n\tconstructor() {\n\n\t\tthis.type = 'Curve';\n\n\t\tthis.arcLengthDivisions = 200;\n\n\t}\n\n\t// Virtual base class method to overwrite and implement in subclasses\n\t//\t- t [0 .. 1]\n\n\tgetPoint( /* t, optionalTarget */ ) {\n\n\t\tconsole.warn( 'THREE.Curve: .getPoint() not implemented.' );\n\t\treturn null;\n\n\t}\n\n\t// Get point at relative position in curve according to arc length\n\t// - u [0 .. 1]\n\n\tgetPointAt( u, optionalTarget ) {\n\n\t\tconst t = this.getUtoTmapping( u );\n\t\treturn this.getPoint( t, optionalTarget );\n\n\t}\n\n\t// Get sequence of points using getPoint( t )\n\n\tgetPoints( divisions = 5 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPoint( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\t// Get sequence of points using getPointAt( u )\n\n\tgetSpacedPoints( divisions = 5 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPointAt( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\t// Get total curve arc length\n\n\tgetLength() {\n\n\t\tconst lengths = this.getLengths();\n\t\treturn lengths[ lengths.length - 1 ];\n\n\t}\n\n\t// Get list of cumulative segment lengths\n\n\tgetLengths( divisions = this.arcLengthDivisions ) {\n\n\t\tif ( this.cacheArcLengths &&\n\t\t\t( this.cacheArcLengths.length === divisions + 1 ) &&\n\t\t\t! this.needsUpdate ) {\n\n\t\t\treturn this.cacheArcLengths;\n\n\t\t}\n\n\t\tthis.needsUpdate = false;\n\n\t\tconst cache = [];\n\t\tlet current, last = this.getPoint( 0 );\n\t\tlet sum = 0;\n\n\t\tcache.push( 0 );\n\n\t\tfor ( let p = 1; p <= divisions; p ++ ) {\n\n\t\t\tcurrent = this.getPoint( p / divisions );\n\t\t\tsum += current.distanceTo( last );\n\t\t\tcache.push( sum );\n\t\t\tlast = current;\n\n\t\t}\n\n\t\tthis.cacheArcLengths = cache;\n\n\t\treturn cache; // { sums: cache, sum: sum }; Sum is in the last element.\n\n\t}\n\n\tupdateArcLengths() {\n\n\t\tthis.needsUpdate = true;\n\t\tthis.getLengths();\n\n\t}\n\n\t// Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant\n\n\tgetUtoTmapping( u, distance ) {\n\n\t\tconst arcLengths = this.getLengths();\n\n\t\tlet i = 0;\n\t\tconst il = arcLengths.length;\n\n\t\tlet targetArcLength; // The targeted u distance value to get\n\n\t\tif ( distance ) {\n\n\t\t\ttargetArcLength = distance;\n\n\t\t} else {\n\n\t\t\ttargetArcLength = u * arcLengths[ il - 1 ];\n\n\t\t}\n\n\t\t// binary search for the index with largest value smaller than target u distance\n\n\t\tlet low = 0, high = il - 1, comparison;\n\n\t\twhile ( low <= high ) {\n\n\t\t\ti = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats\n\n\t\t\tcomparison = arcLengths[ i ] - targetArcLength;\n\n\t\t\tif ( comparison < 0 ) {\n\n\t\t\t\tlow = i + 1;\n\n\t\t\t} else if ( comparison > 0 ) {\n\n\t\t\t\thigh = i - 1;\n\n\t\t\t} else {\n\n\t\t\t\thigh = i;\n\t\t\t\tbreak;\n\n\t\t\t\t// DONE\n\n\t\t\t}\n\n\t\t}\n\n\t\ti = high;\n\n\t\tif ( arcLengths[ i ] === targetArcLength ) {\n\n\t\t\treturn i / ( il - 1 );\n\n\t\t}\n\n\t\t// we could get finer grain at lengths, or use simple interpolation between two points\n\n\t\tconst lengthBefore = arcLengths[ i ];\n\t\tconst lengthAfter = arcLengths[ i + 1 ];\n\n\t\tconst segmentLength = lengthAfter - lengthBefore;\n\n\t\t// determine where we are between the 'before' and 'after' points\n\n\t\tconst segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength;\n\n\t\t// add that fractional amount to t\n\n\t\tconst t = ( i + segmentFraction ) / ( il - 1 );\n\n\t\treturn t;\n\n\t}\n\n\t// Returns a unit vector tangent at t\n\t// In case any sub curve does not implement its tangent derivation,\n\t// 2 points a small delta apart will be used to find its gradient\n\t// which seems to give a reasonable approximation\n\n\tgetTangent( t, optionalTarget ) {\n\n\t\tconst delta = 0.0001;\n\t\tlet t1 = t - delta;\n\t\tlet t2 = t + delta;\n\n\t\t// Capping in case of danger\n\n\t\tif ( t1 < 0 ) t1 = 0;\n\t\tif ( t2 > 1 ) t2 = 1;\n\n\t\tconst pt1 = this.getPoint( t1 );\n\t\tconst pt2 = this.getPoint( t2 );\n\n\t\tconst tangent = optionalTarget || ( ( pt1.isVector2 ) ? new Vector2() : new Vector3() );\n\n\t\ttangent.copy( pt2 ).sub( pt1 ).normalize();\n\n\t\treturn tangent;\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\tconst t = this.getUtoTmapping( u );\n\t\treturn this.getTangent( t, optionalTarget );\n\n\t}\n\n\tcomputeFrenetFrames( segments, closed ) {\n\n\t\t// see http://www.cs.indiana.edu/pub/techreports/TR425.pdf\n\n\t\tconst normal = new Vector3();\n\n\t\tconst tangents = [];\n\t\tconst normals = [];\n\t\tconst binormals = [];\n\n\t\tconst vec = new Vector3();\n\t\tconst mat = new Matrix4();\n\n\t\t// compute the tangent vectors for each segment on the curve\n\n\t\tfor ( let i = 0; i <= segments; i ++ ) {\n\n\t\t\tconst u = i / segments;\n\n\t\t\ttangents[ i ] = this.getTangentAt( u, new Vector3() );\n\n\t\t}\n\n\t\t// select an initial normal vector perpendicular to the first tangent vector,\n\t\t// and in the direction of the minimum tangent xyz component\n\n\t\tnormals[ 0 ] = new Vector3();\n\t\tbinormals[ 0 ] = new Vector3();\n\t\tlet min = Number.MAX_VALUE;\n\t\tconst tx = Math.abs( tangents[ 0 ].x );\n\t\tconst ty = Math.abs( tangents[ 0 ].y );\n\t\tconst tz = Math.abs( tangents[ 0 ].z );\n\n\t\tif ( tx <= min ) {\n\n\t\t\tmin = tx;\n\t\t\tnormal.set( 1, 0, 0 );\n\n\t\t}\n\n\t\tif ( ty <= min ) {\n\n\t\t\tmin = ty;\n\t\t\tnormal.set( 0, 1, 0 );\n\n\t\t}\n\n\t\tif ( tz <= min ) {\n\n\t\t\tnormal.set( 0, 0, 1 );\n\n\t\t}\n\n\t\tvec.crossVectors( tangents[ 0 ], normal ).normalize();\n\n\t\tnormals[ 0 ].crossVectors( tangents[ 0 ], vec );\n\t\tbinormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] );\n\n\n\t\t// compute the slowly-varying normal and binormal vectors for each segment on the curve\n\n\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\tnormals[ i ] = normals[ i - 1 ].clone();\n\n\t\t\tbinormals[ i ] = binormals[ i - 1 ].clone();\n\n\t\t\tvec.crossVectors( tangents[ i - 1 ], tangents[ i ] );\n\n\t\t\tif ( vec.length() > Number.EPSILON ) {\n\n\t\t\t\tvec.normalize();\n\n\t\t\t\tconst theta = Math.acos( clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors\n\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) );\n\n\t\t\t}\n\n\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t}\n\n\t\t// if the curve is closed, postprocess the vectors so the first and last normal vectors are the same\n\n\t\tif ( closed === true ) {\n\n\t\t\tlet theta = Math.acos( clamp( normals[ 0 ].dot( normals[ segments ] ), - 1, 1 ) );\n\t\t\ttheta /= segments;\n\n\t\t\tif ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ segments ] ) ) > 0 ) {\n\n\t\t\t\ttheta = - theta;\n\n\t\t\t}\n\n\t\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\t\t// twist a little...\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( tangents[ i ], theta * i ) );\n\t\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn {\n\t\t\ttangents: tangents,\n\t\t\tnormals: normals,\n\t\t\tbinormals: binormals\n\t\t};\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.arcLengthDivisions = source.arcLengthDivisions;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Curve',\n\t\t\t\tgenerator: 'Curve.toJSON'\n\t\t\t}\n\t\t};\n\n\t\tdata.arcLengthDivisions = this.arcLengthDivisions;\n\t\tdata.type = this.type;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tthis.arcLengthDivisions = json.arcLengthDivisions;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass EllipseCurve extends Curve {\n\n\tconstructor( aX = 0, aY = 0, xRadius = 1, yRadius = 1, aStartAngle = 0, aEndAngle = Math.PI * 2, aClockwise = false, aRotation = 0 ) {\n\n\t\tsuper();\n\n\t\tthis.isEllipseCurve = true;\n\n\t\tthis.type = 'EllipseCurve';\n\n\t\tthis.aX = aX;\n\t\tthis.aY = aY;\n\n\t\tthis.xRadius = xRadius;\n\t\tthis.yRadius = yRadius;\n\n\t\tthis.aStartAngle = aStartAngle;\n\t\tthis.aEndAngle = aEndAngle;\n\n\t\tthis.aClockwise = aClockwise;\n\n\t\tthis.aRotation = aRotation;\n\n\t}\n\n\tgetPoint( t, optionalTarget ) {\n\n\t\tconst point = optionalTarget || new Vector2();\n\n\t\tconst twoPi = Math.PI * 2;\n\t\tlet deltaAngle = this.aEndAngle - this.aStartAngle;\n\t\tconst samePoints = Math.abs( deltaAngle ) < Number.EPSILON;\n\n\t\t// ensures that deltaAngle is 0 .. 2 PI\n\t\twhile ( deltaAngle < 0 ) deltaAngle += twoPi;\n\t\twhile ( deltaAngle > twoPi ) deltaAngle -= twoPi;\n\n\t\tif ( deltaAngle < Number.EPSILON ) {\n\n\t\t\tif ( samePoints ) {\n\n\t\t\t\tdeltaAngle = 0;\n\n\t\t\t} else {\n\n\t\t\t\tdeltaAngle = twoPi;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.aClockwise === true && ! samePoints ) {\n\n\t\t\tif ( deltaAngle === twoPi ) {\n\n\t\t\t\tdeltaAngle = - twoPi;\n\n\t\t\t} else {\n\n\t\t\t\tdeltaAngle = deltaAngle - twoPi;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst angle = this.aStartAngle + t * deltaAngle;\n\t\tlet x = this.aX + this.xRadius * Math.cos( angle );\n\t\tlet y = this.aY + this.yRadius * Math.sin( angle );\n\n\t\tif ( this.aRotation !== 0 ) {\n\n\t\t\tconst cos = Math.cos( this.aRotation );\n\t\t\tconst sin = Math.sin( this.aRotation );\n\n\t\t\tconst tx = x - this.aX;\n\t\t\tconst ty = y - this.aY;\n\n\t\t\t// Rotate the point about the center of the ellipse.\n\t\t\tx = tx * cos - ty * sin + this.aX;\n\t\t\ty = tx * sin + ty * cos + this.aY;\n\n\t\t}\n\n\t\treturn point.set( x, y );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.aX = source.aX;\n\t\tthis.aY = source.aY;\n\n\t\tthis.xRadius = source.xRadius;\n\t\tthis.yRadius = source.yRadius;\n\n\t\tthis.aStartAngle = source.aStartAngle;\n\t\tthis.aEndAngle = source.aEndAngle;\n\n\t\tthis.aClockwise = source.aClockwise;\n\n\t\tthis.aRotation = source.aRotation;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.aX = this.aX;\n\t\tdata.aY = this.aY;\n\n\t\tdata.xRadius = this.xRadius;\n\t\tdata.yRadius = this.yRadius;\n\n\t\tdata.aStartAngle = this.aStartAngle;\n\t\tdata.aEndAngle = this.aEndAngle;\n\n\t\tdata.aClockwise = this.aClockwise;\n\n\t\tdata.aRotation = this.aRotation;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.aX = json.aX;\n\t\tthis.aY = json.aY;\n\n\t\tthis.xRadius = json.xRadius;\n\t\tthis.yRadius = json.yRadius;\n\n\t\tthis.aStartAngle = json.aStartAngle;\n\t\tthis.aEndAngle = json.aEndAngle;\n\n\t\tthis.aClockwise = json.aClockwise;\n\n\t\tthis.aRotation = json.aRotation;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass ArcCurve extends EllipseCurve {\n\n\tconstructor( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tsuper( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\tthis.isArcCurve = true;\n\n\t\tthis.type = 'ArcCurve';\n\n\t}\n\n}\n\n/**\n * Centripetal CatmullRom Curve - which is useful for avoiding\n * cusps and self-intersections in non-uniform catmull rom curves.\n * http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf\n *\n * curve.type accepts centripetal(default), chordal and catmullrom\n * curve.tension is used for catmullrom which defaults to 0.5\n */\n\n\n/*\nBased on an optimized c++ solution in\n - http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/\n - http://ideone.com/NoEbVM\n\nThis CubicPoly class could be used for reusing some variables and calculations,\nbut for three.js curve use, it could be possible inlined and flatten into a single function call\nwhich can be placed in CurveUtils.\n*/\n\nfunction CubicPoly() {\n\n\tlet c0 = 0, c1 = 0, c2 = 0, c3 = 0;\n\n\t/*\n\t * Compute coefficients for a cubic polynomial\n\t * p(s) = c0 + c1*s + c2*s^2 + c3*s^3\n\t * such that\n\t * p(0) = x0, p(1) = x1\n\t * and\n\t * p'(0) = t0, p'(1) = t1.\n\t */\n\tfunction init( x0, x1, t0, t1 ) {\n\n\t\tc0 = x0;\n\t\tc1 = t0;\n\t\tc2 = - 3 * x0 + 3 * x1 - 2 * t0 - t1;\n\t\tc3 = 2 * x0 - 2 * x1 + t0 + t1;\n\n\t}\n\n\treturn {\n\n\t\tinitCatmullRom: function ( x0, x1, x2, x3, tension ) {\n\n\t\t\tinit( x1, x2, tension * ( x2 - x0 ), tension * ( x3 - x1 ) );\n\n\t\t},\n\n\t\tinitNonuniformCatmullRom: function ( x0, x1, x2, x3, dt0, dt1, dt2 ) {\n\n\t\t\t// compute tangents when parameterized in [t1,t2]\n\t\t\tlet t1 = ( x1 - x0 ) / dt0 - ( x2 - x0 ) / ( dt0 + dt1 ) + ( x2 - x1 ) / dt1;\n\t\t\tlet t2 = ( x2 - x1 ) / dt1 - ( x3 - x1 ) / ( dt1 + dt2 ) + ( x3 - x2 ) / dt2;\n\n\t\t\t// rescale tangents for parametrization in [0,1]\n\t\t\tt1 *= dt1;\n\t\t\tt2 *= dt1;\n\n\t\t\tinit( x1, x2, t1, t2 );\n\n\t\t},\n\n\t\tcalc: function ( t ) {\n\n\t\t\tconst t2 = t * t;\n\t\t\tconst t3 = t2 * t;\n\t\t\treturn c0 + c1 * t + c2 * t2 + c3 * t3;\n\n\t\t}\n\n\t};\n\n}\n\n//\n\nconst tmp = /*@__PURE__*/ new Vector3();\nconst px = /*@__PURE__*/ new CubicPoly();\nconst py = /*@__PURE__*/ new CubicPoly();\nconst pz = /*@__PURE__*/ new CubicPoly();\n\nclass CatmullRomCurve3 extends Curve {\n\n\tconstructor( points = [], closed = false, curveType = 'centripetal', tension = 0.5 ) {\n\n\t\tsuper();\n\n\t\tthis.isCatmullRomCurve3 = true;\n\n\t\tthis.type = 'CatmullRomCurve3';\n\n\t\tthis.points = points;\n\t\tthis.closed = closed;\n\t\tthis.curveType = curveType;\n\t\tthis.tension = tension;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst l = points.length;\n\n\t\tconst p = ( l - ( this.closed ? 0 : 1 ) ) * t;\n\t\tlet intPoint = Math.floor( p );\n\t\tlet weight = p - intPoint;\n\n\t\tif ( this.closed ) {\n\n\t\t\tintPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / l ) + 1 ) * l;\n\n\t\t} else if ( weight === 0 && intPoint === l - 1 ) {\n\n\t\t\tintPoint = l - 2;\n\t\t\tweight = 1;\n\n\t\t}\n\n\t\tlet p0, p3; // 4 points (p1 & p2 defined below)\n\n\t\tif ( this.closed || intPoint > 0 ) {\n\n\t\t\tp0 = points[ ( intPoint - 1 ) % l ];\n\n\t\t} else {\n\n\t\t\t// extrapolate first point\n\t\t\ttmp.subVectors( points[ 0 ], points[ 1 ] ).add( points[ 0 ] );\n\t\t\tp0 = tmp;\n\n\t\t}\n\n\t\tconst p1 = points[ intPoint % l ];\n\t\tconst p2 = points[ ( intPoint + 1 ) % l ];\n\n\t\tif ( this.closed || intPoint + 2 < l ) {\n\n\t\t\tp3 = points[ ( intPoint + 2 ) % l ];\n\n\t\t} else {\n\n\t\t\t// extrapolate last point\n\t\t\ttmp.subVectors( points[ l - 1 ], points[ l - 2 ] ).add( points[ l - 1 ] );\n\t\t\tp3 = tmp;\n\n\t\t}\n\n\t\tif ( this.curveType === 'centripetal' || this.curveType === 'chordal' ) {\n\n\t\t\t// init Centripetal / Chordal Catmull-Rom\n\t\t\tconst pow = this.curveType === 'chordal' ? 0.5 : 0.25;\n\t\t\tlet dt0 = Math.pow( p0.distanceToSquared( p1 ), pow );\n\t\t\tlet dt1 = Math.pow( p1.distanceToSquared( p2 ), pow );\n\t\t\tlet dt2 = Math.pow( p2.distanceToSquared( p3 ), pow );\n\n\t\t\t// safety check for repeated points\n\t\t\tif ( dt1 < 1e-4 ) dt1 = 1.0;\n\t\t\tif ( dt0 < 1e-4 ) dt0 = dt1;\n\t\t\tif ( dt2 < 1e-4 ) dt2 = dt1;\n\n\t\t\tpx.initNonuniformCatmullRom( p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2 );\n\t\t\tpy.initNonuniformCatmullRom( p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2 );\n\t\t\tpz.initNonuniformCatmullRom( p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2 );\n\n\t\t} else if ( this.curveType === 'catmullrom' ) {\n\n\t\t\tpx.initCatmullRom( p0.x, p1.x, p2.x, p3.x, this.tension );\n\t\t\tpy.initCatmullRom( p0.y, p1.y, p2.y, p3.y, this.tension );\n\t\t\tpz.initCatmullRom( p0.z, p1.z, p2.z, p3.z, this.tension );\n\n\t\t}\n\n\t\tpoint.set(\n\t\t\tpx.calc( weight ),\n\t\t\tpy.calc( weight ),\n\t\t\tpz.calc( weight )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\tthis.closed = source.closed;\n\t\tthis.curveType = source.curveType;\n\t\tthis.tension = source.tension;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\tdata.closed = this.closed;\n\t\tdata.curveType = this.curveType;\n\t\tdata.tension = this.tension;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new Vector3().fromArray( point ) );\n\n\t\t}\n\n\t\tthis.closed = json.closed;\n\t\tthis.curveType = json.curveType;\n\t\tthis.tension = json.tension;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Bezier Curves formulas obtained from\n * https://en.wikipedia.org/wiki/B%C3%A9zier_curve\n */\n\nfunction CatmullRom( t, p0, p1, p2, p3 ) {\n\n\tconst v0 = ( p2 - p0 ) * 0.5;\n\tconst v1 = ( p3 - p1 ) * 0.5;\n\tconst t2 = t * t;\n\tconst t3 = t * t2;\n\treturn ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;\n\n}\n\n//\n\nfunction QuadraticBezierP0( t, p ) {\n\n\tconst k = 1 - t;\n\treturn k * k * p;\n\n}\n\nfunction QuadraticBezierP1( t, p ) {\n\n\treturn 2 * ( 1 - t ) * t * p;\n\n}\n\nfunction QuadraticBezierP2( t, p ) {\n\n\treturn t * t * p;\n\n}\n\nfunction QuadraticBezier( t, p0, p1, p2 ) {\n\n\treturn QuadraticBezierP0( t, p0 ) + QuadraticBezierP1( t, p1 ) +\n\t\tQuadraticBezierP2( t, p2 );\n\n}\n\n//\n\nfunction CubicBezierP0( t, p ) {\n\n\tconst k = 1 - t;\n\treturn k * k * k * p;\n\n}\n\nfunction CubicBezierP1( t, p ) {\n\n\tconst k = 1 - t;\n\treturn 3 * k * k * t * p;\n\n}\n\nfunction CubicBezierP2( t, p ) {\n\n\treturn 3 * ( 1 - t ) * t * t * p;\n\n}\n\nfunction CubicBezierP3( t, p ) {\n\n\treturn t * t * t * p;\n\n}\n\nfunction CubicBezier( t, p0, p1, p2, p3 ) {\n\n\treturn CubicBezierP0( t, p0 ) + CubicBezierP1( t, p1 ) + CubicBezierP2( t, p2 ) +\n\t\tCubicBezierP3( t, p3 );\n\n}\n\nclass CubicBezierCurve extends Curve {\n\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2(), v3 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isCubicBezierCurve = true;\n\n\t\tthis.type = 'CubicBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass CubicBezierCurve3 extends Curve {\n\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3(), v3 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isCubicBezierCurve3 = true;\n\n\t\tthis.type = 'CubicBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y ),\n\t\t\tCubicBezier( t, v0.z, v1.z, v2.z, v3.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineCurve extends Curve {\n\n\tconstructor( v1 = new Vector2(), v2 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isLineCurve = true;\n\n\t\tthis.type = 'LineCurve';\n\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tif ( t === 1 ) {\n\n\t\t\tpoint.copy( this.v2 );\n\n\t\t} else {\n\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t\t}\n\n\t\treturn point;\n\n\t}\n\n\t// Line curve is linear, so we can overwrite default getPointAt\n\tgetPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}\n\n\tgetTangent( t, optionalTarget = new Vector2() ) {\n\n\t\treturn optionalTarget.subVectors( this.v2, this.v1 ).normalize();\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\treturn this.getTangent( u, optionalTarget );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineCurve3 extends Curve {\n\n\tconstructor( v1 = new Vector3(), v2 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isLineCurve3 = true;\n\n\t\tthis.type = 'LineCurve3';\n\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tif ( t === 1 ) {\n\n\t\t\tpoint.copy( this.v2 );\n\n\t\t} else {\n\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t\t}\n\n\t\treturn point;\n\n\t}\n\t// Line curve is linear, so we can overwrite default getPointAt\n\tgetPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}\n\n\tgetTangent( t, optionalTarget = new Vector3() ) {\n\n\t\treturn optionalTarget.subVectors( this.v2, this.v1 ).normalize();\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\treturn this.getTangent( u, optionalTarget );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass QuadraticBezierCurve extends Curve {\n\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isQuadraticBezierCurve = true;\n\n\t\tthis.type = 'QuadraticBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass QuadraticBezierCurve3 extends Curve {\n\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isQuadraticBezierCurve3 = true;\n\n\t\tthis.type = 'QuadraticBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y ),\n\t\t\tQuadraticBezier( t, v0.z, v1.z, v2.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass SplineCurve extends Curve {\n\n\tconstructor( points = [] ) {\n\n\t\tsuper();\n\n\t\tthis.isSplineCurve = true;\n\n\t\tthis.type = 'SplineCurve';\n\n\t\tthis.points = points;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst p = ( points.length - 1 ) * t;\n\n\t\tconst intPoint = Math.floor( p );\n\t\tconst weight = p - intPoint;\n\n\t\tconst p0 = points[ intPoint === 0 ? intPoint : intPoint - 1 ];\n\t\tconst p1 = points[ intPoint ];\n\t\tconst p2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];\n\t\tconst p3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];\n\n\t\tpoint.set(\n\t\t\tCatmullRom( weight, p0.x, p1.x, p2.x, p3.x ),\n\t\t\tCatmullRom( weight, p0.y, p1.y, p2.y, p3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new Vector2().fromArray( point ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nvar Curves = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tArcCurve: ArcCurve,\n\tCatmullRomCurve3: CatmullRomCurve3,\n\tCubicBezierCurve: CubicBezierCurve,\n\tCubicBezierCurve3: CubicBezierCurve3,\n\tEllipseCurve: EllipseCurve,\n\tLineCurve: LineCurve,\n\tLineCurve3: LineCurve3,\n\tQuadraticBezierCurve: QuadraticBezierCurve,\n\tQuadraticBezierCurve3: QuadraticBezierCurve3,\n\tSplineCurve: SplineCurve\n});\n\n/**************************************************************\n *\tCurved Path - a curve path is simply a array of connected\n * curves, but retains the api of a curve\n **************************************************************/\n\nclass CurvePath extends Curve {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'CurvePath';\n\n\t\tthis.curves = [];\n\t\tthis.autoClose = false; // Automatically closes the path\n\n\t}\n\n\tadd( curve ) {\n\n\t\tthis.curves.push( curve );\n\n\t}\n\n\tclosePath() {\n\n\t\t// Add a line curve if start and end of lines are not connected\n\t\tconst startPoint = this.curves[ 0 ].getPoint( 0 );\n\t\tconst endPoint = this.curves[ this.curves.length - 1 ].getPoint( 1 );\n\n\t\tif ( ! startPoint.equals( endPoint ) ) {\n\n\t\t\tconst lineType = ( startPoint.isVector2 === true ) ? 'LineCurve' : 'LineCurve3';\n\t\t\tthis.curves.push( new Curves[ lineType ]( endPoint, startPoint ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// To get accurate point with reference to\n\t// entire path distance at time t,\n\t// following has to be done:\n\n\t// 1. Length of each sub path have to be known\n\t// 2. Locate and identify type of curve\n\t// 3. Get t for the curve\n\t// 4. Return curve.getPointAt(t')\n\n\tgetPoint( t, optionalTarget ) {\n\n\t\tconst d = t * this.getLength();\n\t\tconst curveLengths = this.getCurveLengths();\n\t\tlet i = 0;\n\n\t\t// To think about boundaries points.\n\n\t\twhile ( i < curveLengths.length ) {\n\n\t\t\tif ( curveLengths[ i ] >= d ) {\n\n\t\t\t\tconst diff = curveLengths[ i ] - d;\n\t\t\t\tconst curve = this.curves[ i ];\n\n\t\t\t\tconst segmentLength = curve.getLength();\n\t\t\t\tconst u = segmentLength === 0 ? 0 : 1 - diff / segmentLength;\n\n\t\t\t\treturn curve.getPointAt( u, optionalTarget );\n\n\t\t\t}\n\n\t\t\ti ++;\n\n\t\t}\n\n\t\treturn null;\n\n\t\t// loop where sum != 0, sum > d , sum+1 1 && ! points[ points.length - 1 ].equals( points[ 0 ] ) ) {\n\n\t\t\tpoints.push( points[ 0 ] );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.curves = [];\n\n\t\tfor ( let i = 0, l = source.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = source.curves[ i ];\n\n\t\t\tthis.curves.push( curve.clone() );\n\n\t\t}\n\n\t\tthis.autoClose = source.autoClose;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.autoClose = this.autoClose;\n\t\tdata.curves = [];\n\n\t\tfor ( let i = 0, l = this.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = this.curves[ i ];\n\t\t\tdata.curves.push( curve.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.autoClose = json.autoClose;\n\t\tthis.curves = [];\n\n\t\tfor ( let i = 0, l = json.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = json.curves[ i ];\n\t\t\tthis.curves.push( new Curves[ curve.type ]().fromJSON( curve ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Path extends CurvePath {\n\n\tconstructor( points ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Path';\n\n\t\tthis.currentPoint = new Vector2();\n\n\t\tif ( points ) {\n\n\t\t\tthis.setFromPoints( points );\n\n\t\t}\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.moveTo( points[ 0 ].x, points[ 0 ].y );\n\n\t\tfor ( let i = 1, l = points.length; i < l; i ++ ) {\n\n\t\t\tthis.lineTo( points[ i ].x, points[ i ].y );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPoint.set( x, y ); // TODO consider referencing vectors instead of copying?\n\n\t\treturn this;\n\n\t}\n\n\tlineTo( x, y ) {\n\n\t\tconst curve = new LineCurve( this.currentPoint.clone(), new Vector2( x, y ) );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tconst curve = new QuadraticBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCPx, aCPy ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tconst curve = new CubicBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCP1x, aCP1y ),\n\t\t\tnew Vector2( aCP2x, aCP2y ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tsplineThru( pts /*Array of Vector*/ ) {\n\n\t\tconst npts = [ this.currentPoint.clone() ].concat( pts );\n\n\t\tconst curve = new SplineCurve( npts );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.copy( pts[ pts.length - 1 ] );\n\n\t\treturn this;\n\n\t}\n\n\tarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absarc( aX + x0, aY + y0, aRadius,\n\t\t\taStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tabsarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tthis.absellipse( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absellipse( aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\treturn this;\n\n\t}\n\n\tabsellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst curve = new EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\tif ( this.curves.length > 0 ) {\n\n\t\t\t// if a previous curve is present, attempt to join\n\t\t\tconst firstPoint = curve.getPoint( 0 );\n\n\t\t\tif ( ! firstPoint.equals( this.currentPoint ) ) {\n\n\t\t\t\tthis.lineTo( firstPoint.x, firstPoint.y );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.curves.push( curve );\n\n\t\tconst lastPoint = curve.getPoint( 1 );\n\t\tthis.currentPoint.copy( lastPoint );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.currentPoint.copy( source.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.currentPoint = this.currentPoint.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.currentPoint.fromArray( json.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LatheGeometry extends BufferGeometry {\n\n\tconstructor( points = [ new Vector2( 0, - 0.5 ), new Vector2( 0.5, 0 ), new Vector2( 0, 0.5 ) ], segments = 12, phiStart = 0, phiLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'LatheGeometry';\n\n\t\tthis.parameters = {\n\t\t\tpoints: points,\n\t\t\tsegments: segments,\n\t\t\tphiStart: phiStart,\n\t\t\tphiLength: phiLength\n\t\t};\n\n\t\tsegments = Math.floor( segments );\n\n\t\t// clamp phiLength so it's in range of [ 0, 2PI ]\n\n\t\tphiLength = clamp( phiLength, 0, Math.PI * 2 );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst uvs = [];\n\t\tconst initNormals = [];\n\t\tconst normals = [];\n\n\t\t// helper variables\n\n\t\tconst inverseSegments = 1.0 / segments;\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\t\tconst normal = new Vector3();\n\t\tconst curNormal = new Vector3();\n\t\tconst prevNormal = new Vector3();\n\t\tlet dx = 0;\n\t\tlet dy = 0;\n\n\t\t// pre-compute normals for initial \"meridian\"\n\n\t\tfor ( let j = 0; j <= ( points.length - 1 ); j ++ ) {\n\n\t\t\tswitch ( j ) {\n\n\t\t\t\tcase 0:\t\t\t\t// special handling for 1st vertex on path\n\n\t\t\t\t\tdx = points[ j + 1 ].x - points[ j ].x;\n\t\t\t\t\tdy = points[ j + 1 ].y - points[ j ].y;\n\n\t\t\t\t\tnormal.x = dy * 1.0;\n\t\t\t\t\tnormal.y = - dx;\n\t\t\t\t\tnormal.z = dy * 0.0;\n\n\t\t\t\t\tprevNormal.copy( normal );\n\n\t\t\t\t\tnormal.normalize();\n\n\t\t\t\t\tinitNormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ( points.length - 1 ):\t// special handling for last Vertex on path\n\n\t\t\t\t\tinitNormals.push( prevNormal.x, prevNormal.y, prevNormal.z );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\t\t\t// default handling for all vertices in between\n\n\t\t\t\t\tdx = points[ j + 1 ].x - points[ j ].x;\n\t\t\t\t\tdy = points[ j + 1 ].y - points[ j ].y;\n\n\t\t\t\t\tnormal.x = dy * 1.0;\n\t\t\t\t\tnormal.y = - dx;\n\t\t\t\t\tnormal.z = dy * 0.0;\n\n\t\t\t\t\tcurNormal.copy( normal );\n\n\t\t\t\t\tnormal.x += prevNormal.x;\n\t\t\t\t\tnormal.y += prevNormal.y;\n\t\t\t\t\tnormal.z += prevNormal.z;\n\n\t\t\t\t\tnormal.normalize();\n\n\t\t\t\t\tinitNormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\tprevNormal.copy( curNormal );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate vertices, uvs and normals\n\n\t\tfor ( let i = 0; i <= segments; i ++ ) {\n\n\t\t\tconst phi = phiStart + i * inverseSegments * phiLength;\n\n\t\t\tconst sin = Math.sin( phi );\n\t\t\tconst cos = Math.cos( phi );\n\n\t\t\tfor ( let j = 0; j <= ( points.length - 1 ); j ++ ) {\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = points[ j ].x * sin;\n\t\t\t\tvertex.y = points[ j ].y;\n\t\t\t\tvertex.z = points[ j ].x * cos;\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = i / segments;\n\t\t\t\tuv.y = j / ( points.length - 1 );\n\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t// normal\n\n\t\t\t\tconst x = initNormals[ 3 * j + 0 ] * sin;\n\t\t\t\tconst y = initNormals[ 3 * j + 1 ];\n\t\t\t\tconst z = initNormals[ 3 * j + 0 ] * cos;\n\n\t\t\t\tnormals.push( x, y, z );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let i = 0; i < segments; i ++ ) {\n\n\t\t\tfor ( let j = 0; j < ( points.length - 1 ); j ++ ) {\n\n\t\t\t\tconst base = j + i * points.length;\n\n\t\t\t\tconst a = base;\n\t\t\t\tconst b = base + points.length;\n\t\t\t\tconst c = base + points.length + 1;\n\t\t\t\tconst d = base + 1;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( c, d, b );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new LatheGeometry( data.points, data.segments, data.phiStart, data.phiLength );\n\n\t}\n\n}\n\nclass CapsuleGeometry extends LatheGeometry {\n\n\tconstructor( radius = 1, length = 1, capSegments = 4, radialSegments = 8 ) {\n\n\t\tconst path = new Path();\n\t\tpath.absarc( 0, - length / 2, radius, Math.PI * 1.5, 0 );\n\t\tpath.absarc( 0, length / 2, radius, 0, Math.PI * 0.5 );\n\n\t\tsuper( path.getPoints( capSegments ), radialSegments );\n\n\t\tthis.type = 'CapsuleGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tlength: length,\n\t\t\tcapSegments: capSegments,\n\t\t\tradialSegments: radialSegments,\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CapsuleGeometry( data.radius, data.length, data.capSegments, data.radialSegments );\n\n\t}\n\n}\n\nclass CircleGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, segments = 32, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CircleGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tsegments: segments,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tsegments = Math.max( 3, segments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\n\t\t// center point\n\n\t\tvertices.push( 0, 0, 0 );\n\t\tnormals.push( 0, 0, 1 );\n\t\tuvs.push( 0.5, 0.5 );\n\n\t\tfor ( let s = 0, i = 3; s <= segments; s ++, i += 3 ) {\n\n\t\t\tconst segment = thetaStart + s / segments * thetaLength;\n\n\t\t\t// vertex\n\n\t\t\tvertex.x = radius * Math.cos( segment );\n\t\t\tvertex.y = radius * Math.sin( segment );\n\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t// normal\n\n\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t// uvs\n\n\t\t\tuv.x = ( vertices[ i ] / radius + 1 ) / 2;\n\t\t\tuv.y = ( vertices[ i + 1 ] / radius + 1 ) / 2;\n\n\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\tindices.push( i, i + 1, 0 );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CircleGeometry( data.radius, data.segments, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass CylinderGeometry extends BufferGeometry {\n\n\tconstructor( radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CylinderGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradiusTop: radiusTop,\n\t\t\tradiusBottom: radiusBottom,\n\t\t\theight: height,\n\t\t\tradialSegments: radialSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\topenEnded: openEnded,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tconst scope = this;\n\n\t\tradialSegments = Math.floor( radialSegments );\n\t\theightSegments = Math.floor( heightSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet index = 0;\n\t\tconst indexArray = [];\n\t\tconst halfHeight = height / 2;\n\t\tlet groupStart = 0;\n\n\t\t// generate geometry\n\n\t\tgenerateTorso();\n\n\t\tif ( openEnded === false ) {\n\n\t\t\tif ( radiusTop > 0 ) generateCap( true );\n\t\t\tif ( radiusBottom > 0 ) generateCap( false );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\tfunction generateTorso() {\n\n\t\t\tconst normal = new Vector3();\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tlet groupCount = 0;\n\n\t\t\t// this will be used to calculate the normal\n\t\t\tconst slope = ( radiusBottom - radiusTop ) / height;\n\n\t\t\t// generate vertices, normals and uvs\n\n\t\t\tfor ( let y = 0; y <= heightSegments; y ++ ) {\n\n\t\t\t\tconst indexRow = [];\n\n\t\t\t\tconst v = y / heightSegments;\n\n\t\t\t\t// calculate the radius of the current row\n\n\t\t\t\tconst radius = v * ( radiusBottom - radiusTop ) + radiusTop;\n\n\t\t\t\tfor ( let x = 0; x <= radialSegments; x ++ ) {\n\n\t\t\t\t\tconst u = x / radialSegments;\n\n\t\t\t\t\tconst theta = u * thetaLength + thetaStart;\n\n\t\t\t\t\tconst sinTheta = Math.sin( theta );\n\t\t\t\t\tconst cosTheta = Math.cos( theta );\n\n\t\t\t\t\t// vertex\n\n\t\t\t\t\tvertex.x = radius * sinTheta;\n\t\t\t\t\tvertex.y = - v * height + halfHeight;\n\t\t\t\t\tvertex.z = radius * cosTheta;\n\t\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t\t// normal\n\n\t\t\t\t\tnormal.set( sinTheta, slope, cosTheta ).normalize();\n\t\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\t// uv\n\n\t\t\t\t\tuvs.push( u, 1 - v );\n\n\t\t\t\t\t// save index of vertex in respective row\n\n\t\t\t\t\tindexRow.push( index ++ );\n\n\t\t\t\t}\n\n\t\t\t\t// now save vertices of the row in our index array\n\n\t\t\t\tindexArray.push( indexRow );\n\n\t\t\t}\n\n\t\t\t// generate indices\n\n\t\t\tfor ( let x = 0; x < radialSegments; x ++ ) {\n\n\t\t\t\tfor ( let y = 0; y < heightSegments; y ++ ) {\n\n\t\t\t\t\t// we use the index array to access the correct indices\n\n\t\t\t\t\tconst a = indexArray[ y ][ x ];\n\t\t\t\t\tconst b = indexArray[ y + 1 ][ x ];\n\t\t\t\t\tconst c = indexArray[ y + 1 ][ x + 1 ];\n\t\t\t\t\tconst d = indexArray[ y ][ x + 1 ];\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t\t// update group counter\n\n\t\t\t\t\tgroupCount += 6;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, 0 );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t}\n\n\t\tfunction generateCap( top ) {\n\n\t\t\t// save the index of the first center vertex\n\t\t\tconst centerIndexStart = index;\n\n\t\t\tconst uv = new Vector2();\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tlet groupCount = 0;\n\n\t\t\tconst radius = ( top === true ) ? radiusTop : radiusBottom;\n\t\t\tconst sign = ( top === true ) ? 1 : - 1;\n\n\t\t\t// first we generate the center vertex data of the cap.\n\t\t\t// because the geometry needs one set of uvs per face,\n\t\t\t// we must generate a center vertex per face/segment\n\n\t\t\tfor ( let x = 1; x <= radialSegments; x ++ ) {\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertices.push( 0, halfHeight * sign, 0 );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, sign, 0 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( 0.5, 0.5 );\n\n\t\t\t\t// increase index\n\n\t\t\t\tindex ++;\n\n\t\t\t}\n\n\t\t\t// save the index of the last center vertex\n\t\t\tconst centerIndexEnd = index;\n\n\t\t\t// now we generate the surrounding vertices, normals and uvs\n\n\t\t\tfor ( let x = 0; x <= radialSegments; x ++ ) {\n\n\t\t\t\tconst u = x / radialSegments;\n\t\t\t\tconst theta = u * thetaLength + thetaStart;\n\n\t\t\t\tconst cosTheta = Math.cos( theta );\n\t\t\t\tconst sinTheta = Math.sin( theta );\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = radius * sinTheta;\n\t\t\t\tvertex.y = halfHeight * sign;\n\t\t\t\tvertex.z = radius * cosTheta;\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, sign, 0 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = ( cosTheta * 0.5 ) + 0.5;\n\t\t\t\tuv.y = ( sinTheta * 0.5 * sign ) + 0.5;\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t// increase index\n\n\t\t\t\tindex ++;\n\n\t\t\t}\n\n\t\t\t// generate indices\n\n\t\t\tfor ( let x = 0; x < radialSegments; x ++ ) {\n\n\t\t\t\tconst c = centerIndexStart + x;\n\t\t\t\tconst i = centerIndexEnd + x;\n\n\t\t\t\tif ( top === true ) {\n\n\t\t\t\t\t// face top\n\n\t\t\t\t\tindices.push( i, i + 1, c );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// face bottom\n\n\t\t\t\t\tindices.push( i + 1, i, c );\n\n\t\t\t\t}\n\n\t\t\t\tgroupCount += 3;\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, top === true ? 1 : 2 );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CylinderGeometry( data.radiusTop, data.radiusBottom, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass ConeGeometry extends CylinderGeometry {\n\n\tconstructor( radius = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper( 0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength );\n\n\t\tthis.type = 'ConeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\theight: height,\n\t\t\tradialSegments: radialSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\topenEnded: openEnded,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new ConeGeometry( data.radius, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass PolyhedronGeometry extends BufferGeometry {\n\n\tconstructor( vertices = [], indices = [], radius = 1, detail = 0 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'PolyhedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tvertices: vertices,\n\t\t\tindices: indices,\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t\t// default buffer data\n\n\t\tconst vertexBuffer = [];\n\t\tconst uvBuffer = [];\n\n\t\t// the subdivision creates the vertex buffer data\n\n\t\tsubdivide( detail );\n\n\t\t// all vertices should lie on a conceptual sphere with a given radius\n\n\t\tapplyRadius( radius );\n\n\t\t// finally, create the uv data\n\n\t\tgenerateUVs();\n\n\t\t// build non-indexed geometry\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertexBuffer, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( vertexBuffer.slice(), 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvBuffer, 2 ) );\n\n\t\tif ( detail === 0 ) {\n\n\t\t\tthis.computeVertexNormals(); // flat normals\n\n\t\t} else {\n\n\t\t\tthis.normalizeNormals(); // smooth normals\n\n\t\t}\n\n\t\t// helper functions\n\n\t\tfunction subdivide( detail ) {\n\n\t\t\tconst a = new Vector3();\n\t\t\tconst b = new Vector3();\n\t\t\tconst c = new Vector3();\n\n\t\t\t// iterate over all faces and apply a subdivision with the given detail value\n\n\t\t\tfor ( let i = 0; i < indices.length; i += 3 ) {\n\n\t\t\t\t// get the vertices of the face\n\n\t\t\t\tgetVertexByIndex( indices[ i + 0 ], a );\n\t\t\t\tgetVertexByIndex( indices[ i + 1 ], b );\n\t\t\t\tgetVertexByIndex( indices[ i + 2 ], c );\n\n\t\t\t\t// perform subdivision\n\n\t\t\t\tsubdivideFace( a, b, c, detail );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction subdivideFace( a, b, c, detail ) {\n\n\t\t\tconst cols = detail + 1;\n\n\t\t\t// we use this multidimensional array as a data structure for creating the subdivision\n\n\t\t\tconst v = [];\n\n\t\t\t// construct all of the vertices for this subdivision\n\n\t\t\tfor ( let i = 0; i <= cols; i ++ ) {\n\n\t\t\t\tv[ i ] = [];\n\n\t\t\t\tconst aj = a.clone().lerp( c, i / cols );\n\t\t\t\tconst bj = b.clone().lerp( c, i / cols );\n\n\t\t\t\tconst rows = cols - i;\n\n\t\t\t\tfor ( let j = 0; j <= rows; j ++ ) {\n\n\t\t\t\t\tif ( j === 0 && i === cols ) {\n\n\t\t\t\t\t\tv[ i ][ j ] = aj;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tv[ i ][ j ] = aj.clone().lerp( bj, j / rows );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// construct all of the faces\n\n\t\t\tfor ( let i = 0; i < cols; i ++ ) {\n\n\t\t\t\tfor ( let j = 0; j < 2 * ( cols - i ) - 1; j ++ ) {\n\n\t\t\t\t\tconst k = Math.floor( j / 2 );\n\n\t\t\t\t\tif ( j % 2 === 0 ) {\n\n\t\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\n\t\t\t\t\t\tpushVertex( v[ i ][ k ] );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction applyRadius( radius ) {\n\n\t\t\tconst vertex = new Vector3();\n\n\t\t\t// iterate over the entire buffer and apply the radius to each vertex\n\n\t\t\tfor ( let i = 0; i < vertexBuffer.length; i += 3 ) {\n\n\t\t\t\tvertex.x = vertexBuffer[ i + 0 ];\n\t\t\t\tvertex.y = vertexBuffer[ i + 1 ];\n\t\t\t\tvertex.z = vertexBuffer[ i + 2 ];\n\n\t\t\t\tvertex.normalize().multiplyScalar( radius );\n\n\t\t\t\tvertexBuffer[ i + 0 ] = vertex.x;\n\t\t\t\tvertexBuffer[ i + 1 ] = vertex.y;\n\t\t\t\tvertexBuffer[ i + 2 ] = vertex.z;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateUVs() {\n\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tfor ( let i = 0; i < vertexBuffer.length; i += 3 ) {\n\n\t\t\t\tvertex.x = vertexBuffer[ i + 0 ];\n\t\t\t\tvertex.y = vertexBuffer[ i + 1 ];\n\t\t\t\tvertex.z = vertexBuffer[ i + 2 ];\n\n\t\t\t\tconst u = azimuth( vertex ) / 2 / Math.PI + 0.5;\n\t\t\t\tconst v = inclination( vertex ) / Math.PI + 0.5;\n\t\t\t\tuvBuffer.push( u, 1 - v );\n\n\t\t\t}\n\n\t\t\tcorrectUVs();\n\n\t\t\tcorrectSeam();\n\n\t\t}\n\n\t\tfunction correctSeam() {\n\n\t\t\t// handle case when face straddles the seam, see #3269\n\n\t\t\tfor ( let i = 0; i < uvBuffer.length; i += 6 ) {\n\n\t\t\t\t// uv data of a single face\n\n\t\t\t\tconst x0 = uvBuffer[ i + 0 ];\n\t\t\t\tconst x1 = uvBuffer[ i + 2 ];\n\t\t\t\tconst x2 = uvBuffer[ i + 4 ];\n\n\t\t\t\tconst max = Math.max( x0, x1, x2 );\n\t\t\t\tconst min = Math.min( x0, x1, x2 );\n\n\t\t\t\t// 0.9 is somewhat arbitrary\n\n\t\t\t\tif ( max > 0.9 && min < 0.1 ) {\n\n\t\t\t\t\tif ( x0 < 0.2 ) uvBuffer[ i + 0 ] += 1;\n\t\t\t\t\tif ( x1 < 0.2 ) uvBuffer[ i + 2 ] += 1;\n\t\t\t\t\tif ( x2 < 0.2 ) uvBuffer[ i + 4 ] += 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction pushVertex( vertex ) {\n\n\t\t\tvertexBuffer.push( vertex.x, vertex.y, vertex.z );\n\n\t\t}\n\n\t\tfunction getVertexByIndex( index, vertex ) {\n\n\t\t\tconst stride = index * 3;\n\n\t\t\tvertex.x = vertices[ stride + 0 ];\n\t\t\tvertex.y = vertices[ stride + 1 ];\n\t\t\tvertex.z = vertices[ stride + 2 ];\n\n\t\t}\n\n\t\tfunction correctUVs() {\n\n\t\t\tconst a = new Vector3();\n\t\t\tconst b = new Vector3();\n\t\t\tconst c = new Vector3();\n\n\t\t\tconst centroid = new Vector3();\n\n\t\t\tconst uvA = new Vector2();\n\t\t\tconst uvB = new Vector2();\n\t\t\tconst uvC = new Vector2();\n\n\t\t\tfor ( let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6 ) {\n\n\t\t\t\ta.set( vertexBuffer[ i + 0 ], vertexBuffer[ i + 1 ], vertexBuffer[ i + 2 ] );\n\t\t\t\tb.set( vertexBuffer[ i + 3 ], vertexBuffer[ i + 4 ], vertexBuffer[ i + 5 ] );\n\t\t\t\tc.set( vertexBuffer[ i + 6 ], vertexBuffer[ i + 7 ], vertexBuffer[ i + 8 ] );\n\n\t\t\t\tuvA.set( uvBuffer[ j + 0 ], uvBuffer[ j + 1 ] );\n\t\t\t\tuvB.set( uvBuffer[ j + 2 ], uvBuffer[ j + 3 ] );\n\t\t\t\tuvC.set( uvBuffer[ j + 4 ], uvBuffer[ j + 5 ] );\n\n\t\t\t\tcentroid.copy( a ).add( b ).add( c ).divideScalar( 3 );\n\n\t\t\t\tconst azi = azimuth( centroid );\n\n\t\t\t\tcorrectUV( uvA, j + 0, a, azi );\n\t\t\t\tcorrectUV( uvB, j + 2, b, azi );\n\t\t\t\tcorrectUV( uvC, j + 4, c, azi );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction correctUV( uv, stride, vector, azimuth ) {\n\n\t\t\tif ( ( azimuth < 0 ) && ( uv.x === 1 ) ) {\n\n\t\t\t\tuvBuffer[ stride ] = uv.x - 1;\n\n\t\t\t}\n\n\t\t\tif ( ( vector.x === 0 ) && ( vector.z === 0 ) ) {\n\n\t\t\t\tuvBuffer[ stride ] = azimuth / 2 / Math.PI + 0.5;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Angle around the Y axis, counter-clockwise when looking from above.\n\n\t\tfunction azimuth( vector ) {\n\n\t\t\treturn Math.atan2( vector.z, - vector.x );\n\n\t\t}\n\n\n\t\t// Angle above the XZ plane.\n\n\t\tfunction inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new PolyhedronGeometry( data.vertices, data.indices, data.radius, data.details );\n\n\t}\n\n}\n\nclass DodecahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst t = ( 1 + Math.sqrt( 5 ) ) / 2;\n\t\tconst r = 1 / t;\n\n\t\tconst vertices = [\n\n\t\t\t// (±1, ±1, ±1)\n\t\t\t- 1, - 1, - 1,\t- 1, - 1, 1,\n\t\t\t- 1, 1, - 1, - 1, 1, 1,\n\t\t\t1, - 1, - 1, 1, - 1, 1,\n\t\t\t1, 1, - 1, 1, 1, 1,\n\n\t\t\t// (0, ±1/φ, ±φ)\n\t\t\t0, - r, - t, 0, - r, t,\n\t\t\t0, r, - t, 0, r, t,\n\n\t\t\t// (±1/φ, ±φ, 0)\n\t\t\t- r, - t, 0, - r, t, 0,\n\t\t\tr, - t, 0, r, t, 0,\n\n\t\t\t// (±φ, 0, ±1/φ)\n\t\t\t- t, 0, - r, t, 0, - r,\n\t\t\t- t, 0, r, t, 0, r\n\t\t];\n\n\t\tconst indices = [\n\t\t\t3, 11, 7, \t3, 7, 15, \t3, 15, 13,\n\t\t\t7, 19, 17, \t7, 17, 6, \t7, 6, 15,\n\t\t\t17, 4, 8, \t17, 8, 10, \t17, 10, 6,\n\t\t\t8, 0, 16, \t8, 16, 2, \t8, 2, 10,\n\t\t\t0, 12, 1, \t0, 1, 18, \t0, 18, 16,\n\t\t\t6, 10, 2, \t6, 2, 13, \t6, 13, 15,\n\t\t\t2, 16, 18, \t2, 18, 3, \t2, 3, 13,\n\t\t\t18, 1, 9, \t18, 9, 11, \t18, 11, 3,\n\t\t\t4, 14, 12, \t4, 12, 0, \t4, 0, 8,\n\t\t\t11, 9, 5, \t11, 5, 19, \t11, 19, 7,\n\t\t\t19, 5, 14, \t19, 14, 4, \t19, 4, 17,\n\t\t\t1, 12, 14, \t1, 14, 5, \t1, 5, 9\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'DodecahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new DodecahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nconst _v0 = /*@__PURE__*/ new Vector3();\nconst _v1$1 = /*@__PURE__*/ new Vector3();\nconst _normal = /*@__PURE__*/ new Vector3();\nconst _triangle = /*@__PURE__*/ new Triangle();\n\nclass EdgesGeometry extends BufferGeometry {\n\n\tconstructor( geometry = null, thresholdAngle = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'EdgesGeometry';\n\n\t\tthis.parameters = {\n\t\t\tgeometry: geometry,\n\t\t\tthresholdAngle: thresholdAngle\n\t\t};\n\n\t\tif ( geometry !== null ) {\n\n\t\t\tconst precisionPoints = 4;\n\t\t\tconst precision = Math.pow( 10, precisionPoints );\n\t\t\tconst thresholdDot = Math.cos( DEG2RAD * thresholdAngle );\n\n\t\t\tconst indexAttr = geometry.getIndex();\n\t\t\tconst positionAttr = geometry.getAttribute( 'position' );\n\t\t\tconst indexCount = indexAttr ? indexAttr.count : positionAttr.count;\n\n\t\t\tconst indexArr = [ 0, 0, 0 ];\n\t\t\tconst vertKeys = [ 'a', 'b', 'c' ];\n\t\t\tconst hashes = new Array( 3 );\n\n\t\t\tconst edgeData = {};\n\t\t\tconst vertices = [];\n\t\t\tfor ( let i = 0; i < indexCount; i += 3 ) {\n\n\t\t\t\tif ( indexAttr ) {\n\n\t\t\t\t\tindexArr[ 0 ] = indexAttr.getX( i );\n\t\t\t\t\tindexArr[ 1 ] = indexAttr.getX( i + 1 );\n\t\t\t\t\tindexArr[ 2 ] = indexAttr.getX( i + 2 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tindexArr[ 0 ] = i;\n\t\t\t\t\tindexArr[ 1 ] = i + 1;\n\t\t\t\t\tindexArr[ 2 ] = i + 2;\n\n\t\t\t\t}\n\n\t\t\t\tconst { a, b, c } = _triangle;\n\t\t\t\ta.fromBufferAttribute( positionAttr, indexArr[ 0 ] );\n\t\t\t\tb.fromBufferAttribute( positionAttr, indexArr[ 1 ] );\n\t\t\t\tc.fromBufferAttribute( positionAttr, indexArr[ 2 ] );\n\t\t\t\t_triangle.getNormal( _normal );\n\n\t\t\t\t// create hashes for the edge from the vertices\n\t\t\t\thashes[ 0 ] = `${ Math.round( a.x * precision ) },${ Math.round( a.y * precision ) },${ Math.round( a.z * precision ) }`;\n\t\t\t\thashes[ 1 ] = `${ Math.round( b.x * precision ) },${ Math.round( b.y * precision ) },${ Math.round( b.z * precision ) }`;\n\t\t\t\thashes[ 2 ] = `${ Math.round( c.x * precision ) },${ Math.round( c.y * precision ) },${ Math.round( c.z * precision ) }`;\n\n\t\t\t\t// skip degenerate triangles\n\t\t\t\tif ( hashes[ 0 ] === hashes[ 1 ] || hashes[ 1 ] === hashes[ 2 ] || hashes[ 2 ] === hashes[ 0 ] ) {\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\t// iterate over every edge\n\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t// get the first and next vertex making up the edge\n\t\t\t\t\tconst jNext = ( j + 1 ) % 3;\n\t\t\t\t\tconst vecHash0 = hashes[ j ];\n\t\t\t\t\tconst vecHash1 = hashes[ jNext ];\n\t\t\t\t\tconst v0 = _triangle[ vertKeys[ j ] ];\n\t\t\t\t\tconst v1 = _triangle[ vertKeys[ jNext ] ];\n\n\t\t\t\t\tconst hash = `${ vecHash0 }_${ vecHash1 }`;\n\t\t\t\t\tconst reverseHash = `${ vecHash1 }_${ vecHash0 }`;\n\n\t\t\t\t\tif ( reverseHash in edgeData && edgeData[ reverseHash ] ) {\n\n\t\t\t\t\t\t// if we found a sibling edge add it into the vertex array if\n\t\t\t\t\t\t// it meets the angle threshold and delete the edge from the map.\n\t\t\t\t\t\tif ( _normal.dot( edgeData[ reverseHash ].normal ) <= thresholdDot ) {\n\n\t\t\t\t\t\t\tvertices.push( v0.x, v0.y, v0.z );\n\t\t\t\t\t\t\tvertices.push( v1.x, v1.y, v1.z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tedgeData[ reverseHash ] = null;\n\n\t\t\t\t\t} else if ( ! ( hash in edgeData ) ) {\n\n\t\t\t\t\t\t// if we've already got an edge here then skip adding a new one\n\t\t\t\t\t\tedgeData[ hash ] = {\n\n\t\t\t\t\t\t\tindex0: indexArr[ j ],\n\t\t\t\t\t\t\tindex1: indexArr[ jNext ],\n\t\t\t\t\t\t\tnormal: _normal.clone(),\n\n\t\t\t\t\t\t};\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// iterate over all remaining, unmatched edges and add them to the vertex array\n\t\t\tfor ( const key in edgeData ) {\n\n\t\t\t\tif ( edgeData[ key ] ) {\n\n\t\t\t\t\tconst { index0, index1 } = edgeData[ key ];\n\t\t\t\t\t_v0.fromBufferAttribute( positionAttr, index0 );\n\t\t\t\t\t_v1$1.fromBufferAttribute( positionAttr, index1 );\n\n\t\t\t\t\tvertices.push( _v0.x, _v0.y, _v0.z );\n\t\t\t\t\tvertices.push( _v1$1.x, _v1$1.y, _v1$1.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Shape extends Path {\n\n\tconstructor( points ) {\n\n\t\tsuper( points );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.type = 'Shape';\n\n\t\tthis.holes = [];\n\n\t}\n\n\tgetPointsHoles( divisions ) {\n\n\t\tconst holesPts = [];\n\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tholesPts[ i ] = this.holes[ i ].getPoints( divisions );\n\n\t\t}\n\n\t\treturn holesPts;\n\n\t}\n\n\t// get points of shape and holes (keypoints based on segments parameter)\n\n\textractPoints( divisions ) {\n\n\t\treturn {\n\n\t\t\tshape: this.getPoints( divisions ),\n\t\t\tholes: this.getPointsHoles( divisions )\n\n\t\t};\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.holes = [];\n\n\t\tfor ( let i = 0, l = source.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = source.holes[ i ];\n\n\t\t\tthis.holes.push( hole.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.holes = [];\n\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = this.holes[ i ];\n\t\t\tdata.holes.push( hole.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.uuid = json.uuid;\n\t\tthis.holes = [];\n\n\t\tfor ( let i = 0, l = json.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = json.holes[ i ];\n\t\t\tthis.holes.push( new Path().fromJSON( hole ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Port from https://github.com/mapbox/earcut (v2.2.4)\n */\n\nconst Earcut = {\n\n\ttriangulate: function ( data, holeIndices, dim = 2 ) {\n\n\t\tconst hasHoles = holeIndices && holeIndices.length;\n\t\tconst outerLen = hasHoles ? holeIndices[ 0 ] * dim : data.length;\n\t\tlet outerNode = linkedList( data, 0, outerLen, dim, true );\n\t\tconst triangles = [];\n\n\t\tif ( ! outerNode || outerNode.next === outerNode.prev ) return triangles;\n\n\t\tlet minX, minY, maxX, maxY, x, y, invSize;\n\n\t\tif ( hasHoles ) outerNode = eliminateHoles( data, holeIndices, outerNode, dim );\n\n\t\t// if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n\t\tif ( data.length > 80 * dim ) {\n\n\t\t\tminX = maxX = data[ 0 ];\n\t\t\tminY = maxY = data[ 1 ];\n\n\t\t\tfor ( let i = dim; i < outerLen; i += dim ) {\n\n\t\t\t\tx = data[ i ];\n\t\t\t\ty = data[ i + 1 ];\n\t\t\t\tif ( x < minX ) minX = x;\n\t\t\t\tif ( y < minY ) minY = y;\n\t\t\t\tif ( x > maxX ) maxX = x;\n\t\t\t\tif ( y > maxY ) maxY = y;\n\n\t\t\t}\n\n\t\t\t// minX, minY and invSize are later used to transform coords into integers for z-order calculation\n\t\t\tinvSize = Math.max( maxX - minX, maxY - minY );\n\t\t\tinvSize = invSize !== 0 ? 32767 / invSize : 0;\n\n\t\t}\n\n\t\tearcutLinked( outerNode, triangles, dim, minX, minY, invSize, 0 );\n\n\t\treturn triangles;\n\n\t}\n\n};\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList( data, start, end, dim, clockwise ) {\n\n\tlet i, last;\n\n\tif ( clockwise === ( signedArea( data, start, end, dim ) > 0 ) ) {\n\n\t\tfor ( i = start; i < end; i += dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\n\n\t} else {\n\n\t\tfor ( i = end - dim; i >= start; i -= dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\n\n\t}\n\n\tif ( last && equals( last, last.next ) ) {\n\n\t\tremoveNode( last );\n\t\tlast = last.next;\n\n\t}\n\n\treturn last;\n\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints( start, end ) {\n\n\tif ( ! start ) return start;\n\tif ( ! end ) end = start;\n\n\tlet p = start,\n\t\tagain;\n\tdo {\n\n\t\tagain = false;\n\n\t\tif ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) {\n\n\t\t\tremoveNode( p );\n\t\t\tp = end = p.prev;\n\t\t\tif ( p === p.next ) break;\n\t\t\tagain = true;\n\n\t\t} else {\n\n\t\t\tp = p.next;\n\n\t\t}\n\n\t} while ( again || p !== end );\n\n\treturn end;\n\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked( ear, triangles, dim, minX, minY, invSize, pass ) {\n\n\tif ( ! ear ) return;\n\n\t// interlink polygon nodes in z-order\n\tif ( ! pass && invSize ) indexCurve( ear, minX, minY, invSize );\n\n\tlet stop = ear,\n\t\tprev, next;\n\n\t// iterate through ears, slicing them one by one\n\twhile ( ear.prev !== ear.next ) {\n\n\t\tprev = ear.prev;\n\t\tnext = ear.next;\n\n\t\tif ( invSize ? isEarHashed( ear, minX, minY, invSize ) : isEar( ear ) ) {\n\n\t\t\t// cut off the triangle\n\t\t\ttriangles.push( prev.i / dim | 0 );\n\t\t\ttriangles.push( ear.i / dim | 0 );\n\t\t\ttriangles.push( next.i / dim | 0 );\n\n\t\t\tremoveNode( ear );\n\n\t\t\t// skipping the next vertex leads to less sliver triangles\n\t\t\tear = next.next;\n\t\t\tstop = next.next;\n\n\t\t\tcontinue;\n\n\t\t}\n\n\t\tear = next;\n\n\t\t// if we looped through the whole remaining polygon and can't find any more ears\n\t\tif ( ear === stop ) {\n\n\t\t\t// try filtering points and slicing again\n\t\t\tif ( ! pass ) {\n\n\t\t\t\tearcutLinked( filterPoints( ear ), triangles, dim, minX, minY, invSize, 1 );\n\n\t\t\t\t// if this didn't work, try curing all small self-intersections locally\n\n\t\t\t} else if ( pass === 1 ) {\n\n\t\t\t\tear = cureLocalIntersections( filterPoints( ear ), triangles, dim );\n\t\t\t\tearcutLinked( ear, triangles, dim, minX, minY, invSize, 2 );\n\n\t\t\t\t// as a last resort, try splitting the remaining polygon into two\n\n\t\t\t} else if ( pass === 2 ) {\n\n\t\t\t\tsplitEarcut( ear, triangles, dim, minX, minY, invSize );\n\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar( ear ) {\n\n\tconst a = ear.prev,\n\t\tb = ear,\n\t\tc = ear.next;\n\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\n\n\t// now make sure we don't have other points inside the potential ear\n\tconst ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n\t// triangle bbox; min & max are calculated like this for speed\n\tconst x0 = ax < bx ? ( ax < cx ? ax : cx ) : ( bx < cx ? bx : cx ),\n\t\ty0 = ay < by ? ( ay < cy ? ay : cy ) : ( by < cy ? by : cy ),\n\t\tx1 = ax > bx ? ( ax > cx ? ax : cx ) : ( bx > cx ? bx : cx ),\n\t\ty1 = ay > by ? ( ay > cy ? ay : cy ) : ( by > cy ? by : cy );\n\n\tlet p = c.next;\n\twhile ( p !== a ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) &&\n\t\t\tarea( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.next;\n\n\t}\n\n\treturn true;\n\n}\n\nfunction isEarHashed( ear, minX, minY, invSize ) {\n\n\tconst a = ear.prev,\n\t\tb = ear,\n\t\tc = ear.next;\n\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\n\n\tconst ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n\t// triangle bbox; min & max are calculated like this for speed\n\tconst x0 = ax < bx ? ( ax < cx ? ax : cx ) : ( bx < cx ? bx : cx ),\n\t\ty0 = ay < by ? ( ay < cy ? ay : cy ) : ( by < cy ? by : cy ),\n\t\tx1 = ax > bx ? ( ax > cx ? ax : cx ) : ( bx > cx ? bx : cx ),\n\t\ty1 = ay > by ? ( ay > cy ? ay : cy ) : ( by > cy ? by : cy );\n\n\t// z-order range for the current triangle bbox;\n\tconst minZ = zOrder( x0, y0, minX, minY, invSize ),\n\t\tmaxZ = zOrder( x1, y1, minX, minY, invSize );\n\n\tlet p = ear.prevZ,\n\t\tn = ear.nextZ;\n\n\t// look for points inside the triangle in both directions\n\twhile ( p && p.z >= minZ && n && n.z <= maxZ ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) && area( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.prevZ;\n\n\t\tif ( n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, n.x, n.y ) && area( n.prev, n, n.next ) >= 0 ) return false;\n\t\tn = n.nextZ;\n\n\t}\n\n\t// look for remaining points in decreasing z-order\n\twhile ( p && p.z >= minZ ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) && area( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.prevZ;\n\n\t}\n\n\t// look for remaining points in increasing z-order\n\twhile ( n && n.z <= maxZ ) {\n\n\t\tif ( n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, n.x, n.y ) && area( n.prev, n, n.next ) >= 0 ) return false;\n\t\tn = n.nextZ;\n\n\t}\n\n\treturn true;\n\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections( start, triangles, dim ) {\n\n\tlet p = start;\n\tdo {\n\n\t\tconst a = p.prev,\n\t\t\tb = p.next.next;\n\n\t\tif ( ! equals( a, b ) && intersects( a, p, p.next, b ) && locallyInside( a, b ) && locallyInside( b, a ) ) {\n\n\t\t\ttriangles.push( a.i / dim | 0 );\n\t\t\ttriangles.push( p.i / dim | 0 );\n\t\t\ttriangles.push( b.i / dim | 0 );\n\n\t\t\t// remove two nodes involved\n\t\t\tremoveNode( p );\n\t\t\tremoveNode( p.next );\n\n\t\t\tp = start = b;\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn filterPoints( p );\n\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut( start, triangles, dim, minX, minY, invSize ) {\n\n\t// look for a valid diagonal that divides the polygon into two\n\tlet a = start;\n\tdo {\n\n\t\tlet b = a.next.next;\n\t\twhile ( b !== a.prev ) {\n\n\t\t\tif ( a.i !== b.i && isValidDiagonal( a, b ) ) {\n\n\t\t\t\t// split the polygon in two by the diagonal\n\t\t\t\tlet c = splitPolygon( a, b );\n\n\t\t\t\t// filter colinear points around the cuts\n\t\t\t\ta = filterPoints( a, a.next );\n\t\t\t\tc = filterPoints( c, c.next );\n\n\t\t\t\t// run earcut on each half\n\t\t\t\tearcutLinked( a, triangles, dim, minX, minY, invSize, 0 );\n\t\t\t\tearcutLinked( c, triangles, dim, minX, minY, invSize, 0 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tb = b.next;\n\n\t\t}\n\n\t\ta = a.next;\n\n\t} while ( a !== start );\n\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles( data, holeIndices, outerNode, dim ) {\n\n\tconst queue = [];\n\tlet i, len, start, end, list;\n\n\tfor ( i = 0, len = holeIndices.length; i < len; i ++ ) {\n\n\t\tstart = holeIndices[ i ] * dim;\n\t\tend = i < len - 1 ? holeIndices[ i + 1 ] * dim : data.length;\n\t\tlist = linkedList( data, start, end, dim, false );\n\t\tif ( list === list.next ) list.steiner = true;\n\t\tqueue.push( getLeftmost( list ) );\n\n\t}\n\n\tqueue.sort( compareX );\n\n\t// process holes from left to right\n\tfor ( i = 0; i < queue.length; i ++ ) {\n\n\t\touterNode = eliminateHole( queue[ i ], outerNode );\n\n\t}\n\n\treturn outerNode;\n\n}\n\nfunction compareX( a, b ) {\n\n\treturn a.x - b.x;\n\n}\n\n// find a bridge between vertices that connects hole with an outer ring and link it\nfunction eliminateHole( hole, outerNode ) {\n\n\tconst bridge = findHoleBridge( hole, outerNode );\n\tif ( ! bridge ) {\n\n\t\treturn outerNode;\n\n\t}\n\n\tconst bridgeReverse = splitPolygon( bridge, hole );\n\n\t// filter collinear points around the cuts\n\tfilterPoints( bridgeReverse, bridgeReverse.next );\n\treturn filterPoints( bridge, bridge.next );\n\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge( hole, outerNode ) {\n\n\tlet p = outerNode,\n\t\tqx = - Infinity,\n\t\tm;\n\n\tconst hx = hole.x, hy = hole.y;\n\n\t// find a segment intersected by a ray from the hole's leftmost point to the left;\n\t// segment's endpoint with lesser x will be potential connection point\n\tdo {\n\n\t\tif ( hy <= p.y && hy >= p.next.y && p.next.y !== p.y ) {\n\n\t\t\tconst x = p.x + ( hy - p.y ) * ( p.next.x - p.x ) / ( p.next.y - p.y );\n\t\t\tif ( x <= hx && x > qx ) {\n\n\t\t\t\tqx = x;\n\t\t\t\tm = p.x < p.next.x ? p : p.next;\n\t\t\t\tif ( x === hx ) return m; // hole touches outer segment; pick leftmost endpoint\n\n\t\t\t}\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== outerNode );\n\n\tif ( ! m ) return null;\n\n\t// look for points inside the triangle of hole point, segment intersection and endpoint;\n\t// if there are no points found, we have a valid connection;\n\t// otherwise choose the point of the minimum angle with the ray as connection point\n\n\tconst stop = m,\n\t\tmx = m.x,\n\t\tmy = m.y;\n\tlet tanMin = Infinity, tan;\n\n\tp = m;\n\n\tdo {\n\n\t\tif ( hx >= p.x && p.x >= mx && hx !== p.x &&\n\t\t\t\tpointInTriangle( hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y ) ) {\n\n\t\t\ttan = Math.abs( hy - p.y ) / ( hx - p.x ); // tangential\n\n\t\t\tif ( locallyInside( p, hole ) && ( tan < tanMin || ( tan === tanMin && ( p.x > m.x || ( p.x === m.x && sectorContainsSector( m, p ) ) ) ) ) ) {\n\n\t\t\t\tm = p;\n\t\t\t\ttanMin = tan;\n\n\t\t\t}\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== stop );\n\n\treturn m;\n\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector( m, p ) {\n\n\treturn area( m.prev, m, p.prev ) < 0 && area( p.next, m, m.next ) < 0;\n\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve( start, minX, minY, invSize ) {\n\n\tlet p = start;\n\tdo {\n\n\t\tif ( p.z === 0 ) p.z = zOrder( p.x, p.y, minX, minY, invSize );\n\t\tp.prevZ = p.prev;\n\t\tp.nextZ = p.next;\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\tp.prevZ.nextZ = null;\n\tp.prevZ = null;\n\n\tsortLinked( p );\n\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked( list ) {\n\n\tlet i, p, q, e, tail, numMerges, pSize, qSize,\n\t\tinSize = 1;\n\n\tdo {\n\n\t\tp = list;\n\t\tlist = null;\n\t\ttail = null;\n\t\tnumMerges = 0;\n\n\t\twhile ( p ) {\n\n\t\t\tnumMerges ++;\n\t\t\tq = p;\n\t\t\tpSize = 0;\n\t\t\tfor ( i = 0; i < inSize; i ++ ) {\n\n\t\t\t\tpSize ++;\n\t\t\t\tq = q.nextZ;\n\t\t\t\tif ( ! q ) break;\n\n\t\t\t}\n\n\t\t\tqSize = inSize;\n\n\t\t\twhile ( pSize > 0 || ( qSize > 0 && q ) ) {\n\n\t\t\t\tif ( pSize !== 0 && ( qSize === 0 || ! q || p.z <= q.z ) ) {\n\n\t\t\t\t\te = p;\n\t\t\t\t\tp = p.nextZ;\n\t\t\t\t\tpSize --;\n\n\t\t\t\t} else {\n\n\t\t\t\t\te = q;\n\t\t\t\t\tq = q.nextZ;\n\t\t\t\t\tqSize --;\n\n\t\t\t\t}\n\n\t\t\t\tif ( tail ) tail.nextZ = e;\n\t\t\t\telse list = e;\n\n\t\t\t\te.prevZ = tail;\n\t\t\t\ttail = e;\n\n\t\t\t}\n\n\t\t\tp = q;\n\n\t\t}\n\n\t\ttail.nextZ = null;\n\t\tinSize *= 2;\n\n\t} while ( numMerges > 1 );\n\n\treturn list;\n\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder( x, y, minX, minY, invSize ) {\n\n\t// coords are transformed into non-negative 15-bit integer range\n\tx = ( x - minX ) * invSize | 0;\n\ty = ( y - minY ) * invSize | 0;\n\n\tx = ( x | ( x << 8 ) ) & 0x00FF00FF;\n\tx = ( x | ( x << 4 ) ) & 0x0F0F0F0F;\n\tx = ( x | ( x << 2 ) ) & 0x33333333;\n\tx = ( x | ( x << 1 ) ) & 0x55555555;\n\n\ty = ( y | ( y << 8 ) ) & 0x00FF00FF;\n\ty = ( y | ( y << 4 ) ) & 0x0F0F0F0F;\n\ty = ( y | ( y << 2 ) ) & 0x33333333;\n\ty = ( y | ( y << 1 ) ) & 0x55555555;\n\n\treturn x | ( y << 1 );\n\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost( start ) {\n\n\tlet p = start,\n\t\tleftmost = start;\n\tdo {\n\n\t\tif ( p.x < leftmost.x || ( p.x === leftmost.x && p.y < leftmost.y ) ) leftmost = p;\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn leftmost;\n\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {\n\n\treturn ( cx - px ) * ( ay - py ) >= ( ax - px ) * ( cy - py ) &&\n ( ax - px ) * ( by - py ) >= ( bx - px ) * ( ay - py ) &&\n ( bx - px ) * ( cy - py ) >= ( cx - px ) * ( by - py );\n\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal( a, b ) {\n\n\treturn a.next.i !== b.i && a.prev.i !== b.i && ! intersectsPolygon( a, b ) && // dones't intersect other edges\n ( locallyInside( a, b ) && locallyInside( b, a ) && middleInside( a, b ) && // locally visible\n ( area( a.prev, a, b.prev ) || area( a, b.prev, b ) ) || // does not create opposite-facing sectors\n equals( a, b ) && area( a.prev, a, a.next ) > 0 && area( b.prev, b, b.next ) > 0 ); // special zero-length case\n\n}\n\n// signed area of a triangle\nfunction area( p, q, r ) {\n\n\treturn ( q.y - p.y ) * ( r.x - q.x ) - ( q.x - p.x ) * ( r.y - q.y );\n\n}\n\n// check if two points are equal\nfunction equals( p1, p2 ) {\n\n\treturn p1.x === p2.x && p1.y === p2.y;\n\n}\n\n// check if two segments intersect\nfunction intersects( p1, q1, p2, q2 ) {\n\n\tconst o1 = sign( area( p1, q1, p2 ) );\n\tconst o2 = sign( area( p1, q1, q2 ) );\n\tconst o3 = sign( area( p2, q2, p1 ) );\n\tconst o4 = sign( area( p2, q2, q1 ) );\n\n\tif ( o1 !== o2 && o3 !== o4 ) return true; // general case\n\n\tif ( o1 === 0 && onSegment( p1, p2, q1 ) ) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n\tif ( o2 === 0 && onSegment( p1, q2, q1 ) ) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n\tif ( o3 === 0 && onSegment( p2, p1, q2 ) ) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n\tif ( o4 === 0 && onSegment( p2, q1, q2 ) ) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n\treturn false;\n\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment( p, q, r ) {\n\n\treturn q.x <= Math.max( p.x, r.x ) && q.x >= Math.min( p.x, r.x ) && q.y <= Math.max( p.y, r.y ) && q.y >= Math.min( p.y, r.y );\n\n}\n\nfunction sign( num ) {\n\n\treturn num > 0 ? 1 : num < 0 ? - 1 : 0;\n\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon( a, b ) {\n\n\tlet p = a;\n\tdo {\n\n\t\tif ( p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n\t\t\tintersects( p, p.next, a, b ) ) return true;\n\t\tp = p.next;\n\n\t} while ( p !== a );\n\n\treturn false;\n\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside( a, b ) {\n\n\treturn area( a.prev, a, a.next ) < 0 ?\n\t\tarea( a, b, a.next ) >= 0 && area( a, a.prev, b ) >= 0 :\n\t\tarea( a, b, a.prev ) < 0 || area( a, a.next, b ) < 0;\n\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside( a, b ) {\n\n\tlet p = a,\n\t\tinside = false;\n\tconst px = ( a.x + b.x ) / 2,\n\t\tpy = ( a.y + b.y ) / 2;\n\tdo {\n\n\t\tif ( ( ( p.y > py ) !== ( p.next.y > py ) ) && p.next.y !== p.y &&\n\t\t\t( px < ( p.next.x - p.x ) * ( py - p.y ) / ( p.next.y - p.y ) + p.x ) )\n\t\t\tinside = ! inside;\n\t\tp = p.next;\n\n\t} while ( p !== a );\n\n\treturn inside;\n\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon( a, b ) {\n\n\tconst a2 = new Node( a.i, a.x, a.y ),\n\t\tb2 = new Node( b.i, b.x, b.y ),\n\t\tan = a.next,\n\t\tbp = b.prev;\n\n\ta.next = b;\n\tb.prev = a;\n\n\ta2.next = an;\n\tan.prev = a2;\n\n\tb2.next = a2;\n\ta2.prev = b2;\n\n\tbp.next = b2;\n\tb2.prev = bp;\n\n\treturn b2;\n\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode( i, x, y, last ) {\n\n\tconst p = new Node( i, x, y );\n\n\tif ( ! last ) {\n\n\t\tp.prev = p;\n\t\tp.next = p;\n\n\t} else {\n\n\t\tp.next = last.next;\n\t\tp.prev = last;\n\t\tlast.next.prev = p;\n\t\tlast.next = p;\n\n\t}\n\n\treturn p;\n\n}\n\nfunction removeNode( p ) {\n\n\tp.next.prev = p.prev;\n\tp.prev.next = p.next;\n\n\tif ( p.prevZ ) p.prevZ.nextZ = p.nextZ;\n\tif ( p.nextZ ) p.nextZ.prevZ = p.prevZ;\n\n}\n\nfunction Node( i, x, y ) {\n\n\t// vertex index in coordinates array\n\tthis.i = i;\n\n\t// vertex coordinates\n\tthis.x = x;\n\tthis.y = y;\n\n\t// previous and next vertex nodes in a polygon ring\n\tthis.prev = null;\n\tthis.next = null;\n\n\t// z-order curve value\n\tthis.z = 0;\n\n\t// previous and next nodes in z-order\n\tthis.prevZ = null;\n\tthis.nextZ = null;\n\n\t// indicates whether this is a steiner point\n\tthis.steiner = false;\n\n}\n\nfunction signedArea( data, start, end, dim ) {\n\n\tlet sum = 0;\n\tfor ( let i = start, j = end - dim; i < end; i += dim ) {\n\n\t\tsum += ( data[ j ] - data[ i ] ) * ( data[ i + 1 ] + data[ j + 1 ] );\n\t\tj = i;\n\n\t}\n\n\treturn sum;\n\n}\n\nclass ShapeUtils {\n\n\t// calculate area of the contour polygon\n\n\tstatic area( contour ) {\n\n\t\tconst n = contour.length;\n\t\tlet a = 0.0;\n\n\t\tfor ( let p = n - 1, q = 0; q < n; p = q ++ ) {\n\n\t\t\ta += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y;\n\n\t\t}\n\n\t\treturn a * 0.5;\n\n\t}\n\n\tstatic isClockWise( pts ) {\n\n\t\treturn ShapeUtils.area( pts ) < 0;\n\n\t}\n\n\tstatic triangulateShape( contour, holes ) {\n\n\t\tconst vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ]\n\t\tconst holeIndices = []; // array of hole indices\n\t\tconst faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ]\n\n\t\tremoveDupEndPts( contour );\n\t\taddContour( vertices, contour );\n\n\t\t//\n\n\t\tlet holeIndex = contour.length;\n\n\t\tholes.forEach( removeDupEndPts );\n\n\t\tfor ( let i = 0; i < holes.length; i ++ ) {\n\n\t\t\tholeIndices.push( holeIndex );\n\t\t\tholeIndex += holes[ i ].length;\n\t\t\taddContour( vertices, holes[ i ] );\n\n\t\t}\n\n\t\t//\n\n\t\tconst triangles = Earcut.triangulate( vertices, holeIndices );\n\n\t\t//\n\n\t\tfor ( let i = 0; i < triangles.length; i += 3 ) {\n\n\t\t\tfaces.push( triangles.slice( i, i + 3 ) );\n\n\t\t}\n\n\t\treturn faces;\n\n\t}\n\n}\n\nfunction removeDupEndPts( points ) {\n\n\tconst l = points.length;\n\n\tif ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) {\n\n\t\tpoints.pop();\n\n\t}\n\n}\n\nfunction addContour( vertices, contour ) {\n\n\tfor ( let i = 0; i < contour.length; i ++ ) {\n\n\t\tvertices.push( contour[ i ].x );\n\t\tvertices.push( contour[ i ].y );\n\n\t}\n\n}\n\n/**\n * Creates extruded geometry from a path shape.\n *\n * parameters = {\n *\n * curveSegments: , // number of points on the curves\n * steps: , // number of points for z-side extrusions / used for subdividing segments of extrude spline too\n * depth: , // Depth to extrude the shape\n *\n * bevelEnabled: , // turn on bevel\n * bevelThickness: , // how deep into the original shape bevel goes\n * bevelSize: , // how far from shape outline (including bevelOffset) is bevel\n * bevelOffset: , // how far from shape outline does bevel start\n * bevelSegments: , // number of bevel layers\n *\n * extrudePath: // curve to extrude shape along\n *\n * UVGenerator: // object that provides UV generator functions\n *\n * }\n */\n\n\nclass ExtrudeGeometry extends BufferGeometry {\n\n\tconstructor( shapes = new Shape( [ new Vector2( 0.5, 0.5 ), new Vector2( - 0.5, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), options = {} ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ExtrudeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tshapes: shapes,\n\t\t\toptions: options\n\t\t};\n\n\t\tshapes = Array.isArray( shapes ) ? shapes : [ shapes ];\n\n\t\tconst scope = this;\n\n\t\tconst verticesArray = [];\n\t\tconst uvArray = [];\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\t\t\taddShape( shape );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( verticesArray, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvArray, 2 ) );\n\n\t\tthis.computeVertexNormals();\n\n\t\t// functions\n\n\t\tfunction addShape( shape ) {\n\n\t\t\tconst placeholder = [];\n\n\t\t\t// options\n\n\t\t\tconst curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;\n\t\t\tconst steps = options.steps !== undefined ? options.steps : 1;\n\t\t\tconst depth = options.depth !== undefined ? options.depth : 1;\n\n\t\t\tlet bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;\n\t\t\tlet bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 0.2;\n\t\t\tlet bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 0.1;\n\t\t\tlet bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;\n\t\t\tlet bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;\n\n\t\t\tconst extrudePath = options.extrudePath;\n\n\t\t\tconst uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator;\n\n\t\t\t//\n\n\t\t\tlet extrudePts, extrudeByPath = false;\n\t\t\tlet splineTube, binormal, normal, position2;\n\n\t\t\tif ( extrudePath ) {\n\n\t\t\t\textrudePts = extrudePath.getSpacedPoints( steps );\n\n\t\t\t\textrudeByPath = true;\n\t\t\t\tbevelEnabled = false; // bevels not supported for path extrusion\n\n\t\t\t\t// SETUP TNB variables\n\n\t\t\t\t// TODO1 - have a .isClosed in spline?\n\n\t\t\t\tsplineTube = extrudePath.computeFrenetFrames( steps, false );\n\n\t\t\t\t// console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);\n\n\t\t\t\tbinormal = new Vector3();\n\t\t\t\tnormal = new Vector3();\n\t\t\t\tposition2 = new Vector3();\n\n\t\t\t}\n\n\t\t\t// Safeguards if bevels are not enabled\n\n\t\t\tif ( ! bevelEnabled ) {\n\n\t\t\t\tbevelSegments = 0;\n\t\t\t\tbevelThickness = 0;\n\t\t\t\tbevelSize = 0;\n\t\t\t\tbevelOffset = 0;\n\n\t\t\t}\n\n\t\t\t// Variables initialization\n\n\t\t\tconst shapePoints = shape.extractPoints( curveSegments );\n\n\t\t\tlet vertices = shapePoints.shape;\n\t\t\tconst holes = shapePoints.holes;\n\n\t\t\tconst reverse = ! ShapeUtils.isClockWise( vertices );\n\n\t\t\tif ( reverse ) {\n\n\t\t\t\tvertices = vertices.reverse();\n\n\t\t\t\t// Maybe we should also check if holes are in the opposite direction, just to be safe ...\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\t\tif ( ShapeUtils.isClockWise( ahole ) ) {\n\n\t\t\t\t\t\tholes[ h ] = ahole.reverse();\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t\tconst faces = ShapeUtils.triangulateShape( vertices, holes );\n\n\t\t\t/* Vertices */\n\n\t\t\tconst contour = vertices; // vertices has all points but contour has only points of circumference\n\n\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\tvertices = vertices.concat( ahole );\n\n\t\t\t}\n\n\n\t\t\tfunction scalePt2( pt, vec, size ) {\n\n\t\t\t\tif ( ! vec ) console.error( 'THREE.ExtrudeGeometry: vec does not exist' );\n\n\t\t\t\treturn pt.clone().addScaledVector( vec, size );\n\n\t\t\t}\n\n\t\t\tconst vlen = vertices.length, flen = faces.length;\n\n\n\t\t\t// Find directions for point movement\n\n\n\t\t\tfunction getBevelVec( inPt, inPrev, inNext ) {\n\n\t\t\t\t// computes for inPt the corresponding point inPt' on a new contour\n\t\t\t\t// shifted by 1 unit (length of normalized vector) to the left\n\t\t\t\t// if we walk along contour clockwise, this new contour is outside the old one\n\t\t\t\t//\n\t\t\t\t// inPt' is the intersection of the two lines parallel to the two\n\t\t\t\t// adjacent edges of inPt at a distance of 1 unit on the left side.\n\n\t\t\t\tlet v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt\n\n\t\t\t\t// good reading for geometry algorithms (here: line-line intersection)\n\t\t\t\t// http://geomalgorithms.com/a05-_intersect-1.html\n\n\t\t\t\tconst v_prev_x = inPt.x - inPrev.x,\n\t\t\t\t\tv_prev_y = inPt.y - inPrev.y;\n\t\t\t\tconst v_next_x = inNext.x - inPt.x,\n\t\t\t\t\tv_next_y = inNext.y - inPt.y;\n\n\t\t\t\tconst v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y );\n\n\t\t\t\t// check for collinear edges\n\t\t\t\tconst collinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\t\tif ( Math.abs( collinear0 ) > Number.EPSILON ) {\n\n\t\t\t\t\t// not collinear\n\n\t\t\t\t\t// length of vectors for normalizing\n\n\t\t\t\t\tconst v_prev_len = Math.sqrt( v_prev_lensq );\n\t\t\t\t\tconst v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y );\n\n\t\t\t\t\t// shift adjacent points by unit vectors to the left\n\n\t\t\t\t\tconst ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len );\n\t\t\t\t\tconst ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len );\n\n\t\t\t\t\tconst ptNextShift_x = ( inNext.x - v_next_y / v_next_len );\n\t\t\t\t\tconst ptNextShift_y = ( inNext.y + v_next_x / v_next_len );\n\n\t\t\t\t\t// scaling factor for v_prev to intersection point\n\n\t\t\t\t\tconst sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y -\n\t\t\t\t\t\t\t( ptNextShift_y - ptPrevShift_y ) * v_next_x ) /\n\t\t\t\t\t\t( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\t\t\t// vector from inPt to intersection point\n\n\t\t\t\t\tv_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x );\n\t\t\t\t\tv_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y );\n\n\t\t\t\t\t// Don't normalize!, otherwise sharp corners become ugly\n\t\t\t\t\t// but prevent crazy spikes\n\t\t\t\t\tconst v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y );\n\t\t\t\t\tif ( v_trans_lensq <= 2 ) {\n\n\t\t\t\t\t\treturn new Vector2( v_trans_x, v_trans_y );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_trans_lensq / 2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// handle special case of collinear edges\n\n\t\t\t\t\tlet direction_eq = false; // assumes: opposite\n\n\t\t\t\t\tif ( v_prev_x > Number.EPSILON ) {\n\n\t\t\t\t\t\tif ( v_next_x > Number.EPSILON ) {\n\n\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( v_prev_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\t\tif ( v_next_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( Math.sign( v_prev_y ) === Math.sign( v_next_y ) ) {\n\n\t\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( direction_eq ) {\n\n\t\t\t\t\t\t// console.log(\"Warning: lines are a straight sequence\");\n\t\t\t\t\t\tv_trans_x = - v_prev_y;\n\t\t\t\t\t\tv_trans_y = v_prev_x;\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// console.log(\"Warning: lines are a straight spike\");\n\t\t\t\t\t\tv_trans_x = v_prev_x;\n\t\t\t\t\t\tv_trans_y = v_prev_y;\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq / 2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn new Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by );\n\n\t\t\t}\n\n\n\t\t\tconst contourMovements = [];\n\n\t\t\tfor ( let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\t\tif ( j === il ) j = 0;\n\t\t\t\tif ( k === il ) k = 0;\n\n\t\t\t\t// (j)---(i)---(k)\n\t\t\t\t// console.log('i,j,k', i, j , k)\n\n\t\t\t\tcontourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );\n\n\t\t\t}\n\n\t\t\tconst holesMovements = [];\n\t\t\tlet oneHoleMovements, verticesMovements = contourMovements.concat();\n\n\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\toneHoleMovements = [];\n\n\t\t\t\tfor ( let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\t\t\tif ( j === il ) j = 0;\n\t\t\t\t\tif ( k === il ) k = 0;\n\n\t\t\t\t\t// (j)---(i)---(k)\n\t\t\t\t\toneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );\n\n\t\t\t\t}\n\n\t\t\t\tholesMovements.push( oneHoleMovements );\n\t\t\t\tverticesMovements = verticesMovements.concat( oneHoleMovements );\n\n\t\t\t}\n\n\n\t\t\t// Loop bevelSegments, 1 for the front, 1 for the back\n\n\t\t\tfor ( let b = 0; b < bevelSegments; b ++ ) {\n\n\t\t\t\t//for ( b = bevelSegments; b > 0; b -- ) {\n\n\t\t\t\tconst t = b / bevelSegments;\n\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t\t// contract shape\n\n\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\n\t\t\t\t\tv( vert.x, vert.y, - z );\n\n\t\t\t\t}\n\n\t\t\t\t// expand holes\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\toneHoleMovements = holesMovements[ h ];\n\n\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\t\tv( vert.x, vert.y, - z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst bs = bevelSize + bevelOffset;\n\n\t\t\t// Back facing vertices\n\n\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\n\n\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\tv( vert.x, vert.y, 0 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );\n\n\t\t\t\t\tnormal.copy( splineTube.normals[ 0 ] ).multiplyScalar( vert.x );\n\t\t\t\t\tbinormal.copy( splineTube.binormals[ 0 ] ).multiplyScalar( vert.y );\n\n\t\t\t\t\tposition2.copy( extrudePts[ 0 ] ).add( normal ).add( binormal );\n\n\t\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Add stepped vertices...\n\t\t\t// Including front facing vertices\n\n\t\t\tfor ( let s = 1; s <= steps; s ++ ) {\n\n\t\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\n\n\t\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\t\tv( vert.x, vert.y, depth / steps * s );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );\n\n\t\t\t\t\t\tnormal.copy( splineTube.normals[ s ] ).multiplyScalar( vert.x );\n\t\t\t\t\t\tbinormal.copy( splineTube.binormals[ s ] ).multiplyScalar( vert.y );\n\n\t\t\t\t\t\tposition2.copy( extrudePts[ s ] ).add( normal ).add( binormal );\n\n\t\t\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t\t// Add bevel segments planes\n\n\t\t\t//for ( b = 1; b <= bevelSegments; b ++ ) {\n\t\t\tfor ( let b = bevelSegments - 1; b >= 0; b -- ) {\n\n\t\t\t\tconst t = b / bevelSegments;\n\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t\t// contract shape\n\n\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\t\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t\t}\n\n\t\t\t\t// expand holes\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\toneHoleMovements = holesMovements[ h ];\n\n\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tv( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t/* Faces */\n\n\t\t\t// Top and bottom faces\n\n\t\t\tbuildLidFaces();\n\n\t\t\t// Sides faces\n\n\t\t\tbuildSideFaces();\n\n\n\t\t\t///// Internal functions\n\n\t\t\tfunction buildLidFaces() {\n\n\t\t\t\tconst start = verticesArray.length / 3;\n\n\t\t\t\tif ( bevelEnabled ) {\n\n\t\t\t\t\tlet layer = 0; // steps + 1\n\t\t\t\t\tlet offset = vlen * layer;\n\n\t\t\t\t\t// Bottom faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tlayer = steps + bevelSegments * 2;\n\t\t\t\t\toffset = vlen * layer;\n\n\t\t\t\t\t// Top faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Bottom faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 2 ], face[ 1 ], face[ 0 ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Top faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 0 );\n\n\t\t\t}\n\n\t\t\t// Create faces for the z-sides of the shape\n\n\t\t\tfunction buildSideFaces() {\n\n\t\t\t\tconst start = verticesArray.length / 3;\n\t\t\t\tlet layeroffset = 0;\n\t\t\t\tsidewalls( contour, layeroffset );\n\t\t\t\tlayeroffset += contour.length;\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t\t\t//, true\n\t\t\t\t\tlayeroffset += ahole.length;\n\n\t\t\t\t}\n\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n\n\n\t\t\t}\n\n\t\t\tfunction sidewalls( contour, layeroffset ) {\n\n\t\t\t\tlet i = contour.length;\n\n\t\t\t\twhile ( -- i >= 0 ) {\n\n\t\t\t\t\tconst j = i;\n\t\t\t\t\tlet k = i - 1;\n\t\t\t\t\tif ( k < 0 ) k = contour.length - 1;\n\n\t\t\t\t\t//console.log('b', i,j, i-1, k,vertices.length);\n\n\t\t\t\t\tfor ( let s = 0, sl = ( steps + bevelSegments * 2 ); s < sl; s ++ ) {\n\n\t\t\t\t\t\tconst slen1 = vlen * s;\n\t\t\t\t\t\tconst slen2 = vlen * ( s + 1 );\n\n\t\t\t\t\t\tconst a = layeroffset + j + slen1,\n\t\t\t\t\t\t\tb = layeroffset + k + slen1,\n\t\t\t\t\t\t\tc = layeroffset + k + slen2,\n\t\t\t\t\t\t\td = layeroffset + j + slen2;\n\n\t\t\t\t\t\tf4( a, b, c, d );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tfunction v( x, y, z ) {\n\n\t\t\t\tplaceholder.push( x );\n\t\t\t\tplaceholder.push( y );\n\t\t\t\tplaceholder.push( z );\n\n\t\t\t}\n\n\n\t\t\tfunction f3( a, b, c ) {\n\n\t\t\t\taddVertex( a );\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( c );\n\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\n\t\t\t\tconst uvs = uvgen.generateTopUV( scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\t\taddUV( uvs[ 0 ] );\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 2 ] );\n\n\t\t\t}\n\n\t\t\tfunction f4( a, b, c, d ) {\n\n\t\t\t\taddVertex( a );\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( d );\n\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( c );\n\t\t\t\taddVertex( d );\n\n\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\n\t\t\t\tconst uvs = uvgen.generateSideWallUV( scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\t\taddUV( uvs[ 0 ] );\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 3 ] );\n\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 2 ] );\n\t\t\t\taddUV( uvs[ 3 ] );\n\n\t\t\t}\n\n\t\t\tfunction addVertex( index ) {\n\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 0 ] );\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 1 ] );\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 2 ] );\n\n\t\t\t}\n\n\n\t\t\tfunction addUV( vector2 ) {\n\n\t\t\t\tuvArray.push( vector2.x );\n\t\t\t\tuvArray.push( vector2.y );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tconst shapes = this.parameters.shapes;\n\t\tconst options = this.parameters.options;\n\n\t\treturn toJSON$1( shapes, options, data );\n\n\t}\n\n\tstatic fromJSON( data, shapes ) {\n\n\t\tconst geometryShapes = [];\n\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\n\n\t\t\tgeometryShapes.push( shape );\n\n\t\t}\n\n\t\tconst extrudePath = data.options.extrudePath;\n\n\t\tif ( extrudePath !== undefined ) {\n\n\t\t\tdata.options.extrudePath = new Curves[ extrudePath.type ]().fromJSON( extrudePath );\n\n\t\t}\n\n\t\treturn new ExtrudeGeometry( geometryShapes, data.options );\n\n\t}\n\n}\n\nconst WorldUVGenerator = {\n\n\tgenerateTopUV: function ( geometry, vertices, indexA, indexB, indexC ) {\n\n\t\tconst a_x = vertices[ indexA * 3 ];\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\n\t\tconst b_x = vertices[ indexB * 3 ];\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\n\t\tconst c_x = vertices[ indexC * 3 ];\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\n\n\t\treturn [\n\t\t\tnew Vector2( a_x, a_y ),\n\t\t\tnew Vector2( b_x, b_y ),\n\t\t\tnew Vector2( c_x, c_y )\n\t\t];\n\n\t},\n\n\tgenerateSideWallUV: function ( geometry, vertices, indexA, indexB, indexC, indexD ) {\n\n\t\tconst a_x = vertices[ indexA * 3 ];\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\n\t\tconst a_z = vertices[ indexA * 3 + 2 ];\n\t\tconst b_x = vertices[ indexB * 3 ];\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\n\t\tconst b_z = vertices[ indexB * 3 + 2 ];\n\t\tconst c_x = vertices[ indexC * 3 ];\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\n\t\tconst c_z = vertices[ indexC * 3 + 2 ];\n\t\tconst d_x = vertices[ indexD * 3 ];\n\t\tconst d_y = vertices[ indexD * 3 + 1 ];\n\t\tconst d_z = vertices[ indexD * 3 + 2 ];\n\n\t\tif ( Math.abs( a_y - b_y ) < Math.abs( a_x - b_x ) ) {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_x, 1 - a_z ),\n\t\t\t\tnew Vector2( b_x, 1 - b_z ),\n\t\t\t\tnew Vector2( c_x, 1 - c_z ),\n\t\t\t\tnew Vector2( d_x, 1 - d_z )\n\t\t\t];\n\n\t\t} else {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_y, 1 - a_z ),\n\t\t\t\tnew Vector2( b_y, 1 - b_z ),\n\t\t\t\tnew Vector2( c_y, 1 - c_z ),\n\t\t\t\tnew Vector2( d_y, 1 - d_z )\n\t\t\t];\n\n\t\t}\n\n\t}\n\n};\n\nfunction toJSON$1( shapes, options, data ) {\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\tdata.options = Object.assign( {}, options );\n\n\tif ( options.extrudePath !== undefined ) data.options.extrudePath = options.extrudePath.toJSON();\n\n\treturn data;\n\n}\n\nclass IcosahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst t = ( 1 + Math.sqrt( 5 ) ) / 2;\n\n\t\tconst vertices = [\n\t\t\t- 1, t, 0, \t1, t, 0, \t- 1, - t, 0, \t1, - t, 0,\n\t\t\t0, - 1, t, \t0, 1, t,\t0, - 1, - t, \t0, 1, - t,\n\t\t\tt, 0, - 1, \tt, 0, 1, \t- t, 0, - 1, \t- t, 0, 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t0, 11, 5, \t0, 5, 1, \t0, 1, 7, \t0, 7, 10, \t0, 10, 11,\n\t\t\t1, 5, 9, \t5, 11, 4,\t11, 10, 2,\t10, 7, 6,\t7, 1, 8,\n\t\t\t3, 9, 4, \t3, 4, 2,\t3, 2, 6,\t3, 6, 8,\t3, 8, 9,\n\t\t\t4, 9, 5, \t2, 4, 11,\t6, 2, 10,\t8, 6, 7,\t9, 8, 1\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'IcosahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new IcosahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass OctahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst vertices = [\n\t\t\t1, 0, 0, \t- 1, 0, 0,\t0, 1, 0,\n\t\t\t0, - 1, 0, \t0, 0, 1,\t0, 0, - 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t0, 2, 4,\t0, 4, 3,\t0, 3, 5,\n\t\t\t0, 5, 2,\t1, 2, 5,\t1, 5, 3,\n\t\t\t1, 3, 4,\t1, 4, 2\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'OctahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new OctahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass RingGeometry extends BufferGeometry {\n\n\tconstructor( innerRadius = 0.5, outerRadius = 1, thetaSegments = 32, phiSegments = 1, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'RingGeometry';\n\n\t\tthis.parameters = {\n\t\t\tinnerRadius: innerRadius,\n\t\t\touterRadius: outerRadius,\n\t\t\tthetaSegments: thetaSegments,\n\t\t\tphiSegments: phiSegments,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tthetaSegments = Math.max( 3, thetaSegments );\n\t\tphiSegments = Math.max( 1, phiSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// some helper variables\n\n\t\tlet radius = innerRadius;\n\t\tconst radiusStep = ( ( outerRadius - innerRadius ) / phiSegments );\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let j = 0; j <= phiSegments; j ++ ) {\n\n\t\t\tfor ( let i = 0; i <= thetaSegments; i ++ ) {\n\n\t\t\t\t// values are generate from the inside of the ring to the outside\n\n\t\t\t\tconst segment = thetaStart + i / thetaSegments * thetaLength;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = radius * Math.cos( segment );\n\t\t\t\tvertex.y = radius * Math.sin( segment );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = ( vertex.x / outerRadius + 1 ) / 2;\n\t\t\t\tuv.y = ( vertex.y / outerRadius + 1 ) / 2;\n\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t}\n\n\t\t\t// increase the radius for next row of vertices\n\n\t\t\tradius += radiusStep;\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let j = 0; j < phiSegments; j ++ ) {\n\n\t\t\tconst thetaSegmentLevel = j * ( thetaSegments + 1 );\n\n\t\t\tfor ( let i = 0; i < thetaSegments; i ++ ) {\n\n\t\t\t\tconst segment = i + thetaSegmentLevel;\n\n\t\t\t\tconst a = segment;\n\t\t\t\tconst b = segment + thetaSegments + 1;\n\t\t\t\tconst c = segment + thetaSegments + 2;\n\t\t\t\tconst d = segment + 1;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new RingGeometry( data.innerRadius, data.outerRadius, data.thetaSegments, data.phiSegments, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass ShapeGeometry extends BufferGeometry {\n\n\tconstructor( shapes = new Shape( [ new Vector2( 0, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), curveSegments = 12 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ShapeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tshapes: shapes,\n\t\t\tcurveSegments: curveSegments\n\t\t};\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet groupStart = 0;\n\t\tlet groupCount = 0;\n\n\t\t// allow single and array values for \"shapes\" parameter\n\n\t\tif ( Array.isArray( shapes ) === false ) {\n\n\t\t\taddShape( shapes );\n\n\t\t} else {\n\n\t\t\tfor ( let i = 0; i < shapes.length; i ++ ) {\n\n\t\t\t\taddShape( shapes[ i ] );\n\n\t\t\t\tthis.addGroup( groupStart, groupCount, i ); // enables MultiMaterial support\n\n\t\t\t\tgroupStart += groupCount;\n\t\t\t\tgroupCount = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\n\t\t// helper functions\n\n\t\tfunction addShape( shape ) {\n\n\t\t\tconst indexOffset = vertices.length / 3;\n\t\t\tconst points = shape.extractPoints( curveSegments );\n\n\t\t\tlet shapeVertices = points.shape;\n\t\t\tconst shapeHoles = points.holes;\n\n\t\t\t// check direction of vertices\n\n\t\t\tif ( ShapeUtils.isClockWise( shapeVertices ) === false ) {\n\n\t\t\t\tshapeVertices = shapeVertices.reverse();\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\n\n\t\t\t\tif ( ShapeUtils.isClockWise( shapeHole ) === true ) {\n\n\t\t\t\t\tshapeHoles[ i ] = shapeHole.reverse();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst faces = ShapeUtils.triangulateShape( shapeVertices, shapeHoles );\n\n\t\t\t// join vertices of inner and outer paths to a single array\n\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\n\t\t\t\tshapeVertices = shapeVertices.concat( shapeHole );\n\n\t\t\t}\n\n\t\t\t// vertices, normals, uvs\n\n\t\t\tfor ( let i = 0, l = shapeVertices.length; i < l; i ++ ) {\n\n\t\t\t\tconst vertex = shapeVertices[ i ];\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, 0 );\n\t\t\t\tnormals.push( 0, 0, 1 );\n\t\t\t\tuvs.push( vertex.x, vertex.y ); // world uvs\n\n\t\t\t}\n\n\t\t\t// indices\n\n\t\t\tfor ( let i = 0, l = faces.length; i < l; i ++ ) {\n\n\t\t\t\tconst face = faces[ i ];\n\n\t\t\t\tconst a = face[ 0 ] + indexOffset;\n\t\t\t\tconst b = face[ 1 ] + indexOffset;\n\t\t\t\tconst c = face[ 2 ] + indexOffset;\n\n\t\t\t\tindices.push( a, b, c );\n\t\t\t\tgroupCount += 3;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tconst shapes = this.parameters.shapes;\n\n\t\treturn toJSON( shapes, data );\n\n\t}\n\n\tstatic fromJSON( data, shapes ) {\n\n\t\tconst geometryShapes = [];\n\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\n\n\t\t\tgeometryShapes.push( shape );\n\n\t\t}\n\n\t\treturn new ShapeGeometry( geometryShapes, data.curveSegments );\n\n\t}\n\n}\n\nfunction toJSON( shapes, data ) {\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\treturn data;\n\n}\n\nclass SphereGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, widthSegments = 32, heightSegments = 16, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'SphereGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tphiStart: phiStart,\n\t\t\tphiLength: phiLength,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\twidthSegments = Math.max( 3, Math.floor( widthSegments ) );\n\t\theightSegments = Math.max( 2, Math.floor( heightSegments ) );\n\n\t\tconst thetaEnd = Math.min( thetaStart + thetaLength, Math.PI );\n\n\t\tlet index = 0;\n\t\tconst grid = [];\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let iy = 0; iy <= heightSegments; iy ++ ) {\n\n\t\t\tconst verticesRow = [];\n\n\t\t\tconst v = iy / heightSegments;\n\n\t\t\t// special case for the poles\n\n\t\t\tlet uOffset = 0;\n\n\t\t\tif ( iy === 0 && thetaStart === 0 ) {\n\n\t\t\t\tuOffset = 0.5 / widthSegments;\n\n\t\t\t} else if ( iy === heightSegments && thetaEnd === Math.PI ) {\n\n\t\t\t\tuOffset = - 0.5 / widthSegments;\n\n\t\t\t}\n\n\t\t\tfor ( let ix = 0; ix <= widthSegments; ix ++ ) {\n\n\t\t\t\tconst u = ix / widthSegments;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\t\t\t\tvertex.y = radius * Math.cos( thetaStart + v * thetaLength );\n\t\t\t\tvertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormal.copy( vertex ).normalize();\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( u + uOffset, 1 - v );\n\n\t\t\t\tverticesRow.push( index ++ );\n\n\t\t\t}\n\n\t\t\tgrid.push( verticesRow );\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let iy = 0; iy < heightSegments; iy ++ ) {\n\n\t\t\tfor ( let ix = 0; ix < widthSegments; ix ++ ) {\n\n\t\t\t\tconst a = grid[ iy ][ ix + 1 ];\n\t\t\t\tconst b = grid[ iy ][ ix ];\n\t\t\t\tconst c = grid[ iy + 1 ][ ix ];\n\t\t\t\tconst d = grid[ iy + 1 ][ ix + 1 ];\n\n\t\t\t\tif ( iy !== 0 || thetaStart > 0 ) indices.push( a, b, d );\n\t\t\t\tif ( iy !== heightSegments - 1 || thetaEnd < Math.PI ) indices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new SphereGeometry( data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass TetrahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst vertices = [\n\t\t\t1, 1, 1, \t- 1, - 1, 1, \t- 1, 1, - 1, \t1, - 1, - 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t2, 1, 0, \t0, 3, 2,\t1, 3, 0,\t2, 3, 1\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'TetrahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TetrahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass TorusGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, tube = 0.4, radialSegments = 12, tubularSegments = 48, arc = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TorusGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\ttube: tube,\n\t\t\tradialSegments: radialSegments,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tarc: arc\n\t\t};\n\n\t\tradialSegments = Math.floor( radialSegments );\n\t\ttubularSegments = Math.floor( tubularSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst center = new Vector3();\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\tfor ( let i = 0; i <= tubularSegments; i ++ ) {\n\n\t\t\t\tconst u = i / tubularSegments * arc;\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u );\n\t\t\t\tvertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u );\n\t\t\t\tvertex.z = tube * Math.sin( v );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tcenter.x = radius * Math.cos( u );\n\t\t\t\tcenter.y = radius * Math.sin( u );\n\t\t\t\tnormal.subVectors( vertex, center ).normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( i / tubularSegments );\n\t\t\t\tuvs.push( j / radialSegments );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate indices\n\n\t\tfor ( let j = 1; j <= radialSegments; j ++ ) {\n\n\t\t\tfor ( let i = 1; i <= tubularSegments; i ++ ) {\n\n\t\t\t\t// indices\n\n\t\t\t\tconst a = ( tubularSegments + 1 ) * j + i - 1;\n\t\t\t\tconst b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1;\n\t\t\t\tconst c = ( tubularSegments + 1 ) * ( j - 1 ) + i;\n\t\t\t\tconst d = ( tubularSegments + 1 ) * j + i;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TorusGeometry( data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc );\n\n\t}\n\n}\n\nclass TorusKnotGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, tube = 0.4, tubularSegments = 64, radialSegments = 8, p = 2, q = 3 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TorusKnotGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\ttube: tube,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tradialSegments: radialSegments,\n\t\t\tp: p,\n\t\t\tq: q\n\t\t};\n\n\t\ttubularSegments = Math.floor( tubularSegments );\n\t\tradialSegments = Math.floor( radialSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\tconst P1 = new Vector3();\n\t\tconst P2 = new Vector3();\n\n\t\tconst B = new Vector3();\n\t\tconst T = new Vector3();\n\t\tconst N = new Vector3();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let i = 0; i <= tubularSegments; ++ i ) {\n\n\t\t\t// the radian \"u\" is used to calculate the position on the torus curve of the current tubular segment\n\n\t\t\tconst u = i / tubularSegments * p * Math.PI * 2;\n\n\t\t\t// now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead.\n\t\t\t// these points are used to create a special \"coordinate space\", which is necessary to calculate the correct vertex positions\n\n\t\t\tcalculatePositionOnCurve( u, p, q, radius, P1 );\n\t\t\tcalculatePositionOnCurve( u + 0.01, p, q, radius, P2 );\n\n\t\t\t// calculate orthonormal basis\n\n\t\t\tT.subVectors( P2, P1 );\n\t\t\tN.addVectors( P2, P1 );\n\t\t\tB.crossVectors( T, N );\n\t\t\tN.crossVectors( B, T );\n\n\t\t\t// normalize B, N. T can be ignored, we don't use it\n\n\t\t\tB.normalize();\n\t\t\tN.normalize();\n\n\t\t\tfor ( let j = 0; j <= radialSegments; ++ j ) {\n\n\t\t\t\t// now calculate the vertices. they are nothing more than an extrusion of the torus curve.\n\t\t\t\t// because we extrude a shape in the xy-plane, there is no need to calculate a z-value.\n\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\t\t\t\tconst cx = - tube * Math.cos( v );\n\t\t\t\tconst cy = tube * Math.sin( v );\n\n\t\t\t\t// now calculate the final vertex position.\n\t\t\t\t// first we orient the extrusion with our basis vectors, then we add it to the current position on the curve\n\n\t\t\t\tvertex.x = P1.x + ( cx * N.x + cy * B.x );\n\t\t\t\tvertex.y = P1.y + ( cx * N.y + cy * B.y );\n\t\t\t\tvertex.z = P1.z + ( cx * N.z + cy * B.z );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal)\n\n\t\t\t\tnormal.subVectors( vertex, P1 ).normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( i / tubularSegments );\n\t\t\t\tuvs.push( j / radialSegments );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate indices\n\n\t\tfor ( let j = 1; j <= tubularSegments; j ++ ) {\n\n\t\t\tfor ( let i = 1; i <= radialSegments; i ++ ) {\n\n\t\t\t\t// indices\n\n\t\t\t\tconst a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\n\t\t\t\tconst b = ( radialSegments + 1 ) * j + ( i - 1 );\n\t\t\t\tconst c = ( radialSegments + 1 ) * j + i;\n\t\t\t\tconst d = ( radialSegments + 1 ) * ( j - 1 ) + i;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\t// this function calculates the current position on the torus curve\n\n\t\tfunction calculatePositionOnCurve( u, p, q, radius, position ) {\n\n\t\t\tconst cu = Math.cos( u );\n\t\t\tconst su = Math.sin( u );\n\t\t\tconst quOverP = q / p * u;\n\t\t\tconst cs = Math.cos( quOverP );\n\n\t\t\tposition.x = radius * ( 2 + cs ) * 0.5 * cu;\n\t\t\tposition.y = radius * ( 2 + cs ) * su * 0.5;\n\t\t\tposition.z = radius * Math.sin( quOverP ) * 0.5;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TorusKnotGeometry( data.radius, data.tube, data.tubularSegments, data.radialSegments, data.p, data.q );\n\n\t}\n\n}\n\nclass TubeGeometry extends BufferGeometry {\n\n\tconstructor( path = new QuadraticBezierCurve3( new Vector3( - 1, - 1, 0 ), new Vector3( - 1, 1, 0 ), new Vector3( 1, 1, 0 ) ), tubularSegments = 64, radius = 1, radialSegments = 8, closed = false ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TubeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tpath: path,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tradius: radius,\n\t\t\tradialSegments: radialSegments,\n\t\t\tclosed: closed\n\t\t};\n\n\t\tconst frames = path.computeFrenetFrames( tubularSegments, closed );\n\n\t\t// expose internals\n\n\t\tthis.tangents = frames.tangents;\n\t\tthis.normals = frames.normals;\n\t\tthis.binormals = frames.binormals;\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\t\tconst uv = new Vector2();\n\t\tlet P = new Vector3();\n\n\t\t// buffer\n\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\t\tconst indices = [];\n\n\t\t// create buffer data\n\n\t\tgenerateBufferData();\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\t// functions\n\n\t\tfunction generateBufferData() {\n\n\t\t\tfor ( let i = 0; i < tubularSegments; i ++ ) {\n\n\t\t\t\tgenerateSegment( i );\n\n\t\t\t}\n\n\t\t\t// if the geometry is not closed, generate the last row of vertices and normals\n\t\t\t// at the regular position on the given path\n\t\t\t//\n\t\t\t// if the geometry is closed, duplicate the first row of vertices and normals (uvs will differ)\n\n\t\t\tgenerateSegment( ( closed === false ) ? tubularSegments : 0 );\n\n\t\t\t// uvs are generated in a separate function.\n\t\t\t// this makes it easy compute correct values for closed geometries\n\n\t\t\tgenerateUVs();\n\n\t\t\t// finally create faces\n\n\t\t\tgenerateIndices();\n\n\t\t}\n\n\t\tfunction generateSegment( i ) {\n\n\t\t\t// we use getPointAt to sample evenly distributed points from the given path\n\n\t\t\tP = path.getPointAt( i / tubularSegments, P );\n\n\t\t\t// retrieve corresponding normal and binormal\n\n\t\t\tconst N = frames.normals[ i ];\n\t\t\tconst B = frames.binormals[ i ];\n\n\t\t\t// generate normals and vertices for the current segment\n\n\t\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\n\t\t\t\tconst sin = Math.sin( v );\n\t\t\t\tconst cos = - Math.cos( v );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormal.x = ( cos * N.x + sin * B.x );\n\t\t\t\tnormal.y = ( cos * N.y + sin * B.y );\n\t\t\t\tnormal.z = ( cos * N.z + sin * B.z );\n\t\t\t\tnormal.normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = P.x + radius * normal.x;\n\t\t\t\tvertex.y = P.y + radius * normal.y;\n\t\t\t\tvertex.z = P.z + radius * normal.z;\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateIndices() {\n\n\t\t\tfor ( let j = 1; j <= tubularSegments; j ++ ) {\n\n\t\t\t\tfor ( let i = 1; i <= radialSegments; i ++ ) {\n\n\t\t\t\t\tconst a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\n\t\t\t\t\tconst b = ( radialSegments + 1 ) * j + ( i - 1 );\n\t\t\t\t\tconst c = ( radialSegments + 1 ) * j + i;\n\t\t\t\t\tconst d = ( radialSegments + 1 ) * ( j - 1 ) + i;\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateUVs() {\n\n\t\t\tfor ( let i = 0; i <= tubularSegments; i ++ ) {\n\n\t\t\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\t\t\tuv.x = i / tubularSegments;\n\t\t\t\t\tuv.y = j / radialSegments;\n\n\t\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.path = this.parameters.path.toJSON();\n\n\t\treturn data;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\t// This only works for built-in curves (e.g. CatmullRomCurve3).\n\t\t// User defined curves or instances of CurvePath will not be deserialized.\n\t\treturn new TubeGeometry(\n\t\t\tnew Curves[ data.path.type ]().fromJSON( data.path ),\n\t\t\tdata.tubularSegments,\n\t\t\tdata.radius,\n\t\t\tdata.radialSegments,\n\t\t\tdata.closed\n\t\t);\n\n\t}\n\n}\n\nclass WireframeGeometry extends BufferGeometry {\n\n\tconstructor( geometry = null ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'WireframeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tgeometry: geometry\n\t\t};\n\n\t\tif ( geometry !== null ) {\n\n\t\t\t// buffer\n\n\t\t\tconst vertices = [];\n\t\t\tconst edges = new Set();\n\n\t\t\t// helper variables\n\n\t\t\tconst start = new Vector3();\n\t\t\tconst end = new Vector3();\n\n\t\t\tif ( geometry.index !== null ) {\n\n\t\t\t\t// indexed BufferGeometry\n\n\t\t\t\tconst position = geometry.attributes.position;\n\t\t\t\tconst indices = geometry.index;\n\t\t\t\tlet groups = geometry.groups;\n\n\t\t\t\tif ( groups.length === 0 ) {\n\n\t\t\t\t\tgroups = [ { start: 0, count: indices.count, materialIndex: 0 } ];\n\n\t\t\t\t}\n\n\t\t\t\t// create a data structure that contains all edges without duplicates\n\n\t\t\t\tfor ( let o = 0, ol = groups.length; o < ol; ++ o ) {\n\n\t\t\t\t\tconst group = groups[ o ];\n\n\t\t\t\t\tconst groupStart = group.start;\n\t\t\t\t\tconst groupCount = group.count;\n\n\t\t\t\t\tfor ( let i = groupStart, l = ( groupStart + groupCount ); i < l; i += 3 ) {\n\n\t\t\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t\t\tconst index1 = indices.getX( i + j );\n\t\t\t\t\t\t\tconst index2 = indices.getX( i + ( j + 1 ) % 3 );\n\n\t\t\t\t\t\t\tstart.fromBufferAttribute( position, index1 );\n\t\t\t\t\t\t\tend.fromBufferAttribute( position, index2 );\n\n\t\t\t\t\t\t\tif ( isUniqueEdge( start, end, edges ) === true ) {\n\n\t\t\t\t\t\t\t\tvertices.push( start.x, start.y, start.z );\n\t\t\t\t\t\t\t\tvertices.push( end.x, end.y, end.z );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// non-indexed BufferGeometry\n\n\t\t\t\tconst position = geometry.attributes.position;\n\n\t\t\t\tfor ( let i = 0, l = ( position.count / 3 ); i < l; i ++ ) {\n\n\t\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t\t// three edges per triangle, an edge is represented as (index1, index2)\n\t\t\t\t\t\t// e.g. the first triangle has the following edges: (0,1),(1,2),(2,0)\n\n\t\t\t\t\t\tconst index1 = 3 * i + j;\n\t\t\t\t\t\tconst index2 = 3 * i + ( ( j + 1 ) % 3 );\n\n\t\t\t\t\t\tstart.fromBufferAttribute( position, index1 );\n\t\t\t\t\t\tend.fromBufferAttribute( position, index2 );\n\n\t\t\t\t\t\tif ( isUniqueEdge( start, end, edges ) === true ) {\n\n\t\t\t\t\t\t\tvertices.push( start.x, start.y, start.z );\n\t\t\t\t\t\t\tvertices.push( end.x, end.y, end.z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// build geometry\n\n\t\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n}\n\nfunction isUniqueEdge( start, end, edges ) {\n\n\tconst hash1 = `${start.x},${start.y},${start.z}-${end.x},${end.y},${end.z}`;\n\tconst hash2 = `${end.x},${end.y},${end.z}-${start.x},${start.y},${start.z}`; // coincident edge\n\n\tif ( edges.has( hash1 ) === true || edges.has( hash2 ) === true ) {\n\n\t\treturn false;\n\n\t} else {\n\n\t\tedges.add( hash1 );\n\t\tedges.add( hash2 );\n\t\treturn true;\n\n\t}\n\n}\n\nvar Geometries = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tBoxGeometry: BoxGeometry,\n\tCapsuleGeometry: CapsuleGeometry,\n\tCircleGeometry: CircleGeometry,\n\tConeGeometry: ConeGeometry,\n\tCylinderGeometry: CylinderGeometry,\n\tDodecahedronGeometry: DodecahedronGeometry,\n\tEdgesGeometry: EdgesGeometry,\n\tExtrudeGeometry: ExtrudeGeometry,\n\tIcosahedronGeometry: IcosahedronGeometry,\n\tLatheGeometry: LatheGeometry,\n\tOctahedronGeometry: OctahedronGeometry,\n\tPlaneGeometry: PlaneGeometry,\n\tPolyhedronGeometry: PolyhedronGeometry,\n\tRingGeometry: RingGeometry,\n\tShapeGeometry: ShapeGeometry,\n\tSphereGeometry: SphereGeometry,\n\tTetrahedronGeometry: TetrahedronGeometry,\n\tTorusGeometry: TorusGeometry,\n\tTorusKnotGeometry: TorusKnotGeometry,\n\tTubeGeometry: TubeGeometry,\n\tWireframeGeometry: WireframeGeometry\n});\n\nclass ShadowMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isShadowMaterial = true;\n\n\t\tthis.type = 'ShadowMaterial';\n\n\t\tthis.color = new Color( 0x000000 );\n\t\tthis.transparent = true;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass RawShaderMaterial extends ShaderMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper( parameters );\n\n\t\tthis.isRawShaderMaterial = true;\n\n\t\tthis.type = 'RawShaderMaterial';\n\n\t}\n\n}\n\nclass MeshStandardMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshStandardMaterial = true;\n\n\t\tthis.defines = { 'STANDARD': '' };\n\n\t\tthis.type = 'MeshStandardMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\t\tthis.roughness = 1.0;\n\t\tthis.metalness = 0.0;\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.roughnessMap = null;\n\n\t\tthis.metalnessMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.envMapIntensity = 1.0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = { 'STANDARD': '' };\n\n\t\tthis.color.copy( source.color );\n\t\tthis.roughness = source.roughness;\n\t\tthis.metalness = source.metalness;\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.roughnessMap = source.roughnessMap;\n\n\t\tthis.metalnessMap = source.metalnessMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.envMapIntensity = source.envMapIntensity;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshPhysicalMaterial extends MeshStandardMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshPhysicalMaterial = true;\n\n\t\tthis.defines = {\n\n\t\t\t'STANDARD': '',\n\t\t\t'PHYSICAL': ''\n\n\t\t};\n\n\t\tthis.type = 'MeshPhysicalMaterial';\n\n\t\tthis.anisotropyRotation = 0;\n\t\tthis.anisotropyMap = null;\n\n\t\tthis.clearcoatMap = null;\n\t\tthis.clearcoatRoughness = 0.0;\n\t\tthis.clearcoatRoughnessMap = null;\n\t\tthis.clearcoatNormalScale = new Vector2( 1, 1 );\n\t\tthis.clearcoatNormalMap = null;\n\n\t\tthis.ior = 1.5;\n\n\t\tObject.defineProperty( this, 'reflectivity', {\n\t\t\tget: function () {\n\n\t\t\t\treturn ( clamp( 2.5 * ( this.ior - 1 ) / ( this.ior + 1 ), 0, 1 ) );\n\n\t\t\t},\n\t\t\tset: function ( reflectivity ) {\n\n\t\t\t\tthis.ior = ( 1 + 0.4 * reflectivity ) / ( 1 - 0.4 * reflectivity );\n\n\t\t\t}\n\t\t} );\n\n\t\tthis.iridescenceMap = null;\n\t\tthis.iridescenceIOR = 1.3;\n\t\tthis.iridescenceThicknessRange = [ 100, 400 ];\n\t\tthis.iridescenceThicknessMap = null;\n\n\t\tthis.sheenColor = new Color( 0x000000 );\n\t\tthis.sheenColorMap = null;\n\t\tthis.sheenRoughness = 1.0;\n\t\tthis.sheenRoughnessMap = null;\n\n\t\tthis.transmissionMap = null;\n\n\t\tthis.thickness = 0;\n\t\tthis.thicknessMap = null;\n\t\tthis.attenuationDistance = Infinity;\n\t\tthis.attenuationColor = new Color( 1, 1, 1 );\n\n\t\tthis.specularIntensity = 1.0;\n\t\tthis.specularIntensityMap = null;\n\t\tthis.specularColor = new Color( 1, 1, 1 );\n\t\tthis.specularColorMap = null;\n\n\t\tthis._anisotropy = 0;\n\t\tthis._clearcoat = 0;\n\t\tthis._iridescence = 0;\n\t\tthis._sheen = 0.0;\n\t\tthis._transmission = 0;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tget anisotropy() {\n\n\t\treturn this._anisotropy;\n\n\t}\n\n\tset anisotropy( value ) {\n\n\t\tif ( this._anisotropy > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._anisotropy = value;\n\n\t}\n\n\tget clearcoat() {\n\n\t\treturn this._clearcoat;\n\n\t}\n\n\tset clearcoat( value ) {\n\n\t\tif ( this._clearcoat > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._clearcoat = value;\n\n\t}\n\n\tget iridescence() {\n\n\t\treturn this._iridescence;\n\n\t}\n\n\tset iridescence( value ) {\n\n\t\tif ( this._iridescence > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._iridescence = value;\n\n\t}\n\n\tget sheen() {\n\n\t\treturn this._sheen;\n\n\t}\n\n\tset sheen( value ) {\n\n\t\tif ( this._sheen > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._sheen = value;\n\n\t}\n\n\tget transmission() {\n\n\t\treturn this._transmission;\n\n\t}\n\n\tset transmission( value ) {\n\n\t\tif ( this._transmission > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._transmission = value;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = {\n\n\t\t\t'STANDARD': '',\n\t\t\t'PHYSICAL': ''\n\n\t\t};\n\n\t\tthis.anisotropy = source.anisotropy;\n\t\tthis.anisotropyRotation = source.anisotropyRotation;\n\t\tthis.anisotropyMap = source.anisotropyMap;\n\n\t\tthis.clearcoat = source.clearcoat;\n\t\tthis.clearcoatMap = source.clearcoatMap;\n\t\tthis.clearcoatRoughness = source.clearcoatRoughness;\n\t\tthis.clearcoatRoughnessMap = source.clearcoatRoughnessMap;\n\t\tthis.clearcoatNormalMap = source.clearcoatNormalMap;\n\t\tthis.clearcoatNormalScale.copy( source.clearcoatNormalScale );\n\n\t\tthis.ior = source.ior;\n\n\t\tthis.iridescence = source.iridescence;\n\t\tthis.iridescenceMap = source.iridescenceMap;\n\t\tthis.iridescenceIOR = source.iridescenceIOR;\n\t\tthis.iridescenceThicknessRange = [ ...source.iridescenceThicknessRange ];\n\t\tthis.iridescenceThicknessMap = source.iridescenceThicknessMap;\n\n\t\tthis.sheen = source.sheen;\n\t\tthis.sheenColor.copy( source.sheenColor );\n\t\tthis.sheenColorMap = source.sheenColorMap;\n\t\tthis.sheenRoughness = source.sheenRoughness;\n\t\tthis.sheenRoughnessMap = source.sheenRoughnessMap;\n\n\t\tthis.transmission = source.transmission;\n\t\tthis.transmissionMap = source.transmissionMap;\n\n\t\tthis.thickness = source.thickness;\n\t\tthis.thicknessMap = source.thicknessMap;\n\t\tthis.attenuationDistance = source.attenuationDistance;\n\t\tthis.attenuationColor.copy( source.attenuationColor );\n\n\t\tthis.specularIntensity = source.specularIntensity;\n\t\tthis.specularIntensityMap = source.specularIntensityMap;\n\t\tthis.specularColor.copy( source.specularColor );\n\t\tthis.specularColorMap = source.specularColorMap;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshPhongMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshPhongMaterial = true;\n\n\t\tthis.type = 'MeshPhongMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\t\tthis.specular = new Color( 0x111111 );\n\t\tthis.shininess = 30;\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\t\tthis.specular.copy( source.specular );\n\t\tthis.shininess = source.shininess;\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshToonMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshToonMaterial = true;\n\n\t\tthis.defines = { 'TOON': '' };\n\n\t\tthis.type = 'MeshToonMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\t\tthis.gradientMap = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\t\tthis.gradientMap = source.gradientMap;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshNormalMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshNormalMaterial = true;\n\n\t\tthis.type = 'MeshNormalMaterial';\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.flatShading = false;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshLambertMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshLambertMaterial = true;\n\n\t\tthis.type = 'MeshLambertMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshMatcapMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshMatcapMaterial = true;\n\n\t\tthis.defines = { 'MATCAP': '' };\n\n\t\tthis.type = 'MeshMatcapMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\tthis.matcap = null;\n\n\t\tthis.map = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = { 'MATCAP': '' };\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.matcap = source.matcap;\n\n\t\tthis.map = source.map;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineDashedMaterial extends LineBasicMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isLineDashedMaterial = true;\n\n\t\tthis.type = 'LineDashedMaterial';\n\n\t\tthis.scale = 1;\n\t\tthis.dashSize = 3;\n\t\tthis.gapSize = 1;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.scale = source.scale;\n\t\tthis.dashSize = source.dashSize;\n\t\tthis.gapSize = source.gapSize;\n\n\t\treturn this;\n\n\t}\n\n}\n\n// converts an array to a specific type\nfunction convertArray( array, type, forceClone ) {\n\n\tif ( ! array || // let 'undefined' and 'null' pass\n\t\t! forceClone && array.constructor === type ) return array;\n\n\tif ( typeof type.BYTES_PER_ELEMENT === 'number' ) {\n\n\t\treturn new type( array ); // create typed array\n\n\t}\n\n\treturn Array.prototype.slice.call( array ); // create Array\n\n}\n\nfunction isTypedArray( object ) {\n\n\treturn ArrayBuffer.isView( object ) &&\n\t\t! ( object instanceof DataView );\n\n}\n\n// returns an array by which times and values can be sorted\nfunction getKeyframeOrder( times ) {\n\n\tfunction compareTime( i, j ) {\n\n\t\treturn times[ i ] - times[ j ];\n\n\t}\n\n\tconst n = times.length;\n\tconst result = new Array( n );\n\tfor ( let i = 0; i !== n; ++ i ) result[ i ] = i;\n\n\tresult.sort( compareTime );\n\n\treturn result;\n\n}\n\n// uses the array previously returned by 'getKeyframeOrder' to sort data\nfunction sortedArray( values, stride, order ) {\n\n\tconst nValues = values.length;\n\tconst result = new values.constructor( nValues );\n\n\tfor ( let i = 0, dstOffset = 0; dstOffset !== nValues; ++ i ) {\n\n\t\tconst srcOffset = order[ i ] * stride;\n\n\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\tresult[ dstOffset ++ ] = values[ srcOffset + j ];\n\n\t\t}\n\n\t}\n\n\treturn result;\n\n}\n\n// function for parsing AOS keyframe formats\nfunction flattenJSON( jsonKeys, times, values, valuePropertyName ) {\n\n\tlet i = 1, key = jsonKeys[ 0 ];\n\n\twhile ( key !== undefined && key[ valuePropertyName ] === undefined ) {\n\n\t\tkey = jsonKeys[ i ++ ];\n\n\t}\n\n\tif ( key === undefined ) return; // no data\n\n\tlet value = key[ valuePropertyName ];\n\tif ( value === undefined ) return; // no data\n\n\tif ( Array.isArray( value ) ) {\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalues.push.apply( values, value ); // push all elements\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t} else if ( value.toArray !== undefined ) {\n\n\t\t// ...assume THREE.Math-ish\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalue.toArray( values, values.length );\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t} else {\n\n\t\t// otherwise push as-is\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalues.push( value );\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t}\n\n}\n\nfunction subclip( sourceClip, name, startFrame, endFrame, fps = 30 ) {\n\n\tconst clip = sourceClip.clone();\n\n\tclip.name = name;\n\n\tconst tracks = [];\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tconst track = clip.tracks[ i ];\n\t\tconst valueSize = track.getValueSize();\n\n\t\tconst times = [];\n\t\tconst values = [];\n\n\t\tfor ( let j = 0; j < track.times.length; ++ j ) {\n\n\t\t\tconst frame = track.times[ j ] * fps;\n\n\t\t\tif ( frame < startFrame || frame >= endFrame ) continue;\n\n\t\t\ttimes.push( track.times[ j ] );\n\n\t\t\tfor ( let k = 0; k < valueSize; ++ k ) {\n\n\t\t\t\tvalues.push( track.values[ j * valueSize + k ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( times.length === 0 ) continue;\n\n\t\ttrack.times = convertArray( times, track.times.constructor );\n\t\ttrack.values = convertArray( values, track.values.constructor );\n\n\t\ttracks.push( track );\n\n\t}\n\n\tclip.tracks = tracks;\n\n\t// find minimum .times value across all tracks in the trimmed clip\n\n\tlet minStartTime = Infinity;\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tif ( minStartTime > clip.tracks[ i ].times[ 0 ] ) {\n\n\t\t\tminStartTime = clip.tracks[ i ].times[ 0 ];\n\n\t\t}\n\n\t}\n\n\t// shift all tracks such that clip begins at t=0\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tclip.tracks[ i ].shift( - 1 * minStartTime );\n\n\t}\n\n\tclip.resetDuration();\n\n\treturn clip;\n\n}\n\nfunction makeClipAdditive( targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30 ) {\n\n\tif ( fps <= 0 ) fps = 30;\n\n\tconst numTracks = referenceClip.tracks.length;\n\tconst referenceTime = referenceFrame / fps;\n\n\t// Make each track's values relative to the values at the reference frame\n\tfor ( let i = 0; i < numTracks; ++ i ) {\n\n\t\tconst referenceTrack = referenceClip.tracks[ i ];\n\t\tconst referenceTrackType = referenceTrack.ValueTypeName;\n\n\t\t// Skip this track if it's non-numeric\n\t\tif ( referenceTrackType === 'bool' || referenceTrackType === 'string' ) continue;\n\n\t\t// Find the track in the target clip whose name and type matches the reference track\n\t\tconst targetTrack = targetClip.tracks.find( function ( track ) {\n\n\t\t\treturn track.name === referenceTrack.name\n\t\t\t\t&& track.ValueTypeName === referenceTrackType;\n\n\t\t} );\n\n\t\tif ( targetTrack === undefined ) continue;\n\n\t\tlet referenceOffset = 0;\n\t\tconst referenceValueSize = referenceTrack.getValueSize();\n\n\t\tif ( referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {\n\n\t\t\treferenceOffset = referenceValueSize / 3;\n\n\t\t}\n\n\t\tlet targetOffset = 0;\n\t\tconst targetValueSize = targetTrack.getValueSize();\n\n\t\tif ( targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {\n\n\t\t\ttargetOffset = targetValueSize / 3;\n\n\t\t}\n\n\t\tconst lastIndex = referenceTrack.times.length - 1;\n\t\tlet referenceValue;\n\n\t\t// Find the value to subtract out of the track\n\t\tif ( referenceTime <= referenceTrack.times[ 0 ] ) {\n\n\t\t\t// Reference frame is earlier than the first keyframe, so just use the first keyframe\n\t\t\tconst startIndex = referenceOffset;\n\t\t\tconst endIndex = referenceValueSize - referenceOffset;\n\t\t\treferenceValue = referenceTrack.values.slice( startIndex, endIndex );\n\n\t\t} else if ( referenceTime >= referenceTrack.times[ lastIndex ] ) {\n\n\t\t\t// Reference frame is after the last keyframe, so just use the last keyframe\n\t\t\tconst startIndex = lastIndex * referenceValueSize + referenceOffset;\n\t\t\tconst endIndex = startIndex + referenceValueSize - referenceOffset;\n\t\t\treferenceValue = referenceTrack.values.slice( startIndex, endIndex );\n\n\t\t} else {\n\n\t\t\t// Interpolate to the reference value\n\t\t\tconst interpolant = referenceTrack.createInterpolant();\n\t\t\tconst startIndex = referenceOffset;\n\t\t\tconst endIndex = referenceValueSize - referenceOffset;\n\t\t\tinterpolant.evaluate( referenceTime );\n\t\t\treferenceValue = interpolant.resultBuffer.slice( startIndex, endIndex );\n\n\t\t}\n\n\t\t// Conjugate the quaternion\n\t\tif ( referenceTrackType === 'quaternion' ) {\n\n\t\t\tconst referenceQuat = new Quaternion().fromArray( referenceValue ).normalize().conjugate();\n\t\t\treferenceQuat.toArray( referenceValue );\n\n\t\t}\n\n\t\t// Subtract the reference value from all of the track values\n\n\t\tconst numTimes = targetTrack.times.length;\n\t\tfor ( let j = 0; j < numTimes; ++ j ) {\n\n\t\t\tconst valueStart = j * targetValueSize + targetOffset;\n\n\t\t\tif ( referenceTrackType === 'quaternion' ) {\n\n\t\t\t\t// Multiply the conjugate for quaternion track types\n\t\t\t\tQuaternion.multiplyQuaternionsFlat(\n\t\t\t\t\ttargetTrack.values,\n\t\t\t\t\tvalueStart,\n\t\t\t\t\treferenceValue,\n\t\t\t\t\t0,\n\t\t\t\t\ttargetTrack.values,\n\t\t\t\t\tvalueStart\n\t\t\t\t);\n\n\t\t\t} else {\n\n\t\t\t\tconst valueEnd = targetValueSize - targetOffset * 2;\n\n\t\t\t\t// Subtract each value for all other numeric track types\n\t\t\t\tfor ( let k = 0; k < valueEnd; ++ k ) {\n\n\t\t\t\t\ttargetTrack.values[ valueStart + k ] -= referenceValue[ k ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttargetClip.blendMode = AdditiveAnimationBlendMode;\n\n\treturn targetClip;\n\n}\n\nconst AnimationUtils = {\n\tconvertArray: convertArray,\n\tisTypedArray: isTypedArray,\n\tgetKeyframeOrder: getKeyframeOrder,\n\tsortedArray: sortedArray,\n\tflattenJSON: flattenJSON,\n\tsubclip: subclip,\n\tmakeClipAdditive: makeClipAdditive\n};\n\n/**\n * Abstract base class of interpolants over parametric samples.\n *\n * The parameter domain is one dimensional, typically the time or a path\n * along a curve defined by the data.\n *\n * The sample values can have any dimensionality and derived classes may\n * apply special interpretations to the data.\n *\n * This class provides the interval seek in a Template Method, deferring\n * the actual interpolation to derived classes.\n *\n * Time complexity is O(1) for linear access crossing at most two points\n * and O(log N) for random access, where N is the number of positions.\n *\n * References:\n *\n * \t\thttp://www.oodesign.com/template-method-pattern.html\n *\n */\n\nclass Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tthis.parameterPositions = parameterPositions;\n\t\tthis._cachedIndex = 0;\n\n\t\tthis.resultBuffer = resultBuffer !== undefined ?\n\t\t\tresultBuffer : new sampleValues.constructor( sampleSize );\n\t\tthis.sampleValues = sampleValues;\n\t\tthis.valueSize = sampleSize;\n\n\t\tthis.settings = null;\n\t\tthis.DefaultSettings_ = {};\n\n\t}\n\n\tevaluate( t ) {\n\n\t\tconst pp = this.parameterPositions;\n\t\tlet i1 = this._cachedIndex,\n\t\t\tt1 = pp[ i1 ],\n\t\t\tt0 = pp[ i1 - 1 ];\n\n\t\tvalidate_interval: {\n\n\t\t\tseek: {\n\n\t\t\t\tlet right;\n\n\t\t\t\tlinear_scan: {\n\n\t\t\t\t\t//- See http://jsperf.com/comparison-to-undefined/3\n\t\t\t\t\t//- slower code:\n\t\t\t\t\t//-\n\t\t\t\t\t//- \t\t\t\tif ( t >= t1 || t1 === undefined ) {\n\t\t\t\t\tforward_scan: if ( ! ( t < t1 ) ) {\n\n\t\t\t\t\t\tfor ( let giveUpAt = i1 + 2; ; ) {\n\n\t\t\t\t\t\t\tif ( t1 === undefined ) {\n\n\t\t\t\t\t\t\t\tif ( t < t0 ) break forward_scan;\n\n\t\t\t\t\t\t\t\t// after end\n\n\t\t\t\t\t\t\t\ti1 = pp.length;\n\t\t\t\t\t\t\t\tthis._cachedIndex = i1;\n\t\t\t\t\t\t\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\n\n\t\t\t\t\t\t\tt0 = t1;\n\t\t\t\t\t\t\tt1 = pp[ ++ i1 ];\n\n\t\t\t\t\t\t\tif ( t < t1 ) {\n\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\n\t\t\t\t\t\t\t\tbreak seek;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// prepare binary search on the right side of the index\n\t\t\t\t\t\tright = pp.length;\n\t\t\t\t\t\tbreak linear_scan;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t//- slower code:\n\t\t\t\t\t//-\t\t\t\t\tif ( t < t0 || t0 === undefined ) {\n\t\t\t\t\tif ( ! ( t >= t0 ) ) {\n\n\t\t\t\t\t\t// looping?\n\n\t\t\t\t\t\tconst t1global = pp[ 1 ];\n\n\t\t\t\t\t\tif ( t < t1global ) {\n\n\t\t\t\t\t\t\ti1 = 2; // + 1, using the scan for the details\n\t\t\t\t\t\t\tt0 = t1global;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// linear reverse scan\n\n\t\t\t\t\t\tfor ( let giveUpAt = i1 - 2; ; ) {\n\n\t\t\t\t\t\t\tif ( t0 === undefined ) {\n\n\t\t\t\t\t\t\t\t// before start\n\n\t\t\t\t\t\t\t\tthis._cachedIndex = 0;\n\t\t\t\t\t\t\t\treturn this.copySampleValue_( 0 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\n\n\t\t\t\t\t\t\tt1 = t0;\n\t\t\t\t\t\t\tt0 = pp[ -- i1 - 1 ];\n\n\t\t\t\t\t\t\tif ( t >= t0 ) {\n\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\n\t\t\t\t\t\t\t\tbreak seek;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// prepare binary search on the left side of the index\n\t\t\t\t\t\tright = i1;\n\t\t\t\t\t\ti1 = 0;\n\t\t\t\t\t\tbreak linear_scan;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the interval is valid\n\n\t\t\t\t\tbreak validate_interval;\n\n\t\t\t\t} // linear scan\n\n\t\t\t\t// binary search\n\n\t\t\t\twhile ( i1 < right ) {\n\n\t\t\t\t\tconst mid = ( i1 + right ) >>> 1;\n\n\t\t\t\t\tif ( t < pp[ mid ] ) {\n\n\t\t\t\t\t\tright = mid;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ti1 = mid + 1;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tt1 = pp[ i1 ];\n\t\t\t\tt0 = pp[ i1 - 1 ];\n\n\t\t\t\t// check boundary cases, again\n\n\t\t\t\tif ( t0 === undefined ) {\n\n\t\t\t\t\tthis._cachedIndex = 0;\n\t\t\t\t\treturn this.copySampleValue_( 0 );\n\n\t\t\t\t}\n\n\t\t\t\tif ( t1 === undefined ) {\n\n\t\t\t\t\ti1 = pp.length;\n\t\t\t\t\tthis._cachedIndex = i1;\n\t\t\t\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t\t\t\t}\n\n\t\t\t} // seek\n\n\t\t\tthis._cachedIndex = i1;\n\n\t\t\tthis.intervalChanged_( i1, t0, t1 );\n\n\t\t} // validate_interval\n\n\t\treturn this.interpolate_( i1, t0, t, t1 );\n\n\t}\n\n\tgetSettings_() {\n\n\t\treturn this.settings || this.DefaultSettings_;\n\n\t}\n\n\tcopySampleValue_( index ) {\n\n\t\t// copies a sample value to the result buffer\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = index * stride;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] = values[ offset + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\t// Template methods for derived classes:\n\n\tinterpolate_( /* i1, t0, t, t1 */ ) {\n\n\t\tthrow new Error( 'call to abstract method' );\n\t\t// implementations shall return this.resultBuffer\n\n\t}\n\n\tintervalChanged_( /* i1, t0, t1 */ ) {\n\n\t\t// empty\n\n\t}\n\n}\n\n/**\n * Fast and simple cubic spline interpolant.\n *\n * It was derived from a Hermitian construction setting the first derivative\n * at each sample position to the linear slope between neighboring positions\n * over their parameter interval.\n */\n\nclass CubicInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t\tthis._weightPrev = - 0;\n\t\tthis._offsetPrev = - 0;\n\t\tthis._weightNext = - 0;\n\t\tthis._offsetNext = - 0;\n\n\t\tthis.DefaultSettings_ = {\n\n\t\t\tendingStart: ZeroCurvatureEnding,\n\t\t\tendingEnd: ZeroCurvatureEnding\n\n\t\t};\n\n\t}\n\n\tintervalChanged_( i1, t0, t1 ) {\n\n\t\tconst pp = this.parameterPositions;\n\t\tlet iPrev = i1 - 2,\n\t\t\tiNext = i1 + 1,\n\n\t\t\ttPrev = pp[ iPrev ],\n\t\t\ttNext = pp[ iNext ];\n\n\t\tif ( tPrev === undefined ) {\n\n\t\t\tswitch ( this.getSettings_().endingStart ) {\n\n\t\t\t\tcase ZeroSlopeEnding:\n\n\t\t\t\t\t// f'(t0) = 0\n\t\t\t\t\tiPrev = i1;\n\t\t\t\t\ttPrev = 2 * t0 - t1;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase WrapAroundEnding:\n\n\t\t\t\t\t// use the other end of the curve\n\t\t\t\t\tiPrev = pp.length - 2;\n\t\t\t\t\ttPrev = t0 + pp[ iPrev ] - pp[ iPrev + 1 ];\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: // ZeroCurvatureEnding\n\n\t\t\t\t\t// f''(t0) = 0 a.k.a. Natural Spline\n\t\t\t\t\tiPrev = i1;\n\t\t\t\t\ttPrev = t1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( tNext === undefined ) {\n\n\t\t\tswitch ( this.getSettings_().endingEnd ) {\n\n\t\t\t\tcase ZeroSlopeEnding:\n\n\t\t\t\t\t// f'(tN) = 0\n\t\t\t\t\tiNext = i1;\n\t\t\t\t\ttNext = 2 * t1 - t0;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase WrapAroundEnding:\n\n\t\t\t\t\t// use the other end of the curve\n\t\t\t\t\tiNext = 1;\n\t\t\t\t\ttNext = t1 + pp[ 1 ] - pp[ 0 ];\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: // ZeroCurvatureEnding\n\n\t\t\t\t\t// f''(tN) = 0, a.k.a. Natural Spline\n\t\t\t\t\tiNext = i1 - 1;\n\t\t\t\t\ttNext = t0;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst halfDt = ( t1 - t0 ) * 0.5,\n\t\t\tstride = this.valueSize;\n\n\t\tthis._weightPrev = halfDt / ( t0 - tPrev );\n\t\tthis._weightNext = halfDt / ( tNext - t1 );\n\t\tthis._offsetPrev = iPrev * stride;\n\t\tthis._offsetNext = iNext * stride;\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\to1 = i1 * stride,\t\to0 = o1 - stride,\n\t\t\toP = this._offsetPrev, \toN = this._offsetNext,\n\t\t\twP = this._weightPrev,\twN = this._weightNext,\n\n\t\t\tp = ( t - t0 ) / ( t1 - t0 ),\n\t\t\tpp = p * p,\n\t\t\tppp = pp * p;\n\n\t\t// evaluate polynomials\n\n\t\tconst sP = - wP * ppp + 2 * wP * pp - wP * p;\n\t\tconst s0 = ( 1 + wP ) * ppp + ( - 1.5 - 2 * wP ) * pp + ( - 0.5 + wP ) * p + 1;\n\t\tconst s1 = ( - 1 - wN ) * ppp + ( 1.5 + wN ) * pp + 0.5 * p;\n\t\tconst sN = wN * ppp - wN * pp;\n\n\t\t// combine data linearly\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] =\n\t\t\t\t\tsP * values[ oP + i ] +\n\t\t\t\t\ts0 * values[ o0 + i ] +\n\t\t\t\t\ts1 * values[ o1 + i ] +\n\t\t\t\t\tsN * values[ oN + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\nclass LinearInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\toffset1 = i1 * stride,\n\t\t\toffset0 = offset1 - stride,\n\n\t\t\tweight1 = ( t - t0 ) / ( t1 - t0 ),\n\t\t\tweight0 = 1 - weight1;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] =\n\t\t\t\t\tvalues[ offset0 + i ] * weight0 +\n\t\t\t\t\tvalues[ offset1 + i ] * weight1;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\n/**\n *\n * Interpolant that evaluates to the sample value at the position preceding\n * the parameter.\n */\n\nclass DiscreteInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1 /*, t0, t, t1 */ ) {\n\n\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t}\n\n}\n\nclass KeyframeTrack {\n\n\tconstructor( name, times, values, interpolation ) {\n\n\t\tif ( name === undefined ) throw new Error( 'THREE.KeyframeTrack: track name is undefined' );\n\t\tif ( times === undefined || times.length === 0 ) throw new Error( 'THREE.KeyframeTrack: no keyframes in track named ' + name );\n\n\t\tthis.name = name;\n\n\t\tthis.times = convertArray( times, this.TimeBufferType );\n\t\tthis.values = convertArray( values, this.ValueBufferType );\n\n\t\tthis.setInterpolation( interpolation || this.DefaultInterpolation );\n\n\t}\n\n\t// Serialization (in static context, because of constructor invocation\n\t// and automatic invocation of .toJSON):\n\n\tstatic toJSON( track ) {\n\n\t\tconst trackType = track.constructor;\n\n\t\tlet json;\n\n\t\t// derived classes can define a static toJSON method\n\t\tif ( trackType.toJSON !== this.toJSON ) {\n\n\t\t\tjson = trackType.toJSON( track );\n\n\t\t} else {\n\n\t\t\t// by default, we assume the data can be serialized as-is\n\t\t\tjson = {\n\n\t\t\t\t'name': track.name,\n\t\t\t\t'times': convertArray( track.times, Array ),\n\t\t\t\t'values': convertArray( track.values, Array )\n\n\t\t\t};\n\n\t\t\tconst interpolation = track.getInterpolation();\n\n\t\t\tif ( interpolation !== track.DefaultInterpolation ) {\n\n\t\t\t\tjson.interpolation = interpolation;\n\n\t\t\t}\n\n\t\t}\n\n\t\tjson.type = track.ValueTypeName; // mandatory\n\n\t\treturn json;\n\n\t}\n\n\tInterpolantFactoryMethodDiscrete( result ) {\n\n\t\treturn new DiscreteInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tInterpolantFactoryMethodLinear( result ) {\n\n\t\treturn new LinearInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tInterpolantFactoryMethodSmooth( result ) {\n\n\t\treturn new CubicInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tsetInterpolation( interpolation ) {\n\n\t\tlet factoryMethod;\n\n\t\tswitch ( interpolation ) {\n\n\t\t\tcase InterpolateDiscrete:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodDiscrete;\n\n\t\t\t\tbreak;\n\n\t\t\tcase InterpolateLinear:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodLinear;\n\n\t\t\t\tbreak;\n\n\t\t\tcase InterpolateSmooth:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodSmooth;\n\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\tif ( factoryMethod === undefined ) {\n\n\t\t\tconst message = 'unsupported interpolation for ' +\n\t\t\t\tthis.ValueTypeName + ' keyframe track named ' + this.name;\n\n\t\t\tif ( this.createInterpolant === undefined ) {\n\n\t\t\t\t// fall back to default, unless the default itself is messed up\n\t\t\t\tif ( interpolation !== this.DefaultInterpolation ) {\n\n\t\t\t\t\tthis.setInterpolation( this.DefaultInterpolation );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new Error( message ); // fatal, in this case\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconsole.warn( 'THREE.KeyframeTrack:', message );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tthis.createInterpolant = factoryMethod;\n\n\t\treturn this;\n\n\t}\n\n\tgetInterpolation() {\n\n\t\tswitch ( this.createInterpolant ) {\n\n\t\t\tcase this.InterpolantFactoryMethodDiscrete:\n\n\t\t\t\treturn InterpolateDiscrete;\n\n\t\t\tcase this.InterpolantFactoryMethodLinear:\n\n\t\t\t\treturn InterpolateLinear;\n\n\t\t\tcase this.InterpolantFactoryMethodSmooth:\n\n\t\t\t\treturn InterpolateSmooth;\n\n\t\t}\n\n\t}\n\n\tgetValueSize() {\n\n\t\treturn this.values.length / this.times.length;\n\n\t}\n\n\t// move all keyframes either forwards or backwards in time\n\tshift( timeOffset ) {\n\n\t\tif ( timeOffset !== 0.0 ) {\n\n\t\t\tconst times = this.times;\n\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] += timeOffset;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// scale all keyframe times by a factor (useful for frame <-> seconds conversions)\n\tscale( timeScale ) {\n\n\t\tif ( timeScale !== 1.0 ) {\n\n\t\t\tconst times = this.times;\n\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] *= timeScale;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// removes keyframes before and after animation without changing any values within the range [startTime, endTime].\n\t// IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values\n\ttrim( startTime, endTime ) {\n\n\t\tconst times = this.times,\n\t\t\tnKeys = times.length;\n\n\t\tlet from = 0,\n\t\t\tto = nKeys - 1;\n\n\t\twhile ( from !== nKeys && times[ from ] < startTime ) {\n\n\t\t\t++ from;\n\n\t\t}\n\n\t\twhile ( to !== - 1 && times[ to ] > endTime ) {\n\n\t\t\t-- to;\n\n\t\t}\n\n\t\t++ to; // inclusive -> exclusive bound\n\n\t\tif ( from !== 0 || to !== nKeys ) {\n\n\t\t\t// empty tracks are forbidden, so keep at least one keyframe\n\t\t\tif ( from >= to ) {\n\n\t\t\t\tto = Math.max( to, 1 );\n\t\t\t\tfrom = to - 1;\n\n\t\t\t}\n\n\t\t\tconst stride = this.getValueSize();\n\t\t\tthis.times = times.slice( from, to );\n\t\t\tthis.values = this.values.slice( from * stride, to * stride );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable\n\tvalidate() {\n\n\t\tlet valid = true;\n\n\t\tconst valueSize = this.getValueSize();\n\t\tif ( valueSize - Math.floor( valueSize ) !== 0 ) {\n\n\t\t\tconsole.error( 'THREE.KeyframeTrack: Invalid value size in track.', this );\n\t\t\tvalid = false;\n\n\t\t}\n\n\t\tconst times = this.times,\n\t\t\tvalues = this.values,\n\n\t\t\tnKeys = times.length;\n\n\t\tif ( nKeys === 0 ) {\n\n\t\t\tconsole.error( 'THREE.KeyframeTrack: Track is empty.', this );\n\t\t\tvalid = false;\n\n\t\t}\n\n\t\tlet prevTime = null;\n\n\t\tfor ( let i = 0; i !== nKeys; i ++ ) {\n\n\t\t\tconst currTime = times[ i ];\n\n\t\t\tif ( typeof currTime === 'number' && isNaN( currTime ) ) {\n\n\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Time is not a valid number.', this, i, currTime );\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tif ( prevTime !== null && prevTime > currTime ) {\n\n\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Out of order keys.', this, i, currTime, prevTime );\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tprevTime = currTime;\n\n\t\t}\n\n\t\tif ( values !== undefined ) {\n\n\t\t\tif ( isTypedArray( values ) ) {\n\n\t\t\t\tfor ( let i = 0, n = values.length; i !== n; ++ i ) {\n\n\t\t\t\t\tconst value = values[ i ];\n\n\t\t\t\t\tif ( isNaN( value ) ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Value is not a valid number.', this, i, value );\n\t\t\t\t\t\tvalid = false;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn valid;\n\n\t}\n\n\t// removes equivalent sequential keys as common in morph target sequences\n\t// (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)\n\toptimize() {\n\n\t\t// times or values may be shared with other tracks, so overwriting is unsafe\n\t\tconst times = this.times.slice(),\n\t\t\tvalues = this.values.slice(),\n\t\t\tstride = this.getValueSize(),\n\n\t\t\tsmoothInterpolation = this.getInterpolation() === InterpolateSmooth,\n\n\t\t\tlastIndex = times.length - 1;\n\n\t\tlet writeIndex = 1;\n\n\t\tfor ( let i = 1; i < lastIndex; ++ i ) {\n\n\t\t\tlet keep = false;\n\n\t\t\tconst time = times[ i ];\n\t\t\tconst timeNext = times[ i + 1 ];\n\n\t\t\t// remove adjacent keyframes scheduled at the same time\n\n\t\t\tif ( time !== timeNext && ( i !== 1 || time !== times[ 0 ] ) ) {\n\n\t\t\t\tif ( ! smoothInterpolation ) {\n\n\t\t\t\t\t// remove unnecessary keyframes same as their neighbors\n\n\t\t\t\t\tconst offset = i * stride,\n\t\t\t\t\t\toffsetP = offset - stride,\n\t\t\t\t\t\toffsetN = offset + stride;\n\n\t\t\t\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\t\t\t\tconst value = values[ offset + j ];\n\n\t\t\t\t\t\tif ( value !== values[ offsetP + j ] ||\n\t\t\t\t\t\t\tvalue !== values[ offsetN + j ] ) {\n\n\t\t\t\t\t\t\tkeep = true;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tkeep = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// in-place compaction\n\n\t\t\tif ( keep ) {\n\n\t\t\t\tif ( i !== writeIndex ) {\n\n\t\t\t\t\ttimes[ writeIndex ] = times[ i ];\n\n\t\t\t\t\tconst readOffset = i * stride,\n\t\t\t\t\t\twriteOffset = writeIndex * stride;\n\n\t\t\t\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t++ writeIndex;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// flush last keyframe (compaction looks ahead)\n\n\t\tif ( lastIndex > 0 ) {\n\n\t\t\ttimes[ writeIndex ] = times[ lastIndex ];\n\n\t\t\tfor ( let readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++ j ) {\n\n\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\n\n\t\t\t}\n\n\t\t\t++ writeIndex;\n\n\t\t}\n\n\t\tif ( writeIndex !== times.length ) {\n\n\t\t\tthis.times = times.slice( 0, writeIndex );\n\t\t\tthis.values = values.slice( 0, writeIndex * stride );\n\n\t\t} else {\n\n\t\t\tthis.times = times;\n\t\t\tthis.values = values;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\tconst times = this.times.slice();\n\t\tconst values = this.values.slice();\n\n\t\tconst TypedKeyframeTrack = this.constructor;\n\t\tconst track = new TypedKeyframeTrack( this.name, times, values );\n\n\t\t// Interpolant argument to constructor is not saved, so copy the factory method directly.\n\t\ttrack.createInterpolant = this.createInterpolant;\n\n\t\treturn track;\n\n\t}\n\n}\n\nKeyframeTrack.prototype.TimeBufferType = Float32Array;\nKeyframeTrack.prototype.ValueBufferType = Float32Array;\nKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;\n\n/**\n * A Track of Boolean keyframe values.\n */\nclass BooleanKeyframeTrack extends KeyframeTrack {}\n\nBooleanKeyframeTrack.prototype.ValueTypeName = 'bool';\nBooleanKeyframeTrack.prototype.ValueBufferType = Array;\nBooleanKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track of keyframe values that represent color.\n */\nclass ColorKeyframeTrack extends KeyframeTrack {}\n\nColorKeyframeTrack.prototype.ValueTypeName = 'color';\n\n/**\n * A Track of numeric keyframe values.\n */\nclass NumberKeyframeTrack extends KeyframeTrack {}\n\nNumberKeyframeTrack.prototype.ValueTypeName = 'number';\n\n/**\n * Spherical linear unit quaternion interpolant.\n */\n\nclass QuaternionLinearInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\talpha = ( t - t0 ) / ( t1 - t0 );\n\n\t\tlet offset = i1 * stride;\n\n\t\tfor ( let end = offset + stride; offset !== end; offset += 4 ) {\n\n\t\t\tQuaternion.slerpFlat( result, 0, values, offset - stride, values, offset, alpha );\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\n/**\n * A Track of quaternion keyframe values.\n */\nclass QuaternionKeyframeTrack extends KeyframeTrack {\n\n\tInterpolantFactoryMethodLinear( result ) {\n\n\t\treturn new QuaternionLinearInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n}\n\nQuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion';\n// ValueBufferType is inherited\nQuaternionKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;\nQuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track that interpolates Strings\n */\nclass StringKeyframeTrack extends KeyframeTrack {}\n\nStringKeyframeTrack.prototype.ValueTypeName = 'string';\nStringKeyframeTrack.prototype.ValueBufferType = Array;\nStringKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\nStringKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\nStringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track of vectored keyframe values.\n */\nclass VectorKeyframeTrack extends KeyframeTrack {}\n\nVectorKeyframeTrack.prototype.ValueTypeName = 'vector';\n\nclass AnimationClip {\n\n\tconstructor( name, duration = - 1, tracks, blendMode = NormalAnimationBlendMode ) {\n\n\t\tthis.name = name;\n\t\tthis.tracks = tracks;\n\t\tthis.duration = duration;\n\t\tthis.blendMode = blendMode;\n\n\t\tthis.uuid = generateUUID();\n\n\t\t// this means it should figure out its duration by scanning the tracks\n\t\tif ( this.duration < 0 ) {\n\n\t\t\tthis.resetDuration();\n\n\t\t}\n\n\t}\n\n\n\tstatic parse( json ) {\n\n\t\tconst tracks = [],\n\t\t\tjsonTracks = json.tracks,\n\t\t\tframeTime = 1.0 / ( json.fps || 1.0 );\n\n\t\tfor ( let i = 0, n = jsonTracks.length; i !== n; ++ i ) {\n\n\t\t\ttracks.push( parseKeyframeTrack( jsonTracks[ i ] ).scale( frameTime ) );\n\n\t\t}\n\n\t\tconst clip = new this( json.name, json.duration, tracks, json.blendMode );\n\t\tclip.uuid = json.uuid;\n\n\t\treturn clip;\n\n\t}\n\n\tstatic toJSON( clip ) {\n\n\t\tconst tracks = [],\n\t\t\tclipTracks = clip.tracks;\n\n\t\tconst json = {\n\n\t\t\t'name': clip.name,\n\t\t\t'duration': clip.duration,\n\t\t\t'tracks': tracks,\n\t\t\t'uuid': clip.uuid,\n\t\t\t'blendMode': clip.blendMode\n\n\t\t};\n\n\t\tfor ( let i = 0, n = clipTracks.length; i !== n; ++ i ) {\n\n\t\t\ttracks.push( KeyframeTrack.toJSON( clipTracks[ i ] ) );\n\n\t\t}\n\n\t\treturn json;\n\n\t}\n\n\tstatic CreateFromMorphTargetSequence( name, morphTargetSequence, fps, noLoop ) {\n\n\t\tconst numMorphTargets = morphTargetSequence.length;\n\t\tconst tracks = [];\n\n\t\tfor ( let i = 0; i < numMorphTargets; i ++ ) {\n\n\t\t\tlet times = [];\n\t\t\tlet values = [];\n\n\t\t\ttimes.push(\n\t\t\t\t( i + numMorphTargets - 1 ) % numMorphTargets,\n\t\t\t\ti,\n\t\t\t\t( i + 1 ) % numMorphTargets );\n\n\t\t\tvalues.push( 0, 1, 0 );\n\n\t\t\tconst order = getKeyframeOrder( times );\n\t\t\ttimes = sortedArray( times, 1, order );\n\t\t\tvalues = sortedArray( values, 1, order );\n\n\t\t\t// if there is a key at the first frame, duplicate it as the\n\t\t\t// last frame as well for perfect loop.\n\t\t\tif ( ! noLoop && times[ 0 ] === 0 ) {\n\n\t\t\t\ttimes.push( numMorphTargets );\n\t\t\t\tvalues.push( values[ 0 ] );\n\n\t\t\t}\n\n\t\t\ttracks.push(\n\t\t\t\tnew NumberKeyframeTrack(\n\t\t\t\t\t'.morphTargetInfluences[' + morphTargetSequence[ i ].name + ']',\n\t\t\t\t\ttimes, values\n\t\t\t\t).scale( 1.0 / fps ) );\n\n\t\t}\n\n\t\treturn new this( name, - 1, tracks );\n\n\t}\n\n\tstatic findByName( objectOrClipArray, name ) {\n\n\t\tlet clipArray = objectOrClipArray;\n\n\t\tif ( ! Array.isArray( objectOrClipArray ) ) {\n\n\t\t\tconst o = objectOrClipArray;\n\t\t\tclipArray = o.geometry && o.geometry.animations || o.animations;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < clipArray.length; i ++ ) {\n\n\t\t\tif ( clipArray[ i ].name === name ) {\n\n\t\t\t\treturn clipArray[ i ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\tstatic CreateClipsFromMorphTargetSequences( morphTargets, fps, noLoop ) {\n\n\t\tconst animationToMorphTargets = {};\n\n\t\t// tested with https://regex101.com/ on trick sequences\n\t\t// such flamingo_flyA_003, flamingo_run1_003, crdeath0059\n\t\tconst pattern = /^([\\w-]*?)([\\d]+)$/;\n\n\t\t// sort morph target names into animation groups based\n\t\t// patterns like Walk_001, Walk_002, Run_001, Run_002\n\t\tfor ( let i = 0, il = morphTargets.length; i < il; i ++ ) {\n\n\t\t\tconst morphTarget = morphTargets[ i ];\n\t\t\tconst parts = morphTarget.name.match( pattern );\n\n\t\t\tif ( parts && parts.length > 1 ) {\n\n\t\t\t\tconst name = parts[ 1 ];\n\n\t\t\t\tlet animationMorphTargets = animationToMorphTargets[ name ];\n\n\t\t\t\tif ( ! animationMorphTargets ) {\n\n\t\t\t\t\tanimationToMorphTargets[ name ] = animationMorphTargets = [];\n\n\t\t\t\t}\n\n\t\t\t\tanimationMorphTargets.push( morphTarget );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst clips = [];\n\n\t\tfor ( const name in animationToMorphTargets ) {\n\n\t\t\tclips.push( this.CreateFromMorphTargetSequence( name, animationToMorphTargets[ name ], fps, noLoop ) );\n\n\t\t}\n\n\t\treturn clips;\n\n\t}\n\n\t// parse the animation.hierarchy format\n\tstatic parseAnimation( animation, bones ) {\n\n\t\tif ( ! animation ) {\n\n\t\t\tconsole.error( 'THREE.AnimationClip: No animation in JSONLoader data.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst addNonemptyTrack = function ( trackType, trackName, animationKeys, propertyName, destTracks ) {\n\n\t\t\t// only return track if there are actually keys.\n\t\t\tif ( animationKeys.length !== 0 ) {\n\n\t\t\t\tconst times = [];\n\t\t\t\tconst values = [];\n\n\t\t\t\tflattenJSON( animationKeys, times, values, propertyName );\n\n\t\t\t\t// empty keys are filtered out, so check again\n\t\t\t\tif ( times.length !== 0 ) {\n\n\t\t\t\t\tdestTracks.push( new trackType( trackName, times, values ) );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tconst tracks = [];\n\n\t\tconst clipName = animation.name || 'default';\n\t\tconst fps = animation.fps || 30;\n\t\tconst blendMode = animation.blendMode;\n\n\t\t// automatic length determination in AnimationClip.\n\t\tlet duration = animation.length || - 1;\n\n\t\tconst hierarchyTracks = animation.hierarchy || [];\n\n\t\tfor ( let h = 0; h < hierarchyTracks.length; h ++ ) {\n\n\t\t\tconst animationKeys = hierarchyTracks[ h ].keys;\n\n\t\t\t// skip empty tracks\n\t\t\tif ( ! animationKeys || animationKeys.length === 0 ) continue;\n\n\t\t\t// process morph targets\n\t\t\tif ( animationKeys[ 0 ].morphTargets ) {\n\n\t\t\t\t// figure out all morph targets used in this track\n\t\t\t\tconst morphTargetNames = {};\n\n\t\t\t\tlet k;\n\n\t\t\t\tfor ( k = 0; k < animationKeys.length; k ++ ) {\n\n\t\t\t\t\tif ( animationKeys[ k ].morphTargets ) {\n\n\t\t\t\t\t\tfor ( let m = 0; m < animationKeys[ k ].morphTargets.length; m ++ ) {\n\n\t\t\t\t\t\t\tmorphTargetNames[ animationKeys[ k ].morphTargets[ m ] ] = - 1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// create a track for each morph target with all zero\n\t\t\t\t// morphTargetInfluences except for the keys in which\n\t\t\t\t// the morphTarget is named.\n\t\t\t\tfor ( const morphTargetName in morphTargetNames ) {\n\n\t\t\t\t\tconst times = [];\n\t\t\t\t\tconst values = [];\n\n\t\t\t\t\tfor ( let m = 0; m !== animationKeys[ k ].morphTargets.length; ++ m ) {\n\n\t\t\t\t\t\tconst animationKey = animationKeys[ k ];\n\n\t\t\t\t\t\ttimes.push( animationKey.time );\n\t\t\t\t\t\tvalues.push( ( animationKey.morphTarget === morphTargetName ) ? 1 : 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttracks.push( new NumberKeyframeTrack( '.morphTargetInfluence[' + morphTargetName + ']', times, values ) );\n\n\t\t\t\t}\n\n\t\t\t\tduration = morphTargetNames.length * fps;\n\n\t\t\t} else {\n\n\t\t\t\t// ...assume skeletal animation\n\n\t\t\t\tconst boneName = '.bones[' + bones[ h ].name + ']';\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.position',\n\t\t\t\t\tanimationKeys, 'pos', tracks );\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tQuaternionKeyframeTrack, boneName + '.quaternion',\n\t\t\t\t\tanimationKeys, 'rot', tracks );\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.scale',\n\t\t\t\t\tanimationKeys, 'scl', tracks );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( tracks.length === 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst clip = new this( clipName, duration, tracks, blendMode );\n\n\t\treturn clip;\n\n\t}\n\n\tresetDuration() {\n\n\t\tconst tracks = this.tracks;\n\t\tlet duration = 0;\n\n\t\tfor ( let i = 0, n = tracks.length; i !== n; ++ i ) {\n\n\t\t\tconst track = this.tracks[ i ];\n\n\t\t\tduration = Math.max( duration, track.times[ track.times.length - 1 ] );\n\n\t\t}\n\n\t\tthis.duration = duration;\n\n\t\treturn this;\n\n\t}\n\n\ttrim() {\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tthis.tracks[ i ].trim( 0, this.duration );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tvalidate() {\n\n\t\tlet valid = true;\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tvalid = valid && this.tracks[ i ].validate();\n\n\t\t}\n\n\t\treturn valid;\n\n\t}\n\n\toptimize() {\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tthis.tracks[ i ].optimize();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\tconst tracks = [];\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\ttracks.push( this.tracks[ i ].clone() );\n\n\t\t}\n\n\t\treturn new this.constructor( this.name, this.duration, tracks, this.blendMode );\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.constructor.toJSON( this );\n\n\t}\n\n}\n\nfunction getTrackTypeForValueTypeName( typeName ) {\n\n\tswitch ( typeName.toLowerCase() ) {\n\n\t\tcase 'scalar':\n\t\tcase 'double':\n\t\tcase 'float':\n\t\tcase 'number':\n\t\tcase 'integer':\n\n\t\t\treturn NumberKeyframeTrack;\n\n\t\tcase 'vector':\n\t\tcase 'vector2':\n\t\tcase 'vector3':\n\t\tcase 'vector4':\n\n\t\t\treturn VectorKeyframeTrack;\n\n\t\tcase 'color':\n\n\t\t\treturn ColorKeyframeTrack;\n\n\t\tcase 'quaternion':\n\n\t\t\treturn QuaternionKeyframeTrack;\n\n\t\tcase 'bool':\n\t\tcase 'boolean':\n\n\t\t\treturn BooleanKeyframeTrack;\n\n\t\tcase 'string':\n\n\t\t\treturn StringKeyframeTrack;\n\n\t}\n\n\tthrow new Error( 'THREE.KeyframeTrack: Unsupported typeName: ' + typeName );\n\n}\n\nfunction parseKeyframeTrack( json ) {\n\n\tif ( json.type === undefined ) {\n\n\t\tthrow new Error( 'THREE.KeyframeTrack: track type undefined, can not parse' );\n\n\t}\n\n\tconst trackType = getTrackTypeForValueTypeName( json.type );\n\n\tif ( json.times === undefined ) {\n\n\t\tconst times = [], values = [];\n\n\t\tflattenJSON( json.keys, times, values, 'value' );\n\n\t\tjson.times = times;\n\t\tjson.values = values;\n\n\t}\n\n\t// derived classes can define a static parse method\n\tif ( trackType.parse !== undefined ) {\n\n\t\treturn trackType.parse( json );\n\n\t} else {\n\n\t\t// by default, we assume a constructor compatible with the base\n\t\treturn new trackType( json.name, json.times, json.values, json.interpolation );\n\n\t}\n\n}\n\nconst Cache = {\n\n\tenabled: false,\n\n\tfiles: {},\n\n\tadd: function ( key, file ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\t// console.log( 'THREE.Cache', 'Adding key:', key );\n\n\t\tthis.files[ key ] = file;\n\n\t},\n\n\tget: function ( key ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\t// console.log( 'THREE.Cache', 'Checking key:', key );\n\n\t\treturn this.files[ key ];\n\n\t},\n\n\tremove: function ( key ) {\n\n\t\tdelete this.files[ key ];\n\n\t},\n\n\tclear: function () {\n\n\t\tthis.files = {};\n\n\t}\n\n};\n\nclass LoadingManager {\n\n\tconstructor( onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tlet isLoading = false;\n\t\tlet itemsLoaded = 0;\n\t\tlet itemsTotal = 0;\n\t\tlet urlModifier = undefined;\n\t\tconst handlers = [];\n\n\t\t// Refer to #5689 for the reason why we don't set .onStart\n\t\t// in the constructor\n\n\t\tthis.onStart = undefined;\n\t\tthis.onLoad = onLoad;\n\t\tthis.onProgress = onProgress;\n\t\tthis.onError = onError;\n\n\t\tthis.itemStart = function ( url ) {\n\n\t\t\titemsTotal ++;\n\n\t\t\tif ( isLoading === false ) {\n\n\t\t\t\tif ( scope.onStart !== undefined ) {\n\n\t\t\t\t\tscope.onStart( url, itemsLoaded, itemsTotal );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tisLoading = true;\n\n\t\t};\n\n\t\tthis.itemEnd = function ( url ) {\n\n\t\t\titemsLoaded ++;\n\n\t\t\tif ( scope.onProgress !== undefined ) {\n\n\t\t\t\tscope.onProgress( url, itemsLoaded, itemsTotal );\n\n\t\t\t}\n\n\t\t\tif ( itemsLoaded === itemsTotal ) {\n\n\t\t\t\tisLoading = false;\n\n\t\t\t\tif ( scope.onLoad !== undefined ) {\n\n\t\t\t\t\tscope.onLoad();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.itemError = function ( url ) {\n\n\t\t\tif ( scope.onError !== undefined ) {\n\n\t\t\t\tscope.onError( url );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.resolveURL = function ( url ) {\n\n\t\t\tif ( urlModifier ) {\n\n\t\t\t\treturn urlModifier( url );\n\n\t\t\t}\n\n\t\t\treturn url;\n\n\t\t};\n\n\t\tthis.setURLModifier = function ( transform ) {\n\n\t\t\turlModifier = transform;\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.addHandler = function ( regex, loader ) {\n\n\t\t\thandlers.push( regex, loader );\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.removeHandler = function ( regex ) {\n\n\t\t\tconst index = handlers.indexOf( regex );\n\n\t\t\tif ( index !== - 1 ) {\n\n\t\t\t\thandlers.splice( index, 2 );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.getHandler = function ( file ) {\n\n\t\t\tfor ( let i = 0, l = handlers.length; i < l; i += 2 ) {\n\n\t\t\t\tconst regex = handlers[ i ];\n\t\t\t\tconst loader = handlers[ i + 1 ];\n\n\t\t\t\tif ( regex.global ) regex.lastIndex = 0; // see #17920\n\n\t\t\t\tif ( regex.test( file ) ) {\n\n\t\t\t\t\treturn loader;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn null;\n\n\t\t};\n\n\t}\n\n}\n\nconst DefaultLoadingManager = /*@__PURE__*/ new LoadingManager();\n\nclass Loader {\n\n\tconstructor( manager ) {\n\n\t\tthis.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;\n\n\t\tthis.crossOrigin = 'anonymous';\n\t\tthis.withCredentials = false;\n\t\tthis.path = '';\n\t\tthis.resourcePath = '';\n\t\tthis.requestHeader = {};\n\n\t}\n\n\tload( /* url, onLoad, onProgress, onError */ ) {}\n\n\tloadAsync( url, onProgress ) {\n\n\t\tconst scope = this;\n\n\t\treturn new Promise( function ( resolve, reject ) {\n\n\t\t\tscope.load( url, resolve, onProgress, reject );\n\n\t\t} );\n\n\t}\n\n\tparse( /* data */ ) {}\n\n\tsetCrossOrigin( crossOrigin ) {\n\n\t\tthis.crossOrigin = crossOrigin;\n\t\treturn this;\n\n\t}\n\n\tsetWithCredentials( value ) {\n\n\t\tthis.withCredentials = value;\n\t\treturn this;\n\n\t}\n\n\tsetPath( path ) {\n\n\t\tthis.path = path;\n\t\treturn this;\n\n\t}\n\n\tsetResourcePath( resourcePath ) {\n\n\t\tthis.resourcePath = resourcePath;\n\t\treturn this;\n\n\t}\n\n\tsetRequestHeader( requestHeader ) {\n\n\t\tthis.requestHeader = requestHeader;\n\t\treturn this;\n\n\t}\n\n}\n\nLoader.DEFAULT_MATERIAL_NAME = '__DEFAULT';\n\nconst loading = {};\n\nclass HttpError extends Error {\n\n\tconstructor( message, response ) {\n\n\t\tsuper( message );\n\t\tthis.response = response;\n\n\t}\n\n}\n\nclass FileLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( url === undefined ) url = '';\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tthis.manager.itemStart( url );\n\n\t\t\tsetTimeout( () => {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tthis.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\t// Check if request is duplicate\n\n\t\tif ( loading[ url ] !== undefined ) {\n\n\t\t\tloading[ url ].push( {\n\n\t\t\t\tonLoad: onLoad,\n\t\t\t\tonProgress: onProgress,\n\t\t\t\tonError: onError\n\n\t\t\t} );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// Initialise array for duplicate requests\n\t\tloading[ url ] = [];\n\n\t\tloading[ url ].push( {\n\t\t\tonLoad: onLoad,\n\t\t\tonProgress: onProgress,\n\t\t\tonError: onError,\n\t\t} );\n\n\t\t// create request\n\t\tconst req = new Request( url, {\n\t\t\theaders: new Headers( this.requestHeader ),\n\t\t\tcredentials: this.withCredentials ? 'include' : 'same-origin',\n\t\t\t// An abort controller could be added within a future PR\n\t\t} );\n\n\t\t// record states ( avoid data race )\n\t\tconst mimeType = this.mimeType;\n\t\tconst responseType = this.responseType;\n\n\t\t// start the fetch\n\t\tfetch( req )\n\t\t\t.then( response => {\n\n\t\t\t\tif ( response.status === 200 || response.status === 0 ) {\n\n\t\t\t\t\t// Some browsers return HTTP Status 0 when using non-http protocol\n\t\t\t\t\t// e.g. 'file://' or 'data://'. Handle as success.\n\n\t\t\t\t\tif ( response.status === 0 ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.FileLoader: HTTP Status 0 received.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Workaround: Checking if response.body === undefined for Alipay browser #23548\n\n\t\t\t\t\tif ( typeof ReadableStream === 'undefined' || response.body === undefined || response.body.getReader === undefined ) {\n\n\t\t\t\t\t\treturn response;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst callbacks = loading[ url ];\n\t\t\t\t\tconst reader = response.body.getReader();\n\n\t\t\t\t\t// Nginx needs X-File-Size check\n\t\t\t\t\t// https://serverfault.com/questions/482875/why-does-nginx-remove-content-length-header-for-chunked-content\n\t\t\t\t\tconst contentLength = response.headers.get( 'Content-Length' ) || response.headers.get( 'X-File-Size' );\n\t\t\t\t\tconst total = contentLength ? parseInt( contentLength ) : 0;\n\t\t\t\t\tconst lengthComputable = total !== 0;\n\t\t\t\t\tlet loaded = 0;\n\n\t\t\t\t\t// periodically read data into the new stream tracking while download progress\n\t\t\t\t\tconst stream = new ReadableStream( {\n\t\t\t\t\t\tstart( controller ) {\n\n\t\t\t\t\t\t\treadData();\n\n\t\t\t\t\t\t\tfunction readData() {\n\n\t\t\t\t\t\t\t\treader.read().then( ( { done, value } ) => {\n\n\t\t\t\t\t\t\t\t\tif ( done ) {\n\n\t\t\t\t\t\t\t\t\t\tcontroller.close();\n\n\t\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\t\tloaded += value.byteLength;\n\n\t\t\t\t\t\t\t\t\t\tconst event = new ProgressEvent( 'progress', { lengthComputable, loaded, total } );\n\t\t\t\t\t\t\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\t\t\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\t\t\t\t\t\t\tif ( callback.onProgress ) callback.onProgress( event );\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tcontroller.enqueue( value );\n\t\t\t\t\t\t\t\t\t\treadData();\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn new Response( stream );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new HttpError( `fetch for \"${response.url}\" responded with ${response.status}: ${response.statusText}`, response );\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.then( response => {\n\n\t\t\t\tswitch ( responseType ) {\n\n\t\t\t\t\tcase 'arraybuffer':\n\n\t\t\t\t\t\treturn response.arrayBuffer();\n\n\t\t\t\t\tcase 'blob':\n\n\t\t\t\t\t\treturn response.blob();\n\n\t\t\t\t\tcase 'document':\n\n\t\t\t\t\t\treturn response.text()\n\t\t\t\t\t\t\t.then( text => {\n\n\t\t\t\t\t\t\t\tconst parser = new DOMParser();\n\t\t\t\t\t\t\t\treturn parser.parseFromString( text, mimeType );\n\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\tcase 'json':\n\n\t\t\t\t\t\treturn response.json();\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tif ( mimeType === undefined ) {\n\n\t\t\t\t\t\t\treturn response.text();\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// sniff encoding\n\t\t\t\t\t\t\tconst re = /charset=\"?([^;\"\\s]*)\"?/i;\n\t\t\t\t\t\t\tconst exec = re.exec( mimeType );\n\t\t\t\t\t\t\tconst label = exec && exec[ 1 ] ? exec[ 1 ].toLowerCase() : undefined;\n\t\t\t\t\t\t\tconst decoder = new TextDecoder( label );\n\t\t\t\t\t\t\treturn response.arrayBuffer().then( ab => decoder.decode( ab ) );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.then( data => {\n\n\t\t\t\t// Add to cache only on HTTP success, so that we do not cache\n\t\t\t\t// error response bodies as proper responses to requests.\n\t\t\t\tCache.add( url, data );\n\n\t\t\t\tconst callbacks = loading[ url ];\n\t\t\t\tdelete loading[ url ];\n\n\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\tif ( callback.onLoad ) callback.onLoad( data );\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.catch( err => {\n\n\t\t\t\t// Abort errors and other errors are handled the same\n\n\t\t\t\tconst callbacks = loading[ url ];\n\n\t\t\t\tif ( callbacks === undefined ) {\n\n\t\t\t\t\t// When onLoad was called and url was deleted in `loading`\n\t\t\t\t\tthis.manager.itemError( url );\n\t\t\t\t\tthrow err;\n\n\t\t\t\t}\n\n\t\t\t\tdelete loading[ url ];\n\n\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\tif ( callback.onError ) callback.onError( err );\n\n\t\t\t\t}\n\n\t\t\t\tthis.manager.itemError( url );\n\n\t\t\t} )\n\t\t\t.finally( () => {\n\n\t\t\t\tthis.manager.itemEnd( url );\n\n\t\t\t} );\n\n\t\tthis.manager.itemStart( url );\n\n\t}\n\n\tsetResponseType( value ) {\n\n\t\tthis.responseType = value;\n\t\treturn this;\n\n\t}\n\n\tsetMimeType( value ) {\n\n\t\tthis.mimeType = value;\n\t\treturn this;\n\n\t}\n\n}\n\nclass AnimationLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst animations = [];\n\n\t\tfor ( let i = 0; i < json.length; i ++ ) {\n\n\t\t\tconst clip = AnimationClip.parse( json[ i ] );\n\n\t\t\tanimations.push( clip );\n\n\t\t}\n\n\t\treturn animations;\n\n\t}\n\n}\n\n/**\n * Abstract Base class to block based textures loader (dds, pvr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */\n\nclass CompressedTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst images = [];\n\n\t\tconst texture = new CompressedTexture();\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\n\t\tlet loaded = 0;\n\n\t\tfunction loadTexture( i ) {\n\n\t\t\tloader.load( url[ i ], function ( buffer ) {\n\n\t\t\t\tconst texDatas = scope.parse( buffer, true );\n\n\t\t\t\timages[ i ] = {\n\t\t\t\t\twidth: texDatas.width,\n\t\t\t\t\theight: texDatas.height,\n\t\t\t\t\tformat: texDatas.format,\n\t\t\t\t\tmipmaps: texDatas.mipmaps\n\t\t\t\t};\n\n\t\t\t\tloaded += 1;\n\n\t\t\t\tif ( loaded === 6 ) {\n\n\t\t\t\t\tif ( texDatas.mipmapCount === 1 ) texture.minFilter = LinearFilter;\n\n\t\t\t\t\ttexture.image = images;\n\t\t\t\t\ttexture.format = texDatas.format;\n\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t\t}\n\n\t\t\t}, onProgress, onError );\n\n\t\t}\n\n\t\tif ( Array.isArray( url ) ) {\n\n\t\t\tfor ( let i = 0, il = url.length; i < il; ++ i ) {\n\n\t\t\t\tloadTexture( i );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// compressed cubemap texture stored in a single DDS file\n\n\t\t\tloader.load( url, function ( buffer ) {\n\n\t\t\t\tconst texDatas = scope.parse( buffer, true );\n\n\t\t\t\tif ( texDatas.isCubemap ) {\n\n\t\t\t\t\tconst faces = texDatas.mipmaps.length / texDatas.mipmapCount;\n\n\t\t\t\t\tfor ( let f = 0; f < faces; f ++ ) {\n\n\t\t\t\t\t\timages[ f ] = { mipmaps: [] };\n\n\t\t\t\t\t\tfor ( let i = 0; i < texDatas.mipmapCount; i ++ ) {\n\n\t\t\t\t\t\t\timages[ f ].mipmaps.push( texDatas.mipmaps[ f * texDatas.mipmapCount + i ] );\n\t\t\t\t\t\t\timages[ f ].format = texDatas.format;\n\t\t\t\t\t\t\timages[ f ].width = texDatas.width;\n\t\t\t\t\t\t\timages[ f ].height = texDatas.height;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.image = images;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttexture.image.width = texDatas.width;\n\t\t\t\t\ttexture.image.height = texDatas.height;\n\t\t\t\t\ttexture.mipmaps = texDatas.mipmaps;\n\n\t\t\t\t}\n\n\t\t\t\tif ( texDatas.mipmapCount === 1 ) {\n\n\t\t\t\t\ttexture.minFilter = LinearFilter;\n\n\t\t\t\t}\n\n\t\t\t\ttexture.format = texDatas.format;\n\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t}, onProgress, onError );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass ImageLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst scope = this;\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\tsetTimeout( function () {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\tconst image = createElementNS( 'img' );\n\n\t\tfunction onImageLoad() {\n\n\t\t\tremoveEventListeners();\n\n\t\t\tCache.add( url, this );\n\n\t\t\tif ( onLoad ) onLoad( this );\n\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\tfunction onImageError( event ) {\n\n\t\t\tremoveEventListeners();\n\n\t\t\tif ( onError ) onError( event );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\tfunction removeEventListeners() {\n\n\t\t\timage.removeEventListener( 'load', onImageLoad, false );\n\t\t\timage.removeEventListener( 'error', onImageError, false );\n\n\t\t}\n\n\t\timage.addEventListener( 'load', onImageLoad, false );\n\t\timage.addEventListener( 'error', onImageError, false );\n\n\t\tif ( url.slice( 0, 5 ) !== 'data:' ) {\n\n\t\t\tif ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;\n\n\t\t}\n\n\t\tscope.manager.itemStart( url );\n\n\t\timage.src = url;\n\n\t\treturn image;\n\n\t}\n\n}\n\nclass CubeTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( urls, onLoad, onProgress, onError ) {\n\n\t\tconst texture = new CubeTexture();\n\t\ttexture.colorSpace = SRGBColorSpace;\n\n\t\tconst loader = new ImageLoader( this.manager );\n\t\tloader.setCrossOrigin( this.crossOrigin );\n\t\tloader.setPath( this.path );\n\n\t\tlet loaded = 0;\n\n\t\tfunction loadTexture( i ) {\n\n\t\t\tloader.load( urls[ i ], function ( image ) {\n\n\t\t\t\ttexture.images[ i ] = image;\n\n\t\t\t\tloaded ++;\n\n\t\t\t\tif ( loaded === 6 ) {\n\n\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t\t}\n\n\t\t\t}, undefined, onError );\n\n\t\t}\n\n\t\tfor ( let i = 0; i < urls.length; ++ i ) {\n\n\t\t\tloadTexture( i );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n}\n\n/**\n * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */\n\nclass DataTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst texture = new DataTexture();\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setPath( this.path );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( buffer ) {\n\n\t\t\tlet texData;\n\n\t\t\ttry {\n\n\t\t\t\ttexData = scope.parse( buffer );\n\n\t\t\t} catch ( error ) {\n\n\t\t\t\tif ( onError !== undefined ) {\n\n\t\t\t\t\tonError( error );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( error );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( texData.image !== undefined ) {\n\n\t\t\t\ttexture.image = texData.image;\n\n\t\t\t} else if ( texData.data !== undefined ) {\n\n\t\t\t\ttexture.image.width = texData.width;\n\t\t\t\ttexture.image.height = texData.height;\n\t\t\t\ttexture.image.data = texData.data;\n\n\t\t\t}\n\n\t\t\ttexture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;\n\t\t\ttexture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;\n\n\t\t\ttexture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;\n\t\t\ttexture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;\n\n\t\t\ttexture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;\n\n\t\t\tif ( texData.colorSpace !== undefined ) {\n\n\t\t\t\ttexture.colorSpace = texData.colorSpace;\n\n\t\t\t} else if ( texData.encoding !== undefined ) { // @deprecated, r152\n\n\t\t\t\ttexture.encoding = texData.encoding;\n\n\t\t\t}\n\n\t\t\tif ( texData.flipY !== undefined ) {\n\n\t\t\t\ttexture.flipY = texData.flipY;\n\n\t\t\t}\n\n\t\t\tif ( texData.format !== undefined ) {\n\n\t\t\t\ttexture.format = texData.format;\n\n\t\t\t}\n\n\t\t\tif ( texData.type !== undefined ) {\n\n\t\t\t\ttexture.type = texData.type;\n\n\t\t\t}\n\n\t\t\tif ( texData.mipmaps !== undefined ) {\n\n\t\t\t\ttexture.mipmaps = texData.mipmaps;\n\t\t\t\ttexture.minFilter = LinearMipmapLinearFilter; // presumably...\n\n\t\t\t}\n\n\t\t\tif ( texData.mipmapCount === 1 ) {\n\n\t\t\t\ttexture.minFilter = LinearFilter;\n\n\t\t\t}\n\n\t\t\tif ( texData.generateMipmaps !== undefined ) {\n\n\t\t\t\ttexture.generateMipmaps = texData.generateMipmaps;\n\n\t\t\t}\n\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\tif ( onLoad ) onLoad( texture, texData );\n\n\t\t}, onProgress, onError );\n\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass TextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst texture = new Texture();\n\n\t\tconst loader = new ImageLoader( this.manager );\n\t\tloader.setCrossOrigin( this.crossOrigin );\n\t\tloader.setPath( this.path );\n\n\t\tloader.load( url, function ( image ) {\n\n\t\t\ttexture.image = image;\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\tif ( onLoad !== undefined ) {\n\n\t\t\t\tonLoad( texture );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass Light extends Object3D {\n\n\tconstructor( color, intensity = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.isLight = true;\n\n\t\tthis.type = 'Light';\n\n\t\tthis.color = new Color( color );\n\t\tthis.intensity = intensity;\n\n\t}\n\n\tdispose() {\n\n\t\t// Empty here in base class; some subclasses override.\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.color.copy( source.color );\n\t\tthis.intensity = source.intensity;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.color = this.color.getHex();\n\t\tdata.object.intensity = this.intensity;\n\n\t\tif ( this.groundColor !== undefined ) data.object.groundColor = this.groundColor.getHex();\n\n\t\tif ( this.distance !== undefined ) data.object.distance = this.distance;\n\t\tif ( this.angle !== undefined ) data.object.angle = this.angle;\n\t\tif ( this.decay !== undefined ) data.object.decay = this.decay;\n\t\tif ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra;\n\n\t\tif ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON();\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass HemisphereLight extends Light {\n\n\tconstructor( skyColor, groundColor, intensity ) {\n\n\t\tsuper( skyColor, intensity );\n\n\t\tthis.isHemisphereLight = true;\n\n\t\tthis.type = 'HemisphereLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\tthis.groundColor = new Color( groundColor );\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.groundColor.copy( source.groundColor );\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _projScreenMatrix$1 = /*@__PURE__*/ new Matrix4();\nconst _lightPositionWorld$1 = /*@__PURE__*/ new Vector3();\nconst _lookTarget$1 = /*@__PURE__*/ new Vector3();\n\nclass LightShadow {\n\n\tconstructor( camera ) {\n\n\t\tthis.camera = camera;\n\n\t\tthis.bias = 0;\n\t\tthis.normalBias = 0;\n\t\tthis.radius = 1;\n\t\tthis.blurSamples = 8;\n\n\t\tthis.mapSize = new Vector2( 512, 512 );\n\n\t\tthis.map = null;\n\t\tthis.mapPass = null;\n\t\tthis.matrix = new Matrix4();\n\n\t\tthis.autoUpdate = true;\n\t\tthis.needsUpdate = false;\n\n\t\tthis._frustum = new Frustum();\n\t\tthis._frameExtents = new Vector2( 1, 1 );\n\n\t\tthis._viewportCount = 1;\n\n\t\tthis._viewports = [\n\n\t\t\tnew Vector4( 0, 0, 1, 1 )\n\n\t\t];\n\n\t}\n\n\tgetViewportCount() {\n\n\t\treturn this._viewportCount;\n\n\t}\n\n\tgetFrustum() {\n\n\t\treturn this._frustum;\n\n\t}\n\n\tupdateMatrices( light ) {\n\n\t\tconst shadowCamera = this.camera;\n\t\tconst shadowMatrix = this.matrix;\n\n\t\t_lightPositionWorld$1.setFromMatrixPosition( light.matrixWorld );\n\t\tshadowCamera.position.copy( _lightPositionWorld$1 );\n\n\t\t_lookTarget$1.setFromMatrixPosition( light.target.matrixWorld );\n\t\tshadowCamera.lookAt( _lookTarget$1 );\n\t\tshadowCamera.updateMatrixWorld();\n\n\t\t_projScreenMatrix$1.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );\n\t\tthis._frustum.setFromProjectionMatrix( _projScreenMatrix$1 );\n\n\t\tshadowMatrix.set(\n\t\t\t0.5, 0.0, 0.0, 0.5,\n\t\t\t0.0, 0.5, 0.0, 0.5,\n\t\t\t0.0, 0.0, 0.5, 0.5,\n\t\t\t0.0, 0.0, 0.0, 1.0\n\t\t);\n\n\t\tshadowMatrix.multiply( _projScreenMatrix$1 );\n\n\t}\n\n\tgetViewport( viewportIndex ) {\n\n\t\treturn this._viewports[ viewportIndex ];\n\n\t}\n\n\tgetFrameExtents() {\n\n\t\treturn this._frameExtents;\n\n\t}\n\n\tdispose() {\n\n\t\tif ( this.map ) {\n\n\t\t\tthis.map.dispose();\n\n\t\t}\n\n\t\tif ( this.mapPass ) {\n\n\t\t\tthis.mapPass.dispose();\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.camera = source.camera.clone();\n\n\t\tthis.bias = source.bias;\n\t\tthis.radius = source.radius;\n\n\t\tthis.mapSize.copy( source.mapSize );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst object = {};\n\n\t\tif ( this.bias !== 0 ) object.bias = this.bias;\n\t\tif ( this.normalBias !== 0 ) object.normalBias = this.normalBias;\n\t\tif ( this.radius !== 1 ) object.radius = this.radius;\n\t\tif ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) object.mapSize = this.mapSize.toArray();\n\n\t\tobject.camera = this.camera.toJSON( false ).object;\n\t\tdelete object.camera.matrix;\n\n\t\treturn object;\n\n\t}\n\n}\n\nclass SpotLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new PerspectiveCamera( 50, 1, 0.5, 500 ) );\n\n\t\tthis.isSpotLightShadow = true;\n\n\t\tthis.focus = 1;\n\n\t}\n\n\tupdateMatrices( light ) {\n\n\t\tconst camera = this.camera;\n\n\t\tconst fov = RAD2DEG * 2 * light.angle * this.focus;\n\t\tconst aspect = this.mapSize.width / this.mapSize.height;\n\t\tconst far = light.distance || camera.far;\n\n\t\tif ( fov !== camera.fov || aspect !== camera.aspect || far !== camera.far ) {\n\n\t\t\tcamera.fov = fov;\n\t\t\tcamera.aspect = aspect;\n\t\t\tcamera.far = far;\n\t\t\tcamera.updateProjectionMatrix();\n\n\t\t}\n\n\t\tsuper.updateMatrices( light );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.focus = source.focus;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass SpotLight extends Light {\n\n\tconstructor( color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 2 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isSpotLight = true;\n\n\t\tthis.type = 'SpotLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\tthis.target = new Object3D();\n\n\t\tthis.distance = distance;\n\t\tthis.angle = angle;\n\t\tthis.penumbra = penumbra;\n\t\tthis.decay = decay;\n\n\t\tthis.map = null;\n\n\t\tthis.shadow = new SpotLightShadow();\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in candela)\n\t\t// by convention for a spotlight, luminous power (lm) = π * luminous intensity (cd)\n\t\treturn this.intensity * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in candela) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / Math.PI;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.distance = source.distance;\n\t\tthis.angle = source.angle;\n\t\tthis.penumbra = source.penumbra;\n\t\tthis.decay = source.decay;\n\n\t\tthis.target = source.target.clone();\n\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _projScreenMatrix = /*@__PURE__*/ new Matrix4();\nconst _lightPositionWorld = /*@__PURE__*/ new Vector3();\nconst _lookTarget = /*@__PURE__*/ new Vector3();\n\nclass PointLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new PerspectiveCamera( 90, 1, 0.5, 500 ) );\n\n\t\tthis.isPointLightShadow = true;\n\n\t\tthis._frameExtents = new Vector2( 4, 2 );\n\n\t\tthis._viewportCount = 6;\n\n\t\tthis._viewports = [\n\t\t\t// These viewports map a cube-map onto a 2D texture with the\n\t\t\t// following orientation:\n\t\t\t//\n\t\t\t// xzXZ\n\t\t\t// y Y\n\t\t\t//\n\t\t\t// X - Positive x direction\n\t\t\t// x - Negative x direction\n\t\t\t// Y - Positive y direction\n\t\t\t// y - Negative y direction\n\t\t\t// Z - Positive z direction\n\t\t\t// z - Negative z direction\n\n\t\t\t// positive X\n\t\t\tnew Vector4( 2, 1, 1, 1 ),\n\t\t\t// negative X\n\t\t\tnew Vector4( 0, 1, 1, 1 ),\n\t\t\t// positive Z\n\t\t\tnew Vector4( 3, 1, 1, 1 ),\n\t\t\t// negative Z\n\t\t\tnew Vector4( 1, 1, 1, 1 ),\n\t\t\t// positive Y\n\t\t\tnew Vector4( 3, 0, 1, 1 ),\n\t\t\t// negative Y\n\t\t\tnew Vector4( 1, 0, 1, 1 )\n\t\t];\n\n\t\tthis._cubeDirections = [\n\t\t\tnew Vector3( 1, 0, 0 ), new Vector3( - 1, 0, 0 ), new Vector3( 0, 0, 1 ),\n\t\t\tnew Vector3( 0, 0, - 1 ), new Vector3( 0, 1, 0 ), new Vector3( 0, - 1, 0 )\n\t\t];\n\n\t\tthis._cubeUps = [\n\t\t\tnew Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ),\n\t\t\tnew Vector3( 0, 1, 0 ), new Vector3( 0, 0, 1 ),\tnew Vector3( 0, 0, - 1 )\n\t\t];\n\n\t}\n\n\tupdateMatrices( light, viewportIndex = 0 ) {\n\n\t\tconst camera = this.camera;\n\t\tconst shadowMatrix = this.matrix;\n\n\t\tconst far = light.distance || camera.far;\n\n\t\tif ( far !== camera.far ) {\n\n\t\t\tcamera.far = far;\n\t\t\tcamera.updateProjectionMatrix();\n\n\t\t}\n\n\t\t_lightPositionWorld.setFromMatrixPosition( light.matrixWorld );\n\t\tcamera.position.copy( _lightPositionWorld );\n\n\t\t_lookTarget.copy( camera.position );\n\t\t_lookTarget.add( this._cubeDirections[ viewportIndex ] );\n\t\tcamera.up.copy( this._cubeUps[ viewportIndex ] );\n\t\tcamera.lookAt( _lookTarget );\n\t\tcamera.updateMatrixWorld();\n\n\t\tshadowMatrix.makeTranslation( - _lightPositionWorld.x, - _lightPositionWorld.y, - _lightPositionWorld.z );\n\n\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\n\t\tthis._frustum.setFromProjectionMatrix( _projScreenMatrix );\n\n\t}\n\n}\n\nclass PointLight extends Light {\n\n\tconstructor( color, intensity, distance = 0, decay = 2 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isPointLight = true;\n\n\t\tthis.type = 'PointLight';\n\n\t\tthis.distance = distance;\n\t\tthis.decay = decay;\n\n\t\tthis.shadow = new PointLightShadow();\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in candela)\n\t\t// for an isotropic light source, luminous power (lm) = 4 π luminous intensity (cd)\n\t\treturn this.intensity * 4 * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in candela) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / ( 4 * Math.PI );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.distance = source.distance;\n\t\tthis.decay = source.decay;\n\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass DirectionalLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) );\n\n\t\tthis.isDirectionalLightShadow = true;\n\n\t}\n\n}\n\nclass DirectionalLight extends Light {\n\n\tconstructor( color, intensity ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isDirectionalLight = true;\n\n\t\tthis.type = 'DirectionalLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\tthis.target = new Object3D();\n\n\t\tthis.shadow = new DirectionalLightShadow();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.target = source.target.clone();\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass AmbientLight extends Light {\n\n\tconstructor( color, intensity ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isAmbientLight = true;\n\n\t\tthis.type = 'AmbientLight';\n\n\t}\n\n}\n\nclass RectAreaLight extends Light {\n\n\tconstructor( color, intensity, width = 10, height = 10 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isRectAreaLight = true;\n\n\t\tthis.type = 'RectAreaLight';\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in nits)\n\t\treturn this.intensity * this.width * this.height * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in nits) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / ( this.width * this.height * Math.PI );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.width = this.width;\n\t\tdata.object.height = this.height;\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * Primary reference:\n * https://graphics.stanford.edu/papers/envmap/envmap.pdf\n *\n * Secondary reference:\n * https://www.ppsloan.org/publications/StupidSH36.pdf\n */\n\n// 3-band SH defined by 9 coefficients\n\nclass SphericalHarmonics3 {\n\n\tconstructor() {\n\n\t\tthis.isSphericalHarmonics3 = true;\n\n\t\tthis.coefficients = [];\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients.push( new Vector3() );\n\n\t\t}\n\n\t}\n\n\tset( coefficients ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].copy( coefficients[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tzero() {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].set( 0, 0, 0 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// get the radiance in the direction of the normal\n\t// target is a Vector3\n\tgetAt( normal, target ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\tconst coeff = this.coefficients;\n\n\t\t// band 0\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.282095 );\n\n\t\t// band 1\n\t\ttarget.addScaledVector( coeff[ 1 ], 0.488603 * y );\n\t\ttarget.addScaledVector( coeff[ 2 ], 0.488603 * z );\n\t\ttarget.addScaledVector( coeff[ 3 ], 0.488603 * x );\n\n\t\t// band 2\n\t\ttarget.addScaledVector( coeff[ 4 ], 1.092548 * ( x * y ) );\n\t\ttarget.addScaledVector( coeff[ 5 ], 1.092548 * ( y * z ) );\n\t\ttarget.addScaledVector( coeff[ 6 ], 0.315392 * ( 3.0 * z * z - 1.0 ) );\n\t\ttarget.addScaledVector( coeff[ 7 ], 1.092548 * ( x * z ) );\n\t\ttarget.addScaledVector( coeff[ 8 ], 0.546274 * ( x * x - y * y ) );\n\n\t\treturn target;\n\n\t}\n\n\t// get the irradiance (radiance convolved with cosine lobe) in the direction of the normal\n\t// target is a Vector3\n\t// https://graphics.stanford.edu/papers/envmap/envmap.pdf\n\tgetIrradianceAt( normal, target ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\tconst coeff = this.coefficients;\n\n\t\t// band 0\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.886227 ); // π * 0.282095\n\n\t\t// band 1\n\t\ttarget.addScaledVector( coeff[ 1 ], 2.0 * 0.511664 * y ); // ( 2 * π / 3 ) * 0.488603\n\t\ttarget.addScaledVector( coeff[ 2 ], 2.0 * 0.511664 * z );\n\t\ttarget.addScaledVector( coeff[ 3 ], 2.0 * 0.511664 * x );\n\n\t\t// band 2\n\t\ttarget.addScaledVector( coeff[ 4 ], 2.0 * 0.429043 * x * y ); // ( π / 4 ) * 1.092548\n\t\ttarget.addScaledVector( coeff[ 5 ], 2.0 * 0.429043 * y * z );\n\t\ttarget.addScaledVector( coeff[ 6 ], 0.743125 * z * z - 0.247708 ); // ( π / 4 ) * 0.315392 * 3\n\t\ttarget.addScaledVector( coeff[ 7 ], 2.0 * 0.429043 * x * z );\n\t\ttarget.addScaledVector( coeff[ 8 ], 0.429043 * ( x * x - y * y ) ); // ( π / 4 ) * 0.546274\n\n\t\treturn target;\n\n\t}\n\n\tadd( sh ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].add( sh.coefficients[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\taddScaledSH( sh, s ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].addScaledVector( sh.coefficients[ i ], s );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tscale( s ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].multiplyScalar( s );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tlerp( sh, alpha ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].lerp( sh.coefficients[ i ], alpha );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tequals( sh ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tif ( ! this.coefficients[ i ].equals( sh.coefficients[ i ] ) ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tcopy( sh ) {\n\n\t\treturn this.set( sh.coefficients );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tconst coefficients = this.coefficients;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tcoefficients[ i ].fromArray( array, offset + ( i * 3 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst coefficients = this.coefficients;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tcoefficients[ i ].toArray( array, offset + ( i * 3 ) );\n\n\t\t}\n\n\t\treturn array;\n\n\t}\n\n\t// evaluate the basis functions\n\t// shBasis is an Array[ 9 ]\n\tstatic getBasisAt( normal, shBasis ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\t// band 0\n\t\tshBasis[ 0 ] = 0.282095;\n\n\t\t// band 1\n\t\tshBasis[ 1 ] = 0.488603 * y;\n\t\tshBasis[ 2 ] = 0.488603 * z;\n\t\tshBasis[ 3 ] = 0.488603 * x;\n\n\t\t// band 2\n\t\tshBasis[ 4 ] = 1.092548 * x * y;\n\t\tshBasis[ 5 ] = 1.092548 * y * z;\n\t\tshBasis[ 6 ] = 0.315392 * ( 3 * z * z - 1 );\n\t\tshBasis[ 7 ] = 1.092548 * x * z;\n\t\tshBasis[ 8 ] = 0.546274 * ( x * x - y * y );\n\n\t}\n\n}\n\nclass LightProbe extends Light {\n\n\tconstructor( sh = new SphericalHarmonics3(), intensity = 1 ) {\n\n\t\tsuper( undefined, intensity );\n\n\t\tthis.isLightProbe = true;\n\n\t\tthis.sh = sh;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.sh.copy( source.sh );\n\n\t\treturn this;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tthis.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON();\n\t\tthis.sh.fromArray( json.sh );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.sh = this.sh.toArray();\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass MaterialLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\t\tthis.textures = {};\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( scope.manager );\n\t\tloader.setPath( scope.path );\n\t\tloader.setRequestHeader( scope.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst textures = this.textures;\n\n\t\tfunction getTexture( name ) {\n\n\t\t\tif ( textures[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.MaterialLoader: Undefined texture', name );\n\n\t\t\t}\n\n\t\t\treturn textures[ name ];\n\n\t\t}\n\n\t\tconst material = MaterialLoader.createMaterialFromType( json.type );\n\n\t\tif ( json.uuid !== undefined ) material.uuid = json.uuid;\n\t\tif ( json.name !== undefined ) material.name = json.name;\n\t\tif ( json.color !== undefined && material.color !== undefined ) material.color.setHex( json.color );\n\t\tif ( json.roughness !== undefined ) material.roughness = json.roughness;\n\t\tif ( json.metalness !== undefined ) material.metalness = json.metalness;\n\t\tif ( json.sheen !== undefined ) material.sheen = json.sheen;\n\t\tif ( json.sheenColor !== undefined ) material.sheenColor = new Color().setHex( json.sheenColor );\n\t\tif ( json.sheenRoughness !== undefined ) material.sheenRoughness = json.sheenRoughness;\n\t\tif ( json.emissive !== undefined && material.emissive !== undefined ) material.emissive.setHex( json.emissive );\n\t\tif ( json.specular !== undefined && material.specular !== undefined ) material.specular.setHex( json.specular );\n\t\tif ( json.specularIntensity !== undefined ) material.specularIntensity = json.specularIntensity;\n\t\tif ( json.specularColor !== undefined && material.specularColor !== undefined ) material.specularColor.setHex( json.specularColor );\n\t\tif ( json.shininess !== undefined ) material.shininess = json.shininess;\n\t\tif ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat;\n\t\tif ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness;\n\t\tif ( json.iridescence !== undefined ) material.iridescence = json.iridescence;\n\t\tif ( json.iridescenceIOR !== undefined ) material.iridescenceIOR = json.iridescenceIOR;\n\t\tif ( json.iridescenceThicknessRange !== undefined ) material.iridescenceThicknessRange = json.iridescenceThicknessRange;\n\t\tif ( json.transmission !== undefined ) material.transmission = json.transmission;\n\t\tif ( json.thickness !== undefined ) material.thickness = json.thickness;\n\t\tif ( json.attenuationDistance !== undefined ) material.attenuationDistance = json.attenuationDistance;\n\t\tif ( json.attenuationColor !== undefined && material.attenuationColor !== undefined ) material.attenuationColor.setHex( json.attenuationColor );\n\t\tif ( json.anisotropy !== undefined ) material.anisotropy = json.anisotropy;\n\t\tif ( json.anisotropyRotation !== undefined ) material.anisotropyRotation = json.anisotropyRotation;\n\t\tif ( json.fog !== undefined ) material.fog = json.fog;\n\t\tif ( json.flatShading !== undefined ) material.flatShading = json.flatShading;\n\t\tif ( json.blending !== undefined ) material.blending = json.blending;\n\t\tif ( json.combine !== undefined ) material.combine = json.combine;\n\t\tif ( json.side !== undefined ) material.side = json.side;\n\t\tif ( json.shadowSide !== undefined ) material.shadowSide = json.shadowSide;\n\t\tif ( json.opacity !== undefined ) material.opacity = json.opacity;\n\t\tif ( json.transparent !== undefined ) material.transparent = json.transparent;\n\t\tif ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;\n\t\tif ( json.alphaHash !== undefined ) material.alphaHash = json.alphaHash;\n\t\tif ( json.depthFunc !== undefined ) material.depthFunc = json.depthFunc;\n\t\tif ( json.depthTest !== undefined ) material.depthTest = json.depthTest;\n\t\tif ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;\n\t\tif ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;\n\t\tif ( json.blendSrc !== undefined ) material.blendSrc = json.blendSrc;\n\t\tif ( json.blendDst !== undefined ) material.blendDst = json.blendDst;\n\t\tif ( json.blendEquation !== undefined ) material.blendEquation = json.blendEquation;\n\t\tif ( json.blendSrcAlpha !== undefined ) material.blendSrcAlpha = json.blendSrcAlpha;\n\t\tif ( json.blendDstAlpha !== undefined ) material.blendDstAlpha = json.blendDstAlpha;\n\t\tif ( json.blendEquationAlpha !== undefined ) material.blendEquationAlpha = json.blendEquationAlpha;\n\t\tif ( json.blendColor !== undefined && material.blendColor !== undefined ) material.blendColor.setHex( json.blendColor );\n\t\tif ( json.blendAlpha !== undefined ) material.blendAlpha = json.blendAlpha;\n\t\tif ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask;\n\t\tif ( json.stencilFunc !== undefined ) material.stencilFunc = json.stencilFunc;\n\t\tif ( json.stencilRef !== undefined ) material.stencilRef = json.stencilRef;\n\t\tif ( json.stencilFuncMask !== undefined ) material.stencilFuncMask = json.stencilFuncMask;\n\t\tif ( json.stencilFail !== undefined ) material.stencilFail = json.stencilFail;\n\t\tif ( json.stencilZFail !== undefined ) material.stencilZFail = json.stencilZFail;\n\t\tif ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass;\n\t\tif ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;\n\n\t\tif ( json.wireframe !== undefined ) material.wireframe = json.wireframe;\n\t\tif ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;\n\t\tif ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap;\n\t\tif ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin;\n\n\t\tif ( json.rotation !== undefined ) material.rotation = json.rotation;\n\n\t\tif ( json.linewidth !== undefined ) material.linewidth = json.linewidth;\n\t\tif ( json.dashSize !== undefined ) material.dashSize = json.dashSize;\n\t\tif ( json.gapSize !== undefined ) material.gapSize = json.gapSize;\n\t\tif ( json.scale !== undefined ) material.scale = json.scale;\n\n\t\tif ( json.polygonOffset !== undefined ) material.polygonOffset = json.polygonOffset;\n\t\tif ( json.polygonOffsetFactor !== undefined ) material.polygonOffsetFactor = json.polygonOffsetFactor;\n\t\tif ( json.polygonOffsetUnits !== undefined ) material.polygonOffsetUnits = json.polygonOffsetUnits;\n\n\t\tif ( json.dithering !== undefined ) material.dithering = json.dithering;\n\n\t\tif ( json.alphaToCoverage !== undefined ) material.alphaToCoverage = json.alphaToCoverage;\n\t\tif ( json.premultipliedAlpha !== undefined ) material.premultipliedAlpha = json.premultipliedAlpha;\n\t\tif ( json.forceSinglePass !== undefined ) material.forceSinglePass = json.forceSinglePass;\n\n\t\tif ( json.visible !== undefined ) material.visible = json.visible;\n\n\t\tif ( json.toneMapped !== undefined ) material.toneMapped = json.toneMapped;\n\n\t\tif ( json.userData !== undefined ) material.userData = json.userData;\n\n\t\tif ( json.vertexColors !== undefined ) {\n\n\t\t\tif ( typeof json.vertexColors === 'number' ) {\n\n\t\t\t\tmaterial.vertexColors = ( json.vertexColors > 0 ) ? true : false;\n\n\t\t\t} else {\n\n\t\t\t\tmaterial.vertexColors = json.vertexColors;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Shader Material\n\n\t\tif ( json.uniforms !== undefined ) {\n\n\t\t\tfor ( const name in json.uniforms ) {\n\n\t\t\t\tconst uniform = json.uniforms[ name ];\n\n\t\t\t\tmaterial.uniforms[ name ] = {};\n\n\t\t\t\tswitch ( uniform.type ) {\n\n\t\t\t\t\tcase 't':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = getTexture( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'c':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Color().setHex( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v2':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector2().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v3':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector3().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v4':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector4().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'm3':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix3().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'm4':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix4().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = uniform.value;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json.defines !== undefined ) material.defines = json.defines;\n\t\tif ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader;\n\t\tif ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader;\n\t\tif ( json.glslVersion !== undefined ) material.glslVersion = json.glslVersion;\n\n\t\tif ( json.extensions !== undefined ) {\n\n\t\t\tfor ( const key in json.extensions ) {\n\n\t\t\t\tmaterial.extensions[ key ] = json.extensions[ key ];\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json.lights !== undefined ) material.lights = json.lights;\n\t\tif ( json.clipping !== undefined ) material.clipping = json.clipping;\n\n\t\t// for PointsMaterial\n\n\t\tif ( json.size !== undefined ) material.size = json.size;\n\t\tif ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation;\n\n\t\t// maps\n\n\t\tif ( json.map !== undefined ) material.map = getTexture( json.map );\n\t\tif ( json.matcap !== undefined ) material.matcap = getTexture( json.matcap );\n\n\t\tif ( json.alphaMap !== undefined ) material.alphaMap = getTexture( json.alphaMap );\n\n\t\tif ( json.bumpMap !== undefined ) material.bumpMap = getTexture( json.bumpMap );\n\t\tif ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale;\n\n\t\tif ( json.normalMap !== undefined ) material.normalMap = getTexture( json.normalMap );\n\t\tif ( json.normalMapType !== undefined ) material.normalMapType = json.normalMapType;\n\t\tif ( json.normalScale !== undefined ) {\n\n\t\t\tlet normalScale = json.normalScale;\n\n\t\t\tif ( Array.isArray( normalScale ) === false ) {\n\n\t\t\t\t// Blender exporter used to export a scalar. See #7459\n\n\t\t\t\tnormalScale = [ normalScale, normalScale ];\n\n\t\t\t}\n\n\t\t\tmaterial.normalScale = new Vector2().fromArray( normalScale );\n\n\t\t}\n\n\t\tif ( json.displacementMap !== undefined ) material.displacementMap = getTexture( json.displacementMap );\n\t\tif ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale;\n\t\tif ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias;\n\n\t\tif ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap );\n\t\tif ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap );\n\n\t\tif ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap );\n\t\tif ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity;\n\n\t\tif ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap );\n\t\tif ( json.specularIntensityMap !== undefined ) material.specularIntensityMap = getTexture( json.specularIntensityMap );\n\t\tif ( json.specularColorMap !== undefined ) material.specularColorMap = getTexture( json.specularColorMap );\n\n\t\tif ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );\n\t\tif ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;\n\n\t\tif ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;\n\t\tif ( json.refractionRatio !== undefined ) material.refractionRatio = json.refractionRatio;\n\n\t\tif ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap );\n\t\tif ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity;\n\n\t\tif ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap );\n\t\tif ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity;\n\n\t\tif ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap );\n\n\t\tif ( json.clearcoatMap !== undefined ) material.clearcoatMap = getTexture( json.clearcoatMap );\n\t\tif ( json.clearcoatRoughnessMap !== undefined ) material.clearcoatRoughnessMap = getTexture( json.clearcoatRoughnessMap );\n\t\tif ( json.clearcoatNormalMap !== undefined ) material.clearcoatNormalMap = getTexture( json.clearcoatNormalMap );\n\t\tif ( json.clearcoatNormalScale !== undefined ) material.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale );\n\n\t\tif ( json.iridescenceMap !== undefined ) material.iridescenceMap = getTexture( json.iridescenceMap );\n\t\tif ( json.iridescenceThicknessMap !== undefined ) material.iridescenceThicknessMap = getTexture( json.iridescenceThicknessMap );\n\n\t\tif ( json.transmissionMap !== undefined ) material.transmissionMap = getTexture( json.transmissionMap );\n\t\tif ( json.thicknessMap !== undefined ) material.thicknessMap = getTexture( json.thicknessMap );\n\n\t\tif ( json.anisotropyMap !== undefined ) material.anisotropyMap = getTexture( json.anisotropyMap );\n\n\t\tif ( json.sheenColorMap !== undefined ) material.sheenColorMap = getTexture( json.sheenColorMap );\n\t\tif ( json.sheenRoughnessMap !== undefined ) material.sheenRoughnessMap = getTexture( json.sheenRoughnessMap );\n\n\t\treturn material;\n\n\t}\n\n\tsetTextures( value ) {\n\n\t\tthis.textures = value;\n\t\treturn this;\n\n\t}\n\n\tstatic createMaterialFromType( type ) {\n\n\t\tconst materialLib = {\n\t\t\tShadowMaterial,\n\t\t\tSpriteMaterial,\n\t\t\tRawShaderMaterial,\n\t\t\tShaderMaterial,\n\t\t\tPointsMaterial,\n\t\t\tMeshPhysicalMaterial,\n\t\t\tMeshStandardMaterial,\n\t\t\tMeshPhongMaterial,\n\t\t\tMeshToonMaterial,\n\t\t\tMeshNormalMaterial,\n\t\t\tMeshLambertMaterial,\n\t\t\tMeshDepthMaterial,\n\t\t\tMeshDistanceMaterial,\n\t\t\tMeshBasicMaterial,\n\t\t\tMeshMatcapMaterial,\n\t\t\tLineDashedMaterial,\n\t\t\tLineBasicMaterial,\n\t\t\tMaterial\n\t\t};\n\n\t\treturn new materialLib[ type ]();\n\n\t}\n\n}\n\nclass LoaderUtils {\n\n\tstatic decodeText( array ) {\n\n\t\tif ( typeof TextDecoder !== 'undefined' ) {\n\n\t\t\treturn new TextDecoder().decode( array );\n\n\t\t}\n\n\t\t// Avoid the String.fromCharCode.apply(null, array) shortcut, which\n\t\t// throws a \"maximum call stack size exceeded\" error for large arrays.\n\n\t\tlet s = '';\n\n\t\tfor ( let i = 0, il = array.length; i < il; i ++ ) {\n\n\t\t\t// Implicitly assumes little-endian.\n\t\t\ts += String.fromCharCode( array[ i ] );\n\n\t\t}\n\n\t\ttry {\n\n\t\t\t// merges multi-byte utf-8 characters.\n\n\t\t\treturn decodeURIComponent( escape( s ) );\n\n\t\t} catch ( e ) { // see #16358\n\n\t\t\treturn s;\n\n\t\t}\n\n\t}\n\n\tstatic extractUrlBase( url ) {\n\n\t\tconst index = url.lastIndexOf( '/' );\n\n\t\tif ( index === - 1 ) return './';\n\n\t\treturn url.slice( 0, index + 1 );\n\n\t}\n\n\tstatic resolveURL( url, path ) {\n\n\t\t// Invalid URL\n\t\tif ( typeof url !== 'string' || url === '' ) return '';\n\n\t\t// Host Relative URL\n\t\tif ( /^https?:\\/\\//i.test( path ) && /^\\//.test( url ) ) {\n\n\t\t\tpath = path.replace( /(^https?:\\/\\/[^\\/]+).*/i, '$1' );\n\n\t\t}\n\n\t\t// Absolute URL http://,https://,//\n\t\tif ( /^(https?:)?\\/\\//i.test( url ) ) return url;\n\n\t\t// Data URI\n\t\tif ( /^data:.*,.*$/i.test( url ) ) return url;\n\n\t\t// Blob URL\n\t\tif ( /^blob:.*$/i.test( url ) ) return url;\n\n\t\t// Relative URL\n\t\treturn path + url;\n\n\t}\n\n}\n\nclass InstancedBufferGeometry extends BufferGeometry {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isInstancedBufferGeometry = true;\n\n\t\tthis.type = 'InstancedBufferGeometry';\n\t\tthis.instanceCount = Infinity;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.instanceCount = source.instanceCount;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.instanceCount = this.instanceCount;\n\n\t\tdata.isInstancedBufferGeometry = true;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass BufferGeometryLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( scope.manager );\n\t\tloader.setPath( scope.path );\n\t\tloader.setRequestHeader( scope.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst interleavedBufferMap = {};\n\t\tconst arrayBufferMap = {};\n\n\t\tfunction getInterleavedBuffer( json, uuid ) {\n\n\t\t\tif ( interleavedBufferMap[ uuid ] !== undefined ) return interleavedBufferMap[ uuid ];\n\n\t\t\tconst interleavedBuffers = json.interleavedBuffers;\n\t\t\tconst interleavedBuffer = interleavedBuffers[ uuid ];\n\n\t\t\tconst buffer = getArrayBuffer( json, interleavedBuffer.buffer );\n\n\t\t\tconst array = getTypedArray( interleavedBuffer.type, buffer );\n\t\t\tconst ib = new InterleavedBuffer( array, interleavedBuffer.stride );\n\t\t\tib.uuid = interleavedBuffer.uuid;\n\n\t\t\tinterleavedBufferMap[ uuid ] = ib;\n\n\t\t\treturn ib;\n\n\t\t}\n\n\t\tfunction getArrayBuffer( json, uuid ) {\n\n\t\t\tif ( arrayBufferMap[ uuid ] !== undefined ) return arrayBufferMap[ uuid ];\n\n\t\t\tconst arrayBuffers = json.arrayBuffers;\n\t\t\tconst arrayBuffer = arrayBuffers[ uuid ];\n\n\t\t\tconst ab = new Uint32Array( arrayBuffer ).buffer;\n\n\t\t\tarrayBufferMap[ uuid ] = ab;\n\n\t\t\treturn ab;\n\n\t\t}\n\n\t\tconst geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry();\n\n\t\tconst index = json.data.index;\n\n\t\tif ( index !== undefined ) {\n\n\t\t\tconst typedArray = getTypedArray( index.type, index.array );\n\t\t\tgeometry.setIndex( new BufferAttribute( typedArray, 1 ) );\n\n\t\t}\n\n\t\tconst attributes = json.data.attributes;\n\n\t\tfor ( const key in attributes ) {\n\n\t\t\tconst attribute = attributes[ key ];\n\t\t\tlet bufferAttribute;\n\n\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\tconst interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );\n\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );\n\n\t\t\t} else {\n\n\t\t\t\tconst typedArray = getTypedArray( attribute.type, attribute.array );\n\t\t\t\tconst bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute;\n\t\t\t\tbufferAttribute = new bufferAttributeConstr( typedArray, attribute.itemSize, attribute.normalized );\n\n\t\t\t}\n\n\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\n\t\t\tif ( attribute.usage !== undefined ) bufferAttribute.setUsage( attribute.usage );\n\n\t\t\tif ( attribute.updateRange !== undefined ) {\n\n\t\t\t\tbufferAttribute.updateRange.offset = attribute.updateRange.offset;\n\t\t\t\tbufferAttribute.updateRange.count = attribute.updateRange.count;\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( key, bufferAttribute );\n\n\t\t}\n\n\t\tconst morphAttributes = json.data.morphAttributes;\n\n\t\tif ( morphAttributes ) {\n\n\t\t\tfor ( const key in morphAttributes ) {\n\n\t\t\t\tconst attributeArray = morphAttributes[ key ];\n\n\t\t\t\tconst array = [];\n\n\t\t\t\tfor ( let i = 0, il = attributeArray.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst attribute = attributeArray[ i ];\n\t\t\t\t\tlet bufferAttribute;\n\n\t\t\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\t\tconst interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );\n\t\t\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst typedArray = getTypedArray( attribute.type, attribute.array );\n\t\t\t\t\t\tbufferAttribute = new BufferAttribute( typedArray, attribute.itemSize, attribute.normalized );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\n\t\t\t\t\tarray.push( bufferAttribute );\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.morphAttributes[ key ] = array;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst morphTargetsRelative = json.data.morphTargetsRelative;\n\n\t\tif ( morphTargetsRelative ) {\n\n\t\t\tgeometry.morphTargetsRelative = true;\n\n\t\t}\n\n\t\tconst groups = json.data.groups || json.data.drawcalls || json.data.offsets;\n\n\t\tif ( groups !== undefined ) {\n\n\t\t\tfor ( let i = 0, n = groups.length; i !== n; ++ i ) {\n\n\t\t\t\tconst group = groups[ i ];\n\n\t\t\t\tgeometry.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst boundingSphere = json.data.boundingSphere;\n\n\t\tif ( boundingSphere !== undefined ) {\n\n\t\t\tconst center = new Vector3();\n\n\t\t\tif ( boundingSphere.center !== undefined ) {\n\n\t\t\t\tcenter.fromArray( boundingSphere.center );\n\n\t\t\t}\n\n\t\t\tgeometry.boundingSphere = new Sphere( center, boundingSphere.radius );\n\n\t\t}\n\n\t\tif ( json.name ) geometry.name = json.name;\n\t\tif ( json.userData ) geometry.userData = json.userData;\n\n\t\treturn geometry;\n\n\t}\n\n}\n\nclass ObjectLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;\n\t\tthis.resourcePath = this.resourcePath || path;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\tlet json = null;\n\n\t\t\ttry {\n\n\t\t\t\tjson = JSON.parse( text );\n\n\t\t\t} catch ( error ) {\n\n\t\t\t\tif ( onError !== undefined ) onError( error );\n\n\t\t\t\tconsole.error( 'THREE:ObjectLoader: Can\\'t parse ' + url + '.', error.message );\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst metadata = json.metadata;\n\n\t\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\n\n\t\t\t\tif ( onError !== undefined ) onError( new Error( 'THREE.ObjectLoader: Can\\'t load ' + url ) );\n\n\t\t\t\tconsole.error( 'THREE.ObjectLoader: Can\\'t load ' + url );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tscope.parse( json, onLoad );\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tasync loadAsync( url, onProgress ) {\n\n\t\tconst scope = this;\n\n\t\tconst path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;\n\t\tthis.resourcePath = this.resourcePath || path;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\n\t\tconst text = await loader.loadAsync( url, onProgress );\n\n\t\tconst json = JSON.parse( text );\n\n\t\tconst metadata = json.metadata;\n\n\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\n\n\t\t\tthrow new Error( 'THREE.ObjectLoader: Can\\'t load ' + url );\n\n\t\t}\n\n\t\treturn await scope.parseAsync( json );\n\n\t}\n\n\tparse( json, onLoad ) {\n\n\t\tconst animations = this.parseAnimations( json.animations );\n\t\tconst shapes = this.parseShapes( json.shapes );\n\t\tconst geometries = this.parseGeometries( json.geometries, shapes );\n\n\t\tconst images = this.parseImages( json.images, function () {\n\n\t\t\tif ( onLoad !== undefined ) onLoad( object );\n\n\t\t} );\n\n\t\tconst textures = this.parseTextures( json.textures, images );\n\t\tconst materials = this.parseMaterials( json.materials, textures );\n\n\t\tconst object = this.parseObject( json.object, geometries, materials, textures, animations );\n\t\tconst skeletons = this.parseSkeletons( json.skeletons, object );\n\n\t\tthis.bindSkeletons( object, skeletons );\n\n\t\t//\n\n\t\tif ( onLoad !== undefined ) {\n\n\t\t\tlet hasImages = false;\n\n\t\t\tfor ( const uuid in images ) {\n\n\t\t\t\tif ( images[ uuid ].data instanceof HTMLImageElement ) {\n\n\t\t\t\t\thasImages = true;\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( hasImages === false ) onLoad( object );\n\n\t\t}\n\n\t\treturn object;\n\n\t}\n\n\tasync parseAsync( json ) {\n\n\t\tconst animations = this.parseAnimations( json.animations );\n\t\tconst shapes = this.parseShapes( json.shapes );\n\t\tconst geometries = this.parseGeometries( json.geometries, shapes );\n\n\t\tconst images = await this.parseImagesAsync( json.images );\n\n\t\tconst textures = this.parseTextures( json.textures, images );\n\t\tconst materials = this.parseMaterials( json.materials, textures );\n\n\t\tconst object = this.parseObject( json.object, geometries, materials, textures, animations );\n\t\tconst skeletons = this.parseSkeletons( json.skeletons, object );\n\n\t\tthis.bindSkeletons( object, skeletons );\n\n\t\treturn object;\n\n\t}\n\n\tparseShapes( json ) {\n\n\t\tconst shapes = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst shape = new Shape().fromJSON( json[ i ] );\n\n\t\t\t\tshapes[ shape.uuid ] = shape;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn shapes;\n\n\t}\n\n\tparseSkeletons( json, object ) {\n\n\t\tconst skeletons = {};\n\t\tconst bones = {};\n\n\t\t// generate bone lookup table\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isBone ) bones[ child.uuid ] = child;\n\n\t\t} );\n\n\t\t// create skeletons\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst skeleton = new Skeleton().fromJSON( json[ i ], bones );\n\n\t\t\t\tskeletons[ skeleton.uuid ] = skeleton;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn skeletons;\n\n\t}\n\n\tparseGeometries( json, shapes ) {\n\n\t\tconst geometries = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tconst bufferGeometryLoader = new BufferGeometryLoader();\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tlet geometry;\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tswitch ( data.type ) {\n\n\t\t\t\t\tcase 'BufferGeometry':\n\t\t\t\t\tcase 'InstancedBufferGeometry':\n\n\t\t\t\t\t\tgeometry = bufferGeometryLoader.parse( data );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tif ( data.type in Geometries ) {\n\n\t\t\t\t\t\t\tgeometry = Geometries[ data.type ].fromJSON( data, shapes );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tconsole.warn( `THREE.ObjectLoader: Unsupported geometry type \"${ data.type }\"` );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.uuid = data.uuid;\n\n\t\t\t\tif ( data.name !== undefined ) geometry.name = data.name;\n\t\t\t\tif ( data.userData !== undefined ) geometry.userData = data.userData;\n\n\t\t\t\tgeometries[ data.uuid ] = geometry;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn geometries;\n\n\t}\n\n\tparseMaterials( json, textures ) {\n\n\t\tconst cache = {}; // MultiMaterial\n\t\tconst materials = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tconst loader = new MaterialLoader();\n\t\t\tloader.setTextures( textures );\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tif ( cache[ data.uuid ] === undefined ) {\n\n\t\t\t\t\tcache[ data.uuid ] = loader.parse( data );\n\n\t\t\t\t}\n\n\t\t\t\tmaterials[ data.uuid ] = cache[ data.uuid ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn materials;\n\n\t}\n\n\tparseAnimations( json ) {\n\n\t\tconst animations = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0; i < json.length; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tconst clip = AnimationClip.parse( data );\n\n\t\t\t\tanimations[ clip.uuid ] = clip;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn animations;\n\n\t}\n\n\tparseImages( json, onLoad ) {\n\n\t\tconst scope = this;\n\t\tconst images = {};\n\n\t\tlet loader;\n\n\t\tfunction loadImage( url ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\treturn loader.load( url, function () {\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, undefined, function () {\n\n\t\t\t\tscope.manager.itemError( url );\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t} );\n\n\t\t}\n\n\t\tfunction deserializeImage( image ) {\n\n\t\t\tif ( typeof image === 'string' ) {\n\n\t\t\t\tconst url = image;\n\n\t\t\t\tconst path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( url ) ? url : scope.resourcePath + url;\n\n\t\t\t\treturn loadImage( path );\n\n\t\t\t} else {\n\n\t\t\t\tif ( image.data ) {\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: getTypedArray( image.type, image.data ),\n\t\t\t\t\t\twidth: image.width,\n\t\t\t\t\t\theight: image.height\n\t\t\t\t\t};\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json !== undefined && json.length > 0 ) {\n\n\t\t\tconst manager = new LoadingManager( onLoad );\n\n\t\t\tloader = new ImageLoader( manager );\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\n\n\t\t\tfor ( let i = 0, il = json.length; i < il; i ++ ) {\n\n\t\t\t\tconst image = json[ i ];\n\t\t\t\tconst url = image.url;\n\n\t\t\t\tif ( Array.isArray( url ) ) {\n\n\t\t\t\t\t// load array of images e.g CubeTexture\n\n\t\t\t\t\tconst imageArray = [];\n\n\t\t\t\t\tfor ( let j = 0, jl = url.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\tconst currentUrl = url[ j ];\n\n\t\t\t\t\t\tconst deserializedImage = deserializeImage( currentUrl );\n\n\t\t\t\t\t\tif ( deserializedImage !== null ) {\n\n\t\t\t\t\t\t\tif ( deserializedImage instanceof HTMLImageElement ) {\n\n\t\t\t\t\t\t\t\timageArray.push( deserializedImage );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// special case: handle array of data textures for cube textures\n\n\t\t\t\t\t\t\t\timageArray.push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\timages[ image.uuid ] = new Source( imageArray );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// load single image\n\n\t\t\t\t\tconst deserializedImage = deserializeImage( image.url );\n\t\t\t\t\timages[ image.uuid ] = new Source( deserializedImage );\n\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn images;\n\n\t}\n\n\tasync parseImagesAsync( json ) {\n\n\t\tconst scope = this;\n\t\tconst images = {};\n\n\t\tlet loader;\n\n\t\tasync function deserializeImage( image ) {\n\n\t\t\tif ( typeof image === 'string' ) {\n\n\t\t\t\tconst url = image;\n\n\t\t\t\tconst path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( url ) ? url : scope.resourcePath + url;\n\n\t\t\t\treturn await loader.loadAsync( path );\n\n\t\t\t} else {\n\n\t\t\t\tif ( image.data ) {\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: getTypedArray( image.type, image.data ),\n\t\t\t\t\t\twidth: image.width,\n\t\t\t\t\t\theight: image.height\n\t\t\t\t\t};\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json !== undefined && json.length > 0 ) {\n\n\t\t\tloader = new ImageLoader( this.manager );\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\n\n\t\t\tfor ( let i = 0, il = json.length; i < il; i ++ ) {\n\n\t\t\t\tconst image = json[ i ];\n\t\t\t\tconst url = image.url;\n\n\t\t\t\tif ( Array.isArray( url ) ) {\n\n\t\t\t\t\t// load array of images e.g CubeTexture\n\n\t\t\t\t\tconst imageArray = [];\n\n\t\t\t\t\tfor ( let j = 0, jl = url.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\tconst currentUrl = url[ j ];\n\n\t\t\t\t\t\tconst deserializedImage = await deserializeImage( currentUrl );\n\n\t\t\t\t\t\tif ( deserializedImage !== null ) {\n\n\t\t\t\t\t\t\tif ( deserializedImage instanceof HTMLImageElement ) {\n\n\t\t\t\t\t\t\t\timageArray.push( deserializedImage );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// special case: handle array of data textures for cube textures\n\n\t\t\t\t\t\t\t\timageArray.push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\timages[ image.uuid ] = new Source( imageArray );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// load single image\n\n\t\t\t\t\tconst deserializedImage = await deserializeImage( image.url );\n\t\t\t\t\timages[ image.uuid ] = new Source( deserializedImage );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn images;\n\n\t}\n\n\tparseTextures( json, images ) {\n\n\t\tfunction parseConstant( value, type ) {\n\n\t\t\tif ( typeof value === 'number' ) return value;\n\n\t\t\tconsole.warn( 'THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value );\n\n\t\t\treturn type[ value ];\n\n\t\t}\n\n\t\tconst textures = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tif ( data.image === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: No \"image\" specified for', data.uuid );\n\n\t\t\t\t}\n\n\t\t\t\tif ( images[ data.image ] === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined image', data.image );\n\n\t\t\t\t}\n\n\t\t\t\tconst source = images[ data.image ];\n\t\t\t\tconst image = source.data;\n\n\t\t\t\tlet texture;\n\n\t\t\t\tif ( Array.isArray( image ) ) {\n\n\t\t\t\t\ttexture = new CubeTexture();\n\n\t\t\t\t\tif ( image.length === 6 ) texture.needsUpdate = true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( image && image.data ) {\n\n\t\t\t\t\t\ttexture = new DataTexture();\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttexture = new Texture();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( image ) texture.needsUpdate = true; // textures can have undefined image data\n\n\t\t\t\t}\n\n\t\t\t\ttexture.source = source;\n\n\t\t\t\ttexture.uuid = data.uuid;\n\n\t\t\t\tif ( data.name !== undefined ) texture.name = data.name;\n\n\t\t\t\tif ( data.mapping !== undefined ) texture.mapping = parseConstant( data.mapping, TEXTURE_MAPPING );\n\t\t\t\tif ( data.channel !== undefined ) texture.channel = data.channel;\n\n\t\t\t\tif ( data.offset !== undefined ) texture.offset.fromArray( data.offset );\n\t\t\t\tif ( data.repeat !== undefined ) texture.repeat.fromArray( data.repeat );\n\t\t\t\tif ( data.center !== undefined ) texture.center.fromArray( data.center );\n\t\t\t\tif ( data.rotation !== undefined ) texture.rotation = data.rotation;\n\n\t\t\t\tif ( data.wrap !== undefined ) {\n\n\t\t\t\t\ttexture.wrapS = parseConstant( data.wrap[ 0 ], TEXTURE_WRAPPING );\n\t\t\t\t\ttexture.wrapT = parseConstant( data.wrap[ 1 ], TEXTURE_WRAPPING );\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.format !== undefined ) texture.format = data.format;\n\t\t\t\tif ( data.internalFormat !== undefined ) texture.internalFormat = data.internalFormat;\n\t\t\t\tif ( data.type !== undefined ) texture.type = data.type;\n\t\t\t\tif ( data.colorSpace !== undefined ) texture.colorSpace = data.colorSpace;\n\t\t\t\tif ( data.encoding !== undefined ) texture.encoding = data.encoding; // @deprecated, r152\n\n\t\t\t\tif ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter, TEXTURE_FILTER );\n\t\t\t\tif ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter, TEXTURE_FILTER );\n\t\t\t\tif ( data.anisotropy !== undefined ) texture.anisotropy = data.anisotropy;\n\n\t\t\t\tif ( data.flipY !== undefined ) texture.flipY = data.flipY;\n\n\t\t\t\tif ( data.generateMipmaps !== undefined ) texture.generateMipmaps = data.generateMipmaps;\n\t\t\t\tif ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha;\n\t\t\t\tif ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment;\n\t\t\t\tif ( data.compareFunction !== undefined ) texture.compareFunction = data.compareFunction;\n\n\t\t\t\tif ( data.userData !== undefined ) texture.userData = data.userData;\n\n\t\t\t\ttextures[ data.uuid ] = texture;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn textures;\n\n\t}\n\n\tparseObject( data, geometries, materials, textures, animations ) {\n\n\t\tlet object;\n\n\t\tfunction getGeometry( name ) {\n\n\t\t\tif ( geometries[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined geometry', name );\n\n\t\t\t}\n\n\t\t\treturn geometries[ name ];\n\n\t\t}\n\n\t\tfunction getMaterial( name ) {\n\n\t\t\tif ( name === undefined ) return undefined;\n\n\t\t\tif ( Array.isArray( name ) ) {\n\n\t\t\t\tconst array = [];\n\n\t\t\t\tfor ( let i = 0, l = name.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst uuid = name[ i ];\n\n\t\t\t\t\tif ( materials[ uuid ] === undefined ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined material', uuid );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tarray.push( materials[ uuid ] );\n\n\t\t\t\t}\n\n\t\t\t\treturn array;\n\n\t\t\t}\n\n\t\t\tif ( materials[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined material', name );\n\n\t\t\t}\n\n\t\t\treturn materials[ name ];\n\n\t\t}\n\n\t\tfunction getTexture( uuid ) {\n\n\t\t\tif ( textures[ uuid ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined texture', uuid );\n\n\t\t\t}\n\n\t\t\treturn textures[ uuid ];\n\n\t\t}\n\n\t\tlet geometry, material;\n\n\t\tswitch ( data.type ) {\n\n\t\t\tcase 'Scene':\n\n\t\t\t\tobject = new Scene();\n\n\t\t\t\tif ( data.background !== undefined ) {\n\n\t\t\t\t\tif ( Number.isInteger( data.background ) ) {\n\n\t\t\t\t\t\tobject.background = new Color( data.background );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tobject.background = getTexture( data.background );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.environment !== undefined ) {\n\n\t\t\t\t\tobject.environment = getTexture( data.environment );\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.fog !== undefined ) {\n\n\t\t\t\t\tif ( data.fog.type === 'Fog' ) {\n\n\t\t\t\t\t\tobject.fog = new Fog( data.fog.color, data.fog.near, data.fog.far );\n\n\t\t\t\t\t} else if ( data.fog.type === 'FogExp2' ) {\n\n\t\t\t\t\t\tobject.fog = new FogExp2( data.fog.color, data.fog.density );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( data.fog.name !== '' ) {\n\n\t\t\t\t\t\tobject.fog.name = data.fog.name;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.backgroundBlurriness !== undefined ) object.backgroundBlurriness = data.backgroundBlurriness;\n\t\t\t\tif ( data.backgroundIntensity !== undefined ) object.backgroundIntensity = data.backgroundIntensity;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PerspectiveCamera':\n\n\t\t\t\tobject = new PerspectiveCamera( data.fov, data.aspect, data.near, data.far );\n\n\t\t\t\tif ( data.focus !== undefined ) object.focus = data.focus;\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\n\t\t\t\tif ( data.filmGauge !== undefined ) object.filmGauge = data.filmGauge;\n\t\t\t\tif ( data.filmOffset !== undefined ) object.filmOffset = data.filmOffset;\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'OrthographicCamera':\n\n\t\t\t\tobject = new OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far );\n\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'AmbientLight':\n\n\t\t\t\tobject = new AmbientLight( data.color, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'DirectionalLight':\n\n\t\t\t\tobject = new DirectionalLight( data.color, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PointLight':\n\n\t\t\t\tobject = new PointLight( data.color, data.intensity, data.distance, data.decay );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'RectAreaLight':\n\n\t\t\t\tobject = new RectAreaLight( data.color, data.intensity, data.width, data.height );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'SpotLight':\n\n\t\t\t\tobject = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'HemisphereLight':\n\n\t\t\t\tobject = new HemisphereLight( data.color, data.groundColor, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LightProbe':\n\n\t\t\t\tobject = new LightProbe().fromJSON( data );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'SkinnedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t \tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new SkinnedMesh( geometry, material );\n\n\t\t\t\tif ( data.bindMode !== undefined ) object.bindMode = data.bindMode;\n\t\t\t\tif ( data.bindMatrix !== undefined ) object.bindMatrix.fromArray( data.bindMatrix );\n\t\t\t\tif ( data.skeleton !== undefined ) object.skeleton = data.skeleton;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Mesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new Mesh( geometry, material );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'InstancedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\t\t\t\tconst count = data.count;\n\t\t\t\tconst instanceMatrix = data.instanceMatrix;\n\t\t\t\tconst instanceColor = data.instanceColor;\n\n\t\t\t\tobject = new InstancedMesh( geometry, material, count );\n\t\t\t\tobject.instanceMatrix = new InstancedBufferAttribute( new Float32Array( instanceMatrix.array ), 16 );\n\t\t\t\tif ( instanceColor !== undefined ) object.instanceColor = new InstancedBufferAttribute( new Float32Array( instanceColor.array ), instanceColor.itemSize );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LOD':\n\n\t\t\t\tobject = new LOD();\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Line':\n\n\t\t\t\tobject = new Line( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LineLoop':\n\n\t\t\t\tobject = new LineLoop( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LineSegments':\n\n\t\t\t\tobject = new LineSegments( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PointCloud':\n\t\t\tcase 'Points':\n\n\t\t\t\tobject = new Points( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Sprite':\n\n\t\t\t\tobject = new Sprite( getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Group':\n\n\t\t\t\tobject = new Group();\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Bone':\n\n\t\t\t\tobject = new Bone();\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tobject = new Object3D();\n\n\t\t}\n\n\t\tobject.uuid = data.uuid;\n\n\t\tif ( data.name !== undefined ) object.name = data.name;\n\n\t\tif ( data.matrix !== undefined ) {\n\n\t\t\tobject.matrix.fromArray( data.matrix );\n\n\t\t\tif ( data.matrixAutoUpdate !== undefined ) object.matrixAutoUpdate = data.matrixAutoUpdate;\n\t\t\tif ( object.matrixAutoUpdate ) object.matrix.decompose( object.position, object.quaternion, object.scale );\n\n\t\t} else {\n\n\t\t\tif ( data.position !== undefined ) object.position.fromArray( data.position );\n\t\t\tif ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation );\n\t\t\tif ( data.quaternion !== undefined ) object.quaternion.fromArray( data.quaternion );\n\t\t\tif ( data.scale !== undefined ) object.scale.fromArray( data.scale );\n\n\t\t}\n\n\t\tif ( data.up !== undefined ) object.up.fromArray( data.up );\n\n\t\tif ( data.castShadow !== undefined ) object.castShadow = data.castShadow;\n\t\tif ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow;\n\n\t\tif ( data.shadow ) {\n\n\t\t\tif ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias;\n\t\t\tif ( data.shadow.normalBias !== undefined ) object.shadow.normalBias = data.shadow.normalBias;\n\t\t\tif ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius;\n\t\t\tif ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize );\n\t\t\tif ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera );\n\n\t\t}\n\n\t\tif ( data.visible !== undefined ) object.visible = data.visible;\n\t\tif ( data.frustumCulled !== undefined ) object.frustumCulled = data.frustumCulled;\n\t\tif ( data.renderOrder !== undefined ) object.renderOrder = data.renderOrder;\n\t\tif ( data.userData !== undefined ) object.userData = data.userData;\n\t\tif ( data.layers !== undefined ) object.layers.mask = data.layers;\n\n\t\tif ( data.children !== undefined ) {\n\n\t\t\tconst children = data.children;\n\n\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\n\n\t\t\t\tobject.add( this.parseObject( children[ i ], geometries, materials, textures, animations ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( data.animations !== undefined ) {\n\n\t\t\tconst objectAnimations = data.animations;\n\n\t\t\tfor ( let i = 0; i < objectAnimations.length; i ++ ) {\n\n\t\t\t\tconst uuid = objectAnimations[ i ];\n\n\t\t\t\tobject.animations.push( animations[ uuid ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( data.type === 'LOD' ) {\n\n\t\t\tif ( data.autoUpdate !== undefined ) object.autoUpdate = data.autoUpdate;\n\n\t\t\tconst levels = data.levels;\n\n\t\t\tfor ( let l = 0; l < levels.length; l ++ ) {\n\n\t\t\t\tconst level = levels[ l ];\n\t\t\t\tconst child = object.getObjectByProperty( 'uuid', level.object );\n\n\t\t\t\tif ( child !== undefined ) {\n\n\t\t\t\t\tobject.addLevel( child, level.distance, level.hysteresis );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn object;\n\n\t}\n\n\tbindSkeletons( object, skeletons ) {\n\n\t\tif ( Object.keys( skeletons ).length === 0 ) return;\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isSkinnedMesh === true && child.skeleton !== undefined ) {\n\n\t\t\t\tconst skeleton = skeletons[ child.skeleton ];\n\n\t\t\t\tif ( skeleton === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: No skeleton found with UUID:', child.skeleton );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tchild.bind( skeleton, child.bindMatrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} );\n\n\t}\n\n}\n\nconst TEXTURE_MAPPING = {\n\tUVMapping: UVMapping,\n\tCubeReflectionMapping: CubeReflectionMapping,\n\tCubeRefractionMapping: CubeRefractionMapping,\n\tEquirectangularReflectionMapping: EquirectangularReflectionMapping,\n\tEquirectangularRefractionMapping: EquirectangularRefractionMapping,\n\tCubeUVReflectionMapping: CubeUVReflectionMapping\n};\n\nconst TEXTURE_WRAPPING = {\n\tRepeatWrapping: RepeatWrapping,\n\tClampToEdgeWrapping: ClampToEdgeWrapping,\n\tMirroredRepeatWrapping: MirroredRepeatWrapping\n};\n\nconst TEXTURE_FILTER = {\n\tNearestFilter: NearestFilter,\n\tNearestMipmapNearestFilter: NearestMipmapNearestFilter,\n\tNearestMipmapLinearFilter: NearestMipmapLinearFilter,\n\tLinearFilter: LinearFilter,\n\tLinearMipmapNearestFilter: LinearMipmapNearestFilter,\n\tLinearMipmapLinearFilter: LinearMipmapLinearFilter\n};\n\nclass ImageBitmapLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t\tthis.isImageBitmapLoader = true;\n\n\t\tif ( typeof createImageBitmap === 'undefined' ) {\n\n\t\t\tconsole.warn( 'THREE.ImageBitmapLoader: createImageBitmap() not supported.' );\n\n\t\t}\n\n\t\tif ( typeof fetch === 'undefined' ) {\n\n\t\t\tconsole.warn( 'THREE.ImageBitmapLoader: fetch() not supported.' );\n\n\t\t}\n\n\t\tthis.options = { premultiplyAlpha: 'none' };\n\n\t}\n\n\tsetOptions( options ) {\n\n\t\tthis.options = options;\n\n\t\treturn this;\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( url === undefined ) url = '';\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst scope = this;\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\tsetTimeout( function () {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\tconst fetchOptions = {};\n\t\tfetchOptions.credentials = ( this.crossOrigin === 'anonymous' ) ? 'same-origin' : 'include';\n\t\tfetchOptions.headers = this.requestHeader;\n\n\t\tfetch( url, fetchOptions ).then( function ( res ) {\n\n\t\t\treturn res.blob();\n\n\t\t} ).then( function ( blob ) {\n\n\t\t\treturn createImageBitmap( blob, Object.assign( scope.options, { colorSpaceConversion: 'none' } ) );\n\n\t\t} ).then( function ( imageBitmap ) {\n\n\t\t\tCache.add( url, imageBitmap );\n\n\t\t\tif ( onLoad ) onLoad( imageBitmap );\n\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t} ).catch( function ( e ) {\n\n\t\t\tif ( onError ) onError( e );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t} );\n\n\t\tscope.manager.itemStart( url );\n\n\t}\n\n}\n\nlet _context;\n\nclass AudioContext {\n\n\tstatic getContext() {\n\n\t\tif ( _context === undefined ) {\n\n\t\t\t_context = new ( window.AudioContext || window.webkitAudioContext )();\n\n\t\t}\n\n\t\treturn _context;\n\n\t}\n\n\tstatic setContext( value ) {\n\n\t\t_context = value;\n\n\t}\n\n}\n\nclass AudioLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( buffer ) {\n\n\t\t\ttry {\n\n\t\t\t\t// Create a copy of the buffer. The `decodeAudioData` method\n\t\t\t\t// detaches the buffer when complete, preventing reuse.\n\t\t\t\tconst bufferCopy = buffer.slice( 0 );\n\n\t\t\t\tconst context = AudioContext.getContext();\n\t\t\t\tcontext.decodeAudioData( bufferCopy, function ( audioBuffer ) {\n\n\t\t\t\t\tonLoad( audioBuffer );\n\n\t\t\t\t}, handleError );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\thandleError( e );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t\tfunction handleError( e ) {\n\n\t\t\tif ( onError ) {\n\n\t\t\t\tonError( e );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.error( e );\n\n\t\t\t}\n\n\t\t\tscope.manager.itemError( url );\n\n\t\t}\n\n\t}\n\n}\n\nconst _eyeRight = /*@__PURE__*/ new Matrix4();\nconst _eyeLeft = /*@__PURE__*/ new Matrix4();\nconst _projectionMatrix = /*@__PURE__*/ new Matrix4();\n\nclass StereoCamera {\n\n\tconstructor() {\n\n\t\tthis.type = 'StereoCamera';\n\n\t\tthis.aspect = 1;\n\n\t\tthis.eyeSep = 0.064;\n\n\t\tthis.cameraL = new PerspectiveCamera();\n\t\tthis.cameraL.layers.enable( 1 );\n\t\tthis.cameraL.matrixAutoUpdate = false;\n\n\t\tthis.cameraR = new PerspectiveCamera();\n\t\tthis.cameraR.layers.enable( 2 );\n\t\tthis.cameraR.matrixAutoUpdate = false;\n\n\t\tthis._cache = {\n\t\t\tfocus: null,\n\t\t\tfov: null,\n\t\t\taspect: null,\n\t\t\tnear: null,\n\t\t\tfar: null,\n\t\t\tzoom: null,\n\t\t\teyeSep: null\n\t\t};\n\n\t}\n\n\tupdate( camera ) {\n\n\t\tconst cache = this._cache;\n\n\t\tconst needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov ||\n\t\t\tcache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near ||\n\t\t\tcache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep;\n\n\t\tif ( needsUpdate ) {\n\n\t\t\tcache.focus = camera.focus;\n\t\t\tcache.fov = camera.fov;\n\t\t\tcache.aspect = camera.aspect * this.aspect;\n\t\t\tcache.near = camera.near;\n\t\t\tcache.far = camera.far;\n\t\t\tcache.zoom = camera.zoom;\n\t\t\tcache.eyeSep = this.eyeSep;\n\n\t\t\t// Off-axis stereoscopic effect based on\n\t\t\t// http://paulbourke.net/stereographics/stereorender/\n\n\t\t\t_projectionMatrix.copy( camera.projectionMatrix );\n\t\t\tconst eyeSepHalf = cache.eyeSep / 2;\n\t\t\tconst eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;\n\t\t\tconst ymax = ( cache.near * Math.tan( DEG2RAD * cache.fov * 0.5 ) ) / cache.zoom;\n\t\t\tlet xmin, xmax;\n\n\t\t\t// translate xOffset\n\n\t\t\t_eyeLeft.elements[ 12 ] = - eyeSepHalf;\n\t\t\t_eyeRight.elements[ 12 ] = eyeSepHalf;\n\n\t\t\t// for left eye\n\n\t\t\txmin = - ymax * cache.aspect + eyeSepOnProjection;\n\t\t\txmax = ymax * cache.aspect + eyeSepOnProjection;\n\n\t\t\t_projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\n\t\t\t_projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\n\n\t\t\tthis.cameraL.projectionMatrix.copy( _projectionMatrix );\n\n\t\t\t// for right eye\n\n\t\t\txmin = - ymax * cache.aspect - eyeSepOnProjection;\n\t\t\txmax = ymax * cache.aspect - eyeSepOnProjection;\n\n\t\t\t_projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\n\t\t\t_projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\n\n\t\t\tthis.cameraR.projectionMatrix.copy( _projectionMatrix );\n\n\t\t}\n\n\t\tthis.cameraL.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeLeft );\n\t\tthis.cameraR.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeRight );\n\n\t}\n\n}\n\nclass Clock {\n\n\tconstructor( autoStart = true ) {\n\n\t\tthis.autoStart = autoStart;\n\n\t\tthis.startTime = 0;\n\t\tthis.oldTime = 0;\n\t\tthis.elapsedTime = 0;\n\n\t\tthis.running = false;\n\n\t}\n\n\tstart() {\n\n\t\tthis.startTime = now();\n\n\t\tthis.oldTime = this.startTime;\n\t\tthis.elapsedTime = 0;\n\t\tthis.running = true;\n\n\t}\n\n\tstop() {\n\n\t\tthis.getElapsedTime();\n\t\tthis.running = false;\n\t\tthis.autoStart = false;\n\n\t}\n\n\tgetElapsedTime() {\n\n\t\tthis.getDelta();\n\t\treturn this.elapsedTime;\n\n\t}\n\n\tgetDelta() {\n\n\t\tlet diff = 0;\n\n\t\tif ( this.autoStart && ! this.running ) {\n\n\t\t\tthis.start();\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tif ( this.running ) {\n\n\t\t\tconst newTime = now();\n\n\t\t\tdiff = ( newTime - this.oldTime ) / 1000;\n\t\t\tthis.oldTime = newTime;\n\n\t\t\tthis.elapsedTime += diff;\n\n\t\t}\n\n\t\treturn diff;\n\n\t}\n\n}\n\nfunction now() {\n\n\treturn ( typeof performance === 'undefined' ? Date : performance ).now(); // see #10732\n\n}\n\nconst _position$1 = /*@__PURE__*/ new Vector3();\nconst _quaternion$1 = /*@__PURE__*/ new Quaternion();\nconst _scale$1 = /*@__PURE__*/ new Vector3();\nconst _orientation$1 = /*@__PURE__*/ new Vector3();\n\nclass AudioListener extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'AudioListener';\n\n\t\tthis.context = AudioContext.getContext();\n\n\t\tthis.gain = this.context.createGain();\n\t\tthis.gain.connect( this.context.destination );\n\n\t\tthis.filter = null;\n\n\t\tthis.timeDelta = 0;\n\n\t\t// private\n\n\t\tthis._clock = new Clock();\n\n\t}\n\n\tgetInput() {\n\n\t\treturn this.gain;\n\n\t}\n\n\tremoveFilter() {\n\n\t\tif ( this.filter !== null ) {\n\n\t\t\tthis.gain.disconnect( this.filter );\n\t\t\tthis.filter.disconnect( this.context.destination );\n\t\t\tthis.gain.connect( this.context.destination );\n\t\t\tthis.filter = null;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetFilter() {\n\n\t\treturn this.filter;\n\n\t}\n\n\tsetFilter( value ) {\n\n\t\tif ( this.filter !== null ) {\n\n\t\t\tthis.gain.disconnect( this.filter );\n\t\t\tthis.filter.disconnect( this.context.destination );\n\n\t\t} else {\n\n\t\t\tthis.gain.disconnect( this.context.destination );\n\n\t\t}\n\n\t\tthis.filter = value;\n\t\tthis.gain.connect( this.filter );\n\t\tthis.filter.connect( this.context.destination );\n\n\t\treturn this;\n\n\t}\n\n\tgetMasterVolume() {\n\n\t\treturn this.gain.gain.value;\n\n\t}\n\n\tsetMasterVolume( value ) {\n\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\n\n\t\treturn this;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tconst listener = this.context.listener;\n\t\tconst up = this.up;\n\n\t\tthis.timeDelta = this._clock.getDelta();\n\n\t\tthis.matrixWorld.decompose( _position$1, _quaternion$1, _scale$1 );\n\n\t\t_orientation$1.set( 0, 0, - 1 ).applyQuaternion( _quaternion$1 );\n\n\t\tif ( listener.positionX ) {\n\n\t\t\t// code path for Chrome (see #14393)\n\n\t\t\tconst endTime = this.context.currentTime + this.timeDelta;\n\n\t\t\tlistener.positionX.linearRampToValueAtTime( _position$1.x, endTime );\n\t\t\tlistener.positionY.linearRampToValueAtTime( _position$1.y, endTime );\n\t\t\tlistener.positionZ.linearRampToValueAtTime( _position$1.z, endTime );\n\t\t\tlistener.forwardX.linearRampToValueAtTime( _orientation$1.x, endTime );\n\t\t\tlistener.forwardY.linearRampToValueAtTime( _orientation$1.y, endTime );\n\t\t\tlistener.forwardZ.linearRampToValueAtTime( _orientation$1.z, endTime );\n\t\t\tlistener.upX.linearRampToValueAtTime( up.x, endTime );\n\t\t\tlistener.upY.linearRampToValueAtTime( up.y, endTime );\n\t\t\tlistener.upZ.linearRampToValueAtTime( up.z, endTime );\n\n\t\t} else {\n\n\t\t\tlistener.setPosition( _position$1.x, _position$1.y, _position$1.z );\n\t\t\tlistener.setOrientation( _orientation$1.x, _orientation$1.y, _orientation$1.z, up.x, up.y, up.z );\n\n\t\t}\n\n\t}\n\n}\n\nclass Audio extends Object3D {\n\n\tconstructor( listener ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Audio';\n\n\t\tthis.listener = listener;\n\t\tthis.context = listener.context;\n\n\t\tthis.gain = this.context.createGain();\n\t\tthis.gain.connect( listener.getInput() );\n\n\t\tthis.autoplay = false;\n\n\t\tthis.buffer = null;\n\t\tthis.detune = 0;\n\t\tthis.loop = false;\n\t\tthis.loopStart = 0;\n\t\tthis.loopEnd = 0;\n\t\tthis.offset = 0;\n\t\tthis.duration = undefined;\n\t\tthis.playbackRate = 1;\n\t\tthis.isPlaying = false;\n\t\tthis.hasPlaybackControl = true;\n\t\tthis.source = null;\n\t\tthis.sourceType = 'empty';\n\n\t\tthis._startedAt = 0;\n\t\tthis._progress = 0;\n\t\tthis._connected = false;\n\n\t\tthis.filters = [];\n\n\t}\n\n\tgetOutput() {\n\n\t\treturn this.gain;\n\n\t}\n\n\tsetNodeSource( audioNode ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'audioNode';\n\t\tthis.source = audioNode;\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetMediaElementSource( mediaElement ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'mediaNode';\n\t\tthis.source = this.context.createMediaElementSource( mediaElement );\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetMediaStreamSource( mediaStream ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'mediaStreamNode';\n\t\tthis.source = this.context.createMediaStreamSource( mediaStream );\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetBuffer( audioBuffer ) {\n\n\t\tthis.buffer = audioBuffer;\n\t\tthis.sourceType = 'buffer';\n\n\t\tif ( this.autoplay ) this.play();\n\n\t\treturn this;\n\n\t}\n\n\tplay( delay = 0 ) {\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: Audio is already playing.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis._startedAt = this.context.currentTime + delay;\n\n\t\tconst source = this.context.createBufferSource();\n\t\tsource.buffer = this.buffer;\n\t\tsource.loop = this.loop;\n\t\tsource.loopStart = this.loopStart;\n\t\tsource.loopEnd = this.loopEnd;\n\t\tsource.onended = this.onEnded.bind( this );\n\t\tsource.start( this._startedAt, this._progress + this.offset, this.duration );\n\n\t\tthis.isPlaying = true;\n\n\t\tthis.source = source;\n\n\t\tthis.setDetune( this.detune );\n\t\tthis.setPlaybackRate( this.playbackRate );\n\n\t\treturn this.connect();\n\n\t}\n\n\tpause() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\t// update current progress\n\n\t\t\tthis._progress += Math.max( this.context.currentTime - this._startedAt, 0 ) * this.playbackRate;\n\n\t\t\tif ( this.loop === true ) {\n\n\t\t\t\t// ensure _progress does not exceed duration with looped audios\n\n\t\t\t\tthis._progress = this._progress % ( this.duration || this.buffer.duration );\n\n\t\t\t}\n\n\t\t\tthis.source.stop();\n\t\t\tthis.source.onended = null;\n\n\t\t\tthis.isPlaying = false;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tstop() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis._progress = 0;\n\n\t\tif ( this.source !== null ) {\n\n\t\t\tthis.source.stop();\n\t\t\tthis.source.onended = null;\n\n\t\t}\n\n\t\tthis.isPlaying = false;\n\n\t\treturn this;\n\n\t}\n\n\tconnect() {\n\n\t\tif ( this.filters.length > 0 ) {\n\n\t\t\tthis.source.connect( this.filters[ 0 ] );\n\n\t\t\tfor ( let i = 1, l = this.filters.length; i < l; i ++ ) {\n\n\t\t\t\tthis.filters[ i - 1 ].connect( this.filters[ i ] );\n\n\t\t\t}\n\n\t\t\tthis.filters[ this.filters.length - 1 ].connect( this.getOutput() );\n\n\t\t} else {\n\n\t\t\tthis.source.connect( this.getOutput() );\n\n\t\t}\n\n\t\tthis._connected = true;\n\n\t\treturn this;\n\n\t}\n\n\tdisconnect() {\n\n\t\tif ( this._connected === false ) {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.filters.length > 0 ) {\n\n\t\t\tthis.source.disconnect( this.filters[ 0 ] );\n\n\t\t\tfor ( let i = 1, l = this.filters.length; i < l; i ++ ) {\n\n\t\t\t\tthis.filters[ i - 1 ].disconnect( this.filters[ i ] );\n\n\t\t\t}\n\n\t\t\tthis.filters[ this.filters.length - 1 ].disconnect( this.getOutput() );\n\n\t\t} else {\n\n\t\t\tthis.source.disconnect( this.getOutput() );\n\n\t\t}\n\n\t\tthis._connected = false;\n\n\t\treturn this;\n\n\t}\n\n\tgetFilters() {\n\n\t\treturn this.filters;\n\n\t}\n\n\tsetFilters( value ) {\n\n\t\tif ( ! value ) value = [];\n\n\t\tif ( this._connected === true ) {\n\n\t\t\tthis.disconnect();\n\t\t\tthis.filters = value.slice();\n\t\t\tthis.connect();\n\n\t\t} else {\n\n\t\t\tthis.filters = value.slice();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetDetune( value ) {\n\n\t\tthis.detune = value;\n\n\t\tif ( this.source.detune === undefined ) return; // only set detune when available\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.detune.setTargetAtTime( this.detune, this.context.currentTime, 0.01 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetDetune() {\n\n\t\treturn this.detune;\n\n\t}\n\n\tgetFilter() {\n\n\t\treturn this.getFilters()[ 0 ];\n\n\t}\n\n\tsetFilter( filter ) {\n\n\t\treturn this.setFilters( filter ? [ filter ] : [] );\n\n\t}\n\n\tsetPlaybackRate( value ) {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis.playbackRate = value;\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.playbackRate.setTargetAtTime( this.playbackRate, this.context.currentTime, 0.01 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetPlaybackRate() {\n\n\t\treturn this.playbackRate;\n\n\t}\n\n\tonEnded() {\n\n\t\tthis.isPlaying = false;\n\n\t}\n\n\tgetLoop() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn this.loop;\n\n\t}\n\n\tsetLoop( value ) {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis.loop = value;\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.loop = this.loop;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetLoopStart( value ) {\n\n\t\tthis.loopStart = value;\n\n\t\treturn this;\n\n\t}\n\n\tsetLoopEnd( value ) {\n\n\t\tthis.loopEnd = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetVolume() {\n\n\t\treturn this.gain.gain.value;\n\n\t}\n\n\tsetVolume( value ) {\n\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _position = /*@__PURE__*/ new Vector3();\nconst _quaternion = /*@__PURE__*/ new Quaternion();\nconst _scale = /*@__PURE__*/ new Vector3();\nconst _orientation = /*@__PURE__*/ new Vector3();\n\nclass PositionalAudio extends Audio {\n\n\tconstructor( listener ) {\n\n\t\tsuper( listener );\n\n\t\tthis.panner = this.context.createPanner();\n\t\tthis.panner.panningModel = 'HRTF';\n\t\tthis.panner.connect( this.gain );\n\n\t}\n\n\tconnect() {\n\n\t\tsuper.connect();\n\n\t\tthis.panner.connect( this.gain );\n\n\t}\n\n\tdisconnect() {\n\n\t\tsuper.disconnect();\n\n\t\tthis.panner.disconnect( this.gain );\n\n\t}\n\n\tgetOutput() {\n\n\t\treturn this.panner;\n\n\t}\n\n\tgetRefDistance() {\n\n\t\treturn this.panner.refDistance;\n\n\t}\n\n\tsetRefDistance( value ) {\n\n\t\tthis.panner.refDistance = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetRolloffFactor() {\n\n\t\treturn this.panner.rolloffFactor;\n\n\t}\n\n\tsetRolloffFactor( value ) {\n\n\t\tthis.panner.rolloffFactor = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetDistanceModel() {\n\n\t\treturn this.panner.distanceModel;\n\n\t}\n\n\tsetDistanceModel( value ) {\n\n\t\tthis.panner.distanceModel = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetMaxDistance() {\n\n\t\treturn this.panner.maxDistance;\n\n\t}\n\n\tsetMaxDistance( value ) {\n\n\t\tthis.panner.maxDistance = value;\n\n\t\treturn this;\n\n\t}\n\n\tsetDirectionalCone( coneInnerAngle, coneOuterAngle, coneOuterGain ) {\n\n\t\tthis.panner.coneInnerAngle = coneInnerAngle;\n\t\tthis.panner.coneOuterAngle = coneOuterAngle;\n\t\tthis.panner.coneOuterGain = coneOuterGain;\n\n\t\treturn this;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tif ( this.hasPlaybackControl === true && this.isPlaying === false ) return;\n\n\t\tthis.matrixWorld.decompose( _position, _quaternion, _scale );\n\n\t\t_orientation.set( 0, 0, 1 ).applyQuaternion( _quaternion );\n\n\t\tconst panner = this.panner;\n\n\t\tif ( panner.positionX ) {\n\n\t\t\t// code path for Chrome and Firefox (see #14393)\n\n\t\t\tconst endTime = this.context.currentTime + this.listener.timeDelta;\n\n\t\t\tpanner.positionX.linearRampToValueAtTime( _position.x, endTime );\n\t\t\tpanner.positionY.linearRampToValueAtTime( _position.y, endTime );\n\t\t\tpanner.positionZ.linearRampToValueAtTime( _position.z, endTime );\n\t\t\tpanner.orientationX.linearRampToValueAtTime( _orientation.x, endTime );\n\t\t\tpanner.orientationY.linearRampToValueAtTime( _orientation.y, endTime );\n\t\t\tpanner.orientationZ.linearRampToValueAtTime( _orientation.z, endTime );\n\n\t\t} else {\n\n\t\t\tpanner.setPosition( _position.x, _position.y, _position.z );\n\t\t\tpanner.setOrientation( _orientation.x, _orientation.y, _orientation.z );\n\n\t\t}\n\n\t}\n\n}\n\nclass AudioAnalyser {\n\n\tconstructor( audio, fftSize = 2048 ) {\n\n\t\tthis.analyser = audio.context.createAnalyser();\n\t\tthis.analyser.fftSize = fftSize;\n\n\t\tthis.data = new Uint8Array( this.analyser.frequencyBinCount );\n\n\t\taudio.getOutput().connect( this.analyser );\n\n\t}\n\n\n\tgetFrequencyData() {\n\n\t\tthis.analyser.getByteFrequencyData( this.data );\n\n\t\treturn this.data;\n\n\t}\n\n\tgetAverageFrequency() {\n\n\t\tlet value = 0;\n\t\tconst data = this.getFrequencyData();\n\n\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\tvalue += data[ i ];\n\n\t\t}\n\n\t\treturn value / data.length;\n\n\t}\n\n}\n\nclass PropertyMixer {\n\n\tconstructor( binding, typeName, valueSize ) {\n\n\t\tthis.binding = binding;\n\t\tthis.valueSize = valueSize;\n\n\t\tlet mixFunction,\n\t\t\tmixFunctionAdditive,\n\t\t\tsetIdentity;\n\n\t\t// buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ]\n\t\t//\n\t\t// interpolators can use .buffer as their .result\n\t\t// the data then goes to 'incoming'\n\t\t//\n\t\t// 'accu0' and 'accu1' are used frame-interleaved for\n\t\t// the cumulative result and are compared to detect\n\t\t// changes\n\t\t//\n\t\t// 'orig' stores the original state of the property\n\t\t//\n\t\t// 'add' is used for additive cumulative results\n\t\t//\n\t\t// 'work' is optional and is only present for quaternion types. It is used\n\t\t// to store intermediate quaternion multiplication results\n\n\t\tswitch ( typeName ) {\n\n\t\t\tcase 'quaternion':\n\t\t\t\tmixFunction = this._slerp;\n\t\t\t\tmixFunctionAdditive = this._slerpAdditive;\n\t\t\t\tsetIdentity = this._setAdditiveIdentityQuaternion;\n\n\t\t\t\tthis.buffer = new Float64Array( valueSize * 6 );\n\t\t\t\tthis._workIndex = 5;\n\t\t\t\tbreak;\n\n\t\t\tcase 'string':\n\t\t\tcase 'bool':\n\t\t\t\tmixFunction = this._select;\n\n\t\t\t\t// Use the regular mix function and for additive on these types,\n\t\t\t\t// additive is not relevant for non-numeric types\n\t\t\t\tmixFunctionAdditive = this._select;\n\n\t\t\t\tsetIdentity = this._setAdditiveIdentityOther;\n\n\t\t\t\tthis.buffer = new Array( valueSize * 5 );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tmixFunction = this._lerp;\n\t\t\t\tmixFunctionAdditive = this._lerpAdditive;\n\t\t\t\tsetIdentity = this._setAdditiveIdentityNumeric;\n\n\t\t\t\tthis.buffer = new Float64Array( valueSize * 5 );\n\n\t\t}\n\n\t\tthis._mixBufferRegion = mixFunction;\n\t\tthis._mixBufferRegionAdditive = mixFunctionAdditive;\n\t\tthis._setIdentity = setIdentity;\n\t\tthis._origIndex = 3;\n\t\tthis._addIndex = 4;\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t\tthis.useCount = 0;\n\t\tthis.referenceCount = 0;\n\n\t}\n\n\t// accumulate data in the 'incoming' region into 'accu'\n\taccumulate( accuIndex, weight ) {\n\n\t\t// note: happily accumulating nothing when weight = 0, the caller knows\n\t\t// the weight and shouldn't have made the call in the first place\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = accuIndex * stride + stride;\n\n\t\tlet currentWeight = this.cumulativeWeight;\n\n\t\tif ( currentWeight === 0 ) {\n\n\t\t\t// accuN := incoming * weight\n\n\t\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\t\tbuffer[ offset + i ] = buffer[ i ];\n\n\t\t\t}\n\n\t\t\tcurrentWeight = weight;\n\n\t\t} else {\n\n\t\t\t// accuN := accuN + incoming * weight\n\n\t\t\tcurrentWeight += weight;\n\t\t\tconst mix = weight / currentWeight;\n\t\t\tthis._mixBufferRegion( buffer, offset, 0, mix, stride );\n\n\t\t}\n\n\t\tthis.cumulativeWeight = currentWeight;\n\n\t}\n\n\t// accumulate data in the 'incoming' region into 'add'\n\taccumulateAdditive( weight ) {\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = stride * this._addIndex;\n\n\t\tif ( this.cumulativeWeightAdditive === 0 ) {\n\n\t\t\t// add = identity\n\n\t\t\tthis._setIdentity();\n\n\t\t}\n\n\t\t// add := add + incoming * weight\n\n\t\tthis._mixBufferRegionAdditive( buffer, offset, 0, weight, stride );\n\t\tthis.cumulativeWeightAdditive += weight;\n\n\t}\n\n\t// apply the state of 'accu' to the binding when accus differ\n\tapply( accuIndex ) {\n\n\t\tconst stride = this.valueSize,\n\t\t\tbuffer = this.buffer,\n\t\t\toffset = accuIndex * stride + stride,\n\n\t\t\tweight = this.cumulativeWeight,\n\t\t\tweightAdditive = this.cumulativeWeightAdditive,\n\n\t\t\tbinding = this.binding;\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t\tif ( weight < 1 ) {\n\n\t\t\t// accuN := accuN + original * ( 1 - cumulativeWeight )\n\n\t\t\tconst originalValueOffset = stride * this._origIndex;\n\n\t\t\tthis._mixBufferRegion(\n\t\t\t\tbuffer, offset, originalValueOffset, 1 - weight, stride );\n\n\t\t}\n\n\t\tif ( weightAdditive > 0 ) {\n\n\t\t\t// accuN := accuN + additive accuN\n\n\t\t\tthis._mixBufferRegionAdditive( buffer, offset, this._addIndex * stride, 1, stride );\n\n\t\t}\n\n\t\tfor ( let i = stride, e = stride + stride; i !== e; ++ i ) {\n\n\t\t\tif ( buffer[ i ] !== buffer[ i + stride ] ) {\n\n\t\t\t\t// value has changed -> update scene graph\n\n\t\t\t\tbinding.setValue( buffer, offset );\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// remember the state of the bound property and copy it to both accus\n\tsaveOriginalState() {\n\n\t\tconst binding = this.binding;\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\n\t\t\toriginalValueOffset = stride * this._origIndex;\n\n\t\tbinding.getValue( buffer, originalValueOffset );\n\n\t\t// accu[0..1] := orig -- initially detect changes against the original\n\t\tfor ( let i = stride, e = originalValueOffset; i !== e; ++ i ) {\n\n\t\t\tbuffer[ i ] = buffer[ originalValueOffset + ( i % stride ) ];\n\n\t\t}\n\n\t\t// Add to identity for additive\n\t\tthis._setIdentity();\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t}\n\n\t// apply the state previously taken via 'saveOriginalState' to the binding\n\trestoreOriginalState() {\n\n\t\tconst originalValueOffset = this.valueSize * 3;\n\t\tthis.binding.setValue( this.buffer, originalValueOffset );\n\n\t}\n\n\t_setAdditiveIdentityNumeric() {\n\n\t\tconst startIndex = this._addIndex * this.valueSize;\n\t\tconst endIndex = startIndex + this.valueSize;\n\n\t\tfor ( let i = startIndex; i < endIndex; i ++ ) {\n\n\t\t\tthis.buffer[ i ] = 0;\n\n\t\t}\n\n\t}\n\n\t_setAdditiveIdentityQuaternion() {\n\n\t\tthis._setAdditiveIdentityNumeric();\n\t\tthis.buffer[ this._addIndex * this.valueSize + 3 ] = 1;\n\n\t}\n\n\t_setAdditiveIdentityOther() {\n\n\t\tconst startIndex = this._origIndex * this.valueSize;\n\t\tconst targetIndex = this._addIndex * this.valueSize;\n\n\t\tfor ( let i = 0; i < this.valueSize; i ++ ) {\n\n\t\t\tthis.buffer[ targetIndex + i ] = this.buffer[ startIndex + i ];\n\n\t\t}\n\n\t}\n\n\n\t// mix functions\n\n\t_select( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tif ( t >= 0.5 ) {\n\n\t\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\t\tbuffer[ dstOffset + i ] = buffer[ srcOffset + i ];\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_slerp( buffer, dstOffset, srcOffset, t ) {\n\n\t\tQuaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t );\n\n\t}\n\n\t_slerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tconst workOffset = this._workIndex * stride;\n\n\t\t// Store result in intermediate buffer offset\n\t\tQuaternion.multiplyQuaternionsFlat( buffer, workOffset, buffer, dstOffset, buffer, srcOffset );\n\n\t\t// Slerp to the intermediate result\n\t\tQuaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t );\n\n\t}\n\n\t_lerp( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tconst s = 1 - t;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tconst j = dstOffset + i;\n\n\t\t\tbuffer[ j ] = buffer[ j ] * s + buffer[ srcOffset + i ] * t;\n\n\t\t}\n\n\t}\n\n\t_lerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tconst j = dstOffset + i;\n\n\t\t\tbuffer[ j ] = buffer[ j ] + buffer[ srcOffset + i ] * t;\n\n\t\t}\n\n\t}\n\n}\n\n// Characters [].:/ are reserved for track binding syntax.\nconst _RESERVED_CHARS_RE = '\\\\[\\\\]\\\\.:\\\\/';\nconst _reservedRe = new RegExp( '[' + _RESERVED_CHARS_RE + ']', 'g' );\n\n// Attempts to allow node names from any language. ES5's `\\w` regexp matches\n// only latin characters, and the unicode \\p{L} is not yet supported. So\n// instead, we exclude reserved characters and match everything else.\nconst _wordChar = '[^' + _RESERVED_CHARS_RE + ']';\nconst _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace( '\\\\.', '' ) + ']';\n\n// Parent directories, delimited by '/' or ':'. Currently unused, but must\n// be matched to parse the rest of the track name.\nconst _directoryRe = /*@__PURE__*/ /((?:WC+[\\/:])*)/.source.replace( 'WC', _wordChar );\n\n// Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.\nconst _nodeRe = /*@__PURE__*/ /(WCOD+)?/.source.replace( 'WCOD', _wordCharOrDot );\n\n// Object on target node, and accessor. May not contain reserved\n// characters. Accessor may contain any character except closing bracket.\nconst _objectRe = /*@__PURE__*/ /(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace( 'WC', _wordChar );\n\n// Property and accessor. May not contain reserved characters. Accessor may\n// contain any non-bracket characters.\nconst _propertyRe = /*@__PURE__*/ /\\.(WC+)(?:\\[(.+)\\])?/.source.replace( 'WC', _wordChar );\n\nconst _trackRe = new RegExp( ''\n\t+ '^'\n\t+ _directoryRe\n\t+ _nodeRe\n\t+ _objectRe\n\t+ _propertyRe\n\t+ '$'\n);\n\nconst _supportedObjectNames = [ 'material', 'materials', 'bones', 'map' ];\n\nclass Composite {\n\n\tconstructor( targetGroup, path, optionalParsedPath ) {\n\n\t\tconst parsedPath = optionalParsedPath || PropertyBinding.parseTrackName( path );\n\n\t\tthis._targetGroup = targetGroup;\n\t\tthis._bindings = targetGroup.subscribe_( path, parsedPath );\n\n\t}\n\n\tgetValue( array, offset ) {\n\n\t\tthis.bind(); // bind all binding\n\n\t\tconst firstValidIndex = this._targetGroup.nCachedObjects_,\n\t\t\tbinding = this._bindings[ firstValidIndex ];\n\n\t\t// and only call .getValue on the first\n\t\tif ( binding !== undefined ) binding.getValue( array, offset );\n\n\t}\n\n\tsetValue( array, offset ) {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].setValue( array, offset );\n\n\t\t}\n\n\t}\n\n\tbind() {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].bind();\n\n\t\t}\n\n\t}\n\n\tunbind() {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].unbind();\n\n\t\t}\n\n\t}\n\n}\n\n// Note: This class uses a State pattern on a per-method basis:\n// 'bind' sets 'this.getValue' / 'setValue' and shadows the\n// prototype version of these methods with one that represents\n// the bound state. When the property is not found, the methods\n// become no-ops.\nclass PropertyBinding {\n\n\tconstructor( rootNode, path, parsedPath ) {\n\n\t\tthis.path = path;\n\t\tthis.parsedPath = parsedPath || PropertyBinding.parseTrackName( path );\n\n\t\tthis.node = PropertyBinding.findNode( rootNode, this.parsedPath.nodeName );\n\n\t\tthis.rootNode = rootNode;\n\n\t\t// initial state of these methods that calls 'bind'\n\t\tthis.getValue = this._getValue_unbound;\n\t\tthis.setValue = this._setValue_unbound;\n\n\t}\n\n\n\tstatic create( root, path, parsedPath ) {\n\n\t\tif ( ! ( root && root.isAnimationObjectGroup ) ) {\n\n\t\t\treturn new PropertyBinding( root, path, parsedPath );\n\n\t\t} else {\n\n\t\t\treturn new PropertyBinding.Composite( root, path, parsedPath );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Replaces spaces with underscores and removes unsupported characters from\n\t * node names, to ensure compatibility with parseTrackName().\n\t *\n\t * @param {string} name Node name to be sanitized.\n\t * @return {string}\n\t */\n\tstatic sanitizeNodeName( name ) {\n\n\t\treturn name.replace( /\\s/g, '_' ).replace( _reservedRe, '' );\n\n\t}\n\n\tstatic parseTrackName( trackName ) {\n\n\t\tconst matches = _trackRe.exec( trackName );\n\n\t\tif ( matches === null ) {\n\n\t\t\tthrow new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName );\n\n\t\t}\n\n\t\tconst results = {\n\t\t\t// directoryName: matches[ 1 ], // (tschw) currently unused\n\t\t\tnodeName: matches[ 2 ],\n\t\t\tobjectName: matches[ 3 ],\n\t\t\tobjectIndex: matches[ 4 ],\n\t\t\tpropertyName: matches[ 5 ], // required\n\t\t\tpropertyIndex: matches[ 6 ]\n\t\t};\n\n\t\tconst lastDot = results.nodeName && results.nodeName.lastIndexOf( '.' );\n\n\t\tif ( lastDot !== undefined && lastDot !== - 1 ) {\n\n\t\t\tconst objectName = results.nodeName.substring( lastDot + 1 );\n\n\t\t\t// Object names must be checked against an allowlist. Otherwise, there\n\t\t\t// is no way to parse 'foo.bar.baz': 'baz' must be a property, but\n\t\t\t// 'bar' could be the objectName, or part of a nodeName (which can\n\t\t\t// include '.' characters).\n\t\t\tif ( _supportedObjectNames.indexOf( objectName ) !== - 1 ) {\n\n\t\t\t\tresults.nodeName = results.nodeName.substring( 0, lastDot );\n\t\t\t\tresults.objectName = objectName;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( results.propertyName === null || results.propertyName.length === 0 ) {\n\n\t\t\tthrow new Error( 'PropertyBinding: can not parse propertyName from trackName: ' + trackName );\n\n\t\t}\n\n\t\treturn results;\n\n\t}\n\n\tstatic findNode( root, nodeName ) {\n\n\t\tif ( nodeName === undefined || nodeName === '' || nodeName === '.' || nodeName === - 1 || nodeName === root.name || nodeName === root.uuid ) {\n\n\t\t\treturn root;\n\n\t\t}\n\n\t\t// search into skeleton bones.\n\t\tif ( root.skeleton ) {\n\n\t\t\tconst bone = root.skeleton.getBoneByName( nodeName );\n\n\t\t\tif ( bone !== undefined ) {\n\n\t\t\t\treturn bone;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// search into node subtree.\n\t\tif ( root.children ) {\n\n\t\t\tconst searchNodeSubtree = function ( children ) {\n\n\t\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\n\n\t\t\t\t\tconst childNode = children[ i ];\n\n\t\t\t\t\tif ( childNode.name === nodeName || childNode.uuid === nodeName ) {\n\n\t\t\t\t\t\treturn childNode;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst result = searchNodeSubtree( childNode.children );\n\n\t\t\t\t\tif ( result ) return result;\n\n\t\t\t\t}\n\n\t\t\t\treturn null;\n\n\t\t\t};\n\n\t\t\tconst subTreeNode = searchNodeSubtree( root.children );\n\n\t\t\tif ( subTreeNode ) {\n\n\t\t\t\treturn subTreeNode;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t// these are used to \"bind\" a nonexistent property\n\t_getValue_unavailable() {}\n\t_setValue_unavailable() {}\n\n\t// Getters\n\n\t_getValue_direct( buffer, offset ) {\n\n\t\tbuffer[ offset ] = this.targetObject[ this.propertyName ];\n\n\t}\n\n\t_getValue_array( buffer, offset ) {\n\n\t\tconst source = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = source.length; i !== n; ++ i ) {\n\n\t\t\tbuffer[ offset ++ ] = source[ i ];\n\n\t\t}\n\n\t}\n\n\t_getValue_arrayElement( buffer, offset ) {\n\n\t\tbuffer[ offset ] = this.resolvedProperty[ this.propertyIndex ];\n\n\t}\n\n\t_getValue_toArray( buffer, offset ) {\n\n\t\tthis.resolvedProperty.toArray( buffer, offset );\n\n\t}\n\n\t// Direct\n\n\t_setValue_direct( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\n\t}\n\n\t_setValue_direct_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_direct_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// EntireArray\n\n\t_setValue_array( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t}\n\n\t_setValue_array_setNeedsUpdate( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_array_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// ArrayElement\n\n\t_setValue_arrayElement( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\n\t}\n\n\t_setValue_arrayElement_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_arrayElement_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// HasToFromArray\n\n\t_setValue_fromArray( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\n\t}\n\n\t_setValue_fromArray_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_fromArray_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t_getValue_unbound( targetArray, offset ) {\n\n\t\tthis.bind();\n\t\tthis.getValue( targetArray, offset );\n\n\t}\n\n\t_setValue_unbound( sourceArray, offset ) {\n\n\t\tthis.bind();\n\t\tthis.setValue( sourceArray, offset );\n\n\t}\n\n\t// create getter / setter pair for a property in the scene graph\n\tbind() {\n\n\t\tlet targetObject = this.node;\n\t\tconst parsedPath = this.parsedPath;\n\n\t\tconst objectName = parsedPath.objectName;\n\t\tconst propertyName = parsedPath.propertyName;\n\t\tlet propertyIndex = parsedPath.propertyIndex;\n\n\t\tif ( ! targetObject ) {\n\n\t\t\ttargetObject = PropertyBinding.findNode( this.rootNode, parsedPath.nodeName );\n\n\t\t\tthis.node = targetObject;\n\n\t\t}\n\n\t\t// set fail state so we can just 'return' on error\n\t\tthis.getValue = this._getValue_unavailable;\n\t\tthis.setValue = this._setValue_unavailable;\n\n\t\t// ensure there is a value node\n\t\tif ( ! targetObject ) {\n\n\t\t\tconsole.warn( 'THREE.PropertyBinding: No target node found for track: ' + this.path + '.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( objectName ) {\n\n\t\t\tlet objectIndex = parsedPath.objectIndex;\n\n\t\t\t// special cases were we need to reach deeper into the hierarchy to get the face materials....\n\t\t\tswitch ( objectName ) {\n\n\t\t\t\tcase 'materials':\n\n\t\t\t\t\tif ( ! targetObject.material ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material.materials ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject.material.materials;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'bones':\n\n\t\t\t\t\tif ( ! targetObject.skeleton ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// potential future optimization: skip this if propertyIndex is already an integer\n\t\t\t\t\t// and convert the integer string to a true integer.\n\n\t\t\t\t\ttargetObject = targetObject.skeleton.bones;\n\n\t\t\t\t\t// support resolving morphTarget names into indices.\n\t\t\t\t\tfor ( let i = 0; i < targetObject.length; i ++ ) {\n\n\t\t\t\t\t\tif ( targetObject[ i ].name === objectIndex ) {\n\n\t\t\t\t\t\t\tobjectIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'map':\n\n\t\t\t\t\tif ( 'map' in targetObject ) {\n\n\t\t\t\t\t\ttargetObject = targetObject.map;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material.map ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject.material.map;\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tif ( targetObject[ objectName ] === undefined ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to objectName of node undefined.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject[ objectName ];\n\n\t\t\t}\n\n\n\t\t\tif ( objectIndex !== undefined ) {\n\n\t\t\t\tif ( targetObject[ objectIndex ] === undefined ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.', this, targetObject );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\ttargetObject = targetObject[ objectIndex ];\n\n\t\t\t}\n\n\t\t}\n\n\t\t// resolve property\n\t\tconst nodeProperty = targetObject[ propertyName ];\n\n\t\tif ( nodeProperty === undefined ) {\n\n\t\t\tconst nodeName = parsedPath.nodeName;\n\n\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to update property for track: ' + nodeName +\n\t\t\t\t'.' + propertyName + ' but it wasn\\'t found.', targetObject );\n\t\t\treturn;\n\n\t\t}\n\n\t\t// determine versioning scheme\n\t\tlet versioning = this.Versioning.None;\n\n\t\tthis.targetObject = targetObject;\n\n\t\tif ( targetObject.needsUpdate !== undefined ) { // material\n\n\t\t\tversioning = this.Versioning.NeedsUpdate;\n\n\t\t} else if ( targetObject.matrixWorldNeedsUpdate !== undefined ) { // node transform\n\n\t\t\tversioning = this.Versioning.MatrixWorldNeedsUpdate;\n\n\t\t}\n\n\t\t// determine how the property gets bound\n\t\tlet bindingType = this.BindingType.Direct;\n\n\t\tif ( propertyIndex !== undefined ) {\n\n\t\t\t// access a sub element of the property array (only primitives are supported right now)\n\n\t\t\tif ( propertyName === 'morphTargetInfluences' ) {\n\n\t\t\t\t// potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.\n\n\t\t\t\t// support resolving morphTarget names into indices.\n\t\t\t\tif ( ! targetObject.geometry ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.', this );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tif ( ! targetObject.geometry.morphAttributes ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.', this );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tif ( targetObject.morphTargetDictionary[ propertyIndex ] !== undefined ) {\n\n\t\t\t\t\tpropertyIndex = targetObject.morphTargetDictionary[ propertyIndex ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tbindingType = this.BindingType.ArrayElement;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\t\t\tthis.propertyIndex = propertyIndex;\n\n\t\t} else if ( nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined ) {\n\n\t\t\t// must use copy for Object3D.Euler/Quaternion\n\n\t\t\tbindingType = this.BindingType.HasFromToArray;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\n\t\t} else if ( Array.isArray( nodeProperty ) ) {\n\n\t\t\tbindingType = this.BindingType.EntireArray;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\n\t\t} else {\n\n\t\t\tthis.propertyName = propertyName;\n\n\t\t}\n\n\t\t// select getter / setter\n\t\tthis.getValue = this.GetterByBindingType[ bindingType ];\n\t\tthis.setValue = this.SetterByBindingTypeAndVersioning[ bindingType ][ versioning ];\n\n\t}\n\n\tunbind() {\n\n\t\tthis.node = null;\n\n\t\t// back to the prototype version of getValue / setValue\n\t\t// note: avoiding to mutate the shape of 'this' via 'delete'\n\t\tthis.getValue = this._getValue_unbound;\n\t\tthis.setValue = this._setValue_unbound;\n\n\t}\n\n}\n\nPropertyBinding.Composite = Composite;\n\nPropertyBinding.prototype.BindingType = {\n\tDirect: 0,\n\tEntireArray: 1,\n\tArrayElement: 2,\n\tHasFromToArray: 3\n};\n\nPropertyBinding.prototype.Versioning = {\n\tNone: 0,\n\tNeedsUpdate: 1,\n\tMatrixWorldNeedsUpdate: 2\n};\n\nPropertyBinding.prototype.GetterByBindingType = [\n\n\tPropertyBinding.prototype._getValue_direct,\n\tPropertyBinding.prototype._getValue_array,\n\tPropertyBinding.prototype._getValue_arrayElement,\n\tPropertyBinding.prototype._getValue_toArray,\n\n];\n\nPropertyBinding.prototype.SetterByBindingTypeAndVersioning = [\n\n\t[\n\t\t// Direct\n\t\tPropertyBinding.prototype._setValue_direct,\n\t\tPropertyBinding.prototype._setValue_direct_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// EntireArray\n\n\t\tPropertyBinding.prototype._setValue_array,\n\t\tPropertyBinding.prototype._setValue_array_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// ArrayElement\n\t\tPropertyBinding.prototype._setValue_arrayElement,\n\t\tPropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// HasToFromArray\n\t\tPropertyBinding.prototype._setValue_fromArray,\n\t\tPropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate,\n\n\t]\n\n];\n\n/**\n *\n * A group of objects that receives a shared animation state.\n *\n * Usage:\n *\n * - Add objects you would otherwise pass as 'root' to the\n * constructor or the .clipAction method of AnimationMixer.\n *\n * - Instead pass this object as 'root'.\n *\n * - You can also add and remove objects later when the mixer\n * is running.\n *\n * Note:\n *\n * Objects of this class appear as one object to the mixer,\n * so cache control of the individual objects must be done\n * on the group.\n *\n * Limitation:\n *\n * - The animated properties must be compatible among the\n * all objects in the group.\n *\n * - A single property can either be controlled through a\n * target group or directly, but not both.\n */\n\nclass AnimationObjectGroup {\n\n\tconstructor() {\n\n\t\tthis.isAnimationObjectGroup = true;\n\n\t\tthis.uuid = generateUUID();\n\n\t\t// cached objects followed by the active ones\n\t\tthis._objects = Array.prototype.slice.call( arguments );\n\n\t\tthis.nCachedObjects_ = 0; // threshold\n\t\t// note: read by PropertyBinding.Composite\n\n\t\tconst indices = {};\n\t\tthis._indicesByUUID = indices; // for bookkeeping\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tindices[ arguments[ i ].uuid ] = i;\n\n\t\t}\n\n\t\tthis._paths = []; // inside: string\n\t\tthis._parsedPaths = []; // inside: { we don't care, here }\n\t\tthis._bindings = []; // inside: Array< PropertyBinding >\n\t\tthis._bindingsIndicesByPath = {}; // inside: indices in these arrays\n\n\t\tconst scope = this;\n\n\t\tthis.stats = {\n\n\t\t\tobjects: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._objects.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn this.total - scope.nCachedObjects_;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tget bindingsPerObject() {\n\n\t\t\t\treturn scope._bindings.length;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tadd() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tpaths = this._paths,\n\t\t\tparsedPaths = this._parsedPaths,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet knownObject = undefined,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid;\n\t\t\tlet index = indicesByUUID[ uuid ];\n\n\t\t\tif ( index === undefined ) {\n\n\t\t\t\t// unknown object -> add it to the ACTIVE region\n\n\t\t\t\tindex = nObjects ++;\n\t\t\t\tindicesByUUID[ uuid ] = index;\n\t\t\t\tobjects.push( object );\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tbindings[ j ].push( new PropertyBinding( object, paths[ j ], parsedPaths[ j ] ) );\n\n\t\t\t\t}\n\n\t\t\t} else if ( index < nCachedObjects ) {\n\n\t\t\t\tknownObject = objects[ index ];\n\n\t\t\t\t// move existing object to the ACTIVE region\n\n\t\t\t\tconst firstActiveIndex = -- nCachedObjects,\n\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ];\n\n\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\n\t\t\t\tobjects[ index ] = lastCachedObject;\n\n\t\t\t\tindicesByUUID[ uuid ] = firstActiveIndex;\n\t\t\t\tobjects[ firstActiveIndex ] = object;\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ];\n\n\t\t\t\t\tlet binding = bindingsForPath[ index ];\n\n\t\t\t\t\tbindingsForPath[ index ] = lastCached;\n\n\t\t\t\t\tif ( binding === undefined ) {\n\n\t\t\t\t\t\t// since we do not bother to create new bindings\n\t\t\t\t\t\t// for objects that are cached, the binding may\n\t\t\t\t\t\t// or may not exist\n\n\t\t\t\t\t\tbinding = new PropertyBinding( object, paths[ j ], parsedPaths[ j ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = binding;\n\n\t\t\t\t}\n\n\t\t\t} else if ( objects[ index ] !== knownObject ) {\n\n\t\t\t\tconsole.error( 'THREE.AnimationObjectGroup: Different objects with the same UUID ' +\n\t\t\t\t\t'detected. Clean the caches or recreate your infrastructure when reloading scenes.' );\n\n\t\t\t} // else the object is already where we want it to be\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\tremove() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet nCachedObjects = this.nCachedObjects_;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid,\n\t\t\t\tindex = indicesByUUID[ uuid ];\n\n\t\t\tif ( index !== undefined && index >= nCachedObjects ) {\n\n\t\t\t\t// move existing object into the CACHED region\n\n\t\t\t\tconst lastCachedIndex = nCachedObjects ++,\n\t\t\t\t\tfirstActiveObject = objects[ lastCachedIndex ];\n\n\t\t\t\tindicesByUUID[ firstActiveObject.uuid ] = index;\n\t\t\t\tobjects[ index ] = firstActiveObject;\n\n\t\t\t\tindicesByUUID[ uuid ] = lastCachedIndex;\n\t\t\t\tobjects[ lastCachedIndex ] = object;\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\tfirstActive = bindingsForPath[ lastCachedIndex ],\n\t\t\t\t\t\tbinding = bindingsForPath[ index ];\n\n\t\t\t\t\tbindingsForPath[ index ] = firstActive;\n\t\t\t\t\tbindingsForPath[ lastCachedIndex ] = binding;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\t// remove & forget\n\tuncache() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet nCachedObjects = this.nCachedObjects_,\n\t\t\tnObjects = objects.length;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid,\n\t\t\t\tindex = indicesByUUID[ uuid ];\n\n\t\t\tif ( index !== undefined ) {\n\n\t\t\t\tdelete indicesByUUID[ uuid ];\n\n\t\t\t\tif ( index < nCachedObjects ) {\n\n\t\t\t\t\t// object is cached, shrink the CACHED region\n\n\t\t\t\t\tconst firstActiveIndex = -- nCachedObjects,\n\t\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ],\n\t\t\t\t\t\tlastIndex = -- nObjects,\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\n\n\t\t\t\t\t// last cached object takes this object's place\n\t\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\n\t\t\t\t\tobjects[ index ] = lastCachedObject;\n\n\t\t\t\t\t// last object goes to the activated slot and pop\n\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = firstActiveIndex;\n\t\t\t\t\tobjects[ firstActiveIndex ] = lastObject;\n\t\t\t\t\tobjects.pop();\n\n\t\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ],\n\t\t\t\t\t\t\tlast = bindingsForPath[ lastIndex ];\n\n\t\t\t\t\t\tbindingsForPath[ index ] = lastCached;\n\t\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = last;\n\t\t\t\t\t\tbindingsForPath.pop();\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// object is active, just swap with the last and pop\n\n\t\t\t\t\tconst lastIndex = -- nObjects,\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\n\n\t\t\t\t\tif ( lastIndex > 0 ) {\n\n\t\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = index;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tobjects[ index ] = lastObject;\n\t\t\t\t\tobjects.pop();\n\n\t\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\t\tconst bindingsForPath = bindings[ j ];\n\n\t\t\t\t\t\tbindingsForPath[ index ] = bindingsForPath[ lastIndex ];\n\t\t\t\t\t\tbindingsForPath.pop();\n\n\t\t\t\t\t}\n\n\t\t\t\t} // cached or active\n\n\t\t\t} // if object is known\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\t// Internal interface used by befriended PropertyBinding.Composite:\n\n\tsubscribe_( path, parsedPath ) {\n\n\t\t// returns an array of bindings for the given path that is changed\n\t\t// according to the contained objects in the group\n\n\t\tconst indicesByPath = this._bindingsIndicesByPath;\n\t\tlet index = indicesByPath[ path ];\n\t\tconst bindings = this._bindings;\n\n\t\tif ( index !== undefined ) return bindings[ index ];\n\n\t\tconst paths = this._paths,\n\t\t\tparsedPaths = this._parsedPaths,\n\t\t\tobjects = this._objects,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_,\n\t\t\tbindingsForPath = new Array( nObjects );\n\n\t\tindex = bindings.length;\n\n\t\tindicesByPath[ path ] = index;\n\n\t\tpaths.push( path );\n\t\tparsedPaths.push( parsedPath );\n\t\tbindings.push( bindingsForPath );\n\n\t\tfor ( let i = nCachedObjects, n = objects.length; i !== n; ++ i ) {\n\n\t\t\tconst object = objects[ i ];\n\t\t\tbindingsForPath[ i ] = new PropertyBinding( object, path, parsedPath );\n\n\t\t}\n\n\t\treturn bindingsForPath;\n\n\t}\n\n\tunsubscribe_( path ) {\n\n\t\t// tells the group to forget about a property path and no longer\n\t\t// update the array previously obtained with 'subscribe_'\n\n\t\tconst indicesByPath = this._bindingsIndicesByPath,\n\t\t\tindex = indicesByPath[ path ];\n\n\t\tif ( index !== undefined ) {\n\n\t\t\tconst paths = this._paths,\n\t\t\t\tparsedPaths = this._parsedPaths,\n\t\t\t\tbindings = this._bindings,\n\t\t\t\tlastBindingsIndex = bindings.length - 1,\n\t\t\t\tlastBindings = bindings[ lastBindingsIndex ],\n\t\t\t\tlastBindingsPath = path[ lastBindingsIndex ];\n\n\t\t\tindicesByPath[ lastBindingsPath ] = index;\n\n\t\t\tbindings[ index ] = lastBindings;\n\t\t\tbindings.pop();\n\n\t\t\tparsedPaths[ index ] = parsedPaths[ lastBindingsIndex ];\n\t\t\tparsedPaths.pop();\n\n\t\t\tpaths[ index ] = paths[ lastBindingsIndex ];\n\t\t\tpaths.pop();\n\n\t\t}\n\n\t}\n\n}\n\nclass AnimationAction {\n\n\tconstructor( mixer, clip, localRoot = null, blendMode = clip.blendMode ) {\n\n\t\tthis._mixer = mixer;\n\t\tthis._clip = clip;\n\t\tthis._localRoot = localRoot;\n\t\tthis.blendMode = blendMode;\n\n\t\tconst tracks = clip.tracks,\n\t\t\tnTracks = tracks.length,\n\t\t\tinterpolants = new Array( nTracks );\n\n\t\tconst interpolantSettings = {\n\t\t\tendingStart: ZeroCurvatureEnding,\n\t\t\tendingEnd: ZeroCurvatureEnding\n\t\t};\n\n\t\tfor ( let i = 0; i !== nTracks; ++ i ) {\n\n\t\t\tconst interpolant = tracks[ i ].createInterpolant( null );\n\t\t\tinterpolants[ i ] = interpolant;\n\t\t\tinterpolant.settings = interpolantSettings;\n\n\t\t}\n\n\t\tthis._interpolantSettings = interpolantSettings;\n\n\t\tthis._interpolants = interpolants; // bound by the mixer\n\n\t\t// inside: PropertyMixer (managed by the mixer)\n\t\tthis._propertyBindings = new Array( nTracks );\n\n\t\tthis._cacheIndex = null; // for the memory manager\n\t\tthis._byClipCacheIndex = null; // for the memory manager\n\n\t\tthis._timeScaleInterpolant = null;\n\t\tthis._weightInterpolant = null;\n\n\t\tthis.loop = LoopRepeat;\n\t\tthis._loopCount = - 1;\n\n\t\t// global mixer time when the action is to be started\n\t\t// it's set back to 'null' upon start of the action\n\t\tthis._startTime = null;\n\n\t\t// scaled local time of the action\n\t\t// gets clamped or wrapped to 0..clip.duration according to loop\n\t\tthis.time = 0;\n\n\t\tthis.timeScale = 1;\n\t\tthis._effectiveTimeScale = 1;\n\n\t\tthis.weight = 1;\n\t\tthis._effectiveWeight = 1;\n\n\t\tthis.repetitions = Infinity; // no. of repetitions when looping\n\n\t\tthis.paused = false; // true -> zero effective time scale\n\t\tthis.enabled = true; // false -> zero effective weight\n\n\t\tthis.clampWhenFinished = false;// keep feeding the last frame?\n\n\t\tthis.zeroSlopeAtStart = true;// for smooth interpolation w/o separate\n\t\tthis.zeroSlopeAtEnd = true;// clips for start, loop and end\n\n\t}\n\n\t// State & Scheduling\n\n\tplay() {\n\n\t\tthis._mixer._activateAction( this );\n\n\t\treturn this;\n\n\t}\n\n\tstop() {\n\n\t\tthis._mixer._deactivateAction( this );\n\n\t\treturn this.reset();\n\n\t}\n\n\treset() {\n\n\t\tthis.paused = false;\n\t\tthis.enabled = true;\n\n\t\tthis.time = 0; // restart clip\n\t\tthis._loopCount = - 1;// forget previous loops\n\t\tthis._startTime = null;// forget scheduling\n\n\t\treturn this.stopFading().stopWarping();\n\n\t}\n\n\tisRunning() {\n\n\t\treturn this.enabled && ! this.paused && this.timeScale !== 0 &&\n\t\t\tthis._startTime === null && this._mixer._isActiveAction( this );\n\n\t}\n\n\t// return true when play has been called\n\tisScheduled() {\n\n\t\treturn this._mixer._isActiveAction( this );\n\n\t}\n\n\tstartAt( time ) {\n\n\t\tthis._startTime = time;\n\n\t\treturn this;\n\n\t}\n\n\tsetLoop( mode, repetitions ) {\n\n\t\tthis.loop = mode;\n\t\tthis.repetitions = repetitions;\n\n\t\treturn this;\n\n\t}\n\n\t// Weight\n\n\t// set the weight stopping any scheduled fading\n\t// although .enabled = false yields an effective weight of zero, this\n\t// method does *not* change .enabled, because it would be confusing\n\tsetEffectiveWeight( weight ) {\n\n\t\tthis.weight = weight;\n\n\t\t// note: same logic as when updated at runtime\n\t\tthis._effectiveWeight = this.enabled ? weight : 0;\n\n\t\treturn this.stopFading();\n\n\t}\n\n\t// return the weight considering fading and .enabled\n\tgetEffectiveWeight() {\n\n\t\treturn this._effectiveWeight;\n\n\t}\n\n\tfadeIn( duration ) {\n\n\t\treturn this._scheduleFading( duration, 0, 1 );\n\n\t}\n\n\tfadeOut( duration ) {\n\n\t\treturn this._scheduleFading( duration, 1, 0 );\n\n\t}\n\n\tcrossFadeFrom( fadeOutAction, duration, warp ) {\n\n\t\tfadeOutAction.fadeOut( duration );\n\t\tthis.fadeIn( duration );\n\n\t\tif ( warp ) {\n\n\t\t\tconst fadeInDuration = this._clip.duration,\n\t\t\t\tfadeOutDuration = fadeOutAction._clip.duration,\n\n\t\t\t\tstartEndRatio = fadeOutDuration / fadeInDuration,\n\t\t\t\tendStartRatio = fadeInDuration / fadeOutDuration;\n\n\t\t\tfadeOutAction.warp( 1.0, startEndRatio, duration );\n\t\t\tthis.warp( endStartRatio, 1.0, duration );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcrossFadeTo( fadeInAction, duration, warp ) {\n\n\t\treturn fadeInAction.crossFadeFrom( this, duration, warp );\n\n\t}\n\n\tstopFading() {\n\n\t\tconst weightInterpolant = this._weightInterpolant;\n\n\t\tif ( weightInterpolant !== null ) {\n\n\t\t\tthis._weightInterpolant = null;\n\t\t\tthis._mixer._takeBackControlInterpolant( weightInterpolant );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Time Scale Control\n\n\t// set the time scale stopping any scheduled warping\n\t// although .paused = true yields an effective time scale of zero, this\n\t// method does *not* change .paused, because it would be confusing\n\tsetEffectiveTimeScale( timeScale ) {\n\n\t\tthis.timeScale = timeScale;\n\t\tthis._effectiveTimeScale = this.paused ? 0 : timeScale;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\t// return the time scale considering warping and .paused\n\tgetEffectiveTimeScale() {\n\n\t\treturn this._effectiveTimeScale;\n\n\t}\n\n\tsetDuration( duration ) {\n\n\t\tthis.timeScale = this._clip.duration / duration;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\tsyncWith( action ) {\n\n\t\tthis.time = action.time;\n\t\tthis.timeScale = action.timeScale;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\thalt( duration ) {\n\n\t\treturn this.warp( this._effectiveTimeScale, 0, duration );\n\n\t}\n\n\twarp( startTimeScale, endTimeScale, duration ) {\n\n\t\tconst mixer = this._mixer,\n\t\t\tnow = mixer.time,\n\t\t\ttimeScale = this.timeScale;\n\n\t\tlet interpolant = this._timeScaleInterpolant;\n\n\t\tif ( interpolant === null ) {\n\n\t\t\tinterpolant = mixer._lendControlInterpolant();\n\t\t\tthis._timeScaleInterpolant = interpolant;\n\n\t\t}\n\n\t\tconst times = interpolant.parameterPositions,\n\t\t\tvalues = interpolant.sampleValues;\n\n\t\ttimes[ 0 ] = now;\n\t\ttimes[ 1 ] = now + duration;\n\n\t\tvalues[ 0 ] = startTimeScale / timeScale;\n\t\tvalues[ 1 ] = endTimeScale / timeScale;\n\n\t\treturn this;\n\n\t}\n\n\tstopWarping() {\n\n\t\tconst timeScaleInterpolant = this._timeScaleInterpolant;\n\n\t\tif ( timeScaleInterpolant !== null ) {\n\n\t\t\tthis._timeScaleInterpolant = null;\n\t\t\tthis._mixer._takeBackControlInterpolant( timeScaleInterpolant );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Object Accessors\n\n\tgetMixer() {\n\n\t\treturn this._mixer;\n\n\t}\n\n\tgetClip() {\n\n\t\treturn this._clip;\n\n\t}\n\n\tgetRoot() {\n\n\t\treturn this._localRoot || this._mixer._root;\n\n\t}\n\n\t// Interna\n\n\t_update( time, deltaTime, timeDirection, accuIndex ) {\n\n\t\t// called by the mixer\n\n\t\tif ( ! this.enabled ) {\n\n\t\t\t// call ._updateWeight() to update ._effectiveWeight\n\n\t\t\tthis._updateWeight( time );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst startTime = this._startTime;\n\n\t\tif ( startTime !== null ) {\n\n\t\t\t// check for scheduled start of action\n\n\t\t\tconst timeRunning = ( time - startTime ) * timeDirection;\n\t\t\tif ( timeRunning < 0 || timeDirection === 0 ) {\n\n\t\t\t\tdeltaTime = 0;\n\n\t\t\t} else {\n\n\n\t\t\t\tthis._startTime = null; // unschedule\n\t\t\t\tdeltaTime = timeDirection * timeRunning;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// apply time scale and advance time\n\n\t\tdeltaTime *= this._updateTimeScale( time );\n\t\tconst clipTime = this._updateTime( deltaTime );\n\n\t\t// note: _updateTime may disable the action resulting in\n\t\t// an effective weight of 0\n\n\t\tconst weight = this._updateWeight( time );\n\n\t\tif ( weight > 0 ) {\n\n\t\t\tconst interpolants = this._interpolants;\n\t\t\tconst propertyMixers = this._propertyBindings;\n\n\t\t\tswitch ( this.blendMode ) {\n\n\t\t\t\tcase AdditiveAnimationBlendMode:\n\n\t\t\t\t\tfor ( let j = 0, m = interpolants.length; j !== m; ++ j ) {\n\n\t\t\t\t\t\tinterpolants[ j ].evaluate( clipTime );\n\t\t\t\t\t\tpropertyMixers[ j ].accumulateAdditive( weight );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase NormalAnimationBlendMode:\n\t\t\t\tdefault:\n\n\t\t\t\t\tfor ( let j = 0, m = interpolants.length; j !== m; ++ j ) {\n\n\t\t\t\t\t\tinterpolants[ j ].evaluate( clipTime );\n\t\t\t\t\t\tpropertyMixers[ j ].accumulate( accuIndex, weight );\n\n\t\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_updateWeight( time ) {\n\n\t\tlet weight = 0;\n\n\t\tif ( this.enabled ) {\n\n\t\t\tweight = this.weight;\n\t\t\tconst interpolant = this._weightInterpolant;\n\n\t\t\tif ( interpolant !== null ) {\n\n\t\t\t\tconst interpolantValue = interpolant.evaluate( time )[ 0 ];\n\n\t\t\t\tweight *= interpolantValue;\n\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\n\n\t\t\t\t\tthis.stopFading();\n\n\t\t\t\t\tif ( interpolantValue === 0 ) {\n\n\t\t\t\t\t\t// faded out, disable\n\t\t\t\t\t\tthis.enabled = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._effectiveWeight = weight;\n\t\treturn weight;\n\n\t}\n\n\t_updateTimeScale( time ) {\n\n\t\tlet timeScale = 0;\n\n\t\tif ( ! this.paused ) {\n\n\t\t\ttimeScale = this.timeScale;\n\n\t\t\tconst interpolant = this._timeScaleInterpolant;\n\n\t\t\tif ( interpolant !== null ) {\n\n\t\t\t\tconst interpolantValue = interpolant.evaluate( time )[ 0 ];\n\n\t\t\t\ttimeScale *= interpolantValue;\n\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\n\n\t\t\t\t\tthis.stopWarping();\n\n\t\t\t\t\tif ( timeScale === 0 ) {\n\n\t\t\t\t\t\t// motion has halted, pause\n\t\t\t\t\t\tthis.paused = true;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// warp done - apply final time scale\n\t\t\t\t\t\tthis.timeScale = timeScale;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._effectiveTimeScale = timeScale;\n\t\treturn timeScale;\n\n\t}\n\n\t_updateTime( deltaTime ) {\n\n\t\tconst duration = this._clip.duration;\n\t\tconst loop = this.loop;\n\n\t\tlet time = this.time + deltaTime;\n\t\tlet loopCount = this._loopCount;\n\n\t\tconst pingPong = ( loop === LoopPingPong );\n\n\t\tif ( deltaTime === 0 ) {\n\n\t\t\tif ( loopCount === - 1 ) return time;\n\n\t\t\treturn ( pingPong && ( loopCount & 1 ) === 1 ) ? duration - time : time;\n\n\t\t}\n\n\t\tif ( loop === LoopOnce ) {\n\n\t\t\tif ( loopCount === - 1 ) {\n\n\t\t\t\t// just started\n\n\t\t\t\tthis._loopCount = 0;\n\t\t\t\tthis._setEndings( true, true, false );\n\n\t\t\t}\n\n\t\t\thandle_stop: {\n\n\t\t\t\tif ( time >= duration ) {\n\n\t\t\t\t\ttime = duration;\n\n\t\t\t\t} else if ( time < 0 ) {\n\n\t\t\t\t\ttime = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tbreak handle_stop;\n\n\t\t\t\t}\n\n\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\n\t\t\t\telse this.enabled = false;\n\n\t\t\t\tthis.time = time;\n\n\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\ttype: 'finished', action: this,\n\t\t\t\t\tdirection: deltaTime < 0 ? - 1 : 1\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t} else { // repetitive Repeat or PingPong\n\n\t\t\tif ( loopCount === - 1 ) {\n\n\t\t\t\t// just started\n\n\t\t\t\tif ( deltaTime >= 0 ) {\n\n\t\t\t\t\tloopCount = 0;\n\n\t\t\t\t\tthis._setEndings( true, this.repetitions === 0, pingPong );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// when looping in reverse direction, the initial\n\t\t\t\t\t// transition through zero counts as a repetition,\n\t\t\t\t\t// so leave loopCount at -1\n\n\t\t\t\t\tthis._setEndings( this.repetitions === 0, true, pingPong );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( time >= duration || time < 0 ) {\n\n\t\t\t\t// wrap around\n\n\t\t\t\tconst loopDelta = Math.floor( time / duration ); // signed\n\t\t\t\ttime -= duration * loopDelta;\n\n\t\t\t\tloopCount += Math.abs( loopDelta );\n\n\t\t\t\tconst pending = this.repetitions - loopCount;\n\n\t\t\t\tif ( pending <= 0 ) {\n\n\t\t\t\t\t// have to stop (switch state, clamp time, fire event)\n\n\t\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\n\t\t\t\t\telse this.enabled = false;\n\n\t\t\t\t\ttime = deltaTime > 0 ? duration : 0;\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\t\ttype: 'finished', action: this,\n\t\t\t\t\t\tdirection: deltaTime > 0 ? 1 : - 1\n\t\t\t\t\t} );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// keep running\n\n\t\t\t\t\tif ( pending === 1 ) {\n\n\t\t\t\t\t\t// entering the last round\n\n\t\t\t\t\t\tconst atStart = deltaTime < 0;\n\t\t\t\t\t\tthis._setEndings( atStart, ! atStart, pingPong );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis._setEndings( false, false, pingPong );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._loopCount = loopCount;\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\t\ttype: 'loop', action: this, loopDelta: loopDelta\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tthis.time = time;\n\n\t\t\t}\n\n\t\t\tif ( pingPong && ( loopCount & 1 ) === 1 ) {\n\n\t\t\t\t// invert time for the \"pong round\"\n\n\t\t\t\treturn duration - time;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn time;\n\n\t}\n\n\t_setEndings( atStart, atEnd, pingPong ) {\n\n\t\tconst settings = this._interpolantSettings;\n\n\t\tif ( pingPong ) {\n\n\t\t\tsettings.endingStart = ZeroSlopeEnding;\n\t\t\tsettings.endingEnd = ZeroSlopeEnding;\n\n\t\t} else {\n\n\t\t\t// assuming for LoopOnce atStart == atEnd == true\n\n\t\t\tif ( atStart ) {\n\n\t\t\t\tsettings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding;\n\n\t\t\t} else {\n\n\t\t\t\tsettings.endingStart = WrapAroundEnding;\n\n\t\t\t}\n\n\t\t\tif ( atEnd ) {\n\n\t\t\t\tsettings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding;\n\n\t\t\t} else {\n\n\t\t\t\tsettings.endingEnd \t = WrapAroundEnding;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_scheduleFading( duration, weightNow, weightThen ) {\n\n\t\tconst mixer = this._mixer, now = mixer.time;\n\t\tlet interpolant = this._weightInterpolant;\n\n\t\tif ( interpolant === null ) {\n\n\t\t\tinterpolant = mixer._lendControlInterpolant();\n\t\t\tthis._weightInterpolant = interpolant;\n\n\t\t}\n\n\t\tconst times = interpolant.parameterPositions,\n\t\t\tvalues = interpolant.sampleValues;\n\n\t\ttimes[ 0 ] = now;\n\t\tvalues[ 0 ] = weightNow;\n\t\ttimes[ 1 ] = now + duration;\n\t\tvalues[ 1 ] = weightThen;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _controlInterpolantsResultBuffer = new Float32Array( 1 );\n\n\nclass AnimationMixer extends EventDispatcher {\n\n\tconstructor( root ) {\n\n\t\tsuper();\n\n\t\tthis._root = root;\n\t\tthis._initMemoryManager();\n\t\tthis._accuIndex = 0;\n\t\tthis.time = 0;\n\t\tthis.timeScale = 1.0;\n\n\t}\n\n\t_bindAction( action, prototypeAction ) {\n\n\t\tconst root = action._localRoot || this._root,\n\t\t\ttracks = action._clip.tracks,\n\t\t\tnTracks = tracks.length,\n\t\t\tbindings = action._propertyBindings,\n\t\t\tinterpolants = action._interpolants,\n\t\t\trootUuid = root.uuid,\n\t\t\tbindingsByRoot = this._bindingsByRootAndName;\n\n\t\tlet bindingsByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingsByName === undefined ) {\n\n\t\t\tbindingsByName = {};\n\t\t\tbindingsByRoot[ rootUuid ] = bindingsByName;\n\n\t\t}\n\n\t\tfor ( let i = 0; i !== nTracks; ++ i ) {\n\n\t\t\tconst track = tracks[ i ],\n\t\t\t\ttrackName = track.name;\n\n\t\t\tlet binding = bindingsByName[ trackName ];\n\n\t\t\tif ( binding !== undefined ) {\n\n\t\t\t\t++ binding.referenceCount;\n\t\t\t\tbindings[ i ] = binding;\n\n\t\t\t} else {\n\n\t\t\t\tbinding = bindings[ i ];\n\n\t\t\t\tif ( binding !== undefined ) {\n\n\t\t\t\t\t// existing binding, make sure the cache knows\n\n\t\t\t\t\tif ( binding._cacheIndex === null ) {\n\n\t\t\t\t\t\t++ binding.referenceCount;\n\t\t\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\tconst path = prototypeAction && prototypeAction.\n\t\t\t\t\t_propertyBindings[ i ].binding.parsedPath;\n\n\t\t\t\tbinding = new PropertyMixer(\n\t\t\t\t\tPropertyBinding.create( root, trackName, path ),\n\t\t\t\t\ttrack.ValueTypeName, track.getValueSize() );\n\n\t\t\t\t++ binding.referenceCount;\n\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\n\n\t\t\t\tbindings[ i ] = binding;\n\n\t\t\t}\n\n\t\t\tinterpolants[ i ].resultBuffer = binding.buffer;\n\n\t\t}\n\n\t}\n\n\t_activateAction( action ) {\n\n\t\tif ( ! this._isActiveAction( action ) ) {\n\n\t\t\tif ( action._cacheIndex === null ) {\n\n\t\t\t\t// this action has been forgotten by the cache, but the user\n\t\t\t\t// appears to be still using it -> rebind\n\n\t\t\t\tconst rootUuid = ( action._localRoot || this._root ).uuid,\n\t\t\t\t\tclipUuid = action._clip.uuid,\n\t\t\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\n\n\t\t\t\tthis._bindAction( action,\n\t\t\t\t\tactionsForClip && actionsForClip.knownActions[ 0 ] );\n\n\t\t\t\tthis._addInactiveAction( action, clipUuid, rootUuid );\n\n\t\t\t}\n\n\t\t\tconst bindings = action._propertyBindings;\n\n\t\t\t// increment reference counts / sort out state\n\t\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\t\tconst binding = bindings[ i ];\n\n\t\t\t\tif ( binding.useCount ++ === 0 ) {\n\n\t\t\t\t\tthis._lendBinding( binding );\n\t\t\t\t\tbinding.saveOriginalState();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._lendAction( action );\n\n\t\t}\n\n\t}\n\n\t_deactivateAction( action ) {\n\n\t\tif ( this._isActiveAction( action ) ) {\n\n\t\t\tconst bindings = action._propertyBindings;\n\n\t\t\t// decrement reference counts / sort out state\n\t\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\t\tconst binding = bindings[ i ];\n\n\t\t\t\tif ( -- binding.useCount === 0 ) {\n\n\t\t\t\t\tbinding.restoreOriginalState();\n\t\t\t\t\tthis._takeBackBinding( binding );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._takeBackAction( action );\n\n\t\t}\n\n\t}\n\n\t// Memory manager\n\n\t_initMemoryManager() {\n\n\t\tthis._actions = []; // 'nActiveActions' followed by inactive ones\n\t\tthis._nActiveActions = 0;\n\n\t\tthis._actionsByClip = {};\n\t\t// inside:\n\t\t// {\n\t\t// \tknownActions: Array< AnimationAction > - used as prototypes\n\t\t// \tactionByRoot: AnimationAction - lookup\n\t\t// }\n\n\n\t\tthis._bindings = []; // 'nActiveBindings' followed by inactive ones\n\t\tthis._nActiveBindings = 0;\n\n\t\tthis._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer >\n\n\n\t\tthis._controlInterpolants = []; // same game as above\n\t\tthis._nActiveControlInterpolants = 0;\n\n\t\tconst scope = this;\n\n\t\tthis.stats = {\n\n\t\t\tactions: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._actions.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveActions;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tbindings: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._bindings.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveBindings;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tcontrolInterpolants: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._controlInterpolants.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveControlInterpolants;\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\t// Memory management for AnimationAction objects\n\n\t_isActiveAction( action ) {\n\n\t\tconst index = action._cacheIndex;\n\t\treturn index !== null && index < this._nActiveActions;\n\n\t}\n\n\t_addInactiveAction( action, clipUuid, rootUuid ) {\n\n\t\tconst actions = this._actions,\n\t\t\tactionsByClip = this._actionsByClip;\n\n\t\tlet actionsForClip = actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip === undefined ) {\n\n\t\t\tactionsForClip = {\n\n\t\t\t\tknownActions: [ action ],\n\t\t\t\tactionByRoot: {}\n\n\t\t\t};\n\n\t\t\taction._byClipCacheIndex = 0;\n\n\t\t\tactionsByClip[ clipUuid ] = actionsForClip;\n\n\t\t} else {\n\n\t\t\tconst knownActions = actionsForClip.knownActions;\n\n\t\t\taction._byClipCacheIndex = knownActions.length;\n\t\t\tknownActions.push( action );\n\n\t\t}\n\n\t\taction._cacheIndex = actions.length;\n\t\tactions.push( action );\n\n\t\tactionsForClip.actionByRoot[ rootUuid ] = action;\n\n\t}\n\n\t_removeInactiveAction( action ) {\n\n\t\tconst actions = this._actions,\n\t\t\tlastInactiveAction = actions[ actions.length - 1 ],\n\t\t\tcacheIndex = action._cacheIndex;\n\n\t\tlastInactiveAction._cacheIndex = cacheIndex;\n\t\tactions[ cacheIndex ] = lastInactiveAction;\n\t\tactions.pop();\n\n\t\taction._cacheIndex = null;\n\n\n\t\tconst clipUuid = action._clip.uuid,\n\t\t\tactionsByClip = this._actionsByClip,\n\t\t\tactionsForClip = actionsByClip[ clipUuid ],\n\t\t\tknownActionsForClip = actionsForClip.knownActions,\n\n\t\t\tlastKnownAction =\n\t\t\t\tknownActionsForClip[ knownActionsForClip.length - 1 ],\n\n\t\t\tbyClipCacheIndex = action._byClipCacheIndex;\n\n\t\tlastKnownAction._byClipCacheIndex = byClipCacheIndex;\n\t\tknownActionsForClip[ byClipCacheIndex ] = lastKnownAction;\n\t\tknownActionsForClip.pop();\n\n\t\taction._byClipCacheIndex = null;\n\n\n\t\tconst actionByRoot = actionsForClip.actionByRoot,\n\t\t\trootUuid = ( action._localRoot || this._root ).uuid;\n\n\t\tdelete actionByRoot[ rootUuid ];\n\n\t\tif ( knownActionsForClip.length === 0 ) {\n\n\t\t\tdelete actionsByClip[ clipUuid ];\n\n\t\t}\n\n\t\tthis._removeInactiveBindingsForAction( action );\n\n\t}\n\n\t_removeInactiveBindingsForAction( action ) {\n\n\t\tconst bindings = action._propertyBindings;\n\n\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tconst binding = bindings[ i ];\n\n\t\t\tif ( -- binding.referenceCount === 0 ) {\n\n\t\t\t\tthis._removeInactiveBinding( binding );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_lendAction( action ) {\n\n\t\t// [ active actions | inactive actions ]\n\t\t// [ active actions >| inactive actions ]\n\t\t// s a\n\t\t// <-swap->\n\t\t// a s\n\n\t\tconst actions = this._actions,\n\t\t\tprevIndex = action._cacheIndex,\n\n\t\t\tlastActiveIndex = this._nActiveActions ++,\n\n\t\t\tfirstInactiveAction = actions[ lastActiveIndex ];\n\n\t\taction._cacheIndex = lastActiveIndex;\n\t\tactions[ lastActiveIndex ] = action;\n\n\t\tfirstInactiveAction._cacheIndex = prevIndex;\n\t\tactions[ prevIndex ] = firstInactiveAction;\n\n\t}\n\n\t_takeBackAction( action ) {\n\n\t\t// [ active actions | inactive actions ]\n\t\t// [ active actions |< inactive actions ]\n\t\t// a s\n\t\t// <-swap->\n\t\t// s a\n\n\t\tconst actions = this._actions,\n\t\t\tprevIndex = action._cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveActions,\n\n\t\t\tlastActiveAction = actions[ firstInactiveIndex ];\n\n\t\taction._cacheIndex = firstInactiveIndex;\n\t\tactions[ firstInactiveIndex ] = action;\n\n\t\tlastActiveAction._cacheIndex = prevIndex;\n\t\tactions[ prevIndex ] = lastActiveAction;\n\n\t}\n\n\t// Memory management for PropertyMixer objects\n\n\t_addInactiveBinding( binding, rootUuid, trackName ) {\n\n\t\tconst bindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindings = this._bindings;\n\n\t\tlet bindingByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingByName === undefined ) {\n\n\t\t\tbindingByName = {};\n\t\t\tbindingsByRoot[ rootUuid ] = bindingByName;\n\n\t\t}\n\n\t\tbindingByName[ trackName ] = binding;\n\n\t\tbinding._cacheIndex = bindings.length;\n\t\tbindings.push( binding );\n\n\t}\n\n\t_removeInactiveBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tpropBinding = binding.binding,\n\t\t\trootUuid = propBinding.rootNode.uuid,\n\t\t\ttrackName = propBinding.path,\n\t\t\tbindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ],\n\n\t\t\tlastInactiveBinding = bindings[ bindings.length - 1 ],\n\t\t\tcacheIndex = binding._cacheIndex;\n\n\t\tlastInactiveBinding._cacheIndex = cacheIndex;\n\t\tbindings[ cacheIndex ] = lastInactiveBinding;\n\t\tbindings.pop();\n\n\t\tdelete bindingByName[ trackName ];\n\n\t\tif ( Object.keys( bindingByName ).length === 0 ) {\n\n\t\t\tdelete bindingsByRoot[ rootUuid ];\n\n\t\t}\n\n\t}\n\n\t_lendBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tprevIndex = binding._cacheIndex,\n\n\t\t\tlastActiveIndex = this._nActiveBindings ++,\n\n\t\t\tfirstInactiveBinding = bindings[ lastActiveIndex ];\n\n\t\tbinding._cacheIndex = lastActiveIndex;\n\t\tbindings[ lastActiveIndex ] = binding;\n\n\t\tfirstInactiveBinding._cacheIndex = prevIndex;\n\t\tbindings[ prevIndex ] = firstInactiveBinding;\n\n\t}\n\n\t_takeBackBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tprevIndex = binding._cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveBindings,\n\n\t\t\tlastActiveBinding = bindings[ firstInactiveIndex ];\n\n\t\tbinding._cacheIndex = firstInactiveIndex;\n\t\tbindings[ firstInactiveIndex ] = binding;\n\n\t\tlastActiveBinding._cacheIndex = prevIndex;\n\t\tbindings[ prevIndex ] = lastActiveBinding;\n\n\t}\n\n\n\t// Memory management of Interpolants for weight and time scale\n\n\t_lendControlInterpolant() {\n\n\t\tconst interpolants = this._controlInterpolants,\n\t\t\tlastActiveIndex = this._nActiveControlInterpolants ++;\n\n\t\tlet interpolant = interpolants[ lastActiveIndex ];\n\n\t\tif ( interpolant === undefined ) {\n\n\t\t\tinterpolant = new LinearInterpolant(\n\t\t\t\tnew Float32Array( 2 ), new Float32Array( 2 ),\n\t\t\t\t1, _controlInterpolantsResultBuffer );\n\n\t\t\tinterpolant.__cacheIndex = lastActiveIndex;\n\t\t\tinterpolants[ lastActiveIndex ] = interpolant;\n\n\t\t}\n\n\t\treturn interpolant;\n\n\t}\n\n\t_takeBackControlInterpolant( interpolant ) {\n\n\t\tconst interpolants = this._controlInterpolants,\n\t\t\tprevIndex = interpolant.__cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveControlInterpolants,\n\n\t\t\tlastActiveInterpolant = interpolants[ firstInactiveIndex ];\n\n\t\tinterpolant.__cacheIndex = firstInactiveIndex;\n\t\tinterpolants[ firstInactiveIndex ] = interpolant;\n\n\t\tlastActiveInterpolant.__cacheIndex = prevIndex;\n\t\tinterpolants[ prevIndex ] = lastActiveInterpolant;\n\n\t}\n\n\t// return an action for a clip optionally using a custom root target\n\t// object (this method allocates a lot of dynamic memory in case a\n\t// previously unknown clip/root combination is specified)\n\tclipAction( clip, optionalRoot, blendMode ) {\n\n\t\tconst root = optionalRoot || this._root,\n\t\t\trootUuid = root.uuid;\n\n\t\tlet clipObject = typeof clip === 'string' ? AnimationClip.findByName( root, clip ) : clip;\n\n\t\tconst clipUuid = clipObject !== null ? clipObject.uuid : clip;\n\n\t\tconst actionsForClip = this._actionsByClip[ clipUuid ];\n\t\tlet prototypeAction = null;\n\n\t\tif ( blendMode === undefined ) {\n\n\t\t\tif ( clipObject !== null ) {\n\n\t\t\t\tblendMode = clipObject.blendMode;\n\n\t\t\t} else {\n\n\t\t\t\tblendMode = NormalAnimationBlendMode;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\tconst existingAction = actionsForClip.actionByRoot[ rootUuid ];\n\n\t\t\tif ( existingAction !== undefined && existingAction.blendMode === blendMode ) {\n\n\t\t\t\treturn existingAction;\n\n\t\t\t}\n\n\t\t\t// we know the clip, so we don't have to parse all\n\t\t\t// the bindings again but can just copy\n\t\t\tprototypeAction = actionsForClip.knownActions[ 0 ];\n\n\t\t\t// also, take the clip from the prototype action\n\t\t\tif ( clipObject === null )\n\t\t\t\tclipObject = prototypeAction._clip;\n\n\t\t}\n\n\t\t// clip must be known when specified via string\n\t\tif ( clipObject === null ) return null;\n\n\t\t// allocate all resources required to run it\n\t\tconst newAction = new AnimationAction( this, clipObject, optionalRoot, blendMode );\n\n\t\tthis._bindAction( newAction, prototypeAction );\n\n\t\t// and make the action known to the memory manager\n\t\tthis._addInactiveAction( newAction, clipUuid, rootUuid );\n\n\t\treturn newAction;\n\n\t}\n\n\t// get an existing action\n\texistingAction( clip, optionalRoot ) {\n\n\t\tconst root = optionalRoot || this._root,\n\t\t\trootUuid = root.uuid,\n\n\t\t\tclipObject = typeof clip === 'string' ?\n\t\t\t\tAnimationClip.findByName( root, clip ) : clip,\n\n\t\t\tclipUuid = clipObject ? clipObject.uuid : clip,\n\n\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\treturn actionsForClip.actionByRoot[ rootUuid ] || null;\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t// deactivates all previously scheduled actions\n\tstopAllAction() {\n\n\t\tconst actions = this._actions,\n\t\t\tnActions = this._nActiveActions;\n\n\t\tfor ( let i = nActions - 1; i >= 0; -- i ) {\n\n\t\t\tactions[ i ].stop();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// advance the time and update apply the animation\n\tupdate( deltaTime ) {\n\n\t\tdeltaTime *= this.timeScale;\n\n\t\tconst actions = this._actions,\n\t\t\tnActions = this._nActiveActions,\n\n\t\t\ttime = this.time += deltaTime,\n\t\t\ttimeDirection = Math.sign( deltaTime ),\n\n\t\t\taccuIndex = this._accuIndex ^= 1;\n\n\t\t// run active actions\n\n\t\tfor ( let i = 0; i !== nActions; ++ i ) {\n\n\t\t\tconst action = actions[ i ];\n\n\t\t\taction._update( time, deltaTime, timeDirection, accuIndex );\n\n\t\t}\n\n\t\t// update scene graph\n\n\t\tconst bindings = this._bindings,\n\t\t\tnBindings = this._nActiveBindings;\n\n\t\tfor ( let i = 0; i !== nBindings; ++ i ) {\n\n\t\t\tbindings[ i ].apply( accuIndex );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Allows you to seek to a specific time in an animation.\n\tsetTime( timeInSeconds ) {\n\n\t\tthis.time = 0; // Zero out time attribute for AnimationMixer object;\n\t\tfor ( let i = 0; i < this._actions.length; i ++ ) {\n\n\t\t\tthis._actions[ i ].time = 0; // Zero out time attribute for all associated AnimationAction objects.\n\n\t\t}\n\n\t\treturn this.update( timeInSeconds ); // Update used to set exact time. Returns \"this\" AnimationMixer object.\n\n\t}\n\n\t// return this mixer's root target object\n\tgetRoot() {\n\n\t\treturn this._root;\n\n\t}\n\n\t// free all resources specific to a particular clip\n\tuncacheClip( clip ) {\n\n\t\tconst actions = this._actions,\n\t\t\tclipUuid = clip.uuid,\n\t\t\tactionsByClip = this._actionsByClip,\n\t\t\tactionsForClip = actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\t// note: just calling _removeInactiveAction would mess up the\n\t\t\t// iteration state and also require updating the state we can\n\t\t\t// just throw away\n\n\t\t\tconst actionsToRemove = actionsForClip.knownActions;\n\n\t\t\tfor ( let i = 0, n = actionsToRemove.length; i !== n; ++ i ) {\n\n\t\t\t\tconst action = actionsToRemove[ i ];\n\n\t\t\t\tthis._deactivateAction( action );\n\n\t\t\t\tconst cacheIndex = action._cacheIndex,\n\t\t\t\t\tlastInactiveAction = actions[ actions.length - 1 ];\n\n\t\t\t\taction._cacheIndex = null;\n\t\t\t\taction._byClipCacheIndex = null;\n\n\t\t\t\tlastInactiveAction._cacheIndex = cacheIndex;\n\t\t\t\tactions[ cacheIndex ] = lastInactiveAction;\n\t\t\t\tactions.pop();\n\n\t\t\t\tthis._removeInactiveBindingsForAction( action );\n\n\t\t\t}\n\n\t\t\tdelete actionsByClip[ clipUuid ];\n\n\t\t}\n\n\t}\n\n\t// free all resources specific to a particular root target object\n\tuncacheRoot( root ) {\n\n\t\tconst rootUuid = root.uuid,\n\t\t\tactionsByClip = this._actionsByClip;\n\n\t\tfor ( const clipUuid in actionsByClip ) {\n\n\t\t\tconst actionByRoot = actionsByClip[ clipUuid ].actionByRoot,\n\t\t\t\taction = actionByRoot[ rootUuid ];\n\n\t\t\tif ( action !== undefined ) {\n\n\t\t\t\tthis._deactivateAction( action );\n\t\t\t\tthis._removeInactiveAction( action );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst bindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingByName !== undefined ) {\n\n\t\t\tfor ( const trackName in bindingByName ) {\n\n\t\t\t\tconst binding = bindingByName[ trackName ];\n\t\t\t\tbinding.restoreOriginalState();\n\t\t\t\tthis._removeInactiveBinding( binding );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// remove a targeted clip from the cache\n\tuncacheAction( clip, optionalRoot ) {\n\n\t\tconst action = this.existingAction( clip, optionalRoot );\n\n\t\tif ( action !== null ) {\n\n\t\t\tthis._deactivateAction( action );\n\t\t\tthis._removeInactiveAction( action );\n\n\t\t}\n\n\t}\n\n}\n\nclass Uniform {\n\n\tconstructor( value ) {\n\n\t\tthis.value = value;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Uniform( this.value.clone === undefined ? this.value : this.value.clone() );\n\n\t}\n\n}\n\nlet _id = 0;\n\nclass UniformsGroup extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isUniformsGroup = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _id ++ } );\n\n\t\tthis.name = '';\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis.uniforms = [];\n\n\t}\n\n\tadd( uniform ) {\n\n\t\tthis.uniforms.push( uniform );\n\n\t\treturn this;\n\n\t}\n\n\tremove( uniform ) {\n\n\t\tconst index = this.uniforms.indexOf( uniform );\n\n\t\tif ( index !== - 1 ) this.uniforms.splice( index, 1 );\n\n\t\treturn this;\n\n\t}\n\n\tsetName( name ) {\n\n\t\tthis.name = name;\n\n\t\treturn this;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\t\tthis.usage = source.usage;\n\n\t\tconst uniformsSource = source.uniforms;\n\n\t\tthis.uniforms.length = 0;\n\n\t\tfor ( let i = 0, l = uniformsSource.length; i < l; i ++ ) {\n\n\t\t\tthis.uniforms.push( uniformsSource[ i ].clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nclass InstancedInterleavedBuffer extends InterleavedBuffer {\n\n\tconstructor( array, stride, meshPerAttribute = 1 ) {\n\n\t\tsuper( array, stride );\n\n\t\tthis.isInstancedInterleavedBuffer = true;\n\n\t\tthis.meshPerAttribute = meshPerAttribute;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tconst ib = super.clone( data );\n\n\t\tib.meshPerAttribute = this.meshPerAttribute;\n\n\t\treturn ib;\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tconst json = super.toJSON( data );\n\n\t\tjson.isInstancedInterleavedBuffer = true;\n\t\tjson.meshPerAttribute = this.meshPerAttribute;\n\n\t\treturn json;\n\n\t}\n\n}\n\nclass GLBufferAttribute {\n\n\tconstructor( buffer, type, itemSize, elementSize, count ) {\n\n\t\tthis.isGLBufferAttribute = true;\n\n\t\tthis.name = '';\n\n\t\tthis.buffer = buffer;\n\t\tthis.type = type;\n\t\tthis.itemSize = itemSize;\n\t\tthis.elementSize = elementSize;\n\t\tthis.count = count;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tsetBuffer( buffer ) {\n\n\t\tthis.buffer = buffer;\n\n\t\treturn this;\n\n\t}\n\n\tsetType( type, elementSize ) {\n\n\t\tthis.type = type;\n\t\tthis.elementSize = elementSize;\n\n\t\treturn this;\n\n\t}\n\n\tsetItemSize( itemSize ) {\n\n\t\tthis.itemSize = itemSize;\n\n\t\treturn this;\n\n\t}\n\n\tsetCount( count ) {\n\n\t\tthis.count = count;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Raycaster {\n\n\tconstructor( origin, direction, near = 0, far = Infinity ) {\n\n\t\tthis.ray = new Ray( origin, direction );\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\t\tthis.camera = null;\n\t\tthis.layers = new Layers();\n\n\t\tthis.params = {\n\t\t\tMesh: {},\n\t\t\tLine: { threshold: 1 },\n\t\t\tLOD: {},\n\t\t\tPoints: { threshold: 1 },\n\t\t\tSprite: {}\n\t\t};\n\n\t}\n\n\tset( origin, direction ) {\n\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\n\n\t\tthis.ray.set( origin, direction );\n\n\t}\n\n\tsetFromCamera( coords, camera ) {\n\n\t\tif ( camera.isPerspectiveCamera ) {\n\n\t\t\tthis.ray.origin.setFromMatrixPosition( camera.matrixWorld );\n\t\t\tthis.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( this.ray.origin ).normalize();\n\t\t\tthis.camera = camera;\n\n\t\t} else if ( camera.isOrthographicCamera ) {\n\n\t\t\tthis.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera\n\t\t\tthis.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld );\n\t\t\tthis.camera = camera;\n\n\t\t} else {\n\n\t\t\tconsole.error( 'THREE.Raycaster: Unsupported camera type: ' + camera.type );\n\n\t\t}\n\n\t}\n\n\tintersectObject( object, recursive = true, intersects = [] ) {\n\n\t\tintersectObject( object, this, intersects, recursive );\n\n\t\tintersects.sort( ascSort );\n\n\t\treturn intersects;\n\n\t}\n\n\tintersectObjects( objects, recursive = true, intersects = [] ) {\n\n\t\tfor ( let i = 0, l = objects.length; i < l; i ++ ) {\n\n\t\t\tintersectObject( objects[ i ], this, intersects, recursive );\n\n\t\t}\n\n\t\tintersects.sort( ascSort );\n\n\t\treturn intersects;\n\n\t}\n\n}\n\nfunction ascSort( a, b ) {\n\n\treturn a.distance - b.distance;\n\n}\n\nfunction intersectObject( object, raycaster, intersects, recursive ) {\n\n\tif ( object.layers.test( raycaster.layers ) ) {\n\n\t\tobject.raycast( raycaster, intersects );\n\n\t}\n\n\tif ( recursive === true ) {\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tintersectObject( children[ i ], raycaster, intersects, true );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system\n *\n * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up.\n * The azimuthal angle (theta) is measured from the positive z-axis.\n */\n\n\nclass Spherical {\n\n\tconstructor( radius = 1, phi = 0, theta = 0 ) {\n\n\t\tthis.radius = radius;\n\t\tthis.phi = phi; // polar angle\n\t\tthis.theta = theta; // azimuthal angle\n\n\t\treturn this;\n\n\t}\n\n\tset( radius, phi, theta ) {\n\n\t\tthis.radius = radius;\n\t\tthis.phi = phi;\n\t\tthis.theta = theta;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tthis.radius = other.radius;\n\t\tthis.phi = other.phi;\n\t\tthis.theta = other.theta;\n\n\t\treturn this;\n\n\t}\n\n\t// restrict phi to be between EPS and PI-EPS\n\tmakeSafe() {\n\n\t\tconst EPS = 0.000001;\n\t\tthis.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\n\n\t}\n\n\tsetFromCartesianCoords( x, y, z ) {\n\n\t\tthis.radius = Math.sqrt( x * x + y * y + z * z );\n\n\t\tif ( this.radius === 0 ) {\n\n\t\t\tthis.theta = 0;\n\t\t\tthis.phi = 0;\n\n\t\t} else {\n\n\t\t\tthis.theta = Math.atan2( x, z );\n\t\t\tthis.phi = Math.acos( clamp( y / this.radius, - 1, 1 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\n/**\n * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system\n */\n\nclass Cylindrical {\n\n\tconstructor( radius = 1, theta = 0, y = 0 ) {\n\n\t\tthis.radius = radius; // distance from the origin to a point in the x-z plane\n\t\tthis.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis\n\t\tthis.y = y; // height above the x-z plane\n\n\t\treturn this;\n\n\t}\n\n\tset( radius, theta, y ) {\n\n\t\tthis.radius = radius;\n\t\tthis.theta = theta;\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tthis.radius = other.radius;\n\t\tthis.theta = other.theta;\n\t\tthis.y = other.y;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\n\n\t}\n\n\tsetFromCartesianCoords( x, y, z ) {\n\n\t\tthis.radius = Math.sqrt( x * x + z * z );\n\t\tthis.theta = Math.atan2( x, z );\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$4 = /*@__PURE__*/ new Vector2();\n\nclass Box2 {\n\n\tconstructor( min = new Vector2( + Infinity, + Infinity ), max = new Vector2( - Infinity, - Infinity ) ) {\n\n\t\tthis.isBox2 = true;\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tset( min, max ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( points[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCenterAndSize( center, size ) {\n\n\t\tconst halfSize = _vector$4.copy( size ).multiplyScalar( 0.5 );\n\t\tthis.min.copy( center ).sub( halfSize );\n\t\tthis.max.copy( center ).add( halfSize );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( box ) {\n\n\t\tthis.min.copy( box.min );\n\t\tthis.max.copy( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.min.x = this.min.y = + Infinity;\n\t\tthis.max.x = this.max.y = - Infinity;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y );\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\n\n\t}\n\n\tgetSize( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.subVectors( this.max, this.min );\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tthis.min.min( point );\n\t\tthis.max.max( point );\n\n\t\treturn this;\n\n\t}\n\n\texpandByVector( vector ) {\n\n\t\tthis.min.sub( vector );\n\t\tthis.max.add( vector );\n\n\t\treturn this;\n\n\t}\n\n\texpandByScalar( scalar ) {\n\n\t\tthis.min.addScalar( - scalar );\n\t\tthis.max.addScalar( scalar );\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn point.x < this.min.x || point.x > this.max.x ||\n\t\t\tpoint.y < this.min.y || point.y > this.max.y ? false : true;\n\n\t}\n\n\tcontainsBox( box ) {\n\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y;\n\n\t}\n\n\tgetParameter( point, target ) {\n\n\t\t// This can potentially have a divide by zero if the box\n\t\t// has a size dimension of 0.\n\n\t\treturn target.set(\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y )\n\t\t);\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\t// using 4 splitting planes to rule out intersections\n\n\t\treturn box.max.x < this.min.x || box.min.x > this.max.x ||\n\t\t\tbox.max.y < this.min.y || box.min.y > this.max.y ? false : true;\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\treturn target.copy( point ).clamp( this.min, this.max );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.clampPoint( point, _vector$4 ).distanceTo( point );\n\n\t}\n\n\tintersect( box ) {\n\n\t\tthis.min.max( box.min );\n\t\tthis.max.min( box.max );\n\n\t\tif ( this.isEmpty() ) this.makeEmpty();\n\n\t\treturn this;\n\n\t}\n\n\tunion( box ) {\n\n\t\tthis.min.min( box.min );\n\t\tthis.max.max( box.max );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.min.add( offset );\n\t\tthis.max.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\tequals( box ) {\n\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\n\n\t}\n\n}\n\nconst _startP = /*@__PURE__*/ new Vector3();\nconst _startEnd = /*@__PURE__*/ new Vector3();\n\nclass Line3 {\n\n\tconstructor( start = new Vector3(), end = new Vector3() ) {\n\n\t\tthis.start = start;\n\t\tthis.end = end;\n\n\t}\n\n\tset( start, end ) {\n\n\t\tthis.start.copy( start );\n\t\tthis.end.copy( end );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( line ) {\n\n\t\tthis.start.copy( line.start );\n\t\tthis.end.copy( line.end );\n\n\t\treturn this;\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn target.addVectors( this.start, this.end ).multiplyScalar( 0.5 );\n\n\t}\n\n\tdelta( target ) {\n\n\t\treturn target.subVectors( this.end, this.start );\n\n\t}\n\n\tdistanceSq() {\n\n\t\treturn this.start.distanceToSquared( this.end );\n\n\t}\n\n\tdistance() {\n\n\t\treturn this.start.distanceTo( this.end );\n\n\t}\n\n\tat( t, target ) {\n\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\n\n\t}\n\n\tclosestPointToPointParameter( point, clampToLine ) {\n\n\t\t_startP.subVectors( point, this.start );\n\t\t_startEnd.subVectors( this.end, this.start );\n\n\t\tconst startEnd2 = _startEnd.dot( _startEnd );\n\t\tconst startEnd_startP = _startEnd.dot( _startP );\n\n\t\tlet t = startEnd_startP / startEnd2;\n\n\t\tif ( clampToLine ) {\n\n\t\t\tt = clamp( t, 0, 1 );\n\n\t\t}\n\n\t\treturn t;\n\n\t}\n\n\tclosestPointToPoint( point, clampToLine, target ) {\n\n\t\tconst t = this.closestPointToPointParameter( point, clampToLine );\n\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tthis.start.applyMatrix4( matrix );\n\t\tthis.end.applyMatrix4( matrix );\n\n\t\treturn this;\n\n\t}\n\n\tequals( line ) {\n\n\t\treturn line.start.equals( this.start ) && line.end.equals( this.end );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$3 = /*@__PURE__*/ new Vector3();\n\nclass SpotLightHelper extends Object3D {\n\n\tconstructor( light, color ) {\n\n\t\tsuper();\n\n\t\tthis.light = light;\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'SpotLightHelper';\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tconst positions = [\n\t\t\t0, 0, 0, \t0, 0, 1,\n\t\t\t0, 0, 0, \t1, 0, 1,\n\t\t\t0, 0, 0,\t- 1, 0, 1,\n\t\t\t0, 0, 0, \t0, 1, 1,\n\t\t\t0, 0, 0, \t0, - 1, 1\n\t\t];\n\n\t\tfor ( let i = 0, j = 1, l = 32; i < l; i ++, j ++ ) {\n\n\t\t\tconst p1 = ( i / l ) * Math.PI * 2;\n\t\t\tconst p2 = ( j / l ) * Math.PI * 2;\n\n\t\t\tpositions.push(\n\t\t\t\tMath.cos( p1 ), Math.sin( p1 ), 1,\n\t\t\t\tMath.cos( p2 ), Math.sin( p2 ), 1\n\t\t\t);\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { fog: false, toneMapped: false } );\n\n\t\tthis.cone = new LineSegments( geometry, material );\n\t\tthis.add( this.cone );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.cone.geometry.dispose();\n\t\tthis.cone.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\t\tthis.light.target.updateWorldMatrix( true, false );\n\n\t\tconst coneLength = this.light.distance ? this.light.distance : 1000;\n\t\tconst coneWidth = coneLength * Math.tan( this.light.angle );\n\n\t\tthis.cone.scale.set( coneWidth, coneWidth, coneLength );\n\n\t\t_vector$3.setFromMatrixPosition( this.light.target.matrixWorld );\n\n\t\tthis.cone.lookAt( _vector$3 );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.cone.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.cone.material.color.copy( this.light.color );\n\n\t\t}\n\n\t}\n\n}\n\nconst _vector$2 = /*@__PURE__*/ new Vector3();\nconst _boneMatrix = /*@__PURE__*/ new Matrix4();\nconst _matrixWorldInv = /*@__PURE__*/ new Matrix4();\n\n\nclass SkeletonHelper extends LineSegments {\n\n\tconstructor( object ) {\n\n\t\tconst bones = getBoneList( object );\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\tconst color1 = new Color( 0, 0, 1 );\n\t\tconst color2 = new Color( 0, 1, 0 );\n\n\t\tfor ( let i = 0; i < bones.length; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\n\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tcolors.push( color1.r, color1.g, color1.b );\n\t\t\t\tcolors.push( color2.r, color2.g, color2.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, depthTest: false, depthWrite: false, toneMapped: false, transparent: true } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isSkeletonHelper = true;\n\n\t\tthis.type = 'SkeletonHelper';\n\n\t\tthis.root = object;\n\t\tthis.bones = bones;\n\n\t\tthis.matrix = object.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tconst bones = this.bones;\n\n\t\tconst geometry = this.geometry;\n\t\tconst position = geometry.getAttribute( 'position' );\n\n\t\t_matrixWorldInv.copy( this.root.matrixWorld ).invert();\n\n\t\tfor ( let i = 0, j = 0; i < bones.length; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\n\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.matrixWorld );\n\t\t\t\t_vector$2.setFromMatrixPosition( _boneMatrix );\n\t\t\t\tposition.setXYZ( j, _vector$2.x, _vector$2.y, _vector$2.z );\n\n\t\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.parent.matrixWorld );\n\t\t\t\t_vector$2.setFromMatrixPosition( _boneMatrix );\n\t\t\t\tposition.setXYZ( j + 1, _vector$2.x, _vector$2.y, _vector$2.z );\n\n\t\t\t\tj += 2;\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.getAttribute( 'position' ).needsUpdate = true;\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\n\nfunction getBoneList( object ) {\n\n\tconst boneList = [];\n\n\tif ( object.isBone === true ) {\n\n\t\tboneList.push( object );\n\n\t}\n\n\tfor ( let i = 0; i < object.children.length; i ++ ) {\n\n\t\tboneList.push.apply( boneList, getBoneList( object.children[ i ] ) );\n\n\t}\n\n\treturn boneList;\n\n}\n\nclass PointLightHelper extends Mesh {\n\n\tconstructor( light, sphereSize, color ) {\n\n\t\tconst geometry = new SphereGeometry( sphereSize, 4, 2 );\n\t\tconst material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.light = light;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'PointLightHelper';\n\n\t\tthis.matrix = this.light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.update();\n\n\n\t\t/*\n\t// TODO: delete this comment?\n\tconst distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );\n\tconst distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );\n\n\tthis.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );\n\tthis.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );\n\n\tconst d = light.distance;\n\n\tif ( d === 0.0 ) {\n\n\t\tthis.lightDistance.visible = false;\n\n\t} else {\n\n\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t}\n\n\tthis.add( this.lightDistance );\n\t*/\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.material.color.copy( this.light.color );\n\n\t\t}\n\n\t\t/*\n\t\tconst d = this.light.distance;\n\n\t\tif ( d === 0.0 ) {\n\n\t\t\tthis.lightDistance.visible = false;\n\n\t\t} else {\n\n\t\t\tthis.lightDistance.visible = true;\n\t\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t\t}\n\t\t*/\n\n\t}\n\n}\n\nconst _vector$1 = /*@__PURE__*/ new Vector3();\nconst _color1 = /*@__PURE__*/ new Color();\nconst _color2 = /*@__PURE__*/ new Color();\n\nclass HemisphereLightHelper extends Object3D {\n\n\tconstructor( light, size, color ) {\n\n\t\tsuper();\n\n\t\tthis.light = light;\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'HemisphereLightHelper';\n\n\t\tconst geometry = new OctahedronGeometry( size );\n\t\tgeometry.rotateY( Math.PI * 0.5 );\n\n\t\tthis.material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );\n\t\tif ( this.color === undefined ) this.material.vertexColors = true;\n\n\t\tconst position = geometry.getAttribute( 'position' );\n\t\tconst colors = new Float32Array( position.count * 3 );\n\n\t\tgeometry.setAttribute( 'color', new BufferAttribute( colors, 3 ) );\n\n\t\tthis.add( new Mesh( geometry, this.material ) );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.children[ 0 ].geometry.dispose();\n\t\tthis.children[ 0 ].material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tconst mesh = this.children[ 0 ];\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tconst colors = mesh.geometry.getAttribute( 'color' );\n\n\t\t\t_color1.copy( this.light.color );\n\t\t\t_color2.copy( this.light.groundColor );\n\n\t\t\tfor ( let i = 0, l = colors.count; i < l; i ++ ) {\n\n\t\t\t\tconst color = ( i < ( l / 2 ) ) ? _color1 : _color2;\n\n\t\t\t\tcolors.setXYZ( i, color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t\tcolors.needsUpdate = true;\n\n\t\t}\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\n\t\tmesh.lookAt( _vector$1.setFromMatrixPosition( this.light.matrixWorld ).negate() );\n\n\t}\n\n}\n\nclass GridHelper extends LineSegments {\n\n\tconstructor( size = 10, divisions = 10, color1 = 0x444444, color2 = 0x888888 ) {\n\n\t\tcolor1 = new Color( color1 );\n\t\tcolor2 = new Color( color2 );\n\n\t\tconst center = divisions / 2;\n\t\tconst step = size / divisions;\n\t\tconst halfSize = size / 2;\n\n\t\tconst vertices = [], colors = [];\n\n\t\tfor ( let i = 0, j = 0, k = - halfSize; i <= divisions; i ++, k += step ) {\n\n\t\t\tvertices.push( - halfSize, 0, k, halfSize, 0, k );\n\t\t\tvertices.push( k, 0, - halfSize, k, 0, halfSize );\n\n\t\t\tconst color = i === center ? color1 : color2;\n\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\n\t\t}\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'GridHelper';\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass PolarGridHelper extends LineSegments {\n\n\tconstructor( radius = 10, sectors = 16, rings = 8, divisions = 64, color1 = 0x444444, color2 = 0x888888 ) {\n\n\t\tcolor1 = new Color( color1 );\n\t\tcolor2 = new Color( color2 );\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\t// create the sectors\n\n\t\tif ( sectors > 1 ) {\n\n\t\t\tfor ( let i = 0; i < sectors; i ++ ) {\n\n\t\t\t\tconst v = ( i / sectors ) * ( Math.PI * 2 );\n\n\t\t\t\tconst x = Math.sin( v ) * radius;\n\t\t\t\tconst z = Math.cos( v ) * radius;\n\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tvertices.push( x, 0, z );\n\n\t\t\t\tconst color = ( i & 1 ) ? color1 : color2;\n\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// create the rings\n\n\t\tfor ( let i = 0; i < rings; i ++ ) {\n\n\t\t\tconst color = ( i & 1 ) ? color1 : color2;\n\n\t\t\tconst r = radius - ( radius / rings * i );\n\n\t\t\tfor ( let j = 0; j < divisions; j ++ ) {\n\n\t\t\t\t// first vertex\n\n\t\t\t\tlet v = ( j / divisions ) * ( Math.PI * 2 );\n\n\t\t\t\tlet x = Math.sin( v ) * r;\n\t\t\t\tlet z = Math.cos( v ) * r;\n\n\t\t\t\tvertices.push( x, 0, z );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t\t// second vertex\n\n\t\t\t\tv = ( ( j + 1 ) / divisions ) * ( Math.PI * 2 );\n\n\t\t\t\tx = Math.sin( v ) * r;\n\t\t\t\tz = Math.cos( v ) * r;\n\n\t\t\t\tvertices.push( x, 0, z );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'PolarGridHelper';\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nconst _v1 = /*@__PURE__*/ new Vector3();\nconst _v2 = /*@__PURE__*/ new Vector3();\nconst _v3 = /*@__PURE__*/ new Vector3();\n\nclass DirectionalLightHelper extends Object3D {\n\n\tconstructor( light, size, color ) {\n\n\t\tsuper();\n\n\t\tthis.light = light;\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'DirectionalLightHelper';\n\n\t\tif ( size === undefined ) size = 1;\n\n\t\tlet geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [\n\t\t\t- size, size, 0,\n\t\t\tsize, size, 0,\n\t\t\tsize, - size, 0,\n\t\t\t- size, - size, 0,\n\t\t\t- size, size, 0\n\t\t], 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { fog: false, toneMapped: false } );\n\n\t\tthis.lightPlane = new Line( geometry, material );\n\t\tthis.add( this.lightPlane );\n\n\t\tgeometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 0, 1 ], 3 ) );\n\n\t\tthis.targetLine = new Line( geometry, material );\n\t\tthis.add( this.targetLine );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.lightPlane.geometry.dispose();\n\t\tthis.lightPlane.material.dispose();\n\t\tthis.targetLine.geometry.dispose();\n\t\tthis.targetLine.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\t\tthis.light.target.updateWorldMatrix( true, false );\n\n\t\t_v1.setFromMatrixPosition( this.light.matrixWorld );\n\t\t_v2.setFromMatrixPosition( this.light.target.matrixWorld );\n\t\t_v3.subVectors( _v2, _v1 );\n\n\t\tthis.lightPlane.lookAt( _v2 );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.lightPlane.material.color.set( this.color );\n\t\t\tthis.targetLine.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.lightPlane.material.color.copy( this.light.color );\n\t\t\tthis.targetLine.material.color.copy( this.light.color );\n\n\t\t}\n\n\t\tthis.targetLine.lookAt( _v2 );\n\t\tthis.targetLine.scale.z = _v3.length();\n\n\t}\n\n}\n\nconst _vector = /*@__PURE__*/ new Vector3();\nconst _camera = /*@__PURE__*/ new Camera();\n\n/**\n *\t- shows frustum, line of sight and up of the camera\n *\t- suitable for fast updates\n * \t- based on frustum visualization in lightgl.js shadowmap example\n *\t\thttps://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html\n */\n\nclass CameraHelper extends LineSegments {\n\n\tconstructor( camera ) {\n\n\t\tconst geometry = new BufferGeometry();\n\t\tconst material = new LineBasicMaterial( { color: 0xffffff, vertexColors: true, toneMapped: false } );\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\tconst pointMap = {};\n\n\t\t// near\n\n\t\taddLine( 'n1', 'n2' );\n\t\taddLine( 'n2', 'n4' );\n\t\taddLine( 'n4', 'n3' );\n\t\taddLine( 'n3', 'n1' );\n\n\t\t// far\n\n\t\taddLine( 'f1', 'f2' );\n\t\taddLine( 'f2', 'f4' );\n\t\taddLine( 'f4', 'f3' );\n\t\taddLine( 'f3', 'f1' );\n\n\t\t// sides\n\n\t\taddLine( 'n1', 'f1' );\n\t\taddLine( 'n2', 'f2' );\n\t\taddLine( 'n3', 'f3' );\n\t\taddLine( 'n4', 'f4' );\n\n\t\t// cone\n\n\t\taddLine( 'p', 'n1' );\n\t\taddLine( 'p', 'n2' );\n\t\taddLine( 'p', 'n3' );\n\t\taddLine( 'p', 'n4' );\n\n\t\t// up\n\n\t\taddLine( 'u1', 'u2' );\n\t\taddLine( 'u2', 'u3' );\n\t\taddLine( 'u3', 'u1' );\n\n\t\t// target\n\n\t\taddLine( 'c', 't' );\n\t\taddLine( 'p', 'c' );\n\n\t\t// cross\n\n\t\taddLine( 'cn1', 'cn2' );\n\t\taddLine( 'cn3', 'cn4' );\n\n\t\taddLine( 'cf1', 'cf2' );\n\t\taddLine( 'cf3', 'cf4' );\n\n\t\tfunction addLine( a, b ) {\n\n\t\t\taddPoint( a );\n\t\t\taddPoint( b );\n\n\t\t}\n\n\t\tfunction addPoint( id ) {\n\n\t\t\tvertices.push( 0, 0, 0 );\n\t\t\tcolors.push( 0, 0, 0 );\n\n\t\t\tif ( pointMap[ id ] === undefined ) {\n\n\t\t\t\tpointMap[ id ] = [];\n\n\t\t\t}\n\n\t\t\tpointMap[ id ].push( ( vertices.length / 3 ) - 1 );\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'CameraHelper';\n\n\t\tthis.camera = camera;\n\t\tif ( this.camera.updateProjectionMatrix ) this.camera.updateProjectionMatrix();\n\n\t\tthis.matrix = camera.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.pointMap = pointMap;\n\n\t\tthis.update();\n\n\t\t// colors\n\n\t\tconst colorFrustum = new Color( 0xffaa00 );\n\t\tconst colorCone = new Color( 0xff0000 );\n\t\tconst colorUp = new Color( 0x00aaff );\n\t\tconst colorTarget = new Color( 0xffffff );\n\t\tconst colorCross = new Color( 0x333333 );\n\n\t\tthis.setColors( colorFrustum, colorCone, colorUp, colorTarget, colorCross );\n\n\t}\n\n\tsetColors( frustum, cone, up, target, cross ) {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst colorAttribute = geometry.getAttribute( 'color' );\n\n\t\t// near\n\n\t\tcolorAttribute.setXYZ( 0, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 1, frustum.r, frustum.g, frustum.b ); // n1, n2\n\t\tcolorAttribute.setXYZ( 2, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 3, frustum.r, frustum.g, frustum.b ); // n2, n4\n\t\tcolorAttribute.setXYZ( 4, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 5, frustum.r, frustum.g, frustum.b ); // n4, n3\n\t\tcolorAttribute.setXYZ( 6, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 7, frustum.r, frustum.g, frustum.b ); // n3, n1\n\n\t\t// far\n\n\t\tcolorAttribute.setXYZ( 8, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 9, frustum.r, frustum.g, frustum.b ); // f1, f2\n\t\tcolorAttribute.setXYZ( 10, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 11, frustum.r, frustum.g, frustum.b ); // f2, f4\n\t\tcolorAttribute.setXYZ( 12, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 13, frustum.r, frustum.g, frustum.b ); // f4, f3\n\t\tcolorAttribute.setXYZ( 14, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 15, frustum.r, frustum.g, frustum.b ); // f3, f1\n\n\t\t// sides\n\n\t\tcolorAttribute.setXYZ( 16, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 17, frustum.r, frustum.g, frustum.b ); // n1, f1\n\t\tcolorAttribute.setXYZ( 18, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 19, frustum.r, frustum.g, frustum.b ); // n2, f2\n\t\tcolorAttribute.setXYZ( 20, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 21, frustum.r, frustum.g, frustum.b ); // n3, f3\n\t\tcolorAttribute.setXYZ( 22, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 23, frustum.r, frustum.g, frustum.b ); // n4, f4\n\n\t\t// cone\n\n\t\tcolorAttribute.setXYZ( 24, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 25, cone.r, cone.g, cone.b ); // p, n1\n\t\tcolorAttribute.setXYZ( 26, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 27, cone.r, cone.g, cone.b ); // p, n2\n\t\tcolorAttribute.setXYZ( 28, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 29, cone.r, cone.g, cone.b ); // p, n3\n\t\tcolorAttribute.setXYZ( 30, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 31, cone.r, cone.g, cone.b ); // p, n4\n\n\t\t// up\n\n\t\tcolorAttribute.setXYZ( 32, up.r, up.g, up.b ); colorAttribute.setXYZ( 33, up.r, up.g, up.b ); // u1, u2\n\t\tcolorAttribute.setXYZ( 34, up.r, up.g, up.b ); colorAttribute.setXYZ( 35, up.r, up.g, up.b ); // u2, u3\n\t\tcolorAttribute.setXYZ( 36, up.r, up.g, up.b ); colorAttribute.setXYZ( 37, up.r, up.g, up.b ); // u3, u1\n\n\t\t// target\n\n\t\tcolorAttribute.setXYZ( 38, target.r, target.g, target.b ); colorAttribute.setXYZ( 39, target.r, target.g, target.b ); // c, t\n\t\tcolorAttribute.setXYZ( 40, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 41, cross.r, cross.g, cross.b ); // p, c\n\n\t\t// cross\n\n\t\tcolorAttribute.setXYZ( 42, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 43, cross.r, cross.g, cross.b ); // cn1, cn2\n\t\tcolorAttribute.setXYZ( 44, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 45, cross.r, cross.g, cross.b ); // cn3, cn4\n\n\t\tcolorAttribute.setXYZ( 46, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 47, cross.r, cross.g, cross.b ); // cf1, cf2\n\t\tcolorAttribute.setXYZ( 48, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 49, cross.r, cross.g, cross.b ); // cf3, cf4\n\n\t\tcolorAttribute.needsUpdate = true;\n\n\t}\n\n\tupdate() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst pointMap = this.pointMap;\n\n\t\tconst w = 1, h = 1;\n\n\t\t// we need just camera projection matrix inverse\n\t\t// world matrix must be identity\n\n\t\t_camera.projectionMatrixInverse.copy( this.camera.projectionMatrixInverse );\n\n\t\t// center / target\n\n\t\tsetPoint( 'c', pointMap, geometry, _camera, 0, 0, - 1 );\n\t\tsetPoint( 't', pointMap, geometry, _camera, 0, 0, 1 );\n\n\t\t// near\n\n\t\tsetPoint( 'n1', pointMap, geometry, _camera, - w, - h, - 1 );\n\t\tsetPoint( 'n2', pointMap, geometry, _camera, w, - h, - 1 );\n\t\tsetPoint( 'n3', pointMap, geometry, _camera, - w, h, - 1 );\n\t\tsetPoint( 'n4', pointMap, geometry, _camera, w, h, - 1 );\n\n\t\t// far\n\n\t\tsetPoint( 'f1', pointMap, geometry, _camera, - w, - h, 1 );\n\t\tsetPoint( 'f2', pointMap, geometry, _camera, w, - h, 1 );\n\t\tsetPoint( 'f3', pointMap, geometry, _camera, - w, h, 1 );\n\t\tsetPoint( 'f4', pointMap, geometry, _camera, w, h, 1 );\n\n\t\t// up\n\n\t\tsetPoint( 'u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, - 1 );\n\t\tsetPoint( 'u2', pointMap, geometry, _camera, - w * 0.7, h * 1.1, - 1 );\n\t\tsetPoint( 'u3', pointMap, geometry, _camera, 0, h * 2, - 1 );\n\n\t\t// cross\n\n\t\tsetPoint( 'cf1', pointMap, geometry, _camera, - w, 0, 1 );\n\t\tsetPoint( 'cf2', pointMap, geometry, _camera, w, 0, 1 );\n\t\tsetPoint( 'cf3', pointMap, geometry, _camera, 0, - h, 1 );\n\t\tsetPoint( 'cf4', pointMap, geometry, _camera, 0, h, 1 );\n\n\t\tsetPoint( 'cn1', pointMap, geometry, _camera, - w, 0, - 1 );\n\t\tsetPoint( 'cn2', pointMap, geometry, _camera, w, 0, - 1 );\n\t\tsetPoint( 'cn3', pointMap, geometry, _camera, 0, - h, - 1 );\n\t\tsetPoint( 'cn4', pointMap, geometry, _camera, 0, h, - 1 );\n\n\t\tgeometry.getAttribute( 'position' ).needsUpdate = true;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\n\nfunction setPoint( point, pointMap, geometry, camera, x, y, z ) {\n\n\t_vector.set( x, y, z ).unproject( camera );\n\n\tconst points = pointMap[ point ];\n\n\tif ( points !== undefined ) {\n\n\t\tconst position = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tposition.setXYZ( points[ i ], _vector.x, _vector.y, _vector.z );\n\n\t\t}\n\n\t}\n\n}\n\nconst _box = /*@__PURE__*/ new Box3();\n\nclass BoxHelper extends LineSegments {\n\n\tconstructor( object, color = 0xffff00 ) {\n\n\t\tconst indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\n\t\tconst positions = new Float32Array( 8 * 3 );\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\n\t\tgeometry.setAttribute( 'position', new BufferAttribute( positions, 3 ) );\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.object = object;\n\t\tthis.type = 'BoxHelper';\n\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.update();\n\n\t}\n\n\tupdate( object ) {\n\n\t\tif ( object !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.BoxHelper: .update() has no longer arguments.' );\n\n\t\t}\n\n\t\tif ( this.object !== undefined ) {\n\n\t\t\t_box.setFromObject( this.object );\n\n\t\t}\n\n\t\tif ( _box.isEmpty() ) return;\n\n\t\tconst min = _box.min;\n\t\tconst max = _box.max;\n\n\t\t/*\n\t\t\t5____4\n\t\t1/___0/|\n\t\t| 6__|_7\n\t\t2/___3/\n\n\t\t0: max.x, max.y, max.z\n\t\t1: min.x, max.y, max.z\n\t\t2: min.x, min.y, max.z\n\t\t3: max.x, min.y, max.z\n\t\t4: max.x, max.y, min.z\n\t\t5: min.x, max.y, min.z\n\t\t6: min.x, min.y, min.z\n\t\t7: max.x, min.y, min.z\n\t\t*/\n\n\t\tconst position = this.geometry.attributes.position;\n\t\tconst array = position.array;\n\n\t\tarray[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z;\n\t\tarray[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z;\n\t\tarray[ 6 ] = min.x; array[ 7 ] = min.y; array[ 8 ] = max.z;\n\t\tarray[ 9 ] = max.x; array[ 10 ] = min.y; array[ 11 ] = max.z;\n\t\tarray[ 12 ] = max.x; array[ 13 ] = max.y; array[ 14 ] = min.z;\n\t\tarray[ 15 ] = min.x; array[ 16 ] = max.y; array[ 17 ] = min.z;\n\t\tarray[ 18 ] = min.x; array[ 19 ] = min.y; array[ 20 ] = min.z;\n\t\tarray[ 21 ] = max.x; array[ 22 ] = min.y; array[ 23 ] = min.z;\n\n\t\tposition.needsUpdate = true;\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\t}\n\n\tsetFromObject( object ) {\n\n\t\tthis.object = object;\n\t\tthis.update();\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.object = source.object;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass Box3Helper extends LineSegments {\n\n\tconstructor( box, color = 0xffff00 ) {\n\n\t\tconst indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\n\n\t\tconst positions = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 1, - 1, 1, - 1, - 1 ];\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.box = box;\n\n\t\tthis.type = 'Box3Helper';\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tconst box = this.box;\n\n\t\tif ( box.isEmpty() ) return;\n\n\t\tbox.getCenter( this.position );\n\n\t\tbox.getSize( this.scale );\n\n\t\tthis.scale.multiplyScalar( 0.5 );\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass PlaneHelper extends Line {\n\n\tconstructor( plane, size = 1, hex = 0xffff00 ) {\n\n\t\tconst color = hex;\n\n\t\tconst positions = [ 1, - 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, - 1, 0, 1, 1, 0 ];\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\t\tgeometry.computeBoundingSphere();\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.type = 'PlaneHelper';\n\n\t\tthis.plane = plane;\n\n\t\tthis.size = size;\n\n\t\tconst positions2 = [ 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, - 1, 0 ];\n\n\t\tconst geometry2 = new BufferGeometry();\n\t\tgeometry2.setAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) );\n\t\tgeometry2.computeBoundingSphere();\n\n\t\tthis.add( new Mesh( geometry2, new MeshBasicMaterial( { color: color, opacity: 0.2, transparent: true, depthWrite: false, toneMapped: false } ) ) );\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tthis.position.set( 0, 0, 0 );\n\n\t\tthis.scale.set( 0.5 * this.size, 0.5 * this.size, 1 );\n\n\t\tthis.lookAt( this.plane.normal );\n\n\t\tthis.translateZ( - this.plane.constant );\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\t\tthis.children[ 0 ].geometry.dispose();\n\t\tthis.children[ 0 ].material.dispose();\n\n\t}\n\n}\n\nconst _axis = /*@__PURE__*/ new Vector3();\nlet _lineGeometry, _coneGeometry;\n\nclass ArrowHelper extends Object3D {\n\n\t// dir is assumed to be normalized\n\n\tconstructor( dir = new Vector3( 0, 0, 1 ), origin = new Vector3( 0, 0, 0 ), length = 1, color = 0xffff00, headLength = length * 0.2, headWidth = headLength * 0.2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ArrowHelper';\n\n\t\tif ( _lineGeometry === undefined ) {\n\n\t\t\t_lineGeometry = new BufferGeometry();\n\t\t\t_lineGeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );\n\n\t\t\t_coneGeometry = new CylinderGeometry( 0, 0.5, 1, 5, 1 );\n\t\t\t_coneGeometry.translate( 0, - 0.5, 0 );\n\n\t\t}\n\n\t\tthis.position.copy( origin );\n\n\t\tthis.line = new Line( _lineGeometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\t\tthis.line.matrixAutoUpdate = false;\n\t\tthis.add( this.line );\n\n\t\tthis.cone = new Mesh( _coneGeometry, new MeshBasicMaterial( { color: color, toneMapped: false } ) );\n\t\tthis.cone.matrixAutoUpdate = false;\n\t\tthis.add( this.cone );\n\n\t\tthis.setDirection( dir );\n\t\tthis.setLength( length, headLength, headWidth );\n\n\t}\n\n\tsetDirection( dir ) {\n\n\t\t// dir is assumed to be normalized\n\n\t\tif ( dir.y > 0.99999 ) {\n\n\t\t\tthis.quaternion.set( 0, 0, 0, 1 );\n\n\t\t} else if ( dir.y < - 0.99999 ) {\n\n\t\t\tthis.quaternion.set( 1, 0, 0, 0 );\n\n\t\t} else {\n\n\t\t\t_axis.set( dir.z, 0, - dir.x ).normalize();\n\n\t\t\tconst radians = Math.acos( dir.y );\n\n\t\t\tthis.quaternion.setFromAxisAngle( _axis, radians );\n\n\t\t}\n\n\t}\n\n\tsetLength( length, headLength = length * 0.2, headWidth = headLength * 0.2 ) {\n\n\t\tthis.line.scale.set( 1, Math.max( 0.0001, length - headLength ), 1 ); // see #17458\n\t\tthis.line.updateMatrix();\n\n\t\tthis.cone.scale.set( headWidth, headLength, headWidth );\n\t\tthis.cone.position.y = length;\n\t\tthis.cone.updateMatrix();\n\n\t}\n\n\tsetColor( color ) {\n\n\t\tthis.line.material.color.set( color );\n\t\tthis.cone.material.color.set( color );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source, false );\n\n\t\tthis.line.copy( source.line );\n\t\tthis.cone.copy( source.cone );\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.line.geometry.dispose();\n\t\tthis.line.material.dispose();\n\t\tthis.cone.geometry.dispose();\n\t\tthis.cone.material.dispose();\n\n\t}\n\n}\n\nclass AxesHelper extends LineSegments {\n\n\tconstructor( size = 1 ) {\n\n\t\tconst vertices = [\n\t\t\t0, 0, 0,\tsize, 0, 0,\n\t\t\t0, 0, 0,\t0, size, 0,\n\t\t\t0, 0, 0,\t0, 0, size\n\t\t];\n\n\t\tconst colors = [\n\t\t\t1, 0, 0,\t1, 0.6, 0,\n\t\t\t0, 1, 0,\t0.6, 1, 0,\n\t\t\t0, 0, 1,\t0, 0.6, 1\n\t\t];\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'AxesHelper';\n\n\t}\n\n\tsetColors( xAxisColor, yAxisColor, zAxisColor ) {\n\n\t\tconst color = new Color();\n\t\tconst array = this.geometry.attributes.color.array;\n\n\t\tcolor.set( xAxisColor );\n\t\tcolor.toArray( array, 0 );\n\t\tcolor.toArray( array, 3 );\n\n\t\tcolor.set( yAxisColor );\n\t\tcolor.toArray( array, 6 );\n\t\tcolor.toArray( array, 9 );\n\n\t\tcolor.set( zAxisColor );\n\t\tcolor.toArray( array, 12 );\n\t\tcolor.toArray( array, 15 );\n\n\t\tthis.geometry.attributes.color.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass ShapePath {\n\n\tconstructor() {\n\n\t\tthis.type = 'ShapePath';\n\n\t\tthis.color = new Color();\n\n\t\tthis.subPaths = [];\n\t\tthis.currentPath = null;\n\n\t}\n\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPath = new Path();\n\t\tthis.subPaths.push( this.currentPath );\n\t\tthis.currentPath.moveTo( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tlineTo( x, y ) {\n\n\t\tthis.currentPath.lineTo( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tthis.currentPath.quadraticCurveTo( aCPx, aCPy, aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tthis.currentPath.bezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tsplineThru( pts ) {\n\n\t\tthis.currentPath.splineThru( pts );\n\n\t\treturn this;\n\n\t}\n\n\ttoShapes( isCCW ) {\n\n\t\tfunction toShapesNoHoles( inSubpaths ) {\n\n\t\t\tconst shapes = [];\n\n\t\t\tfor ( let i = 0, l = inSubpaths.length; i < l; i ++ ) {\n\n\t\t\t\tconst tmpPath = inSubpaths[ i ];\n\n\t\t\t\tconst tmpShape = new Shape();\n\t\t\t\ttmpShape.curves = tmpPath.curves;\n\n\t\t\t\tshapes.push( tmpShape );\n\n\t\t\t}\n\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tfunction isPointInsidePolygon( inPt, inPolygon ) {\n\n\t\t\tconst polyLen = inPolygon.length;\n\n\t\t\t// inPt on polygon contour => immediate success or\n\t\t\t// toggling of inside/outside at every single! intersection point of an edge\n\t\t\t// with the horizontal line through inPt, left of inPt\n\t\t\t// not counting lowerY endpoints of edges and whole edges on that line\n\t\t\tlet inside = false;\n\t\t\tfor ( let p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {\n\n\t\t\t\tlet edgeLowPt = inPolygon[ p ];\n\t\t\t\tlet edgeHighPt = inPolygon[ q ];\n\n\t\t\t\tlet edgeDx = edgeHighPt.x - edgeLowPt.x;\n\t\t\t\tlet edgeDy = edgeHighPt.y - edgeLowPt.y;\n\n\t\t\t\tif ( Math.abs( edgeDy ) > Number.EPSILON ) {\n\n\t\t\t\t\t// not parallel\n\t\t\t\t\tif ( edgeDy < 0 ) {\n\n\t\t\t\t\t\tedgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx;\n\t\t\t\t\t\tedgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) \t\tcontinue;\n\n\t\t\t\t\tif ( inPt.y === edgeLowPt.y ) {\n\n\t\t\t\t\t\tif ( inPt.x === edgeLowPt.x )\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\t// continue;\t\t\t\t// no intersection or edgeLowPt => doesn't count !!!\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y );\n\t\t\t\t\t\tif ( perpEdge === 0 )\t\t\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\tif ( perpEdge < 0 ) \t\t\t\tcontinue;\n\t\t\t\t\t\tinside = ! inside;\t\t// true intersection left of inPt\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// parallel or collinear\n\t\t\t\t\tif ( inPt.y !== edgeLowPt.y ) \t\tcontinue;\t\t\t// parallel\n\t\t\t\t\t// edge lies on the same horizontal line as inPt\n\t\t\t\t\tif ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) ||\n\t\t\t\t\t\t ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) )\t\treturn\ttrue;\t// inPt: Point on contour !\n\t\t\t\t\t// continue;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn\tinside;\n\n\t\t}\n\n\t\tconst isClockWise = ShapeUtils.isClockWise;\n\n\t\tconst subPaths = this.subPaths;\n\t\tif ( subPaths.length === 0 ) return [];\n\n\t\tlet solid, tmpPath, tmpShape;\n\t\tconst shapes = [];\n\n\t\tif ( subPaths.length === 1 ) {\n\n\t\t\ttmpPath = subPaths[ 0 ];\n\t\t\ttmpShape = new Shape();\n\t\t\ttmpShape.curves = tmpPath.curves;\n\t\t\tshapes.push( tmpShape );\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tlet holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() );\n\t\tholesFirst = isCCW ? ! holesFirst : holesFirst;\n\n\t\t// console.log(\"Holes first\", holesFirst);\n\n\t\tconst betterShapeHoles = [];\n\t\tconst newShapes = [];\n\t\tlet newShapeHoles = [];\n\t\tlet mainIdx = 0;\n\t\tlet tmpPoints;\n\n\t\tnewShapes[ mainIdx ] = undefined;\n\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\tfor ( let i = 0, l = subPaths.length; i < l; i ++ ) {\n\n\t\t\ttmpPath = subPaths[ i ];\n\t\t\ttmpPoints = tmpPath.getPoints();\n\t\t\tsolid = isClockWise( tmpPoints );\n\t\t\tsolid = isCCW ? ! solid : solid;\n\n\t\t\tif ( solid ) {\n\n\t\t\t\tif ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) )\tmainIdx ++;\n\n\t\t\t\tnewShapes[ mainIdx ] = { s: new Shape(), p: tmpPoints };\n\t\t\t\tnewShapes[ mainIdx ].s.curves = tmpPath.curves;\n\n\t\t\t\tif ( holesFirst )\tmainIdx ++;\n\t\t\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\t\t\t//console.log('cw', i);\n\n\t\t\t} else {\n\n\t\t\t\tnewShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );\n\n\t\t\t\t//console.log('ccw', i);\n\n\t\t\t}\n\n\t\t}\n\n\t\t// only Holes? -> probably all Shapes with wrong orientation\n\t\tif ( ! newShapes[ 0 ] )\treturn\ttoShapesNoHoles( subPaths );\n\n\n\t\tif ( newShapes.length > 1 ) {\n\n\t\t\tlet ambiguous = false;\n\t\t\tlet toChange = 0;\n\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tbetterShapeHoles[ sIdx ] = [];\n\n\t\t\t}\n\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tconst sho = newShapeHoles[ sIdx ];\n\n\t\t\t\tfor ( let hIdx = 0; hIdx < sho.length; hIdx ++ ) {\n\n\t\t\t\t\tconst ho = sho[ hIdx ];\n\t\t\t\t\tlet hole_unassigned = true;\n\n\t\t\t\t\tfor ( let s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {\n\n\t\t\t\t\t\tif ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {\n\n\t\t\t\t\t\t\tif ( sIdx !== s2Idx )\ttoChange ++;\n\n\t\t\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\t\t\thole_unassigned = false;\n\t\t\t\t\t\t\t\tbetterShapeHoles[ s2Idx ].push( ho );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tambiguous = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\tbetterShapeHoles[ sIdx ].push( ho );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( toChange > 0 && ambiguous === false ) {\n\n\t\t\t\tnewShapeHoles = betterShapeHoles;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet tmpHoles;\n\n\t\tfor ( let i = 0, il = newShapes.length; i < il; i ++ ) {\n\n\t\t\ttmpShape = newShapes[ i ].s;\n\t\t\tshapes.push( tmpShape );\n\t\t\ttmpHoles = newShapeHoles[ i ];\n\n\t\t\tfor ( let j = 0, jl = tmpHoles.length; j < jl; j ++ ) {\n\n\t\t\t\ttmpShape.holes.push( tmpHoles[ j ].h );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//console.log(\"shape\", shapes);\n\n\t\treturn shapes;\n\n\t}\n\n}\n\nif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: {\n\t\trevision: REVISION,\n\t} } ) );\n\n}\n\nif ( typeof window !== 'undefined' ) {\n\n\tif ( window.__THREE__ ) {\n\n\t\tconsole.warn( 'WARNING: Multiple instances of Three.js being imported.' );\n\n\t} else {\n\n\t\twindow.__THREE__ = REVISION;\n\n\t}\n\n}\n\nexport { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DisplayP3ColorSpace, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, Float64BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearDisplayP3ColorSpace, LinearEncoding, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, P3Primaries, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, Rec709Primaries, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, TwoPassDoubleSide, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoTexture, WebGL1Renderer, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, _SRGBAFormat, createCanvasElement, sRGBEncoding };\n"], - "mappings": ";AAKA,IAAM,WAAW;AAEjB,IAAM,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,EAAE;AAC1E,IAAM,QAAQ,EAAE,QAAQ,GAAG,KAAK,GAAG,WAAW,GAAG,cAAc,EAAE;AACjE,IAAM,eAAe;AACrB,IAAM,eAAe;AACrB,IAAM,gBAAgB;AACtB,IAAM,oBAAoB;AAC1B,IAAM,iBAAiB;AACvB,IAAM,eAAe;AACrB,IAAM,mBAAmB;AACzB,IAAM,eAAe;AACrB,IAAM,YAAY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AAW,KAAM,EAAE,CAAE,GAAI;AAEzD,kBAAK,SAAS;AAAQ;AAEtB,kBAAK,iBAAkB;AAEtB,kCAAkB;AAClB,iCAAkB,KAAM,EAAE,KAAM,EAAG;AAAA,cAEpC,OAAO;AAEN,4BAAY;AAAA,cAEb;AAAA,YAED;AAAA,UAED;AAEA,cAAK,iBAAkB;AAEtB,6BAAkB,IAAK,EAAE,KAAM,EAAG;AAAA,UAEnC;AAAA,QAED;AAAA,MAED;AAEA,UAAK,WAAW,KAAK,cAAc,OAAQ;AAE1C,wBAAgB;AAAA,MAEjB;AAAA,IAED;AAEA,QAAI;AAEJ,aAAU,IAAI,GAAG,KAAK,UAAU,QAAQ,IAAI,IAAI,KAAO;AAEtD,iBAAW,UAAW,CAAE,EAAE;AAC1B,aAAO,KAAM,QAAS;AACtB,iBAAW,cAAe,CAAE;AAE5B,eAAU,IAAI,GAAG,KAAK,SAAS,QAAQ,IAAI,IAAI,KAAO;AAErD,iBAAS,MAAM,KAAM,SAAU,CAAE,EAAE,CAAE;AAAA,MAEtC;AAAA,IAED;AAIA,WAAO;AAAA,EAER;AAED;AAEA,IAAK,OAAO,uBAAuB,aAAc;AAEhD,qBAAmB,cAAe,IAAI,YAAa,YAAY,EAAE,QAAQ;AAAA,IACxE,UAAU;AAAA,EACX,EAAE,CAAE,CAAE;AAEP;AAEA,IAAK,OAAO,WAAW,aAAc;AAEpC,MAAK,OAAO,WAAY;AAEvB,YAAQ,KAAM,yDAA0D;AAAA,EAEzE,OAAO;AAEN,WAAO,YAAY;AAAA,EAEpB;AAED;", - "names": ["tmp", "sign", "data", "tmp2", "indices", "intersects", "width", "height", "depth", "fov", "aspect", "renderer", "scene", "alpha", "attributes", "extension", "precision", "x", "self", "drawBuffers", "scissor", "viewport", "_canvas", "texture", "i", "cameraL", "cameraR", "cameras", "cameraXR", "info", "_projScreenMatrix", "_vector2", "_vector3", "context", "stencil", "materials", "currentRenderList", "parameters", "framebuffer", "vertex", "detail", "radius", "azimuth", "px", "py", "bs", "contour", "p", "q", "json", "now", "shapes", "tmpPath", "tmpShape"] -} diff --git a/node_modules/.vite/deps/chunk-MIR452EH.js b/node_modules/.vite/deps/chunk-MIR452EH.js deleted file mode 100644 index 357b6bf2..00000000 --- a/node_modules/.vite/deps/chunk-MIR452EH.js +++ /dev/null @@ -1,823 +0,0 @@ -// node_modules/@adraffy/ens-normalize/dist/index.mjs -var COMPRESSED$1 = "AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRAN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jYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI"; -var FENCED = /* @__PURE__ */ new Map([[8217, "apostrophe"], [8260, "fraction slash"], [12539, "middle dot"]]); -var NSM_MAX = 4; -function decode_arithmetic(bytes) { - let pos = 0; - function u16() { - return bytes[pos++] << 8 | bytes[pos++]; - } - let symbol_count = u16(); - let total = 1; - let acc = [0, 1]; - for (let i = 1; i < symbol_count; i++) { - acc.push(total += u16()); - } - let skip = u16(); - let pos_payload = pos; - pos += skip; - let read_width = 0; - let read_buffer = 0; - function read_bit() { - if (read_width == 0) { - read_buffer = read_buffer << 8 | bytes[pos++]; - read_width = 8; - } - return read_buffer >> --read_width & 1; - } - const N = 31; - const FULL = 2 ** N; - const HALF = FULL >>> 1; - const QRTR = HALF >> 1; - const MASK = FULL - 1; - let register = 0; - for (let i = 0; i < N; i++) - register = register << 1 | read_bit(); - let symbols = []; - let low = 0; - let range = FULL; - while (true) { - let value = Math.floor(((register - low + 1) * total - 1) / range); - let start = 0; - let end = symbol_count; - while (end - start > 1) { - let mid = start + end >>> 1; - if (value < acc[mid]) { - end = mid; - } else { - start = mid; - } - } - if (start == 0) - break; - symbols.push(start); - let a = low + Math.floor(range * acc[start] / total); - let b = low + Math.floor(range * acc[start + 1] / total) - 1; - while (((a ^ b) & HALF) == 0) { - register = register << 1 & MASK | read_bit(); - a = a << 1 & MASK; - b = b << 1 & MASK | 1; - } - while (a & ~b & QRTR) { - register = register & HALF | register << 1 & MASK >>> 1 | read_bit(); - a = a << 1 ^ HALF; - b = (b ^ HALF) << 1 | HALF | 1; - } - low = a; - range = 1 + b - a; - } - let offset = symbol_count - 4; - return symbols.map((x) => { - switch (x - offset) { - case 3: - return offset + 65792 + (bytes[pos_payload++] << 16 | bytes[pos_payload++] << 8 | bytes[pos_payload++]); - case 2: - return offset + 256 + (bytes[pos_payload++] << 8 | bytes[pos_payload++]); - case 1: - return offset + bytes[pos_payload++]; - default: - return x - 1; - } - }); -} -function read_payload(v) { - let pos = 0; - return () => v[pos++]; -} -function read_compressed_payload(s) { - return read_payload(decode_arithmetic(unsafe_atob(s))); -} -function unsafe_atob(s) { - let lookup = []; - [..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((c, i) => lookup[c.charCodeAt(0)] = i); - let n = s.length; - let ret = new Uint8Array(6 * n >> 3); - for (let i = 0, pos = 0, width = 0, carry = 0; i < n; i++) { - carry = carry << 6 | lookup[s.charCodeAt(i)]; - width += 6; - if (width >= 8) { - ret[pos++] = carry >> (width -= 8); - } - } - return ret; -} -function signed(i) { - return i & 1 ? ~i >> 1 : i >> 1; -} -function read_deltas(n, next) { - let v = Array(n); - for (let i = 0, x = 0; i < n; i++) - v[i] = x += signed(next()); - return v; -} -function read_sorted(next, prev = 0) { - let ret = []; - while (true) { - let x = next(); - let n = next(); - if (!n) - break; - prev += x; - for (let i = 0; i < n; i++) { - ret.push(prev + i); - } - prev += n + 1; - } - return ret; -} -function read_sorted_arrays(next) { - return read_array_while(() => { - let v = read_sorted(next); - if (v.length) - return v; - }); -} -function read_mapped(next) { - let ret = []; - while (true) { - let w = next(); - if (w == 0) - break; - ret.push(read_linear_table(w, next)); - } - while (true) { - let w = next() - 1; - if (w < 0) - break; - ret.push(read_replacement_table(w, next)); - } - return ret.flat(); -} -function read_array_while(next) { - let v = []; - while (true) { - let x = next(v.length); - if (!x) - break; - v.push(x); - } - return v; -} -function read_transposed(n, w, next) { - let m = Array(n).fill().map(() => []); - for (let i = 0; i < w; i++) { - read_deltas(n, next).forEach((x, j) => m[j].push(x)); - } - return m; -} -function read_linear_table(w, next) { - let dx = 1 + next(); - let dy = next(); - let vN = read_array_while(next); - let m = read_transposed(vN.length, 1 + w, next); - return m.flatMap((v, i) => { - let [x, ...ys] = v; - return Array(vN[i]).fill().map((_, j) => { - let j_dy = j * dy; - return [x + j * dx, ys.map((y) => y + j_dy)]; - }); - }); -} -function read_replacement_table(w, next) { - let n = 1 + next(); - let m = read_transposed(n, 1 + w, next); - return m.map((v) => [v[0], v.slice(1)]); -} -function read_trie(next) { - let ret = []; - let sorted = read_sorted(next); - expand(decode([]), []); - return ret; - function decode(Q) { - let S = next(); - let B = read_array_while(() => { - let cps = read_sorted(next).map((i) => sorted[i]); - if (cps.length) - return decode(cps); - }); - return { S, B, Q }; - } - function expand({ S, B }, cps, saved) { - if (S & 4 && saved === cps[cps.length - 1]) - return; - if (S & 2) - saved = cps[cps.length - 1]; - if (S & 1) - ret.push(cps); - for (let br of B) { - for (let cp of br.Q) { - expand(br, [...cps, cp], saved); - } - } - } -} -function hex_cp(cp) { - return cp.toString(16).toUpperCase().padStart(2, "0"); -} -function quote_cp(cp) { - return `{${hex_cp(cp)}}`; -} -function explode_cp(s) { - let cps = []; - for (let pos = 0, len = s.length; pos < len; ) { - let cp = s.codePointAt(pos); - pos += cp < 65536 ? 1 : 2; - cps.push(cp); - } - return cps; -} -function str_from_cps(cps) { - const chunk = 4096; - let len = cps.length; - if (len < chunk) - return String.fromCodePoint(...cps); - let buf = []; - for (let i = 0; i < len; ) { - buf.push(String.fromCodePoint(...cps.slice(i, i += chunk))); - } - return buf.join(""); -} -function compare_arrays(a, b) { - let n = a.length; - let c = n - b.length; - for (let i = 0; c == 0 && i < n; i++) - c = a[i] - b[i]; - return c; -} -var COMPRESSED = "AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgsj26PTQyy8FfEQ8AY8IPAGcEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJF8AJpIBpob5AERSMAKNoAXqaQLUBMCzEiACnwRZEkkVsS7tANAsBG0RuAQLEPABv9HICTUBXigPZwRBApMDOwAamhtaABqEAY8KvKx3LQ4ArAB8UhwEBAVSagD8AEFZADkBIadVj2UMUgx5Il4ANQC9AxIB1BlbEPMAs30CGxlXAhwZKQIECBc6EbsCoxngzv7UzRQA8M0BawL6ZwkN7wABAD33OQRcsgLJCjMCjqUChtw/km+NAsXPAoP2BT84PwURAK0RAvptb6cApQS/OMMey5HJS84UdxpxTPkCogVFITaTOwERAK5pAvkNBOVyA7q3BKlOJSALAgUIBRcEdASpBXqzABXFSWZOawLCOqw//AolCZdvv3dSBkEQGyelEPcMMwG1ATsN7UvYBPEGOwTJH30ZGQ/NlZwIpS3dDO0m4y6hgFoj9SqDBe1L9DzdC01RaA9ZC2UJ4zpjgU4DIQENIosK3Q05CG0Q8wrJaw3lEUUHOQPVSZoApQcBCxEdNRW1JhBirAsJOXc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var L0 = 4352; -var V0 = 4449; -var T0 = 4519; -var L_COUNT = 19; -var V_COUNT = 21; -var T_COUNT = 28; -var N_COUNT = V_COUNT * T_COUNT; -var S_COUNT = L_COUNT * N_COUNT; -var S1 = S0 + S_COUNT; -var L1 = L0 + L_COUNT; -var V1 = V0 + V_COUNT; -var T1 = T0 + T_COUNT; -function unpack_cc(packed) { - return packed >> 24 & 255; -} -function unpack_cp(packed) { - return packed & 16777215; -} -var SHIFTED_RANK; -var EXCLUSIONS; -var DECOMP; -var RECOMP; -function init$1() { - let r = read_compressed_payload(COMPRESSED); - SHIFTED_RANK = new Map(read_sorted_arrays(r).flatMap((v, i) => v.map((x) => [x, i + 1 << 24]))); - EXCLUSIONS = new Set(read_sorted(r)); - DECOMP = /* @__PURE__ */ new Map(); - RECOMP = /* @__PURE__ */ new Map(); - for (let [cp, cps] of read_mapped(r)) { - if (!EXCLUSIONS.has(cp) && cps.length == 2) { - let [a, b] = cps; - let bucket = RECOMP.get(a); - if (!bucket) { - bucket = /* @__PURE__ */ new Map(); - RECOMP.set(a, bucket); - } - bucket.set(b, cp); - } - DECOMP.set(cp, cps.reverse()); - } -} -function is_hangul(cp) { - return cp >= S0 && cp < S1; -} -function compose_pair(a, b) { - if (a >= L0 && a < L1 && b >= V0 && b < V1) { - return S0 + (a - L0) * N_COUNT + (b - V0) * T_COUNT; - } else if (is_hangul(a) && b > T0 && b < T1 && (a - S0) % T_COUNT == 0) { - return a + (b - T0); - } else { - let recomp = RECOMP.get(a); - if (recomp) { - recomp = recomp.get(b); - if (recomp) { - return recomp; - } - } - return -1; - } -} -function decomposed(cps) { - if (!SHIFTED_RANK) - init$1(); - let ret = []; - let buf = []; - let check_order = false; - function add(cp) { - let cc = SHIFTED_RANK.get(cp); - if (cc) { - check_order = true; - cp |= cc; - } - ret.push(cp); - } - for (let cp of cps) { - while (true) { - if (cp < 128) { - ret.push(cp); - } else if (is_hangul(cp)) { - let s_index = cp - S0; - let l_index = s_index / N_COUNT | 0; - let v_index = s_index % N_COUNT / T_COUNT | 0; - let t_index = s_index % T_COUNT; - add(L0 + l_index); - add(V0 + v_index); - if (t_index > 0) - add(T0 + t_index); - } else { - let mapped = DECOMP.get(cp); - if (mapped) { - buf.push(...mapped); - } else { - add(cp); - } - } - if (!buf.length) - break; - cp = buf.pop(); - } - } - if (check_order && ret.length > 1) { - let prev_cc = unpack_cc(ret[0]); - for (let i = 1; i < ret.length; i++) { - let cc = unpack_cc(ret[i]); - if (cc == 0 || prev_cc <= cc) { - prev_cc = cc; - continue; - } - let j = i - 1; - while (true) { - let tmp = ret[j + 1]; - ret[j + 1] = ret[j]; - ret[j] = tmp; - if (!j) - break; - prev_cc = unpack_cc(ret[--j]); - if (prev_cc <= cc) - break; - } - prev_cc = unpack_cc(ret[i]); - } - } - return ret; -} -function composed_from_decomposed(v) { - let ret = []; - let stack = []; - let prev_cp = -1; - let prev_cc = 0; - for (let packed of v) { - let cc = unpack_cc(packed); - let cp = unpack_cp(packed); - if (prev_cp == -1) { - if (cc == 0) { - prev_cp = cp; - } else { - ret.push(cp); - } - } else if (prev_cc > 0 && prev_cc >= cc) { - if (cc == 0) { - ret.push(prev_cp, ...stack); - stack.length = 0; - prev_cp = cp; - } else { - stack.push(cp); - } - prev_cc = cc; - } else { - let composed = compose_pair(prev_cp, cp); - if (composed >= 0) { - prev_cp = composed; - } else if (prev_cc == 0 && cc == 0) { - ret.push(prev_cp); - prev_cp = cp; - } else { - stack.push(cp); - prev_cc = cc; - } - } - } - if (prev_cp >= 0) { - ret.push(prev_cp, ...stack); - } - return ret; -} -function nfd(cps) { - return decomposed(cps).map(unpack_cp); -} -function nfc(cps) { - return composed_from_decomposed(decomposed(cps)); -} -var HYPHEN = 45; -var STOP_CH = "."; -var FE0F = 65039; -var UNIQUE_PH = 1; -var Array_from = (x) => Array.from(x); -function group_has_cp(g, cp) { - return g.P.has(cp) || g.Q.has(cp); -} -var Emoji = class extends Array { - get is_emoji() { - return true; - } - // free tagging system -}; -var MAPPED; -var IGNORED; -var CM; -var NSM; -var ESCAPE; -var NFC_CHECK; -var GROUPS; -var WHOLE_VALID; -var WHOLE_MAP; -var VALID; -var EMOJI_LIST; -var EMOJI_ROOT; -function init() { - if (MAPPED) - return; - let r = read_compressed_payload(COMPRESSED$1); - const read_sorted_array = () => read_sorted(r); - const read_sorted_set = () => new Set(read_sorted_array()); - const set_add_many = (set, v) => v.forEach((x) => set.add(x)); - MAPPED = new Map(read_mapped(r)); - IGNORED = read_sorted_set(); - CM = read_sorted_array(); - NSM = new Set(read_sorted_array().map((i) => CM[i])); - CM = new Set(CM); - ESCAPE = read_sorted_set(); - NFC_CHECK = read_sorted_set(); - let chunks = read_sorted_arrays(r); - let unrestricted = r(); - const read_chunked = () => { - let set = /* @__PURE__ */ new Set(); - read_sorted_array().forEach((i) => set_add_many(set, chunks[i])); - set_add_many(set, read_sorted_array()); - return set; - }; - GROUPS = read_array_while((i) => { - let N = read_array_while(r).map((x) => x + 96); - if (N.length) { - let R = i >= unrestricted; - N[0] -= 32; - N = str_from_cps(N); - if (R) - N = `Restricted[${N}]`; - let P = read_chunked(); - let Q = read_chunked(); - let M = !r(); - return { N, P, Q, M, R }; - } - }); - WHOLE_VALID = read_sorted_set(); - WHOLE_MAP = /* @__PURE__ */ new Map(); - let wholes = read_sorted_array().concat(Array_from(WHOLE_VALID)).sort((a, b) => a - b); - wholes.forEach((cp, i) => { - let d = r(); - let w = wholes[i] = d ? wholes[i - d] : { V: [], M: /* @__PURE__ */ new Map() }; - w.V.push(cp); - if (!WHOLE_VALID.has(cp)) { - WHOLE_MAP.set(cp, w); - } - }); - for (let { V, M } of new Set(WHOLE_MAP.values())) { - let recs = []; - for (let cp of V) { - let gs = GROUPS.filter((g) => group_has_cp(g, cp)); - let rec = recs.find(({ G }) => gs.some((g) => G.has(g))); - if (!rec) { - rec = { G: /* @__PURE__ */ new Set(), V: [] }; - recs.push(rec); - } - rec.V.push(cp); - set_add_many(rec.G, gs); - } - let union = recs.flatMap((x) => Array_from(x.G)); - for (let { G, V: V2 } of recs) { - let complement = new Set(union.filter((g) => !G.has(g))); - for (let cp of V2) { - M.set(cp, complement); - } - } - } - VALID = /* @__PURE__ */ new Set(); - let multi = /* @__PURE__ */ new Set(); - const add_to_union = (cp) => VALID.has(cp) ? multi.add(cp) : VALID.add(cp); - for (let g of GROUPS) { - for (let cp of g.P) - add_to_union(cp); - for (let cp of g.Q) - add_to_union(cp); - } - for (let cp of VALID) { - if (!WHOLE_MAP.has(cp) && !multi.has(cp)) { - WHOLE_MAP.set(cp, UNIQUE_PH); - } - } - set_add_many(VALID, nfd(VALID)); - EMOJI_LIST = read_trie(r).map((v) => Emoji.from(v)).sort(compare_arrays); - EMOJI_ROOT = /* @__PURE__ */ new Map(); - for (let cps of EMOJI_LIST) { - let prev = [EMOJI_ROOT]; - for (let cp of cps) { - let next = prev.map((node) => { - let child = node.get(cp); - if (!child) { - child = /* @__PURE__ */ new Map(); - node.set(cp, child); - } - return child; - }); - if (cp === FE0F) { - prev.push(...next); - } else { - prev = next; - } - } - for (let x of prev) { - x.V = cps; - } - } -} -function quoted_cp(cp) { - return (should_escape(cp) ? "" : `${bidi_qq(safe_str_from_cps([cp]))} `) + quote_cp(cp); -} -function bidi_qq(s) { - return `"${s}"‎`; -} -function check_label_extension(cps) { - if (cps.length >= 4 && cps[2] == HYPHEN && cps[3] == HYPHEN) { - throw new Error(`invalid label extension: "${str_from_cps(cps.slice(0, 4))}"`); - } -} -function check_leading_underscore(cps) { - const UNDERSCORE = 95; - for (let i = cps.lastIndexOf(UNDERSCORE); i > 0; ) { - if (cps[--i] !== UNDERSCORE) { - throw new Error("underscore allowed only at start"); - } - } -} -function check_fenced(cps) { - let cp = cps[0]; - let prev = FENCED.get(cp); - if (prev) - throw error_placement(`leading ${prev}`); - let n = cps.length; - let last = -1; - for (let i = 1; i < n; i++) { - cp = cps[i]; - let match = FENCED.get(cp); - if (match) { - if (last == i) - throw error_placement(`${prev} + ${match}`); - last = i + 1; - prev = match; - } - } - if (last == n) - throw error_placement(`trailing ${prev}`); -} -function safe_str_from_cps(cps, max = Infinity, quoter = quote_cp) { - let buf = []; - if (is_combining_mark(cps[0])) - buf.push("◌"); - if (cps.length > max) { - max >>= 1; - cps = [...cps.slice(0, max), 8230, ...cps.slice(-max)]; - } - let prev = 0; - let n = cps.length; - for (let i = 0; i < n; i++) { - let cp = cps[i]; - if (should_escape(cp)) { - buf.push(str_from_cps(cps.slice(prev, i))); - buf.push(quoter(cp)); - prev = i + 1; - } - } - buf.push(str_from_cps(cps.slice(prev, n))); - return buf.join(""); -} -function is_combining_mark(cp) { - init(); - return CM.has(cp); -} -function should_escape(cp) { - init(); - return ESCAPE.has(cp); -} -function ens_normalize(name) { - return flatten(split(name, nfc, filter_fe0f)); -} -function split(name, nf, ef) { - if (!name) - return []; - init(); - let offset = 0; - return name.split(STOP_CH).map((label) => { - let input = explode_cp(label); - let info = { - input, - offset - // codepoint, not substring! - }; - offset += input.length + 1; - try { - let tokens = info.tokens = tokens_from_str(input, nf, ef); - let token_count = tokens.length; - let type; - if (!token_count) { - throw new Error(`empty label`); - } - let norm = info.output = tokens.flat(); - check_leading_underscore(norm); - let emoji = info.emoji = token_count > 1 || tokens[0].is_emoji; - if (!emoji && norm.every((cp) => cp < 128)) { - check_label_extension(norm); - type = "ASCII"; - } else { - let chars = tokens.flatMap((x) => x.is_emoji ? [] : x); - if (!chars.length) { - type = "Emoji"; - } else { - if (CM.has(norm[0])) - throw error_placement("leading combining mark"); - for (let i = 1; i < token_count; i++) { - let cps = tokens[i]; - if (!cps.is_emoji && CM.has(cps[0])) { - throw error_placement(`emoji + combining mark: "${str_from_cps(tokens[i - 1])} + ${safe_str_from_cps([cps[0]])}"`); - } - } - check_fenced(norm); - let unique = Array_from(new Set(chars)); - let [g] = determine_group(unique); - check_group(g, chars); - check_whole(g, unique); - type = g.N; - } - } - info.type = type; - } catch (err) { - info.error = err; - } - return info; - }); -} -function check_whole(group, unique) { - let maker; - let shared = []; - for (let cp of unique) { - let whole = WHOLE_MAP.get(cp); - if (whole === UNIQUE_PH) - return; - if (whole) { - let set = whole.M.get(cp); - maker = maker ? maker.filter((g) => set.has(g)) : Array_from(set); - if (!maker.length) - return; - } else { - shared.push(cp); - } - } - if (maker) { - for (let g of maker) { - if (shared.every((cp) => group_has_cp(g, cp))) { - throw new Error(`whole-script confusable: ${group.N}/${g.N}`); - } - } - } -} -function determine_group(unique) { - let groups = GROUPS; - for (let cp of unique) { - let gs = groups.filter((g) => group_has_cp(g, cp)); - if (!gs.length) { - if (!GROUPS.some((g) => group_has_cp(g, cp))) { - throw error_disallowed(cp); - } else { - throw error_group_member(groups[0], cp); - } - } - groups = gs; - if (gs.length == 1) - break; - } - return groups; -} -function flatten(split2) { - return split2.map(({ input, error, output }) => { - if (error) { - let msg = error.message; - throw new Error(split2.length == 1 ? msg : `Invalid label ${bidi_qq(safe_str_from_cps(input, 63))}: ${msg}`); - } - return str_from_cps(output); - }).join(STOP_CH); -} -function error_disallowed(cp) { - return new Error(`disallowed character: ${quoted_cp(cp)}`); -} -function error_group_member(g, cp) { - let quoted = quoted_cp(cp); - let gg = GROUPS.find((g2) => g2.P.has(cp)); - if (gg) { - quoted = `${gg.N} ${quoted}`; - } - return new Error(`illegal mixture: ${g.N} + ${quoted}`); -} -function error_placement(where) { - return new Error(`illegal placement: ${where}`); -} -function check_group(g, cps) { - for (let cp of cps) { - if (!group_has_cp(g, cp)) { - throw error_group_member(g, cp); - } - } - if (g.M) { - let decomposed2 = nfd(cps); - for (let i = 1, e = decomposed2.length; i < e; i++) { - if (NSM.has(decomposed2[i])) { - let j = i + 1; - for (let cp; j < e && NSM.has(cp = decomposed2[j]); j++) { - for (let k = i; k < j; k++) { - if (decomposed2[k] == cp) { - throw new Error(`duplicate non-spacing marks: ${quoted_cp(cp)}`); - } - } - } - if (j - i > NSM_MAX) { - throw new Error(`excessive non-spacing marks: ${bidi_qq(safe_str_from_cps(decomposed2.slice(i - 1, j)))} (${j - i}/${NSM_MAX})`); - } - i = j; - } - } - } -} -function tokens_from_str(input, nf, ef) { - let ret = []; - let chars = []; - input = input.slice().reverse(); - while (input.length) { - let emoji = consume_emoji_reversed(input); - if (emoji) { - if (chars.length) { - ret.push(nf(chars)); - chars = []; - } - ret.push(ef(emoji)); - } else { - let cp = input.pop(); - if (VALID.has(cp)) { - chars.push(cp); - } else { - let cps = MAPPED.get(cp); - if (cps) { - chars.push(...cps); - } else if (!IGNORED.has(cp)) { - throw error_disallowed(cp); - } - } - } - } - if (chars.length) { - ret.push(nf(chars)); - } - return ret; -} -function filter_fe0f(cps) { - return cps.filter((cp) => cp != FE0F); -} -function consume_emoji_reversed(cps, eaten) { - let node = EMOJI_ROOT; - let emoji; - let pos = cps.length; - while (pos) { - node = node.get(cps[--pos]); - if (!node) - break; - let { V } = node; - if (V) { - emoji = V; - if (eaten) - eaten.push(...cps.slice(pos).reverse()); - cps.length = pos; - } - } - return emoji; -} - -export { - ens_normalize -}; -//# sourceMappingURL=chunk-MIR452EH.js.map diff --git a/node_modules/.vite/deps/chunk-MIR452EH.js.map b/node_modules/.vite/deps/chunk-MIR452EH.js.map deleted file mode 100644 index b5f12537..00000000 --- a/node_modules/.vite/deps/chunk-MIR452EH.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../../@adraffy/ens-normalize/dist/index.mjs"], - "sourcesContent": ["// created 2023-09-25T01:01:55.148Z\n// compressed base64-encoded blob for include-ens data\n// source: https://github.com/adraffy/ens-normalize.js/blob/main/src/make.js\n// see: https://github.com/adraffy/ens-normalize.js#security\n// SHA-256: 0565ed049b9cf1614bb9e11ba7d8ac6a6fb96c893253d890f7e2b2884b9ded32\nvar COMPRESSED$1 = 'AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABA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ChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI';\nconst FENCED = new Map([[8217,\"apostrophe\"],[8260,\"fraction slash\"],[12539,\"middle dot\"]]);\nconst NSM_MAX = 4;\n\nfunction decode_arithmetic(bytes) {\r\n\tlet pos = 0;\r\n\tfunction u16() { return (bytes[pos++] << 8) | bytes[pos++]; }\r\n\t\r\n\t// decode the frequency table\r\n\tlet symbol_count = u16();\r\n\tlet total = 1;\r\n\tlet acc = [0, 1]; // first symbol has frequency 1\r\n\tfor (let i = 1; i < symbol_count; i++) {\r\n\t\tacc.push(total += u16());\r\n\t}\r\n\r\n\t// skip the sized-payload that the last 3 symbols index into\r\n\tlet skip = u16();\r\n\tlet pos_payload = pos;\r\n\tpos += skip;\r\n\r\n\tlet read_width = 0;\r\n\tlet read_buffer = 0; \r\n\tfunction read_bit() {\r\n\t\tif (read_width == 0) {\r\n\t\t\t// this will read beyond end of buffer\r\n\t\t\t// but (undefined|0) => zero pad\r\n\t\t\tread_buffer = (read_buffer << 8) | bytes[pos++];\r\n\t\t\tread_width = 8;\r\n\t\t}\r\n\t\treturn (read_buffer >> --read_width) & 1;\r\n\t}\r\n\r\n\tconst N = 31;\r\n\tconst FULL = 2**N;\r\n\tconst HALF = FULL >>> 1;\r\n\tconst QRTR = HALF >> 1;\r\n\tconst MASK = FULL - 1;\r\n\r\n\t// fill register\r\n\tlet register = 0;\r\n\tfor (let i = 0; i < N; i++) register = (register << 1) | read_bit();\r\n\r\n\tlet symbols = [];\r\n\tlet low = 0;\r\n\tlet range = FULL; // treat like a float\r\n\twhile (true) {\r\n\t\tlet value = Math.floor((((register - low + 1) * total) - 1) / range);\r\n\t\tlet start = 0;\r\n\t\tlet end = symbol_count;\r\n\t\twhile (end - start > 1) { // binary search\r\n\t\t\tlet mid = (start + end) >>> 1;\r\n\t\t\tif (value < acc[mid]) {\r\n\t\t\t\tend = mid;\r\n\t\t\t} else {\r\n\t\t\t\tstart = mid;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (start == 0) break; // first symbol is end mark\r\n\t\tsymbols.push(start);\r\n\t\tlet a = low + Math.floor(range * acc[start] / total);\r\n\t\tlet b = low + Math.floor(range * acc[start+1] / total) - 1;\r\n\t\twhile (((a ^ b) & HALF) == 0) {\r\n\t\t\tregister = (register << 1) & MASK | read_bit();\r\n\t\t\ta = (a << 1) & MASK;\r\n\t\t\tb = (b << 1) & MASK | 1;\r\n\t\t}\r\n\t\twhile (a & ~b & QRTR) {\r\n\t\t\tregister = (register & HALF) | ((register << 1) & (MASK >>> 1)) | read_bit();\r\n\t\t\ta = (a << 1) ^ HALF;\r\n\t\t\tb = ((b ^ HALF) << 1) | HALF | 1;\r\n\t\t}\r\n\t\tlow = a;\r\n\t\trange = 1 + b - a;\r\n\t}\r\n\tlet offset = symbol_count - 4;\r\n\treturn symbols.map(x => { // index into payload\r\n\t\tswitch (x - offset) {\r\n\t\t\tcase 3: return offset + 0x10100 + ((bytes[pos_payload++] << 16) | (bytes[pos_payload++] << 8) | bytes[pos_payload++]);\r\n\t\t\tcase 2: return offset + 0x100 + ((bytes[pos_payload++] << 8) | bytes[pos_payload++]);\r\n\t\t\tcase 1: return offset + bytes[pos_payload++];\r\n\t\t\tdefault: return x - 1;\r\n\t\t}\r\n\t});\r\n}\t\r\n\r\n// returns an iterator which returns the next symbol\r\nfunction read_payload(v) {\r\n\tlet pos = 0;\r\n\treturn () => v[pos++];\r\n}\r\nfunction read_compressed_payload(s) {\r\n\treturn read_payload(decode_arithmetic(unsafe_atob(s)));\r\n}\r\n\r\n// unsafe in the sense:\r\n// expected well-formed Base64 w/o padding \r\n// 20220922: added for https://github.com/adraffy/ens-normalize.js/issues/4\r\nfunction unsafe_atob(s) {\r\n\tlet lookup = [];\r\n\t[...'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'].forEach((c, i) => lookup[c.charCodeAt(0)] = i);\r\n\tlet n = s.length;\r\n\tlet ret = new Uint8Array((6 * n) >> 3);\r\n\tfor (let i = 0, pos = 0, width = 0, carry = 0; i < n; i++) {\r\n\t\tcarry = (carry << 6) | lookup[s.charCodeAt(i)];\r\n\t\twidth += 6;\r\n\t\tif (width >= 8) {\r\n\t\t\tret[pos++] = (carry >> (width -= 8));\r\n\t\t}\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\n// eg. [0,1,2,3...] => [0,-1,1,-2,...]\r\nfunction signed(i) { \r\n\treturn (i & 1) ? (~i >> 1) : (i >> 1);\r\n}\r\n\r\nfunction read_deltas(n, next) {\r\n\tlet v = Array(n);\r\n\tfor (let i = 0, x = 0; i < n; i++) v[i] = x += signed(next());\r\n\treturn v;\r\n}\r\n\r\n// [123][5] => [0 3] [1 1] [0 0]\r\nfunction read_sorted(next, prev = 0) {\r\n\tlet ret = [];\r\n\twhile (true) {\r\n\t\tlet x = next();\r\n\t\tlet n = next();\r\n\t\tif (!n) break;\r\n\t\tprev += x;\r\n\t\tfor (let i = 0; i < n; i++) {\r\n\t\t\tret.push(prev + i);\r\n\t\t}\r\n\t\tprev += n + 1;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nfunction read_sorted_arrays(next) {\r\n\treturn read_array_while(() => { \r\n\t\tlet v = read_sorted(next);\r\n\t\tif (v.length) return v;\r\n\t});\r\n}\r\n\r\n// returns map of x => ys\r\nfunction read_mapped(next) {\r\n\tlet ret = [];\r\n\twhile (true) {\r\n\t\tlet w = next();\r\n\t\tif (w == 0) break;\r\n\t\tret.push(read_linear_table(w, next));\r\n\t}\r\n\twhile (true) {\r\n\t\tlet w = next() - 1;\r\n\t\tif (w < 0) break;\r\n\t\tret.push(read_replacement_table(w, next));\r\n\t}\r\n\treturn ret.flat();\r\n}\r\n\r\n// read until next is falsy\r\n// return array of read values\r\nfunction read_array_while(next) {\r\n\tlet v = [];\r\n\twhile (true) {\r\n\t\tlet x = next(v.length);\r\n\t\tif (!x) break;\r\n\t\tv.push(x);\r\n\t}\r\n\treturn v;\r\n}\r\n\r\n// read w columns of length n\r\n// return as n rows of length w\r\nfunction read_transposed(n, w, next) {\r\n\tlet m = Array(n).fill().map(() => []);\r\n\tfor (let i = 0; i < w; i++) {\r\n\t\tread_deltas(n, next).forEach((x, j) => m[j].push(x));\r\n\t}\r\n\treturn m;\r\n}\r\n \r\n// returns [[x, ys], [x+dx, ys+dy], [x+2*dx, ys+2*dy], ...]\r\n// where dx/dy = steps, n = run size, w = length of y\r\nfunction read_linear_table(w, next) {\r\n\tlet dx = 1 + next();\r\n\tlet dy = next();\r\n\tlet vN = read_array_while(next);\r\n\tlet m = read_transposed(vN.length, 1+w, next);\r\n\treturn m.flatMap((v, i) => {\r\n\t\tlet [x, ...ys] = v;\r\n\t\treturn Array(vN[i]).fill().map((_, j) => {\r\n\t\t\tlet j_dy = j * dy;\r\n\t\t\treturn [x + j * dx, ys.map(y => y + j_dy)];\r\n\t\t});\r\n\t});\r\n}\r\n\r\n// return [[x, ys...], ...]\r\n// where w = length of y\r\nfunction read_replacement_table(w, next) { \r\n\tlet n = 1 + next();\r\n\tlet m = read_transposed(n, 1+w, next);\r\n\treturn m.map(v => [v[0], v.slice(1)]);\r\n}\r\n\r\n\r\nfunction read_trie(next) {\r\n\tlet ret = [];\r\n\tlet sorted = read_sorted(next); \r\n\texpand(decode([]), []);\r\n\treturn ret; // not sorted\r\n\tfunction decode(Q) { // characters that lead into this node\r\n\t\tlet S = next(); // state: valid, save, check\r\n\t\tlet B = read_array_while(() => { // buckets leading to new nodes\r\n\t\t\tlet cps = read_sorted(next).map(i => sorted[i]);\r\n\t\t\tif (cps.length) return decode(cps);\r\n\t\t});\r\n\t\treturn {S, B, Q};\r\n\t}\r\n\tfunction expand({S, B}, cps, saved) {\r\n\t\tif (S & 4 && saved === cps[cps.length-1]) return;\r\n\t\tif (S & 2) saved = cps[cps.length-1];\r\n\t\tif (S & 1) ret.push(cps); \r\n\t\tfor (let br of B) {\r\n\t\t\tfor (let cp of br.Q) {\r\n\t\t\t\texpand(br, [...cps, cp], saved);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\n\nfunction hex_cp(cp) {\r\n\treturn cp.toString(16).toUpperCase().padStart(2, '0');\r\n}\r\n\r\nfunction quote_cp(cp) {\r\n\treturn `{${hex_cp(cp)}}`; // raffy convention: like \"\\u{X}\" w/o the \"\\u\"\r\n}\r\n\r\n/*\r\nexport function explode_cp(s) {\r\n\treturn [...s].map(c => c.codePointAt(0));\r\n}\r\n*/\r\nfunction explode_cp(s) { // this is about 2x faster\r\n\tlet cps = [];\r\n\tfor (let pos = 0, len = s.length; pos < len; ) {\r\n\t\tlet cp = s.codePointAt(pos);\r\n\t\tpos += cp < 0x10000 ? 1 : 2;\r\n\t\tcps.push(cp);\r\n\t}\r\n\treturn cps;\r\n}\r\n\r\nfunction str_from_cps(cps) {\r\n\tconst chunk = 4096;\r\n\tlet len = cps.length;\r\n\tif (len < chunk) return String.fromCodePoint(...cps);\r\n\tlet buf = [];\r\n\tfor (let i = 0; i < len; ) {\r\n\t\tbuf.push(String.fromCodePoint(...cps.slice(i, i += chunk)));\r\n\t}\r\n\treturn buf.join('');\r\n}\r\n\r\nfunction compare_arrays(a, b) {\r\n\tlet n = a.length;\r\n\tlet c = n - b.length;\r\n\tfor (let i = 0; c == 0 && i < n; i++) c = a[i] - b[i];\r\n\treturn c;\r\n}\n\n// created 2023-09-25T01:01:55.148Z\n// compressed base64-encoded blob for include-nf data\n// source: https://github.com/adraffy/ens-normalize.js/blob/main/src/make.js\n// see: https://github.com/adraffy/ens-normalize.js#security\n// SHA-256: a974b6f8541fc29d919bc85118af0a44015851fab5343f8679cb31be2bdb209e\nvar COMPRESSED = 'AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAM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Lxzm7qFBe7s+quuJs6ETYmnpgS3LwSZxPIltgBDXz8M1k/W2ySNv2f9/NPhxLGK2D21dkHeSGmenRT3Yqcdl0m/h3OYr8V+lXNYGf8aCCpd4bWjE4QIPj7vUKN4Nrfs7ML6Y2OyS830JCnofg/k7lpFpt4SqZc5HGg1HCOrHvOdC8bP6FGDbE/VV0mX4IakzbdS/op+Kt3G24/8QbBV7y86sGSQ/vZzU8FXs7u6jIvwchsEP2BpIhW3G8uWNwa3HmjfH/ZjhhCWvluAcF+nMf14ClKg5hGgtPLJ98ueNAkc5Hs2WZlk2QHvfreCK1CCGO6nMZVSb99VM/ajr8WHTte9JSmkXq/i/U943HEbdzW6Re/S88dKgg8pGOLlAeNiqrcLkUR3/aClFpMXcOUP3rmETcWSfMXZE3TUOi8i+fqRnTYLflVx/Vb/6GJ7eIRZUA6k3RYR3iFSK9c4iDdNwJuZL2FKz/IK5VimcNWEqdXjSoxSgmF0UPlDoUlNrPcM7ftmA8Y9gKiqKEHuWN+AZRIwtVSxye2Kf8rM3lhJ5XcBXU9n4v0Oy1RU2M+4qM8AQPVwse8ErNSob5oFPWxuqZnVzo1qB/IBxkM3EVUKFUUlO3e51259GgNcJbCmlvrdjtoTW7rChm1wyCKzpCTwozUUEOIcWLneRLgMXh+SjGSFkAllzbGS5HK7LlfCMRNRDSvbQPjcXaenNYxCvu2Qyznz6StuxVj66SgI0T8B6/sfHAJYZaZ78thjOSIFumNWLQbeZixDCCC+v0YBtkxiBB3jefHqZ/dFHU+crbj6OvS1x/JDD7vlm7zOVPwpUC01nhxZuY/63E7g';\n\n// https://unicode.org/reports/tr15/\r\n// for reference implementation\r\n// see: /derive/nf.js\r\n\r\n\r\n// algorithmic hangul\r\n// https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf (page 144)\r\nconst S0 = 0xAC00;\r\nconst L0 = 0x1100;\r\nconst V0 = 0x1161;\r\nconst T0 = 0x11A7;\r\nconst L_COUNT = 19;\r\nconst V_COUNT = 21;\r\nconst T_COUNT = 28;\r\nconst N_COUNT = V_COUNT * T_COUNT;\r\nconst S_COUNT = L_COUNT * N_COUNT;\r\nconst S1 = S0 + S_COUNT;\r\nconst L1 = L0 + L_COUNT;\r\nconst V1 = V0 + V_COUNT;\r\nconst T1 = T0 + T_COUNT;\r\n\r\nfunction unpack_cc(packed) {\r\n\treturn (packed >> 24) & 0xFF;\r\n}\r\nfunction unpack_cp(packed) {\r\n\treturn packed & 0xFFFFFF;\r\n}\r\n\r\nlet SHIFTED_RANK, EXCLUSIONS, DECOMP, RECOMP;\r\n\r\nfunction init$1() {\r\n\t//console.time('nf');\r\n\tlet r = read_compressed_payload(COMPRESSED);\r\n\tSHIFTED_RANK = new Map(read_sorted_arrays(r).flatMap((v, i) => v.map(x => [x, (i+1) << 24]))); // pre-shifted\r\n\tEXCLUSIONS = new Set(read_sorted(r));\r\n\tDECOMP = new Map();\r\n\tRECOMP = new Map();\r\n\tfor (let [cp, cps] of read_mapped(r)) {\r\n\t\tif (!EXCLUSIONS.has(cp) && cps.length == 2) {\r\n\t\t\tlet [a, b] = cps;\r\n\t\t\tlet bucket = RECOMP.get(a);\r\n\t\t\tif (!bucket) {\r\n\t\t\t\tbucket = new Map();\r\n\t\t\t\tRECOMP.set(a, bucket);\r\n\t\t\t}\r\n\t\t\tbucket.set(b, cp);\r\n\t\t}\r\n\t\tDECOMP.set(cp, cps.reverse()); // stored reversed\r\n\t}\r\n\t//console.timeEnd('nf');\r\n\t// 20230905: 11ms\r\n}\r\n\r\nfunction is_hangul(cp) {\r\n\treturn cp >= S0 && cp < S1;\r\n}\r\n\r\nfunction compose_pair(a, b) {\r\n\tif (a >= L0 && a < L1 && b >= V0 && b < V1) {\r\n\t\treturn S0 + (a - L0) * N_COUNT + (b - V0) * T_COUNT;\r\n\t} else if (is_hangul(a) && b > T0 && b < T1 && (a - S0) % T_COUNT == 0) {\r\n\t\treturn a + (b - T0);\r\n\t} else {\r\n\t\tlet recomp = RECOMP.get(a);\r\n\t\tif (recomp) {\r\n\t\t\trecomp = recomp.get(b);\r\n\t\t\tif (recomp) {\r\n\t\t\t\treturn recomp;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n}\r\n\r\nfunction decomposed(cps) {\r\n\tif (!SHIFTED_RANK) init$1();\r\n\tlet ret = [];\r\n\tlet buf = [];\r\n\tlet check_order = false;\r\n\tfunction add(cp) {\r\n\t\tlet cc = SHIFTED_RANK.get(cp);\r\n\t\tif (cc) {\r\n\t\t\tcheck_order = true;\r\n\t\t\tcp |= cc;\r\n\t\t}\r\n\t\tret.push(cp);\r\n\t}\r\n\tfor (let cp of cps) {\r\n\t\twhile (true) {\r\n\t\t\tif (cp < 0x80) {\r\n\t\t\t\tret.push(cp);\r\n\t\t\t} else if (is_hangul(cp)) {\r\n\t\t\t\tlet s_index = cp - S0;\r\n\t\t\t\tlet l_index = s_index / N_COUNT | 0;\r\n\t\t\t\tlet v_index = (s_index % N_COUNT) / T_COUNT | 0;\r\n\t\t\t\tlet t_index = s_index % T_COUNT;\r\n\t\t\t\tadd(L0 + l_index);\r\n\t\t\t\tadd(V0 + v_index);\r\n\t\t\t\tif (t_index > 0) add(T0 + t_index);\r\n\t\t\t} else {\r\n\t\t\t\tlet mapped = DECOMP.get(cp);\r\n\t\t\t\tif (mapped) {\r\n\t\t\t\t\tbuf.push(...mapped);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tadd(cp);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (!buf.length) break;\r\n\t\t\tcp = buf.pop();\r\n\t\t}\r\n\t}\r\n\tif (check_order && ret.length > 1) {\r\n\t\tlet prev_cc = unpack_cc(ret[0]);\r\n\t\tfor (let i = 1; i < ret.length; i++) {\r\n\t\t\tlet cc = unpack_cc(ret[i]);\r\n\t\t\tif (cc == 0 || prev_cc <= cc) {\r\n\t\t\t\tprev_cc = cc;\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tlet j = i-1;\r\n\t\t\twhile (true) {\r\n\t\t\t\tlet tmp = ret[j+1];\r\n\t\t\t\tret[j+1] = ret[j];\r\n\t\t\t\tret[j] = tmp;\r\n\t\t\t\tif (!j) break;\r\n\t\t\t\tprev_cc = unpack_cc(ret[--j]);\r\n\t\t\t\tif (prev_cc <= cc) break;\r\n\t\t\t}\r\n\t\t\tprev_cc = unpack_cc(ret[i]);\r\n\t\t}\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nfunction composed_from_decomposed(v) {\r\n\tlet ret = [];\r\n\tlet stack = [];\r\n\tlet prev_cp = -1;\r\n\tlet prev_cc = 0;\r\n\tfor (let packed of v) {\r\n\t\tlet cc = unpack_cc(packed);\r\n\t\tlet cp = unpack_cp(packed);\r\n\t\tif (prev_cp == -1) {\r\n\t\t\tif (cc == 0) {\r\n\t\t\t\tprev_cp = cp;\r\n\t\t\t} else {\r\n\t\t\t\tret.push(cp);\r\n\t\t\t}\r\n\t\t} else if (prev_cc > 0 && prev_cc >= cc) {\r\n\t\t\tif (cc == 0) {\r\n\t\t\t\tret.push(prev_cp, ...stack);\r\n\t\t\t\tstack.length = 0;\r\n\t\t\t\tprev_cp = cp;\r\n\t\t\t} else {\r\n\t\t\t\tstack.push(cp);\r\n\t\t\t}\r\n\t\t\tprev_cc = cc;\r\n\t\t} else {\r\n\t\t\tlet composed = compose_pair(prev_cp, cp);\r\n\t\t\tif (composed >= 0) {\r\n\t\t\t\tprev_cp = composed;\r\n\t\t\t} else if (prev_cc == 0 && cc == 0) {\r\n\t\t\t\tret.push(prev_cp);\r\n\t\t\t\tprev_cp = cp;\r\n\t\t\t} else {\r\n\t\t\t\tstack.push(cp);\r\n\t\t\t\tprev_cc = cc;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif (prev_cp >= 0) {\r\n\t\tret.push(prev_cp, ...stack);\t\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\n// note: cps can be iterable\r\nfunction nfd(cps) {\r\n\treturn decomposed(cps).map(unpack_cp);\r\n}\r\nfunction nfc(cps) {\r\n\treturn composed_from_decomposed(decomposed(cps));\r\n}\n\nconst HYPHEN = 0x2D;\r\nconst STOP = 0x2E;\r\nconst STOP_CH = '.';\r\nconst FE0F = 0xFE0F;\r\nconst UNIQUE_PH = 1;\r\n\r\n// 20230913: replace [...v] with Array_from(v) to avoid large spreads\r\nconst Array_from = x => Array.from(x); // Array.from.bind(Array);\r\n\r\nfunction group_has_cp(g, cp) {\r\n\t// 20230913: keep primary and secondary distinct instead of creating valid union\r\n\treturn g.P.has(cp) || g.Q.has(cp);\r\n}\r\n\r\nclass Emoji extends Array {\r\n\tget is_emoji() { return true; } // free tagging system\r\n}\r\n\r\nlet MAPPED, IGNORED, CM, NSM, ESCAPE, NFC_CHECK, GROUPS, WHOLE_VALID, WHOLE_MAP, VALID, EMOJI_LIST, EMOJI_ROOT;\r\n\r\nfunction init() {\r\n\tif (MAPPED) return;\r\n\t\r\n\tlet r = read_compressed_payload(COMPRESSED$1);\r\n\tconst read_sorted_array = () => read_sorted(r);\r\n\tconst read_sorted_set = () => new Set(read_sorted_array());\r\n\tconst set_add_many = (set, v) => v.forEach(x => set.add(x));\r\n\r\n\tMAPPED = new Map(read_mapped(r)); \r\n\tIGNORED = read_sorted_set(); // ignored characters are not valid, so just read raw codepoints\r\n\r\n\t/*\r\n\t// direct include from payload is smaller than the decompression code\r\n\tconst FENCED = new Map(read_array_while(() => {\r\n\t\tlet cp = r();\r\n\t\tif (cp) return [cp, read_str(r())];\r\n\t}));\r\n\t*/\r\n\t// 20230217: we still need all CM for proper error formatting\r\n\t// but norm only needs NSM subset that are potentially-valid\r\n\tCM = read_sorted_array();\r\n\tNSM = new Set(read_sorted_array().map(i => CM[i]));\r\n\tCM = new Set(CM);\r\n\t\r\n\tESCAPE = read_sorted_set(); // characters that should not be printed\r\n\tNFC_CHECK = read_sorted_set(); // only needed to illustrate ens_tokenize() transformations\r\n\r\n\tlet chunks = read_sorted_arrays(r);\r\n\tlet unrestricted = r();\r\n\t//const read_chunked = () => new Set(read_sorted_array().flatMap(i => chunks[i]).concat(read_sorted_array()));\r\n\tconst read_chunked = () => {\r\n\t\t// 20230921: build set in parts, 2x faster\r\n\t\tlet set = new Set();\r\n\t\tread_sorted_array().forEach(i => set_add_many(set, chunks[i]));\r\n\t\tset_add_many(set, read_sorted_array());\r\n\t\treturn set; \r\n\t};\r\n\tGROUPS = read_array_while(i => {\r\n\t\t// minifier property mangling seems unsafe\r\n\t\t// so these are manually renamed to single chars\r\n\t\tlet N = read_array_while(r).map(x => x+0x60);\r\n\t\tif (N.length) {\r\n\t\t\tlet R = i >= unrestricted; // unrestricted then restricted\r\n\t\t\tN[0] -= 32; // capitalize\r\n\t\t\tN = str_from_cps(N);\r\n\t\t\tif (R) N=`Restricted[${N}]`;\r\n\t\t\tlet P = read_chunked(); // primary\r\n\t\t\tlet Q = read_chunked(); // secondary\r\n\t\t\tlet M = !r(); // not-whitelisted, check for NSM\r\n\t\t\t// *** this code currently isn't needed ***\r\n\t\t\t/*\r\n\t\t\tlet V = [...P, ...Q].sort((a, b) => a-b); // derive: sorted valid\r\n\t\t\tlet M = r()-1; // number of combining mark\r\n\t\t\tif (M < 0) { // whitelisted\r\n\t\t\t\tM = new Map(read_array_while(() => {\r\n\t\t\t\t\tlet i = r();\r\n\t\t\t\t\tif (i) return [V[i-1], read_array_while(() => {\r\n\t\t\t\t\t\tlet v = read_array_while(r);\r\n\t\t\t\t\t\tif (v.length) return v.map(x => x-1);\r\n\t\t\t\t\t})];\r\n\t\t\t\t}));\r\n\t\t\t}*/\r\n\t\t\treturn {N, P, Q, M, R};\r\n\t\t}\r\n\t});\r\n\r\n\t// decode compressed wholes\r\n\tWHOLE_VALID = read_sorted_set();\r\n\tWHOLE_MAP = new Map();\r\n\tlet wholes = read_sorted_array().concat(Array_from(WHOLE_VALID)).sort((a, b) => a-b); // must be sorted\r\n\twholes.forEach((cp, i) => {\r\n\t\tlet d = r(); \r\n\t\tlet w = wholes[i] = d ? wholes[i-d] : {V: [], M: new Map()};\r\n\t\tw.V.push(cp); // add to member set\r\n\t\tif (!WHOLE_VALID.has(cp)) {\r\n\t\t\tWHOLE_MAP.set(cp, w); // register with whole map\r\n\t\t}\r\n\t});\r\n\r\n\t// compute confusable-extent complements\r\n\t// usage: WHOLE_MAP.get(cp).M.get(cp) = complement set\r\n\tfor (let {V, M} of new Set(WHOLE_MAP.values())) {\r\n\t\t// connect all groups that have each whole character\r\n\t\tlet recs = [];\r\n\t\tfor (let cp of V) {\r\n\t\t\tlet gs = GROUPS.filter(g => group_has_cp(g, cp));\r\n\t\t\tlet rec = recs.find(({G}) => gs.some(g => G.has(g)));\r\n\t\t\tif (!rec) {\r\n\t\t\t\trec = {G: new Set(), V: []};\r\n\t\t\t\trecs.push(rec);\r\n\t\t\t}\r\n\t\t\trec.V.push(cp);\r\n\t\t\tset_add_many(rec.G, gs);\r\n\t\t}\r\n\t\t// per character cache groups which are not a member of the extent\r\n\t\tlet union = recs.flatMap(x => Array_from(x.G)); // all of the groups used by this whole\r\n\t\tfor (let {G, V} of recs) {\r\n\t\t\tlet complement = new Set(union.filter(g => !G.has(g))); // groups not covered by the extent\r\n\t\t\tfor (let cp of V) {\r\n\t\t\t\tM.set(cp, complement); // this is the same reference\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// compute valid set\r\n\t// 20230924: VALID was union but can be re-used\r\n\tVALID = new Set(); // exists in 1+ groups\r\n\tlet multi = new Set(); // exists in 2+ groups\r\n\tconst add_to_union = cp => VALID.has(cp) ? multi.add(cp) : VALID.add(cp);\r\n\tfor (let g of GROUPS) {\r\n\t\tfor (let cp of g.P) add_to_union(cp);\r\n\t\tfor (let cp of g.Q) add_to_union(cp);\r\n\t}\r\n\t// dual purpose WHOLE_MAP: return placeholder if unique non-confusable\r\n\tfor (let cp of VALID) {\r\n\t\tif (!WHOLE_MAP.has(cp) && !multi.has(cp)) {\r\n\t\t\tWHOLE_MAP.set(cp, UNIQUE_PH);\r\n\t\t}\r\n\t}\r\n\t// add all decomposed parts\r\n\t// see derive: \"Valid is Closed (via Brute-force)\"\r\n\tset_add_many(VALID, nfd(VALID));\r\n\t\r\n\t// decode emoji\r\n\t// 20230719: emoji are now fully-expanded to avoid quirk logic \r\n\tEMOJI_LIST = read_trie(r).map(v => Emoji.from(v)).sort(compare_arrays);\r\n\tEMOJI_ROOT = new Map(); // this has approx 7K nodes (2+ per emoji)\r\n\tfor (let cps of EMOJI_LIST) {\r\n\t\t// 20230719: change to *slightly* stricter algorithm which disallows \r\n\t\t// insertion of misplaced FE0F in emoji sequences (matching ENSIP-15)\r\n\t\t// example: beautified [A B] (eg. flag emoji) \r\n\t\t// before: allow: [A FE0F B], error: [A FE0F FE0F B] \r\n\t\t// after: error: both\r\n\t\t// note: this code now matches ENSNormalize.{cs,java} logic\r\n\t\tlet prev = [EMOJI_ROOT];\r\n\t\tfor (let cp of cps) {\r\n\t\t\tlet next = prev.map(node => {\r\n\t\t\t\tlet child = node.get(cp);\r\n\t\t\t\tif (!child) {\r\n\t\t\t\t\t// should this be object? \r\n\t\t\t\t\t// (most have 1-2 items, few have many)\r\n\t\t\t\t\t// 20230719: no, v8 default map is 4?\r\n\t\t\t\t\tchild = new Map();\r\n\t\t\t\t\tnode.set(cp, child);\r\n\t\t\t\t}\r\n\t\t\t\treturn child;\r\n\t\t\t});\r\n\t\t\tif (cp === FE0F) {\r\n\t\t\t\tprev.push(...next); // less than 20 elements\r\n\t\t\t} else {\r\n\t\t\t\tprev = next;\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (let x of prev) {\r\n\t\t\tx.V = cps;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// if escaped: {HEX}\r\n// else: \"x\" {HEX}\r\nfunction quoted_cp(cp) {\r\n\treturn (should_escape(cp) ? '' : `${bidi_qq(safe_str_from_cps([cp]))} `) + quote_cp(cp);\r\n}\r\n\r\n// 20230211: some messages can be mixed-directional and result in spillover\r\n// use 200E after a quoted string to force the remainder of a string from \r\n// acquring the direction of the quote\r\n// https://www.w3.org/International/questions/qa-bidi-unicode-controls#exceptions\r\nfunction bidi_qq(s) {\r\n\treturn `\"${s}\"\\u200E`; // strong LTR\r\n}\r\n\r\nfunction check_label_extension(cps) {\r\n\tif (cps.length >= 4 && cps[2] == HYPHEN && cps[3] == HYPHEN) {\r\n\t\tthrow new Error(`invalid label extension: \"${str_from_cps(cps.slice(0, 4))}\"`); // this can only be ascii so cant be bidi\r\n\t}\r\n}\r\nfunction check_leading_underscore(cps) {\r\n\tconst UNDERSCORE = 0x5F;\r\n\tfor (let i = cps.lastIndexOf(UNDERSCORE); i > 0; ) {\r\n\t\tif (cps[--i] !== UNDERSCORE) {\r\n\t\t\tthrow new Error('underscore allowed only at start');\r\n\t\t}\r\n\t}\r\n}\r\n// check that a fenced cp is not leading, trailing, or touching another fenced cp\r\nfunction check_fenced(cps) {\r\n\tlet cp = cps[0];\r\n\tlet prev = FENCED.get(cp);\r\n\tif (prev) throw error_placement(`leading ${prev}`);\r\n\tlet n = cps.length;\r\n\tlet last = -1; // prevents trailing from throwing\r\n\tfor (let i = 1; i < n; i++) {\r\n\t\tcp = cps[i];\r\n\t\tlet match = FENCED.get(cp);\r\n\t\tif (match) {\r\n\t\t\t// since cps[0] isn't fenced, cps[1] cannot throw\r\n\t\t\tif (last == i) throw error_placement(`${prev} + ${match}`);\r\n\t\t\tlast = i + 1;\r\n\t\t\tprev = match;\r\n\t\t}\r\n\t}\r\n\tif (last == n) throw error_placement(`trailing ${prev}`);\r\n}\r\n\r\n// create a safe to print string \r\n// invisibles are escaped\r\n// leading cm uses placeholder\r\n// if cps exceed max, middle truncate with ellipsis\r\n// quoter(cp) => string, eg. 3000 => \"{3000}\"\r\n// note: in html, you'd call this function then replace [<>&] with entities\r\nfunction safe_str_from_cps(cps, max = Infinity, quoter = quote_cp) {\r\n\t//if (Number.isInteger(cps)) cps = [cps];\r\n\t//if (!Array.isArray(cps)) throw new TypeError(`expected codepoints`);\r\n\tlet buf = [];\r\n\tif (is_combining_mark(cps[0])) buf.push('◌');\r\n\tif (cps.length > max) {\r\n\t\tmax >>= 1;\r\n\t\tcps = [...cps.slice(0, max), 0x2026, ...cps.slice(-max)];\r\n\t}\r\n\tlet prev = 0;\r\n\tlet n = cps.length;\r\n\tfor (let i = 0; i < n; i++) {\r\n\t\tlet cp = cps[i];\r\n\t\tif (should_escape(cp)) {\r\n\t\t\tbuf.push(str_from_cps(cps.slice(prev, i)));\r\n\t\t\tbuf.push(quoter(cp));\r\n\t\t\tprev = i + 1;\r\n\t\t}\r\n\t}\r\n\tbuf.push(str_from_cps(cps.slice(prev, n)));\r\n\treturn buf.join('');\r\n}\r\n\r\n// note: set(s) cannot be exposed because they can be modified\r\n// note: Object.freeze() doesn't work\r\nfunction is_combining_mark(cp) {\r\n\tinit();\r\n\treturn CM.has(cp);\r\n}\r\nfunction should_escape(cp) {\r\n\tinit();\r\n\treturn ESCAPE.has(cp);\r\n}\r\n\r\n// return all supported emoji as fully-qualified emoji \r\n// ordered by length then lexicographic \r\nfunction ens_emoji() {\r\n\tinit();\r\n\treturn EMOJI_LIST.map(x => x.slice()); // emoji are exposed so copy\r\n}\r\n\r\nfunction ens_normalize_fragment(frag, decompose) {\r\n\tinit();\r\n\tlet nf = decompose ? nfd : nfc;\r\n\treturn frag.split(STOP_CH).map(label => str_from_cps(tokens_from_str(explode_cp(label), nf, filter_fe0f).flat())).join(STOP_CH);\r\n}\r\n\r\nfunction ens_normalize(name) {\r\n\treturn flatten(split(name, nfc, filter_fe0f));\r\n}\r\n\r\nfunction ens_beautify(name) {\r\n\tlet labels = split(name, nfc, x => x); // emoji not exposed\r\n\tfor (let {type, output, error} of labels) {\r\n\t\tif (error) break; // flatten will throw\r\n\r\n\t\t// replace leading/trailing hyphen\r\n\t\t// 20230121: consider beautifing all or leading/trailing hyphen to unicode variant\r\n\t\t// not exactly the same in every font, but very similar: \"-\" vs \"‐\"\r\n\t\t/*\r\n\t\tconst UNICODE_HYPHEN = 0x2010;\r\n\t\t// maybe this should replace all for visual consistancy?\r\n\t\t// `node tools/reg-count.js regex ^-\\{2,\\}` => 592\r\n\t\t//for (let i = 0; i < output.length; i++) if (output[i] == 0x2D) output[i] = 0x2010;\r\n\t\tif (output[0] == HYPHEN) output[0] = UNICODE_HYPHEN;\r\n\t\tlet end = output.length-1;\r\n\t\tif (output[end] == HYPHEN) output[end] = UNICODE_HYPHEN;\r\n\t\t*/\r\n\t\t// 20230123: WHATWG URL uses \"CheckHyphens\" false\r\n\t\t// https://url.spec.whatwg.org/#idna\r\n\r\n\t\t// update ethereum symbol\r\n\t\t// ξ => Ξ if not greek\r\n\t\tif (type !== 'Greek') array_replace(output, 0x3BE, 0x39E);\r\n\r\n\t\t// 20221213: fixes bidi subdomain issue, but breaks invariant (200E is disallowed)\r\n\t\t// could be fixed with special case for: 2D (.) + 200E (LTR)\r\n\t\t// https://discuss.ens.domains/t/bidi-label-ordering-spoof/15824\r\n\t\t//output.splice(0, 0, 0x200E);\r\n\t}\r\n\treturn flatten(labels);\r\n}\r\n\r\nfunction array_replace(v, a, b) {\r\n\tlet prev = 0;\r\n\twhile (true) {\r\n\t\tlet next = v.indexOf(a, prev);\r\n\t\tif (next < 0) break;\r\n\t\tv[next] = b; \r\n\t\tprev = next + 1;\r\n\t}\r\n}\r\n\r\nfunction ens_split(name, preserve_emoji) {\r\n\treturn split(name, nfc, preserve_emoji ? x => x.slice() : filter_fe0f); // emoji are exposed so copy\r\n}\r\n\r\nfunction split(name, nf, ef) {\r\n\tif (!name) return []; // 20230719: empty name allowance\r\n\tinit();\r\n\tlet offset = 0;\r\n\t// https://unicode.org/reports/tr46/#Validity_Criteria\r\n\t// 4.) \"The label must not contain a U+002E ( . ) FULL STOP.\"\r\n\treturn name.split(STOP_CH).map(label => {\r\n\t\tlet input = explode_cp(label);\r\n\t\tlet info = {\r\n\t\t\tinput,\r\n\t\t\toffset, // codepoint, not substring!\r\n\t\t};\r\n\t\toffset += input.length + 1; // + stop\r\n\t\ttry {\r\n\t\t\t// 1.) \"The label must be in Unicode Normalization Form NFC\"\r\n\t\t\tlet tokens = info.tokens = tokens_from_str(input, nf, ef);\r\n\t\t\tlet token_count = tokens.length;\r\n\t\t\tlet type;\r\n\t\t\tif (!token_count) { // the label was effectively empty (could of had ignored characters)\r\n\t\t\t\t//norm = [];\r\n\t\t\t\t//type = 'None'; // use this instead of next match, \"ASCII\"\r\n\t\t\t\t// 20230120: change to strict\r\n\t\t\t\t// https://discuss.ens.domains/t/ens-name-normalization-2nd/14564/59\r\n\t\t\t\tthrow new Error(`empty label`);\r\n\t\t\t} \r\n\t\t\tlet norm = info.output = tokens.flat();\r\n\t\t\tcheck_leading_underscore(norm);\r\n\t\t\tlet emoji = info.emoji = token_count > 1 || tokens[0].is_emoji; // same as: tokens.some(x => x.is_emoji);\r\n\t\t\tif (!emoji && norm.every(cp => cp < 0x80)) { // special case for ascii\r\n\t\t\t\t// 20230123: matches matches WHATWG, see note 3.3\r\n\t\t\t\tcheck_label_extension(norm); // only needed for ascii\r\n\t\t\t\t// cant have fenced\r\n\t\t\t\t// cant have cm\r\n\t\t\t\t// cant have wholes\r\n\t\t\t\t// see derive: \"Fastpath ASCII\"\r\n\t\t\t\ttype = 'ASCII';\r\n\t\t\t} else {\r\n\t\t\t\tlet chars = tokens.flatMap(x => x.is_emoji ? [] : x); // all of the nfc tokens concat together\r\n\t\t\t\tif (!chars.length) { // theres no text, just emoji\r\n\t\t\t\t\ttype = 'Emoji';\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// 5.) \"The label must not begin with a combining mark, that is: General_Category=Mark.\"\r\n\t\t\t\t\tif (CM.has(norm[0])) throw error_placement('leading combining mark');\r\n\t\t\t\t\tfor (let i = 1; i < token_count; i++) { // we've already checked the first token\r\n\t\t\t\t\t\tlet cps = tokens[i];\r\n\t\t\t\t\t\tif (!cps.is_emoji && CM.has(cps[0])) { // every text token has emoji neighbors, eg. EtEEEtEt...\r\n\t\t\t\t\t\t\t// bidi_qq() not needed since emoji is LTR and cps is a CM\r\n\t\t\t\t\t\t\tthrow error_placement(`emoji + combining mark: \"${str_from_cps(tokens[i-1])} + ${safe_str_from_cps([cps[0]])}\"`); \r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcheck_fenced(norm);\r\n\t\t\t\t\tlet unique = Array_from(new Set(chars));\r\n\t\t\t\t\tlet [g] = determine_group(unique); // take the first match\r\n\t\t\t\t\t// see derive: \"Matching Groups have Same CM Style\"\r\n\t\t\t\t\t// alternative: could form a hybrid type: Latin/Japanese/...\t\r\n\t\t\t\t\tcheck_group(g, chars); // need text in order\r\n\t\t\t\t\tcheck_whole(g, unique); // only need unique text (order would be required for multiple-char confusables)\r\n\t\t\t\t\ttype = g.N;\r\n\t\t\t\t\t// 20230121: consider exposing restricted flag\r\n\t\t\t\t\t// it's simpler to just check for 'Restricted'\r\n\t\t\t\t\t// or even better: type.endsWith(']')\r\n\t\t\t\t\t//if (g.R) info.restricted = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tinfo.type = type;\r\n\t\t} catch (err) {\r\n\t\t\tinfo.error = err; // use full error object\r\n\t\t}\r\n\t\treturn info;\r\n\t});\r\n}\r\n\r\nfunction check_whole(group, unique) {\r\n\tlet maker;\r\n\tlet shared = [];\r\n\tfor (let cp of unique) {\r\n\t\tlet whole = WHOLE_MAP.get(cp);\r\n\t\tif (whole === UNIQUE_PH) return; // unique, non-confusable\r\n\t\tif (whole) {\r\n\t\t\tlet set = whole.M.get(cp); // groups which have a character that look-like this character\r\n\t\t\tmaker = maker ? maker.filter(g => set.has(g)) : Array_from(set);\r\n\t\t\tif (!maker.length) return; // confusable intersection is empty\r\n\t\t} else {\r\n\t\t\tshared.push(cp); \r\n\t\t}\r\n\t}\r\n\tif (maker) {\r\n\t\t// we have 1+ confusable\r\n\t\t// check if any of the remaining groups\r\n\t\t// contain the shared characters too\r\n\t\tfor (let g of maker) {\r\n\t\t\tif (shared.every(cp => group_has_cp(g, cp))) {\r\n\t\t\t\tthrow new Error(`whole-script confusable: ${group.N}/${g.N}`);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// assumption: unique.size > 0\r\n// returns list of matching groups\r\nfunction determine_group(unique) {\r\n\tlet groups = GROUPS;\r\n\tfor (let cp of unique) {\r\n\t\t// note: we need to dodge CM that are whitelisted\r\n\t\t// but that code isn't currently necessary\r\n\t\tlet gs = groups.filter(g => group_has_cp(g, cp));\r\n\t\tif (!gs.length) {\r\n\t\t\tif (!GROUPS.some(g => group_has_cp(g, cp))) { \r\n\t\t\t\t// the character was composed of valid parts\r\n\t\t\t\t// but it's NFC form is invalid\r\n\t\t\t\t// 20230716: change to more exact statement, see: ENSNormalize.{cs,java}\r\n\t\t\t\t// note: this doesn't have to be a composition\r\n\t\t\t\t// 20230720: change to full check\r\n\t\t\t\tthrow error_disallowed(cp); // this should be rare\r\n\t\t\t} else {\r\n\t\t\t\t// there is no group that contains all these characters\r\n\t\t\t\t// throw using the highest priority group that matched\r\n\t\t\t\t// https://www.unicode.org/reports/tr39/#mixed_script_confusables\r\n\t\t\t\tthrow error_group_member(groups[0], cp);\r\n\t\t\t}\r\n\t\t}\r\n\t\tgroups = gs;\r\n\t\tif (gs.length == 1) break; // there is only one group left\r\n\t}\r\n\t// there are at least 1 group(s) with all of these characters\r\n\treturn groups;\r\n}\r\n\r\n// throw on first error\r\nfunction flatten(split) {\r\n\treturn split.map(({input, error, output}) => {\r\n\t\tif (error) {\r\n\t\t\t// don't print label again if just a single label\r\n\t\t\tlet msg = error.message;\r\n\t\t\t// bidi_qq() only necessary if msg is digits\r\n\t\t\tthrow new Error(split.length == 1 ? msg : `Invalid label ${bidi_qq(safe_str_from_cps(input, 63))}: ${msg}`); \r\n\t\t}\r\n\t\treturn str_from_cps(output);\r\n\t}).join(STOP_CH);\r\n}\r\n\r\nfunction error_disallowed(cp) {\r\n\t// TODO: add cp to error?\r\n\treturn new Error(`disallowed character: ${quoted_cp(cp)}`); \r\n}\r\nfunction error_group_member(g, cp) {\r\n\tlet quoted = quoted_cp(cp);\r\n\tlet gg = GROUPS.find(g => g.P.has(cp)); // only check primary\r\n\tif (gg) {\r\n\t\tquoted = `${gg.N} ${quoted}`;\r\n\t}\r\n\treturn new Error(`illegal mixture: ${g.N} + ${quoted}`);\r\n}\r\nfunction error_placement(where) {\r\n\treturn new Error(`illegal placement: ${where}`);\r\n}\r\n\r\n// assumption: cps.length > 0\r\n// assumption: cps[0] isn't a CM\r\n// assumption: the previous character isn't an emoji\r\nfunction check_group(g, cps) {\r\n\tfor (let cp of cps) {\r\n\t\tif (!group_has_cp(g, cp)) {\r\n\t\t\t// for whitelisted scripts, this will throw illegal mixture on invalid cm, eg. \"e{300}{300}\"\r\n\t\t\t// at the moment, it's unnecessary to introduce an extra error type\r\n\t\t\t// until there exists a whitelisted multi-character\r\n\t\t\t// eg. if (M < 0 && is_combining_mark(cp)) { ... }\r\n\t\t\t// there are 3 cases:\r\n\t\t\t// 1. illegal cm for wrong group => mixture error\r\n\t\t\t// 2. illegal cm for same group => cm error\r\n\t\t\t// requires set of whitelist cm per group: \r\n\t\t\t// eg. new Set([...g.P, ...g.Q].flatMap(nfc).filter(cp => CM.has(cp)))\r\n\t\t\t// 3. wrong group => mixture error\r\n\t\t\tthrow error_group_member(g, cp);\r\n\t\t}\r\n\t}\r\n\t//if (M >= 0) { // we have a known fixed cm count\r\n\tif (g.M) { // we need to check for NSM\r\n\t\tlet decomposed = nfd(cps);\r\n\t\tfor (let i = 1, e = decomposed.length; i < e; i++) { // see: assumption\r\n\t\t\t// 20230210: bugfix: using cps instead of decomposed h/t Carbon225\r\n\t\t\t/*\r\n\t\t\tif (CM.has(decomposed[i])) {\r\n\t\t\t\tlet j = i + 1;\r\n\t\t\t\twhile (j < e && CM.has(decomposed[j])) j++;\r\n\t\t\t\tif (j - i > M) {\r\n\t\t\t\t\tthrow new Error(`too many combining marks: ${g.N} ${bidi_qq(str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${M})`);\r\n\t\t\t\t}\r\n\t\t\t\ti = j;\r\n\t\t\t}\r\n\t\t\t*/\r\n\t\t\t// 20230217: switch to NSM counting\r\n\t\t\t// https://www.unicode.org/reports/tr39/#Optional_Detection\r\n\t\t\tif (NSM.has(decomposed[i])) {\r\n\t\t\t\tlet j = i + 1;\r\n\t\t\t\tfor (let cp; j < e && NSM.has(cp = decomposed[j]); j++) {\r\n\t\t\t\t\t// a. Forbid sequences of the same nonspacing mark.\r\n\t\t\t\t\tfor (let k = i; k < j; k++) { // O(n^2) but n < 100\r\n\t\t\t\t\t\tif (decomposed[k] == cp) {\r\n\t\t\t\t\t\t\tthrow new Error(`duplicate non-spacing marks: ${quoted_cp(cp)}`);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// parse to end so we have full nsm count\r\n\t\t\t\t// b. Forbid sequences of more than 4 nonspacing marks (gc=Mn or gc=Me).\r\n\t\t\t\tif (j - i > NSM_MAX) {\r\n\t\t\t\t\t// note: this slice starts with a base char or spacing-mark cm\r\n\t\t\t\t\tthrow new Error(`excessive non-spacing marks: ${bidi_qq(safe_str_from_cps(decomposed.slice(i-1, j)))} (${j-i}/${NSM_MAX})`);\r\n\t\t\t\t}\r\n\t\t\t\ti = j;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t// *** this code currently isn't needed ***\r\n\t/*\r\n\tlet cm_whitelist = M instanceof Map;\r\n\tfor (let i = 0, e = cps.length; i < e; ) {\r\n\t\tlet cp = cps[i++];\r\n\t\tlet seqs = cm_whitelist && M.get(cp);\r\n\t\tif (seqs) { \r\n\t\t\t// list of codepoints that can follow\r\n\t\t\t// if this exists, this will always be 1+\r\n\t\t\tlet j = i;\r\n\t\t\twhile (j < e && CM.has(cps[j])) j++;\r\n\t\t\tlet cms = cps.slice(i, j);\r\n\t\t\tlet match = seqs.find(seq => !compare_arrays(seq, cms));\r\n\t\t\tif (!match) throw new Error(`disallowed combining mark sequence: \"${safe_str_from_cps([cp, ...cms])}\"`);\r\n\t\t\ti = j;\r\n\t\t} else if (!V.has(cp)) {\r\n\t\t\t// https://www.unicode.org/reports/tr39/#mixed_script_confusables\r\n\t\t\tlet quoted = quoted_cp(cp);\r\n\t\t\tfor (let cp of cps) {\r\n\t\t\t\tlet u = UNIQUE.get(cp);\r\n\t\t\t\tif (u && u !== g) {\r\n\t\t\t\t\t// if both scripts are restricted this error is confusing\r\n\t\t\t\t\t// because we don't differentiate RestrictedA from RestrictedB \r\n\t\t\t\t\tif (!u.R) quoted = `${quoted} is ${u.N}`;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthrow new Error(`disallowed ${g.N} character: ${quoted}`);\r\n\t\t\t//throw new Error(`disallowed character: ${quoted} (expected ${g.N})`);\r\n\t\t\t//throw new Error(`${g.N} does not allow: ${quoted}`);\r\n\t\t}\r\n\t}\r\n\tif (!cm_whitelist) {\r\n\t\tlet decomposed = nfd(cps);\r\n\t\tfor (let i = 1, e = decomposed.length; i < e; i++) { // we know it can't be cm leading\r\n\t\t\tif (CM.has(decomposed[i])) {\r\n\t\t\t\tlet j = i + 1;\r\n\t\t\t\twhile (j < e && CM.has(decomposed[j])) j++;\r\n\t\t\t\tif (j - i > M) {\r\n\t\t\t\t\tthrow new Error(`too many combining marks: \"${str_from_cps(decomposed.slice(i-1, j))}\" (${j-i}/${M})`);\r\n\t\t\t\t}\r\n\t\t\t\ti = j;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t*/\r\n}\r\n\r\n// given a list of codepoints\r\n// returns a list of lists, where emoji are a fully-qualified (as Array subclass)\r\n// eg. explode_cp(\"abc💩d\") => [[61, 62, 63], Emoji[1F4A9, FE0F], [64]]\r\n// 20230818: rename for 'process' name collision h/t Javarome\r\n// https://github.com/adraffy/ens-normalize.js/issues/23\r\nfunction tokens_from_str(input, nf, ef) {\r\n\tlet ret = [];\r\n\tlet chars = [];\r\n\tinput = input.slice().reverse(); // flip so we can pop\r\n\twhile (input.length) {\r\n\t\tlet emoji = consume_emoji_reversed(input);\r\n\t\tif (emoji) {\r\n\t\t\tif (chars.length) {\r\n\t\t\t\tret.push(nf(chars));\r\n\t\t\t\tchars = [];\r\n\t\t\t}\r\n\t\t\tret.push(ef(emoji));\r\n\t\t} else {\r\n\t\t\tlet cp = input.pop();\r\n\t\t\tif (VALID.has(cp)) {\r\n\t\t\t\tchars.push(cp);\r\n\t\t\t} else {\r\n\t\t\t\tlet cps = MAPPED.get(cp);\r\n\t\t\t\tif (cps) {\r\n\t\t\t\t\tchars.push(...cps); // less than 10 elements\r\n\t\t\t\t} else if (!IGNORED.has(cp)) {\r\n\t\t\t\t\t// 20230912: unicode 15.1 changed the order of processing such that\r\n\t\t\t\t\t// disallowed parts are only rejected after NFC\r\n\t\t\t\t\t// https://unicode.org/reports/tr46/#Validity_Criteria\r\n\t\t\t\t\t// this doesn't impact normalization as of today\r\n\t\t\t\t\t// technically, this error can be removed as the group logic will apply similar logic\r\n\t\t\t\t\t// however the error type might be less clear\r\n\t\t\t\t\tthrow error_disallowed(cp);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif (chars.length) {\r\n\t\tret.push(nf(chars));\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\nfunction filter_fe0f(cps) {\r\n\treturn cps.filter(cp => cp != FE0F);\r\n}\r\n\r\n// given array of codepoints\r\n// returns the longest valid emoji sequence (or undefined if no match)\r\n// *MUTATES* the supplied array\r\n// disallows interleaved ignored characters\r\n// fills (optional) eaten array with matched codepoints\r\nfunction consume_emoji_reversed(cps, eaten) {\r\n\tlet node = EMOJI_ROOT;\r\n\tlet emoji;\r\n\tlet pos = cps.length;\r\n\twhile (pos) {\r\n\t\tnode = node.get(cps[--pos]);\r\n\t\tif (!node) break;\r\n\t\tlet {V} = node;\r\n\t\tif (V) { // this is a valid emoji (so far)\r\n\t\t\temoji = V;\r\n\t\t\tif (eaten) eaten.push(...cps.slice(pos).reverse()); // (optional) copy input, used for ens_tokenize()\r\n\t\t\tcps.length = pos; // truncate\r\n\t\t}\r\n\t}\r\n\treturn emoji;\r\n}\r\n\r\n// ************************************************************\r\n// tokenizer \r\n\r\nconst TY_VALID = 'valid';\r\nconst TY_MAPPED = 'mapped';\r\nconst TY_IGNORED = 'ignored';\r\nconst TY_DISALLOWED = 'disallowed';\r\nconst TY_EMOJI = 'emoji';\r\nconst TY_NFC = 'nfc';\r\nconst TY_STOP = 'stop';\r\n\r\nfunction ens_tokenize(name, {\r\n\tnf = true, // collapse unnormalized runs into a single token\r\n} = {}) {\r\n\tinit();\r\n\tlet input = explode_cp(name).reverse();\r\n\tlet eaten = [];\r\n\tlet tokens = [];\r\n\twhile (input.length) {\r\n\t\tlet emoji = consume_emoji_reversed(input, eaten);\r\n\t\tif (emoji) {\r\n\t\t\ttokens.push({\r\n\t\t\t\ttype: TY_EMOJI,\r\n\t\t\t\temoji: emoji.slice(), // copy emoji\r\n\t\t\t\tinput: eaten,\r\n\t\t\t\tcps: filter_fe0f(emoji)\r\n\t\t\t});\r\n\t\t\teaten = []; // reset buffer\r\n\t\t} else {\r\n\t\t\tlet cp = input.pop();\r\n\t\t\tif (cp == STOP) {\r\n\t\t\t\ttokens.push({type: TY_STOP, cp});\r\n\t\t\t} else if (VALID.has(cp)) {\r\n\t\t\t\ttokens.push({type: TY_VALID, cps: [cp]});\r\n\t\t\t} else if (IGNORED.has(cp)) {\r\n\t\t\t\ttokens.push({type: TY_IGNORED, cp});\r\n\t\t\t} else {\r\n\t\t\t\tlet cps = MAPPED.get(cp);\r\n\t\t\t\tif (cps) {\r\n\t\t\t\t\ttokens.push({type: TY_MAPPED, cp, cps: cps.slice()});\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttokens.push({type: TY_DISALLOWED, cp});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif (nf) {\r\n\t\tfor (let i = 0, start = -1; i < tokens.length; i++) {\r\n\t\t\tlet token = tokens[i];\r\n\t\t\tif (is_valid_or_mapped(token.type)) {\r\n\t\t\t\tif (requires_check(token.cps)) { // normalization might be needed\r\n\t\t\t\t\tlet end = i + 1;\r\n\t\t\t\t\tfor (let pos = end; pos < tokens.length; pos++) { // find adjacent text\r\n\t\t\t\t\t\tlet {type, cps} = tokens[pos];\r\n\t\t\t\t\t\tif (is_valid_or_mapped(type)) {\r\n\t\t\t\t\t\t\tif (!requires_check(cps)) break;\r\n\t\t\t\t\t\t\tend = pos + 1;\r\n\t\t\t\t\t\t} else if (type !== TY_IGNORED) { // || type !== TY_DISALLOWED) { \r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (start < 0) start = i;\r\n\t\t\t\t\tlet slice = tokens.slice(start, end);\r\n\t\t\t\t\tlet cps0 = slice.flatMap(x => is_valid_or_mapped(x.type) ? x.cps : []); // strip junk tokens\r\n\t\t\t\t\tlet cps = nfc(cps0);\r\n\t\t\t\t\tif (compare_arrays(cps, cps0)) { // bundle into an nfc token\r\n\t\t\t\t\t\ttokens.splice(start, end - start, {\r\n\t\t\t\t\t\t\ttype: TY_NFC, \r\n\t\t\t\t\t\t\tinput: cps0, // there are 3 states: tokens0 ==(process)=> input ==(nfc)=> tokens/cps\r\n\t\t\t\t\t\t\tcps, \r\n\t\t\t\t\t\t\ttokens0: collapse_valid_tokens(slice),\r\n\t\t\t\t\t\t\ttokens: ens_tokenize(str_from_cps(cps), {nf: false})\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\ti = start;\r\n\t\t\t\t\t} else { \r\n\t\t\t\t\t\ti = end - 1; // skip to end of slice\r\n\t\t\t\t\t}\r\n\t\t\t\t\tstart = -1; // reset\r\n\t\t\t\t} else {\r\n\t\t\t\t\tstart = i; // remember last\r\n\t\t\t\t}\r\n\t\t\t} else if (token.type !== TY_IGNORED) { // 20221024: is this correct?\r\n\t\t\t\tstart = -1; // reset\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn collapse_valid_tokens(tokens);\r\n}\r\n\r\nfunction is_valid_or_mapped(type) {\r\n\treturn type == TY_VALID || type == TY_MAPPED;\r\n}\r\n\r\nfunction requires_check(cps) {\r\n\treturn cps.some(cp => NFC_CHECK.has(cp));\r\n}\r\n\r\nfunction collapse_valid_tokens(tokens) {\r\n\tfor (let i = 0; i < tokens.length; i++) {\r\n\t\tif (tokens[i].type == TY_VALID) {\r\n\t\t\tlet j = i + 1;\r\n\t\t\twhile (j < tokens.length && tokens[j].type == TY_VALID) j++;\r\n\t\t\ttokens.splice(i, j - i, {type: TY_VALID, cps: tokens.slice(i, j).flatMap(x => x.cps)});\r\n\t\t}\r\n\t}\r\n\treturn tokens;\r\n}\n\nexport { ens_beautify, ens_emoji, ens_normalize, ens_normalize_fragment, ens_split, ens_tokenize, is_combining_mark, nfc, nfd, safe_str_from_cps, should_escape };\n"], - "mappings": ";AAKA,IAAI,eAAe;AACnB,IAAM,SAAS,oBAAI,IAAI,CAAC,CAAC,MAAK,YAAY,GAAE,CAAC,MAAK,gBAAgB,GAAE,CAAC,OAAM,YAAY,CAAC,CAAC;AACzF,IAAM,UAAU;AAEhB,SAAS,kBAAkB,OAAO;AACjC,MAAI,MAAM;AACV,WAAS,MAAM;AAAE,WAAQ,MAAM,KAAK,KAAK,IAAK,MAAM,KAAK;AAAA,EAAG;AAG5D,MAAI,eAAe,IAAI;AACvB,MAAI,QAAQ;AACZ,MAAI,MAAM,CAAC,GAAG,CAAC;AACf,WAAS,IAAI,GAAG,IAAI,cAAc,KAAK;AACtC,QAAI,KAAK,SAAS,IAAI,CAAC;AAAA,EACxB;AAGA,MAAI,OAAO,IAAI;AACf,MAAI,cAAc;AAClB,SAAO;AAEP,MAAI,aAAa;AACjB,MAAI,cAAc;AAClB,WAAS,WAAW;AACnB,QAAI,cAAc,GAAG;AAGpB,oBAAe,eAAe,IAAK,MAAM,KAAK;AAC9C,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- "names": ["V", "split", "g", "decomposed"] -} diff --git a/node_modules/.vite/deps/chunk-TXPGJST7.js b/node_modules/.vite/deps/chunk-TXPGJST7.js deleted file mode 100644 index 69c5606c..00000000 --- a/node_modules/.vite/deps/chunk-TXPGJST7.js +++ /dev/null @@ -1,77 +0,0 @@ -var __create = Object.create; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __getProtoOf = Object.getPrototypeOf; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __commonJS = (cb, mod) => function __require() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; -}; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod -)); -var __publicField = (obj, key, value) => { - __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); - return value; -}; -var __accessCheck = (obj, member, msg) => { - if (!member.has(obj)) - throw TypeError("Cannot " + msg); -}; -var __privateGet = (obj, member, getter) => { - __accessCheck(obj, member, "read from private field"); - return getter ? getter.call(obj) : member.get(obj); -}; -var __privateAdd = (obj, member, value) => { - if (member.has(obj)) - throw TypeError("Cannot add the same private member more than once"); - member instanceof WeakSet ? member.add(obj) : member.set(obj, value); -}; -var __privateSet = (obj, member, value, setter) => { - __accessCheck(obj, member, "write to private field"); - setter ? setter.call(obj, value) : member.set(obj, value); - return value; -}; -var __privateWrapper = (obj, member, setter, getter) => ({ - set _(value) { - __privateSet(obj, member, value, setter); - }, - get _() { - return __privateGet(obj, member, getter); - } -}); -var __privateMethod = (obj, member, method) => { - __accessCheck(obj, member, "access private method"); - return method; -}; - -export { - __commonJS, - __export, - __toESM, - __publicField, - __privateGet, - __privateAdd, - __privateSet, - __privateWrapper, - __privateMethod -}; -//# sourceMappingURL=chunk-TXPGJST7.js.map diff --git a/node_modules/.vite/deps/chunk-TXPGJST7.js.map b/node_modules/.vite/deps/chunk-TXPGJST7.js.map deleted file mode 100644 index 98652118..00000000 --- a/node_modules/.vite/deps/chunk-TXPGJST7.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": [], - "sourcesContent": [], - "mappings": "", - "names": [] -} diff --git a/node_modules/.vite/deps/ethers.js b/node_modules/.vite/deps/ethers.js deleted file mode 100644 index 37b338a9..00000000 --- a/node_modules/.vite/deps/ethers.js +++ /dev/null @@ -1,22438 +0,0 @@ -import { - ens_normalize -} from "./chunk-MIR452EH.js"; -import { - __export, - __privateAdd, - __privateGet, - __privateMethod, - __privateSet, - __privateWrapper, - __publicField -} from "./chunk-TXPGJST7.js"; - -// node_modules/ethers/lib.esm/ethers.js -var ethers_exports = {}; -__export(ethers_exports, { - AbiCoder: () => AbiCoder, - AbstractProvider: () => AbstractProvider, - AbstractSigner: () => AbstractSigner, - AlchemyProvider: () => AlchemyProvider, - AnkrProvider: () => AnkrProvider, - BaseContract: () => BaseContract, - BaseWallet: () => BaseWallet, - Block: () => Block, - BrowserProvider: () => BrowserProvider, - CloudflareProvider: () => CloudflareProvider, - ConstructorFragment: () => ConstructorFragment, - Contract: () => Contract, - ContractEventPayload: () => ContractEventPayload, - ContractFactory: () => ContractFactory, - ContractTransactionReceipt: () => ContractTransactionReceipt, - ContractTransactionResponse: () => ContractTransactionResponse, - ContractUnknownEventPayload: () => ContractUnknownEventPayload, - EnsPlugin: () => EnsPlugin, - EnsResolver: () => EnsResolver, - ErrorDescription: () => ErrorDescription, - ErrorFragment: () => ErrorFragment, - EtherSymbol: () => EtherSymbol, - EtherscanPlugin: () => EtherscanPlugin, - EtherscanProvider: () => EtherscanProvider, - EventFragment: () => EventFragment, - EventLog: () => EventLog, - EventPayload: () => EventPayload, - FallbackFragment: () => FallbackFragment, - FallbackProvider: () => FallbackProvider, - FeeData: () => FeeData, - FeeDataNetworkPlugin: () => FeeDataNetworkPlugin, - FetchCancelSignal: () => FetchCancelSignal, - FetchRequest: () => FetchRequest, - FetchResponse: () => FetchResponse, - FetchUrlFeeDataNetworkPlugin: () => FetchUrlFeeDataNetworkPlugin, - FixedNumber: () => FixedNumber, - Fragment: () => Fragment, - FunctionFragment: () => FunctionFragment, - GasCostPlugin: () => GasCostPlugin, - HDNodeVoidWallet: () => HDNodeVoidWallet, - HDNodeWallet: () => HDNodeWallet, - Indexed: () => Indexed, - InfuraProvider: () => InfuraProvider, - InfuraWebSocketProvider: () => InfuraWebSocketProvider, - Interface: () => Interface, - IpcSocketProvider: () => IpcSocketProvider, - JsonRpcApiProvider: () => JsonRpcApiProvider, - JsonRpcProvider: () => JsonRpcProvider, - JsonRpcSigner: () => JsonRpcSigner, - LangEn: () => LangEn, - Log: () => Log, - LogDescription: () => LogDescription, - MaxInt256: () => MaxInt256, - MaxUint256: () => MaxUint256, - MessagePrefix: () => MessagePrefix, - MinInt256: () => MinInt256, - Mnemonic: () => Mnemonic, - MulticoinProviderPlugin: () => MulticoinProviderPlugin, - N: () => N, - NamedFragment: () => NamedFragment, - Network: () => Network, - NetworkPlugin: () => NetworkPlugin, - NonceManager: () => NonceManager, - ParamType: () => ParamType, - PocketProvider: () => PocketProvider, - QuickNodeProvider: () => QuickNodeProvider, - Result: () => Result, - Signature: () => Signature, - SigningKey: () => SigningKey, - SocketBlockSubscriber: () => SocketBlockSubscriber, - SocketEventSubscriber: () => SocketEventSubscriber, - SocketPendingSubscriber: () => SocketPendingSubscriber, - SocketProvider: () => SocketProvider, - SocketSubscriber: () => SocketSubscriber, - StructFragment: () => StructFragment, - Transaction: () => Transaction, - TransactionDescription: () => TransactionDescription, - TransactionReceipt: () => TransactionReceipt, - TransactionResponse: () => TransactionResponse, - Typed: () => Typed, - TypedDataEncoder: () => TypedDataEncoder, - UndecodedEventLog: () => UndecodedEventLog, - UnmanagedSubscriber: () => UnmanagedSubscriber, - Utf8ErrorFuncs: () => Utf8ErrorFuncs, - VoidSigner: () => VoidSigner, - Wallet: () => Wallet, - WebSocketProvider: () => WebSocketProvider, - WeiPerEther: () => WeiPerEther, - Wordlist: () => Wordlist, - WordlistOwl: () => WordlistOwl, - WordlistOwlA: () => WordlistOwlA, - ZeroAddress: () => ZeroAddress, - ZeroHash: () => ZeroHash, - accessListify: () => accessListify, - assert: () => assert, - assertArgument: () => assertArgument, - assertArgumentCount: () => assertArgumentCount, - assertNormalize: () => assertNormalize, - assertPrivate: () => assertPrivate, - checkResultErrors: () => checkResultErrors, - computeAddress: () => computeAddress, - computeHmac: () => computeHmac, - concat: () => concat, - copyRequest: () => copyRequest, - dataLength: () => dataLength, - dataSlice: () => dataSlice, - decodeBase58: () => decodeBase58, - decodeBase64: () => decodeBase64, - decodeBytes32String: () => decodeBytes32String, - decodeRlp: () => decodeRlp, - decryptCrowdsaleJson: () => decryptCrowdsaleJson, - decryptKeystoreJson: () => decryptKeystoreJson, - decryptKeystoreJsonSync: () => decryptKeystoreJsonSync, - defaultPath: () => defaultPath2, - defineProperties: () => defineProperties, - dnsEncode: () => dnsEncode, - encodeBase58: () => encodeBase58, - encodeBase64: () => encodeBase64, - encodeBytes32String: () => encodeBytes32String, - encodeRlp: () => encodeRlp, - encryptKeystoreJson: () => encryptKeystoreJson, - encryptKeystoreJsonSync: () => encryptKeystoreJsonSync, - ensNormalize: () => ensNormalize, - formatEther: () => formatEther, - formatUnits: () => formatUnits, - fromTwos: () => fromTwos, - getAccountPath: () => getAccountPath, - getAddress: () => getAddress, - getBigInt: () => getBigInt, - getBytes: () => getBytes, - getBytesCopy: () => getBytesCopy, - getCreate2Address: () => getCreate2Address, - getCreateAddress: () => getCreateAddress, - getDefaultProvider: () => getDefaultProvider, - getIcapAddress: () => getIcapAddress, - getIndexedAccountPath: () => getIndexedAccountPath, - getNumber: () => getNumber, - getUint: () => getUint, - hashMessage: () => hashMessage, - hexlify: () => hexlify, - id: () => id, - isAddress: () => isAddress, - isAddressable: () => isAddressable, - isBytesLike: () => isBytesLike, - isCallException: () => isCallException, - isCrowdsaleJson: () => isCrowdsaleJson, - isError: () => isError, - isHexString: () => isHexString, - isKeystoreJson: () => isKeystoreJson, - isValidName: () => isValidName, - keccak256: () => keccak256, - lock: () => lock, - makeError: () => makeError, - mask: () => mask, - namehash: () => namehash, - parseEther: () => parseEther, - parseUnits: () => parseUnits, - pbkdf2: () => pbkdf22, - randomBytes: () => randomBytes3, - recoverAddress: () => recoverAddress, - resolveAddress: () => resolveAddress, - resolveProperties: () => resolveProperties, - ripemd160: () => ripemd1602, - scrypt: () => scrypt2, - scryptSync: () => scryptSync, - sha256: () => sha2562, - sha512: () => sha5122, - showThrottleMessage: () => showThrottleMessage, - solidityPacked: () => solidityPacked, - solidityPackedKeccak256: () => solidityPackedKeccak256, - solidityPackedSha256: () => solidityPackedSha256, - stripZerosLeft: () => stripZerosLeft, - toBeArray: () => toBeArray, - toBeHex: () => toBeHex, - toBigInt: () => toBigInt, - toNumber: () => toNumber, - toQuantity: () => toQuantity, - toTwos: () => toTwos, - toUtf8Bytes: () => toUtf8Bytes, - toUtf8CodePoints: () => toUtf8CodePoints, - toUtf8String: () => toUtf8String, - uuidV4: () => uuidV4, - verifyMessage: () => verifyMessage, - verifyTypedData: () => verifyTypedData, - version: () => version, - wordlists: () => wordlists, - zeroPadBytes: () => zeroPadBytes, - zeroPadValue: () => zeroPadValue -}); - -// node_modules/ethers/lib.esm/_version.js -var version = "6.11.1"; - -// node_modules/ethers/lib.esm/utils/properties.js -function checkType(value, type, name) { - const types = type.split("|").map((t) => t.trim()); - for (let i = 0; i < types.length; i++) { - switch (type) { - case "any": - return; - case "bigint": - case "boolean": - case "number": - case "string": - if (typeof value === type) { - return; - } - } - } - const error = new Error(`invalid value for type ${type}`); - error.code = "INVALID_ARGUMENT"; - error.argument = `value.${name}`; - error.value = value; - throw error; -} -async function resolveProperties(value) { - const keys = Object.keys(value); - const results = await Promise.all(keys.map((k) => Promise.resolve(value[k]))); - return results.reduce((accum, v, index) => { - accum[keys[index]] = v; - return accum; - }, {}); -} -function defineProperties(target, values, types) { - for (let key in values) { - let value = values[key]; - const type = types ? types[key] : null; - if (type) { - checkType(value, type, key); - } - Object.defineProperty(target, key, { enumerable: true, value, writable: false }); - } -} - -// node_modules/ethers/lib.esm/utils/errors.js -function stringify(value) { - if (value == null) { - return "null"; - } - if (Array.isArray(value)) { - return "[ " + value.map(stringify).join(", ") + " ]"; - } - if (value instanceof Uint8Array) { - const HEX = "0123456789abcdef"; - let result = "0x"; - for (let i = 0; i < value.length; i++) { - result += HEX[value[i] >> 4]; - result += HEX[value[i] & 15]; - } - return result; - } - if (typeof value === "object" && typeof value.toJSON === "function") { - return stringify(value.toJSON()); - } - switch (typeof value) { - case "boolean": - case "symbol": - return value.toString(); - case "bigint": - return BigInt(value).toString(); - case "number": - return value.toString(); - case "string": - return JSON.stringify(value); - case "object": { - const keys = Object.keys(value); - keys.sort(); - return "{ " + keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(", ") + " }"; - } - } - return `[ COULD NOT SERIALIZE ]`; -} -function isError(error, code) { - return error && error.code === code; -} -function isCallException(error) { - return isError(error, "CALL_EXCEPTION"); -} -function makeError(message, code, info) { - let shortMessage = message; - { - const details = []; - if (info) { - if ("message" in info || "code" in info || "name" in info) { - throw new Error(`value will overwrite populated values: ${stringify(info)}`); - } - for (const key in info) { - if (key === "shortMessage") { - continue; - } - const value = info[key]; - details.push(key + "=" + stringify(value)); - } - } - details.push(`code=${code}`); - details.push(`version=${version}`); - if (details.length) { - message += " (" + details.join(", ") + ")"; - } - } - let error; - switch (code) { - case "INVALID_ARGUMENT": - error = new TypeError(message); - break; - case "NUMERIC_FAULT": - case "BUFFER_OVERRUN": - error = new RangeError(message); - break; - default: - error = new Error(message); - } - defineProperties(error, { code }); - if (info) { - Object.assign(error, info); - } - if (error.shortMessage == null) { - defineProperties(error, { shortMessage }); - } - return error; -} -function assert(check, message, code, info) { - if (!check) { - throw makeError(message, code, info); - } -} -function assertArgument(check, message, name, value) { - assert(check, message, "INVALID_ARGUMENT", { argument: name, value }); -} -function assertArgumentCount(count, expectedCount, message) { - if (message == null) { - message = ""; - } - if (message) { - message = ": " + message; - } - assert(count >= expectedCount, "missing arguemnt" + message, "MISSING_ARGUMENT", { - count, - expectedCount - }); - assert(count <= expectedCount, "too many arguments" + message, "UNEXPECTED_ARGUMENT", { - count, - expectedCount - }); -} -var _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => { - try { - if ("test".normalize(form) !== "test") { - throw new Error("bad"); - } - ; - if (form === "NFD") { - const check = String.fromCharCode(233).normalize("NFD"); - const expected = String.fromCharCode(101, 769); - if (check !== expected) { - throw new Error("broken"); - } - } - accum.push(form); - } catch (error) { - } - return accum; -}, []); -function assertNormalize(form) { - assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", { - operation: "String.prototype.normalize", - info: { form } - }); -} -function assertPrivate(givenGuard, guard, className) { - if (className == null) { - className = ""; - } - if (givenGuard !== guard) { - let method = className, operation = "new"; - if (className) { - method += "."; - operation += " " + className; - } - assert(false, `private constructor; use ${method}from* methods`, "UNSUPPORTED_OPERATION", { - operation - }); - } -} - -// node_modules/ethers/lib.esm/utils/data.js -function _getBytes(value, name, copy4) { - if (value instanceof Uint8Array) { - if (copy4) { - return new Uint8Array(value); - } - return value; - } - if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) { - const result = new Uint8Array((value.length - 2) / 2); - let offset = 2; - for (let i = 0; i < result.length; i++) { - result[i] = parseInt(value.substring(offset, offset + 2), 16); - offset += 2; - } - return result; - } - assertArgument(false, "invalid BytesLike value", name || "value", value); -} -function getBytes(value, name) { - return _getBytes(value, name, false); -} -function getBytesCopy(value, name) { - return _getBytes(value, name, true); -} -function isHexString(value, length) { - if (typeof value !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { - return false; - } - if (typeof length === "number" && value.length !== 2 + 2 * length) { - return false; - } - if (length === true && value.length % 2 !== 0) { - return false; - } - return true; -} -function isBytesLike(value) { - return isHexString(value, true) || value instanceof Uint8Array; -} -var HexCharacters = "0123456789abcdef"; -function hexlify(data) { - const bytes2 = getBytes(data); - let result = "0x"; - for (let i = 0; i < bytes2.length; i++) { - const v = bytes2[i]; - result += HexCharacters[(v & 240) >> 4] + HexCharacters[v & 15]; - } - return result; -} -function concat(datas) { - return "0x" + datas.map((d) => hexlify(d).substring(2)).join(""); -} -function dataLength(data) { - if (isHexString(data, true)) { - return (data.length - 2) / 2; - } - return getBytes(data).length; -} -function dataSlice(data, start, end) { - const bytes2 = getBytes(data); - if (end != null && end > bytes2.length) { - assert(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", { - buffer: bytes2, - length: bytes2.length, - offset: end - }); - } - return hexlify(bytes2.slice(start == null ? 0 : start, end == null ? bytes2.length : end)); -} -function stripZerosLeft(data) { - let bytes2 = hexlify(data).substring(2); - while (bytes2.startsWith("00")) { - bytes2 = bytes2.substring(2); - } - return "0x" + bytes2; -} -function zeroPad(data, length, left) { - const bytes2 = getBytes(data); - assert(length >= bytes2.length, "padding exceeds data length", "BUFFER_OVERRUN", { - buffer: new Uint8Array(bytes2), - length, - offset: length + 1 - }); - const result = new Uint8Array(length); - result.fill(0); - if (left) { - result.set(bytes2, length - bytes2.length); - } else { - result.set(bytes2, 0); - } - return hexlify(result); -} -function zeroPadValue(data, length) { - return zeroPad(data, length, true); -} -function zeroPadBytes(data, length) { - return zeroPad(data, length, false); -} - -// node_modules/ethers/lib.esm/utils/maths.js -var BN_0 = BigInt(0); -var BN_1 = BigInt(1); -var maxValue = 9007199254740991; -function fromTwos(_value2, _width) { - const value = getUint(_value2, "value"); - const width = BigInt(getNumber(_width, "width")); - assert(value >> width === BN_0, "overflow", "NUMERIC_FAULT", { - operation: "fromTwos", - fault: "overflow", - value: _value2 - }); - if (value >> width - BN_1) { - const mask2 = (BN_1 << width) - BN_1; - return -((~value & mask2) + BN_1); - } - return value; -} -function toTwos(_value2, _width) { - let value = getBigInt(_value2, "value"); - const width = BigInt(getNumber(_width, "width")); - const limit = BN_1 << width - BN_1; - if (value < BN_0) { - value = -value; - assert(value <= limit, "too low", "NUMERIC_FAULT", { - operation: "toTwos", - fault: "overflow", - value: _value2 - }); - const mask2 = (BN_1 << width) - BN_1; - return (~value & mask2) + BN_1; - } else { - assert(value < limit, "too high", "NUMERIC_FAULT", { - operation: "toTwos", - fault: "overflow", - value: _value2 - }); - } - return value; -} -function mask(_value2, _bits) { - const value = getUint(_value2, "value"); - const bits = BigInt(getNumber(_bits, "bits")); - return value & (BN_1 << bits) - BN_1; -} -function getBigInt(value, name) { - switch (typeof value) { - case "bigint": - return value; - case "number": - assertArgument(Number.isInteger(value), "underflow", name || "value", value); - assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); - return BigInt(value); - case "string": - try { - if (value === "") { - throw new Error("empty string"); - } - if (value[0] === "-" && value[1] !== "-") { - return -BigInt(value.substring(1)); - } - return BigInt(value); - } catch (e) { - assertArgument(false, `invalid BigNumberish string: ${e.message}`, name || "value", value); - } - } - assertArgument(false, "invalid BigNumberish value", name || "value", value); -} -function getUint(value, name) { - const result = getBigInt(value, name); - assert(result >= BN_0, "unsigned value cannot be negative", "NUMERIC_FAULT", { - fault: "overflow", - operation: "getUint", - value - }); - return result; -} -var Nibbles = "0123456789abcdef"; -function toBigInt(value) { - if (value instanceof Uint8Array) { - let result = "0x0"; - for (const v of value) { - result += Nibbles[v >> 4]; - result += Nibbles[v & 15]; - } - return BigInt(result); - } - return getBigInt(value); -} -function getNumber(value, name) { - switch (typeof value) { - case "bigint": - assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); - return Number(value); - case "number": - assertArgument(Number.isInteger(value), "underflow", name || "value", value); - assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); - return value; - case "string": - try { - if (value === "") { - throw new Error("empty string"); - } - return getNumber(BigInt(value), name); - } catch (e) { - assertArgument(false, `invalid numeric string: ${e.message}`, name || "value", value); - } - } - assertArgument(false, "invalid numeric value", name || "value", value); -} -function toNumber(value) { - return getNumber(toBigInt(value)); -} -function toBeHex(_value2, _width) { - const value = getUint(_value2, "value"); - let result = value.toString(16); - if (_width == null) { - if (result.length % 2) { - result = "0" + result; - } - } else { - const width = getNumber(_width, "width"); - assert(width * 2 >= result.length, `value exceeds width (${width} bytes)`, "NUMERIC_FAULT", { - operation: "toBeHex", - fault: "overflow", - value: _value2 - }); - while (result.length < width * 2) { - result = "0" + result; - } - } - return "0x" + result; -} -function toBeArray(_value2) { - const value = getUint(_value2, "value"); - if (value === BN_0) { - return new Uint8Array([]); - } - let hex = value.toString(16); - if (hex.length % 2) { - hex = "0" + hex; - } - const result = new Uint8Array(hex.length / 2); - for (let i = 0; i < result.length; i++) { - const offset = i * 2; - result[i] = parseInt(hex.substring(offset, offset + 2), 16); - } - return result; -} -function toQuantity(value) { - let result = hexlify(isBytesLike(value) ? value : toBeArray(value)).substring(2); - while (result.startsWith("0")) { - result = result.substring(1); - } - if (result === "") { - result = "0"; - } - return "0x" + result; -} - -// node_modules/ethers/lib.esm/utils/base58.js -var Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; -var Lookup = null; -function getAlpha(letter) { - if (Lookup == null) { - Lookup = {}; - for (let i = 0; i < Alphabet.length; i++) { - Lookup[Alphabet[i]] = BigInt(i); - } - } - const result = Lookup[letter]; - assertArgument(result != null, `invalid base58 value`, "letter", letter); - return result; -} -var BN_02 = BigInt(0); -var BN_58 = BigInt(58); -function encodeBase58(_value2) { - const bytes2 = getBytes(_value2); - let value = toBigInt(bytes2); - let result = ""; - while (value) { - result = Alphabet[Number(value % BN_58)] + result; - value /= BN_58; - } - for (let i = 0; i < bytes2.length; i++) { - if (bytes2[i]) { - break; - } - result = Alphabet[0] + result; - } - return result; -} -function decodeBase58(value) { - let result = BN_02; - for (let i = 0; i < value.length; i++) { - result *= BN_58; - result += getAlpha(value[i]); - } - return result; -} - -// node_modules/ethers/lib.esm/utils/base64-browser.js -function decodeBase64(textData) { - textData = atob(textData); - const data = new Uint8Array(textData.length); - for (let i = 0; i < textData.length; i++) { - data[i] = textData.charCodeAt(i); - } - return getBytes(data); -} -function encodeBase64(_data5) { - const data = getBytes(_data5); - let textData = ""; - for (let i = 0; i < data.length; i++) { - textData += String.fromCharCode(data[i]); - } - return btoa(textData); -} - -// node_modules/ethers/lib.esm/utils/events.js -var _listener; -var EventPayload = class { - /** - * Create a new **EventPayload** for %%emitter%% with - * the %%listener%% and for %%filter%%. - */ - constructor(emitter, listener, filter) { - /** - * The event filter. - */ - __publicField(this, "filter"); - /** - * The **EventEmitterable**. - */ - __publicField(this, "emitter"); - __privateAdd(this, _listener, void 0); - __privateSet(this, _listener, listener); - defineProperties(this, { emitter, filter }); - } - /** - * Unregister the triggered listener for future events. - */ - async removeListener() { - if (__privateGet(this, _listener) == null) { - return; - } - await this.emitter.off(this.filter, __privateGet(this, _listener)); - } -}; -_listener = new WeakMap(); - -// node_modules/ethers/lib.esm/utils/utf8.js -function errorFunc(reason, offset, bytes2, output2, badCodepoint) { - assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes2); -} -function ignoreFunc(reason, offset, bytes2, output2, badCodepoint) { - if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") { - let i = 0; - for (let o = offset + 1; o < bytes2.length; o++) { - if (bytes2[o] >> 6 !== 2) { - break; - } - i++; - } - return i; - } - if (reason === "OVERRUN") { - return bytes2.length - offset - 1; - } - return 0; -} -function replaceFunc(reason, offset, bytes2, output2, badCodepoint) { - if (reason === "OVERLONG") { - assertArgument(typeof badCodepoint === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint); - output2.push(badCodepoint); - return 0; - } - output2.push(65533); - return ignoreFunc(reason, offset, bytes2, output2, badCodepoint); -} -var Utf8ErrorFuncs = Object.freeze({ - error: errorFunc, - ignore: ignoreFunc, - replace: replaceFunc -}); -function getUtf8CodePoints(_bytes, onError) { - if (onError == null) { - onError = Utf8ErrorFuncs.error; - } - const bytes2 = getBytes(_bytes, "bytes"); - const result = []; - let i = 0; - while (i < bytes2.length) { - const c = bytes2[i++]; - if (c >> 7 === 0) { - result.push(c); - continue; - } - let extraLength = null; - let overlongMask = null; - if ((c & 224) === 192) { - extraLength = 1; - overlongMask = 127; - } else if ((c & 240) === 224) { - extraLength = 2; - overlongMask = 2047; - } else if ((c & 248) === 240) { - extraLength = 3; - overlongMask = 65535; - } else { - if ((c & 192) === 128) { - i += onError("UNEXPECTED_CONTINUE", i - 1, bytes2, result); - } else { - i += onError("BAD_PREFIX", i - 1, bytes2, result); - } - continue; - } - if (i - 1 + extraLength >= bytes2.length) { - i += onError("OVERRUN", i - 1, bytes2, result); - continue; - } - let res = c & (1 << 8 - extraLength - 1) - 1; - for (let j = 0; j < extraLength; j++) { - let nextChar = bytes2[i]; - if ((nextChar & 192) != 128) { - i += onError("MISSING_CONTINUE", i, bytes2, result); - res = null; - break; - } - ; - res = res << 6 | nextChar & 63; - i++; - } - if (res === null) { - continue; - } - if (res > 1114111) { - i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes2, result, res); - continue; - } - if (res >= 55296 && res <= 57343) { - i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes2, result, res); - continue; - } - if (res <= overlongMask) { - i += onError("OVERLONG", i - 1 - extraLength, bytes2, result, res); - continue; - } - result.push(res); - } - return result; -} -function toUtf8Bytes(str, form) { - assertArgument(typeof str === "string", "invalid string value", "str", str); - if (form != null) { - assertNormalize(form); - str = str.normalize(form); - } - let result = []; - for (let i = 0; i < str.length; i++) { - const c = str.charCodeAt(i); - if (c < 128) { - result.push(c); - } else if (c < 2048) { - result.push(c >> 6 | 192); - result.push(c & 63 | 128); - } else if ((c & 64512) == 55296) { - i++; - const c2 = str.charCodeAt(i); - assertArgument(i < str.length && (c2 & 64512) === 56320, "invalid surrogate pair", "str", str); - const pair = 65536 + ((c & 1023) << 10) + (c2 & 1023); - result.push(pair >> 18 | 240); - result.push(pair >> 12 & 63 | 128); - result.push(pair >> 6 & 63 | 128); - result.push(pair & 63 | 128); - } else { - result.push(c >> 12 | 224); - result.push(c >> 6 & 63 | 128); - result.push(c & 63 | 128); - } - } - return new Uint8Array(result); -} -function _toUtf8String(codePoints) { - return codePoints.map((codePoint) => { - if (codePoint <= 65535) { - return String.fromCharCode(codePoint); - } - codePoint -= 65536; - return String.fromCharCode((codePoint >> 10 & 1023) + 55296, (codePoint & 1023) + 56320); - }).join(""); -} -function toUtf8String(bytes2, onError) { - return _toUtf8String(getUtf8CodePoints(bytes2, onError)); -} -function toUtf8CodePoints(str, form) { - return getUtf8CodePoints(toUtf8Bytes(str, form)); -} - -// node_modules/ethers/lib.esm/utils/geturl-browser.js -function createGetUrl(options) { - async function getUrl(req, _signal2) { - const protocol = req.url.split(":")[0].toLowerCase(); - assert(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { - info: { protocol }, - operation: "request" - }); - assert(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { - operation: "request" - }); - let signal = void 0; - if (_signal2) { - const controller = new AbortController(); - signal = controller.signal; - _signal2.addListener(() => { - controller.abort(); - }); - } - const init = { - method: req.method, - headers: new Headers(Array.from(req)), - body: req.body || void 0, - signal - }; - const resp = await fetch(req.url, init); - const headers = {}; - resp.headers.forEach((value, key) => { - headers[key.toLowerCase()] = value; - }); - const respBody = await resp.arrayBuffer(); - const body = respBody == null ? null : new Uint8Array(respBody); - return { - statusCode: resp.status, - statusMessage: resp.statusText, - headers, - body - }; - } - return getUrl; -} -var defaultGetUrl = createGetUrl({}); - -// node_modules/ethers/lib.esm/utils/fetch.js -var MAX_ATTEMPTS = 12; -var SLOT_INTERVAL = 250; -var defaultGetUrlFunc = createGetUrl(); -var reData = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"); -var reIpfs = new RegExp("^ipfs://(ipfs/)?(.*)$", "i"); -var locked = false; -async function dataGatewayFunc(url, signal) { - try { - const match = url.match(reData); - if (!match) { - throw new Error("invalid data"); - } - return new FetchResponse(200, "OK", { - "content-type": match[1] || "text/plain" - }, match[2] ? decodeBase64(match[3]) : unpercent(match[3])); - } catch (error) { - return new FetchResponse(599, "BAD REQUEST (invalid data: URI)", {}, null, new FetchRequest(url)); - } -} -function getIpfsGatewayFunc(baseUrl) { - async function gatewayIpfs(url, signal) { - try { - const match = url.match(reIpfs); - if (!match) { - throw new Error("invalid link"); - } - return new FetchRequest(`${baseUrl}${match[2]}`); - } catch (error) { - return new FetchResponse(599, "BAD REQUEST (invalid IPFS URI)", {}, null, new FetchRequest(url)); - } - } - return gatewayIpfs; -} -var Gateways = { - "data": dataGatewayFunc, - "ipfs": getIpfsGatewayFunc("https://gateway.ipfs.io/ipfs/") -}; -var fetchSignals = /* @__PURE__ */ new WeakMap(); -var _listeners, _cancelled; -var FetchCancelSignal = class { - constructor(request) { - __privateAdd(this, _listeners, void 0); - __privateAdd(this, _cancelled, void 0); - __privateSet(this, _listeners, []); - __privateSet(this, _cancelled, false); - fetchSignals.set(request, () => { - if (__privateGet(this, _cancelled)) { - return; - } - __privateSet(this, _cancelled, true); - for (const listener of __privateGet(this, _listeners)) { - setTimeout(() => { - listener(); - }, 0); - } - __privateSet(this, _listeners, []); - }); - } - addListener(listener) { - assert(!__privateGet(this, _cancelled), "singal already cancelled", "UNSUPPORTED_OPERATION", { - operation: "fetchCancelSignal.addCancelListener" - }); - __privateGet(this, _listeners).push(listener); - } - get cancelled() { - return __privateGet(this, _cancelled); - } - checkSignal() { - assert(!this.cancelled, "cancelled", "CANCELLED", {}); - } -}; -_listeners = new WeakMap(); -_cancelled = new WeakMap(); -function checkSignal(signal) { - if (signal == null) { - throw new Error("missing signal; should not happen"); - } - signal.checkSignal(); - return signal; -} -var _allowInsecure, _gzip, _headers, _method, _timeout, _url, _body, _bodyType, _creds, _preflight, _process, _retry, _signal, _throttle, _getUrlFunc, _send, send_fn; -var _FetchRequest = class _FetchRequest { - /** - * Create a new FetchRequest instance with default values. - * - * Once created, each property may be set before issuing a - * ``.send()`` to make the request. - */ - constructor(url) { - __privateAdd(this, _send); - __privateAdd(this, _allowInsecure, void 0); - __privateAdd(this, _gzip, void 0); - __privateAdd(this, _headers, void 0); - __privateAdd(this, _method, void 0); - __privateAdd(this, _timeout, void 0); - __privateAdd(this, _url, void 0); - __privateAdd(this, _body, void 0); - __privateAdd(this, _bodyType, void 0); - __privateAdd(this, _creds, void 0); - // Hooks - __privateAdd(this, _preflight, void 0); - __privateAdd(this, _process, void 0); - __privateAdd(this, _retry, void 0); - __privateAdd(this, _signal, void 0); - __privateAdd(this, _throttle, void 0); - __privateAdd(this, _getUrlFunc, void 0); - __privateSet(this, _url, String(url)); - __privateSet(this, _allowInsecure, false); - __privateSet(this, _gzip, true); - __privateSet(this, _headers, {}); - __privateSet(this, _method, ""); - __privateSet(this, _timeout, 3e5); - __privateSet(this, _throttle, { - slotInterval: SLOT_INTERVAL, - maxAttempts: MAX_ATTEMPTS - }); - __privateSet(this, _getUrlFunc, null); - } - /** - * The fetch URL to request. - */ - get url() { - return __privateGet(this, _url); - } - set url(url) { - __privateSet(this, _url, String(url)); - } - /** - * The fetch body, if any, to send as the request body. //(default: null)// - * - * When setting a body, the intrinsic ``Content-Type`` is automatically - * set and will be used if **not overridden** by setting a custom - * header. - * - * If %%body%% is null, the body is cleared (along with the - * intrinsic ``Content-Type``). - * - * If %%body%% is a string, the intrinsic ``Content-Type`` is set to - * ``text/plain``. - * - * If %%body%% is a Uint8Array, the intrinsic ``Content-Type`` is set to - * ``application/octet-stream``. - * - * If %%body%% is any other object, the intrinsic ``Content-Type`` is - * set to ``application/json``. - */ - get body() { - if (__privateGet(this, _body) == null) { - return null; - } - return new Uint8Array(__privateGet(this, _body)); - } - set body(body) { - if (body == null) { - __privateSet(this, _body, void 0); - __privateSet(this, _bodyType, void 0); - } else if (typeof body === "string") { - __privateSet(this, _body, toUtf8Bytes(body)); - __privateSet(this, _bodyType, "text/plain"); - } else if (body instanceof Uint8Array) { - __privateSet(this, _body, body); - __privateSet(this, _bodyType, "application/octet-stream"); - } else if (typeof body === "object") { - __privateSet(this, _body, toUtf8Bytes(JSON.stringify(body))); - __privateSet(this, _bodyType, "application/json"); - } else { - throw new Error("invalid body"); - } - } - /** - * Returns true if the request has a body. - */ - hasBody() { - return __privateGet(this, _body) != null; - } - /** - * The HTTP method to use when requesting the URI. If no method - * has been explicitly set, then ``GET`` is used if the body is - * null and ``POST`` otherwise. - */ - get method() { - if (__privateGet(this, _method)) { - return __privateGet(this, _method); - } - if (this.hasBody()) { - return "POST"; - } - return "GET"; - } - set method(method) { - if (method == null) { - method = ""; - } - __privateSet(this, _method, String(method).toUpperCase()); - } - /** - * The headers that will be used when requesting the URI. All - * keys are lower-case. - * - * This object is a copy, so any changes will **NOT** be reflected - * in the ``FetchRequest``. - * - * To set a header entry, use the ``setHeader`` method. - */ - get headers() { - const headers = Object.assign({}, __privateGet(this, _headers)); - if (__privateGet(this, _creds)) { - headers["authorization"] = `Basic ${encodeBase64(toUtf8Bytes(__privateGet(this, _creds)))}`; - } - ; - if (this.allowGzip) { - headers["accept-encoding"] = "gzip"; - } - if (headers["content-type"] == null && __privateGet(this, _bodyType)) { - headers["content-type"] = __privateGet(this, _bodyType); - } - if (this.body) { - headers["content-length"] = String(this.body.length); - } - return headers; - } - /** - * Get the header for %%key%%, ignoring case. - */ - getHeader(key) { - return this.headers[key.toLowerCase()]; - } - /** - * Set the header for %%key%% to %%value%%. All values are coerced - * to a string. - */ - setHeader(key, value) { - __privateGet(this, _headers)[String(key).toLowerCase()] = String(value); - } - /** - * Clear all headers, resetting all intrinsic headers. - */ - clearHeaders() { - __privateSet(this, _headers, {}); - } - [Symbol.iterator]() { - const headers = this.headers; - const keys = Object.keys(headers); - let index = 0; - return { - next: () => { - if (index < keys.length) { - const key = keys[index++]; - return { - value: [key, headers[key]], - done: false - }; - } - return { value: void 0, done: true }; - } - }; - } - /** - * The value that will be sent for the ``Authorization`` header. - * - * To set the credentials, use the ``setCredentials`` method. - */ - get credentials() { - return __privateGet(this, _creds) || null; - } - /** - * Sets an ``Authorization`` for %%username%% with %%password%%. - */ - setCredentials(username, password) { - assertArgument(!username.match(/:/), "invalid basic authentication username", "username", "[REDACTED]"); - __privateSet(this, _creds, `${username}:${password}`); - } - /** - * Enable and request gzip-encoded responses. The response will - * automatically be decompressed. //(default: true)// - */ - get allowGzip() { - return __privateGet(this, _gzip); - } - set allowGzip(value) { - __privateSet(this, _gzip, !!value); - } - /** - * Allow ``Authentication`` credentials to be sent over insecure - * channels. //(default: false)// - */ - get allowInsecureAuthentication() { - return !!__privateGet(this, _allowInsecure); - } - set allowInsecureAuthentication(value) { - __privateSet(this, _allowInsecure, !!value); - } - /** - * The timeout (in milliseconds) to wait for a complete response. - * //(default: 5 minutes)// - */ - get timeout() { - return __privateGet(this, _timeout); - } - set timeout(timeout) { - assertArgument(timeout >= 0, "timeout must be non-zero", "timeout", timeout); - __privateSet(this, _timeout, timeout); - } - /** - * This function is called prior to each request, for example - * during a redirection or retry in case of server throttling. - * - * This offers an opportunity to populate headers or update - * content before sending a request. - */ - get preflightFunc() { - return __privateGet(this, _preflight) || null; - } - set preflightFunc(preflight) { - __privateSet(this, _preflight, preflight); - } - /** - * This function is called after each response, offering an - * opportunity to provide client-level throttling or updating - * response data. - * - * Any error thrown in this causes the ``send()`` to throw. - * - * To schedule a retry attempt (assuming the maximum retry limit - * has not been reached), use [[response.throwThrottleError]]. - */ - get processFunc() { - return __privateGet(this, _process) || null; - } - set processFunc(process) { - __privateSet(this, _process, process); - } - /** - * This function is called on each retry attempt. - */ - get retryFunc() { - return __privateGet(this, _retry) || null; - } - set retryFunc(retry) { - __privateSet(this, _retry, retry); - } - /** - * This function is called to fetch content from HTTP and - * HTTPS URLs and is platform specific (e.g. nodejs vs - * browsers). - * - * This is by default the currently registered global getUrl - * function, which can be changed using [[registerGetUrl]]. - * If this has been set, setting is to ``null`` will cause - * this FetchRequest (and any future clones) to revert back to - * using the currently registered global getUrl function. - * - * Setting this is generally not necessary, but may be useful - * for developers that wish to intercept requests or to - * configurege a proxy or other agent. - */ - get getUrlFunc() { - return __privateGet(this, _getUrlFunc) || defaultGetUrlFunc; - } - set getUrlFunc(value) { - __privateSet(this, _getUrlFunc, value); - } - toString() { - return ``; - } - /** - * Update the throttle parameters used to determine maximum - * attempts and exponential-backoff properties. - */ - setThrottleParams(params) { - if (params.slotInterval != null) { - __privateGet(this, _throttle).slotInterval = params.slotInterval; - } - if (params.maxAttempts != null) { - __privateGet(this, _throttle).maxAttempts = params.maxAttempts; - } - } - /** - * Resolves to the response by sending the request. - */ - send() { - assert(__privateGet(this, _signal) == null, "request already sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.send" }); - __privateSet(this, _signal, new FetchCancelSignal(this)); - return __privateMethod(this, _send, send_fn).call(this, 0, getTime() + this.timeout, 0, this, new FetchResponse(0, "", {}, null, this)); - } - /** - * Cancels the inflight response, causing a ``CANCELLED`` - * error to be rejected from the [[send]]. - */ - cancel() { - assert(__privateGet(this, _signal) != null, "request has not been sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.cancel" }); - const signal = fetchSignals.get(this); - if (!signal) { - throw new Error("missing signal; should not happen"); - } - signal(); - } - /** - * Returns a new [[FetchRequest]] that represents the redirection - * to %%location%%. - */ - redirect(location) { - const current = this.url.split(":")[0].toLowerCase(); - const target = location.split(":")[0].toLowerCase(); - assert(this.method === "GET" && (current !== "https" || target !== "http") && location.match(/^https?:/), `unsupported redirect`, "UNSUPPORTED_OPERATION", { - operation: `redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})` - }); - const req = new _FetchRequest(location); - req.method = "GET"; - req.allowGzip = this.allowGzip; - req.timeout = this.timeout; - __privateSet(req, _headers, Object.assign({}, __privateGet(this, _headers))); - if (__privateGet(this, _body)) { - __privateSet(req, _body, new Uint8Array(__privateGet(this, _body))); - } - __privateSet(req, _bodyType, __privateGet(this, _bodyType)); - return req; - } - /** - * Create a new copy of this request. - */ - clone() { - const clone = new _FetchRequest(this.url); - __privateSet(clone, _method, __privateGet(this, _method)); - if (__privateGet(this, _body)) { - __privateSet(clone, _body, __privateGet(this, _body)); - } - __privateSet(clone, _bodyType, __privateGet(this, _bodyType)); - __privateSet(clone, _headers, Object.assign({}, __privateGet(this, _headers))); - __privateSet(clone, _creds, __privateGet(this, _creds)); - if (this.allowGzip) { - clone.allowGzip = true; - } - clone.timeout = this.timeout; - if (this.allowInsecureAuthentication) { - clone.allowInsecureAuthentication = true; - } - __privateSet(clone, _preflight, __privateGet(this, _preflight)); - __privateSet(clone, _process, __privateGet(this, _process)); - __privateSet(clone, _retry, __privateGet(this, _retry)); - __privateSet(clone, _getUrlFunc, __privateGet(this, _getUrlFunc)); - return clone; - } - /** - * Locks all static configuration for gateways and FetchGetUrlFunc - * registration. - */ - static lockConfig() { - locked = true; - } - /** - * Get the current Gateway function for %%scheme%%. - */ - static getGateway(scheme) { - return Gateways[scheme.toLowerCase()] || null; - } - /** - * Use the %%func%% when fetching URIs using %%scheme%%. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGateway(scheme, func) { - scheme = scheme.toLowerCase(); - if (scheme === "http" || scheme === "https") { - throw new Error(`cannot intercept ${scheme}; use registerGetUrl`); - } - if (locked) { - throw new Error("gateways locked"); - } - Gateways[scheme] = func; - } - /** - * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. - * - * This method affects all requests globally. - * - * If [[lockConfig]] has been called, no change is made and this - * throws. - */ - static registerGetUrl(getUrl) { - if (locked) { - throw new Error("gateways locked"); - } - defaultGetUrlFunc = getUrl; - } - /** - * Creates a getUrl function that fetches content from HTTP and - * HTTPS URLs. - * - * The available %%options%% are dependent on the platform - * implementation of the default getUrl function. - * - * This is not generally something that is needed, but is useful - * when trying to customize simple behaviour when fetching HTTP - * content. - */ - static createGetUrlFunc(options) { - return createGetUrl(options); - } - /** - * Creates a function that can "fetch" data URIs. - * - * Note that this is automatically done internally to support - * data URIs, so it is not necessary to register it. - * - * This is not generally something that is needed, but may - * be useful in a wrapper to perfom custom data URI functionality. - */ - static createDataGateway() { - return dataGatewayFunc; - } - /** - * Creates a function that will fetch IPFS (unvalidated) from - * a custom gateway baseUrl. - * - * The default IPFS gateway used internally is - * ``"https:/\/gateway.ipfs.io/ipfs/"``. - */ - static createIpfsGatewayFunc(baseUrl) { - return getIpfsGatewayFunc(baseUrl); - } -}; -_allowInsecure = new WeakMap(); -_gzip = new WeakMap(); -_headers = new WeakMap(); -_method = new WeakMap(); -_timeout = new WeakMap(); -_url = new WeakMap(); -_body = new WeakMap(); -_bodyType = new WeakMap(); -_creds = new WeakMap(); -_preflight = new WeakMap(); -_process = new WeakMap(); -_retry = new WeakMap(); -_signal = new WeakMap(); -_throttle = new WeakMap(); -_getUrlFunc = new WeakMap(); -_send = new WeakSet(); -send_fn = async function(attempt, expires, delay, _request3, _response) { - var _a2, _b, _c; - if (attempt >= __privateGet(this, _throttle).maxAttempts) { - return _response.makeServerError("exceeded maximum retry limit"); - } - assert(getTime() <= expires, "timeout", "TIMEOUT", { - operation: "request.send", - reason: "timeout", - request: _request3 - }); - if (delay > 0) { - await wait(delay); - } - let req = this.clone(); - const scheme = (req.url.split(":")[0] || "").toLowerCase(); - if (scheme in Gateways) { - const result = await Gateways[scheme](req.url, checkSignal(__privateGet(_request3, _signal))); - if (result instanceof FetchResponse) { - let response2 = result; - if (this.processFunc) { - checkSignal(__privateGet(_request3, _signal)); - try { - response2 = await this.processFunc(req, response2); - } catch (error) { - if (error.throttle == null || typeof error.stall !== "number") { - response2.makeServerError("error in post-processing function", error).assertOk(); - } - } - } - return response2; - } - req = result; - } - if (this.preflightFunc) { - req = await this.preflightFunc(req); - } - const resp = await this.getUrlFunc(req, checkSignal(__privateGet(_request3, _signal))); - let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request3); - if (response.statusCode === 301 || response.statusCode === 302) { - try { - const location = response.headers.location || ""; - return __privateMethod(_a2 = req.redirect(location), _send, send_fn).call(_a2, attempt + 1, expires, 0, _request3, response); - } catch (error) { - } - return response; - } else if (response.statusCode === 429) { - if (this.retryFunc == null || await this.retryFunc(req, response, attempt)) { - const retryAfter = response.headers["retry-after"]; - let delay2 = __privateGet(this, _throttle).slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); - if (typeof retryAfter === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { - delay2 = parseInt(retryAfter); - } - return __privateMethod(_b = req.clone(), _send, send_fn).call(_b, attempt + 1, expires, delay2, _request3, response); - } - } - if (this.processFunc) { - checkSignal(__privateGet(_request3, _signal)); - try { - response = await this.processFunc(req, response); - } catch (error) { - if (error.throttle == null || typeof error.stall !== "number") { - response.makeServerError("error in post-processing function", error).assertOk(); - } - let delay2 = __privateGet(this, _throttle).slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); - ; - if (error.stall >= 0) { - delay2 = error.stall; - } - return __privateMethod(_c = req.clone(), _send, send_fn).call(_c, attempt + 1, expires, delay2, _request3, response); - } - } - return response; -}; -var FetchRequest = _FetchRequest; -var _statusCode, _statusMessage, _headers2, _body2, _request, _error; -var _FetchResponse = class _FetchResponse { - constructor(statusCode, statusMessage, headers, body, request) { - __privateAdd(this, _statusCode, void 0); - __privateAdd(this, _statusMessage, void 0); - __privateAdd(this, _headers2, void 0); - __privateAdd(this, _body2, void 0); - __privateAdd(this, _request, void 0); - __privateAdd(this, _error, void 0); - __privateSet(this, _statusCode, statusCode); - __privateSet(this, _statusMessage, statusMessage); - __privateSet(this, _headers2, Object.keys(headers).reduce((accum, k) => { - accum[k.toLowerCase()] = String(headers[k]); - return accum; - }, {})); - __privateSet(this, _body2, body == null ? null : new Uint8Array(body)); - __privateSet(this, _request, request || null); - __privateSet(this, _error, { message: "" }); - } - toString() { - return ``; - } - /** - * The response status code. - */ - get statusCode() { - return __privateGet(this, _statusCode); - } - /** - * The response status message. - */ - get statusMessage() { - return __privateGet(this, _statusMessage); - } - /** - * The response headers. All keys are lower-case. - */ - get headers() { - return Object.assign({}, __privateGet(this, _headers2)); - } - /** - * The response body, or ``null`` if there was no body. - */ - get body() { - return __privateGet(this, _body2) == null ? null : new Uint8Array(__privateGet(this, _body2)); - } - /** - * The response body as a UTF-8 encoded string, or the empty - * string (i.e. ``""``) if there was no body. - * - * An error is thrown if the body is invalid UTF-8 data. - */ - get bodyText() { - try { - return __privateGet(this, _body2) == null ? "" : toUtf8String(__privateGet(this, _body2)); - } catch (error) { - assert(false, "response body is not valid UTF-8 data", "UNSUPPORTED_OPERATION", { - operation: "bodyText", - info: { response: this } - }); - } - } - /** - * The response body, decoded as JSON. - * - * An error is thrown if the body is invalid JSON-encoded data - * or if there was no body. - */ - get bodyJson() { - try { - return JSON.parse(this.bodyText); - } catch (error) { - assert(false, "response body is not valid JSON", "UNSUPPORTED_OPERATION", { - operation: "bodyJson", - info: { response: this } - }); - } - } - [Symbol.iterator]() { - const headers = this.headers; - const keys = Object.keys(headers); - let index = 0; - return { - next: () => { - if (index < keys.length) { - const key = keys[index++]; - return { - value: [key, headers[key]], - done: false - }; - } - return { value: void 0, done: true }; - } - }; - } - /** - * Return a Response with matching headers and body, but with - * an error status code (i.e. 599) and %%message%% with an - * optional %%error%%. - */ - makeServerError(message, error) { - let statusMessage; - if (!message) { - message = `${this.statusCode} ${this.statusMessage}`; - statusMessage = `CLIENT ESCALATED SERVER ERROR (${message})`; - } else { - statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`; - } - const response = new _FetchResponse(599, statusMessage, this.headers, this.body, __privateGet(this, _request) || void 0); - __privateSet(response, _error, { message, error }); - return response; - } - /** - * If called within a [request.processFunc](FetchRequest-processFunc) - * call, causes the request to retry as if throttled for %%stall%% - * milliseconds. - */ - throwThrottleError(message, stall5) { - if (stall5 == null) { - stall5 = -1; - } else { - assertArgument(Number.isInteger(stall5) && stall5 >= 0, "invalid stall timeout", "stall", stall5); - } - const error = new Error(message || "throttling requests"); - defineProperties(error, { stall: stall5, throttle: true }); - throw error; - } - /** - * Get the header value for %%key%%, ignoring case. - */ - getHeader(key) { - return this.headers[key.toLowerCase()]; - } - /** - * Returns true if the response has a body. - */ - hasBody() { - return __privateGet(this, _body2) != null; - } - /** - * The request made for this response. - */ - get request() { - return __privateGet(this, _request); - } - /** - * Returns true if this response was a success statusCode. - */ - ok() { - return __privateGet(this, _error).message === "" && this.statusCode >= 200 && this.statusCode < 300; - } - /** - * Throws a ``SERVER_ERROR`` if this response is not ok. - */ - assertOk() { - if (this.ok()) { - return; - } - let { message, error } = __privateGet(this, _error); - if (message === "") { - message = `server response ${this.statusCode} ${this.statusMessage}`; - } - let requestUrl = null; - if (this.request) { - requestUrl = this.request.url; - } - let responseBody = null; - try { - if (__privateGet(this, _body2)) { - responseBody = toUtf8String(__privateGet(this, _body2)); - } - } catch (e) { - } - assert(false, message, "SERVER_ERROR", { - request: this.request || "unknown request", - response: this, - error, - info: { - requestUrl, - responseBody, - responseStatus: `${this.statusCode} ${this.statusMessage}` - } - }); - } -}; -_statusCode = new WeakMap(); -_statusMessage = new WeakMap(); -_headers2 = new WeakMap(); -_body2 = new WeakMap(); -_request = new WeakMap(); -_error = new WeakMap(); -var FetchResponse = _FetchResponse; -function getTime() { - return (/* @__PURE__ */ new Date()).getTime(); -} -function unpercent(value) { - return toUtf8Bytes(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => { - return String.fromCharCode(parseInt(code, 16)); - })); -} -function wait(delay) { - return new Promise((resolve) => setTimeout(resolve, delay)); -} - -// node_modules/ethers/lib.esm/utils/fixednumber.js -var BN_N1 = BigInt(-1); -var BN_03 = BigInt(0); -var BN_12 = BigInt(1); -var BN_5 = BigInt(5); -var _guard = {}; -var Zeros = "0000"; -while (Zeros.length < 80) { - Zeros += Zeros; -} -function getTens(decimals) { - let result = Zeros; - while (result.length < decimals) { - result += result; - } - return BigInt("1" + result.substring(0, decimals)); -} -function checkValue(val, format, safeOp) { - const width = BigInt(format.width); - if (format.signed) { - const limit = BN_12 << width - BN_12; - assert(safeOp == null || val >= -limit && val < limit, "overflow", "NUMERIC_FAULT", { - operation: safeOp, - fault: "overflow", - value: val - }); - if (val > BN_03) { - val = fromTwos(mask(val, width), width); - } else { - val = -fromTwos(mask(-val, width), width); - } - } else { - const limit = BN_12 << width; - assert(safeOp == null || val >= 0 && val < limit, "overflow", "NUMERIC_FAULT", { - operation: safeOp, - fault: "overflow", - value: val - }); - val = (val % limit + limit) % limit & limit - BN_12; - } - return val; -} -function getFormat(value) { - if (typeof value === "number") { - value = `fixed128x${value}`; - } - let signed = true; - let width = 128; - let decimals = 18; - if (typeof value === "string") { - if (value === "fixed") { - } else if (value === "ufixed") { - signed = false; - } else { - const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/); - assertArgument(match, "invalid fixed format", "format", value); - signed = match[1] !== "u"; - width = parseInt(match[2]); - decimals = parseInt(match[3]); - } - } else if (value) { - const v = value; - const check = (key, type, defaultValue) => { - if (v[key] == null) { - return defaultValue; - } - assertArgument(typeof v[key] === type, "invalid fixed format (" + key + " not " + type + ")", "format." + key, v[key]); - return v[key]; - }; - signed = check("signed", "boolean", signed); - width = check("width", "number", width); - decimals = check("decimals", "number", decimals); - } - assertArgument(width % 8 === 0, "invalid FixedNumber width (not byte aligned)", "format.width", width); - assertArgument(decimals <= 80, "invalid FixedNumber decimals (too large)", "format.decimals", decimals); - const name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals); - return { signed, width, decimals, name }; -} -function toString(val, decimals) { - let negative = ""; - if (val < BN_03) { - negative = "-"; - val *= BN_N1; - } - let str = val.toString(); - if (decimals === 0) { - return negative + str; - } - while (str.length <= decimals) { - str = Zeros + str; - } - const index = str.length - decimals; - str = str.substring(0, index) + "." + str.substring(index); - while (str[0] === "0" && str[1] !== ".") { - str = str.substring(1); - } - while (str[str.length - 1] === "0" && str[str.length - 2] !== ".") { - str = str.substring(0, str.length - 1); - } - return negative + str; -} -var _format, _val, _tens, _checkFormat, checkFormat_fn, _checkValue, checkValue_fn, _add, add_fn, _sub, sub_fn, _mul, mul_fn, _div, div_fn; -var _FixedNumber = class _FixedNumber { - // Use this when changing this file to get some typing info, - // but then switch to any to mask the internal type - //constructor(guard: any, value: bigint, format: _FixedFormat) { - /** - * @private - */ - constructor(guard, value, format) { - __privateAdd(this, _checkFormat); - __privateAdd(this, _checkValue); - __privateAdd(this, _add); - __privateAdd(this, _sub); - __privateAdd(this, _mul); - __privateAdd(this, _div); - /** - * The specific fixed-point arithmetic field for this value. - */ - __publicField(this, "format"); - __privateAdd(this, _format, void 0); - // The actual value (accounting for decimals) - __privateAdd(this, _val, void 0); - // A base-10 value to multiple values by to maintain the magnitude - __privateAdd(this, _tens, void 0); - /** - * This is a property so console.log shows a human-meaningful value. - * - * @private - */ - __publicField(this, "_value"); - assertPrivate(guard, _guard, "FixedNumber"); - __privateSet(this, _val, value); - __privateSet(this, _format, format); - const _value2 = toString(value, format.decimals); - defineProperties(this, { format: format.name, _value: _value2 }); - __privateSet(this, _tens, getTens(format.decimals)); - } - /** - * If true, negative values are permitted, otherwise only - * positive values and zero are allowed. - */ - get signed() { - return __privateGet(this, _format).signed; - } - /** - * The number of bits available to store the value. - */ - get width() { - return __privateGet(this, _format).width; - } - /** - * The number of decimal places in the fixed-point arithment field. - */ - get decimals() { - return __privateGet(this, _format).decimals; - } - /** - * The value as an integer, based on the smallest unit the - * [[decimals]] allow. - */ - get value() { - return __privateGet(this, _val); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% added - * to %%other%%, ignoring overflow. - */ - addUnsafe(other) { - return __privateMethod(this, _add, add_fn).call(this, other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% added - * to %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - add(other) { - return __privateMethod(this, _add, add_fn).call(this, other, "add"); - } - /** - * Returns a new [[FixedNumber]] with the result of %%other%% subtracted - * from %%this%%, ignoring overflow. - */ - subUnsafe(other) { - return __privateMethod(this, _sub, sub_fn).call(this, other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%other%% subtracted - * from %%this%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - sub(other) { - return __privateMethod(this, _sub, sub_fn).call(this, other, "sub"); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%, ignoring overflow and underflow (precision loss). - */ - mulUnsafe(other) { - return __privateMethod(this, _mul, mul_fn).call(this, other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs. - */ - mul(other) { - return __privateMethod(this, _mul, mul_fn).call(this, other, "mul"); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% multiplied - * by %%other%%. A [[NumericFaultError]] is thrown if overflow - * occurs or if underflow (precision loss) occurs. - */ - mulSignal(other) { - __privateMethod(this, _checkFormat, checkFormat_fn).call(this, other); - const value = __privateGet(this, _val) * __privateGet(other, _val); - assert(value % __privateGet(this, _tens) === BN_03, "precision lost during signalling mul", "NUMERIC_FAULT", { - operation: "mulSignal", - fault: "underflow", - value: this - }); - return __privateMethod(this, _checkValue, checkValue_fn).call(this, value / __privateGet(this, _tens), "mulSignal"); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%, ignoring underflow (precision loss). A - * [[NumericFaultError]] is thrown if overflow occurs. - */ - divUnsafe(other) { - return __privateMethod(this, _div, div_fn).call(this, other); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%, ignoring underflow (precision loss). A - * [[NumericFaultError]] is thrown if overflow occurs. - */ - div(other) { - return __privateMethod(this, _div, div_fn).call(this, other, "div"); - } - /** - * Returns a new [[FixedNumber]] with the result of %%this%% divided - * by %%other%%. A [[NumericFaultError]] is thrown if underflow - * (precision loss) occurs. - */ - divSignal(other) { - assert(__privateGet(other, _val) !== BN_03, "division by zero", "NUMERIC_FAULT", { - operation: "div", - fault: "divide-by-zero", - value: this - }); - __privateMethod(this, _checkFormat, checkFormat_fn).call(this, other); - const value = __privateGet(this, _val) * __privateGet(this, _tens); - assert(value % __privateGet(other, _val) === BN_03, "precision lost during signalling div", "NUMERIC_FAULT", { - operation: "divSignal", - fault: "underflow", - value: this - }); - return __privateMethod(this, _checkValue, checkValue_fn).call(this, value / __privateGet(other, _val), "divSignal"); - } - /** - * Returns a comparison result between %%this%% and %%other%%. - * - * This is suitable for use in sorting, where ``-1`` implies %%this%% - * is smaller, ``1`` implies %%this%% is larger and ``0`` implies - * both are equal. - */ - cmp(other) { - let a = this.value, b2 = other.value; - const delta = this.decimals - other.decimals; - if (delta > 0) { - b2 *= getTens(delta); - } else if (delta < 0) { - a *= getTens(-delta); - } - if (a < b2) { - return -1; - } - if (a > b2) { - return 1; - } - return 0; - } - /** - * Returns true if %%other%% is equal to %%this%%. - */ - eq(other) { - return this.cmp(other) === 0; - } - /** - * Returns true if %%other%% is less than to %%this%%. - */ - lt(other) { - return this.cmp(other) < 0; - } - /** - * Returns true if %%other%% is less than or equal to %%this%%. - */ - lte(other) { - return this.cmp(other) <= 0; - } - /** - * Returns true if %%other%% is greater than to %%this%%. - */ - gt(other) { - return this.cmp(other) > 0; - } - /** - * Returns true if %%other%% is greater than or equal to %%this%%. - */ - gte(other) { - return this.cmp(other) >= 0; - } - /** - * Returns a new [[FixedNumber]] which is the largest **integer** - * that is less than or equal to %%this%%. - * - * The decimal component of the result will always be ``0``. - */ - floor() { - let val = __privateGet(this, _val); - if (__privateGet(this, _val) < BN_03) { - val -= __privateGet(this, _tens) - BN_12; - } - val = __privateGet(this, _val) / __privateGet(this, _tens) * __privateGet(this, _tens); - return __privateMethod(this, _checkValue, checkValue_fn).call(this, val, "floor"); - } - /** - * Returns a new [[FixedNumber]] which is the smallest **integer** - * that is greater than or equal to %%this%%. - * - * The decimal component of the result will always be ``0``. - */ - ceiling() { - let val = __privateGet(this, _val); - if (__privateGet(this, _val) > BN_03) { - val += __privateGet(this, _tens) - BN_12; - } - val = __privateGet(this, _val) / __privateGet(this, _tens) * __privateGet(this, _tens); - return __privateMethod(this, _checkValue, checkValue_fn).call(this, val, "ceiling"); - } - /** - * Returns a new [[FixedNumber]] with the decimal component - * rounded up on ties at %%decimals%% places. - */ - round(decimals) { - if (decimals == null) { - decimals = 0; - } - if (decimals >= this.decimals) { - return this; - } - const delta = this.decimals - decimals; - const bump = BN_5 * getTens(delta - 1); - let value = this.value + bump; - const tens = getTens(delta); - value = value / tens * tens; - checkValue(value, __privateGet(this, _format), "round"); - return new _FixedNumber(_guard, value, __privateGet(this, _format)); - } - /** - * Returns true if %%this%% is equal to ``0``. - */ - isZero() { - return __privateGet(this, _val) === BN_03; - } - /** - * Returns true if %%this%% is less than ``0``. - */ - isNegative() { - return __privateGet(this, _val) < BN_03; - } - /** - * Returns the string representation of %%this%%. - */ - toString() { - return this._value; - } - /** - * Returns a float approximation. - * - * Due to IEEE 754 precission (or lack thereof), this function - * can only return an approximation and most values will contain - * rounding errors. - */ - toUnsafeFloat() { - return parseFloat(this.toString()); - } - /** - * Return a new [[FixedNumber]] with the same value but has had - * its field set to %%format%%. - * - * This will throw if the value cannot fit into %%format%%. - */ - toFormat(format) { - return _FixedNumber.fromString(this.toString(), format); - } - /** - * Creates a new [[FixedNumber]] for %%value%% divided by - * %%decimal%% places with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% (once adjusted - * for %%decimals%%) cannot fit in %%format%%, either due to overflow - * or underflow (precision loss). - */ - static fromValue(_value2, _decimals, _format2) { - const decimals = _decimals == null ? 0 : getNumber(_decimals); - const format = getFormat(_format2); - let value = getBigInt(_value2, "value"); - const delta = decimals - format.decimals; - if (delta > 0) { - const tens = getTens(delta); - assert(value % tens === BN_03, "value loses precision for format", "NUMERIC_FAULT", { - operation: "fromValue", - fault: "underflow", - value: _value2 - }); - value /= tens; - } else if (delta < 0) { - value *= getTens(-delta); - } - checkValue(value, format, "fromValue"); - return new _FixedNumber(_guard, value, format); - } - /** - * Creates a new [[FixedNumber]] for %%value%% with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% cannot fit - * in %%format%%, either due to overflow or underflow (precision loss). - */ - static fromString(_value2, _format2) { - const match = _value2.match(/^(-?)([0-9]*)\.?([0-9]*)$/); - assertArgument(match && match[2].length + match[3].length > 0, "invalid FixedNumber string value", "value", _value2); - const format = getFormat(_format2); - let whole = match[2] || "0", decimal = match[3] || ""; - while (decimal.length < format.decimals) { - decimal += Zeros; - } - assert(decimal.substring(format.decimals).match(/^0*$/), "too many decimals for format", "NUMERIC_FAULT", { - operation: "fromString", - fault: "underflow", - value: _value2 - }); - decimal = decimal.substring(0, format.decimals); - const value = BigInt(match[1] + whole + decimal); - checkValue(value, format, "fromString"); - return new _FixedNumber(_guard, value, format); - } - /** - * Creates a new [[FixedNumber]] with the big-endian representation - * %%value%% with %%format%%. - * - * This will throw a [[NumericFaultError]] if %%value%% cannot fit - * in %%format%% due to overflow. - */ - static fromBytes(_value2, _format2) { - let value = toBigInt(getBytes(_value2, "value")); - const format = getFormat(_format2); - if (format.signed) { - value = fromTwos(value, format.width); - } - checkValue(value, format, "fromBytes"); - return new _FixedNumber(_guard, value, format); - } -}; -_format = new WeakMap(); -_val = new WeakMap(); -_tens = new WeakMap(); -_checkFormat = new WeakSet(); -checkFormat_fn = function(other) { - assertArgument(this.format === other.format, "incompatible format; use fixedNumber.toFormat", "other", other); -}; -_checkValue = new WeakSet(); -checkValue_fn = function(val, safeOp) { - val = checkValue(val, __privateGet(this, _format), safeOp); - return new _FixedNumber(_guard, val, __privateGet(this, _format)); -}; -_add = new WeakSet(); -add_fn = function(o, safeOp) { - __privateMethod(this, _checkFormat, checkFormat_fn).call(this, o); - return __privateMethod(this, _checkValue, checkValue_fn).call(this, __privateGet(this, _val) + __privateGet(o, _val), safeOp); -}; -_sub = new WeakSet(); -sub_fn = function(o, safeOp) { - __privateMethod(this, _checkFormat, checkFormat_fn).call(this, o); - return __privateMethod(this, _checkValue, checkValue_fn).call(this, __privateGet(this, _val) - __privateGet(o, _val), safeOp); -}; -_mul = new WeakSet(); -mul_fn = function(o, safeOp) { - __privateMethod(this, _checkFormat, checkFormat_fn).call(this, o); - return __privateMethod(this, _checkValue, checkValue_fn).call(this, __privateGet(this, _val) * __privateGet(o, _val) / __privateGet(this, _tens), safeOp); -}; -_div = new WeakSet(); -div_fn = function(o, safeOp) { - assert(__privateGet(o, _val) !== BN_03, "division by zero", "NUMERIC_FAULT", { - operation: "div", - fault: "divide-by-zero", - value: this - }); - __privateMethod(this, _checkFormat, checkFormat_fn).call(this, o); - return __privateMethod(this, _checkValue, checkValue_fn).call(this, __privateGet(this, _val) * __privateGet(this, _tens) / __privateGet(o, _val), safeOp); -}; -var FixedNumber = _FixedNumber; - -// node_modules/ethers/lib.esm/utils/rlp-decode.js -function hexlifyByte(value) { - let result = value.toString(16); - while (result.length < 2) { - result = "0" + result; - } - return "0x" + result; -} -function unarrayifyInteger(data, offset, length) { - let result = 0; - for (let i = 0; i < length; i++) { - result = result * 256 + data[offset + i]; - } - return result; -} -function _decodeChildren(data, offset, childOffset, length) { - const result = []; - while (childOffset < offset + 1 + length) { - const decoded = _decode(data, childOffset); - result.push(decoded.result); - childOffset += decoded.consumed; - assert(childOffset <= offset + 1 + length, "child data too short", "BUFFER_OVERRUN", { - buffer: data, - length, - offset - }); - } - return { consumed: 1 + length, result }; -} -function _decode(data, offset) { - assert(data.length !== 0, "data too short", "BUFFER_OVERRUN", { - buffer: data, - length: 0, - offset: 1 - }); - const checkOffset = (offset2) => { - assert(offset2 <= data.length, "data short segment too short", "BUFFER_OVERRUN", { - buffer: data, - length: data.length, - offset: offset2 - }); - }; - if (data[offset] >= 248) { - const lengthLength = data[offset] - 247; - checkOffset(offset + 1 + lengthLength); - const length = unarrayifyInteger(data, offset + 1, lengthLength); - checkOffset(offset + 1 + lengthLength + length); - return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length); - } else if (data[offset] >= 192) { - const length = data[offset] - 192; - checkOffset(offset + 1 + length); - return _decodeChildren(data, offset, offset + 1, length); - } else if (data[offset] >= 184) { - const lengthLength = data[offset] - 183; - checkOffset(offset + 1 + lengthLength); - const length = unarrayifyInteger(data, offset + 1, lengthLength); - checkOffset(offset + 1 + lengthLength + length); - const result = hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); - return { consumed: 1 + lengthLength + length, result }; - } else if (data[offset] >= 128) { - const length = data[offset] - 128; - checkOffset(offset + 1 + length); - const result = hexlify(data.slice(offset + 1, offset + 1 + length)); - return { consumed: 1 + length, result }; - } - return { consumed: 1, result: hexlifyByte(data[offset]) }; -} -function decodeRlp(_data5) { - const data = getBytes(_data5, "data"); - const decoded = _decode(data, 0); - assertArgument(decoded.consumed === data.length, "unexpected junk after rlp payload", "data", _data5); - return decoded.result; -} - -// node_modules/ethers/lib.esm/utils/rlp-encode.js -function arrayifyInteger(value) { - const result = []; - while (value) { - result.unshift(value & 255); - value >>= 8; - } - return result; -} -function _encode(object2) { - if (Array.isArray(object2)) { - let payload = []; - object2.forEach(function(child) { - payload = payload.concat(_encode(child)); - }); - if (payload.length <= 55) { - payload.unshift(192 + payload.length); - return payload; - } - const length2 = arrayifyInteger(payload.length); - length2.unshift(247 + length2.length); - return length2.concat(payload); - } - const data = Array.prototype.slice.call(getBytes(object2, "object")); - if (data.length === 1 && data[0] <= 127) { - return data; - } else if (data.length <= 55) { - data.unshift(128 + data.length); - return data; - } - const length = arrayifyInteger(data.length); - length.unshift(183 + length.length); - return length.concat(data); -} -var nibbles = "0123456789abcdef"; -function encodeRlp(object2) { - let result = "0x"; - for (const v of _encode(object2)) { - result += nibbles[v >> 4]; - result += nibbles[v & 15]; - } - return result; -} - -// node_modules/ethers/lib.esm/utils/units.js -var names = [ - "wei", - "kwei", - "mwei", - "gwei", - "szabo", - "finney", - "ether" -]; -function formatUnits(value, unit) { - let decimals = 18; - if (typeof unit === "string") { - const index = names.indexOf(unit); - assertArgument(index >= 0, "invalid unit", "unit", unit); - decimals = 3 * index; - } else if (unit != null) { - decimals = getNumber(unit, "unit"); - } - return FixedNumber.fromValue(value, decimals, { decimals, width: 512 }).toString(); -} -function parseUnits(value, unit) { - assertArgument(typeof value === "string", "value must be a string", "value", value); - let decimals = 18; - if (typeof unit === "string") { - const index = names.indexOf(unit); - assertArgument(index >= 0, "invalid unit", "unit", unit); - decimals = 3 * index; - } else if (unit != null) { - decimals = getNumber(unit, "unit"); - } - return FixedNumber.fromString(value, { decimals, width: 512 }).value; -} -function formatEther(wei) { - return formatUnits(wei, 18); -} -function parseEther(ether) { - return parseUnits(ether, 18); -} - -// node_modules/ethers/lib.esm/utils/uuid.js -function uuidV4(randomBytes4) { - const bytes2 = getBytes(randomBytes4, "randomBytes"); - bytes2[6] = bytes2[6] & 15 | 64; - bytes2[8] = bytes2[8] & 63 | 128; - const value = hexlify(bytes2); - return [ - value.substring(2, 10), - value.substring(10, 14), - value.substring(14, 18), - value.substring(18, 22), - value.substring(22, 34) - ].join("-"); -} - -// node_modules/ethers/lib.esm/abi/coders/abstract-coder.js -var WordSize = 32; -var Padding = new Uint8Array(WordSize); -var passProperties = ["then"]; -var _guard2 = {}; -function throwError(name, error) { - const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`); - wrapped.error = error; - throw wrapped; -} -var _names; -var _Result = class _Result extends Array { - /** - * @private - */ - constructor(...args) { - const guard = args[0]; - let items = args[1]; - let names2 = (args[2] || []).slice(); - let wrap = true; - if (guard !== _guard2) { - items = args; - names2 = []; - wrap = false; - } - super(items.length); - __privateAdd(this, _names, void 0); - items.forEach((item, index) => { - this[index] = item; - }); - const nameCounts = names2.reduce((accum, name) => { - if (typeof name === "string") { - accum.set(name, (accum.get(name) || 0) + 1); - } - return accum; - }, /* @__PURE__ */ new Map()); - __privateSet(this, _names, Object.freeze(items.map((item, index) => { - const name = names2[index]; - if (name != null && nameCounts.get(name) === 1) { - return name; - } - return null; - }))); - if (!wrap) { - return; - } - Object.freeze(this); - return new Proxy(this, { - get: (target, prop, receiver) => { - if (typeof prop === "string") { - if (prop.match(/^[0-9]+$/)) { - const index = getNumber(prop, "%index"); - if (index < 0 || index >= this.length) { - throw new RangeError("out of result range"); - } - const item = target[index]; - if (item instanceof Error) { - throwError(`index ${index}`, item); - } - return item; - } - if (passProperties.indexOf(prop) >= 0) { - return Reflect.get(target, prop, receiver); - } - const value = target[prop]; - if (value instanceof Function) { - return function(...args2) { - return value.apply(this === receiver ? target : this, args2); - }; - } else if (!(prop in target)) { - return target.getValue.apply(this === receiver ? target : this, [prop]); - } - } - return Reflect.get(target, prop, receiver); - } - }); - } - /** - * Returns the Result as a normal Array. - * - * This will throw if there are any outstanding deferred - * errors. - */ - toArray() { - const result = []; - this.forEach((item, index) => { - if (item instanceof Error) { - throwError(`index ${index}`, item); - } - result.push(item); - }); - return result; - } - /** - * Returns the Result as an Object with each name-value pair. - * - * This will throw if any value is unnamed, or if there are - * any outstanding deferred errors. - */ - toObject() { - return __privateGet(this, _names).reduce((accum, name, index) => { - assert(name != null, "value at index ${ index } unnamed", "UNSUPPORTED_OPERATION", { - operation: "toObject()" - }); - if (!(name in accum)) { - accum[name] = this.getValue(name); - } - return accum; - }, {}); - } - /** - * @_ignore - */ - slice(start, end) { - if (start == null) { - start = 0; - } - if (start < 0) { - start += this.length; - if (start < 0) { - start = 0; - } - } - if (end == null) { - end = this.length; - } - if (end < 0) { - end += this.length; - if (end < 0) { - end = 0; - } - } - if (end > this.length) { - end = this.length; - } - const result = [], names2 = []; - for (let i = start; i < end; i++) { - result.push(this[i]); - names2.push(__privateGet(this, _names)[i]); - } - return new _Result(_guard2, result, names2); - } - /** - * @_ignore - */ - filter(callback, thisArg) { - const result = [], names2 = []; - for (let i = 0; i < this.length; i++) { - const item = this[i]; - if (item instanceof Error) { - throwError(`index ${i}`, item); - } - if (callback.call(thisArg, item, i, this)) { - result.push(item); - names2.push(__privateGet(this, _names)[i]); - } - } - return new _Result(_guard2, result, names2); - } - /** - * @_ignore - */ - map(callback, thisArg) { - const result = []; - for (let i = 0; i < this.length; i++) { - const item = this[i]; - if (item instanceof Error) { - throwError(`index ${i}`, item); - } - result.push(callback.call(thisArg, item, i, this)); - } - return result; - } - /** - * Returns the value for %%name%%. - * - * Since it is possible to have a key whose name conflicts with - * a method on a [[Result]] or its superclass Array, or any - * JavaScript keyword, this ensures all named values are still - * accessible by name. - */ - getValue(name) { - const index = __privateGet(this, _names).indexOf(name); - if (index === -1) { - return void 0; - } - const value = this[index]; - if (value instanceof Error) { - throwError(`property ${JSON.stringify(name)}`, value.error); - } - return value; - } - /** - * Creates a new [[Result]] for %%items%% with each entry - * also accessible by its corresponding name in %%keys%%. - */ - static fromItems(items, keys) { - return new _Result(_guard2, items, keys); - } -}; -_names = new WeakMap(); -var Result = _Result; -function checkResultErrors(result) { - const errors = []; - const checkErrors = function(path, object2) { - if (!Array.isArray(object2)) { - return; - } - for (let key in object2) { - const childPath = path.slice(); - childPath.push(key); - try { - checkErrors(childPath, object2[key]); - } catch (error) { - errors.push({ path: childPath, error }); - } - } - }; - checkErrors([], result); - return errors; -} -function getValue(value) { - let bytes2 = toBeArray(value); - assert(bytes2.length <= WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: bytes2, length: WordSize, offset: bytes2.length }); - if (bytes2.length !== WordSize) { - bytes2 = getBytesCopy(concat([Padding.slice(bytes2.length % WordSize), bytes2])); - } - return bytes2; -} -var Coder = class { - constructor(name, type, localName, dynamic) { - // The coder name: - // - address, uint256, tuple, array, etc. - __publicField(this, "name"); - // The fully expanded type, including composite types: - // - address, uint256, tuple(address,bytes), uint256[3][4][], etc. - __publicField(this, "type"); - // The localName bound in the signature, in this example it is "baz": - // - tuple(address foo, uint bar) baz - __publicField(this, "localName"); - // Whether this type is dynamic: - // - Dynamic: bytes, string, address[], tuple(boolean[]), etc. - // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8) - __publicField(this, "dynamic"); - defineProperties(this, { name, type, localName, dynamic }, { - name: "string", - type: "string", - localName: "string", - dynamic: "boolean" - }); - } - _throwError(message, value) { - assertArgument(false, message, this.localName, value); - } -}; -var _data, _dataLength, _writeData, writeData_fn; -var Writer = class { - constructor() { - __privateAdd(this, _writeData); - // An array of WordSize lengthed objects to concatenation - __privateAdd(this, _data, void 0); - __privateAdd(this, _dataLength, void 0); - __privateSet(this, _data, []); - __privateSet(this, _dataLength, 0); - } - get data() { - return concat(__privateGet(this, _data)); - } - get length() { - return __privateGet(this, _dataLength); - } - appendWriter(writer) { - return __privateMethod(this, _writeData, writeData_fn).call(this, getBytesCopy(writer.data)); - } - // Arrayish item; pad on the right to *nearest* WordSize - writeBytes(value) { - let bytes2 = getBytesCopy(value); - const paddingOffset = bytes2.length % WordSize; - if (paddingOffset) { - bytes2 = getBytesCopy(concat([bytes2, Padding.slice(paddingOffset)])); - } - return __privateMethod(this, _writeData, writeData_fn).call(this, bytes2); - } - // Numeric item; pad on the left *to* WordSize - writeValue(value) { - return __privateMethod(this, _writeData, writeData_fn).call(this, getValue(value)); - } - // Inserts a numeric place-holder, returning a callback that can - // be used to asjust the value later - writeUpdatableValue() { - const offset = __privateGet(this, _data).length; - __privateGet(this, _data).push(Padding); - __privateSet(this, _dataLength, __privateGet(this, _dataLength) + WordSize); - return (value) => { - __privateGet(this, _data)[offset] = getValue(value); - }; - } -}; -_data = new WeakMap(); -_dataLength = new WeakMap(); -_writeData = new WeakSet(); -writeData_fn = function(data) { - __privateGet(this, _data).push(data); - __privateSet(this, _dataLength, __privateGet(this, _dataLength) + data.length); - return data.length; -}; -var _data2, _offset, _bytesRead, _parent, _maxInflation, _incrementBytesRead, incrementBytesRead_fn, _peekBytes, peekBytes_fn; -var _Reader = class _Reader { - constructor(data, allowLoose, maxInflation) { - __privateAdd(this, _incrementBytesRead); - __privateAdd(this, _peekBytes); - // Allows incomplete unpadded data to be read; otherwise an error - // is raised if attempting to overrun the buffer. This is required - // to deal with an old Solidity bug, in which event data for - // external (not public thoguh) was tightly packed. - __publicField(this, "allowLoose"); - __privateAdd(this, _data2, void 0); - __privateAdd(this, _offset, void 0); - __privateAdd(this, _bytesRead, void 0); - __privateAdd(this, _parent, void 0); - __privateAdd(this, _maxInflation, void 0); - defineProperties(this, { allowLoose: !!allowLoose }); - __privateSet(this, _data2, getBytesCopy(data)); - __privateSet(this, _bytesRead, 0); - __privateSet(this, _parent, null); - __privateSet(this, _maxInflation, maxInflation != null ? maxInflation : 1024); - __privateSet(this, _offset, 0); - } - get data() { - return hexlify(__privateGet(this, _data2)); - } - get dataLength() { - return __privateGet(this, _data2).length; - } - get consumed() { - return __privateGet(this, _offset); - } - get bytes() { - return new Uint8Array(__privateGet(this, _data2)); - } - // Create a sub-reader with the same underlying data, but offset - subReader(offset) { - const reader = new _Reader(__privateGet(this, _data2).slice(__privateGet(this, _offset) + offset), this.allowLoose, __privateGet(this, _maxInflation)); - __privateSet(reader, _parent, this); - return reader; - } - // Read bytes - readBytes(length, loose) { - let bytes2 = __privateMethod(this, _peekBytes, peekBytes_fn).call(this, 0, length, !!loose); - __privateMethod(this, _incrementBytesRead, incrementBytesRead_fn).call(this, length); - __privateSet(this, _offset, __privateGet(this, _offset) + bytes2.length); - return bytes2.slice(0, length); - } - // Read a numeric values - readValue() { - return toBigInt(this.readBytes(WordSize)); - } - readIndex() { - return toNumber(this.readBytes(WordSize)); - } -}; -_data2 = new WeakMap(); -_offset = new WeakMap(); -_bytesRead = new WeakMap(); -_parent = new WeakMap(); -_maxInflation = new WeakMap(); -_incrementBytesRead = new WeakSet(); -incrementBytesRead_fn = function(count) { - var _a2; - if (__privateGet(this, _parent)) { - return __privateMethod(_a2 = __privateGet(this, _parent), _incrementBytesRead, incrementBytesRead_fn).call(_a2, count); - } - __privateSet(this, _bytesRead, __privateGet(this, _bytesRead) + count); - assert(__privateGet(this, _maxInflation) < 1 || __privateGet(this, _bytesRead) <= __privateGet(this, _maxInflation) * this.dataLength, `compressed ABI data exceeds inflation ratio of ${__privateGet(this, _maxInflation)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`, "BUFFER_OVERRUN", { - buffer: getBytesCopy(__privateGet(this, _data2)), - offset: __privateGet(this, _offset), - length: count, - info: { - bytesRead: __privateGet(this, _bytesRead), - dataLength: this.dataLength - } - }); -}; -_peekBytes = new WeakSet(); -peekBytes_fn = function(offset, length, loose) { - let alignedLength = Math.ceil(length / WordSize) * WordSize; - if (__privateGet(this, _offset) + alignedLength > __privateGet(this, _data2).length) { - if (this.allowLoose && loose && __privateGet(this, _offset) + length <= __privateGet(this, _data2).length) { - alignedLength = length; - } else { - assert(false, "data out-of-bounds", "BUFFER_OVERRUN", { - buffer: getBytesCopy(__privateGet(this, _data2)), - length: __privateGet(this, _data2).length, - offset: __privateGet(this, _offset) + alignedLength - }); - } - } - return __privateGet(this, _data2).slice(__privateGet(this, _offset), __privateGet(this, _offset) + alignedLength); -}; -var Reader = _Reader; - -// node_modules/ethers/node_modules/@noble/hashes/esm/_assert.js -function number(n2) { - if (!Number.isSafeInteger(n2) || n2 < 0) - throw new Error(`Wrong positive integer: ${n2}`); -} -function bytes(b2, ...lengths) { - if (!(b2 instanceof Uint8Array)) - throw new Error("Expected Uint8Array"); - if (lengths.length > 0 && !lengths.includes(b2.length)) - throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b2.length}`); -} -function hash(hash2) { - if (typeof hash2 !== "function" || typeof hash2.create !== "function") - throw new Error("Hash should be wrapped by utils.wrapConstructor"); - number(hash2.outputLen); - number(hash2.blockLen); -} -function exists(instance, checkFinished = true) { - if (instance.destroyed) - throw new Error("Hash instance has been destroyed"); - if (checkFinished && instance.finished) - throw new Error("Hash#digest() has already been called"); -} -function output(out, instance) { - bytes(out); - const min = instance.outputLen; - if (out.length < min) { - throw new Error(`digestInto() expects output buffer of length at least ${min}`); - } -} - -// node_modules/ethers/node_modules/@noble/hashes/esm/crypto.js -var crypto = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : void 0; - -// node_modules/ethers/node_modules/@noble/hashes/esm/utils.js -var u8a = (a) => a instanceof Uint8Array; -var u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); -var createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); -var rotr = (word, shift) => word << 32 - shift | word >>> shift; -var isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68; -if (!isLE) - throw new Error("Non little-endian hardware is not supported"); -var hexes = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0")); -var nextTick = async () => { -}; -async function asyncLoop(iters, tick, cb) { - let ts = Date.now(); - for (let i = 0; i < iters; i++) { - cb(i); - const diff = Date.now() - ts; - if (diff >= 0 && diff < tick) - continue; - await nextTick(); - ts += diff; - } -} -function utf8ToBytes(str) { - if (typeof str !== "string") - throw new Error(`utf8ToBytes expected string, got ${typeof str}`); - return new Uint8Array(new TextEncoder().encode(str)); -} -function toBytes(data) { - if (typeof data === "string") - data = utf8ToBytes(data); - if (!u8a(data)) - throw new Error(`expected Uint8Array, got ${typeof data}`); - return data; -} -function concatBytes(...arrays) { - const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); - let pad = 0; - arrays.forEach((a) => { - if (!u8a(a)) - throw new Error("Uint8Array expected"); - r.set(a, pad); - pad += a.length; - }); - return r; -} -var Hash = class { - // Safe version that clones internal state - clone() { - return this._cloneInto(); - } -}; -var toStr = {}.toString; -function checkOpts(defaults, opts) { - if (opts !== void 0 && toStr.call(opts) !== "[object Object]") - throw new Error("Options should be object or undefined"); - const merged = Object.assign(defaults, opts); - return merged; -} -function wrapConstructor(hashCons) { - const hashC = (msg) => hashCons().update(toBytes(msg)).digest(); - const tmp = hashCons(); - hashC.outputLen = tmp.outputLen; - hashC.blockLen = tmp.blockLen; - hashC.create = () => hashCons(); - return hashC; -} -function wrapXOFConstructorWithOpts(hashCons) { - const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest(); - const tmp = hashCons({}); - hashC.outputLen = tmp.outputLen; - hashC.blockLen = tmp.blockLen; - hashC.create = (opts) => hashCons(opts); - return hashC; -} -function randomBytes(bytesLength = 32) { - if (crypto && typeof crypto.getRandomValues === "function") { - return crypto.getRandomValues(new Uint8Array(bytesLength)); - } - throw new Error("crypto.getRandomValues must be defined"); -} - -// node_modules/ethers/node_modules/@noble/hashes/esm/hmac.js -var HMAC = class extends Hash { - constructor(hash2, _key) { - super(); - this.finished = false; - this.destroyed = false; - hash(hash2); - const key = toBytes(_key); - this.iHash = hash2.create(); - if (typeof this.iHash.update !== "function") - throw new Error("Expected instance of class which extends utils.Hash"); - this.blockLen = this.iHash.blockLen; - this.outputLen = this.iHash.outputLen; - const blockLen = this.blockLen; - const pad = new Uint8Array(blockLen); - pad.set(key.length > blockLen ? hash2.create().update(key).digest() : key); - for (let i = 0; i < pad.length; i++) - pad[i] ^= 54; - this.iHash.update(pad); - this.oHash = hash2.create(); - for (let i = 0; i < pad.length; i++) - pad[i] ^= 54 ^ 92; - this.oHash.update(pad); - pad.fill(0); - } - update(buf) { - exists(this); - this.iHash.update(buf); - return this; - } - digestInto(out) { - exists(this); - bytes(out, this.outputLen); - this.finished = true; - this.iHash.digestInto(out); - this.oHash.update(out); - this.oHash.digestInto(out); - this.destroy(); - } - digest() { - const out = new Uint8Array(this.oHash.outputLen); - this.digestInto(out); - return out; - } - _cloneInto(to) { - to || (to = Object.create(Object.getPrototypeOf(this), {})); - const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this; - to = to; - to.finished = finished; - to.destroyed = destroyed; - to.blockLen = blockLen; - to.outputLen = outputLen; - to.oHash = oHash._cloneInto(to.oHash); - to.iHash = iHash._cloneInto(to.iHash); - return to; - } - destroy() { - this.destroyed = true; - this.oHash.destroy(); - this.iHash.destroy(); - } -}; -var hmac = (hash2, key, message) => new HMAC(hash2, key).update(message).digest(); -hmac.create = (hash2, key) => new HMAC(hash2, key); - -// node_modules/ethers/node_modules/@noble/hashes/esm/pbkdf2.js -function pbkdf2Init(hash2, _password, _salt, _opts) { - hash(hash2); - const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts); - const { c, dkLen, asyncTick } = opts; - number(c); - number(dkLen); - number(asyncTick); - if (c < 1) - throw new Error("PBKDF2: iterations (c) should be >= 1"); - const password = toBytes(_password); - const salt = toBytes(_salt); - const DK = new Uint8Array(dkLen); - const PRF = hmac.create(hash2, password); - const PRFSalt = PRF._cloneInto().update(salt); - return { c, dkLen, asyncTick, DK, PRF, PRFSalt }; -} -function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) { - PRF.destroy(); - PRFSalt.destroy(); - if (prfW) - prfW.destroy(); - u.fill(0); - return DK; -} -function pbkdf2(hash2, password, salt, opts) { - const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash2, password, salt, opts); - let prfW; - const arr = new Uint8Array(4); - const view = createView(arr); - const u = new Uint8Array(PRF.outputLen); - for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { - const Ti = DK.subarray(pos, pos + PRF.outputLen); - view.setInt32(0, ti, false); - (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); - Ti.set(u.subarray(0, Ti.length)); - for (let ui = 1; ui < c; ui++) { - PRF._cloneInto(prfW).update(u).digestInto(u); - for (let i = 0; i < Ti.length; i++) - Ti[i] ^= u[i]; - } - } - return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); -} - -// node_modules/ethers/node_modules/@noble/hashes/esm/_sha2.js -function setBigUint64(view, byteOffset, value, isLE2) { - if (typeof view.setBigUint64 === "function") - return view.setBigUint64(byteOffset, value, isLE2); - const _32n2 = BigInt(32); - const _u32_max = BigInt(4294967295); - const wh = Number(value >> _32n2 & _u32_max); - const wl = Number(value & _u32_max); - const h = isLE2 ? 4 : 0; - const l = isLE2 ? 0 : 4; - view.setUint32(byteOffset + h, wh, isLE2); - view.setUint32(byteOffset + l, wl, isLE2); -} -var SHA2 = class extends Hash { - constructor(blockLen, outputLen, padOffset, isLE2) { - super(); - this.blockLen = blockLen; - this.outputLen = outputLen; - this.padOffset = padOffset; - this.isLE = isLE2; - this.finished = false; - this.length = 0; - this.pos = 0; - this.destroyed = false; - this.buffer = new Uint8Array(blockLen); - this.view = createView(this.buffer); - } - update(data) { - exists(this); - const { view, buffer, blockLen } = this; - data = toBytes(data); - const len = data.length; - for (let pos = 0; pos < len; ) { - const take = Math.min(blockLen - this.pos, len - pos); - if (take === blockLen) { - const dataView = createView(data); - for (; blockLen <= len - pos; pos += blockLen) - this.process(dataView, pos); - continue; - } - buffer.set(data.subarray(pos, pos + take), this.pos); - this.pos += take; - pos += take; - if (this.pos === blockLen) { - this.process(view, 0); - this.pos = 0; - } - } - this.length += data.length; - this.roundClean(); - return this; - } - digestInto(out) { - exists(this); - output(out, this); - this.finished = true; - const { buffer, view, blockLen, isLE: isLE2 } = this; - let { pos } = this; - buffer[pos++] = 128; - this.buffer.subarray(pos).fill(0); - if (this.padOffset > blockLen - pos) { - this.process(view, 0); - pos = 0; - } - for (let i = pos; i < blockLen; i++) - buffer[i] = 0; - setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2); - this.process(view, 0); - const oview = createView(out); - const len = this.outputLen; - if (len % 4) - throw new Error("_sha2: outputLen should be aligned to 32bit"); - const outLen = len / 4; - const state = this.get(); - if (outLen > state.length) - throw new Error("_sha2: outputLen bigger than state"); - for (let i = 0; i < outLen; i++) - oview.setUint32(4 * i, state[i], isLE2); - } - digest() { - const { buffer, outputLen } = this; - this.digestInto(buffer); - const res = buffer.slice(0, outputLen); - this.destroy(); - return res; - } - _cloneInto(to) { - to || (to = new this.constructor()); - to.set(...this.get()); - const { blockLen, buffer, length, finished, destroyed, pos } = this; - to.length = length; - to.pos = pos; - to.finished = finished; - to.destroyed = destroyed; - if (length % blockLen) - to.buffer.set(buffer); - return to; - } -}; - -// node_modules/ethers/node_modules/@noble/hashes/esm/sha256.js -var Chi = (a, b2, c) => a & b2 ^ ~a & c; -var Maj = (a, b2, c) => a & b2 ^ a & c ^ b2 & c; -var SHA256_K = new Uint32Array([ - 1116352408, - 1899447441, - 3049323471, - 3921009573, - 961987163, - 1508970993, - 2453635748, - 2870763221, - 3624381080, - 310598401, - 607225278, - 1426881987, - 1925078388, - 2162078206, - 2614888103, - 3248222580, - 3835390401, - 4022224774, - 264347078, - 604807628, - 770255983, - 1249150122, - 1555081692, - 1996064986, - 2554220882, - 2821834349, - 2952996808, - 3210313671, - 3336571891, - 3584528711, - 113926993, - 338241895, - 666307205, - 773529912, - 1294757372, - 1396182291, - 1695183700, - 1986661051, - 2177026350, - 2456956037, - 2730485921, - 2820302411, - 3259730800, - 3345764771, - 3516065817, - 3600352804, - 4094571909, - 275423344, - 430227734, - 506948616, - 659060556, - 883997877, - 958139571, - 1322822218, - 1537002063, - 1747873779, - 1955562222, - 2024104815, - 2227730452, - 2361852424, - 2428436474, - 2756734187, - 3204031479, - 3329325298 -]); -var IV = new Uint32Array([ - 1779033703, - 3144134277, - 1013904242, - 2773480762, - 1359893119, - 2600822924, - 528734635, - 1541459225 -]); -var SHA256_W = new Uint32Array(64); -var SHA256 = class extends SHA2 { - constructor() { - super(64, 32, 8, false); - this.A = IV[0] | 0; - this.B = IV[1] | 0; - this.C = IV[2] | 0; - this.D = IV[3] | 0; - this.E = IV[4] | 0; - this.F = IV[5] | 0; - this.G = IV[6] | 0; - this.H = IV[7] | 0; - } - get() { - const { A, B, C, D, E, F, G, H } = this; - return [A, B, C, D, E, F, G, H]; - } - // prettier-ignore - set(A, B, C, D, E, F, G, H) { - this.A = A | 0; - this.B = B | 0; - this.C = C | 0; - this.D = D | 0; - this.E = E | 0; - this.F = F | 0; - this.G = G | 0; - this.H = H | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) - SHA256_W[i] = view.getUint32(offset, false); - for (let i = 16; i < 64; i++) { - const W15 = SHA256_W[i - 15]; - const W2 = SHA256_W[i - 2]; - const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3; - const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10; - SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0; - } - let { A, B, C, D, E, F, G, H } = this; - for (let i = 0; i < 64; i++) { - const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25); - const T12 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0; - const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22); - const T22 = sigma0 + Maj(A, B, C) | 0; - H = G; - G = F; - F = E; - E = D + T12 | 0; - D = C; - C = B; - B = A; - A = T12 + T22 | 0; - } - A = A + this.A | 0; - B = B + this.B | 0; - C = C + this.C | 0; - D = D + this.D | 0; - E = E + this.E | 0; - F = F + this.F | 0; - G = G + this.G | 0; - H = H + this.H | 0; - this.set(A, B, C, D, E, F, G, H); - } - roundClean() { - SHA256_W.fill(0); - } - destroy() { - this.set(0, 0, 0, 0, 0, 0, 0, 0); - this.buffer.fill(0); - } -}; -var SHA224 = class extends SHA256 { - constructor() { - super(); - this.A = 3238371032 | 0; - this.B = 914150663 | 0; - this.C = 812702999 | 0; - this.D = 4144912697 | 0; - this.E = 4290775857 | 0; - this.F = 1750603025 | 0; - this.G = 1694076839 | 0; - this.H = 3204075428 | 0; - this.outputLen = 28; - } -}; -var sha256 = wrapConstructor(() => new SHA256()); -var sha224 = wrapConstructor(() => new SHA224()); - -// node_modules/ethers/node_modules/@noble/hashes/esm/_u64.js -var U32_MASK64 = BigInt(2 ** 32 - 1); -var _32n = BigInt(32); -function fromBig(n2, le = false) { - if (le) - return { h: Number(n2 & U32_MASK64), l: Number(n2 >> _32n & U32_MASK64) }; - return { h: Number(n2 >> _32n & U32_MASK64) | 0, l: Number(n2 & U32_MASK64) | 0 }; -} -function split(lst, le = false) { - let Ah = new Uint32Array(lst.length); - let Al = new Uint32Array(lst.length); - for (let i = 0; i < lst.length; i++) { - const { h, l } = fromBig(lst[i], le); - [Ah[i], Al[i]] = [h, l]; - } - return [Ah, Al]; -} -var toBig = (h, l) => BigInt(h >>> 0) << _32n | BigInt(l >>> 0); -var shrSH = (h, _l, s) => h >>> s; -var shrSL = (h, l, s) => h << 32 - s | l >>> s; -var rotrSH = (h, l, s) => h >>> s | l << 32 - s; -var rotrSL = (h, l, s) => h << 32 - s | l >>> s; -var rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32; -var rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s; -var rotr32H = (_h, l) => l; -var rotr32L = (h, _l) => h; -var rotlSH = (h, l, s) => h << s | l >>> 32 - s; -var rotlSL = (h, l, s) => l << s | h >>> 32 - s; -var rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s; -var rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s; -function add(Ah, Al, Bh, Bl) { - const l = (Al >>> 0) + (Bl >>> 0); - return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 }; -} -var add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0); -var add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0; -var add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0); -var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0; -var add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0); -var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0; -var u64 = { - fromBig, - split, - toBig, - shrSH, - shrSL, - rotrSH, - rotrSL, - rotrBH, - rotrBL, - rotr32H, - rotr32L, - rotlSH, - rotlSL, - rotlBH, - rotlBL, - add, - add3L, - add3H, - add4L, - add4H, - add5H, - add5L -}; -var u64_default = u64; - -// node_modules/ethers/node_modules/@noble/hashes/esm/sha512.js -var [SHA512_Kh, SHA512_Kl] = (() => u64_default.split([ - "0x428a2f98d728ae22", - "0x7137449123ef65cd", - "0xb5c0fbcfec4d3b2f", - "0xe9b5dba58189dbbc", - "0x3956c25bf348b538", - "0x59f111f1b605d019", - "0x923f82a4af194f9b", - "0xab1c5ed5da6d8118", - "0xd807aa98a3030242", - "0x12835b0145706fbe", - "0x243185be4ee4b28c", - "0x550c7dc3d5ffb4e2", - "0x72be5d74f27b896f", - "0x80deb1fe3b1696b1", - "0x9bdc06a725c71235", - "0xc19bf174cf692694", - "0xe49b69c19ef14ad2", - "0xefbe4786384f25e3", - "0x0fc19dc68b8cd5b5", - "0x240ca1cc77ac9c65", - "0x2de92c6f592b0275", - "0x4a7484aa6ea6e483", - "0x5cb0a9dcbd41fbd4", - "0x76f988da831153b5", - "0x983e5152ee66dfab", - "0xa831c66d2db43210", - "0xb00327c898fb213f", - "0xbf597fc7beef0ee4", - "0xc6e00bf33da88fc2", - "0xd5a79147930aa725", - "0x06ca6351e003826f", - "0x142929670a0e6e70", - "0x27b70a8546d22ffc", - "0x2e1b21385c26c926", - "0x4d2c6dfc5ac42aed", - "0x53380d139d95b3df", - "0x650a73548baf63de", - "0x766a0abb3c77b2a8", - "0x81c2c92e47edaee6", - "0x92722c851482353b", - "0xa2bfe8a14cf10364", - "0xa81a664bbc423001", - "0xc24b8b70d0f89791", - "0xc76c51a30654be30", - "0xd192e819d6ef5218", - "0xd69906245565a910", - "0xf40e35855771202a", - "0x106aa07032bbd1b8", - "0x19a4c116b8d2d0c8", - "0x1e376c085141ab53", - "0x2748774cdf8eeb99", - "0x34b0bcb5e19b48a8", - "0x391c0cb3c5c95a63", - "0x4ed8aa4ae3418acb", - "0x5b9cca4f7763e373", - "0x682e6ff3d6b2b8a3", - "0x748f82ee5defb2fc", - "0x78a5636f43172f60", - "0x84c87814a1f0ab72", - "0x8cc702081a6439ec", - "0x90befffa23631e28", - "0xa4506cebde82bde9", - "0xbef9a3f7b2c67915", - "0xc67178f2e372532b", - "0xca273eceea26619c", - "0xd186b8c721c0c207", - "0xeada7dd6cde0eb1e", - "0xf57d4f7fee6ed178", - "0x06f067aa72176fba", - "0x0a637dc5a2c898a6", - "0x113f9804bef90dae", - "0x1b710b35131c471b", - "0x28db77f523047d84", - "0x32caab7b40c72493", - "0x3c9ebe0a15c9bebc", - "0x431d67c49c100d4c", - "0x4cc5d4becb3e42b6", - "0x597f299cfc657e2a", - "0x5fcb6fab3ad6faec", - "0x6c44198c4a475817" -].map((n2) => BigInt(n2))))(); -var SHA512_W_H = new Uint32Array(80); -var SHA512_W_L = new Uint32Array(80); -var SHA512 = class extends SHA2 { - constructor() { - super(128, 64, 16, false); - this.Ah = 1779033703 | 0; - this.Al = 4089235720 | 0; - this.Bh = 3144134277 | 0; - this.Bl = 2227873595 | 0; - this.Ch = 1013904242 | 0; - this.Cl = 4271175723 | 0; - this.Dh = 2773480762 | 0; - this.Dl = 1595750129 | 0; - this.Eh = 1359893119 | 0; - this.El = 2917565137 | 0; - this.Fh = 2600822924 | 0; - this.Fl = 725511199 | 0; - this.Gh = 528734635 | 0; - this.Gl = 4215389547 | 0; - this.Hh = 1541459225 | 0; - this.Hl = 327033209 | 0; - } - // prettier-ignore - get() { - const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl]; - } - // prettier-ignore - set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) { - this.Ah = Ah | 0; - this.Al = Al | 0; - this.Bh = Bh | 0; - this.Bl = Bl | 0; - this.Ch = Ch | 0; - this.Cl = Cl | 0; - this.Dh = Dh | 0; - this.Dl = Dl | 0; - this.Eh = Eh | 0; - this.El = El | 0; - this.Fh = Fh | 0; - this.Fl = Fl | 0; - this.Gh = Gh | 0; - this.Gl = Gl | 0; - this.Hh = Hh | 0; - this.Hl = Hl | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) { - SHA512_W_H[i] = view.getUint32(offset); - SHA512_W_L[i] = view.getUint32(offset += 4); - } - for (let i = 16; i < 80; i++) { - const W15h = SHA512_W_H[i - 15] | 0; - const W15l = SHA512_W_L[i - 15] | 0; - const s0h = u64_default.rotrSH(W15h, W15l, 1) ^ u64_default.rotrSH(W15h, W15l, 8) ^ u64_default.shrSH(W15h, W15l, 7); - const s0l = u64_default.rotrSL(W15h, W15l, 1) ^ u64_default.rotrSL(W15h, W15l, 8) ^ u64_default.shrSL(W15h, W15l, 7); - const W2h = SHA512_W_H[i - 2] | 0; - const W2l = SHA512_W_L[i - 2] | 0; - const s1h = u64_default.rotrSH(W2h, W2l, 19) ^ u64_default.rotrBH(W2h, W2l, 61) ^ u64_default.shrSH(W2h, W2l, 6); - const s1l = u64_default.rotrSL(W2h, W2l, 19) ^ u64_default.rotrBL(W2h, W2l, 61) ^ u64_default.shrSL(W2h, W2l, 6); - const SUMl = u64_default.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]); - const SUMh = u64_default.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]); - SHA512_W_H[i] = SUMh | 0; - SHA512_W_L[i] = SUMl | 0; - } - let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - for (let i = 0; i < 80; i++) { - const sigma1h = u64_default.rotrSH(Eh, El, 14) ^ u64_default.rotrSH(Eh, El, 18) ^ u64_default.rotrBH(Eh, El, 41); - const sigma1l = u64_default.rotrSL(Eh, El, 14) ^ u64_default.rotrSL(Eh, El, 18) ^ u64_default.rotrBL(Eh, El, 41); - const CHIh = Eh & Fh ^ ~Eh & Gh; - const CHIl = El & Fl ^ ~El & Gl; - const T1ll = u64_default.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]); - const T1h = u64_default.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]); - const T1l = T1ll | 0; - const sigma0h = u64_default.rotrSH(Ah, Al, 28) ^ u64_default.rotrBH(Ah, Al, 34) ^ u64_default.rotrBH(Ah, Al, 39); - const sigma0l = u64_default.rotrSL(Ah, Al, 28) ^ u64_default.rotrBL(Ah, Al, 34) ^ u64_default.rotrBL(Ah, Al, 39); - const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch; - const MAJl = Al & Bl ^ Al & Cl ^ Bl & Cl; - Hh = Gh | 0; - Hl = Gl | 0; - Gh = Fh | 0; - Gl = Fl | 0; - Fh = Eh | 0; - Fl = El | 0; - ({ h: Eh, l: El } = u64_default.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0)); - Dh = Ch | 0; - Dl = Cl | 0; - Ch = Bh | 0; - Cl = Bl | 0; - Bh = Ah | 0; - Bl = Al | 0; - const All = u64_default.add3L(T1l, sigma0l, MAJl); - Ah = u64_default.add3H(All, T1h, sigma0h, MAJh); - Al = All | 0; - } - ({ h: Ah, l: Al } = u64_default.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0)); - ({ h: Bh, l: Bl } = u64_default.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0)); - ({ h: Ch, l: Cl } = u64_default.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0)); - ({ h: Dh, l: Dl } = u64_default.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0)); - ({ h: Eh, l: El } = u64_default.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0)); - ({ h: Fh, l: Fl } = u64_default.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0)); - ({ h: Gh, l: Gl } = u64_default.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0)); - ({ h: Hh, l: Hl } = u64_default.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0)); - this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl); - } - roundClean() { - SHA512_W_H.fill(0); - SHA512_W_L.fill(0); - } - destroy() { - this.buffer.fill(0); - this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - } -}; -var SHA512_224 = class extends SHA512 { - constructor() { - super(); - this.Ah = 2352822216 | 0; - this.Al = 424955298 | 0; - this.Bh = 1944164710 | 0; - this.Bl = 2312950998 | 0; - this.Ch = 502970286 | 0; - this.Cl = 855612546 | 0; - this.Dh = 1738396948 | 0; - this.Dl = 1479516111 | 0; - this.Eh = 258812777 | 0; - this.El = 2077511080 | 0; - this.Fh = 2011393907 | 0; - this.Fl = 79989058 | 0; - this.Gh = 1067287976 | 0; - this.Gl = 1780299464 | 0; - this.Hh = 286451373 | 0; - this.Hl = 2446758561 | 0; - this.outputLen = 28; - } -}; -var SHA512_256 = class extends SHA512 { - constructor() { - super(); - this.Ah = 573645204 | 0; - this.Al = 4230739756 | 0; - this.Bh = 2673172387 | 0; - this.Bl = 3360449730 | 0; - this.Ch = 596883563 | 0; - this.Cl = 1867755857 | 0; - this.Dh = 2520282905 | 0; - this.Dl = 1497426621 | 0; - this.Eh = 2519219938 | 0; - this.El = 2827943907 | 0; - this.Fh = 3193839141 | 0; - this.Fl = 1401305490 | 0; - this.Gh = 721525244 | 0; - this.Gl = 746961066 | 0; - this.Hh = 246885852 | 0; - this.Hl = 2177182882 | 0; - this.outputLen = 32; - } -}; -var SHA384 = class extends SHA512 { - constructor() { - super(); - this.Ah = 3418070365 | 0; - this.Al = 3238371032 | 0; - this.Bh = 1654270250 | 0; - this.Bl = 914150663 | 0; - this.Ch = 2438529370 | 0; - this.Cl = 812702999 | 0; - this.Dh = 355462360 | 0; - this.Dl = 4144912697 | 0; - this.Eh = 1731405415 | 0; - this.El = 4290775857 | 0; - this.Fh = 2394180231 | 0; - this.Fl = 1750603025 | 0; - this.Gh = 3675008525 | 0; - this.Gl = 1694076839 | 0; - this.Hh = 1203062813 | 0; - this.Hl = 3204075428 | 0; - this.outputLen = 48; - } -}; -var sha512 = wrapConstructor(() => new SHA512()); -var sha512_224 = wrapConstructor(() => new SHA512_224()); -var sha512_256 = wrapConstructor(() => new SHA512_256()); -var sha384 = wrapConstructor(() => new SHA384()); - -// node_modules/ethers/lib.esm/crypto/crypto-browser.js -function getGlobal() { - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw new Error("unable to locate global object"); -} -var anyGlobal = getGlobal(); -var crypto2 = anyGlobal.crypto || anyGlobal.msCrypto; -function createHash(algo) { - switch (algo) { - case "sha256": - return sha256.create(); - case "sha512": - return sha512.create(); - } - assertArgument(false, "invalid hashing algorithm name", "algorithm", algo); -} -function createHmac(_algo, key) { - const algo = { sha256, sha512 }[_algo]; - assertArgument(algo != null, "invalid hmac algorithm", "algorithm", _algo); - return hmac.create(algo, key); -} -function pbkdf2Sync(password, salt, iterations, keylen, _algo) { - const algo = { sha256, sha512 }[_algo]; - assertArgument(algo != null, "invalid pbkdf2 algorithm", "algorithm", _algo); - return pbkdf2(algo, password, salt, { c: iterations, dkLen: keylen }); -} -function randomBytes2(length) { - assert(crypto2 != null, "platform does not support secure random numbers", "UNSUPPORTED_OPERATION", { - operation: "randomBytes" - }); - assertArgument(Number.isInteger(length) && length > 0 && length <= 1024, "invalid length", "length", length); - const result = new Uint8Array(length); - crypto2.getRandomValues(result); - return result; -} - -// node_modules/ethers/lib.esm/crypto/hmac.js -var locked2 = false; -var _computeHmac = function(algorithm, key, data) { - return createHmac(algorithm, key).update(data).digest(); -}; -var __computeHmac = _computeHmac; -function computeHmac(algorithm, _key, _data5) { - const key = getBytes(_key, "key"); - const data = getBytes(_data5, "data"); - return hexlify(__computeHmac(algorithm, key, data)); -} -computeHmac._ = _computeHmac; -computeHmac.lock = function() { - locked2 = true; -}; -computeHmac.register = function(func) { - if (locked2) { - throw new Error("computeHmac is locked"); - } - __computeHmac = func; -}; -Object.freeze(computeHmac); - -// node_modules/ethers/node_modules/@noble/hashes/esm/sha3.js -var [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []]; -var _0n = BigInt(0); -var _1n = BigInt(1); -var _2n = BigInt(2); -var _7n = BigInt(7); -var _256n = BigInt(256); -var _0x71n = BigInt(113); -for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) { - [x, y] = [y, (2 * x + 3 * y) % 5]; - SHA3_PI.push(2 * (5 * y + x)); - SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64); - let t = _0n; - for (let j = 0; j < 7; j++) { - R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n; - if (R & _2n) - t ^= _1n << (_1n << BigInt(j)) - _1n; - } - _SHA3_IOTA.push(t); -} -var [SHA3_IOTA_H, SHA3_IOTA_L] = split(_SHA3_IOTA, true); -var rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s); -var rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s); -function keccakP(s, rounds = 24) { - const B = new Uint32Array(5 * 2); - for (let round = 24 - rounds; round < 24; round++) { - for (let x = 0; x < 10; x++) - B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40]; - for (let x = 0; x < 10; x += 2) { - const idx1 = (x + 8) % 10; - const idx0 = (x + 2) % 10; - const B0 = B[idx0]; - const B1 = B[idx0 + 1]; - const Th = rotlH(B0, B1, 1) ^ B[idx1]; - const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1]; - for (let y = 0; y < 50; y += 10) { - s[x + y] ^= Th; - s[x + y + 1] ^= Tl; - } - } - let curH = s[2]; - let curL = s[3]; - for (let t = 0; t < 24; t++) { - const shift = SHA3_ROTL[t]; - const Th = rotlH(curH, curL, shift); - const Tl = rotlL(curH, curL, shift); - const PI = SHA3_PI[t]; - curH = s[PI]; - curL = s[PI + 1]; - s[PI] = Th; - s[PI + 1] = Tl; - } - for (let y = 0; y < 50; y += 10) { - for (let x = 0; x < 10; x++) - B[x] = s[y + x]; - for (let x = 0; x < 10; x++) - s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10]; - } - s[0] ^= SHA3_IOTA_H[round]; - s[1] ^= SHA3_IOTA_L[round]; - } - B.fill(0); -} -var Keccak = class _Keccak extends Hash { - // NOTE: we accept arguments in bytes instead of bits here. - constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) { - super(); - this.blockLen = blockLen; - this.suffix = suffix; - this.outputLen = outputLen; - this.enableXOF = enableXOF; - this.rounds = rounds; - this.pos = 0; - this.posOut = 0; - this.finished = false; - this.destroyed = false; - number(outputLen); - if (0 >= this.blockLen || this.blockLen >= 200) - throw new Error("Sha3 supports only keccak-f1600 function"); - this.state = new Uint8Array(200); - this.state32 = u32(this.state); - } - keccak() { - keccakP(this.state32, this.rounds); - this.posOut = 0; - this.pos = 0; - } - update(data) { - exists(this); - const { blockLen, state } = this; - data = toBytes(data); - const len = data.length; - for (let pos = 0; pos < len; ) { - const take = Math.min(blockLen - this.pos, len - pos); - for (let i = 0; i < take; i++) - state[this.pos++] ^= data[pos++]; - if (this.pos === blockLen) - this.keccak(); - } - return this; - } - finish() { - if (this.finished) - return; - this.finished = true; - const { state, suffix, pos, blockLen } = this; - state[pos] ^= suffix; - if ((suffix & 128) !== 0 && pos === blockLen - 1) - this.keccak(); - state[blockLen - 1] ^= 128; - this.keccak(); - } - writeInto(out) { - exists(this, false); - bytes(out); - this.finish(); - const bufferOut = this.state; - const { blockLen } = this; - for (let pos = 0, len = out.length; pos < len; ) { - if (this.posOut >= blockLen) - this.keccak(); - const take = Math.min(blockLen - this.posOut, len - pos); - out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); - this.posOut += take; - pos += take; - } - return out; - } - xofInto(out) { - if (!this.enableXOF) - throw new Error("XOF is not possible for this instance"); - return this.writeInto(out); - } - xof(bytes2) { - number(bytes2); - return this.xofInto(new Uint8Array(bytes2)); - } - digestInto(out) { - output(out, this); - if (this.finished) - throw new Error("digest() was already called"); - this.writeInto(out); - this.destroy(); - return out; - } - digest() { - return this.digestInto(new Uint8Array(this.outputLen)); - } - destroy() { - this.destroyed = true; - this.state.fill(0); - } - _cloneInto(to) { - const { blockLen, suffix, outputLen, rounds, enableXOF } = this; - to || (to = new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds)); - to.state32.set(this.state32); - to.pos = this.pos; - to.posOut = this.posOut; - to.finished = this.finished; - to.rounds = rounds; - to.suffix = suffix; - to.outputLen = outputLen; - to.enableXOF = enableXOF; - to.destroyed = this.destroyed; - return to; - } -}; -var gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen)); -var sha3_224 = gen(6, 144, 224 / 8); -var sha3_256 = gen(6, 136, 256 / 8); -var sha3_384 = gen(6, 104, 384 / 8); -var sha3_512 = gen(6, 72, 512 / 8); -var keccak_224 = gen(1, 144, 224 / 8); -var keccak_256 = gen(1, 136, 256 / 8); -var keccak_384 = gen(1, 104, 384 / 8); -var keccak_512 = gen(1, 72, 512 / 8); -var genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true)); -var shake128 = genShake(31, 168, 128 / 8); -var shake256 = genShake(31, 136, 256 / 8); - -// node_modules/ethers/lib.esm/crypto/keccak.js -var locked3 = false; -var _keccak256 = function(data) { - return keccak_256(data); -}; -var __keccak256 = _keccak256; -function keccak256(_data5) { - const data = getBytes(_data5, "data"); - return hexlify(__keccak256(data)); -} -keccak256._ = _keccak256; -keccak256.lock = function() { - locked3 = true; -}; -keccak256.register = function(func) { - if (locked3) { - throw new TypeError("keccak256 is locked"); - } - __keccak256 = func; -}; -Object.freeze(keccak256); - -// node_modules/ethers/node_modules/@noble/hashes/esm/ripemd160.js -var Rho = new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]); -var Id = Uint8Array.from({ length: 16 }, (_, i) => i); -var Pi = Id.map((i) => (9 * i + 5) % 16); -var idxL = [Id]; -var idxR = [Pi]; -for (let i = 0; i < 4; i++) - for (let j of [idxL, idxR]) - j.push(j[i].map((k) => Rho[k])); -var shifts = [ - [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8], - [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7], - [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9], - [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6], - [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5] -].map((i) => new Uint8Array(i)); -var shiftsL = idxL.map((idx, i) => idx.map((j) => shifts[i][j])); -var shiftsR = idxR.map((idx, i) => idx.map((j) => shifts[i][j])); -var Kl = new Uint32Array([ - 0, - 1518500249, - 1859775393, - 2400959708, - 2840853838 -]); -var Kr = new Uint32Array([ - 1352829926, - 1548603684, - 1836072691, - 2053994217, - 0 -]); -var rotl = (word, shift) => word << shift | word >>> 32 - shift; -function f(group, x, y, z) { - if (group === 0) - return x ^ y ^ z; - else if (group === 1) - return x & y | ~x & z; - else if (group === 2) - return (x | ~y) ^ z; - else if (group === 3) - return x & z | y & ~z; - else - return x ^ (y | ~z); -} -var BUF = new Uint32Array(16); -var RIPEMD160 = class extends SHA2 { - constructor() { - super(64, 20, 8, true); - this.h0 = 1732584193 | 0; - this.h1 = 4023233417 | 0; - this.h2 = 2562383102 | 0; - this.h3 = 271733878 | 0; - this.h4 = 3285377520 | 0; - } - get() { - const { h0, h1, h2, h3, h4 } = this; - return [h0, h1, h2, h3, h4]; - } - set(h0, h1, h2, h3, h4) { - this.h0 = h0 | 0; - this.h1 = h1 | 0; - this.h2 = h2 | 0; - this.h3 = h3 | 0; - this.h4 = h4 | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) - BUF[i] = view.getUint32(offset, true); - let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el; - for (let group = 0; group < 5; group++) { - const rGroup = 4 - group; - const hbl = Kl[group], hbr = Kr[group]; - const rl = idxL[group], rr = idxR[group]; - const sl = shiftsL[group], sr = shiftsR[group]; - for (let i = 0; i < 16; i++) { - const tl = rotl(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el | 0; - al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; - } - for (let i = 0; i < 16; i++) { - const tr = rotl(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er | 0; - ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; - } - } - this.set(this.h1 + cl + dr | 0, this.h2 + dl + er | 0, this.h3 + el + ar | 0, this.h4 + al + br | 0, this.h0 + bl + cr | 0); - } - roundClean() { - BUF.fill(0); - } - destroy() { - this.destroyed = true; - this.buffer.fill(0); - this.set(0, 0, 0, 0, 0); - } -}; -var ripemd160 = wrapConstructor(() => new RIPEMD160()); - -// node_modules/ethers/lib.esm/crypto/ripemd160.js -var locked4 = false; -var _ripemd160 = function(data) { - return ripemd160(data); -}; -var __ripemd160 = _ripemd160; -function ripemd1602(_data5) { - const data = getBytes(_data5, "data"); - return hexlify(__ripemd160(data)); -} -ripemd1602._ = _ripemd160; -ripemd1602.lock = function() { - locked4 = true; -}; -ripemd1602.register = function(func) { - if (locked4) { - throw new TypeError("ripemd160 is locked"); - } - __ripemd160 = func; -}; -Object.freeze(ripemd1602); - -// node_modules/ethers/lib.esm/crypto/pbkdf2.js -var locked5 = false; -var _pbkdf2 = function(password, salt, iterations, keylen, algo) { - return pbkdf2Sync(password, salt, iterations, keylen, algo); -}; -var __pbkdf2 = _pbkdf2; -function pbkdf22(_password, _salt, iterations, keylen, algo) { - const password = getBytes(_password, "password"); - const salt = getBytes(_salt, "salt"); - return hexlify(__pbkdf2(password, salt, iterations, keylen, algo)); -} -pbkdf22._ = _pbkdf2; -pbkdf22.lock = function() { - locked5 = true; -}; -pbkdf22.register = function(func) { - if (locked5) { - throw new Error("pbkdf2 is locked"); - } - __pbkdf2 = func; -}; -Object.freeze(pbkdf22); - -// node_modules/ethers/lib.esm/crypto/random.js -var locked6 = false; -var _randomBytes = function(length) { - return new Uint8Array(randomBytes2(length)); -}; -var __randomBytes = _randomBytes; -function randomBytes3(length) { - return __randomBytes(length); -} -randomBytes3._ = _randomBytes; -randomBytes3.lock = function() { - locked6 = true; -}; -randomBytes3.register = function(func) { - if (locked6) { - throw new Error("randomBytes is locked"); - } - __randomBytes = func; -}; -Object.freeze(randomBytes3); - -// node_modules/ethers/node_modules/@noble/hashes/esm/scrypt.js -var rotl2 = (a, b2) => a << b2 | a >>> 32 - b2; -function XorAndSalsa(prev, pi, input, ii, out, oi) { - let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++]; - let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++]; - let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++]; - let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++]; - let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++]; - let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++]; - let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++]; - let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++]; - let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15; - for (let i = 0; i < 8; i += 2) { - x04 ^= rotl2(x00 + x12 | 0, 7); - x08 ^= rotl2(x04 + x00 | 0, 9); - x12 ^= rotl2(x08 + x04 | 0, 13); - x00 ^= rotl2(x12 + x08 | 0, 18); - x09 ^= rotl2(x05 + x01 | 0, 7); - x13 ^= rotl2(x09 + x05 | 0, 9); - x01 ^= rotl2(x13 + x09 | 0, 13); - x05 ^= rotl2(x01 + x13 | 0, 18); - x14 ^= rotl2(x10 + x06 | 0, 7); - x02 ^= rotl2(x14 + x10 | 0, 9); - x06 ^= rotl2(x02 + x14 | 0, 13); - x10 ^= rotl2(x06 + x02 | 0, 18); - x03 ^= rotl2(x15 + x11 | 0, 7); - x07 ^= rotl2(x03 + x15 | 0, 9); - x11 ^= rotl2(x07 + x03 | 0, 13); - x15 ^= rotl2(x11 + x07 | 0, 18); - x01 ^= rotl2(x00 + x03 | 0, 7); - x02 ^= rotl2(x01 + x00 | 0, 9); - x03 ^= rotl2(x02 + x01 | 0, 13); - x00 ^= rotl2(x03 + x02 | 0, 18); - x06 ^= rotl2(x05 + x04 | 0, 7); - x07 ^= rotl2(x06 + x05 | 0, 9); - x04 ^= rotl2(x07 + x06 | 0, 13); - x05 ^= rotl2(x04 + x07 | 0, 18); - x11 ^= rotl2(x10 + x09 | 0, 7); - x08 ^= rotl2(x11 + x10 | 0, 9); - x09 ^= rotl2(x08 + x11 | 0, 13); - x10 ^= rotl2(x09 + x08 | 0, 18); - x12 ^= rotl2(x15 + x14 | 0, 7); - x13 ^= rotl2(x12 + x15 | 0, 9); - x14 ^= rotl2(x13 + x12 | 0, 13); - x15 ^= rotl2(x14 + x13 | 0, 18); - } - out[oi++] = y00 + x00 | 0; - out[oi++] = y01 + x01 | 0; - out[oi++] = y02 + x02 | 0; - out[oi++] = y03 + x03 | 0; - out[oi++] = y04 + x04 | 0; - out[oi++] = y05 + x05 | 0; - out[oi++] = y06 + x06 | 0; - out[oi++] = y07 + x07 | 0; - out[oi++] = y08 + x08 | 0; - out[oi++] = y09 + x09 | 0; - out[oi++] = y10 + x10 | 0; - out[oi++] = y11 + x11 | 0; - out[oi++] = y12 + x12 | 0; - out[oi++] = y13 + x13 | 0; - out[oi++] = y14 + x14 | 0; - out[oi++] = y15 + x15 | 0; -} -function BlockMix(input, ii, out, oi, r) { - let head = oi + 0; - let tail = oi + 16 * r; - for (let i = 0; i < 16; i++) - out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; - for (let i = 0; i < r; i++, head += 16, ii += 16) { - XorAndSalsa(out, tail, input, ii, out, head); - if (i > 0) - tail += 16; - XorAndSalsa(out, head, input, ii += 16, out, tail); - } -} -function scryptInit(password, salt, _opts) { - const opts = checkOpts({ - dkLen: 32, - asyncTick: 10, - maxmem: 1024 ** 3 + 1024 - }, _opts); - const { N: N3, r, p, dkLen, asyncTick, maxmem, onProgress } = opts; - number(N3); - number(r); - number(p); - number(dkLen); - number(asyncTick); - number(maxmem); - if (onProgress !== void 0 && typeof onProgress !== "function") - throw new Error("progressCb should be function"); - const blockSize = 128 * r; - const blockSize32 = blockSize / 4; - if (N3 <= 1 || (N3 & N3 - 1) !== 0 || N3 >= 2 ** (blockSize / 8) || N3 > 2 ** 32) { - throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32"); - } - if (p < 0 || p > (2 ** 32 - 1) * 32 / blockSize) { - throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)"); - } - if (dkLen < 0 || dkLen > (2 ** 32 - 1) * 32) { - throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32"); - } - const memUsed = blockSize * (N3 + p); - if (memUsed > maxmem) { - throw new Error(`Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)`); - } - const B = pbkdf2(sha256, password, salt, { c: 1, dkLen: blockSize * p }); - const B32 = u32(B); - const V = u32(new Uint8Array(blockSize * N3)); - const tmp = u32(new Uint8Array(blockSize)); - let blockMixCb = () => { - }; - if (onProgress) { - const totalBlockMix = 2 * N3 * p; - const callbackPer = Math.max(Math.floor(totalBlockMix / 1e4), 1); - let blockMixCnt = 0; - blockMixCb = () => { - blockMixCnt++; - if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix)) - onProgress(blockMixCnt / totalBlockMix); - }; - } - return { N: N3, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick }; -} -function scryptOutput(password, dkLen, B, V, tmp) { - const res = pbkdf2(sha256, password, B, { c: 1, dkLen }); - B.fill(0); - V.fill(0); - tmp.fill(0); - return res; -} -function scrypt(password, salt, opts) { - const { N: N3, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(password, salt, opts); - for (let pi = 0; pi < p; pi++) { - const Pi2 = blockSize32 * pi; - for (let i = 0; i < blockSize32; i++) - V[i] = B32[Pi2 + i]; - for (let i = 0, pos = 0; i < N3 - 1; i++) { - BlockMix(V, pos, V, pos += blockSize32, r); - blockMixCb(); - } - BlockMix(V, (N3 - 1) * blockSize32, B32, Pi2, r); - blockMixCb(); - for (let i = 0; i < N3; i++) { - const j = B32[Pi2 + blockSize32 - 16] % N3; - for (let k = 0; k < blockSize32; k++) - tmp[k] = B32[Pi2 + k] ^ V[j * blockSize32 + k]; - BlockMix(tmp, 0, B32, Pi2, r); - blockMixCb(); - } - } - return scryptOutput(password, dkLen, B, V, tmp); -} -async function scryptAsync(password, salt, opts) { - const { N: N3, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(password, salt, opts); - for (let pi = 0; pi < p; pi++) { - const Pi2 = blockSize32 * pi; - for (let i = 0; i < blockSize32; i++) - V[i] = B32[Pi2 + i]; - let pos = 0; - await asyncLoop(N3 - 1, asyncTick, () => { - BlockMix(V, pos, V, pos += blockSize32, r); - blockMixCb(); - }); - BlockMix(V, (N3 - 1) * blockSize32, B32, Pi2, r); - blockMixCb(); - await asyncLoop(N3, asyncTick, () => { - const j = B32[Pi2 + blockSize32 - 16] % N3; - for (let k = 0; k < blockSize32; k++) - tmp[k] = B32[Pi2 + k] ^ V[j * blockSize32 + k]; - BlockMix(tmp, 0, B32, Pi2, r); - blockMixCb(); - }); - } - return scryptOutput(password, dkLen, B, V, tmp); -} - -// node_modules/ethers/lib.esm/crypto/scrypt.js -var lockedSync = false; -var lockedAsync = false; -var _scryptAsync = async function(passwd, salt, N3, r, p, dkLen, onProgress) { - return await scryptAsync(passwd, salt, { N: N3, r, p, dkLen, onProgress }); -}; -var _scryptSync = function(passwd, salt, N3, r, p, dkLen) { - return scrypt(passwd, salt, { N: N3, r, p, dkLen }); -}; -var __scryptAsync = _scryptAsync; -var __scryptSync = _scryptSync; -async function scrypt2(_passwd, _salt, N3, r, p, dkLen, progress) { - const passwd = getBytes(_passwd, "passwd"); - const salt = getBytes(_salt, "salt"); - return hexlify(await __scryptAsync(passwd, salt, N3, r, p, dkLen, progress)); -} -scrypt2._ = _scryptAsync; -scrypt2.lock = function() { - lockedAsync = true; -}; -scrypt2.register = function(func) { - if (lockedAsync) { - throw new Error("scrypt is locked"); - } - __scryptAsync = func; -}; -Object.freeze(scrypt2); -function scryptSync(_passwd, _salt, N3, r, p, dkLen) { - const passwd = getBytes(_passwd, "passwd"); - const salt = getBytes(_salt, "salt"); - return hexlify(__scryptSync(passwd, salt, N3, r, p, dkLen)); -} -scryptSync._ = _scryptSync; -scryptSync.lock = function() { - lockedSync = true; -}; -scryptSync.register = function(func) { - if (lockedSync) { - throw new Error("scryptSync is locked"); - } - __scryptSync = func; -}; -Object.freeze(scryptSync); - -// node_modules/ethers/lib.esm/crypto/sha2.js -var _sha256 = function(data) { - return createHash("sha256").update(data).digest(); -}; -var _sha512 = function(data) { - return createHash("sha512").update(data).digest(); -}; -var __sha256 = _sha256; -var __sha512 = _sha512; -var locked256 = false; -var locked512 = false; -function sha2562(_data5) { - const data = getBytes(_data5, "data"); - return hexlify(__sha256(data)); -} -sha2562._ = _sha256; -sha2562.lock = function() { - locked256 = true; -}; -sha2562.register = function(func) { - if (locked256) { - throw new Error("sha256 is locked"); - } - __sha256 = func; -}; -Object.freeze(sha2562); -function sha5122(_data5) { - const data = getBytes(_data5, "data"); - return hexlify(__sha512(data)); -} -sha5122._ = _sha512; -sha5122.lock = function() { - locked512 = true; -}; -sha5122.register = function(func) { - if (locked512) { - throw new Error("sha512 is locked"); - } - __sha512 = func; -}; -Object.freeze(sha2562); - -// node_modules/ethers/node_modules/@noble/curves/esm/abstract/utils.js -var utils_exports = {}; -__export(utils_exports, { - bitGet: () => bitGet, - bitLen: () => bitLen, - bitMask: () => bitMask, - bitSet: () => bitSet, - bytesToHex: () => bytesToHex, - bytesToNumberBE: () => bytesToNumberBE, - bytesToNumberLE: () => bytesToNumberLE, - concatBytes: () => concatBytes2, - createHmacDrbg: () => createHmacDrbg, - ensureBytes: () => ensureBytes, - equalBytes: () => equalBytes, - hexToBytes: () => hexToBytes, - hexToNumber: () => hexToNumber, - numberToBytesBE: () => numberToBytesBE, - numberToBytesLE: () => numberToBytesLE, - numberToHexUnpadded: () => numberToHexUnpadded, - numberToVarBytesBE: () => numberToVarBytesBE, - utf8ToBytes: () => utf8ToBytes2, - validateObject: () => validateObject -}); -var _0n2 = BigInt(0); -var _1n2 = BigInt(1); -var _2n2 = BigInt(2); -var u8a2 = (a) => a instanceof Uint8Array; -var hexes2 = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0")); -function bytesToHex(bytes2) { - if (!u8a2(bytes2)) - throw new Error("Uint8Array expected"); - let hex = ""; - for (let i = 0; i < bytes2.length; i++) { - hex += hexes2[bytes2[i]]; - } - return hex; -} -function numberToHexUnpadded(num) { - const hex = num.toString(16); - return hex.length & 1 ? `0${hex}` : hex; -} -function hexToNumber(hex) { - if (typeof hex !== "string") - throw new Error("hex string expected, got " + typeof hex); - return BigInt(hex === "" ? "0" : `0x${hex}`); -} -function hexToBytes(hex) { - if (typeof hex !== "string") - throw new Error("hex string expected, got " + typeof hex); - const len = hex.length; - if (len % 2) - throw new Error("padded hex string expected, got unpadded hex of length " + len); - const array = new Uint8Array(len / 2); - for (let i = 0; i < array.length; i++) { - const j = i * 2; - const hexByte = hex.slice(j, j + 2); - const byte = Number.parseInt(hexByte, 16); - if (Number.isNaN(byte) || byte < 0) - throw new Error("Invalid byte sequence"); - array[i] = byte; - } - return array; -} -function bytesToNumberBE(bytes2) { - return hexToNumber(bytesToHex(bytes2)); -} -function bytesToNumberLE(bytes2) { - if (!u8a2(bytes2)) - throw new Error("Uint8Array expected"); - return hexToNumber(bytesToHex(Uint8Array.from(bytes2).reverse())); -} -function numberToBytesBE(n2, len) { - return hexToBytes(n2.toString(16).padStart(len * 2, "0")); -} -function numberToBytesLE(n2, len) { - return numberToBytesBE(n2, len).reverse(); -} -function numberToVarBytesBE(n2) { - return hexToBytes(numberToHexUnpadded(n2)); -} -function ensureBytes(title, hex, expectedLength) { - let res; - if (typeof hex === "string") { - try { - res = hexToBytes(hex); - } catch (e) { - throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`); - } - } else if (u8a2(hex)) { - res = Uint8Array.from(hex); - } else { - throw new Error(`${title} must be hex string or Uint8Array`); - } - const len = res.length; - if (typeof expectedLength === "number" && len !== expectedLength) - throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`); - return res; -} -function concatBytes2(...arrays) { - const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0)); - let pad = 0; - arrays.forEach((a) => { - if (!u8a2(a)) - throw new Error("Uint8Array expected"); - r.set(a, pad); - pad += a.length; - }); - return r; -} -function equalBytes(b1, b2) { - if (b1.length !== b2.length) - return false; - for (let i = 0; i < b1.length; i++) - if (b1[i] !== b2[i]) - return false; - return true; -} -function utf8ToBytes2(str) { - if (typeof str !== "string") - throw new Error(`utf8ToBytes expected string, got ${typeof str}`); - return new Uint8Array(new TextEncoder().encode(str)); -} -function bitLen(n2) { - let len; - for (len = 0; n2 > _0n2; n2 >>= _1n2, len += 1) - ; - return len; -} -function bitGet(n2, pos) { - return n2 >> BigInt(pos) & _1n2; -} -var bitSet = (n2, pos, value) => { - return n2 | (value ? _1n2 : _0n2) << BigInt(pos); -}; -var bitMask = (n2) => (_2n2 << BigInt(n2 - 1)) - _1n2; -var u8n = (data) => new Uint8Array(data); -var u8fr = (arr) => Uint8Array.from(arr); -function createHmacDrbg(hashLen, qByteLen, hmacFn) { - if (typeof hashLen !== "number" || hashLen < 2) - throw new Error("hashLen must be a number"); - if (typeof qByteLen !== "number" || qByteLen < 2) - throw new Error("qByteLen must be a number"); - if (typeof hmacFn !== "function") - throw new Error("hmacFn must be a function"); - let v = u8n(hashLen); - let k = u8n(hashLen); - let i = 0; - const reset = () => { - v.fill(1); - k.fill(0); - i = 0; - }; - const h = (...b2) => hmacFn(k, v, ...b2); - const reseed = (seed = u8n()) => { - k = h(u8fr([0]), seed); - v = h(); - if (seed.length === 0) - return; - k = h(u8fr([1]), seed); - v = h(); - }; - const gen2 = () => { - if (i++ >= 1e3) - throw new Error("drbg: tried 1000 values"); - let len = 0; - const out = []; - while (len < qByteLen) { - v = h(); - const sl = v.slice(); - out.push(sl); - len += v.length; - } - return concatBytes2(...out); - }; - const genUntil = (seed, pred) => { - reset(); - reseed(seed); - let res = void 0; - while (!(res = pred(gen2()))) - reseed(); - reset(); - return res; - }; - return genUntil; -} -var validatorFns = { - bigint: (val) => typeof val === "bigint", - function: (val) => typeof val === "function", - boolean: (val) => typeof val === "boolean", - string: (val) => typeof val === "string", - stringOrUint8Array: (val) => typeof val === "string" || val instanceof Uint8Array, - isSafeInteger: (val) => Number.isSafeInteger(val), - array: (val) => Array.isArray(val), - field: (val, object2) => object2.Fp.isValid(val), - hash: (val) => typeof val === "function" && Number.isSafeInteger(val.outputLen) -}; -function validateObject(object2, validators, optValidators = {}) { - const checkField = (fieldName, type, isOptional) => { - const checkVal = validatorFns[type]; - if (typeof checkVal !== "function") - throw new Error(`Invalid validator "${type}", expected function`); - const val = object2[fieldName]; - if (isOptional && val === void 0) - return; - if (!checkVal(val, object2)) { - throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`); - } - }; - for (const [fieldName, type] of Object.entries(validators)) - checkField(fieldName, type, false); - for (const [fieldName, type] of Object.entries(optValidators)) - checkField(fieldName, type, true); - return object2; -} - -// node_modules/ethers/node_modules/@noble/curves/esm/abstract/modular.js -var _0n3 = BigInt(0); -var _1n3 = BigInt(1); -var _2n3 = BigInt(2); -var _3n = BigInt(3); -var _4n = BigInt(4); -var _5n = BigInt(5); -var _8n = BigInt(8); -var _9n = BigInt(9); -var _16n = BigInt(16); -function mod(a, b2) { - const result = a % b2; - return result >= _0n3 ? result : b2 + result; -} -function pow(num, power, modulo) { - if (modulo <= _0n3 || power < _0n3) - throw new Error("Expected power/modulo > 0"); - if (modulo === _1n3) - return _0n3; - let res = _1n3; - while (power > _0n3) { - if (power & _1n3) - res = res * num % modulo; - num = num * num % modulo; - power >>= _1n3; - } - return res; -} -function pow2(x, power, modulo) { - let res = x; - while (power-- > _0n3) { - res *= res; - res %= modulo; - } - return res; -} -function invert(number2, modulo) { - if (number2 === _0n3 || modulo <= _0n3) { - throw new Error(`invert: expected positive integers, got n=${number2} mod=${modulo}`); - } - let a = mod(number2, modulo); - let b2 = modulo; - let x = _0n3, y = _1n3, u = _1n3, v = _0n3; - while (a !== _0n3) { - const q = b2 / a; - const r = b2 % a; - const m = x - u * q; - const n2 = y - v * q; - b2 = a, a = r, x = u, y = v, u = m, v = n2; - } - const gcd = b2; - if (gcd !== _1n3) - throw new Error("invert: does not exist"); - return mod(x, modulo); -} -function tonelliShanks(P) { - const legendreC = (P - _1n3) / _2n3; - let Q, S2, Z; - for (Q = P - _1n3, S2 = 0; Q % _2n3 === _0n3; Q /= _2n3, S2++) - ; - for (Z = _2n3; Z < P && pow(Z, legendreC, P) !== P - _1n3; Z++) - ; - if (S2 === 1) { - const p1div4 = (P + _1n3) / _4n; - return function tonelliFast(Fp2, n2) { - const root = Fp2.pow(n2, p1div4); - if (!Fp2.eql(Fp2.sqr(root), n2)) - throw new Error("Cannot find square root"); - return root; - }; - } - const Q1div2 = (Q + _1n3) / _2n3; - return function tonelliSlow(Fp2, n2) { - if (Fp2.pow(n2, legendreC) === Fp2.neg(Fp2.ONE)) - throw new Error("Cannot find square root"); - let r = S2; - let g = Fp2.pow(Fp2.mul(Fp2.ONE, Z), Q); - let x = Fp2.pow(n2, Q1div2); - let b2 = Fp2.pow(n2, Q); - while (!Fp2.eql(b2, Fp2.ONE)) { - if (Fp2.eql(b2, Fp2.ZERO)) - return Fp2.ZERO; - let m = 1; - for (let t2 = Fp2.sqr(b2); m < r; m++) { - if (Fp2.eql(t2, Fp2.ONE)) - break; - t2 = Fp2.sqr(t2); - } - const ge2 = Fp2.pow(g, _1n3 << BigInt(r - m - 1)); - g = Fp2.sqr(ge2); - x = Fp2.mul(x, ge2); - b2 = Fp2.mul(b2, g); - r = m; - } - return x; - }; -} -function FpSqrt(P) { - if (P % _4n === _3n) { - const p1div4 = (P + _1n3) / _4n; - return function sqrt3mod4(Fp2, n2) { - const root = Fp2.pow(n2, p1div4); - if (!Fp2.eql(Fp2.sqr(root), n2)) - throw new Error("Cannot find square root"); - return root; - }; - } - if (P % _8n === _5n) { - const c1 = (P - _5n) / _8n; - return function sqrt5mod8(Fp2, n2) { - const n22 = Fp2.mul(n2, _2n3); - const v = Fp2.pow(n22, c1); - const nv = Fp2.mul(n2, v); - const i = Fp2.mul(Fp2.mul(nv, _2n3), v); - const root = Fp2.mul(nv, Fp2.sub(i, Fp2.ONE)); - if (!Fp2.eql(Fp2.sqr(root), n2)) - throw new Error("Cannot find square root"); - return root; - }; - } - if (P % _16n === _9n) { - } - return tonelliShanks(P); -} -var FIELD_FIELDS = [ - "create", - "isValid", - "is0", - "neg", - "inv", - "sqrt", - "sqr", - "eql", - "add", - "sub", - "mul", - "pow", - "div", - "addN", - "subN", - "mulN", - "sqrN" -]; -function validateField(field) { - const initial = { - ORDER: "bigint", - MASK: "bigint", - BYTES: "isSafeInteger", - BITS: "isSafeInteger" - }; - const opts = FIELD_FIELDS.reduce((map, val) => { - map[val] = "function"; - return map; - }, initial); - return validateObject(field, opts); -} -function FpPow(f2, num, power) { - if (power < _0n3) - throw new Error("Expected power > 0"); - if (power === _0n3) - return f2.ONE; - if (power === _1n3) - return num; - let p = f2.ONE; - let d = num; - while (power > _0n3) { - if (power & _1n3) - p = f2.mul(p, d); - d = f2.sqr(d); - power >>= _1n3; - } - return p; -} -function FpInvertBatch(f2, nums) { - const tmp = new Array(nums.length); - const lastMultiplied = nums.reduce((acc, num, i) => { - if (f2.is0(num)) - return acc; - tmp[i] = acc; - return f2.mul(acc, num); - }, f2.ONE); - const inverted = f2.inv(lastMultiplied); - nums.reduceRight((acc, num, i) => { - if (f2.is0(num)) - return acc; - tmp[i] = f2.mul(acc, tmp[i]); - return f2.mul(acc, num); - }, inverted); - return tmp; -} -function nLength(n2, nBitLength) { - const _nBitLength = nBitLength !== void 0 ? nBitLength : n2.toString(2).length; - const nByteLength = Math.ceil(_nBitLength / 8); - return { nBitLength: _nBitLength, nByteLength }; -} -function Field(ORDER, bitLen2, isLE2 = false, redef = {}) { - if (ORDER <= _0n3) - throw new Error(`Expected Field ORDER > 0, got ${ORDER}`); - const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen2); - if (BYTES > 2048) - throw new Error("Field lengths over 2048 bytes are not supported"); - const sqrtP = FpSqrt(ORDER); - const f2 = Object.freeze({ - ORDER, - BITS, - BYTES, - MASK: bitMask(BITS), - ZERO: _0n3, - ONE: _1n3, - create: (num) => mod(num, ORDER), - isValid: (num) => { - if (typeof num !== "bigint") - throw new Error(`Invalid field element: expected bigint, got ${typeof num}`); - return _0n3 <= num && num < ORDER; - }, - is0: (num) => num === _0n3, - isOdd: (num) => (num & _1n3) === _1n3, - neg: (num) => mod(-num, ORDER), - eql: (lhs, rhs) => lhs === rhs, - sqr: (num) => mod(num * num, ORDER), - add: (lhs, rhs) => mod(lhs + rhs, ORDER), - sub: (lhs, rhs) => mod(lhs - rhs, ORDER), - mul: (lhs, rhs) => mod(lhs * rhs, ORDER), - pow: (num, power) => FpPow(f2, num, power), - div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER), - // Same as above, but doesn't normalize - sqrN: (num) => num * num, - addN: (lhs, rhs) => lhs + rhs, - subN: (lhs, rhs) => lhs - rhs, - mulN: (lhs, rhs) => lhs * rhs, - inv: (num) => invert(num, ORDER), - sqrt: redef.sqrt || ((n2) => sqrtP(f2, n2)), - invertBatch: (lst) => FpInvertBatch(f2, lst), - // TODO: do we really need constant cmov? - // We don't have const-time bigints anyway, so probably will be not very useful - cmov: (a, b2, c) => c ? b2 : a, - toBytes: (num) => isLE2 ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES), - fromBytes: (bytes2) => { - if (bytes2.length !== BYTES) - throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes2.length}`); - return isLE2 ? bytesToNumberLE(bytes2) : bytesToNumberBE(bytes2); - } - }); - return Object.freeze(f2); -} -function getFieldBytesLength(fieldOrder) { - if (typeof fieldOrder !== "bigint") - throw new Error("field order must be bigint"); - const bitLength = fieldOrder.toString(2).length; - return Math.ceil(bitLength / 8); -} -function getMinHashLength(fieldOrder) { - const length = getFieldBytesLength(fieldOrder); - return length + Math.ceil(length / 2); -} -function mapHashToField(key, fieldOrder, isLE2 = false) { - const len = key.length; - const fieldLen = getFieldBytesLength(fieldOrder); - const minLen = getMinHashLength(fieldOrder); - if (len < 16 || len < minLen || len > 1024) - throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`); - const num = isLE2 ? bytesToNumberBE(key) : bytesToNumberLE(key); - const reduced = mod(num, fieldOrder - _1n3) + _1n3; - return isLE2 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen); -} - -// node_modules/ethers/node_modules/@noble/curves/esm/abstract/curve.js -var _0n4 = BigInt(0); -var _1n4 = BigInt(1); -function wNAF(c, bits) { - const constTimeNegate = (condition, item) => { - const neg = item.negate(); - return condition ? neg : item; - }; - const opts = (W) => { - const windows = Math.ceil(bits / W) + 1; - const windowSize = 2 ** (W - 1); - return { windows, windowSize }; - }; - return { - constTimeNegate, - // non-const time multiplication ladder - unsafeLadder(elm, n2) { - let p = c.ZERO; - let d = elm; - while (n2 > _0n4) { - if (n2 & _1n4) - p = p.add(d); - d = d.double(); - n2 >>= _1n4; - } - return p; - }, - /** - * Creates a wNAF precomputation window. Used for caching. - * Default window size is set by `utils.precompute()` and is equal to 8. - * Number of precomputed points depends on the curve size: - * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: - * - 𝑊 is the window size - * - 𝑛 is the bitlength of the curve order. - * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. - * @returns precomputed point tables flattened to a single array - */ - precomputeWindow(elm, W) { - const { windows, windowSize } = opts(W); - const points = []; - let p = elm; - let base = p; - for (let window2 = 0; window2 < windows; window2++) { - base = p; - points.push(base); - for (let i = 1; i < windowSize; i++) { - base = base.add(p); - points.push(base); - } - p = base.double(); - } - return points; - }, - /** - * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. - * @param W window size - * @param precomputes precomputed tables - * @param n scalar (we don't check here, but should be less than curve order) - * @returns real and fake (for const-time) points - */ - wNAF(W, precomputes, n2) { - const { windows, windowSize } = opts(W); - let p = c.ZERO; - let f2 = c.BASE; - const mask2 = BigInt(2 ** W - 1); - const maxNumber = 2 ** W; - const shiftBy = BigInt(W); - for (let window2 = 0; window2 < windows; window2++) { - const offset = window2 * windowSize; - let wbits = Number(n2 & mask2); - n2 >>= shiftBy; - if (wbits > windowSize) { - wbits -= maxNumber; - n2 += _1n4; - } - const offset1 = offset; - const offset2 = offset + Math.abs(wbits) - 1; - const cond1 = window2 % 2 !== 0; - const cond2 = wbits < 0; - if (wbits === 0) { - f2 = f2.add(constTimeNegate(cond1, precomputes[offset1])); - } else { - p = p.add(constTimeNegate(cond2, precomputes[offset2])); - } - } - return { p, f: f2 }; - }, - wNAFCached(P, precomputesMap, n2, transform) { - const W = P._WINDOW_SIZE || 1; - let comp = precomputesMap.get(P); - if (!comp) { - comp = this.precomputeWindow(P, W); - if (W !== 1) { - precomputesMap.set(P, transform(comp)); - } - } - return this.wNAF(W, comp, n2); - } - }; -} -function validateBasic(curve) { - validateField(curve.Fp); - validateObject(curve, { - n: "bigint", - h: "bigint", - Gx: "field", - Gy: "field" - }, { - nBitLength: "isSafeInteger", - nByteLength: "isSafeInteger" - }); - return Object.freeze({ - ...nLength(curve.n, curve.nBitLength), - ...curve, - ...{ p: curve.Fp.ORDER } - }); -} - -// node_modules/ethers/node_modules/@noble/curves/esm/abstract/weierstrass.js -function validatePointOpts(curve) { - const opts = validateBasic(curve); - validateObject(opts, { - a: "field", - b: "field" - }, { - allowedPrivateKeyLengths: "array", - wrapPrivateKey: "boolean", - isTorsionFree: "function", - clearCofactor: "function", - allowInfinityPoint: "boolean", - fromBytes: "function", - toBytes: "function" - }); - const { endo, Fp: Fp2, a } = opts; - if (endo) { - if (!Fp2.eql(a, Fp2.ZERO)) { - throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0"); - } - if (typeof endo !== "object" || typeof endo.beta !== "bigint" || typeof endo.splitScalar !== "function") { - throw new Error("Expected endomorphism with beta: bigint and splitScalar: function"); - } - } - return Object.freeze({ ...opts }); -} -var { bytesToNumberBE: b2n, hexToBytes: h2b } = utils_exports; -var DER = { - // asn.1 DER encoding utils - Err: class DERErr extends Error { - constructor(m = "") { - super(m); - } - }, - _parseInt(data) { - const { Err: E } = DER; - if (data.length < 2 || data[0] !== 2) - throw new E("Invalid signature integer tag"); - const len = data[1]; - const res = data.subarray(2, len + 2); - if (!len || res.length !== len) - throw new E("Invalid signature integer: wrong length"); - if (res[0] & 128) - throw new E("Invalid signature integer: negative"); - if (res[0] === 0 && !(res[1] & 128)) - throw new E("Invalid signature integer: unnecessary leading zero"); - return { d: b2n(res), l: data.subarray(len + 2) }; - }, - toSig(hex) { - const { Err: E } = DER; - const data = typeof hex === "string" ? h2b(hex) : hex; - if (!(data instanceof Uint8Array)) - throw new Error("ui8a expected"); - let l = data.length; - if (l < 2 || data[0] != 48) - throw new E("Invalid signature tag"); - if (data[1] !== l - 2) - throw new E("Invalid signature: incorrect length"); - const { d: r, l: sBytes } = DER._parseInt(data.subarray(2)); - const { d: s, l: rBytesLeft } = DER._parseInt(sBytes); - if (rBytesLeft.length) - throw new E("Invalid signature: left bytes after parsing"); - return { r, s }; - }, - hexFromSig(sig) { - const slice = (s2) => Number.parseInt(s2[0], 16) & 8 ? "00" + s2 : s2; - const h = (num) => { - const hex = num.toString(16); - return hex.length & 1 ? `0${hex}` : hex; - }; - const s = slice(h(sig.s)); - const r = slice(h(sig.r)); - const shl = s.length / 2; - const rhl = r.length / 2; - const sl = h(shl); - const rl = h(rhl); - return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`; - } -}; -var _0n5 = BigInt(0); -var _1n5 = BigInt(1); -var _2n4 = BigInt(2); -var _3n2 = BigInt(3); -var _4n2 = BigInt(4); -function weierstrassPoints(opts) { - const CURVE = validatePointOpts(opts); - const { Fp: Fp2 } = CURVE; - const toBytes2 = CURVE.toBytes || ((_c, point, _isCompressed) => { - const a = point.toAffine(); - return concatBytes2(Uint8Array.from([4]), Fp2.toBytes(a.x), Fp2.toBytes(a.y)); - }); - const fromBytes = CURVE.fromBytes || ((bytes2) => { - const tail = bytes2.subarray(1); - const x = Fp2.fromBytes(tail.subarray(0, Fp2.BYTES)); - const y = Fp2.fromBytes(tail.subarray(Fp2.BYTES, 2 * Fp2.BYTES)); - return { x, y }; - }); - function weierstrassEquation(x) { - const { a, b: b2 } = CURVE; - const x2 = Fp2.sqr(x); - const x3 = Fp2.mul(x2, x); - return Fp2.add(Fp2.add(x3, Fp2.mul(x, a)), b2); - } - if (!Fp2.eql(Fp2.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx))) - throw new Error("bad generator point: equation left != right"); - function isWithinCurveOrder(num) { - return typeof num === "bigint" && _0n5 < num && num < CURVE.n; - } - function assertGE(num) { - if (!isWithinCurveOrder(num)) - throw new Error("Expected valid bigint: 0 < bigint < curve.n"); - } - function normPrivateKeyToScalar(key) { - const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n: n2 } = CURVE; - if (lengths && typeof key !== "bigint") { - if (key instanceof Uint8Array) - key = bytesToHex(key); - if (typeof key !== "string" || !lengths.includes(key.length)) - throw new Error("Invalid key"); - key = key.padStart(nByteLength * 2, "0"); - } - let num; - try { - num = typeof key === "bigint" ? key : bytesToNumberBE(ensureBytes("private key", key, nByteLength)); - } catch (error) { - throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`); - } - if (wrapPrivateKey) - num = mod(num, n2); - assertGE(num); - return num; - } - const pointPrecomputes = /* @__PURE__ */ new Map(); - function assertPrjPoint(other) { - if (!(other instanceof Point2)) - throw new Error("ProjectivePoint expected"); - } - class Point2 { - constructor(px, py, pz) { - this.px = px; - this.py = py; - this.pz = pz; - if (px == null || !Fp2.isValid(px)) - throw new Error("x required"); - if (py == null || !Fp2.isValid(py)) - throw new Error("y required"); - if (pz == null || !Fp2.isValid(pz)) - throw new Error("z required"); - } - // Does not validate if the point is on-curve. - // Use fromHex instead, or call assertValidity() later. - static fromAffine(p) { - const { x, y } = p || {}; - if (!p || !Fp2.isValid(x) || !Fp2.isValid(y)) - throw new Error("invalid affine point"); - if (p instanceof Point2) - throw new Error("projective point not allowed"); - const is0 = (i) => Fp2.eql(i, Fp2.ZERO); - if (is0(x) && is0(y)) - return Point2.ZERO; - return new Point2(x, y, Fp2.ONE); - } - get x() { - return this.toAffine().x; - } - get y() { - return this.toAffine().y; - } - /** - * Takes a bunch of Projective Points but executes only one - * inversion on all of them. Inversion is very slow operation, - * so this improves performance massively. - * Optimization: converts a list of projective points to a list of identical points with Z=1. - */ - static normalizeZ(points) { - const toInv = Fp2.invertBatch(points.map((p) => p.pz)); - return points.map((p, i) => p.toAffine(toInv[i])).map(Point2.fromAffine); - } - /** - * Converts hash string or Uint8Array to Point. - * @param hex short/long ECDSA hex - */ - static fromHex(hex) { - const P = Point2.fromAffine(fromBytes(ensureBytes("pointHex", hex))); - P.assertValidity(); - return P; - } - // Multiplies generator point by privateKey. - static fromPrivateKey(privateKey) { - return Point2.BASE.multiply(normPrivateKeyToScalar(privateKey)); - } - // "Private method", don't use it directly - _setWindowSize(windowSize) { - this._WINDOW_SIZE = windowSize; - pointPrecomputes.delete(this); - } - // A point on curve is valid if it conforms to equation. - assertValidity() { - if (this.is0()) { - if (CURVE.allowInfinityPoint && !Fp2.is0(this.py)) - return; - throw new Error("bad point: ZERO"); - } - const { x, y } = this.toAffine(); - if (!Fp2.isValid(x) || !Fp2.isValid(y)) - throw new Error("bad point: x or y not FE"); - const left = Fp2.sqr(y); - const right = weierstrassEquation(x); - if (!Fp2.eql(left, right)) - throw new Error("bad point: equation left != right"); - if (!this.isTorsionFree()) - throw new Error("bad point: not in prime-order subgroup"); - } - hasEvenY() { - const { y } = this.toAffine(); - if (Fp2.isOdd) - return !Fp2.isOdd(y); - throw new Error("Field doesn't support isOdd"); - } - /** - * Compare one point to another. - */ - equals(other) { - assertPrjPoint(other); - const { px: X1, py: Y1, pz: Z1 } = this; - const { px: X2, py: Y2, pz: Z2 } = other; - const U12 = Fp2.eql(Fp2.mul(X1, Z2), Fp2.mul(X2, Z1)); - const U22 = Fp2.eql(Fp2.mul(Y1, Z2), Fp2.mul(Y2, Z1)); - return U12 && U22; - } - /** - * Flips point to one corresponding to (x, -y) in Affine coordinates. - */ - negate() { - return new Point2(this.px, Fp2.neg(this.py), this.pz); - } - // Renes-Costello-Batina exception-free doubling formula. - // There is 30% faster Jacobian formula, but it is not complete. - // https://eprint.iacr.org/2015/1060, algorithm 3 - // Cost: 8M + 3S + 3*a + 2*b3 + 15add. - double() { - const { a, b: b2 } = CURVE; - const b3 = Fp2.mul(b2, _3n2); - const { px: X1, py: Y1, pz: Z1 } = this; - let X3 = Fp2.ZERO, Y3 = Fp2.ZERO, Z3 = Fp2.ZERO; - let t0 = Fp2.mul(X1, X1); - let t1 = Fp2.mul(Y1, Y1); - let t2 = Fp2.mul(Z1, Z1); - let t3 = Fp2.mul(X1, Y1); - t3 = Fp2.add(t3, t3); - Z3 = Fp2.mul(X1, Z1); - Z3 = Fp2.add(Z3, Z3); - X3 = Fp2.mul(a, Z3); - Y3 = Fp2.mul(b3, t2); - Y3 = Fp2.add(X3, Y3); - X3 = Fp2.sub(t1, Y3); - Y3 = Fp2.add(t1, Y3); - Y3 = Fp2.mul(X3, Y3); - X3 = Fp2.mul(t3, X3); - Z3 = Fp2.mul(b3, Z3); - t2 = Fp2.mul(a, t2); - t3 = Fp2.sub(t0, t2); - t3 = Fp2.mul(a, t3); - t3 = Fp2.add(t3, Z3); - Z3 = Fp2.add(t0, t0); - t0 = Fp2.add(Z3, t0); - t0 = Fp2.add(t0, t2); - t0 = Fp2.mul(t0, t3); - Y3 = Fp2.add(Y3, t0); - t2 = Fp2.mul(Y1, Z1); - t2 = Fp2.add(t2, t2); - t0 = Fp2.mul(t2, t3); - X3 = Fp2.sub(X3, t0); - Z3 = Fp2.mul(t2, t1); - Z3 = Fp2.add(Z3, Z3); - Z3 = Fp2.add(Z3, Z3); - return new Point2(X3, Y3, Z3); - } - // Renes-Costello-Batina exception-free addition formula. - // There is 30% faster Jacobian formula, but it is not complete. - // https://eprint.iacr.org/2015/1060, algorithm 1 - // Cost: 12M + 0S + 3*a + 3*b3 + 23add. - add(other) { - assertPrjPoint(other); - const { px: X1, py: Y1, pz: Z1 } = this; - const { px: X2, py: Y2, pz: Z2 } = other; - let X3 = Fp2.ZERO, Y3 = Fp2.ZERO, Z3 = Fp2.ZERO; - const a = CURVE.a; - const b3 = Fp2.mul(CURVE.b, _3n2); - let t0 = Fp2.mul(X1, X2); - let t1 = Fp2.mul(Y1, Y2); - let t2 = Fp2.mul(Z1, Z2); - let t3 = Fp2.add(X1, Y1); - let t4 = Fp2.add(X2, Y2); - t3 = Fp2.mul(t3, t4); - t4 = Fp2.add(t0, t1); - t3 = Fp2.sub(t3, t4); - t4 = Fp2.add(X1, Z1); - let t5 = Fp2.add(X2, Z2); - t4 = Fp2.mul(t4, t5); - t5 = Fp2.add(t0, t2); - t4 = Fp2.sub(t4, t5); - t5 = Fp2.add(Y1, Z1); - X3 = Fp2.add(Y2, Z2); - t5 = Fp2.mul(t5, X3); - X3 = Fp2.add(t1, t2); - t5 = Fp2.sub(t5, X3); - Z3 = Fp2.mul(a, t4); - X3 = Fp2.mul(b3, t2); - Z3 = Fp2.add(X3, Z3); - X3 = Fp2.sub(t1, Z3); - Z3 = Fp2.add(t1, Z3); - Y3 = Fp2.mul(X3, Z3); - t1 = Fp2.add(t0, t0); - t1 = Fp2.add(t1, t0); - t2 = Fp2.mul(a, t2); - t4 = Fp2.mul(b3, t4); - t1 = Fp2.add(t1, t2); - t2 = Fp2.sub(t0, t2); - t2 = Fp2.mul(a, t2); - t4 = Fp2.add(t4, t2); - t0 = Fp2.mul(t1, t4); - Y3 = Fp2.add(Y3, t0); - t0 = Fp2.mul(t5, t4); - X3 = Fp2.mul(t3, X3); - X3 = Fp2.sub(X3, t0); - t0 = Fp2.mul(t3, t1); - Z3 = Fp2.mul(t5, Z3); - Z3 = Fp2.add(Z3, t0); - return new Point2(X3, Y3, Z3); - } - subtract(other) { - return this.add(other.negate()); - } - is0() { - return this.equals(Point2.ZERO); - } - wNAF(n2) { - return wnaf.wNAFCached(this, pointPrecomputes, n2, (comp) => { - const toInv = Fp2.invertBatch(comp.map((p) => p.pz)); - return comp.map((p, i) => p.toAffine(toInv[i])).map(Point2.fromAffine); - }); - } - /** - * Non-constant-time multiplication. Uses double-and-add algorithm. - * It's faster, but should only be used when you don't care about - * an exposed private key e.g. sig verification, which works over *public* keys. - */ - multiplyUnsafe(n2) { - const I = Point2.ZERO; - if (n2 === _0n5) - return I; - assertGE(n2); - if (n2 === _1n5) - return this; - const { endo } = CURVE; - if (!endo) - return wnaf.unsafeLadder(this, n2); - let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n2); - let k1p = I; - let k2p = I; - let d = this; - while (k1 > _0n5 || k2 > _0n5) { - if (k1 & _1n5) - k1p = k1p.add(d); - if (k2 & _1n5) - k2p = k2p.add(d); - d = d.double(); - k1 >>= _1n5; - k2 >>= _1n5; - } - if (k1neg) - k1p = k1p.negate(); - if (k2neg) - k2p = k2p.negate(); - k2p = new Point2(Fp2.mul(k2p.px, endo.beta), k2p.py, k2p.pz); - return k1p.add(k2p); - } - /** - * Constant time multiplication. - * Uses wNAF method. Windowed method may be 10% faster, - * but takes 2x longer to generate and consumes 2x memory. - * Uses precomputes when available. - * Uses endomorphism for Koblitz curves. - * @param scalar by which the point would be multiplied - * @returns New point - */ - multiply(scalar) { - assertGE(scalar); - let n2 = scalar; - let point, fake; - const { endo } = CURVE; - if (endo) { - const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n2); - let { p: k1p, f: f1p } = this.wNAF(k1); - let { p: k2p, f: f2p } = this.wNAF(k2); - k1p = wnaf.constTimeNegate(k1neg, k1p); - k2p = wnaf.constTimeNegate(k2neg, k2p); - k2p = new Point2(Fp2.mul(k2p.px, endo.beta), k2p.py, k2p.pz); - point = k1p.add(k2p); - fake = f1p.add(f2p); - } else { - const { p, f: f2 } = this.wNAF(n2); - point = p; - fake = f2; - } - return Point2.normalizeZ([point, fake])[0]; - } - /** - * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly. - * Not using Strauss-Shamir trick: precomputation tables are faster. - * The trick could be useful if both P and Q are not G (not in our case). - * @returns non-zero affine point - */ - multiplyAndAddUnsafe(Q, a, b2) { - const G = Point2.BASE; - const mul = (P, a2) => a2 === _0n5 || a2 === _1n5 || !P.equals(G) ? P.multiplyUnsafe(a2) : P.multiply(a2); - const sum = mul(this, a).add(mul(Q, b2)); - return sum.is0() ? void 0 : sum; - } - // Converts Projective point to affine (x, y) coordinates. - // Can accept precomputed Z^-1 - for example, from invertBatch. - // (x, y, z) ∋ (x=x/z, y=y/z) - toAffine(iz) { - const { px: x, py: y, pz: z } = this; - const is0 = this.is0(); - if (iz == null) - iz = is0 ? Fp2.ONE : Fp2.inv(z); - const ax = Fp2.mul(x, iz); - const ay = Fp2.mul(y, iz); - const zz = Fp2.mul(z, iz); - if (is0) - return { x: Fp2.ZERO, y: Fp2.ZERO }; - if (!Fp2.eql(zz, Fp2.ONE)) - throw new Error("invZ was invalid"); - return { x: ax, y: ay }; - } - isTorsionFree() { - const { h: cofactor, isTorsionFree } = CURVE; - if (cofactor === _1n5) - return true; - if (isTorsionFree) - return isTorsionFree(Point2, this); - throw new Error("isTorsionFree() has not been declared for the elliptic curve"); - } - clearCofactor() { - const { h: cofactor, clearCofactor } = CURVE; - if (cofactor === _1n5) - return this; - if (clearCofactor) - return clearCofactor(Point2, this); - return this.multiplyUnsafe(CURVE.h); - } - toRawBytes(isCompressed = true) { - this.assertValidity(); - return toBytes2(Point2, this, isCompressed); - } - toHex(isCompressed = true) { - return bytesToHex(this.toRawBytes(isCompressed)); - } - } - Point2.BASE = new Point2(CURVE.Gx, CURVE.Gy, Fp2.ONE); - Point2.ZERO = new Point2(Fp2.ZERO, Fp2.ONE, Fp2.ZERO); - const _bits = CURVE.nBitLength; - const wnaf = wNAF(Point2, CURVE.endo ? Math.ceil(_bits / 2) : _bits); - return { - CURVE, - ProjectivePoint: Point2, - normPrivateKeyToScalar, - weierstrassEquation, - isWithinCurveOrder - }; -} -function validateOpts(curve) { - const opts = validateBasic(curve); - validateObject(opts, { - hash: "hash", - hmac: "function", - randomBytes: "function" - }, { - bits2int: "function", - bits2int_modN: "function", - lowS: "boolean" - }); - return Object.freeze({ lowS: true, ...opts }); -} -function weierstrass(curveDef) { - const CURVE = validateOpts(curveDef); - const { Fp: Fp2, n: CURVE_ORDER } = CURVE; - const compressedLen = Fp2.BYTES + 1; - const uncompressedLen = 2 * Fp2.BYTES + 1; - function isValidFieldElement(num) { - return _0n5 < num && num < Fp2.ORDER; - } - function modN2(a) { - return mod(a, CURVE_ORDER); - } - function invN(a) { - return invert(a, CURVE_ORDER); - } - const { ProjectivePoint: Point2, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder } = weierstrassPoints({ - ...CURVE, - toBytes(_c, point, isCompressed) { - const a = point.toAffine(); - const x = Fp2.toBytes(a.x); - const cat = concatBytes2; - if (isCompressed) { - return cat(Uint8Array.from([point.hasEvenY() ? 2 : 3]), x); - } else { - return cat(Uint8Array.from([4]), x, Fp2.toBytes(a.y)); - } - }, - fromBytes(bytes2) { - const len = bytes2.length; - const head = bytes2[0]; - const tail = bytes2.subarray(1); - if (len === compressedLen && (head === 2 || head === 3)) { - const x = bytesToNumberBE(tail); - if (!isValidFieldElement(x)) - throw new Error("Point is not on curve"); - const y2 = weierstrassEquation(x); - let y = Fp2.sqrt(y2); - const isYOdd = (y & _1n5) === _1n5; - const isHeadOdd = (head & 1) === 1; - if (isHeadOdd !== isYOdd) - y = Fp2.neg(y); - return { x, y }; - } else if (len === uncompressedLen && head === 4) { - const x = Fp2.fromBytes(tail.subarray(0, Fp2.BYTES)); - const y = Fp2.fromBytes(tail.subarray(Fp2.BYTES, 2 * Fp2.BYTES)); - return { x, y }; - } else { - throw new Error(`Point of length ${len} was invalid. Expected ${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes`); - } - } - }); - const numToNByteStr = (num) => bytesToHex(numberToBytesBE(num, CURVE.nByteLength)); - function isBiggerThanHalfOrder(number2) { - const HALF = CURVE_ORDER >> _1n5; - return number2 > HALF; - } - function normalizeS(s) { - return isBiggerThanHalfOrder(s) ? modN2(-s) : s; - } - const slcNum = (b2, from, to) => bytesToNumberBE(b2.slice(from, to)); - class Signature2 { - constructor(r, s, recovery) { - this.r = r; - this.s = s; - this.recovery = recovery; - this.assertValidity(); - } - // pair (bytes of r, bytes of s) - static fromCompact(hex) { - const l = CURVE.nByteLength; - hex = ensureBytes("compactSignature", hex, l * 2); - return new Signature2(slcNum(hex, 0, l), slcNum(hex, l, 2 * l)); - } - // DER encoded ECDSA signature - // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script - static fromDER(hex) { - const { r, s } = DER.toSig(ensureBytes("DER", hex)); - return new Signature2(r, s); - } - assertValidity() { - if (!isWithinCurveOrder(this.r)) - throw new Error("r must be 0 < r < CURVE.n"); - if (!isWithinCurveOrder(this.s)) - throw new Error("s must be 0 < s < CURVE.n"); - } - addRecoveryBit(recovery) { - return new Signature2(this.r, this.s, recovery); - } - recoverPublicKey(msgHash) { - const { r, s, recovery: rec } = this; - const h = bits2int_modN(ensureBytes("msgHash", msgHash)); - if (rec == null || ![0, 1, 2, 3].includes(rec)) - throw new Error("recovery id invalid"); - const radj = rec === 2 || rec === 3 ? r + CURVE.n : r; - if (radj >= Fp2.ORDER) - throw new Error("recovery id 2 or 3 invalid"); - const prefix = (rec & 1) === 0 ? "02" : "03"; - const R = Point2.fromHex(prefix + numToNByteStr(radj)); - const ir = invN(radj); - const u1 = modN2(-h * ir); - const u2 = modN2(s * ir); - const Q = Point2.BASE.multiplyAndAddUnsafe(R, u1, u2); - if (!Q) - throw new Error("point at infinify"); - Q.assertValidity(); - return Q; - } - // Signatures should be low-s, to prevent malleability. - hasHighS() { - return isBiggerThanHalfOrder(this.s); - } - normalizeS() { - return this.hasHighS() ? new Signature2(this.r, modN2(-this.s), this.recovery) : this; - } - // DER-encoded - toDERRawBytes() { - return hexToBytes(this.toDERHex()); - } - toDERHex() { - return DER.hexFromSig({ r: this.r, s: this.s }); - } - // padded bytes of r, then padded bytes of s - toCompactRawBytes() { - return hexToBytes(this.toCompactHex()); - } - toCompactHex() { - return numToNByteStr(this.r) + numToNByteStr(this.s); - } - } - const utils = { - isValidPrivateKey(privateKey) { - try { - normPrivateKeyToScalar(privateKey); - return true; - } catch (error) { - return false; - } - }, - normPrivateKeyToScalar, - /** - * Produces cryptographically secure private key from random of size - * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible. - */ - randomPrivateKey: () => { - const length = getMinHashLength(CURVE.n); - return mapHashToField(CURVE.randomBytes(length), CURVE.n); - }, - /** - * Creates precompute table for an arbitrary EC point. Makes point "cached". - * Allows to massively speed-up `point.multiply(scalar)`. - * @returns cached point - * @example - * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey)); - * fast.multiply(privKey); // much faster ECDH now - */ - precompute(windowSize = 8, point = Point2.BASE) { - point._setWindowSize(windowSize); - point.multiply(BigInt(3)); - return point; - } - }; - function getPublicKey(privateKey, isCompressed = true) { - return Point2.fromPrivateKey(privateKey).toRawBytes(isCompressed); - } - function isProbPub(item) { - const arr = item instanceof Uint8Array; - const str = typeof item === "string"; - const len = (arr || str) && item.length; - if (arr) - return len === compressedLen || len === uncompressedLen; - if (str) - return len === 2 * compressedLen || len === 2 * uncompressedLen; - if (item instanceof Point2) - return true; - return false; - } - function getSharedSecret(privateA, publicB, isCompressed = true) { - if (isProbPub(privateA)) - throw new Error("first arg must be private key"); - if (!isProbPub(publicB)) - throw new Error("second arg must be public key"); - const b2 = Point2.fromHex(publicB); - return b2.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed); - } - const bits2int = CURVE.bits2int || function(bytes2) { - const num = bytesToNumberBE(bytes2); - const delta = bytes2.length * 8 - CURVE.nBitLength; - return delta > 0 ? num >> BigInt(delta) : num; - }; - const bits2int_modN = CURVE.bits2int_modN || function(bytes2) { - return modN2(bits2int(bytes2)); - }; - const ORDER_MASK = bitMask(CURVE.nBitLength); - function int2octets(num) { - if (typeof num !== "bigint") - throw new Error("bigint expected"); - if (!(_0n5 <= num && num < ORDER_MASK)) - throw new Error(`bigint expected < 2^${CURVE.nBitLength}`); - return numberToBytesBE(num, CURVE.nByteLength); - } - function prepSig(msgHash, privateKey, opts = defaultSigOpts) { - if (["recovered", "canonical"].some((k) => k in opts)) - throw new Error("sign() legacy options not supported"); - const { hash: hash2, randomBytes: randomBytes4 } = CURVE; - let { lowS, prehash, extraEntropy: ent } = opts; - if (lowS == null) - lowS = true; - msgHash = ensureBytes("msgHash", msgHash); - if (prehash) - msgHash = ensureBytes("prehashed msgHash", hash2(msgHash)); - const h1int = bits2int_modN(msgHash); - const d = normPrivateKeyToScalar(privateKey); - const seedArgs = [int2octets(d), int2octets(h1int)]; - if (ent != null) { - const e = ent === true ? randomBytes4(Fp2.BYTES) : ent; - seedArgs.push(ensureBytes("extraEntropy", e)); - } - const seed = concatBytes2(...seedArgs); - const m = h1int; - function k2sig(kBytes) { - const k = bits2int(kBytes); - if (!isWithinCurveOrder(k)) - return; - const ik = invN(k); - const q = Point2.BASE.multiply(k).toAffine(); - const r = modN2(q.x); - if (r === _0n5) - return; - const s = modN2(ik * modN2(m + r * d)); - if (s === _0n5) - return; - let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n5); - let normS = s; - if (lowS && isBiggerThanHalfOrder(s)) { - normS = normalizeS(s); - recovery ^= 1; - } - return new Signature2(r, normS, recovery); - } - return { seed, k2sig }; - } - const defaultSigOpts = { lowS: CURVE.lowS, prehash: false }; - const defaultVerOpts = { lowS: CURVE.lowS, prehash: false }; - function sign(msgHash, privKey, opts = defaultSigOpts) { - const { seed, k2sig } = prepSig(msgHash, privKey, opts); - const C = CURVE; - const drbg = createHmacDrbg(C.hash.outputLen, C.nByteLength, C.hmac); - return drbg(seed, k2sig); - } - Point2.BASE._setWindowSize(8); - function verify(signature, msgHash, publicKey, opts = defaultVerOpts) { - var _a2; - const sg = signature; - msgHash = ensureBytes("msgHash", msgHash); - publicKey = ensureBytes("publicKey", publicKey); - if ("strict" in opts) - throw new Error("options.strict was renamed to lowS"); - const { lowS, prehash } = opts; - let _sig2 = void 0; - let P; - try { - if (typeof sg === "string" || sg instanceof Uint8Array) { - try { - _sig2 = Signature2.fromDER(sg); - } catch (derError) { - if (!(derError instanceof DER.Err)) - throw derError; - _sig2 = Signature2.fromCompact(sg); - } - } else if (typeof sg === "object" && typeof sg.r === "bigint" && typeof sg.s === "bigint") { - const { r: r2, s: s2 } = sg; - _sig2 = new Signature2(r2, s2); - } else { - throw new Error("PARSE"); - } - P = Point2.fromHex(publicKey); - } catch (error) { - if (error.message === "PARSE") - throw new Error(`signature must be Signature instance, Uint8Array or hex string`); - return false; - } - if (lowS && _sig2.hasHighS()) - return false; - if (prehash) - msgHash = CURVE.hash(msgHash); - const { r, s } = _sig2; - const h = bits2int_modN(msgHash); - const is = invN(s); - const u1 = modN2(h * is); - const u2 = modN2(r * is); - const R = (_a2 = Point2.BASE.multiplyAndAddUnsafe(P, u1, u2)) == null ? void 0 : _a2.toAffine(); - if (!R) - return false; - const v = modN2(R.x); - return v === r; - } - return { - CURVE, - getPublicKey, - getSharedSecret, - sign, - verify, - ProjectivePoint: Point2, - Signature: Signature2, - utils - }; -} -function SWUFpSqrtRatio(Fp2, Z) { - const q = Fp2.ORDER; - let l = _0n5; - for (let o = q - _1n5; o % _2n4 === _0n5; o /= _2n4) - l += _1n5; - const c1 = l; - const _2n_pow_c1_1 = _2n4 << c1 - _1n5 - _1n5; - const _2n_pow_c1 = _2n_pow_c1_1 * _2n4; - const c2 = (q - _1n5) / _2n_pow_c1; - const c3 = (c2 - _1n5) / _2n4; - const c4 = _2n_pow_c1 - _1n5; - const c5 = _2n_pow_c1_1; - const c6 = Fp2.pow(Z, c2); - const c7 = Fp2.pow(Z, (c2 + _1n5) / _2n4); - let sqrtRatio = (u, v) => { - let tv1 = c6; - let tv2 = Fp2.pow(v, c4); - let tv3 = Fp2.sqr(tv2); - tv3 = Fp2.mul(tv3, v); - let tv5 = Fp2.mul(u, tv3); - tv5 = Fp2.pow(tv5, c3); - tv5 = Fp2.mul(tv5, tv2); - tv2 = Fp2.mul(tv5, v); - tv3 = Fp2.mul(tv5, u); - let tv4 = Fp2.mul(tv3, tv2); - tv5 = Fp2.pow(tv4, c5); - let isQR = Fp2.eql(tv5, Fp2.ONE); - tv2 = Fp2.mul(tv3, c7); - tv5 = Fp2.mul(tv4, tv1); - tv3 = Fp2.cmov(tv2, tv3, isQR); - tv4 = Fp2.cmov(tv5, tv4, isQR); - for (let i = c1; i > _1n5; i--) { - let tv52 = i - _2n4; - tv52 = _2n4 << tv52 - _1n5; - let tvv5 = Fp2.pow(tv4, tv52); - const e1 = Fp2.eql(tvv5, Fp2.ONE); - tv2 = Fp2.mul(tv3, tv1); - tv1 = Fp2.mul(tv1, tv1); - tvv5 = Fp2.mul(tv4, tv1); - tv3 = Fp2.cmov(tv2, tv3, e1); - tv4 = Fp2.cmov(tvv5, tv4, e1); - } - return { isValid: isQR, value: tv3 }; - }; - if (Fp2.ORDER % _4n2 === _3n2) { - const c12 = (Fp2.ORDER - _3n2) / _4n2; - const c22 = Fp2.sqrt(Fp2.neg(Z)); - sqrtRatio = (u, v) => { - let tv1 = Fp2.sqr(v); - const tv2 = Fp2.mul(u, v); - tv1 = Fp2.mul(tv1, tv2); - let y1 = Fp2.pow(tv1, c12); - y1 = Fp2.mul(y1, tv2); - const y2 = Fp2.mul(y1, c22); - const tv3 = Fp2.mul(Fp2.sqr(y1), v); - const isQR = Fp2.eql(tv3, u); - let y = Fp2.cmov(y2, y1, isQR); - return { isValid: isQR, value: y }; - }; - } - return sqrtRatio; -} -function mapToCurveSimpleSWU(Fp2, opts) { - validateField(Fp2); - if (!Fp2.isValid(opts.A) || !Fp2.isValid(opts.B) || !Fp2.isValid(opts.Z)) - throw new Error("mapToCurveSimpleSWU: invalid opts"); - const sqrtRatio = SWUFpSqrtRatio(Fp2, opts.Z); - if (!Fp2.isOdd) - throw new Error("Fp.isOdd is not implemented!"); - return (u) => { - let tv1, tv2, tv3, tv4, tv5, tv6, x, y; - tv1 = Fp2.sqr(u); - tv1 = Fp2.mul(tv1, opts.Z); - tv2 = Fp2.sqr(tv1); - tv2 = Fp2.add(tv2, tv1); - tv3 = Fp2.add(tv2, Fp2.ONE); - tv3 = Fp2.mul(tv3, opts.B); - tv4 = Fp2.cmov(opts.Z, Fp2.neg(tv2), !Fp2.eql(tv2, Fp2.ZERO)); - tv4 = Fp2.mul(tv4, opts.A); - tv2 = Fp2.sqr(tv3); - tv6 = Fp2.sqr(tv4); - tv5 = Fp2.mul(tv6, opts.A); - tv2 = Fp2.add(tv2, tv5); - tv2 = Fp2.mul(tv2, tv3); - tv6 = Fp2.mul(tv6, tv4); - tv5 = Fp2.mul(tv6, opts.B); - tv2 = Fp2.add(tv2, tv5); - x = Fp2.mul(tv1, tv3); - const { isValid, value } = sqrtRatio(tv2, tv6); - y = Fp2.mul(tv1, u); - y = Fp2.mul(y, value); - x = Fp2.cmov(x, tv3, isValid); - y = Fp2.cmov(y, value, isValid); - const e1 = Fp2.isOdd(u) === Fp2.isOdd(y); - y = Fp2.cmov(Fp2.neg(y), y, e1); - x = Fp2.div(x, tv4); - return { x, y }; - }; -} - -// node_modules/ethers/node_modules/@noble/curves/esm/abstract/hash-to-curve.js -function validateDST(dst) { - if (dst instanceof Uint8Array) - return dst; - if (typeof dst === "string") - return utf8ToBytes2(dst); - throw new Error("DST must be Uint8Array or string"); -} -var os2ip = bytesToNumberBE; -function i2osp(value, length) { - if (value < 0 || value >= 1 << 8 * length) { - throw new Error(`bad I2OSP call: value=${value} length=${length}`); - } - const res = Array.from({ length }).fill(0); - for (let i = length - 1; i >= 0; i--) { - res[i] = value & 255; - value >>>= 8; - } - return new Uint8Array(res); -} -function strxor(a, b2) { - const arr = new Uint8Array(a.length); - for (let i = 0; i < a.length; i++) { - arr[i] = a[i] ^ b2[i]; - } - return arr; -} -function isBytes(item) { - if (!(item instanceof Uint8Array)) - throw new Error("Uint8Array expected"); -} -function isNum(item) { - if (!Number.isSafeInteger(item)) - throw new Error("number expected"); -} -function expand_message_xmd(msg, DST, lenInBytes, H) { - isBytes(msg); - isBytes(DST); - isNum(lenInBytes); - if (DST.length > 255) - DST = H(concatBytes2(utf8ToBytes2("H2C-OVERSIZE-DST-"), DST)); - const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H; - const ell = Math.ceil(lenInBytes / b_in_bytes); - if (ell > 255) - throw new Error("Invalid xmd length"); - const DST_prime = concatBytes2(DST, i2osp(DST.length, 1)); - const Z_pad = i2osp(0, r_in_bytes); - const l_i_b_str = i2osp(lenInBytes, 2); - const b2 = new Array(ell); - const b_0 = H(concatBytes2(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime)); - b2[0] = H(concatBytes2(b_0, i2osp(1, 1), DST_prime)); - for (let i = 1; i <= ell; i++) { - const args = [strxor(b_0, b2[i - 1]), i2osp(i + 1, 1), DST_prime]; - b2[i] = H(concatBytes2(...args)); - } - const pseudo_random_bytes = concatBytes2(...b2); - return pseudo_random_bytes.slice(0, lenInBytes); -} -function expand_message_xof(msg, DST, lenInBytes, k, H) { - isBytes(msg); - isBytes(DST); - isNum(lenInBytes); - if (DST.length > 255) { - const dkLen = Math.ceil(2 * k / 8); - DST = H.create({ dkLen }).update(utf8ToBytes2("H2C-OVERSIZE-DST-")).update(DST).digest(); - } - if (lenInBytes > 65535 || DST.length > 255) - throw new Error("expand_message_xof: invalid lenInBytes"); - return H.create({ dkLen: lenInBytes }).update(msg).update(i2osp(lenInBytes, 2)).update(DST).update(i2osp(DST.length, 1)).digest(); -} -function hash_to_field(msg, count, options) { - validateObject(options, { - DST: "stringOrUint8Array", - p: "bigint", - m: "isSafeInteger", - k: "isSafeInteger", - hash: "hash" - }); - const { p, k, m, hash: hash2, expand, DST: _DST } = options; - isBytes(msg); - isNum(count); - const DST = validateDST(_DST); - const log2p = p.toString(2).length; - const L = Math.ceil((log2p + k) / 8); - const len_in_bytes = count * m * L; - let prb; - if (expand === "xmd") { - prb = expand_message_xmd(msg, DST, len_in_bytes, hash2); - } else if (expand === "xof") { - prb = expand_message_xof(msg, DST, len_in_bytes, k, hash2); - } else if (expand === "_internal_pass") { - prb = msg; - } else { - throw new Error('expand must be "xmd" or "xof"'); - } - const u = new Array(count); - for (let i = 0; i < count; i++) { - const e = new Array(m); - for (let j = 0; j < m; j++) { - const elm_offset = L * (j + i * m); - const tv = prb.subarray(elm_offset, elm_offset + L); - e[j] = mod(os2ip(tv), p); - } - u[i] = e; - } - return u; -} -function isogenyMap(field, map) { - const COEFF = map.map((i) => Array.from(i).reverse()); - return (x, y) => { - const [xNum, xDen, yNum, yDen] = COEFF.map((val) => val.reduce((acc, i) => field.add(field.mul(acc, x), i))); - x = field.div(xNum, xDen); - y = field.mul(y, field.div(yNum, yDen)); - return { x, y }; - }; -} -function createHasher(Point2, mapToCurve, def) { - if (typeof mapToCurve !== "function") - throw new Error("mapToCurve() must be defined"); - return { - // Encodes byte string to elliptic curve. - // hash_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 - hashToCurve(msg, options) { - const u = hash_to_field(msg, 2, { ...def, DST: def.DST, ...options }); - const u0 = Point2.fromAffine(mapToCurve(u[0])); - const u1 = Point2.fromAffine(mapToCurve(u[1])); - const P = u0.add(u1).clearCofactor(); - P.assertValidity(); - return P; - }, - // Encodes byte string to elliptic curve. - // encode_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 - encodeToCurve(msg, options) { - const u = hash_to_field(msg, 1, { ...def, DST: def.encodeDST, ...options }); - const P = Point2.fromAffine(mapToCurve(u[0])).clearCofactor(); - P.assertValidity(); - return P; - } - }; -} - -// node_modules/ethers/node_modules/@noble/curves/esm/_shortw_utils.js -function getHash(hash2) { - return { - hash: hash2, - hmac: (key, ...msgs) => hmac(hash2, key, concatBytes(...msgs)), - randomBytes - }; -} -function createCurve(curveDef, defHash) { - const create = (hash2) => weierstrass({ ...curveDef, ...getHash(hash2) }); - return Object.freeze({ ...create(defHash), create }); -} - -// node_modules/ethers/node_modules/@noble/curves/esm/secp256k1.js -var secp256k1P = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"); -var secp256k1N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); -var _1n6 = BigInt(1); -var _2n5 = BigInt(2); -var divNearest = (a, b2) => (a + b2 / _2n5) / b2; -function sqrtMod(y) { - const P = secp256k1P; - const _3n3 = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22); - const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88); - const b2 = y * y * y % P; - const b3 = b2 * b2 * y % P; - const b6 = pow2(b3, _3n3, P) * b3 % P; - const b9 = pow2(b6, _3n3, P) * b3 % P; - const b11 = pow2(b9, _2n5, P) * b2 % P; - const b22 = pow2(b11, _11n, P) * b11 % P; - const b44 = pow2(b22, _22n, P) * b22 % P; - const b88 = pow2(b44, _44n, P) * b44 % P; - const b176 = pow2(b88, _88n, P) * b88 % P; - const b220 = pow2(b176, _44n, P) * b44 % P; - const b223 = pow2(b220, _3n3, P) * b3 % P; - const t1 = pow2(b223, _23n, P) * b22 % P; - const t2 = pow2(t1, _6n, P) * b2 % P; - const root = pow2(t2, _2n5, P); - if (!Fp.eql(Fp.sqr(root), y)) - throw new Error("Cannot find square root"); - return root; -} -var Fp = Field(secp256k1P, void 0, void 0, { sqrt: sqrtMod }); -var secp256k1 = createCurve({ - a: BigInt(0), - b: BigInt(7), - Fp, - n: secp256k1N, - // Base point (x, y) aka generator point - Gx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"), - Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"), - h: BigInt(1), - lowS: true, - /** - * secp256k1 belongs to Koblitz curves: it has efficiently computable endomorphism. - * Endomorphism uses 2x less RAM, speeds up precomputation by 2x and ECDH / key recovery by 20%. - * For precomputed wNAF it trades off 1/2 init time & 1/3 ram for 20% perf hit. - * Explanation: https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066 - */ - endo: { - beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"), - splitScalar: (k) => { - const n2 = secp256k1N; - const a1 = BigInt("0x3086d221a7d46bcde86c90e49284eb15"); - const b1 = -_1n6 * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"); - const a2 = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"); - const b2 = a1; - const POW_2_128 = BigInt("0x100000000000000000000000000000000"); - const c1 = divNearest(b2 * k, n2); - const c2 = divNearest(-b1 * k, n2); - let k1 = mod(k - c1 * a1 - c2 * a2, n2); - let k2 = mod(-c1 * b1 - c2 * b2, n2); - const k1neg = k1 > POW_2_128; - const k2neg = k2 > POW_2_128; - if (k1neg) - k1 = n2 - k1; - if (k2neg) - k2 = n2 - k2; - if (k1 > POW_2_128 || k2 > POW_2_128) { - throw new Error("splitScalar: Endomorphism failed, k=" + k); - } - return { k1neg, k1, k2neg, k2 }; - } - } -}, sha256); -var _0n6 = BigInt(0); -var fe = (x) => typeof x === "bigint" && _0n6 < x && x < secp256k1P; -var ge = (x) => typeof x === "bigint" && _0n6 < x && x < secp256k1N; -var TAGGED_HASH_PREFIXES = {}; -function taggedHash(tag, ...messages) { - let tagP = TAGGED_HASH_PREFIXES[tag]; - if (tagP === void 0) { - const tagH = sha256(Uint8Array.from(tag, (c) => c.charCodeAt(0))); - tagP = concatBytes2(tagH, tagH); - TAGGED_HASH_PREFIXES[tag] = tagP; - } - return sha256(concatBytes2(tagP, ...messages)); -} -var pointToBytes = (point) => point.toRawBytes(true).slice(1); -var numTo32b = (n2) => numberToBytesBE(n2, 32); -var modP = (x) => mod(x, secp256k1P); -var modN = (x) => mod(x, secp256k1N); -var Point = secp256k1.ProjectivePoint; -var GmulAdd = (Q, a, b2) => Point.BASE.multiplyAndAddUnsafe(Q, a, b2); -function schnorrGetExtPubKey(priv) { - let d_ = secp256k1.utils.normPrivateKeyToScalar(priv); - let p = Point.fromPrivateKey(d_); - const scalar = p.hasEvenY() ? d_ : modN(-d_); - return { scalar, bytes: pointToBytes(p) }; -} -function lift_x(x) { - if (!fe(x)) - throw new Error("bad x: need 0 < x < p"); - const xx = modP(x * x); - const c = modP(xx * x + BigInt(7)); - let y = sqrtMod(c); - if (y % _2n5 !== _0n6) - y = modP(-y); - const p = new Point(x, y, _1n6); - p.assertValidity(); - return p; -} -function challenge(...args) { - return modN(bytesToNumberBE(taggedHash("BIP0340/challenge", ...args))); -} -function schnorrGetPublicKey(privateKey) { - return schnorrGetExtPubKey(privateKey).bytes; -} -function schnorrSign(message, privateKey, auxRand = randomBytes(32)) { - const m = ensureBytes("message", message); - const { bytes: px, scalar: d } = schnorrGetExtPubKey(privateKey); - const a = ensureBytes("auxRand", auxRand, 32); - const t = numTo32b(d ^ bytesToNumberBE(taggedHash("BIP0340/aux", a))); - const rand = taggedHash("BIP0340/nonce", t, px, m); - const k_ = modN(bytesToNumberBE(rand)); - if (k_ === _0n6) - throw new Error("sign failed: k is zero"); - const { bytes: rx, scalar: k } = schnorrGetExtPubKey(k_); - const e = challenge(rx, px, m); - const sig = new Uint8Array(64); - sig.set(rx, 0); - sig.set(numTo32b(modN(k + e * d)), 32); - if (!schnorrVerify(sig, m, px)) - throw new Error("sign: Invalid signature produced"); - return sig; -} -function schnorrVerify(signature, message, publicKey) { - const sig = ensureBytes("signature", signature, 64); - const m = ensureBytes("message", message); - const pub = ensureBytes("publicKey", publicKey, 32); - try { - const P = lift_x(bytesToNumberBE(pub)); - const r = bytesToNumberBE(sig.subarray(0, 32)); - if (!fe(r)) - return false; - const s = bytesToNumberBE(sig.subarray(32, 64)); - if (!ge(s)) - return false; - const e = challenge(numTo32b(r), pointToBytes(P), m); - const R = GmulAdd(P, s, modN(-e)); - if (!R || !R.hasEvenY() || R.toAffine().x !== r) - return false; - return true; - } catch (error) { - return false; - } -} -var schnorr = (() => ({ - getPublicKey: schnorrGetPublicKey, - sign: schnorrSign, - verify: schnorrVerify, - utils: { - randomPrivateKey: secp256k1.utils.randomPrivateKey, - lift_x, - pointToBytes, - numberToBytesBE, - bytesToNumberBE, - taggedHash, - mod - } -}))(); -var isoMap = (() => isogenyMap(Fp, [ - // xNum - [ - "0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7", - "0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581", - "0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262", - "0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c" - ], - // xDen - [ - "0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b", - "0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14", - "0x0000000000000000000000000000000000000000000000000000000000000001" - // LAST 1 - ], - // yNum - [ - "0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c", - "0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3", - "0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931", - "0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84" - ], - // yDen - [ - "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b", - "0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573", - "0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f", - "0x0000000000000000000000000000000000000000000000000000000000000001" - // LAST 1 - ] -].map((i) => i.map((j) => BigInt(j)))))(); -var mapSWU = (() => mapToCurveSimpleSWU(Fp, { - A: BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"), - B: BigInt("1771"), - Z: Fp.create(BigInt("-11")) -}))(); -var htf = (() => createHasher(secp256k1.ProjectivePoint, (scalars) => { - const { x, y } = mapSWU(Fp.create(scalars[0])); - return isoMap(x, y); -}, { - DST: "secp256k1_XMD:SHA-256_SSWU_RO_", - encodeDST: "secp256k1_XMD:SHA-256_SSWU_NU_", - p: Fp.ORDER, - m: 1, - k: 128, - expand: "xmd", - hash: sha256 -}))(); -var hashToCurve = (() => htf.hashToCurve)(); -var encodeToCurve = (() => htf.encodeToCurve)(); - -// node_modules/ethers/lib.esm/constants/addresses.js -var ZeroAddress = "0x0000000000000000000000000000000000000000"; - -// node_modules/ethers/lib.esm/constants/hashes.js -var ZeroHash = "0x0000000000000000000000000000000000000000000000000000000000000000"; - -// node_modules/ethers/lib.esm/constants/numbers.js -var N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); -var WeiPerEther = BigInt("1000000000000000000"); -var MaxUint256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); -var MinInt256 = BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * BigInt(-1); -var MaxInt256 = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); - -// node_modules/ethers/lib.esm/constants/strings.js -var EtherSymbol = "Ξ"; -var MessagePrefix = "Ethereum Signed Message:\n"; - -// node_modules/ethers/lib.esm/crypto/signature.js -var BN_04 = BigInt(0); -var BN_13 = BigInt(1); -var BN_2 = BigInt(2); -var BN_27 = BigInt(27); -var BN_28 = BigInt(28); -var BN_35 = BigInt(35); -var _guard3 = {}; -function toUint256(value) { - return zeroPadValue(toBeArray(value), 32); -} -var _r, _s, _v, _networkV; -var _Signature = class _Signature { - /** - * @private - */ - constructor(guard, r, s, v) { - __privateAdd(this, _r, void 0); - __privateAdd(this, _s, void 0); - __privateAdd(this, _v, void 0); - __privateAdd(this, _networkV, void 0); - assertPrivate(guard, _guard3, "Signature"); - __privateSet(this, _r, r); - __privateSet(this, _s, s); - __privateSet(this, _v, v); - __privateSet(this, _networkV, null); - } - /** - * The ``r`` value for a signautre. - * - * This represents the ``x`` coordinate of a "reference" or - * challenge point, from which the ``y`` can be computed. - */ - get r() { - return __privateGet(this, _r); - } - set r(value) { - assertArgument(dataLength(value) === 32, "invalid r", "value", value); - __privateSet(this, _r, hexlify(value)); - } - /** - * The ``s`` value for a signature. - */ - get s() { - return __privateGet(this, _s); - } - set s(_value2) { - assertArgument(dataLength(_value2) === 32, "invalid s", "value", _value2); - const value = hexlify(_value2); - assertArgument(parseInt(value.substring(0, 3)) < 8, "non-canonical s", "value", value); - __privateSet(this, _s, value); - } - /** - * The ``v`` value for a signature. - * - * Since a given ``x`` value for ``r`` has two possible values for - * its correspondin ``y``, the ``v`` indicates which of the two ``y`` - * values to use. - * - * It is normalized to the values ``27`` or ``28`` for legacy - * purposes. - */ - get v() { - return __privateGet(this, _v); - } - set v(value) { - const v = getNumber(value, "value"); - assertArgument(v === 27 || v === 28, "invalid v", "v", value); - __privateSet(this, _v, v); - } - /** - * The EIP-155 ``v`` for legacy transactions. For non-legacy - * transactions, this value is ``null``. - */ - get networkV() { - return __privateGet(this, _networkV); - } - /** - * The chain ID for EIP-155 legacy transactions. For non-legacy - * transactions, this value is ``null``. - */ - get legacyChainId() { - const v = this.networkV; - if (v == null) { - return null; - } - return _Signature.getChainId(v); - } - /** - * The ``yParity`` for the signature. - * - * See ``v`` for more details on how this value is used. - */ - get yParity() { - return this.v === 27 ? 0 : 1; - } - /** - * The [[link-eip-2098]] compact representation of the ``yParity`` - * and ``s`` compacted into a single ``bytes32``. - */ - get yParityAndS() { - const yParityAndS = getBytes(this.s); - if (this.yParity) { - yParityAndS[0] |= 128; - } - return hexlify(yParityAndS); - } - /** - * The [[link-eip-2098]] compact representation. - */ - get compactSerialized() { - return concat([this.r, this.yParityAndS]); - } - /** - * The serialized representation. - */ - get serialized() { - return concat([this.r, this.s, this.yParity ? "0x1c" : "0x1b"]); - } - [Symbol.for("nodejs.util.inspect.custom")]() { - return `Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`; - } - /** - * Returns a new identical [[Signature]]. - */ - clone() { - const clone = new _Signature(_guard3, this.r, this.s, this.v); - if (this.networkV) { - __privateSet(clone, _networkV, this.networkV); - } - return clone; - } - /** - * Returns a representation that is compatible with ``JSON.stringify``. - */ - toJSON() { - const networkV = this.networkV; - return { - _type: "signature", - networkV: networkV != null ? networkV.toString() : null, - r: this.r, - s: this.s, - v: this.v - }; - } - /** - * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. - * - * @example: - * Signature.getChainId(45) - * //_result: - * - * Signature.getChainId(46) - * //_result: - */ - static getChainId(v) { - const bv = getBigInt(v, "v"); - if (bv == BN_27 || bv == BN_28) { - return BN_04; - } - assertArgument(bv >= BN_35, "invalid EIP-155 v", "v", v); - return (bv - BN_35) / BN_2; - } - /** - * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions. - * - * Legacy transactions which use [[link-eip-155]] hijack the ``v`` - * property to include the chain ID. - * - * @example: - * Signature.getChainIdV(5, 27) - * //_result: - * - * Signature.getChainIdV(5, 28) - * //_result: - * - */ - static getChainIdV(chainId, v) { - return getBigInt(chainId) * BN_2 + BigInt(35 + v - 27); - } - /** - * Compute the normalized legacy transaction ``v`` from a ``yParirty``, - * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction. - * - * @example: - * // The values 0 and 1 imply v is actually yParity - * Signature.getNormalizedV(0) - * //_result: - * - * // Legacy non-EIP-1559 transaction (i.e. 27 or 28) - * Signature.getNormalizedV(27) - * //_result: - * - * // Legacy EIP-155 transaction (i.e. >= 35) - * Signature.getNormalizedV(46) - * //_result: - * - * // Invalid values throw - * Signature.getNormalizedV(5) - * //_error: - */ - static getNormalizedV(v) { - const bv = getBigInt(v); - if (bv === BN_04 || bv === BN_27) { - return 27; - } - if (bv === BN_13 || bv === BN_28) { - return 28; - } - assertArgument(bv >= BN_35, "invalid v", "v", v); - return bv & BN_13 ? 27 : 28; - } - /** - * Creates a new [[Signature]]. - * - * If no %%sig%% is provided, a new [[Signature]] is created - * with default values. - * - * If %%sig%% is a string, it is parsed. - */ - static from(sig) { - function assertError(check, message) { - assertArgument(check, message, "signature", sig); - } - ; - if (sig == null) { - return new _Signature(_guard3, ZeroHash, ZeroHash, 27); - } - if (typeof sig === "string") { - const bytes2 = getBytes(sig, "signature"); - if (bytes2.length === 64) { - const r2 = hexlify(bytes2.slice(0, 32)); - const s2 = bytes2.slice(32, 64); - const v2 = s2[0] & 128 ? 28 : 27; - s2[0] &= 127; - return new _Signature(_guard3, r2, hexlify(s2), v2); - } - if (bytes2.length === 65) { - const r2 = hexlify(bytes2.slice(0, 32)); - const s2 = bytes2.slice(32, 64); - assertError((s2[0] & 128) === 0, "non-canonical s"); - const v2 = _Signature.getNormalizedV(bytes2[64]); - return new _Signature(_guard3, r2, hexlify(s2), v2); - } - assertError(false, "invalid raw signature length"); - } - if (sig instanceof _Signature) { - return sig.clone(); - } - const _r2 = sig.r; - assertError(_r2 != null, "missing r"); - const r = toUint256(_r2); - const s = function(s2, yParityAndS) { - if (s2 != null) { - return toUint256(s2); - } - if (yParityAndS != null) { - assertError(isHexString(yParityAndS, 32), "invalid yParityAndS"); - const bytes2 = getBytes(yParityAndS); - bytes2[0] &= 127; - return hexlify(bytes2); - } - assertError(false, "missing s"); - }(sig.s, sig.yParityAndS); - assertError((getBytes(s)[0] & 128) == 0, "non-canonical s"); - const { networkV, v } = function(_v2, yParityAndS, yParity) { - if (_v2 != null) { - const v2 = getBigInt(_v2); - return { - networkV: v2 >= BN_35 ? v2 : void 0, - v: _Signature.getNormalizedV(v2) - }; - } - if (yParityAndS != null) { - assertError(isHexString(yParityAndS, 32), "invalid yParityAndS"); - return { v: getBytes(yParityAndS)[0] & 128 ? 28 : 27 }; - } - if (yParity != null) { - switch (getNumber(yParity, "sig.yParity")) { - case 0: - return { v: 27 }; - case 1: - return { v: 28 }; - } - assertError(false, "invalid yParity"); - } - assertError(false, "missing v"); - }(sig.v, sig.yParityAndS, sig.yParity); - const result = new _Signature(_guard3, r, s, v); - if (networkV) { - __privateSet(result, _networkV, networkV); - } - assertError(sig.yParity == null || getNumber(sig.yParity, "sig.yParity") === result.yParity, "yParity mismatch"); - assertError(sig.yParityAndS == null || sig.yParityAndS === result.yParityAndS, "yParityAndS mismatch"); - return result; - } -}; -_r = new WeakMap(); -_s = new WeakMap(); -_v = new WeakMap(); -_networkV = new WeakMap(); -var Signature = _Signature; - -// node_modules/ethers/lib.esm/crypto/signing-key.js -var _privateKey; -var _SigningKey = class _SigningKey { - /** - * Creates a new **SigningKey** for %%privateKey%%. - */ - constructor(privateKey) { - __privateAdd(this, _privateKey, void 0); - assertArgument(dataLength(privateKey) === 32, "invalid private key", "privateKey", "[REDACTED]"); - __privateSet(this, _privateKey, hexlify(privateKey)); - } - /** - * The private key. - */ - get privateKey() { - return __privateGet(this, _privateKey); - } - /** - * The uncompressed public key. - * - * This will always begin with the prefix ``0x04`` and be 132 - * characters long (the ``0x`` prefix and 130 hexadecimal nibbles). - */ - get publicKey() { - return _SigningKey.computePublicKey(__privateGet(this, _privateKey)); - } - /** - * The compressed public key. - * - * This will always begin with either the prefix ``0x02`` or ``0x03`` - * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal - * nibbles) - */ - get compressedPublicKey() { - return _SigningKey.computePublicKey(__privateGet(this, _privateKey), true); - } - /** - * Return the signature of the signed %%digest%%. - */ - sign(digest) { - assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest); - const sig = secp256k1.sign(getBytesCopy(digest), getBytesCopy(__privateGet(this, _privateKey)), { - lowS: true - }); - return Signature.from({ - r: toBeHex(sig.r, 32), - s: toBeHex(sig.s, 32), - v: sig.recovery ? 28 : 27 - }); - } - /** - * Returns the [[link-wiki-ecdh]] shared secret between this - * private key and the %%other%% key. - * - * The %%other%% key may be any type of key, a raw public key, - * a compressed/uncompressed pubic key or aprivate key. - * - * Best practice is usually to use a cryptographic hash on the - * returned value before using it as a symetric secret. - * - * @example: - * sign1 = new SigningKey(id("some-secret-1")) - * sign2 = new SigningKey(id("some-secret-2")) - * - * // Notice that privA.computeSharedSecret(pubB)... - * sign1.computeSharedSecret(sign2.publicKey) - * //_result: - * - * // ...is equal to privB.computeSharedSecret(pubA). - * sign2.computeSharedSecret(sign1.publicKey) - * //_result: - */ - computeSharedSecret(other) { - const pubKey = _SigningKey.computePublicKey(other); - return hexlify(secp256k1.getSharedSecret(getBytesCopy(__privateGet(this, _privateKey)), getBytes(pubKey), false)); - } - /** - * Compute the public key for %%key%%, optionally %%compressed%%. - * - * The %%key%% may be any type of key, a raw public key, a - * compressed/uncompressed public key or private key. - * - * @example: - * sign = new SigningKey(id("some-secret")); - * - * // Compute the uncompressed public key for a private key - * SigningKey.computePublicKey(sign.privateKey) - * //_result: - * - * // Compute the compressed public key for a private key - * SigningKey.computePublicKey(sign.privateKey, true) - * //_result: - * - * // Compute the uncompressed public key - * SigningKey.computePublicKey(sign.publicKey, false); - * //_result: - * - * // Compute the Compressed a public key - * SigningKey.computePublicKey(sign.publicKey, true); - * //_result: - */ - static computePublicKey(key, compressed) { - let bytes2 = getBytes(key, "key"); - if (bytes2.length === 32) { - const pubKey = secp256k1.getPublicKey(bytes2, !!compressed); - return hexlify(pubKey); - } - if (bytes2.length === 64) { - const pub = new Uint8Array(65); - pub[0] = 4; - pub.set(bytes2, 1); - bytes2 = pub; - } - const point = secp256k1.ProjectivePoint.fromHex(bytes2); - return hexlify(point.toRawBytes(compressed)); - } - /** - * Returns the public key for the private key which produced the - * %%signature%% for the given %%digest%%. - * - * @example: - * key = new SigningKey(id("some-secret")) - * digest = id("hello world") - * sig = key.sign(digest) - * - * // Notice the signer public key... - * key.publicKey - * //_result: - * - * // ...is equal to the recovered public key - * SigningKey.recoverPublicKey(digest, sig) - * //_result: - * - */ - static recoverPublicKey(digest, signature) { - assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest); - const sig = Signature.from(signature); - let secpSig = secp256k1.Signature.fromCompact(getBytesCopy(concat([sig.r, sig.s]))); - secpSig = secpSig.addRecoveryBit(sig.yParity); - const pubKey = secpSig.recoverPublicKey(getBytesCopy(digest)); - assertArgument(pubKey != null, "invalid signautre for digest", "signature", signature); - return "0x" + pubKey.toHex(false); - } - /** - * Returns the point resulting from adding the ellipic curve points - * %%p0%% and %%p1%%. - * - * This is not a common function most developers should require, but - * can be useful for certain privacy-specific techniques. - * - * For example, it is used by [[HDNodeWallet]] to compute child - * addresses from parent public keys and chain codes. - */ - static addPoints(p0, p1, compressed) { - const pub0 = secp256k1.ProjectivePoint.fromHex(_SigningKey.computePublicKey(p0).substring(2)); - const pub1 = secp256k1.ProjectivePoint.fromHex(_SigningKey.computePublicKey(p1).substring(2)); - return "0x" + pub0.add(pub1).toHex(!!compressed); - } -}; -_privateKey = new WeakMap(); -var SigningKey = _SigningKey; - -// node_modules/ethers/lib.esm/crypto/index.js -function lock() { - computeHmac.lock(); - keccak256.lock(); - pbkdf22.lock(); - randomBytes3.lock(); - ripemd1602.lock(); - scrypt2.lock(); - scryptSync.lock(); - sha2562.lock(); - sha5122.lock(); - randomBytes3.lock(); -} - -// node_modules/ethers/lib.esm/address/address.js -var BN_05 = BigInt(0); -var BN_36 = BigInt(36); -function getChecksumAddress(address) { - address = address.toLowerCase(); - const chars = address.substring(2).split(""); - const expanded = new Uint8Array(40); - for (let i = 0; i < 40; i++) { - expanded[i] = chars[i].charCodeAt(0); - } - const hashed = getBytes(keccak256(expanded)); - for (let i = 0; i < 40; i += 2) { - if (hashed[i >> 1] >> 4 >= 8) { - chars[i] = chars[i].toUpperCase(); - } - if ((hashed[i >> 1] & 15) >= 8) { - chars[i + 1] = chars[i + 1].toUpperCase(); - } - } - return "0x" + chars.join(""); -} -var ibanLookup = {}; -for (let i = 0; i < 10; i++) { - ibanLookup[String(i)] = String(i); -} -for (let i = 0; i < 26; i++) { - ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); -} -var safeDigits = 15; -function ibanChecksum(address) { - address = address.toUpperCase(); - address = address.substring(4) + address.substring(0, 2) + "00"; - let expanded = address.split("").map((c) => { - return ibanLookup[c]; - }).join(""); - while (expanded.length >= safeDigits) { - let block = expanded.substring(0, safeDigits); - expanded = parseInt(block, 10) % 97 + expanded.substring(block.length); - } - let checksum2 = String(98 - parseInt(expanded, 10) % 97); - while (checksum2.length < 2) { - checksum2 = "0" + checksum2; - } - return checksum2; -} -var Base36 = function() { - ; - const result = {}; - for (let i = 0; i < 36; i++) { - const key = "0123456789abcdefghijklmnopqrstuvwxyz"[i]; - result[key] = BigInt(i); - } - return result; -}(); -function fromBase36(value) { - value = value.toLowerCase(); - let result = BN_05; - for (let i = 0; i < value.length; i++) { - result = result * BN_36 + Base36[value[i]]; - } - return result; -} -function getAddress(address) { - assertArgument(typeof address === "string", "invalid address", "address", address); - if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) { - if (!address.startsWith("0x")) { - address = "0x" + address; - } - const result = getChecksumAddress(address); - assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address, "bad address checksum", "address", address); - return result; - } - if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { - assertArgument(address.substring(2, 4) === ibanChecksum(address), "bad icap checksum", "address", address); - let result = fromBase36(address.substring(4)).toString(16); - while (result.length < 40) { - result = "0" + result; - } - return getChecksumAddress("0x" + result); - } - assertArgument(false, "invalid address", "address", address); -} -function getIcapAddress(address) { - let base36 = BigInt(getAddress(address)).toString(36).toUpperCase(); - while (base36.length < 30) { - base36 = "0" + base36; - } - return "XE" + ibanChecksum("XE00" + base36) + base36; -} - -// node_modules/ethers/lib.esm/address/contract-address.js -function getCreateAddress(tx) { - const from = getAddress(tx.from); - const nonce = getBigInt(tx.nonce, "tx.nonce"); - let nonceHex = nonce.toString(16); - if (nonceHex === "0") { - nonceHex = "0x"; - } else if (nonceHex.length % 2) { - nonceHex = "0x0" + nonceHex; - } else { - nonceHex = "0x" + nonceHex; - } - return getAddress(dataSlice(keccak256(encodeRlp([from, nonceHex])), 12)); -} -function getCreate2Address(_from, _salt, _initCodeHash) { - const from = getAddress(_from); - const salt = getBytes(_salt, "salt"); - const initCodeHash = getBytes(_initCodeHash, "initCodeHash"); - assertArgument(salt.length === 32, "salt must be 32 bytes", "salt", _salt); - assertArgument(initCodeHash.length === 32, "initCodeHash must be 32 bytes", "initCodeHash", _initCodeHash); - return getAddress(dataSlice(keccak256(concat(["0xff", from, salt, initCodeHash])), 12)); -} - -// node_modules/ethers/lib.esm/address/checks.js -function isAddressable(value) { - return value && typeof value.getAddress === "function"; -} -function isAddress(value) { - try { - getAddress(value); - return true; - } catch (error) { - } - return false; -} -async function checkAddress(target, promise) { - const result = await promise; - if (result == null || result === "0x0000000000000000000000000000000000000000") { - assert(typeof target !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target }); - assertArgument(false, "invalid AddressLike value; did not resolve to a value address", "target", target); - } - return getAddress(result); -} -function resolveAddress(target, resolver) { - if (typeof target === "string") { - if (target.match(/^0x[0-9a-f]{40}$/i)) { - return getAddress(target); - } - assert(resolver != null, "ENS resolution requires a provider", "UNSUPPORTED_OPERATION", { operation: "resolveName" }); - return checkAddress(target, resolver.resolveName(target)); - } else if (isAddressable(target)) { - return checkAddress(target, target.getAddress()); - } else if (target && typeof target.then === "function") { - return checkAddress(target, target); - } - assertArgument(false, "unsupported addressable value", "target", target); -} - -// node_modules/ethers/lib.esm/abi/typed.js -var _gaurd = {}; -function n(value, width) { - let signed = false; - if (width < 0) { - signed = true; - width *= -1; - } - return new Typed(_gaurd, `${signed ? "" : "u"}int${width}`, value, { signed, width }); -} -function b(value, size) { - return new Typed(_gaurd, `bytes${size ? size : ""}`, value, { size }); -} -var _typedSymbol = Symbol.for("_ethers_typed"); -var _options; -var _Typed = class _Typed { - /** - * @_ignore: - */ - constructor(gaurd, type, value, options) { - /** - * The type, as a Solidity-compatible type. - */ - __publicField(this, "type"); - /** - * The actual value. - */ - __publicField(this, "value"); - __privateAdd(this, _options, void 0); - /** - * @_ignore: - */ - __publicField(this, "_typedSymbol"); - if (options == null) { - options = null; - } - assertPrivate(_gaurd, gaurd, "Typed"); - defineProperties(this, { _typedSymbol, type, value }); - __privateSet(this, _options, options); - this.format(); - } - /** - * Format the type as a Human-Readable type. - */ - format() { - if (this.type === "array") { - throw new Error(""); - } else if (this.type === "dynamicArray") { - throw new Error(""); - } else if (this.type === "tuple") { - return `tuple(${this.value.map((v) => v.format()).join(",")})`; - } - return this.type; - } - /** - * The default value returned by this type. - */ - defaultValue() { - return 0; - } - /** - * The minimum value for numeric types. - */ - minValue() { - return 0; - } - /** - * The maximum value for numeric types. - */ - maxValue() { - return 0; - } - /** - * Returns ``true`` and provides a type guard is this is a [[TypedBigInt]]. - */ - isBigInt() { - return !!this.type.match(/^u?int[0-9]+$/); - } - /** - * Returns ``true`` and provides a type guard is this is a [[TypedData]]. - */ - isData() { - return this.type.startsWith("bytes"); - } - /** - * Returns ``true`` and provides a type guard is this is a [[TypedString]]. - */ - isString() { - return this.type === "string"; - } - /** - * Returns the tuple name, if this is a tuple. Throws otherwise. - */ - get tupleName() { - if (this.type !== "tuple") { - throw TypeError("not a tuple"); - } - return __privateGet(this, _options); - } - // Returns the length of this type as an array - // - `null` indicates the length is unforced, it could be dynamic - // - `-1` indicates the length is dynamic - // - any other value indicates it is a static array and is its length - /** - * Returns the length of the array type or ``-1`` if it is dynamic. - * - * Throws if the type is not an array. - */ - get arrayLength() { - if (this.type !== "array") { - throw TypeError("not an array"); - } - if (__privateGet(this, _options) === true) { - return -1; - } - if (__privateGet(this, _options) === false) { - return this.value.length; - } - return null; - } - /** - * Returns a new **Typed** of %%type%% with the %%value%%. - */ - static from(type, value) { - return new _Typed(_gaurd, type, value); - } - /** - * Return a new ``uint8`` type for %%v%%. - */ - static uint8(v) { - return n(v, 8); - } - /** - * Return a new ``uint16`` type for %%v%%. - */ - static uint16(v) { - return n(v, 16); - } - /** - * Return a new ``uint24`` type for %%v%%. - */ - static uint24(v) { - return n(v, 24); - } - /** - * Return a new ``uint32`` type for %%v%%. - */ - static uint32(v) { - return n(v, 32); - } - /** - * Return a new ``uint40`` type for %%v%%. - */ - static uint40(v) { - return n(v, 40); - } - /** - * Return a new ``uint48`` type for %%v%%. - */ - static uint48(v) { - return n(v, 48); - } - /** - * Return a new ``uint56`` type for %%v%%. - */ - static uint56(v) { - return n(v, 56); - } - /** - * Return a new ``uint64`` type for %%v%%. - */ - static uint64(v) { - return n(v, 64); - } - /** - * Return a new ``uint72`` type for %%v%%. - */ - static uint72(v) { - return n(v, 72); - } - /** - * Return a new ``uint80`` type for %%v%%. - */ - static uint80(v) { - return n(v, 80); - } - /** - * Return a new ``uint88`` type for %%v%%. - */ - static uint88(v) { - return n(v, 88); - } - /** - * Return a new ``uint96`` type for %%v%%. - */ - static uint96(v) { - return n(v, 96); - } - /** - * Return a new ``uint104`` type for %%v%%. - */ - static uint104(v) { - return n(v, 104); - } - /** - * Return a new ``uint112`` type for %%v%%. - */ - static uint112(v) { - return n(v, 112); - } - /** - * Return a new ``uint120`` type for %%v%%. - */ - static uint120(v) { - return n(v, 120); - } - /** - * Return a new ``uint128`` type for %%v%%. - */ - static uint128(v) { - return n(v, 128); - } - /** - * Return a new ``uint136`` type for %%v%%. - */ - static uint136(v) { - return n(v, 136); - } - /** - * Return a new ``uint144`` type for %%v%%. - */ - static uint144(v) { - return n(v, 144); - } - /** - * Return a new ``uint152`` type for %%v%%. - */ - static uint152(v) { - return n(v, 152); - } - /** - * Return a new ``uint160`` type for %%v%%. - */ - static uint160(v) { - return n(v, 160); - } - /** - * Return a new ``uint168`` type for %%v%%. - */ - static uint168(v) { - return n(v, 168); - } - /** - * Return a new ``uint176`` type for %%v%%. - */ - static uint176(v) { - return n(v, 176); - } - /** - * Return a new ``uint184`` type for %%v%%. - */ - static uint184(v) { - return n(v, 184); - } - /** - * Return a new ``uint192`` type for %%v%%. - */ - static uint192(v) { - return n(v, 192); - } - /** - * Return a new ``uint200`` type for %%v%%. - */ - static uint200(v) { - return n(v, 200); - } - /** - * Return a new ``uint208`` type for %%v%%. - */ - static uint208(v) { - return n(v, 208); - } - /** - * Return a new ``uint216`` type for %%v%%. - */ - static uint216(v) { - return n(v, 216); - } - /** - * Return a new ``uint224`` type for %%v%%. - */ - static uint224(v) { - return n(v, 224); - } - /** - * Return a new ``uint232`` type for %%v%%. - */ - static uint232(v) { - return n(v, 232); - } - /** - * Return a new ``uint240`` type for %%v%%. - */ - static uint240(v) { - return n(v, 240); - } - /** - * Return a new ``uint248`` type for %%v%%. - */ - static uint248(v) { - return n(v, 248); - } - /** - * Return a new ``uint256`` type for %%v%%. - */ - static uint256(v) { - return n(v, 256); - } - /** - * Return a new ``uint256`` type for %%v%%. - */ - static uint(v) { - return n(v, 256); - } - /** - * Return a new ``int8`` type for %%v%%. - */ - static int8(v) { - return n(v, -8); - } - /** - * Return a new ``int16`` type for %%v%%. - */ - static int16(v) { - return n(v, -16); - } - /** - * Return a new ``int24`` type for %%v%%. - */ - static int24(v) { - return n(v, -24); - } - /** - * Return a new ``int32`` type for %%v%%. - */ - static int32(v) { - return n(v, -32); - } - /** - * Return a new ``int40`` type for %%v%%. - */ - static int40(v) { - return n(v, -40); - } - /** - * Return a new ``int48`` type for %%v%%. - */ - static int48(v) { - return n(v, -48); - } - /** - * Return a new ``int56`` type for %%v%%. - */ - static int56(v) { - return n(v, -56); - } - /** - * Return a new ``int64`` type for %%v%%. - */ - static int64(v) { - return n(v, -64); - } - /** - * Return a new ``int72`` type for %%v%%. - */ - static int72(v) { - return n(v, -72); - } - /** - * Return a new ``int80`` type for %%v%%. - */ - static int80(v) { - return n(v, -80); - } - /** - * Return a new ``int88`` type for %%v%%. - */ - static int88(v) { - return n(v, -88); - } - /** - * Return a new ``int96`` type for %%v%%. - */ - static int96(v) { - return n(v, -96); - } - /** - * Return a new ``int104`` type for %%v%%. - */ - static int104(v) { - return n(v, -104); - } - /** - * Return a new ``int112`` type for %%v%%. - */ - static int112(v) { - return n(v, -112); - } - /** - * Return a new ``int120`` type for %%v%%. - */ - static int120(v) { - return n(v, -120); - } - /** - * Return a new ``int128`` type for %%v%%. - */ - static int128(v) { - return n(v, -128); - } - /** - * Return a new ``int136`` type for %%v%%. - */ - static int136(v) { - return n(v, -136); - } - /** - * Return a new ``int144`` type for %%v%%. - */ - static int144(v) { - return n(v, -144); - } - /** - * Return a new ``int52`` type for %%v%%. - */ - static int152(v) { - return n(v, -152); - } - /** - * Return a new ``int160`` type for %%v%%. - */ - static int160(v) { - return n(v, -160); - } - /** - * Return a new ``int168`` type for %%v%%. - */ - static int168(v) { - return n(v, -168); - } - /** - * Return a new ``int176`` type for %%v%%. - */ - static int176(v) { - return n(v, -176); - } - /** - * Return a new ``int184`` type for %%v%%. - */ - static int184(v) { - return n(v, -184); - } - /** - * Return a new ``int92`` type for %%v%%. - */ - static int192(v) { - return n(v, -192); - } - /** - * Return a new ``int200`` type for %%v%%. - */ - static int200(v) { - return n(v, -200); - } - /** - * Return a new ``int208`` type for %%v%%. - */ - static int208(v) { - return n(v, -208); - } - /** - * Return a new ``int216`` type for %%v%%. - */ - static int216(v) { - return n(v, -216); - } - /** - * Return a new ``int224`` type for %%v%%. - */ - static int224(v) { - return n(v, -224); - } - /** - * Return a new ``int232`` type for %%v%%. - */ - static int232(v) { - return n(v, -232); - } - /** - * Return a new ``int240`` type for %%v%%. - */ - static int240(v) { - return n(v, -240); - } - /** - * Return a new ``int248`` type for %%v%%. - */ - static int248(v) { - return n(v, -248); - } - /** - * Return a new ``int256`` type for %%v%%. - */ - static int256(v) { - return n(v, -256); - } - /** - * Return a new ``int256`` type for %%v%%. - */ - static int(v) { - return n(v, -256); - } - /** - * Return a new ``bytes1`` type for %%v%%. - */ - static bytes1(v) { - return b(v, 1); - } - /** - * Return a new ``bytes2`` type for %%v%%. - */ - static bytes2(v) { - return b(v, 2); - } - /** - * Return a new ``bytes3`` type for %%v%%. - */ - static bytes3(v) { - return b(v, 3); - } - /** - * Return a new ``bytes4`` type for %%v%%. - */ - static bytes4(v) { - return b(v, 4); - } - /** - * Return a new ``bytes5`` type for %%v%%. - */ - static bytes5(v) { - return b(v, 5); - } - /** - * Return a new ``bytes6`` type for %%v%%. - */ - static bytes6(v) { - return b(v, 6); - } - /** - * Return a new ``bytes7`` type for %%v%%. - */ - static bytes7(v) { - return b(v, 7); - } - /** - * Return a new ``bytes8`` type for %%v%%. - */ - static bytes8(v) { - return b(v, 8); - } - /** - * Return a new ``bytes9`` type for %%v%%. - */ - static bytes9(v) { - return b(v, 9); - } - /** - * Return a new ``bytes10`` type for %%v%%. - */ - static bytes10(v) { - return b(v, 10); - } - /** - * Return a new ``bytes11`` type for %%v%%. - */ - static bytes11(v) { - return b(v, 11); - } - /** - * Return a new ``bytes12`` type for %%v%%. - */ - static bytes12(v) { - return b(v, 12); - } - /** - * Return a new ``bytes13`` type for %%v%%. - */ - static bytes13(v) { - return b(v, 13); - } - /** - * Return a new ``bytes14`` type for %%v%%. - */ - static bytes14(v) { - return b(v, 14); - } - /** - * Return a new ``bytes15`` type for %%v%%. - */ - static bytes15(v) { - return b(v, 15); - } - /** - * Return a new ``bytes16`` type for %%v%%. - */ - static bytes16(v) { - return b(v, 16); - } - /** - * Return a new ``bytes17`` type for %%v%%. - */ - static bytes17(v) { - return b(v, 17); - } - /** - * Return a new ``bytes18`` type for %%v%%. - */ - static bytes18(v) { - return b(v, 18); - } - /** - * Return a new ``bytes19`` type for %%v%%. - */ - static bytes19(v) { - return b(v, 19); - } - /** - * Return a new ``bytes20`` type for %%v%%. - */ - static bytes20(v) { - return b(v, 20); - } - /** - * Return a new ``bytes21`` type for %%v%%. - */ - static bytes21(v) { - return b(v, 21); - } - /** - * Return a new ``bytes22`` type for %%v%%. - */ - static bytes22(v) { - return b(v, 22); - } - /** - * Return a new ``bytes23`` type for %%v%%. - */ - static bytes23(v) { - return b(v, 23); - } - /** - * Return a new ``bytes24`` type for %%v%%. - */ - static bytes24(v) { - return b(v, 24); - } - /** - * Return a new ``bytes25`` type for %%v%%. - */ - static bytes25(v) { - return b(v, 25); - } - /** - * Return a new ``bytes26`` type for %%v%%. - */ - static bytes26(v) { - return b(v, 26); - } - /** - * Return a new ``bytes27`` type for %%v%%. - */ - static bytes27(v) { - return b(v, 27); - } - /** - * Return a new ``bytes28`` type for %%v%%. - */ - static bytes28(v) { - return b(v, 28); - } - /** - * Return a new ``bytes29`` type for %%v%%. - */ - static bytes29(v) { - return b(v, 29); - } - /** - * Return a new ``bytes30`` type for %%v%%. - */ - static bytes30(v) { - return b(v, 30); - } - /** - * Return a new ``bytes31`` type for %%v%%. - */ - static bytes31(v) { - return b(v, 31); - } - /** - * Return a new ``bytes32`` type for %%v%%. - */ - static bytes32(v) { - return b(v, 32); - } - /** - * Return a new ``address`` type for %%v%%. - */ - static address(v) { - return new _Typed(_gaurd, "address", v); - } - /** - * Return a new ``bool`` type for %%v%%. - */ - static bool(v) { - return new _Typed(_gaurd, "bool", !!v); - } - /** - * Return a new ``bytes`` type for %%v%%. - */ - static bytes(v) { - return new _Typed(_gaurd, "bytes", v); - } - /** - * Return a new ``string`` type for %%v%%. - */ - static string(v) { - return new _Typed(_gaurd, "string", v); - } - /** - * Return a new ``array`` type for %%v%%, allowing %%dynamic%% length. - */ - static array(v, dynamic) { - throw new Error("not implemented yet"); - return new _Typed(_gaurd, "array", v, dynamic); - } - /** - * Return a new ``tuple`` type for %%v%%, with the optional %%name%%. - */ - static tuple(v, name) { - throw new Error("not implemented yet"); - return new _Typed(_gaurd, "tuple", v, name); - } - /** - * Return a new ``uint8`` type for %%v%%. - */ - static overrides(v) { - return new _Typed(_gaurd, "overrides", Object.assign({}, v)); - } - /** - * Returns true only if %%value%% is a [[Typed]] instance. - */ - static isTyped(value) { - return value && typeof value === "object" && "_typedSymbol" in value && value._typedSymbol === _typedSymbol; - } - /** - * If the value is a [[Typed]] instance, validates the underlying value - * and returns it, otherwise returns value directly. - * - * This is useful for functions that with to accept either a [[Typed]] - * object or values. - */ - static dereference(value, type) { - if (_Typed.isTyped(value)) { - if (value.type !== type) { - throw new Error(`invalid type: expecetd ${type}, got ${value.type}`); - } - return value.value; - } - return value; - } -}; -_options = new WeakMap(); -var Typed = _Typed; - -// node_modules/ethers/lib.esm/abi/coders/address.js -var AddressCoder = class extends Coder { - constructor(localName) { - super("address", "address", localName, false); - } - defaultValue() { - return "0x0000000000000000000000000000000000000000"; - } - encode(writer, _value2) { - let value = Typed.dereference(_value2, "string"); - try { - value = getAddress(value); - } catch (error) { - return this._throwError(error.message, _value2); - } - return writer.writeValue(value); - } - decode(reader) { - return getAddress(toBeHex(reader.readValue(), 20)); - } -}; - -// node_modules/ethers/lib.esm/abi/coders/anonymous.js -var AnonymousCoder = class extends Coder { - constructor(coder) { - super(coder.name, coder.type, "_", coder.dynamic); - __publicField(this, "coder"); - this.coder = coder; - } - defaultValue() { - return this.coder.defaultValue(); - } - encode(writer, value) { - return this.coder.encode(writer, value); - } - decode(reader) { - return this.coder.decode(reader); - } -}; - -// node_modules/ethers/lib.esm/abi/coders/array.js -function pack(writer, coders, values) { - let arrayValues = []; - if (Array.isArray(values)) { - arrayValues = values; - } else if (values && typeof values === "object") { - let unique = {}; - arrayValues = coders.map((coder) => { - const name = coder.localName; - assert(name, "cannot encode object for signature with missing names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); - assert(!unique[name], "cannot encode object for signature with duplicate names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); - unique[name] = true; - return values[name]; - }); - } else { - assertArgument(false, "invalid tuple value", "tuple", values); - } - assertArgument(coders.length === arrayValues.length, "types/value length mismatch", "tuple", values); - let staticWriter = new Writer(); - let dynamicWriter = new Writer(); - let updateFuncs = []; - coders.forEach((coder, index) => { - let value = arrayValues[index]; - if (coder.dynamic) { - let dynamicOffset = dynamicWriter.length; - coder.encode(dynamicWriter, value); - let updateFunc = staticWriter.writeUpdatableValue(); - updateFuncs.push((baseOffset) => { - updateFunc(baseOffset + dynamicOffset); - }); - } else { - coder.encode(staticWriter, value); - } - }); - updateFuncs.forEach((func) => { - func(staticWriter.length); - }); - let length = writer.appendWriter(staticWriter); - length += writer.appendWriter(dynamicWriter); - return length; -} -function unpack(reader, coders) { - let values = []; - let keys = []; - let baseReader = reader.subReader(0); - coders.forEach((coder) => { - let value = null; - if (coder.dynamic) { - let offset = reader.readIndex(); - let offsetReader = baseReader.subReader(offset); - try { - value = coder.decode(offsetReader); - } catch (error) { - if (isError(error, "BUFFER_OVERRUN")) { - throw error; - } - value = error; - value.baseType = coder.name; - value.name = coder.localName; - value.type = coder.type; - } - } else { - try { - value = coder.decode(reader); - } catch (error) { - if (isError(error, "BUFFER_OVERRUN")) { - throw error; - } - value = error; - value.baseType = coder.name; - value.name = coder.localName; - value.type = coder.type; - } - } - if (value == void 0) { - throw new Error("investigate"); - } - values.push(value); - keys.push(coder.localName || null); - }); - return Result.fromItems(values, keys); -} -var ArrayCoder = class extends Coder { - constructor(coder, length, localName) { - const type = coder.type + "[" + (length >= 0 ? length : "") + "]"; - const dynamic = length === -1 || coder.dynamic; - super("array", type, localName, dynamic); - __publicField(this, "coder"); - __publicField(this, "length"); - defineProperties(this, { coder, length }); - } - defaultValue() { - const defaultChild = this.coder.defaultValue(); - const result = []; - for (let i = 0; i < this.length; i++) { - result.push(defaultChild); - } - return result; - } - encode(writer, _value2) { - const value = Typed.dereference(_value2, "array"); - if (!Array.isArray(value)) { - this._throwError("expected array value", value); - } - let count = this.length; - if (count === -1) { - count = value.length; - writer.writeValue(value.length); - } - assertArgumentCount(value.length, count, "coder array" + (this.localName ? " " + this.localName : "")); - let coders = []; - for (let i = 0; i < value.length; i++) { - coders.push(this.coder); - } - return pack(writer, coders, value); - } - decode(reader) { - let count = this.length; - if (count === -1) { - count = reader.readIndex(); - assert(count * WordSize <= reader.dataLength, "insufficient data length", "BUFFER_OVERRUN", { buffer: reader.bytes, offset: count * WordSize, length: reader.dataLength }); - } - let coders = []; - for (let i = 0; i < count; i++) { - coders.push(new AnonymousCoder(this.coder)); - } - return unpack(reader, coders); - } -}; - -// node_modules/ethers/lib.esm/abi/coders/boolean.js -var BooleanCoder = class extends Coder { - constructor(localName) { - super("bool", "bool", localName, false); - } - defaultValue() { - return false; - } - encode(writer, _value2) { - const value = Typed.dereference(_value2, "bool"); - return writer.writeValue(value ? 1 : 0); - } - decode(reader) { - return !!reader.readValue(); - } -}; - -// node_modules/ethers/lib.esm/abi/coders/bytes.js -var DynamicBytesCoder = class extends Coder { - constructor(type, localName) { - super(type, type, localName, true); - } - defaultValue() { - return "0x"; - } - encode(writer, value) { - value = getBytesCopy(value); - let length = writer.writeValue(value.length); - length += writer.writeBytes(value); - return length; - } - decode(reader) { - return reader.readBytes(reader.readIndex(), true); - } -}; -var BytesCoder = class extends DynamicBytesCoder { - constructor(localName) { - super("bytes", localName); - } - decode(reader) { - return hexlify(super.decode(reader)); - } -}; - -// node_modules/ethers/lib.esm/abi/coders/fixed-bytes.js -var FixedBytesCoder = class extends Coder { - constructor(size, localName) { - let name = "bytes" + String(size); - super(name, name, localName, false); - __publicField(this, "size"); - defineProperties(this, { size }, { size: "number" }); - } - defaultValue() { - return "0x0000000000000000000000000000000000000000000000000000000000000000".substring(0, 2 + this.size * 2); - } - encode(writer, _value2) { - let data = getBytesCopy(Typed.dereference(_value2, this.type)); - if (data.length !== this.size) { - this._throwError("incorrect data length", _value2); - } - return writer.writeBytes(data); - } - decode(reader) { - return hexlify(reader.readBytes(this.size)); - } -}; - -// node_modules/ethers/lib.esm/abi/coders/null.js -var Empty = new Uint8Array([]); -var NullCoder = class extends Coder { - constructor(localName) { - super("null", "", localName, false); - } - defaultValue() { - return null; - } - encode(writer, value) { - if (value != null) { - this._throwError("not null", value); - } - return writer.writeBytes(Empty); - } - decode(reader) { - reader.readBytes(0); - return null; - } -}; - -// node_modules/ethers/lib.esm/abi/coders/number.js -var BN_06 = BigInt(0); -var BN_14 = BigInt(1); -var BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); -var NumberCoder = class extends Coder { - constructor(size, signed, localName) { - const name = (signed ? "int" : "uint") + size * 8; - super(name, name, localName, false); - __publicField(this, "size"); - __publicField(this, "signed"); - defineProperties(this, { size, signed }, { size: "number", signed: "boolean" }); - } - defaultValue() { - return 0; - } - encode(writer, _value2) { - let value = getBigInt(Typed.dereference(_value2, this.type)); - let maxUintValue = mask(BN_MAX_UINT256, WordSize * 8); - if (this.signed) { - let bounds = mask(maxUintValue, this.size * 8 - 1); - if (value > bounds || value < -(bounds + BN_14)) { - this._throwError("value out-of-bounds", _value2); - } - value = toTwos(value, 8 * WordSize); - } else if (value < BN_06 || value > mask(maxUintValue, this.size * 8)) { - this._throwError("value out-of-bounds", _value2); - } - return writer.writeValue(value); - } - decode(reader) { - let value = mask(reader.readValue(), this.size * 8); - if (this.signed) { - value = fromTwos(value, this.size * 8); - } - return value; - } -}; - -// node_modules/ethers/lib.esm/abi/coders/string.js -var StringCoder = class extends DynamicBytesCoder { - constructor(localName) { - super("string", localName); - } - defaultValue() { - return ""; - } - encode(writer, _value2) { - return super.encode(writer, toUtf8Bytes(Typed.dereference(_value2, "string"))); - } - decode(reader) { - return toUtf8String(super.decode(reader)); - } -}; - -// node_modules/ethers/lib.esm/abi/coders/tuple.js -var TupleCoder = class extends Coder { - constructor(coders, localName) { - let dynamic = false; - const types = []; - coders.forEach((coder) => { - if (coder.dynamic) { - dynamic = true; - } - types.push(coder.type); - }); - const type = "tuple(" + types.join(",") + ")"; - super("tuple", type, localName, dynamic); - __publicField(this, "coders"); - defineProperties(this, { coders: Object.freeze(coders.slice()) }); - } - defaultValue() { - const values = []; - this.coders.forEach((coder) => { - values.push(coder.defaultValue()); - }); - const uniqueNames = this.coders.reduce((accum, coder) => { - const name = coder.localName; - if (name) { - if (!accum[name]) { - accum[name] = 0; - } - accum[name]++; - } - return accum; - }, {}); - this.coders.forEach((coder, index) => { - let name = coder.localName; - if (!name || uniqueNames[name] !== 1) { - return; - } - if (name === "length") { - name = "_length"; - } - if (values[name] != null) { - return; - } - values[name] = values[index]; - }); - return Object.freeze(values); - } - encode(writer, _value2) { - const value = Typed.dereference(_value2, "tuple"); - return pack(writer, this.coders, value); - } - decode(reader) { - return unpack(reader, this.coders); - } -}; - -// node_modules/ethers/lib.esm/hash/id.js -function id(value) { - return keccak256(toUtf8Bytes(value)); -} - -// node_modules/ethers/lib.esm/hash/namehash.js -var Zeros2 = new Uint8Array(32); -Zeros2.fill(0); -function checkComponent(comp) { - assertArgument(comp.length !== 0, "invalid ENS name; empty component", "comp", comp); - return comp; -} -function ensNameSplit(name) { - const bytes2 = toUtf8Bytes(ensNormalize(name)); - const comps = []; - if (name.length === 0) { - return comps; - } - let last = 0; - for (let i = 0; i < bytes2.length; i++) { - const d = bytes2[i]; - if (d === 46) { - comps.push(checkComponent(bytes2.slice(last, i))); - last = i + 1; - } - } - assertArgument(last < bytes2.length, "invalid ENS name; empty component", "name", name); - comps.push(checkComponent(bytes2.slice(last))); - return comps; -} -function ensNormalize(name) { - try { - if (name.length === 0) { - throw new Error("empty label"); - } - return ens_normalize(name); - } catch (error) { - assertArgument(false, `invalid ENS name (${error.message})`, "name", name); - } -} -function isValidName(name) { - try { - return ensNameSplit(name).length !== 0; - } catch (error) { - } - return false; -} -function namehash(name) { - assertArgument(typeof name === "string", "invalid ENS name; not a string", "name", name); - assertArgument(name.length, `invalid ENS name (empty label)`, "name", name); - let result = Zeros2; - const comps = ensNameSplit(name); - while (comps.length) { - result = keccak256(concat([result, keccak256(comps.pop())])); - } - return hexlify(result); -} -function dnsEncode(name, _maxLength) { - const length = _maxLength != null ? _maxLength : 63; - assertArgument(length <= 255, "DNS encoded label cannot exceed 255", "length", length); - return hexlify(concat(ensNameSplit(name).map((comp) => { - assertArgument(comp.length <= length, `label ${JSON.stringify(name)} exceeds ${length} bytes`, "name", name); - const bytes2 = new Uint8Array(comp.length + 1); - bytes2.set(comp, 1); - bytes2[0] = bytes2.length - 1; - return bytes2; - }))) + "00"; -} - -// node_modules/ethers/lib.esm/transaction/accesslist.js -function accessSetify(addr, storageKeys) { - return { - address: getAddress(addr), - storageKeys: storageKeys.map((storageKey, index) => { - assertArgument(isHexString(storageKey, 32), "invalid slot", `storageKeys[${index}]`, storageKey); - return storageKey.toLowerCase(); - }) - }; -} -function accessListify(value) { - if (Array.isArray(value)) { - return value.map((set, index) => { - if (Array.isArray(set)) { - assertArgument(set.length === 2, "invalid slot set", `value[${index}]`, set); - return accessSetify(set[0], set[1]); - } - assertArgument(set != null && typeof set === "object", "invalid address-slot set", "value", value); - return accessSetify(set.address, set.storageKeys); - }); - } - assertArgument(value != null && typeof value === "object", "invalid access list", "value", value); - const result = Object.keys(value).map((addr) => { - const storageKeys = value[addr].reduce((accum, storageKey) => { - accum[storageKey] = true; - return accum; - }, {}); - return accessSetify(addr, Object.keys(storageKeys).sort()); - }); - result.sort((a, b2) => a.address.localeCompare(b2.address)); - return result; -} - -// node_modules/ethers/lib.esm/transaction/address.js -function computeAddress(key) { - let pubkey; - if (typeof key === "string") { - pubkey = SigningKey.computePublicKey(key, false); - } else { - pubkey = key.publicKey; - } - return getAddress(keccak256("0x" + pubkey.substring(4)).substring(26)); -} -function recoverAddress(digest, signature) { - return computeAddress(SigningKey.recoverPublicKey(digest, signature)); -} - -// node_modules/ethers/lib.esm/transaction/transaction.js -var BN_07 = BigInt(0); -var BN_22 = BigInt(2); -var BN_272 = BigInt(27); -var BN_282 = BigInt(28); -var BN_352 = BigInt(35); -var BN_MAX_UINT = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); -function handleAddress(value) { - if (value === "0x") { - return null; - } - return getAddress(value); -} -function handleAccessList(value, param) { - try { - return accessListify(value); - } catch (error) { - assertArgument(false, error.message, param, value); - } -} -function handleNumber(_value2, param) { - if (_value2 === "0x") { - return 0; - } - return getNumber(_value2, param); -} -function handleUint(_value2, param) { - if (_value2 === "0x") { - return BN_07; - } - const value = getBigInt(_value2, param); - assertArgument(value <= BN_MAX_UINT, "value exceeds uint size", param, value); - return value; -} -function formatNumber(_value2, name) { - const value = getBigInt(_value2, "value"); - const result = toBeArray(value); - assertArgument(result.length <= 32, `value too large`, `tx.${name}`, value); - return result; -} -function formatAccessList(value) { - return accessListify(value).map((set) => [set.address, set.storageKeys]); -} -function formatHashes(value, param) { - assertArgument(Array.isArray(value), `invalid ${param}`, "value", value); - for (let i = 0; i < value.length; i++) { - assertArgument(isHexString(value[i], 32), "invalid ${ param } hash", `value[${i}]`, value[i]); - } - return value; -} -function _parseLegacy(data) { - const fields = decodeRlp(data); - assertArgument(Array.isArray(fields) && (fields.length === 9 || fields.length === 6), "invalid field count for legacy transaction", "data", data); - const tx = { - type: 0, - nonce: handleNumber(fields[0], "nonce"), - gasPrice: handleUint(fields[1], "gasPrice"), - gasLimit: handleUint(fields[2], "gasLimit"), - to: handleAddress(fields[3]), - value: handleUint(fields[4], "value"), - data: hexlify(fields[5]), - chainId: BN_07 - }; - if (fields.length === 6) { - return tx; - } - const v = handleUint(fields[6], "v"); - const r = handleUint(fields[7], "r"); - const s = handleUint(fields[8], "s"); - if (r === BN_07 && s === BN_07) { - tx.chainId = v; - } else { - let chainId = (v - BN_352) / BN_22; - if (chainId < BN_07) { - chainId = BN_07; - } - tx.chainId = chainId; - assertArgument(chainId !== BN_07 || (v === BN_272 || v === BN_282), "non-canonical legacy v", "v", fields[6]); - tx.signature = Signature.from({ - r: zeroPadValue(fields[7], 32), - s: zeroPadValue(fields[8], 32), - v - }); - tx.hash = keccak256(data); - } - return tx; -} -function _serializeLegacy(tx, sig) { - const fields = [ - formatNumber(tx.nonce, "nonce"), - formatNumber(tx.gasPrice || 0, "gasPrice"), - formatNumber(tx.gasLimit, "gasLimit"), - tx.to || "0x", - formatNumber(tx.value, "value"), - tx.data - ]; - let chainId = BN_07; - if (tx.chainId != BN_07) { - chainId = getBigInt(tx.chainId, "tx.chainId"); - assertArgument(!sig || sig.networkV == null || sig.legacyChainId === chainId, "tx.chainId/sig.v mismatch", "sig", sig); - } else if (tx.signature) { - const legacy = tx.signature.legacyChainId; - if (legacy != null) { - chainId = legacy; - } - } - if (!sig) { - if (chainId !== BN_07) { - fields.push(toBeArray(chainId)); - fields.push("0x"); - fields.push("0x"); - } - return encodeRlp(fields); - } - let v = BigInt(27 + sig.yParity); - if (chainId !== BN_07) { - v = Signature.getChainIdV(chainId, sig.v); - } else if (BigInt(sig.v) !== v) { - assertArgument(false, "tx.chainId/sig.v mismatch", "sig", sig); - } - fields.push(toBeArray(v)); - fields.push(toBeArray(sig.r)); - fields.push(toBeArray(sig.s)); - return encodeRlp(fields); -} -function _parseEipSignature(tx, fields) { - let yParity; - try { - yParity = handleNumber(fields[0], "yParity"); - if (yParity !== 0 && yParity !== 1) { - throw new Error("bad yParity"); - } - } catch (error) { - assertArgument(false, "invalid yParity", "yParity", fields[0]); - } - const r = zeroPadValue(fields[1], 32); - const s = zeroPadValue(fields[2], 32); - const signature = Signature.from({ r, s, yParity }); - tx.signature = signature; -} -function _parseEip1559(data) { - const fields = decodeRlp(getBytes(data).slice(1)); - assertArgument(Array.isArray(fields) && (fields.length === 9 || fields.length === 12), "invalid field count for transaction type: 2", "data", hexlify(data)); - const tx = { - type: 2, - chainId: handleUint(fields[0], "chainId"), - nonce: handleNumber(fields[1], "nonce"), - maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"), - maxFeePerGas: handleUint(fields[3], "maxFeePerGas"), - gasPrice: null, - gasLimit: handleUint(fields[4], "gasLimit"), - to: handleAddress(fields[5]), - value: handleUint(fields[6], "value"), - data: hexlify(fields[7]), - accessList: handleAccessList(fields[8], "accessList") - }; - if (fields.length === 9) { - return tx; - } - tx.hash = keccak256(data); - _parseEipSignature(tx, fields.slice(9)); - return tx; -} -function _serializeEip1559(tx, sig) { - const fields = [ - formatNumber(tx.chainId, "chainId"), - formatNumber(tx.nonce, "nonce"), - formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), - formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"), - formatNumber(tx.gasLimit, "gasLimit"), - tx.to || "0x", - formatNumber(tx.value, "value"), - tx.data, - formatAccessList(tx.accessList || []) - ]; - if (sig) { - fields.push(formatNumber(sig.yParity, "yParity")); - fields.push(toBeArray(sig.r)); - fields.push(toBeArray(sig.s)); - } - return concat(["0x02", encodeRlp(fields)]); -} -function _parseEip2930(data) { - const fields = decodeRlp(getBytes(data).slice(1)); - assertArgument(Array.isArray(fields) && (fields.length === 8 || fields.length === 11), "invalid field count for transaction type: 1", "data", hexlify(data)); - const tx = { - type: 1, - chainId: handleUint(fields[0], "chainId"), - nonce: handleNumber(fields[1], "nonce"), - gasPrice: handleUint(fields[2], "gasPrice"), - gasLimit: handleUint(fields[3], "gasLimit"), - to: handleAddress(fields[4]), - value: handleUint(fields[5], "value"), - data: hexlify(fields[6]), - accessList: handleAccessList(fields[7], "accessList") - }; - if (fields.length === 8) { - return tx; - } - tx.hash = keccak256(data); - _parseEipSignature(tx, fields.slice(8)); - return tx; -} -function _serializeEip2930(tx, sig) { - const fields = [ - formatNumber(tx.chainId, "chainId"), - formatNumber(tx.nonce, "nonce"), - formatNumber(tx.gasPrice || 0, "gasPrice"), - formatNumber(tx.gasLimit, "gasLimit"), - tx.to || "0x", - formatNumber(tx.value, "value"), - tx.data, - formatAccessList(tx.accessList || []) - ]; - if (sig) { - fields.push(formatNumber(sig.yParity, "recoveryParam")); - fields.push(toBeArray(sig.r)); - fields.push(toBeArray(sig.s)); - } - return concat(["0x01", encodeRlp(fields)]); -} -function _parseEip4844(data) { - const fields = decodeRlp(getBytes(data).slice(1)); - assertArgument(Array.isArray(fields) && (fields.length === 11 || fields.length === 14), "invalid field count for transaction type: 3", "data", hexlify(data)); - const tx = { - type: 3, - chainId: handleUint(fields[0], "chainId"), - nonce: handleNumber(fields[1], "nonce"), - maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"), - maxFeePerGas: handleUint(fields[3], "maxFeePerGas"), - gasPrice: null, - gasLimit: handleUint(fields[4], "gasLimit"), - to: handleAddress(fields[5]), - value: handleUint(fields[6], "value"), - data: hexlify(fields[7]), - accessList: handleAccessList(fields[8], "accessList"), - maxFeePerBlobGas: handleUint(fields[9], "maxFeePerBlobGas"), - blobVersionedHashes: fields[10] - }; - assertArgument(tx.to != null, "invalid address for transaction type: 3", "data", data); - assertArgument(Array.isArray(tx.blobVersionedHashes), "invalid blobVersionedHashes: must be an array", "data", data); - for (let i = 0; i < tx.blobVersionedHashes.length; i++) { - assertArgument(isHexString(tx.blobVersionedHashes[i], 32), `invalid blobVersionedHash at index ${i}: must be length 32`, "data", data); - } - if (fields.length === 11) { - return tx; - } - tx.hash = keccak256(data); - _parseEipSignature(tx, fields.slice(11)); - return tx; -} -function _serializeEip4844(tx, sig) { - const fields = [ - formatNumber(tx.chainId, "chainId"), - formatNumber(tx.nonce, "nonce"), - formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), - formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"), - formatNumber(tx.gasLimit, "gasLimit"), - tx.to || ZeroAddress, - formatNumber(tx.value, "value"), - tx.data, - formatAccessList(tx.accessList || []), - formatNumber(tx.maxFeePerBlobGas || 0, "maxFeePerBlobGas"), - formatHashes(tx.blobVersionedHashes || [], "blobVersionedHashes") - ]; - if (sig) { - fields.push(formatNumber(sig.yParity, "yParity")); - fields.push(toBeArray(sig.r)); - fields.push(toBeArray(sig.s)); - } - return concat(["0x03", encodeRlp(fields)]); -} -var _type, _to, _data3, _nonce, _gasLimit, _gasPrice, _maxPriorityFeePerGas, _maxFeePerGas, _value, _chainId, _sig, _accessList, _maxFeePerBlobGas, _blobVersionedHashes; -var _Transaction = class _Transaction { - /** - * Creates a new Transaction with default values. - */ - constructor() { - __privateAdd(this, _type, void 0); - __privateAdd(this, _to, void 0); - __privateAdd(this, _data3, void 0); - __privateAdd(this, _nonce, void 0); - __privateAdd(this, _gasLimit, void 0); - __privateAdd(this, _gasPrice, void 0); - __privateAdd(this, _maxPriorityFeePerGas, void 0); - __privateAdd(this, _maxFeePerGas, void 0); - __privateAdd(this, _value, void 0); - __privateAdd(this, _chainId, void 0); - __privateAdd(this, _sig, void 0); - __privateAdd(this, _accessList, void 0); - __privateAdd(this, _maxFeePerBlobGas, void 0); - __privateAdd(this, _blobVersionedHashes, void 0); - __privateSet(this, _type, null); - __privateSet(this, _to, null); - __privateSet(this, _nonce, 0); - __privateSet(this, _gasLimit, BN_07); - __privateSet(this, _gasPrice, null); - __privateSet(this, _maxPriorityFeePerGas, null); - __privateSet(this, _maxFeePerGas, null); - __privateSet(this, _data3, "0x"); - __privateSet(this, _value, BN_07); - __privateSet(this, _chainId, BN_07); - __privateSet(this, _sig, null); - __privateSet(this, _accessList, null); - __privateSet(this, _maxFeePerBlobGas, null); - __privateSet(this, _blobVersionedHashes, null); - } - /** - * The transaction type. - * - * If null, the type will be automatically inferred based on - * explicit properties. - */ - get type() { - return __privateGet(this, _type); - } - set type(value) { - switch (value) { - case null: - __privateSet(this, _type, null); - break; - case 0: - case "legacy": - __privateSet(this, _type, 0); - break; - case 1: - case "berlin": - case "eip-2930": - __privateSet(this, _type, 1); - break; - case 2: - case "london": - case "eip-1559": - __privateSet(this, _type, 2); - break; - case 3: - case "cancun": - case "eip-4844": - __privateSet(this, _type, 3); - break; - default: - assertArgument(false, "unsupported transaction type", "type", value); - } - } - /** - * The name of the transaction type. - */ - get typeName() { - switch (this.type) { - case 0: - return "legacy"; - case 1: - return "eip-2930"; - case 2: - return "eip-1559"; - case 3: - return "eip-4844"; - } - return null; - } - /** - * The ``to`` address for the transaction or ``null`` if the - * transaction is an ``init`` transaction. - */ - get to() { - const value = __privateGet(this, _to); - if (value == null && this.type === 3) { - return ZeroAddress; - } - return value; - } - set to(value) { - __privateSet(this, _to, value == null ? null : getAddress(value)); - } - /** - * The transaction nonce. - */ - get nonce() { - return __privateGet(this, _nonce); - } - set nonce(value) { - __privateSet(this, _nonce, getNumber(value, "value")); - } - /** - * The gas limit. - */ - get gasLimit() { - return __privateGet(this, _gasLimit); - } - set gasLimit(value) { - __privateSet(this, _gasLimit, getBigInt(value)); - } - /** - * The gas price. - * - * On legacy networks this defines the fee that will be paid. On - * EIP-1559 networks, this should be ``null``. - */ - get gasPrice() { - const value = __privateGet(this, _gasPrice); - if (value == null && (this.type === 0 || this.type === 1)) { - return BN_07; - } - return value; - } - set gasPrice(value) { - __privateSet(this, _gasPrice, value == null ? null : getBigInt(value, "gasPrice")); - } - /** - * The maximum priority fee per unit of gas to pay. On legacy - * networks this should be ``null``. - */ - get maxPriorityFeePerGas() { - const value = __privateGet(this, _maxPriorityFeePerGas); - if (value == null) { - if (this.type === 2 || this.type === 3) { - return BN_07; - } - return null; - } - return value; - } - set maxPriorityFeePerGas(value) { - __privateSet(this, _maxPriorityFeePerGas, value == null ? null : getBigInt(value, "maxPriorityFeePerGas")); - } - /** - * The maximum total fee per unit of gas to pay. On legacy - * networks this should be ``null``. - */ - get maxFeePerGas() { - const value = __privateGet(this, _maxFeePerGas); - if (value == null) { - if (this.type === 2 || this.type === 3) { - return BN_07; - } - return null; - } - return value; - } - set maxFeePerGas(value) { - __privateSet(this, _maxFeePerGas, value == null ? null : getBigInt(value, "maxFeePerGas")); - } - /** - * The transaction data. For ``init`` transactions this is the - * deployment code. - */ - get data() { - return __privateGet(this, _data3); - } - set data(value) { - __privateSet(this, _data3, hexlify(value)); - } - /** - * The amount of ether (in wei) to send in this transactions. - */ - get value() { - return __privateGet(this, _value); - } - set value(value) { - __privateSet(this, _value, getBigInt(value, "value")); - } - /** - * The chain ID this transaction is valid on. - */ - get chainId() { - return __privateGet(this, _chainId); - } - set chainId(value) { - __privateSet(this, _chainId, getBigInt(value)); - } - /** - * If signed, the signature for this transaction. - */ - get signature() { - return __privateGet(this, _sig) || null; - } - set signature(value) { - __privateSet(this, _sig, value == null ? null : Signature.from(value)); - } - /** - * The access list. - * - * An access list permits discounted (but pre-paid) access to - * bytecode and state variable access within contract execution. - */ - get accessList() { - const value = __privateGet(this, _accessList) || null; - if (value == null) { - if (this.type === 1 || this.type === 2 || this.type === 3) { - return []; - } - return null; - } - return value; - } - set accessList(value) { - __privateSet(this, _accessList, value == null ? null : accessListify(value)); - } - /** - * The max fee per blob gas for Cancun transactions. - */ - get maxFeePerBlobGas() { - const value = __privateGet(this, _maxFeePerBlobGas); - if (value == null && this.type === 3) { - return BN_07; - } - return value; - } - set maxFeePerBlobGas(value) { - __privateSet(this, _maxFeePerBlobGas, value == null ? null : getBigInt(value, "maxFeePerBlobGas")); - } - /** - * The BLOB versioned hashes for Cancun transactions. - */ - get blobVersionedHashes() { - let value = __privateGet(this, _blobVersionedHashes); - if (value == null && this.type === 3) { - return []; - } - return value; - } - set blobVersionedHashes(value) { - if (value != null) { - assertArgument(Array.isArray(value), "blobVersionedHashes must be an Array", "value", value); - value = value.slice(); - for (let i = 0; i < value.length; i++) { - assertArgument(isHexString(value[i], 32), "invalid blobVersionedHash", `value[${i}]`, value[i]); - } - } - __privateSet(this, _blobVersionedHashes, value); - } - /** - * The transaction hash, if signed. Otherwise, ``null``. - */ - get hash() { - if (this.signature == null) { - return null; - } - return keccak256(this.serialized); - } - /** - * The pre-image hash of this transaction. - * - * This is the digest that a [[Signer]] must sign to authorize - * this transaction. - */ - get unsignedHash() { - return keccak256(this.unsignedSerialized); - } - /** - * The sending address, if signed. Otherwise, ``null``. - */ - get from() { - if (this.signature == null) { - return null; - } - return recoverAddress(this.unsignedHash, this.signature); - } - /** - * The public key of the sender, if signed. Otherwise, ``null``. - */ - get fromPublicKey() { - if (this.signature == null) { - return null; - } - return SigningKey.recoverPublicKey(this.unsignedHash, this.signature); - } - /** - * Returns true if signed. - * - * This provides a Type Guard that properties requiring a signed - * transaction are non-null. - */ - isSigned() { - return this.signature != null; - } - /** - * The serialized transaction. - * - * This throws if the transaction is unsigned. For the pre-image, - * use [[unsignedSerialized]]. - */ - get serialized() { - assert(this.signature != null, "cannot serialize unsigned transaction; maybe you meant .unsignedSerialized", "UNSUPPORTED_OPERATION", { operation: ".serialized" }); - switch (this.inferType()) { - case 0: - return _serializeLegacy(this, this.signature); - case 1: - return _serializeEip2930(this, this.signature); - case 2: - return _serializeEip1559(this, this.signature); - case 3: - return _serializeEip4844(this, this.signature); - } - assert(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: ".serialized" }); - } - /** - * The transaction pre-image. - * - * The hash of this is the digest which needs to be signed to - * authorize this transaction. - */ - get unsignedSerialized() { - switch (this.inferType()) { - case 0: - return _serializeLegacy(this); - case 1: - return _serializeEip2930(this); - case 2: - return _serializeEip1559(this); - case 3: - return _serializeEip4844(this); - } - assert(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: ".unsignedSerialized" }); - } - /** - * Return the most "likely" type; currently the highest - * supported transaction type. - */ - inferType() { - const types = this.inferTypes(); - if (types.indexOf(2) >= 0) { - return 2; - } - return types.pop(); - } - /** - * Validates the explicit properties and returns a list of compatible - * transaction types. - */ - inferTypes() { - const hasGasPrice = this.gasPrice != null; - const hasFee = this.maxFeePerGas != null || this.maxPriorityFeePerGas != null; - const hasAccessList = this.accessList != null; - const hasBlob = __privateGet(this, _maxFeePerBlobGas) != null || __privateGet(this, _blobVersionedHashes); - if (this.maxFeePerGas != null && this.maxPriorityFeePerGas != null) { - assert(this.maxFeePerGas >= this.maxPriorityFeePerGas, "priorityFee cannot be more than maxFee", "BAD_DATA", { value: this }); - } - assert(!hasFee || this.type !== 0 && this.type !== 1, "transaction type cannot have maxFeePerGas or maxPriorityFeePerGas", "BAD_DATA", { value: this }); - assert(this.type !== 0 || !hasAccessList, "legacy transaction cannot have accessList", "BAD_DATA", { value: this }); - const types = []; - if (this.type != null) { - types.push(this.type); - } else { - if (hasFee) { - types.push(2); - } else if (hasGasPrice) { - types.push(1); - if (!hasAccessList) { - types.push(0); - } - } else if (hasAccessList) { - types.push(1); - types.push(2); - } else if (hasBlob && this.to) { - types.push(3); - } else { - types.push(0); - types.push(1); - types.push(2); - types.push(3); - } - } - types.sort(); - return types; - } - /** - * Returns true if this transaction is a legacy transaction (i.e. - * ``type === 0``). - * - * This provides a Type Guard that the related properties are - * non-null. - */ - isLegacy() { - return this.type === 0; - } - /** - * Returns true if this transaction is berlin hardform transaction (i.e. - * ``type === 1``). - * - * This provides a Type Guard that the related properties are - * non-null. - */ - isBerlin() { - return this.type === 1; - } - /** - * Returns true if this transaction is london hardform transaction (i.e. - * ``type === 2``). - * - * This provides a Type Guard that the related properties are - * non-null. - */ - isLondon() { - return this.type === 2; - } - /** - * Returns true if this transaction is an [[link-eip-4844]] BLOB - * transaction. - * - * This provides a Type Guard that the related properties are - * non-null. - */ - isCancun() { - return this.type === 3; - } - /** - * Create a copy of this transaciton. - */ - clone() { - return _Transaction.from(this); - } - /** - * Return a JSON-friendly object. - */ - toJSON() { - const s = (v) => { - if (v == null) { - return null; - } - return v.toString(); - }; - return { - type: this.type, - to: this.to, - // from: this.from, - data: this.data, - nonce: this.nonce, - gasLimit: s(this.gasLimit), - gasPrice: s(this.gasPrice), - maxPriorityFeePerGas: s(this.maxPriorityFeePerGas), - maxFeePerGas: s(this.maxFeePerGas), - value: s(this.value), - chainId: s(this.chainId), - sig: this.signature ? this.signature.toJSON() : null, - accessList: this.accessList - }; - } - /** - * Create a **Transaction** from a serialized transaction or a - * Transaction-like object. - */ - static from(tx) { - if (tx == null) { - return new _Transaction(); - } - if (typeof tx === "string") { - const payload = getBytes(tx); - if (payload[0] >= 127) { - return _Transaction.from(_parseLegacy(payload)); - } - switch (payload[0]) { - case 1: - return _Transaction.from(_parseEip2930(payload)); - case 2: - return _Transaction.from(_parseEip1559(payload)); - case 3: - return _Transaction.from(_parseEip4844(payload)); - } - assert(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: "from" }); - } - const result = new _Transaction(); - if (tx.type != null) { - result.type = tx.type; - } - if (tx.to != null) { - result.to = tx.to; - } - if (tx.nonce != null) { - result.nonce = tx.nonce; - } - if (tx.gasLimit != null) { - result.gasLimit = tx.gasLimit; - } - if (tx.gasPrice != null) { - result.gasPrice = tx.gasPrice; - } - if (tx.maxPriorityFeePerGas != null) { - result.maxPriorityFeePerGas = tx.maxPriorityFeePerGas; - } - if (tx.maxFeePerGas != null) { - result.maxFeePerGas = tx.maxFeePerGas; - } - if (tx.maxFeePerBlobGas != null) { - result.maxFeePerBlobGas = tx.maxFeePerBlobGas; - } - if (tx.data != null) { - result.data = tx.data; - } - if (tx.value != null) { - result.value = tx.value; - } - if (tx.chainId != null) { - result.chainId = tx.chainId; - } - if (tx.signature != null) { - result.signature = Signature.from(tx.signature); - } - if (tx.accessList != null) { - result.accessList = tx.accessList; - } - if (tx.blobVersionedHashes != null) { - result.blobVersionedHashes = tx.blobVersionedHashes; - } - if (tx.hash != null) { - assertArgument(result.isSigned(), "unsigned transaction cannot define hash", "tx", tx); - assertArgument(result.hash === tx.hash, "hash mismatch", "tx", tx); - } - if (tx.from != null) { - assertArgument(result.isSigned(), "unsigned transaction cannot define from", "tx", tx); - assertArgument(result.from.toLowerCase() === (tx.from || "").toLowerCase(), "from mismatch", "tx", tx); - } - return result; - } -}; -_type = new WeakMap(); -_to = new WeakMap(); -_data3 = new WeakMap(); -_nonce = new WeakMap(); -_gasLimit = new WeakMap(); -_gasPrice = new WeakMap(); -_maxPriorityFeePerGas = new WeakMap(); -_maxFeePerGas = new WeakMap(); -_value = new WeakMap(); -_chainId = new WeakMap(); -_sig = new WeakMap(); -_accessList = new WeakMap(); -_maxFeePerBlobGas = new WeakMap(); -_blobVersionedHashes = new WeakMap(); -var Transaction = _Transaction; - -// node_modules/ethers/lib.esm/hash/message.js -function hashMessage(message) { - if (typeof message === "string") { - message = toUtf8Bytes(message); - } - return keccak256(concat([ - toUtf8Bytes(MessagePrefix), - toUtf8Bytes(String(message.length)), - message - ])); -} -function verifyMessage(message, sig) { - const digest = hashMessage(message); - return recoverAddress(digest, sig); -} - -// node_modules/ethers/lib.esm/hash/solidity.js -var regexBytes = new RegExp("^bytes([0-9]+)$"); -var regexNumber = new RegExp("^(u?int)([0-9]*)$"); -var regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$"); -function _pack(type, value, isArray) { - switch (type) { - case "address": - if (isArray) { - return getBytes(zeroPadValue(value, 32)); - } - return getBytes(getAddress(value)); - case "string": - return toUtf8Bytes(value); - case "bytes": - return getBytes(value); - case "bool": - value = !!value ? "0x01" : "0x00"; - if (isArray) { - return getBytes(zeroPadValue(value, 32)); - } - return getBytes(value); - } - let match = type.match(regexNumber); - if (match) { - let signed = match[1] === "int"; - let size = parseInt(match[2] || "256"); - assertArgument((!match[2] || match[2] === String(size)) && size % 8 === 0 && size !== 0 && size <= 256, "invalid number type", "type", type); - if (isArray) { - size = 256; - } - if (signed) { - value = toTwos(value, size); - } - return getBytes(zeroPadValue(toBeArray(value), size / 8)); - } - match = type.match(regexBytes); - if (match) { - const size = parseInt(match[1]); - assertArgument(String(size) === match[1] && size !== 0 && size <= 32, "invalid bytes type", "type", type); - assertArgument(dataLength(value) === size, `invalid value for ${type}`, "value", value); - if (isArray) { - return getBytes(zeroPadBytes(value, 32)); - } - return value; - } - match = type.match(regexArray); - if (match && Array.isArray(value)) { - const baseType = match[1]; - const count = parseInt(match[2] || String(value.length)); - assertArgument(count === value.length, `invalid array length for ${type}`, "value", value); - const result = []; - value.forEach(function(value2) { - result.push(_pack(baseType, value2, true)); - }); - return getBytes(concat(result)); - } - assertArgument(false, "invalid type", "type", type); -} -function solidityPacked(types, values) { - assertArgument(types.length === values.length, "wrong number of values; expected ${ types.length }", "values", values); - const tight = []; - types.forEach(function(type, index) { - tight.push(_pack(type, values[index])); - }); - return hexlify(concat(tight)); -} -function solidityPackedKeccak256(types, values) { - return keccak256(solidityPacked(types, values)); -} -function solidityPackedSha256(types, values) { - return sha2562(solidityPacked(types, values)); -} - -// node_modules/ethers/lib.esm/hash/typed-data.js -var padding = new Uint8Array(32); -padding.fill(0); -var BN__1 = BigInt(-1); -var BN_08 = BigInt(0); -var BN_15 = BigInt(1); -var BN_MAX_UINT2562 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); -function hexPadRight(value) { - const bytes2 = getBytes(value); - const padOffset = bytes2.length % 32; - if (padOffset) { - return concat([bytes2, padding.slice(padOffset)]); - } - return hexlify(bytes2); -} -var hexTrue = toBeHex(BN_15, 32); -var hexFalse = toBeHex(BN_08, 32); -var domainFieldTypes = { - name: "string", - version: "string", - chainId: "uint256", - verifyingContract: "address", - salt: "bytes32" -}; -var domainFieldNames = [ - "name", - "version", - "chainId", - "verifyingContract", - "salt" -]; -function checkString(key) { - return function(value) { - assertArgument(typeof value === "string", `invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value); - return value; - }; -} -var domainChecks = { - name: checkString("name"), - version: checkString("version"), - chainId: function(_value2) { - const value = getBigInt(_value2, "domain.chainId"); - assertArgument(value >= 0, "invalid chain ID", "domain.chainId", _value2); - if (Number.isSafeInteger(value)) { - return Number(value); - } - return toQuantity(value); - }, - verifyingContract: function(value) { - try { - return getAddress(value).toLowerCase(); - } catch (error) { - } - assertArgument(false, `invalid domain value "verifyingContract"`, "domain.verifyingContract", value); - }, - salt: function(value) { - const bytes2 = getBytes(value, "domain.salt"); - assertArgument(bytes2.length === 32, `invalid domain value "salt"`, "domain.salt", value); - return hexlify(bytes2); - } -}; -function getBaseEncoder(type) { - { - const match = type.match(/^(u?)int(\d+)$/); - if (match) { - const signed = match[1] === ""; - const width = parseInt(match[2]); - assertArgument(width % 8 === 0 && width !== 0 && width <= 256 && match[2] === String(width), "invalid numeric width", "type", type); - const boundsUpper = mask(BN_MAX_UINT2562, signed ? width - 1 : width); - const boundsLower = signed ? (boundsUpper + BN_15) * BN__1 : BN_08; - return function(_value2) { - const value = getBigInt(_value2, "value"); - assertArgument(value >= boundsLower && value <= boundsUpper, `value out-of-bounds for ${type}`, "value", value); - return toBeHex(signed ? toTwos(value, 256) : value, 32); - }; - } - } - { - const match = type.match(/^bytes(\d+)$/); - if (match) { - const width = parseInt(match[1]); - assertArgument(width !== 0 && width <= 32 && match[1] === String(width), "invalid bytes width", "type", type); - return function(value) { - const bytes2 = getBytes(value); - assertArgument(bytes2.length === width, `invalid length for ${type}`, "value", value); - return hexPadRight(value); - }; - } - } - switch (type) { - case "address": - return function(value) { - return zeroPadValue(getAddress(value), 32); - }; - case "bool": - return function(value) { - return !value ? hexFalse : hexTrue; - }; - case "bytes": - return function(value) { - return keccak256(value); - }; - case "string": - return function(value) { - return id(value); - }; - } - return null; -} -function encodeType(name, fields) { - return `${name}(${fields.map(({ name: name2, type }) => type + " " + name2).join(",")})`; -} -function splitArray(type) { - const match = type.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/); - if (match) { - return { - base: match[1], - index: match[2] + match[4], - array: { - base: match[1], - prefix: match[1] + match[2], - count: match[5] ? parseInt(match[5]) : -1 - } - }; - } - return { base: type }; -} -var _types, _fullTypes, _encoderCache, _getEncoder, getEncoder_fn; -var _TypedDataEncoder = class _TypedDataEncoder { - /** - * Create a new **TypedDataEncoder** for %%types%%. - * - * This performs all necessary checking that types are valid and - * do not violate the [[link-eip-712]] structural constraints as - * well as computes the [[primaryType]]. - */ - constructor(_types2) { - __privateAdd(this, _getEncoder); - /** - * The primary type for the structured [[types]]. - * - * This is derived automatically from the [[types]], since no - * recursion is possible, once the DAG for the types is consturcted - * internally, the primary type must be the only remaining type with - * no parent nodes. - */ - __publicField(this, "primaryType"); - __privateAdd(this, _types, void 0); - __privateAdd(this, _fullTypes, void 0); - __privateAdd(this, _encoderCache, void 0); - __privateSet(this, _fullTypes, /* @__PURE__ */ new Map()); - __privateSet(this, _encoderCache, /* @__PURE__ */ new Map()); - const links = /* @__PURE__ */ new Map(); - const parents = /* @__PURE__ */ new Map(); - const subtypes = /* @__PURE__ */ new Map(); - const types = {}; - Object.keys(_types2).forEach((type) => { - types[type] = _types2[type].map(({ name, type: type2 }) => { - let { base, index } = splitArray(type2); - if (base === "int" && !_types2["int"]) { - base = "int256"; - } - if (base === "uint" && !_types2["uint"]) { - base = "uint256"; - } - return { name, type: base + (index || "") }; - }); - links.set(type, /* @__PURE__ */ new Set()); - parents.set(type, []); - subtypes.set(type, /* @__PURE__ */ new Set()); - }); - __privateSet(this, _types, JSON.stringify(types)); - for (const name in types) { - const uniqueNames = /* @__PURE__ */ new Set(); - for (const field of types[name]) { - assertArgument(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", _types2); - uniqueNames.add(field.name); - const baseType = splitArray(field.type).base; - assertArgument(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, "types", _types2); - const encoder = getBaseEncoder(baseType); - if (encoder) { - continue; - } - assertArgument(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, "types", _types2); - parents.get(baseType).push(name); - links.get(name).add(baseType); - } - } - const primaryTypes = Array.from(parents.keys()).filter((n2) => parents.get(n2).length === 0); - assertArgument(primaryTypes.length !== 0, "missing primary type", "types", _types2); - assertArgument(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes.map((t) => JSON.stringify(t)).join(", ")}`, "types", _types2); - defineProperties(this, { primaryType: primaryTypes[0] }); - function checkCircular(type, found) { - assertArgument(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, "types", _types2); - found.add(type); - for (const child of links.get(type)) { - if (!parents.has(child)) { - continue; - } - checkCircular(child, found); - for (const subtype of found) { - subtypes.get(subtype).add(child); - } - } - found.delete(type); - } - checkCircular(this.primaryType, /* @__PURE__ */ new Set()); - for (const [name, set] of subtypes) { - const st = Array.from(set); - st.sort(); - __privateGet(this, _fullTypes).set(name, encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join("")); - } - } - /** - * The types. - */ - get types() { - return JSON.parse(__privateGet(this, _types)); - } - /** - * Returnthe encoder for the specific %%type%%. - */ - getEncoder(type) { - let encoder = __privateGet(this, _encoderCache).get(type); - if (!encoder) { - encoder = __privateMethod(this, _getEncoder, getEncoder_fn).call(this, type); - __privateGet(this, _encoderCache).set(type, encoder); - } - return encoder; - } - /** - * Return the full type for %%name%%. - */ - encodeType(name) { - const result = __privateGet(this, _fullTypes).get(name); - assertArgument(result, `unknown type: ${JSON.stringify(name)}`, "name", name); - return result; - } - /** - * Return the encoded %%value%% for the %%type%%. - */ - encodeData(type, value) { - return this.getEncoder(type)(value); - } - /** - * Returns the hash of %%value%% for the type of %%name%%. - */ - hashStruct(name, value) { - return keccak256(this.encodeData(name, value)); - } - /** - * Return the fulled encoded %%value%% for the [[types]]. - */ - encode(value) { - return this.encodeData(this.primaryType, value); - } - /** - * Return the hash of the fully encoded %%value%% for the [[types]]. - */ - hash(value) { - return this.hashStruct(this.primaryType, value); - } - /** - * @_ignore: - */ - _visit(type, value, callback) { - { - const encoder = getBaseEncoder(type); - if (encoder) { - return callback(type, value); - } - } - const array = splitArray(type).array; - if (array) { - assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, "value", value); - return value.map((v) => this._visit(array.prefix, v, callback)); - } - const fields = this.types[type]; - if (fields) { - return fields.reduce((accum, { name, type: type2 }) => { - accum[name] = this._visit(type2, value[name], callback); - return accum; - }, {}); - } - assertArgument(false, `unknown type: ${type}`, "type", type); - } - /** - * Call %%calback%% for each value in %%value%%, passing the type and - * component within %%value%%. - * - * This is useful for replacing addresses or other transformation that - * may be desired on each component, based on its type. - */ - visit(value, callback) { - return this._visit(this.primaryType, value, callback); - } - /** - * Create a new **TypedDataEncoder** for %%types%%. - */ - static from(types) { - return new _TypedDataEncoder(types); - } - /** - * Return the primary type for %%types%%. - */ - static getPrimaryType(types) { - return _TypedDataEncoder.from(types).primaryType; - } - /** - * Return the hashed struct for %%value%% using %%types%% and %%name%%. - */ - static hashStruct(name, types, value) { - return _TypedDataEncoder.from(types).hashStruct(name, value); - } - /** - * Return the domain hash for %%domain%%. - */ - static hashDomain(domain) { - const domainFields = []; - for (const name in domain) { - if (domain[name] == null) { - continue; - } - const type = domainFieldTypes[name]; - assertArgument(type, `invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain); - domainFields.push({ name, type }); - } - domainFields.sort((a, b2) => { - return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b2.name); - }); - return _TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain); - } - /** - * Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. - */ - static encode(domain, types, value) { - return concat([ - "0x1901", - _TypedDataEncoder.hashDomain(domain), - _TypedDataEncoder.from(types).hash(value) - ]); - } - /** - * Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. - */ - static hash(domain, types, value) { - return keccak256(_TypedDataEncoder.encode(domain, types, value)); - } - // Replaces all address types with ENS names with their looked up address - /** - * Resolves to the value from resolving all addresses in %%value%% for - * %%types%% and the %%domain%%. - */ - static async resolveNames(domain, types, value, resolveName) { - domain = Object.assign({}, domain); - for (const key in domain) { - if (domain[key] == null) { - delete domain[key]; - } - } - const ensCache = {}; - if (domain.verifyingContract && !isHexString(domain.verifyingContract, 20)) { - ensCache[domain.verifyingContract] = "0x"; - } - const encoder = _TypedDataEncoder.from(types); - encoder.visit(value, (type, value2) => { - if (type === "address" && !isHexString(value2, 20)) { - ensCache[value2] = "0x"; - } - return value2; - }); - for (const name in ensCache) { - ensCache[name] = await resolveName(name); - } - if (domain.verifyingContract && ensCache[domain.verifyingContract]) { - domain.verifyingContract = ensCache[domain.verifyingContract]; - } - value = encoder.visit(value, (type, value2) => { - if (type === "address" && ensCache[value2]) { - return ensCache[value2]; - } - return value2; - }); - return { domain, value }; - } - /** - * Returns the JSON-encoded payload expected by nodes which implement - * the JSON-RPC [[link-eip-712]] method. - */ - static getPayload(domain, types, value) { - _TypedDataEncoder.hashDomain(domain); - const domainValues = {}; - const domainTypes = []; - domainFieldNames.forEach((name) => { - const value2 = domain[name]; - if (value2 == null) { - return; - } - domainValues[name] = domainChecks[name](value2); - domainTypes.push({ name, type: domainFieldTypes[name] }); - }); - const encoder = _TypedDataEncoder.from(types); - types = encoder.types; - const typesWithDomain = Object.assign({}, types); - assertArgument(typesWithDomain.EIP712Domain == null, "types must not contain EIP712Domain type", "types.EIP712Domain", types); - typesWithDomain.EIP712Domain = domainTypes; - encoder.encode(value); - return { - types: typesWithDomain, - domain: domainValues, - primaryType: encoder.primaryType, - message: encoder.visit(value, (type, value2) => { - if (type.match(/^bytes(\d*)/)) { - return hexlify(getBytes(value2)); - } - if (type.match(/^u?int/)) { - return getBigInt(value2).toString(); - } - switch (type) { - case "address": - return value2.toLowerCase(); - case "bool": - return !!value2; - case "string": - assertArgument(typeof value2 === "string", "invalid string", "value", value2); - return value2; - } - assertArgument(false, "unsupported type", "type", type); - }) - }; - } -}; -_types = new WeakMap(); -_fullTypes = new WeakMap(); -_encoderCache = new WeakMap(); -_getEncoder = new WeakSet(); -getEncoder_fn = function(type) { - { - const encoder = getBaseEncoder(type); - if (encoder) { - return encoder; - } - } - const array = splitArray(type).array; - if (array) { - const subtype = array.prefix; - const subEncoder = this.getEncoder(subtype); - return (value) => { - assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, "value", value); - let result = value.map(subEncoder); - if (__privateGet(this, _fullTypes).has(subtype)) { - result = result.map(keccak256); - } - return keccak256(concat(result)); - }; - } - const fields = this.types[type]; - if (fields) { - const encodedType = id(__privateGet(this, _fullTypes).get(type)); - return (value) => { - const values = fields.map(({ name, type: type2 }) => { - const result = this.getEncoder(type2)(value[name]); - if (__privateGet(this, _fullTypes).has(type2)) { - return keccak256(result); - } - return result; - }); - values.unshift(encodedType); - return concat(values); - }; - } - assertArgument(false, `unknown type: ${type}`, "type", type); -}; -var TypedDataEncoder = _TypedDataEncoder; -function verifyTypedData(domain, types, value, signature) { - return recoverAddress(TypedDataEncoder.hash(domain, types, value), signature); -} - -// node_modules/ethers/lib.esm/abi/fragments.js -function setify(items) { - const result = /* @__PURE__ */ new Set(); - items.forEach((k) => result.add(k)); - return Object.freeze(result); -} -var _kwVisibDeploy = "external public payable override"; -var KwVisibDeploy = setify(_kwVisibDeploy.split(" ")); -var _kwVisib = "constant external internal payable private public pure view override"; -var KwVisib = setify(_kwVisib.split(" ")); -var _kwTypes = "constructor error event fallback function receive struct"; -var KwTypes = setify(_kwTypes.split(" ")); -var _kwModifiers = "calldata memory storage payable indexed"; -var KwModifiers = setify(_kwModifiers.split(" ")); -var _kwOther = "tuple returns"; -var _keywords = [_kwTypes, _kwModifiers, _kwOther, _kwVisib].join(" "); -var Keywords = setify(_keywords.split(" ")); -var SimpleTokens = { - "(": "OPEN_PAREN", - ")": "CLOSE_PAREN", - "[": "OPEN_BRACKET", - "]": "CLOSE_BRACKET", - ",": "COMMA", - "@": "AT" -}; -var regexWhitespacePrefix = new RegExp("^(\\s*)"); -var regexNumberPrefix = new RegExp("^([0-9]+)"); -var regexIdPrefix = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"); -var regexId = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"); -var regexType = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"); -var _offset2, _tokens, _subTokenString, subTokenString_fn; -var _TokenString = class _TokenString { - constructor(tokens) { - __privateAdd(this, _subTokenString); - __privateAdd(this, _offset2, void 0); - __privateAdd(this, _tokens, void 0); - __privateSet(this, _offset2, 0); - __privateSet(this, _tokens, tokens.slice()); - } - get offset() { - return __privateGet(this, _offset2); - } - get length() { - return __privateGet(this, _tokens).length - __privateGet(this, _offset2); - } - clone() { - return new _TokenString(__privateGet(this, _tokens)); - } - reset() { - __privateSet(this, _offset2, 0); - } - // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens - popKeyword(allowed) { - const top = this.peek(); - if (top.type !== "KEYWORD" || !allowed.has(top.text)) { - throw new Error(`expected keyword ${top.text}`); - } - return this.pop().text; - } - // Pops and returns the value of the next token if it is `type`; throws if out of tokens - popType(type) { - if (this.peek().type !== type) { - const top = this.peek(); - throw new Error(`expected ${type}; got ${top.type} ${JSON.stringify(top.text)}`); - } - return this.pop().text; - } - // Pops and returns a "(" TOKENS ")" - popParen() { - const top = this.peek(); - if (top.type !== "OPEN_PAREN") { - throw new Error("bad start"); - } - const result = __privateMethod(this, _subTokenString, subTokenString_fn).call(this, __privateGet(this, _offset2) + 1, top.match + 1); - __privateSet(this, _offset2, top.match + 1); - return result; - } - // Pops and returns the items within "(" ITEM1 "," ITEM2 "," ... ")" - popParams() { - const top = this.peek(); - if (top.type !== "OPEN_PAREN") { - throw new Error("bad start"); - } - const result = []; - while (__privateGet(this, _offset2) < top.match - 1) { - const link = this.peek().linkNext; - result.push(__privateMethod(this, _subTokenString, subTokenString_fn).call(this, __privateGet(this, _offset2) + 1, link)); - __privateSet(this, _offset2, link); - } - __privateSet(this, _offset2, top.match + 1); - return result; - } - // Returns the top Token, throwing if out of tokens - peek() { - if (__privateGet(this, _offset2) >= __privateGet(this, _tokens).length) { - throw new Error("out-of-bounds"); - } - return __privateGet(this, _tokens)[__privateGet(this, _offset2)]; - } - // Returns the next value, if it is a keyword in `allowed` - peekKeyword(allowed) { - const top = this.peekType("KEYWORD"); - return top != null && allowed.has(top) ? top : null; - } - // Returns the value of the next token if it is `type` - peekType(type) { - if (this.length === 0) { - return null; - } - const top = this.peek(); - return top.type === type ? top.text : null; - } - // Returns the next token; throws if out of tokens - pop() { - const result = this.peek(); - __privateWrapper(this, _offset2)._++; - return result; - } - toString() { - const tokens = []; - for (let i = __privateGet(this, _offset2); i < __privateGet(this, _tokens).length; i++) { - const token = __privateGet(this, _tokens)[i]; - tokens.push(`${token.type}:${token.text}`); - } - return ``; - } -}; -_offset2 = new WeakMap(); -_tokens = new WeakMap(); -_subTokenString = new WeakSet(); -subTokenString_fn = function(from = 0, to = 0) { - return new _TokenString(__privateGet(this, _tokens).slice(from, to).map((t) => { - return Object.freeze(Object.assign({}, t, { - match: t.match - from, - linkBack: t.linkBack - from, - linkNext: t.linkNext - from - })); - })); -}; -var TokenString = _TokenString; -function lex(text) { - const tokens = []; - const throwError2 = (message) => { - const token = offset < text.length ? JSON.stringify(text[offset]) : "$EOI"; - throw new Error(`invalid token ${token} at ${offset}: ${message}`); - }; - let brackets = []; - let commas = []; - let offset = 0; - while (offset < text.length) { - let cur = text.substring(offset); - let match = cur.match(regexWhitespacePrefix); - if (match) { - offset += match[1].length; - cur = text.substring(offset); - } - const token = { depth: brackets.length, linkBack: -1, linkNext: -1, match: -1, type: "", text: "", offset, value: -1 }; - tokens.push(token); - let type = SimpleTokens[cur[0]] || ""; - if (type) { - token.type = type; - token.text = cur[0]; - offset++; - if (type === "OPEN_PAREN") { - brackets.push(tokens.length - 1); - commas.push(tokens.length - 1); - } else if (type == "CLOSE_PAREN") { - if (brackets.length === 0) { - throwError2("no matching open bracket"); - } - token.match = brackets.pop(); - tokens[token.match].match = tokens.length - 1; - token.depth--; - token.linkBack = commas.pop(); - tokens[token.linkBack].linkNext = tokens.length - 1; - } else if (type === "COMMA") { - token.linkBack = commas.pop(); - tokens[token.linkBack].linkNext = tokens.length - 1; - commas.push(tokens.length - 1); - } else if (type === "OPEN_BRACKET") { - token.type = "BRACKET"; - } else if (type === "CLOSE_BRACKET") { - let suffix = tokens.pop().text; - if (tokens.length > 0 && tokens[tokens.length - 1].type === "NUMBER") { - const value = tokens.pop().text; - suffix = value + suffix; - tokens[tokens.length - 1].value = getNumber(value); - } - if (tokens.length === 0 || tokens[tokens.length - 1].type !== "BRACKET") { - throw new Error("missing opening bracket"); - } - tokens[tokens.length - 1].text += suffix; - } - continue; - } - match = cur.match(regexIdPrefix); - if (match) { - token.text = match[1]; - offset += token.text.length; - if (Keywords.has(token.text)) { - token.type = "KEYWORD"; - continue; - } - if (token.text.match(regexType)) { - token.type = "TYPE"; - continue; - } - token.type = "ID"; - continue; - } - match = cur.match(regexNumberPrefix); - if (match) { - token.text = match[1]; - token.type = "NUMBER"; - offset += token.text.length; - continue; - } - throw new Error(`unexpected token ${JSON.stringify(cur[0])} at position ${offset}`); - } - return new TokenString(tokens.map((t) => Object.freeze(t))); -} -function allowSingle(set, allowed) { - let included = []; - for (const key in allowed.keys()) { - if (set.has(key)) { - included.push(key); - } - } - if (included.length > 1) { - throw new Error(`conflicting types: ${included.join(", ")}`); - } -} -function consumeName(type, tokens) { - if (tokens.peekKeyword(KwTypes)) { - const keyword = tokens.pop().text; - if (keyword !== type) { - throw new Error(`expected ${type}, got ${keyword}`); - } - } - return tokens.popType("ID"); -} -function consumeKeywords(tokens, allowed) { - const keywords = /* @__PURE__ */ new Set(); - while (true) { - const keyword = tokens.peekType("KEYWORD"); - if (keyword == null || allowed && !allowed.has(keyword)) { - break; - } - tokens.pop(); - if (keywords.has(keyword)) { - throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`); - } - keywords.add(keyword); - } - return Object.freeze(keywords); -} -function consumeMutability(tokens) { - let modifiers = consumeKeywords(tokens, KwVisib); - allowSingle(modifiers, setify("constant payable nonpayable".split(" "))); - allowSingle(modifiers, setify("pure view payable nonpayable".split(" "))); - if (modifiers.has("view")) { - return "view"; - } - if (modifiers.has("pure")) { - return "pure"; - } - if (modifiers.has("payable")) { - return "payable"; - } - if (modifiers.has("nonpayable")) { - return "nonpayable"; - } - if (modifiers.has("constant")) { - return "view"; - } - return "nonpayable"; -} -function consumeParams(tokens, allowIndexed) { - return tokens.popParams().map((t) => ParamType.from(t, allowIndexed)); -} -function consumeGas(tokens) { - if (tokens.peekType("AT")) { - tokens.pop(); - if (tokens.peekType("NUMBER")) { - return getBigInt(tokens.pop().text); - } - throw new Error("invalid gas"); - } - return null; -} -function consumeEoi(tokens) { - if (tokens.length) { - throw new Error(`unexpected tokens at offset ${tokens.offset}: ${tokens.toString()}`); - } -} -var regexArrayType = new RegExp(/^(.*)\[([0-9]*)\]$/); -function verifyBasicType(type) { - const match = type.match(regexType); - assertArgument(match, "invalid type", "type", type); - if (type === "uint") { - return "uint256"; - } - if (type === "int") { - return "int256"; - } - if (match[2]) { - const length = parseInt(match[2]); - assertArgument(length !== 0 && length <= 32, "invalid bytes length", "type", type); - } else if (match[3]) { - const size = parseInt(match[3]); - assertArgument(size !== 0 && size <= 256 && size % 8 === 0, "invalid numeric width", "type", type); - } - return type; -} -var _guard4 = {}; -var internal = Symbol.for("_ethers_internal"); -var ParamTypeInternal = "_ParamTypeInternal"; -var ErrorFragmentInternal = "_ErrorInternal"; -var EventFragmentInternal = "_EventInternal"; -var ConstructorFragmentInternal = "_ConstructorInternal"; -var FallbackFragmentInternal = "_FallbackInternal"; -var FunctionFragmentInternal = "_FunctionInternal"; -var StructFragmentInternal = "_StructInternal"; -var _walkAsync, walkAsync_fn; -var _ParamType = class _ParamType { - /** - * @private - */ - constructor(guard, name, type, baseType, indexed, components, arrayLength, arrayChildren) { - __privateAdd(this, _walkAsync); - /** - * The local name of the parameter (or ``""`` if unbound) - */ - __publicField(this, "name"); - /** - * The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``, - * ``"uint256[3][]"``) - */ - __publicField(this, "type"); - /** - * The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``) - */ - __publicField(this, "baseType"); - /** - * True if the parameters is indexed. - * - * For non-indexable types this is ``null``. - */ - __publicField(this, "indexed"); - /** - * The components for the tuple. - * - * For non-tuple types this is ``null``. - */ - __publicField(this, "components"); - /** - * The array length, or ``-1`` for dynamic-lengthed arrays. - * - * For non-array types this is ``null``. - */ - __publicField(this, "arrayLength"); - /** - * The type of each child in the array. - * - * For non-array types this is ``null``. - */ - __publicField(this, "arrayChildren"); - assertPrivate(guard, _guard4, "ParamType"); - Object.defineProperty(this, internal, { value: ParamTypeInternal }); - if (components) { - components = Object.freeze(components.slice()); - } - if (baseType === "array") { - if (arrayLength == null || arrayChildren == null) { - throw new Error(""); - } - } else if (arrayLength != null || arrayChildren != null) { - throw new Error(""); - } - if (baseType === "tuple") { - if (components == null) { - throw new Error(""); - } - } else if (components != null) { - throw new Error(""); - } - defineProperties(this, { - name, - type, - baseType, - indexed, - components, - arrayLength, - arrayChildren - }); - } - /** - * Return a string representation of this type. - * - * For example, - * - * ``sighash" => "(uint256,address)"`` - * - * ``"minimal" => "tuple(uint256,address) indexed"`` - * - * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` - */ - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - const name = this.name || ""; - if (this.isArray()) { - const result3 = JSON.parse(this.arrayChildren.format("json")); - result3.name = name; - result3.type += `[${this.arrayLength < 0 ? "" : String(this.arrayLength)}]`; - return JSON.stringify(result3); - } - const result2 = { - type: this.baseType === "tuple" ? "tuple" : this.type, - name - }; - if (typeof this.indexed === "boolean") { - result2.indexed = this.indexed; - } - if (this.isTuple()) { - result2.components = this.components.map((c) => JSON.parse(c.format(format))); - } - return JSON.stringify(result2); - } - let result = ""; - if (this.isArray()) { - result += this.arrayChildren.format(format); - result += `[${this.arrayLength < 0 ? "" : String(this.arrayLength)}]`; - } else { - if (this.isTuple()) { - result += "(" + this.components.map((comp) => comp.format(format)).join(format === "full" ? ", " : ",") + ")"; - } else { - result += this.type; - } - } - if (format !== "sighash") { - if (this.indexed === true) { - result += " indexed"; - } - if (format === "full" && this.name) { - result += " " + this.name; - } - } - return result; - } - /** - * Returns true if %%this%% is an Array type. - * - * This provides a type gaurd ensuring that [[arrayChildren]] - * and [[arrayLength]] are non-null. - */ - isArray() { - return this.baseType === "array"; - } - /** - * Returns true if %%this%% is a Tuple type. - * - * This provides a type gaurd ensuring that [[components]] - * is non-null. - */ - isTuple() { - return this.baseType === "tuple"; - } - /** - * Returns true if %%this%% is an Indexable type. - * - * This provides a type gaurd ensuring that [[indexed]] - * is non-null. - */ - isIndexable() { - return this.indexed != null; - } - /** - * Walks the **ParamType** with %%value%%, calling %%process%% - * on each type, destructing the %%value%% recursively. - */ - walk(value, process) { - if (this.isArray()) { - if (!Array.isArray(value)) { - throw new Error("invalid array value"); - } - if (this.arrayLength !== -1 && value.length !== this.arrayLength) { - throw new Error("array is wrong length"); - } - const _this = this; - return value.map((v) => _this.arrayChildren.walk(v, process)); - } - if (this.isTuple()) { - if (!Array.isArray(value)) { - throw new Error("invalid tuple value"); - } - if (value.length !== this.components.length) { - throw new Error("array is wrong length"); - } - const _this = this; - return value.map((v, i) => _this.components[i].walk(v, process)); - } - return process(this.type, value); - } - /** - * Walks the **ParamType** with %%value%%, asynchronously calling - * %%process%% on each type, destructing the %%value%% recursively. - * - * This can be used to resolve ENS naes by walking and resolving each - * ``"address"`` type. - */ - async walkAsync(value, process) { - const promises = []; - const result = [value]; - __privateMethod(this, _walkAsync, walkAsync_fn).call(this, promises, value, process, (value2) => { - result[0] = value2; - }); - if (promises.length) { - await Promise.all(promises); - } - return result[0]; - } - /** - * Creates a new **ParamType** for %%obj%%. - * - * If %%allowIndexed%% then the ``indexed`` keyword is permitted, - * otherwise the ``indexed`` keyword will throw an error. - */ - static from(obj, allowIndexed) { - if (_ParamType.isParamType(obj)) { - return obj; - } - if (typeof obj === "string") { - try { - return _ParamType.from(lex(obj), allowIndexed); - } catch (error) { - assertArgument(false, "invalid param type", "obj", obj); - } - } else if (obj instanceof TokenString) { - let type2 = "", baseType = ""; - let comps = null; - if (consumeKeywords(obj, setify(["tuple"])).has("tuple") || obj.peekType("OPEN_PAREN")) { - baseType = "tuple"; - comps = obj.popParams().map((t) => _ParamType.from(t)); - type2 = `tuple(${comps.map((c) => c.format()).join(",")})`; - } else { - type2 = verifyBasicType(obj.popType("TYPE")); - baseType = type2; - } - let arrayChildren = null; - let arrayLength = null; - while (obj.length && obj.peekType("BRACKET")) { - const bracket = obj.pop(); - arrayChildren = new _ParamType(_guard4, "", type2, baseType, null, comps, arrayLength, arrayChildren); - arrayLength = bracket.value; - type2 += bracket.text; - baseType = "array"; - comps = null; - } - let indexed2 = null; - const keywords = consumeKeywords(obj, KwModifiers); - if (keywords.has("indexed")) { - if (!allowIndexed) { - throw new Error(""); - } - indexed2 = true; - } - const name2 = obj.peekType("ID") ? obj.pop().text : ""; - if (obj.length) { - throw new Error("leftover tokens"); - } - return new _ParamType(_guard4, name2, type2, baseType, indexed2, comps, arrayLength, arrayChildren); - } - const name = obj.name; - assertArgument(!name || typeof name === "string" && name.match(regexId), "invalid name", "obj.name", name); - let indexed = obj.indexed; - if (indexed != null) { - assertArgument(allowIndexed, "parameter cannot be indexed", "obj.indexed", obj.indexed); - indexed = !!indexed; - } - let type = obj.type; - let arrayMatch = type.match(regexArrayType); - if (arrayMatch) { - const arrayLength = parseInt(arrayMatch[2] || "-1"); - const arrayChildren = _ParamType.from({ - type: arrayMatch[1], - components: obj.components - }); - return new _ParamType(_guard4, name || "", type, "array", indexed, null, arrayLength, arrayChildren); - } - if (type === "tuple" || type.startsWith( - "tuple(" - /* fix: ) */ - ) || type.startsWith( - "(" - /* fix: ) */ - )) { - const comps = obj.components != null ? obj.components.map((c) => _ParamType.from(c)) : null; - const tuple = new _ParamType(_guard4, name || "", type, "tuple", indexed, comps, null, null); - return tuple; - } - type = verifyBasicType(obj.type); - return new _ParamType(_guard4, name || "", type, type, indexed, null, null, null); - } - /** - * Returns true if %%value%% is a **ParamType**. - */ - static isParamType(value) { - return value && value[internal] === ParamTypeInternal; - } -}; -_walkAsync = new WeakSet(); -walkAsync_fn = function(promises, value, process, setValue) { - if (this.isArray()) { - if (!Array.isArray(value)) { - throw new Error("invalid array value"); - } - if (this.arrayLength !== -1 && value.length !== this.arrayLength) { - throw new Error("array is wrong length"); - } - const childType = this.arrayChildren; - const result2 = value.slice(); - result2.forEach((value2, index) => { - var _a2; - __privateMethod(_a2 = childType, _walkAsync, walkAsync_fn).call(_a2, promises, value2, process, (value3) => { - result2[index] = value3; - }); - }); - setValue(result2); - return; - } - if (this.isTuple()) { - const components = this.components; - let result2; - if (Array.isArray(value)) { - result2 = value.slice(); - } else { - if (value == null || typeof value !== "object") { - throw new Error("invalid tuple value"); - } - result2 = components.map((param) => { - if (!param.name) { - throw new Error("cannot use object value with unnamed components"); - } - if (!(param.name in value)) { - throw new Error(`missing value for component ${param.name}`); - } - return value[param.name]; - }); - } - if (result2.length !== this.components.length) { - throw new Error("array is wrong length"); - } - result2.forEach((value2, index) => { - var _a2; - __privateMethod(_a2 = components[index], _walkAsync, walkAsync_fn).call(_a2, promises, value2, process, (value3) => { - result2[index] = value3; - }); - }); - setValue(result2); - return; - } - const result = process(this.type, value); - if (result.then) { - promises.push(async function() { - setValue(await result); - }()); - } else { - setValue(result); - } -}; -var ParamType = _ParamType; -var Fragment = class _Fragment { - /** - * @private - */ - constructor(guard, type, inputs) { - /** - * The type of the fragment. - */ - __publicField(this, "type"); - /** - * The inputs for the fragment. - */ - __publicField(this, "inputs"); - assertPrivate(guard, _guard4, "Fragment"); - inputs = Object.freeze(inputs.slice()); - defineProperties(this, { type, inputs }); - } - /** - * Creates a new **Fragment** for %%obj%%, wich can be any supported - * ABI frgament type. - */ - static from(obj) { - if (typeof obj === "string") { - try { - _Fragment.from(JSON.parse(obj)); - } catch (e) { - } - return _Fragment.from(lex(obj)); - } - if (obj instanceof TokenString) { - const type = obj.peekKeyword(KwTypes); - switch (type) { - case "constructor": - return ConstructorFragment.from(obj); - case "error": - return ErrorFragment.from(obj); - case "event": - return EventFragment.from(obj); - case "fallback": - case "receive": - return FallbackFragment.from(obj); - case "function": - return FunctionFragment.from(obj); - case "struct": - return StructFragment.from(obj); - } - } else if (typeof obj === "object") { - switch (obj.type) { - case "constructor": - return ConstructorFragment.from(obj); - case "error": - return ErrorFragment.from(obj); - case "event": - return EventFragment.from(obj); - case "fallback": - case "receive": - return FallbackFragment.from(obj); - case "function": - return FunctionFragment.from(obj); - case "struct": - return StructFragment.from(obj); - } - assert(false, `unsupported type: ${obj.type}`, "UNSUPPORTED_OPERATION", { - operation: "Fragment.from" - }); - } - assertArgument(false, "unsupported frgament object", "obj", obj); - } - /** - * Returns true if %%value%% is a [[ConstructorFragment]]. - */ - static isConstructor(value) { - return ConstructorFragment.isFragment(value); - } - /** - * Returns true if %%value%% is an [[ErrorFragment]]. - */ - static isError(value) { - return ErrorFragment.isFragment(value); - } - /** - * Returns true if %%value%% is an [[EventFragment]]. - */ - static isEvent(value) { - return EventFragment.isFragment(value); - } - /** - * Returns true if %%value%% is a [[FunctionFragment]]. - */ - static isFunction(value) { - return FunctionFragment.isFragment(value); - } - /** - * Returns true if %%value%% is a [[StructFragment]]. - */ - static isStruct(value) { - return StructFragment.isFragment(value); - } -}; -var NamedFragment = class extends Fragment { - /** - * @private - */ - constructor(guard, type, name, inputs) { - super(guard, type, inputs); - /** - * The name of the fragment. - */ - __publicField(this, "name"); - assertArgument(typeof name === "string" && name.match(regexId), "invalid identifier", "name", name); - inputs = Object.freeze(inputs.slice()); - defineProperties(this, { name }); - } -}; -function joinParams(format, params) { - return "(" + params.map((p) => p.format(format)).join(format === "full" ? ", " : ",") + ")"; -} -var ErrorFragment = class _ErrorFragment extends NamedFragment { - /** - * @private - */ - constructor(guard, name, inputs) { - super(guard, "error", name, inputs); - Object.defineProperty(this, internal, { value: ErrorFragmentInternal }); - } - /** - * The Custom Error selector. - */ - get selector() { - return id(this.format("sighash")).substring(0, 10); - } - /** - * Returns a string representation of this fragment as %%format%%. - */ - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - return JSON.stringify({ - type: "error", - name: this.name, - inputs: this.inputs.map((input) => JSON.parse(input.format(format))) - }); - } - const result = []; - if (format !== "sighash") { - result.push("error"); - } - result.push(this.name + joinParams(format, this.inputs)); - return result.join(" "); - } - /** - * Returns a new **ErrorFragment** for %%obj%%. - */ - static from(obj) { - if (_ErrorFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - return _ErrorFragment.from(lex(obj)); - } else if (obj instanceof TokenString) { - const name = consumeName("error", obj); - const inputs = consumeParams(obj); - consumeEoi(obj); - return new _ErrorFragment(_guard4, name, inputs); - } - return new _ErrorFragment(_guard4, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); - } - /** - * Returns ``true`` and provides a type guard if %%value%% is an - * **ErrorFragment**. - */ - static isFragment(value) { - return value && value[internal] === ErrorFragmentInternal; - } -}; -var EventFragment = class _EventFragment extends NamedFragment { - /** - * @private - */ - constructor(guard, name, inputs, anonymous) { - super(guard, "event", name, inputs); - /** - * Whether this event is anonymous. - */ - __publicField(this, "anonymous"); - Object.defineProperty(this, internal, { value: EventFragmentInternal }); - defineProperties(this, { anonymous }); - } - /** - * The Event topic hash. - */ - get topicHash() { - return id(this.format("sighash")); - } - /** - * Returns a string representation of this event as %%format%%. - */ - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - return JSON.stringify({ - type: "event", - anonymous: this.anonymous, - name: this.name, - inputs: this.inputs.map((i) => JSON.parse(i.format(format))) - }); - } - const result = []; - if (format !== "sighash") { - result.push("event"); - } - result.push(this.name + joinParams(format, this.inputs)); - if (format !== "sighash" && this.anonymous) { - result.push("anonymous"); - } - return result.join(" "); - } - /** - * Return the topic hash for an event with %%name%% and %%params%%. - */ - static getTopicHash(name, params) { - params = (params || []).map((p) => ParamType.from(p)); - const fragment = new _EventFragment(_guard4, name, params, false); - return fragment.topicHash; - } - /** - * Returns a new **EventFragment** for %%obj%%. - */ - static from(obj) { - if (_EventFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - try { - return _EventFragment.from(lex(obj)); - } catch (error) { - assertArgument(false, "invalid event fragment", "obj", obj); - } - } else if (obj instanceof TokenString) { - const name = consumeName("event", obj); - const inputs = consumeParams(obj, true); - const anonymous = !!consumeKeywords(obj, setify(["anonymous"])).has("anonymous"); - consumeEoi(obj); - return new _EventFragment(_guard4, name, inputs, anonymous); - } - return new _EventFragment(_guard4, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous); - } - /** - * Returns ``true`` and provides a type guard if %%value%% is an - * **EventFragment**. - */ - static isFragment(value) { - return value && value[internal] === EventFragmentInternal; - } -}; -var ConstructorFragment = class _ConstructorFragment extends Fragment { - /** - * @private - */ - constructor(guard, type, inputs, payable, gas) { - super(guard, type, inputs); - /** - * Whether the constructor can receive an endowment. - */ - __publicField(this, "payable"); - /** - * The recommended gas limit for deployment or ``null``. - */ - __publicField(this, "gas"); - Object.defineProperty(this, internal, { value: ConstructorFragmentInternal }); - defineProperties(this, { payable, gas }); - } - /** - * Returns a string representation of this constructor as %%format%%. - */ - format(format) { - assert(format != null && format !== "sighash", "cannot format a constructor for sighash", "UNSUPPORTED_OPERATION", { operation: "format(sighash)" }); - if (format === "json") { - return JSON.stringify({ - type: "constructor", - stateMutability: this.payable ? "payable" : "undefined", - payable: this.payable, - gas: this.gas != null ? this.gas : void 0, - inputs: this.inputs.map((i) => JSON.parse(i.format(format))) - }); - } - const result = [`constructor${joinParams(format, this.inputs)}`]; - if (this.payable) { - result.push("payable"); - } - if (this.gas != null) { - result.push(`@${this.gas.toString()}`); - } - return result.join(" "); - } - /** - * Returns a new **ConstructorFragment** for %%obj%%. - */ - static from(obj) { - if (_ConstructorFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - try { - return _ConstructorFragment.from(lex(obj)); - } catch (error) { - assertArgument(false, "invalid constuctor fragment", "obj", obj); - } - } else if (obj instanceof TokenString) { - consumeKeywords(obj, setify(["constructor"])); - const inputs = consumeParams(obj); - const payable = !!consumeKeywords(obj, KwVisibDeploy).has("payable"); - const gas = consumeGas(obj); - consumeEoi(obj); - return new _ConstructorFragment(_guard4, "constructor", inputs, payable, gas); - } - return new _ConstructorFragment(_guard4, "constructor", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, obj.gas != null ? obj.gas : null); - } - /** - * Returns ``true`` and provides a type guard if %%value%% is a - * **ConstructorFragment**. - */ - static isFragment(value) { - return value && value[internal] === ConstructorFragmentInternal; - } -}; -var FallbackFragment = class _FallbackFragment extends Fragment { - constructor(guard, inputs, payable) { - super(guard, "fallback", inputs); - /** - * If the function can be sent value during invocation. - */ - __publicField(this, "payable"); - Object.defineProperty(this, internal, { value: FallbackFragmentInternal }); - defineProperties(this, { payable }); - } - /** - * Returns a string representation of this fallback as %%format%%. - */ - format(format) { - const type = this.inputs.length === 0 ? "receive" : "fallback"; - if (format === "json") { - const stateMutability = this.payable ? "payable" : "nonpayable"; - return JSON.stringify({ type, stateMutability }); - } - return `${type}()${this.payable ? " payable" : ""}`; - } - /** - * Returns a new **FallbackFragment** for %%obj%%. - */ - static from(obj) { - if (_FallbackFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - try { - return _FallbackFragment.from(lex(obj)); - } catch (error) { - assertArgument(false, "invalid fallback fragment", "obj", obj); - } - } else if (obj instanceof TokenString) { - const errorObj = obj.toString(); - const topIsValid = obj.peekKeyword(setify(["fallback", "receive"])); - assertArgument(topIsValid, "type must be fallback or receive", "obj", errorObj); - const type = obj.popKeyword(setify(["fallback", "receive"])); - if (type === "receive") { - const inputs2 = consumeParams(obj); - assertArgument(inputs2.length === 0, `receive cannot have arguments`, "obj.inputs", inputs2); - consumeKeywords(obj, setify(["payable"])); - consumeEoi(obj); - return new _FallbackFragment(_guard4, [], true); - } - let inputs = consumeParams(obj); - if (inputs.length) { - assertArgument(inputs.length === 1 && inputs[0].type === "bytes", "invalid fallback inputs", "obj.inputs", inputs.map((i) => i.format("minimal")).join(", ")); - } else { - inputs = [ParamType.from("bytes")]; - } - const mutability = consumeMutability(obj); - assertArgument(mutability === "nonpayable" || mutability === "payable", "fallback cannot be constants", "obj.stateMutability", mutability); - if (consumeKeywords(obj, setify(["returns"])).has("returns")) { - const outputs = consumeParams(obj); - assertArgument(outputs.length === 1 && outputs[0].type === "bytes", "invalid fallback outputs", "obj.outputs", outputs.map((i) => i.format("minimal")).join(", ")); - } - consumeEoi(obj); - return new _FallbackFragment(_guard4, inputs, mutability === "payable"); - } - if (obj.type === "receive") { - return new _FallbackFragment(_guard4, [], true); - } - if (obj.type === "fallback") { - const inputs = [ParamType.from("bytes")]; - const payable = obj.stateMutability === "payable"; - return new _FallbackFragment(_guard4, inputs, payable); - } - assertArgument(false, "invalid fallback description", "obj", obj); - } - /** - * Returns ``true`` and provides a type guard if %%value%% is a - * **FallbackFragment**. - */ - static isFragment(value) { - return value && value[internal] === FallbackFragmentInternal; - } -}; -var FunctionFragment = class _FunctionFragment extends NamedFragment { - /** - * @private - */ - constructor(guard, name, stateMutability, inputs, outputs, gas) { - super(guard, "function", name, inputs); - /** - * If the function is constant (e.g. ``pure`` or ``view`` functions). - */ - __publicField(this, "constant"); - /** - * The returned types for the result of calling this function. - */ - __publicField(this, "outputs"); - /** - * The state mutability (e.g. ``payable``, ``nonpayable``, ``view`` - * or ``pure``) - */ - __publicField(this, "stateMutability"); - /** - * If the function can be sent value during invocation. - */ - __publicField(this, "payable"); - /** - * The recommended gas limit to send when calling this function. - */ - __publicField(this, "gas"); - Object.defineProperty(this, internal, { value: FunctionFragmentInternal }); - outputs = Object.freeze(outputs.slice()); - const constant = stateMutability === "view" || stateMutability === "pure"; - const payable = stateMutability === "payable"; - defineProperties(this, { constant, gas, outputs, payable, stateMutability }); - } - /** - * The Function selector. - */ - get selector() { - return id(this.format("sighash")).substring(0, 10); - } - /** - * Returns a string representation of this function as %%format%%. - */ - format(format) { - if (format == null) { - format = "sighash"; - } - if (format === "json") { - return JSON.stringify({ - type: "function", - name: this.name, - constant: this.constant, - stateMutability: this.stateMutability !== "nonpayable" ? this.stateMutability : void 0, - payable: this.payable, - gas: this.gas != null ? this.gas : void 0, - inputs: this.inputs.map((i) => JSON.parse(i.format(format))), - outputs: this.outputs.map((o) => JSON.parse(o.format(format))) - }); - } - const result = []; - if (format !== "sighash") { - result.push("function"); - } - result.push(this.name + joinParams(format, this.inputs)); - if (format !== "sighash") { - if (this.stateMutability !== "nonpayable") { - result.push(this.stateMutability); - } - if (this.outputs && this.outputs.length) { - result.push("returns"); - result.push(joinParams(format, this.outputs)); - } - if (this.gas != null) { - result.push(`@${this.gas.toString()}`); - } - } - return result.join(" "); - } - /** - * Return the selector for a function with %%name%% and %%params%%. - */ - static getSelector(name, params) { - params = (params || []).map((p) => ParamType.from(p)); - const fragment = new _FunctionFragment(_guard4, name, "view", params, [], null); - return fragment.selector; - } - /** - * Returns a new **FunctionFragment** for %%obj%%. - */ - static from(obj) { - if (_FunctionFragment.isFragment(obj)) { - return obj; - } - if (typeof obj === "string") { - try { - return _FunctionFragment.from(lex(obj)); - } catch (error) { - assertArgument(false, "invalid function fragment", "obj", obj); - } - } else if (obj instanceof TokenString) { - const name = consumeName("function", obj); - const inputs = consumeParams(obj); - const mutability = consumeMutability(obj); - let outputs = []; - if (consumeKeywords(obj, setify(["returns"])).has("returns")) { - outputs = consumeParams(obj); - } - const gas = consumeGas(obj); - consumeEoi(obj); - return new _FunctionFragment(_guard4, name, mutability, inputs, outputs, gas); - } - let stateMutability = obj.stateMutability; - if (stateMutability == null) { - stateMutability = "payable"; - if (typeof obj.constant === "boolean") { - stateMutability = "view"; - if (!obj.constant) { - stateMutability = "payable"; - if (typeof obj.payable === "boolean" && !obj.payable) { - stateMutability = "nonpayable"; - } - } - } else if (typeof obj.payable === "boolean" && !obj.payable) { - stateMutability = "nonpayable"; - } - } - return new _FunctionFragment(_guard4, obj.name, stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], obj.gas != null ? obj.gas : null); - } - /** - * Returns ``true`` and provides a type guard if %%value%% is a - * **FunctionFragment**. - */ - static isFragment(value) { - return value && value[internal] === FunctionFragmentInternal; - } -}; -var StructFragment = class _StructFragment extends NamedFragment { - /** - * @private - */ - constructor(guard, name, inputs) { - super(guard, "struct", name, inputs); - Object.defineProperty(this, internal, { value: StructFragmentInternal }); - } - /** - * Returns a string representation of this struct as %%format%%. - */ - format() { - throw new Error("@TODO"); - } - /** - * Returns a new **StructFragment** for %%obj%%. - */ - static from(obj) { - if (typeof obj === "string") { - try { - return _StructFragment.from(lex(obj)); - } catch (error) { - assertArgument(false, "invalid struct fragment", "obj", obj); - } - } else if (obj instanceof TokenString) { - const name = consumeName("struct", obj); - const inputs = consumeParams(obj); - consumeEoi(obj); - return new _StructFragment(_guard4, name, inputs); - } - return new _StructFragment(_guard4, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); - } - // @TODO: fix this return type - /** - * Returns ``true`` and provides a type guard if %%value%% is a - * **StructFragment**. - */ - static isFragment(value) { - return value && value[internal] === StructFragmentInternal; - } -}; - -// node_modules/ethers/lib.esm/abi/abi-coder.js -var PanicReasons = /* @__PURE__ */ new Map(); -PanicReasons.set(0, "GENERIC_PANIC"); -PanicReasons.set(1, "ASSERT_FALSE"); -PanicReasons.set(17, "OVERFLOW"); -PanicReasons.set(18, "DIVIDE_BY_ZERO"); -PanicReasons.set(33, "ENUM_RANGE_ERROR"); -PanicReasons.set(34, "BAD_STORAGE_DATA"); -PanicReasons.set(49, "STACK_UNDERFLOW"); -PanicReasons.set(50, "ARRAY_RANGE_ERROR"); -PanicReasons.set(65, "OUT_OF_MEMORY"); -PanicReasons.set(81, "UNINITIALIZED_FUNCTION_CALL"); -var paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); -var paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); -var defaultCoder = null; -var defaultMaxInflation = 1024; -function getBuiltinCallException(action, tx, data, abiCoder) { - let message = "missing revert data"; - let reason = null; - const invocation = null; - let revert = null; - if (data) { - message = "execution reverted"; - const bytes2 = getBytes(data); - data = hexlify(data); - if (bytes2.length === 0) { - message += " (no data present; likely require(false) occurred"; - reason = "require(false)"; - } else if (bytes2.length % 32 !== 4) { - message += " (could not decode reason; invalid data length)"; - } else if (hexlify(bytes2.slice(0, 4)) === "0x08c379a0") { - try { - reason = abiCoder.decode(["string"], bytes2.slice(4))[0]; - revert = { - signature: "Error(string)", - name: "Error", - args: [reason] - }; - message += `: ${JSON.stringify(reason)}`; - } catch (error) { - message += " (could not decode reason; invalid string data)"; - } - } else if (hexlify(bytes2.slice(0, 4)) === "0x4e487b71") { - try { - const code = Number(abiCoder.decode(["uint256"], bytes2.slice(4))[0]); - revert = { - signature: "Panic(uint256)", - name: "Panic", - args: [code] - }; - reason = `Panic due to ${PanicReasons.get(code) || "UNKNOWN"}(${code})`; - message += `: ${reason}`; - } catch (error) { - message += " (could not decode panic code)"; - } - } else { - message += " (unknown custom error)"; - } - } - const transaction = { - to: tx.to ? getAddress(tx.to) : null, - data: tx.data || "0x" - }; - if (tx.from) { - transaction.from = getAddress(tx.from); - } - return makeError(message, "CALL_EXCEPTION", { - action, - data, - reason, - transaction, - invocation, - revert - }); -} -var _getCoder, getCoder_fn; -var _AbiCoder = class _AbiCoder { - constructor() { - __privateAdd(this, _getCoder); - } - /** - * Get the default values for the given %%types%%. - * - * For example, a ``uint`` is by default ``0`` and ``bool`` - * is by default ``false``. - */ - getDefaultValue(types) { - const coders = types.map((type) => __privateMethod(this, _getCoder, getCoder_fn).call(this, ParamType.from(type))); - const coder = new TupleCoder(coders, "_"); - return coder.defaultValue(); - } - /** - * Encode the %%values%% as the %%types%% into ABI data. - * - * @returns DataHexstring - */ - encode(types, values) { - assertArgumentCount(values.length, types.length, "types/values length mismatch"); - const coders = types.map((type) => __privateMethod(this, _getCoder, getCoder_fn).call(this, ParamType.from(type))); - const coder = new TupleCoder(coders, "_"); - const writer = new Writer(); - coder.encode(writer, values); - return writer.data; - } - /** - * Decode the ABI %%data%% as the %%types%% into values. - * - * If %%loose%% decoding is enabled, then strict padding is - * not enforced. Some older versions of Solidity incorrectly - * padded event data emitted from ``external`` functions. - */ - decode(types, data, loose) { - const coders = types.map((type) => __privateMethod(this, _getCoder, getCoder_fn).call(this, ParamType.from(type))); - const coder = new TupleCoder(coders, "_"); - return coder.decode(new Reader(data, loose, defaultMaxInflation)); - } - static _setDefaultMaxInflation(value) { - assertArgument(typeof value === "number" && Number.isInteger(value), "invalid defaultMaxInflation factor", "value", value); - defaultMaxInflation = value; - } - /** - * Returns the shared singleton instance of a default [[AbiCoder]]. - * - * On the first call, the instance is created internally. - */ - static defaultAbiCoder() { - if (defaultCoder == null) { - defaultCoder = new _AbiCoder(); - } - return defaultCoder; - } - /** - * Returns an ethers-compatible [[CallExceptionError]] Error for the given - * result %%data%% for the [[CallExceptionAction]] %%action%% against - * the Transaction %%tx%%. - */ - static getBuiltinCallException(action, tx, data) { - return getBuiltinCallException(action, tx, data, _AbiCoder.defaultAbiCoder()); - } -}; -_getCoder = new WeakSet(); -getCoder_fn = function(param) { - if (param.isArray()) { - return new ArrayCoder(__privateMethod(this, _getCoder, getCoder_fn).call(this, param.arrayChildren), param.arrayLength, param.name); - } - if (param.isTuple()) { - return new TupleCoder(param.components.map((c) => __privateMethod(this, _getCoder, getCoder_fn).call(this, c)), param.name); - } - switch (param.baseType) { - case "address": - return new AddressCoder(param.name); - case "bool": - return new BooleanCoder(param.name); - case "string": - return new StringCoder(param.name); - case "bytes": - return new BytesCoder(param.name); - case "": - return new NullCoder(param.name); - } - let match = param.type.match(paramTypeNumber); - if (match) { - let size = parseInt(match[2] || "256"); - assertArgument(size !== 0 && size <= 256 && size % 8 === 0, "invalid " + match[1] + " bit length", "param", param); - return new NumberCoder(size / 8, match[1] === "int", param.name); - } - match = param.type.match(paramTypeBytes); - if (match) { - let size = parseInt(match[1]); - assertArgument(size !== 0 && size <= 32, "invalid bytes length", "param", param); - return new FixedBytesCoder(size, param.name); - } - assertArgument(false, "invalid type", "type", param.type); -}; -var AbiCoder = _AbiCoder; - -// node_modules/ethers/lib.esm/abi/bytes32.js -function encodeBytes32String(text) { - const bytes2 = toUtf8Bytes(text); - if (bytes2.length > 31) { - throw new Error("bytes32 string must be less than 32 bytes"); - } - return zeroPadBytes(bytes2, 32); -} -function decodeBytes32String(_bytes) { - const data = getBytes(_bytes, "bytes"); - if (data.length !== 32) { - throw new Error("invalid bytes32 - not 32 bytes long"); - } - if (data[31] !== 0) { - throw new Error("invalid bytes32 string - no null terminator"); - } - let length = 31; - while (data[length - 1] === 0) { - length--; - } - return toUtf8String(data.slice(0, length)); -} - -// node_modules/ethers/lib.esm/abi/interface.js -var LogDescription = class { - /** - * @_ignore: - */ - constructor(fragment, topic, args) { - /** - * The matching fragment for the ``topic0``. - */ - __publicField(this, "fragment"); - /** - * The name of the Event. - */ - __publicField(this, "name"); - /** - * The full Event signature. - */ - __publicField(this, "signature"); - /** - * The topic hash for the Event. - */ - __publicField(this, "topic"); - /** - * The arguments passed into the Event with ``emit``. - */ - __publicField(this, "args"); - const name = fragment.name, signature = fragment.format(); - defineProperties(this, { - fragment, - name, - signature, - topic, - args - }); - } -}; -var TransactionDescription = class { - /** - * @_ignore: - */ - constructor(fragment, selector, args, value) { - /** - * The matching fragment from the transaction ``data``. - */ - __publicField(this, "fragment"); - /** - * The name of the Function from the transaction ``data``. - */ - __publicField(this, "name"); - /** - * The arguments passed to the Function from the transaction ``data``. - */ - __publicField(this, "args"); - /** - * The full Function signature from the transaction ``data``. - */ - __publicField(this, "signature"); - /** - * The selector for the Function from the transaction ``data``. - */ - __publicField(this, "selector"); - /** - * The ``value`` (in wei) from the transaction. - */ - __publicField(this, "value"); - const name = fragment.name, signature = fragment.format(); - defineProperties(this, { - fragment, - name, - args, - signature, - selector, - value - }); - } -}; -var ErrorDescription = class { - /** - * @_ignore: - */ - constructor(fragment, selector, args) { - /** - * The matching fragment. - */ - __publicField(this, "fragment"); - /** - * The name of the Error. - */ - __publicField(this, "name"); - /** - * The arguments passed to the Error with ``revert``. - */ - __publicField(this, "args"); - /** - * The full Error signature. - */ - __publicField(this, "signature"); - /** - * The selector for the Error. - */ - __publicField(this, "selector"); - const name = fragment.name, signature = fragment.format(); - defineProperties(this, { - fragment, - name, - args, - signature, - selector - }); - } -}; -var Indexed = class { - /** - * @_ignore: - */ - constructor(hash2) { - /** - * The ``keccak256`` of the value logged. - */ - __publicField(this, "hash"); - /** - * @_ignore: - */ - __publicField(this, "_isIndexed"); - defineProperties(this, { hash: hash2, _isIndexed: true }); - } - /** - * Returns ``true`` if %%value%% is an **Indexed**. - * - * This provides a Type Guard for property access. - */ - static isIndexed(value) { - return !!(value && value._isIndexed); - } -}; -var PanicReasons2 = { - "0": "generic panic", - "1": "assert(false)", - "17": "arithmetic overflow", - "18": "division or modulo by zero", - "33": "enum overflow", - "34": "invalid encoded storage byte array accessed", - "49": "out-of-bounds array access; popping on an empty array", - "50": "out-of-bounds access of an array or bytesN", - "65": "out of memory", - "81": "uninitialized function" -}; -var BuiltinErrors = { - "0x08c379a0": { - signature: "Error(string)", - name: "Error", - inputs: ["string"], - reason: (message) => { - return `reverted with reason string ${JSON.stringify(message)}`; - } - }, - "0x4e487b71": { - signature: "Panic(uint256)", - name: "Panic", - inputs: ["uint256"], - reason: (code) => { - let reason = "unknown panic code"; - if (code >= 0 && code <= 255 && PanicReasons2[code.toString()]) { - reason = PanicReasons2[code.toString()]; - } - return `reverted with panic code 0x${code.toString(16)} (${reason})`; - } - } -}; -var _errors, _events, _functions, _abiCoder, _getFunction, getFunction_fn, _getEvent, getEvent_fn; -var _Interface = class _Interface { - /** - * Create a new Interface for the %%fragments%%. - */ - constructor(fragments) { - // Find a function definition by any means necessary (unless it is ambiguous) - __privateAdd(this, _getFunction); - // Find an event definition by any means necessary (unless it is ambiguous) - __privateAdd(this, _getEvent); - /** - * All the Contract ABI members (i.e. methods, events, errors, etc). - */ - __publicField(this, "fragments"); - /** - * The Contract constructor. - */ - __publicField(this, "deploy"); - /** - * The Fallback method, if any. - */ - __publicField(this, "fallback"); - /** - * If receiving ether is supported. - */ - __publicField(this, "receive"); - __privateAdd(this, _errors, void 0); - __privateAdd(this, _events, void 0); - __privateAdd(this, _functions, void 0); - // #structs: Map; - __privateAdd(this, _abiCoder, void 0); - let abi = []; - if (typeof fragments === "string") { - abi = JSON.parse(fragments); - } else { - abi = fragments; - } - __privateSet(this, _functions, /* @__PURE__ */ new Map()); - __privateSet(this, _errors, /* @__PURE__ */ new Map()); - __privateSet(this, _events, /* @__PURE__ */ new Map()); - const frags = []; - for (const a of abi) { - try { - frags.push(Fragment.from(a)); - } catch (error) { - console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`, error.message); - } - } - defineProperties(this, { - fragments: Object.freeze(frags) - }); - let fallback = null; - let receive = false; - __privateSet(this, _abiCoder, this.getAbiCoder()); - this.fragments.forEach((fragment, index) => { - let bucket; - switch (fragment.type) { - case "constructor": - if (this.deploy) { - console.log("duplicate definition - constructor"); - return; - } - defineProperties(this, { deploy: fragment }); - return; - case "fallback": - if (fragment.inputs.length === 0) { - receive = true; - } else { - assertArgument(!fallback || fragment.payable !== fallback.payable, "conflicting fallback fragments", `fragments[${index}]`, fragment); - fallback = fragment; - receive = fallback.payable; - } - return; - case "function": - bucket = __privateGet(this, _functions); - break; - case "event": - bucket = __privateGet(this, _events); - break; - case "error": - bucket = __privateGet(this, _errors); - break; - default: - return; - } - const signature = fragment.format(); - if (bucket.has(signature)) { - return; - } - bucket.set(signature, fragment); - }); - if (!this.deploy) { - defineProperties(this, { - deploy: ConstructorFragment.from("constructor()") - }); - } - defineProperties(this, { fallback, receive }); - } - /** - * Returns the entire Human-Readable ABI, as an array of - * signatures, optionally as %%minimal%% strings, which - * removes parameter names and unneceesary spaces. - */ - format(minimal) { - const format = minimal ? "minimal" : "full"; - const abi = this.fragments.map((f2) => f2.format(format)); - return abi; - } - /** - * Return the JSON-encoded ABI. This is the format Solidiy - * returns. - */ - formatJson() { - const abi = this.fragments.map((f2) => f2.format("json")); - return JSON.stringify(abi.map((j) => JSON.parse(j))); - } - /** - * The ABI coder that will be used to encode and decode binary - * data. - */ - getAbiCoder() { - return AbiCoder.defaultAbiCoder(); - } - /** - * Get the function name for %%key%%, which may be a function selector, - * function name or function signature that belongs to the ABI. - */ - getFunctionName(key) { - const fragment = __privateMethod(this, _getFunction, getFunction_fn).call(this, key, null, false); - assertArgument(fragment, "no matching function", "key", key); - return fragment.name; - } - /** - * Returns true if %%key%% (a function selector, function name or - * function signature) is present in the ABI. - * - * In the case of a function name, the name may be ambiguous, so - * accessing the [[FunctionFragment]] may require refinement. - */ - hasFunction(key) { - return !!__privateMethod(this, _getFunction, getFunction_fn).call(this, key, null, false); - } - /** - * Get the [[FunctionFragment]] for %%key%%, which may be a function - * selector, function name or function signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple functions match by name. - * - * If the %%key%% and %%values%% do not refine to a single function in - * the ABI, this will throw. - */ - getFunction(key, values) { - return __privateMethod(this, _getFunction, getFunction_fn).call(this, key, values || null, true); - } - /** - * Iterate over all functions, calling %%callback%%, sorted by their name. - */ - forEachFunction(callback) { - const names2 = Array.from(__privateGet(this, _functions).keys()); - names2.sort((a, b2) => a.localeCompare(b2)); - for (let i = 0; i < names2.length; i++) { - const name = names2[i]; - callback(__privateGet(this, _functions).get(name), i); - } - } - /** - * Get the event name for %%key%%, which may be a topic hash, - * event name or event signature that belongs to the ABI. - */ - getEventName(key) { - const fragment = __privateMethod(this, _getEvent, getEvent_fn).call(this, key, null, false); - assertArgument(fragment, "no matching event", "key", key); - return fragment.name; - } - /** - * Returns true if %%key%% (an event topic hash, event name or - * event signature) is present in the ABI. - * - * In the case of an event name, the name may be ambiguous, so - * accessing the [[EventFragment]] may require refinement. - */ - hasEvent(key) { - return !!__privateMethod(this, _getEvent, getEvent_fn).call(this, key, null, false); - } - /** - * Get the [[EventFragment]] for %%key%%, which may be a topic hash, - * event name or event signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple events match by name. - * - * If the %%key%% and %%values%% do not refine to a single event in - * the ABI, this will throw. - */ - getEvent(key, values) { - return __privateMethod(this, _getEvent, getEvent_fn).call(this, key, values || null, true); - } - /** - * Iterate over all events, calling %%callback%%, sorted by their name. - */ - forEachEvent(callback) { - const names2 = Array.from(__privateGet(this, _events).keys()); - names2.sort((a, b2) => a.localeCompare(b2)); - for (let i = 0; i < names2.length; i++) { - const name = names2[i]; - callback(__privateGet(this, _events).get(name), i); - } - } - /** - * Get the [[ErrorFragment]] for %%key%%, which may be an error - * selector, error name or error signature that belongs to the ABI. - * - * If %%values%% is provided, it will use the Typed API to handle - * ambiguous cases where multiple errors match by name. - * - * If the %%key%% and %%values%% do not refine to a single error in - * the ABI, this will throw. - */ - getError(key, values) { - if (isHexString(key)) { - const selector = key.toLowerCase(); - if (BuiltinErrors[selector]) { - return ErrorFragment.from(BuiltinErrors[selector].signature); - } - for (const fragment of __privateGet(this, _errors).values()) { - if (selector === fragment.selector) { - return fragment; - } - } - return null; - } - if (key.indexOf("(") === -1) { - const matching = []; - for (const [name, fragment] of __privateGet(this, _errors)) { - if (name.split( - "(" - /* fix:) */ - )[0] === key) { - matching.push(fragment); - } - } - if (matching.length === 0) { - if (key === "Error") { - return ErrorFragment.from("error Error(string)"); - } - if (key === "Panic") { - return ErrorFragment.from("error Panic(uint256)"); - } - return null; - } else if (matching.length > 1) { - const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); - assertArgument(false, `ambiguous error description (i.e. ${matchStr})`, "name", key); - } - return matching[0]; - } - key = ErrorFragment.from(key).format(); - if (key === "Error(string)") { - return ErrorFragment.from("error Error(string)"); - } - if (key === "Panic(uint256)") { - return ErrorFragment.from("error Panic(uint256)"); - } - const result = __privateGet(this, _errors).get(key); - if (result) { - return result; - } - return null; - } - /** - * Iterate over all errors, calling %%callback%%, sorted by their name. - */ - forEachError(callback) { - const names2 = Array.from(__privateGet(this, _errors).keys()); - names2.sort((a, b2) => a.localeCompare(b2)); - for (let i = 0; i < names2.length; i++) { - const name = names2[i]; - callback(__privateGet(this, _errors).get(name), i); - } - } - // Get the 4-byte selector used by Solidity to identify a function - /* - getSelector(fragment: ErrorFragment | FunctionFragment): string { - if (typeof(fragment) === "string") { - const matches: Array = [ ]; - - try { matches.push(this.getFunction(fragment)); } catch (error) { } - try { matches.push(this.getError(fragment)); } catch (_) { } - - if (matches.length === 0) { - logger.throwArgumentError("unknown fragment", "key", fragment); - } else if (matches.length > 1) { - logger.throwArgumentError("ambiguous fragment matches function and error", "key", fragment); - } - - fragment = matches[0]; - } - - return dataSlice(id(fragment.format()), 0, 4); - } - */ - // Get the 32-byte topic hash used by Solidity to identify an event - /* - getEventTopic(fragment: EventFragment): string { - //if (typeof(fragment) === "string") { fragment = this.getEvent(eventFragment); } - return id(fragment.format()); - } - */ - _decodeParams(params, data) { - return __privateGet(this, _abiCoder).decode(params, data); - } - _encodeParams(params, values) { - return __privateGet(this, _abiCoder).encode(params, values); - } - /** - * Encodes a ``tx.data`` object for deploying the Contract with - * the %%values%% as the constructor arguments. - */ - encodeDeploy(values) { - return this._encodeParams(this.deploy.inputs, values || []); - } - /** - * Decodes the result %%data%% (e.g. from an ``eth_call``) for the - * specified error (see [[getError]] for valid values for - * %%key%%). - * - * Most developers should prefer the [[parseCallResult]] method instead, - * which will automatically detect a ``CALL_EXCEPTION`` and throw the - * corresponding error. - */ - decodeErrorResult(fragment, data) { - if (typeof fragment === "string") { - const f2 = this.getError(fragment); - assertArgument(f2, "unknown error", "fragment", fragment); - fragment = f2; - } - assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match error ${fragment.name}.`, "data", data); - return this._decodeParams(fragment.inputs, dataSlice(data, 4)); - } - /** - * Encodes the transaction revert data for a call result that - * reverted from the the Contract with the sepcified %%error%% - * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. - * - * This is generally not used by most developers, unless trying to mock - * a result from a Contract. - */ - encodeErrorResult(fragment, values) { - if (typeof fragment === "string") { - const f2 = this.getError(fragment); - assertArgument(f2, "unknown error", "fragment", fragment); - fragment = f2; - } - return concat([ - fragment.selector, - this._encodeParams(fragment.inputs, values || []) - ]); - } - /** - * Decodes the %%data%% from a transaction ``tx.data`` for - * the function specified (see [[getFunction]] for valid values - * for %%fragment%%). - * - * Most developers should prefer the [[parseTransaction]] method - * instead, which will automatically detect the fragment. - */ - decodeFunctionData(fragment, data) { - if (typeof fragment === "string") { - const f2 = this.getFunction(fragment); - assertArgument(f2, "unknown function", "fragment", fragment); - fragment = f2; - } - assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match function ${fragment.name}.`, "data", data); - return this._decodeParams(fragment.inputs, dataSlice(data, 4)); - } - /** - * Encodes the ``tx.data`` for a transaction that calls the function - * specified (see [[getFunction]] for valid values for %%fragment%%) with - * the %%values%%. - */ - encodeFunctionData(fragment, values) { - if (typeof fragment === "string") { - const f2 = this.getFunction(fragment); - assertArgument(f2, "unknown function", "fragment", fragment); - fragment = f2; - } - return concat([ - fragment.selector, - this._encodeParams(fragment.inputs, values || []) - ]); - } - /** - * Decodes the result %%data%% (e.g. from an ``eth_call``) for the - * specified function (see [[getFunction]] for valid values for - * %%key%%). - * - * Most developers should prefer the [[parseCallResult]] method instead, - * which will automatically detect a ``CALL_EXCEPTION`` and throw the - * corresponding error. - */ - decodeFunctionResult(fragment, data) { - if (typeof fragment === "string") { - const f2 = this.getFunction(fragment); - assertArgument(f2, "unknown function", "fragment", fragment); - fragment = f2; - } - let message = "invalid length for result data"; - const bytes2 = getBytesCopy(data); - if (bytes2.length % 32 === 0) { - try { - return __privateGet(this, _abiCoder).decode(fragment.outputs, bytes2); - } catch (error) { - message = "could not decode result data"; - } - } - assert(false, message, "BAD_DATA", { - value: hexlify(bytes2), - info: { method: fragment.name, signature: fragment.format() } - }); - } - makeError(_data5, tx) { - const data = getBytes(_data5, "data"); - const error = AbiCoder.getBuiltinCallException("call", tx, data); - const customPrefix = "execution reverted (unknown custom error)"; - if (error.message.startsWith(customPrefix)) { - const selector = hexlify(data.slice(0, 4)); - const ef = this.getError(selector); - if (ef) { - try { - const args = __privateGet(this, _abiCoder).decode(ef.inputs, data.slice(4)); - error.revert = { - name: ef.name, - signature: ef.format(), - args - }; - error.reason = error.revert.signature; - error.message = `execution reverted: ${error.reason}`; - } catch (e) { - error.message = `execution reverted (coult not decode custom error)`; - } - } - } - const parsed = this.parseTransaction(tx); - if (parsed) { - error.invocation = { - method: parsed.name, - signature: parsed.signature, - args: parsed.args - }; - } - return error; - } - /** - * Encodes the result data (e.g. from an ``eth_call``) for the - * specified function (see [[getFunction]] for valid values - * for %%fragment%%) with %%values%%. - * - * This is generally not used by most developers, unless trying to mock - * a result from a Contract. - */ - encodeFunctionResult(fragment, values) { - if (typeof fragment === "string") { - const f2 = this.getFunction(fragment); - assertArgument(f2, "unknown function", "fragment", fragment); - fragment = f2; - } - return hexlify(__privateGet(this, _abiCoder).encode(fragment.outputs, values || [])); - } - /* - spelunk(inputs: Array, values: ReadonlyArray, processfunc: (type: string, value: any) => Promise): Promise> { - const promises: Array> = [ ]; - const process = function(type: ParamType, value: any): any { - if (type.baseType === "array") { - return descend(type.child - } - if (type. === "address") { - } - }; - - const descend = function (inputs: Array, values: ReadonlyArray) { - if (inputs.length !== values.length) { throw new Error("length mismatch"); } - - }; - - const result: Array = [ ]; - values.forEach((value, index) => { - if (value == null) { - topics.push(null); - } else if (param.baseType === "array" || param.baseType === "tuple") { - logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value); - } else if (Array.isArray(value)) { - topics.push(value.map((value) => encodeTopic(param, value))); - } else { - topics.push(encodeTopic(param, value)); - } - }); - } - */ - // Create the filter for the event with search criteria (e.g. for eth_filterLog) - encodeFilterTopics(fragment, values) { - if (typeof fragment === "string") { - const f2 = this.getEvent(fragment); - assertArgument(f2, "unknown event", "eventFragment", fragment); - fragment = f2; - } - assert(values.length <= fragment.inputs.length, `too many arguments for ${fragment.format()}`, "UNEXPECTED_ARGUMENT", { count: values.length, expectedCount: fragment.inputs.length }); - const topics = []; - if (!fragment.anonymous) { - topics.push(fragment.topicHash); - } - const encodeTopic = (param, value) => { - if (param.type === "string") { - return id(value); - } else if (param.type === "bytes") { - return keccak256(hexlify(value)); - } - if (param.type === "bool" && typeof value === "boolean") { - value = value ? "0x01" : "0x00"; - } else if (param.type.match(/^u?int/)) { - value = toBeHex(value); - } else if (param.type.match(/^bytes/)) { - value = zeroPadBytes(value, 32); - } else if (param.type === "address") { - __privateGet(this, _abiCoder).encode(["address"], [value]); - } - return zeroPadValue(hexlify(value), 32); - }; - values.forEach((value, index) => { - const param = fragment.inputs[index]; - if (!param.indexed) { - assertArgument(value == null, "cannot filter non-indexed parameters; must be null", "contract." + param.name, value); - return; - } - if (value == null) { - topics.push(null); - } else if (param.baseType === "array" || param.baseType === "tuple") { - assertArgument(false, "filtering with tuples or arrays not supported", "contract." + param.name, value); - } else if (Array.isArray(value)) { - topics.push(value.map((value2) => encodeTopic(param, value2))); - } else { - topics.push(encodeTopic(param, value)); - } - }); - while (topics.length && topics[topics.length - 1] === null) { - topics.pop(); - } - return topics; - } - encodeEventLog(fragment, values) { - if (typeof fragment === "string") { - const f2 = this.getEvent(fragment); - assertArgument(f2, "unknown event", "eventFragment", fragment); - fragment = f2; - } - const topics = []; - const dataTypes = []; - const dataValues = []; - if (!fragment.anonymous) { - topics.push(fragment.topicHash); - } - assertArgument(values.length === fragment.inputs.length, "event arguments/values mismatch", "values", values); - fragment.inputs.forEach((param, index) => { - const value = values[index]; - if (param.indexed) { - if (param.type === "string") { - topics.push(id(value)); - } else if (param.type === "bytes") { - topics.push(keccak256(value)); - } else if (param.baseType === "tuple" || param.baseType === "array") { - throw new Error("not implemented"); - } else { - topics.push(__privateGet(this, _abiCoder).encode([param.type], [value])); - } - } else { - dataTypes.push(param); - dataValues.push(value); - } - }); - return { - data: __privateGet(this, _abiCoder).encode(dataTypes, dataValues), - topics - }; - } - // Decode a filter for the event and the search criteria - decodeEventLog(fragment, data, topics) { - if (typeof fragment === "string") { - const f2 = this.getEvent(fragment); - assertArgument(f2, "unknown event", "eventFragment", fragment); - fragment = f2; - } - if (topics != null && !fragment.anonymous) { - const eventTopic = fragment.topicHash; - assertArgument(isHexString(topics[0], 32) && topics[0].toLowerCase() === eventTopic, "fragment/topic mismatch", "topics[0]", topics[0]); - topics = topics.slice(1); - } - const indexed = []; - const nonIndexed = []; - const dynamic = []; - fragment.inputs.forEach((param, index) => { - if (param.indexed) { - if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") { - indexed.push(ParamType.from({ type: "bytes32", name: param.name })); - dynamic.push(true); - } else { - indexed.push(param); - dynamic.push(false); - } - } else { - nonIndexed.push(param); - dynamic.push(false); - } - }); - const resultIndexed = topics != null ? __privateGet(this, _abiCoder).decode(indexed, concat(topics)) : null; - const resultNonIndexed = __privateGet(this, _abiCoder).decode(nonIndexed, data, true); - const values = []; - const keys = []; - let nonIndexedIndex = 0, indexedIndex = 0; - fragment.inputs.forEach((param, index) => { - let value = null; - if (param.indexed) { - if (resultIndexed == null) { - value = new Indexed(null); - } else if (dynamic[index]) { - value = new Indexed(resultIndexed[indexedIndex++]); - } else { - try { - value = resultIndexed[indexedIndex++]; - } catch (error) { - value = error; - } - } - } else { - try { - value = resultNonIndexed[nonIndexedIndex++]; - } catch (error) { - value = error; - } - } - values.push(value); - keys.push(param.name || null); - }); - return Result.fromItems(values, keys); - } - /** - * Parses a transaction, finding the matching function and extracts - * the parameter values along with other useful function details. - * - * If the matching function cannot be found, return null. - */ - parseTransaction(tx) { - const data = getBytes(tx.data, "tx.data"); - const value = getBigInt(tx.value != null ? tx.value : 0, "tx.value"); - const fragment = this.getFunction(hexlify(data.slice(0, 4))); - if (!fragment) { - return null; - } - const args = __privateGet(this, _abiCoder).decode(fragment.inputs, data.slice(4)); - return new TransactionDescription(fragment, fragment.selector, args, value); - } - parseCallResult(data) { - throw new Error("@TODO"); - } - /** - * Parses a receipt log, finding the matching event and extracts - * the parameter values along with other useful event details. - * - * If the matching event cannot be found, returns null. - */ - parseLog(log) { - const fragment = this.getEvent(log.topics[0]); - if (!fragment || fragment.anonymous) { - return null; - } - return new LogDescription(fragment, fragment.topicHash, this.decodeEventLog(fragment, log.data, log.topics)); - } - /** - * Parses a revert data, finding the matching error and extracts - * the parameter values along with other useful error details. - * - * If the matching error cannot be found, returns null. - */ - parseError(data) { - const hexData = hexlify(data); - const fragment = this.getError(dataSlice(hexData, 0, 4)); - if (!fragment) { - return null; - } - const args = __privateGet(this, _abiCoder).decode(fragment.inputs, dataSlice(hexData, 4)); - return new ErrorDescription(fragment, fragment.selector, args); - } - /** - * Creates a new [[Interface]] from the ABI %%value%%. - * - * The %%value%% may be provided as an existing [[Interface]] object, - * a JSON-encoded ABI or any Human-Readable ABI format. - */ - static from(value) { - if (value instanceof _Interface) { - return value; - } - if (typeof value === "string") { - return new _Interface(JSON.parse(value)); - } - if (typeof value.format === "function") { - return new _Interface(value.format("json")); - } - return new _Interface(value); - } -}; -_errors = new WeakMap(); -_events = new WeakMap(); -_functions = new WeakMap(); -_abiCoder = new WeakMap(); -_getFunction = new WeakSet(); -getFunction_fn = function(key, values, forceUnique) { - if (isHexString(key)) { - const selector = key.toLowerCase(); - for (const fragment of __privateGet(this, _functions).values()) { - if (selector === fragment.selector) { - return fragment; - } - } - return null; - } - if (key.indexOf("(") === -1) { - const matching = []; - for (const [name, fragment] of __privateGet(this, _functions)) { - if (name.split( - "(" - /* fix:) */ - )[0] === key) { - matching.push(fragment); - } - } - if (values) { - const lastValue = values.length > 0 ? values[values.length - 1] : null; - let valueLength = values.length; - let allowOptions = true; - if (Typed.isTyped(lastValue) && lastValue.type === "overrides") { - allowOptions = false; - valueLength--; - } - for (let i = matching.length - 1; i >= 0; i--) { - const inputs = matching[i].inputs.length; - if (inputs !== valueLength && (!allowOptions || inputs !== valueLength - 1)) { - matching.splice(i, 1); - } - } - for (let i = matching.length - 1; i >= 0; i--) { - const inputs = matching[i].inputs; - for (let j = 0; j < values.length; j++) { - if (!Typed.isTyped(values[j])) { - continue; - } - if (j >= inputs.length) { - if (values[j].type === "overrides") { - continue; - } - matching.splice(i, 1); - break; - } - if (values[j].type !== inputs[j].baseType) { - matching.splice(i, 1); - break; - } - } - } - } - if (matching.length === 1 && values && values.length !== matching[0].inputs.length) { - const lastArg = values[values.length - 1]; - if (lastArg == null || Array.isArray(lastArg) || typeof lastArg !== "object") { - matching.splice(0, 1); - } - } - if (matching.length === 0) { - return null; - } - if (matching.length > 1 && forceUnique) { - const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); - assertArgument(false, `ambiguous function description (i.e. matches ${matchStr})`, "key", key); - } - return matching[0]; - } - const result = __privateGet(this, _functions).get(FunctionFragment.from(key).format()); - if (result) { - return result; - } - return null; -}; -_getEvent = new WeakSet(); -getEvent_fn = function(key, values, forceUnique) { - if (isHexString(key)) { - const eventTopic = key.toLowerCase(); - for (const fragment of __privateGet(this, _events).values()) { - if (eventTopic === fragment.topicHash) { - return fragment; - } - } - return null; - } - if (key.indexOf("(") === -1) { - const matching = []; - for (const [name, fragment] of __privateGet(this, _events)) { - if (name.split( - "(" - /* fix:) */ - )[0] === key) { - matching.push(fragment); - } - } - if (values) { - for (let i = matching.length - 1; i >= 0; i--) { - if (matching[i].inputs.length < values.length) { - matching.splice(i, 1); - } - } - for (let i = matching.length - 1; i >= 0; i--) { - const inputs = matching[i].inputs; - for (let j = 0; j < values.length; j++) { - if (!Typed.isTyped(values[j])) { - continue; - } - if (values[j].type !== inputs[j].baseType) { - matching.splice(i, 1); - break; - } - } - } - } - if (matching.length === 0) { - return null; - } - if (matching.length > 1 && forceUnique) { - const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); - assertArgument(false, `ambiguous event description (i.e. matches ${matchStr})`, "key", key); - } - return matching[0]; - } - const result = __privateGet(this, _events).get(EventFragment.from(key).format()); - if (result) { - return result; - } - return null; -}; -var Interface = _Interface; - -// node_modules/ethers/lib.esm/providers/provider.js -var BN_09 = BigInt(0); -function getValue2(value) { - if (value == null) { - return null; - } - return value; -} -function toJson(value) { - if (value == null) { - return null; - } - return value.toString(); -} -var FeeData = class { - /** - * Creates a new FeeData for %%gasPrice%%, %%maxFeePerGas%% and - * %%maxPriorityFeePerGas%%. - */ - constructor(gasPrice, maxFeePerGas, maxPriorityFeePerGas) { - /** - * The gas price for legacy networks. - */ - __publicField(this, "gasPrice"); - /** - * The maximum fee to pay per gas. - * - * The base fee per gas is defined by the network and based on - * congestion, increasing the cost during times of heavy load - * and lowering when less busy. - * - * The actual fee per gas will be the base fee for the block - * and the priority fee, up to the max fee per gas. - * - * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) - */ - __publicField(this, "maxFeePerGas"); - /** - * The additional amout to pay per gas to encourage a validator - * to include the transaction. - * - * The purpose of this is to compensate the validator for the - * adjusted risk for including a given transaction. - * - * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) - */ - __publicField(this, "maxPriorityFeePerGas"); - defineProperties(this, { - gasPrice: getValue2(gasPrice), - maxFeePerGas: getValue2(maxFeePerGas), - maxPriorityFeePerGas: getValue2(maxPriorityFeePerGas) - }); - } - /** - * Returns a JSON-friendly value. - */ - toJSON() { - const { gasPrice, maxFeePerGas, maxPriorityFeePerGas } = this; - return { - _type: "FeeData", - gasPrice: toJson(gasPrice), - maxFeePerGas: toJson(maxFeePerGas), - maxPriorityFeePerGas: toJson(maxPriorityFeePerGas) - }; - } -}; -function copyRequest(req) { - const result = {}; - if (req.to) { - result.to = req.to; - } - if (req.from) { - result.from = req.from; - } - if (req.data) { - result.data = hexlify(req.data); - } - const bigIntKeys = "chainId,gasLimit,gasPrice,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/); - for (const key of bigIntKeys) { - if (!(key in req) || req[key] == null) { - continue; - } - result[key] = getBigInt(req[key], `request.${key}`); - } - const numberKeys = "type,nonce".split(/,/); - for (const key of numberKeys) { - if (!(key in req) || req[key] == null) { - continue; - } - result[key] = getNumber(req[key], `request.${key}`); - } - if (req.accessList) { - result.accessList = accessListify(req.accessList); - } - if ("blockTag" in req) { - result.blockTag = req.blockTag; - } - if ("enableCcipRead" in req) { - result.enableCcipRead = !!req.enableCcipRead; - } - if ("customData" in req) { - result.customData = req.customData; - } - return result; -} -var _transactions; -var Block = class { - /** - * Create a new **Block** object. - * - * This should generally not be necessary as the unless implementing a - * low-level library. - */ - constructor(block, provider) { - /** - * The provider connected to the block used to fetch additional details - * if necessary. - */ - __publicField(this, "provider"); - /** - * The block number, sometimes called the block height. This is a - * sequential number that is one higher than the parent block. - */ - __publicField(this, "number"); - /** - * The block hash. - * - * This hash includes all properties, so can be safely used to identify - * an exact set of block properties. - */ - __publicField(this, "hash"); - /** - * The timestamp for this block, which is the number of seconds since - * epoch that this block was included. - */ - __publicField(this, "timestamp"); - /** - * The block hash of the parent block. - */ - __publicField(this, "parentHash"); - /** - * The hash tree root of the parent beacon block for the given - * execution block. See [[link-eip-4788]]. - */ - __publicField(this, "parentBeaconBlockRoot"); - /** - * The nonce. - * - * On legacy networks, this is the random number inserted which - * permitted the difficulty target to be reached. - */ - __publicField(this, "nonce"); - /** - * The difficulty target. - * - * On legacy networks, this is the proof-of-work target required - * for a block to meet the protocol rules to be included. - * - * On modern networks, this is a random number arrived at using - * randao. @TODO: Find links? - */ - __publicField(this, "difficulty"); - /** - * The total gas limit for this block. - */ - __publicField(this, "gasLimit"); - /** - * The total gas used in this block. - */ - __publicField(this, "gasUsed"); - /** - * The root hash for the global state after applying changes - * in this block. - */ - __publicField(this, "stateRoot"); - /** - * The hash of the transaction receipts trie. - */ - __publicField(this, "receiptsRoot"); - /** - * The total amount of blob gas consumed by the transactions - * within the block. See [[link-eip-4844]]. - */ - __publicField(this, "blobGasUsed"); - /** - * The running total of blob gas consumed in excess of the - * target, prior to the block. See [[link-eip-4844]]. - */ - __publicField(this, "excessBlobGas"); - /** - * The miner coinbase address, wihch receives any subsidies for - * including this block. - */ - __publicField(this, "miner"); - /** - * Any extra data the validator wished to include. - */ - __publicField(this, "extraData"); - /** - * The base fee per gas that all transactions in this block were - * charged. - * - * This adjusts after each block, depending on how congested the network - * is. - */ - __publicField(this, "baseFeePerGas"); - __privateAdd(this, _transactions, void 0); - __privateSet(this, _transactions, block.transactions.map((tx) => { - if (typeof tx !== "string") { - return new TransactionResponse(tx, provider); - } - return tx; - })); - defineProperties(this, { - provider, - hash: getValue2(block.hash), - number: block.number, - timestamp: block.timestamp, - parentHash: block.parentHash, - parentBeaconBlockRoot: block.parentBeaconBlockRoot, - nonce: block.nonce, - difficulty: block.difficulty, - gasLimit: block.gasLimit, - gasUsed: block.gasUsed, - blobGasUsed: block.blobGasUsed, - excessBlobGas: block.excessBlobGas, - miner: block.miner, - extraData: block.extraData, - baseFeePerGas: getValue2(block.baseFeePerGas), - stateRoot: block.stateRoot, - receiptsRoot: block.receiptsRoot - }); - } - /** - * Returns the list of transaction hashes, in the order - * they were executed within the block. - */ - get transactions() { - return __privateGet(this, _transactions).map((tx) => { - if (typeof tx === "string") { - return tx; - } - return tx.hash; - }); - } - /** - * Returns the complete transactions, in the order they - * were executed within the block. - * - * This is only available for blocks which prefetched - * transactions, by passing ``true`` to %%prefetchTxs%% - * into [[Provider-getBlock]]. - */ - get prefetchedTransactions() { - const txs = __privateGet(this, _transactions).slice(); - if (txs.length === 0) { - return []; - } - assert(typeof txs[0] === "object", "transactions were not prefetched with block request", "UNSUPPORTED_OPERATION", { - operation: "transactionResponses()" - }); - return txs; - } - /** - * Returns a JSON-friendly value. - */ - toJSON() { - const { baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash: hash2, miner, nonce, number: number2, parentHash, parentBeaconBlockRoot, stateRoot, receiptsRoot, timestamp, transactions } = this; - return { - _type: "Block", - baseFeePerGas: toJson(baseFeePerGas), - difficulty: toJson(difficulty), - extraData, - gasLimit: toJson(gasLimit), - gasUsed: toJson(gasUsed), - blobGasUsed: toJson(this.blobGasUsed), - excessBlobGas: toJson(this.excessBlobGas), - hash: hash2, - miner, - nonce, - number: number2, - parentHash, - timestamp, - parentBeaconBlockRoot, - stateRoot, - receiptsRoot, - transactions - }; - } - [Symbol.iterator]() { - let index = 0; - const txs = this.transactions; - return { - next: () => { - if (index < this.length) { - return { - value: txs[index++], - done: false - }; - } - return { value: void 0, done: true }; - } - }; - } - /** - * The number of transactions in this block. - */ - get length() { - return __privateGet(this, _transactions).length; - } - /** - * The [[link-js-date]] this block was included at. - */ - get date() { - if (this.timestamp == null) { - return null; - } - return new Date(this.timestamp * 1e3); - } - /** - * Get the transaction at %%indexe%% within this block. - */ - async getTransaction(indexOrHash) { - let tx = void 0; - if (typeof indexOrHash === "number") { - tx = __privateGet(this, _transactions)[indexOrHash]; - } else { - const hash2 = indexOrHash.toLowerCase(); - for (const v of __privateGet(this, _transactions)) { - if (typeof v === "string") { - if (v !== hash2) { - continue; - } - tx = v; - break; - } else { - if (v.hash === hash2) { - continue; - } - tx = v; - break; - } - } - } - if (tx == null) { - throw new Error("no such tx"); - } - if (typeof tx === "string") { - return await this.provider.getTransaction(tx); - } else { - return tx; - } - } - /** - * If a **Block** was fetched with a request to include the transactions - * this will allow synchronous access to those transactions. - * - * If the transactions were not prefetched, this will throw. - */ - getPrefetchedTransaction(indexOrHash) { - const txs = this.prefetchedTransactions; - if (typeof indexOrHash === "number") { - return txs[indexOrHash]; - } - indexOrHash = indexOrHash.toLowerCase(); - for (const tx of txs) { - if (tx.hash === indexOrHash) { - return tx; - } - } - assertArgument(false, "no matching transaction", "indexOrHash", indexOrHash); - } - /** - * Returns true if this block been mined. This provides a type guard - * for all properties on a [[MinedBlock]]. - */ - isMined() { - return !!this.hash; - } - /** - * Returns true if this block is an [[link-eip-2930]] block. - */ - isLondon() { - return !!this.baseFeePerGas; - } - /** - * @_ignore: - */ - orphanedEvent() { - if (!this.isMined()) { - throw new Error(""); - } - return createOrphanedBlockFilter(this); - } -}; -_transactions = new WeakMap(); -var Log = class { - /** - * @_ignore: - */ - constructor(log, provider) { - /** - * The provider connected to the log used to fetch additional details - * if necessary. - */ - __publicField(this, "provider"); - /** - * The transaction hash of the transaction this log occurred in. Use the - * [[Log-getTransaction]] to get the [[TransactionResponse]]. - */ - __publicField(this, "transactionHash"); - /** - * The block hash of the block this log occurred in. Use the - * [[Log-getBlock]] to get the [[Block]]. - */ - __publicField(this, "blockHash"); - /** - * The block number of the block this log occurred in. It is preferred - * to use the [[Block-hash]] when fetching the related [[Block]], - * since in the case of an orphaned block, the block at that height may - * have changed. - */ - __publicField(this, "blockNumber"); - /** - * If the **Log** represents a block that was removed due to an orphaned - * block, this will be true. - * - * This can only happen within an orphan event listener. - */ - __publicField(this, "removed"); - /** - * The address of the contract that emitted this log. - */ - __publicField(this, "address"); - /** - * The data included in this log when it was emitted. - */ - __publicField(this, "data"); - /** - * The indexed topics included in this log when it was emitted. - * - * All topics are included in the bloom filters, so they can be - * efficiently filtered using the [[Provider-getLogs]] method. - */ - __publicField(this, "topics"); - /** - * The index within the block this log occurred at. This is generally - * not useful to developers, but can be used with the various roots - * to proof inclusion within a block. - */ - __publicField(this, "index"); - /** - * The index within the transaction of this log. - */ - __publicField(this, "transactionIndex"); - this.provider = provider; - const topics = Object.freeze(log.topics.slice()); - defineProperties(this, { - transactionHash: log.transactionHash, - blockHash: log.blockHash, - blockNumber: log.blockNumber, - removed: log.removed, - address: log.address, - data: log.data, - topics, - index: log.index, - transactionIndex: log.transactionIndex - }); - } - /** - * Returns a JSON-compatible object. - */ - toJSON() { - const { address, blockHash, blockNumber, data, index, removed, topics, transactionHash, transactionIndex } = this; - return { - _type: "log", - address, - blockHash, - blockNumber, - data, - index, - removed, - topics, - transactionHash, - transactionIndex - }; - } - /** - * Returns the block that this log occurred in. - */ - async getBlock() { - const block = await this.provider.getBlock(this.blockHash); - assert(!!block, "failed to find transaction", "UNKNOWN_ERROR", {}); - return block; - } - /** - * Returns the transaction that this log occurred in. - */ - async getTransaction() { - const tx = await this.provider.getTransaction(this.transactionHash); - assert(!!tx, "failed to find transaction", "UNKNOWN_ERROR", {}); - return tx; - } - /** - * Returns the transaction receipt fot the transaction that this - * log occurred in. - */ - async getTransactionReceipt() { - const receipt = await this.provider.getTransactionReceipt(this.transactionHash); - assert(!!receipt, "failed to find transaction receipt", "UNKNOWN_ERROR", {}); - return receipt; - } - /** - * @_ignore: - */ - removedEvent() { - return createRemovedLogFilter(this); - } -}; -var _logs; -var TransactionReceipt = class { - /** - * @_ignore: - */ - constructor(tx, provider) { - /** - * The provider connected to the log used to fetch additional details - * if necessary. - */ - __publicField(this, "provider"); - /** - * The address the transaction was sent to. - */ - __publicField(this, "to"); - /** - * The sender of the transaction. - */ - __publicField(this, "from"); - /** - * The address of the contract if the transaction was directly - * responsible for deploying one. - * - * This is non-null **only** if the ``to`` is empty and the ``data`` - * was successfully executed as initcode. - */ - __publicField(this, "contractAddress"); - /** - * The transaction hash. - */ - __publicField(this, "hash"); - /** - * The index of this transaction within the block transactions. - */ - __publicField(this, "index"); - /** - * The block hash of the [[Block]] this transaction was included in. - */ - __publicField(this, "blockHash"); - /** - * The block number of the [[Block]] this transaction was included in. - */ - __publicField(this, "blockNumber"); - /** - * The bloom filter bytes that represent all logs that occurred within - * this transaction. This is generally not useful for most developers, - * but can be used to validate the included logs. - */ - __publicField(this, "logsBloom"); - /** - * The actual amount of gas used by this transaction. - * - * When creating a transaction, the amount of gas that will be used can - * only be approximated, but the sender must pay the gas fee for the - * entire gas limit. After the transaction, the difference is refunded. - */ - __publicField(this, "gasUsed"); - /** - * The gas used for BLObs. See [[link-eip-4844]]. - */ - __publicField(this, "blobGasUsed"); - /** - * The amount of gas used by all transactions within the block for this - * and all transactions with a lower ``index``. - * - * This is generally not useful for developers but can be used to - * validate certain aspects of execution. - */ - __publicField(this, "cumulativeGasUsed"); - /** - * The actual gas price used during execution. - * - * Due to the complexity of [[link-eip-1559]] this value can only - * be caluclated after the transaction has been mined, snce the base - * fee is protocol-enforced. - */ - __publicField(this, "gasPrice"); - /** - * The price paid per BLOB in gas. See [[link-eip-4844]]. - */ - __publicField(this, "blobGasPrice"); - /** - * The [[link-eip-2718]] transaction type. - */ - __publicField(this, "type"); - //readonly byzantium!: boolean; - /** - * The status of this transaction, indicating success (i.e. ``1``) or - * a revert (i.e. ``0``). - * - * This is available in post-byzantium blocks, but some backends may - * backfill this value. - */ - __publicField(this, "status"); - /** - * The root hash of this transaction. - * - * This is no present and was only included in pre-byzantium blocks, but - * could be used to validate certain parts of the receipt. - */ - __publicField(this, "root"); - __privateAdd(this, _logs, void 0); - __privateSet(this, _logs, Object.freeze(tx.logs.map((log) => { - return new Log(log, provider); - }))); - let gasPrice = BN_09; - if (tx.effectiveGasPrice != null) { - gasPrice = tx.effectiveGasPrice; - } else if (tx.gasPrice != null) { - gasPrice = tx.gasPrice; - } - defineProperties(this, { - provider, - to: tx.to, - from: tx.from, - contractAddress: tx.contractAddress, - hash: tx.hash, - index: tx.index, - blockHash: tx.blockHash, - blockNumber: tx.blockNumber, - logsBloom: tx.logsBloom, - gasUsed: tx.gasUsed, - cumulativeGasUsed: tx.cumulativeGasUsed, - blobGasUsed: tx.blobGasUsed, - gasPrice, - blobGasPrice: tx.blobGasPrice, - type: tx.type, - //byzantium: tx.byzantium, - status: tx.status, - root: tx.root - }); - } - /** - * The logs for this transaction. - */ - get logs() { - return __privateGet(this, _logs); - } - /** - * Returns a JSON-compatible representation. - */ - toJSON() { - const { - to, - from, - contractAddress, - hash: hash2, - index, - blockHash, - blockNumber, - logsBloom, - logs, - //byzantium, - status, - root - } = this; - return { - _type: "TransactionReceipt", - blockHash, - blockNumber, - //byzantium, - contractAddress, - cumulativeGasUsed: toJson(this.cumulativeGasUsed), - from, - gasPrice: toJson(this.gasPrice), - blobGasUsed: toJson(this.blobGasUsed), - blobGasPrice: toJson(this.blobGasPrice), - gasUsed: toJson(this.gasUsed), - hash: hash2, - index, - logs, - logsBloom, - root, - status, - to - }; - } - /** - * @_ignore: - */ - get length() { - return this.logs.length; - } - [Symbol.iterator]() { - let index = 0; - return { - next: () => { - if (index < this.length) { - return { value: this.logs[index++], done: false }; - } - return { value: void 0, done: true }; - } - }; - } - /** - * The total fee for this transaction, in wei. - */ - get fee() { - return this.gasUsed * this.gasPrice; - } - /** - * Resolves to the block this transaction occurred in. - */ - async getBlock() { - const block = await this.provider.getBlock(this.blockHash); - if (block == null) { - throw new Error("TODO"); - } - return block; - } - /** - * Resolves to the transaction this transaction occurred in. - */ - async getTransaction() { - const tx = await this.provider.getTransaction(this.hash); - if (tx == null) { - throw new Error("TODO"); - } - return tx; - } - /** - * Resolves to the return value of the execution of this transaction. - * - * Support for this feature is limited, as it requires an archive node - * with the ``debug_`` or ``trace_`` API enabled. - */ - async getResult() { - return await this.provider.getTransactionResult(this.hash); - } - /** - * Resolves to the number of confirmations this transaction has. - */ - async confirmations() { - return await this.provider.getBlockNumber() - this.blockNumber + 1; - } - /** - * @_ignore: - */ - removedEvent() { - return createRemovedTransactionFilter(this); - } - /** - * @_ignore: - */ - reorderedEvent(other) { - assert(!other || other.isMined(), "unmined 'other' transction cannot be orphaned", "UNSUPPORTED_OPERATION", { operation: "reorderedEvent(other)" }); - return createReorderedTransactionFilter(this, other); - } -}; -_logs = new WeakMap(); -var _startBlock; -var _TransactionResponse = class _TransactionResponse { - /** - * @_ignore: - */ - constructor(tx, provider) { - /** - * The provider this is connected to, which will influence how its - * methods will resolve its async inspection methods. - */ - __publicField(this, "provider"); - /** - * The block number of the block that this transaction was included in. - * - * This is ``null`` for pending transactions. - */ - __publicField(this, "blockNumber"); - /** - * The blockHash of the block that this transaction was included in. - * - * This is ``null`` for pending transactions. - */ - __publicField(this, "blockHash"); - /** - * The index within the block that this transaction resides at. - */ - __publicField(this, "index"); - /** - * The transaction hash. - */ - __publicField(this, "hash"); - /** - * The [[link-eip-2718]] transaction envelope type. This is - * ``0`` for legacy transactions types. - */ - __publicField(this, "type"); - /** - * The receiver of this transaction. - * - * If ``null``, then the transaction is an initcode transaction. - * This means the result of executing the [[data]] will be deployed - * as a new contract on chain (assuming it does not revert) and the - * address may be computed using [[getCreateAddress]]. - */ - __publicField(this, "to"); - /** - * The sender of this transaction. It is implicitly computed - * from the transaction pre-image hash (as the digest) and the - * [[signature]] using ecrecover. - */ - __publicField(this, "from"); - /** - * The nonce, which is used to prevent replay attacks and offer - * a method to ensure transactions from a given sender are explicitly - * ordered. - * - * When sending a transaction, this must be equal to the number of - * transactions ever sent by [[from]]. - */ - __publicField(this, "nonce"); - /** - * The maximum units of gas this transaction can consume. If execution - * exceeds this, the entries transaction is reverted and the sender - * is charged for the full amount, despite not state changes being made. - */ - __publicField(this, "gasLimit"); - /** - * The gas price can have various values, depending on the network. - * - * In modern networks, for transactions that are included this is - * the //effective gas price// (the fee per gas that was actually - * charged), while for transactions that have not been included yet - * is the [[maxFeePerGas]]. - * - * For legacy transactions, or transactions on legacy networks, this - * is the fee that will be charged per unit of gas the transaction - * consumes. - */ - __publicField(this, "gasPrice"); - /** - * The maximum priority fee (per unit of gas) to allow a - * validator to charge the sender. This is inclusive of the - * [[maxFeeFeePerGas]]. - */ - __publicField(this, "maxPriorityFeePerGas"); - /** - * The maximum fee (per unit of gas) to allow this transaction - * to charge the sender. - */ - __publicField(this, "maxFeePerGas"); - /** - * The [[link-eip-4844]] max fee per BLOb gas. - */ - __publicField(this, "maxFeePerBlobGas"); - /** - * The data. - */ - __publicField(this, "data"); - /** - * The value, in wei. Use [[formatEther]] to format this value - * as ether. - */ - __publicField(this, "value"); - /** - * The chain ID. - */ - __publicField(this, "chainId"); - /** - * The signature. - */ - __publicField(this, "signature"); - /** - * The [[link-eip-2930]] access list for transaction types that - * support it, otherwise ``null``. - */ - __publicField(this, "accessList"); - /** - * The [[link-eip-4844]] BLOb versioned hashes. - */ - __publicField(this, "blobVersionedHashes"); - __privateAdd(this, _startBlock, void 0); - this.provider = provider; - this.blockNumber = tx.blockNumber != null ? tx.blockNumber : null; - this.blockHash = tx.blockHash != null ? tx.blockHash : null; - this.hash = tx.hash; - this.index = tx.index; - this.type = tx.type; - this.from = tx.from; - this.to = tx.to || null; - this.gasLimit = tx.gasLimit; - this.nonce = tx.nonce; - this.data = tx.data; - this.value = tx.value; - this.gasPrice = tx.gasPrice; - this.maxPriorityFeePerGas = tx.maxPriorityFeePerGas != null ? tx.maxPriorityFeePerGas : null; - this.maxFeePerGas = tx.maxFeePerGas != null ? tx.maxFeePerGas : null; - this.maxFeePerBlobGas = tx.maxFeePerBlobGas != null ? tx.maxFeePerBlobGas : null; - this.chainId = tx.chainId; - this.signature = tx.signature; - this.accessList = tx.accessList != null ? tx.accessList : null; - this.blobVersionedHashes = tx.blobVersionedHashes != null ? tx.blobVersionedHashes : null; - __privateSet(this, _startBlock, -1); - } - /** - * Returns a JSON-compatible representation of this transaction. - */ - toJSON() { - const { blockNumber, blockHash, index, hash: hash2, type, to, from, nonce, data, signature, accessList, blobVersionedHashes } = this; - return { - _type: "TransactionResponse", - accessList, - blockNumber, - blockHash, - blobVersionedHashes, - chainId: toJson(this.chainId), - data, - from, - gasLimit: toJson(this.gasLimit), - gasPrice: toJson(this.gasPrice), - hash: hash2, - maxFeePerGas: toJson(this.maxFeePerGas), - maxPriorityFeePerGas: toJson(this.maxPriorityFeePerGas), - maxFeePerBlobGas: toJson(this.maxFeePerBlobGas), - nonce, - signature, - to, - index, - type, - value: toJson(this.value) - }; - } - /** - * Resolves to the Block that this transaction was included in. - * - * This will return null if the transaction has not been included yet. - */ - async getBlock() { - let blockNumber = this.blockNumber; - if (blockNumber == null) { - const tx = await this.getTransaction(); - if (tx) { - blockNumber = tx.blockNumber; - } - } - if (blockNumber == null) { - return null; - } - const block = this.provider.getBlock(blockNumber); - if (block == null) { - throw new Error("TODO"); - } - return block; - } - /** - * Resolves to this transaction being re-requested from the - * provider. This can be used if you have an unmined transaction - * and wish to get an up-to-date populated instance. - */ - async getTransaction() { - return this.provider.getTransaction(this.hash); - } - /** - * Resolve to the number of confirmations this transaction has. - */ - async confirmations() { - if (this.blockNumber == null) { - const { tx, blockNumber: blockNumber2 } = await resolveProperties({ - tx: this.getTransaction(), - blockNumber: this.provider.getBlockNumber() - }); - if (tx == null || tx.blockNumber == null) { - return 0; - } - return blockNumber2 - tx.blockNumber + 1; - } - const blockNumber = await this.provider.getBlockNumber(); - return blockNumber - this.blockNumber + 1; - } - /** - * Resolves once this transaction has been mined and has - * %%confirms%% blocks including it (default: ``1``) with an - * optional %%timeout%%. - * - * This can resolve to ``null`` only if %%confirms%% is ``0`` - * and the transaction has not been mined, otherwise this will - * wait until enough confirmations have completed. - */ - async wait(_confirms, _timeout2) { - const confirms = _confirms == null ? 1 : _confirms; - const timeout = _timeout2 == null ? 0 : _timeout2; - let startBlock = __privateGet(this, _startBlock); - let nextScan = -1; - let stopScanning = startBlock === -1 ? true : false; - const checkReplacement = async () => { - if (stopScanning) { - return null; - } - const { blockNumber, nonce } = await resolveProperties({ - blockNumber: this.provider.getBlockNumber(), - nonce: this.provider.getTransactionCount(this.from) - }); - if (nonce < this.nonce) { - startBlock = blockNumber; - return; - } - if (stopScanning) { - return null; - } - const mined = await this.getTransaction(); - if (mined && mined.blockNumber != null) { - return; - } - if (nextScan === -1) { - nextScan = startBlock - 3; - if (nextScan < __privateGet(this, _startBlock)) { - nextScan = __privateGet(this, _startBlock); - } - } - while (nextScan <= blockNumber) { - if (stopScanning) { - return null; - } - const block = await this.provider.getBlock(nextScan, true); - if (block == null) { - return; - } - for (const hash2 of block) { - if (hash2 === this.hash) { - return; - } - } - for (let i = 0; i < block.length; i++) { - const tx = await block.getTransaction(i); - if (tx.from === this.from && tx.nonce === this.nonce) { - if (stopScanning) { - return null; - } - const receipt2 = await this.provider.getTransactionReceipt(tx.hash); - if (receipt2 == null) { - return; - } - if (blockNumber - receipt2.blockNumber + 1 < confirms) { - return; - } - let reason = "replaced"; - if (tx.data === this.data && tx.to === this.to && tx.value === this.value) { - reason = "repriced"; - } else if (tx.data === "0x" && tx.from === tx.to && tx.value === BN_09) { - reason = "cancelled"; - } - assert(false, "transaction was replaced", "TRANSACTION_REPLACED", { - cancelled: reason === "replaced" || reason === "cancelled", - reason, - replacement: tx.replaceableTransaction(startBlock), - hash: tx.hash, - receipt: receipt2 - }); - } - } - nextScan++; - } - return; - }; - const checkReceipt = (receipt2) => { - if (receipt2 == null || receipt2.status !== 0) { - return receipt2; - } - assert(false, "transaction execution reverted", "CALL_EXCEPTION", { - action: "sendTransaction", - data: null, - reason: null, - invocation: null, - revert: null, - transaction: { - to: receipt2.to, - from: receipt2.from, - data: "" - // @TODO: in v7, split out sendTransaction properties - }, - receipt: receipt2 - }); - }; - const receipt = await this.provider.getTransactionReceipt(this.hash); - if (confirms === 0) { - return checkReceipt(receipt); - } - if (receipt) { - if (await receipt.confirmations() >= confirms) { - return checkReceipt(receipt); - } - } else { - await checkReplacement(); - if (confirms === 0) { - return null; - } - } - const waiter = new Promise((resolve, reject) => { - const cancellers = []; - const cancel = () => { - cancellers.forEach((c) => c()); - }; - cancellers.push(() => { - stopScanning = true; - }); - if (timeout > 0) { - const timer = setTimeout(() => { - cancel(); - reject(makeError("wait for transaction timeout", "TIMEOUT")); - }, timeout); - cancellers.push(() => { - clearTimeout(timer); - }); - } - const txListener = async (receipt2) => { - if (await receipt2.confirmations() >= confirms) { - cancel(); - try { - resolve(checkReceipt(receipt2)); - } catch (error) { - reject(error); - } - } - }; - cancellers.push(() => { - this.provider.off(this.hash, txListener); - }); - this.provider.on(this.hash, txListener); - if (startBlock >= 0) { - const replaceListener = async () => { - try { - await checkReplacement(); - } catch (error) { - if (isError(error, "TRANSACTION_REPLACED")) { - cancel(); - reject(error); - return; - } - } - if (!stopScanning) { - this.provider.once("block", replaceListener); - } - }; - cancellers.push(() => { - this.provider.off("block", replaceListener); - }); - this.provider.once("block", replaceListener); - } - }); - return await waiter; - } - /** - * Returns ``true`` if this transaction has been included. - * - * This is effective only as of the time the TransactionResponse - * was instantiated. To get up-to-date information, use - * [[getTransaction]]. - * - * This provides a Type Guard that this transaction will have - * non-null property values for properties that are null for - * unmined transactions. - */ - isMined() { - return this.blockHash != null; - } - /** - * Returns true if the transaction is a legacy (i.e. ``type == 0``) - * transaction. - * - * This provides a Type Guard that this transaction will have - * the ``null``-ness for hardfork-specific properties set correctly. - */ - isLegacy() { - return this.type === 0; - } - /** - * Returns true if the transaction is a Berlin (i.e. ``type == 1``) - * transaction. See [[link-eip-2070]]. - * - * This provides a Type Guard that this transaction will have - * the ``null``-ness for hardfork-specific properties set correctly. - */ - isBerlin() { - return this.type === 1; - } - /** - * Returns true if the transaction is a London (i.e. ``type == 2``) - * transaction. See [[link-eip-1559]]. - * - * This provides a Type Guard that this transaction will have - * the ``null``-ness for hardfork-specific properties set correctly. - */ - isLondon() { - return this.type === 2; - } - /** - * Returns true if hte transaction is a Cancun (i.e. ``type == 3``) - * transaction. See [[link-eip-4844]]. - */ - isCancun() { - return this.type === 3; - } - /** - * Returns a filter which can be used to listen for orphan events - * that evict this transaction. - */ - removedEvent() { - assert(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); - return createRemovedTransactionFilter(this); - } - /** - * Returns a filter which can be used to listen for orphan events - * that re-order this event against %%other%%. - */ - reorderedEvent(other) { - assert(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); - assert(!other || other.isMined(), "unmined 'other' transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); - return createReorderedTransactionFilter(this, other); - } - /** - * Returns a new TransactionResponse instance which has the ability to - * detect (and throw an error) if the transaction is replaced, which - * will begin scanning at %%startBlock%%. - * - * This should generally not be used by developers and is intended - * primarily for internal use. Setting an incorrect %%startBlock%% can - * have devastating performance consequences if used incorrectly. - */ - replaceableTransaction(startBlock) { - assertArgument(Number.isInteger(startBlock) && startBlock >= 0, "invalid startBlock", "startBlock", startBlock); - const tx = new _TransactionResponse(this, this.provider); - __privateSet(tx, _startBlock, startBlock); - return tx; - } -}; -_startBlock = new WeakMap(); -var TransactionResponse = _TransactionResponse; -function createOrphanedBlockFilter(block) { - return { orphan: "drop-block", hash: block.hash, number: block.number }; -} -function createReorderedTransactionFilter(tx, other) { - return { orphan: "reorder-transaction", tx, other }; -} -function createRemovedTransactionFilter(tx) { - return { orphan: "drop-transaction", tx }; -} -function createRemovedLogFilter(log) { - return { orphan: "drop-log", log: { - transactionHash: log.transactionHash, - blockHash: log.blockHash, - blockNumber: log.blockNumber, - address: log.address, - data: log.data, - topics: Object.freeze(log.topics.slice()), - index: log.index - } }; -} - -// node_modules/ethers/lib.esm/contract/wrappers.js -var EventLog = class extends Log { - /** - * @_ignore: - */ - constructor(log, iface, fragment) { - super(log, log.provider); - /** - * The Contract Interface. - */ - __publicField(this, "interface"); - /** - * The matching event. - */ - __publicField(this, "fragment"); - /** - * The parsed arguments passed to the event by ``emit``. - */ - __publicField(this, "args"); - const args = iface.decodeEventLog(fragment, log.data, log.topics); - defineProperties(this, { args, fragment, interface: iface }); - } - /** - * The name of the event. - */ - get eventName() { - return this.fragment.name; - } - /** - * The signature of the event. - */ - get eventSignature() { - return this.fragment.format(); - } -}; -var UndecodedEventLog = class extends Log { - /** - * @_ignore: - */ - constructor(log, error) { - super(log, log.provider); - /** - * The error encounted when trying to decode the log. - */ - __publicField(this, "error"); - defineProperties(this, { error }); - } -}; -var _iface; -var ContractTransactionReceipt = class extends TransactionReceipt { - /** - * @_ignore: - */ - constructor(iface, provider, tx) { - super(tx, provider); - __privateAdd(this, _iface, void 0); - __privateSet(this, _iface, iface); - } - /** - * The parsed logs for any [[Log]] which has a matching event in the - * Contract ABI. - */ - get logs() { - return super.logs.map((log) => { - const fragment = log.topics.length ? __privateGet(this, _iface).getEvent(log.topics[0]) : null; - if (fragment) { - try { - return new EventLog(log, __privateGet(this, _iface), fragment); - } catch (error) { - return new UndecodedEventLog(log, error); - } - } - return log; - }); - } -}; -_iface = new WeakMap(); -var _iface2; -var ContractTransactionResponse = class extends TransactionResponse { - /** - * @_ignore: - */ - constructor(iface, provider, tx) { - super(tx, provider); - __privateAdd(this, _iface2, void 0); - __privateSet(this, _iface2, iface); - } - /** - * Resolves once this transaction has been mined and has - * %%confirms%% blocks including it (default: ``1``) with an - * optional %%timeout%%. - * - * This can resolve to ``null`` only if %%confirms%% is ``0`` - * and the transaction has not been mined, otherwise this will - * wait until enough confirmations have completed. - */ - async wait(confirms, timeout) { - const receipt = await super.wait(confirms, timeout); - if (receipt == null) { - return null; - } - return new ContractTransactionReceipt(__privateGet(this, _iface2), this.provider, receipt); - } -}; -_iface2 = new WeakMap(); -var ContractUnknownEventPayload = class extends EventPayload { - /** - * @_event: - */ - constructor(contract, listener, filter, log) { - super(contract, listener, filter); - /** - * The log with no matching events. - */ - __publicField(this, "log"); - defineProperties(this, { log }); - } - /** - * Resolves to the block the event occured in. - */ - async getBlock() { - return await this.log.getBlock(); - } - /** - * Resolves to the transaction the event occured in. - */ - async getTransaction() { - return await this.log.getTransaction(); - } - /** - * Resolves to the transaction receipt the event occured in. - */ - async getTransactionReceipt() { - return await this.log.getTransactionReceipt(); - } -}; -var ContractEventPayload = class extends ContractUnknownEventPayload { - /** - * @_ignore: - */ - constructor(contract, listener, filter, fragment, _log) { - super(contract, listener, filter, new EventLog(_log, contract.interface, fragment)); - const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics); - defineProperties(this, { args, fragment }); - } - /** - * The event name. - */ - get eventName() { - return this.fragment.name; - } - /** - * The event signature. - */ - get eventSignature() { - return this.fragment.format(); - } -}; - -// node_modules/ethers/lib.esm/contract/contract.js -var BN_010 = BigInt(0); -function canCall(value) { - return value && typeof value.call === "function"; -} -function canEstimate(value) { - return value && typeof value.estimateGas === "function"; -} -function canResolve(value) { - return value && typeof value.resolveName === "function"; -} -function canSend(value) { - return value && typeof value.sendTransaction === "function"; -} -function getResolver(value) { - if (value != null) { - if (canResolve(value)) { - return value; - } - if (value.provider) { - return value.provider; - } - } - return void 0; -} -var _filter; -var PreparedTopicFilter = class { - constructor(contract, fragment, args) { - __privateAdd(this, _filter, void 0); - __publicField(this, "fragment"); - defineProperties(this, { fragment }); - if (fragment.inputs.length < args.length) { - throw new Error("too many arguments"); - } - const runner = getRunner(contract.runner, "resolveName"); - const resolver = canResolve(runner) ? runner : null; - __privateSet(this, _filter, async function() { - const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => { - const arg = args[index]; - if (arg == null) { - return null; - } - return param.walkAsync(args[index], (type, value) => { - if (type === "address") { - if (Array.isArray(value)) { - return Promise.all(value.map((v) => resolveAddress(v, resolver))); - } - return resolveAddress(value, resolver); - } - return value; - }); - })); - return contract.interface.encodeFilterTopics(fragment, resolvedArgs); - }()); - } - getTopicFilter() { - return __privateGet(this, _filter); - } -}; -_filter = new WeakMap(); -function getRunner(value, feature) { - if (value == null) { - return null; - } - if (typeof value[feature] === "function") { - return value; - } - if (value.provider && typeof value.provider[feature] === "function") { - return value.provider; - } - return null; -} -function getProvider(value) { - if (value == null) { - return null; - } - return value.provider || null; -} -async function copyOverrides(arg, allowed) { - const _overrides = Typed.dereference(arg, "overrides"); - assertArgument(typeof _overrides === "object", "invalid overrides parameter", "overrides", arg); - const overrides = copyRequest(_overrides); - assertArgument(overrides.to == null || (allowed || []).indexOf("to") >= 0, "cannot override to", "overrides.to", overrides.to); - assertArgument(overrides.data == null || (allowed || []).indexOf("data") >= 0, "cannot override data", "overrides.data", overrides.data); - if (overrides.from) { - overrides.from = overrides.from; - } - return overrides; -} -async function resolveArgs(_runner, inputs, args) { - const runner = getRunner(_runner, "resolveName"); - const resolver = canResolve(runner) ? runner : null; - return await Promise.all(inputs.map((param, index) => { - return param.walkAsync(args[index], (type, value) => { - value = Typed.dereference(value, type); - if (type === "address") { - return resolveAddress(value, resolver); - } - return value; - }); - })); -} -function buildWrappedFallback(contract) { - const populateTransaction = async function(overrides) { - const tx = await copyOverrides(overrides, ["data"]); - tx.to = await contract.getAddress(); - if (tx.from) { - tx.from = await resolveAddress(tx.from, getResolver(contract.runner)); - } - const iface = contract.interface; - const noValue = getBigInt(tx.value || BN_010, "overrides.value") === BN_010; - const noData = (tx.data || "0x") === "0x"; - if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) { - assertArgument(false, "cannot send data to receive or send value to non-payable fallback", "overrides", overrides); - } - assertArgument(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data); - const payable = iface.receive || iface.fallback && iface.fallback.payable; - assertArgument(payable || noValue, "cannot send value to non-payable fallback", "overrides.value", tx.value); - assertArgument(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data); - return tx; - }; - const staticCall = async function(overrides) { - const runner = getRunner(contract.runner, "call"); - assert(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); - const tx = await populateTransaction(overrides); - try { - return await runner.call(tx); - } catch (error) { - if (isCallException(error) && error.data) { - throw contract.interface.makeError(error.data, tx); - } - throw error; - } - }; - const send = async function(overrides) { - const runner = contract.runner; - assert(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); - const tx = await runner.sendTransaction(await populateTransaction(overrides)); - const provider = getProvider(contract.runner); - return new ContractTransactionResponse(contract.interface, provider, tx); - }; - const estimateGas = async function(overrides) { - const runner = getRunner(contract.runner, "estimateGas"); - assert(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); - return await runner.estimateGas(await populateTransaction(overrides)); - }; - const method = async (overrides) => { - return await send(overrides); - }; - defineProperties(method, { - _contract: contract, - estimateGas, - populateTransaction, - send, - staticCall - }); - return method; -} -function buildWrappedMethod(contract, key) { - const getFragment = function(...args) { - const fragment = contract.interface.getFunction(key, args); - assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { - operation: "fragment", - info: { key, args } - }); - return fragment; - }; - const populateTransaction = async function(...args) { - const fragment = getFragment(...args); - let overrides = {}; - if (fragment.inputs.length + 1 === args.length) { - overrides = await copyOverrides(args.pop()); - if (overrides.from) { - overrides.from = await resolveAddress(overrides.from, getResolver(contract.runner)); - } - } - if (fragment.inputs.length !== args.length) { - throw new Error("internal error: fragment inputs doesn't match arguments; should not happen"); - } - const resolvedArgs = await resolveArgs(contract.runner, fragment.inputs, args); - return Object.assign({}, overrides, await resolveProperties({ - to: contract.getAddress(), - data: contract.interface.encodeFunctionData(fragment, resolvedArgs) - })); - }; - const staticCall = async function(...args) { - const result = await staticCallResult(...args); - if (result.length === 1) { - return result[0]; - } - return result; - }; - const send = async function(...args) { - const runner = contract.runner; - assert(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); - const tx = await runner.sendTransaction(await populateTransaction(...args)); - const provider = getProvider(contract.runner); - return new ContractTransactionResponse(contract.interface, provider, tx); - }; - const estimateGas = async function(...args) { - const runner = getRunner(contract.runner, "estimateGas"); - assert(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); - return await runner.estimateGas(await populateTransaction(...args)); - }; - const staticCallResult = async function(...args) { - const runner = getRunner(contract.runner, "call"); - assert(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); - const tx = await populateTransaction(...args); - let result = "0x"; - try { - result = await runner.call(tx); - } catch (error) { - if (isCallException(error) && error.data) { - throw contract.interface.makeError(error.data, tx); - } - throw error; - } - const fragment = getFragment(...args); - return contract.interface.decodeFunctionResult(fragment, result); - }; - const method = async (...args) => { - const fragment = getFragment(...args); - if (fragment.constant) { - return await staticCall(...args); - } - return await send(...args); - }; - defineProperties(method, { - name: contract.interface.getFunctionName(key), - _contract: contract, - _key: key, - getFragment, - estimateGas, - populateTransaction, - send, - staticCall, - staticCallResult - }); - Object.defineProperty(method, "fragment", { - configurable: false, - enumerable: true, - get: () => { - const fragment = contract.interface.getFunction(key); - assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { - operation: "fragment", - info: { key } - }); - return fragment; - } - }); - return method; -} -function buildWrappedEvent(contract, key) { - const getFragment = function(...args) { - const fragment = contract.interface.getEvent(key, args); - assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { - operation: "fragment", - info: { key, args } - }); - return fragment; - }; - const method = function(...args) { - return new PreparedTopicFilter(contract, getFragment(...args), args); - }; - defineProperties(method, { - name: contract.interface.getEventName(key), - _contract: contract, - _key: key, - getFragment - }); - Object.defineProperty(method, "fragment", { - configurable: false, - enumerable: true, - get: () => { - const fragment = contract.interface.getEvent(key); - assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { - operation: "fragment", - info: { key } - }); - return fragment; - } - }); - return method; -} -var internal2 = Symbol.for("_ethersInternal_contract"); -var internalValues = /* @__PURE__ */ new WeakMap(); -function setInternal(contract, values) { - internalValues.set(contract[internal2], values); -} -function getInternal(contract) { - return internalValues.get(contract[internal2]); -} -function isDeferred(value) { - return value && typeof value === "object" && "getTopicFilter" in value && typeof value.getTopicFilter === "function" && value.fragment; -} -async function getSubInfo(contract, event) { - let topics; - let fragment = null; - if (Array.isArray(event)) { - const topicHashify = function(name) { - if (isHexString(name, 32)) { - return name; - } - const fragment2 = contract.interface.getEvent(name); - assertArgument(fragment2, "unknown fragment", "name", name); - return fragment2.topicHash; - }; - topics = event.map((e) => { - if (e == null) { - return null; - } - if (Array.isArray(e)) { - return e.map(topicHashify); - } - return topicHashify(e); - }); - } else if (event === "*") { - topics = [null]; - } else if (typeof event === "string") { - if (isHexString(event, 32)) { - topics = [event]; - } else { - fragment = contract.interface.getEvent(event); - assertArgument(fragment, "unknown fragment", "event", event); - topics = [fragment.topicHash]; - } - } else if (isDeferred(event)) { - topics = await event.getTopicFilter(); - } else if ("fragment" in event) { - fragment = event.fragment; - topics = [fragment.topicHash]; - } else { - assertArgument(false, "unknown event name", "event", event); - } - topics = topics.map((t) => { - if (t == null) { - return null; - } - if (Array.isArray(t)) { - const items = Array.from(new Set(t.map((t2) => t2.toLowerCase())).values()); - if (items.length === 1) { - return items[0]; - } - items.sort(); - return items; - } - return t.toLowerCase(); - }); - const tag = topics.map((t) => { - if (t == null) { - return "null"; - } - if (Array.isArray(t)) { - return t.join("|"); - } - return t; - }).join("&"); - return { fragment, tag, topics }; -} -async function hasSub(contract, event) { - const { subs } = getInternal(contract); - return subs.get((await getSubInfo(contract, event)).tag) || null; -} -async function getSub(contract, operation, event) { - const provider = getProvider(contract.runner); - assert(provider, "contract runner does not support subscribing", "UNSUPPORTED_OPERATION", { operation }); - const { fragment, tag, topics } = await getSubInfo(contract, event); - const { addr, subs } = getInternal(contract); - let sub = subs.get(tag); - if (!sub) { - const address = addr ? addr : contract; - const filter = { address, topics }; - const listener = (log) => { - let foundFragment = fragment; - if (foundFragment == null) { - try { - foundFragment = contract.interface.getEvent(log.topics[0]); - } catch (error) { - } - } - if (foundFragment) { - const _foundFragment = foundFragment; - const args = fragment ? contract.interface.decodeEventLog(fragment, log.data, log.topics) : []; - emit(contract, event, args, (listener2) => { - return new ContractEventPayload(contract, listener2, event, _foundFragment, log); - }); - } else { - emit(contract, event, [], (listener2) => { - return new ContractUnknownEventPayload(contract, listener2, event, log); - }); - } - }; - let starting = []; - const start = () => { - if (starting.length) { - return; - } - starting.push(provider.on(filter, listener)); - }; - const stop = async () => { - if (starting.length == 0) { - return; - } - let started = starting; - starting = []; - await Promise.all(started); - provider.off(filter, listener); - }; - sub = { tag, listeners: [], start, stop }; - subs.set(tag, sub); - } - return sub; -} -var lastEmit = Promise.resolve(); -async function _emit(contract, event, args, payloadFunc) { - await lastEmit; - const sub = await hasSub(contract, event); - if (!sub) { - return false; - } - const count = sub.listeners.length; - sub.listeners = sub.listeners.filter(({ listener, once }) => { - const passArgs = Array.from(args); - if (payloadFunc) { - passArgs.push(payloadFunc(once ? null : listener)); - } - try { - listener.call(contract, ...passArgs); - } catch (error) { - } - return !once; - }); - if (sub.listeners.length === 0) { - sub.stop(); - getInternal(contract).subs.delete(sub.tag); - } - return count > 0; -} -async function emit(contract, event, args, payloadFunc) { - try { - await lastEmit; - } catch (error) { - } - const resultPromise = _emit(contract, event, args, payloadFunc); - lastEmit = resultPromise; - return await resultPromise; -} -var passProperties2 = ["then"]; -var _a; -var _BaseContract = class _BaseContract { - /** - * Creates a new contract connected to %%target%% with the %%abi%% and - * optionally connected to a %%runner%% to perform operations on behalf - * of. - */ - constructor(target, abi, runner, _deployTx) { - /** - * The target to connect to. - * - * This can be an address, ENS name or any [[Addressable]], such as - * another contract. To get the resovled address, use the ``getAddress`` - * method. - */ - __publicField(this, "target"); - /** - * The contract Interface. - */ - __publicField(this, "interface"); - /** - * The connected runner. This is generally a [[Provider]] or a - * [[Signer]], which dictates what operations are supported. - * - * For example, a **Contract** connected to a [[Provider]] may - * only execute read-only operations. - */ - __publicField(this, "runner"); - /** - * All the Events available on this contract. - */ - __publicField(this, "filters"); - /** - * @_ignore: - */ - __publicField(this, _a); - /** - * The fallback or receive function if any. - */ - __publicField(this, "fallback"); - assertArgument(typeof target === "string" || isAddressable(target), "invalid value for Contract target", "target", target); - if (runner == null) { - runner = null; - } - const iface = Interface.from(abi); - defineProperties(this, { target, runner, interface: iface }); - Object.defineProperty(this, internal2, { value: {} }); - let addrPromise; - let addr = null; - let deployTx = null; - if (_deployTx) { - const provider = getProvider(runner); - deployTx = new ContractTransactionResponse(this.interface, provider, _deployTx); - } - let subs = /* @__PURE__ */ new Map(); - if (typeof target === "string") { - if (isHexString(target)) { - addr = target; - addrPromise = Promise.resolve(target); - } else { - const resolver = getRunner(runner, "resolveName"); - if (!canResolve(resolver)) { - throw makeError("contract runner does not support name resolution", "UNSUPPORTED_OPERATION", { - operation: "resolveName" - }); - } - addrPromise = resolver.resolveName(target).then((addr2) => { - if (addr2 == null) { - throw makeError("an ENS name used for a contract target must be correctly configured", "UNCONFIGURED_NAME", { - value: target - }); - } - getInternal(this).addr = addr2; - return addr2; - }); - } - } else { - addrPromise = target.getAddress().then((addr2) => { - if (addr2 == null) { - throw new Error("TODO"); - } - getInternal(this).addr = addr2; - return addr2; - }); - } - setInternal(this, { addrPromise, addr, deployTx, subs }); - const filters = new Proxy({}, { - get: (target2, prop, receiver) => { - if (typeof prop === "symbol" || passProperties2.indexOf(prop) >= 0) { - return Reflect.get(target2, prop, receiver); - } - try { - return this.getEvent(prop); - } catch (error) { - if (!isError(error, "INVALID_ARGUMENT") || error.argument !== "key") { - throw error; - } - } - return void 0; - }, - has: (target2, prop) => { - if (passProperties2.indexOf(prop) >= 0) { - return Reflect.has(target2, prop); - } - return Reflect.has(target2, prop) || this.interface.hasEvent(String(prop)); - } - }); - defineProperties(this, { filters }); - defineProperties(this, { - fallback: iface.receive || iface.fallback ? buildWrappedFallback(this) : null - }); - return new Proxy(this, { - get: (target2, prop, receiver) => { - if (typeof prop === "symbol" || prop in target2 || passProperties2.indexOf(prop) >= 0) { - return Reflect.get(target2, prop, receiver); - } - try { - return target2.getFunction(prop); - } catch (error) { - if (!isError(error, "INVALID_ARGUMENT") || error.argument !== "key") { - throw error; - } - } - return void 0; - }, - has: (target2, prop) => { - if (typeof prop === "symbol" || prop in target2 || passProperties2.indexOf(prop) >= 0) { - return Reflect.has(target2, prop); - } - return target2.interface.hasFunction(prop); - } - }); - } - /** - * Return a new Contract instance with the same target and ABI, but - * a different %%runner%%. - */ - connect(runner) { - return new _BaseContract(this.target, this.interface, runner); - } - /** - * Return a new Contract instance with the same ABI and runner, but - * a different %%target%%. - */ - attach(target) { - return new _BaseContract(target, this.interface, this.runner); - } - /** - * Return the resolved address of this Contract. - */ - async getAddress() { - return await getInternal(this).addrPromise; - } - /** - * Return the deployed bytecode or null if no bytecode is found. - */ - async getDeployedCode() { - const provider = getProvider(this.runner); - assert(provider, "runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "getDeployedCode" }); - const code = await provider.getCode(await this.getAddress()); - if (code === "0x") { - return null; - } - return code; - } - /** - * Resolve to this Contract once the bytecode has been deployed, or - * resolve immediately if already deployed. - */ - async waitForDeployment() { - const deployTx = this.deploymentTransaction(); - if (deployTx) { - await deployTx.wait(); - return this; - } - const code = await this.getDeployedCode(); - if (code != null) { - return this; - } - const provider = getProvider(this.runner); - assert(provider != null, "contract runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "waitForDeployment" }); - return new Promise((resolve, reject) => { - const checkCode = async () => { - try { - const code2 = await this.getDeployedCode(); - if (code2 != null) { - return resolve(this); - } - provider.once("block", checkCode); - } catch (error) { - reject(error); - } - }; - checkCode(); - }); - } - /** - * Return the transaction used to deploy this contract. - * - * This is only available if this instance was returned from a - * [[ContractFactory]]. - */ - deploymentTransaction() { - return getInternal(this).deployTx; - } - /** - * Return the function for a given name. This is useful when a contract - * method name conflicts with a JavaScript name such as ``prototype`` or - * when using a Contract programatically. - */ - getFunction(key) { - if (typeof key !== "string") { - key = key.format(); - } - const func = buildWrappedMethod(this, key); - return func; - } - /** - * Return the event for a given name. This is useful when a contract - * event name conflicts with a JavaScript name such as ``prototype`` or - * when using a Contract programatically. - */ - getEvent(key) { - if (typeof key !== "string") { - key = key.format(); - } - return buildWrappedEvent(this, key); - } - /** - * @_ignore: - */ - async queryTransaction(hash2) { - throw new Error("@TODO"); - } - /* - // @TODO: this is a non-backwards compatible change, but will be added - // in v7 and in a potential SmartContract class in an upcoming - // v6 release - async getTransactionReceipt(hash: string): Promise { - const provider = getProvider(this.runner); - assert(provider, "contract runner does not have a provider", - "UNSUPPORTED_OPERATION", { operation: "queryTransaction" }); - - const receipt = await provider.getTransactionReceipt(hash); - if (receipt == null) { return null; } - - return new ContractTransactionReceipt(this.interface, provider, receipt); - } - */ - /** - * Provide historic access to event data for %%event%% in the range - * %%fromBlock%% (default: ``0``) to %%toBlock%% (default: ``"latest"``) - * inclusive. - */ - async queryFilter(event, fromBlock, toBlock) { - if (fromBlock == null) { - fromBlock = 0; - } - if (toBlock == null) { - toBlock = "latest"; - } - const { addr, addrPromise } = getInternal(this); - const address = addr ? addr : await addrPromise; - const { fragment, topics } = await getSubInfo(this, event); - const filter = { address, topics, fromBlock, toBlock }; - const provider = getProvider(this.runner); - assert(provider, "contract runner does not have a provider", "UNSUPPORTED_OPERATION", { operation: "queryFilter" }); - return (await provider.getLogs(filter)).map((log) => { - let foundFragment = fragment; - if (foundFragment == null) { - try { - foundFragment = this.interface.getEvent(log.topics[0]); - } catch (error) { - } - } - if (foundFragment) { - try { - return new EventLog(log, this.interface, foundFragment); - } catch (error) { - return new UndecodedEventLog(log, error); - } - } - return new Log(log, provider); - }); - } - /** - * Add an event %%listener%% for the %%event%%. - */ - async on(event, listener) { - const sub = await getSub(this, "on", event); - sub.listeners.push({ listener, once: false }); - sub.start(); - return this; - } - /** - * Add an event %%listener%% for the %%event%%, but remove the listener - * after it is fired once. - */ - async once(event, listener) { - const sub = await getSub(this, "once", event); - sub.listeners.push({ listener, once: true }); - sub.start(); - return this; - } - /** - * Emit an %%event%% calling all listeners with %%args%%. - * - * Resolves to ``true`` if any listeners were called. - */ - async emit(event, ...args) { - return await emit(this, event, args, null); - } - /** - * Resolves to the number of listeners of %%event%% or the total number - * of listeners if unspecified. - */ - async listenerCount(event) { - if (event) { - const sub = await hasSub(this, event); - if (!sub) { - return 0; - } - return sub.listeners.length; - } - const { subs } = getInternal(this); - let total = 0; - for (const { listeners } of subs.values()) { - total += listeners.length; - } - return total; - } - /** - * Resolves to the listeners subscribed to %%event%% or all listeners - * if unspecified. - */ - async listeners(event) { - if (event) { - const sub = await hasSub(this, event); - if (!sub) { - return []; - } - return sub.listeners.map(({ listener }) => listener); - } - const { subs } = getInternal(this); - let result = []; - for (const { listeners } of subs.values()) { - result = result.concat(listeners.map(({ listener }) => listener)); - } - return result; - } - /** - * Remove the %%listener%% from the listeners for %%event%% or remove - * all listeners if unspecified. - */ - async off(event, listener) { - const sub = await hasSub(this, event); - if (!sub) { - return this; - } - if (listener) { - const index = sub.listeners.map(({ listener: listener2 }) => listener2).indexOf(listener); - if (index >= 0) { - sub.listeners.splice(index, 1); - } - } - if (listener == null || sub.listeners.length === 0) { - sub.stop(); - getInternal(this).subs.delete(sub.tag); - } - return this; - } - /** - * Remove all the listeners for %%event%% or remove all listeners if - * unspecified. - */ - async removeAllListeners(event) { - if (event) { - const sub = await hasSub(this, event); - if (!sub) { - return this; - } - sub.stop(); - getInternal(this).subs.delete(sub.tag); - } else { - const { subs } = getInternal(this); - for (const { tag, stop } of subs.values()) { - stop(); - subs.delete(tag); - } - } - return this; - } - /** - * Alias for [on]. - */ - async addListener(event, listener) { - return await this.on(event, listener); - } - /** - * Alias for [off]. - */ - async removeListener(event, listener) { - return await this.off(event, listener); - } - /** - * Create a new Class for the %%abi%%. - */ - static buildClass(abi) { - class CustomContract extends _BaseContract { - constructor(address, runner = null) { - super(address, abi, runner); - } - } - return CustomContract; - } - /** - * Create a new BaseContract with a specified Interface. - */ - static from(target, abi, runner) { - if (runner == null) { - runner = null; - } - const contract = new this(target, abi, runner); - return contract; - } -}; -_a = internal2; -var BaseContract = _BaseContract; -function _ContractBase() { - return BaseContract; -} -var Contract = class extends _ContractBase() { -}; - -// node_modules/ethers/lib.esm/contract/factory.js -var ContractFactory = class _ContractFactory { - /** - * Create a new **ContractFactory** with %%abi%% and %%bytecode%%, - * optionally connected to %%runner%%. - * - * The %%bytecode%% may be the ``bytecode`` property within the - * standard Solidity JSON output. - */ - constructor(abi, bytecode, runner) { - /** - * The Contract Interface. - */ - __publicField(this, "interface"); - /** - * The Contract deployment bytecode. Often called the initcode. - */ - __publicField(this, "bytecode"); - /** - * The ContractRunner to deploy the Contract as. - */ - __publicField(this, "runner"); - const iface = Interface.from(abi); - if (bytecode instanceof Uint8Array) { - bytecode = hexlify(getBytes(bytecode)); - } else { - if (typeof bytecode === "object") { - bytecode = bytecode.object; - } - if (!bytecode.startsWith("0x")) { - bytecode = "0x" + bytecode; - } - bytecode = hexlify(getBytes(bytecode)); - } - defineProperties(this, { - bytecode, - interface: iface, - runner: runner || null - }); - } - attach(target) { - return new BaseContract(target, this.interface, this.runner); - } - /** - * Resolves to the transaction to deploy the contract, passing %%args%% - * into the constructor. - */ - async getDeployTransaction(...args) { - let overrides = {}; - const fragment = this.interface.deploy; - if (fragment.inputs.length + 1 === args.length) { - overrides = await copyOverrides(args.pop()); - } - if (fragment.inputs.length !== args.length) { - throw new Error("incorrect number of arguments to constructor"); - } - const resolvedArgs = await resolveArgs(this.runner, fragment.inputs, args); - const data = concat([this.bytecode, this.interface.encodeDeploy(resolvedArgs)]); - return Object.assign({}, overrides, { data }); - } - /** - * Resolves to the Contract deployed by passing %%args%% into the - * constructor. - * - * This will resolve to the Contract before it has been deployed to the - * network, so the [[BaseContract-waitForDeployment]] should be used before - * sending any transactions to it. - */ - async deploy(...args) { - const tx = await this.getDeployTransaction(...args); - assert(this.runner && typeof this.runner.sendTransaction === "function", "factory runner does not support sending transactions", "UNSUPPORTED_OPERATION", { - operation: "sendTransaction" - }); - const sentTx = await this.runner.sendTransaction(tx); - const address = getCreateAddress(sentTx); - return new BaseContract(address, this.interface, this.runner, sentTx); - } - /** - * Return a new **ContractFactory** with the same ABI and bytecode, - * but connected to %%runner%%. - */ - connect(runner) { - return new _ContractFactory(this.interface, this.bytecode, runner); - } - /** - * Create a new **ContractFactory** from the standard Solidity JSON output. - */ - static fromSolidity(output2, runner) { - assertArgument(output2 != null, "bad compiler output", "output", output2); - if (typeof output2 === "string") { - output2 = JSON.parse(output2); - } - const abi = output2.abi; - let bytecode = ""; - if (output2.bytecode) { - bytecode = output2.bytecode; - } else if (output2.evm && output2.evm.bytecode) { - bytecode = output2.evm.bytecode; - } - return new this(abi, bytecode, runner); - } -}; - -// node_modules/ethers/lib.esm/providers/ens-resolver.js -function getIpfsLink(link) { - if (link.match(/^ipfs:\/\/ipfs\//i)) { - link = link.substring(12); - } else if (link.match(/^ipfs:\/\//i)) { - link = link.substring(7); - } else { - assertArgument(false, "unsupported IPFS format", "link", link); - } - return `https://gateway.ipfs.io/ipfs/${link}`; -} -var MulticoinProviderPlugin = class { - /** - * Creates a new **MulticoinProviderPluing** for %%name%%. - */ - constructor(name) { - /** - * The name. - */ - __publicField(this, "name"); - defineProperties(this, { name }); - } - connect(proivder) { - return this; - } - /** - * Returns ``true`` if %%coinType%% is supported by this plugin. - */ - supportsCoinType(coinType) { - return false; - } - /** - * Resovles to the encoded %%address%% for %%coinType%%. - */ - async encodeAddress(coinType, address) { - throw new Error("unsupported coin"); - } - /** - * Resovles to the decoded %%data%% for %%coinType%%. - */ - async decodeAddress(coinType, data) { - throw new Error("unsupported coin"); - } -}; -var matcherIpfs = new RegExp("^(ipfs)://(.*)$", "i"); -var matchers = [ - new RegExp("^(https)://(.*)$", "i"), - new RegExp("^(data):(.*)$", "i"), - matcherIpfs, - new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i") -]; -var _supports2544, _resolver, _fetch, fetch_fn, _getResolver, getResolver_fn; -var _EnsResolver = class _EnsResolver { - constructor(provider, address, name) { - __privateAdd(this, _fetch); - /** - * The connected provider. - */ - __publicField(this, "provider"); - /** - * The address of the resolver. - */ - __publicField(this, "address"); - /** - * The name this resolver was resolved against. - */ - __publicField(this, "name"); - // For EIP-2544 names, the ancestor that provided the resolver - __privateAdd(this, _supports2544, void 0); - __privateAdd(this, _resolver, void 0); - defineProperties(this, { provider, address, name }); - __privateSet(this, _supports2544, null); - __privateSet(this, _resolver, new Contract(address, [ - "function supportsInterface(bytes4) view returns (bool)", - "function resolve(bytes, bytes) view returns (bytes)", - "function addr(bytes32) view returns (address)", - "function addr(bytes32, uint) view returns (bytes)", - "function text(bytes32, string) view returns (string)", - "function contenthash(bytes32) view returns (bytes)" - ], provider)); - } - /** - * Resolves to true if the resolver supports wildcard resolution. - */ - async supportsWildcard() { - if (__privateGet(this, _supports2544) == null) { - __privateSet(this, _supports2544, (async () => { - try { - return await __privateGet(this, _resolver).supportsInterface("0x9061b923"); - } catch (error) { - if (isError(error, "CALL_EXCEPTION")) { - return false; - } - __privateSet(this, _supports2544, null); - throw error; - } - })()); - } - return await __privateGet(this, _supports2544); - } - /** - * Resolves to the address for %%coinType%% or null if the - * provided %%coinType%% has not been configured. - */ - async getAddress(coinType) { - if (coinType == null) { - coinType = 60; - } - if (coinType === 60) { - try { - const result = await __privateMethod(this, _fetch, fetch_fn).call(this, "addr(bytes32)"); - if (result == null || result === ZeroAddress) { - return null; - } - return result; - } catch (error) { - if (isError(error, "CALL_EXCEPTION")) { - return null; - } - throw error; - } - } - if (coinType >= 0 && coinType < 2147483648) { - let ethCoinType = coinType + 2147483648; - const data2 = await __privateMethod(this, _fetch, fetch_fn).call(this, "addr(bytes32,uint)", [ethCoinType]); - if (isHexString(data2, 20)) { - return getAddress(data2); - } - } - let coinPlugin = null; - for (const plugin of this.provider.plugins) { - if (!(plugin instanceof MulticoinProviderPlugin)) { - continue; - } - if (plugin.supportsCoinType(coinType)) { - coinPlugin = plugin; - break; - } - } - if (coinPlugin == null) { - return null; - } - const data = await __privateMethod(this, _fetch, fetch_fn).call(this, "addr(bytes32,uint)", [coinType]); - if (data == null || data === "0x") { - return null; - } - const address = await coinPlugin.decodeAddress(coinType, data); - if (address != null) { - return address; - } - assert(false, `invalid coin data`, "UNSUPPORTED_OPERATION", { - operation: `getAddress(${coinType})`, - info: { coinType, data } - }); - } - /** - * Resolves to the EIP-634 text record for %%key%%, or ``null`` - * if unconfigured. - */ - async getText(key) { - const data = await __privateMethod(this, _fetch, fetch_fn).call(this, "text(bytes32,string)", [key]); - if (data == null || data === "0x") { - return null; - } - return data; - } - /** - * Rsolves to the content-hash or ``null`` if unconfigured. - */ - async getContentHash() { - const data = await __privateMethod(this, _fetch, fetch_fn).call(this, "contenthash(bytes32)"); - if (data == null || data === "0x") { - return null; - } - const ipfs = data.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); - if (ipfs) { - const scheme = ipfs[1] === "e3010170" ? "ipfs" : "ipns"; - const length = parseInt(ipfs[4], 16); - if (ipfs[5].length === length * 2) { - return `${scheme}://${encodeBase58("0x" + ipfs[2])}`; - } - } - const swarm = data.match(/^0xe40101fa011b20([0-9a-f]*)$/); - if (swarm && swarm[1].length === 64) { - return `bzz://${swarm[1]}`; - } - assert(false, `invalid or unsupported content hash data`, "UNSUPPORTED_OPERATION", { - operation: "getContentHash()", - info: { data } - }); - } - /** - * Resolves to the avatar url or ``null`` if the avatar is either - * unconfigured or incorrectly configured (e.g. references an NFT - * not owned by the address). - * - * If diagnosing issues with configurations, the [[_getAvatar]] - * method may be useful. - */ - async getAvatar() { - const avatar = await this._getAvatar(); - return avatar.url; - } - /** - * When resolving an avatar, there are many steps involved, such - * fetching metadata and possibly validating ownership of an - * NFT. - * - * This method can be used to examine each step and the value it - * was working from. - */ - async _getAvatar() { - const linkage = [{ type: "name", value: this.name }]; - try { - const avatar = await this.getText("avatar"); - if (avatar == null) { - linkage.push({ type: "!avatar", value: "" }); - return { url: null, linkage }; - } - linkage.push({ type: "avatar", value: avatar }); - for (let i = 0; i < matchers.length; i++) { - const match = avatar.match(matchers[i]); - if (match == null) { - continue; - } - const scheme = match[1].toLowerCase(); - switch (scheme) { - case "https": - case "data": - linkage.push({ type: "url", value: avatar }); - return { linkage, url: avatar }; - case "ipfs": { - const url = getIpfsLink(avatar); - linkage.push({ type: "ipfs", value: avatar }); - linkage.push({ type: "url", value: url }); - return { linkage, url }; - } - case "erc721": - case "erc1155": { - const selector = scheme === "erc721" ? "tokenURI(uint256)" : "uri(uint256)"; - linkage.push({ type: scheme, value: avatar }); - const owner = await this.getAddress(); - if (owner == null) { - linkage.push({ type: "!owner", value: "" }); - return { url: null, linkage }; - } - const comps = (match[2] || "").split("/"); - if (comps.length !== 2) { - linkage.push({ type: `!${scheme}caip`, value: match[2] || "" }); - return { url: null, linkage }; - } - const tokenId = comps[1]; - const contract = new Contract(comps[0], [ - // ERC-721 - "function tokenURI(uint) view returns (string)", - "function ownerOf(uint) view returns (address)", - // ERC-1155 - "function uri(uint) view returns (string)", - "function balanceOf(address, uint256) view returns (uint)" - ], this.provider); - if (scheme === "erc721") { - const tokenOwner = await contract.ownerOf(tokenId); - if (owner !== tokenOwner) { - linkage.push({ type: "!owner", value: tokenOwner }); - return { url: null, linkage }; - } - linkage.push({ type: "owner", value: tokenOwner }); - } else if (scheme === "erc1155") { - const balance = await contract.balanceOf(owner, tokenId); - if (!balance) { - linkage.push({ type: "!balance", value: "0" }); - return { url: null, linkage }; - } - linkage.push({ type: "balance", value: balance.toString() }); - } - let metadataUrl = await contract[selector](tokenId); - if (metadataUrl == null || metadataUrl === "0x") { - linkage.push({ type: "!metadata-url", value: "" }); - return { url: null, linkage }; - } - linkage.push({ type: "metadata-url-base", value: metadataUrl }); - if (scheme === "erc1155") { - metadataUrl = metadataUrl.replace("{id}", toBeHex(tokenId, 32).substring(2)); - linkage.push({ type: "metadata-url-expanded", value: metadataUrl }); - } - if (metadataUrl.match(/^ipfs:/i)) { - metadataUrl = getIpfsLink(metadataUrl); - } - linkage.push({ type: "metadata-url", value: metadataUrl }); - let metadata = {}; - const response = await new FetchRequest(metadataUrl).send(); - response.assertOk(); - try { - metadata = response.bodyJson; - } catch (error) { - try { - linkage.push({ type: "!metadata", value: response.bodyText }); - } catch (error2) { - const bytes2 = response.body; - if (bytes2) { - linkage.push({ type: "!metadata", value: hexlify(bytes2) }); - } - return { url: null, linkage }; - } - return { url: null, linkage }; - } - if (!metadata) { - linkage.push({ type: "!metadata", value: "" }); - return { url: null, linkage }; - } - linkage.push({ type: "metadata", value: JSON.stringify(metadata) }); - let imageUrl = metadata.image; - if (typeof imageUrl !== "string") { - linkage.push({ type: "!imageUrl", value: "" }); - return { url: null, linkage }; - } - if (imageUrl.match(/^(https:\/\/|data:)/i)) { - } else { - const ipfs = imageUrl.match(matcherIpfs); - if (ipfs == null) { - linkage.push({ type: "!imageUrl-ipfs", value: imageUrl }); - return { url: null, linkage }; - } - linkage.push({ type: "imageUrl-ipfs", value: imageUrl }); - imageUrl = getIpfsLink(imageUrl); - } - linkage.push({ type: "url", value: imageUrl }); - return { linkage, url: imageUrl }; - } - } - } - } catch (error) { - } - return { linkage, url: null }; - } - static async getEnsAddress(provider) { - const network = await provider.getNetwork(); - const ensPlugin = network.getPlugin("org.ethers.plugins.network.Ens"); - assert(ensPlugin, "network does not support ENS", "UNSUPPORTED_OPERATION", { - operation: "getEnsAddress", - info: { network } - }); - return ensPlugin.address; - } - /** - * Resolve to the ENS resolver for %%name%% using %%provider%% or - * ``null`` if unconfigured. - */ - static async fromName(provider, name) { - var _a2; - let currentName = name; - while (true) { - if (currentName === "" || currentName === ".") { - return null; - } - if (name !== "eth" && currentName === "eth") { - return null; - } - const addr = await __privateMethod(_a2 = _EnsResolver, _getResolver, getResolver_fn).call(_a2, provider, currentName); - if (addr != null) { - const resolver = new _EnsResolver(provider, addr, name); - if (currentName !== name && !await resolver.supportsWildcard()) { - return null; - } - return resolver; - } - currentName = currentName.split(".").slice(1).join("."); - } - } -}; -_supports2544 = new WeakMap(); -_resolver = new WeakMap(); -_fetch = new WeakSet(); -fetch_fn = async function(funcName, params) { - params = (params || []).slice(); - const iface = __privateGet(this, _resolver).interface; - params.unshift(namehash(this.name)); - let fragment = null; - if (await this.supportsWildcard()) { - fragment = iface.getFunction(funcName); - assert(fragment, "missing fragment", "UNKNOWN_ERROR", { - info: { funcName } - }); - params = [ - dnsEncode(this.name, 255), - iface.encodeFunctionData(fragment, params) - ]; - funcName = "resolve(bytes,bytes)"; - } - params.push({ - enableCcipRead: true - }); - try { - const result = await __privateGet(this, _resolver)[funcName](...params); - if (fragment) { - return iface.decodeFunctionResult(fragment, result)[0]; - } - return result; - } catch (error) { - if (!isError(error, "CALL_EXCEPTION")) { - throw error; - } - } - return null; -}; -_getResolver = new WeakSet(); -getResolver_fn = async function(provider, name) { - const ensAddr = await _EnsResolver.getEnsAddress(provider); - try { - const contract = new Contract(ensAddr, [ - "function resolver(bytes32) view returns (address)" - ], provider); - const addr = await contract.resolver(namehash(name), { - enableCcipRead: true - }); - if (addr === ZeroAddress) { - return null; - } - return addr; - } catch (error) { - throw error; - } - return null; -}; -__privateAdd(_EnsResolver, _getResolver); -var EnsResolver = _EnsResolver; - -// node_modules/ethers/lib.esm/providers/format.js -var BN_011 = BigInt(0); -function allowNull(format, nullValue) { - return function(value) { - if (value == null) { - return nullValue; - } - return format(value); - }; -} -function arrayOf(format, allowNull2) { - return (array) => { - if (allowNull2 && array == null) { - return null; - } - if (!Array.isArray(array)) { - throw new Error("not an array"); - } - return array.map((i) => format(i)); - }; -} -function object(format, altNames) { - return (value) => { - const result = {}; - for (const key in format) { - let srcKey = key; - if (altNames && key in altNames && !(srcKey in value)) { - for (const altKey of altNames[key]) { - if (altKey in value) { - srcKey = altKey; - break; - } - } - } - try { - const nv = format[key](value[srcKey]); - if (nv !== void 0) { - result[key] = nv; - } - } catch (error) { - const message = error instanceof Error ? error.message : "not-an-error"; - assert(false, `invalid value for value.${key} (${message})`, "BAD_DATA", { value }); - } - } - return result; - }; -} -function formatBoolean(value) { - switch (value) { - case true: - case "true": - return true; - case false: - case "false": - return false; - } - assertArgument(false, `invalid boolean; ${JSON.stringify(value)}`, "value", value); -} -function formatData(value) { - assertArgument(isHexString(value, true), "invalid data", "value", value); - return value; -} -function formatHash(value) { - assertArgument(isHexString(value, 32), "invalid hash", "value", value); - return value; -} -var _formatLog = object({ - address: getAddress, - blockHash: formatHash, - blockNumber: getNumber, - data: formatData, - index: getNumber, - removed: allowNull(formatBoolean, false), - topics: arrayOf(formatHash), - transactionHash: formatHash, - transactionIndex: getNumber -}, { - index: ["logIndex"] -}); -function formatLog(value) { - return _formatLog(value); -} -var _formatBlock = object({ - hash: allowNull(formatHash), - parentHash: formatHash, - parentBeaconBlockRoot: allowNull(formatHash, null), - number: getNumber, - timestamp: getNumber, - nonce: allowNull(formatData), - difficulty: getBigInt, - gasLimit: getBigInt, - gasUsed: getBigInt, - stateRoot: allowNull(formatHash, null), - receiptsRoot: allowNull(formatHash, null), - blobGasUsed: allowNull(getBigInt, null), - excessBlobGas: allowNull(getBigInt, null), - miner: allowNull(getAddress), - extraData: formatData, - baseFeePerGas: allowNull(getBigInt) -}); -function formatBlock(value) { - const result = _formatBlock(value); - result.transactions = value.transactions.map((tx) => { - if (typeof tx === "string") { - return tx; - } - return formatTransactionResponse(tx); - }); - return result; -} -var _formatReceiptLog = object({ - transactionIndex: getNumber, - blockNumber: getNumber, - transactionHash: formatHash, - address: getAddress, - topics: arrayOf(formatHash), - data: formatData, - index: getNumber, - blockHash: formatHash -}, { - index: ["logIndex"] -}); -function formatReceiptLog(value) { - return _formatReceiptLog(value); -} -var _formatTransactionReceipt = object({ - to: allowNull(getAddress, null), - from: allowNull(getAddress, null), - contractAddress: allowNull(getAddress, null), - // should be allowNull(hash), but broken-EIP-658 support is handled in receipt - index: getNumber, - root: allowNull(hexlify), - gasUsed: getBigInt, - blobGasUsed: allowNull(getBigInt, null), - logsBloom: allowNull(formatData), - blockHash: formatHash, - hash: formatHash, - logs: arrayOf(formatReceiptLog), - blockNumber: getNumber, - //confirmations: allowNull(getNumber, null), - cumulativeGasUsed: getBigInt, - effectiveGasPrice: allowNull(getBigInt), - blobGasPrice: allowNull(getBigInt, null), - status: allowNull(getNumber), - type: allowNull(getNumber, 0) -}, { - effectiveGasPrice: ["gasPrice"], - hash: ["transactionHash"], - index: ["transactionIndex"] -}); -function formatTransactionReceipt(value) { - return _formatTransactionReceipt(value); -} -function formatTransactionResponse(value) { - if (value.to && getBigInt(value.to) === BN_011) { - value.to = "0x0000000000000000000000000000000000000000"; - } - const result = object({ - hash: formatHash, - // Some nodes do not return this, usually test nodes (like Ganache) - index: allowNull(getNumber, void 0), - type: (value2) => { - if (value2 === "0x" || value2 == null) { - return 0; - } - return getNumber(value2); - }, - accessList: allowNull(accessListify, null), - blobVersionedHashes: allowNull(arrayOf(formatHash, true), null), - blockHash: allowNull(formatHash, null), - blockNumber: allowNull(getNumber, null), - transactionIndex: allowNull(getNumber, null), - from: getAddress, - // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) must be set - gasPrice: allowNull(getBigInt), - maxPriorityFeePerGas: allowNull(getBigInt), - maxFeePerGas: allowNull(getBigInt), - maxFeePerBlobGas: allowNull(getBigInt, null), - gasLimit: getBigInt, - to: allowNull(getAddress, null), - value: getBigInt, - nonce: getNumber, - data: formatData, - creates: allowNull(getAddress, null), - chainId: allowNull(getBigInt, null) - }, { - data: ["input"], - gasLimit: ["gas"], - index: ["transactionIndex"] - })(value); - if (result.to == null && result.creates == null) { - result.creates = getCreateAddress(result); - } - if ((value.type === 1 || value.type === 2) && value.accessList == null) { - result.accessList = []; - } - if (value.signature) { - result.signature = Signature.from(value.signature); - } else { - result.signature = Signature.from(value); - } - if (result.chainId == null) { - const chainId = result.signature.legacyChainId; - if (chainId != null) { - result.chainId = chainId; - } - } - if (result.blockHash && getBigInt(result.blockHash) === BN_011) { - result.blockHash = null; - } - return result; -} - -// node_modules/ethers/lib.esm/providers/plugins-network.js -var EnsAddress = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"; -var NetworkPlugin = class _NetworkPlugin { - /** - * Creates a new **NetworkPlugin**. - */ - constructor(name) { - /** - * The name of the plugin. - * - * It is recommended to use reverse-domain-notation, which permits - * unique names with a known authority as well as hierarchal entries. - */ - __publicField(this, "name"); - defineProperties(this, { name }); - } - /** - * Creates a copy of this plugin. - */ - clone() { - return new _NetworkPlugin(this.name); - } -}; -var GasCostPlugin = class _GasCostPlugin extends NetworkPlugin { - /** - * Creates a new GasCostPlugin from %%effectiveBlock%% until the - * latest block or another GasCostPlugin supercedes that block number, - * with the associated %%costs%%. - */ - constructor(effectiveBlock, costs) { - if (effectiveBlock == null) { - effectiveBlock = 0; - } - super(`org.ethers.network.plugins.GasCost#${effectiveBlock || 0}`); - /** - * The block number to treat these values as valid from. - * - * This allows a hardfork to have updated values included as well as - * mulutiple hardforks to be supported. - */ - __publicField(this, "effectiveBlock"); - /** - * The transactions base fee. - */ - __publicField(this, "txBase"); - /** - * The fee for creating a new account. - */ - __publicField(this, "txCreate"); - /** - * The fee per zero-byte in the data. - */ - __publicField(this, "txDataZero"); - /** - * The fee per non-zero-byte in the data. - */ - __publicField(this, "txDataNonzero"); - /** - * The fee per storage key in the [[link-eip-2930]] access list. - */ - __publicField(this, "txAccessListStorageKey"); - /** - * The fee per address in the [[link-eip-2930]] access list. - */ - __publicField(this, "txAccessListAddress"); - const props = { effectiveBlock }; - function set(name, nullish) { - let value = (costs || {})[name]; - if (value == null) { - value = nullish; - } - assertArgument(typeof value === "number", `invalud value for ${name}`, "costs", costs); - props[name] = value; - } - set("txBase", 21e3); - set("txCreate", 32e3); - set("txDataZero", 4); - set("txDataNonzero", 16); - set("txAccessListStorageKey", 1900); - set("txAccessListAddress", 2400); - defineProperties(this, props); - } - clone() { - return new _GasCostPlugin(this.effectiveBlock, this); - } -}; -var EnsPlugin = class _EnsPlugin extends NetworkPlugin { - /** - * Creates a new **EnsPlugin** connected to %%address%% on the - * %%targetNetwork%%. The default ENS address and mainnet is used - * if unspecified. - */ - constructor(address, targetNetwork) { - super("org.ethers.plugins.network.Ens"); - /** - * The ENS Registrty Contract address. - */ - __publicField(this, "address"); - /** - * The chain ID that the ENS contract lives on. - */ - __publicField(this, "targetNetwork"); - defineProperties(this, { - address: address || EnsAddress, - targetNetwork: targetNetwork == null ? 1 : targetNetwork - }); - } - clone() { - return new _EnsPlugin(this.address, this.targetNetwork); - } -}; -var _feeDataFunc; -var _FeeDataNetworkPlugin = class _FeeDataNetworkPlugin extends NetworkPlugin { - /** - * Creates a new **FeeDataNetworkPlugin**. - */ - constructor(feeDataFunc) { - super("org.ethers.plugins.network.FeeData"); - __privateAdd(this, _feeDataFunc, void 0); - __privateSet(this, _feeDataFunc, feeDataFunc); - } - /** - * The fee data function provided to the constructor. - */ - get feeDataFunc() { - return __privateGet(this, _feeDataFunc); - } - /** - * Resolves to the fee data. - */ - async getFeeData(provider) { - return await __privateGet(this, _feeDataFunc).call(this, provider); - } - clone() { - return new _FeeDataNetworkPlugin(__privateGet(this, _feeDataFunc)); - } -}; -_feeDataFunc = new WeakMap(); -var FeeDataNetworkPlugin = _FeeDataNetworkPlugin; -var _url2, _processFunc; -var FetchUrlFeeDataNetworkPlugin = class extends NetworkPlugin { - /** - * Creates a new **FetchUrlFeeDataNetworkPlugin** which will - * be used when computing the fee data for the network. - */ - constructor(url, processFunc) { - super("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); - __privateAdd(this, _url2, void 0); - __privateAdd(this, _processFunc, void 0); - __privateSet(this, _url2, url); - __privateSet(this, _processFunc, processFunc); - } - /** - * The URL to initialize the FetchRequest with in %%processFunc%%. - */ - get url() { - return __privateGet(this, _url2); - } - /** - * The callback to use when computing the FeeData. - */ - get processFunc() { - return __privateGet(this, _processFunc); - } - // We are immutable, so we can serve as our own clone - clone() { - return this; - } -}; -_url2 = new WeakMap(); -_processFunc = new WeakMap(); - -// node_modules/ethers/lib.esm/providers/network.js -var Networks = /* @__PURE__ */ new Map(); -var _name, _chainId2, _plugins; -var _Network = class _Network { - /** - * Creates a new **Network** for %%name%% and %%chainId%%. - */ - constructor(name, chainId) { - __privateAdd(this, _name, void 0); - __privateAdd(this, _chainId2, void 0); - __privateAdd(this, _plugins, void 0); - __privateSet(this, _name, name); - __privateSet(this, _chainId2, getBigInt(chainId)); - __privateSet(this, _plugins, /* @__PURE__ */ new Map()); - } - /** - * Returns a JSON-compatible representation of a Network. - */ - toJSON() { - return { name: this.name, chainId: String(this.chainId) }; - } - /** - * The network common name. - * - * This is the canonical name, as networks migh have multiple - * names. - */ - get name() { - return __privateGet(this, _name); - } - set name(value) { - __privateSet(this, _name, value); - } - /** - * The network chain ID. - */ - get chainId() { - return __privateGet(this, _chainId2); - } - set chainId(value) { - __privateSet(this, _chainId2, getBigInt(value, "chainId")); - } - /** - * Returns true if %%other%% matches this network. Any chain ID - * must match, and if no chain ID is present, the name must match. - * - * This method does not currently check for additional properties, - * such as ENS address or plug-in compatibility. - */ - matches(other) { - if (other == null) { - return false; - } - if (typeof other === "string") { - try { - return this.chainId === getBigInt(other); - } catch (error) { - } - return this.name === other; - } - if (typeof other === "number" || typeof other === "bigint") { - try { - return this.chainId === getBigInt(other); - } catch (error) { - } - return false; - } - if (typeof other === "object") { - if (other.chainId != null) { - try { - return this.chainId === getBigInt(other.chainId); - } catch (error) { - } - return false; - } - if (other.name != null) { - return this.name === other.name; - } - return false; - } - return false; - } - /** - * Returns the list of plugins currently attached to this Network. - */ - get plugins() { - return Array.from(__privateGet(this, _plugins).values()); - } - /** - * Attach a new %%plugin%% to this Network. The network name - * must be unique, excluding any fragment. - */ - attachPlugin(plugin) { - if (__privateGet(this, _plugins).get(plugin.name)) { - throw new Error(`cannot replace existing plugin: ${plugin.name} `); - } - __privateGet(this, _plugins).set(plugin.name, plugin.clone()); - return this; - } - /** - * Return the plugin, if any, matching %%name%% exactly. Plugins - * with fragments will not be returned unless %%name%% includes - * a fragment. - */ - getPlugin(name) { - return __privateGet(this, _plugins).get(name) || null; - } - /** - * Gets a list of all plugins that match %%name%%, with otr without - * a fragment. - */ - getPlugins(basename) { - return this.plugins.filter((p) => p.name.split("#")[0] === basename); - } - /** - * Create a copy of this Network. - */ - clone() { - const clone = new _Network(this.name, this.chainId); - this.plugins.forEach((plugin) => { - clone.attachPlugin(plugin.clone()); - }); - return clone; - } - /** - * Compute the intrinsic gas required for a transaction. - * - * A GasCostPlugin can be attached to override the default - * values. - */ - computeIntrinsicGas(tx) { - const costs = this.getPlugin("org.ethers.plugins.network.GasCost") || new GasCostPlugin(); - let gas = costs.txBase; - if (tx.to == null) { - gas += costs.txCreate; - } - if (tx.data) { - for (let i = 2; i < tx.data.length; i += 2) { - if (tx.data.substring(i, i + 2) === "00") { - gas += costs.txDataZero; - } else { - gas += costs.txDataNonzero; - } - } - } - if (tx.accessList) { - const accessList = accessListify(tx.accessList); - for (const addr in accessList) { - gas += costs.txAccessListAddress + costs.txAccessListStorageKey * accessList[addr].storageKeys.length; - } - } - return gas; - } - /** - * Returns a new Network for the %%network%% name or chainId. - */ - static from(network) { - injectCommonNetworks(); - if (network == null) { - return _Network.from("mainnet"); - } - if (typeof network === "number") { - network = BigInt(network); - } - if (typeof network === "string" || typeof network === "bigint") { - const networkFunc = Networks.get(network); - if (networkFunc) { - return networkFunc(); - } - if (typeof network === "bigint") { - return new _Network("unknown", network); - } - assertArgument(false, "unknown network", "network", network); - } - if (typeof network.clone === "function") { - const clone = network.clone(); - return clone; - } - if (typeof network === "object") { - assertArgument(typeof network.name === "string" && typeof network.chainId === "number", "invalid network object name or chainId", "network", network); - const custom = new _Network(network.name, network.chainId); - if (network.ensAddress || network.ensNetwork != null) { - custom.attachPlugin(new EnsPlugin(network.ensAddress, network.ensNetwork)); - } - return custom; - } - assertArgument(false, "invalid network", "network", network); - } - /** - * Register %%nameOrChainId%% with a function which returns - * an instance of a Network representing that chain. - */ - static register(nameOrChainId, networkFunc) { - if (typeof nameOrChainId === "number") { - nameOrChainId = BigInt(nameOrChainId); - } - const existing = Networks.get(nameOrChainId); - if (existing) { - assertArgument(false, `conflicting network for ${JSON.stringify(existing.name)}`, "nameOrChainId", nameOrChainId); - } - Networks.set(nameOrChainId, networkFunc); - } -}; -_name = new WeakMap(); -_chainId2 = new WeakMap(); -_plugins = new WeakMap(); -var Network = _Network; -function parseUnits2(_value2, decimals) { - const value = String(_value2); - if (!value.match(/^[0-9.]+$/)) { - throw new Error(`invalid gwei value: ${_value2}`); - } - const comps = value.split("."); - if (comps.length === 1) { - comps.push(""); - } - if (comps.length !== 2) { - throw new Error(`invalid gwei value: ${_value2}`); - } - while (comps[1].length < decimals) { - comps[1] += "0"; - } - if (comps[1].length > 9) { - let frac = BigInt(comps[1].substring(0, 9)); - if (!comps[1].substring(9).match(/^0+$/)) { - frac++; - } - comps[1] = frac.toString(); - } - return BigInt(comps[0] + comps[1]); -} -function getGasStationPlugin(url) { - return new FetchUrlFeeDataNetworkPlugin(url, async (fetchFeeData, provider, request) => { - request.setHeader("User-Agent", "ethers"); - let response; - try { - const [_response, _feeData] = await Promise.all([ - request.send(), - fetchFeeData() - ]); - response = _response; - const payload = response.bodyJson.standard; - const feeData = { - gasPrice: _feeData.gasPrice, - maxFeePerGas: parseUnits2(payload.maxFee, 9), - maxPriorityFeePerGas: parseUnits2(payload.maxPriorityFee, 9) - }; - return feeData; - } catch (error) { - assert(false, `error encountered with polygon gas station (${JSON.stringify(request.url)})`, "SERVER_ERROR", { request, response, error }); - } - }); -} -var injected = false; -function injectCommonNetworks() { - if (injected) { - return; - } - injected = true; - function registerEth(name, chainId, options) { - const func = function() { - const network = new Network(name, chainId); - if (options.ensNetwork != null) { - network.attachPlugin(new EnsPlugin(null, options.ensNetwork)); - } - network.attachPlugin(new GasCostPlugin()); - (options.plugins || []).forEach((plugin) => { - network.attachPlugin(plugin); - }); - return network; - }; - Network.register(name, func); - Network.register(chainId, func); - if (options.altNames) { - options.altNames.forEach((name2) => { - Network.register(name2, func); - }); - } - } - registerEth("mainnet", 1, { ensNetwork: 1, altNames: ["homestead"] }); - registerEth("ropsten", 3, { ensNetwork: 3 }); - registerEth("rinkeby", 4, { ensNetwork: 4 }); - registerEth("goerli", 5, { ensNetwork: 5 }); - registerEth("kovan", 42, { ensNetwork: 42 }); - registerEth("sepolia", 11155111, { ensNetwork: 11155111 }); - registerEth("holesky", 17e3, { ensNetwork: 17e3 }); - registerEth("classic", 61, {}); - registerEth("classicKotti", 6, {}); - registerEth("arbitrum", 42161, { - ensNetwork: 1 - }); - registerEth("arbitrum-goerli", 421613, {}); - registerEth("arbitrum-sepolia", 421614, {}); - registerEth("base", 8453, { ensNetwork: 1 }); - registerEth("base-goerli", 84531, {}); - registerEth("base-sepolia", 84532, {}); - registerEth("bnb", 56, { ensNetwork: 1 }); - registerEth("bnbt", 97, {}); - registerEth("linea", 59144, { ensNetwork: 1 }); - registerEth("linea-goerli", 59140, {}); - registerEth("matic", 137, { - ensNetwork: 1, - plugins: [ - getGasStationPlugin("https://gasstation.polygon.technology/v2") - ] - }); - registerEth("matic-mumbai", 80001, { - altNames: ["maticMumbai", "maticmum"], - plugins: [ - getGasStationPlugin("https://gasstation-testnet.polygon.technology/v2") - ] - }); - registerEth("optimism", 10, { - ensNetwork: 1, - plugins: [] - }); - registerEth("optimism-goerli", 420, {}); - registerEth("optimism-sepolia", 11155420, {}); - registerEth("xdai", 100, { ensNetwork: 1 }); -} - -// node_modules/ethers/lib.esm/providers/subscriber-polling.js -function copy(obj) { - return JSON.parse(JSON.stringify(obj)); -} -var _provider, _poller, _interval, _blockNumber, _poll, poll_fn; -var PollingBlockSubscriber = class { - /** - * Create a new **PollingBlockSubscriber** attached to %%provider%%. - */ - constructor(provider) { - __privateAdd(this, _poll); - __privateAdd(this, _provider, void 0); - __privateAdd(this, _poller, void 0); - __privateAdd(this, _interval, void 0); - // The most recent block we have scanned for events. The value -2 - // indicates we still need to fetch an initial block number - __privateAdd(this, _blockNumber, void 0); - __privateSet(this, _provider, provider); - __privateSet(this, _poller, null); - __privateSet(this, _interval, 4e3); - __privateSet(this, _blockNumber, -2); - } - /** - * The polling interval. - */ - get pollingInterval() { - return __privateGet(this, _interval); - } - set pollingInterval(value) { - __privateSet(this, _interval, value); - } - start() { - if (__privateGet(this, _poller)) { - return; - } - __privateSet(this, _poller, __privateGet(this, _provider)._setTimeout(__privateMethod(this, _poll, poll_fn).bind(this), __privateGet(this, _interval))); - __privateMethod(this, _poll, poll_fn).call(this); - } - stop() { - if (!__privateGet(this, _poller)) { - return; - } - __privateGet(this, _provider)._clearTimeout(__privateGet(this, _poller)); - __privateSet(this, _poller, null); - } - pause(dropWhilePaused) { - this.stop(); - if (dropWhilePaused) { - __privateSet(this, _blockNumber, -2); - } - } - resume() { - this.start(); - } -}; -_provider = new WeakMap(); -_poller = new WeakMap(); -_interval = new WeakMap(); -_blockNumber = new WeakMap(); -_poll = new WeakSet(); -poll_fn = async function() { - try { - const blockNumber = await __privateGet(this, _provider).getBlockNumber(); - if (__privateGet(this, _blockNumber) === -2) { - __privateSet(this, _blockNumber, blockNumber); - return; - } - if (blockNumber !== __privateGet(this, _blockNumber)) { - for (let b2 = __privateGet(this, _blockNumber) + 1; b2 <= blockNumber; b2++) { - if (__privateGet(this, _poller) == null) { - return; - } - await __privateGet(this, _provider).emit("block", b2); - } - __privateSet(this, _blockNumber, blockNumber); - } - } catch (error) { - } - if (__privateGet(this, _poller) == null) { - return; - } - __privateSet(this, _poller, __privateGet(this, _provider)._setTimeout(__privateMethod(this, _poll, poll_fn).bind(this), __privateGet(this, _interval))); -}; -var _provider2, _poll2, _running; -var OnBlockSubscriber = class { - /** - * Create a new **OnBlockSubscriber** attached to %%provider%%. - */ - constructor(provider) { - __privateAdd(this, _provider2, void 0); - __privateAdd(this, _poll2, void 0); - __privateAdd(this, _running, void 0); - __privateSet(this, _provider2, provider); - __privateSet(this, _running, false); - __privateSet(this, _poll2, (blockNumber) => { - this._poll(blockNumber, __privateGet(this, _provider2)); - }); - } - /** - * Called on every new block. - */ - async _poll(blockNumber, provider) { - throw new Error("sub-classes must override this"); - } - start() { - if (__privateGet(this, _running)) { - return; - } - __privateSet(this, _running, true); - __privateGet(this, _poll2).call(this, -2); - __privateGet(this, _provider2).on("block", __privateGet(this, _poll2)); - } - stop() { - if (!__privateGet(this, _running)) { - return; - } - __privateSet(this, _running, false); - __privateGet(this, _provider2).off("block", __privateGet(this, _poll2)); - } - pause(dropWhilePaused) { - this.stop(); - } - resume() { - this.start(); - } -}; -_provider2 = new WeakMap(); -_poll2 = new WeakMap(); -_running = new WeakMap(); -var _tag, _lastBlock; -var PollingBlockTagSubscriber = class extends OnBlockSubscriber { - constructor(provider, tag) { - super(provider); - __privateAdd(this, _tag, void 0); - __privateAdd(this, _lastBlock, void 0); - __privateSet(this, _tag, tag); - __privateSet(this, _lastBlock, -2); - } - pause(dropWhilePaused) { - if (dropWhilePaused) { - __privateSet(this, _lastBlock, -2); - } - super.pause(dropWhilePaused); - } - async _poll(blockNumber, provider) { - const block = await provider.getBlock(__privateGet(this, _tag)); - if (block == null) { - return; - } - if (__privateGet(this, _lastBlock) === -2) { - __privateSet(this, _lastBlock, block.number); - } else if (block.number > __privateGet(this, _lastBlock)) { - provider.emit(__privateGet(this, _tag), block.number); - __privateSet(this, _lastBlock, block.number); - } - } -}; -_tag = new WeakMap(); -_lastBlock = new WeakMap(); -var _filter2; -var PollingOrphanSubscriber = class extends OnBlockSubscriber { - constructor(provider, filter) { - super(provider); - __privateAdd(this, _filter2, void 0); - __privateSet(this, _filter2, copy(filter)); - } - async _poll(blockNumber, provider) { - throw new Error("@TODO"); - console.log(__privateGet(this, _filter2)); - } -}; -_filter2 = new WeakMap(); -var _hash; -var PollingTransactionSubscriber = class extends OnBlockSubscriber { - /** - * Create a new **PollingTransactionSubscriber** attached to - * %%provider%%, listening for %%hash%%. - */ - constructor(provider, hash2) { - super(provider); - __privateAdd(this, _hash, void 0); - __privateSet(this, _hash, hash2); - } - async _poll(blockNumber, provider) { - const tx = await provider.getTransactionReceipt(__privateGet(this, _hash)); - if (tx) { - provider.emit(__privateGet(this, _hash), tx); - } - } -}; -_hash = new WeakMap(); -var _provider3, _filter3, _poller2, _running2, _blockNumber2, _poll3, poll_fn2; -var PollingEventSubscriber = class { - /** - * Create a new **PollingTransactionSubscriber** attached to - * %%provider%%, listening for %%filter%%. - */ - constructor(provider, filter) { - __privateAdd(this, _poll3); - __privateAdd(this, _provider3, void 0); - __privateAdd(this, _filter3, void 0); - __privateAdd(this, _poller2, void 0); - __privateAdd(this, _running2, void 0); - // The most recent block we have scanned for events. The value -2 - // indicates we still need to fetch an initial block number - __privateAdd(this, _blockNumber2, void 0); - __privateSet(this, _provider3, provider); - __privateSet(this, _filter3, copy(filter)); - __privateSet(this, _poller2, __privateMethod(this, _poll3, poll_fn2).bind(this)); - __privateSet(this, _running2, false); - __privateSet(this, _blockNumber2, -2); - } - start() { - if (__privateGet(this, _running2)) { - return; - } - __privateSet(this, _running2, true); - if (__privateGet(this, _blockNumber2) === -2) { - __privateGet(this, _provider3).getBlockNumber().then((blockNumber) => { - __privateSet(this, _blockNumber2, blockNumber); - }); - } - __privateGet(this, _provider3).on("block", __privateGet(this, _poller2)); - } - stop() { - if (!__privateGet(this, _running2)) { - return; - } - __privateSet(this, _running2, false); - __privateGet(this, _provider3).off("block", __privateGet(this, _poller2)); - } - pause(dropWhilePaused) { - this.stop(); - if (dropWhilePaused) { - __privateSet(this, _blockNumber2, -2); - } - } - resume() { - this.start(); - } -}; -_provider3 = new WeakMap(); -_filter3 = new WeakMap(); -_poller2 = new WeakMap(); -_running2 = new WeakMap(); -_blockNumber2 = new WeakMap(); -_poll3 = new WeakSet(); -poll_fn2 = async function(blockNumber) { - if (__privateGet(this, _blockNumber2) === -2) { - return; - } - const filter = copy(__privateGet(this, _filter3)); - filter.fromBlock = __privateGet(this, _blockNumber2) + 1; - filter.toBlock = blockNumber; - const logs = await __privateGet(this, _provider3).getLogs(filter); - if (logs.length === 0) { - if (__privateGet(this, _blockNumber2) < blockNumber - 60) { - __privateSet(this, _blockNumber2, blockNumber - 60); - } - return; - } - for (const log of logs) { - __privateGet(this, _provider3).emit(__privateGet(this, _filter3), log); - __privateSet(this, _blockNumber2, log.blockNumber); - } -}; - -// node_modules/ethers/lib.esm/providers/abstract-provider.js -var BN_23 = BigInt(2); -var MAX_CCIP_REDIRECTS = 10; -function isPromise(value) { - return value && typeof value.then === "function"; -} -function getTag(prefix, value) { - return prefix + ":" + JSON.stringify(value, (k, v) => { - if (v == null) { - return "null"; - } - if (typeof v === "bigint") { - return `bigint:${v.toString()}`; - } - if (typeof v === "string") { - return v.toLowerCase(); - } - if (typeof v === "object" && !Array.isArray(v)) { - const keys = Object.keys(v); - keys.sort(); - return keys.reduce((accum, key) => { - accum[key] = v[key]; - return accum; - }, {}); - } - return v; - }); -} -var UnmanagedSubscriber = class { - /** - * Create a new UnmanagedSubscriber with %%name%%. - */ - constructor(name) { - /** - * The name fof the event. - */ - __publicField(this, "name"); - defineProperties(this, { name }); - } - start() { - } - stop() { - } - pause(dropWhilePaused) { - } - resume() { - } -}; -function copy2(value) { - return JSON.parse(JSON.stringify(value)); -} -function concisify(items) { - items = Array.from(new Set(items).values()); - items.sort(); - return items; -} -async function getSubscription(_event2, provider) { - if (_event2 == null) { - throw new Error("invalid event"); - } - if (Array.isArray(_event2)) { - _event2 = { topics: _event2 }; - } - if (typeof _event2 === "string") { - switch (_event2) { - case "block": - case "debug": - case "error": - case "finalized": - case "network": - case "pending": - case "safe": { - return { type: _event2, tag: _event2 }; - } - } - } - if (isHexString(_event2, 32)) { - const hash2 = _event2.toLowerCase(); - return { type: "transaction", tag: getTag("tx", { hash: hash2 }), hash: hash2 }; - } - if (_event2.orphan) { - const event = _event2; - return { type: "orphan", tag: getTag("orphan", event), filter: copy2(event) }; - } - if (_event2.address || _event2.topics) { - const event = _event2; - const filter = { - topics: (event.topics || []).map((t) => { - if (t == null) { - return null; - } - if (Array.isArray(t)) { - return concisify(t.map((t2) => t2.toLowerCase())); - } - return t.toLowerCase(); - }) - }; - if (event.address) { - const addresses = []; - const promises = []; - const addAddress = (addr) => { - if (isHexString(addr)) { - addresses.push(addr); - } else { - promises.push((async () => { - addresses.push(await resolveAddress(addr, provider)); - })()); - } - }; - if (Array.isArray(event.address)) { - event.address.forEach(addAddress); - } else { - addAddress(event.address); - } - if (promises.length) { - await Promise.all(promises); - } - filter.address = concisify(addresses.map((a) => a.toLowerCase())); - } - return { filter, tag: getTag("event", filter), type: "event" }; - } - assertArgument(false, "unknown ProviderEvent", "event", _event2); -} -function getTime2() { - return (/* @__PURE__ */ new Date()).getTime(); -} -var defaultOptions = { - cacheTimeout: 250, - pollingInterval: 4e3 -}; -var _subs, _plugins2, _pausedState, _destroyed, _networkPromise, _anyNetwork, _performCache, _lastBlockNumber, _nextTimer, _timers, _disableCcipRead, _options2, _perform, perform_fn, _call, call_fn, _checkNetwork, checkNetwork_fn, _getAccountValue, getAccountValue_fn, _getBlock, getBlock_fn, _hasSub, hasSub_fn, _getSub, getSub_fn; -var AbstractProvider = class { - /** - * Create a new **AbstractProvider** connected to %%network%%, or - * use the various network detection capabilities to discover the - * [[Network]] if necessary. - */ - constructor(_network3, options) { - // Shares multiple identical requests made during the same 250ms - __privateAdd(this, _perform); - __privateAdd(this, _call); - __privateAdd(this, _checkNetwork); - // Account - __privateAdd(this, _getAccountValue); - __privateAdd(this, _getBlock); - __privateAdd(this, _hasSub); - __privateAdd(this, _getSub); - __privateAdd(this, _subs, void 0); - __privateAdd(this, _plugins2, void 0); - // null=unpaused, true=paused+dropWhilePaused, false=paused - __privateAdd(this, _pausedState, void 0); - __privateAdd(this, _destroyed, void 0); - __privateAdd(this, _networkPromise, void 0); - __privateAdd(this, _anyNetwork, void 0); - __privateAdd(this, _performCache, void 0); - // The most recent block number if running an event or -1 if no "block" event - __privateAdd(this, _lastBlockNumber, void 0); - __privateAdd(this, _nextTimer, void 0); - __privateAdd(this, _timers, void 0); - __privateAdd(this, _disableCcipRead, void 0); - __privateAdd(this, _options2, void 0); - __privateSet(this, _options2, Object.assign({}, defaultOptions, options || {})); - if (_network3 === "any") { - __privateSet(this, _anyNetwork, true); - __privateSet(this, _networkPromise, null); - } else if (_network3) { - const network = Network.from(_network3); - __privateSet(this, _anyNetwork, false); - __privateSet(this, _networkPromise, Promise.resolve(network)); - setTimeout(() => { - this.emit("network", network, null); - }, 0); - } else { - __privateSet(this, _anyNetwork, false); - __privateSet(this, _networkPromise, null); - } - __privateSet(this, _lastBlockNumber, -1); - __privateSet(this, _performCache, /* @__PURE__ */ new Map()); - __privateSet(this, _subs, /* @__PURE__ */ new Map()); - __privateSet(this, _plugins2, /* @__PURE__ */ new Map()); - __privateSet(this, _pausedState, null); - __privateSet(this, _destroyed, false); - __privateSet(this, _nextTimer, 1); - __privateSet(this, _timers, /* @__PURE__ */ new Map()); - __privateSet(this, _disableCcipRead, false); - } - get pollingInterval() { - return __privateGet(this, _options2).pollingInterval; - } - /** - * Returns ``this``, to allow an **AbstractProvider** to implement - * the [[ContractRunner]] interface. - */ - get provider() { - return this; - } - /** - * Returns all the registered plug-ins. - */ - get plugins() { - return Array.from(__privateGet(this, _plugins2).values()); - } - /** - * Attach a new plug-in. - */ - attachPlugin(plugin) { - if (__privateGet(this, _plugins2).get(plugin.name)) { - throw new Error(`cannot replace existing plugin: ${plugin.name} `); - } - __privateGet(this, _plugins2).set(plugin.name, plugin.connect(this)); - return this; - } - /** - * Get a plugin by name. - */ - getPlugin(name) { - return __privateGet(this, _plugins2).get(name) || null; - } - /** - * Prevent any CCIP-read operation, regardless of whether requested - * in a [[call]] using ``enableCcipRead``. - */ - get disableCcipRead() { - return __privateGet(this, _disableCcipRead); - } - set disableCcipRead(value) { - __privateSet(this, _disableCcipRead, !!value); - } - /** - * Resolves to the data for executing the CCIP-read operations. - */ - async ccipReadFetch(tx, calldata, urls) { - if (this.disableCcipRead || urls.length === 0 || tx.to == null) { - return null; - } - const sender = tx.to.toLowerCase(); - const data = calldata.toLowerCase(); - const errorMessages = []; - for (let i = 0; i < urls.length; i++) { - const url = urls[i]; - const href = url.replace("{sender}", sender).replace("{data}", data); - const request = new FetchRequest(href); - if (url.indexOf("{data}") === -1) { - request.body = { data, sender }; - } - this.emit("debug", { action: "sendCcipReadFetchRequest", request, index: i, urls }); - let errorMessage = "unknown error"; - const resp = await request.send(); - try { - const result = resp.bodyJson; - if (result.data) { - this.emit("debug", { action: "receiveCcipReadFetchResult", request, result }); - return result.data; - } - if (result.message) { - errorMessage = result.message; - } - this.emit("debug", { action: "receiveCcipReadFetchError", request, result }); - } catch (error) { - } - assert(resp.statusCode < 400 || resp.statusCode >= 500, `response not found during CCIP fetch: ${errorMessage}`, "OFFCHAIN_FAULT", { reason: "404_MISSING_RESOURCE", transaction: tx, info: { url, errorMessage } }); - errorMessages.push(errorMessage); - } - assert(false, `error encountered during CCIP fetch: ${errorMessages.map((m) => JSON.stringify(m)).join(", ")}`, "OFFCHAIN_FAULT", { - reason: "500_SERVER_ERROR", - transaction: tx, - info: { urls, errorMessages } - }); - } - /** - * Provides the opportunity for a sub-class to wrap a block before - * returning it, to add additional properties or an alternate - * sub-class of [[Block]]. - */ - _wrapBlock(value, network) { - return new Block(formatBlock(value), this); - } - /** - * Provides the opportunity for a sub-class to wrap a log before - * returning it, to add additional properties or an alternate - * sub-class of [[Log]]. - */ - _wrapLog(value, network) { - return new Log(formatLog(value), this); - } - /** - * Provides the opportunity for a sub-class to wrap a transaction - * receipt before returning it, to add additional properties or an - * alternate sub-class of [[TransactionReceipt]]. - */ - _wrapTransactionReceipt(value, network) { - return new TransactionReceipt(formatTransactionReceipt(value), this); - } - /** - * Provides the opportunity for a sub-class to wrap a transaction - * response before returning it, to add additional properties or an - * alternate sub-class of [[TransactionResponse]]. - */ - _wrapTransactionResponse(tx, network) { - return new TransactionResponse(formatTransactionResponse(tx), this); - } - /** - * Resolves to the Network, forcing a network detection using whatever - * technique the sub-class requires. - * - * Sub-classes **must** override this. - */ - _detectNetwork() { - assert(false, "sub-classes must implement this", "UNSUPPORTED_OPERATION", { - operation: "_detectNetwork" - }); - } - /** - * Sub-classes should use this to perform all built-in operations. All - * methods sanitizes and normalizes the values passed into this. - * - * Sub-classes **must** override this. - */ - async _perform(req) { - assert(false, `unsupported method: ${req.method}`, "UNSUPPORTED_OPERATION", { - operation: req.method, - info: req - }); - } - // State - async getBlockNumber() { - const blockNumber = getNumber(await __privateMethod(this, _perform, perform_fn).call(this, { method: "getBlockNumber" }), "%response"); - if (__privateGet(this, _lastBlockNumber) >= 0) { - __privateSet(this, _lastBlockNumber, blockNumber); - } - return blockNumber; - } - /** - * Returns or resolves to the address for %%address%%, resolving ENS - * names and [[Addressable]] objects and returning if already an - * address. - */ - _getAddress(address) { - return resolveAddress(address, this); - } - /** - * Returns or resolves to a valid block tag for %%blockTag%%, resolving - * negative values and returning if already a valid block tag. - */ - _getBlockTag(blockTag) { - if (blockTag == null) { - return "latest"; - } - switch (blockTag) { - case "earliest": - return "0x0"; - case "finalized": - case "latest": - case "pending": - case "safe": - return blockTag; - } - if (isHexString(blockTag)) { - if (isHexString(blockTag, 32)) { - return blockTag; - } - return toQuantity(blockTag); - } - if (typeof blockTag === "bigint") { - blockTag = getNumber(blockTag, "blockTag"); - } - if (typeof blockTag === "number") { - if (blockTag >= 0) { - return toQuantity(blockTag); - } - if (__privateGet(this, _lastBlockNumber) >= 0) { - return toQuantity(__privateGet(this, _lastBlockNumber) + blockTag); - } - return this.getBlockNumber().then((b2) => toQuantity(b2 + blockTag)); - } - assertArgument(false, "invalid blockTag", "blockTag", blockTag); - } - /** - * Returns or resolves to a filter for %%filter%%, resolving any ENS - * names or [[Addressable]] object and returning if already a valid - * filter. - */ - _getFilter(filter) { - const topics = (filter.topics || []).map((t) => { - if (t == null) { - return null; - } - if (Array.isArray(t)) { - return concisify(t.map((t2) => t2.toLowerCase())); - } - return t.toLowerCase(); - }); - const blockHash = "blockHash" in filter ? filter.blockHash : void 0; - const resolve = (_address, fromBlock2, toBlock2) => { - let address2 = void 0; - switch (_address.length) { - case 0: - break; - case 1: - address2 = _address[0]; - break; - default: - _address.sort(); - address2 = _address; - } - if (blockHash) { - if (fromBlock2 != null || toBlock2 != null) { - throw new Error("invalid filter"); - } - } - const filter2 = {}; - if (address2) { - filter2.address = address2; - } - if (topics.length) { - filter2.topics = topics; - } - if (fromBlock2) { - filter2.fromBlock = fromBlock2; - } - if (toBlock2) { - filter2.toBlock = toBlock2; - } - if (blockHash) { - filter2.blockHash = blockHash; - } - return filter2; - }; - let address = []; - if (filter.address) { - if (Array.isArray(filter.address)) { - for (const addr of filter.address) { - address.push(this._getAddress(addr)); - } - } else { - address.push(this._getAddress(filter.address)); - } - } - let fromBlock = void 0; - if ("fromBlock" in filter) { - fromBlock = this._getBlockTag(filter.fromBlock); - } - let toBlock = void 0; - if ("toBlock" in filter) { - toBlock = this._getBlockTag(filter.toBlock); - } - if (address.filter((a) => typeof a !== "string").length || fromBlock != null && typeof fromBlock !== "string" || toBlock != null && typeof toBlock !== "string") { - return Promise.all([Promise.all(address), fromBlock, toBlock]).then((result) => { - return resolve(result[0], result[1], result[2]); - }); - } - return resolve(address, fromBlock, toBlock); - } - /** - * Returns or resovles to a transaction for %%request%%, resolving - * any ENS names or [[Addressable]] and returning if already a valid - * transaction. - */ - _getTransactionRequest(_request3) { - const request = copyRequest(_request3); - const promises = []; - ["to", "from"].forEach((key) => { - if (request[key] == null) { - return; - } - const addr = resolveAddress(request[key], this); - if (isPromise(addr)) { - promises.push(async function() { - request[key] = await addr; - }()); - } else { - request[key] = addr; - } - }); - if (request.blockTag != null) { - const blockTag = this._getBlockTag(request.blockTag); - if (isPromise(blockTag)) { - promises.push(async function() { - request.blockTag = await blockTag; - }()); - } else { - request.blockTag = blockTag; - } - } - if (promises.length) { - return async function() { - await Promise.all(promises); - return request; - }(); - } - return request; - } - async getNetwork() { - if (__privateGet(this, _networkPromise) == null) { - const detectNetwork = (async () => { - try { - const network = await this._detectNetwork(); - this.emit("network", network, null); - return network; - } catch (error) { - if (__privateGet(this, _networkPromise) === detectNetwork) { - __privateSet(this, _networkPromise, null); - } - throw error; - } - })(); - __privateSet(this, _networkPromise, detectNetwork); - return (await detectNetwork).clone(); - } - const networkPromise = __privateGet(this, _networkPromise); - const [expected, actual] = await Promise.all([ - networkPromise, - this._detectNetwork() - // The actual connected network - ]); - if (expected.chainId !== actual.chainId) { - if (__privateGet(this, _anyNetwork)) { - this.emit("network", actual, expected); - if (__privateGet(this, _networkPromise) === networkPromise) { - __privateSet(this, _networkPromise, Promise.resolve(actual)); - } - } else { - assert(false, `network changed: ${expected.chainId} => ${actual.chainId} `, "NETWORK_ERROR", { - event: "changed" - }); - } - } - return expected.clone(); - } - async getFeeData() { - const network = await this.getNetwork(); - const getFeeDataFunc = async () => { - const { _block, gasPrice, priorityFee } = await resolveProperties({ - _block: __privateMethod(this, _getBlock, getBlock_fn).call(this, "latest", false), - gasPrice: (async () => { - try { - const value = await __privateMethod(this, _perform, perform_fn).call(this, { method: "getGasPrice" }); - return getBigInt(value, "%response"); - } catch (error) { - } - return null; - })(), - priorityFee: (async () => { - try { - const value = await __privateMethod(this, _perform, perform_fn).call(this, { method: "getPriorityFee" }); - return getBigInt(value, "%response"); - } catch (error) { - } - return null; - })() - }); - let maxFeePerGas = null; - let maxPriorityFeePerGas = null; - const block = this._wrapBlock(_block, network); - if (block && block.baseFeePerGas) { - maxPriorityFeePerGas = priorityFee != null ? priorityFee : BigInt("1000000000"); - maxFeePerGas = block.baseFeePerGas * BN_23 + maxPriorityFeePerGas; - } - return new FeeData(gasPrice, maxFeePerGas, maxPriorityFeePerGas); - }; - const plugin = network.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); - if (plugin) { - const req = new FetchRequest(plugin.url); - const feeData = await plugin.processFunc(getFeeDataFunc, this, req); - return new FeeData(feeData.gasPrice, feeData.maxFeePerGas, feeData.maxPriorityFeePerGas); - } - return await getFeeDataFunc(); - } - async estimateGas(_tx) { - let tx = this._getTransactionRequest(_tx); - if (isPromise(tx)) { - tx = await tx; - } - return getBigInt(await __privateMethod(this, _perform, perform_fn).call(this, { - method: "estimateGas", - transaction: tx - }), "%response"); - } - async call(_tx) { - const { tx, blockTag } = await resolveProperties({ - tx: this._getTransactionRequest(_tx), - blockTag: this._getBlockTag(_tx.blockTag) - }); - return await __privateMethod(this, _checkNetwork, checkNetwork_fn).call(this, __privateMethod(this, _call, call_fn).call(this, tx, blockTag, _tx.enableCcipRead ? 0 : -1)); - } - async getBalance(address, blockTag) { - return getBigInt(await __privateMethod(this, _getAccountValue, getAccountValue_fn).call(this, { method: "getBalance" }, address, blockTag), "%response"); - } - async getTransactionCount(address, blockTag) { - return getNumber(await __privateMethod(this, _getAccountValue, getAccountValue_fn).call(this, { method: "getTransactionCount" }, address, blockTag), "%response"); - } - async getCode(address, blockTag) { - return hexlify(await __privateMethod(this, _getAccountValue, getAccountValue_fn).call(this, { method: "getCode" }, address, blockTag)); - } - async getStorage(address, _position, blockTag) { - const position = getBigInt(_position, "position"); - return hexlify(await __privateMethod(this, _getAccountValue, getAccountValue_fn).call(this, { method: "getStorage", position }, address, blockTag)); - } - // Write - async broadcastTransaction(signedTx) { - const { blockNumber, hash: hash2, network } = await resolveProperties({ - blockNumber: this.getBlockNumber(), - hash: this._perform({ - method: "broadcastTransaction", - signedTransaction: signedTx - }), - network: this.getNetwork() - }); - const tx = Transaction.from(signedTx); - if (tx.hash !== hash2) { - throw new Error("@TODO: the returned hash did not match"); - } - return this._wrapTransactionResponse(tx, network).replaceableTransaction(blockNumber); - } - // Queries - async getBlock(block, prefetchTxs) { - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: __privateMethod(this, _getBlock, getBlock_fn).call(this, block, !!prefetchTxs) - }); - if (params == null) { - return null; - } - return this._wrapBlock(params, network); - } - async getTransaction(hash2) { - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: __privateMethod(this, _perform, perform_fn).call(this, { method: "getTransaction", hash: hash2 }) - }); - if (params == null) { - return null; - } - return this._wrapTransactionResponse(params, network); - } - async getTransactionReceipt(hash2) { - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: __privateMethod(this, _perform, perform_fn).call(this, { method: "getTransactionReceipt", hash: hash2 }) - }); - if (params == null) { - return null; - } - if (params.gasPrice == null && params.effectiveGasPrice == null) { - const tx = await __privateMethod(this, _perform, perform_fn).call(this, { method: "getTransaction", hash: hash2 }); - if (tx == null) { - throw new Error("report this; could not find tx or effectiveGasPrice"); - } - params.effectiveGasPrice = tx.gasPrice; - } - return this._wrapTransactionReceipt(params, network); - } - async getTransactionResult(hash2) { - const { result } = await resolveProperties({ - network: this.getNetwork(), - result: __privateMethod(this, _perform, perform_fn).call(this, { method: "getTransactionResult", hash: hash2 }) - }); - if (result == null) { - return null; - } - return hexlify(result); - } - // Bloom-filter Queries - async getLogs(_filter5) { - let filter = this._getFilter(_filter5); - if (isPromise(filter)) { - filter = await filter; - } - const { network, params } = await resolveProperties({ - network: this.getNetwork(), - params: __privateMethod(this, _perform, perform_fn).call(this, { method: "getLogs", filter }) - }); - return params.map((p) => this._wrapLog(p, network)); - } - // ENS - _getProvider(chainId) { - assert(false, "provider cannot connect to target network", "UNSUPPORTED_OPERATION", { - operation: "_getProvider()" - }); - } - async getResolver(name) { - return await EnsResolver.fromName(this, name); - } - async getAvatar(name) { - const resolver = await this.getResolver(name); - if (resolver) { - return await resolver.getAvatar(); - } - return null; - } - async resolveName(name) { - const resolver = await this.getResolver(name); - if (resolver) { - return await resolver.getAddress(); - } - return null; - } - async lookupAddress(address) { - address = getAddress(address); - const node = namehash(address.substring(2).toLowerCase() + ".addr.reverse"); - try { - const ensAddr = await EnsResolver.getEnsAddress(this); - const ensContract = new Contract(ensAddr, [ - "function resolver(bytes32) view returns (address)" - ], this); - const resolver = await ensContract.resolver(node); - if (resolver == null || resolver === ZeroAddress) { - return null; - } - const resolverContract = new Contract(resolver, [ - "function name(bytes32) view returns (string)" - ], this); - const name = await resolverContract.name(node); - const check = await this.resolveName(name); - if (check !== address) { - return null; - } - return name; - } catch (error) { - if (isError(error, "BAD_DATA") && error.value === "0x") { - return null; - } - if (isError(error, "CALL_EXCEPTION")) { - return null; - } - throw error; - } - return null; - } - async waitForTransaction(hash2, _confirms, timeout) { - const confirms = _confirms != null ? _confirms : 1; - if (confirms === 0) { - return this.getTransactionReceipt(hash2); - } - return new Promise(async (resolve, reject) => { - let timer = null; - const listener = async (blockNumber) => { - try { - const receipt = await this.getTransactionReceipt(hash2); - if (receipt != null) { - if (blockNumber - receipt.blockNumber + 1 >= confirms) { - resolve(receipt); - if (timer) { - clearTimeout(timer); - timer = null; - } - return; - } - } - } catch (error) { - console.log("EEE", error); - } - this.once("block", listener); - }; - if (timeout != null) { - timer = setTimeout(() => { - if (timer == null) { - return; - } - timer = null; - this.off("block", listener); - reject(makeError("timeout", "TIMEOUT", { reason: "timeout" })); - }, timeout); - } - listener(await this.getBlockNumber()); - }); - } - async waitForBlock(blockTag) { - assert(false, "not implemented yet", "NOT_IMPLEMENTED", { - operation: "waitForBlock" - }); - } - /** - * Clear a timer created using the [[_setTimeout]] method. - */ - _clearTimeout(timerId) { - const timer = __privateGet(this, _timers).get(timerId); - if (!timer) { - return; - } - if (timer.timer) { - clearTimeout(timer.timer); - } - __privateGet(this, _timers).delete(timerId); - } - /** - * Create a timer that will execute %%func%% after at least %%timeout%% - * (in ms). If %%timeout%% is unspecified, then %%func%% will execute - * in the next event loop. - * - * [Pausing](AbstractProvider-paused) the provider will pause any - * associated timers. - */ - _setTimeout(_func, timeout) { - if (timeout == null) { - timeout = 0; - } - const timerId = __privateWrapper(this, _nextTimer)._++; - const func = () => { - __privateGet(this, _timers).delete(timerId); - _func(); - }; - if (this.paused) { - __privateGet(this, _timers).set(timerId, { timer: null, func, time: timeout }); - } else { - const timer = setTimeout(func, timeout); - __privateGet(this, _timers).set(timerId, { timer, func, time: getTime2() }); - } - return timerId; - } - /** - * Perform %%func%% on each subscriber. - */ - _forEachSubscriber(func) { - for (const sub of __privateGet(this, _subs).values()) { - func(sub.subscriber); - } - } - /** - * Sub-classes may override this to customize subscription - * implementations. - */ - _getSubscriber(sub) { - switch (sub.type) { - case "debug": - case "error": - case "network": - return new UnmanagedSubscriber(sub.type); - case "block": { - const subscriber = new PollingBlockSubscriber(this); - subscriber.pollingInterval = this.pollingInterval; - return subscriber; - } - case "safe": - case "finalized": - return new PollingBlockTagSubscriber(this, sub.type); - case "event": - return new PollingEventSubscriber(this, sub.filter); - case "transaction": - return new PollingTransactionSubscriber(this, sub.hash); - case "orphan": - return new PollingOrphanSubscriber(this, sub.filter); - } - throw new Error(`unsupported event: ${sub.type}`); - } - /** - * If a [[Subscriber]] fails and needs to replace itself, this - * method may be used. - * - * For example, this is used for providers when using the - * ``eth_getFilterChanges`` method, which can return null if state - * filters are not supported by the backend, allowing the Subscriber - * to swap in a [[PollingEventSubscriber]]. - */ - _recoverSubscriber(oldSub, newSub) { - for (const sub of __privateGet(this, _subs).values()) { - if (sub.subscriber === oldSub) { - if (sub.started) { - sub.subscriber.stop(); - } - sub.subscriber = newSub; - if (sub.started) { - newSub.start(); - } - if (__privateGet(this, _pausedState) != null) { - newSub.pause(__privateGet(this, _pausedState)); - } - break; - } - } - } - async on(event, listener) { - const sub = await __privateMethod(this, _getSub, getSub_fn).call(this, event); - sub.listeners.push({ listener, once: false }); - if (!sub.started) { - sub.subscriber.start(); - sub.started = true; - if (__privateGet(this, _pausedState) != null) { - sub.subscriber.pause(__privateGet(this, _pausedState)); - } - } - return this; - } - async once(event, listener) { - const sub = await __privateMethod(this, _getSub, getSub_fn).call(this, event); - sub.listeners.push({ listener, once: true }); - if (!sub.started) { - sub.subscriber.start(); - sub.started = true; - if (__privateGet(this, _pausedState) != null) { - sub.subscriber.pause(__privateGet(this, _pausedState)); - } - } - return this; - } - async emit(event, ...args) { - const sub = await __privateMethod(this, _hasSub, hasSub_fn).call(this, event, args); - if (!sub || sub.listeners.length === 0) { - return false; - } - ; - const count = sub.listeners.length; - sub.listeners = sub.listeners.filter(({ listener, once }) => { - const payload = new EventPayload(this, once ? null : listener, event); - try { - listener.call(this, ...args, payload); - } catch (error) { - } - return !once; - }); - if (sub.listeners.length === 0) { - if (sub.started) { - sub.subscriber.stop(); - } - __privateGet(this, _subs).delete(sub.tag); - } - return count > 0; - } - async listenerCount(event) { - if (event) { - const sub = await __privateMethod(this, _hasSub, hasSub_fn).call(this, event); - if (!sub) { - return 0; - } - return sub.listeners.length; - } - let total = 0; - for (const { listeners } of __privateGet(this, _subs).values()) { - total += listeners.length; - } - return total; - } - async listeners(event) { - if (event) { - const sub = await __privateMethod(this, _hasSub, hasSub_fn).call(this, event); - if (!sub) { - return []; - } - return sub.listeners.map(({ listener }) => listener); - } - let result = []; - for (const { listeners } of __privateGet(this, _subs).values()) { - result = result.concat(listeners.map(({ listener }) => listener)); - } - return result; - } - async off(event, listener) { - const sub = await __privateMethod(this, _hasSub, hasSub_fn).call(this, event); - if (!sub) { - return this; - } - if (listener) { - const index = sub.listeners.map(({ listener: listener2 }) => listener2).indexOf(listener); - if (index >= 0) { - sub.listeners.splice(index, 1); - } - } - if (!listener || sub.listeners.length === 0) { - if (sub.started) { - sub.subscriber.stop(); - } - __privateGet(this, _subs).delete(sub.tag); - } - return this; - } - async removeAllListeners(event) { - if (event) { - const { tag, started, subscriber } = await __privateMethod(this, _getSub, getSub_fn).call(this, event); - if (started) { - subscriber.stop(); - } - __privateGet(this, _subs).delete(tag); - } else { - for (const [tag, { started, subscriber }] of __privateGet(this, _subs)) { - if (started) { - subscriber.stop(); - } - __privateGet(this, _subs).delete(tag); - } - } - return this; - } - // Alias for "on" - async addListener(event, listener) { - return await this.on(event, listener); - } - // Alias for "off" - async removeListener(event, listener) { - return this.off(event, listener); - } - /** - * If this provider has been destroyed using the [[destroy]] method. - * - * Once destroyed, all resources are reclaimed, internal event loops - * and timers are cleaned up and no further requests may be sent to - * the provider. - */ - get destroyed() { - return __privateGet(this, _destroyed); - } - /** - * Sub-classes may use this to shutdown any sockets or release their - * resources and reject any pending requests. - * - * Sub-classes **must** call ``super.destroy()``. - */ - destroy() { - this.removeAllListeners(); - for (const timerId of __privateGet(this, _timers).keys()) { - this._clearTimeout(timerId); - } - __privateSet(this, _destroyed, true); - } - /** - * Whether the provider is currently paused. - * - * A paused provider will not emit any events, and generally should - * not make any requests to the network, but that is up to sub-classes - * to manage. - * - * Setting ``paused = true`` is identical to calling ``.pause(false)``, - * which will buffer any events that occur while paused until the - * provider is unpaused. - */ - get paused() { - return __privateGet(this, _pausedState) != null; - } - set paused(pause) { - if (!!pause === this.paused) { - return; - } - if (this.paused) { - this.resume(); - } else { - this.pause(false); - } - } - /** - * Pause the provider. If %%dropWhilePaused%%, any events that occur - * while paused are dropped, otherwise all events will be emitted once - * the provider is unpaused. - */ - pause(dropWhilePaused) { - __privateSet(this, _lastBlockNumber, -1); - if (__privateGet(this, _pausedState) != null) { - if (__privateGet(this, _pausedState) == !!dropWhilePaused) { - return; - } - assert(false, "cannot change pause type; resume first", "UNSUPPORTED_OPERATION", { - operation: "pause" - }); - } - this._forEachSubscriber((s) => s.pause(dropWhilePaused)); - __privateSet(this, _pausedState, !!dropWhilePaused); - for (const timer of __privateGet(this, _timers).values()) { - if (timer.timer) { - clearTimeout(timer.timer); - } - timer.time = getTime2() - timer.time; - } - } - /** - * Resume the provider. - */ - resume() { - if (__privateGet(this, _pausedState) == null) { - return; - } - this._forEachSubscriber((s) => s.resume()); - __privateSet(this, _pausedState, null); - for (const timer of __privateGet(this, _timers).values()) { - let timeout = timer.time; - if (timeout < 0) { - timeout = 0; - } - timer.time = getTime2(); - setTimeout(timer.func, timeout); - } - } -}; -_subs = new WeakMap(); -_plugins2 = new WeakMap(); -_pausedState = new WeakMap(); -_destroyed = new WeakMap(); -_networkPromise = new WeakMap(); -_anyNetwork = new WeakMap(); -_performCache = new WeakMap(); -_lastBlockNumber = new WeakMap(); -_nextTimer = new WeakMap(); -_timers = new WeakMap(); -_disableCcipRead = new WeakMap(); -_options2 = new WeakMap(); -_perform = new WeakSet(); -perform_fn = async function(req) { - const timeout = __privateGet(this, _options2).cacheTimeout; - if (timeout < 0) { - return await this._perform(req); - } - const tag = getTag(req.method, req); - let perform = __privateGet(this, _performCache).get(tag); - if (!perform) { - perform = this._perform(req); - __privateGet(this, _performCache).set(tag, perform); - setTimeout(() => { - if (__privateGet(this, _performCache).get(tag) === perform) { - __privateGet(this, _performCache).delete(tag); - } - }, timeout); - } - return await perform; -}; -_call = new WeakSet(); -call_fn = async function(tx, blockTag, attempt) { - assert(attempt < MAX_CCIP_REDIRECTS, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", { - reason: "TOO_MANY_REDIRECTS", - transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true }) - }); - const transaction = copyRequest(tx); - try { - return hexlify(await this._perform({ method: "call", transaction, blockTag })); - } catch (error) { - if (!this.disableCcipRead && isCallException(error) && error.data && attempt >= 0 && blockTag === "latest" && transaction.to != null && dataSlice(error.data, 0, 4) === "0x556f1830") { - const data = error.data; - const txSender = await resolveAddress(transaction.to, this); - let ccipArgs; - try { - ccipArgs = parseOffchainLookup(dataSlice(error.data, 4)); - } catch (error2) { - assert(false, error2.message, "OFFCHAIN_FAULT", { - reason: "BAD_DATA", - transaction, - info: { data } - }); - } - assert(ccipArgs.sender.toLowerCase() === txSender.toLowerCase(), "CCIP Read sender mismatch", "CALL_EXCEPTION", { - action: "call", - data, - reason: "OffchainLookup", - transaction, - invocation: null, - revert: { - signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", - name: "OffchainLookup", - args: ccipArgs.errorArgs - } - }); - const ccipResult = await this.ccipReadFetch(transaction, ccipArgs.calldata, ccipArgs.urls); - assert(ccipResult != null, "CCIP Read failed to fetch data", "OFFCHAIN_FAULT", { - reason: "FETCH_FAILED", - transaction, - info: { data: error.data, errorArgs: ccipArgs.errorArgs } - }); - const tx2 = { - to: txSender, - data: concat([ccipArgs.selector, encodeBytes([ccipResult, ccipArgs.extraData])]) - }; - this.emit("debug", { action: "sendCcipReadCall", transaction: tx2 }); - try { - const result = await __privateMethod(this, _call, call_fn).call(this, tx2, blockTag, attempt + 1); - this.emit("debug", { action: "receiveCcipReadCallResult", transaction: Object.assign({}, tx2), result }); - return result; - } catch (error2) { - this.emit("debug", { action: "receiveCcipReadCallError", transaction: Object.assign({}, tx2), error: error2 }); - throw error2; - } - } - throw error; - } -}; -_checkNetwork = new WeakSet(); -checkNetwork_fn = async function(promise) { - const { value } = await resolveProperties({ - network: this.getNetwork(), - value: promise - }); - return value; -}; -_getAccountValue = new WeakSet(); -getAccountValue_fn = async function(request, _address, _blockTag) { - let address = this._getAddress(_address); - let blockTag = this._getBlockTag(_blockTag); - if (typeof address !== "string" || typeof blockTag !== "string") { - [address, blockTag] = await Promise.all([address, blockTag]); - } - return await __privateMethod(this, _checkNetwork, checkNetwork_fn).call(this, __privateMethod(this, _perform, perform_fn).call(this, Object.assign(request, { address, blockTag }))); -}; -_getBlock = new WeakSet(); -getBlock_fn = async function(block, includeTransactions) { - if (isHexString(block, 32)) { - return await __privateMethod(this, _perform, perform_fn).call(this, { - method: "getBlock", - blockHash: block, - includeTransactions - }); - } - let blockTag = this._getBlockTag(block); - if (typeof blockTag !== "string") { - blockTag = await blockTag; - } - return await __privateMethod(this, _perform, perform_fn).call(this, { - method: "getBlock", - blockTag, - includeTransactions - }); -}; -_hasSub = new WeakSet(); -hasSub_fn = async function(event, emitArgs) { - let sub = await getSubscription(event, this); - if (sub.type === "event" && emitArgs && emitArgs.length > 0 && emitArgs[0].removed === true) { - sub = await getSubscription({ orphan: "drop-log", log: emitArgs[0] }, this); - } - return __privateGet(this, _subs).get(sub.tag) || null; -}; -_getSub = new WeakSet(); -getSub_fn = async function(event) { - const subscription = await getSubscription(event, this); - const tag = subscription.tag; - let sub = __privateGet(this, _subs).get(tag); - if (!sub) { - const subscriber = this._getSubscriber(subscription); - const addressableMap = /* @__PURE__ */ new WeakMap(); - const nameMap = /* @__PURE__ */ new Map(); - sub = { subscriber, tag, addressableMap, nameMap, started: false, listeners: [] }; - __privateGet(this, _subs).set(tag, sub); - } - return sub; -}; -function _parseString(result, start) { - try { - const bytes2 = _parseBytes(result, start); - if (bytes2) { - return toUtf8String(bytes2); - } - } catch (error) { - } - return null; -} -function _parseBytes(result, start) { - if (result === "0x") { - return null; - } - try { - const offset = getNumber(dataSlice(result, start, start + 32)); - const length = getNumber(dataSlice(result, offset, offset + 32)); - return dataSlice(result, offset + 32, offset + 32 + length); - } catch (error) { - } - return null; -} -function numPad(value) { - const result = toBeArray(value); - if (result.length > 32) { - throw new Error("internal; should not happen"); - } - const padded = new Uint8Array(32); - padded.set(result, 32 - result.length); - return padded; -} -function bytesPad(value) { - if (value.length % 32 === 0) { - return value; - } - const result = new Uint8Array(Math.ceil(value.length / 32) * 32); - result.set(value); - return result; -} -var empty = new Uint8Array([]); -function encodeBytes(datas) { - const result = []; - let byteCount = 0; - for (let i = 0; i < datas.length; i++) { - result.push(empty); - byteCount += 32; - } - for (let i = 0; i < datas.length; i++) { - const data = getBytes(datas[i]); - result[i] = numPad(byteCount); - result.push(numPad(data.length)); - result.push(bytesPad(data)); - byteCount += 32 + Math.ceil(data.length / 32) * 32; - } - return concat(result); -} -var zeros = "0x0000000000000000000000000000000000000000000000000000000000000000"; -function parseOffchainLookup(data) { - const result = { - sender: "", - urls: [], - calldata: "", - selector: "", - extraData: "", - errorArgs: [] - }; - assert(dataLength(data) >= 5 * 32, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", { - reason: "insufficient OffchainLookup data" - }); - const sender = dataSlice(data, 0, 32); - assert(dataSlice(sender, 0, 12) === dataSlice(zeros, 0, 12), "corrupt OffchainLookup sender", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup sender" - }); - result.sender = dataSlice(sender, 12); - try { - const urls = []; - const urlsOffset = getNumber(dataSlice(data, 32, 64)); - const urlsLength = getNumber(dataSlice(data, urlsOffset, urlsOffset + 32)); - const urlsData = dataSlice(data, urlsOffset + 32); - for (let u = 0; u < urlsLength; u++) { - const url = _parseString(urlsData, u * 32); - if (url == null) { - throw new Error("abort"); - } - urls.push(url); - } - result.urls = urls; - } catch (error) { - assert(false, "corrupt OffchainLookup urls", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup urls" - }); - } - try { - const calldata = _parseBytes(data, 64); - if (calldata == null) { - throw new Error("abort"); - } - result.calldata = calldata; - } catch (error) { - assert(false, "corrupt OffchainLookup calldata", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup calldata" - }); - } - assert(dataSlice(data, 100, 128) === dataSlice(zeros, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup callbaackSelector" - }); - result.selector = dataSlice(data, 96, 100); - try { - const extraData = _parseBytes(data, 128); - if (extraData == null) { - throw new Error("abort"); - } - result.extraData = extraData; - } catch (error) { - assert(false, "corrupt OffchainLookup extraData", "OFFCHAIN_FAULT", { - reason: "corrupt OffchainLookup extraData" - }); - } - result.errorArgs = "sender,urls,calldata,selector,extraData".split(/,/).map((k) => result[k]); - return result; -} - -// node_modules/ethers/lib.esm/providers/abstract-signer.js -function checkProvider(signer, operation) { - if (signer.provider) { - return signer.provider; - } - assert(false, "missing provider", "UNSUPPORTED_OPERATION", { operation }); -} -async function populate(signer, tx) { - let pop = copyRequest(tx); - if (pop.to != null) { - pop.to = resolveAddress(pop.to, signer); - } - if (pop.from != null) { - const from = pop.from; - pop.from = Promise.all([ - signer.getAddress(), - resolveAddress(from, signer) - ]).then(([address, from2]) => { - assertArgument(address.toLowerCase() === from2.toLowerCase(), "transaction from mismatch", "tx.from", from2); - return address; - }); - } else { - pop.from = signer.getAddress(); - } - return await resolveProperties(pop); -} -var AbstractSigner = class { - /** - * Creates a new Signer connected to %%provider%%. - */ - constructor(provider) { - /** - * The provider this signer is connected to. - */ - __publicField(this, "provider"); - defineProperties(this, { provider: provider || null }); - } - async getNonce(blockTag) { - return checkProvider(this, "getTransactionCount").getTransactionCount(await this.getAddress(), blockTag); - } - async populateCall(tx) { - const pop = await populate(this, tx); - return pop; - } - async populateTransaction(tx) { - const provider = checkProvider(this, "populateTransaction"); - const pop = await populate(this, tx); - if (pop.nonce == null) { - pop.nonce = await this.getNonce("pending"); - } - if (pop.gasLimit == null) { - pop.gasLimit = await this.estimateGas(pop); - } - const network = await this.provider.getNetwork(); - if (pop.chainId != null) { - const chainId = getBigInt(pop.chainId); - assertArgument(chainId === network.chainId, "transaction chainId mismatch", "tx.chainId", tx.chainId); - } else { - pop.chainId = network.chainId; - } - const hasEip1559 = pop.maxFeePerGas != null || pop.maxPriorityFeePerGas != null; - if (pop.gasPrice != null && (pop.type === 2 || hasEip1559)) { - assertArgument(false, "eip-1559 transaction do not support gasPrice", "tx", tx); - } else if ((pop.type === 0 || pop.type === 1) && hasEip1559) { - assertArgument(false, "pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas", "tx", tx); - } - if ((pop.type === 2 || pop.type == null) && (pop.maxFeePerGas != null && pop.maxPriorityFeePerGas != null)) { - pop.type = 2; - } else if (pop.type === 0 || pop.type === 1) { - const feeData = await provider.getFeeData(); - assert(feeData.gasPrice != null, "network does not support gasPrice", "UNSUPPORTED_OPERATION", { - operation: "getGasPrice" - }); - if (pop.gasPrice == null) { - pop.gasPrice = feeData.gasPrice; - } - } else { - const feeData = await provider.getFeeData(); - if (pop.type == null) { - if (feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null) { - pop.type = 2; - if (pop.gasPrice != null) { - const gasPrice = pop.gasPrice; - delete pop.gasPrice; - pop.maxFeePerGas = gasPrice; - pop.maxPriorityFeePerGas = gasPrice; - } else { - if (pop.maxFeePerGas == null) { - pop.maxFeePerGas = feeData.maxFeePerGas; - } - if (pop.maxPriorityFeePerGas == null) { - pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; - } - } - } else if (feeData.gasPrice != null) { - assert(!hasEip1559, "network does not support EIP-1559", "UNSUPPORTED_OPERATION", { - operation: "populateTransaction" - }); - if (pop.gasPrice == null) { - pop.gasPrice = feeData.gasPrice; - } - pop.type = 0; - } else { - assert(false, "failed to get consistent fee data", "UNSUPPORTED_OPERATION", { - operation: "signer.getFeeData" - }); - } - } else if (pop.type === 2) { - if (pop.maxFeePerGas == null) { - pop.maxFeePerGas = feeData.maxFeePerGas; - } - if (pop.maxPriorityFeePerGas == null) { - pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; - } - } - } - return await resolveProperties(pop); - } - async estimateGas(tx) { - return checkProvider(this, "estimateGas").estimateGas(await this.populateCall(tx)); - } - async call(tx) { - return checkProvider(this, "call").call(await this.populateCall(tx)); - } - async resolveName(name) { - const provider = checkProvider(this, "resolveName"); - return await provider.resolveName(name); - } - async sendTransaction(tx) { - const provider = checkProvider(this, "sendTransaction"); - const pop = await this.populateTransaction(tx); - delete pop.from; - const txObj = Transaction.from(pop); - return await provider.broadcastTransaction(await this.signTransaction(txObj)); - } -}; -var _throwUnsupported, throwUnsupported_fn; -var _VoidSigner = class _VoidSigner extends AbstractSigner { - /** - * Creates a new **VoidSigner** with %%address%% attached to - * %%provider%%. - */ - constructor(address, provider) { - super(provider); - __privateAdd(this, _throwUnsupported); - /** - * The signer address. - */ - __publicField(this, "address"); - defineProperties(this, { address }); - } - async getAddress() { - return this.address; - } - connect(provider) { - return new _VoidSigner(this.address, provider); - } - async signTransaction(tx) { - __privateMethod(this, _throwUnsupported, throwUnsupported_fn).call(this, "transactions", "signTransaction"); - } - async signMessage(message) { - __privateMethod(this, _throwUnsupported, throwUnsupported_fn).call(this, "messages", "signMessage"); - } - async signTypedData(domain, types, value) { - __privateMethod(this, _throwUnsupported, throwUnsupported_fn).call(this, "typed-data", "signTypedData"); - } -}; -_throwUnsupported = new WeakSet(); -throwUnsupported_fn = function(suffix, operation) { - assert(false, `VoidSigner cannot sign ${suffix}`, "UNSUPPORTED_OPERATION", { operation }); -}; -var VoidSigner = _VoidSigner; - -// node_modules/ethers/lib.esm/providers/community.js -var shown = /* @__PURE__ */ new Set(); -function showThrottleMessage(service) { - if (shown.has(service)) { - return; - } - shown.add(service); - console.log("========= NOTICE ========="); - console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`); - console.log(""); - console.log("The default API keys for each service are provided as a highly-throttled,"); - console.log("community resource for low-traffic projects and early prototyping."); - console.log(""); - console.log("While your application will continue to function, we highly recommended"); - console.log("signing up for your own API keys to improve performance, increase your"); - console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."); - console.log(""); - console.log("For more details: https://docs.ethers.org/api-keys/"); - console.log("=========================="); -} - -// node_modules/ethers/lib.esm/providers/subscriber-filterid.js -function copy3(obj) { - return JSON.parse(JSON.stringify(obj)); -} -var _provider4, _filterIdPromise, _poller3, _running3, _network, _hault, _poll4, poll_fn3, _teardown, teardown_fn; -var FilterIdSubscriber = class { - /** - * Creates a new **FilterIdSubscriber** which will used [[_subscribe]] - * and [[_emitResults]] to setup the subscription and provide the event - * to the %%provider%%. - */ - constructor(provider) { - __privateAdd(this, _poll4); - __privateAdd(this, _teardown); - __privateAdd(this, _provider4, void 0); - __privateAdd(this, _filterIdPromise, void 0); - __privateAdd(this, _poller3, void 0); - __privateAdd(this, _running3, void 0); - __privateAdd(this, _network, void 0); - __privateAdd(this, _hault, void 0); - __privateSet(this, _provider4, provider); - __privateSet(this, _filterIdPromise, null); - __privateSet(this, _poller3, __privateMethod(this, _poll4, poll_fn3).bind(this)); - __privateSet(this, _running3, false); - __privateSet(this, _network, null); - __privateSet(this, _hault, false); - } - /** - * Sub-classes **must** override this to begin the subscription. - */ - _subscribe(provider) { - throw new Error("subclasses must override this"); - } - /** - * Sub-classes **must** override this handle the events. - */ - _emitResults(provider, result) { - throw new Error("subclasses must override this"); - } - /** - * Sub-classes **must** override this handle recovery on errors. - */ - _recover(provider) { - throw new Error("subclasses must override this"); - } - start() { - if (__privateGet(this, _running3)) { - return; - } - __privateSet(this, _running3, true); - __privateMethod(this, _poll4, poll_fn3).call(this, -2); - } - stop() { - if (!__privateGet(this, _running3)) { - return; - } - __privateSet(this, _running3, false); - __privateSet(this, _hault, true); - __privateMethod(this, _teardown, teardown_fn).call(this); - __privateGet(this, _provider4).off("block", __privateGet(this, _poller3)); - } - pause(dropWhilePaused) { - if (dropWhilePaused) { - __privateMethod(this, _teardown, teardown_fn).call(this); - } - __privateGet(this, _provider4).off("block", __privateGet(this, _poller3)); - } - resume() { - this.start(); - } -}; -_provider4 = new WeakMap(); -_filterIdPromise = new WeakMap(); -_poller3 = new WeakMap(); -_running3 = new WeakMap(); -_network = new WeakMap(); -_hault = new WeakMap(); -_poll4 = new WeakSet(); -poll_fn3 = async function(blockNumber) { - try { - if (__privateGet(this, _filterIdPromise) == null) { - __privateSet(this, _filterIdPromise, this._subscribe(__privateGet(this, _provider4))); - } - let filterId = null; - try { - filterId = await __privateGet(this, _filterIdPromise); - } catch (error) { - if (!isError(error, "UNSUPPORTED_OPERATION") || error.operation !== "eth_newFilter") { - throw error; - } - } - if (filterId == null) { - __privateSet(this, _filterIdPromise, null); - __privateGet(this, _provider4)._recoverSubscriber(this, this._recover(__privateGet(this, _provider4))); - return; - } - const network = await __privateGet(this, _provider4).getNetwork(); - if (!__privateGet(this, _network)) { - __privateSet(this, _network, network); - } - if (__privateGet(this, _network).chainId !== network.chainId) { - throw new Error("chaid changed"); - } - if (__privateGet(this, _hault)) { - return; - } - const result = await __privateGet(this, _provider4).send("eth_getFilterChanges", [filterId]); - await this._emitResults(__privateGet(this, _provider4), result); - } catch (error) { - console.log("@TODO", error); - } - __privateGet(this, _provider4).once("block", __privateGet(this, _poller3)); -}; -_teardown = new WeakSet(); -teardown_fn = function() { - const filterIdPromise = __privateGet(this, _filterIdPromise); - if (filterIdPromise) { - __privateSet(this, _filterIdPromise, null); - filterIdPromise.then((filterId) => { - __privateGet(this, _provider4).send("eth_uninstallFilter", [filterId]); - }); - } -}; -var _event; -var FilterIdEventSubscriber = class extends FilterIdSubscriber { - /** - * Creates a new **FilterIdEventSubscriber** attached to %%provider%% - * listening for %%filter%%. - */ - constructor(provider, filter) { - super(provider); - __privateAdd(this, _event, void 0); - __privateSet(this, _event, copy3(filter)); - } - _recover(provider) { - return new PollingEventSubscriber(provider, __privateGet(this, _event)); - } - async _subscribe(provider) { - const filterId = await provider.send("eth_newFilter", [__privateGet(this, _event)]); - return filterId; - } - async _emitResults(provider, results) { - for (const result of results) { - provider.emit(__privateGet(this, _event), provider._wrapLog(result, provider._network)); - } - } -}; -_event = new WeakMap(); -var FilterIdPendingSubscriber = class extends FilterIdSubscriber { - async _subscribe(provider) { - return await provider.send("eth_newPendingTransactionFilter", []); - } - async _emitResults(provider, results) { - for (const result of results) { - provider.emit("pending", result); - } - } -}; - -// node_modules/ethers/lib.esm/providers/provider-jsonrpc.js -var Primitive = "bigint,boolean,function,number,string,symbol".split(/,/g); -function deepCopy(value) { - if (value == null || Primitive.indexOf(typeof value) >= 0) { - return value; - } - if (typeof value.getAddress === "function") { - return value; - } - if (Array.isArray(value)) { - return value.map(deepCopy); - } - if (typeof value === "object") { - return Object.keys(value).reduce((accum, key) => { - accum[key] = value[key]; - return accum; - }, {}); - } - throw new Error(`should not happen: ${value} (${typeof value})`); -} -function stall(duration) { - return new Promise((resolve) => { - setTimeout(resolve, duration); - }); -} -function getLowerCase(value) { - if (value) { - return value.toLowerCase(); - } - return value; -} -function isPollable(value) { - return value && typeof value.pollingInterval === "number"; -} -var defaultOptions2 = { - polling: false, - staticNetwork: null, - batchStallTime: 10, - batchMaxSize: 1 << 20, - batchMaxCount: 100, - cacheTimeout: 250, - pollingInterval: 4e3 -}; -var JsonRpcSigner = class extends AbstractSigner { - constructor(provider, address) { - super(provider); - __publicField(this, "address"); - address = getAddress(address); - defineProperties(this, { address }); - } - connect(provider) { - assert(false, "cannot reconnect JsonRpcSigner", "UNSUPPORTED_OPERATION", { - operation: "signer.connect" - }); - } - async getAddress() { - return this.address; - } - // JSON-RPC will automatially fill in nonce, etc. so we just check from - async populateTransaction(tx) { - return await this.populateCall(tx); - } - // Returns just the hash of the transaction after sent, which is what - // the bare JSON-RPC API does; - async sendUncheckedTransaction(_tx) { - const tx = deepCopy(_tx); - const promises = []; - if (tx.from) { - const _from = tx.from; - promises.push((async () => { - const from = await resolveAddress(_from, this.provider); - assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); - tx.from = from; - })()); - } else { - tx.from = this.address; - } - if (tx.gasLimit == null) { - promises.push((async () => { - tx.gasLimit = await this.provider.estimateGas({ ...tx, from: this.address }); - })()); - } - if (tx.to != null) { - const _to2 = tx.to; - promises.push((async () => { - tx.to = await resolveAddress(_to2, this.provider); - })()); - } - if (promises.length) { - await Promise.all(promises); - } - const hexTx = this.provider.getRpcTransaction(tx); - return this.provider.send("eth_sendTransaction", [hexTx]); - } - async sendTransaction(tx) { - const blockNumber = await this.provider.getBlockNumber(); - const hash2 = await this.sendUncheckedTransaction(tx); - return await new Promise((resolve, reject) => { - const timeouts = [1e3, 100]; - let invalids = 0; - const checkTx = async () => { - try { - const tx2 = await this.provider.getTransaction(hash2); - if (tx2 != null) { - resolve(tx2.replaceableTransaction(blockNumber)); - return; - } - } catch (error) { - if (isError(error, "CANCELLED") || isError(error, "BAD_DATA") || isError(error, "NETWORK_ERROR")) { - if (error.info == null) { - error.info = {}; - } - error.info.sendTransactionHash = hash2; - reject(error); - return; - } - if (isError(error, "INVALID_ARGUMENT")) { - invalids++; - if (error.info == null) { - error.info = {}; - } - error.info.sendTransactionHash = hash2; - if (invalids > 10) { - reject(error); - return; - } - } - this.provider.emit("error", makeError("failed to fetch transation after sending (will try again)", "UNKNOWN_ERROR", { error })); - } - this.provider._setTimeout(() => { - checkTx(); - }, timeouts.pop() || 4e3); - }; - checkTx(); - }); - } - async signTransaction(_tx) { - const tx = deepCopy(_tx); - if (tx.from) { - const from = await resolveAddress(tx.from, this.provider); - assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); - tx.from = from; - } else { - tx.from = this.address; - } - const hexTx = this.provider.getRpcTransaction(tx); - return await this.provider.send("eth_signTransaction", [hexTx]); - } - async signMessage(_message) { - const message = typeof _message === "string" ? toUtf8Bytes(_message) : _message; - return await this.provider.send("personal_sign", [ - hexlify(message), - this.address.toLowerCase() - ]); - } - async signTypedData(domain, types, _value2) { - const value = deepCopy(_value2); - const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (value2) => { - const address = await resolveAddress(value2); - assertArgument(address != null, "TypedData does not support null address", "value", value2); - return address; - }); - return await this.provider.send("eth_signTypedData_v4", [ - this.address.toLowerCase(), - JSON.stringify(TypedDataEncoder.getPayload(populated.domain, types, populated.value)) - ]); - } - async unlock(password) { - return this.provider.send("personal_unlockAccount", [ - this.address.toLowerCase(), - password, - null - ]); - } - // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign - async _legacySignMessage(_message) { - const message = typeof _message === "string" ? toUtf8Bytes(_message) : _message; - return await this.provider.send("eth_sign", [ - this.address.toLowerCase(), - hexlify(message) - ]); - } -}; -var _options3, _nextId, _payloads, _drainTimer, _notReady, _network2, _pendingDetectNetwork, _scheduleDrain, scheduleDrain_fn; -var JsonRpcApiProvider = class extends AbstractProvider { - constructor(network, options) { - super(network, options); - __privateAdd(this, _scheduleDrain); - __privateAdd(this, _options3, void 0); - // The next ID to use for the JSON-RPC ID field - __privateAdd(this, _nextId, void 0); - // Payloads are queued and triggered in batches using the drainTimer - __privateAdd(this, _payloads, void 0); - __privateAdd(this, _drainTimer, void 0); - __privateAdd(this, _notReady, void 0); - __privateAdd(this, _network2, void 0); - __privateAdd(this, _pendingDetectNetwork, void 0); - __privateSet(this, _nextId, 1); - __privateSet(this, _options3, Object.assign({}, defaultOptions2, options || {})); - __privateSet(this, _payloads, []); - __privateSet(this, _drainTimer, null); - __privateSet(this, _network2, null); - __privateSet(this, _pendingDetectNetwork, null); - { - let resolve = null; - const promise = new Promise((_resolve) => { - resolve = _resolve; - }); - __privateSet(this, _notReady, { promise, resolve }); - } - const staticNetwork = this._getOption("staticNetwork"); - if (typeof staticNetwork === "boolean") { - assertArgument(!staticNetwork || network !== "any", "staticNetwork cannot be used on special network 'any'", "options", options); - if (staticNetwork && network != null) { - __privateSet(this, _network2, Network.from(network)); - } - } else if (staticNetwork) { - assertArgument(network == null || staticNetwork.matches(network), "staticNetwork MUST match network object", "options", options); - __privateSet(this, _network2, staticNetwork); - } - } - /** - * Returns the value associated with the option %%key%%. - * - * Sub-classes can use this to inquire about configuration options. - */ - _getOption(key) { - return __privateGet(this, _options3)[key]; - } - /** - * Gets the [[Network]] this provider has committed to. On each call, the network - * is detected, and if it has changed, the call will reject. - */ - get _network() { - assert(__privateGet(this, _network2), "network is not available yet", "NETWORK_ERROR"); - return __privateGet(this, _network2); - } - /** - * Resolves to the non-normalized value by performing %%req%%. - * - * Sub-classes may override this to modify behavior of actions, - * and should generally call ``super._perform`` as a fallback. - */ - async _perform(req) { - if (req.method === "call" || req.method === "estimateGas") { - let tx = req.transaction; - if (tx && tx.type != null && getBigInt(tx.type)) { - if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) { - const feeData = await this.getFeeData(); - if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) { - req = Object.assign({}, req, { - transaction: Object.assign({}, tx, { type: void 0 }) - }); - } - } - } - } - const request = this.getRpcRequest(req); - if (request != null) { - return await this.send(request.method, request.args); - } - return super._perform(req); - } - /** - * Sub-classes may override this; it detects the *actual* network that - * we are **currently** connected to. - * - * Keep in mind that [[send]] may only be used once [[ready]], otherwise the - * _send primitive must be used instead. - */ - async _detectNetwork() { - const network = this._getOption("staticNetwork"); - if (network) { - if (network === true) { - if (__privateGet(this, _network2)) { - return __privateGet(this, _network2); - } - } else { - return network; - } - } - if (__privateGet(this, _pendingDetectNetwork)) { - return await __privateGet(this, _pendingDetectNetwork); - } - if (this.ready) { - __privateSet(this, _pendingDetectNetwork, (async () => { - try { - const result = Network.from(getBigInt(await this.send("eth_chainId", []))); - __privateSet(this, _pendingDetectNetwork, null); - return result; - } catch (error) { - __privateSet(this, _pendingDetectNetwork, null); - throw error; - } - })()); - return await __privateGet(this, _pendingDetectNetwork); - } - __privateSet(this, _pendingDetectNetwork, (async () => { - const payload = { - id: __privateWrapper(this, _nextId)._++, - method: "eth_chainId", - params: [], - jsonrpc: "2.0" - }; - this.emit("debug", { action: "sendRpcPayload", payload }); - let result; - try { - result = (await this._send(payload))[0]; - __privateSet(this, _pendingDetectNetwork, null); - } catch (error) { - __privateSet(this, _pendingDetectNetwork, null); - this.emit("debug", { action: "receiveRpcError", error }); - throw error; - } - this.emit("debug", { action: "receiveRpcResult", result }); - if ("result" in result) { - return Network.from(getBigInt(result.result)); - } - throw this.getRpcError(payload, result); - })()); - return await __privateGet(this, _pendingDetectNetwork); - } - /** - * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls - * will be passed to [[_send]] from [[send]]. If it is overridden, then - * ``super._start()`` **MUST** be called. - * - * Calling it multiple times is safe and has no effect. - */ - _start() { - if (__privateGet(this, _notReady) == null || __privateGet(this, _notReady).resolve == null) { - return; - } - __privateGet(this, _notReady).resolve(); - __privateSet(this, _notReady, null); - (async () => { - while (__privateGet(this, _network2) == null && !this.destroyed) { - try { - __privateSet(this, _network2, await this._detectNetwork()); - } catch (error) { - if (this.destroyed) { - break; - } - console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"); - this.emit("error", makeError("failed to bootstrap network detection", "NETWORK_ERROR", { event: "initial-network-discovery", info: { error } })); - await stall(1e3); - } - } - __privateMethod(this, _scheduleDrain, scheduleDrain_fn).call(this); - })(); - } - /** - * Resolves once the [[_start]] has been called. This can be used in - * sub-classes to defer sending data until the connection has been - * established. - */ - async _waitUntilReady() { - if (__privateGet(this, _notReady) == null) { - return; - } - return await __privateGet(this, _notReady).promise; - } - /** - * Return a Subscriber that will manage the %%sub%%. - * - * Sub-classes may override this to modify the behavior of - * subscription management. - */ - _getSubscriber(sub) { - if (sub.type === "pending") { - return new FilterIdPendingSubscriber(this); - } - if (sub.type === "event") { - if (this._getOption("polling")) { - return new PollingEventSubscriber(this, sub.filter); - } - return new FilterIdEventSubscriber(this, sub.filter); - } - if (sub.type === "orphan" && sub.filter.orphan === "drop-log") { - return new UnmanagedSubscriber("orphan"); - } - return super._getSubscriber(sub); - } - /** - * Returns true only if the [[_start]] has been called. - */ - get ready() { - return __privateGet(this, _notReady) == null; - } - /** - * Returns %%tx%% as a normalized JSON-RPC transaction request, - * which has all values hexlified and any numeric values converted - * to Quantity values. - */ - getRpcTransaction(tx) { - const result = {}; - ["chainId", "gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach((key) => { - if (tx[key] == null) { - return; - } - let dstKey = key; - if (key === "gasLimit") { - dstKey = "gas"; - } - result[dstKey] = toQuantity(getBigInt(tx[key], `tx.${key}`)); - }); - ["from", "to", "data"].forEach((key) => { - if (tx[key] == null) { - return; - } - result[key] = hexlify(tx[key]); - }); - if (tx.accessList) { - result["accessList"] = accessListify(tx.accessList); - } - return result; - } - /** - * Returns the request method and arguments required to perform - * %%req%%. - */ - getRpcRequest(req) { - switch (req.method) { - case "chainId": - return { method: "eth_chainId", args: [] }; - case "getBlockNumber": - return { method: "eth_blockNumber", args: [] }; - case "getGasPrice": - return { method: "eth_gasPrice", args: [] }; - case "getPriorityFee": - return { method: "eth_maxPriorityFeePerGas", args: [] }; - case "getBalance": - return { - method: "eth_getBalance", - args: [getLowerCase(req.address), req.blockTag] - }; - case "getTransactionCount": - return { - method: "eth_getTransactionCount", - args: [getLowerCase(req.address), req.blockTag] - }; - case "getCode": - return { - method: "eth_getCode", - args: [getLowerCase(req.address), req.blockTag] - }; - case "getStorage": - return { - method: "eth_getStorageAt", - args: [ - getLowerCase(req.address), - "0x" + req.position.toString(16), - req.blockTag - ] - }; - case "broadcastTransaction": - return { - method: "eth_sendRawTransaction", - args: [req.signedTransaction] - }; - case "getBlock": - if ("blockTag" in req) { - return { - method: "eth_getBlockByNumber", - args: [req.blockTag, !!req.includeTransactions] - }; - } else if ("blockHash" in req) { - return { - method: "eth_getBlockByHash", - args: [req.blockHash, !!req.includeTransactions] - }; - } - break; - case "getTransaction": - return { - method: "eth_getTransactionByHash", - args: [req.hash] - }; - case "getTransactionReceipt": - return { - method: "eth_getTransactionReceipt", - args: [req.hash] - }; - case "call": - return { - method: "eth_call", - args: [this.getRpcTransaction(req.transaction), req.blockTag] - }; - case "estimateGas": { - return { - method: "eth_estimateGas", - args: [this.getRpcTransaction(req.transaction)] - }; - } - case "getLogs": - if (req.filter && req.filter.address != null) { - if (Array.isArray(req.filter.address)) { - req.filter.address = req.filter.address.map(getLowerCase); - } else { - req.filter.address = getLowerCase(req.filter.address); - } - } - return { method: "eth_getLogs", args: [req.filter] }; - } - return null; - } - /** - * Returns an ethers-style Error for the given JSON-RPC error - * %%payload%%, coalescing the various strings and error shapes - * that different nodes return, coercing them into a machine-readable - * standardized error. - */ - getRpcError(payload, _error2) { - const { method } = payload; - const { error } = _error2; - if (method === "eth_estimateGas" && error.message) { - const msg = error.message; - if (!msg.match(/revert/i) && msg.match(/insufficient funds/i)) { - return makeError("insufficient funds", "INSUFFICIENT_FUNDS", { - transaction: payload.params[0], - info: { payload, error } - }); - } - } - if (method === "eth_call" || method === "eth_estimateGas") { - const result = spelunkData(error); - const e = AbiCoder.getBuiltinCallException(method === "eth_call" ? "call" : "estimateGas", payload.params[0], result ? result.data : null); - e.info = { error, payload }; - return e; - } - const message = JSON.stringify(spelunkMessage(error)); - if (typeof error.message === "string" && error.message.match(/user denied|ethers-user-denied/i)) { - const actionMap = { - eth_sign: "signMessage", - personal_sign: "signMessage", - eth_signTypedData_v4: "signTypedData", - eth_signTransaction: "signTransaction", - eth_sendTransaction: "sendTransaction", - eth_requestAccounts: "requestAccess", - wallet_requestAccounts: "requestAccess" - }; - return makeError(`user rejected action`, "ACTION_REJECTED", { - action: actionMap[method] || "unknown", - reason: "rejected", - info: { payload, error } - }); - } - if (method === "eth_sendRawTransaction" || method === "eth_sendTransaction") { - const transaction = payload.params[0]; - if (message.match(/insufficient funds|base fee exceeds gas limit/i)) { - return makeError("insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", { - transaction, - info: { error } - }); - } - if (message.match(/nonce/i) && message.match(/too low/i)) { - return makeError("nonce has already been used", "NONCE_EXPIRED", { transaction, info: { error } }); - } - if (message.match(/replacement transaction/i) && message.match(/underpriced/i)) { - return makeError("replacement fee too low", "REPLACEMENT_UNDERPRICED", { transaction, info: { error } }); - } - if (message.match(/only replay-protected/i)) { - return makeError("legacy pre-eip-155 transactions not supported", "UNSUPPORTED_OPERATION", { - operation: method, - info: { transaction, info: { error } } - }); - } - } - let unsupported = !!message.match(/the method .* does not exist/i); - if (!unsupported) { - if (error && error.details && error.details.startsWith("Unauthorized method:")) { - unsupported = true; - } - } - if (unsupported) { - return makeError("unsupported operation", "UNSUPPORTED_OPERATION", { - operation: payload.method, - info: { error, payload } - }); - } - return makeError("could not coalesce error", "UNKNOWN_ERROR", { error, payload }); - } - /** - * Requests the %%method%% with %%params%% via the JSON-RPC protocol - * over the underlying channel. This can be used to call methods - * on the backend that do not have a high-level API within the Provider - * API. - * - * This method queues requests according to the batch constraints - * in the options, assigns the request a unique ID. - * - * **Do NOT override** this method in sub-classes; instead - * override [[_send]] or force the options values in the - * call to the constructor to modify this method's behavior. - */ - send(method, params) { - if (this.destroyed) { - return Promise.reject(makeError("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: method })); - } - const id2 = __privateWrapper(this, _nextId)._++; - const promise = new Promise((resolve, reject) => { - __privateGet(this, _payloads).push({ - resolve, - reject, - payload: { method, params, id: id2, jsonrpc: "2.0" } - }); - }); - __privateMethod(this, _scheduleDrain, scheduleDrain_fn).call(this); - return promise; - } - /** - * Resolves to the [[Signer]] account for %%address%% managed by - * the client. - * - * If the %%address%% is a number, it is used as an index in the - * the accounts from [[listAccounts]]. - * - * This can only be used on clients which manage accounts (such as - * Geth with imported account or MetaMask). - * - * Throws if the account doesn't exist. - */ - async getSigner(address) { - if (address == null) { - address = 0; - } - const accountsPromise = this.send("eth_accounts", []); - if (typeof address === "number") { - const accounts2 = await accountsPromise; - if (address >= accounts2.length) { - throw new Error("no such account"); - } - return new JsonRpcSigner(this, accounts2[address]); - } - const { accounts } = await resolveProperties({ - network: this.getNetwork(), - accounts: accountsPromise - }); - address = getAddress(address); - for (const account of accounts) { - if (getAddress(account) === address) { - return new JsonRpcSigner(this, address); - } - } - throw new Error("invalid account"); - } - async listAccounts() { - const accounts = await this.send("eth_accounts", []); - return accounts.map((a) => new JsonRpcSigner(this, a)); - } - destroy() { - if (__privateGet(this, _drainTimer)) { - clearTimeout(__privateGet(this, _drainTimer)); - __privateSet(this, _drainTimer, null); - } - for (const { payload, reject } of __privateGet(this, _payloads)) { - reject(makeError("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: payload.method })); - } - __privateSet(this, _payloads, []); - super.destroy(); - } -}; -_options3 = new WeakMap(); -_nextId = new WeakMap(); -_payloads = new WeakMap(); -_drainTimer = new WeakMap(); -_notReady = new WeakMap(); -_network2 = new WeakMap(); -_pendingDetectNetwork = new WeakMap(); -_scheduleDrain = new WeakSet(); -scheduleDrain_fn = function() { - if (__privateGet(this, _drainTimer)) { - return; - } - const stallTime = this._getOption("batchMaxCount") === 1 ? 0 : this._getOption("batchStallTime"); - __privateSet(this, _drainTimer, setTimeout(() => { - __privateSet(this, _drainTimer, null); - const payloads = __privateGet(this, _payloads); - __privateSet(this, _payloads, []); - while (payloads.length) { - const batch = [payloads.shift()]; - while (payloads.length) { - if (batch.length === __privateGet(this, _options3).batchMaxCount) { - break; - } - batch.push(payloads.shift()); - const bytes2 = JSON.stringify(batch.map((p) => p.payload)); - if (bytes2.length > __privateGet(this, _options3).batchMaxSize) { - payloads.unshift(batch.pop()); - break; - } - } - (async () => { - const payload = batch.length === 1 ? batch[0].payload : batch.map((p) => p.payload); - this.emit("debug", { action: "sendRpcPayload", payload }); - try { - const result = await this._send(payload); - this.emit("debug", { action: "receiveRpcResult", result }); - for (const { resolve, reject, payload: payload2 } of batch) { - if (this.destroyed) { - reject(makeError("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: payload2.method })); - continue; - } - const resp = result.filter((r) => r.id === payload2.id)[0]; - if (resp == null) { - const error = makeError("missing response for request", "BAD_DATA", { - value: result, - info: { payload: payload2 } - }); - this.emit("error", error); - reject(error); - continue; - } - if ("error" in resp) { - reject(this.getRpcError(payload2, resp)); - continue; - } - resolve(resp.result); - } - } catch (error) { - this.emit("debug", { action: "receiveRpcError", error }); - for (const { reject } of batch) { - reject(error); - } - } - })(); - } - }, stallTime)); -}; -var _pollingInterval; -var JsonRpcApiPollingProvider = class extends JsonRpcApiProvider { - constructor(network, options) { - super(network, options); - __privateAdd(this, _pollingInterval, void 0); - __privateSet(this, _pollingInterval, 4e3); - } - _getSubscriber(sub) { - const subscriber = super._getSubscriber(sub); - if (isPollable(subscriber)) { - subscriber.pollingInterval = __privateGet(this, _pollingInterval); - } - return subscriber; - } - /** - * The polling interval (default: 4000 ms) - */ - get pollingInterval() { - return __privateGet(this, _pollingInterval); - } - set pollingInterval(value) { - if (!Number.isInteger(value) || value < 0) { - throw new Error("invalid interval"); - } - __privateSet(this, _pollingInterval, value); - this._forEachSubscriber((sub) => { - if (isPollable(sub)) { - sub.pollingInterval = __privateGet(this, _pollingInterval); - } - }); - } -}; -_pollingInterval = new WeakMap(); -var _connect; -var JsonRpcProvider = class extends JsonRpcApiPollingProvider { - constructor(url, network, options) { - if (url == null) { - url = "http://localhost:8545"; - } - super(network, options); - __privateAdd(this, _connect, void 0); - if (typeof url === "string") { - __privateSet(this, _connect, new FetchRequest(url)); - } else { - __privateSet(this, _connect, url.clone()); - } - } - _getConnection() { - return __privateGet(this, _connect).clone(); - } - async send(method, params) { - await this._start(); - return await super.send(method, params); - } - async _send(payload) { - const request = this._getConnection(); - request.body = JSON.stringify(payload); - request.setHeader("content-type", "application/json"); - const response = await request.send(); - response.assertOk(); - let resp = response.bodyJson; - if (!Array.isArray(resp)) { - resp = [resp]; - } - return resp; - } -}; -_connect = new WeakMap(); -function spelunkData(value) { - if (value == null) { - return null; - } - if (typeof value.message === "string" && value.message.match(/revert/i) && isHexString(value.data)) { - return { message: value.message, data: value.data }; - } - if (typeof value === "object") { - for (const key in value) { - const result = spelunkData(value[key]); - if (result) { - return result; - } - } - return null; - } - if (typeof value === "string") { - try { - return spelunkData(JSON.parse(value)); - } catch (error) { - } - } - return null; -} -function _spelunkMessage(value, result) { - if (value == null) { - return; - } - if (typeof value.message === "string") { - result.push(value.message); - } - if (typeof value === "object") { - for (const key in value) { - _spelunkMessage(value[key], result); - } - } - if (typeof value === "string") { - try { - return _spelunkMessage(JSON.parse(value), result); - } catch (error) { - } - } -} -function spelunkMessage(value) { - const result = []; - _spelunkMessage(value, result); - return result; -} - -// node_modules/ethers/lib.esm/providers/provider-ankr.js -var defaultApiKey = "9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972"; -function getHost(name) { - switch (name) { - case "mainnet": - return "rpc.ankr.com/eth"; - case "goerli": - return "rpc.ankr.com/eth_goerli"; - case "sepolia": - return "rpc.ankr.com/eth_sepolia"; - case "arbitrum": - return "rpc.ankr.com/arbitrum"; - case "base": - return "rpc.ankr.com/base"; - case "base-goerli": - return "rpc.ankr.com/base_goerli"; - case "base-sepolia": - return "rpc.ankr.com/base_sepolia"; - case "bnb": - return "rpc.ankr.com/bsc"; - case "bnbt": - return "rpc.ankr.com/bsc_testnet_chapel"; - case "matic": - return "rpc.ankr.com/polygon"; - case "matic-mumbai": - return "rpc.ankr.com/polygon_mumbai"; - case "optimism": - return "rpc.ankr.com/optimism"; - case "optimism-goerli": - return "rpc.ankr.com/optimism_testnet"; - case "optimism-sepolia": - return "rpc.ankr.com/optimism_sepolia"; - } - assertArgument(false, "unsupported network", "network", name); -} -var AnkrProvider = class _AnkrProvider extends JsonRpcProvider { - /** - * Create a new **AnkrProvider**. - * - * By default connecting to ``mainnet`` with a highly throttled - * API key. - */ - constructor(_network3, apiKey) { - if (_network3 == null) { - _network3 = "mainnet"; - } - const network = Network.from(_network3); - if (apiKey == null) { - apiKey = defaultApiKey; - } - const options = { polling: true, staticNetwork: network }; - const request = _AnkrProvider.getRequest(network, apiKey); - super(request, network, options); - /** - * The API key for the Ankr connection. - */ - __publicField(this, "apiKey"); - defineProperties(this, { apiKey }); - } - _getProvider(chainId) { - try { - return new _AnkrProvider(chainId, this.apiKey); - } catch (error) { - } - return super._getProvider(chainId); - } - /** - * Returns a prepared request for connecting to %%network%% with - * %%apiKey%%. - */ - static getRequest(network, apiKey) { - if (apiKey == null) { - apiKey = defaultApiKey; - } - const request = new FetchRequest(`https://${getHost(network.name)}/${apiKey}`); - request.allowGzip = true; - if (apiKey === defaultApiKey) { - request.retryFunc = async (request2, response, attempt) => { - showThrottleMessage("AnkrProvider"); - return true; - }; - } - return request; - } - getRpcError(payload, error) { - if (payload.method === "eth_sendRawTransaction") { - if (error && error.error && error.error.message === "INTERNAL_ERROR: could not replace existing tx") { - error.error.message = "replacement transaction underpriced"; - } - } - return super.getRpcError(payload, error); - } - isCommunityResource() { - return this.apiKey === defaultApiKey; - } -}; - -// node_modules/ethers/lib.esm/providers/provider-alchemy.js -var defaultApiKey2 = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"; -function getHost2(name) { - switch (name) { - case "mainnet": - return "eth-mainnet.alchemyapi.io"; - case "goerli": - return "eth-goerli.g.alchemy.com"; - case "sepolia": - return "eth-sepolia.g.alchemy.com"; - case "arbitrum": - return "arb-mainnet.g.alchemy.com"; - case "arbitrum-goerli": - return "arb-goerli.g.alchemy.com"; - case "arbitrum-sepolia": - return "arb-sepolia.g.alchemy.com"; - case "base": - return "base-mainnet.g.alchemy.com"; - case "base-goerli": - return "base-goerli.g.alchemy.com"; - case "base-sepolia": - return "base-sepolia.g.alchemy.com"; - case "matic": - return "polygon-mainnet.g.alchemy.com"; - case "matic-mumbai": - return "polygon-mumbai.g.alchemy.com"; - case "optimism": - return "opt-mainnet.g.alchemy.com"; - case "optimism-goerli": - return "opt-goerli.g.alchemy.com"; - case "optimism-sepolia": - return "opt-sepolia.g.alchemy.com"; - } - assertArgument(false, "unsupported network", "network", name); -} -var AlchemyProvider = class _AlchemyProvider extends JsonRpcProvider { - constructor(_network3, apiKey) { - if (_network3 == null) { - _network3 = "mainnet"; - } - const network = Network.from(_network3); - if (apiKey == null) { - apiKey = defaultApiKey2; - } - const request = _AlchemyProvider.getRequest(network, apiKey); - super(request, network, { staticNetwork: network }); - __publicField(this, "apiKey"); - defineProperties(this, { apiKey }); - } - _getProvider(chainId) { - try { - return new _AlchemyProvider(chainId, this.apiKey); - } catch (error) { - } - return super._getProvider(chainId); - } - async _perform(req) { - if (req.method === "getTransactionResult") { - const { trace, tx } = await resolveProperties({ - trace: this.send("trace_transaction", [req.hash]), - tx: this.getTransaction(req.hash) - }); - if (trace == null || tx == null) { - return null; - } - let data; - let error = false; - try { - data = trace[0].result.output; - error = trace[0].error === "Reverted"; - } catch (error2) { - } - if (data) { - assert(!error, "an error occurred during transaction executions", "CALL_EXCEPTION", { - action: "getTransactionResult", - data, - reason: null, - transaction: tx, - invocation: null, - revert: null - // @TODO - }); - return data; - } - assert(false, "could not parse trace result", "BAD_DATA", { value: trace }); - } - return await super._perform(req); - } - isCommunityResource() { - return this.apiKey === defaultApiKey2; - } - static getRequest(network, apiKey) { - if (apiKey == null) { - apiKey = defaultApiKey2; - } - const request = new FetchRequest(`https://${getHost2(network.name)}/v2/${apiKey}`); - request.allowGzip = true; - if (apiKey === defaultApiKey2) { - request.retryFunc = async (request2, response, attempt) => { - showThrottleMessage("alchemy"); - return true; - }; - } - return request; - } -}; - -// node_modules/ethers/lib.esm/providers/provider-cloudflare.js -var CloudflareProvider = class extends JsonRpcProvider { - constructor(_network3) { - if (_network3 == null) { - _network3 = "mainnet"; - } - const network = Network.from(_network3); - assertArgument(network.name === "mainnet", "unsupported network", "network", _network3); - super("https://cloudflare-eth.com/", network, { staticNetwork: network }); - } -}; - -// node_modules/ethers/lib.esm/providers/provider-etherscan.js -var THROTTLE = 2e3; -function isPromise2(value) { - return value && typeof value.then === "function"; -} -var EtherscanPluginId = "org.ethers.plugins.provider.Etherscan"; -var EtherscanPlugin = class _EtherscanPlugin extends NetworkPlugin { - /** - * Creates a new **EtherscanProvider** which will use - * %%baseUrl%%. - */ - constructor(baseUrl) { - super(EtherscanPluginId); - /** - * The Etherscan API base URL. - */ - __publicField(this, "baseUrl"); - defineProperties(this, { baseUrl }); - } - clone() { - return new _EtherscanPlugin(this.baseUrl); - } -}; -var skipKeys = ["enableCcipRead"]; -var nextId = 1; -var _plugin; -var EtherscanProvider = class extends AbstractProvider { - /** - * Creates a new **EtherscanBaseProvider**. - */ - constructor(_network3, _apiKey) { - const apiKey = _apiKey != null ? _apiKey : null; - super(); - /** - * The connected network. - */ - __publicField(this, "network"); - /** - * The API key or null if using the community provided bandwidth. - */ - __publicField(this, "apiKey"); - __privateAdd(this, _plugin, void 0); - const network = Network.from(_network3); - __privateSet(this, _plugin, network.getPlugin(EtherscanPluginId)); - defineProperties(this, { apiKey, network }); - this.getBaseUrl(); - } - /** - * Returns the base URL. - * - * If an [[EtherscanPlugin]] is configured on the - * [[EtherscanBaseProvider_network]], returns the plugin's - * baseUrl. - */ - getBaseUrl() { - if (__privateGet(this, _plugin)) { - return __privateGet(this, _plugin).baseUrl; - } - switch (this.network.name) { - case "mainnet": - return "https://api.etherscan.io"; - case "goerli": - return "https://api-goerli.etherscan.io"; - case "sepolia": - return "https://api-sepolia.etherscan.io"; - case "holesky": - return "https://api-holesky.etherscan.io"; - case "arbitrum": - return "https://api.arbiscan.io"; - case "arbitrum-goerli": - return "https://api-goerli.arbiscan.io"; - case "bnb": - return "https://api.bscscan.com"; - case "bnbt": - return "https://api-testnet.bscscan.com"; - case "matic": - return "https://api.polygonscan.com"; - case "matic-mumbai": - return "https://api-testnet.polygonscan.com"; - case "optimism": - return "https://api-optimistic.etherscan.io"; - case "optimism-goerli": - return "https://api-goerli-optimistic.etherscan.io"; - default: - } - assertArgument(false, "unsupported network", "network", this.network); - } - /** - * Returns the URL for the %%module%% and %%params%%. - */ - getUrl(module, params) { - const query = Object.keys(params).reduce((accum, key) => { - const value = params[key]; - if (value != null) { - accum += `&${key}=${value}`; - } - return accum; - }, ""); - const apiKey = this.apiKey ? `&apikey=${this.apiKey}` : ""; - return `${this.getBaseUrl()}/api?module=${module}${query}${apiKey}`; - } - /** - * Returns the URL for using POST requests. - */ - getPostUrl() { - return `${this.getBaseUrl()}/api`; - } - /** - * Returns the parameters for using POST requests. - */ - getPostData(module, params) { - params.module = module; - params.apikey = this.apiKey; - return params; - } - async detectNetwork() { - return this.network; - } - /** - * Resolves to the result of calling %%module%% with %%params%%. - * - * If %%post%%, the request is made as a POST request. - */ - async fetch(module, params, post) { - const id2 = nextId++; - const url = post ? this.getPostUrl() : this.getUrl(module, params); - const payload = post ? this.getPostData(module, params) : null; - this.emit("debug", { action: "sendRequest", id: id2, url, payload }); - const request = new FetchRequest(url); - request.setThrottleParams({ slotInterval: 1e3 }); - request.retryFunc = (req, resp, attempt) => { - if (this.isCommunityResource()) { - showThrottleMessage("Etherscan"); - } - return Promise.resolve(true); - }; - request.processFunc = async (request2, response2) => { - const result2 = response2.hasBody() ? JSON.parse(toUtf8String(response2.body)) : {}; - const throttle = (typeof result2.result === "string" ? result2.result : "").toLowerCase().indexOf("rate limit") >= 0; - if (module === "proxy") { - if (result2 && result2.status == 0 && result2.message == "NOTOK" && throttle) { - this.emit("debug", { action: "receiveError", id: id2, reason: "proxy-NOTOK", error: result2 }); - response2.throwThrottleError(result2.result, THROTTLE); - } - } else { - if (throttle) { - this.emit("debug", { action: "receiveError", id: id2, reason: "null result", error: result2.result }); - response2.throwThrottleError(result2.result, THROTTLE); - } - } - return response2; - }; - if (payload) { - request.setHeader("content-type", "application/x-www-form-urlencoded; charset=UTF-8"); - request.body = Object.keys(payload).map((k) => `${k}=${payload[k]}`).join("&"); - } - const response = await request.send(); - try { - response.assertOk(); - } catch (error) { - this.emit("debug", { action: "receiveError", id: id2, error, reason: "assertOk" }); - assert(false, "response error", "SERVER_ERROR", { request, response }); - } - if (!response.hasBody()) { - this.emit("debug", { action: "receiveError", id: id2, error: "missing body", reason: "null body" }); - assert(false, "missing response", "SERVER_ERROR", { request, response }); - } - const result = JSON.parse(toUtf8String(response.body)); - if (module === "proxy") { - if (result.jsonrpc != "2.0") { - this.emit("debug", { action: "receiveError", id: id2, result, reason: "invalid JSON-RPC" }); - assert(false, "invalid JSON-RPC response (missing jsonrpc='2.0')", "SERVER_ERROR", { request, response, info: { result } }); - } - if (result.error) { - this.emit("debug", { action: "receiveError", id: id2, result, reason: "JSON-RPC error" }); - assert(false, "error response", "SERVER_ERROR", { request, response, info: { result } }); - } - this.emit("debug", { action: "receiveRequest", id: id2, result }); - return result.result; - } else { - if (result.status == 0 && (result.message === "No records found" || result.message === "No transactions found")) { - this.emit("debug", { action: "receiveRequest", id: id2, result }); - return result.result; - } - if (result.status != 1 || typeof result.message === "string" && !result.message.match(/^OK/)) { - this.emit("debug", { action: "receiveError", id: id2, result }); - assert(false, "error response", "SERVER_ERROR", { request, response, info: { result } }); - } - this.emit("debug", { action: "receiveRequest", id: id2, result }); - return result.result; - } - } - /** - * Returns %%transaction%% normalized for the Etherscan API. - */ - _getTransactionPostData(transaction) { - const result = {}; - for (let key in transaction) { - if (skipKeys.indexOf(key) >= 0) { - continue; - } - if (transaction[key] == null) { - continue; - } - let value = transaction[key]; - if (key === "type" && value === 0) { - continue; - } - if (key === "blockTag" && value === "latest") { - continue; - } - if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) { - value = toQuantity(value); - } else if (key === "accessList") { - value = "[" + accessListify(value).map((set) => { - return `{address:"${set.address}",storageKeys:["${set.storageKeys.join('","')}"]}`; - }).join(",") + "]"; - } else { - value = hexlify(value); - } - result[key] = value; - } - return result; - } - /** - * Throws the normalized Etherscan error. - */ - _checkError(req, error, transaction) { - let message = ""; - if (isError(error, "SERVER_ERROR")) { - try { - message = error.info.result.error.message; - } catch (e) { - } - if (!message) { - try { - message = error.info.message; - } catch (e) { - } - } - } - if (req.method === "estimateGas") { - if (!message.match(/revert/i) && message.match(/insufficient funds/i)) { - assert(false, "insufficient funds", "INSUFFICIENT_FUNDS", { - transaction: req.transaction - }); - } - } - if (req.method === "call" || req.method === "estimateGas") { - if (message.match(/execution reverted/i)) { - let data = ""; - try { - data = error.info.result.error.data; - } catch (error2) { - } - const e = AbiCoder.getBuiltinCallException(req.method, req.transaction, data); - e.info = { request: req, error }; - throw e; - } - } - if (message) { - if (req.method === "broadcastTransaction") { - const transaction2 = Transaction.from(req.signedTransaction); - if (message.match(/replacement/i) && message.match(/underpriced/i)) { - assert(false, "replacement fee too low", "REPLACEMENT_UNDERPRICED", { - transaction: transaction2 - }); - } - if (message.match(/insufficient funds/)) { - assert(false, "insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", { - transaction: transaction2 - }); - } - if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) { - assert(false, "nonce has already been used", "NONCE_EXPIRED", { - transaction: transaction2 - }); - } - } - } - throw error; - } - async _detectNetwork() { - return this.network; - } - async _perform(req) { - switch (req.method) { - case "chainId": - return this.network.chainId; - case "getBlockNumber": - return this.fetch("proxy", { action: "eth_blockNumber" }); - case "getGasPrice": - return this.fetch("proxy", { action: "eth_gasPrice" }); - case "getPriorityFee": - if (this.network.name === "mainnet") { - return "1000000000"; - } else if (this.network.name === "optimism") { - return "1000000"; - } else { - throw new Error("fallback onto the AbstractProvider default"); - } - case "getBalance": - return this.fetch("account", { - action: "balance", - address: req.address, - tag: req.blockTag - }); - case "getTransactionCount": - return this.fetch("proxy", { - action: "eth_getTransactionCount", - address: req.address, - tag: req.blockTag - }); - case "getCode": - return this.fetch("proxy", { - action: "eth_getCode", - address: req.address, - tag: req.blockTag - }); - case "getStorage": - return this.fetch("proxy", { - action: "eth_getStorageAt", - address: req.address, - position: req.position, - tag: req.blockTag - }); - case "broadcastTransaction": - return this.fetch("proxy", { - action: "eth_sendRawTransaction", - hex: req.signedTransaction - }, true).catch((error) => { - return this._checkError(req, error, req.signedTransaction); - }); - case "getBlock": - if ("blockTag" in req) { - return this.fetch("proxy", { - action: "eth_getBlockByNumber", - tag: req.blockTag, - boolean: req.includeTransactions ? "true" : "false" - }); - } - assert(false, "getBlock by blockHash not supported by Etherscan", "UNSUPPORTED_OPERATION", { - operation: "getBlock(blockHash)" - }); - case "getTransaction": - return this.fetch("proxy", { - action: "eth_getTransactionByHash", - txhash: req.hash - }); - case "getTransactionReceipt": - return this.fetch("proxy", { - action: "eth_getTransactionReceipt", - txhash: req.hash - }); - case "call": { - if (req.blockTag !== "latest") { - throw new Error("EtherscanProvider does not support blockTag for call"); - } - const postData = this._getTransactionPostData(req.transaction); - postData.module = "proxy"; - postData.action = "eth_call"; - try { - return await this.fetch("proxy", postData, true); - } catch (error) { - return this._checkError(req, error, req.transaction); - } - } - case "estimateGas": { - const postData = this._getTransactionPostData(req.transaction); - postData.module = "proxy"; - postData.action = "eth_estimateGas"; - try { - return await this.fetch("proxy", postData, true); - } catch (error) { - return this._checkError(req, error, req.transaction); - } - } - default: - break; - } - return super._perform(req); - } - async getNetwork() { - return this.network; - } - /** - * Resolves to the current price of ether. - * - * This returns ``0`` on any network other than ``mainnet``. - */ - async getEtherPrice() { - if (this.network.name !== "mainnet") { - return 0; - } - return parseFloat((await this.fetch("stats", { action: "ethprice" })).ethusd); - } - /** - * Resolves to a [Contract]] for %%address%%, using the - * Etherscan API to retreive the Contract ABI. - */ - async getContract(_address) { - let address = this._getAddress(_address); - if (isPromise2(address)) { - address = await address; - } - try { - const resp = await this.fetch("contract", { - action: "getabi", - address - }); - const abi = JSON.parse(resp); - return new Contract(address, abi, this); - } catch (error) { - return null; - } - } - isCommunityResource() { - return this.apiKey == null; - } -}; -_plugin = new WeakMap(); - -// node_modules/ethers/lib.esm/providers/ws-browser.js -function getGlobal2() { - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw new Error("unable to locate global object"); -} -var _WebSocket = getGlobal2().WebSocket; - -// node_modules/ethers/lib.esm/providers/provider-socket.js -var _provider5, _filter4, _filterId, _paused, _emitPromise; -var SocketSubscriber = class { - /** - * Creates a new **SocketSubscriber** attached to %%provider%% listening - * to %%filter%%. - */ - constructor(provider, filter) { - __privateAdd(this, _provider5, void 0); - __privateAdd(this, _filter4, void 0); - __privateAdd(this, _filterId, void 0); - __privateAdd(this, _paused, void 0); - __privateAdd(this, _emitPromise, void 0); - __privateSet(this, _provider5, provider); - __privateSet(this, _filter4, JSON.stringify(filter)); - __privateSet(this, _filterId, null); - __privateSet(this, _paused, null); - __privateSet(this, _emitPromise, null); - } - /** - * The filter. - */ - get filter() { - return JSON.parse(__privateGet(this, _filter4)); - } - start() { - __privateSet(this, _filterId, __privateGet(this, _provider5).send("eth_subscribe", this.filter).then((filterId) => { - ; - __privateGet(this, _provider5)._register(filterId, this); - return filterId; - })); - } - stop() { - __privateGet(this, _filterId).then((filterId) => { - __privateGet(this, _provider5).send("eth_unsubscribe", [filterId]); - }); - __privateSet(this, _filterId, null); - } - // @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs - // and resume - pause(dropWhilePaused) { - assert(dropWhilePaused, "preserve logs while paused not supported by SocketSubscriber yet", "UNSUPPORTED_OPERATION", { operation: "pause(false)" }); - __privateSet(this, _paused, !!dropWhilePaused); - } - resume() { - __privateSet(this, _paused, null); - } - /** - * @_ignore: - */ - _handleMessage(message) { - if (__privateGet(this, _filterId) == null) { - return; - } - if (__privateGet(this, _paused) === null) { - let emitPromise = __privateGet(this, _emitPromise); - if (emitPromise == null) { - emitPromise = this._emit(__privateGet(this, _provider5), message); - } else { - emitPromise = emitPromise.then(async () => { - await this._emit(__privateGet(this, _provider5), message); - }); - } - __privateSet(this, _emitPromise, emitPromise.then(() => { - if (__privateGet(this, _emitPromise) === emitPromise) { - __privateSet(this, _emitPromise, null); - } - })); - } - } - /** - * Sub-classes **must** override this to emit the events on the - * provider. - */ - async _emit(provider, message) { - throw new Error("sub-classes must implemente this; _emit"); - } -}; -_provider5 = new WeakMap(); -_filter4 = new WeakMap(); -_filterId = new WeakMap(); -_paused = new WeakMap(); -_emitPromise = new WeakMap(); -var SocketBlockSubscriber = class extends SocketSubscriber { - /** - * @_ignore: - */ - constructor(provider) { - super(provider, ["newHeads"]); - } - async _emit(provider, message) { - provider.emit("block", parseInt(message.number)); - } -}; -var SocketPendingSubscriber = class extends SocketSubscriber { - /** - * @_ignore: - */ - constructor(provider) { - super(provider, ["newPendingTransactions"]); - } - async _emit(provider, message) { - provider.emit("pending", message); - } -}; -var _logFilter; -var SocketEventSubscriber = class extends SocketSubscriber { - /** - * @_ignore: - */ - constructor(provider, filter) { - super(provider, ["logs", filter]); - __privateAdd(this, _logFilter, void 0); - __privateSet(this, _logFilter, JSON.stringify(filter)); - } - /** - * The filter. - */ - get logFilter() { - return JSON.parse(__privateGet(this, _logFilter)); - } - async _emit(provider, message) { - provider.emit(this.logFilter, provider._wrapLog(message, provider._network)); - } -}; -_logFilter = new WeakMap(); -var _callbacks, _subs2, _pending; -var SocketProvider = class extends JsonRpcApiProvider { - /** - * Creates a new **SocketProvider** connected to %%network%%. - * - * If unspecified, the network will be discovered. - */ - constructor(network, _options4) { - const options = Object.assign({}, _options4 != null ? _options4 : {}); - assertArgument(options.batchMaxCount == null || options.batchMaxCount === 1, "sockets-based providers do not support batches", "options.batchMaxCount", _options4); - options.batchMaxCount = 1; - if (options.staticNetwork == null) { - options.staticNetwork = true; - } - super(network, options); - __privateAdd(this, _callbacks, void 0); - // Maps each filterId to its subscriber - __privateAdd(this, _subs2, void 0); - // If any events come in before a subscriber has finished - // registering, queue them - __privateAdd(this, _pending, void 0); - __privateSet(this, _callbacks, /* @__PURE__ */ new Map()); - __privateSet(this, _subs2, /* @__PURE__ */ new Map()); - __privateSet(this, _pending, /* @__PURE__ */ new Map()); - } - // This value is only valid after _start has been called - /* - get _network(): Network { - if (this.#network == null) { - throw new Error("this shouldn't happen"); - } - return this.#network.clone(); - } - */ - _getSubscriber(sub) { - switch (sub.type) { - case "close": - return new UnmanagedSubscriber("close"); - case "block": - return new SocketBlockSubscriber(this); - case "pending": - return new SocketPendingSubscriber(this); - case "event": - return new SocketEventSubscriber(this, sub.filter); - case "orphan": - if (sub.filter.orphan === "drop-log") { - return new UnmanagedSubscriber("drop-log"); - } - } - return super._getSubscriber(sub); - } - /** - * Register a new subscriber. This is used internalled by Subscribers - * and generally is unecessary unless extending capabilities. - */ - _register(filterId, subscriber) { - __privateGet(this, _subs2).set(filterId, subscriber); - const pending = __privateGet(this, _pending).get(filterId); - if (pending) { - for (const message of pending) { - subscriber._handleMessage(message); - } - __privateGet(this, _pending).delete(filterId); - } - } - async _send(payload) { - assertArgument(!Array.isArray(payload), "WebSocket does not support batch send", "payload", payload); - const promise = new Promise((resolve, reject) => { - __privateGet(this, _callbacks).set(payload.id, { payload, resolve, reject }); - }); - await this._waitUntilReady(); - await this._write(JSON.stringify(payload)); - return [await promise]; - } - // Sub-classes must call this once they are connected - /* - async _start(): Promise { - if (this.#ready) { return; } - - for (const { payload } of this.#callbacks.values()) { - await this._write(JSON.stringify(payload)); - } - - this.#ready = (async function() { - await super._start(); - })(); - } - */ - /** - * Sub-classes **must** call this with messages received over their - * transport to be processed and dispatched. - */ - async _processMessage(message) { - const result = JSON.parse(message); - if (result && typeof result === "object" && "id" in result) { - const callback = __privateGet(this, _callbacks).get(result.id); - if (callback == null) { - this.emit("error", makeError("received result for unknown id", "UNKNOWN_ERROR", { - reasonCode: "UNKNOWN_ID", - result - })); - return; - } - __privateGet(this, _callbacks).delete(result.id); - callback.resolve(result); - } else if (result && result.method === "eth_subscription") { - const filterId = result.params.subscription; - const subscriber = __privateGet(this, _subs2).get(filterId); - if (subscriber) { - subscriber._handleMessage(result.params.result); - } else { - let pending = __privateGet(this, _pending).get(filterId); - if (pending == null) { - pending = []; - __privateGet(this, _pending).set(filterId, pending); - } - pending.push(result.params.result); - } - } else { - this.emit("error", makeError("received unexpected message", "UNKNOWN_ERROR", { - reasonCode: "UNEXPECTED_MESSAGE", - result - })); - return; - } - } - /** - * Sub-classes **must** override this to send %%message%% over their - * transport. - */ - async _write(message) { - throw new Error("sub-classes must override this"); - } -}; -_callbacks = new WeakMap(); -_subs2 = new WeakMap(); -_pending = new WeakMap(); - -// node_modules/ethers/lib.esm/providers/provider-websocket.js -var _connect2, _websocket; -var WebSocketProvider = class extends SocketProvider { - constructor(url, network, options) { - super(network, options); - __privateAdd(this, _connect2, void 0); - __privateAdd(this, _websocket, void 0); - if (typeof url === "string") { - __privateSet(this, _connect2, () => { - return new _WebSocket(url); - }); - __privateSet(this, _websocket, __privateGet(this, _connect2).call(this)); - } else if (typeof url === "function") { - __privateSet(this, _connect2, url); - __privateSet(this, _websocket, url()); - } else { - __privateSet(this, _connect2, null); - __privateSet(this, _websocket, url); - } - this.websocket.onopen = async () => { - try { - await this._start(); - this.resume(); - } catch (error) { - console.log("failed to start WebsocketProvider", error); - } - }; - this.websocket.onmessage = (message) => { - this._processMessage(message.data); - }; - } - get websocket() { - if (__privateGet(this, _websocket) == null) { - throw new Error("websocket closed"); - } - return __privateGet(this, _websocket); - } - async _write(message) { - this.websocket.send(message); - } - async destroy() { - if (__privateGet(this, _websocket) != null) { - __privateGet(this, _websocket).close(); - __privateSet(this, _websocket, null); - } - super.destroy(); - } -}; -_connect2 = new WeakMap(); -_websocket = new WeakMap(); - -// node_modules/ethers/lib.esm/providers/provider-infura.js -var defaultProjectId = "84842078b09946638c03157f83405213"; -function getHost3(name) { - switch (name) { - case "mainnet": - return "mainnet.infura.io"; - case "goerli": - return "goerli.infura.io"; - case "sepolia": - return "sepolia.infura.io"; - case "arbitrum": - return "arbitrum-mainnet.infura.io"; - case "arbitrum-goerli": - return "arbitrum-goerli.infura.io"; - case "arbitrum-sepolia": - return "arbitrum-sepolia.infura.io"; - case "base": - return "base-mainnet.infura.io"; - case "base-goerlia": - return "base-goerli.infura.io"; - case "base-sepolia": - return "base-sepolia.infura.io"; - case "bnb": - return "bnbsmartchain-mainnet.infura.io"; - case "bnbt": - return "bnbsmartchain-testnet.infura.io"; - case "linea": - return "linea-mainnet.infura.io"; - case "linea-goerli": - return "linea-goerli.infura.io"; - case "matic": - return "polygon-mainnet.infura.io"; - case "matic-mumbai": - return "polygon-mumbai.infura.io"; - case "optimism": - return "optimism-mainnet.infura.io"; - case "optimism-goerli": - return "optimism-goerli.infura.io"; - case "optimism-sepolia": - return "optimism-sepolia.infura.io"; - } - assertArgument(false, "unsupported network", "network", name); -} -var InfuraWebSocketProvider = class extends WebSocketProvider { - /** - * Creates a new **InfuraWebSocketProvider**. - */ - constructor(network, projectId) { - const provider = new InfuraProvider(network, projectId); - const req = provider._getConnection(); - assert(!req.credentials, "INFURA WebSocket project secrets unsupported", "UNSUPPORTED_OPERATION", { operation: "InfuraProvider.getWebSocketProvider()" }); - const url = req.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/"); - super(url, network); - /** - * The Project ID for the INFURA connection. - */ - __publicField(this, "projectId"); - /** - * The Project Secret. - * - * If null, no authenticated requests are made. This should not - * be used outside of private contexts. - */ - __publicField(this, "projectSecret"); - defineProperties(this, { - projectId: provider.projectId, - projectSecret: provider.projectSecret - }); - } - isCommunityResource() { - return this.projectId === defaultProjectId; - } -}; -var InfuraProvider = class _InfuraProvider extends JsonRpcProvider { - /** - * Creates a new **InfuraProvider**. - */ - constructor(_network3, projectId, projectSecret) { - if (_network3 == null) { - _network3 = "mainnet"; - } - const network = Network.from(_network3); - if (projectId == null) { - projectId = defaultProjectId; - } - if (projectSecret == null) { - projectSecret = null; - } - const request = _InfuraProvider.getRequest(network, projectId, projectSecret); - super(request, network, { staticNetwork: network }); - /** - * The Project ID for the INFURA connection. - */ - __publicField(this, "projectId"); - /** - * The Project Secret. - * - * If null, no authenticated requests are made. This should not - * be used outside of private contexts. - */ - __publicField(this, "projectSecret"); - defineProperties(this, { projectId, projectSecret }); - } - _getProvider(chainId) { - try { - return new _InfuraProvider(chainId, this.projectId, this.projectSecret); - } catch (error) { - } - return super._getProvider(chainId); - } - isCommunityResource() { - return this.projectId === defaultProjectId; - } - /** - * Creates a new **InfuraWebSocketProvider**. - */ - static getWebSocketProvider(network, projectId) { - return new InfuraWebSocketProvider(network, projectId); - } - /** - * Returns a prepared request for connecting to %%network%% - * with %%projectId%% and %%projectSecret%%. - */ - static getRequest(network, projectId, projectSecret) { - if (projectId == null) { - projectId = defaultProjectId; - } - if (projectSecret == null) { - projectSecret = null; - } - const request = new FetchRequest(`https://${getHost3(network.name)}/v3/${projectId}`); - request.allowGzip = true; - if (projectSecret) { - request.setCredentials("", projectSecret); - } - if (projectId === defaultProjectId) { - request.retryFunc = async (request2, response, attempt) => { - showThrottleMessage("InfuraProvider"); - return true; - }; - } - return request; - } -}; - -// node_modules/ethers/lib.esm/providers/provider-quicknode.js -var defaultToken = "919b412a057b5e9c9b6dce193c5a60242d6efadb"; -function getHost4(name) { - switch (name) { - case "mainnet": - return "ethers.quiknode.pro"; - case "goerli": - return "ethers.ethereum-goerli.quiknode.pro"; - case "sepolia": - return "ethers.ethereum-sepolia.quiknode.pro"; - case "holesky": - return "ethers.ethereum-holesky.quiknode.pro"; - case "arbitrum": - return "ethers.arbitrum-mainnet.quiknode.pro"; - case "arbitrum-goerli": - return "ethers.arbitrum-goerli.quiknode.pro"; - case "arbitrum-sepolia": - return "ethers.arbitrum-sepolia.quiknode.pro"; - case "base": - return "ethers.base-mainnet.quiknode.pro"; - case "base-goerli": - return "ethers.base-goerli.quiknode.pro"; - case "base-spolia": - return "ethers.base-sepolia.quiknode.pro"; - case "bnb": - return "ethers.bsc.quiknode.pro"; - case "bnbt": - return "ethers.bsc-testnet.quiknode.pro"; - case "matic": - return "ethers.matic.quiknode.pro"; - case "matic-mumbai": - return "ethers.matic-testnet.quiknode.pro"; - case "optimism": - return "ethers.optimism.quiknode.pro"; - case "optimism-goerli": - return "ethers.optimism-goerli.quiknode.pro"; - case "optimism-sepolia": - return "ethers.optimism-sepolia.quiknode.pro"; - case "xdai": - return "ethers.xdai.quiknode.pro"; - } - assertArgument(false, "unsupported network", "network", name); -} -var QuickNodeProvider = class _QuickNodeProvider extends JsonRpcProvider { - /** - * Creates a new **QuickNodeProvider**. - */ - constructor(_network3, token) { - if (_network3 == null) { - _network3 = "mainnet"; - } - const network = Network.from(_network3); - if (token == null) { - token = defaultToken; - } - const request = _QuickNodeProvider.getRequest(network, token); - super(request, network, { staticNetwork: network }); - /** - * The API token. - */ - __publicField(this, "token"); - defineProperties(this, { token }); - } - _getProvider(chainId) { - try { - return new _QuickNodeProvider(chainId, this.token); - } catch (error) { - } - return super._getProvider(chainId); - } - isCommunityResource() { - return this.token === defaultToken; - } - /** - * Returns a new request prepared for %%network%% and the - * %%token%%. - */ - static getRequest(network, token) { - if (token == null) { - token = defaultToken; - } - const request = new FetchRequest(`https://${getHost4(network.name)}/${token}`); - request.allowGzip = true; - if (token === defaultToken) { - request.retryFunc = async (request2, response, attempt) => { - showThrottleMessage("QuickNodeProvider"); - return true; - }; - } - return request; - } -}; - -// node_modules/ethers/lib.esm/providers/provider-fallback.js -var BN_16 = BigInt("1"); -var BN_24 = BigInt("2"); -function shuffle(array) { - for (let i = array.length - 1; i > 0; i--) { - const j = Math.floor(Math.random() * (i + 1)); - const tmp = array[i]; - array[i] = array[j]; - array[j] = tmp; - } -} -function stall2(duration) { - return new Promise((resolve) => { - setTimeout(resolve, duration); - }); -} -function getTime3() { - return (/* @__PURE__ */ new Date()).getTime(); -} -function stringify2(value) { - return JSON.stringify(value, (key, value2) => { - if (typeof value2 === "bigint") { - return { type: "bigint", value: value2.toString() }; - } - return value2; - }); -} -var defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 }; -var defaultState = { - blockNumber: -2, - requests: 0, - lateResponses: 0, - errorResponses: 0, - outOfSync: -1, - unsupportedEvents: 0, - rollingDuration: 0, - score: 0, - _network: null, - _updateNumber: null, - _totalTime: 0, - _lastFatalError: null, - _lastFatalErrorTimestamp: 0 -}; -async function waitForSync(config, blockNumber) { - while (config.blockNumber < 0 || config.blockNumber < blockNumber) { - if (!config._updateNumber) { - config._updateNumber = (async () => { - try { - const blockNumber2 = await config.provider.getBlockNumber(); - if (blockNumber2 > config.blockNumber) { - config.blockNumber = blockNumber2; - } - } catch (error) { - config.blockNumber = -2; - config._lastFatalError = error; - config._lastFatalErrorTimestamp = getTime3(); - } - config._updateNumber = null; - })(); - } - await config._updateNumber; - config.outOfSync++; - if (config._lastFatalError) { - break; - } - } -} -function _normalize(value) { - if (value == null) { - return "null"; - } - if (Array.isArray(value)) { - return "[" + value.map(_normalize).join(",") + "]"; - } - if (typeof value === "object" && typeof value.toJSON === "function") { - return _normalize(value.toJSON()); - } - switch (typeof value) { - case "boolean": - case "symbol": - return value.toString(); - case "bigint": - case "number": - return BigInt(value).toString(); - case "string": - return JSON.stringify(value); - case "object": { - const keys = Object.keys(value); - keys.sort(); - return "{" + keys.map((k) => `${JSON.stringify(k)}:${_normalize(value[k])}`).join(",") + "}"; - } - } - console.log("Could not serialize", value); - throw new Error("Hmm..."); -} -function normalizeResult(value) { - if ("error" in value) { - const error = value.error; - return { tag: _normalize(error), value: error }; - } - const result = value.result; - return { tag: _normalize(result), value: result }; -} -function checkQuorum(quorum, results) { - const tally = /* @__PURE__ */ new Map(); - for (const { value, tag, weight } of results) { - const t = tally.get(tag) || { value, weight: 0 }; - t.weight += weight; - tally.set(tag, t); - } - let best = null; - for (const r of tally.values()) { - if (r.weight >= quorum && (!best || r.weight > best.weight)) { - best = r; - } - } - if (best) { - return best.value; - } - return void 0; -} -function getMedian(quorum, results) { - let resultWeight = 0; - const errorMap = /* @__PURE__ */ new Map(); - let bestError = null; - const values = []; - for (const { value, tag, weight } of results) { - if (value instanceof Error) { - const e = errorMap.get(tag) || { value, weight: 0 }; - e.weight += weight; - errorMap.set(tag, e); - if (bestError == null || e.weight > bestError.weight) { - bestError = e; - } - } else { - values.push(BigInt(value)); - resultWeight += weight; - } - } - if (resultWeight < quorum) { - if (bestError && bestError.weight >= quorum) { - return bestError.value; - } - return void 0; - } - values.sort((a, b2) => a < b2 ? -1 : b2 > a ? 1 : 0); - const mid = Math.floor(values.length / 2); - if (values.length % 2) { - return values[mid]; - } - return (values[mid - 1] + values[mid] + BN_16) / BN_24; -} -function getAnyResult(quorum, results) { - const result = checkQuorum(quorum, results); - if (result !== void 0) { - return result; - } - for (const r of results) { - if (r.value) { - return r.value; - } - } - return void 0; -} -function getFuzzyMode(quorum, results) { - if (quorum === 1) { - return getNumber(getMedian(quorum, results), "%internal"); - } - const tally = /* @__PURE__ */ new Map(); - const add2 = (result, weight) => { - const t = tally.get(result) || { result, weight: 0 }; - t.weight += weight; - tally.set(result, t); - }; - for (const { weight, value } of results) { - const r = getNumber(value); - add2(r - 1, weight); - add2(r, weight); - add2(r + 1, weight); - } - let bestWeight = 0; - let bestResult = void 0; - for (const { weight, result } of tally.values()) { - if (weight >= quorum && (weight > bestWeight || bestResult != null && weight === bestWeight && result > bestResult)) { - bestWeight = weight; - bestResult = result; - } - } - return bestResult; -} -var _configs, _height, _initialSyncPromise, _getNextConfig, getNextConfig_fn, _addRunner, addRunner_fn, _initialSync, initialSync_fn, _checkQuorum, checkQuorum_fn, _waitForQuorum, waitForQuorum_fn; -var FallbackProvider = class extends AbstractProvider { - /** - * Creates a new **FallbackProvider** with %%providers%% connected to - * %%network%%. - * - * If a [[Provider]] is included in %%providers%%, defaults are used - * for the configuration. - */ - constructor(providers, network, options) { - super(network, options); - // Grab the next (random) config that is not already part of - // the running set - __privateAdd(this, _getNextConfig); - // Adds a new runner (if available) to running. - __privateAdd(this, _addRunner); - // Initializes the blockNumber and network for each runner and - // blocks until initialized - __privateAdd(this, _initialSync); - __privateAdd(this, _checkQuorum); - __privateAdd(this, _waitForQuorum); - /** - * The number of backends that must agree on a value before it is - * accpeted. - */ - __publicField(this, "quorum"); - /** - * @_ignore: - */ - __publicField(this, "eventQuorum"); - /** - * @_ignore: - */ - __publicField(this, "eventWorkers"); - __privateAdd(this, _configs, void 0); - __privateAdd(this, _height, void 0); - __privateAdd(this, _initialSyncPromise, void 0); - __privateSet(this, _configs, providers.map((p) => { - if (p instanceof AbstractProvider) { - return Object.assign({ provider: p }, defaultConfig, defaultState); - } else { - return Object.assign({}, defaultConfig, p, defaultState); - } - })); - __privateSet(this, _height, -2); - __privateSet(this, _initialSyncPromise, null); - if (options && options.quorum != null) { - this.quorum = options.quorum; - } else { - this.quorum = Math.ceil(__privateGet(this, _configs).reduce((accum, config) => { - accum += config.weight; - return accum; - }, 0) / 2); - } - this.eventQuorum = 1; - this.eventWorkers = 1; - assertArgument(this.quorum <= __privateGet(this, _configs).reduce((a, c) => a + c.weight, 0), "quorum exceed provider wieght", "quorum", this.quorum); - } - get providerConfigs() { - return __privateGet(this, _configs).map((c) => { - const result = Object.assign({}, c); - for (const key in result) { - if (key[0] === "_") { - delete result[key]; - } - } - return result; - }); - } - async _detectNetwork() { - return Network.from(getBigInt(await this._perform({ method: "chainId" }))); - } - // @TODO: Add support to select providers to be the event subscriber - //_getSubscriber(sub: Subscription): Subscriber { - // throw new Error("@TODO"); - //} - /** - * Transforms a %%req%% into the correct method call on %%provider%%. - */ - async _translatePerform(provider, req) { - switch (req.method) { - case "broadcastTransaction": - return await provider.broadcastTransaction(req.signedTransaction); - case "call": - return await provider.call(Object.assign({}, req.transaction, { blockTag: req.blockTag })); - case "chainId": - return (await provider.getNetwork()).chainId; - case "estimateGas": - return await provider.estimateGas(req.transaction); - case "getBalance": - return await provider.getBalance(req.address, req.blockTag); - case "getBlock": { - const block = "blockHash" in req ? req.blockHash : req.blockTag; - return await provider.getBlock(block, req.includeTransactions); - } - case "getBlockNumber": - return await provider.getBlockNumber(); - case "getCode": - return await provider.getCode(req.address, req.blockTag); - case "getGasPrice": - return (await provider.getFeeData()).gasPrice; - case "getPriorityFee": - return (await provider.getFeeData()).maxPriorityFeePerGas; - case "getLogs": - return await provider.getLogs(req.filter); - case "getStorage": - return await provider.getStorage(req.address, req.position, req.blockTag); - case "getTransaction": - return await provider.getTransaction(req.hash); - case "getTransactionCount": - return await provider.getTransactionCount(req.address, req.blockTag); - case "getTransactionReceipt": - return await provider.getTransactionReceipt(req.hash); - case "getTransactionResult": - return await provider.getTransactionResult(req.hash); - } - } - async _perform(req) { - if (req.method === "broadcastTransaction") { - const results = __privateGet(this, _configs).map((c) => null); - const broadcasts = __privateGet(this, _configs).map(async ({ provider, weight }, index) => { - try { - const result3 = await provider._perform(req); - results[index] = Object.assign(normalizeResult({ result: result3 }), { weight }); - } catch (error) { - results[index] = Object.assign(normalizeResult({ error }), { weight }); - } - }); - while (true) { - const done = results.filter((r) => r != null); - for (const { value } of done) { - if (!(value instanceof Error)) { - return value; - } - } - const result3 = checkQuorum(this.quorum, results.filter((r) => r != null)); - if (isError(result3, "INSUFFICIENT_FUNDS")) { - throw result3; - } - const waiting = broadcasts.filter((b2, i) => results[i] == null); - if (waiting.length === 0) { - break; - } - await Promise.race(waiting); - } - const result2 = getAnyResult(this.quorum, results); - assert(result2 !== void 0, "problem multi-broadcasting", "SERVER_ERROR", { - request: "%sub-requests", - info: { request: req, results: results.map(stringify2) } - }); - if (result2 instanceof Error) { - throw result2; - } - return result2; - } - await __privateMethod(this, _initialSync, initialSync_fn).call(this); - const running = /* @__PURE__ */ new Set(); - let inflightQuorum = 0; - while (true) { - const runner = __privateMethod(this, _addRunner, addRunner_fn).call(this, running, req); - if (runner == null) { - break; - } - inflightQuorum += runner.config.weight; - if (inflightQuorum >= this.quorum) { - break; - } - } - const result = await __privateMethod(this, _waitForQuorum, waitForQuorum_fn).call(this, running, req); - for (const runner of running) { - if (runner.perform && runner.result == null) { - runner.config.lateResponses++; - } - } - return result; - } - async destroy() { - for (const { provider } of __privateGet(this, _configs)) { - provider.destroy(); - } - super.destroy(); - } -}; -_configs = new WeakMap(); -_height = new WeakMap(); -_initialSyncPromise = new WeakMap(); -_getNextConfig = new WeakSet(); -getNextConfig_fn = function(running) { - const configs = Array.from(running).map((r) => r.config); - const allConfigs = __privateGet(this, _configs).slice(); - shuffle(allConfigs); - allConfigs.sort((a, b2) => a.priority - b2.priority); - for (const config of allConfigs) { - if (config._lastFatalError) { - continue; - } - if (configs.indexOf(config) === -1) { - return config; - } - } - return null; -}; -_addRunner = new WeakSet(); -addRunner_fn = function(running, req) { - const config = __privateMethod(this, _getNextConfig, getNextConfig_fn).call(this, running); - if (config == null) { - return null; - } - const runner = { - config, - result: null, - didBump: false, - perform: null, - staller: null - }; - const now = getTime3(); - runner.perform = (async () => { - try { - config.requests++; - const result = await this._translatePerform(config.provider, req); - runner.result = { result }; - } catch (error) { - config.errorResponses++; - runner.result = { error }; - } - const dt = getTime3() - now; - config._totalTime += dt; - config.rollingDuration = 0.95 * config.rollingDuration + 0.05 * dt; - runner.perform = null; - })(); - runner.staller = (async () => { - await stall2(config.stallTimeout); - runner.staller = null; - })(); - running.add(runner); - return runner; -}; -_initialSync = new WeakSet(); -initialSync_fn = async function() { - let initialSync = __privateGet(this, _initialSyncPromise); - if (!initialSync) { - const promises = []; - __privateGet(this, _configs).forEach((config) => { - promises.push((async () => { - await waitForSync(config, 0); - if (!config._lastFatalError) { - config._network = await config.provider.getNetwork(); - } - })()); - }); - __privateSet(this, _initialSyncPromise, initialSync = (async () => { - await Promise.all(promises); - let chainId = null; - for (const config of __privateGet(this, _configs)) { - if (config._lastFatalError) { - continue; - } - const network = config._network; - if (chainId == null) { - chainId = network.chainId; - } else if (network.chainId !== chainId) { - assert(false, "cannot mix providers on different networks", "UNSUPPORTED_OPERATION", { - operation: "new FallbackProvider" - }); - } - } - })()); - } - await initialSync; -}; -_checkQuorum = new WeakSet(); -checkQuorum_fn = async function(running, req) { - const results = []; - for (const runner of running) { - if (runner.result != null) { - const { tag, value } = normalizeResult(runner.result); - results.push({ tag, value, weight: runner.config.weight }); - } - } - if (results.reduce((a, r) => a + r.weight, 0) < this.quorum) { - return void 0; - } - switch (req.method) { - case "getBlockNumber": { - if (__privateGet(this, _height) === -2) { - __privateSet(this, _height, Math.ceil(getNumber(getMedian(this.quorum, __privateGet(this, _configs).filter((c) => !c._lastFatalError).map((c) => ({ - value: c.blockNumber, - tag: getNumber(c.blockNumber).toString(), - weight: c.weight - })))))); - } - const mode = getFuzzyMode(this.quorum, results); - if (mode === void 0) { - return void 0; - } - if (mode > __privateGet(this, _height)) { - __privateSet(this, _height, mode); - } - return __privateGet(this, _height); - } - case "getGasPrice": - case "getPriorityFee": - case "estimateGas": - return getMedian(this.quorum, results); - case "getBlock": - if ("blockTag" in req && req.blockTag === "pending") { - return getAnyResult(this.quorum, results); - } - return checkQuorum(this.quorum, results); - case "call": - case "chainId": - case "getBalance": - case "getTransactionCount": - case "getCode": - case "getStorage": - case "getTransaction": - case "getTransactionReceipt": - case "getLogs": - return checkQuorum(this.quorum, results); - case "broadcastTransaction": - return getAnyResult(this.quorum, results); - } - assert(false, "unsupported method", "UNSUPPORTED_OPERATION", { - operation: `_perform(${stringify2(req.method)})` - }); -}; -_waitForQuorum = new WeakSet(); -waitForQuorum_fn = async function(running, req) { - if (running.size === 0) { - throw new Error("no runners?!"); - } - const interesting = []; - let newRunners = 0; - for (const runner of running) { - if (runner.perform) { - interesting.push(runner.perform); - } - if (runner.staller) { - interesting.push(runner.staller); - continue; - } - if (runner.didBump) { - continue; - } - runner.didBump = true; - newRunners++; - } - const value = await __privateMethod(this, _checkQuorum, checkQuorum_fn).call(this, running, req); - if (value !== void 0) { - if (value instanceof Error) { - throw value; - } - return value; - } - for (let i = 0; i < newRunners; i++) { - __privateMethod(this, _addRunner, addRunner_fn).call(this, running, req); - } - assert(interesting.length > 0, "quorum not met", "SERVER_ERROR", { - request: "%sub-requests", - info: { request: req, results: Array.from(running).map((r) => stringify2(r.result)) } - }); - await Promise.race(interesting); - return await __privateMethod(this, _waitForQuorum, waitForQuorum_fn).call(this, running, req); -}; - -// node_modules/ethers/lib.esm/providers/default-provider.js -function isWebSocketLike(value) { - return value && typeof value.send === "function" && typeof value.close === "function"; -} -var Testnets = "goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" "); -function getDefaultProvider(network, options) { - if (options == null) { - options = {}; - } - const allowService = (name) => { - if (options[name] === "-") { - return false; - } - if (typeof options.exclusive === "string") { - return name === options.exclusive; - } - if (Array.isArray(options.exclusive)) { - return options.exclusive.indexOf(name) !== -1; - } - return true; - }; - if (typeof network === "string" && network.match(/^https?:/)) { - return new JsonRpcProvider(network); - } - if (typeof network === "string" && network.match(/^wss?:/) || isWebSocketLike(network)) { - return new WebSocketProvider(network); - } - let staticNetwork = null; - try { - staticNetwork = Network.from(network); - } catch (error) { - } - const providers = []; - if (allowService("publicPolygon") && staticNetwork) { - if (staticNetwork.name === "matic") { - providers.push(new JsonRpcProvider("https://polygon-rpc.com/", staticNetwork, { staticNetwork })); - } - } - if (allowService("alchemy")) { - try { - providers.push(new AlchemyProvider(network, options.alchemy)); - } catch (error) { - } - } - if (allowService("ankr") && options.ankr != null) { - try { - providers.push(new AnkrProvider(network, options.ankr)); - } catch (error) { - } - } - if (allowService("cloudflare")) { - try { - providers.push(new CloudflareProvider(network)); - } catch (error) { - } - } - if (allowService("etherscan")) { - try { - providers.push(new EtherscanProvider(network, options.etherscan)); - } catch (error) { - } - } - if (allowService("infura")) { - try { - let projectId = options.infura; - let projectSecret = void 0; - if (typeof projectId === "object") { - projectSecret = projectId.projectSecret; - projectId = projectId.projectId; - } - providers.push(new InfuraProvider(network, projectId, projectSecret)); - } catch (error) { - } - } - if (allowService("quicknode")) { - try { - let token = options.quicknode; - providers.push(new QuickNodeProvider(network, token)); - } catch (error) { - } - } - assert(providers.length, "unsupported default network", "UNSUPPORTED_OPERATION", { - operation: "getDefaultProvider" - }); - if (providers.length === 1) { - return providers[0]; - } - let quorum = Math.floor(providers.length / 2); - if (quorum > 2) { - quorum = 2; - } - if (staticNetwork && Testnets.indexOf(staticNetwork.name) !== -1) { - quorum = 1; - } - if (options && options.quorum) { - quorum = options.quorum; - } - return new FallbackProvider(providers, void 0, { quorum }); -} - -// node_modules/ethers/lib.esm/providers/signer-noncemanager.js -var _noncePromise, _delta; -var _NonceManager = class _NonceManager extends AbstractSigner { - /** - * Creates a new **NonceManager** to manage %%signer%%. - */ - constructor(signer) { - super(signer.provider); - /** - * The Signer being managed. - */ - __publicField(this, "signer"); - __privateAdd(this, _noncePromise, void 0); - __privateAdd(this, _delta, void 0); - defineProperties(this, { signer }); - __privateSet(this, _noncePromise, null); - __privateSet(this, _delta, 0); - } - async getAddress() { - return this.signer.getAddress(); - } - connect(provider) { - return new _NonceManager(this.signer.connect(provider)); - } - async getNonce(blockTag) { - if (blockTag === "pending") { - if (__privateGet(this, _noncePromise) == null) { - __privateSet(this, _noncePromise, super.getNonce("pending")); - } - const delta = __privateGet(this, _delta); - return await __privateGet(this, _noncePromise) + delta; - } - return super.getNonce(blockTag); - } - /** - * Manually increment the nonce. This may be useful when managng - * offline transactions. - */ - increment() { - __privateWrapper(this, _delta)._++; - } - /** - * Resets the nonce, causing the **NonceManager** to reload the current - * nonce from the blockchain on the next transaction. - */ - reset() { - __privateSet(this, _delta, 0); - __privateSet(this, _noncePromise, null); - } - async sendTransaction(tx) { - const noncePromise = this.getNonce("pending"); - this.increment(); - tx = await this.signer.populateTransaction(tx); - tx.nonce = await noncePromise; - return await this.signer.sendTransaction(tx); - } - signTransaction(tx) { - return this.signer.signTransaction(tx); - } - signMessage(message) { - return this.signer.signMessage(message); - } - signTypedData(domain, types, value) { - return this.signer.signTypedData(domain, types, value); - } -}; -_noncePromise = new WeakMap(); -_delta = new WeakMap(); -var NonceManager = _NonceManager; - -// node_modules/ethers/lib.esm/providers/provider-browser.js -var _request2; -var BrowserProvider = class extends JsonRpcApiPollingProvider { - /** - * Connnect to the %%ethereum%% provider, optionally forcing the - * %%network%%. - */ - constructor(ethereum, network) { - assertArgument(ethereum && ethereum.request, "invalid EIP-1193 provider", "ethereum", ethereum); - super(network, { batchMaxCount: 1 }); - __privateAdd(this, _request2, void 0); - __privateSet(this, _request2, async (method, params) => { - const payload = { method, params }; - this.emit("debug", { action: "sendEip1193Request", payload }); - try { - const result = await ethereum.request(payload); - this.emit("debug", { action: "receiveEip1193Result", result }); - return result; - } catch (e) { - const error = new Error(e.message); - error.code = e.code; - error.data = e.data; - error.payload = payload; - this.emit("debug", { action: "receiveEip1193Error", error }); - throw error; - } - }); - } - async send(method, params) { - await this._start(); - return await super.send(method, params); - } - async _send(payload) { - assertArgument(!Array.isArray(payload), "EIP-1193 does not support batch request", "payload", payload); - try { - const result = await __privateGet(this, _request2).call(this, payload.method, payload.params || []); - return [{ id: payload.id, result }]; - } catch (e) { - return [{ - id: payload.id, - error: { code: e.code, data: e.data, message: e.message } - }]; - } - } - getRpcError(payload, error) { - error = JSON.parse(JSON.stringify(error)); - switch (error.error.code || -1) { - case 4001: - error.error.message = `ethers-user-denied: ${error.error.message}`; - break; - case 4200: - error.error.message = `ethers-unsupported: ${error.error.message}`; - break; - } - return super.getRpcError(payload, error); - } - /** - * Resolves to ``true`` if the provider manages the %%address%%. - */ - async hasSigner(address) { - if (address == null) { - address = 0; - } - const accounts = await this.send("eth_accounts", []); - if (typeof address === "number") { - return accounts.length > address; - } - address = address.toLowerCase(); - return accounts.filter((a) => a.toLowerCase() === address).length !== 0; - } - async getSigner(address) { - if (address == null) { - address = 0; - } - if (!await this.hasSigner(address)) { - try { - await __privateGet(this, _request2).call(this, "eth_requestAccounts", []); - } catch (error) { - const payload = error.payload; - throw this.getRpcError(payload, { id: payload.id, error }); - } - } - return await super.getSigner(address); - } -}; -_request2 = new WeakMap(); - -// node_modules/ethers/lib.esm/providers/provider-pocket.js -var defaultApplicationId = "62e1ad51b37b8e00394bda3b"; -function getHost5(name) { - switch (name) { - case "mainnet": - return "eth-mainnet.gateway.pokt.network"; - case "goerli": - return "eth-goerli.gateway.pokt.network"; - case "matic": - return "poly-mainnet.gateway.pokt.network"; - case "matic-mumbai": - return "polygon-mumbai-rpc.gateway.pokt.network"; - } - assertArgument(false, "unsupported network", "network", name); -} -var PocketProvider = class _PocketProvider extends JsonRpcProvider { - /** - * Create a new **PocketProvider**. - * - * By default connecting to ``mainnet`` with a highly throttled - * API key. - */ - constructor(_network3, applicationId, applicationSecret) { - if (_network3 == null) { - _network3 = "mainnet"; - } - const network = Network.from(_network3); - if (applicationId == null) { - applicationId = defaultApplicationId; - } - if (applicationSecret == null) { - applicationSecret = null; - } - const options = { staticNetwork: network }; - const request = _PocketProvider.getRequest(network, applicationId, applicationSecret); - super(request, network, options); - /** - * The Application ID for the Pocket connection. - */ - __publicField(this, "applicationId"); - /** - * The Application Secret for making authenticated requests - * to the Pocket connection. - */ - __publicField(this, "applicationSecret"); - defineProperties(this, { applicationId, applicationSecret }); - } - _getProvider(chainId) { - try { - return new _PocketProvider(chainId, this.applicationId, this.applicationSecret); - } catch (error) { - } - return super._getProvider(chainId); - } - /** - * Returns a prepared request for connecting to %%network%% with - * %%applicationId%%. - */ - static getRequest(network, applicationId, applicationSecret) { - if (applicationId == null) { - applicationId = defaultApplicationId; - } - const request = new FetchRequest(`https://${getHost5(network.name)}/v1/lb/${applicationId}`); - request.allowGzip = true; - if (applicationSecret) { - request.setCredentials("", applicationSecret); - } - if (applicationId === defaultApplicationId) { - request.retryFunc = async (request2, response, attempt) => { - showThrottleMessage("PocketProvider"); - return true; - }; - } - return request; - } - isCommunityResource() { - return this.applicationId === defaultApplicationId; - } -}; - -// node_modules/ethers/lib.esm/providers/provider-ipcsocket-browser.js -var IpcSocketProvider = void 0; - -// node_modules/ethers/lib.esm/wallet/base-wallet.js -var _signingKey; -var _BaseWallet = class _BaseWallet extends AbstractSigner { - /** - * Creates a new BaseWallet for %%privateKey%%, optionally - * connected to %%provider%%. - * - * If %%provider%% is not specified, only offline methods can - * be used. - */ - constructor(privateKey, provider) { - super(provider); - /** - * The wallet address. - */ - __publicField(this, "address"); - __privateAdd(this, _signingKey, void 0); - assertArgument(privateKey && typeof privateKey.sign === "function", "invalid private key", "privateKey", "[ REDACTED ]"); - __privateSet(this, _signingKey, privateKey); - const address = computeAddress(this.signingKey.publicKey); - defineProperties(this, { address }); - } - // Store private values behind getters to reduce visibility - // in console.log - /** - * The [[SigningKey]] used for signing payloads. - */ - get signingKey() { - return __privateGet(this, _signingKey); - } - /** - * The private key for this wallet. - */ - get privateKey() { - return this.signingKey.privateKey; - } - async getAddress() { - return this.address; - } - connect(provider) { - return new _BaseWallet(__privateGet(this, _signingKey), provider); - } - async signTransaction(tx) { - const { to, from } = await resolveProperties({ - to: tx.to ? resolveAddress(tx.to, this.provider) : void 0, - from: tx.from ? resolveAddress(tx.from, this.provider) : void 0 - }); - if (to != null) { - tx.to = to; - } - if (from != null) { - tx.from = from; - } - if (tx.from != null) { - assertArgument(getAddress(tx.from) === this.address, "transaction from address mismatch", "tx.from", tx.from); - delete tx.from; - } - const btx = Transaction.from(tx); - btx.signature = this.signingKey.sign(btx.unsignedHash); - return btx.serialized; - } - async signMessage(message) { - return this.signMessageSync(message); - } - // @TODO: Add a secialized signTx and signTyped sync that enforces - // all parameters are known? - /** - * Returns the signature for %%message%% signed with this wallet. - */ - signMessageSync(message) { - return this.signingKey.sign(hashMessage(message)).serialized; - } - async signTypedData(domain, types, value) { - const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (name) => { - assert(this.provider != null, "cannot resolve ENS names without a provider", "UNSUPPORTED_OPERATION", { - operation: "resolveName", - info: { name } - }); - const address = await this.provider.resolveName(name); - assert(address != null, "unconfigured ENS name", "UNCONFIGURED_NAME", { - value: name - }); - return address; - }); - return this.signingKey.sign(TypedDataEncoder.hash(populated.domain, types, populated.value)).serialized; - } -}; -_signingKey = new WeakMap(); -var BaseWallet = _BaseWallet; - -// node_modules/ethers/lib.esm/wordlists/decode-owl.js -var subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; -var Word = /^[a-z]*$/i; -function unfold(words2, sep) { - let initial = 97; - return words2.reduce((accum, word) => { - if (word === sep) { - initial++; - } else if (word.match(Word)) { - accum.push(String.fromCharCode(initial) + word); - } else { - initial = 97; - accum.push(word); - } - return accum; - }, []); -} -function decode(data, subs) { - for (let i = subsChrs.length - 1; i >= 0; i--) { - data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2)); - } - const clumps = []; - const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => { - if (semi) { - for (let i = parseInt(semi); i >= 0; i--) { - clumps.push(";"); - } - } else { - clumps.push(item.toLowerCase()); - } - return ""; - }); - if (leftover) { - throw new Error(`leftovers: ${JSON.stringify(leftover)}`); - } - return unfold(unfold(clumps, ";"), ":"); -} -function decodeOwl(data) { - assertArgument(data[0] === "0", "unsupported auwl data", "data", data); - return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length)); -} - -// node_modules/ethers/lib.esm/wordlists/wordlist.js -var Wordlist = class { - /** - * Creates a new Wordlist instance. - * - * Sub-classes MUST call this if they provide their own constructor, - * passing in the locale string of the language. - * - * Generally there is no need to create instances of a Wordlist, - * since each language-specific Wordlist creates an instance and - * there is no state kept internally, so they are safe to share. - */ - constructor(locale) { - __publicField(this, "locale"); - defineProperties(this, { locale }); - } - /** - * Sub-classes may override this to provide a language-specific - * method for spliting %%phrase%% into individual words. - * - * By default, %%phrase%% is split using any sequences of - * white-space as defined by regular expressions (i.e. ``/\s+/``). - */ - split(phrase) { - return phrase.toLowerCase().split(/\s+/g); - } - /** - * Sub-classes may override this to provider a language-specific - * method for joining %%words%% into a phrase. - * - * By default, %%words%% are joined by a single space. - */ - join(words2) { - return words2.join(" "); - } -}; - -// node_modules/ethers/lib.esm/wordlists/wordlist-owl.js -var _data4, _checksum, _words, _loadWords, loadWords_fn; -var WordlistOwl = class extends Wordlist { - /** - * Creates a new Wordlist for %%locale%% using the OWL %%data%% - * and validated against the %%checksum%%. - */ - constructor(locale, data, checksum2) { - super(locale); - __privateAdd(this, _loadWords); - __privateAdd(this, _data4, void 0); - __privateAdd(this, _checksum, void 0); - __privateAdd(this, _words, void 0); - __privateSet(this, _data4, data); - __privateSet(this, _checksum, checksum2); - __privateSet(this, _words, null); - } - /** - * The OWL-encoded data. - */ - get _data() { - return __privateGet(this, _data4); - } - /** - * Decode all the words for the wordlist. - */ - _decodeWords() { - return decodeOwl(__privateGet(this, _data4)); - } - getWord(index) { - const words2 = __privateMethod(this, _loadWords, loadWords_fn).call(this); - assertArgument(index >= 0 && index < words2.length, `invalid word index: ${index}`, "index", index); - return words2[index]; - } - getWordIndex(word) { - return __privateMethod(this, _loadWords, loadWords_fn).call(this).indexOf(word); - } -}; -_data4 = new WeakMap(); -_checksum = new WeakMap(); -_words = new WeakMap(); -_loadWords = new WeakSet(); -loadWords_fn = function() { - if (__privateGet(this, _words) == null) { - const words2 = this._decodeWords(); - const checksum2 = id(words2.join("\n") + "\n"); - if (checksum2 !== __privateGet(this, _checksum)) { - throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`); - } - __privateSet(this, _words, words2); - } - return __privateGet(this, _words); -}; - -// node_modules/ethers/lib.esm/wordlists/lang-en.js -var words = "0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+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rac!Rr%S ySs/akeXXedXtu*5Bi!DelDifyMM|N.%NkeyN, N`OnR$ReRn(gSqu.oTh T]T%Unta(U'VeVie5ChFf(LeLtiplySc!SeumShroomS-/Tu$3Self/ yTh:I=MePk(Rrow/yT]Tu*3ArCkEdGati=G!@I` PhewR=/TTw%kUtr$V WsXt3CeGht5B!I'M(eeOd!Rm$R`SeTab!TeTh(gTi)VelW5C!?Mb R'T:K0EyJe@Li+Scu*S =Ta(Vious0CurEAyEa'Ed+U{UgUn+2EmEtIntL?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO"; -var checksum = "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"; -var wordlist = null; -var LangEn = class _LangEn extends WordlistOwl { - /** - * Creates a new instance of the English language Wordlist. - * - * This should be unnecessary most of the time as the exported - * [[langEn]] should suffice. - * - * @_ignore: - */ - constructor() { - super("en", words, checksum); - } - /** - * Returns a singleton instance of a ``LangEn``, creating it - * if this is the first time being called. - */ - static wordlist() { - if (wordlist == null) { - wordlist = new _LangEn(); - } - return wordlist; - } -}; - -// node_modules/ethers/lib.esm/wallet/mnemonic.js -function getUpperMask(bits) { - return (1 << bits) - 1 << 8 - bits & 255; -} -function getLowerMask(bits) { - return (1 << bits) - 1 & 255; -} -function mnemonicToEntropy(mnemonic, wordlist2) { - assertNormalize("NFKD"); - if (wordlist2 == null) { - wordlist2 = LangEn.wordlist(); - } - const words2 = wordlist2.split(mnemonic); - assertArgument(words2.length % 3 === 0 && words2.length >= 12 && words2.length <= 24, "invalid mnemonic length", "mnemonic", "[ REDACTED ]"); - const entropy = new Uint8Array(Math.ceil(11 * words2.length / 8)); - let offset = 0; - for (let i = 0; i < words2.length; i++) { - let index = wordlist2.getWordIndex(words2[i].normalize("NFKD")); - assertArgument(index >= 0, `invalid mnemonic word at index ${i}`, "mnemonic", "[ REDACTED ]"); - for (let bit = 0; bit < 11; bit++) { - if (index & 1 << 10 - bit) { - entropy[offset >> 3] |= 1 << 7 - offset % 8; - } - offset++; - } - } - const entropyBits = 32 * words2.length / 3; - const checksumBits = words2.length / 3; - const checksumMask = getUpperMask(checksumBits); - const checksum2 = getBytes(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; - assertArgument(checksum2 === (entropy[entropy.length - 1] & checksumMask), "invalid mnemonic checksum", "mnemonic", "[ REDACTED ]"); - return hexlify(entropy.slice(0, entropyBits / 8)); -} -function entropyToMnemonic(entropy, wordlist2) { - assertArgument(entropy.length % 4 === 0 && entropy.length >= 16 && entropy.length <= 32, "invalid entropy size", "entropy", "[ REDACTED ]"); - if (wordlist2 == null) { - wordlist2 = LangEn.wordlist(); - } - const indices = [0]; - let remainingBits = 11; - for (let i = 0; i < entropy.length; i++) { - if (remainingBits > 8) { - indices[indices.length - 1] <<= 8; - indices[indices.length - 1] |= entropy[i]; - remainingBits -= 8; - } else { - indices[indices.length - 1] <<= remainingBits; - indices[indices.length - 1] |= entropy[i] >> 8 - remainingBits; - indices.push(entropy[i] & getLowerMask(8 - remainingBits)); - remainingBits += 3; - } - } - const checksumBits = entropy.length / 4; - const checksum2 = parseInt(sha2562(entropy).substring(2, 4), 16) & getUpperMask(checksumBits); - indices[indices.length - 1] <<= checksumBits; - indices[indices.length - 1] |= checksum2 >> 8 - checksumBits; - return wordlist2.join(indices.map((index) => wordlist2.getWord(index))); -} -var _guard5 = {}; -var Mnemonic = class _Mnemonic { - /** - * @private - */ - constructor(guard, entropy, phrase, password, wordlist2) { - /** - * The mnemonic phrase of 12, 15, 18, 21 or 24 words. - * - * Use the [[wordlist]] ``split`` method to get the individual words. - */ - __publicField(this, "phrase"); - /** - * The password used for this mnemonic. If no password is used this - * is the empty string (i.e. ``""``) as per the specification. - */ - __publicField(this, "password"); - /** - * The wordlist for this mnemonic. - */ - __publicField(this, "wordlist"); - /** - * The underlying entropy which the mnemonic encodes. - */ - __publicField(this, "entropy"); - if (password == null) { - password = ""; - } - if (wordlist2 == null) { - wordlist2 = LangEn.wordlist(); - } - assertPrivate(guard, _guard5, "Mnemonic"); - defineProperties(this, { phrase, password, wordlist: wordlist2, entropy }); - } - /** - * Returns the seed for the mnemonic. - */ - computeSeed() { - const salt = toUtf8Bytes("mnemonic" + this.password, "NFKD"); - return pbkdf22(toUtf8Bytes(this.phrase, "NFKD"), salt, 2048, 64, "sha512"); - } - /** - * Creates a new Mnemonic for the %%phrase%%. - * - * The default %%password%% is the empty string and the default - * wordlist is the [English wordlists](LangEn). - */ - static fromPhrase(phrase, password, wordlist2) { - const entropy = mnemonicToEntropy(phrase, wordlist2); - phrase = entropyToMnemonic(getBytes(entropy), wordlist2); - return new _Mnemonic(_guard5, entropy, phrase, password, wordlist2); - } - /** - * Create a new **Mnemonic** from the %%entropy%%. - * - * The default %%password%% is the empty string and the default - * wordlist is the [English wordlists](LangEn). - */ - static fromEntropy(_entropy, password, wordlist2) { - const entropy = getBytes(_entropy, "entropy"); - const phrase = entropyToMnemonic(entropy, wordlist2); - return new _Mnemonic(_guard5, hexlify(entropy), phrase, password, wordlist2); - } - /** - * Returns the phrase for %%mnemonic%%. - */ - static entropyToPhrase(_entropy, wordlist2) { - const entropy = getBytes(_entropy, "entropy"); - return entropyToMnemonic(entropy, wordlist2); - } - /** - * Returns the entropy for %%phrase%%. - */ - static phraseToEntropy(phrase, wordlist2) { - return mnemonicToEntropy(phrase, wordlist2); - } - /** - * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase. - * - * This checks all the provided words belong to the %%wordlist%%, - * that the length is valid and the checksum is correct. - */ - static isValidMnemonic(phrase, wordlist2) { - try { - mnemonicToEntropy(phrase, wordlist2); - return true; - } catch (error) { - } - return false; - } -}; - -// node_modules/aes-js/lib.esm/aes.js -var __classPrivateFieldGet = function(receiver, state, kind, f2) { - if (kind === "a" && !f2) - throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f2 : !state.has(receiver)) - throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f2 : kind === "a" ? f2.call(receiver) : f2 ? f2.value : state.get(receiver); -}; -var __classPrivateFieldSet = function(receiver, state, value, kind, f2) { - if (kind === "m") - throw new TypeError("Private method is not writable"); - if (kind === "a" && !f2) - throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f2 : !state.has(receiver)) - throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return kind === "a" ? f2.call(receiver, value) : f2 ? f2.value = value : state.set(receiver, value), value; -}; -var _AES_key; -var _AES_Kd; -var _AES_Ke; -var numberOfRounds = { 16: 10, 24: 12, 32: 14 }; -var rcon = [1, 2, 4, 8, 16, 32, 64, 128, 27, 54, 108, 216, 171, 77, 154, 47, 94, 188, 99, 198, 151, 53, 106, 212, 179, 125, 250, 239, 197, 145]; -var S = [99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22]; -var Si = [82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125]; -var T1 = [3328402341, 4168907908, 4000806809, 4135287693, 4294111757, 3597364157, 3731845041, 2445657428, 1613770832, 33620227, 3462883241, 1445669757, 3892248089, 3050821474, 1303096294, 3967186586, 2412431941, 528646813, 2311702848, 4202528135, 4026202645, 2992200171, 2387036105, 4226871307, 1101901292, 3017069671, 1604494077, 1169141738, 597466303, 1403299063, 3832705686, 2613100635, 1974974402, 3791519004, 1033081774, 1277568618, 1815492186, 2118074177, 4126668546, 2211236943, 1748251740, 1369810420, 3521504564, 4193382664, 3799085459, 2883115123, 1647391059, 706024767, 134480908, 2512897874, 1176707941, 2646852446, 806885416, 932615841, 168101135, 798661301, 235341577, 605164086, 461406363, 3756188221, 3454790438, 1311188841, 2142417613, 3933566367, 302582043, 495158174, 1479289972, 874125870, 907746093, 3698224818, 3025820398, 1537253627, 2756858614, 1983593293, 3084310113, 2108928974, 1378429307, 3722699582, 1580150641, 327451799, 2790478837, 3117535592, 0, 3253595436, 1075847264, 3825007647, 2041688520, 3059440621, 3563743934, 2378943302, 1740553945, 1916352843, 2487896798, 2555137236, 2958579944, 2244988746, 3151024235, 3320835882, 1336584933, 3992714006, 2252555205, 2588757463, 1714631509, 293963156, 2319795663, 3925473552, 67240454, 4269768577, 2689618160, 2017213508, 631218106, 1269344483, 2723238387, 1571005438, 2151694528, 93294474, 1066570413, 563977660, 1882732616, 4059428100, 1673313503, 2008463041, 2950355573, 1109467491, 537923632, 3858759450, 4260623118, 3218264685, 2177748300, 403442708, 638784309, 3287084079, 3193921505, 899127202, 2286175436, 773265209, 2479146071, 1437050866, 4236148354, 2050833735, 3362022572, 3126681063, 840505643, 3866325909, 3227541664, 427917720, 2655997905, 2749160575, 1143087718, 1412049534, 999329963, 193497219, 2353415882, 3354324521, 1807268051, 672404540, 2816401017, 3160301282, 369822493, 2916866934, 3688947771, 1681011286, 1949973070, 336202270, 2454276571, 201721354, 1210328172, 3093060836, 2680341085, 3184776046, 1135389935, 3294782118, 965841320, 831886756, 3554993207, 4068047243, 3588745010, 2345191491, 1849112409, 3664604599, 26054028, 2983581028, 2622377682, 1235855840, 3630984372, 2891339514, 4092916743, 3488279077, 3395642799, 4101667470, 1202630377, 268961816, 1874508501, 4034427016, 1243948399, 1546530418, 941366308, 1470539505, 1941222599, 2546386513, 3421038627, 2715671932, 3899946140, 1042226977, 2521517021, 1639824860, 227249030, 260737669, 3765465232, 2084453954, 1907733956, 3429263018, 2420656344, 100860677, 4160157185, 470683154, 3261161891, 1781871967, 2924959737, 1773779408, 394692241, 2579611992, 974986535, 664706745, 3655459128, 3958962195, 731420851, 571543859, 3530123707, 2849626480, 126783113, 865375399, 765172662, 1008606754, 361203602, 3387549984, 2278477385, 2857719295, 1344809080, 2782912378, 59542671, 1503764984, 160008576, 437062935, 1707065306, 3622233649, 2218934982, 3496503480, 2185314755, 697932208, 1512910199, 504303377, 2075177163, 2824099068, 1841019862, 739644986]; -var T2 = [2781242211, 2230877308, 2582542199, 2381740923, 234877682, 3184946027, 2984144751, 1418839493, 1348481072, 50462977, 2848876391, 2102799147, 434634494, 1656084439, 3863849899, 2599188086, 1167051466, 2636087938, 1082771913, 2281340285, 368048890, 3954334041, 3381544775, 201060592, 3963727277, 1739838676, 4250903202, 3930435503, 3206782108, 4149453988, 2531553906, 1536934080, 3262494647, 484572669, 2923271059, 1783375398, 1517041206, 1098792767, 49674231, 1334037708, 1550332980, 4098991525, 886171109, 150598129, 2481090929, 1940642008, 1398944049, 1059722517, 201851908, 1385547719, 1699095331, 1587397571, 674240536, 2704774806, 252314885, 3039795866, 151914247, 908333586, 2602270848, 1038082786, 651029483, 1766729511, 3447698098, 2682942837, 454166793, 2652734339, 1951935532, 775166490, 758520603, 3000790638, 4004797018, 4217086112, 4137964114, 1299594043, 1639438038, 3464344499, 2068982057, 1054729187, 1901997871, 2534638724, 4121318227, 1757008337, 0, 750906861, 1614815264, 535035132, 3363418545, 3988151131, 3201591914, 1183697867, 3647454910, 1265776953, 3734260298, 3566750796, 3903871064, 1250283471, 1807470800, 717615087, 3847203498, 384695291, 3313910595, 3617213773, 1432761139, 2484176261, 3481945413, 283769337, 100925954, 2180939647, 4037038160, 1148730428, 3123027871, 3813386408, 4087501137, 4267549603, 3229630528, 2315620239, 2906624658, 3156319645, 1215313976, 82966005, 3747855548, 3245848246, 1974459098, 1665278241, 807407632, 451280895, 251524083, 1841287890, 1283575245, 337120268, 891687699, 801369324, 3787349855, 2721421207, 3431482436, 959321879, 1469301956, 4065699751, 2197585534, 1199193405, 2898814052, 3887750493, 724703513, 2514908019, 2696962144, 2551808385, 3516813135, 2141445340, 1715741218, 2119445034, 2872807568, 2198571144, 3398190662, 700968686, 3547052216, 1009259540, 2041044702, 3803995742, 487983883, 1991105499, 1004265696, 1449407026, 1316239930, 504629770, 3683797321, 168560134, 1816667172, 3837287516, 1570751170, 1857934291, 4014189740, 2797888098, 2822345105, 2754712981, 936633572, 2347923833, 852879335, 1133234376, 1500395319, 3084545389, 2348912013, 1689376213, 3533459022, 3762923945, 3034082412, 4205598294, 133428468, 634383082, 2949277029, 2398386810, 3913789102, 403703816, 3580869306, 2297460856, 1867130149, 1918643758, 607656988, 4049053350, 3346248884, 1368901318, 600565992, 2090982877, 2632479860, 557719327, 3717614411, 3697393085, 2249034635, 2232388234, 2430627952, 1115438654, 3295786421, 2865522278, 3633334344, 84280067, 33027830, 303828494, 2747425121, 1600795957, 4188952407, 3496589753, 2434238086, 1486471617, 658119965, 3106381470, 953803233, 334231800, 3005978776, 857870609, 3151128937, 1890179545, 2298973838, 2805175444, 3056442267, 574365214, 2450884487, 550103529, 1233637070, 4289353045, 2018519080, 2057691103, 2399374476, 4166623649, 2148108681, 387583245, 3664101311, 836232934, 3330556482, 3100665960, 3280093505, 2955516313, 2002398509, 287182607, 3413881008, 4238890068, 3597515707, 975967766]; -var T3 = [1671808611, 2089089148, 2006576759, 2072901243, 4061003762, 1807603307, 1873927791, 3310653893, 810573872, 16974337, 1739181671, 729634347, 4263110654, 3613570519, 2883997099, 1989864566, 3393556426, 2191335298, 3376449993, 2106063485, 4195741690, 1508618841, 1204391495, 4027317232, 2917941677, 3563566036, 2734514082, 2951366063, 2629772188, 2767672228, 1922491506, 3227229120, 3082974647, 4246528509, 2477669779, 644500518, 911895606, 1061256767, 4144166391, 3427763148, 878471220, 2784252325, 3845444069, 4043897329, 1905517169, 3631459288, 827548209, 356461077, 67897348, 3344078279, 593839651, 3277757891, 405286936, 2527147926, 84871685, 2595565466, 118033927, 305538066, 2157648768, 3795705826, 3945188843, 661212711, 2999812018, 1973414517, 152769033, 2208177539, 745822252, 439235610, 455947803, 1857215598, 1525593178, 2700827552, 1391895634, 994932283, 3596728278, 3016654259, 695947817, 3812548067, 795958831, 2224493444, 1408607827, 3513301457, 0, 3979133421, 543178784, 4229948412, 2982705585, 1542305371, 1790891114, 3410398667, 3201918910, 961245753, 1256100938, 1289001036, 1491644504, 3477767631, 3496721360, 4012557807, 2867154858, 4212583931, 1137018435, 1305975373, 861234739, 2241073541, 1171229253, 4178635257, 33948674, 2139225727, 1357946960, 1011120188, 2679776671, 2833468328, 1374921297, 2751356323, 1086357568, 2408187279, 2460827538, 2646352285, 944271416, 4110742005, 3168756668, 3066132406, 3665145818, 560153121, 271589392, 4279952895, 4077846003, 3530407890, 3444343245, 202643468, 322250259, 3962553324, 1608629855, 2543990167, 1154254916, 389623319, 3294073796, 2817676711, 2122513534, 1028094525, 1689045092, 1575467613, 422261273, 1939203699, 1621147744, 2174228865, 1339137615, 3699352540, 577127458, 712922154, 2427141008, 2290289544, 1187679302, 3995715566, 3100863416, 339486740, 3732514782, 1591917662, 186455563, 3681988059, 3762019296, 844522546, 978220090, 169743370, 1239126601, 101321734, 611076132, 1558493276, 3260915650, 3547250131, 2901361580, 1655096418, 2443721105, 2510565781, 3828863972, 2039214713, 3878868455, 3359869896, 928607799, 1840765549, 2374762893, 3580146133, 1322425422, 2850048425, 1823791212, 1459268694, 4094161908, 3928346602, 1706019429, 2056189050, 2934523822, 135794696, 3134549946, 2022240376, 628050469, 779246638, 472135708, 2800834470, 3032970164, 3327236038, 3894660072, 3715932637, 1956440180, 522272287, 1272813131, 3185336765, 2340818315, 2323976074, 1888542832, 1044544574, 3049550261, 1722469478, 1222152264, 50660867, 4127324150, 236067854, 1638122081, 895445557, 1475980887, 3117443513, 2257655686, 3243809217, 489110045, 2662934430, 3778599393, 4162055160, 2561878936, 288563729, 1773916777, 3648039385, 2391345038, 2493985684, 2612407707, 505560094, 2274497927, 3911240169, 3460925390, 1442818645, 678973480, 3749357023, 2358182796, 2717407649, 2306869641, 219617805, 3218761151, 3862026214, 1120306242, 1756942440, 1103331905, 2578459033, 762796589, 252780047, 2966125488, 1425844308, 3151392187, 372911126]; -var T4 = [1667474886, 2088535288, 2004326894, 2071694838, 4075949567, 1802223062, 1869591006, 3318043793, 808472672, 16843522, 1734846926, 724270422, 4278065639, 3621216949, 2880169549, 1987484396, 3402253711, 2189597983, 3385409673, 2105378810, 4210693615, 1499065266, 1195886990, 4042263547, 2913856577, 3570689971, 2728590687, 2947541573, 2627518243, 2762274643, 1920112356, 3233831835, 3082273397, 4261223649, 2475929149, 640051788, 909531756, 1061110142, 4160160501, 3435941763, 875846760, 2779116625, 3857003729, 4059105529, 1903268834, 3638064043, 825316194, 353713962, 67374088, 3351728789, 589522246, 3284360861, 404236336, 2526454071, 84217610, 2593830191, 117901582, 303183396, 2155911963, 3806477791, 3958056653, 656894286, 2998062463, 1970642922, 151591698, 2206440989, 741110872, 437923380, 454765878, 1852748508, 1515908788, 2694904667, 1381168804, 993742198, 3604373943, 3014905469, 690584402, 3823320797, 791638366, 2223281939, 1398011302, 3520161977, 0, 3991743681, 538992704, 4244381667, 2981218425, 1532751286, 1785380564, 3419096717, 3200178535, 960056178, 1246420628, 1280103576, 1482221744, 3486468741, 3503319995, 4025428677, 2863326543, 4227536621, 1128514950, 1296947098, 859002214, 2240123921, 1162203018, 4193849577, 33687044, 2139062782, 1347481760, 1010582648, 2678045221, 2829640523, 1364325282, 2745433693, 1077985408, 2408548869, 2459086143, 2644360225, 943212656, 4126475505, 3166494563, 3065430391, 3671750063, 555836226, 269496352, 4294908645, 4092792573, 3537006015, 3452783745, 202118168, 320025894, 3974901699, 1600119230, 2543297077, 1145359496, 387397934, 3301201811, 2812801621, 2122220284, 1027426170, 1684319432, 1566435258, 421079858, 1936954854, 1616945344, 2172753945, 1330631070, 3705438115, 572679748, 707427924, 2425400123, 2290647819, 1179044492, 4008585671, 3099120491, 336870440, 3739122087, 1583276732, 185277718, 3688593069, 3772791771, 842159716, 976899700, 168435220, 1229577106, 101059084, 606366792, 1549591736, 3267517855, 3553849021, 2897014595, 1650632388, 2442242105, 2509612081, 3840161747, 2038008818, 3890688725, 3368567691, 926374254, 1835907034, 2374863873, 3587531953, 1313788572, 2846482505, 1819063512, 1448540844, 4109633523, 3941213647, 1701162954, 2054852340, 2930698567, 134748176, 3132806511, 2021165296, 623210314, 774795868, 471606328, 2795958615, 3031746419, 3334885783, 3907527627, 3722280097, 1953799400, 522133822, 1263263126, 3183336545, 2341176845, 2324333839, 1886425312, 1044267644, 3048588401, 1718004428, 1212733584, 50529542, 4143317495, 235803164, 1633788866, 892690282, 1465383342, 3115962473, 2256965911, 3250673817, 488449850, 2661202215, 3789633753, 4177007595, 2560144171, 286339874, 1768537042, 3654906025, 2391705863, 2492770099, 2610673197, 505291324, 2273808917, 3924369609, 3469625735, 1431699370, 673740880, 3755965093, 2358021891, 2711746649, 2307489801, 218961690, 3217021541, 3873845719, 1111672452, 1751693520, 1094828930, 2576986153, 757954394, 252645662, 2964376443, 1414855848, 3149649517, 370555436]; -var T5 = [1374988112, 2118214995, 437757123, 975658646, 1001089995, 530400753, 2902087851, 1273168787, 540080725, 2910219766, 2295101073, 4110568485, 1340463100, 3307916247, 641025152, 3043140495, 3736164937, 632953703, 1172967064, 1576976609, 3274667266, 2169303058, 2370213795, 1809054150, 59727847, 361929877, 3211623147, 2505202138, 3569255213, 1484005843, 1239443753, 2395588676, 1975683434, 4102977912, 2572697195, 666464733, 3202437046, 4035489047, 3374361702, 2110667444, 1675577880, 3843699074, 2538681184, 1649639237, 2976151520, 3144396420, 4269907996, 4178062228, 1883793496, 2403728665, 2497604743, 1383856311, 2876494627, 1917518562, 3810496343, 1716890410, 3001755655, 800440835, 2261089178, 3543599269, 807962610, 599762354, 33778362, 3977675356, 2328828971, 2809771154, 4077384432, 1315562145, 1708848333, 101039829, 3509871135, 3299278474, 875451293, 2733856160, 92987698, 2767645557, 193195065, 1080094634, 1584504582, 3178106961, 1042385657, 2531067453, 3711829422, 1306967366, 2438237621, 1908694277, 67556463, 1615861247, 429456164, 3602770327, 2302690252, 1742315127, 2968011453, 126454664, 3877198648, 2043211483, 2709260871, 2084704233, 4169408201, 0, 159417987, 841739592, 504459436, 1817866830, 4245618683, 260388950, 1034867998, 908933415, 168810852, 1750902305, 2606453969, 607530554, 202008497, 2472011535, 3035535058, 463180190, 2160117071, 1641816226, 1517767529, 470948374, 3801332234, 3231722213, 1008918595, 303765277, 235474187, 4069246893, 766945465, 337553864, 1475418501, 2943682380, 4003061179, 2743034109, 4144047775, 1551037884, 1147550661, 1543208500, 2336434550, 3408119516, 3069049960, 3102011747, 3610369226, 1113818384, 328671808, 2227573024, 2236228733, 3535486456, 2935566865, 3341394285, 496906059, 3702665459, 226906860, 2009195472, 733156972, 2842737049, 294930682, 1206477858, 2835123396, 2700099354, 1451044056, 573804783, 2269728455, 3644379585, 2362090238, 2564033334, 2801107407, 2776292904, 3669462566, 1068351396, 742039012, 1350078989, 1784663195, 1417561698, 4136440770, 2430122216, 775550814, 2193862645, 2673705150, 1775276924, 1876241833, 3475313331, 3366754619, 270040487, 3902563182, 3678124923, 3441850377, 1851332852, 3969562369, 2203032232, 3868552805, 2868897406, 566021896, 4011190502, 3135740889, 1248802510, 3936291284, 699432150, 832877231, 708780849, 3332740144, 899835584, 1951317047, 4236429990, 3767586992, 866637845, 4043610186, 1106041591, 2144161806, 395441711, 1984812685, 1139781709, 3433712980, 3835036895, 2664543715, 1282050075, 3240894392, 1181045119, 2640243204, 25965917, 4203181171, 4211818798, 3009879386, 2463879762, 3910161971, 1842759443, 2597806476, 933301370, 1509430414, 3943906441, 3467192302, 3076639029, 3776767469, 2051518780, 2631065433, 1441952575, 404016761, 1942435775, 1408749034, 1610459739, 3745345300, 2017778566, 3400528769, 3110650942, 941896748, 3265478751, 371049330, 3168937228, 675039627, 4279080257, 967311729, 135050206, 3635733660, 1683407248, 2076935265, 3576870512, 1215061108, 3501741890]; -var T6 = [1347548327, 1400783205, 3273267108, 2520393566, 3409685355, 4045380933, 2880240216, 2471224067, 1428173050, 4138563181, 2441661558, 636813900, 4233094615, 3620022987, 2149987652, 2411029155, 1239331162, 1730525723, 2554718734, 3781033664, 46346101, 310463728, 2743944855, 3328955385, 3875770207, 2501218972, 3955191162, 3667219033, 768917123, 3545789473, 692707433, 1150208456, 1786102409, 2029293177, 1805211710, 3710368113, 3065962831, 401639597, 1724457132, 3028143674, 409198410, 2196052529, 1620529459, 1164071807, 3769721975, 2226875310, 486441376, 2499348523, 1483753576, 428819965, 2274680428, 3075636216, 598438867, 3799141122, 1474502543, 711349675, 129166120, 53458370, 2592523643, 2782082824, 4063242375, 2988687269, 3120694122, 1559041666, 730517276, 2460449204, 4042459122, 2706270690, 3446004468, 3573941694, 533804130, 2328143614, 2637442643, 2695033685, 839224033, 1973745387, 957055980, 2856345839, 106852767, 1371368976, 4181598602, 1033297158, 2933734917, 1179510461, 3046200461, 91341917, 1862534868, 4284502037, 605657339, 2547432937, 3431546947, 2003294622, 3182487618, 2282195339, 954669403, 3682191598, 1201765386, 3917234703, 3388507166, 0, 2198438022, 1211247597, 2887651696, 1315723890, 4227665663, 1443857720, 507358933, 657861945, 1678381017, 560487590, 3516619604, 975451694, 2970356327, 261314535, 3535072918, 2652609425, 1333838021, 2724322336, 1767536459, 370938394, 182621114, 3854606378, 1128014560, 487725847, 185469197, 2918353863, 3106780840, 3356761769, 2237133081, 1286567175, 3152976349, 4255350624, 2683765030, 3160175349, 3309594171, 878443390, 1988838185, 3704300486, 1756818940, 1673061617, 3403100636, 272786309, 1075025698, 545572369, 2105887268, 4174560061, 296679730, 1841768865, 1260232239, 4091327024, 3960309330, 3497509347, 1814803222, 2578018489, 4195456072, 575138148, 3299409036, 446754879, 3629546796, 4011996048, 3347532110, 3252238545, 4270639778, 915985419, 3483825537, 681933534, 651868046, 2755636671, 3828103837, 223377554, 2607439820, 1649704518, 3270937875, 3901806776, 1580087799, 4118987695, 3198115200, 2087309459, 2842678573, 3016697106, 1003007129, 2802849917, 1860738147, 2077965243, 164439672, 4100872472, 32283319, 2827177882, 1709610350, 2125135846, 136428751, 3874428392, 3652904859, 3460984630, 3572145929, 3593056380, 2939266226, 824852259, 818324884, 3224740454, 930369212, 2801566410, 2967507152, 355706840, 1257309336, 4148292826, 243256656, 790073846, 2373340630, 1296297904, 1422699085, 3756299780, 3818836405, 457992840, 3099667487, 2135319889, 77422314, 1560382517, 1945798516, 788204353, 1521706781, 1385356242, 870912086, 325965383, 2358957921, 2050466060, 2388260884, 2313884476, 4006521127, 901210569, 3990953189, 1014646705, 1503449823, 1062597235, 2031621326, 3212035895, 3931371469, 1533017514, 350174575, 2256028891, 2177544179, 1052338372, 741876788, 1606591296, 1914052035, 213705253, 2334669897, 1107234197, 1899603969, 3725069491, 2631447780, 2422494913, 1635502980, 1893020342, 1950903388, 1120974935]; -var T7 = [2807058932, 1699970625, 2764249623, 1586903591, 1808481195, 1173430173, 1487645946, 59984867, 4199882800, 1844882806, 1989249228, 1277555970, 3623636965, 3419915562, 1149249077, 2744104290, 1514790577, 459744698, 244860394, 3235995134, 1963115311, 4027744588, 2544078150, 4190530515, 1608975247, 2627016082, 2062270317, 1507497298, 2200818878, 567498868, 1764313568, 3359936201, 2305455554, 2037970062, 1047239e3, 1910319033, 1337376481, 2904027272, 2892417312, 984907214, 1243112415, 830661914, 861968209, 2135253587, 2011214180, 2927934315, 2686254721, 731183368, 1750626376, 4246310725, 1820824798, 4172763771, 3542330227, 48394827, 2404901663, 2871682645, 671593195, 3254988725, 2073724613, 145085239, 2280796200, 2779915199, 1790575107, 2187128086, 472615631, 3029510009, 4075877127, 3802222185, 4107101658, 3201631749, 1646252340, 4270507174, 1402811438, 1436590835, 3778151818, 3950355702, 3963161475, 4020912224, 2667994737, 273792366, 2331590177, 104699613, 95345982, 3175501286, 2377486676, 1560637892, 3564045318, 369057872, 4213447064, 3919042237, 1137477952, 2658625497, 1119727848, 2340947849, 1530455833, 4007360968, 172466556, 266959938, 516552836, 0, 2256734592, 3980931627, 1890328081, 1917742170, 4294704398, 945164165, 3575528878, 958871085, 3647212047, 2787207260, 1423022939, 775562294, 1739656202, 3876557655, 2530391278, 2443058075, 3310321856, 547512796, 1265195639, 437656594, 3121275539, 719700128, 3762502690, 387781147, 218828297, 3350065803, 2830708150, 2848461854, 428169201, 122466165, 3720081049, 1627235199, 648017665, 4122762354, 1002783846, 2117360635, 695634755, 3336358691, 4234721005, 4049844452, 3704280881, 2232435299, 574624663, 287343814, 612205898, 1039717051, 840019705, 2708326185, 793451934, 821288114, 1391201670, 3822090177, 376187827, 3113855344, 1224348052, 1679968233, 2361698556, 1058709744, 752375421, 2431590963, 1321699145, 3519142200, 2734591178, 188127444, 2177869557, 3727205754, 2384911031, 3215212461, 2648976442, 2450346104, 3432737375, 1180849278, 331544205, 3102249176, 4150144569, 2952102595, 2159976285, 2474404304, 766078933, 313773861, 2570832044, 2108100632, 1668212892, 3145456443, 2013908262, 418672217, 3070356634, 2594734927, 1852171925, 3867060991, 3473416636, 3907448597, 2614737639, 919489135, 164948639, 2094410160, 2997825956, 590424639, 2486224549, 1723872674, 3157750862, 3399941250, 3501252752, 3625268135, 2555048196, 3673637356, 1343127501, 4130281361, 3599595085, 2957853679, 1297403050, 81781910, 3051593425, 2283490410, 532201772, 1367295589, 3926170974, 895287692, 1953757831, 1093597963, 492483431, 3528626907, 1446242576, 1192455638, 1636604631, 209336225, 344873464, 1015671571, 669961897, 3375740769, 3857572124, 2973530695, 3747192018, 1933530610, 3464042516, 935293895, 3454686199, 2858115069, 1863638845, 3683022916, 4085369519, 3292445032, 875313188, 1080017571, 3279033885, 621591778, 1233856572, 2504130317, 24197544, 3017672716, 3835484340, 3247465558, 2220981195, 3060847922, 1551124588, 1463996600]; -var T8 = [4104605777, 1097159550, 396673818, 660510266, 2875968315, 2638606623, 4200115116, 3808662347, 821712160, 1986918061, 3430322568, 38544885, 3856137295, 718002117, 893681702, 1654886325, 2975484382, 3122358053, 3926825029, 4274053469, 796197571, 1290801793, 1184342925, 3556361835, 2405426947, 2459735317, 1836772287, 1381620373, 3196267988, 1948373848, 3764988233, 3385345166, 3263785589, 2390325492, 1480485785, 3111247143, 3780097726, 2293045232, 548169417, 3459953789, 3746175075, 439452389, 1362321559, 1400849762, 1685577905, 1806599355, 2174754046, 137073913, 1214797936, 1174215055, 3731654548, 2079897426, 1943217067, 1258480242, 529487843, 1437280870, 3945269170, 3049390895, 3313212038, 923313619, 679998e3, 3215307299, 57326082, 377642221, 3474729866, 2041877159, 133361907, 1776460110, 3673476453, 96392454, 878845905, 2801699524, 777231668, 4082475170, 2330014213, 4142626212, 2213296395, 1626319424, 1906247262, 1846563261, 562755902, 3708173718, 1040559837, 3871163981, 1418573201, 3294430577, 114585348, 1343618912, 2566595609, 3186202582, 1078185097, 3651041127, 3896688048, 2307622919, 425408743, 3371096953, 2081048481, 1108339068, 2216610296, 0, 2156299017, 736970802, 292596766, 1517440620, 251657213, 2235061775, 2933202493, 758720310, 265905162, 1554391400, 1532285339, 908999204, 174567692, 1474760595, 4002861748, 2610011675, 3234156416, 3693126241, 2001430874, 303699484, 2478443234, 2687165888, 585122620, 454499602, 151849742, 2345119218, 3064510765, 514443284, 4044981591, 1963412655, 2581445614, 2137062819, 19308535, 1928707164, 1715193156, 4219352155, 1126790795, 600235211, 3992742070, 3841024952, 836553431, 1669664834, 2535604243, 3323011204, 1243905413, 3141400786, 4180808110, 698445255, 2653899549, 2989552604, 2253581325, 3252932727, 3004591147, 1891211689, 2487810577, 3915653703, 4237083816, 4030667424, 2100090966, 865136418, 1229899655, 953270745, 3399679628, 3557504664, 4118925222, 2061379749, 3079546586, 2915017791, 983426092, 2022837584, 1607244650, 2118541908, 2366882550, 3635996816, 972512814, 3283088770, 1568718495, 3499326569, 3576539503, 621982671, 2895723464, 410887952, 2623762152, 1002142683, 645401037, 1494807662, 2595684844, 1335535747, 2507040230, 4293295786, 3167684641, 367585007, 3885750714, 1865862730, 2668221674, 2960971305, 2763173681, 1059270954, 2777952454, 2724642869, 1320957812, 2194319100, 2429595872, 2815956275, 77089521, 3973773121, 3444575871, 2448830231, 1305906550, 4021308739, 2857194700, 2516901860, 3518358430, 1787304780, 740276417, 1699839814, 1592394909, 2352307457, 2272556026, 188821243, 1729977011, 3687994002, 274084841, 3594982253, 3613494426, 2701949495, 4162096729, 322734571, 2837966542, 1640576439, 484830689, 1202797690, 3537852828, 4067639125, 349075736, 3342319475, 4157467219, 4255800159, 1030690015, 1155237496, 2951971274, 1757691577, 607398968, 2738905026, 499347990, 3794078908, 1011452712, 227885567, 2818666809, 213114376, 3034881240, 1455525988, 3414450555, 850817237, 1817998408, 3092726480]; -var U1 = [0, 235474187, 470948374, 303765277, 941896748, 908933415, 607530554, 708780849, 1883793496, 2118214995, 1817866830, 1649639237, 1215061108, 1181045119, 1417561698, 1517767529, 3767586992, 4003061179, 4236429990, 4069246893, 3635733660, 3602770327, 3299278474, 3400528769, 2430122216, 2664543715, 2362090238, 2193862645, 2835123396, 2801107407, 3035535058, 3135740889, 3678124923, 3576870512, 3341394285, 3374361702, 3810496343, 3977675356, 4279080257, 4043610186, 2876494627, 2776292904, 3076639029, 3110650942, 2472011535, 2640243204, 2403728665, 2169303058, 1001089995, 899835584, 666464733, 699432150, 59727847, 226906860, 530400753, 294930682, 1273168787, 1172967064, 1475418501, 1509430414, 1942435775, 2110667444, 1876241833, 1641816226, 2910219766, 2743034109, 2976151520, 3211623147, 2505202138, 2606453969, 2302690252, 2269728455, 3711829422, 3543599269, 3240894392, 3475313331, 3843699074, 3943906441, 4178062228, 4144047775, 1306967366, 1139781709, 1374988112, 1610459739, 1975683434, 2076935265, 1775276924, 1742315127, 1034867998, 866637845, 566021896, 800440835, 92987698, 193195065, 429456164, 395441711, 1984812685, 2017778566, 1784663195, 1683407248, 1315562145, 1080094634, 1383856311, 1551037884, 101039829, 135050206, 437757123, 337553864, 1042385657, 807962610, 573804783, 742039012, 2531067453, 2564033334, 2328828971, 2227573024, 2935566865, 2700099354, 3001755655, 3168937228, 3868552805, 3902563182, 4203181171, 4102977912, 3736164937, 3501741890, 3265478751, 3433712980, 1106041591, 1340463100, 1576976609, 1408749034, 2043211483, 2009195472, 1708848333, 1809054150, 832877231, 1068351396, 766945465, 599762354, 159417987, 126454664, 361929877, 463180190, 2709260871, 2943682380, 3178106961, 3009879386, 2572697195, 2538681184, 2236228733, 2336434550, 3509871135, 3745345300, 3441850377, 3274667266, 3910161971, 3877198648, 4110568485, 4211818798, 2597806476, 2497604743, 2261089178, 2295101073, 2733856160, 2902087851, 3202437046, 2968011453, 3936291284, 3835036895, 4136440770, 4169408201, 3535486456, 3702665459, 3467192302, 3231722213, 2051518780, 1951317047, 1716890410, 1750902305, 1113818384, 1282050075, 1584504582, 1350078989, 168810852, 67556463, 371049330, 404016761, 841739592, 1008918595, 775550814, 540080725, 3969562369, 3801332234, 4035489047, 4269907996, 3569255213, 3669462566, 3366754619, 3332740144, 2631065433, 2463879762, 2160117071, 2395588676, 2767645557, 2868897406, 3102011747, 3069049960, 202008497, 33778362, 270040487, 504459436, 875451293, 975658646, 675039627, 641025152, 2084704233, 1917518562, 1615861247, 1851332852, 1147550661, 1248802510, 1484005843, 1451044056, 933301370, 967311729, 733156972, 632953703, 260388950, 25965917, 328671808, 496906059, 1206477858, 1239443753, 1543208500, 1441952575, 2144161806, 1908694277, 1675577880, 1842759443, 3610369226, 3644379585, 3408119516, 3307916247, 4011190502, 3776767469, 4077384432, 4245618683, 2809771154, 2842737049, 3144396420, 3043140495, 2673705150, 2438237621, 2203032232, 2370213795]; -var U2 = [0, 185469197, 370938394, 487725847, 741876788, 657861945, 975451694, 824852259, 1483753576, 1400783205, 1315723890, 1164071807, 1950903388, 2135319889, 1649704518, 1767536459, 2967507152, 3152976349, 2801566410, 2918353863, 2631447780, 2547432937, 2328143614, 2177544179, 3901806776, 3818836405, 4270639778, 4118987695, 3299409036, 3483825537, 3535072918, 3652904859, 2077965243, 1893020342, 1841768865, 1724457132, 1474502543, 1559041666, 1107234197, 1257309336, 598438867, 681933534, 901210569, 1052338372, 261314535, 77422314, 428819965, 310463728, 3409685355, 3224740454, 3710368113, 3593056380, 3875770207, 3960309330, 4045380933, 4195456072, 2471224067, 2554718734, 2237133081, 2388260884, 3212035895, 3028143674, 2842678573, 2724322336, 4138563181, 4255350624, 3769721975, 3955191162, 3667219033, 3516619604, 3431546947, 3347532110, 2933734917, 2782082824, 3099667487, 3016697106, 2196052529, 2313884476, 2499348523, 2683765030, 1179510461, 1296297904, 1347548327, 1533017514, 1786102409, 1635502980, 2087309459, 2003294622, 507358933, 355706840, 136428751, 53458370, 839224033, 957055980, 605657339, 790073846, 2373340630, 2256028891, 2607439820, 2422494913, 2706270690, 2856345839, 3075636216, 3160175349, 3573941694, 3725069491, 3273267108, 3356761769, 4181598602, 4063242375, 4011996048, 3828103837, 1033297158, 915985419, 730517276, 545572369, 296679730, 446754879, 129166120, 213705253, 1709610350, 1860738147, 1945798516, 2029293177, 1239331162, 1120974935, 1606591296, 1422699085, 4148292826, 4233094615, 3781033664, 3931371469, 3682191598, 3497509347, 3446004468, 3328955385, 2939266226, 2755636671, 3106780840, 2988687269, 2198438022, 2282195339, 2501218972, 2652609425, 1201765386, 1286567175, 1371368976, 1521706781, 1805211710, 1620529459, 2105887268, 1988838185, 533804130, 350174575, 164439672, 46346101, 870912086, 954669403, 636813900, 788204353, 2358957921, 2274680428, 2592523643, 2441661558, 2695033685, 2880240216, 3065962831, 3182487618, 3572145929, 3756299780, 3270937875, 3388507166, 4174560061, 4091327024, 4006521127, 3854606378, 1014646705, 930369212, 711349675, 560487590, 272786309, 457992840, 106852767, 223377554, 1678381017, 1862534868, 1914052035, 2031621326, 1211247597, 1128014560, 1580087799, 1428173050, 32283319, 182621114, 401639597, 486441376, 768917123, 651868046, 1003007129, 818324884, 1503449823, 1385356242, 1333838021, 1150208456, 1973745387, 2125135846, 1673061617, 1756818940, 2970356327, 3120694122, 2802849917, 2887651696, 2637442643, 2520393566, 2334669897, 2149987652, 3917234703, 3799141122, 4284502037, 4100872472, 3309594171, 3460984630, 3545789473, 3629546796, 2050466060, 1899603969, 1814803222, 1730525723, 1443857720, 1560382517, 1075025698, 1260232239, 575138148, 692707433, 878443390, 1062597235, 243256656, 91341917, 409198410, 325965383, 3403100636, 3252238545, 3704300486, 3620022987, 3874428392, 3990953189, 4042459122, 4227665663, 2460449204, 2578018489, 2226875310, 2411029155, 3198115200, 3046200461, 2827177882, 2743944855]; -var U3 = [0, 218828297, 437656594, 387781147, 875313188, 958871085, 775562294, 590424639, 1750626376, 1699970625, 1917742170, 2135253587, 1551124588, 1367295589, 1180849278, 1265195639, 3501252752, 3720081049, 3399941250, 3350065803, 3835484340, 3919042237, 4270507174, 4085369519, 3102249176, 3051593425, 2734591178, 2952102595, 2361698556, 2177869557, 2530391278, 2614737639, 3145456443, 3060847922, 2708326185, 2892417312, 2404901663, 2187128086, 2504130317, 2555048196, 3542330227, 3727205754, 3375740769, 3292445032, 3876557655, 3926170974, 4246310725, 4027744588, 1808481195, 1723872674, 1910319033, 2094410160, 1608975247, 1391201670, 1173430173, 1224348052, 59984867, 244860394, 428169201, 344873464, 935293895, 984907214, 766078933, 547512796, 1844882806, 1627235199, 2011214180, 2062270317, 1507497298, 1423022939, 1137477952, 1321699145, 95345982, 145085239, 532201772, 313773861, 830661914, 1015671571, 731183368, 648017665, 3175501286, 2957853679, 2807058932, 2858115069, 2305455554, 2220981195, 2474404304, 2658625497, 3575528878, 3625268135, 3473416636, 3254988725, 3778151818, 3963161475, 4213447064, 4130281361, 3599595085, 3683022916, 3432737375, 3247465558, 3802222185, 4020912224, 4172763771, 4122762354, 3201631749, 3017672716, 2764249623, 2848461854, 2331590177, 2280796200, 2431590963, 2648976442, 104699613, 188127444, 472615631, 287343814, 840019705, 1058709744, 671593195, 621591778, 1852171925, 1668212892, 1953757831, 2037970062, 1514790577, 1463996600, 1080017571, 1297403050, 3673637356, 3623636965, 3235995134, 3454686199, 4007360968, 3822090177, 4107101658, 4190530515, 2997825956, 3215212461, 2830708150, 2779915199, 2256734592, 2340947849, 2627016082, 2443058075, 172466556, 122466165, 273792366, 492483431, 1047239e3, 861968209, 612205898, 695634755, 1646252340, 1863638845, 2013908262, 1963115311, 1446242576, 1530455833, 1277555970, 1093597963, 1636604631, 1820824798, 2073724613, 1989249228, 1436590835, 1487645946, 1337376481, 1119727848, 164948639, 81781910, 331544205, 516552836, 1039717051, 821288114, 669961897, 719700128, 2973530695, 3157750862, 2871682645, 2787207260, 2232435299, 2283490410, 2667994737, 2450346104, 3647212047, 3564045318, 3279033885, 3464042516, 3980931627, 3762502690, 4150144569, 4199882800, 3070356634, 3121275539, 2904027272, 2686254721, 2200818878, 2384911031, 2570832044, 2486224549, 3747192018, 3528626907, 3310321856, 3359936201, 3950355702, 3867060991, 4049844452, 4234721005, 1739656202, 1790575107, 2108100632, 1890328081, 1402811438, 1586903591, 1233856572, 1149249077, 266959938, 48394827, 369057872, 418672217, 1002783846, 919489135, 567498868, 752375421, 209336225, 24197544, 376187827, 459744698, 945164165, 895287692, 574624663, 793451934, 1679968233, 1764313568, 2117360635, 1933530610, 1343127501, 1560637892, 1243112415, 1192455638, 3704280881, 3519142200, 3336358691, 3419915562, 3907448597, 3857572124, 4075877127, 4294704398, 3029510009, 3113855344, 2927934315, 2744104290, 2159976285, 2377486676, 2594734927, 2544078150]; -var U4 = [0, 151849742, 303699484, 454499602, 607398968, 758720310, 908999204, 1059270954, 1214797936, 1097159550, 1517440620, 1400849762, 1817998408, 1699839814, 2118541908, 2001430874, 2429595872, 2581445614, 2194319100, 2345119218, 3034881240, 3186202582, 2801699524, 2951971274, 3635996816, 3518358430, 3399679628, 3283088770, 4237083816, 4118925222, 4002861748, 3885750714, 1002142683, 850817237, 698445255, 548169417, 529487843, 377642221, 227885567, 77089521, 1943217067, 2061379749, 1640576439, 1757691577, 1474760595, 1592394909, 1174215055, 1290801793, 2875968315, 2724642869, 3111247143, 2960971305, 2405426947, 2253581325, 2638606623, 2487810577, 3808662347, 3926825029, 4044981591, 4162096729, 3342319475, 3459953789, 3576539503, 3693126241, 1986918061, 2137062819, 1685577905, 1836772287, 1381620373, 1532285339, 1078185097, 1229899655, 1040559837, 923313619, 740276417, 621982671, 439452389, 322734571, 137073913, 19308535, 3871163981, 4021308739, 4104605777, 4255800159, 3263785589, 3414450555, 3499326569, 3651041127, 2933202493, 2815956275, 3167684641, 3049390895, 2330014213, 2213296395, 2566595609, 2448830231, 1305906550, 1155237496, 1607244650, 1455525988, 1776460110, 1626319424, 2079897426, 1928707164, 96392454, 213114376, 396673818, 514443284, 562755902, 679998e3, 865136418, 983426092, 3708173718, 3557504664, 3474729866, 3323011204, 4180808110, 4030667424, 3945269170, 3794078908, 2507040230, 2623762152, 2272556026, 2390325492, 2975484382, 3092726480, 2738905026, 2857194700, 3973773121, 3856137295, 4274053469, 4157467219, 3371096953, 3252932727, 3673476453, 3556361835, 2763173681, 2915017791, 3064510765, 3215307299, 2156299017, 2307622919, 2459735317, 2610011675, 2081048481, 1963412655, 1846563261, 1729977011, 1480485785, 1362321559, 1243905413, 1126790795, 878845905, 1030690015, 645401037, 796197571, 274084841, 425408743, 38544885, 188821243, 3613494426, 3731654548, 3313212038, 3430322568, 4082475170, 4200115116, 3780097726, 3896688048, 2668221674, 2516901860, 2366882550, 2216610296, 3141400786, 2989552604, 2837966542, 2687165888, 1202797690, 1320957812, 1437280870, 1554391400, 1669664834, 1787304780, 1906247262, 2022837584, 265905162, 114585348, 499347990, 349075736, 736970802, 585122620, 972512814, 821712160, 2595684844, 2478443234, 2293045232, 2174754046, 3196267988, 3079546586, 2895723464, 2777952454, 3537852828, 3687994002, 3234156416, 3385345166, 4142626212, 4293295786, 3841024952, 3992742070, 174567692, 57326082, 410887952, 292596766, 777231668, 660510266, 1011452712, 893681702, 1108339068, 1258480242, 1343618912, 1494807662, 1715193156, 1865862730, 1948373848, 2100090966, 2701949495, 2818666809, 3004591147, 3122358053, 2235061775, 2352307457, 2535604243, 2653899549, 3915653703, 3764988233, 4219352155, 4067639125, 3444575871, 3294430577, 3746175075, 3594982253, 836553431, 953270745, 600235211, 718002117, 367585007, 484830689, 133361907, 251657213, 2041877159, 1891211689, 1806599355, 1654886325, 1568718495, 1418573201, 1335535747, 1184342925]; -function convertToInt32(bytes2) { - const result = []; - for (let i = 0; i < bytes2.length; i += 4) { - result.push(bytes2[i] << 24 | bytes2[i + 1] << 16 | bytes2[i + 2] << 8 | bytes2[i + 3]); - } - return result; -} -var AES = class _AES { - get key() { - return __classPrivateFieldGet(this, _AES_key, "f").slice(); - } - constructor(key) { - _AES_key.set(this, void 0); - _AES_Kd.set(this, void 0); - _AES_Ke.set(this, void 0); - if (!(this instanceof _AES)) { - throw Error("AES must be instanitated with `new`"); - } - __classPrivateFieldSet(this, _AES_key, new Uint8Array(key), "f"); - const rounds = numberOfRounds[this.key.length]; - if (rounds == null) { - throw new TypeError("invalid key size (must be 16, 24 or 32 bytes)"); - } - __classPrivateFieldSet(this, _AES_Ke, [], "f"); - __classPrivateFieldSet(this, _AES_Kd, [], "f"); - for (let i = 0; i <= rounds; i++) { - __classPrivateFieldGet(this, _AES_Ke, "f").push([0, 0, 0, 0]); - __classPrivateFieldGet(this, _AES_Kd, "f").push([0, 0, 0, 0]); - } - const roundKeyCount = (rounds + 1) * 4; - const KC = this.key.length / 4; - const tk = convertToInt32(this.key); - let index; - for (let i = 0; i < KC; i++) { - index = i >> 2; - __classPrivateFieldGet(this, _AES_Ke, "f")[index][i % 4] = tk[i]; - __classPrivateFieldGet(this, _AES_Kd, "f")[rounds - index][i % 4] = tk[i]; - } - let rconpointer = 0; - let t = KC, tt; - while (t < roundKeyCount) { - tt = tk[KC - 1]; - tk[0] ^= S[tt >> 16 & 255] << 24 ^ S[tt >> 8 & 255] << 16 ^ S[tt & 255] << 8 ^ S[tt >> 24 & 255] ^ rcon[rconpointer] << 24; - rconpointer += 1; - if (KC != 8) { - for (let i2 = 1; i2 < KC; i2++) { - tk[i2] ^= tk[i2 - 1]; - } - } else { - for (let i2 = 1; i2 < KC / 2; i2++) { - tk[i2] ^= tk[i2 - 1]; - } - tt = tk[KC / 2 - 1]; - tk[KC / 2] ^= S[tt & 255] ^ S[tt >> 8 & 255] << 8 ^ S[tt >> 16 & 255] << 16 ^ S[tt >> 24 & 255] << 24; - for (let i2 = KC / 2 + 1; i2 < KC; i2++) { - tk[i2] ^= tk[i2 - 1]; - } - } - let i = 0, r, c; - while (i < KC && t < roundKeyCount) { - r = t >> 2; - c = t % 4; - __classPrivateFieldGet(this, _AES_Ke, "f")[r][c] = tk[i]; - __classPrivateFieldGet(this, _AES_Kd, "f")[rounds - r][c] = tk[i++]; - t++; - } - } - for (let r = 1; r < rounds; r++) { - for (let c = 0; c < 4; c++) { - tt = __classPrivateFieldGet(this, _AES_Kd, "f")[r][c]; - __classPrivateFieldGet(this, _AES_Kd, "f")[r][c] = U1[tt >> 24 & 255] ^ U2[tt >> 16 & 255] ^ U3[tt >> 8 & 255] ^ U4[tt & 255]; - } - } - } - encrypt(plaintext) { - if (plaintext.length != 16) { - throw new TypeError("invalid plaintext size (must be 16 bytes)"); - } - const rounds = __classPrivateFieldGet(this, _AES_Ke, "f").length - 1; - const a = [0, 0, 0, 0]; - let t = convertToInt32(plaintext); - for (let i = 0; i < 4; i++) { - t[i] ^= __classPrivateFieldGet(this, _AES_Ke, "f")[0][i]; - } - for (let r = 1; r < rounds; r++) { - for (let i = 0; i < 4; i++) { - a[i] = T1[t[i] >> 24 & 255] ^ T2[t[(i + 1) % 4] >> 16 & 255] ^ T3[t[(i + 2) % 4] >> 8 & 255] ^ T4[t[(i + 3) % 4] & 255] ^ __classPrivateFieldGet(this, _AES_Ke, "f")[r][i]; - } - t = a.slice(); - } - const result = new Uint8Array(16); - let tt = 0; - for (let i = 0; i < 4; i++) { - tt = __classPrivateFieldGet(this, _AES_Ke, "f")[rounds][i]; - result[4 * i] = (S[t[i] >> 24 & 255] ^ tt >> 24) & 255; - result[4 * i + 1] = (S[t[(i + 1) % 4] >> 16 & 255] ^ tt >> 16) & 255; - result[4 * i + 2] = (S[t[(i + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255; - result[4 * i + 3] = (S[t[(i + 3) % 4] & 255] ^ tt) & 255; - } - return result; - } - decrypt(ciphertext) { - if (ciphertext.length != 16) { - throw new TypeError("invalid ciphertext size (must be 16 bytes)"); - } - const rounds = __classPrivateFieldGet(this, _AES_Kd, "f").length - 1; - const a = [0, 0, 0, 0]; - let t = convertToInt32(ciphertext); - for (let i = 0; i < 4; i++) { - t[i] ^= __classPrivateFieldGet(this, _AES_Kd, "f")[0][i]; - } - for (let r = 1; r < rounds; r++) { - for (let i = 0; i < 4; i++) { - a[i] = T5[t[i] >> 24 & 255] ^ T6[t[(i + 3) % 4] >> 16 & 255] ^ T7[t[(i + 2) % 4] >> 8 & 255] ^ T8[t[(i + 1) % 4] & 255] ^ __classPrivateFieldGet(this, _AES_Kd, "f")[r][i]; - } - t = a.slice(); - } - const result = new Uint8Array(16); - let tt = 0; - for (let i = 0; i < 4; i++) { - tt = __classPrivateFieldGet(this, _AES_Kd, "f")[rounds][i]; - result[4 * i] = (Si[t[i] >> 24 & 255] ^ tt >> 24) & 255; - result[4 * i + 1] = (Si[t[(i + 3) % 4] >> 16 & 255] ^ tt >> 16) & 255; - result[4 * i + 2] = (Si[t[(i + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255; - result[4 * i + 3] = (Si[t[(i + 1) % 4] & 255] ^ tt) & 255; - } - return result; - } -}; -_AES_key = /* @__PURE__ */ new WeakMap(), _AES_Kd = /* @__PURE__ */ new WeakMap(), _AES_Ke = /* @__PURE__ */ new WeakMap(); - -// node_modules/aes-js/lib.esm/mode.js -var ModeOfOperation = class { - constructor(name, key, cls) { - if (cls && !(this instanceof cls)) { - throw new Error(`${name} must be instantiated with "new"`); - } - Object.defineProperties(this, { - aes: { enumerable: true, value: new AES(key) }, - name: { enumerable: true, value: name } - }); - } -}; - -// node_modules/aes-js/lib.esm/mode-cbc.js -var __classPrivateFieldSet2 = function(receiver, state, value, kind, f2) { - if (kind === "m") - throw new TypeError("Private method is not writable"); - if (kind === "a" && !f2) - throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f2 : !state.has(receiver)) - throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return kind === "a" ? f2.call(receiver, value) : f2 ? f2.value = value : state.set(receiver, value), value; -}; -var __classPrivateFieldGet2 = function(receiver, state, kind, f2) { - if (kind === "a" && !f2) - throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f2 : !state.has(receiver)) - throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f2 : kind === "a" ? f2.call(receiver) : f2 ? f2.value : state.get(receiver); -}; -var _CBC_iv; -var _CBC_lastBlock; -var CBC = class _CBC extends ModeOfOperation { - constructor(key, iv) { - super("ECC", key, _CBC); - _CBC_iv.set(this, void 0); - _CBC_lastBlock.set(this, void 0); - if (iv) { - if (iv.length % 16) { - throw new TypeError("invalid iv size (must be 16 bytes)"); - } - __classPrivateFieldSet2(this, _CBC_iv, new Uint8Array(iv), "f"); - } else { - __classPrivateFieldSet2(this, _CBC_iv, new Uint8Array(16), "f"); - } - __classPrivateFieldSet2(this, _CBC_lastBlock, this.iv, "f"); - } - get iv() { - return new Uint8Array(__classPrivateFieldGet2(this, _CBC_iv, "f")); - } - encrypt(plaintext) { - if (plaintext.length % 16) { - throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)"); - } - const ciphertext = new Uint8Array(plaintext.length); - for (let i = 0; i < plaintext.length; i += 16) { - for (let j = 0; j < 16; j++) { - __classPrivateFieldGet2(this, _CBC_lastBlock, "f")[j] ^= plaintext[i + j]; - } - __classPrivateFieldSet2(this, _CBC_lastBlock, this.aes.encrypt(__classPrivateFieldGet2(this, _CBC_lastBlock, "f")), "f"); - ciphertext.set(__classPrivateFieldGet2(this, _CBC_lastBlock, "f"), i); - } - return ciphertext; - } - decrypt(ciphertext) { - if (ciphertext.length % 16) { - throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)"); - } - const plaintext = new Uint8Array(ciphertext.length); - for (let i = 0; i < ciphertext.length; i += 16) { - const block = this.aes.decrypt(ciphertext.subarray(i, i + 16)); - for (let j = 0; j < 16; j++) { - plaintext[i + j] = block[j] ^ __classPrivateFieldGet2(this, _CBC_lastBlock, "f")[j]; - __classPrivateFieldGet2(this, _CBC_lastBlock, "f")[j] = ciphertext[i + j]; - } - } - return plaintext; - } -}; -_CBC_iv = /* @__PURE__ */ new WeakMap(), _CBC_lastBlock = /* @__PURE__ */ new WeakMap(); - -// node_modules/aes-js/lib.esm/mode-cfb.js -var __classPrivateFieldGet3 = function(receiver, state, kind, f2) { - if (kind === "a" && !f2) - throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f2 : !state.has(receiver)) - throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f2 : kind === "a" ? f2.call(receiver) : f2 ? f2.value : state.get(receiver); -}; -var _CFB_instances; -var _CFB_iv; -var _CFB_shiftRegister; -var _CFB_shift; -_CFB_iv = /* @__PURE__ */ new WeakMap(), _CFB_shiftRegister = /* @__PURE__ */ new WeakMap(), _CFB_instances = /* @__PURE__ */ new WeakSet(), _CFB_shift = function _CFB_shift2(data) { - const segmentSize = this.segmentSize / 8; - __classPrivateFieldGet3(this, _CFB_shiftRegister, "f").set(__classPrivateFieldGet3(this, _CFB_shiftRegister, "f").subarray(segmentSize)); - __classPrivateFieldGet3(this, _CFB_shiftRegister, "f").set(data.subarray(0, segmentSize), 16 - segmentSize); -}; - -// node_modules/aes-js/lib.esm/mode-ctr.js -var __classPrivateFieldSet3 = function(receiver, state, value, kind, f2) { - if (kind === "m") - throw new TypeError("Private method is not writable"); - if (kind === "a" && !f2) - throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f2 : !state.has(receiver)) - throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return kind === "a" ? f2.call(receiver, value) : f2 ? f2.value = value : state.set(receiver, value), value; -}; -var __classPrivateFieldGet4 = function(receiver, state, kind, f2) { - if (kind === "a" && !f2) - throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f2 : !state.has(receiver)) - throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f2 : kind === "a" ? f2.call(receiver) : f2 ? f2.value : state.get(receiver); -}; -var _CTR_remaining; -var _CTR_remainingIndex; -var _CTR_counter; -var CTR = class _CTR extends ModeOfOperation { - constructor(key, initialValue) { - super("CTR", key, _CTR); - _CTR_remaining.set(this, void 0); - _CTR_remainingIndex.set(this, void 0); - _CTR_counter.set(this, void 0); - __classPrivateFieldSet3(this, _CTR_counter, new Uint8Array(16), "f"); - __classPrivateFieldGet4(this, _CTR_counter, "f").fill(0); - __classPrivateFieldSet3(this, _CTR_remaining, __classPrivateFieldGet4(this, _CTR_counter, "f"), "f"); - __classPrivateFieldSet3(this, _CTR_remainingIndex, 16, "f"); - if (initialValue == null) { - initialValue = 1; - } - if (typeof initialValue === "number") { - this.setCounterValue(initialValue); - } else { - this.setCounterBytes(initialValue); - } - } - get counter() { - return new Uint8Array(__classPrivateFieldGet4(this, _CTR_counter, "f")); - } - setCounterValue(value) { - if (!Number.isInteger(value) || value < 0 || value > Number.MAX_SAFE_INTEGER) { - throw new TypeError("invalid counter initial integer value"); - } - for (let index = 15; index >= 0; --index) { - __classPrivateFieldGet4(this, _CTR_counter, "f")[index] = value % 256; - value = Math.floor(value / 256); - } - } - setCounterBytes(value) { - if (value.length !== 16) { - throw new TypeError("invalid counter initial Uint8Array value length"); - } - __classPrivateFieldGet4(this, _CTR_counter, "f").set(value); - } - increment() { - for (let i = 15; i >= 0; i--) { - if (__classPrivateFieldGet4(this, _CTR_counter, "f")[i] === 255) { - __classPrivateFieldGet4(this, _CTR_counter, "f")[i] = 0; - } else { - __classPrivateFieldGet4(this, _CTR_counter, "f")[i]++; - break; - } - } - } - encrypt(plaintext) { - var _a2, _b; - const crypttext = new Uint8Array(plaintext); - for (let i = 0; i < crypttext.length; i++) { - if (__classPrivateFieldGet4(this, _CTR_remainingIndex, "f") === 16) { - __classPrivateFieldSet3(this, _CTR_remaining, this.aes.encrypt(__classPrivateFieldGet4(this, _CTR_counter, "f")), "f"); - __classPrivateFieldSet3(this, _CTR_remainingIndex, 0, "f"); - this.increment(); - } - crypttext[i] ^= __classPrivateFieldGet4(this, _CTR_remaining, "f")[__classPrivateFieldSet3(this, _CTR_remainingIndex, (_b = __classPrivateFieldGet4(this, _CTR_remainingIndex, "f"), _a2 = _b++, _b), "f"), _a2]; - } - return crypttext; - } - decrypt(ciphertext) { - return this.encrypt(ciphertext); - } -}; -_CTR_remaining = /* @__PURE__ */ new WeakMap(), _CTR_remainingIndex = /* @__PURE__ */ new WeakMap(), _CTR_counter = /* @__PURE__ */ new WeakMap(); - -// node_modules/aes-js/lib.esm/mode-ofb.js -var _OFB_iv; -var _OFB_lastPrecipher; -var _OFB_lastPrecipherIndex; -_OFB_iv = /* @__PURE__ */ new WeakMap(), _OFB_lastPrecipher = /* @__PURE__ */ new WeakMap(), _OFB_lastPrecipherIndex = /* @__PURE__ */ new WeakMap(); - -// node_modules/aes-js/lib.esm/padding.js -function pkcs7Strip(data) { - if (data.length < 16) { - throw new TypeError("PKCS#7 invalid length"); - } - const padder = data[data.length - 1]; - if (padder > 16) { - throw new TypeError("PKCS#7 padding byte out of range"); - } - const length = data.length - padder; - for (let i = 0; i < padder; i++) { - if (data[length + i] !== padder) { - throw new TypeError("PKCS#7 invalid padding byte"); - } - } - return new Uint8Array(data.subarray(0, length)); -} - -// node_modules/ethers/lib.esm/wallet/utils.js -function looseArrayify(hexString) { - if (typeof hexString === "string" && !hexString.startsWith("0x")) { - hexString = "0x" + hexString; - } - return getBytesCopy(hexString); -} -function zpad(value, length) { - value = String(value); - while (value.length < length) { - value = "0" + value; - } - return value; -} -function getPassword(password) { - if (typeof password === "string") { - return toUtf8Bytes(password, "NFKC"); - } - return getBytesCopy(password); -} -function spelunk(object2, _path) { - const match = _path.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i); - assertArgument(match != null, "invalid path", "path", _path); - const path = match[1]; - const type = match[3]; - const reqd = match[4] === "!"; - let cur = object2; - for (const comp of path.toLowerCase().split(".")) { - if (Array.isArray(cur)) { - if (!comp.match(/^[0-9]+$/)) { - break; - } - cur = cur[parseInt(comp)]; - } else if (typeof cur === "object") { - let found = null; - for (const key in cur) { - if (key.toLowerCase() === comp) { - found = cur[key]; - break; - } - } - cur = found; - } else { - cur = null; - } - if (cur == null) { - break; - } - } - assertArgument(!reqd || cur != null, "missing required value", "path", path); - if (type && cur != null) { - if (type === "int") { - if (typeof cur === "string" && cur.match(/^-?[0-9]+$/)) { - return parseInt(cur); - } else if (Number.isSafeInteger(cur)) { - return cur; - } - } - if (type === "number") { - if (typeof cur === "string" && cur.match(/^-?[0-9.]*$/)) { - return parseFloat(cur); - } - } - if (type === "data") { - if (typeof cur === "string") { - return looseArrayify(cur); - } - } - if (type === "array" && Array.isArray(cur)) { - return cur; - } - if (type === typeof cur) { - return cur; - } - assertArgument(false, `wrong type found for ${type} `, "path", path); - } - return cur; -} - -// node_modules/ethers/lib.esm/wallet/json-keystore.js -var defaultPath = "m/44'/60'/0'/0/0"; -function isKeystoreJson(json) { - try { - const data = JSON.parse(json); - const version2 = data.version != null ? parseInt(data.version) : 0; - if (version2 === 3) { - return true; - } - } catch (error) { - } - return false; -} -function decrypt(data, key, ciphertext) { - const cipher = spelunk(data, "crypto.cipher:string"); - if (cipher === "aes-128-ctr") { - const iv = spelunk(data, "crypto.cipherparams.iv:data!"); - const aesCtr = new CTR(key, iv); - return hexlify(aesCtr.decrypt(ciphertext)); - } - assert(false, "unsupported cipher", "UNSUPPORTED_OPERATION", { - operation: "decrypt" - }); -} -function getAccount(data, _key) { - const key = getBytes(_key); - const ciphertext = spelunk(data, "crypto.ciphertext:data!"); - const computedMAC = hexlify(keccak256(concat([key.slice(16, 32), ciphertext]))).substring(2); - assertArgument(computedMAC === spelunk(data, "crypto.mac:string!").toLowerCase(), "incorrect password", "password", "[ REDACTED ]"); - const privateKey = decrypt(data, key.slice(0, 16), ciphertext); - const address = computeAddress(privateKey); - if (data.address) { - let check = data.address.toLowerCase(); - if (!check.startsWith("0x")) { - check = "0x" + check; - } - assertArgument(getAddress(check) === address, "keystore address/privateKey mismatch", "address", data.address); - } - const account = { address, privateKey }; - const version2 = spelunk(data, "x-ethers.version:string"); - if (version2 === "0.1") { - const mnemonicKey = key.slice(32, 64); - const mnemonicCiphertext = spelunk(data, "x-ethers.mnemonicCiphertext:data!"); - const mnemonicIv = spelunk(data, "x-ethers.mnemonicCounter:data!"); - const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); - account.mnemonic = { - path: spelunk(data, "x-ethers.path:string") || defaultPath, - locale: spelunk(data, "x-ethers.locale:string") || "en", - entropy: hexlify(getBytes(mnemonicAesCtr.decrypt(mnemonicCiphertext))) - }; - } - return account; -} -function getDecryptKdfParams(data) { - const kdf = spelunk(data, "crypto.kdf:string"); - if (kdf && typeof kdf === "string") { - if (kdf.toLowerCase() === "scrypt") { - const salt = spelunk(data, "crypto.kdfparams.salt:data!"); - const N3 = spelunk(data, "crypto.kdfparams.n:int!"); - const r = spelunk(data, "crypto.kdfparams.r:int!"); - const p = spelunk(data, "crypto.kdfparams.p:int!"); - assertArgument(N3 > 0 && (N3 & N3 - 1) === 0, "invalid kdf.N", "kdf.N", N3); - assertArgument(r > 0 && p > 0, "invalid kdf", "kdf", kdf); - const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); - assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dflen", dkLen); - return { name: "scrypt", salt, N: N3, r, p, dkLen: 64 }; - } else if (kdf.toLowerCase() === "pbkdf2") { - const salt = spelunk(data, "crypto.kdfparams.salt:data!"); - const prf = spelunk(data, "crypto.kdfparams.prf:string!"); - const algorithm = prf.split("-").pop(); - assertArgument(algorithm === "sha256" || algorithm === "sha512", "invalid kdf.pdf", "kdf.pdf", prf); - const count = spelunk(data, "crypto.kdfparams.c:int!"); - const dkLen = spelunk(data, "crypto.kdfparams.dklen:int!"); - assertArgument(dkLen === 32, "invalid kdf.dklen", "kdf.dklen", dkLen); - return { name: "pbkdf2", salt, count, dkLen, algorithm }; - } - } - assertArgument(false, "unsupported key-derivation function", "kdf", kdf); -} -function decryptKeystoreJsonSync(json, _password) { - const data = JSON.parse(json); - const password = getPassword(_password); - const params = getDecryptKdfParams(data); - if (params.name === "pbkdf2") { - const { salt: salt2, count, dkLen: dkLen2, algorithm } = params; - const key2 = pbkdf22(password, salt2, count, dkLen2, algorithm); - return getAccount(data, key2); - } - assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { params }); - const { salt, N: N3, r, p, dkLen } = params; - const key = scryptSync(password, salt, N3, r, p, dkLen); - return getAccount(data, key); -} -function stall3(duration) { - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, duration); - }); -} -async function decryptKeystoreJson(json, _password, progress) { - const data = JSON.parse(json); - const password = getPassword(_password); - const params = getDecryptKdfParams(data); - if (params.name === "pbkdf2") { - if (progress) { - progress(0); - await stall3(0); - } - const { salt: salt2, count, dkLen: dkLen2, algorithm } = params; - const key2 = pbkdf22(password, salt2, count, dkLen2, algorithm); - if (progress) { - progress(1); - await stall3(0); - } - return getAccount(data, key2); - } - assert(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { params }); - const { salt, N: N3, r, p, dkLen } = params; - const key = await scrypt2(password, salt, N3, r, p, dkLen, progress); - return getAccount(data, key); -} -function getEncryptKdfParams(options) { - const salt = options.salt != null ? getBytes(options.salt, "options.salt") : randomBytes3(32); - let N3 = 1 << 17, r = 8, p = 1; - if (options.scrypt) { - if (options.scrypt.N) { - N3 = options.scrypt.N; - } - if (options.scrypt.r) { - r = options.scrypt.r; - } - if (options.scrypt.p) { - p = options.scrypt.p; - } - } - assertArgument(typeof N3 === "number" && N3 > 0 && Number.isSafeInteger(N3) && (BigInt(N3) & BigInt(N3 - 1)) === BigInt(0), "invalid scrypt N parameter", "options.N", N3); - assertArgument(typeof r === "number" && r > 0 && Number.isSafeInteger(r), "invalid scrypt r parameter", "options.r", r); - assertArgument(typeof p === "number" && p > 0 && Number.isSafeInteger(p), "invalid scrypt p parameter", "options.p", p); - return { name: "scrypt", dkLen: 32, salt, N: N3, r, p }; -} -function _encryptKeystore(key, kdf, account, options) { - const privateKey = getBytes(account.privateKey, "privateKey"); - const iv = options.iv != null ? getBytes(options.iv, "options.iv") : randomBytes3(16); - assertArgument(iv.length === 16, "invalid options.iv length", "options.iv", options.iv); - const uuidRandom = options.uuid != null ? getBytes(options.uuid, "options.uuid") : randomBytes3(16); - assertArgument(uuidRandom.length === 16, "invalid options.uuid length", "options.uuid", options.iv); - const derivedKey = key.slice(0, 16); - const macPrefix = key.slice(16, 32); - const aesCtr = new CTR(derivedKey, iv); - const ciphertext = getBytes(aesCtr.encrypt(privateKey)); - const mac = keccak256(concat([macPrefix, ciphertext])); - const data = { - address: account.address.substring(2).toLowerCase(), - id: uuidV4(uuidRandom), - version: 3, - Crypto: { - cipher: "aes-128-ctr", - cipherparams: { - iv: hexlify(iv).substring(2) - }, - ciphertext: hexlify(ciphertext).substring(2), - kdf: "scrypt", - kdfparams: { - salt: hexlify(kdf.salt).substring(2), - n: kdf.N, - dklen: 32, - p: kdf.p, - r: kdf.r - }, - mac: mac.substring(2) - } - }; - if (account.mnemonic) { - const client = options.client != null ? options.client : `ethers/${version}`; - const path = account.mnemonic.path || defaultPath; - const locale = account.mnemonic.locale || "en"; - const mnemonicKey = key.slice(32, 64); - const entropy = getBytes(account.mnemonic.entropy, "account.mnemonic.entropy"); - const mnemonicIv = randomBytes3(16); - const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv); - const mnemonicCiphertext = getBytes(mnemonicAesCtr.encrypt(entropy)); - const now = /* @__PURE__ */ new Date(); - const timestamp = now.getUTCFullYear() + "-" + zpad(now.getUTCMonth() + 1, 2) + "-" + zpad(now.getUTCDate(), 2) + "T" + zpad(now.getUTCHours(), 2) + "-" + zpad(now.getUTCMinutes(), 2) + "-" + zpad(now.getUTCSeconds(), 2) + ".0Z"; - const gethFilename = "UTC--" + timestamp + "--" + data.address; - data["x-ethers"] = { - client, - gethFilename, - path, - locale, - mnemonicCounter: hexlify(mnemonicIv).substring(2), - mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2), - version: "0.1" - }; - } - return JSON.stringify(data); -} -function encryptKeystoreJsonSync(account, password, options) { - if (options == null) { - options = {}; - } - const passwordBytes = getPassword(password); - const kdf = getEncryptKdfParams(options); - const key = scryptSync(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64); - return _encryptKeystore(getBytes(key), kdf, account, options); -} -async function encryptKeystoreJson(account, password, options) { - if (options == null) { - options = {}; - } - const passwordBytes = getPassword(password); - const kdf = getEncryptKdfParams(options); - const key = await scrypt2(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64, options.progressCallback); - return _encryptKeystore(getBytes(key), kdf, account, options); -} - -// node_modules/ethers/lib.esm/wallet/hdwallet.js -var defaultPath2 = "m/44'/60'/0'/0/0"; -var MasterSecret = new Uint8Array([66, 105, 116, 99, 111, 105, 110, 32, 115, 101, 101, 100]); -var HardenedBit = 2147483648; -var N2 = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); -var Nibbles2 = "0123456789abcdef"; -function zpad2(value, length) { - let result = ""; - while (value) { - result = Nibbles2[value % 16] + result; - value = Math.trunc(value / 16); - } - while (result.length < length * 2) { - result = "0" + result; - } - return "0x" + result; -} -function encodeBase58Check(_value2) { - const value = getBytes(_value2); - const check = dataSlice(sha2562(sha2562(value)), 0, 4); - const bytes2 = concat([value, check]); - return encodeBase58(bytes2); -} -var _guard6 = {}; -function ser_I(index, chainCode, publicKey, privateKey) { - const data = new Uint8Array(37); - if (index & HardenedBit) { - assert(privateKey != null, "cannot derive child of neutered node", "UNSUPPORTED_OPERATION", { - operation: "deriveChild" - }); - data.set(getBytes(privateKey), 1); - } else { - data.set(getBytes(publicKey)); - } - for (let i = 24; i >= 0; i -= 8) { - data[33 + (i >> 3)] = index >> 24 - i & 255; - } - const I = getBytes(computeHmac("sha512", chainCode, data)); - return { IL: I.slice(0, 32), IR: I.slice(32) }; -} -function derivePath(node, path) { - const components = path.split("/"); - assertArgument(components.length > 0, "invalid path", "path", path); - if (components[0] === "m") { - assertArgument(node.depth === 0, `cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${node.depth}`, "path", path); - components.shift(); - } - let result = node; - for (let i = 0; i < components.length; i++) { - const component = components[i]; - if (component.match(/^[0-9]+'$/)) { - const index = parseInt(component.substring(0, component.length - 1)); - assertArgument(index < HardenedBit, "invalid path index", `path[${i}]`, component); - result = result.deriveChild(HardenedBit + index); - } else if (component.match(/^[0-9]+$/)) { - const index = parseInt(component); - assertArgument(index < HardenedBit, "invalid path index", `path[${i}]`, component); - result = result.deriveChild(index); - } else { - assertArgument(false, "invalid path component", `path[${i}]`, component); - } - } - return result; -} -var _account, account_fn, _fromSeed, fromSeed_fn; -var _HDNodeWallet = class _HDNodeWallet extends BaseWallet { - /** - * @private - */ - constructor(guard, signingKey, parentFingerprint, chainCode, path, index, depth, mnemonic, provider) { - super(signingKey, provider); - __privateAdd(this, _account); - /** - * The compressed public key. - */ - __publicField(this, "publicKey"); - /** - * The fingerprint. - * - * A fingerprint allows quick qay to detect parent and child nodes, - * but developers should be prepared to deal with collisions as it - * is only 4 bytes. - */ - __publicField(this, "fingerprint"); - /** - * The parent fingerprint. - */ - __publicField(this, "parentFingerprint"); - /** - * The mnemonic used to create this HD Node, if available. - * - * Sources such as extended keys do not encode the mnemonic, in - * which case this will be ``null``. - */ - __publicField(this, "mnemonic"); - /** - * The chaincode, which is effectively a public key used - * to derive children. - */ - __publicField(this, "chainCode"); - /** - * The derivation path of this wallet. - * - * Since extended keys do not provider full path details, this - * may be ``null``, if instantiated from a source that does not - * enocde it. - */ - __publicField(this, "path"); - /** - * The child index of this wallet. Values over ``2 *\* 31`` indicate - * the node is hardened. - */ - __publicField(this, "index"); - /** - * The depth of this wallet, which is the number of components - * in its path. - */ - __publicField(this, "depth"); - assertPrivate(guard, _guard6, "HDNodeWallet"); - defineProperties(this, { publicKey: signingKey.compressedPublicKey }); - const fingerprint = dataSlice(ripemd1602(sha2562(this.publicKey)), 0, 4); - defineProperties(this, { - parentFingerprint, - fingerprint, - chainCode, - path, - index, - depth - }); - defineProperties(this, { mnemonic }); - } - connect(provider) { - return new _HDNodeWallet(_guard6, this.signingKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, this.mnemonic, provider); - } - /** - * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with - * %%password%%. - * - * If %%progressCallback%% is specified, it will receive periodic - * updates as the encryption process progreses. - */ - async encrypt(password, progressCallback) { - return await encryptKeystoreJson(__privateMethod(this, _account, account_fn).call(this), password, { progressCallback }); - } - /** - * Returns a [JSON Keystore Wallet](json-wallets) encryped with - * %%password%%. - * - * It is preferred to use the [async version](encrypt) instead, - * which allows a [[ProgressCallback]] to keep the user informed. - * - * This method will block the event loop (freezing all UI) until - * it is complete, which may be a non-trivial duration. - */ - encryptSync(password) { - return encryptKeystoreJsonSync(__privateMethod(this, _account, account_fn).call(this), password); - } - /** - * The extended key. - * - * This key will begin with the prefix ``xpriv`` and can be used to - * reconstruct this HD Node to derive its children. - */ - get extendedKey() { - assert(this.depth < 256, "Depth too deep", "UNSUPPORTED_OPERATION", { operation: "extendedKey" }); - return encodeBase58Check(concat([ - "0x0488ADE4", - zpad2(this.depth, 1), - this.parentFingerprint, - zpad2(this.index, 4), - this.chainCode, - concat(["0x00", this.privateKey]) - ])); - } - /** - * Returns true if this wallet has a path, providing a Type Guard - * that the path is non-null. - */ - hasPath() { - return this.path != null; - } - /** - * Returns a neutered HD Node, which removes the private details - * of an HD Node. - * - * A neutered node has no private key, but can be used to derive - * child addresses and other public data about the HD Node. - */ - neuter() { - return new HDNodeVoidWallet(_guard6, this.address, this.publicKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, this.provider); - } - /** - * Return the child for %%index%%. - */ - deriveChild(_index) { - const index = getNumber(_index, "index"); - assertArgument(index <= 4294967295, "invalid index", "index", index); - let path = this.path; - if (path) { - path += "/" + (index & ~HardenedBit); - if (index & HardenedBit) { - path += "'"; - } - } - const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, this.privateKey); - const ki = new SigningKey(toBeHex((toBigInt(IL) + BigInt(this.privateKey)) % N2, 32)); - return new _HDNodeWallet(_guard6, ki, this.fingerprint, hexlify(IR), path, index, this.depth + 1, this.mnemonic, this.provider); - } - /** - * Return the HDNode for %%path%% from this node. - */ - derivePath(path) { - return derivePath(this, path); - } - /** - * Creates a new HD Node from %%extendedKey%%. - * - * If the %%extendedKey%% will either have a prefix or ``xpub`` or - * ``xpriv``, returning a neutered HD Node ([[HDNodeVoidWallet]]) - * or full HD Node ([[HDNodeWallet) respectively. - */ - static fromExtendedKey(extendedKey) { - const bytes2 = toBeArray(decodeBase58(extendedKey)); - assertArgument(bytes2.length === 82 || encodeBase58Check(bytes2.slice(0, 78)) === extendedKey, "invalid extended key", "extendedKey", "[ REDACTED ]"); - const depth = bytes2[4]; - const parentFingerprint = hexlify(bytes2.slice(5, 9)); - const index = parseInt(hexlify(bytes2.slice(9, 13)).substring(2), 16); - const chainCode = hexlify(bytes2.slice(13, 45)); - const key = bytes2.slice(45, 78); - switch (hexlify(bytes2.slice(0, 4))) { - case "0x0488b21e": - case "0x043587cf": { - const publicKey = hexlify(key); - return new HDNodeVoidWallet(_guard6, computeAddress(publicKey), publicKey, parentFingerprint, chainCode, null, index, depth, null); - } - case "0x0488ade4": - case "0x04358394 ": - if (key[0] !== 0) { - break; - } - return new _HDNodeWallet(_guard6, new SigningKey(key.slice(1)), parentFingerprint, chainCode, null, index, depth, null, null); - } - assertArgument(false, "invalid extended key prefix", "extendedKey", "[ REDACTED ]"); - } - /** - * Creates a new random HDNode. - */ - static createRandom(password, path, wordlist2) { - var _a2; - if (password == null) { - password = ""; - } - if (path == null) { - path = defaultPath2; - } - if (wordlist2 == null) { - wordlist2 = LangEn.wordlist(); - } - const mnemonic = Mnemonic.fromEntropy(randomBytes3(16), password, wordlist2); - return __privateMethod(_a2 = _HDNodeWallet, _fromSeed, fromSeed_fn).call(_a2, mnemonic.computeSeed(), mnemonic).derivePath(path); - } - /** - * Create an HD Node from %%mnemonic%%. - */ - static fromMnemonic(mnemonic, path) { - var _a2; - if (!path) { - path = defaultPath2; - } - return __privateMethod(_a2 = _HDNodeWallet, _fromSeed, fromSeed_fn).call(_a2, mnemonic.computeSeed(), mnemonic).derivePath(path); - } - /** - * Creates an HD Node from a mnemonic %%phrase%%. - */ - static fromPhrase(phrase, password, path, wordlist2) { - var _a2; - if (password == null) { - password = ""; - } - if (path == null) { - path = defaultPath2; - } - if (wordlist2 == null) { - wordlist2 = LangEn.wordlist(); - } - const mnemonic = Mnemonic.fromPhrase(phrase, password, wordlist2); - return __privateMethod(_a2 = _HDNodeWallet, _fromSeed, fromSeed_fn).call(_a2, mnemonic.computeSeed(), mnemonic).derivePath(path); - } - /** - * Creates an HD Node from a %%seed%%. - */ - static fromSeed(seed) { - var _a2; - return __privateMethod(_a2 = _HDNodeWallet, _fromSeed, fromSeed_fn).call(_a2, seed, null); - } -}; -_account = new WeakSet(); -account_fn = function() { - const account = { address: this.address, privateKey: this.privateKey }; - const m = this.mnemonic; - if (this.path && m && m.wordlist.locale === "en" && m.password === "") { - account.mnemonic = { - path: this.path, - locale: "en", - entropy: m.entropy - }; - } - return account; -}; -_fromSeed = new WeakSet(); -fromSeed_fn = function(_seed, mnemonic) { - assertArgument(isBytesLike(_seed), "invalid seed", "seed", "[REDACTED]"); - const seed = getBytes(_seed, "seed"); - assertArgument(seed.length >= 16 && seed.length <= 64, "invalid seed", "seed", "[REDACTED]"); - const I = getBytes(computeHmac("sha512", MasterSecret, seed)); - const signingKey = new SigningKey(hexlify(I.slice(0, 32))); - return new _HDNodeWallet(_guard6, signingKey, "0x00000000", hexlify(I.slice(32)), "m", 0, 0, mnemonic, null); -}; -__privateAdd(_HDNodeWallet, _fromSeed); -var HDNodeWallet = _HDNodeWallet; -var HDNodeVoidWallet = class _HDNodeVoidWallet extends VoidSigner { - /** - * @private - */ - constructor(guard, address, publicKey, parentFingerprint, chainCode, path, index, depth, provider) { - super(address, provider); - /** - * The compressed public key. - */ - __publicField(this, "publicKey"); - /** - * The fingerprint. - * - * A fingerprint allows quick qay to detect parent and child nodes, - * but developers should be prepared to deal with collisions as it - * is only 4 bytes. - */ - __publicField(this, "fingerprint"); - /** - * The parent node fingerprint. - */ - __publicField(this, "parentFingerprint"); - /** - * The chaincode, which is effectively a public key used - * to derive children. - */ - __publicField(this, "chainCode"); - /** - * The derivation path of this wallet. - * - * Since extended keys do not provider full path details, this - * may be ``null``, if instantiated from a source that does not - * enocde it. - */ - __publicField(this, "path"); - /** - * The child index of this wallet. Values over ``2 *\* 31`` indicate - * the node is hardened. - */ - __publicField(this, "index"); - /** - * The depth of this wallet, which is the number of components - * in its path. - */ - __publicField(this, "depth"); - assertPrivate(guard, _guard6, "HDNodeVoidWallet"); - defineProperties(this, { publicKey }); - const fingerprint = dataSlice(ripemd1602(sha2562(publicKey)), 0, 4); - defineProperties(this, { - publicKey, - fingerprint, - parentFingerprint, - chainCode, - path, - index, - depth - }); - } - connect(provider) { - return new _HDNodeVoidWallet(_guard6, this.address, this.publicKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, provider); - } - /** - * The extended key. - * - * This key will begin with the prefix ``xpub`` and can be used to - * reconstruct this neutered key to derive its children addresses. - */ - get extendedKey() { - assert(this.depth < 256, "Depth too deep", "UNSUPPORTED_OPERATION", { operation: "extendedKey" }); - return encodeBase58Check(concat([ - "0x0488B21E", - zpad2(this.depth, 1), - this.parentFingerprint, - zpad2(this.index, 4), - this.chainCode, - this.publicKey - ])); - } - /** - * Returns true if this wallet has a path, providing a Type Guard - * that the path is non-null. - */ - hasPath() { - return this.path != null; - } - /** - * Return the child for %%index%%. - */ - deriveChild(_index) { - const index = getNumber(_index, "index"); - assertArgument(index <= 4294967295, "invalid index", "index", index); - let path = this.path; - if (path) { - path += "/" + (index & ~HardenedBit); - if (index & HardenedBit) { - path += "'"; - } - } - const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, null); - const Ki = SigningKey.addPoints(IL, this.publicKey, true); - const address = computeAddress(Ki); - return new _HDNodeVoidWallet(_guard6, address, Ki, this.fingerprint, hexlify(IR), path, index, this.depth + 1, this.provider); - } - /** - * Return the signer for %%path%% from this node. - */ - derivePath(path) { - return derivePath(this, path); - } -}; -function getAccountPath(_index) { - const index = getNumber(_index, "index"); - assertArgument(index >= 0 && index < HardenedBit, "invalid account index", "index", index); - return `m/44'/60'/${index}'/0/0`; -} -function getIndexedAccountPath(_index) { - const index = getNumber(_index, "index"); - assertArgument(index >= 0 && index < HardenedBit, "invalid account index", "index", index); - return `m/44'/60'/0'/0/${index}`; -} - -// node_modules/ethers/lib.esm/wallet/json-crowdsale.js -function isCrowdsaleJson(json) { - try { - const data = JSON.parse(json); - if (data.encseed) { - return true; - } - } catch (error) { - } - return false; -} -function decryptCrowdsaleJson(json, _password) { - const data = JSON.parse(json); - const password = getPassword(_password); - const address = getAddress(spelunk(data, "ethaddr:string!")); - const encseed = looseArrayify(spelunk(data, "encseed:string!")); - assertArgument(encseed && encseed.length % 16 === 0, "invalid encseed", "json", json); - const key = getBytes(pbkdf22(password, password, 2e3, 32, "sha256")).slice(0, 16); - const iv = encseed.slice(0, 16); - const encryptedSeed = encseed.slice(16); - const aesCbc = new CBC(key, iv); - const seed = pkcs7Strip(getBytes(aesCbc.decrypt(encryptedSeed))); - let seedHex = ""; - for (let i = 0; i < seed.length; i++) { - seedHex += String.fromCharCode(seed[i]); - } - return { address, privateKey: id(seedHex) }; -} - -// node_modules/ethers/lib.esm/wallet/wallet.js -function stall4(duration) { - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, duration); - }); -} -var _fromAccount, fromAccount_fn; -var _Wallet = class _Wallet extends BaseWallet { - /** - * Create a new wallet for the private %%key%%, optionally connected - * to %%provider%%. - */ - constructor(key, provider) { - if (typeof key === "string" && !key.startsWith("0x")) { - key = "0x" + key; - } - let signingKey = typeof key === "string" ? new SigningKey(key) : key; - super(signingKey, provider); - } - connect(provider) { - return new _Wallet(this.signingKey, provider); - } - /** - * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with - * %%password%%. - * - * If %%progressCallback%% is specified, it will receive periodic - * updates as the encryption process progreses. - */ - async encrypt(password, progressCallback) { - const account = { address: this.address, privateKey: this.privateKey }; - return await encryptKeystoreJson(account, password, { progressCallback }); - } - /** - * Returns a [JSON Keystore Wallet](json-wallets) encryped with - * %%password%%. - * - * It is preferred to use the [async version](encrypt) instead, - * which allows a [[ProgressCallback]] to keep the user informed. - * - * This method will block the event loop (freezing all UI) until - * it is complete, which may be a non-trivial duration. - */ - encryptSync(password) { - const account = { address: this.address, privateKey: this.privateKey }; - return encryptKeystoreJsonSync(account, password); - } - /** - * Creates (asynchronously) a **Wallet** by decrypting the %%json%% - * with %%password%%. - * - * If %%progress%% is provided, it is called periodically during - * decryption so that any UI can be updated. - */ - static async fromEncryptedJson(json, password, progress) { - var _a2; - let account = null; - if (isKeystoreJson(json)) { - account = await decryptKeystoreJson(json, password, progress); - } else if (isCrowdsaleJson(json)) { - if (progress) { - progress(0); - await stall4(0); - } - account = decryptCrowdsaleJson(json, password); - if (progress) { - progress(1); - await stall4(0); - } - } - return __privateMethod(_a2 = _Wallet, _fromAccount, fromAccount_fn).call(_a2, account); - } - /** - * Creates a **Wallet** by decrypting the %%json%% with %%password%%. - * - * The [[fromEncryptedJson]] method is preferred, as this method - * will lock up and freeze the UI during decryption, which may take - * some time. - */ - static fromEncryptedJsonSync(json, password) { - var _a2; - let account = null; - if (isKeystoreJson(json)) { - account = decryptKeystoreJsonSync(json, password); - } else if (isCrowdsaleJson(json)) { - account = decryptCrowdsaleJson(json, password); - } else { - assertArgument(false, "invalid JSON wallet", "json", "[ REDACTED ]"); - } - return __privateMethod(_a2 = _Wallet, _fromAccount, fromAccount_fn).call(_a2, account); - } - /** - * Creates a new random [[HDNodeWallet]] using the available - * [cryptographic random source](randomBytes). - * - * If there is no crytographic random source, this will throw. - */ - static createRandom(provider) { - const wallet = HDNodeWallet.createRandom(); - if (provider) { - return wallet.connect(provider); - } - return wallet; - } - /** - * Creates a [[HDNodeWallet]] for %%phrase%%. - */ - static fromPhrase(phrase, provider) { - const wallet = HDNodeWallet.fromPhrase(phrase); - if (provider) { - return wallet.connect(provider); - } - return wallet; - } -}; -_fromAccount = new WeakSet(); -fromAccount_fn = function(account) { - assertArgument(account, "invalid JSON wallet", "json", "[ REDACTED ]"); - if ("mnemonic" in account && account.mnemonic && account.mnemonic.locale === "en") { - const mnemonic = Mnemonic.fromEntropy(account.mnemonic.entropy); - const wallet2 = HDNodeWallet.fromMnemonic(mnemonic, account.mnemonic.path); - if (wallet2.address === account.address && wallet2.privateKey === account.privateKey) { - return wallet2; - } - console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key"); - } - const wallet = new _Wallet(account.privateKey); - assertArgument(wallet.address === account.address, "address/privateKey mismatch", "json", "[ REDACTED ]"); - return wallet; -}; -__privateAdd(_Wallet, _fromAccount); -var Wallet = _Wallet; - -// node_modules/ethers/lib.esm/wordlists/bit-reader.js -var Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; -function decodeBits(width, data) { - const maxValue2 = (1 << width) - 1; - const result = []; - let accum = 0, bits = 0, flood = 0; - for (let i = 0; i < data.length; i++) { - accum = accum << 6 | Base64.indexOf(data[i]); - bits += 6; - while (bits >= width) { - const value = accum >> bits - width; - accum &= (1 << bits - width) - 1; - bits -= width; - if (value === 0) { - flood += maxValue2; - } else { - result.push(value + flood); - flood = 0; - } - } - } - return result; -} - -// node_modules/ethers/lib.esm/wordlists/decode-owla.js -function decodeOwlA(data, accents) { - let words2 = decodeOwl(data).join(","); - accents.split(/,/g).forEach((accent) => { - const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/); - assertArgument(match !== null, "internal error parsing accents", "accents", accents); - let posOffset = 0; - const positions = decodeBits(parseInt(match[3]), match[4]); - const charCode = parseInt(match[2]); - const regex = new RegExp(`([${match[1]}])`, "g"); - words2 = words2.replace(regex, (all, letter) => { - const rem = --positions[posOffset]; - if (rem === 0) { - letter = String.fromCharCode(letter.charCodeAt(0), charCode); - posOffset++; - } - return letter; - }); - }); - return words2.split(","); -} - -// node_modules/ethers/lib.esm/wordlists/wordlist-owla.js -var _accent; -var WordlistOwlA = class extends WordlistOwl { - /** - * Creates a new Wordlist for %%locale%% using the OWLA %%data%% - * and %%accent%% data and validated against the %%checksum%%. - */ - constructor(locale, data, accent, checksum2) { - super(locale, data, checksum2); - __privateAdd(this, _accent, void 0); - __privateSet(this, _accent, accent); - } - /** - * The OWLA-encoded accent data. - */ - get _accent() { - return __privateGet(this, _accent); - } - /** - * Decode all the words for the wordlist. - */ - _decodeWords() { - return decodeOwlA(this._data, this._accent); - } -}; -_accent = new WeakMap(); - -// node_modules/ethers/lib.esm/wordlists/wordlists-browser.js -var wordlists = { - en: LangEn.wordlist() -}; -export { - AbiCoder, - AbstractProvider, - AbstractSigner, - AlchemyProvider, - AnkrProvider, - BaseContract, - BaseWallet, - Block, - BrowserProvider, - CloudflareProvider, - ConstructorFragment, - Contract, - ContractEventPayload, - ContractFactory, - ContractTransactionReceipt, - ContractTransactionResponse, - ContractUnknownEventPayload, - EnsPlugin, - EnsResolver, - ErrorDescription, - ErrorFragment, - EtherSymbol, - EtherscanPlugin, - EtherscanProvider, - EventFragment, - EventLog, - EventPayload, - FallbackFragment, - FallbackProvider, - FeeData, - FeeDataNetworkPlugin, - FetchCancelSignal, - FetchRequest, - FetchResponse, - FetchUrlFeeDataNetworkPlugin, - FixedNumber, - Fragment, - FunctionFragment, - GasCostPlugin, - HDNodeVoidWallet, - HDNodeWallet, - Indexed, - InfuraProvider, - InfuraWebSocketProvider, - Interface, - IpcSocketProvider, - JsonRpcApiProvider, - JsonRpcProvider, - JsonRpcSigner, - LangEn, - Log, - LogDescription, - MaxInt256, - MaxUint256, - MessagePrefix, - MinInt256, - Mnemonic, - MulticoinProviderPlugin, - N, - NamedFragment, - Network, - NetworkPlugin, - NonceManager, - ParamType, - PocketProvider, - QuickNodeProvider, - Result, - Signature, - SigningKey, - SocketBlockSubscriber, - SocketEventSubscriber, - SocketPendingSubscriber, - SocketProvider, - SocketSubscriber, - StructFragment, - Transaction, - TransactionDescription, - TransactionReceipt, - TransactionResponse, - Typed, - TypedDataEncoder, - UndecodedEventLog, - UnmanagedSubscriber, - Utf8ErrorFuncs, - VoidSigner, - Wallet, - WebSocketProvider, - WeiPerEther, - Wordlist, - WordlistOwl, - WordlistOwlA, - ZeroAddress, - ZeroHash, - accessListify, - assert, - assertArgument, - assertArgumentCount, - assertNormalize, - assertPrivate, - checkResultErrors, - computeAddress, - computeHmac, - concat, - copyRequest, - dataLength, - dataSlice, - decodeBase58, - decodeBase64, - decodeBytes32String, - decodeRlp, - decryptCrowdsaleJson, - decryptKeystoreJson, - decryptKeystoreJsonSync, - defaultPath2 as defaultPath, - defineProperties, - dnsEncode, - encodeBase58, - encodeBase64, - encodeBytes32String, - encodeRlp, - encryptKeystoreJson, - encryptKeystoreJsonSync, - ensNormalize, - ethers_exports as ethers, - formatEther, - formatUnits, - fromTwos, - getAccountPath, - getAddress, - getBigInt, - getBytes, - getBytesCopy, - getCreate2Address, - getCreateAddress, - getDefaultProvider, - getIcapAddress, - getIndexedAccountPath, - getNumber, - getUint, - hashMessage, - hexlify, - id, - isAddress, - isAddressable, - isBytesLike, - isCallException, - isCrowdsaleJson, - isError, - isHexString, - isKeystoreJson, - isValidName, - keccak256, - lock, - makeError, - mask, - namehash, - parseEther, - parseUnits, - pbkdf22 as pbkdf2, - randomBytes3 as randomBytes, - recoverAddress, - resolveAddress, - resolveProperties, - ripemd1602 as ripemd160, - scrypt2 as scrypt, - scryptSync, - sha2562 as sha256, - sha5122 as sha512, - showThrottleMessage, - solidityPacked, - solidityPackedKeccak256, - solidityPackedSha256, - stripZerosLeft, - toBeArray, - toBeHex, - toBigInt, - toNumber, - toQuantity, - toTwos, - toUtf8Bytes, - toUtf8CodePoints, - toUtf8String, - uuidV4, - verifyMessage, - verifyTypedData, - version, - wordlists, - zeroPadBytes, - zeroPadValue -}; -/*! Bundled license information: - -@noble/hashes/esm/utils.js: - (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *) - -@noble/curves/esm/abstract/utils.js: - (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) - -@noble/curves/esm/abstract/modular.js: - (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) - -@noble/curves/esm/abstract/curve.js: - (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) - -@noble/curves/esm/abstract/weierstrass.js: - (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) - -@noble/curves/esm/_shortw_utils.js: - (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) - -@noble/curves/esm/secp256k1.js: - (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) - -aes-js/lib.esm/aes.js: - (*! MIT License. Copyright 2015-2022 Richard Moore . See LICENSE.txt. *) -*/ -//# sourceMappingURL=ethers.js.map diff --git a/node_modules/.vite/deps/ethers.js.map b/node_modules/.vite/deps/ethers.js.map deleted file mode 100644 index 293eefba..00000000 --- a/node_modules/.vite/deps/ethers.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../../ethers/src.ts/ethers.ts", "../../ethers/src.ts/_version.ts", "../../ethers/src.ts/utils/properties.ts", "../../ethers/src.ts/utils/errors.ts", "../../ethers/src.ts/utils/data.ts", "../../ethers/src.ts/utils/maths.ts", "../../ethers/src.ts/utils/base58.ts", "../../ethers/src.ts/utils/base64-browser.ts", "../../ethers/src.ts/utils/events.ts", "../../ethers/src.ts/utils/utf8.ts", "../../ethers/src.ts/utils/geturl-browser.ts", "../../ethers/src.ts/utils/fetch.ts", "../../ethers/src.ts/utils/fixednumber.ts", "../../ethers/src.ts/utils/rlp-decode.ts", "../../ethers/src.ts/utils/rlp-encode.ts", "../../ethers/src.ts/utils/units.ts", "../../ethers/src.ts/utils/uuid.ts", "../../ethers/src.ts/abi/coders/abstract-coder.ts", "../../ethers/node_modules/@noble/hashes/src/_assert.ts", "../../ethers/node_modules/@noble/hashes/src/crypto.ts", "../../ethers/node_modules/@noble/hashes/src/utils.ts", "../../ethers/node_modules/@noble/hashes/src/hmac.ts", "../../ethers/node_modules/@noble/hashes/src/pbkdf2.ts", "../../ethers/node_modules/@noble/hashes/src/_sha2.ts", "../../ethers/node_modules/@noble/hashes/src/sha256.ts", "../../ethers/node_modules/@noble/hashes/src/_u64.ts", "../../ethers/node_modules/@noble/hashes/src/sha512.ts", "../../ethers/src.ts/crypto/crypto-browser.ts", "../../ethers/src.ts/crypto/hmac.ts", "../../ethers/node_modules/@noble/hashes/src/sha3.ts", "../../ethers/src.ts/crypto/keccak.ts", "../../ethers/node_modules/@noble/hashes/src/ripemd160.ts", "../../ethers/src.ts/crypto/ripemd160.ts", "../../ethers/src.ts/crypto/pbkdf2.ts", "../../ethers/src.ts/crypto/random.ts", "../../ethers/node_modules/@noble/hashes/src/scrypt.ts", "../../ethers/src.ts/crypto/scrypt.ts", "../../ethers/src.ts/crypto/sha2.ts", "../../ethers/node_modules/@noble/curves/src/abstract/utils.ts", "../../ethers/node_modules/@noble/curves/src/abstract/modular.ts", "../../ethers/node_modules/@noble/curves/src/abstract/curve.ts", "../../ethers/node_modules/@noble/curves/src/abstract/weierstrass.ts", "../../ethers/node_modules/@noble/curves/src/abstract/hash-to-curve.ts", "../../ethers/node_modules/@noble/curves/src/_shortw_utils.ts", "../../ethers/node_modules/@noble/curves/src/secp256k1.ts", "../../ethers/src.ts/constants/addresses.ts", "../../ethers/src.ts/constants/hashes.ts", "../../ethers/src.ts/constants/numbers.ts", "../../ethers/src.ts/constants/strings.ts", "../../ethers/src.ts/crypto/signature.ts", "../../ethers/src.ts/crypto/signing-key.ts", "../../ethers/src.ts/crypto/index.ts", "../../ethers/src.ts/address/address.ts", "../../ethers/src.ts/address/contract-address.ts", "../../ethers/src.ts/address/checks.ts", "../../ethers/src.ts/abi/typed.ts", "../../ethers/src.ts/abi/coders/address.ts", "../../ethers/src.ts/abi/coders/anonymous.ts", "../../ethers/src.ts/abi/coders/array.ts", "../../ethers/src.ts/abi/coders/boolean.ts", "../../ethers/src.ts/abi/coders/bytes.ts", "../../ethers/src.ts/abi/coders/fixed-bytes.ts", "../../ethers/src.ts/abi/coders/null.ts", "../../ethers/src.ts/abi/coders/number.ts", "../../ethers/src.ts/abi/coders/string.ts", "../../ethers/src.ts/abi/coders/tuple.ts", "../../ethers/src.ts/hash/id.ts", "../../ethers/src.ts/hash/namehash.ts", "../../ethers/src.ts/transaction/accesslist.ts", "../../ethers/src.ts/transaction/address.ts", "../../ethers/src.ts/transaction/transaction.ts", "../../ethers/src.ts/hash/message.ts", "../../ethers/src.ts/hash/solidity.ts", "../../ethers/src.ts/hash/typed-data.ts", "../../ethers/src.ts/abi/fragments.ts", "../../ethers/src.ts/abi/abi-coder.ts", "../../ethers/src.ts/abi/bytes32.ts", "../../ethers/src.ts/abi/interface.ts", "../../ethers/src.ts/providers/provider.ts", "../../ethers/src.ts/contract/wrappers.ts", "../../ethers/src.ts/contract/contract.ts", "../../ethers/src.ts/contract/factory.ts", "../../ethers/src.ts/providers/ens-resolver.ts", "../../ethers/src.ts/providers/format.ts", "../../ethers/src.ts/providers/plugins-network.ts", "../../ethers/src.ts/providers/network.ts", "../../ethers/src.ts/providers/subscriber-polling.ts", "../../ethers/src.ts/providers/abstract-provider.ts", "../../ethers/src.ts/providers/abstract-signer.ts", "../../ethers/src.ts/providers/community.ts", "../../ethers/src.ts/providers/subscriber-filterid.ts", "../../ethers/src.ts/providers/provider-jsonrpc.ts", "../../ethers/src.ts/providers/provider-ankr.ts", "../../ethers/src.ts/providers/provider-alchemy.ts", "../../ethers/src.ts/providers/provider-cloudflare.ts", "../../ethers/src.ts/providers/provider-etherscan.ts", "../../ethers/src.ts/providers/ws-browser.ts", "../../ethers/src.ts/providers/provider-socket.ts", "../../ethers/src.ts/providers/provider-websocket.ts", "../../ethers/src.ts/providers/provider-infura.ts", "../../ethers/src.ts/providers/provider-quicknode.ts", "../../ethers/src.ts/providers/provider-fallback.ts", "../../ethers/src.ts/providers/default-provider.ts", "../../ethers/src.ts/providers/signer-noncemanager.ts", "../../ethers/src.ts/providers/provider-browser.ts", "../../ethers/src.ts/providers/provider-pocket.ts", "../../ethers/src.ts/providers/provider-ipcsocket-browser.ts", "../../ethers/src.ts/wallet/base-wallet.ts", "../../ethers/src.ts/wordlists/decode-owl.ts", "../../ethers/src.ts/wordlists/wordlist.ts", "../../ethers/src.ts/wordlists/wordlist-owl.ts", "../../ethers/src.ts/wordlists/lang-en.ts", "../../ethers/src.ts/wallet/mnemonic.ts", "../../aes-js/src.ts/aes.ts", "../../aes-js/src.ts/mode.ts", "../../aes-js/src.ts/mode-cbc.ts", "../../aes-js/src.ts/mode-cfb.ts", "../../aes-js/src.ts/mode-ctr.ts", "../../aes-js/src.ts/padding.ts", "../../ethers/src.ts/wallet/utils.ts", "../../ethers/src.ts/wallet/json-keystore.ts", "../../ethers/src.ts/wallet/hdwallet.ts", "../../ethers/src.ts/wallet/json-crowdsale.ts", "../../ethers/src.ts/wallet/wallet.ts", "../../ethers/src.ts/wordlists/bit-reader.ts", "../../ethers/src.ts/wordlists/decode-owla.ts", "../../ethers/src.ts/wordlists/wordlist-owla.ts", "../../ethers/src.ts/wordlists/wordlists-browser.ts"], - "sourcesContent": ["\n\n/////////////////////////////\n//\n\nexport { version } from \"./_version.js\";\n\nexport {\n decodeBytes32String, encodeBytes32String,\n\n AbiCoder,\n ConstructorFragment, ErrorFragment, EventFragment, Fragment, FallbackFragment, FunctionFragment, NamedFragment, ParamType, StructFragment,\n\n checkResultErrors, ErrorDescription, Indexed, Interface, LogDescription, Result, TransactionDescription,\n Typed,\n} from \"./abi/index.js\";\n\nexport {\n getAddress, getIcapAddress,\n getCreateAddress, getCreate2Address,\n isAddressable, isAddress, resolveAddress\n} from \"./address/index.js\";\n\nexport {\n ZeroAddress,\n WeiPerEther, MaxUint256, MinInt256, MaxInt256, N,\n ZeroHash,\n EtherSymbol, MessagePrefix\n} from \"./constants/index.js\";\n\nexport {\n BaseContract, Contract,\n ContractFactory,\n ContractEventPayload, ContractTransactionReceipt, ContractTransactionResponse, ContractUnknownEventPayload, EventLog, UndecodedEventLog\n} from \"./contract/index.js\";\n\nexport {\n computeHmac,\n randomBytes,\n keccak256,\n ripemd160,\n sha256, sha512,\n pbkdf2,\n scrypt, scryptSync,\n lock,\n Signature, SigningKey\n} from \"./crypto/index.js\";\n\nexport {\n id,\n ensNormalize, isValidName, namehash, dnsEncode,\n hashMessage, verifyMessage,\n solidityPacked, solidityPackedKeccak256, solidityPackedSha256,\n TypedDataEncoder,\n verifyTypedData\n} from \"./hash/index.js\";\n\nexport {\n getDefaultProvider,\n\n Block, FeeData, Log, TransactionReceipt, TransactionResponse,\n\n AbstractSigner, NonceManager, VoidSigner,\n\n AbstractProvider,\n\n FallbackProvider,\n JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner,\n\n BrowserProvider,\n\n AlchemyProvider, AnkrProvider, CloudflareProvider, EtherscanProvider,\n InfuraProvider, InfuraWebSocketProvider, PocketProvider, QuickNodeProvider,\n\n IpcSocketProvider, SocketProvider, WebSocketProvider,\n\n EnsResolver,\n Network,\n\n EnsPlugin, EtherscanPlugin,\n FeeDataNetworkPlugin, FetchUrlFeeDataNetworkPlugin,\n GasCostPlugin, NetworkPlugin, MulticoinProviderPlugin,\n\n SocketBlockSubscriber, SocketEventSubscriber, SocketPendingSubscriber,\n SocketSubscriber, UnmanagedSubscriber,\n\n copyRequest, showThrottleMessage\n} from \"./providers/index.js\";\n\nexport {\n accessListify,\n computeAddress, recoverAddress,\n Transaction\n} from \"./transaction/index.js\";\n\nexport {\n decodeBase58, encodeBase58,\n decodeBase64, encodeBase64,\n concat, dataLength, dataSlice, getBytes, getBytesCopy, hexlify,\n isHexString, isBytesLike, stripZerosLeft, zeroPadBytes, zeroPadValue,\n defineProperties, resolveProperties,\n assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate,\n makeError,\n isCallException, isError,\n EventPayload,\n FetchRequest, FetchResponse, FetchCancelSignal,\n FixedNumber,\n getBigInt, getNumber, getUint, toBeArray, toBigInt, toBeHex, toNumber, toQuantity,\n fromTwos, toTwos, mask,\n formatEther, parseEther, formatUnits, parseUnits,\n toUtf8Bytes, toUtf8CodePoints, toUtf8String,\n Utf8ErrorFuncs,\n decodeRlp, encodeRlp,\n uuidV4,\n} from \"./utils/index.js\";\n\nexport {\n Mnemonic,\n BaseWallet, HDNodeWallet, HDNodeVoidWallet,\n Wallet,\n\n defaultPath,\n\n getAccountPath, getIndexedAccountPath,\n isCrowdsaleJson, isKeystoreJson,\n\n decryptCrowdsaleJson, decryptKeystoreJsonSync, decryptKeystoreJson,\n encryptKeystoreJson, encryptKeystoreJsonSync,\n} from \"./wallet/index.js\";\n\nexport {\n Wordlist, LangEn, WordlistOwl, WordlistOwlA, wordlists\n} from \"./wordlists/index.js\";\n\n\n\n/////////////////////////////\n// Types\n\nexport type {\n JsonFragment, JsonFragmentType,\n FormatType, FragmentType,\n InterfaceAbi,\n ParamTypeWalkFunc, ParamTypeWalkAsyncFunc\n} from \"./abi/index.js\";\n\nexport type {\n Addressable, AddressLike, NameResolver\n} from \"./address/index.js\";\n\nexport type {\n ConstantContractMethod, ContractEvent, ContractEventArgs, ContractEventName,\n ContractInterface, ContractMethod, ContractMethodArgs, ContractTransaction,\n DeferredTopicFilter, Overrides,\n BaseContractMethod, ContractDeployTransaction, PostfixOverrides,\n WrappedFallback\n} from \"./contract/index.js\";\n\nexport type { ProgressCallback, SignatureLike } from \"./crypto/index.js\";\n\nexport type { TypedDataDomain, TypedDataField } from \"./hash/index.js\";\n\nexport type {\n Provider, Signer,\n\n AbstractProviderOptions, FallbackProviderOptions,\n\n AbstractProviderPlugin, BlockParams, BlockTag, ContractRunner, DebugEventBrowserProvider,\n Eip1193Provider, EventFilter, Filter, FilterByBlockHash, GasCostParameters,\n JsonRpcApiProviderOptions, JsonRpcError, JsonRpcPayload, JsonRpcResult,\n JsonRpcTransactionRequest, LogParams, MinedBlock, MinedTransactionResponse, Networkish,\n OrphanFilter, PerformActionFilter, PerformActionRequest, PerformActionTransaction,\n PreparedTransactionRequest, ProviderEvent, Subscriber, Subscription, TopicFilter,\n TransactionReceiptParams, TransactionRequest, TransactionResponseParams,\n WebSocketCreator, WebSocketLike\n} from \"./providers/index.js\";\n\nexport type {\n AccessList, AccessListish, AccessListEntry,\n TransactionLike\n} from \"./transaction/index.js\";\n\nexport type {\n BytesLike,\n BigNumberish, Numeric,\n ErrorCode,\n FixedFormat,\n Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason,\n RlpStructuredData, RlpStructuredDataish,\n\n GetUrlResponse,\n FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc,\n FetchGatewayFunc, FetchGetUrlFunc,\n\n EthersError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError,\n ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError,\n NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError,\n CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError,\n ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError,\n ActionRejectedError,\n CodedEthersError,\n\n CallExceptionAction, CallExceptionTransaction,\n EventEmitterable, Listener\n} from \"./utils/index.js\";\n\nexport type {\n CrowdsaleAccount, KeystoreAccount, EncryptOptions\n} from \"./wallet/index.js\";\n\n", "/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */\n\n/**\n * The current version of Ethers.\n */\nexport const version: string = \"6.11.1\";\n", "/**\n * Property helper functions.\n *\n * @_subsection api/utils:Properties [about-properties]\n */\n\nfunction checkType(value: any, type: string, name: string): void {\n const types = type.split(\"|\").map(t => t.trim());\n for (let i = 0; i < types.length; i++) {\n switch (type) {\n case \"any\":\n return;\n case \"bigint\":\n case \"boolean\":\n case \"number\":\n case \"string\":\n if (typeof(value) === type) { return; }\n }\n }\n\n const error: any = new Error(`invalid value for type ${ type }`);\n error.code = \"INVALID_ARGUMENT\";\n error.argument = `value.${ name }`;\n error.value = value;\n\n throw error;\n}\n\n/**\n * Resolves to a new object that is a copy of %%value%%, but with all\n * values resolved.\n */\nexport async function resolveProperties(value: { [ P in keyof T ]: T[P] | Promise}): Promise {\n const keys = Object.keys(value);\n const results = await Promise.all(keys.map((k) => Promise.resolve(value[k])));\n return results.reduce((accum: any, v, index) => {\n accum[keys[index]] = v;\n return accum;\n }, <{ [ P in keyof T]: T[P] }>{ });\n}\n\n/**\n * Assigns the %%values%% to %%target%% as read-only values.\n *\n * It %%types%% is specified, the values are checked.\n */\nexport function defineProperties(\n target: T,\n values: { [ K in keyof T ]?: T[K] },\n types?: { [ K in keyof T ]?: string }): void {\n\n for (let key in values) {\n let value = values[key];\n\n const type = (types ? types[key]: null);\n if (type) { checkType(value, type, key); }\n\n Object.defineProperty(target, key, { enumerable: true, value, writable: false });\n }\n}\n", "/**\n * All errors in ethers include properties to ensure they are both\n * human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``).\n *\n * The [[isError]] function can be used to check the error ``code`` and\n * provide a type guard for the properties present on that error interface.\n *\n * @_section: api/utils/errors:Errors [about-errors]\n */\n\nimport { version } from \"../_version.js\";\n\nimport { defineProperties } from \"./properties.js\";\n\nimport type {\n TransactionRequest, TransactionReceipt, TransactionResponse\n} from \"../providers/index.js\";\n\nimport type { FetchRequest, FetchResponse } from \"./fetch.js\";\n\n/**\n * An error may contain additional properties, but those must not\n * conflict with any implicit properties.\n */\nexport type ErrorInfo = Omit & { shortMessage?: string };\n\n\nfunction stringify(value: any): any {\n if (value == null) { return \"null\"; }\n\n if (Array.isArray(value)) {\n return \"[ \" + (value.map(stringify)).join(\", \") + \" ]\";\n }\n\n if (value instanceof Uint8Array) {\n const HEX = \"0123456789abcdef\";\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n result += HEX[value[i] >> 4];\n result += HEX[value[i] & 0xf];\n }\n return result;\n }\n\n if (typeof(value) === \"object\" && typeof(value.toJSON) === \"function\") {\n return stringify(value.toJSON());\n }\n\n switch (typeof(value)) {\n case \"boolean\": case \"symbol\":\n return value.toString();\n case \"bigint\":\n return BigInt(value).toString();\n case \"number\":\n return (value).toString();\n case \"string\":\n return JSON.stringify(value);\n case \"object\": {\n const keys = Object.keys(value);\n keys.sort();\n return \"{ \" + keys.map((k) => `${ stringify(k) }: ${ stringify(value[k]) }`).join(\", \") + \" }\";\n }\n }\n\n return `[ COULD NOT SERIALIZE ]`;\n}\n\n/**\n * All errors emitted by ethers have an **ErrorCode** to help\n * identify and coalesce errors to simplify programmatic analysis.\n *\n * Each **ErrorCode** is the %%code%% proerty of a coresponding\n * [[EthersError]].\n *\n * **Generic Errors**\n *\n * **``\"UNKNOWN_ERROR\"``** - see [[UnknownError]]\n *\n * **``\"NOT_IMPLEMENTED\"``** - see [[NotImplementedError]]\n *\n * **``\"UNSUPPORTED_OPERATION\"``** - see [[UnsupportedOperationError]]\n *\n * **``\"NETWORK_ERROR\"``** - see [[NetworkError]]\n *\n * **``\"SERVER_ERROR\"``** - see [[ServerError]]\n *\n * **``\"TIMEOUT\"``** - see [[TimeoutError]]\n *\n * **``\"BAD_DATA\"``** - see [[BadDataError]]\n *\n * **``\"CANCELLED\"``** - see [[CancelledError]]\n *\n * **Operational Errors**\n *\n * **``\"BUFFER_OVERRUN\"``** - see [[BufferOverrunError]]\n *\n * **``\"NUMERIC_FAULT\"``** - see [[NumericFaultError]]\n *\n * **Argument Errors**\n *\n * **``\"INVALID_ARGUMENT\"``** - see [[InvalidArgumentError]]\n *\n * **``\"MISSING_ARGUMENT\"``** - see [[MissingArgumentError]]\n *\n * **``\"UNEXPECTED_ARGUMENT\"``** - see [[UnexpectedArgumentError]]\n *\n * **``\"VALUE_MISMATCH\"``** - //unused//\n *\n * **Blockchain Errors**\n *\n * **``\"CALL_EXCEPTION\"``** - see [[CallExceptionError]]\n *\n * **``\"INSUFFICIENT_FUNDS\"``** - see [[InsufficientFundsError]]\n *\n * **``\"NONCE_EXPIRED\"``** - see [[NonceExpiredError]]\n *\n * **``\"REPLACEMENT_UNDERPRICED\"``** - see [[ReplacementUnderpricedError]]\n *\n * **``\"TRANSACTION_REPLACED\"``** - see [[TransactionReplacedError]]\n *\n * **``\"UNCONFIGURED_NAME\"``** - see [[UnconfiguredNameError]]\n *\n * **``\"OFFCHAIN_FAULT\"``** - see [[OffchainFaultError]]\n *\n * **User Interaction Errors**\n *\n * **``\"ACTION_REJECTED\"``** - see [[ActionRejectedError]]\n */\nexport type ErrorCode =\n\n // Generic Errors\n \"UNKNOWN_ERROR\" | \"NOT_IMPLEMENTED\" | \"UNSUPPORTED_OPERATION\" |\n \"NETWORK_ERROR\" | \"SERVER_ERROR\" | \"TIMEOUT\" | \"BAD_DATA\" |\n \"CANCELLED\" |\n\n // Operational Errors\n \"BUFFER_OVERRUN\" | \"NUMERIC_FAULT\" |\n\n // Argument Errors\n \"INVALID_ARGUMENT\" | \"MISSING_ARGUMENT\" | \"UNEXPECTED_ARGUMENT\" |\n \"VALUE_MISMATCH\" |\n\n // Blockchain Errors\n \"CALL_EXCEPTION\" | \"INSUFFICIENT_FUNDS\" | \"NONCE_EXPIRED\" |\n \"REPLACEMENT_UNDERPRICED\" | \"TRANSACTION_REPLACED\" |\n \"UNCONFIGURED_NAME\" | \"OFFCHAIN_FAULT\" |\n\n // User Interaction\n \"ACTION_REJECTED\"\n;\n\n/**\n * All errors in Ethers include properties to assist in\n * machine-readable errors.\n */\nexport interface EthersError extends Error {\n /**\n * The string error code.\n */\n code: ErrorCode;\n\n /**\n * A short message describing the error, with minimal additional\n * details.\n */\n shortMessage: string;\n\n /**\n * Additional info regarding the error that may be useful.\n *\n * This is generally helpful mostly for human-based debugging.\n */\n info?: Record;\n\n /**\n * Any related error.\n */\n error?: Error;\n}\n\n// Generic Errors\n\n/**\n * This Error is a catch-all for when there is no way for Ethers to\n * know what the underlying problem is.\n */\nexport interface UnknownError extends EthersError<\"UNKNOWN_ERROR\"> {\n [ key: string ]: any;\n}\n\n/**\n * This Error is mostly used as a stub for functionality that is\n * intended for the future, but is currently not implemented.\n */\nexport interface NotImplementedError extends EthersError<\"NOT_IMPLEMENTED\"> {\n /**\n * The attempted operation.\n */\n operation: string;\n}\n\n/**\n * This Error indicates that the attempted operation is not supported.\n *\n * This could range from a specific JSON-RPC end-point not supporting\n * a feature to a specific configuration of an object prohibiting the\n * operation.\n *\n * For example, a [[Wallet]] with no connected [[Provider]] is unable\n * to send a transaction.\n */\nexport interface UnsupportedOperationError extends EthersError<\"UNSUPPORTED_OPERATION\"> {\n /**\n * The attempted operation.\n */\n operation: string;\n}\n\n/**\n * This Error indicates a problem connecting to a network.\n */\nexport interface NetworkError extends EthersError<\"NETWORK_ERROR\"> {\n /**\n * The network event.\n */\n event: string;\n}\n\n/**\n * This Error indicates there was a problem fetching a resource from\n * a server.\n */\nexport interface ServerError extends EthersError<\"SERVER_ERROR\"> {\n /**\n * The requested resource.\n */\n request: FetchRequest | string;\n\n /**\n * The response received from the server, if available.\n */\n response?: FetchResponse;\n}\n\n/**\n * This Error indicates that the timeout duration has expired and\n * that the operation has been implicitly cancelled.\n *\n * The side-effect of the operation may still occur, as this\n * generally means a request has been sent and there has simply\n * been no response to indicate whether it was processed or not.\n */\nexport interface TimeoutError extends EthersError<\"TIMEOUT\"> {\n /**\n * The attempted operation.\n */\n operation: string;\n\n /**\n * The reason.\n */\n reason: string;\n\n /**\n * The resource request, if available.\n */\n request?: FetchRequest;\n}\n\n/**\n * This Error indicates that a provided set of data cannot\n * be correctly interpreted.\n */\nexport interface BadDataError extends EthersError<\"BAD_DATA\"> {\n /**\n * The data.\n */\n value: any;\n}\n\n/**\n * This Error indicates that the operation was cancelled by a\n * programmatic call, for example to ``cancel()``.\n */\nexport interface CancelledError extends EthersError<\"CANCELLED\"> {\n}\n\n\n// Operational Errors\n\n/**\n * This Error indicates an attempt was made to read outside the bounds\n * of protected data.\n *\n * Most operations in Ethers are protected by bounds checks, to mitigate\n * exploits when parsing data.\n */\nexport interface BufferOverrunError extends EthersError<\"BUFFER_OVERRUN\"> {\n /**\n * The buffer that was overrun.\n */\n buffer: Uint8Array;\n\n /**\n * The length of the buffer.\n */\n length: number;\n\n /**\n * The offset that was requested.\n */\n offset: number;\n}\n\n/**\n * This Error indicates an operation which would result in incorrect\n * arithmetic output has occurred.\n *\n * For example, trying to divide by zero or using a ``uint8`` to store\n * a negative value.\n */\nexport interface NumericFaultError extends EthersError<\"NUMERIC_FAULT\"> {\n /**\n * The attempted operation.\n */\n operation: string;\n\n /**\n * The fault reported.\n */\n fault: string;\n\n /**\n * The value the operation was attempted against.\n */\n value: any;\n}\n\n\n// Argument Errors\n\n/**\n * This Error indicates an incorrect type or value was passed to\n * a function or method.\n */\nexport interface InvalidArgumentError extends EthersError<\"INVALID_ARGUMENT\"> {\n /**\n * The name of the argument.\n */\n argument: string;\n\n /**\n * The value that was provided.\n */\n value: any;\n\n info?: Record\n}\n\n/**\n * This Error indicates there were too few arguments were provided.\n */\nexport interface MissingArgumentError extends EthersError<\"MISSING_ARGUMENT\"> {\n /**\n * The number of arguments received.\n */\n count: number;\n\n /**\n * The number of arguments expected.\n */\n expectedCount: number;\n}\n\n/**\n * This Error indicates too many arguments were provided.\n */\nexport interface UnexpectedArgumentError extends EthersError<\"UNEXPECTED_ARGUMENT\"> {\n /**\n * The number of arguments received.\n */\n count: number;\n\n /**\n * The number of arguments expected.\n */\n expectedCount: number;\n}\n\n\n// Blockchain Errors\n\n/**\n * The action that resulted in the call exception.\n */\nexport type CallExceptionAction = \"call\" | \"estimateGas\" | \"getTransactionResult\" | \"sendTransaction\" | \"unknown\";\n\n/**\n * The related transaction that caused the error.\n */\nexport type CallExceptionTransaction = {\n to: null | string;\n from?: string;\n data: string;\n};\n\n/**\n * This **Error** indicates a transaction reverted.\n */\nexport interface CallExceptionError extends EthersError<\"CALL_EXCEPTION\"> {\n\n /**\n * The action being performed when the revert was encountered.\n */\n action: CallExceptionAction;\n\n /**\n * The revert data returned.\n */\n data: null | string;\n\n /**\n * A human-readable representation of data, if possible.\n */\n reason: null | string;\n\n /**\n * The transaction that triggered the exception.\n */\n transaction: CallExceptionTransaction,\n\n /**\n * The contract invocation details, if available.\n */\n invocation: null | {\n method: string;\n signature: string;\n args: Array;\n }\n\n /**\n * The built-in or custom revert error, if available\n */\n revert: null | {\n signature: string;\n name: string;\n args: Array;\n }\n\n /**\n * If the error occurred in a transaction that was mined\n * (with a status of ``0``), this is the receipt.\n */\n receipt?: TransactionReceipt; // @TODO: in v7, make this `null | TransactionReceipt`\n}\n\n\n/**\n * The sending account has insufficient funds to cover the\n * entire transaction cost.\n */\nexport interface InsufficientFundsError extends EthersError<\"INSUFFICIENT_FUNDS\"> {\n /**\n * The transaction.\n */\n transaction: TransactionRequest;\n}\n\n/**\n * The sending account has already used this nonce in a\n * transaction that has been included.\n */\nexport interface NonceExpiredError extends EthersError<\"NONCE_EXPIRED\"> {\n /**\n * The transaction.\n */\n transaction: TransactionRequest;\n}\n\n/**\n * A CCIP-read exception, which cannot be recovered from or\n * be further processed.\n */\nexport interface OffchainFaultError extends EthersError<\"OFFCHAIN_FAULT\"> {\n /**\n * The transaction.\n */\n transaction?: TransactionRequest;\n\n /**\n * The reason the CCIP-read failed.\n */\n reason: string;\n}\n\n/**\n * An attempt was made to replace a transaction, but with an\n * insufficient additional fee to afford evicting the old\n * transaction from the memory pool.\n */\nexport interface ReplacementUnderpricedError extends EthersError<\"REPLACEMENT_UNDERPRICED\"> {\n /**\n * The transaction.\n */\n transaction: TransactionRequest;\n}\n\n/**\n * A pending transaction was replaced by another.\n */\nexport interface TransactionReplacedError extends EthersError<\"TRANSACTION_REPLACED\"> {\n /**\n * If the transaction was cancelled, such that the original\n * effects of the transaction cannot be assured.\n */\n cancelled: boolean;\n\n /**\n * The reason the transaction was replaced.\n */\n reason: \"repriced\" | \"cancelled\" | \"replaced\";\n\n /**\n * The hash of the replaced transaction.\n */\n hash: string;\n\n /**\n * The transaction that replaced the transaction.\n */\n replacement: TransactionResponse;\n\n /**\n * The receipt of the transaction that replace the transaction.\n */\n receipt: TransactionReceipt;\n}\n\n/**\n * This Error indicates an ENS name was used, but the name has not\n * been configured.\n *\n * This could indicate an ENS name is unowned or that the current\n * address being pointed to is the [[ZeroAddress]].\n */\nexport interface UnconfiguredNameError extends EthersError<\"UNCONFIGURED_NAME\"> {\n /**\n * The ENS name that was requested\n */\n value: string;\n}\n\n/**\n * This Error indicates a request was rejected by the user.\n *\n * In most clients (such as MetaMask), when an operation requires user\n * authorization (such as ``signer.sendTransaction``), the client\n * presents a dialog box to the user. If the user denies the request\n * this error is thrown.\n */\nexport interface ActionRejectedError extends EthersError<\"ACTION_REJECTED\"> {\n /**\n * The requested action.\n */\n action: \"requestAccess\" | \"sendTransaction\" | \"signMessage\" | \"signTransaction\" | \"signTypedData\" | \"unknown\",\n\n /**\n * The reason the action was rejected.\n *\n * If there is already a pending request, some clients may indicate\n * there is already a ``\"pending\"`` action. This prevents an app\n * from spamming the user.\n */\n reason: \"expired\" | \"rejected\" | \"pending\"\n}\n\n// Coding; converts an ErrorCode its Typed Error\n\n/**\n * A conditional type that transforms the [[ErrorCode]] T into\n * its EthersError type.\n *\n * @flatworm-skip-docs\n */\nexport type CodedEthersError =\n T extends \"UNKNOWN_ERROR\" ? UnknownError:\n T extends \"NOT_IMPLEMENTED\" ? NotImplementedError:\n T extends \"UNSUPPORTED_OPERATION\" ? UnsupportedOperationError:\n T extends \"NETWORK_ERROR\" ? NetworkError:\n T extends \"SERVER_ERROR\" ? ServerError:\n T extends \"TIMEOUT\" ? TimeoutError:\n T extends \"BAD_DATA\" ? BadDataError:\n T extends \"CANCELLED\" ? CancelledError:\n\n T extends \"BUFFER_OVERRUN\" ? BufferOverrunError:\n T extends \"NUMERIC_FAULT\" ? NumericFaultError:\n\n T extends \"INVALID_ARGUMENT\" ? InvalidArgumentError:\n T extends \"MISSING_ARGUMENT\" ? MissingArgumentError:\n T extends \"UNEXPECTED_ARGUMENT\" ? UnexpectedArgumentError:\n\n T extends \"CALL_EXCEPTION\" ? CallExceptionError:\n T extends \"INSUFFICIENT_FUNDS\" ? InsufficientFundsError:\n T extends \"NONCE_EXPIRED\" ? NonceExpiredError:\n T extends \"OFFCHAIN_FAULT\" ? OffchainFaultError:\n T extends \"REPLACEMENT_UNDERPRICED\" ? ReplacementUnderpricedError:\n T extends \"TRANSACTION_REPLACED\" ? TransactionReplacedError:\n T extends \"UNCONFIGURED_NAME\" ? UnconfiguredNameError:\n\n T extends \"ACTION_REJECTED\" ? ActionRejectedError:\n\n never;\n\n\n\n/**\n * Returns true if the %%error%% matches an error thrown by ethers\n * that matches the error %%code%%.\n *\n * In TypeScript environments, this can be used to check that %%error%%\n * matches an EthersError type, which means the expected properties will\n * be set.\n *\n * @See [ErrorCodes](api:ErrorCode)\n * @example\n * try {\n * // code....\n * } catch (e) {\n * if (isError(e, \"CALL_EXCEPTION\")) {\n * // The Type Guard has validated this object\n * console.log(e.data);\n * }\n * }\n */\nexport function isError>(error: any, code: K): error is T {\n return (error && (error).code === code);\n}\n\n/**\n * Returns true if %%error%% is a [[CallExceptionError].\n */\nexport function isCallException(error: any): error is CallExceptionError {\n return isError(error, \"CALL_EXCEPTION\");\n}\n\n/**\n * Returns a new Error configured to the format ethers emits errors, with\n * the %%message%%, [[api:ErrorCode]] %%code%% and additional properties\n * for the corresponding EthersError.\n *\n * Each error in ethers includes the version of ethers, a\n * machine-readable [[ErrorCode]], and depending on %%code%%, additional\n * required properties. The error message will also include the %%message%%,\n * ethers version, %%code%% and all additional properties, serialized.\n */\nexport function makeError>(message: string, code: K, info?: ErrorInfo): T {\n let shortMessage = message;\n\n {\n const details: Array = [];\n if (info) {\n if (\"message\" in info || \"code\" in info || \"name\" in info) {\n throw new Error(`value will overwrite populated values: ${ stringify(info) }`);\n }\n for (const key in info) {\n if (key === \"shortMessage\") { continue; }\n const value = (info[>key]);\n// try {\n details.push(key + \"=\" + stringify(value));\n// } catch (error: any) {\n// console.log(\"MMM\", error.message);\n// details.push(key + \"=[could not serialize object]\");\n// }\n }\n }\n details.push(`code=${ code }`);\n details.push(`version=${ version }`);\n\n if (details.length) {\n message += \" (\" + details.join(\", \") + \")\";\n }\n }\n\n let error;\n switch (code) {\n case \"INVALID_ARGUMENT\":\n error = new TypeError(message);\n break;\n case \"NUMERIC_FAULT\":\n case \"BUFFER_OVERRUN\":\n error = new RangeError(message);\n break;\n default:\n error = new Error(message);\n }\n\n defineProperties(error, { code });\n\n if (info) { Object.assign(error, info); }\n\n if ((error).shortMessage == null) {\n defineProperties(error, { shortMessage });\n }\n\n return error;\n}\n\n/**\n * Throws an EthersError with %%message%%, %%code%% and additional error\n * %%info%% when %%check%% is falsish..\n *\n * @see [[api:makeError]]\n */\nexport function assert>(check: unknown, message: string, code: K, info?: ErrorInfo): asserts check {\n if (!check) { throw makeError(message, code, info); }\n}\n\n\n/**\n * A simple helper to simply ensuring provided arguments match expected\n * constraints, throwing if not.\n *\n * In TypeScript environments, the %%check%% has been asserted true, so\n * any further code does not need additional compile-time checks.\n */\nexport function assertArgument(check: unknown, message: string, name: string, value: unknown): asserts check {\n assert(check, message, \"INVALID_ARGUMENT\", { argument: name, value: value });\n}\n\nexport function assertArgumentCount(count: number, expectedCount: number, message?: string): void {\n if (message == null) { message = \"\"; }\n if (message) { message = \": \" + message; }\n\n assert(count >= expectedCount, \"missing arguemnt\" + message, \"MISSING_ARGUMENT\", {\n count: count,\n expectedCount: expectedCount\n });\n\n assert(count <= expectedCount, \"too many arguments\" + message, \"UNEXPECTED_ARGUMENT\", {\n count: count,\n expectedCount: expectedCount\n });\n}\n\nconst _normalizeForms = [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].reduce((accum, form) => {\n try {\n // General test for normalize\n /* c8 ignore start */\n if (\"test\".normalize(form) !== \"test\") { throw new Error(\"bad\"); };\n /* c8 ignore stop */\n\n if (form === \"NFD\") {\n const check = String.fromCharCode(0xe9).normalize(\"NFD\");\n const expected = String.fromCharCode(0x65, 0x0301)\n /* c8 ignore start */\n if (check !== expected) { throw new Error(\"broken\") }\n /* c8 ignore stop */\n }\n\n accum.push(form);\n } catch(error) { }\n\n return accum;\n}, >[]);\n\n/**\n * Throws if the normalization %%form%% is not supported.\n */\nexport function assertNormalize(form: string): void {\n assert(_normalizeForms.indexOf(form) >= 0, \"platform missing String.prototype.normalize\", \"UNSUPPORTED_OPERATION\", {\n operation: \"String.prototype.normalize\", info: { form }\n });\n}\n\n/**\n * Many classes use file-scoped values to guard the constructor,\n * making it effectively private. This facilitates that pattern\n * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%,\n * throwing if not, indicating the %%className%% if provided.\n */\nexport function assertPrivate(givenGuard: any, guard: any, className?: string): void {\n if (className == null) { className = \"\"; }\n if (givenGuard !== guard) {\n let method = className, operation = \"new\";\n if (className) {\n method += \".\";\n operation += \" \" + className;\n }\n assert(false, `private constructor; use ${ method }from* methods`, \"UNSUPPORTED_OPERATION\", {\n operation\n });\n }\n}\n", "/**\n * Some data helpers.\n *\n *\n * @_subsection api/utils:Data Helpers [about-data]\n */\nimport { assert, assertArgument } from \"./errors.js\";\n\n/**\n * A [[HexString]] whose length is even, which ensures it is a valid\n * representation of binary data.\n */\nexport type DataHexString = string;\n\n/**\n * A string which is prefixed with ``0x`` and followed by any number\n * of case-agnostic hexadecimal characters.\n *\n * It must match the regular expression ``/0x[0-9A-Fa-f]*\\/``.\n */\nexport type HexString = string;\n\n/**\n * An object that can be used to represent binary data.\n */\nexport type BytesLike = DataHexString | Uint8Array;\n\nfunction _getBytes(value: BytesLike, name?: string, copy?: boolean): Uint8Array {\n if (value instanceof Uint8Array) {\n if (copy) { return new Uint8Array(value); }\n return value;\n }\n\n if (typeof(value) === \"string\" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) {\n const result = new Uint8Array((value.length - 2) / 2);\n let offset = 2;\n for (let i = 0; i < result.length; i++) {\n result[i] = parseInt(value.substring(offset, offset + 2), 16);\n offset += 2;\n }\n return result;\n }\n\n assertArgument(false, \"invalid BytesLike value\", name || \"value\", value);\n}\n\n/**\n * Get a typed Uint8Array for %%value%%. If already a Uint8Array\n * the original %%value%% is returned; if a copy is required use\n * [[getBytesCopy]].\n *\n * @see: getBytesCopy\n */\nexport function getBytes(value: BytesLike, name?: string): Uint8Array {\n return _getBytes(value, name, false);\n}\n\n/**\n * Get a typed Uint8Array for %%value%%, creating a copy if necessary\n * to prevent any modifications of the returned value from being\n * reflected elsewhere.\n *\n * @see: getBytes\n */\nexport function getBytesCopy(value: BytesLike, name?: string): Uint8Array {\n return _getBytes(value, name, true);\n}\n\n\n/**\n * Returns true if %%value%% is a valid [[HexString]].\n *\n * If %%length%% is ``true`` or a //number//, it also checks that\n * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//)\n * bytes of data (e.g. ``0x1234`` is 2 bytes).\n */\nexport function isHexString(value: any, length?: number | boolean): value is `0x${ string }` {\n if (typeof(value) !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false\n }\n\n if (typeof(length) === \"number\" && value.length !== 2 + 2 * length) { return false; }\n if (length === true && (value.length % 2) !== 0) { return false; }\n\n return true;\n}\n\n/**\n * Returns true if %%value%% is a valid representation of arbitrary\n * data (i.e. a valid [[DataHexString]] or a Uint8Array).\n */\nexport function isBytesLike(value: any): value is BytesLike {\n return (isHexString(value, true) || (value instanceof Uint8Array));\n}\n\nconst HexCharacters: string = \"0123456789abcdef\";\n\n/**\n * Returns a [[DataHexString]] representation of %%data%%.\n */\nexport function hexlify(data: BytesLike): string {\n const bytes = getBytes(data);\n\n let result = \"0x\";\n for (let i = 0; i < bytes.length; i++) {\n const v = bytes[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n}\n\n/**\n * Returns a [[DataHexString]] by concatenating all values\n * within %%data%%.\n */\nexport function concat(datas: ReadonlyArray): string {\n return \"0x\" + datas.map((d) => hexlify(d).substring(2)).join(\"\");\n}\n\n/**\n * Returns the length of %%data%%, in bytes.\n */\nexport function dataLength(data: BytesLike): number {\n if (isHexString(data, true)) { return (data.length - 2) / 2; }\n return getBytes(data).length;\n}\n\n/**\n * Returns a [[DataHexString]] by slicing %%data%% from the %%start%%\n * offset to the %%end%% offset.\n *\n * By default %%start%% is 0 and %%end%% is the length of %%data%%.\n */\nexport function dataSlice(data: BytesLike, start?: number, end?: number): string {\n const bytes = getBytes(data);\n if (end != null && end > bytes.length) {\n assert(false, \"cannot slice beyond data bounds\", \"BUFFER_OVERRUN\", {\n buffer: bytes, length: bytes.length, offset: end\n });\n }\n return hexlify(bytes.slice((start == null) ? 0: start, (end == null) ? bytes.length: end));\n}\n\n/**\n * Return the [[DataHexString]] result by stripping all **leading**\n ** zero bytes from %%data%%.\n */\nexport function stripZerosLeft(data: BytesLike): string {\n let bytes = hexlify(data).substring(2);\n while (bytes.startsWith(\"00\")) { bytes = bytes.substring(2); }\n return \"0x\" + bytes;\n}\n\nfunction zeroPad(data: BytesLike, length: number, left: boolean): string {\n const bytes = getBytes(data);\n assert(length >= bytes.length, \"padding exceeds data length\", \"BUFFER_OVERRUN\", {\n buffer: new Uint8Array(bytes),\n length: length,\n offset: length + 1\n });\n\n const result = new Uint8Array(length);\n result.fill(0);\n if (left) {\n result.set(bytes, length - bytes.length);\n } else {\n result.set(bytes, 0);\n }\n\n return hexlify(result);\n}\n\n/**\n * Return the [[DataHexString]] of %%data%% padded on the **left**\n * to %%length%% bytes.\n *\n * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is\n * thrown.\n *\n * This pads data the same as **values** are in Solidity\n * (e.g. ``uint128``).\n */\nexport function zeroPadValue(data: BytesLike, length: number): string {\n return zeroPad(data, length, true);\n}\n\n/**\n * Return the [[DataHexString]] of %%data%% padded on the **right**\n * to %%length%% bytes.\n *\n * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is\n * thrown.\n *\n * This pads data the same as **bytes** are in Solidity\n * (e.g. ``bytes16``).\n */\nexport function zeroPadBytes(data: BytesLike, length: number): string {\n return zeroPad(data, length, false);\n}\n", "/**\n * Some mathematic operations.\n *\n * @_subsection: api/utils:Math Helpers [about-maths]\n */\nimport { hexlify, isBytesLike } from \"./data.js\";\nimport { assert, assertArgument } from \"./errors.js\";\n\nimport type { BytesLike } from \"./data.js\";\n\n/**\n * Any type that can be used where a numeric value is needed.\n */\nexport type Numeric = number | bigint;\n\n/**\n * Any type that can be used where a big number is needed.\n */\nexport type BigNumberish = string | Numeric;\n\n\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\n\n//const BN_Max256 = (BN_1 << BigInt(256)) - BN_1;\n\n\n// IEEE 754 support 53-bits of mantissa\nconst maxValue = 0x1fffffffffffff;\n\n/**\n * Convert %%value%% from a twos-compliment representation of %%width%%\n * bits to its value.\n *\n * If the highest bit is ``1``, the result will be negative.\n */\nexport function fromTwos(_value: BigNumberish, _width: Numeric): bigint {\n const value = getUint(_value, \"value\");\n const width = BigInt(getNumber(_width, \"width\"));\n\n assert((value >> width) === BN_0, \"overflow\", \"NUMERIC_FAULT\", {\n operation: \"fromTwos\", fault: \"overflow\", value: _value\n });\n\n // Top bit set; treat as a negative value\n if (value >> (width - BN_1)) {\n const mask = (BN_1 << width) - BN_1;\n return -(((~value) & mask) + BN_1);\n }\n\n return value;\n}\n\n/**\n * Convert %%value%% to a twos-compliment representation of\n * %%width%% bits.\n *\n * The result will always be positive.\n */\nexport function toTwos(_value: BigNumberish, _width: Numeric): bigint {\n let value = getBigInt(_value, \"value\");\n const width = BigInt(getNumber(_width, \"width\"));\n\n const limit = (BN_1 << (width - BN_1));\n\n if (value < BN_0) {\n value = -value;\n assert(value <= limit, \"too low\", \"NUMERIC_FAULT\", {\n operation: \"toTwos\", fault: \"overflow\", value: _value\n });\n const mask = (BN_1 << width) - BN_1;\n return ((~value) & mask) + BN_1;\n } else {\n assert(value < limit, \"too high\", \"NUMERIC_FAULT\", {\n operation: \"toTwos\", fault: \"overflow\", value: _value\n });\n }\n\n return value;\n}\n\n/**\n * Mask %%value%% with a bitmask of %%bits%% ones.\n */\nexport function mask(_value: BigNumberish, _bits: Numeric): bigint {\n const value = getUint(_value, \"value\");\n const bits = BigInt(getNumber(_bits, \"bits\"));\n return value & ((BN_1 << bits) - BN_1);\n}\n\n/**\n * Gets a BigInt from %%value%%. If it is an invalid value for\n * a BigInt, then an ArgumentError will be thrown for %%name%%.\n */\nexport function getBigInt(value: BigNumberish, name?: string): bigint {\n switch (typeof(value)) {\n case \"bigint\": return value;\n case \"number\":\n assertArgument(Number.isInteger(value), \"underflow\", name || \"value\", value);\n assertArgument(value >= -maxValue && value <= maxValue, \"overflow\", name || \"value\", value);\n return BigInt(value);\n case \"string\":\n try {\n if (value === \"\") { throw new Error(\"empty string\"); }\n if (value[0] === \"-\" && value[1] !== \"-\") {\n return -BigInt(value.substring(1));\n }\n return BigInt(value);\n } catch(e: any) {\n assertArgument(false, `invalid BigNumberish string: ${ e.message }`, name || \"value\", value);\n }\n }\n assertArgument(false, \"invalid BigNumberish value\", name || \"value\", value);\n}\n\n/**\n * Returns %%value%% as a bigint, validating it is valid as a bigint\n * value and that it is positive.\n */\nexport function getUint(value: BigNumberish, name?: string): bigint {\n const result = getBigInt(value, name);\n assert(result >= BN_0, \"unsigned value cannot be negative\", \"NUMERIC_FAULT\", {\n fault: \"overflow\", operation: \"getUint\", value\n });\n return result;\n}\n\nconst Nibbles = \"0123456789abcdef\";\n\n/*\n * Converts %%value%% to a BigInt. If %%value%% is a Uint8Array, it\n * is treated as Big Endian data.\n */\nexport function toBigInt(value: BigNumberish | Uint8Array): bigint {\n if (value instanceof Uint8Array) {\n let result = \"0x0\";\n for (const v of value) {\n result += Nibbles[v >> 4];\n result += Nibbles[v & 0x0f];\n }\n return BigInt(result);\n }\n\n return getBigInt(value);\n}\n\n/**\n * Gets a //number// from %%value%%. If it is an invalid value for\n * a //number//, then an ArgumentError will be thrown for %%name%%.\n */\nexport function getNumber(value: BigNumberish, name?: string): number {\n switch (typeof(value)) {\n case \"bigint\":\n assertArgument(value >= -maxValue && value <= maxValue, \"overflow\", name || \"value\", value);\n return Number(value);\n case \"number\":\n assertArgument(Number.isInteger(value), \"underflow\", name || \"value\", value);\n assertArgument(value >= -maxValue && value <= maxValue, \"overflow\", name || \"value\", value);\n return value;\n case \"string\":\n try {\n if (value === \"\") { throw new Error(\"empty string\"); }\n return getNumber(BigInt(value), name);\n } catch(e: any) {\n assertArgument(false, `invalid numeric string: ${ e.message }`, name || \"value\", value);\n }\n }\n assertArgument(false, \"invalid numeric value\", name || \"value\", value);\n}\n\n\n/**\n * Converts %%value%% to a number. If %%value%% is a Uint8Array, it\n * is treated as Big Endian data. Throws if the value is not safe.\n */\nexport function toNumber(value: BigNumberish | Uint8Array): number {\n return getNumber(toBigInt(value));\n}\n\n/**\n * Converts %%value%% to a Big Endian hexstring, optionally padded to\n * %%width%% bytes.\n */\nexport function toBeHex(_value: BigNumberish, _width?: Numeric): string {\n const value = getUint(_value, \"value\");\n\n let result = value.toString(16);\n\n if (_width == null) {\n // Ensure the value is of even length\n if (result.length % 2) { result = \"0\" + result; }\n } else {\n const width = getNumber(_width, \"width\");\n assert(width * 2 >= result.length, `value exceeds width (${ width } bytes)`, \"NUMERIC_FAULT\", {\n operation: \"toBeHex\",\n fault: \"overflow\",\n value: _value\n });\n\n // Pad the value to the required width\n while (result.length < (width * 2)) { result = \"0\" + result; }\n\n }\n\n return \"0x\" + result;\n}\n\n/**\n * Converts %%value%% to a Big Endian Uint8Array.\n */\nexport function toBeArray(_value: BigNumberish): Uint8Array {\n const value = getUint(_value, \"value\");\n\n if (value === BN_0) { return new Uint8Array([ ]); }\n\n let hex = value.toString(16);\n if (hex.length % 2) { hex = \"0\" + hex; }\n\n const result = new Uint8Array(hex.length / 2);\n for (let i = 0; i < result.length; i++) {\n const offset = i * 2;\n result[i] = parseInt(hex.substring(offset, offset + 2), 16);\n }\n\n return result;\n}\n\n/**\n * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//.\n *\n * A //Quantity// does not have and leading 0 values unless the value is\n * the literal value `0x0`. This is most commonly used for JSSON-RPC\n * numeric values.\n */\nexport function toQuantity(value: BytesLike | BigNumberish): string {\n let result = hexlify(isBytesLike(value) ? value: toBeArray(value)).substring(2);\n while (result.startsWith(\"0\")) { result = result.substring(1); }\n if (result === \"\") { result = \"0\"; }\n return \"0x\" + result;\n}\n", "/**\n * The [Base58 Encoding](link-base58) scheme allows a **numeric** value\n * to be encoded as a compact string using a radix of 58 using only\n * alpha-numeric characters. Confusingly similar characters are omitted\n * (i.e. ``\"l0O\"``).\n *\n * Note that Base58 encodes a **numeric** value, not arbitrary bytes,\n * since any zero-bytes on the left would get removed. To mitigate this\n * issue most schemes that use Base58 choose specific high-order values\n * to ensure non-zero prefixes.\n *\n * @_subsection: api/utils:Base58 Encoding [about-base58]\n */\n\nimport { getBytes } from \"./data.js\";\nimport { assertArgument } from \"./errors.js\";\nimport { toBigInt } from \"./maths.js\";\n\nimport type { BytesLike } from \"./index.js\";\n\n\nconst Alphabet = \"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\";\nlet Lookup: null | Record = null;\n\nfunction getAlpha(letter: string): bigint {\n if (Lookup == null) {\n Lookup = { };\n for (let i = 0; i < Alphabet.length; i++) {\n Lookup[Alphabet[i]] = BigInt(i);\n }\n }\n const result = Lookup[letter];\n assertArgument(result != null, `invalid base58 value`, \"letter\", letter);\n return result;\n}\n\n\nconst BN_0 = BigInt(0);\nconst BN_58 = BigInt(58);\n\n/**\n * Encode %%value%% as a Base58-encoded string.\n */\nexport function encodeBase58(_value: BytesLike): string {\n const bytes = getBytes(_value);\n\n let value = toBigInt(bytes);\n let result = \"\";\n while (value) {\n result = Alphabet[Number(value % BN_58)] + result;\n value /= BN_58;\n }\n\n // Account for leading padding zeros\n for (let i = 0; i < bytes.length; i++) {\n if (bytes[i]) { break; }\n result = Alphabet[0] + result;\n }\n\n return result;\n}\n\n/**\n * Decode the Base58-encoded %%value%%.\n */\nexport function decodeBase58(value: string): bigint {\n let result = BN_0;\n for (let i = 0; i < value.length; i++) {\n result *= BN_58;\n result += getAlpha(value[i]);\n }\n return result;\n}\n", "\n// utils/base64-browser\n\nimport { getBytes } from \"./data.js\";\n\nimport type { BytesLike } from \"./data.js\";\n\n\nexport function decodeBase64(textData: string): Uint8Array {\n textData = atob(textData);\n const data = new Uint8Array(textData.length);\n for (let i = 0; i < textData.length; i++) {\n data[i] = textData.charCodeAt(i);\n }\n return getBytes(data);\n}\n\nexport function encodeBase64(_data: BytesLike): string {\n const data = getBytes(_data);\n let textData = \"\";\n for (let i = 0; i < data.length; i++) {\n textData += String.fromCharCode(data[i]);\n }\n return btoa(textData);\n}\n", "/**\n * Events allow for applications to use the observer pattern, which\n * allows subscribing and publishing events, outside the normal\n * execution paths.\n *\n * @_section api/utils/events:Events [about-events]\n */\nimport { defineProperties } from \"./properties.js\";\n\n/**\n * A callback function called when a an event is triggered.\n */\nexport type Listener = (...args: Array) => void;\n\n/**\n * An **EventEmitterable** behaves similar to an EventEmitter\n * except provides async access to its methods.\n *\n * An EventEmitter implements the observer pattern.\n */\nexport interface EventEmitterable {\n /**\n * Registers a %%listener%% that is called whenever the\n * %%event%% occurs until unregistered.\n */\n on(event: T, listener: Listener): Promise;\n\n /**\n * Registers a %%listener%% that is called the next time\n * %%event%% occurs.\n */\n once(event: T, listener: Listener): Promise;\n\n /**\n * Triggers each listener for %%event%% with the %%args%%.\n */\n emit(event: T, ...args: Array): Promise;\n\n /**\n * Resolves to the number of listeners for %%event%%.\n */\n listenerCount(event?: T): Promise;\n\n /**\n * Resolves to the listeners for %%event%%.\n */\n listeners(event?: T): Promise>;\n\n /**\n * Unregister the %%listener%% for %%event%%. If %%listener%%\n * is unspecified, all listeners are unregistered.\n */\n off(event: T, listener?: Listener): Promise;\n\n /**\n * Unregister all listeners for %%event%%.\n */\n removeAllListeners(event?: T): Promise;\n\n /**\n * Alias for [[on]].\n */\n addListener(event: T, listener: Listener): Promise;\n\n /**\n * Alias for [[off]].\n */\n removeListener(event: T, listener: Listener): Promise;\n}\n\n/**\n * When an [[EventEmitterable]] triggers a [[Listener]], the\n * callback always ahas one additional argument passed, which is\n * an **EventPayload**.\n */\nexport class EventPayload {\n /**\n * The event filter.\n */\n readonly filter!: T;\n\n /**\n * The **EventEmitterable**.\n */\n readonly emitter!: EventEmitterable;\n\n readonly #listener: null | Listener;\n\n /**\n * Create a new **EventPayload** for %%emitter%% with\n * the %%listener%% and for %%filter%%.\n */\n constructor(emitter: EventEmitterable, listener: null | Listener, filter: T) {\n this.#listener = listener;\n defineProperties>(this, { emitter, filter });\n }\n\n /**\n * Unregister the triggered listener for future events.\n */\n async removeListener(): Promise {\n if (this.#listener == null) { return; }\n await this.emitter.off(this.filter, this.#listener);\n }\n}\n", "/**\n * Using strings in Ethereum (or any security-basd system) requires\n * additional care. These utilities attempt to mitigate some of the\n * safety issues as well as provide the ability to recover and analyse\n * strings.\n *\n * @_subsection api/utils:Strings and UTF-8 [about-strings]\n */\nimport { getBytes } from \"./data.js\";\nimport { assertArgument, assertNormalize } from \"./errors.js\";\n\nimport type { BytesLike } from \"./index.js\";\n\n\n///////////////////////////////\n\n/**\n * The stanard normalization forms.\n */\nexport type UnicodeNormalizationForm = \"NFC\" | \"NFD\" | \"NFKC\" | \"NFKD\";\n\n/**\n * When using the UTF-8 error API the following errors can be intercepted\n * and processed as the %%reason%% passed to the [[Utf8ErrorFunc]].\n *\n * **``\"UNEXPECTED_CONTINUE\"``** - a continuation byte was present where there\n * was nothing to continue.\n *\n * **``\"BAD_PREFIX\"``** - an invalid (non-continuation) byte to start a\n * UTF-8 codepoint was found.\n *\n * **``\"OVERRUN\"``** - the string is too short to process the expected\n * codepoint length.\n *\n * **``\"MISSING_CONTINUE\"``** - a missing continuation byte was expected but\n * not found. The %%offset%% indicates the index the continuation byte\n * was expected at.\n *\n * **``\"OUT_OF_RANGE\"``** - the computed code point is outside the range\n * for UTF-8. The %%badCodepoint%% indicates the computed codepoint, which was\n * outside the valid UTF-8 range.\n *\n * **``\"UTF16_SURROGATE\"``** - the UTF-8 strings contained a UTF-16 surrogate\n * pair. The %%badCodepoint%% is the computed codepoint, which was inside the\n * UTF-16 surrogate range.\n *\n * **``\"OVERLONG\"``** - the string is an overlong representation. The\n * %%badCodepoint%% indicates the computed codepoint, which has already\n * been bounds checked.\n *\n *\n * @returns string\n */\nexport type Utf8ErrorReason = \"UNEXPECTED_CONTINUE\" | \"BAD_PREFIX\" | \"OVERRUN\" |\n \"MISSING_CONTINUE\" | \"OUT_OF_RANGE\" | \"UTF16_SURROGATE\" | \"OVERLONG\";\n\n\n/**\n * A callback that can be used with [[toUtf8String]] to analysis or\n * recovery from invalid UTF-8 data.\n *\n * Parsing UTF-8 data is done through a simple Finite-State Machine (FSM)\n * which calls the ``Utf8ErrorFunc`` if a fault is detected.\n *\n * The %%reason%% indicates where in the FSM execution the fault\n * occurred and the %%offset%% indicates where the input failed.\n *\n * The %%bytes%% represents the raw UTF-8 data that was provided and\n * %%output%% is the current array of UTF-8 code-points, which may\n * be updated by the ``Utf8ErrorFunc``.\n *\n * The value of the %%badCodepoint%% depends on the %%reason%%. See\n * [[Utf8ErrorReason]] for details.\n *\n * The function should return the number of bytes that should be skipped\n * when control resumes to the FSM.\n */\nexport type Utf8ErrorFunc = (reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, output: Array, badCodepoint?: number) => number;\n\n\nfunction errorFunc(reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, output: Array, badCodepoint?: number): number {\n assertArgument(false, `invalid codepoint at offset ${ offset }; ${ reason }`, \"bytes\", bytes);\n}\n\nfunction ignoreFunc(reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, output: Array, badCodepoint?: number): number {\n\n // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes\n if (reason === \"BAD_PREFIX\" || reason === \"UNEXPECTED_CONTINUE\") {\n let i = 0;\n for (let o = offset + 1; o < bytes.length; o++) {\n if (bytes[o] >> 6 !== 0x02) { break; }\n i++;\n }\n return i;\n }\n\n // This byte runs us past the end of the string, so just jump to the end\n // (but the first byte was read already read and therefore skipped)\n if (reason === \"OVERRUN\") {\n return bytes.length - offset - 1;\n }\n\n // Nothing to skip\n return 0;\n}\n\nfunction replaceFunc(reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, output: Array, badCodepoint?: number): number {\n\n // Overlong representations are otherwise \"valid\" code points; just non-deistingtished\n if (reason === \"OVERLONG\") {\n assertArgument(typeof(badCodepoint) === \"number\", \"invalid bad code point for replacement\", \"badCodepoint\", badCodepoint);\n output.push(badCodepoint);\n return 0;\n }\n\n // Put the replacement character into the output\n output.push(0xfffd);\n\n // Otherwise, process as if ignoring errors\n return ignoreFunc(reason, offset, bytes, output, badCodepoint);\n}\n\n/**\n * A handful of popular, built-in UTF-8 error handling strategies.\n *\n * **``\"error\"``** - throws on ANY illegal UTF-8 sequence or\n * non-canonical (overlong) codepoints (this is the default)\n *\n * **``\"ignore\"``** - silently drops any illegal UTF-8 sequence\n * and accepts non-canonical (overlong) codepoints\n *\n * **``\"replace\"``** - replace any illegal UTF-8 sequence with the\n * UTF-8 replacement character (i.e. ``\"\\\\ufffd\"``) and accepts\n * non-canonical (overlong) codepoints\n *\n * @returns: Record<\"error\" | \"ignore\" | \"replace\", Utf8ErrorFunc>\n */\nexport const Utf8ErrorFuncs: Readonly> = Object.freeze({\n error: errorFunc,\n ignore: ignoreFunc,\n replace: replaceFunc\n});\n\n// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499\nfunction getUtf8CodePoints(_bytes: BytesLike, onError?: Utf8ErrorFunc): Array {\n if (onError == null) { onError = Utf8ErrorFuncs.error; }\n\n const bytes = getBytes(_bytes, \"bytes\");\n\n const result: Array = [];\n let i = 0;\n\n // Invalid bytes are ignored\n while(i < bytes.length) {\n\n const c = bytes[i++];\n\n // 0xxx xxxx\n if (c >> 7 === 0) {\n result.push(c);\n continue;\n }\n\n // Multibyte; how many bytes left for this character?\n let extraLength: null | number = null;\n let overlongMask: null | number = null;\n\n // 110x xxxx 10xx xxxx\n if ((c & 0xe0) === 0xc0) {\n extraLength = 1;\n overlongMask = 0x7f;\n\n // 1110 xxxx 10xx xxxx 10xx xxxx\n } else if ((c & 0xf0) === 0xe0) {\n extraLength = 2;\n overlongMask = 0x7ff;\n\n // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx\n } else if ((c & 0xf8) === 0xf0) {\n extraLength = 3;\n overlongMask = 0xffff;\n\n } else {\n if ((c & 0xc0) === 0x80) {\n i += onError(\"UNEXPECTED_CONTINUE\", i - 1, bytes, result);\n } else {\n i += onError(\"BAD_PREFIX\", i - 1, bytes, result);\n }\n continue;\n }\n\n // Do we have enough bytes in our data?\n if (i - 1 + extraLength >= bytes.length) {\n i += onError(\"OVERRUN\", i - 1, bytes, result);\n continue;\n }\n\n // Remove the length prefix from the char\n let res: null | number = c & ((1 << (8 - extraLength - 1)) - 1);\n\n for (let j = 0; j < extraLength; j++) {\n let nextChar = bytes[i];\n\n // Invalid continuation byte\n if ((nextChar & 0xc0) != 0x80) {\n i += onError(\"MISSING_CONTINUE\", i, bytes, result);\n res = null;\n break;\n };\n\n res = (res << 6) | (nextChar & 0x3f);\n i++;\n }\n\n // See above loop for invalid continuation byte\n if (res === null) { continue; }\n\n // Maximum code point\n if (res > 0x10ffff) {\n i += onError(\"OUT_OF_RANGE\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n\n // Reserved for UTF-16 surrogate halves\n if (res >= 0xd800 && res <= 0xdfff) {\n i += onError(\"UTF16_SURROGATE\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n\n // Check for overlong sequences (more bytes than needed)\n if (res <= overlongMask) {\n i += onError(\"OVERLONG\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n\n result.push(res);\n }\n\n return result;\n}\n\n// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array\n\n/**\n * Returns the UTF-8 byte representation of %%str%%.\n *\n * If %%form%% is specified, the string is normalized.\n */\nexport function toUtf8Bytes(str: string, form?: UnicodeNormalizationForm): Uint8Array {\n assertArgument(typeof(str) === \"string\", \"invalid string value\", \"str\", str);\n\n if (form != null) {\n assertNormalize(form);\n str = str.normalize(form);\n }\n\n let result: Array = [];\n for (let i = 0; i < str.length; i++) {\n const c = str.charCodeAt(i);\n\n if (c < 0x80) {\n result.push(c);\n\n } else if (c < 0x800) {\n result.push((c >> 6) | 0xc0);\n result.push((c & 0x3f) | 0x80);\n\n } else if ((c & 0xfc00) == 0xd800) {\n i++;\n const c2 = str.charCodeAt(i);\n\n assertArgument(i < str.length && ((c2 & 0xfc00) === 0xdc00),\n \"invalid surrogate pair\", \"str\", str);\n\n // Surrogate Pair\n const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff);\n result.push((pair >> 18) | 0xf0);\n result.push(((pair >> 12) & 0x3f) | 0x80);\n result.push(((pair >> 6) & 0x3f) | 0x80);\n result.push((pair & 0x3f) | 0x80);\n\n } else {\n result.push((c >> 12) | 0xe0);\n result.push(((c >> 6) & 0x3f) | 0x80);\n result.push((c & 0x3f) | 0x80);\n }\n }\n\n return new Uint8Array(result);\n};\n\n//export \nfunction _toUtf8String(codePoints: Array): string {\n return codePoints.map((codePoint) => {\n if (codePoint <= 0xffff) {\n return String.fromCharCode(codePoint);\n }\n codePoint -= 0x10000;\n return String.fromCharCode(\n (((codePoint >> 10) & 0x3ff) + 0xd800),\n ((codePoint & 0x3ff) + 0xdc00)\n );\n }).join(\"\");\n}\n\n/**\n * Returns the string represented by the UTF-8 data %%bytes%%.\n *\n * When %%onError%% function is specified, it is called on UTF-8\n * errors allowing recovery using the [[Utf8ErrorFunc]] API.\n * (default: [error](Utf8ErrorFuncs))\n */\nexport function toUtf8String(bytes: BytesLike, onError?: Utf8ErrorFunc): string {\n return _toUtf8String(getUtf8CodePoints(bytes, onError));\n}\n\n/**\n * Returns the UTF-8 code-points for %%str%%.\n *\n * If %%form%% is specified, the string is normalized.\n */\nexport function toUtf8CodePoints(str: string, form?: UnicodeNormalizationForm): Array {\n return getUtf8CodePoints(toUtf8Bytes(str, form));\n}\n\n", "import { assert } from \"./errors.js\";\n\nimport type {\n FetchGetUrlFunc, FetchRequest, FetchCancelSignal, GetUrlResponse\n} from \"./fetch.js\";\n\n\ndeclare global {\n class Headers {\n constructor(values: Array<[ string, string ]>);\n forEach(func: (v: string, k: string) => void): void;\n }\n\n class Response {\n status: number;\n statusText: string;\n headers: Headers;\n arrayBuffer(): Promise;\n }\n\n type FetchInit = {\n method?: string,\n headers?: Headers,\n body?: Uint8Array\n };\n\n function fetch(url: string, init: FetchInit): Promise;\n}\n\n// @TODO: timeout is completely ignored; start a Promise.any with a reject?\n\nexport function createGetUrl(options?: Record): FetchGetUrlFunc {\n\n async function getUrl(req: FetchRequest, _signal?: FetchCancelSignal): Promise {\n const protocol = req.url.split(\":\")[0].toLowerCase();\n\n assert(protocol === \"http\" || protocol === \"https\", `unsupported protocol ${ protocol }`, \"UNSUPPORTED_OPERATION\", {\n info: { protocol },\n operation: \"request\"\n });\n\n assert(protocol === \"https\" || !req.credentials || req.allowInsecureAuthentication, \"insecure authorized connections unsupported\", \"UNSUPPORTED_OPERATION\", {\n operation: \"request\"\n });\n\n let signal: undefined | AbortSignal = undefined;\n if (_signal) {\n const controller = new AbortController();\n signal = controller.signal;\n _signal.addListener(() => { controller.abort(); });\n }\n\n const init = {\n method: req.method,\n headers: new Headers(Array.from(req)),\n body: req.body || undefined,\n signal\n };\n\n const resp = await fetch(req.url, init);\n\n const headers: Record = { };\n resp.headers.forEach((value, key) => {\n headers[key.toLowerCase()] = value;\n });\n\n const respBody = await resp.arrayBuffer();\n const body = (respBody == null) ? null: new Uint8Array(respBody);\n\n return {\n statusCode: resp.status,\n statusMessage: resp.statusText,\n headers, body\n };\n }\n\n return getUrl;\n}\n\n// @TODO: remove in v7; provided for backwards compat\nconst defaultGetUrl: FetchGetUrlFunc = createGetUrl({ });\n\nexport async function getUrl(req: FetchRequest, _signal?: FetchCancelSignal): Promise {\n return defaultGetUrl(req, _signal);\n}\n\n", "/**\n * Fetching content from the web is environment-specific, so Ethers\n * provides an abstraction that each environment can implement to provide\n * this service.\n *\n * On [Node.js](link-node), the ``http`` and ``https`` libs are used to\n * create a request object, register event listeners and process data\n * and populate the [[FetchResponse]].\n *\n * In a browser, the [DOM fetch](link-js-fetch) is used, and the resulting\n * ``Promise`` is waited on to retrieve the payload.\n *\n * The [[FetchRequest]] is responsible for handling many common situations,\n * such as redirects, server throttling, authentication, etc.\n *\n * It also handles common gateways, such as IPFS and data URIs.\n *\n * @_section api/utils/fetching:Fetching Web Content [about-fetch]\n */\nimport { decodeBase64, encodeBase64 } from \"./base64.js\";\nimport { hexlify } from \"./data.js\";\nimport { assert, assertArgument } from \"./errors.js\";\nimport { defineProperties } from \"./properties.js\";\nimport { toUtf8Bytes, toUtf8String } from \"./utf8.js\";\n\nimport { createGetUrl } from \"./geturl.js\";\n\n/**\n * An environment's implementation of ``getUrl`` must return this type.\n */\nexport type GetUrlResponse = {\n statusCode: number,\n statusMessage: string,\n headers: Record,\n body: null | Uint8Array\n};\n\n/**\n * This can be used to control how throttling is handled in\n * [[FetchRequest-setThrottleParams]].\n */\nexport type FetchThrottleParams = {\n maxAttempts?: number;\n slotInterval?: number;\n};\n\n/**\n * Called before any network request, allowing updated headers (e.g. Bearer tokens), etc.\n */\nexport type FetchPreflightFunc = (req: FetchRequest) => Promise;\n\n/**\n * Called on the response, allowing client-based throttling logic or post-processing.\n */\nexport type FetchProcessFunc = (req: FetchRequest, resp: FetchResponse) => Promise;\n\n/**\n * Called prior to each retry; return true to retry, false to abort.\n */\nexport type FetchRetryFunc = (req: FetchRequest, resp: FetchResponse, attempt: number) => Promise;\n\n/**\n * Called on Gateway URLs.\n */\nexport type FetchGatewayFunc = (url: string, signal?: FetchCancelSignal) => Promise;\n\n/**\n * Used to perform a fetch; use this to override the underlying network\n * fetch layer. In NodeJS, the default uses the \"http\" and \"https\" libraries\n * and in the browser ``fetch`` is used. If you wish to use Axios, this is\n * how you would register it.\n */\nexport type FetchGetUrlFunc = (req: FetchRequest, signal?: FetchCancelSignal) => Promise;\n\n\nconst MAX_ATTEMPTS = 12;\nconst SLOT_INTERVAL = 250;\n\n// The global FetchGetUrlFunc implementation.\nlet defaultGetUrlFunc: FetchGetUrlFunc = createGetUrl();\n\nconst reData = new RegExp(\"^data:([^;:]*)?(;base64)?,(.*)$\", \"i\");\nconst reIpfs = new RegExp(\"^ipfs:/\\/(ipfs/)?(.*)$\", \"i\");\n\n// If locked, new Gateways cannot be added\nlet locked = false;\n\n// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs\nasync function dataGatewayFunc(url: string, signal?: FetchCancelSignal): Promise {\n try {\n const match = url.match(reData);\n if (!match) { throw new Error(\"invalid data\"); }\n return new FetchResponse(200, \"OK\", {\n \"content-type\": (match[1] || \"text/plain\"),\n }, (match[2] ? decodeBase64(match[3]): unpercent(match[3])));\n } catch (error) {\n return new FetchResponse(599, \"BAD REQUEST (invalid data: URI)\", { }, null, new FetchRequest(url));\n }\n}\n\n/**\n * Returns a [[FetchGatewayFunc]] for fetching content from a standard\n * IPFS gateway hosted at %%baseUrl%%.\n */\nfunction getIpfsGatewayFunc(baseUrl: string): FetchGatewayFunc {\n async function gatewayIpfs(url: string, signal?: FetchCancelSignal): Promise {\n try {\n const match = url.match(reIpfs);\n if (!match) { throw new Error(\"invalid link\"); }\n return new FetchRequest(`${ baseUrl }${ match[2] }`);\n } catch (error) {\n return new FetchResponse(599, \"BAD REQUEST (invalid IPFS URI)\", { }, null, new FetchRequest(url));\n }\n }\n\n return gatewayIpfs;\n}\n\nconst Gateways: Record = {\n \"data\": dataGatewayFunc,\n \"ipfs\": getIpfsGatewayFunc(\"https:/\\/gateway.ipfs.io/ipfs/\")\n};\n\nconst fetchSignals: WeakMap void> = new WeakMap();\n\n/**\n * @_ignore\n */\nexport class FetchCancelSignal {\n #listeners: Array<() => void>;\n #cancelled: boolean;\n\n constructor(request: FetchRequest) {\n this.#listeners = [ ];\n this.#cancelled = false;\n\n fetchSignals.set(request, () => {\n if (this.#cancelled) { return; }\n this.#cancelled = true;\n\n for (const listener of this.#listeners) {\n setTimeout(() => { listener(); }, 0);\n }\n this.#listeners = [ ];\n });\n }\n\n addListener(listener: () => void): void {\n assert(!this.#cancelled, \"singal already cancelled\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fetchCancelSignal.addCancelListener\"\n });\n this.#listeners.push(listener);\n }\n\n get cancelled(): boolean { return this.#cancelled; }\n\n checkSignal(): void {\n assert(!this.cancelled, \"cancelled\", \"CANCELLED\", { });\n }\n}\n\n// Check the signal, throwing if it is cancelled\nfunction checkSignal(signal?: FetchCancelSignal): FetchCancelSignal {\n if (signal == null) { throw new Error(\"missing signal; should not happen\"); }\n signal.checkSignal();\n return signal;\n}\n\n/**\n * Represents a request for a resource using a URI.\n *\n * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``,\n * and ``IPFS:``.\n *\n * Additional schemes can be added globally using [[registerGateway]].\n *\n * @example:\n * req = new FetchRequest(\"https://www.ricmoo.com\")\n * resp = await req.send()\n * resp.body.length\n * //_result:\n */\nexport class FetchRequest implements Iterable<[ key: string, value: string ]> {\n #allowInsecure: boolean;\n #gzip: boolean;\n #headers: Record;\n #method: string;\n #timeout: number;\n #url: string;\n\n #body?: Uint8Array;\n #bodyType?: string;\n #creds?: string;\n\n // Hooks\n #preflight?: null | FetchPreflightFunc;\n #process?: null | FetchProcessFunc;\n #retry?: null | FetchRetryFunc;\n\n #signal?: FetchCancelSignal;\n\n #throttle: Required;\n\n #getUrlFunc: null | FetchGetUrlFunc;\n\n /**\n * The fetch URL to request.\n */\n get url(): string { return this.#url; }\n set url(url: string) {\n this.#url = String(url);\n }\n\n /**\n * The fetch body, if any, to send as the request body. //(default: null)//\n *\n * When setting a body, the intrinsic ``Content-Type`` is automatically\n * set and will be used if **not overridden** by setting a custom\n * header.\n *\n * If %%body%% is null, the body is cleared (along with the\n * intrinsic ``Content-Type``).\n *\n * If %%body%% is a string, the intrinsic ``Content-Type`` is set to\n * ``text/plain``.\n *\n * If %%body%% is a Uint8Array, the intrinsic ``Content-Type`` is set to\n * ``application/octet-stream``.\n *\n * If %%body%% is any other object, the intrinsic ``Content-Type`` is\n * set to ``application/json``.\n */\n get body(): null | Uint8Array {\n if (this.#body == null) { return null; }\n return new Uint8Array(this.#body);\n }\n set body(body: null | string | Readonly | Readonly) {\n if (body == null) {\n this.#body = undefined;\n this.#bodyType = undefined;\n } else if (typeof(body) === \"string\") {\n this.#body = toUtf8Bytes(body);\n this.#bodyType = \"text/plain\";\n } else if (body instanceof Uint8Array) {\n this.#body = body;\n this.#bodyType = \"application/octet-stream\";\n } else if (typeof(body) === \"object\") {\n this.#body = toUtf8Bytes(JSON.stringify(body));\n this.#bodyType = \"application/json\";\n } else {\n throw new Error(\"invalid body\");\n }\n }\n\n /**\n * Returns true if the request has a body.\n */\n hasBody(): this is (FetchRequest & { body: Uint8Array }) {\n return (this.#body != null);\n }\n\n /**\n * The HTTP method to use when requesting the URI. If no method\n * has been explicitly set, then ``GET`` is used if the body is\n * null and ``POST`` otherwise.\n */\n get method(): string {\n if (this.#method) { return this.#method; }\n if (this.hasBody()) { return \"POST\"; }\n return \"GET\";\n }\n set method(method: null | string) {\n if (method == null) { method = \"\"; }\n this.#method = String(method).toUpperCase();\n }\n\n /**\n * The headers that will be used when requesting the URI. All\n * keys are lower-case.\n *\n * This object is a copy, so any changes will **NOT** be reflected\n * in the ``FetchRequest``.\n *\n * To set a header entry, use the ``setHeader`` method.\n */\n get headers(): Record {\n const headers = Object.assign({ }, this.#headers);\n\n if (this.#creds) {\n headers[\"authorization\"] = `Basic ${ encodeBase64(toUtf8Bytes(this.#creds)) }`;\n };\n\n if (this.allowGzip) {\n headers[\"accept-encoding\"] = \"gzip\";\n }\n\n if (headers[\"content-type\"] == null && this.#bodyType) {\n headers[\"content-type\"] = this.#bodyType;\n }\n if (this.body) { headers[\"content-length\"] = String(this.body.length); }\n\n return headers;\n }\n\n /**\n * Get the header for %%key%%, ignoring case.\n */\n getHeader(key: string): string {\n return this.headers[key.toLowerCase()];\n }\n\n /**\n * Set the header for %%key%% to %%value%%. All values are coerced\n * to a string.\n */\n setHeader(key: string, value: string | number): void {\n this.#headers[String(key).toLowerCase()] = String(value);\n }\n\n /**\n * Clear all headers, resetting all intrinsic headers.\n */\n clearHeaders(): void {\n this.#headers = { };\n }\n\n [Symbol.iterator](): Iterator<[ key: string, value: string ]> {\n const headers = this.headers;\n const keys = Object.keys(headers);\n let index = 0;\n return {\n next: () => {\n if (index < keys.length) {\n const key = keys[index++];\n return {\n value: [ key, headers[key] ], done: false\n }\n }\n return { value: undefined, done: true };\n }\n };\n }\n\n /**\n * The value that will be sent for the ``Authorization`` header.\n *\n * To set the credentials, use the ``setCredentials`` method.\n */\n get credentials(): null | string {\n return this.#creds || null;\n }\n\n /**\n * Sets an ``Authorization`` for %%username%% with %%password%%.\n */\n setCredentials(username: string, password: string): void {\n assertArgument(!username.match(/:/), \"invalid basic authentication username\", \"username\", \"[REDACTED]\");\n this.#creds = `${ username }:${ password }`;\n }\n\n /**\n * Enable and request gzip-encoded responses. The response will\n * automatically be decompressed. //(default: true)//\n */\n get allowGzip(): boolean {\n return this.#gzip;\n }\n set allowGzip(value: boolean) {\n this.#gzip = !!value;\n }\n\n /**\n * Allow ``Authentication`` credentials to be sent over insecure\n * channels. //(default: false)//\n */\n get allowInsecureAuthentication(): boolean {\n return !!this.#allowInsecure;\n }\n set allowInsecureAuthentication(value: boolean) {\n this.#allowInsecure = !!value;\n }\n\n /**\n * The timeout (in milliseconds) to wait for a complete response.\n * //(default: 5 minutes)//\n */\n get timeout(): number { return this.#timeout; }\n set timeout(timeout: number) {\n assertArgument(timeout >= 0, \"timeout must be non-zero\", \"timeout\", timeout);\n this.#timeout = timeout;\n }\n\n /**\n * This function is called prior to each request, for example\n * during a redirection or retry in case of server throttling.\n *\n * This offers an opportunity to populate headers or update\n * content before sending a request.\n */\n get preflightFunc(): null | FetchPreflightFunc {\n return this.#preflight || null;\n }\n set preflightFunc(preflight: null | FetchPreflightFunc) {\n this.#preflight = preflight;\n }\n\n /**\n * This function is called after each response, offering an\n * opportunity to provide client-level throttling or updating\n * response data.\n *\n * Any error thrown in this causes the ``send()`` to throw.\n *\n * To schedule a retry attempt (assuming the maximum retry limit\n * has not been reached), use [[response.throwThrottleError]].\n */\n get processFunc(): null | FetchProcessFunc {\n return this.#process || null;\n }\n set processFunc(process: null | FetchProcessFunc) {\n this.#process = process;\n }\n\n /**\n * This function is called on each retry attempt.\n */\n get retryFunc(): null | FetchRetryFunc {\n return this.#retry || null;\n }\n set retryFunc(retry: null | FetchRetryFunc) {\n this.#retry = retry;\n }\n\n /**\n * This function is called to fetch content from HTTP and\n * HTTPS URLs and is platform specific (e.g. nodejs vs\n * browsers).\n *\n * This is by default the currently registered global getUrl\n * function, which can be changed using [[registerGetUrl]].\n * If this has been set, setting is to ``null`` will cause\n * this FetchRequest (and any future clones) to revert back to\n * using the currently registered global getUrl function.\n *\n * Setting this is generally not necessary, but may be useful\n * for developers that wish to intercept requests or to\n * configurege a proxy or other agent.\n */\n get getUrlFunc(): FetchGetUrlFunc {\n return this.#getUrlFunc || defaultGetUrlFunc;\n }\n set getUrlFunc(value: null | FetchGetUrlFunc) {\n this.#getUrlFunc = value;\n }\n\n /**\n * Create a new FetchRequest instance with default values.\n *\n * Once created, each property may be set before issuing a\n * ``.send()`` to make the request.\n */\n constructor(url: string) {\n this.#url = String(url);\n\n this.#allowInsecure = false;\n this.#gzip = true;\n this.#headers = { };\n this.#method = \"\";\n this.#timeout = 300000;\n\n this.#throttle = {\n slotInterval: SLOT_INTERVAL,\n maxAttempts: MAX_ATTEMPTS\n };\n\n this.#getUrlFunc = null;\n }\n\n toString(): string {\n return ``;\n }\n\n /**\n * Update the throttle parameters used to determine maximum\n * attempts and exponential-backoff properties.\n */\n setThrottleParams(params: FetchThrottleParams): void {\n if (params.slotInterval != null) {\n this.#throttle.slotInterval = params.slotInterval;\n }\n if (params.maxAttempts != null) {\n this.#throttle.maxAttempts = params.maxAttempts;\n }\n }\n\n async #send(attempt: number, expires: number, delay: number, _request: FetchRequest, _response: FetchResponse): Promise {\n if (attempt >= this.#throttle.maxAttempts) {\n return _response.makeServerError(\"exceeded maximum retry limit\");\n }\n\n assert(getTime() <= expires, \"timeout\", \"TIMEOUT\", {\n operation: \"request.send\", reason: \"timeout\", request: _request\n });\n\n if (delay > 0) { await wait(delay); }\n\n let req = this.clone();\n const scheme = (req.url.split(\":\")[0] || \"\").toLowerCase();\n\n // Process any Gateways\n if (scheme in Gateways) {\n const result = await Gateways[scheme](req.url, checkSignal(_request.#signal));\n if (result instanceof FetchResponse) {\n let response = result;\n\n if (this.processFunc) {\n checkSignal(_request.#signal);\n try {\n response = await this.processFunc(req, response);\n } catch (error: any) {\n\n // Something went wrong during processing; throw a 5xx server error\n if (error.throttle == null || typeof(error.stall) !== \"number\") {\n response.makeServerError(\"error in post-processing function\", error).assertOk();\n }\n\n // Ignore throttling\n }\n }\n\n return response;\n }\n req = result;\n }\n\n // We have a preflight function; update the request\n if (this.preflightFunc) { req = await this.preflightFunc(req); }\n\n const resp = await this.getUrlFunc(req, checkSignal(_request.#signal));\n let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request);\n\n if (response.statusCode === 301 || response.statusCode === 302) {\n\n // Redirect\n try {\n const location = response.headers.location || \"\";\n return req.redirect(location).#send(attempt + 1, expires, 0, _request, response);\n } catch (error) { }\n\n // Things won't get any better on another attempt; abort\n return response;\n\n } else if (response.statusCode === 429) {\n\n // Throttle\n if (this.retryFunc == null || (await this.retryFunc(req, response, attempt))) {\n const retryAfter = response.headers[\"retry-after\"];\n let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt));\n if (typeof(retryAfter) === \"string\" && retryAfter.match(/^[1-9][0-9]*$/)) {\n delay = parseInt(retryAfter);\n }\n return req.clone().#send(attempt + 1, expires, delay, _request, response);\n }\n }\n\n if (this.processFunc) {\n checkSignal(_request.#signal);\n try {\n response = await this.processFunc(req, response);\n } catch (error: any) {\n\n // Something went wrong during processing; throw a 5xx server error\n if (error.throttle == null || typeof(error.stall) !== \"number\") {\n response.makeServerError(\"error in post-processing function\", error).assertOk();\n }\n\n // Throttle\n let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt));;\n if (error.stall >= 0) { delay = error.stall; }\n\n return req.clone().#send(attempt + 1, expires, delay, _request, response);\n }\n }\n\n return response;\n }\n\n /**\n * Resolves to the response by sending the request.\n */\n send(): Promise {\n assert(this.#signal == null, \"request already sent\", \"UNSUPPORTED_OPERATION\", { operation: \"fetchRequest.send\" });\n this.#signal = new FetchCancelSignal(this);\n return this.#send(0, getTime() + this.timeout, 0, this, new FetchResponse(0, \"\", { }, null, this));\n }\n\n /**\n * Cancels the inflight response, causing a ``CANCELLED``\n * error to be rejected from the [[send]].\n */\n cancel(): void {\n assert(this.#signal != null, \"request has not been sent\", \"UNSUPPORTED_OPERATION\", { operation: \"fetchRequest.cancel\" });\n const signal = fetchSignals.get(this);\n if (!signal) { throw new Error(\"missing signal; should not happen\"); }\n signal();\n }\n\n /**\n * Returns a new [[FetchRequest]] that represents the redirection\n * to %%location%%.\n */\n redirect(location: string): FetchRequest {\n // Redirection; for now we only support absolute locations\n const current = this.url.split(\":\")[0].toLowerCase();\n const target = location.split(\":\")[0].toLowerCase();\n\n // Don't allow redirecting:\n // - non-GET requests\n // - downgrading the security (e.g. https => http)\n // - to non-HTTP (or non-HTTPS) protocols [this could be relaxed?]\n assert(this.method === \"GET\" && (current !== \"https\" || target !== \"http\") && location.match(/^https?:/), `unsupported redirect`, \"UNSUPPORTED_OPERATION\", {\n operation: `redirect(${ this.method } ${ JSON.stringify(this.url) } => ${ JSON.stringify(location) })`\n });\n\n // Create a copy of this request, with a new URL\n const req = new FetchRequest(location);\n req.method = \"GET\";\n req.allowGzip = this.allowGzip;\n req.timeout = this.timeout;\n req.#headers = Object.assign({ }, this.#headers);\n if (this.#body) { req.#body = new Uint8Array(this.#body); }\n req.#bodyType = this.#bodyType;\n\n // Do not forward credentials unless on the same domain; only absolute\n //req.allowInsecure = false;\n // paths are currently supported; may want a way to specify to forward?\n //setStore(req.#props, \"creds\", getStore(this.#pros, \"creds\"));\n\n return req;\n }\n\n /**\n * Create a new copy of this request.\n */\n clone(): FetchRequest {\n const clone = new FetchRequest(this.url);\n\n // Preserve \"default method\" (i.e. null)\n clone.#method = this.#method;\n\n // Preserve \"default body\" with type, copying the Uint8Array is present\n if (this.#body) { clone.#body = this.#body; }\n clone.#bodyType = this.#bodyType;\n\n // Preserve \"default headers\"\n clone.#headers = Object.assign({ }, this.#headers);\n\n // Credentials is readonly, so we copy internally\n clone.#creds = this.#creds;\n\n if (this.allowGzip) { clone.allowGzip = true; }\n\n clone.timeout = this.timeout;\n if (this.allowInsecureAuthentication) { clone.allowInsecureAuthentication = true; }\n\n clone.#preflight = this.#preflight;\n clone.#process = this.#process;\n clone.#retry = this.#retry;\n\n clone.#getUrlFunc = this.#getUrlFunc;\n\n return clone;\n }\n\n /**\n * Locks all static configuration for gateways and FetchGetUrlFunc\n * registration.\n */\n static lockConfig(): void {\n locked = true;\n }\n\n /**\n * Get the current Gateway function for %%scheme%%.\n */\n static getGateway(scheme: string): null | FetchGatewayFunc {\n return Gateways[scheme.toLowerCase()] || null;\n }\n\n /**\n * Use the %%func%% when fetching URIs using %%scheme%%.\n *\n * This method affects all requests globally.\n *\n * If [[lockConfig]] has been called, no change is made and this\n * throws.\n */\n static registerGateway(scheme: string, func: FetchGatewayFunc): void {\n scheme = scheme.toLowerCase();\n if (scheme === \"http\" || scheme === \"https\") {\n throw new Error(`cannot intercept ${ scheme }; use registerGetUrl`);\n }\n if (locked) { throw new Error(\"gateways locked\"); }\n Gateways[scheme] = func;\n }\n\n /**\n * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests.\n *\n * This method affects all requests globally.\n *\n * If [[lockConfig]] has been called, no change is made and this\n * throws.\n */\n static registerGetUrl(getUrl: FetchGetUrlFunc): void {\n if (locked) { throw new Error(\"gateways locked\"); }\n defaultGetUrlFunc = getUrl;\n }\n\n /**\n * Creates a getUrl function that fetches content from HTTP and\n * HTTPS URLs.\n *\n * The available %%options%% are dependent on the platform\n * implementation of the default getUrl function.\n *\n * This is not generally something that is needed, but is useful\n * when trying to customize simple behaviour when fetching HTTP\n * content.\n */\n static createGetUrlFunc(options?: Record): FetchGetUrlFunc {\n return createGetUrl(options);\n }\n\n /**\n * Creates a function that can \"fetch\" data URIs.\n *\n * Note that this is automatically done internally to support\n * data URIs, so it is not necessary to register it.\n *\n * This is not generally something that is needed, but may\n * be useful in a wrapper to perfom custom data URI functionality.\n */\n static createDataGateway(): FetchGatewayFunc {\n return dataGatewayFunc;\n }\n\n /**\n * Creates a function that will fetch IPFS (unvalidated) from\n * a custom gateway baseUrl.\n *\n * The default IPFS gateway used internally is\n * ``\"https:/\\/gateway.ipfs.io/ipfs/\"``.\n */\n static createIpfsGatewayFunc(baseUrl: string): FetchGatewayFunc {\n return getIpfsGatewayFunc(baseUrl);\n }\n}\n\n\ninterface ThrottleError extends Error {\n stall: number;\n throttle: true;\n};\n\n/**\n * The response for a FetchRequest.\n */\nexport class FetchResponse implements Iterable<[ key: string, value: string ]> {\n #statusCode: number;\n #statusMessage: string;\n #headers: Record;\n #body: null | Readonly;\n #request: null | FetchRequest;\n\n #error: { error?: Error, message: string };\n\n toString(): string {\n return ``;\n }\n\n /**\n * The response status code.\n */\n get statusCode(): number { return this.#statusCode; }\n\n /**\n * The response status message.\n */\n get statusMessage(): string { return this.#statusMessage; }\n\n /**\n * The response headers. All keys are lower-case.\n */\n get headers(): Record { return Object.assign({ }, this.#headers); }\n\n /**\n * The response body, or ``null`` if there was no body.\n */\n get body(): null | Readonly {\n return (this.#body == null) ? null: new Uint8Array(this.#body);\n }\n\n /**\n * The response body as a UTF-8 encoded string, or the empty\n * string (i.e. ``\"\"``) if there was no body.\n *\n * An error is thrown if the body is invalid UTF-8 data.\n */\n get bodyText(): string {\n try {\n return (this.#body == null) ? \"\": toUtf8String(this.#body);\n } catch (error) {\n assert(false, \"response body is not valid UTF-8 data\", \"UNSUPPORTED_OPERATION\", {\n operation: \"bodyText\", info: { response: this }\n });\n }\n }\n\n /**\n * The response body, decoded as JSON.\n *\n * An error is thrown if the body is invalid JSON-encoded data\n * or if there was no body.\n */\n get bodyJson(): any {\n try {\n return JSON.parse(this.bodyText);\n } catch (error) {\n assert(false, \"response body is not valid JSON\", \"UNSUPPORTED_OPERATION\", {\n operation: \"bodyJson\", info: { response: this }\n });\n }\n }\n\n [Symbol.iterator](): Iterator<[ key: string, value: string ]> {\n const headers = this.headers;\n const keys = Object.keys(headers);\n let index = 0;\n return {\n next: () => {\n if (index < keys.length) {\n const key = keys[index++];\n return {\n value: [ key, headers[key] ], done: false\n }\n }\n return { value: undefined, done: true };\n }\n };\n }\n\n constructor(statusCode: number, statusMessage: string, headers: Readonly>, body: null | Uint8Array, request?: FetchRequest) {\n this.#statusCode = statusCode;\n this.#statusMessage = statusMessage;\n this.#headers = Object.keys(headers).reduce((accum, k) => {\n accum[k.toLowerCase()] = String(headers[k]);\n return accum;\n }, >{ });\n this.#body = ((body == null) ? null: new Uint8Array(body));\n this.#request = (request || null);\n\n this.#error = { message: \"\" };\n }\n\n /**\n * Return a Response with matching headers and body, but with\n * an error status code (i.e. 599) and %%message%% with an\n * optional %%error%%.\n */\n makeServerError(message?: string, error?: Error): FetchResponse {\n let statusMessage: string;\n if (!message) {\n message = `${ this.statusCode } ${ this.statusMessage }`;\n statusMessage = `CLIENT ESCALATED SERVER ERROR (${ message })`;\n } else {\n statusMessage = `CLIENT ESCALATED SERVER ERROR (${ this.statusCode } ${ this.statusMessage }; ${ message })`;\n }\n const response = new FetchResponse(599, statusMessage, this.headers,\n this.body, this.#request || undefined);\n response.#error = { message, error };\n return response;\n }\n\n /**\n * If called within a [request.processFunc](FetchRequest-processFunc)\n * call, causes the request to retry as if throttled for %%stall%%\n * milliseconds.\n */\n throwThrottleError(message?: string, stall?: number): never {\n if (stall == null) {\n stall = -1;\n } else {\n assertArgument(Number.isInteger(stall) && stall >= 0, \"invalid stall timeout\", \"stall\", stall);\n }\n\n const error = new Error(message || \"throttling requests\");\n\n defineProperties(error, { stall, throttle: true });\n\n throw error;\n }\n\n /**\n * Get the header value for %%key%%, ignoring case.\n */\n getHeader(key: string): string {\n return this.headers[key.toLowerCase()];\n }\n\n /**\n * Returns true if the response has a body.\n */\n hasBody(): this is (FetchResponse & { body: Uint8Array }) {\n return (this.#body != null);\n }\n\n /**\n * The request made for this response.\n */\n get request(): null | FetchRequest { return this.#request; }\n\n /**\n * Returns true if this response was a success statusCode.\n */\n ok(): boolean {\n return (this.#error.message === \"\" && this.statusCode >= 200 && this.statusCode < 300);\n }\n\n /**\n * Throws a ``SERVER_ERROR`` if this response is not ok.\n */\n assertOk(): void {\n if (this.ok()) { return; }\n let { message, error } = this.#error;\n if (message === \"\") {\n message = `server response ${ this.statusCode } ${ this.statusMessage }`;\n }\n\n let requestUrl: null | string = null;\n if (this.request) { requestUrl = this.request.url; }\n\n let responseBody: null | string = null;\n try {\n if (this.#body) { responseBody = toUtf8String(this.#body); }\n } catch (e) { }\n\n assert(false, message, \"SERVER_ERROR\", {\n request: (this.request || \"unknown request\"), response: this, error,\n info: {\n requestUrl, responseBody,\n responseStatus: `${ this.statusCode } ${ this.statusMessage }` }\n });\n }\n}\n\n\nfunction getTime(): number { return (new Date()).getTime(); }\n\nfunction unpercent(value: string): Uint8Array {\n return toUtf8Bytes(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => {\n return String.fromCharCode(parseInt(code, 16));\n }));\n}\n\nfunction wait(delay: number): Promise {\n return new Promise((resolve) => setTimeout(resolve, delay));\n}\n", "/**\n * The **FixedNumber** class permits using values with decimal places,\n * using fixed-pont math.\n *\n * Fixed-point math is still based on integers under-the-hood, but uses an\n * internal offset to store fractional components below, and each operation\n * corrects for this after each operation.\n *\n * @_section: api/utils/fixed-point-math:Fixed-Point Maths [about-fixed-point-math]\n */\nimport { getBytes } from \"./data.js\";\nimport { assert, assertArgument, assertPrivate } from \"./errors.js\";\nimport {\n getBigInt, getNumber, fromTwos, mask, toBigInt\n} from \"./maths.js\";\nimport { defineProperties } from \"./properties.js\";\n\nimport type { BigNumberish, BytesLike, Numeric } from \"./index.js\";\n\nconst BN_N1 = BigInt(-1);\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_5 = BigInt(5);\n\nconst _guard = { };\n\n\n// Constant to pull zeros from for multipliers\nlet Zeros = \"0000\";\nwhile (Zeros.length < 80) { Zeros += Zeros; }\n\n// Returns a string \"1\" followed by decimal \"0\"s\nfunction getTens(decimals: number): bigint {\n let result = Zeros;\n while (result.length < decimals) { result += result; }\n return BigInt(\"1\" + result.substring(0, decimals));\n}\n\n\n\n /*\n * Returns a new FixedFormat for %%value%%.\n *\n * If %%value%% is specified as a ``number``, the bit-width is\n * 128 bits and %%value%% is used for the ``decimals``.\n *\n * A string %%value%% may begin with ``fixed`` or ``ufixed``\n * for signed and unsigned respectfully. If no other properties\n * are specified, the bit-width is 128-bits with 18 decimals.\n *\n * To specify the bit-width and demicals, append them separated\n * by an ``\"x\"`` to the %%value%%.\n *\n * For example, ``ufixed128x18`` describes an unsigned, 128-bit\n * wide format with 18 decimals.\n *\n * If %%value%% is an other object, its properties for ``signed``,\n * ``width`` and ``decimals`` are checked.\n */\n\n/**\n * A description of a fixed-point arithmetic field.\n *\n * When specifying the fixed format, the values override the default of\n * a ``fixed128x18``, which implies a signed 128-bit value with 18\n * decimals of precision.\n *\n * The alias ``fixed`` and ``ufixed`` can be used for ``fixed128x18`` and\n * ``ufixed128x18`` respectively.\n *\n * When a fixed format string begins with a ``u``, it indicates the field\n * is unsigned, so any negative values will overflow. The first number\n * indicates the bit-width and the second number indicates the decimal\n * precision.\n *\n * When a ``number`` is used for a fixed format, it indicates the number\n * of decimal places, and the default width and signed-ness will be used.\n *\n * The bit-width must be byte aligned and the decimals can be at most 80.\n */\nexport type FixedFormat = number | string | {\n signed?: boolean,\n width?: number,\n decimals?: number\n};\n\nfunction checkValue(val: bigint, format: _FixedFormat, safeOp?: string): bigint {\n const width = BigInt(format.width);\n if (format.signed) {\n const limit = (BN_1 << (width - BN_1));\n assert(safeOp == null || (val >= -limit && val < limit), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp, fault: \"overflow\", value: val\n });\n\n if (val > BN_0) {\n val = fromTwos(mask(val, width), width);\n } else {\n val = -fromTwos(mask(-val, width), width);\n }\n\n } else {\n const limit = (BN_1 << width);\n assert(safeOp == null || (val >= 0 && val < limit), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp, fault: \"overflow\", value: val\n });\n val = (((val % limit) + limit) % limit) & (limit - BN_1);\n }\n\n return val;\n}\n\ntype _FixedFormat = { signed: boolean, width: number, decimals: number, name: string }\n\nfunction getFormat(value?: FixedFormat): _FixedFormat {\n if (typeof(value) === \"number\") { value = `fixed128x${value}` }\n\n let signed = true;\n let width = 128;\n let decimals = 18;\n\n if (typeof(value) === \"string\") {\n // Parse the format string\n if (value === \"fixed\") {\n // defaults...\n } else if (value === \"ufixed\") {\n signed = false;\n } else {\n const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);\n assertArgument(match, \"invalid fixed format\", \"format\", value);\n signed = (match[1] !== \"u\");\n width = parseInt(match[2]);\n decimals = parseInt(match[3]);\n }\n } else if (value) {\n // Extract the values from the object\n const v: any = value;\n const check = (key: string, type: string, defaultValue: any): any => {\n if (v[key] == null) { return defaultValue; }\n assertArgument(typeof(v[key]) === type,\n \"invalid fixed format (\" + key + \" not \" + type +\")\", \"format.\" + key, v[key]);\n return v[key];\n }\n signed = check(\"signed\", \"boolean\", signed);\n width = check(\"width\", \"number\", width);\n decimals = check(\"decimals\", \"number\", decimals);\n }\n\n assertArgument((width % 8) === 0, \"invalid FixedNumber width (not byte aligned)\", \"format.width\", width);\n assertArgument(decimals <= 80, \"invalid FixedNumber decimals (too large)\", \"format.decimals\", decimals);\n\n const name = (signed ? \"\": \"u\") + \"fixed\" + String(width) + \"x\" + String(decimals);\n\n return { signed, width, decimals, name };\n}\n\nfunction toString(val: bigint, decimals: number) {\n let negative = \"\";\n if (val < BN_0) {\n negative = \"-\";\n val *= BN_N1;\n }\n\n let str = val.toString();\n\n // No decimal point for whole values\n if (decimals === 0) { return (negative + str); }\n\n // Pad out to the whole component (including a whole digit)\n while (str.length <= decimals) { str = Zeros + str; }\n\n // Insert the decimal point\n const index = str.length - decimals;\n str = str.substring(0, index) + \".\" + str.substring(index);\n\n // Trim the whole component (leaving at least one 0)\n while (str[0] === \"0\" && str[1] !== \".\") {\n str = str.substring(1);\n }\n\n // Trim the decimal component (leaving at least one 0)\n while (str[str.length - 1] === \"0\" && str[str.length - 2] !== \".\") {\n str = str.substring(0, str.length - 1);\n }\n\n return (negative + str);\n}\n\n\n/**\n * A FixedNumber represents a value over its [[FixedFormat]]\n * arithmetic field.\n *\n * A FixedNumber can be used to perform math, losslessly, on\n * values which have decmial places.\n *\n * A FixedNumber has a fixed bit-width to store values in, and stores all\n * values internally by multiplying the value by 10 raised to the power of\n * %%decimals%%.\n *\n * If operations are performed that cause a value to grow too high (close to\n * positive infinity) or too low (close to negative infinity), the value\n * is said to //overflow//.\n *\n * For example, an 8-bit signed value, with 0 decimals may only be within\n * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become\n * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``.\n *\n * Many operation have a normal and //unsafe// variant. The normal variant\n * will throw a [[NumericFaultError]] on any overflow, while the //unsafe//\n * variant will silently allow overflow, corrupting its value value.\n *\n * If operations are performed that cause a value to become too small\n * (close to zero), the value loses precison and is said to //underflow//.\n *\n * For example, an value with 1 decimal place may store a number as small\n * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit\n * into 1 decimal place, so underflow occurs which means precision is lost\n * and the value becomes ``0``.\n *\n * Some operations have a normal and //signalling// variant. The normal\n * variant will silently ignore underflow, while the //signalling// variant\n * will thow a [[NumericFaultError]] on underflow.\n */\nexport class FixedNumber {\n\n /**\n * The specific fixed-point arithmetic field for this value.\n */\n readonly format!: string;\n\n readonly #format: _FixedFormat;\n\n // The actual value (accounting for decimals)\n #val: bigint;\n\n // A base-10 value to multiple values by to maintain the magnitude\n readonly #tens: bigint;\n\n /**\n * This is a property so console.log shows a human-meaningful value.\n *\n * @private\n */\n readonly _value!: string;\n\n // Use this when changing this file to get some typing info,\n // but then switch to any to mask the internal type\n //constructor(guard: any, value: bigint, format: _FixedFormat) {\n\n /**\n * @private\n */\n constructor(guard: any, value: bigint, format: any) {\n assertPrivate(guard, _guard, \"FixedNumber\");\n\n this.#val = value;\n\n this.#format = format;\n\n const _value = toString(value, format.decimals);\n\n defineProperties(this, { format: format.name, _value });\n\n this.#tens = getTens(format.decimals);\n }\n\n /**\n * If true, negative values are permitted, otherwise only\n * positive values and zero are allowed.\n */\n get signed(): boolean { return this.#format.signed; }\n\n /**\n * The number of bits available to store the value.\n */\n get width(): number { return this.#format.width; }\n\n /**\n * The number of decimal places in the fixed-point arithment field.\n */\n get decimals(): number { return this.#format.decimals; }\n\n /**\n * The value as an integer, based on the smallest unit the\n * [[decimals]] allow.\n */\n get value(): bigint { return this.#val; }\n\n #checkFormat(other: FixedNumber): void {\n assertArgument(this.format === other.format,\n \"incompatible format; use fixedNumber.toFormat\", \"other\", other);\n }\n\n #checkValue(val: bigint, safeOp?: string): FixedNumber {\n/*\n const width = BigInt(this.width);\n if (this.signed) {\n const limit = (BN_1 << (width - BN_1));\n assert(safeOp == null || (val >= -limit && val < limit), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp, fault: \"overflow\", value: val\n });\n\n if (val > BN_0) {\n val = fromTwos(mask(val, width), width);\n } else {\n val = -fromTwos(mask(-val, width), width);\n }\n\n } else {\n const masked = mask(val, width);\n assert(safeOp == null || (val >= 0 && val === masked), \"overflow\", \"NUMERIC_FAULT\", {\n operation: safeOp, fault: \"overflow\", value: val\n });\n val = masked;\n }\n*/\n val = checkValue(val, this.#format, safeOp);\n return new FixedNumber(_guard, val, this.#format);\n }\n\n #add(o: FixedNumber, safeOp?: string): FixedNumber {\n this.#checkFormat(o);\n return this.#checkValue(this.#val + o.#val, safeOp);\n }\n\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% added\n * to %%other%%, ignoring overflow.\n */\n addUnsafe(other: FixedNumber): FixedNumber { return this.#add(other); }\n\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% added\n * to %%other%%. A [[NumericFaultError]] is thrown if overflow\n * occurs.\n */\n add(other: FixedNumber): FixedNumber { return this.#add(other, \"add\"); }\n\n #sub(o: FixedNumber, safeOp?: string): FixedNumber {\n this.#checkFormat(o);\n return this.#checkValue(this.#val - o.#val, safeOp);\n }\n\n /**\n * Returns a new [[FixedNumber]] with the result of %%other%% subtracted\n * from %%this%%, ignoring overflow.\n */\n subUnsafe(other: FixedNumber): FixedNumber { return this.#sub(other); }\n\n /**\n * Returns a new [[FixedNumber]] with the result of %%other%% subtracted\n * from %%this%%. A [[NumericFaultError]] is thrown if overflow\n * occurs.\n */\n sub(other: FixedNumber): FixedNumber { return this.#sub(other, \"sub\"); }\n\n #mul(o: FixedNumber, safeOp?: string): FixedNumber {\n this.#checkFormat(o);\n return this.#checkValue((this.#val * o.#val) / this.#tens, safeOp);\n }\n\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% multiplied\n * by %%other%%, ignoring overflow and underflow (precision loss).\n */\n mulUnsafe(other: FixedNumber): FixedNumber { return this.#mul(other); }\n\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% multiplied\n * by %%other%%. A [[NumericFaultError]] is thrown if overflow\n * occurs.\n */\n mul(other: FixedNumber): FixedNumber { return this.#mul(other, \"mul\"); }\n\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% multiplied\n * by %%other%%. A [[NumericFaultError]] is thrown if overflow\n * occurs or if underflow (precision loss) occurs.\n */\n mulSignal(other: FixedNumber): FixedNumber {\n this.#checkFormat(other);\n const value = this.#val * other.#val;\n assert((value % this.#tens) === BN_0, \"precision lost during signalling mul\", \"NUMERIC_FAULT\", {\n operation: \"mulSignal\", fault: \"underflow\", value: this\n });\n return this.#checkValue(value / this.#tens, \"mulSignal\");\n }\n\n #div(o: FixedNumber, safeOp?: string): FixedNumber {\n assert(o.#val !== BN_0, \"division by zero\", \"NUMERIC_FAULT\", {\n operation: \"div\", fault: \"divide-by-zero\", value: this\n });\n this.#checkFormat(o);\n return this.#checkValue((this.#val * this.#tens) / o.#val, safeOp);\n }\n\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% divided\n * by %%other%%, ignoring underflow (precision loss). A\n * [[NumericFaultError]] is thrown if overflow occurs.\n */\n divUnsafe(other: FixedNumber): FixedNumber { return this.#div(other); }\n\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% divided\n * by %%other%%, ignoring underflow (precision loss). A\n * [[NumericFaultError]] is thrown if overflow occurs.\n */\n div(other: FixedNumber): FixedNumber { return this.#div(other, \"div\"); }\n\n\n /**\n * Returns a new [[FixedNumber]] with the result of %%this%% divided\n * by %%other%%. A [[NumericFaultError]] is thrown if underflow\n * (precision loss) occurs.\n */\n divSignal(other: FixedNumber): FixedNumber {\n assert(other.#val !== BN_0, \"division by zero\", \"NUMERIC_FAULT\", {\n operation: \"div\", fault: \"divide-by-zero\", value: this\n });\n this.#checkFormat(other);\n const value = (this.#val * this.#tens);\n assert((value % other.#val) === BN_0, \"precision lost during signalling div\", \"NUMERIC_FAULT\", {\n operation: \"divSignal\", fault: \"underflow\", value: this\n });\n return this.#checkValue(value / other.#val, \"divSignal\");\n }\n\n /**\n * Returns a comparison result between %%this%% and %%other%%.\n *\n * This is suitable for use in sorting, where ``-1`` implies %%this%%\n * is smaller, ``1`` implies %%this%% is larger and ``0`` implies\n * both are equal.\n */\n cmp(other: FixedNumber): number {\n let a = this.value, b = other.value;\n\n // Coerce a and b to the same magnitude\n const delta = this.decimals - other.decimals;\n if (delta > 0) {\n b *= getTens(delta);\n } else if (delta < 0) {\n a *= getTens(-delta);\n }\n\n // Comnpare\n if (a < b) { return -1; }\n if (a > b) { return 1; }\n return 0;\n }\n\n /**\n * Returns true if %%other%% is equal to %%this%%.\n */\n eq(other: FixedNumber): boolean { return this.cmp(other) === 0; }\n\n /**\n * Returns true if %%other%% is less than to %%this%%.\n */\n lt(other: FixedNumber): boolean { return this.cmp(other) < 0; }\n\n /**\n * Returns true if %%other%% is less than or equal to %%this%%.\n */\n lte(other: FixedNumber): boolean { return this.cmp(other) <= 0; }\n\n /**\n * Returns true if %%other%% is greater than to %%this%%.\n */\n gt(other: FixedNumber): boolean { return this.cmp(other) > 0; }\n\n /**\n * Returns true if %%other%% is greater than or equal to %%this%%.\n */\n gte(other: FixedNumber): boolean { return this.cmp(other) >= 0; }\n\n /**\n * Returns a new [[FixedNumber]] which is the largest **integer**\n * that is less than or equal to %%this%%.\n *\n * The decimal component of the result will always be ``0``.\n */\n floor(): FixedNumber {\n let val = this.#val;\n if (this.#val < BN_0) { val -= this.#tens - BN_1; }\n val = (this.#val / this.#tens) * this.#tens;\n return this.#checkValue(val, \"floor\");\n }\n\n /**\n * Returns a new [[FixedNumber]] which is the smallest **integer**\n * that is greater than or equal to %%this%%.\n *\n * The decimal component of the result will always be ``0``.\n */\n ceiling(): FixedNumber {\n let val = this.#val;\n if (this.#val > BN_0) { val += this.#tens - BN_1; }\n val = (this.#val / this.#tens) * this.#tens;\n return this.#checkValue(val, \"ceiling\");\n }\n\n /**\n * Returns a new [[FixedNumber]] with the decimal component\n * rounded up on ties at %%decimals%% places.\n */\n round(decimals?: number): FixedNumber {\n if (decimals == null) { decimals = 0; }\n\n // Not enough precision to not already be rounded\n if (decimals >= this.decimals) { return this; }\n\n const delta = this.decimals - decimals;\n const bump = BN_5 * getTens(delta - 1);\n\n let value = this.value + bump;\n const tens = getTens(delta);\n value = (value / tens) * tens;\n\n checkValue(value, this.#format, \"round\");\n\n return new FixedNumber(_guard, value, this.#format);\n }\n\n /**\n * Returns true if %%this%% is equal to ``0``.\n */\n isZero(): boolean { return (this.#val === BN_0); }\n\n /**\n * Returns true if %%this%% is less than ``0``.\n */\n isNegative(): boolean { return (this.#val < BN_0); }\n\n /**\n * Returns the string representation of %%this%%.\n */\n toString(): string { return this._value; }\n\n /**\n * Returns a float approximation.\n *\n * Due to IEEE 754 precission (or lack thereof), this function\n * can only return an approximation and most values will contain\n * rounding errors.\n */\n toUnsafeFloat(): number { return parseFloat(this.toString()); }\n\n /**\n * Return a new [[FixedNumber]] with the same value but has had\n * its field set to %%format%%.\n *\n * This will throw if the value cannot fit into %%format%%.\n */\n toFormat(format: FixedFormat): FixedNumber {\n return FixedNumber.fromString(this.toString(), format);\n }\n\n /**\n * Creates a new [[FixedNumber]] for %%value%% divided by\n * %%decimal%% places with %%format%%.\n *\n * This will throw a [[NumericFaultError]] if %%value%% (once adjusted\n * for %%decimals%%) cannot fit in %%format%%, either due to overflow\n * or underflow (precision loss).\n */\n static fromValue(_value: BigNumberish, _decimals?: Numeric, _format?: FixedFormat): FixedNumber {\n const decimals = (_decimals == null) ? 0: getNumber(_decimals);\n const format = getFormat(_format);\n\n let value = getBigInt(_value, \"value\");\n const delta = decimals - format.decimals;\n if (delta > 0) {\n const tens = getTens(delta);\n assert((value % tens) === BN_0, \"value loses precision for format\", \"NUMERIC_FAULT\", {\n operation: \"fromValue\", fault: \"underflow\", value: _value\n });\n value /= tens;\n } else if (delta < 0) {\n value *= getTens(-delta);\n }\n\n checkValue(value, format, \"fromValue\");\n\n return new FixedNumber(_guard, value, format);\n }\n\n /**\n * Creates a new [[FixedNumber]] for %%value%% with %%format%%.\n *\n * This will throw a [[NumericFaultError]] if %%value%% cannot fit\n * in %%format%%, either due to overflow or underflow (precision loss).\n */\n static fromString(_value: string, _format?: FixedFormat): FixedNumber {\n const match = _value.match(/^(-?)([0-9]*)\\.?([0-9]*)$/);\n assertArgument(match && (match[2].length + match[3].length) > 0, \"invalid FixedNumber string value\", \"value\", _value);\n\n const format = getFormat(_format);\n\n let whole = (match[2] || \"0\"), decimal = (match[3] || \"\");\n\n // Pad out the decimals\n while (decimal.length < format.decimals) { decimal += Zeros; }\n\n // Check precision is safe\n assert(decimal.substring(format.decimals).match(/^0*$/), \"too many decimals for format\", \"NUMERIC_FAULT\", {\n operation: \"fromString\", fault: \"underflow\", value: _value\n });\n\n // Remove extra padding\n decimal = decimal.substring(0, format.decimals);\n\n const value = BigInt(match[1] + whole + decimal)\n\n checkValue(value, format, \"fromString\");\n\n return new FixedNumber(_guard, value, format);\n }\n\n /**\n * Creates a new [[FixedNumber]] with the big-endian representation\n * %%value%% with %%format%%.\n *\n * This will throw a [[NumericFaultError]] if %%value%% cannot fit\n * in %%format%% due to overflow.\n */\n static fromBytes(_value: BytesLike, _format?: FixedFormat): FixedNumber {\n let value = toBigInt(getBytes(_value, \"value\"));\n const format = getFormat(_format);\n\n if (format.signed) { value = fromTwos(value, format.width); }\n\n checkValue(value, format, \"fromBytes\");\n\n return new FixedNumber(_guard, value, format);\n }\n}\n\n//const f1 = FixedNumber.fromString(\"12.56\", \"fixed16x2\");\n//const f2 = FixedNumber.fromString(\"0.3\", \"fixed16x2\");\n//console.log(f1.divSignal(f2));\n//const BUMP = FixedNumber.from(\"0.5\");\n", "//See: https://github.com/ethereum/wiki/wiki/RLP\n\nimport { hexlify } from \"./data.js\";\nimport { assert, assertArgument } from \"./errors.js\";\nimport { getBytes } from \"./data.js\";\n\nimport type { BytesLike, RlpStructuredData } from \"./index.js\";\n\n\nfunction hexlifyByte(value: number): string {\n let result = value.toString(16);\n while (result.length < 2) { result = \"0\" + result; }\n return \"0x\" + result;\n}\n\nfunction unarrayifyInteger(data: Uint8Array, offset: number, length: number): number {\n let result = 0;\n for (let i = 0; i < length; i++) {\n result = (result * 256) + data[offset + i];\n }\n return result;\n}\n\ntype Decoded = {\n result: any;\n consumed: number;\n};\n\nfunction _decodeChildren(data: Uint8Array, offset: number, childOffset: number, length: number): Decoded {\n const result: Array = [];\n\n while (childOffset < offset + 1 + length) {\n const decoded = _decode(data, childOffset);\n\n result.push(decoded.result);\n\n childOffset += decoded.consumed;\n assert(childOffset <= offset + 1 + length, \"child data too short\", \"BUFFER_OVERRUN\", {\n buffer: data, length, offset\n });\n }\n\n return {consumed: (1 + length), result: result};\n}\n\n// returns { consumed: number, result: Object }\nfunction _decode(data: Uint8Array, offset: number): { consumed: number, result: any } {\n assert(data.length !== 0, \"data too short\", \"BUFFER_OVERRUN\", {\n buffer: data, length: 0, offset: 1\n });\n\n const checkOffset = (offset: number) => {\n assert(offset <= data.length, \"data short segment too short\", \"BUFFER_OVERRUN\", {\n buffer: data, length: data.length, offset\n });\n };\n\n // Array with extra length prefix\n if (data[offset] >= 0xf8) {\n const lengthLength = data[offset] - 0xf7;\n checkOffset(offset + 1 + lengthLength);\n\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n checkOffset(offset + 1 + lengthLength + length);\n\n return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length);\n\n } else if (data[offset] >= 0xc0) {\n const length = data[offset] - 0xc0;\n checkOffset(offset + 1 + length);\n\n return _decodeChildren(data, offset, offset + 1, length);\n\n } else if (data[offset] >= 0xb8) {\n const lengthLength = data[offset] - 0xb7;\n checkOffset(offset + 1 + lengthLength);\n\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n checkOffset(offset + 1 + lengthLength + length);\n\n const result = hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length));\n return { consumed: (1 + lengthLength + length), result: result }\n\n } else if (data[offset] >= 0x80) {\n const length = data[offset] - 0x80;\n checkOffset(offset + 1 + length);\n\n const result = hexlify(data.slice(offset + 1, offset + 1 + length));\n return { consumed: (1 + length), result: result }\n }\n\n return { consumed: 1, result: hexlifyByte(data[offset]) };\n}\n\n/**\n * Decodes %%data%% into the structured data it represents.\n */\nexport function decodeRlp(_data: BytesLike): RlpStructuredData {\n const data = getBytes(_data, \"data\");\n const decoded = _decode(data, 0);\n assertArgument(decoded.consumed === data.length, \"unexpected junk after rlp payload\", \"data\", _data);\n return decoded.result;\n}\n\n", "//See: https://github.com/ethereum/wiki/wiki/RLP\n\nimport { getBytes } from \"./data.js\";\n\nimport type { RlpStructuredDataish } from \"./rlp.js\";\n\n\nfunction arrayifyInteger(value: number): Array {\n const result: Array = [];\n while (value) {\n result.unshift(value & 0xff);\n value >>= 8;\n }\n return result;\n}\n\nfunction _encode(object: Array | string | Uint8Array): Array {\n if (Array.isArray(object)) {\n let payload: Array = [];\n object.forEach(function(child) {\n payload = payload.concat(_encode(child));\n });\n\n if (payload.length <= 55) {\n payload.unshift(0xc0 + payload.length)\n return payload;\n }\n\n const length = arrayifyInteger(payload.length);\n length.unshift(0xf7 + length.length);\n\n return length.concat(payload);\n\n }\n\n const data: Array = Array.prototype.slice.call(getBytes(object, \"object\"));\n\n if (data.length === 1 && data[0] <= 0x7f) {\n return data;\n\n } else if (data.length <= 55) {\n data.unshift(0x80 + data.length);\n return data;\n }\n\n const length = arrayifyInteger(data.length);\n length.unshift(0xb7 + length.length);\n\n return length.concat(data);\n}\n\nconst nibbles = \"0123456789abcdef\";\n\n/**\n * Encodes %%object%% as an RLP-encoded [[DataHexString]].\n */\nexport function encodeRlp(object: RlpStructuredDataish): string {\n let result = \"0x\";\n for (const v of _encode(object)) {\n result += nibbles[v >> 4];\n result += nibbles[v & 0xf];\n }\n return result;\n}\n", "/**\n * Most interactions with Ethereum requires integer values, which use\n * the smallest magnitude unit.\n *\n * For example, imagine dealing with dollars and cents. Since dollars\n * are divisible, non-integer values are possible, such as ``$10.77``.\n * By using the smallest indivisible unit (i.e. cents), the value can\n * be kept as the integer ``1077``.\n *\n * When receiving decimal input from the user (as a decimal string),\n * the value should be converted to an integer and when showing a user\n * a value, the integer value should be converted to a decimal string.\n *\n * This creates a clear distinction, between values to be used by code\n * (integers) and values used for display logic to users (decimals).\n *\n * The native unit in Ethereum, //ether// is divisible to 18 decimal places,\n * where each individual unit is called a //wei//.\n *\n * @_subsection api/utils:Unit Conversion [about-units]\n */\nimport { assertArgument } from \"./errors.js\";\nimport { FixedNumber } from \"./fixednumber.js\";\nimport { getNumber } from \"./maths.js\";\n\nimport type { BigNumberish, Numeric } from \"../utils/index.js\";\n\n\nconst names = [\n \"wei\",\n \"kwei\",\n \"mwei\",\n \"gwei\",\n \"szabo\",\n \"finney\",\n \"ether\",\n];\n\n/**\n * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal\n * places. The %%unit%% may be the number of decimal places or the name of\n * a unit (e.g. ``\"gwei\"`` for 9 decimal places).\n *\n */\nexport function formatUnits(value: BigNumberish, unit?: string | Numeric): string {\n let decimals = 18;\n if (typeof(unit) === \"string\") {\n const index = names.indexOf(unit);\n assertArgument(index >= 0, \"invalid unit\", \"unit\", unit);\n decimals = 3 * index;\n } else if (unit != null) {\n decimals = getNumber(unit, \"unit\");\n }\n\n return FixedNumber.fromValue(value, decimals, { decimals, width: 512 }).toString();\n}\n\n/**\n * Converts the //decimal string// %%value%% to a BigInt, assuming\n * %%unit%% decimal places. The %%unit%% may the number of decimal places\n * or the name of a unit (e.g. ``\"gwei\"`` for 9 decimal places).\n */\nexport function parseUnits(value: string, unit?: string | Numeric): bigint {\n assertArgument(typeof(value) === \"string\", \"value must be a string\", \"value\", value);\n\n let decimals = 18;\n if (typeof(unit) === \"string\") {\n const index = names.indexOf(unit);\n assertArgument(index >= 0, \"invalid unit\", \"unit\", unit);\n decimals = 3 * index;\n } else if (unit != null) {\n decimals = getNumber(unit, \"unit\");\n }\n\n return FixedNumber.fromString(value, { decimals, width: 512 }).value;\n}\n\n/**\n * Converts %%value%% into a //decimal string// using 18 decimal places.\n */\nexport function formatEther(wei: BigNumberish): string {\n return formatUnits(wei, 18);\n}\n\n/**\n * Converts the //decimal string// %%ether%% to a BigInt, using 18\n * decimal places.\n */\nexport function parseEther(ether: string): bigint {\n return parseUnits(ether, 18);\n}\n", "/**\n * Explain UUID and link to RFC here.\n *\n * @_subsection: api/utils:UUID [about-uuid]\n */\nimport { getBytes, hexlify } from \"./data.js\";\n\nimport type { BytesLike } from \"./index.js\";\n\n/**\n * Returns the version 4 [[link-uuid]] for the %%randomBytes%%.\n *\n * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4)\n */\nexport function uuidV4(randomBytes: BytesLike): string {\n const bytes = getBytes(randomBytes, \"randomBytes\");\n\n // Section: 4.1.3:\n // - time_hi_and_version[12:16] = 0b0100\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n\n // Section 4.4\n // - clock_seq_hi_and_reserved[6] = 0b0\n // - clock_seq_hi_and_reserved[7] = 0b1\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n\n const value = hexlify(bytes);\n\n return [\n value.substring(2, 10),\n value.substring(10, 14),\n value.substring(14, 18),\n value.substring(18, 22),\n value.substring(22, 34),\n ].join(\"-\");\n}\n", "\nimport {\n defineProperties, concat, getBytesCopy, getNumber, hexlify,\n toBeArray, toBigInt, toNumber,\n assert, assertArgument\n} from \"../../utils/index.js\";\n\nimport type { BigNumberish, BytesLike } from \"../../utils/index.js\";\n\n/**\n * @_ignore:\n */\nexport const WordSize: number = 32;\nconst Padding = new Uint8Array(WordSize);\n\n// Properties used to immediate pass through to the underlying object\n// - `then` is used to detect if an object is a Promise for await\nconst passProperties = [ \"then\" ];\n\nconst _guard = { };\n\nfunction throwError(name: string, error: Error): never {\n const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${ name }`);\n (wrapped).error = error;\n throw wrapped;\n}\n\n/**\n * A [[Result]] is a sub-class of Array, which allows accessing any\n * of its values either positionally by its index or, if keys are\n * provided by its name.\n *\n * @_docloc: api/abi\n */\nexport class Result extends Array {\n readonly #names: ReadonlyArray;\n\n [ K: string | number ]: any\n\n /**\n * @private\n */\n constructor(...args: Array) {\n // To properly sub-class Array so the other built-in\n // functions work, the constructor has to behave fairly\n // well. So, in the event we are created via fromItems()\n // we build the read-only Result object we want, but on\n // any other input, we use the default constructor\n\n // constructor(guard: any, items: Array, keys?: Array);\n const guard = args[0];\n let items: Array = args[1];\n let names: Array = (args[2] || [ ]).slice();\n\n let wrap = true;\n if (guard !== _guard) {\n items = args;\n names = [ ];\n wrap = false;\n }\n\n // Can't just pass in ...items since an array of length 1\n // is a special case in the super.\n super(items.length);\n items.forEach((item, index) => { this[index] = item; });\n\n // Find all unique keys\n const nameCounts = names.reduce((accum, name) => {\n if (typeof(name) === \"string\") {\n accum.set(name, (accum.get(name) || 0) + 1);\n }\n return accum;\n }, >(new Map()));\n\n // Remove any key thats not unique\n this.#names = Object.freeze(items.map((item, index) => {\n const name = names[index];\n if (name != null && nameCounts.get(name) === 1) {\n return name;\n }\n return null;\n }));\n\n if (!wrap) { return; }\n\n // A wrapped Result is immutable\n Object.freeze(this);\n\n // Proxy indices and names so we can trap deferred errors\n return new Proxy(this, {\n get: (target, prop, receiver) => {\n if (typeof(prop) === \"string\") {\n\n // Index accessor\n if (prop.match(/^[0-9]+$/)) {\n const index = getNumber(prop, \"%index\");\n if (index < 0 || index >= this.length) {\n throw new RangeError(\"out of result range\");\n }\n\n const item = target[index];\n if (item instanceof Error) {\n throwError(`index ${ index }`, item);\n }\n return item;\n }\n\n // Pass important checks (like `then` for Promise) through\n if (passProperties.indexOf(prop) >= 0) {\n return Reflect.get(target, prop, receiver);\n }\n\n const value = target[prop];\n if (value instanceof Function) {\n // Make sure functions work with private variables\n // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding\n return function(this: any, ...args: Array) {\n return value.apply((this === receiver) ? target: this, args);\n };\n\n } else if (!(prop in target)) {\n // Possible name accessor\n return target.getValue.apply((this === receiver) ? target: this, [ prop ]);\n }\n }\n\n return Reflect.get(target, prop, receiver);\n }\n });\n }\n\n /**\n * Returns the Result as a normal Array.\n *\n * This will throw if there are any outstanding deferred\n * errors.\n */\n toArray(): Array {\n const result: Array = [ ];\n this.forEach((item, index) => {\n if (item instanceof Error) { throwError(`index ${ index }`, item); }\n result.push(item);\n });\n return result;\n }\n\n /**\n * Returns the Result as an Object with each name-value pair.\n *\n * This will throw if any value is unnamed, or if there are\n * any outstanding deferred errors.\n */\n toObject(): Record {\n return this.#names.reduce((accum, name, index) => {\n assert(name != null, \"value at index ${ index } unnamed\", \"UNSUPPORTED_OPERATION\", {\n operation: \"toObject()\"\n });\n\n // Add values for names that don't conflict\n if (!(name in accum)) {\n accum[name] = this.getValue(name);\n }\n\n return accum;\n }, >{});\n }\n\n /**\n * @_ignore\n */\n slice(start?: number | undefined, end?: number | undefined): Result {\n if (start == null) { start = 0; }\n if (start < 0) {\n start += this.length;\n if (start < 0) { start = 0; }\n }\n\n if (end == null) { end = this.length; }\n if (end < 0) {\n end += this.length;\n if (end < 0) { end = 0; }\n }\n if (end > this.length) { end = this.length; }\n\n const result: Array = [ ], names: Array = [ ];\n for (let i = start; i < end; i++) {\n result.push(this[i]);\n names.push(this.#names[i]);\n }\n\n return new Result(_guard, result, names);\n }\n\n /**\n * @_ignore\n */\n filter(callback: (el: any, index: number, array: Result) => boolean, thisArg?: any): Result {\n const result: Array = [ ], names: Array = [ ];\n for (let i = 0; i < this.length; i++) {\n const item = this[i];\n if (item instanceof Error) {\n throwError(`index ${ i }`, item);\n }\n\n if (callback.call(thisArg, item, i, this)) {\n result.push(item);\n names.push(this.#names[i]);\n }\n }\n\n return new Result(_guard, result, names);\n }\n\n /**\n * @_ignore\n */\n map(callback: (el: any, index: number, array: Result) => T, thisArg?: any): Array {\n const result: Array = [ ];\n for (let i = 0; i < this.length; i++) {\n const item = this[i];\n if (item instanceof Error) {\n throwError(`index ${ i }`, item);\n }\n\n result.push(callback.call(thisArg, item, i, this));\n }\n\n return result;\n }\n\n\n /**\n * Returns the value for %%name%%.\n *\n * Since it is possible to have a key whose name conflicts with\n * a method on a [[Result]] or its superclass Array, or any\n * JavaScript keyword, this ensures all named values are still\n * accessible by name.\n */\n getValue(name: string): any {\n const index = this.#names.indexOf(name);\n if (index === -1) { return undefined; }\n\n const value = this[index];\n\n if (value instanceof Error) {\n throwError(`property ${ JSON.stringify(name) }`, (value).error);\n }\n\n return value;\n }\n\n /**\n * Creates a new [[Result]] for %%items%% with each entry\n * also accessible by its corresponding name in %%keys%%.\n */\n static fromItems(items: Array, keys?: Array): Result {\n return new Result(_guard, items, keys);\n }\n}\n\n/**\n * Returns all errors found in a [[Result]].\n *\n * Since certain errors encountered when creating a [[Result]] do\n * not impact the ability to continue parsing data, they are\n * deferred until they are actually accessed. Hence a faulty string\n * in an Event that is never used does not impact the program flow.\n *\n * However, sometimes it may be useful to access, identify or\n * validate correctness of a [[Result]].\n *\n * @_docloc api/abi\n */\nexport function checkResultErrors(result: Result): Array<{ path: Array, error: Error }> {\n // Find the first error (if any)\n const errors: Array<{ path: Array, error: Error }> = [ ];\n\n const checkErrors = function(path: Array, object: any): void {\n if (!Array.isArray(object)) { return; }\n for (let key in object) {\n const childPath = path.slice();\n childPath.push(key);\n\n try {\n checkErrors(childPath, object[key]);\n } catch (error: any) {\n errors.push({ path: childPath, error: error });\n }\n }\n }\n checkErrors([ ], result);\n\n return errors;\n\n}\n\nfunction getValue(value: BigNumberish): Uint8Array {\n let bytes = toBeArray(value);\n\n assert (bytes.length <= WordSize, \"value out-of-bounds\",\n \"BUFFER_OVERRUN\", { buffer: bytes, length: WordSize, offset: bytes.length });\n\n if (bytes.length !== WordSize) {\n bytes = getBytesCopy(concat([ Padding.slice(bytes.length % WordSize), bytes ]));\n }\n\n return bytes;\n}\n\n/**\n * @_ignore\n */\nexport abstract class Coder {\n\n // The coder name:\n // - address, uint256, tuple, array, etc.\n readonly name!: string;\n\n // The fully expanded type, including composite types:\n // - address, uint256, tuple(address,bytes), uint256[3][4][], etc.\n readonly type!: string;\n\n // The localName bound in the signature, in this example it is \"baz\":\n // - tuple(address foo, uint bar) baz\n readonly localName!: string;\n\n // Whether this type is dynamic:\n // - Dynamic: bytes, string, address[], tuple(boolean[]), etc.\n // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8)\n readonly dynamic!: boolean;\n\n constructor(name: string, type: string, localName: string, dynamic: boolean) {\n defineProperties(this, { name, type, localName, dynamic }, {\n name: \"string\", type: \"string\", localName: \"string\", dynamic: \"boolean\"\n });\n }\n\n _throwError(message: string, value: any): never {\n assertArgument(false, message, this.localName, value);\n }\n\n abstract encode(writer: Writer, value: any): number;\n abstract decode(reader: Reader): any;\n\n abstract defaultValue(): any;\n}\n\n/**\n * @_ignore\n */\nexport class Writer {\n // An array of WordSize lengthed objects to concatenation\n #data: Array;\n #dataLength: number;\n\n constructor() {\n this.#data = [ ];\n this.#dataLength = 0;\n }\n\n get data(): string {\n return concat(this.#data);\n }\n get length(): number { return this.#dataLength; }\n\n #writeData(data: Uint8Array): number {\n this.#data.push(data);\n this.#dataLength += data.length;\n return data.length;\n }\n\n appendWriter(writer: Writer): number {\n return this.#writeData(getBytesCopy(writer.data));\n }\n\n // Arrayish item; pad on the right to *nearest* WordSize\n writeBytes(value: BytesLike): number {\n let bytes = getBytesCopy(value);\n const paddingOffset = bytes.length % WordSize;\n if (paddingOffset) {\n bytes = getBytesCopy(concat([ bytes, Padding.slice(paddingOffset) ]))\n }\n return this.#writeData(bytes);\n }\n\n // Numeric item; pad on the left *to* WordSize\n writeValue(value: BigNumberish): number {\n return this.#writeData(getValue(value));\n }\n\n // Inserts a numeric place-holder, returning a callback that can\n // be used to asjust the value later\n writeUpdatableValue(): (value: BigNumberish) => void {\n const offset = this.#data.length;\n this.#data.push(Padding);\n this.#dataLength += WordSize;\n return (value: BigNumberish) => {\n this.#data[offset] = getValue(value);\n };\n }\n}\n\n/**\n * @_ignore\n */\nexport class Reader {\n // Allows incomplete unpadded data to be read; otherwise an error\n // is raised if attempting to overrun the buffer. This is required\n // to deal with an old Solidity bug, in which event data for\n // external (not public thoguh) was tightly packed.\n readonly allowLoose!: boolean;\n\n readonly #data: Uint8Array;\n #offset: number;\n\n #bytesRead: number;\n #parent: null | Reader;\n #maxInflation: number;\n\n constructor(data: BytesLike, allowLoose?: boolean, maxInflation?: number) {\n defineProperties(this, { allowLoose: !!allowLoose });\n\n this.#data = getBytesCopy(data);\n this.#bytesRead = 0;\n this.#parent = null;\n this.#maxInflation = (maxInflation != null) ? maxInflation: 1024;\n\n this.#offset = 0;\n }\n\n get data(): string { return hexlify(this.#data); }\n get dataLength(): number { return this.#data.length; }\n get consumed(): number { return this.#offset; }\n get bytes(): Uint8Array { return new Uint8Array(this.#data); }\n\n #incrementBytesRead(count: number): void {\n if (this.#parent) { return this.#parent.#incrementBytesRead(count); }\n\n this.#bytesRead += count;\n\n // Check for excessive inflation (see: #4537)\n assert(this.#maxInflation < 1 || this.#bytesRead <= this.#maxInflation * this.dataLength, `compressed ABI data exceeds inflation ratio of ${ this.#maxInflation } ( see: https:/\\/github.com/ethers-io/ethers.js/issues/4537 )`, \"BUFFER_OVERRUN\", {\n buffer: getBytesCopy(this.#data), offset: this.#offset,\n length: count, info: {\n bytesRead: this.#bytesRead,\n dataLength: this.dataLength\n }\n });\n }\n\n #peekBytes(offset: number, length: number, loose?: boolean): Uint8Array {\n let alignedLength = Math.ceil(length / WordSize) * WordSize;\n if (this.#offset + alignedLength > this.#data.length) {\n if (this.allowLoose && loose && this.#offset + length <= this.#data.length) {\n alignedLength = length;\n } else {\n assert(false, \"data out-of-bounds\", \"BUFFER_OVERRUN\", {\n buffer: getBytesCopy(this.#data),\n length: this.#data.length,\n offset: this.#offset + alignedLength\n });\n }\n }\n return this.#data.slice(this.#offset, this.#offset + alignedLength)\n }\n\n // Create a sub-reader with the same underlying data, but offset\n subReader(offset: number): Reader {\n const reader = new Reader(this.#data.slice(this.#offset + offset), this.allowLoose, this.#maxInflation);\n reader.#parent = this;\n return reader;\n }\n\n // Read bytes\n readBytes(length: number, loose?: boolean): Uint8Array {\n let bytes = this.#peekBytes(0, length, !!loose);\n this.#incrementBytesRead(length);\n this.#offset += bytes.length;\n // @TODO: Make sure the length..end bytes are all 0?\n return bytes.slice(0, length);\n }\n\n // Read a numeric values\n readValue(): bigint {\n return toBigInt(this.readBytes(WordSize));\n }\n\n readIndex(): number {\n return toNumber(this.readBytes(WordSize));\n }\n}\n", "function number(n: number) {\n if (!Number.isSafeInteger(n) || n < 0) throw new Error(`Wrong positive integer: ${n}`);\n}\n\nfunction bool(b: boolean) {\n if (typeof b !== 'boolean') throw new Error(`Expected boolean, not ${b}`);\n}\n\nfunction bytes(b: Uint8Array | undefined, ...lengths: number[]) {\n if (!(b instanceof Uint8Array)) throw new Error('Expected Uint8Array');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);\n}\n\ntype Hash = {\n (data: Uint8Array): Uint8Array;\n blockLen: number;\n outputLen: number;\n create: any;\n};\nfunction hash(hash: Hash) {\n if (typeof hash !== 'function' || typeof hash.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(hash.outputLen);\n number(hash.blockLen);\n}\n\nfunction exists(instance: any, checkFinished = true) {\n if (instance.destroyed) throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished) throw new Error('Hash#digest() has already been called');\n}\nfunction output(out: any, instance: any) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\n\nexport { number, bool, bytes, hash, exists, output };\n\nconst assert = { number, bool, bytes, hash, exists, output };\nexport default assert;\n", "// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// See utils.ts for details.\ndeclare const globalThis: Record | undefined;\nexport const crypto =\n typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;\n", "/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated, we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\n\n// prettier-ignore\nexport type TypedArray = Int8Array | Uint8ClampedArray | Uint8Array |\n Uint16Array | Int16Array | Uint32Array | Int32Array;\n\nconst u8a = (a: any): a is Uint8Array => a instanceof Uint8Array;\n// Cast array to different type\nexport const u8 = (arr: TypedArray) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nexport const u32 = (arr: TypedArray) =>\n new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n\n// Cast array to view\nexport const createView = (arr: TypedArray) =>\n new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n\n// The rotate right (circular right shift) operation for uint32\nexport const rotr = (word: number, shift: number) => (word << (32 - shift)) | (word >>> shift);\n\n// big-endian hardware is rare. Just in case someone still decides to run hashes:\n// early-throw an error because we don't support BE yet.\nexport const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\nif (!isLE) throw new Error('Non little-endian hardware is not supported');\n\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) =>\n i.toString(16).padStart(2, '0')\n);\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes: Uint8Array): string {\n if (!u8a(bytes)) throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex: string): Uint8Array {\n if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex);\n const len = hex.length;\n if (len % 2) throw new Error('padded hex string expected, got unpadded hex of length ' + len);\n const array = new Uint8Array(len / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0) throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\n\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nexport const nextTick = async () => {};\n\n// Returns control to thread each 'tick' ms to avoid blocking\nexport async function asyncLoop(iters: number, tick: number, cb: (i: number) => void) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick) continue;\n await nextTick();\n ts += diff;\n }\n}\n\n// Global symbols in both browsers and Node.js since v11\n// See https://github.com/microsoft/TypeScript/issues/31535\ndeclare const TextEncoder: any;\n\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str: string): Uint8Array {\n if (typeof str !== 'string') throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n\nexport type Input = Uint8Array | string;\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data: Input): Uint8Array {\n if (typeof data === 'string') data = utf8ToBytes(data);\n if (!u8a(data)) throw new Error(`expected Uint8Array, got ${typeof data}`);\n return data;\n}\n\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays: Uint8Array[]): Uint8Array {\n const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));\n let pad = 0; // walk through each item, ensure they have proper type\n arrays.forEach((a) => {\n if (!u8a(a)) throw new Error('Uint8Array expected');\n r.set(a, pad);\n pad += a.length;\n });\n return r;\n}\n\n// For runtime check if class implements interface\nexport abstract class Hash> {\n abstract blockLen: number; // Bytes per block\n abstract outputLen: number; // Bytes in output\n abstract update(buf: Input): this;\n // Writes digest into buf\n abstract digestInto(buf: Uint8Array): void;\n abstract digest(): Uint8Array;\n /**\n * Resets internal state. Makes Hash instance unusable.\n * Reset is impossible for keyed hashes if key is consumed into state. If digest is not consumed\n * by user, they will need to manually call `destroy()` when zeroing is necessary.\n */\n abstract destroy(): void;\n /**\n * Clones hash instance. Unsafe: doesn't check whether `to` is valid. Can be used as `clone()`\n * when no options are passed.\n * Reasons to use `_cloneInto` instead of clone: 1) performance 2) reuse instance => all internal\n * buffers are overwritten => causes buffer overwrite which is used for digest in some cases.\n * There are no guarantees for clean-up because it's impossible in JS.\n */\n abstract _cloneInto(to?: T): T;\n // Safe version that clones internal state\n clone(): T {\n return this._cloneInto();\n }\n}\n\n/**\n * XOF: streaming API to read digest in chunks.\n * Same as 'squeeze' in keccak/k12 and 'seek' in blake3, but more generic name.\n * When hash used in XOF mode it is up to user to call '.destroy' afterwards, since we cannot\n * destroy state, next call can require more bytes.\n */\nexport type HashXOF> = Hash & {\n xof(bytes: number): Uint8Array; // Read 'bytes' bytes from digest stream\n xofInto(buf: Uint8Array): Uint8Array; // read buf.length bytes from digest stream into buf\n};\n\nconst toStr = {}.toString;\ntype EmptyObj = {};\nexport function checkOpts(\n defaults: T1,\n opts?: T2\n): T1 & T2 {\n if (opts !== undefined && toStr.call(opts) !== '[object Object]')\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged as T1 & T2;\n}\n\nexport type CHash = ReturnType;\n\nexport function wrapConstructor>(hashCons: () => Hash) {\n const hashC = (msg: Input): Uint8Array => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\n\nexport function wrapConstructorWithOpts, T extends Object>(\n hashCons: (opts?: T) => Hash\n) {\n const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({} as T);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts: T) => hashCons(opts);\n return hashC;\n}\n\nexport function wrapXOFConstructorWithOpts, T extends Object>(\n hashCons: (opts?: T) => HashXOF\n) {\n const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({} as T);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts: T) => hashCons(opts);\n return hashC;\n}\n\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nexport function randomBytes(bytesLength = 32): Uint8Array {\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n", "import { hash as assertHash, bytes as assertBytes, exists as assertExists } from './_assert.js';\nimport { Hash, CHash, Input, toBytes } from './utils.js';\n// HMAC (RFC 2104)\nexport class HMAC> extends Hash> {\n oHash: T;\n iHash: T;\n blockLen: number;\n outputLen: number;\n private finished = false;\n private destroyed = false;\n\n constructor(hash: CHash, _key: Input) {\n super();\n assertHash(hash);\n const key = toBytes(_key);\n this.iHash = hash.create() as T;\n if (typeof this.iHash.update !== 'function')\n throw new Error('Expected instance of class which extends utils.Hash');\n this.blockLen = this.iHash.blockLen;\n this.outputLen = this.iHash.outputLen;\n const blockLen = this.blockLen;\n const pad = new Uint8Array(blockLen);\n // blockLen can be bigger than outputLen\n pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);\n for (let i = 0; i < pad.length; i++) pad[i] ^= 0x36;\n this.iHash.update(pad);\n // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone\n this.oHash = hash.create() as T;\n // Undo internal XOR && apply outer XOR\n for (let i = 0; i < pad.length; i++) pad[i] ^= 0x36 ^ 0x5c;\n this.oHash.update(pad);\n pad.fill(0);\n }\n update(buf: Input) {\n assertExists(this);\n this.iHash.update(buf);\n return this;\n }\n digestInto(out: Uint8Array) {\n assertExists(this);\n assertBytes(out, this.outputLen);\n this.finished = true;\n this.iHash.digestInto(out);\n this.oHash.update(out);\n this.oHash.digestInto(out);\n this.destroy();\n }\n digest() {\n const out = new Uint8Array(this.oHash.outputLen);\n this.digestInto(out);\n return out;\n }\n _cloneInto(to?: HMAC): HMAC {\n // Create new instance without calling constructor since key already in state and we don't know it.\n to ||= Object.create(Object.getPrototypeOf(this), {});\n const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;\n to = to as this;\n to.finished = finished;\n to.destroyed = destroyed;\n to.blockLen = blockLen;\n to.outputLen = outputLen;\n to.oHash = oHash._cloneInto(to.oHash);\n to.iHash = iHash._cloneInto(to.iHash);\n return to;\n }\n destroy() {\n this.destroyed = true;\n this.oHash.destroy();\n this.iHash.destroy();\n }\n}\n\n/**\n * HMAC: RFC2104 message authentication code.\n * @param hash - function that would be used e.g. sha256\n * @param key - message key\n * @param message - message data\n */\nexport const hmac = (hash: CHash, key: Input, message: Input): Uint8Array =>\n new HMAC(hash, key).update(message).digest();\nhmac.create = (hash: CHash, key: Input) => new HMAC(hash, key);\n", "import { hash as assertHash, number as assertNumber } from './_assert.js';\nimport { hmac } from './hmac.js';\nimport { Hash, CHash, Input, createView, toBytes, checkOpts, asyncLoop } from './utils.js';\n\n// PBKDF (RFC 2898)\nexport type Pbkdf2Opt = {\n c: number; // Iterations\n dkLen?: number; // Desired key length in bytes (Intended output length in octets of the derived key\n asyncTick?: number; // Maximum time in ms for which async function can block execution\n};\n// Common prologue and epilogue for sync/async functions\nfunction pbkdf2Init(hash: CHash, _password: Input, _salt: Input, _opts: Pbkdf2Opt) {\n assertHash(hash);\n const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);\n const { c, dkLen, asyncTick } = opts;\n assertNumber(c);\n assertNumber(dkLen);\n assertNumber(asyncTick);\n if (c < 1) throw new Error('PBKDF2: iterations (c) should be >= 1');\n const password = toBytes(_password);\n const salt = toBytes(_salt);\n // DK = PBKDF2(PRF, Password, Salt, c, dkLen);\n const DK = new Uint8Array(dkLen);\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n const PRF = hmac.create(hash, password);\n const PRFSalt = PRF._cloneInto().update(salt);\n return { c, dkLen, asyncTick, DK, PRF, PRFSalt };\n}\n\nfunction pbkdf2Output>(\n PRF: Hash,\n PRFSalt: Hash,\n DK: Uint8Array,\n prfW: Hash,\n u: Uint8Array\n) {\n PRF.destroy();\n PRFSalt.destroy();\n if (prfW) prfW.destroy();\n u.fill(0);\n return DK;\n}\n\n/**\n * PBKDF2-HMAC: RFC 2898 key derivation function\n * @param hash - hash function that would be used e.g. sha256\n * @param password - password from which a derived key is generated\n * @param salt - cryptographic salt\n * @param opts - {c, dkLen} where c is work factor and dkLen is output message size\n */\nexport function pbkdf2(hash: CHash, password: Input, salt: Input, opts: Pbkdf2Opt) {\n const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);\n let prfW: any; // Working copy\n const arr = new Uint8Array(4);\n const view = createView(arr);\n const u = new Uint8Array(PRF.outputLen);\n // DK = T1 + T2 + ⋯ + Tdklen/hlen\n for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {\n // Ti = F(Password, Salt, c, i)\n const Ti = DK.subarray(pos, pos + PRF.outputLen);\n view.setInt32(0, ti, false);\n // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);\n Ti.set(u.subarray(0, Ti.length));\n for (let ui = 1; ui < c; ui++) {\n // Uc = PRF(Password, Uc−1)\n PRF._cloneInto(prfW).update(u).digestInto(u);\n for (let i = 0; i < Ti.length; i++) Ti[i] ^= u[i];\n }\n }\n return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);\n}\n\nexport async function pbkdf2Async(hash: CHash, password: Input, salt: Input, opts: Pbkdf2Opt) {\n const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);\n let prfW: any; // Working copy\n const arr = new Uint8Array(4);\n const view = createView(arr);\n const u = new Uint8Array(PRF.outputLen);\n // DK = T1 + T2 + ⋯ + Tdklen/hlen\n for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {\n // Ti = F(Password, Salt, c, i)\n const Ti = DK.subarray(pos, pos + PRF.outputLen);\n view.setInt32(0, ti, false);\n // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc\n // U1 = PRF(Password, Salt + INT_32_BE(i))\n (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);\n Ti.set(u.subarray(0, Ti.length));\n await asyncLoop(c - 1, asyncTick, () => {\n // Uc = PRF(Password, Uc−1)\n PRF._cloneInto(prfW).update(u).digestInto(u);\n for (let i = 0; i < Ti.length; i++) Ti[i] ^= u[i];\n });\n }\n return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);\n}\n", "import { exists, output } from './_assert.js';\nimport { Hash, createView, Input, toBytes } from './utils.js';\n\n// Polyfill for Safari 14\nfunction setBigUint64(view: DataView, byteOffset: number, value: bigint, isLE: boolean): void {\n if (typeof view.setBigUint64 === 'function') return view.setBigUint64(byteOffset, value, isLE);\n const _32n = BigInt(32);\n const _u32_max = BigInt(0xffffffff);\n const wh = Number((value >> _32n) & _u32_max);\n const wl = Number(value & _u32_max);\n const h = isLE ? 4 : 0;\n const l = isLE ? 0 : 4;\n view.setUint32(byteOffset + h, wh, isLE);\n view.setUint32(byteOffset + l, wl, isLE);\n}\n\n// Base SHA2 class (RFC 6234)\nexport abstract class SHA2> extends Hash {\n protected abstract process(buf: DataView, offset: number): void;\n protected abstract get(): number[];\n protected abstract set(...args: number[]): void;\n abstract destroy(): void;\n protected abstract roundClean(): void;\n // For partial updates less than block size\n protected buffer: Uint8Array;\n protected view: DataView;\n protected finished = false;\n protected length = 0;\n protected pos = 0;\n protected destroyed = false;\n\n constructor(\n readonly blockLen: number,\n public outputLen: number,\n readonly padOffset: number,\n readonly isLE: boolean\n ) {\n super();\n this.buffer = new Uint8Array(blockLen);\n this.view = createView(this.buffer);\n }\n update(data: Input): this {\n exists(this);\n const { view, buffer, blockLen } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len; ) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input, cast it to view and process\n if (take === blockLen) {\n const dataView = createView(data);\n for (; blockLen <= len - pos; pos += blockLen) this.process(dataView, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out: Uint8Array) {\n exists(this);\n output(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n this.buffer.subarray(pos).fill(0);\n // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++) buffer[i] = 0;\n // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that\n // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.\n // So we just write lowest 64 bits of that value.\n setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);\n this.process(view, 0);\n const oview = createView(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT\n if (len % 4) throw new Error('_sha2: outputLen should be aligned to 32bit');\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length) throw new Error('_sha2: outputLen bigger than state');\n for (let i = 0; i < outLen; i++) oview.setUint32(4 * i, state[i], isLE);\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to?: T): T {\n to ||= new (this.constructor as any)() as T;\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.length = length;\n to.pos = pos;\n to.finished = finished;\n to.destroyed = destroyed;\n if (length % blockLen) to.buffer.set(buffer);\n return to;\n }\n}\n", "import { SHA2 } from './_sha2.js';\nimport { rotr, wrapConstructor } from './utils.js';\n\n// SHA2-256 need to try 2^128 hashes to execute birthday attack.\n// BTC network is doing 2^67 hashes/sec as per early 2023.\n\n// Choice: a ? b : c\nconst Chi = (a: number, b: number, c: number) => (a & b) ^ (~a & c);\n// Majority function, true if any two inpust is true\nconst Maj = (a: number, b: number, c: number) => (a & b) ^ (a & c) ^ (b & c);\n\n// Round constants:\n// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)\n// prettier-ignore\nconst SHA256_K = /* @__PURE__ */new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n\n// Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):\n// prettier-ignore\nconst IV = /* @__PURE__ */new Uint32Array([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19\n]);\n\n// Temporary buffer, not used to store anything between runs\n// Named this way because it matches specification.\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\nclass SHA256 extends SHA2 {\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n A = IV[0] | 0;\n B = IV[1] | 0;\n C = IV[2] | 0;\n D = IV[3] | 0;\n E = IV[4] | 0;\n F = IV[5] | 0;\n G = IV[6] | 0;\n H = IV[7] | 0;\n\n constructor() {\n super(64, 32, 8, false);\n }\n protected get(): [number, number, number, number, number, number, number, number] {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n // prettier-ignore\n protected set(\n A: number, B: number, C: number, D: number, E: number, F: number, G: number, H: number\n ) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n protected process(view: DataView, offset: number): void {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) SHA256_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);\n const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);\n const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);\n const T2 = (sigma0 + Maj(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n protected roundClean() {\n SHA256_W.fill(0);\n }\n destroy() {\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n this.buffer.fill(0);\n }\n}\n// Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf\nclass SHA224 extends SHA256 {\n A = 0xc1059ed8 | 0;\n B = 0x367cd507 | 0;\n C = 0x3070dd17 | 0;\n D = 0xf70e5939 | 0;\n E = 0xffc00b31 | 0;\n F = 0x68581511 | 0;\n G = 0x64f98fa7 | 0;\n H = 0xbefa4fa4 | 0;\n constructor() {\n super();\n this.outputLen = 28;\n }\n}\n\n/**\n * SHA2-256 hash function\n * @param message - data that would be hashed\n */\nexport const sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());\nexport const sha224 = /* @__PURE__ */ wrapConstructor(() => new SHA224());\n", "const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);\nconst _32n = /* @__PURE__ */ BigInt(32);\n\n// We are not using BigUint64Array, because they are extremely slow as per 2022\nfunction fromBig(n: bigint, le = false) {\n if (le) return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\n\nfunction split(lst: bigint[], le = false) {\n let Ah = new Uint32Array(lst.length);\n let Al = new Uint32Array(lst.length);\n for (let i = 0; i < lst.length; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\n\nconst toBig = (h: number, l: number) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// for Shift in [0, 32)\nconst shrSH = (h: number, _l: number, s: number) => h >>> s;\nconst shrSL = (h: number, l: number, s: number) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h: number, l: number, s: number) => (h >>> s) | (l << (32 - s));\nconst rotrSL = (h: number, l: number, s: number) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h: number, l: number, s: number) => (h << (64 - s)) | (l >>> (s - 32));\nconst rotrBL = (h: number, l: number, s: number) => (h >>> (s - 32)) | (l << (64 - s));\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (_h: number, l: number) => l;\nconst rotr32L = (h: number, _l: number) => h;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h: number, l: number, s: number) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h: number, l: number, s: number) => (l << s) | (h >>> (32 - s));\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h: number, l: number, s: number) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h: number, l: number, s: number) => (h << (s - 32)) | (l >>> (64 - s));\n\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\nfunction add(Ah: number, Al: number, Bh: number, Bl: number) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\nconst add3L = (Al: number, Bl: number, Cl: number) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nconst add3H = (low: number, Ah: number, Bh: number, Ch: number) =>\n (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nconst add4L = (Al: number, Bl: number, Cl: number, Dl: number) =>\n (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nconst add4H = (low: number, Ah: number, Bh: number, Ch: number, Dh: number) =>\n (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nconst add5L = (Al: number, Bl: number, Cl: number, Dl: number, El: number) =>\n (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nconst add5H = (low: number, Ah: number, Bh: number, Ch: number, Dh: number, Eh: number) =>\n (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n\n// prettier-ignore\nexport {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\nexport default u64;\n", "import { SHA2 } from './_sha2.js';\nimport u64 from './_u64.js';\nimport { wrapConstructor } from './utils.js';\n\n// Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409):\n// prettier-ignore\nconst [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => u64.split([\n '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',\n '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',\n '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',\n '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',\n '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',\n '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',\n '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',\n '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',\n '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',\n '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',\n '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',\n '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',\n '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',\n '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',\n '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',\n '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',\n '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',\n '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',\n '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',\n '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'\n].map(n => BigInt(n))))();\n\n// Temporary buffer, not used to store anything between runs\nconst SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);\nconst SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);\nexport class SHA512 extends SHA2 {\n // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers.\n // Also looks cleaner and easier to verify with spec.\n // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):\n // h -- high 32 bits, l -- low 32 bits\n Ah = 0x6a09e667 | 0;\n Al = 0xf3bcc908 | 0;\n Bh = 0xbb67ae85 | 0;\n Bl = 0x84caa73b | 0;\n Ch = 0x3c6ef372 | 0;\n Cl = 0xfe94f82b | 0;\n Dh = 0xa54ff53a | 0;\n Dl = 0x5f1d36f1 | 0;\n Eh = 0x510e527f | 0;\n El = 0xade682d1 | 0;\n Fh = 0x9b05688c | 0;\n Fl = 0x2b3e6c1f | 0;\n Gh = 0x1f83d9ab | 0;\n Gl = 0xfb41bd6b | 0;\n Hh = 0x5be0cd19 | 0;\n Hl = 0x137e2179 | 0;\n\n constructor() {\n super(128, 64, 16, false);\n }\n // prettier-ignore\n protected get(): [\n number, number, number, number, number, number, number, number,\n number, number, number, number, number, number, number, number\n ] {\n const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n }\n // prettier-ignore\n protected set(\n Ah: number, Al: number, Bh: number, Bl: number, Ch: number, Cl: number, Dh: number, Dl: number,\n Eh: number, El: number, Fh: number, Fl: number, Gh: number, Gl: number, Hh: number, Hl: number\n ) {\n this.Ah = Ah | 0;\n this.Al = Al | 0;\n this.Bh = Bh | 0;\n this.Bl = Bl | 0;\n this.Ch = Ch | 0;\n this.Cl = Cl | 0;\n this.Dh = Dh | 0;\n this.Dl = Dl | 0;\n this.Eh = Eh | 0;\n this.El = El | 0;\n this.Fh = Fh | 0;\n this.Fl = Fl | 0;\n this.Gh = Gh | 0;\n this.Gl = Gl | 0;\n this.Hh = Hh | 0;\n this.Hl = Hl | 0;\n }\n protected process(view: DataView, offset: number) {\n // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA512_W_H[i] = view.getUint32(offset);\n SHA512_W_L[i] = view.getUint32((offset += 4));\n }\n for (let i = 16; i < 80; i++) {\n // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n const W15h = SHA512_W_H[i - 15] | 0;\n const W15l = SHA512_W_L[i - 15] | 0;\n const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);\n const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);\n // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n const W2h = SHA512_W_H[i - 2] | 0;\n const W2l = SHA512_W_L[i - 2] | 0;\n const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);\n const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);\n // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];\n const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n SHA512_W_H[i] = SUMh | 0;\n SHA512_W_L[i] = SUMl | 0;\n }\n let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n // Compression function main loop, 80 rounds\n for (let i = 0; i < 80; i++) {\n // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);\n const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);\n //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n const CHIl = (El & Fl) ^ (~El & Gl);\n // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n // prettier-ignore\n const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);\n const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);\n const T1l = T1ll | 0;\n // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)\n const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);\n const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);\n const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);\n const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);\n Hh = Gh | 0;\n Hl = Gl | 0;\n Gh = Fh | 0;\n Gl = Fl | 0;\n Fh = Eh | 0;\n Fl = El | 0;\n ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));\n Dh = Ch | 0;\n Dl = Cl | 0;\n Ch = Bh | 0;\n Cl = Bl | 0;\n Bh = Ah | 0;\n Bl = Al | 0;\n const All = u64.add3L(T1l, sigma0l, MAJl);\n Ah = u64.add3H(All, T1h, sigma0h, MAJh);\n Al = All | 0;\n }\n // Add the compressed chunk to the current hash value\n ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));\n ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));\n ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));\n ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));\n ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));\n ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));\n ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));\n ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));\n this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);\n }\n protected roundClean() {\n SHA512_W_H.fill(0);\n SHA512_W_L.fill(0);\n }\n destroy() {\n this.buffer.fill(0);\n this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n }\n}\n\nclass SHA512_224 extends SHA512 {\n // h -- high 32 bits, l -- low 32 bits\n Ah = 0x8c3d37c8 | 0;\n Al = 0x19544da2 | 0;\n Bh = 0x73e19966 | 0;\n Bl = 0x89dcd4d6 | 0;\n Ch = 0x1dfab7ae | 0;\n Cl = 0x32ff9c82 | 0;\n Dh = 0x679dd514 | 0;\n Dl = 0x582f9fcf | 0;\n Eh = 0x0f6d2b69 | 0;\n El = 0x7bd44da8 | 0;\n Fh = 0x77e36f73 | 0;\n Fl = 0x04c48942 | 0;\n Gh = 0x3f9d85a8 | 0;\n Gl = 0x6a1d36c8 | 0;\n Hh = 0x1112e6ad | 0;\n Hl = 0x91d692a1 | 0;\n\n constructor() {\n super();\n this.outputLen = 28;\n }\n}\n\nclass SHA512_256 extends SHA512 {\n // h -- high 32 bits, l -- low 32 bits\n Ah = 0x22312194 | 0;\n Al = 0xfc2bf72c | 0;\n Bh = 0x9f555fa3 | 0;\n Bl = 0xc84c64c2 | 0;\n Ch = 0x2393b86b | 0;\n Cl = 0x6f53b151 | 0;\n Dh = 0x96387719 | 0;\n Dl = 0x5940eabd | 0;\n Eh = 0x96283ee2 | 0;\n El = 0xa88effe3 | 0;\n Fh = 0xbe5e1e25 | 0;\n Fl = 0x53863992 | 0;\n Gh = 0x2b0199fc | 0;\n Gl = 0x2c85b8aa | 0;\n Hh = 0x0eb72ddc | 0;\n Hl = 0x81c52ca2 | 0;\n\n constructor() {\n super();\n this.outputLen = 32;\n }\n}\n\nclass SHA384 extends SHA512 {\n // h -- high 32 bits, l -- low 32 bits\n Ah = 0xcbbb9d5d | 0;\n Al = 0xc1059ed8 | 0;\n Bh = 0x629a292a | 0;\n Bl = 0x367cd507 | 0;\n Ch = 0x9159015a | 0;\n Cl = 0x3070dd17 | 0;\n Dh = 0x152fecd8 | 0;\n Dl = 0xf70e5939 | 0;\n Eh = 0x67332667 | 0;\n El = 0xffc00b31 | 0;\n Fh = 0x8eb44a87 | 0;\n Fl = 0x68581511 | 0;\n Gh = 0xdb0c2e0d | 0;\n Gl = 0x64f98fa7 | 0;\n Hh = 0x47b5481d | 0;\n Hl = 0xbefa4fa4 | 0;\n\n constructor() {\n super();\n this.outputLen = 48;\n }\n}\n\nexport const sha512 = /* @__PURE__ */ wrapConstructor(() => new SHA512());\nexport const sha512_224 = /* @__PURE__ */ wrapConstructor(() => new SHA512_224());\nexport const sha512_256 = /* @__PURE__ */ wrapConstructor(() => new SHA512_256());\nexport const sha384 = /* @__PURE__ */ wrapConstructor(() => new SHA384());\n", "/* Browser Crypto Shims */\n\nimport { hmac } from \"@noble/hashes/hmac\";\nimport { pbkdf2 } from \"@noble/hashes/pbkdf2\";\nimport { sha256 } from \"@noble/hashes/sha256\";\nimport { sha512 } from \"@noble/hashes/sha512\";\n\nimport { assert, assertArgument } from \"../utils/index.js\";\n\n\ndeclare global {\n interface Window { }\n\n const window: Window;\n const self: Window;\n}\n\n\nfunction getGlobal(): any {\n if (typeof self !== 'undefined') { return self; }\n if (typeof window !== 'undefined') { return window; }\n if (typeof global !== 'undefined') { return global; }\n throw new Error('unable to locate global object');\n};\n\nconst anyGlobal = getGlobal();\nconst crypto: any = anyGlobal.crypto || anyGlobal.msCrypto;\n\n\nexport interface CryptoHasher {\n update(data: Uint8Array): CryptoHasher;\n digest(): Uint8Array;\n}\n\nexport function createHash(algo: string): CryptoHasher {\n switch (algo) {\n case \"sha256\": return sha256.create();\n case \"sha512\": return sha512.create();\n }\n assertArgument(false, \"invalid hashing algorithm name\", \"algorithm\", algo);\n}\n\nexport function createHmac(_algo: string, key: Uint8Array): CryptoHasher {\n const algo = ({ sha256, sha512 }[_algo]);\n assertArgument(algo != null, \"invalid hmac algorithm\", \"algorithm\", _algo);\n return hmac.create(algo, key);\n}\n\nexport function pbkdf2Sync(password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, _algo: \"sha256\" | \"sha512\"): Uint8Array {\n const algo = ({ sha256, sha512 }[_algo]);\n assertArgument(algo != null, \"invalid pbkdf2 algorithm\", \"algorithm\", _algo);\n return pbkdf2(algo, password, salt, { c: iterations, dkLen: keylen });\n}\n\nexport function randomBytes(length: number): Uint8Array {\n assert(crypto != null, \"platform does not support secure random numbers\", \"UNSUPPORTED_OPERATION\", {\n operation: \"randomBytes\" });\n\n assertArgument(Number.isInteger(length) && length > 0 && length <= 1024, \"invalid length\", \"length\", length);\n\n const result = new Uint8Array(length);\n crypto.getRandomValues(result);\n return result;\n}\n", "/**\n * An **HMAC** enables verification that a given key was used\n * to authenticate a payload.\n *\n * See: [[link-wiki-hmac]]\n *\n * @_subsection: api/crypto:HMAC [about-hmac]\n */\nimport { createHmac } from \"./crypto.js\";\nimport { getBytes, hexlify } from \"../utils/index.js\";\n\nimport type { BytesLike } from \"../utils/index.js\";\n\n\nlet locked = false;\n\nconst _computeHmac = function(algorithm: \"sha256\" | \"sha512\", key: Uint8Array, data: Uint8Array): BytesLike {\n return createHmac(algorithm, key).update(data).digest();\n}\n\nlet __computeHmac = _computeHmac;\n\n/**\n * Return the HMAC for %%data%% using the %%key%% key with the underlying\n * %%algo%% used for compression.\n *\n * @example:\n * key = id(\"some-secret\")\n *\n * // Compute the HMAC\n * computeHmac(\"sha256\", key, \"0x1337\")\n * //_result:\n *\n * // To compute the HMAC of UTF-8 data, the data must be\n * // converted to UTF-8 bytes\n * computeHmac(\"sha256\", key, toUtf8Bytes(\"Hello World\"))\n * //_result:\n *\n */\nexport function computeHmac(algorithm: \"sha256\" | \"sha512\", _key: BytesLike, _data: BytesLike): string {\n const key = getBytes(_key, \"key\");\n const data = getBytes(_data, \"data\");\n return hexlify(__computeHmac(algorithm, key, data));\n}\ncomputeHmac._ = _computeHmac;\ncomputeHmac.lock = function() { locked = true; }\ncomputeHmac.register = function(func: (algorithm: \"sha256\" | \"sha512\", key: Uint8Array, data: Uint8Array) => BytesLike) {\n if (locked) { throw new Error(\"computeHmac is locked\"); }\n __computeHmac = func;\n}\nObject.freeze(computeHmac);\n", "import { bytes, exists, number, output } from './_assert.js';\nimport { rotlBH, rotlBL, rotlSH, rotlSL, split } from './_u64.js';\nimport {\n Hash,\n u32,\n Input,\n toBytes,\n wrapConstructor,\n wrapXOFConstructorWithOpts,\n HashXOF,\n} from './utils.js';\n\n// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size.\n// It's called a sponge function.\n\n// Various per round constants calculations\nconst [SHA3_PI, SHA3_ROTL, _SHA3_IOTA]: [number[], number[], bigint[]] = [[], [], []];\nconst _0n = /* @__PURE__ */ BigInt(0);\nconst _1n = /* @__PURE__ */ BigInt(1);\nconst _2n = /* @__PURE__ */ BigInt(2);\nconst _7n = /* @__PURE__ */ BigInt(7);\nconst _256n = /* @__PURE__ */ BigInt(256);\nconst _0x71n = /* @__PURE__ */ BigInt(0x71);\nfor (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {\n // Pi\n [x, y] = [y, (2 * x + 3 * y) % 5];\n SHA3_PI.push(2 * (5 * y + x));\n // Rotational\n SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);\n // Iota\n let t = _0n;\n for (let j = 0; j < 7; j++) {\n R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;\n if (R & _2n) t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n);\n }\n _SHA3_IOTA.push(t);\n}\nconst [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);\n\n// Left rotation (without 0, 32, 64)\nconst rotlH = (h: number, l: number, s: number) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));\nconst rotlL = (h: number, l: number, s: number) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));\n\n// Same as keccakf1600, but allows to skip some rounds\nexport function keccakP(s: Uint32Array, rounds: number = 24) {\n const B = new Uint32Array(5 * 2);\n // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)\n for (let round = 24 - rounds; round < 24; round++) {\n // Theta θ\n for (let x = 0; x < 10; x++) B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];\n for (let x = 0; x < 10; x += 2) {\n const idx1 = (x + 8) % 10;\n const idx0 = (x + 2) % 10;\n const B0 = B[idx0];\n const B1 = B[idx0 + 1];\n const Th = rotlH(B0, B1, 1) ^ B[idx1];\n const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];\n for (let y = 0; y < 50; y += 10) {\n s[x + y] ^= Th;\n s[x + y + 1] ^= Tl;\n }\n }\n // Rho (ρ) and Pi (π)\n let curH = s[2];\n let curL = s[3];\n for (let t = 0; t < 24; t++) {\n const shift = SHA3_ROTL[t];\n const Th = rotlH(curH, curL, shift);\n const Tl = rotlL(curH, curL, shift);\n const PI = SHA3_PI[t];\n curH = s[PI];\n curL = s[PI + 1];\n s[PI] = Th;\n s[PI + 1] = Tl;\n }\n // Chi (χ)\n for (let y = 0; y < 50; y += 10) {\n for (let x = 0; x < 10; x++) B[x] = s[y + x];\n for (let x = 0; x < 10; x++) s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];\n }\n // Iota (ι)\n s[0] ^= SHA3_IOTA_H[round];\n s[1] ^= SHA3_IOTA_L[round];\n }\n B.fill(0);\n}\n\nexport class Keccak extends Hash implements HashXOF {\n protected state: Uint8Array;\n protected pos = 0;\n protected posOut = 0;\n protected finished = false;\n protected state32: Uint32Array;\n protected destroyed = false;\n // NOTE: we accept arguments in bytes instead of bits here.\n constructor(\n public blockLen: number,\n public suffix: number,\n public outputLen: number,\n protected enableXOF = false,\n protected rounds: number = 24\n ) {\n super();\n // Can be passed from user as dkLen\n number(outputLen);\n // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes\n if (0 >= this.blockLen || this.blockLen >= 200)\n throw new Error('Sha3 supports only keccak-f1600 function');\n this.state = new Uint8Array(200);\n this.state32 = u32(this.state);\n }\n protected keccak() {\n keccakP(this.state32, this.rounds);\n this.posOut = 0;\n this.pos = 0;\n }\n update(data: Input) {\n exists(this);\n const { blockLen, state } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len; ) {\n const take = Math.min(blockLen - this.pos, len - pos);\n for (let i = 0; i < take; i++) state[this.pos++] ^= data[pos++];\n if (this.pos === blockLen) this.keccak();\n }\n return this;\n }\n protected finish() {\n if (this.finished) return;\n this.finished = true;\n const { state, suffix, pos, blockLen } = this;\n // Do the padding\n state[pos] ^= suffix;\n if ((suffix & 0x80) !== 0 && pos === blockLen - 1) this.keccak();\n state[blockLen - 1] ^= 0x80;\n this.keccak();\n }\n protected writeInto(out: Uint8Array): Uint8Array {\n exists(this, false);\n bytes(out);\n this.finish();\n const bufferOut = this.state;\n const { blockLen } = this;\n for (let pos = 0, len = out.length; pos < len; ) {\n if (this.posOut >= blockLen) this.keccak();\n const take = Math.min(blockLen - this.posOut, len - pos);\n out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);\n this.posOut += take;\n pos += take;\n }\n return out;\n }\n xofInto(out: Uint8Array): Uint8Array {\n // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF\n if (!this.enableXOF) throw new Error('XOF is not possible for this instance');\n return this.writeInto(out);\n }\n xof(bytes: number): Uint8Array {\n number(bytes);\n return this.xofInto(new Uint8Array(bytes));\n }\n digestInto(out: Uint8Array) {\n output(out, this);\n if (this.finished) throw new Error('digest() was already called');\n this.writeInto(out);\n this.destroy();\n return out;\n }\n digest() {\n return this.digestInto(new Uint8Array(this.outputLen));\n }\n destroy() {\n this.destroyed = true;\n this.state.fill(0);\n }\n _cloneInto(to?: Keccak): Keccak {\n const { blockLen, suffix, outputLen, rounds, enableXOF } = this;\n to ||= new Keccak(blockLen, suffix, outputLen, enableXOF, rounds);\n to.state32.set(this.state32);\n to.pos = this.pos;\n to.posOut = this.posOut;\n to.finished = this.finished;\n to.rounds = rounds;\n // Suffix can change in cSHAKE\n to.suffix = suffix;\n to.outputLen = outputLen;\n to.enableXOF = enableXOF;\n to.destroyed = this.destroyed;\n return to;\n }\n}\n\nconst gen = (suffix: number, blockLen: number, outputLen: number) =>\n wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));\n\nexport const sha3_224 = /* @__PURE__ */ gen(0x06, 144, 224 / 8);\n/**\n * SHA3-256 hash function\n * @param message - that would be hashed\n */\nexport const sha3_256 = /* @__PURE__ */ gen(0x06, 136, 256 / 8);\nexport const sha3_384 = /* @__PURE__ */ gen(0x06, 104, 384 / 8);\nexport const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8);\nexport const keccak_224 = /* @__PURE__ */ gen(0x01, 144, 224 / 8);\n/**\n * keccak-256 hash function. Different from SHA3-256.\n * @param message - that would be hashed\n */\nexport const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8);\nexport const keccak_384 = /* @__PURE__ */ gen(0x01, 104, 384 / 8);\nexport const keccak_512 = /* @__PURE__ */ gen(0x01, 72, 512 / 8);\n\nexport type ShakeOpts = { dkLen?: number };\n\nconst genShake = (suffix: number, blockLen: number, outputLen: number) =>\n wrapXOFConstructorWithOpts, ShakeOpts>(\n (opts: ShakeOpts = {}) =>\n new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true)\n );\n\nexport const shake128 = /* @__PURE__ */ genShake(0x1f, 168, 128 / 8);\nexport const shake256 = /* @__PURE__ */ genShake(0x1f, 136, 256 / 8);\n", "/**\n * Cryptographic hashing functions\n *\n * @_subsection: api/crypto:Hash Functions [about-crypto-hashing]\n */\n\nimport { keccak_256 } from \"@noble/hashes/sha3\";\n\nimport { getBytes, hexlify } from \"../utils/index.js\";\n\nimport type { BytesLike } from \"../utils/index.js\";\n\n\nlet locked = false;\n\nconst _keccak256 = function(data: Uint8Array): Uint8Array {\n return keccak_256(data);\n}\n\nlet __keccak256: (data: Uint8Array) => BytesLike = _keccak256;\n\n/**\n * Compute the cryptographic KECCAK256 hash of %%data%%.\n *\n * The %%data%% **must** be a data representation, to compute the\n * hash of UTF-8 data use the [[id]] function.\n *\n * @returns DataHexstring\n * @example:\n * keccak256(\"0x\")\n * //_result:\n *\n * keccak256(\"0x1337\")\n * //_result:\n *\n * keccak256(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n *\n * // Strings are assumed to be DataHexString, otherwise it will\n * // throw. To hash UTF-8 data, see the note above.\n * keccak256(\"Hello World\")\n * //_error:\n */\nexport function keccak256(_data: BytesLike): string {\n const data = getBytes(_data, \"data\");\n return hexlify(__keccak256(data));\n}\nkeccak256._ = _keccak256;\nkeccak256.lock = function(): void { locked = true; }\nkeccak256.register = function(func: (data: Uint8Array) => BytesLike) {\n if (locked) { throw new TypeError(\"keccak256 is locked\"); }\n __keccak256 = func;\n}\nObject.freeze(keccak256);\n", "import { SHA2 } from './_sha2.js';\nimport { wrapConstructor } from './utils.js';\n\n// https://homes.esat.kuleuven.be/~bosselae/ripemd160.html\n// https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf\nconst Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);\nconst Id = /* @__PURE__ */ Uint8Array.from({ length: 16 }, (_, i) => i);\nconst Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16);\nlet idxL = [Id];\nlet idxR = [Pi];\nfor (let i = 0; i < 4; i++) for (let j of [idxL, idxR]) j.push(j[i].map((k) => Rho[k]));\n\nconst shifts = /* @__PURE__ */ [\n [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],\n [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],\n [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],\n [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],\n [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5],\n].map((i) => new Uint8Array(i));\nconst shiftsL = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts[i][j]));\nconst shiftsR = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts[i][j]));\nconst Kl = /* @__PURE__ */ new Uint32Array([\n 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e,\n]);\nconst Kr = /* @__PURE__ */ new Uint32Array([\n 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000,\n]);\n// The rotate left (circular left shift) operation for uint32\nconst rotl = (word: number, shift: number) => (word << shift) | (word >>> (32 - shift));\n// It's called f() in spec.\nfunction f(group: number, x: number, y: number, z: number): number {\n if (group === 0) return x ^ y ^ z;\n else if (group === 1) return (x & y) | (~x & z);\n else if (group === 2) return (x | ~y) ^ z;\n else if (group === 3) return (x & z) | (y & ~z);\n else return x ^ (y | ~z);\n}\n// Temporary buffer, not used to store anything between runs\nconst BUF = /* @__PURE__ */ new Uint32Array(16);\nexport class RIPEMD160 extends SHA2 {\n private h0 = 0x67452301 | 0;\n private h1 = 0xefcdab89 | 0;\n private h2 = 0x98badcfe | 0;\n private h3 = 0x10325476 | 0;\n private h4 = 0xc3d2e1f0 | 0;\n\n constructor() {\n super(64, 20, 8, true);\n }\n protected get(): [number, number, number, number, number] {\n const { h0, h1, h2, h3, h4 } = this;\n return [h0, h1, h2, h3, h4];\n }\n protected set(h0: number, h1: number, h2: number, h3: number, h4: number) {\n this.h0 = h0 | 0;\n this.h1 = h1 | 0;\n this.h2 = h2 | 0;\n this.h3 = h3 | 0;\n this.h4 = h4 | 0;\n }\n protected process(view: DataView, offset: number): void {\n for (let i = 0; i < 16; i++, offset += 4) BUF[i] = view.getUint32(offset, true);\n // prettier-ignore\n let al = this.h0 | 0, ar = al,\n bl = this.h1 | 0, br = bl,\n cl = this.h2 | 0, cr = cl,\n dl = this.h3 | 0, dr = dl,\n el = this.h4 | 0, er = el;\n\n // Instead of iterating 0 to 80, we split it into 5 groups\n // And use the groups in constants, functions, etc. Much simpler\n for (let group = 0; group < 5; group++) {\n const rGroup = 4 - group;\n const hbl = Kl[group], hbr = Kr[group]; // prettier-ignore\n const rl = idxL[group], rr = idxR[group]; // prettier-ignore\n const sl = shiftsL[group], sr = shiftsR[group]; // prettier-ignore\n for (let i = 0; i < 16; i++) {\n const tl = (rotl(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el) | 0;\n al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore\n }\n // 2 loops are 10% faster\n for (let i = 0; i < 16; i++) {\n const tr = (rotl(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er) | 0;\n ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore\n }\n }\n // Add the compressed chunk to the current hash value\n this.set(\n (this.h1 + cl + dr) | 0,\n (this.h2 + dl + er) | 0,\n (this.h3 + el + ar) | 0,\n (this.h4 + al + br) | 0,\n (this.h0 + bl + cr) | 0\n );\n }\n protected roundClean() {\n BUF.fill(0);\n }\n destroy() {\n this.destroyed = true;\n this.buffer.fill(0);\n this.set(0, 0, 0, 0, 0);\n }\n}\n\n/**\n * RIPEMD-160 - a hash function from 1990s.\n * @param message - msg that would be hashed\n */\nexport const ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160());\n", "import { ripemd160 as noble_ripemd160 } from \"@noble/hashes/ripemd160\";\n\nimport { getBytes, hexlify } from \"../utils/index.js\";\n\nimport type { BytesLike } from \"../utils/index.js\";\n\n\nlet locked = false;\n\nconst _ripemd160 = function(data: Uint8Array): Uint8Array {\n return noble_ripemd160(data);\n}\n\nlet __ripemd160: (data: Uint8Array) => BytesLike = _ripemd160;\n\n/**\n * Compute the cryptographic RIPEMD-160 hash of %%data%%.\n *\n * @_docloc: api/crypto:Hash Functions\n * @returns DataHexstring\n *\n * @example:\n * ripemd160(\"0x\")\n * //_result:\n *\n * ripemd160(\"0x1337\")\n * //_result:\n *\n * ripemd160(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n *\n */\nexport function ripemd160(_data: BytesLike): string {\n const data = getBytes(_data, \"data\");\n return hexlify(__ripemd160(data));\n}\nripemd160._ = _ripemd160;\nripemd160.lock = function(): void { locked = true; }\nripemd160.register = function(func: (data: Uint8Array) => BytesLike) {\n if (locked) { throw new TypeError(\"ripemd160 is locked\"); }\n __ripemd160 = func;\n}\nObject.freeze(ripemd160);\n", "/**\n * A **Password-Based Key-Derivation Function** is designed to create\n * a sequence of bytes suitible as a **key** from a human-rememberable\n * password.\n *\n * @_subsection: api/crypto:Passwords [about-pbkdf]\n */\n\nimport { pbkdf2Sync } from \"./crypto.js\";\n\nimport { getBytes, hexlify } from \"../utils/index.js\";\n\nimport type { BytesLike } from \"../utils/index.js\";\n\n\nlet locked = false;\n\nconst _pbkdf2 = function(password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: \"sha256\" | \"sha512\"): BytesLike {\n return pbkdf2Sync(password, salt, iterations, keylen, algo);\n}\n\nlet __pbkdf2 = _pbkdf2;\n\n/**\n * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using\n * the %%salt%% and using %%iterations%% of %%algo%%.\n *\n * This PBKDF is outdated and should not be used in new projects, but is\n * required to decrypt older files.\n *\n * @example:\n * // The password must be converted to bytes, and it is generally\n * // best practices to ensure the string has been normalized. Many\n * // formats explicitly indicate the normalization form to use.\n * password = \"hello\"\n * passwordBytes = toUtf8Bytes(password, \"NFKC\")\n *\n * salt = id(\"some-salt\")\n *\n * // Compute the PBKDF2\n * pbkdf2(passwordBytes, salt, 1024, 16, \"sha256\")\n * //_result:\n */\nexport function pbkdf2(_password: BytesLike, _salt: BytesLike, iterations: number, keylen: number, algo: \"sha256\" | \"sha512\"): string {\n const password = getBytes(_password, \"password\");\n const salt = getBytes(_salt, \"salt\");\n return hexlify(__pbkdf2(password, salt, iterations, keylen, algo));\n}\npbkdf2._ = _pbkdf2;\npbkdf2.lock = function(): void { locked = true; }\npbkdf2.register = function(func: (password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: \"sha256\" | \"sha512\") => BytesLike) {\n if (locked) { throw new Error(\"pbkdf2 is locked\"); }\n __pbkdf2 = func;\n}\nObject.freeze(pbkdf2);\n", "/**\n * A **Cryptographically Secure Random Value** is one that has been\n * generated with additional care take to prevent side-channels\n * from allowing others to detect it and prevent others from through\n * coincidence generate the same values.\n *\n * @_subsection: api/crypto:Random Values [about-crypto-random]\n */\nimport { randomBytes as crypto_random } from \"./crypto.js\";\n\nlet locked = false;\n\nconst _randomBytes = function(length: number): Uint8Array {\n return new Uint8Array(crypto_random(length));\n}\n\nlet __randomBytes = _randomBytes;\n\n/**\n * Return %%length%% bytes of cryptographically secure random data.\n *\n * @example:\n * randomBytes(8)\n * //_result:\n */\nexport function randomBytes(length: number): Uint8Array {\n return __randomBytes(length);\n}\n\nrandomBytes._ = _randomBytes;\nrandomBytes.lock = function(): void { locked = true; }\nrandomBytes.register = function(func: (length: number) => Uint8Array) {\n if (locked) { throw new Error(\"randomBytes is locked\"); }\n __randomBytes = func;\n}\nObject.freeze(randomBytes);\n", "import { number as assertNumber } from './_assert.js';\nimport { sha256 } from './sha256.js';\nimport { pbkdf2 } from './pbkdf2.js';\nimport { asyncLoop, checkOpts, Input, u32 } from './utils.js';\n\n// RFC 7914 Scrypt KDF\n\n// Left rotate for uint32\nconst rotl = (a: number, b: number) => (a << b) | (a >>> (32 - b));\n\n// The main Scrypt loop: uses Salsa extensively.\n// Six versions of the function were tried, this is the fastest one.\n// prettier-ignore\nfunction XorAndSalsa(\n prev: Uint32Array,\n pi: number,\n input: Uint32Array,\n ii: number,\n out: Uint32Array,\n oi: number\n) {\n // Based on https://cr.yp.to/salsa20.html\n // Xor blocks\n let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++];\n let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++];\n let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++];\n let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++];\n let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++];\n let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++];\n let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++];\n let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++];\n // Save state to temporary variables (salsa)\n let x00 = y00, x01 = y01, x02 = y02, x03 = y03,\n x04 = y04, x05 = y05, x06 = y06, x07 = y07,\n x08 = y08, x09 = y09, x10 = y10, x11 = y11,\n x12 = y12, x13 = y13, x14 = y14, x15 = y15;\n // Main loop (salsa)\n for (let i = 0; i < 8; i += 2) {\n x04 ^= rotl(x00 + x12 | 0, 7); x08 ^= rotl(x04 + x00 | 0, 9);\n x12 ^= rotl(x08 + x04 | 0, 13); x00 ^= rotl(x12 + x08 | 0, 18);\n x09 ^= rotl(x05 + x01 | 0, 7); x13 ^= rotl(x09 + x05 | 0, 9);\n x01 ^= rotl(x13 + x09 | 0, 13); x05 ^= rotl(x01 + x13 | 0, 18);\n x14 ^= rotl(x10 + x06 | 0, 7); x02 ^= rotl(x14 + x10 | 0, 9);\n x06 ^= rotl(x02 + x14 | 0, 13); x10 ^= rotl(x06 + x02 | 0, 18);\n x03 ^= rotl(x15 + x11 | 0, 7); x07 ^= rotl(x03 + x15 | 0, 9);\n x11 ^= rotl(x07 + x03 | 0, 13); x15 ^= rotl(x11 + x07 | 0, 18);\n x01 ^= rotl(x00 + x03 | 0, 7); x02 ^= rotl(x01 + x00 | 0, 9);\n x03 ^= rotl(x02 + x01 | 0, 13); x00 ^= rotl(x03 + x02 | 0, 18);\n x06 ^= rotl(x05 + x04 | 0, 7); x07 ^= rotl(x06 + x05 | 0, 9);\n x04 ^= rotl(x07 + x06 | 0, 13); x05 ^= rotl(x04 + x07 | 0, 18);\n x11 ^= rotl(x10 + x09 | 0, 7); x08 ^= rotl(x11 + x10 | 0, 9);\n x09 ^= rotl(x08 + x11 | 0, 13); x10 ^= rotl(x09 + x08 | 0, 18);\n x12 ^= rotl(x15 + x14 | 0, 7); x13 ^= rotl(x12 + x15 | 0, 9);\n x14 ^= rotl(x13 + x12 | 0, 13); x15 ^= rotl(x14 + x13 | 0, 18);\n }\n // Write output (salsa)\n out[oi++] = (y00 + x00) | 0; out[oi++] = (y01 + x01) | 0;\n out[oi++] = (y02 + x02) | 0; out[oi++] = (y03 + x03) | 0;\n out[oi++] = (y04 + x04) | 0; out[oi++] = (y05 + x05) | 0;\n out[oi++] = (y06 + x06) | 0; out[oi++] = (y07 + x07) | 0;\n out[oi++] = (y08 + x08) | 0; out[oi++] = (y09 + x09) | 0;\n out[oi++] = (y10 + x10) | 0; out[oi++] = (y11 + x11) | 0;\n out[oi++] = (y12 + x12) | 0; out[oi++] = (y13 + x13) | 0;\n out[oi++] = (y14 + x14) | 0; out[oi++] = (y15 + x15) | 0;\n}\n\nfunction BlockMix(input: Uint32Array, ii: number, out: Uint32Array, oi: number, r: number) {\n // The block B is r 128-byte chunks (which is equivalent of 2r 64-byte chunks)\n let head = oi + 0;\n let tail = oi + 16 * r;\n for (let i = 0; i < 16; i++) out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; // X ← B[2r−1]\n for (let i = 0; i < r; i++, head += 16, ii += 16) {\n // We write odd & even Yi at same time. Even: 0bXXXXX0 Odd: 0bXXXXX1\n XorAndSalsa(out, tail, input, ii, out, head); // head[i] = Salsa(blockIn[2*i] ^ tail[i-1])\n if (i > 0) tail += 16; // First iteration overwrites tmp value in tail\n XorAndSalsa(out, head, input, (ii += 16), out, tail); // tail[i] = Salsa(blockIn[2*i+1] ^ head[i])\n }\n}\n\nexport type ScryptOpts = {\n N: number; // cost factor\n r: number; // block size\n p: number; // parallelization\n dkLen?: number; // key length\n asyncTick?: number; // block execution max time\n maxmem?: number;\n onProgress?: (progress: number) => void;\n};\n\n// Common prologue and epilogue for sync/async functions\nfunction scryptInit(password: Input, salt: Input, _opts?: ScryptOpts) {\n // Maxmem - 1GB+1KB by default\n const opts = checkOpts(\n {\n dkLen: 32,\n asyncTick: 10,\n maxmem: 1024 ** 3 + 1024,\n },\n _opts\n );\n const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts;\n assertNumber(N);\n assertNumber(r);\n assertNumber(p);\n assertNumber(dkLen);\n assertNumber(asyncTick);\n assertNumber(maxmem);\n if (onProgress !== undefined && typeof onProgress !== 'function')\n throw new Error('progressCb should be function');\n const blockSize = 128 * r;\n const blockSize32 = blockSize / 4;\n if (N <= 1 || (N & (N - 1)) !== 0 || N >= 2 ** (blockSize / 8) || N > 2 ** 32) {\n // NOTE: we limit N to be less than 2**32 because of 32 bit variant of Integrify function\n // There is no JS engines that allows alocate more than 4GB per single Uint8Array for now, but can change in future.\n throw new Error(\n 'Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32'\n );\n }\n if (p < 0 || p > ((2 ** 32 - 1) * 32) / blockSize) {\n throw new Error(\n 'Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)'\n );\n }\n if (dkLen < 0 || dkLen > (2 ** 32 - 1) * 32) {\n throw new Error(\n 'Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32'\n );\n }\n const memUsed = blockSize * (N + p);\n if (memUsed > maxmem) {\n throw new Error(\n `Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)`\n );\n }\n // [B0...Bp−1] ← PBKDF2HMAC-SHA256(Passphrase, Salt, 1, blockSize*ParallelizationFactor)\n // Since it has only one iteration there is no reason to use async variant\n const B = pbkdf2(sha256, password, salt, { c: 1, dkLen: blockSize * p });\n const B32 = u32(B);\n // Re-used between parallel iterations. Array(iterations) of B\n const V = u32(new Uint8Array(blockSize * N));\n const tmp = u32(new Uint8Array(blockSize));\n let blockMixCb = () => {};\n if (onProgress) {\n const totalBlockMix = 2 * N * p;\n // Invoke callback if progress changes from 10.01 to 10.02\n // Allows to draw smooth progress bar on up to 8K screen\n const callbackPer = Math.max(Math.floor(totalBlockMix / 10000), 1);\n let blockMixCnt = 0;\n blockMixCb = () => {\n blockMixCnt++;\n if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix))\n onProgress(blockMixCnt / totalBlockMix);\n };\n }\n return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick };\n}\n\nfunction scryptOutput(\n password: Input,\n dkLen: number,\n B: Uint8Array,\n V: Uint32Array,\n tmp: Uint32Array\n) {\n const res = pbkdf2(sha256, password, B, { c: 1, dkLen });\n B.fill(0);\n V.fill(0);\n tmp.fill(0);\n return res;\n}\n\n/**\n * Scrypt KDF from RFC 7914.\n * @param password - pass\n * @param salt - salt\n * @param opts - parameters\n * - `N` is cpu/mem work factor (power of 2 e.g. 2**18)\n * - `r` is block size (8 is common), fine-tunes sequential memory read size and performance\n * - `p` is parallelization factor (1 is common)\n * - `dkLen` is output key length in bytes e.g. 32.\n * - `asyncTick` - (default: 10) max time in ms for which async function can block execution\n * - `maxmem` - (default: `1024 ** 3 + 1024` aka 1GB+1KB). A limit that the app could use for scrypt\n * - `onProgress` - callback function that would be executed for progress report\n * @returns Derived key\n */\nexport function scrypt(password: Input, salt: Input, opts: ScryptOpts) {\n const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(\n password,\n salt,\n opts\n );\n for (let pi = 0; pi < p; pi++) {\n const Pi = blockSize32 * pi;\n for (let i = 0; i < blockSize32; i++) V[i] = B32[Pi + i]; // V[0] = B[i]\n for (let i = 0, pos = 0; i < N - 1; i++) {\n BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]);\n blockMixCb();\n }\n BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element\n blockMixCb();\n for (let i = 0; i < N; i++) {\n // First u32 of the last 64-byte block (u32 is LE)\n const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations\n for (let k = 0; k < blockSize32; k++) tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j]\n BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j])\n blockMixCb();\n }\n }\n return scryptOutput(password, dkLen, B, V, tmp);\n}\n\n/**\n * Scrypt KDF from RFC 7914.\n */\nexport async function scryptAsync(password: Input, salt: Input, opts: ScryptOpts) {\n const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(\n password,\n salt,\n opts\n );\n for (let pi = 0; pi < p; pi++) {\n const Pi = blockSize32 * pi;\n for (let i = 0; i < blockSize32; i++) V[i] = B32[Pi + i]; // V[0] = B[i]\n let pos = 0;\n await asyncLoop(N - 1, asyncTick, () => {\n BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]);\n blockMixCb();\n });\n BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element\n blockMixCb();\n await asyncLoop(N, asyncTick, () => {\n // First u32 of the last 64-byte block (u32 is LE)\n const j = B32[Pi + blockSize32 - 16] % N; // j = Integrify(X) % iterations\n for (let k = 0; k < blockSize32; k++) tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j]\n BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j])\n blockMixCb();\n });\n }\n return scryptOutput(password, dkLen, B, V, tmp);\n}\n", "import { scrypt as _nobleSync, scryptAsync as _nobleAsync } from \"@noble/hashes/scrypt\";\n\nimport { getBytes, hexlify as H } from \"../utils/index.js\";\n\nimport type { BytesLike } from \"../utils/index.js\";\n\n/**\n * A callback during long-running operations to update any\n * UI or provide programatic access to the progress.\n *\n * The %%percent%% is a value between ``0`` and ``1``.\n *\n * @_docloc: api/crypto:Passwords\n */\nexport type ProgressCallback = (percent: number) => void;\n\n\nlet lockedSync = false, lockedAsync = false;\n\nconst _scryptAsync = async function(passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, onProgress?: ProgressCallback) {\n return await _nobleAsync(passwd, salt, { N, r, p, dkLen, onProgress });\n}\nconst _scryptSync = function(passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) {\n return _nobleSync(passwd, salt, { N, r, p, dkLen });\n}\n\nlet __scryptAsync: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, onProgress?: ProgressCallback) => Promise = _scryptAsync;\nlet __scryptSync: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => BytesLike = _scryptSync\n\n\n/**\n * The [[link-wiki-scrypt]] uses a memory and cpu hard method of\n * derivation to increase the resource cost to brute-force a password\n * for a given key.\n *\n * This means this algorithm is intentionally slow, and can be tuned to\n * become slower. As computation and memory speed improve over time,\n * increasing the difficulty maintains the cost of an attacker.\n *\n * For example, if a target time of 5 seconds is used, a legitimate user\n * which knows their password requires only 5 seconds to unlock their\n * account. A 6 character password has 68 billion possibilities, which\n * would require an attacker to invest over 10,000 years of CPU time. This\n * is of course a crude example (as password generally aren't random),\n * but demonstrates to value of imposing large costs to decryption.\n *\n * For this reason, if building a UI which involved decrypting or\n * encrypting datsa using scrypt, it is recommended to use a\n * [[ProgressCallback]] (as event short periods can seem lik an eternity\n * if the UI freezes). Including the phrase //\"decrypting\"// in the UI\n * can also help, assuring the user their waiting is for a good reason.\n *\n * @_docloc: api/crypto:Passwords\n *\n * @example:\n * // The password must be converted to bytes, and it is generally\n * // best practices to ensure the string has been normalized. Many\n * // formats explicitly indicate the normalization form to use.\n * password = \"hello\"\n * passwordBytes = toUtf8Bytes(password, \"NFKC\")\n *\n * salt = id(\"some-salt\")\n *\n * // Compute the scrypt\n * scrypt(passwordBytes, salt, 1024, 8, 1, 16)\n * //_result:\n */\nexport async function scrypt(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback): Promise {\n const passwd = getBytes(_passwd, \"passwd\");\n const salt = getBytes(_salt, \"salt\");\n return H(await __scryptAsync(passwd, salt, N, r, p, dkLen, progress));\n}\nscrypt._ = _scryptAsync;\nscrypt.lock = function(): void { lockedAsync = true; }\nscrypt.register = function(func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback) => Promise) {\n if (lockedAsync) { throw new Error(\"scrypt is locked\"); }\n __scryptAsync = func;\n}\nObject.freeze(scrypt);\n\n/**\n * Provides a synchronous variant of [[scrypt]].\n *\n * This will completely lock up and freeze the UI in a browser and will\n * prevent any event loop from progressing. For this reason, it is\n * preferred to use the [async variant](scrypt).\n *\n * @_docloc: api/crypto:Passwords\n *\n * @example:\n * // The password must be converted to bytes, and it is generally\n * // best practices to ensure the string has been normalized. Many\n * // formats explicitly indicate the normalization form to use.\n * password = \"hello\"\n * passwordBytes = toUtf8Bytes(password, \"NFKC\")\n *\n * salt = id(\"some-salt\")\n *\n * // Compute the scrypt\n * scryptSync(passwordBytes, salt, 1024, 8, 1, 16)\n * //_result:\n */\nexport function scryptSync(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number): string {\n const passwd = getBytes(_passwd, \"passwd\");\n const salt = getBytes(_salt, \"salt\");\n return H(__scryptSync(passwd, salt, N, r, p, dkLen));\n}\nscryptSync._ = _scryptSync;\nscryptSync.lock = function(): void { lockedSync = true; }\nscryptSync.register = function(func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => BytesLike) {\n if (lockedSync) { throw new Error(\"scryptSync is locked\"); }\n __scryptSync = func;\n}\nObject.freeze(scryptSync);\n", "import { createHash } from \"./crypto.js\";\n\nimport { getBytes, hexlify } from \"../utils/index.js\";\n\nimport type { BytesLike } from \"../utils/index.js\";\n\n\nconst _sha256 = function(data: Uint8Array): Uint8Array {\n return createHash(\"sha256\").update(data).digest();\n}\n\nconst _sha512 = function(data: Uint8Array): Uint8Array {\n return createHash(\"sha512\").update(data).digest();\n}\n\nlet __sha256: (data: Uint8Array) => BytesLike = _sha256;\nlet __sha512: (data: Uint8Array) => BytesLike = _sha512;\n\nlet locked256 = false, locked512 = false;\n\n\n/**\n * Compute the cryptographic SHA2-256 hash of %%data%%.\n *\n * @_docloc: api/crypto:Hash Functions\n * @returns DataHexstring\n *\n * @example:\n * sha256(\"0x\")\n * //_result:\n *\n * sha256(\"0x1337\")\n * //_result:\n *\n * sha256(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n *\n */\nexport function sha256(_data: BytesLike): string {\n const data = getBytes(_data, \"data\");\n return hexlify(__sha256(data));\n}\nsha256._ = _sha256;\nsha256.lock = function(): void { locked256 = true; }\nsha256.register = function(func: (data: Uint8Array) => BytesLike): void {\n if (locked256) { throw new Error(\"sha256 is locked\"); }\n __sha256 = func;\n}\nObject.freeze(sha256);\n\n\n/**\n * Compute the cryptographic SHA2-512 hash of %%data%%.\n *\n * @_docloc: api/crypto:Hash Functions\n * @returns DataHexstring\n *\n * @example:\n * sha512(\"0x\")\n * //_result:\n *\n * sha512(\"0x1337\")\n * //_result:\n *\n * sha512(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n */\nexport function sha512(_data: BytesLike): string {\n const data = getBytes(_data, \"data\");\n return hexlify(__sha512(data));\n}\nsha512._ = _sha512;\nsha512.lock = function(): void { locked512 = true; }\nsha512.register = function(func: (data: Uint8Array) => BytesLike): void {\n if (locked512) { throw new Error(\"sha512 is locked\"); }\n __sha512 = func;\n}\nObject.freeze(sha256);\n", "/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// 100 lines of code in the file are duplicated from noble-hashes (utils).\n// This is OK: `abstract` directory does not use noble-hashes.\n// User may opt-in into using different hashing library. This way, noble-hashes\n// won't be included into their bundle.\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nconst u8a = (a: any): a is Uint8Array => a instanceof Uint8Array;\nexport type Hex = Uint8Array | string; // hex strings are accepted for simplicity\nexport type PrivKey = Hex | bigint; // bigints are accepted to ease learning curve\nexport type CHash = {\n (message: Uint8Array | string): Uint8Array;\n blockLen: number;\n outputLen: number;\n create(opts?: { dkLen?: number }): any; // For shake\n};\nexport type FHash = (message: Uint8Array | string) => Uint8Array;\n\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) =>\n i.toString(16).padStart(2, '0')\n);\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes: Uint8Array): string {\n if (!u8a(bytes)) throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n\nexport function numberToHexUnpadded(num: number | bigint): string {\n const hex = num.toString(16);\n return hex.length & 1 ? `0${hex}` : hex;\n}\n\nexport function hexToNumber(hex: string): bigint {\n if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex);\n // Big Endian\n return BigInt(hex === '' ? '0' : `0x${hex}`);\n}\n\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex: string): Uint8Array {\n if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex);\n const len = hex.length;\n if (len % 2) throw new Error('padded hex string expected, got unpadded hex of length ' + len);\n const array = new Uint8Array(len / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0) throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\n\n// BE: Big Endian, LE: Little Endian\nexport function bytesToNumberBE(bytes: Uint8Array): bigint {\n return hexToNumber(bytesToHex(bytes));\n}\nexport function bytesToNumberLE(bytes: Uint8Array): bigint {\n if (!u8a(bytes)) throw new Error('Uint8Array expected');\n return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse()));\n}\n\nexport function numberToBytesBE(n: number | bigint, len: number): Uint8Array {\n return hexToBytes(n.toString(16).padStart(len * 2, '0'));\n}\nexport function numberToBytesLE(n: number | bigint, len: number): Uint8Array {\n return numberToBytesBE(n, len).reverse();\n}\n// Unpadded, rarely used\nexport function numberToVarBytesBE(n: number | bigint): Uint8Array {\n return hexToBytes(numberToHexUnpadded(n));\n}\n\n/**\n * Takes hex string or Uint8Array, converts to Uint8Array.\n * Validates output length.\n * Will throw error for other types.\n * @param title descriptive title for an error e.g. 'private key'\n * @param hex hex string or Uint8Array\n * @param expectedLength optional, will compare to result array's length\n * @returns\n */\nexport function ensureBytes(title: string, hex: Hex, expectedLength?: number): Uint8Array {\n let res: Uint8Array;\n if (typeof hex === 'string') {\n try {\n res = hexToBytes(hex);\n } catch (e) {\n throw new Error(`${title} must be valid hex string, got \"${hex}\". Cause: ${e}`);\n }\n } else if (u8a(hex)) {\n // Uint8Array.from() instead of hash.slice() because node.js Buffer\n // is instance of Uint8Array, and its slice() creates **mutable** copy\n res = Uint8Array.from(hex);\n } else {\n throw new Error(`${title} must be hex string or Uint8Array`);\n }\n const len = res.length;\n if (typeof expectedLength === 'number' && len !== expectedLength)\n throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`);\n return res;\n}\n\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays: Uint8Array[]): Uint8Array {\n const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));\n let pad = 0; // walk through each item, ensure they have proper type\n arrays.forEach((a) => {\n if (!u8a(a)) throw new Error('Uint8Array expected');\n r.set(a, pad);\n pad += a.length;\n });\n return r;\n}\n\nexport function equalBytes(b1: Uint8Array, b2: Uint8Array) {\n // We don't care about timing attacks here\n if (b1.length !== b2.length) return false;\n for (let i = 0; i < b1.length; i++) if (b1[i] !== b2[i]) return false;\n return true;\n}\n\n// Global symbols in both browsers and Node.js since v11\n// See https://github.com/microsoft/TypeScript/issues/31535\ndeclare const TextEncoder: any;\n\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str: string): Uint8Array {\n if (typeof str !== 'string') throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n\n// Bit operations\n\n/**\n * Calculates amount of bits in a bigint.\n * Same as `n.toString(2).length`\n */\nexport function bitLen(n: bigint) {\n let len;\n for (len = 0; n > _0n; n >>= _1n, len += 1);\n return len;\n}\n\n/**\n * Gets single bit at position.\n * NOTE: first bit position is 0 (same as arrays)\n * Same as `!!+Array.from(n.toString(2)).reverse()[pos]`\n */\nexport function bitGet(n: bigint, pos: number) {\n return (n >> BigInt(pos)) & _1n;\n}\n\n/**\n * Sets single bit at position.\n */\nexport const bitSet = (n: bigint, pos: number, value: boolean) => {\n return n | ((value ? _1n : _0n) << BigInt(pos));\n};\n\n/**\n * Calculate mask for N bits. Not using ** operator with bigints because of old engines.\n * Same as BigInt(`0b${Array(i).fill('1').join('')}`)\n */\nexport const bitMask = (n: number) => (_2n << BigInt(n - 1)) - _1n;\n\n// DRBG\n\nconst u8n = (data?: any) => new Uint8Array(data); // creates Uint8Array\nconst u8fr = (arr: any) => Uint8Array.from(arr); // another shortcut\ntype Pred = (v: Uint8Array) => T | undefined;\n/**\n * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n * @returns function that will call DRBG until 2nd arg returns something meaningful\n * @example\n * const drbg = createHmacDRBG(32, 32, hmac);\n * drbg(seed, bytesToKey); // bytesToKey must return Key or undefined\n */\nexport function createHmacDrbg(\n hashLen: number,\n qByteLen: number,\n hmacFn: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array\n): (seed: Uint8Array, predicate: Pred) => T {\n if (typeof hashLen !== 'number' || hashLen < 2) throw new Error('hashLen must be a number');\n if (typeof qByteLen !== 'number' || qByteLen < 2) throw new Error('qByteLen must be a number');\n if (typeof hmacFn !== 'function') throw new Error('hmacFn must be a function');\n // Step B, Step C: set hashLen to 8*ceil(hlen/8)\n let v = u8n(hashLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n let k = u8n(hashLen); // Steps B and C of RFC6979 3.2: set hashLen, in our case always same\n let i = 0; // Iterations counter, will throw when over 1000\n const reset = () => {\n v.fill(1);\n k.fill(0);\n i = 0;\n };\n const h = (...b: Uint8Array[]) => hmacFn(k, v, ...b); // hmac(k)(v, ...values)\n const reseed = (seed = u8n()) => {\n // HMAC-DRBG reseed() function. Steps D-G\n k = h(u8fr([0x00]), seed); // k = hmac(k || v || 0x00 || seed)\n v = h(); // v = hmac(k || v)\n if (seed.length === 0) return;\n k = h(u8fr([0x01]), seed); // k = hmac(k || v || 0x01 || seed)\n v = h(); // v = hmac(k || v)\n };\n const gen = () => {\n // HMAC-DRBG generate() function\n if (i++ >= 1000) throw new Error('drbg: tried 1000 values');\n let len = 0;\n const out: Uint8Array[] = [];\n while (len < qByteLen) {\n v = h();\n const sl = v.slice();\n out.push(sl);\n len += v.length;\n }\n return concatBytes(...out);\n };\n const genUntil = (seed: Uint8Array, pred: Pred): T => {\n reset();\n reseed(seed); // Steps D-G\n let res: T | undefined = undefined; // Step H: grind until k is in [1..n-1]\n while (!(res = pred(gen()))) reseed();\n reset();\n return res;\n };\n return genUntil;\n}\n\n// Validating curves and fields\n\nconst validatorFns = {\n bigint: (val: any) => typeof val === 'bigint',\n function: (val: any) => typeof val === 'function',\n boolean: (val: any) => typeof val === 'boolean',\n string: (val: any) => typeof val === 'string',\n stringOrUint8Array: (val: any) => typeof val === 'string' || val instanceof Uint8Array,\n isSafeInteger: (val: any) => Number.isSafeInteger(val),\n array: (val: any) => Array.isArray(val),\n field: (val: any, object: any) => (object as any).Fp.isValid(val),\n hash: (val: any) => typeof val === 'function' && Number.isSafeInteger(val.outputLen),\n} as const;\ntype Validator = keyof typeof validatorFns;\ntype ValMap> = { [K in keyof T]?: Validator };\n// type Record = { [P in K]: T; }\n\nexport function validateObject>(\n object: T,\n validators: ValMap,\n optValidators: ValMap = {}\n) {\n const checkField = (fieldName: keyof T, type: Validator, isOptional: boolean) => {\n const checkVal = validatorFns[type];\n if (typeof checkVal !== 'function')\n throw new Error(`Invalid validator \"${type}\", expected function`);\n\n const val = object[fieldName as keyof typeof object];\n if (isOptional && val === undefined) return;\n if (!checkVal(val, object)) {\n throw new Error(\n `Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`\n );\n }\n };\n for (const [fieldName, type] of Object.entries(validators)) checkField(fieldName, type!, false);\n for (const [fieldName, type] of Object.entries(optValidators)) checkField(fieldName, type!, true);\n return object;\n}\n// validate type tests\n// const o: { a: number; b: number; c: number } = { a: 1, b: 5, c: 6 };\n// const z0 = validateObject(o, { a: 'isSafeInteger' }, { c: 'bigint' }); // Ok!\n// // Should fail type-check\n// const z1 = validateObject(o, { a: 'tmp' }, { c: 'zz' });\n// const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' });\n// const z3 = validateObject(o, { test: 'boolean', z: 'bug' });\n// const z4 = validateObject(o, { a: 'boolean', z: 'bug' });\n", "/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Utilities for modular arithmetics and finite fields\nimport {\n bitMask,\n numberToBytesBE,\n numberToBytesLE,\n bytesToNumberBE,\n bytesToNumberLE,\n ensureBytes,\n validateObject,\n} from './utils.js';\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3);\n// prettier-ignore\nconst _4n = BigInt(4), _5n = BigInt(5), _8n = BigInt(8);\n// prettier-ignore\nconst _9n = BigInt(9), _16n = BigInt(16);\n\n// Calculates a modulo b\nexport function mod(a: bigint, b: bigint): bigint {\n const result = a % b;\n return result >= _0n ? result : b + result;\n}\n/**\n * Efficiently raise num to power and do modular division.\n * Unsafe in some contexts: uses ladder, so can expose bigint bits.\n * @example\n * pow(2n, 6n, 11n) // 64n % 11n == 9n\n */\n// TODO: use field version && remove\nexport function pow(num: bigint, power: bigint, modulo: bigint): bigint {\n if (modulo <= _0n || power < _0n) throw new Error('Expected power/modulo > 0');\n if (modulo === _1n) return _0n;\n let res = _1n;\n while (power > _0n) {\n if (power & _1n) res = (res * num) % modulo;\n num = (num * num) % modulo;\n power >>= _1n;\n }\n return res;\n}\n\n// Does x ^ (2 ^ power) mod p. pow2(30, 4) == 30 ^ (2 ^ 4)\nexport function pow2(x: bigint, power: bigint, modulo: bigint): bigint {\n let res = x;\n while (power-- > _0n) {\n res *= res;\n res %= modulo;\n }\n return res;\n}\n\n// Inverses number over modulo\nexport function invert(number: bigint, modulo: bigint): bigint {\n if (number === _0n || modulo <= _0n) {\n throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`);\n }\n // Euclidean GCD https://brilliant.org/wiki/extended-euclidean-algorithm/\n // Fermat's little theorem \"CT-like\" version inv(n) = n^(m-2) mod m is 30x slower.\n let a = mod(number, modulo);\n let b = modulo;\n // prettier-ignore\n let x = _0n, y = _1n, u = _1n, v = _0n;\n while (a !== _0n) {\n // JIT applies optimization if those two lines follow each other\n const q = b / a;\n const r = b % a;\n const m = x - u * q;\n const n = y - v * q;\n // prettier-ignore\n b = a, a = r, x = u, y = v, u = m, v = n;\n }\n const gcd = b;\n if (gcd !== _1n) throw new Error('invert: does not exist');\n return mod(x, modulo);\n}\n\n/**\n * Tonelli-Shanks square root search algorithm.\n * 1. https://eprint.iacr.org/2012/685.pdf (page 12)\n * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks\n * Will start an infinite loop if field order P is not prime.\n * @param P field order\n * @returns function that takes field Fp (created from P) and number n\n */\nexport function tonelliShanks(P: bigint) {\n // Legendre constant: used to calculate Legendre symbol (a | p),\n // which denotes the value of a^((p-1)/2) (mod p).\n // (a | p) ≡ 1 if a is a square (mod p)\n // (a | p) ≡ -1 if a is not a square (mod p)\n // (a | p) ≡ 0 if a ≡ 0 (mod p)\n const legendreC = (P - _1n) / _2n;\n\n let Q: bigint, S: number, Z: bigint;\n // Step 1: By factoring out powers of 2 from p - 1,\n // find q and s such that p - 1 = q*(2^s) with q odd\n for (Q = P - _1n, S = 0; Q % _2n === _0n; Q /= _2n, S++);\n\n // Step 2: Select a non-square z such that (z | p) ≡ -1 and set c ≡ zq\n for (Z = _2n; Z < P && pow(Z, legendreC, P) !== P - _1n; Z++);\n\n // Fast-path\n if (S === 1) {\n const p1div4 = (P + _1n) / _4n;\n return function tonelliFast(Fp: IField, n: T) {\n const root = Fp.pow(n, p1div4);\n if (!Fp.eql(Fp.sqr(root), n)) throw new Error('Cannot find square root');\n return root;\n };\n }\n\n // Slow-path\n const Q1div2 = (Q + _1n) / _2n;\n return function tonelliSlow(Fp: IField, n: T): T {\n // Step 0: Check that n is indeed a square: (n | p) should not be ≡ -1\n if (Fp.pow(n, legendreC) === Fp.neg(Fp.ONE)) throw new Error('Cannot find square root');\n let r = S;\n // TODO: will fail at Fp2/etc\n let g = Fp.pow(Fp.mul(Fp.ONE, Z), Q); // will update both x and b\n let x = Fp.pow(n, Q1div2); // first guess at the square root\n let b = Fp.pow(n, Q); // first guess at the fudge factor\n\n while (!Fp.eql(b, Fp.ONE)) {\n if (Fp.eql(b, Fp.ZERO)) return Fp.ZERO; // https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm (4. If t = 0, return r = 0)\n // Find m such b^(2^m)==1\n let m = 1;\n for (let t2 = Fp.sqr(b); m < r; m++) {\n if (Fp.eql(t2, Fp.ONE)) break;\n t2 = Fp.sqr(t2); // t2 *= t2\n }\n // NOTE: r-m-1 can be bigger than 32, need to convert to bigint before shift, otherwise there will be overflow\n const ge = Fp.pow(g, _1n << BigInt(r - m - 1)); // ge = 2^(r-m-1)\n g = Fp.sqr(ge); // g = ge * ge\n x = Fp.mul(x, ge); // x *= ge\n b = Fp.mul(b, g); // b *= g\n r = m;\n }\n return x;\n };\n}\n\nexport function FpSqrt(P: bigint) {\n // NOTE: different algorithms can give different roots, it is up to user to decide which one they want.\n // For example there is FpSqrtOdd/FpSqrtEven to choice root based on oddness (used for hash-to-curve).\n\n // P ≡ 3 (mod 4)\n // √n = n^((P+1)/4)\n if (P % _4n === _3n) {\n // Not all roots possible!\n // const ORDER =\n // 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn;\n // const NUM = 72057594037927816n;\n const p1div4 = (P + _1n) / _4n;\n return function sqrt3mod4(Fp: IField, n: T) {\n const root = Fp.pow(n, p1div4);\n // Throw if root**2 != n\n if (!Fp.eql(Fp.sqr(root), n)) throw new Error('Cannot find square root');\n return root;\n };\n }\n\n // Atkin algorithm for q ≡ 5 (mod 8), https://eprint.iacr.org/2012/685.pdf (page 10)\n if (P % _8n === _5n) {\n const c1 = (P - _5n) / _8n;\n return function sqrt5mod8(Fp: IField, n: T) {\n const n2 = Fp.mul(n, _2n);\n const v = Fp.pow(n2, c1);\n const nv = Fp.mul(n, v);\n const i = Fp.mul(Fp.mul(nv, _2n), v);\n const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));\n if (!Fp.eql(Fp.sqr(root), n)) throw new Error('Cannot find square root');\n return root;\n };\n }\n\n // P ≡ 9 (mod 16)\n if (P % _16n === _9n) {\n // NOTE: tonelli is too slow for bls-Fp2 calculations even on start\n // Means we cannot use sqrt for constants at all!\n //\n // const c1 = Fp.sqrt(Fp.negate(Fp.ONE)); // 1. c1 = sqrt(-1) in F, i.e., (c1^2) == -1 in F\n // const c2 = Fp.sqrt(c1); // 2. c2 = sqrt(c1) in F, i.e., (c2^2) == c1 in F\n // const c3 = Fp.sqrt(Fp.negate(c1)); // 3. c3 = sqrt(-c1) in F, i.e., (c3^2) == -c1 in F\n // const c4 = (P + _7n) / _16n; // 4. c4 = (q + 7) / 16 # Integer arithmetic\n // sqrt = (x) => {\n // let tv1 = Fp.pow(x, c4); // 1. tv1 = x^c4\n // let tv2 = Fp.mul(c1, tv1); // 2. tv2 = c1 * tv1\n // const tv3 = Fp.mul(c2, tv1); // 3. tv3 = c2 * tv1\n // let tv4 = Fp.mul(c3, tv1); // 4. tv4 = c3 * tv1\n // const e1 = Fp.equals(Fp.square(tv2), x); // 5. e1 = (tv2^2) == x\n // const e2 = Fp.equals(Fp.square(tv3), x); // 6. e2 = (tv3^2) == x\n // tv1 = Fp.cmov(tv1, tv2, e1); // 7. tv1 = CMOV(tv1, tv2, e1) # Select tv2 if (tv2^2) == x\n // tv2 = Fp.cmov(tv4, tv3, e2); // 8. tv2 = CMOV(tv4, tv3, e2) # Select tv3 if (tv3^2) == x\n // const e3 = Fp.equals(Fp.square(tv2), x); // 9. e3 = (tv2^2) == x\n // return Fp.cmov(tv1, tv2, e3); // 10. z = CMOV(tv1, tv2, e3) # Select the sqrt from tv1 and tv2\n // }\n }\n\n // Other cases: Tonelli-Shanks algorithm\n return tonelliShanks(P);\n}\n\n// Little-endian check for first LE bit (last BE bit);\nexport const isNegativeLE = (num: bigint, modulo: bigint) => (mod(num, modulo) & _1n) === _1n;\n\n// Field is not always over prime: for example, Fp2 has ORDER(q)=p^m\nexport interface IField {\n ORDER: bigint;\n BYTES: number;\n BITS: number;\n MASK: bigint;\n ZERO: T;\n ONE: T;\n // 1-arg\n create: (num: T) => T;\n isValid: (num: T) => boolean;\n is0: (num: T) => boolean;\n neg(num: T): T;\n inv(num: T): T;\n sqrt(num: T): T;\n sqr(num: T): T;\n // 2-args\n eql(lhs: T, rhs: T): boolean;\n add(lhs: T, rhs: T): T;\n sub(lhs: T, rhs: T): T;\n mul(lhs: T, rhs: T | bigint): T;\n pow(lhs: T, power: bigint): T;\n div(lhs: T, rhs: T | bigint): T;\n // N for NonNormalized (for now)\n addN(lhs: T, rhs: T): T;\n subN(lhs: T, rhs: T): T;\n mulN(lhs: T, rhs: T | bigint): T;\n sqrN(num: T): T;\n\n // Optional\n // Should be same as sgn0 function in\n // [RFC9380](https://www.rfc-editor.org/rfc/rfc9380#section-4.1).\n // NOTE: sgn0 is 'negative in LE', which is same as odd. And negative in LE is kinda strange definition anyway.\n isOdd?(num: T): boolean; // Odd instead of even since we have it for Fp2\n // legendre?(num: T): T;\n pow(lhs: T, power: bigint): T;\n invertBatch: (lst: T[]) => T[];\n toBytes(num: T): Uint8Array;\n fromBytes(bytes: Uint8Array): T;\n // If c is False, CMOV returns a, otherwise it returns b.\n cmov(a: T, b: T, c: boolean): T;\n}\n// prettier-ignore\nconst FIELD_FIELDS = [\n 'create', 'isValid', 'is0', 'neg', 'inv', 'sqrt', 'sqr',\n 'eql', 'add', 'sub', 'mul', 'pow', 'div',\n 'addN', 'subN', 'mulN', 'sqrN'\n] as const;\nexport function validateField(field: IField) {\n const initial = {\n ORDER: 'bigint',\n MASK: 'bigint',\n BYTES: 'isSafeInteger',\n BITS: 'isSafeInteger',\n } as Record;\n const opts = FIELD_FIELDS.reduce((map, val: string) => {\n map[val] = 'function';\n return map;\n }, initial);\n return validateObject(field, opts);\n}\n\n// Generic field functions\n\n/**\n * Same as `pow` but for Fp: non-constant-time.\n * Unsafe in some contexts: uses ladder, so can expose bigint bits.\n */\nexport function FpPow(f: IField, num: T, power: bigint): T {\n // Should have same speed as pow for bigints\n // TODO: benchmark!\n if (power < _0n) throw new Error('Expected power > 0');\n if (power === _0n) return f.ONE;\n if (power === _1n) return num;\n let p = f.ONE;\n let d = num;\n while (power > _0n) {\n if (power & _1n) p = f.mul(p, d);\n d = f.sqr(d);\n power >>= _1n;\n }\n return p;\n}\n\n/**\n * Efficiently invert an array of Field elements.\n * `inv(0)` will return `undefined` here: make sure to throw an error.\n */\nexport function FpInvertBatch(f: IField, nums: T[]): T[] {\n const tmp = new Array(nums.length);\n // Walk from first to last, multiply them by each other MOD p\n const lastMultiplied = nums.reduce((acc, num, i) => {\n if (f.is0(num)) return acc;\n tmp[i] = acc;\n return f.mul(acc, num);\n }, f.ONE);\n // Invert last element\n const inverted = f.inv(lastMultiplied);\n // Walk from last to first, multiply them by inverted each other MOD p\n nums.reduceRight((acc, num, i) => {\n if (f.is0(num)) return acc;\n tmp[i] = f.mul(acc, tmp[i]);\n return f.mul(acc, num);\n }, inverted);\n return tmp;\n}\n\nexport function FpDiv(f: IField, lhs: T, rhs: T | bigint): T {\n return f.mul(lhs, typeof rhs === 'bigint' ? invert(rhs, f.ORDER) : f.inv(rhs));\n}\n\n// This function returns True whenever the value x is a square in the field F.\nexport function FpIsSquare(f: IField) {\n const legendreConst = (f.ORDER - _1n) / _2n; // Integer arithmetic\n return (x: T): boolean => {\n const p = f.pow(x, legendreConst);\n return f.eql(p, f.ZERO) || f.eql(p, f.ONE);\n };\n}\n\n// CURVE.n lengths\nexport function nLength(n: bigint, nBitLength?: number) {\n // Bit size, byte size of CURVE.n\n const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length;\n const nByteLength = Math.ceil(_nBitLength / 8);\n return { nBitLength: _nBitLength, nByteLength };\n}\n\ntype FpField = IField & Required, 'isOdd'>>;\n/**\n * Initializes a finite field over prime. **Non-primes are not supported.**\n * Do not init in loop: slow. Very fragile: always run a benchmark on a change.\n * Major performance optimizations:\n * * a) denormalized operations like mulN instead of mul\n * * b) same object shape: never add or remove keys\n * * c) Object.freeze\n * @param ORDER prime positive bigint\n * @param bitLen how many bits the field consumes\n * @param isLE (def: false) if encoding / decoding should be in little-endian\n * @param redef optional faster redefinitions of sqrt and other methods\n */\nexport function Field(\n ORDER: bigint,\n bitLen?: number,\n isLE = false,\n redef: Partial> = {}\n): Readonly {\n if (ORDER <= _0n) throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);\n const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen);\n if (BYTES > 2048) throw new Error('Field lengths over 2048 bytes are not supported');\n const sqrtP = FpSqrt(ORDER);\n const f: Readonly = Object.freeze({\n ORDER,\n BITS,\n BYTES,\n MASK: bitMask(BITS),\n ZERO: _0n,\n ONE: _1n,\n create: (num) => mod(num, ORDER),\n isValid: (num) => {\n if (typeof num !== 'bigint')\n throw new Error(`Invalid field element: expected bigint, got ${typeof num}`);\n return _0n <= num && num < ORDER; // 0 is valid element, but it's not invertible\n },\n is0: (num) => num === _0n,\n isOdd: (num) => (num & _1n) === _1n,\n neg: (num) => mod(-num, ORDER),\n eql: (lhs, rhs) => lhs === rhs,\n\n sqr: (num) => mod(num * num, ORDER),\n add: (lhs, rhs) => mod(lhs + rhs, ORDER),\n sub: (lhs, rhs) => mod(lhs - rhs, ORDER),\n mul: (lhs, rhs) => mod(lhs * rhs, ORDER),\n pow: (num, power) => FpPow(f, num, power),\n div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER),\n\n // Same as above, but doesn't normalize\n sqrN: (num) => num * num,\n addN: (lhs, rhs) => lhs + rhs,\n subN: (lhs, rhs) => lhs - rhs,\n mulN: (lhs, rhs) => lhs * rhs,\n\n inv: (num) => invert(num, ORDER),\n sqrt: redef.sqrt || ((n) => sqrtP(f, n)),\n invertBatch: (lst) => FpInvertBatch(f, lst),\n // TODO: do we really need constant cmov?\n // We don't have const-time bigints anyway, so probably will be not very useful\n cmov: (a, b, c) => (c ? b : a),\n toBytes: (num) => (isLE ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES)),\n fromBytes: (bytes) => {\n if (bytes.length !== BYTES)\n throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes.length}`);\n return isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes);\n },\n } as FpField);\n return Object.freeze(f);\n}\n\nexport function FpSqrtOdd(Fp: IField, elm: T) {\n if (!Fp.isOdd) throw new Error(`Field doesn't have isOdd`);\n const root = Fp.sqrt(elm);\n return Fp.isOdd(root) ? root : Fp.neg(root);\n}\n\nexport function FpSqrtEven(Fp: IField, elm: T) {\n if (!Fp.isOdd) throw new Error(`Field doesn't have isOdd`);\n const root = Fp.sqrt(elm);\n return Fp.isOdd(root) ? Fp.neg(root) : root;\n}\n\n/**\n * \"Constant-time\" private key generation utility.\n * Same as mapKeyToField, but accepts less bytes (40 instead of 48 for 32-byte field).\n * Which makes it slightly more biased, less secure.\n * @deprecated use mapKeyToField instead\n */\nexport function hashToPrivateScalar(\n hash: string | Uint8Array,\n groupOrder: bigint,\n isLE = false\n): bigint {\n hash = ensureBytes('privateHash', hash);\n const hashLen = hash.length;\n const minLen = nLength(groupOrder).nByteLength + 8;\n if (minLen < 24 || hashLen < minLen || hashLen > 1024)\n throw new Error(`hashToPrivateScalar: expected ${minLen}-1024 bytes of input, got ${hashLen}`);\n const num = isLE ? bytesToNumberLE(hash) : bytesToNumberBE(hash);\n return mod(num, groupOrder - _1n) + _1n;\n}\n\n/**\n * Returns total number of bytes consumed by the field element.\n * For example, 32 bytes for usual 256-bit weierstrass curve.\n * @param fieldOrder number of field elements, usually CURVE.n\n * @returns byte length of field\n */\nexport function getFieldBytesLength(fieldOrder: bigint): number {\n if (typeof fieldOrder !== 'bigint') throw new Error('field order must be bigint');\n const bitLength = fieldOrder.toString(2).length;\n return Math.ceil(bitLength / 8);\n}\n\n/**\n * Returns minimal amount of bytes that can be safely reduced\n * by field order.\n * Should be 2^-128 for 128-bit curve such as P256.\n * @param fieldOrder number of field elements, usually CURVE.n\n * @returns byte length of target hash\n */\nexport function getMinHashLength(fieldOrder: bigint): number {\n const length = getFieldBytesLength(fieldOrder);\n return length + Math.ceil(length / 2);\n}\n\n/**\n * \"Constant-time\" private key generation utility.\n * Can take (n + n/2) or more bytes of uniform input e.g. from CSPRNG or KDF\n * and convert them into private scalar, with the modulo bias being negligible.\n * Needs at least 48 bytes of input for 32-byte private key.\n * https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/\n * FIPS 186-5, A.2 https://csrc.nist.gov/publications/detail/fips/186/5/final\n * RFC 9380, https://www.rfc-editor.org/rfc/rfc9380#section-5\n * @param hash hash output from SHA3 or a similar function\n * @param groupOrder size of subgroup - (e.g. secp256k1.CURVE.n)\n * @param isLE interpret hash bytes as LE num\n * @returns valid private scalar\n */\nexport function mapHashToField(key: Uint8Array, fieldOrder: bigint, isLE = false): Uint8Array {\n const len = key.length;\n const fieldLen = getFieldBytesLength(fieldOrder);\n const minLen = getMinHashLength(fieldOrder);\n // No small numbers: need to understand bias story. No huge numbers: easier to detect JS timings.\n if (len < 16 || len < minLen || len > 1024)\n throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);\n const num = isLE ? bytesToNumberBE(key) : bytesToNumberLE(key);\n // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0\n const reduced = mod(num, fieldOrder - _1n) + _1n;\n return isLE ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);\n}\n", "/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Abelian group utilities\nimport { IField, validateField, nLength } from './modular.js';\nimport { validateObject } from './utils.js';\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\n\nexport type AffinePoint = {\n x: T;\n y: T;\n} & { z?: never; t?: never };\n\nexport interface Group> {\n double(): T;\n negate(): T;\n add(other: T): T;\n subtract(other: T): T;\n equals(other: T): boolean;\n multiply(scalar: bigint): T;\n}\n\nexport type GroupConstructor = {\n BASE: T;\n ZERO: T;\n};\nexport type Mapper = (i: T[]) => T[];\n\n// Elliptic curve multiplication of Point by scalar. Fragile.\n// Scalars should always be less than curve order: this should be checked inside of a curve itself.\n// Creates precomputation tables for fast multiplication:\n// - private scalar is split by fixed size windows of W bits\n// - every window point is collected from window's table & added to accumulator\n// - since windows are different, same point inside tables won't be accessed more than once per calc\n// - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar)\n// - +1 window is neccessary for wNAF\n// - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication\n// TODO: Research returning 2d JS array of windows, instead of a single window. This would allow\n// windows to be in different memory locations\nexport function wNAF>(c: GroupConstructor, bits: number) {\n const constTimeNegate = (condition: boolean, item: T): T => {\n const neg = item.negate();\n return condition ? neg : item;\n };\n const opts = (W: number) => {\n const windows = Math.ceil(bits / W) + 1; // +1, because\n const windowSize = 2 ** (W - 1); // -1 because we skip zero\n return { windows, windowSize };\n };\n return {\n constTimeNegate,\n // non-const time multiplication ladder\n unsafeLadder(elm: T, n: bigint) {\n let p = c.ZERO;\n let d: T = elm;\n while (n > _0n) {\n if (n & _1n) p = p.add(d);\n d = d.double();\n n >>= _1n;\n }\n return p;\n },\n\n /**\n * Creates a wNAF precomputation window. Used for caching.\n * Default window size is set by `utils.precompute()` and is equal to 8.\n * Number of precomputed points depends on the curve size:\n * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:\n * - 𝑊 is the window size\n * - 𝑛 is the bitlength of the curve order.\n * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.\n * @returns precomputed point tables flattened to a single array\n */\n precomputeWindow(elm: T, W: number): Group[] {\n const { windows, windowSize } = opts(W);\n const points: T[] = [];\n let p: T = elm;\n let base = p;\n for (let window = 0; window < windows; window++) {\n base = p;\n points.push(base);\n // =1, because we skip zero\n for (let i = 1; i < windowSize; i++) {\n base = base.add(p);\n points.push(base);\n }\n p = base.double();\n }\n return points;\n },\n\n /**\n * Implements ec multiplication using precomputed tables and w-ary non-adjacent form.\n * @param W window size\n * @param precomputes precomputed tables\n * @param n scalar (we don't check here, but should be less than curve order)\n * @returns real and fake (for const-time) points\n */\n wNAF(W: number, precomputes: T[], n: bigint): { p: T; f: T } {\n // TODO: maybe check that scalar is less than group order? wNAF behavious is undefined otherwise\n // But need to carefully remove other checks before wNAF. ORDER == bits here\n const { windows, windowSize } = opts(W);\n\n let p = c.ZERO;\n let f = c.BASE;\n\n const mask = BigInt(2 ** W - 1); // Create mask with W ones: 0b1111 for W=4 etc.\n const maxNumber = 2 ** W;\n const shiftBy = BigInt(W);\n\n for (let window = 0; window < windows; window++) {\n const offset = window * windowSize;\n // Extract W bits.\n let wbits = Number(n & mask);\n\n // Shift number by W bits.\n n >>= shiftBy;\n\n // If the bits are bigger than max size, we'll split those.\n // +224 => 256 - 32\n if (wbits > windowSize) {\n wbits -= maxNumber;\n n += _1n;\n }\n\n // This code was first written with assumption that 'f' and 'p' will never be infinity point:\n // since each addition is multiplied by 2 ** W, it cannot cancel each other. However,\n // there is negate now: it is possible that negated element from low value\n // would be the same as high element, which will create carry into next window.\n // It's not obvious how this can fail, but still worth investigating later.\n\n // Check if we're onto Zero point.\n // Add random point inside current window to f.\n const offset1 = offset;\n const offset2 = offset + Math.abs(wbits) - 1; // -1 because we skip zero\n const cond1 = window % 2 !== 0;\n const cond2 = wbits < 0;\n if (wbits === 0) {\n // The most important part for const-time getPublicKey\n f = f.add(constTimeNegate(cond1, precomputes[offset1]));\n } else {\n p = p.add(constTimeNegate(cond2, precomputes[offset2]));\n }\n }\n // JIT-compiler should not eliminate f here, since it will later be used in normalizeZ()\n // Even if the variable is still unused, there are some checks which will\n // throw an exception, so compiler needs to prove they won't happen, which is hard.\n // At this point there is a way to F be infinity-point even if p is not,\n // which makes it less const-time: around 1 bigint multiply.\n return { p, f };\n },\n\n wNAFCached(P: T, precomputesMap: Map, n: bigint, transform: Mapper): { p: T; f: T } {\n // @ts-ignore\n const W: number = P._WINDOW_SIZE || 1;\n // Calculate precomputes on a first run, reuse them after\n let comp = precomputesMap.get(P);\n if (!comp) {\n comp = this.precomputeWindow(P, W) as T[];\n if (W !== 1) {\n precomputesMap.set(P, transform(comp));\n }\n }\n return this.wNAF(W, comp, n);\n },\n };\n}\n\n// Generic BasicCurve interface: works even for polynomial fields (BLS): P, n, h would be ok.\n// Though generator can be different (Fp2 / Fp6 for BLS).\nexport type BasicCurve = {\n Fp: IField; // Field over which we'll do calculations (Fp)\n n: bigint; // Curve order, total count of valid points in the field\n nBitLength?: number; // bit length of curve order\n nByteLength?: number; // byte length of curve order\n h: bigint; // cofactor. we can assign default=1, but users will just ignore it w/o validation\n hEff?: bigint; // Number to multiply to clear cofactor\n Gx: T; // base point X coordinate\n Gy: T; // base point Y coordinate\n allowInfinityPoint?: boolean; // bls12-381 requires it. ZERO point is valid, but invalid pubkey\n};\n\nexport function validateBasic(curve: BasicCurve & T) {\n validateField(curve.Fp);\n validateObject(\n curve,\n {\n n: 'bigint',\n h: 'bigint',\n Gx: 'field',\n Gy: 'field',\n },\n {\n nBitLength: 'isSafeInteger',\n nByteLength: 'isSafeInteger',\n }\n );\n // Set defaults\n return Object.freeze({\n ...nLength(curve.n, curve.nBitLength),\n ...curve,\n ...{ p: curve.Fp.ORDER },\n } as const);\n}\n", "/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Short Weierstrass curve. The formula is: y² = x³ + ax + b\nimport * as mod from './modular.js';\nimport * as ut from './utils.js';\nimport { CHash, Hex, PrivKey, ensureBytes } from './utils.js';\nimport { Group, GroupConstructor, wNAF, BasicCurve, validateBasic, AffinePoint } from './curve.js';\n\nexport type { AffinePoint };\ntype HmacFnSync = (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;\ntype EndomorphismOpts = {\n beta: bigint;\n splitScalar: (k: bigint) => { k1neg: boolean; k1: bigint; k2neg: boolean; k2: bigint };\n};\nexport type BasicWCurve = BasicCurve & {\n // Params: a, b\n a: T;\n b: T;\n\n // Optional params\n allowedPrivateKeyLengths?: readonly number[]; // for P521\n wrapPrivateKey?: boolean; // bls12-381 requires mod(n) instead of rejecting keys >= n\n endo?: EndomorphismOpts; // Endomorphism options for Koblitz curves\n // When a cofactor != 1, there can be an effective methods to:\n // 1. Determine whether a point is torsion-free\n isTorsionFree?: (c: ProjConstructor, point: ProjPointType) => boolean;\n // 2. Clear torsion component\n clearCofactor?: (c: ProjConstructor, point: ProjPointType) => ProjPointType;\n};\n\ntype Entropy = Hex | true;\nexport type SignOpts = { lowS?: boolean; extraEntropy?: Entropy; prehash?: boolean };\nexport type VerOpts = { lowS?: boolean; prehash?: boolean };\n\n/**\n * ### Design rationale for types\n *\n * * Interaction between classes from different curves should fail:\n * `k256.Point.BASE.add(p256.Point.BASE)`\n * * For this purpose we want to use `instanceof` operator, which is fast and works during runtime\n * * Different calls of `curve()` would return different classes -\n * `curve(params) !== curve(params)`: if somebody decided to monkey-patch their curve,\n * it won't affect others\n *\n * TypeScript can't infer types for classes created inside a function. Classes is one instance of nominative types in TypeScript and interfaces only check for shape, so it's hard to create unique type for every function call.\n *\n * We can use generic types via some param, like curve opts, but that would:\n * 1. Enable interaction between `curve(params)` and `curve(params)` (curves of same params)\n * which is hard to debug.\n * 2. Params can be generic and we can't enforce them to be constant value:\n * if somebody creates curve from non-constant params,\n * it would be allowed to interact with other curves with non-constant params\n *\n * TODO: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#unique-symbol\n */\n\n// Instance for 3d XYZ points\nexport interface ProjPointType extends Group> {\n readonly px: T;\n readonly py: T;\n readonly pz: T;\n get x(): T;\n get y(): T;\n multiply(scalar: bigint): ProjPointType;\n toAffine(iz?: T): AffinePoint;\n isTorsionFree(): boolean;\n clearCofactor(): ProjPointType;\n assertValidity(): void;\n hasEvenY(): boolean;\n toRawBytes(isCompressed?: boolean): Uint8Array;\n toHex(isCompressed?: boolean): string;\n\n multiplyUnsafe(scalar: bigint): ProjPointType;\n multiplyAndAddUnsafe(Q: ProjPointType, a: bigint, b: bigint): ProjPointType | undefined;\n _setWindowSize(windowSize: number): void;\n}\n// Static methods for 3d XYZ points\nexport interface ProjConstructor extends GroupConstructor> {\n new (x: T, y: T, z: T): ProjPointType;\n fromAffine(p: AffinePoint): ProjPointType;\n fromHex(hex: Hex): ProjPointType;\n fromPrivateKey(privateKey: PrivKey): ProjPointType;\n normalizeZ(points: ProjPointType[]): ProjPointType[];\n}\n\nexport type CurvePointsType = BasicWCurve & {\n // Bytes\n fromBytes?: (bytes: Uint8Array) => AffinePoint;\n toBytes?: (c: ProjConstructor, point: ProjPointType, isCompressed: boolean) => Uint8Array;\n};\n\nfunction validatePointOpts(curve: CurvePointsType) {\n const opts = validateBasic(curve);\n ut.validateObject(\n opts,\n {\n a: 'field',\n b: 'field',\n },\n {\n allowedPrivateKeyLengths: 'array',\n wrapPrivateKey: 'boolean',\n isTorsionFree: 'function',\n clearCofactor: 'function',\n allowInfinityPoint: 'boolean',\n fromBytes: 'function',\n toBytes: 'function',\n }\n );\n const { endo, Fp, a } = opts;\n if (endo) {\n if (!Fp.eql(a, Fp.ZERO)) {\n throw new Error('Endomorphism can only be defined for Koblitz curves that have a=0');\n }\n if (\n typeof endo !== 'object' ||\n typeof endo.beta !== 'bigint' ||\n typeof endo.splitScalar !== 'function'\n ) {\n throw new Error('Expected endomorphism with beta: bigint and splitScalar: function');\n }\n }\n return Object.freeze({ ...opts } as const);\n}\n\nexport type CurvePointsRes = {\n ProjectivePoint: ProjConstructor;\n normPrivateKeyToScalar: (key: PrivKey) => bigint;\n weierstrassEquation: (x: T) => T;\n isWithinCurveOrder: (num: bigint) => boolean;\n};\n\n// ASN.1 DER encoding utilities\nconst { bytesToNumberBE: b2n, hexToBytes: h2b } = ut;\nexport const DER = {\n // asn.1 DER encoding utils\n Err: class DERErr extends Error {\n constructor(m = '') {\n super(m);\n }\n },\n _parseInt(data: Uint8Array): { d: bigint; l: Uint8Array } {\n const { Err: E } = DER;\n if (data.length < 2 || data[0] !== 0x02) throw new E('Invalid signature integer tag');\n const len = data[1];\n const res = data.subarray(2, len + 2);\n if (!len || res.length !== len) throw new E('Invalid signature integer: wrong length');\n // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,\n // since we always use positive integers here. It must always be empty:\n // - add zero byte if exists\n // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)\n if (res[0] & 0b10000000) throw new E('Invalid signature integer: negative');\n if (res[0] === 0x00 && !(res[1] & 0b10000000))\n throw new E('Invalid signature integer: unnecessary leading zero');\n return { d: b2n(res), l: data.subarray(len + 2) }; // d is data, l is left\n },\n toSig(hex: string | Uint8Array): { r: bigint; s: bigint } {\n // parse DER signature\n const { Err: E } = DER;\n const data = typeof hex === 'string' ? h2b(hex) : hex;\n if (!(data instanceof Uint8Array)) throw new Error('ui8a expected');\n let l = data.length;\n if (l < 2 || data[0] != 0x30) throw new E('Invalid signature tag');\n if (data[1] !== l - 2) throw new E('Invalid signature: incorrect length');\n const { d: r, l: sBytes } = DER._parseInt(data.subarray(2));\n const { d: s, l: rBytesLeft } = DER._parseInt(sBytes);\n if (rBytesLeft.length) throw new E('Invalid signature: left bytes after parsing');\n return { r, s };\n },\n hexFromSig(sig: { r: bigint; s: bigint }): string {\n // Add leading zero if first byte has negative bit enabled. More details in '_parseInt'\n const slice = (s: string): string => (Number.parseInt(s[0], 16) & 0b1000 ? '00' + s : s);\n const h = (num: number | bigint) => {\n const hex = num.toString(16);\n return hex.length & 1 ? `0${hex}` : hex;\n };\n const s = slice(h(sig.s));\n const r = slice(h(sig.r));\n const shl = s.length / 2;\n const rhl = r.length / 2;\n const sl = h(shl);\n const rl = h(rhl);\n return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`;\n },\n};\n\n// Be friendly to bad ECMAScript parsers by not using bigint literals\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4);\n\nexport function weierstrassPoints(opts: CurvePointsType) {\n const CURVE = validatePointOpts(opts);\n const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ\n\n const toBytes =\n CURVE.toBytes ||\n ((_c: ProjConstructor, point: ProjPointType, _isCompressed: boolean) => {\n const a = point.toAffine();\n return ut.concatBytes(Uint8Array.from([0x04]), Fp.toBytes(a.x), Fp.toBytes(a.y));\n });\n const fromBytes =\n CURVE.fromBytes ||\n ((bytes: Uint8Array) => {\n // const head = bytes[0];\n const tail = bytes.subarray(1);\n // if (head !== 0x04) throw new Error('Only non-compressed encoding is supported');\n const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES));\n const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES));\n return { x, y };\n });\n\n /**\n * y² = x³ + ax + b: Short weierstrass curve formula\n * @returns y²\n */\n function weierstrassEquation(x: T): T {\n const { a, b } = CURVE;\n const x2 = Fp.sqr(x); // x * x\n const x3 = Fp.mul(x2, x); // x2 * x\n return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x3 + a * x + b\n }\n // Validate whether the passed curve params are valid.\n // We check if curve equation works for generator point.\n // `assertValidity()` won't work: `isTorsionFree()` is not available at this point in bls12-381.\n // ProjectivePoint class has not been initialized yet.\n if (!Fp.eql(Fp.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx)))\n throw new Error('bad generator point: equation left != right');\n\n // Valid group elements reside in range 1..n-1\n function isWithinCurveOrder(num: bigint): boolean {\n return typeof num === 'bigint' && _0n < num && num < CURVE.n;\n }\n function assertGE(num: bigint) {\n if (!isWithinCurveOrder(num)) throw new Error('Expected valid bigint: 0 < bigint < curve.n');\n }\n // Validates if priv key is valid and converts it to bigint.\n // Supports options allowedPrivateKeyLengths and wrapPrivateKey.\n function normPrivateKeyToScalar(key: PrivKey): bigint {\n const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE;\n if (lengths && typeof key !== 'bigint') {\n if (key instanceof Uint8Array) key = ut.bytesToHex(key);\n // Normalize to hex string, pad. E.g. P521 would norm 130-132 char hex to 132-char bytes\n if (typeof key !== 'string' || !lengths.includes(key.length)) throw new Error('Invalid key');\n key = key.padStart(nByteLength * 2, '0');\n }\n let num: bigint;\n try {\n num =\n typeof key === 'bigint'\n ? key\n : ut.bytesToNumberBE(ensureBytes('private key', key, nByteLength));\n } catch (error) {\n throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`);\n }\n if (wrapPrivateKey) num = mod.mod(num, n); // disabled by default, enabled for BLS\n assertGE(num); // num in range [1..N-1]\n return num;\n }\n\n const pointPrecomputes = new Map();\n function assertPrjPoint(other: unknown) {\n if (!(other instanceof Point)) throw new Error('ProjectivePoint expected');\n }\n /**\n * Projective Point works in 3d / projective (homogeneous) coordinates: (x, y, z) ∋ (x=x/z, y=y/z)\n * Default Point works in 2d / affine coordinates: (x, y)\n * We're doing calculations in projective, because its operations don't require costly inversion.\n */\n class Point implements ProjPointType {\n static readonly BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE);\n static readonly ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO);\n\n constructor(readonly px: T, readonly py: T, readonly pz: T) {\n if (px == null || !Fp.isValid(px)) throw new Error('x required');\n if (py == null || !Fp.isValid(py)) throw new Error('y required');\n if (pz == null || !Fp.isValid(pz)) throw new Error('z required');\n }\n\n // Does not validate if the point is on-curve.\n // Use fromHex instead, or call assertValidity() later.\n static fromAffine(p: AffinePoint): Point {\n const { x, y } = p || {};\n if (!p || !Fp.isValid(x) || !Fp.isValid(y)) throw new Error('invalid affine point');\n if (p instanceof Point) throw new Error('projective point not allowed');\n const is0 = (i: T) => Fp.eql(i, Fp.ZERO);\n // fromAffine(x:0, y:0) would produce (x:0, y:0, z:1), but we need (x:0, y:1, z:0)\n if (is0(x) && is0(y)) return Point.ZERO;\n return new Point(x, y, Fp.ONE);\n }\n\n get x(): T {\n return this.toAffine().x;\n }\n get y(): T {\n return this.toAffine().y;\n }\n\n /**\n * Takes a bunch of Projective Points but executes only one\n * inversion on all of them. Inversion is very slow operation,\n * so this improves performance massively.\n * Optimization: converts a list of projective points to a list of identical points with Z=1.\n */\n static normalizeZ(points: Point[]): Point[] {\n const toInv = Fp.invertBatch(points.map((p) => p.pz));\n return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);\n }\n\n /**\n * Converts hash string or Uint8Array to Point.\n * @param hex short/long ECDSA hex\n */\n static fromHex(hex: Hex): Point {\n const P = Point.fromAffine(fromBytes(ensureBytes('pointHex', hex)));\n P.assertValidity();\n return P;\n }\n\n // Multiplies generator point by privateKey.\n static fromPrivateKey(privateKey: PrivKey) {\n return Point.BASE.multiply(normPrivateKeyToScalar(privateKey));\n }\n\n // We calculate precomputes for elliptic curve point multiplication\n // using windowed method. This specifies window size and\n // stores precomputed values. Usually only base point would be precomputed.\n _WINDOW_SIZE?: number;\n\n // \"Private method\", don't use it directly\n _setWindowSize(windowSize: number) {\n this._WINDOW_SIZE = windowSize;\n pointPrecomputes.delete(this);\n }\n\n // A point on curve is valid if it conforms to equation.\n assertValidity(): void {\n if (this.is0()) {\n // (0, 1, 0) aka ZERO is invalid in most contexts.\n // In BLS, ZERO can be serialized, so we allow it.\n // (0, 0, 0) is wrong representation of ZERO and is always invalid.\n if (CURVE.allowInfinityPoint && !Fp.is0(this.py)) return;\n throw new Error('bad point: ZERO');\n }\n // Some 3rd-party test vectors require different wording between here & `fromCompressedHex`\n const { x, y } = this.toAffine();\n // Check if x, y are valid field elements\n if (!Fp.isValid(x) || !Fp.isValid(y)) throw new Error('bad point: x or y not FE');\n const left = Fp.sqr(y); // y²\n const right = weierstrassEquation(x); // x³ + ax + b\n if (!Fp.eql(left, right)) throw new Error('bad point: equation left != right');\n if (!this.isTorsionFree()) throw new Error('bad point: not in prime-order subgroup');\n }\n hasEvenY(): boolean {\n const { y } = this.toAffine();\n if (Fp.isOdd) return !Fp.isOdd(y);\n throw new Error(\"Field doesn't support isOdd\");\n }\n\n /**\n * Compare one point to another.\n */\n equals(other: Point): boolean {\n assertPrjPoint(other);\n const { px: X1, py: Y1, pz: Z1 } = this;\n const { px: X2, py: Y2, pz: Z2 } = other;\n const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1));\n const U2 = Fp.eql(Fp.mul(Y1, Z2), Fp.mul(Y2, Z1));\n return U1 && U2;\n }\n\n /**\n * Flips point to one corresponding to (x, -y) in Affine coordinates.\n */\n negate(): Point {\n return new Point(this.px, Fp.neg(this.py), this.pz);\n }\n\n // Renes-Costello-Batina exception-free doubling formula.\n // There is 30% faster Jacobian formula, but it is not complete.\n // https://eprint.iacr.org/2015/1060, algorithm 3\n // Cost: 8M + 3S + 3*a + 2*b3 + 15add.\n double() {\n const { a, b } = CURVE;\n const b3 = Fp.mul(b, _3n);\n const { px: X1, py: Y1, pz: Z1 } = this;\n let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore\n let t0 = Fp.mul(X1, X1); // step 1\n let t1 = Fp.mul(Y1, Y1);\n let t2 = Fp.mul(Z1, Z1);\n let t3 = Fp.mul(X1, Y1);\n t3 = Fp.add(t3, t3); // step 5\n Z3 = Fp.mul(X1, Z1);\n Z3 = Fp.add(Z3, Z3);\n X3 = Fp.mul(a, Z3);\n Y3 = Fp.mul(b3, t2);\n Y3 = Fp.add(X3, Y3); // step 10\n X3 = Fp.sub(t1, Y3);\n Y3 = Fp.add(t1, Y3);\n Y3 = Fp.mul(X3, Y3);\n X3 = Fp.mul(t3, X3);\n Z3 = Fp.mul(b3, Z3); // step 15\n t2 = Fp.mul(a, t2);\n t3 = Fp.sub(t0, t2);\n t3 = Fp.mul(a, t3);\n t3 = Fp.add(t3, Z3);\n Z3 = Fp.add(t0, t0); // step 20\n t0 = Fp.add(Z3, t0);\n t0 = Fp.add(t0, t2);\n t0 = Fp.mul(t0, t3);\n Y3 = Fp.add(Y3, t0);\n t2 = Fp.mul(Y1, Z1); // step 25\n t2 = Fp.add(t2, t2);\n t0 = Fp.mul(t2, t3);\n X3 = Fp.sub(X3, t0);\n Z3 = Fp.mul(t2, t1);\n Z3 = Fp.add(Z3, Z3); // step 30\n Z3 = Fp.add(Z3, Z3);\n return new Point(X3, Y3, Z3);\n }\n\n // Renes-Costello-Batina exception-free addition formula.\n // There is 30% faster Jacobian formula, but it is not complete.\n // https://eprint.iacr.org/2015/1060, algorithm 1\n // Cost: 12M + 0S + 3*a + 3*b3 + 23add.\n add(other: Point): Point {\n assertPrjPoint(other);\n const { px: X1, py: Y1, pz: Z1 } = this;\n const { px: X2, py: Y2, pz: Z2 } = other;\n let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore\n const a = CURVE.a;\n const b3 = Fp.mul(CURVE.b, _3n);\n let t0 = Fp.mul(X1, X2); // step 1\n let t1 = Fp.mul(Y1, Y2);\n let t2 = Fp.mul(Z1, Z2);\n let t3 = Fp.add(X1, Y1);\n let t4 = Fp.add(X2, Y2); // step 5\n t3 = Fp.mul(t3, t4);\n t4 = Fp.add(t0, t1);\n t3 = Fp.sub(t3, t4);\n t4 = Fp.add(X1, Z1);\n let t5 = Fp.add(X2, Z2); // step 10\n t4 = Fp.mul(t4, t5);\n t5 = Fp.add(t0, t2);\n t4 = Fp.sub(t4, t5);\n t5 = Fp.add(Y1, Z1);\n X3 = Fp.add(Y2, Z2); // step 15\n t5 = Fp.mul(t5, X3);\n X3 = Fp.add(t1, t2);\n t5 = Fp.sub(t5, X3);\n Z3 = Fp.mul(a, t4);\n X3 = Fp.mul(b3, t2); // step 20\n Z3 = Fp.add(X3, Z3);\n X3 = Fp.sub(t1, Z3);\n Z3 = Fp.add(t1, Z3);\n Y3 = Fp.mul(X3, Z3);\n t1 = Fp.add(t0, t0); // step 25\n t1 = Fp.add(t1, t0);\n t2 = Fp.mul(a, t2);\n t4 = Fp.mul(b3, t4);\n t1 = Fp.add(t1, t2);\n t2 = Fp.sub(t0, t2); // step 30\n t2 = Fp.mul(a, t2);\n t4 = Fp.add(t4, t2);\n t0 = Fp.mul(t1, t4);\n Y3 = Fp.add(Y3, t0);\n t0 = Fp.mul(t5, t4); // step 35\n X3 = Fp.mul(t3, X3);\n X3 = Fp.sub(X3, t0);\n t0 = Fp.mul(t3, t1);\n Z3 = Fp.mul(t5, Z3);\n Z3 = Fp.add(Z3, t0); // step 40\n return new Point(X3, Y3, Z3);\n }\n\n subtract(other: Point) {\n return this.add(other.negate());\n }\n\n private is0() {\n return this.equals(Point.ZERO);\n }\n private wNAF(n: bigint): { p: Point; f: Point } {\n return wnaf.wNAFCached(this, pointPrecomputes, n, (comp: Point[]) => {\n const toInv = Fp.invertBatch(comp.map((p) => p.pz));\n return comp.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);\n });\n }\n\n /**\n * Non-constant-time multiplication. Uses double-and-add algorithm.\n * It's faster, but should only be used when you don't care about\n * an exposed private key e.g. sig verification, which works over *public* keys.\n */\n multiplyUnsafe(n: bigint): Point {\n const I = Point.ZERO;\n if (n === _0n) return I;\n assertGE(n); // Will throw on 0\n if (n === _1n) return this;\n const { endo } = CURVE;\n if (!endo) return wnaf.unsafeLadder(this, n);\n\n // Apply endomorphism\n let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);\n let k1p = I;\n let k2p = I;\n let d: Point = this;\n while (k1 > _0n || k2 > _0n) {\n if (k1 & _1n) k1p = k1p.add(d);\n if (k2 & _1n) k2p = k2p.add(d);\n d = d.double();\n k1 >>= _1n;\n k2 >>= _1n;\n }\n if (k1neg) k1p = k1p.negate();\n if (k2neg) k2p = k2p.negate();\n k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz);\n return k1p.add(k2p);\n }\n\n /**\n * Constant time multiplication.\n * Uses wNAF method. Windowed method may be 10% faster,\n * but takes 2x longer to generate and consumes 2x memory.\n * Uses precomputes when available.\n * Uses endomorphism for Koblitz curves.\n * @param scalar by which the point would be multiplied\n * @returns New point\n */\n multiply(scalar: bigint): Point {\n assertGE(scalar);\n let n = scalar;\n let point: Point, fake: Point; // Fake point is used to const-time mult\n const { endo } = CURVE;\n if (endo) {\n const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);\n let { p: k1p, f: f1p } = this.wNAF(k1);\n let { p: k2p, f: f2p } = this.wNAF(k2);\n k1p = wnaf.constTimeNegate(k1neg, k1p);\n k2p = wnaf.constTimeNegate(k2neg, k2p);\n k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz);\n point = k1p.add(k2p);\n fake = f1p.add(f2p);\n } else {\n const { p, f } = this.wNAF(n);\n point = p;\n fake = f;\n }\n // Normalize `z` for both points, but return only real one\n return Point.normalizeZ([point, fake])[0];\n }\n\n /**\n * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly.\n * Not using Strauss-Shamir trick: precomputation tables are faster.\n * The trick could be useful if both P and Q are not G (not in our case).\n * @returns non-zero affine point\n */\n multiplyAndAddUnsafe(Q: Point, a: bigint, b: bigint): Point | undefined {\n const G = Point.BASE; // No Strauss-Shamir trick: we have 10% faster G precomputes\n const mul = (\n P: Point,\n a: bigint // Select faster multiply() method\n ) => (a === _0n || a === _1n || !P.equals(G) ? P.multiplyUnsafe(a) : P.multiply(a));\n const sum = mul(this, a).add(mul(Q, b));\n return sum.is0() ? undefined : sum;\n }\n\n // Converts Projective point to affine (x, y) coordinates.\n // Can accept precomputed Z^-1 - for example, from invertBatch.\n // (x, y, z) ∋ (x=x/z, y=y/z)\n toAffine(iz?: T): AffinePoint {\n const { px: x, py: y, pz: z } = this;\n const is0 = this.is0();\n // If invZ was 0, we return zero point. However we still want to execute\n // all operations, so we replace invZ with a random number, 1.\n if (iz == null) iz = is0 ? Fp.ONE : Fp.inv(z);\n const ax = Fp.mul(x, iz);\n const ay = Fp.mul(y, iz);\n const zz = Fp.mul(z, iz);\n if (is0) return { x: Fp.ZERO, y: Fp.ZERO };\n if (!Fp.eql(zz, Fp.ONE)) throw new Error('invZ was invalid');\n return { x: ax, y: ay };\n }\n isTorsionFree(): boolean {\n const { h: cofactor, isTorsionFree } = CURVE;\n if (cofactor === _1n) return true; // No subgroups, always torsion-free\n if (isTorsionFree) return isTorsionFree(Point, this);\n throw new Error('isTorsionFree() has not been declared for the elliptic curve');\n }\n clearCofactor(): Point {\n const { h: cofactor, clearCofactor } = CURVE;\n if (cofactor === _1n) return this; // Fast-path\n if (clearCofactor) return clearCofactor(Point, this) as Point;\n return this.multiplyUnsafe(CURVE.h);\n }\n\n toRawBytes(isCompressed = true): Uint8Array {\n this.assertValidity();\n return toBytes(Point, this, isCompressed);\n }\n\n toHex(isCompressed = true): string {\n return ut.bytesToHex(this.toRawBytes(isCompressed));\n }\n }\n const _bits = CURVE.nBitLength;\n const wnaf = wNAF(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits);\n // Validate if generator point is on curve\n return {\n CURVE,\n ProjectivePoint: Point as ProjConstructor,\n normPrivateKeyToScalar,\n weierstrassEquation,\n isWithinCurveOrder,\n };\n}\n\n// Instance\nexport interface SignatureType {\n readonly r: bigint;\n readonly s: bigint;\n readonly recovery?: number;\n assertValidity(): void;\n addRecoveryBit(recovery: number): RecoveredSignatureType;\n hasHighS(): boolean;\n normalizeS(): SignatureType;\n recoverPublicKey(msgHash: Hex): ProjPointType;\n toCompactRawBytes(): Uint8Array;\n toCompactHex(): string;\n // DER-encoded\n toDERRawBytes(isCompressed?: boolean): Uint8Array;\n toDERHex(isCompressed?: boolean): string;\n}\nexport type RecoveredSignatureType = SignatureType & {\n readonly recovery: number;\n};\n// Static methods\nexport type SignatureConstructor = {\n new (r: bigint, s: bigint): SignatureType;\n fromCompact(hex: Hex): SignatureType;\n fromDER(hex: Hex): SignatureType;\n};\ntype SignatureLike = { r: bigint; s: bigint };\n\nexport type PubKey = Hex | ProjPointType;\n\nexport type CurveType = BasicWCurve & {\n hash: CHash; // CHash not FHash because we need outputLen for DRBG\n hmac: HmacFnSync;\n randomBytes: (bytesLength?: number) => Uint8Array;\n lowS?: boolean;\n bits2int?: (bytes: Uint8Array) => bigint;\n bits2int_modN?: (bytes: Uint8Array) => bigint;\n};\n\nfunction validateOpts(curve: CurveType) {\n const opts = validateBasic(curve);\n ut.validateObject(\n opts,\n {\n hash: 'hash',\n hmac: 'function',\n randomBytes: 'function',\n },\n {\n bits2int: 'function',\n bits2int_modN: 'function',\n lowS: 'boolean',\n }\n );\n return Object.freeze({ lowS: true, ...opts } as const);\n}\n\nexport type CurveFn = {\n CURVE: ReturnType;\n getPublicKey: (privateKey: PrivKey, isCompressed?: boolean) => Uint8Array;\n getSharedSecret: (privateA: PrivKey, publicB: Hex, isCompressed?: boolean) => Uint8Array;\n sign: (msgHash: Hex, privKey: PrivKey, opts?: SignOpts) => RecoveredSignatureType;\n verify: (signature: Hex | SignatureLike, msgHash: Hex, publicKey: Hex, opts?: VerOpts) => boolean;\n ProjectivePoint: ProjConstructor;\n Signature: SignatureConstructor;\n utils: {\n normPrivateKeyToScalar: (key: PrivKey) => bigint;\n isValidPrivateKey(privateKey: PrivKey): boolean;\n randomPrivateKey: () => Uint8Array;\n precompute: (windowSize?: number, point?: ProjPointType) => ProjPointType;\n };\n};\n\nexport function weierstrass(curveDef: CurveType): CurveFn {\n const CURVE = validateOpts(curveDef) as ReturnType;\n const { Fp, n: CURVE_ORDER } = CURVE;\n const compressedLen = Fp.BYTES + 1; // e.g. 33 for 32\n const uncompressedLen = 2 * Fp.BYTES + 1; // e.g. 65 for 32\n\n function isValidFieldElement(num: bigint): boolean {\n return _0n < num && num < Fp.ORDER; // 0 is banned since it's not invertible FE\n }\n function modN(a: bigint) {\n return mod.mod(a, CURVE_ORDER);\n }\n function invN(a: bigint) {\n return mod.invert(a, CURVE_ORDER);\n }\n\n const {\n ProjectivePoint: Point,\n normPrivateKeyToScalar,\n weierstrassEquation,\n isWithinCurveOrder,\n } = weierstrassPoints({\n ...CURVE,\n toBytes(_c, point, isCompressed: boolean): Uint8Array {\n const a = point.toAffine();\n const x = Fp.toBytes(a.x);\n const cat = ut.concatBytes;\n if (isCompressed) {\n return cat(Uint8Array.from([point.hasEvenY() ? 0x02 : 0x03]), x);\n } else {\n return cat(Uint8Array.from([0x04]), x, Fp.toBytes(a.y));\n }\n },\n fromBytes(bytes: Uint8Array) {\n const len = bytes.length;\n const head = bytes[0];\n const tail = bytes.subarray(1);\n // this.assertValidity() is done inside of fromHex\n if (len === compressedLen && (head === 0x02 || head === 0x03)) {\n const x = ut.bytesToNumberBE(tail);\n if (!isValidFieldElement(x)) throw new Error('Point is not on curve');\n const y2 = weierstrassEquation(x); // y² = x³ + ax + b\n let y = Fp.sqrt(y2); // y = y² ^ (p+1)/4\n const isYOdd = (y & _1n) === _1n;\n // ECDSA\n const isHeadOdd = (head & 1) === 1;\n if (isHeadOdd !== isYOdd) y = Fp.neg(y);\n return { x, y };\n } else if (len === uncompressedLen && head === 0x04) {\n const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES));\n const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES));\n return { x, y };\n } else {\n throw new Error(\n `Point of length ${len} was invalid. Expected ${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes`\n );\n }\n },\n });\n const numToNByteStr = (num: bigint): string =>\n ut.bytesToHex(ut.numberToBytesBE(num, CURVE.nByteLength));\n\n function isBiggerThanHalfOrder(number: bigint) {\n const HALF = CURVE_ORDER >> _1n;\n return number > HALF;\n }\n\n function normalizeS(s: bigint) {\n return isBiggerThanHalfOrder(s) ? modN(-s) : s;\n }\n // slice bytes num\n const slcNum = (b: Uint8Array, from: number, to: number) => ut.bytesToNumberBE(b.slice(from, to));\n\n /**\n * ECDSA signature with its (r, s) properties. Supports DER & compact representations.\n */\n class Signature implements SignatureType {\n constructor(readonly r: bigint, readonly s: bigint, readonly recovery?: number) {\n this.assertValidity();\n }\n\n // pair (bytes of r, bytes of s)\n static fromCompact(hex: Hex) {\n const l = CURVE.nByteLength;\n hex = ensureBytes('compactSignature', hex, l * 2);\n return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l));\n }\n\n // DER encoded ECDSA signature\n // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script\n static fromDER(hex: Hex) {\n const { r, s } = DER.toSig(ensureBytes('DER', hex));\n return new Signature(r, s);\n }\n\n assertValidity(): void {\n // can use assertGE here\n if (!isWithinCurveOrder(this.r)) throw new Error('r must be 0 < r < CURVE.n');\n if (!isWithinCurveOrder(this.s)) throw new Error('s must be 0 < s < CURVE.n');\n }\n\n addRecoveryBit(recovery: number): RecoveredSignature {\n return new Signature(this.r, this.s, recovery) as RecoveredSignature;\n }\n\n recoverPublicKey(msgHash: Hex): typeof Point.BASE {\n const { r, s, recovery: rec } = this;\n const h = bits2int_modN(ensureBytes('msgHash', msgHash)); // Truncate hash\n if (rec == null || ![0, 1, 2, 3].includes(rec)) throw new Error('recovery id invalid');\n const radj = rec === 2 || rec === 3 ? r + CURVE.n : r;\n if (radj >= Fp.ORDER) throw new Error('recovery id 2 or 3 invalid');\n const prefix = (rec & 1) === 0 ? '02' : '03';\n const R = Point.fromHex(prefix + numToNByteStr(radj));\n const ir = invN(radj); // r^-1\n const u1 = modN(-h * ir); // -hr^-1\n const u2 = modN(s * ir); // sr^-1\n const Q = Point.BASE.multiplyAndAddUnsafe(R, u1, u2); // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1)\n if (!Q) throw new Error('point at infinify'); // unsafe is fine: no priv data leaked\n Q.assertValidity();\n return Q;\n }\n\n // Signatures should be low-s, to prevent malleability.\n hasHighS(): boolean {\n return isBiggerThanHalfOrder(this.s);\n }\n\n normalizeS() {\n return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this;\n }\n\n // DER-encoded\n toDERRawBytes() {\n return ut.hexToBytes(this.toDERHex());\n }\n toDERHex() {\n return DER.hexFromSig({ r: this.r, s: this.s });\n }\n\n // padded bytes of r, then padded bytes of s\n toCompactRawBytes() {\n return ut.hexToBytes(this.toCompactHex());\n }\n toCompactHex() {\n return numToNByteStr(this.r) + numToNByteStr(this.s);\n }\n }\n type RecoveredSignature = Signature & { recovery: number };\n\n const utils = {\n isValidPrivateKey(privateKey: PrivKey) {\n try {\n normPrivateKeyToScalar(privateKey);\n return true;\n } catch (error) {\n return false;\n }\n },\n normPrivateKeyToScalar: normPrivateKeyToScalar,\n\n /**\n * Produces cryptographically secure private key from random of size\n * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible.\n */\n randomPrivateKey: (): Uint8Array => {\n const length = mod.getMinHashLength(CURVE.n);\n return mod.mapHashToField(CURVE.randomBytes(length), CURVE.n);\n },\n\n /**\n * Creates precompute table for an arbitrary EC point. Makes point \"cached\".\n * Allows to massively speed-up `point.multiply(scalar)`.\n * @returns cached point\n * @example\n * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey));\n * fast.multiply(privKey); // much faster ECDH now\n */\n precompute(windowSize = 8, point = Point.BASE): typeof Point.BASE {\n point._setWindowSize(windowSize);\n point.multiply(BigInt(3)); // 3 is arbitrary, just need any number here\n return point;\n },\n };\n\n /**\n * Computes public key for a private key. Checks for validity of the private key.\n * @param privateKey private key\n * @param isCompressed whether to return compact (default), or full key\n * @returns Public key, full when isCompressed=false; short when isCompressed=true\n */\n function getPublicKey(privateKey: PrivKey, isCompressed = true): Uint8Array {\n return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed);\n }\n\n /**\n * Quick and dirty check for item being public key. Does not validate hex, or being on-curve.\n */\n function isProbPub(item: PrivKey | PubKey): boolean {\n const arr = item instanceof Uint8Array;\n const str = typeof item === 'string';\n const len = (arr || str) && (item as Hex).length;\n if (arr) return len === compressedLen || len === uncompressedLen;\n if (str) return len === 2 * compressedLen || len === 2 * uncompressedLen;\n if (item instanceof Point) return true;\n return false;\n }\n\n /**\n * ECDH (Elliptic Curve Diffie Hellman).\n * Computes shared public key from private key and public key.\n * Checks: 1) private key validity 2) shared key is on-curve.\n * Does NOT hash the result.\n * @param privateA private key\n * @param publicB different public key\n * @param isCompressed whether to return compact (default), or full key\n * @returns shared public key\n */\n function getSharedSecret(privateA: PrivKey, publicB: Hex, isCompressed = true): Uint8Array {\n if (isProbPub(privateA)) throw new Error('first arg must be private key');\n if (!isProbPub(publicB)) throw new Error('second arg must be public key');\n const b = Point.fromHex(publicB); // check for being on-curve\n return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed);\n }\n\n // RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets.\n // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int.\n // bits2int can produce res>N, we can do mod(res, N) since the bitLen is the same.\n // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors\n const bits2int =\n CURVE.bits2int ||\n function (bytes: Uint8Array): bigint {\n // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m)\n // for some cases, since bytes.length * 8 is not actual bitLength.\n const num = ut.bytesToNumberBE(bytes); // check for == u8 done here\n const delta = bytes.length * 8 - CURVE.nBitLength; // truncate to nBitLength leftmost bits\n return delta > 0 ? num >> BigInt(delta) : num;\n };\n const bits2int_modN =\n CURVE.bits2int_modN ||\n function (bytes: Uint8Array): bigint {\n return modN(bits2int(bytes)); // can't use bytesToNumberBE here\n };\n // NOTE: pads output with zero as per spec\n const ORDER_MASK = ut.bitMask(CURVE.nBitLength);\n /**\n * Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`.\n */\n function int2octets(num: bigint): Uint8Array {\n if (typeof num !== 'bigint') throw new Error('bigint expected');\n if (!(_0n <= num && num < ORDER_MASK))\n throw new Error(`bigint expected < 2^${CURVE.nBitLength}`);\n // works with order, can have different size than numToField!\n return ut.numberToBytesBE(num, CURVE.nByteLength);\n }\n\n // Steps A, D of RFC6979 3.2\n // Creates RFC6979 seed; converts msg/privKey to numbers.\n // Used only in sign, not in verify.\n // NOTE: we cannot assume here that msgHash has same amount of bytes as curve order, this will be wrong at least for P521.\n // Also it can be bigger for P224 + SHA256\n function prepSig(msgHash: Hex, privateKey: PrivKey, opts = defaultSigOpts) {\n if (['recovered', 'canonical'].some((k) => k in opts))\n throw new Error('sign() legacy options not supported');\n const { hash, randomBytes } = CURVE;\n let { lowS, prehash, extraEntropy: ent } = opts; // generates low-s sigs by default\n if (lowS == null) lowS = true; // RFC6979 3.2: we skip step A, because we already provide hash\n msgHash = ensureBytes('msgHash', msgHash);\n if (prehash) msgHash = ensureBytes('prehashed msgHash', hash(msgHash));\n\n // We can't later call bits2octets, since nested bits2int is broken for curves\n // with nBitLength % 8 !== 0. Because of that, we unwrap it here as int2octets call.\n // const bits2octets = (bits) => int2octets(bits2int_modN(bits))\n const h1int = bits2int_modN(msgHash);\n const d = normPrivateKeyToScalar(privateKey); // validate private key, convert to bigint\n const seedArgs = [int2octets(d), int2octets(h1int)];\n // extraEntropy. RFC6979 3.6: additional k' (optional).\n if (ent != null) {\n // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k')\n const e = ent === true ? randomBytes(Fp.BYTES) : ent; // generate random bytes OR pass as-is\n seedArgs.push(ensureBytes('extraEntropy', e)); // check for being bytes\n }\n const seed = ut.concatBytes(...seedArgs); // Step D of RFC6979 3.2\n const m = h1int; // NOTE: no need to call bits2int second time here, it is inside truncateHash!\n // Converts signature params into point w r/s, checks result for validity.\n function k2sig(kBytes: Uint8Array): RecoveredSignature | undefined {\n // RFC 6979 Section 3.2, step 3: k = bits2int(T)\n const k = bits2int(kBytes); // Cannot use fields methods, since it is group element\n if (!isWithinCurveOrder(k)) return; // Important: all mod() calls here must be done over N\n const ik = invN(k); // k^-1 mod n\n const q = Point.BASE.multiply(k).toAffine(); // q = Gk\n const r = modN(q.x); // r = q.x mod n\n if (r === _0n) return;\n // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to\n // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it:\n // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT\n const s = modN(ik * modN(m + r * d)); // Not using blinding here\n if (s === _0n) return;\n let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n); // recovery bit (2 or 3, when q.x > n)\n let normS = s;\n if (lowS && isBiggerThanHalfOrder(s)) {\n normS = normalizeS(s); // if lowS was passed, ensure s is always\n recovery ^= 1; // // in the bottom half of N\n }\n return new Signature(r, normS, recovery) as RecoveredSignature; // use normS, not s\n }\n return { seed, k2sig };\n }\n const defaultSigOpts: SignOpts = { lowS: CURVE.lowS, prehash: false };\n const defaultVerOpts: VerOpts = { lowS: CURVE.lowS, prehash: false };\n\n /**\n * Signs message hash with a private key.\n * ```\n * sign(m, d, k) where\n * (x, y) = G × k\n * r = x mod n\n * s = (m + dr)/k mod n\n * ```\n * @param msgHash NOT message. msg needs to be hashed to `msgHash`, or use `prehash`.\n * @param privKey private key\n * @param opts lowS for non-malleable sigs. extraEntropy for mixing randomness into k. prehash will hash first arg.\n * @returns signature with recovery param\n */\n function sign(msgHash: Hex, privKey: PrivKey, opts = defaultSigOpts): RecoveredSignature {\n const { seed, k2sig } = prepSig(msgHash, privKey, opts); // Steps A, D of RFC6979 3.2.\n const C = CURVE;\n const drbg = ut.createHmacDrbg(C.hash.outputLen, C.nByteLength, C.hmac);\n return drbg(seed, k2sig); // Steps B, C, D, E, F, G\n }\n\n // Enable precomputes. Slows down first publicKey computation by 20ms.\n Point.BASE._setWindowSize(8);\n // utils.precompute(8, ProjectivePoint.BASE)\n\n /**\n * Verifies a signature against message hash and public key.\n * Rejects lowS signatures by default: to override,\n * specify option `{lowS: false}`. Implements section 4.1.4 from https://www.secg.org/sec1-v2.pdf:\n *\n * ```\n * verify(r, s, h, P) where\n * U1 = hs^-1 mod n\n * U2 = rs^-1 mod n\n * R = U1⋅G - U2⋅P\n * mod(R.x, n) == r\n * ```\n */\n function verify(\n signature: Hex | SignatureLike,\n msgHash: Hex,\n publicKey: Hex,\n opts = defaultVerOpts\n ): boolean {\n const sg = signature;\n msgHash = ensureBytes('msgHash', msgHash);\n publicKey = ensureBytes('publicKey', publicKey);\n if ('strict' in opts) throw new Error('options.strict was renamed to lowS');\n const { lowS, prehash } = opts;\n\n let _sig: Signature | undefined = undefined;\n let P: ProjPointType;\n try {\n if (typeof sg === 'string' || sg instanceof Uint8Array) {\n // Signature can be represented in 2 ways: compact (2*nByteLength) & DER (variable-length).\n // Since DER can also be 2*nByteLength bytes, we check for it first.\n try {\n _sig = Signature.fromDER(sg);\n } catch (derError) {\n if (!(derError instanceof DER.Err)) throw derError;\n _sig = Signature.fromCompact(sg);\n }\n } else if (typeof sg === 'object' && typeof sg.r === 'bigint' && typeof sg.s === 'bigint') {\n const { r, s } = sg;\n _sig = new Signature(r, s);\n } else {\n throw new Error('PARSE');\n }\n P = Point.fromHex(publicKey);\n } catch (error) {\n if ((error as Error).message === 'PARSE')\n throw new Error(`signature must be Signature instance, Uint8Array or hex string`);\n return false;\n }\n if (lowS && _sig.hasHighS()) return false;\n if (prehash) msgHash = CURVE.hash(msgHash);\n const { r, s } = _sig;\n const h = bits2int_modN(msgHash); // Cannot use fields methods, since it is group element\n const is = invN(s); // s^-1\n const u1 = modN(h * is); // u1 = hs^-1 mod n\n const u2 = modN(r * is); // u2 = rs^-1 mod n\n const R = Point.BASE.multiplyAndAddUnsafe(P, u1, u2)?.toAffine(); // R = u1⋅G + u2⋅P\n if (!R) return false;\n const v = modN(R.x);\n return v === r;\n }\n return {\n CURVE,\n getPublicKey,\n getSharedSecret,\n sign,\n verify,\n ProjectivePoint: Point,\n Signature,\n utils,\n };\n}\n\n/**\n * Implementation of the Shallue and van de Woestijne method for any weierstrass curve.\n * TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular.\n * b = True and y = sqrt(u / v) if (u / v) is square in F, and\n * b = False and y = sqrt(Z * (u / v)) otherwise.\n * @param Fp\n * @param Z\n * @returns\n */\nexport function SWUFpSqrtRatio(Fp: mod.IField, Z: T) {\n // Generic implementation\n const q = Fp.ORDER;\n let l = _0n;\n for (let o = q - _1n; o % _2n === _0n; o /= _2n) l += _1n;\n const c1 = l; // 1. c1, the largest integer such that 2^c1 divides q - 1.\n // We need 2n ** c1 and 2n ** (c1-1). We can't use **; but we can use <<.\n // 2n ** c1 == 2n << (c1-1)\n const _2n_pow_c1_1 = _2n << (c1 - _1n - _1n);\n const _2n_pow_c1 = _2n_pow_c1_1 * _2n;\n const c2 = (q - _1n) / _2n_pow_c1; // 2. c2 = (q - 1) / (2^c1) # Integer arithmetic\n const c3 = (c2 - _1n) / _2n; // 3. c3 = (c2 - 1) / 2 # Integer arithmetic\n const c4 = _2n_pow_c1 - _1n; // 4. c4 = 2^c1 - 1 # Integer arithmetic\n const c5 = _2n_pow_c1_1; // 5. c5 = 2^(c1 - 1) # Integer arithmetic\n const c6 = Fp.pow(Z, c2); // 6. c6 = Z^c2\n const c7 = Fp.pow(Z, (c2 + _1n) / _2n); // 7. c7 = Z^((c2 + 1) / 2)\n let sqrtRatio = (u: T, v: T): { isValid: boolean; value: T } => {\n let tv1 = c6; // 1. tv1 = c6\n let tv2 = Fp.pow(v, c4); // 2. tv2 = v^c4\n let tv3 = Fp.sqr(tv2); // 3. tv3 = tv2^2\n tv3 = Fp.mul(tv3, v); // 4. tv3 = tv3 * v\n let tv5 = Fp.mul(u, tv3); // 5. tv5 = u * tv3\n tv5 = Fp.pow(tv5, c3); // 6. tv5 = tv5^c3\n tv5 = Fp.mul(tv5, tv2); // 7. tv5 = tv5 * tv2\n tv2 = Fp.mul(tv5, v); // 8. tv2 = tv5 * v\n tv3 = Fp.mul(tv5, u); // 9. tv3 = tv5 * u\n let tv4 = Fp.mul(tv3, tv2); // 10. tv4 = tv3 * tv2\n tv5 = Fp.pow(tv4, c5); // 11. tv5 = tv4^c5\n let isQR = Fp.eql(tv5, Fp.ONE); // 12. isQR = tv5 == 1\n tv2 = Fp.mul(tv3, c7); // 13. tv2 = tv3 * c7\n tv5 = Fp.mul(tv4, tv1); // 14. tv5 = tv4 * tv1\n tv3 = Fp.cmov(tv2, tv3, isQR); // 15. tv3 = CMOV(tv2, tv3, isQR)\n tv4 = Fp.cmov(tv5, tv4, isQR); // 16. tv4 = CMOV(tv5, tv4, isQR)\n // 17. for i in (c1, c1 - 1, ..., 2):\n for (let i = c1; i > _1n; i--) {\n let tv5 = i - _2n; // 18. tv5 = i - 2\n tv5 = _2n << (tv5 - _1n); // 19. tv5 = 2^tv5\n let tvv5 = Fp.pow(tv4, tv5); // 20. tv5 = tv4^tv5\n const e1 = Fp.eql(tvv5, Fp.ONE); // 21. e1 = tv5 == 1\n tv2 = Fp.mul(tv3, tv1); // 22. tv2 = tv3 * tv1\n tv1 = Fp.mul(tv1, tv1); // 23. tv1 = tv1 * tv1\n tvv5 = Fp.mul(tv4, tv1); // 24. tv5 = tv4 * tv1\n tv3 = Fp.cmov(tv2, tv3, e1); // 25. tv3 = CMOV(tv2, tv3, e1)\n tv4 = Fp.cmov(tvv5, tv4, e1); // 26. tv4 = CMOV(tv5, tv4, e1)\n }\n return { isValid: isQR, value: tv3 };\n };\n if (Fp.ORDER % _4n === _3n) {\n // sqrt_ratio_3mod4(u, v)\n const c1 = (Fp.ORDER - _3n) / _4n; // 1. c1 = (q - 3) / 4 # Integer arithmetic\n const c2 = Fp.sqrt(Fp.neg(Z)); // 2. c2 = sqrt(-Z)\n sqrtRatio = (u: T, v: T) => {\n let tv1 = Fp.sqr(v); // 1. tv1 = v^2\n const tv2 = Fp.mul(u, v); // 2. tv2 = u * v\n tv1 = Fp.mul(tv1, tv2); // 3. tv1 = tv1 * tv2\n let y1 = Fp.pow(tv1, c1); // 4. y1 = tv1^c1\n y1 = Fp.mul(y1, tv2); // 5. y1 = y1 * tv2\n const y2 = Fp.mul(y1, c2); // 6. y2 = y1 * c2\n const tv3 = Fp.mul(Fp.sqr(y1), v); // 7. tv3 = y1^2; 8. tv3 = tv3 * v\n const isQR = Fp.eql(tv3, u); // 9. isQR = tv3 == u\n let y = Fp.cmov(y2, y1, isQR); // 10. y = CMOV(y2, y1, isQR)\n return { isValid: isQR, value: y }; // 11. return (isQR, y) isQR ? y : y*c2\n };\n }\n // No curves uses that\n // if (Fp.ORDER % _8n === _5n) // sqrt_ratio_5mod8\n return sqrtRatio;\n}\n/**\n * Simplified Shallue-van de Woestijne-Ulas Method\n * https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2\n */\nexport function mapToCurveSimpleSWU(\n Fp: mod.IField,\n opts: {\n A: T;\n B: T;\n Z: T;\n }\n) {\n mod.validateField(Fp);\n if (!Fp.isValid(opts.A) || !Fp.isValid(opts.B) || !Fp.isValid(opts.Z))\n throw new Error('mapToCurveSimpleSWU: invalid opts');\n const sqrtRatio = SWUFpSqrtRatio(Fp, opts.Z);\n if (!Fp.isOdd) throw new Error('Fp.isOdd is not implemented!');\n // Input: u, an element of F.\n // Output: (x, y), a point on E.\n return (u: T): { x: T; y: T } => {\n // prettier-ignore\n let tv1, tv2, tv3, tv4, tv5, tv6, x, y;\n tv1 = Fp.sqr(u); // 1. tv1 = u^2\n tv1 = Fp.mul(tv1, opts.Z); // 2. tv1 = Z * tv1\n tv2 = Fp.sqr(tv1); // 3. tv2 = tv1^2\n tv2 = Fp.add(tv2, tv1); // 4. tv2 = tv2 + tv1\n tv3 = Fp.add(tv2, Fp.ONE); // 5. tv3 = tv2 + 1\n tv3 = Fp.mul(tv3, opts.B); // 6. tv3 = B * tv3\n tv4 = Fp.cmov(opts.Z, Fp.neg(tv2), !Fp.eql(tv2, Fp.ZERO)); // 7. tv4 = CMOV(Z, -tv2, tv2 != 0)\n tv4 = Fp.mul(tv4, opts.A); // 8. tv4 = A * tv4\n tv2 = Fp.sqr(tv3); // 9. tv2 = tv3^2\n tv6 = Fp.sqr(tv4); // 10. tv6 = tv4^2\n tv5 = Fp.mul(tv6, opts.A); // 11. tv5 = A * tv6\n tv2 = Fp.add(tv2, tv5); // 12. tv2 = tv2 + tv5\n tv2 = Fp.mul(tv2, tv3); // 13. tv2 = tv2 * tv3\n tv6 = Fp.mul(tv6, tv4); // 14. tv6 = tv6 * tv4\n tv5 = Fp.mul(tv6, opts.B); // 15. tv5 = B * tv6\n tv2 = Fp.add(tv2, tv5); // 16. tv2 = tv2 + tv5\n x = Fp.mul(tv1, tv3); // 17. x = tv1 * tv3\n const { isValid, value } = sqrtRatio(tv2, tv6); // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6)\n y = Fp.mul(tv1, u); // 19. y = tv1 * u -> Z * u^3 * y1\n y = Fp.mul(y, value); // 20. y = y * y1\n x = Fp.cmov(x, tv3, isValid); // 21. x = CMOV(x, tv3, is_gx1_square)\n y = Fp.cmov(y, value, isValid); // 22. y = CMOV(y, y1, is_gx1_square)\n const e1 = Fp.isOdd!(u) === Fp.isOdd!(y); // 23. e1 = sgn0(u) == sgn0(y)\n y = Fp.cmov(Fp.neg(y), y, e1); // 24. y = CMOV(-y, y, e1)\n x = Fp.div(x, tv4); // 25. x = x / tv4\n return { x, y };\n };\n}\n", "/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport type { Group, GroupConstructor, AffinePoint } from './curve.js';\nimport { mod, IField } from './modular.js';\nimport { bytesToNumberBE, CHash, concatBytes, utf8ToBytes, validateObject } from './utils.js';\n\n/**\n * * `DST` is a domain separation tag, defined in section 2.2.5\n * * `p` characteristic of F, where F is a finite field of characteristic p and order q = p^m\n * * `m` is extension degree (1 for prime fields)\n * * `k` is the target security target in bits (e.g. 128), from section 5.1\n * * `expand` is `xmd` (SHA2, SHA3, BLAKE) or `xof` (SHAKE, BLAKE-XOF)\n * * `hash` conforming to `utils.CHash` interface, with `outputLen` / `blockLen` props\n */\ntype UnicodeOrBytes = string | Uint8Array;\nexport type Opts = {\n DST: UnicodeOrBytes;\n p: bigint;\n m: number;\n k: number;\n expand: 'xmd' | 'xof';\n hash: CHash;\n};\n\nfunction validateDST(dst: UnicodeOrBytes): Uint8Array {\n if (dst instanceof Uint8Array) return dst;\n if (typeof dst === 'string') return utf8ToBytes(dst);\n throw new Error('DST must be Uint8Array or string');\n}\n\n// Octet Stream to Integer. \"spec\" implementation of os2ip is 2.5x slower vs bytesToNumberBE.\nconst os2ip = bytesToNumberBE;\n\n// Integer to Octet Stream (numberToBytesBE)\nfunction i2osp(value: number, length: number): Uint8Array {\n if (value < 0 || value >= 1 << (8 * length)) {\n throw new Error(`bad I2OSP call: value=${value} length=${length}`);\n }\n const res = Array.from({ length }).fill(0) as number[];\n for (let i = length - 1; i >= 0; i--) {\n res[i] = value & 0xff;\n value >>>= 8;\n }\n return new Uint8Array(res);\n}\n\nfunction strxor(a: Uint8Array, b: Uint8Array): Uint8Array {\n const arr = new Uint8Array(a.length);\n for (let i = 0; i < a.length; i++) {\n arr[i] = a[i] ^ b[i];\n }\n return arr;\n}\n\nfunction isBytes(item: unknown): void {\n if (!(item instanceof Uint8Array)) throw new Error('Uint8Array expected');\n}\nfunction isNum(item: unknown): void {\n if (!Number.isSafeInteger(item)) throw new Error('number expected');\n}\n\n// Produces a uniformly random byte string using a cryptographic hash function H that outputs b bits\n// https://www.rfc-editor.org/rfc/rfc9380#section-5.3.1\nexport function expand_message_xmd(\n msg: Uint8Array,\n DST: Uint8Array,\n lenInBytes: number,\n H: CHash\n): Uint8Array {\n isBytes(msg);\n isBytes(DST);\n isNum(lenInBytes);\n // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3\n if (DST.length > 255) DST = H(concatBytes(utf8ToBytes('H2C-OVERSIZE-DST-'), DST));\n const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H;\n const ell = Math.ceil(lenInBytes / b_in_bytes);\n if (ell > 255) throw new Error('Invalid xmd length');\n const DST_prime = concatBytes(DST, i2osp(DST.length, 1));\n const Z_pad = i2osp(0, r_in_bytes);\n const l_i_b_str = i2osp(lenInBytes, 2); // len_in_bytes_str\n const b = new Array(ell);\n const b_0 = H(concatBytes(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime));\n b[0] = H(concatBytes(b_0, i2osp(1, 1), DST_prime));\n for (let i = 1; i <= ell; i++) {\n const args = [strxor(b_0, b[i - 1]), i2osp(i + 1, 1), DST_prime];\n b[i] = H(concatBytes(...args));\n }\n const pseudo_random_bytes = concatBytes(...b);\n return pseudo_random_bytes.slice(0, lenInBytes);\n}\n\n// Produces a uniformly random byte string using an extendable-output function (XOF) H.\n// 1. The collision resistance of H MUST be at least k bits.\n// 2. H MUST be an XOF that has been proved indifferentiable from\n// a random oracle under a reasonable cryptographic assumption.\n// https://www.rfc-editor.org/rfc/rfc9380#section-5.3.2\nexport function expand_message_xof(\n msg: Uint8Array,\n DST: Uint8Array,\n lenInBytes: number,\n k: number,\n H: CHash\n): Uint8Array {\n isBytes(msg);\n isBytes(DST);\n isNum(lenInBytes);\n // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3\n // DST = H('H2C-OVERSIZE-DST-' || a_very_long_DST, Math.ceil((lenInBytes * k) / 8));\n if (DST.length > 255) {\n const dkLen = Math.ceil((2 * k) / 8);\n DST = H.create({ dkLen }).update(utf8ToBytes('H2C-OVERSIZE-DST-')).update(DST).digest();\n }\n if (lenInBytes > 65535 || DST.length > 255)\n throw new Error('expand_message_xof: invalid lenInBytes');\n return (\n H.create({ dkLen: lenInBytes })\n .update(msg)\n .update(i2osp(lenInBytes, 2))\n // 2. DST_prime = DST || I2OSP(len(DST), 1)\n .update(DST)\n .update(i2osp(DST.length, 1))\n .digest()\n );\n}\n\n/**\n * Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F\n * https://www.rfc-editor.org/rfc/rfc9380#section-5.2\n * @param msg a byte string containing the message to hash\n * @param count the number of elements of F to output\n * @param options `{DST: string, p: bigint, m: number, k: number, expand: 'xmd' | 'xof', hash: H}`, see above\n * @returns [u_0, ..., u_(count - 1)], a list of field elements.\n */\nexport function hash_to_field(msg: Uint8Array, count: number, options: Opts): bigint[][] {\n validateObject(options, {\n DST: 'stringOrUint8Array',\n p: 'bigint',\n m: 'isSafeInteger',\n k: 'isSafeInteger',\n hash: 'hash',\n });\n const { p, k, m, hash, expand, DST: _DST } = options;\n isBytes(msg);\n isNum(count);\n const DST = validateDST(_DST);\n const log2p = p.toString(2).length;\n const L = Math.ceil((log2p + k) / 8); // section 5.1 of ietf draft link above\n const len_in_bytes = count * m * L;\n let prb; // pseudo_random_bytes\n if (expand === 'xmd') {\n prb = expand_message_xmd(msg, DST, len_in_bytes, hash);\n } else if (expand === 'xof') {\n prb = expand_message_xof(msg, DST, len_in_bytes, k, hash);\n } else if (expand === '_internal_pass') {\n // for internal tests only\n prb = msg;\n } else {\n throw new Error('expand must be \"xmd\" or \"xof\"');\n }\n const u = new Array(count);\n for (let i = 0; i < count; i++) {\n const e = new Array(m);\n for (let j = 0; j < m; j++) {\n const elm_offset = L * (j + i * m);\n const tv = prb.subarray(elm_offset, elm_offset + L);\n e[j] = mod(os2ip(tv), p);\n }\n u[i] = e;\n }\n return u;\n}\n\nexport function isogenyMap>(field: F, map: [T[], T[], T[], T[]]) {\n // Make same order as in spec\n const COEFF = map.map((i) => Array.from(i).reverse());\n return (x: T, y: T) => {\n const [xNum, xDen, yNum, yDen] = COEFF.map((val) =>\n val.reduce((acc, i) => field.add(field.mul(acc, x), i))\n );\n x = field.div(xNum, xDen); // xNum / xDen\n y = field.mul(y, field.div(yNum, yDen)); // y * (yNum / yDev)\n return { x, y };\n };\n}\n\nexport interface H2CPoint extends Group> {\n add(rhs: H2CPoint): H2CPoint;\n toAffine(iz?: bigint): AffinePoint;\n clearCofactor(): H2CPoint;\n assertValidity(): void;\n}\n\nexport interface H2CPointConstructor extends GroupConstructor> {\n fromAffine(ap: AffinePoint): H2CPoint;\n}\n\nexport type MapToCurve = (scalar: bigint[]) => AffinePoint;\n\n// Separated from initialization opts, so users won't accidentally change per-curve parameters\n// (changing DST is ok!)\nexport type htfBasicOpts = { DST: UnicodeOrBytes };\n\nexport function createHasher(\n Point: H2CPointConstructor,\n mapToCurve: MapToCurve,\n def: Opts & { encodeDST?: UnicodeOrBytes }\n) {\n if (typeof mapToCurve !== 'function') throw new Error('mapToCurve() must be defined');\n return {\n // Encodes byte string to elliptic curve.\n // hash_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3\n hashToCurve(msg: Uint8Array, options?: htfBasicOpts) {\n const u = hash_to_field(msg, 2, { ...def, DST: def.DST, ...options } as Opts);\n const u0 = Point.fromAffine(mapToCurve(u[0]));\n const u1 = Point.fromAffine(mapToCurve(u[1]));\n const P = u0.add(u1).clearCofactor();\n P.assertValidity();\n return P;\n },\n\n // Encodes byte string to elliptic curve.\n // encode_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3\n encodeToCurve(msg: Uint8Array, options?: htfBasicOpts) {\n const u = hash_to_field(msg, 1, { ...def, DST: def.encodeDST, ...options } as Opts);\n const P = Point.fromAffine(mapToCurve(u[0])).clearCofactor();\n P.assertValidity();\n return P;\n },\n };\n}\n", "/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { hmac } from '@noble/hashes/hmac';\nimport { concatBytes, randomBytes } from '@noble/hashes/utils';\nimport { weierstrass, CurveType } from './abstract/weierstrass.js';\nimport { CHash } from './abstract/utils.js';\n\n// connects noble-curves to noble-hashes\nexport function getHash(hash: CHash) {\n return {\n hash,\n hmac: (key: Uint8Array, ...msgs: Uint8Array[]) => hmac(hash, key, concatBytes(...msgs)),\n randomBytes,\n };\n}\n// Same API as @noble/hashes, with ability to create curve with custom hash\ntype CurveDef = Readonly>;\nexport function createCurve(curveDef: CurveDef, defHash: CHash) {\n const create = (hash: CHash) => weierstrass({ ...curveDef, ...getHash(hash) });\n return Object.freeze({ ...create(defHash), create });\n}\n", "/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { sha256 } from '@noble/hashes/sha256';\nimport { randomBytes } from '@noble/hashes/utils';\nimport { Field, mod, pow2 } from './abstract/modular.js';\nimport { ProjPointType as PointType, mapToCurveSimpleSWU } from './abstract/weierstrass.js';\nimport type { Hex, PrivKey } from './abstract/utils.js';\nimport { bytesToNumberBE, concatBytes, ensureBytes, numberToBytesBE } from './abstract/utils.js';\nimport { createHasher, isogenyMap } from './abstract/hash-to-curve.js';\nimport { createCurve } from './_shortw_utils.js';\n\nconst secp256k1P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f');\nconst secp256k1N = BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141');\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nconst divNearest = (a: bigint, b: bigint) => (a + b / _2n) / b;\n\n/**\n * √n = n^((p+1)/4) for fields p = 3 mod 4. We unwrap the loop and multiply bit-by-bit.\n * (P+1n/4n).toString(2) would produce bits [223x 1, 0, 22x 1, 4x 0, 11, 00]\n */\nfunction sqrtMod(y: bigint): bigint {\n const P = secp256k1P;\n // prettier-ignore\n const _3n = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);\n // prettier-ignore\n const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88);\n const b2 = (y * y * y) % P; // x^3, 11\n const b3 = (b2 * b2 * y) % P; // x^7\n const b6 = (pow2(b3, _3n, P) * b3) % P;\n const b9 = (pow2(b6, _3n, P) * b3) % P;\n const b11 = (pow2(b9, _2n, P) * b2) % P;\n const b22 = (pow2(b11, _11n, P) * b11) % P;\n const b44 = (pow2(b22, _22n, P) * b22) % P;\n const b88 = (pow2(b44, _44n, P) * b44) % P;\n const b176 = (pow2(b88, _88n, P) * b88) % P;\n const b220 = (pow2(b176, _44n, P) * b44) % P;\n const b223 = (pow2(b220, _3n, P) * b3) % P;\n const t1 = (pow2(b223, _23n, P) * b22) % P;\n const t2 = (pow2(t1, _6n, P) * b2) % P;\n const root = pow2(t2, _2n, P);\n if (!Fp.eql(Fp.sqr(root), y)) throw new Error('Cannot find square root');\n return root;\n}\n\nconst Fp = Field(secp256k1P, undefined, undefined, { sqrt: sqrtMod });\n\nexport const secp256k1 = createCurve(\n {\n a: BigInt(0), // equation params: a, b\n b: BigInt(7), // Seem to be rigid: bitcointalk.org/index.php?topic=289795.msg3183975#msg3183975\n Fp, // Field's prime: 2n**256n - 2n**32n - 2n**9n - 2n**8n - 2n**7n - 2n**6n - 2n**4n - 1n\n n: secp256k1N, // Curve order, total count of valid points in the field\n // Base point (x, y) aka generator point\n Gx: BigInt('55066263022277343669578718895168534326250603453777594175500187360389116729240'),\n Gy: BigInt('32670510020758816978083085130507043184471273380659243275938904335757337482424'),\n h: BigInt(1), // Cofactor\n lowS: true, // Allow only low-S signatures by default in sign() and verify()\n /**\n * secp256k1 belongs to Koblitz curves: it has efficiently computable endomorphism.\n * Endomorphism uses 2x less RAM, speeds up precomputation by 2x and ECDH / key recovery by 20%.\n * For precomputed wNAF it trades off 1/2 init time & 1/3 ram for 20% perf hit.\n * Explanation: https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066\n */\n endo: {\n beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'),\n splitScalar: (k: bigint) => {\n const n = secp256k1N;\n const a1 = BigInt('0x3086d221a7d46bcde86c90e49284eb15');\n const b1 = -_1n * BigInt('0xe4437ed6010e88286f547fa90abfe4c3');\n const a2 = BigInt('0x114ca50f7a8e2f3f657c1108d9d44cfd8');\n const b2 = a1;\n const POW_2_128 = BigInt('0x100000000000000000000000000000000'); // (2n**128n).toString(16)\n\n const c1 = divNearest(b2 * k, n);\n const c2 = divNearest(-b1 * k, n);\n let k1 = mod(k - c1 * a1 - c2 * a2, n);\n let k2 = mod(-c1 * b1 - c2 * b2, n);\n const k1neg = k1 > POW_2_128;\n const k2neg = k2 > POW_2_128;\n if (k1neg) k1 = n - k1;\n if (k2neg) k2 = n - k2;\n if (k1 > POW_2_128 || k2 > POW_2_128) {\n throw new Error('splitScalar: Endomorphism failed, k=' + k);\n }\n return { k1neg, k1, k2neg, k2 };\n },\n },\n },\n sha256\n);\n\n// Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code.\n// https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki\nconst _0n = BigInt(0);\nconst fe = (x: bigint) => typeof x === 'bigint' && _0n < x && x < secp256k1P;\nconst ge = (x: bigint) => typeof x === 'bigint' && _0n < x && x < secp256k1N;\n/** An object mapping tags to their tagged hash prefix of [SHA256(tag) | SHA256(tag)] */\nconst TAGGED_HASH_PREFIXES: { [tag: string]: Uint8Array } = {};\nfunction taggedHash(tag: string, ...messages: Uint8Array[]): Uint8Array {\n let tagP = TAGGED_HASH_PREFIXES[tag];\n if (tagP === undefined) {\n const tagH = sha256(Uint8Array.from(tag, (c) => c.charCodeAt(0)));\n tagP = concatBytes(tagH, tagH);\n TAGGED_HASH_PREFIXES[tag] = tagP;\n }\n return sha256(concatBytes(tagP, ...messages));\n}\n\n// ECDSA compact points are 33-byte. Schnorr is 32: we strip first byte 0x02 or 0x03\nconst pointToBytes = (point: PointType) => point.toRawBytes(true).slice(1);\nconst numTo32b = (n: bigint) => numberToBytesBE(n, 32);\nconst modP = (x: bigint) => mod(x, secp256k1P);\nconst modN = (x: bigint) => mod(x, secp256k1N);\nconst Point = secp256k1.ProjectivePoint;\nconst GmulAdd = (Q: PointType, a: bigint, b: bigint) =>\n Point.BASE.multiplyAndAddUnsafe(Q, a, b);\n\n// Calculate point, scalar and bytes\nfunction schnorrGetExtPubKey(priv: PrivKey) {\n let d_ = secp256k1.utils.normPrivateKeyToScalar(priv); // same method executed in fromPrivateKey\n let p = Point.fromPrivateKey(d_); // P = d'⋅G; 0 < d' < n check is done inside\n const scalar = p.hasEvenY() ? d_ : modN(-d_);\n return { scalar: scalar, bytes: pointToBytes(p) };\n}\n/**\n * lift_x from BIP340. Convert 32-byte x coordinate to elliptic curve point.\n * @returns valid point checked for being on-curve\n */\nfunction lift_x(x: bigint): PointType {\n if (!fe(x)) throw new Error('bad x: need 0 < x < p'); // Fail if x ≥ p.\n const xx = modP(x * x);\n const c = modP(xx * x + BigInt(7)); // Let c = x³ + 7 mod p.\n let y = sqrtMod(c); // Let y = c^(p+1)/4 mod p.\n if (y % _2n !== _0n) y = modP(-y); // Return the unique point P such that x(P) = x and\n const p = new Point(x, y, _1n); // y(P) = y if y mod 2 = 0 or y(P) = p-y otherwise.\n p.assertValidity();\n return p;\n}\n/**\n * Create tagged hash, convert it to bigint, reduce modulo-n.\n */\nfunction challenge(...args: Uint8Array[]): bigint {\n return modN(bytesToNumberBE(taggedHash('BIP0340/challenge', ...args)));\n}\n\n/**\n * Schnorr public key is just `x` coordinate of Point as per BIP340.\n */\nfunction schnorrGetPublicKey(privateKey: Hex): Uint8Array {\n return schnorrGetExtPubKey(privateKey).bytes; // d'=int(sk). Fail if d'=0 or d'≥n. Ret bytes(d'⋅G)\n}\n\n/**\n * Creates Schnorr signature as per BIP340. Verifies itself before returning anything.\n * auxRand is optional and is not the sole source of k generation: bad CSPRNG won't be dangerous.\n */\nfunction schnorrSign(\n message: Hex,\n privateKey: PrivKey,\n auxRand: Hex = randomBytes(32)\n): Uint8Array {\n const m = ensureBytes('message', message);\n const { bytes: px, scalar: d } = schnorrGetExtPubKey(privateKey); // checks for isWithinCurveOrder\n const a = ensureBytes('auxRand', auxRand, 32); // Auxiliary random data a: a 32-byte array\n const t = numTo32b(d ^ bytesToNumberBE(taggedHash('BIP0340/aux', a))); // Let t be the byte-wise xor of bytes(d) and hash/aux(a)\n const rand = taggedHash('BIP0340/nonce', t, px, m); // Let rand = hash/nonce(t || bytes(P) || m)\n const k_ = modN(bytesToNumberBE(rand)); // Let k' = int(rand) mod n\n if (k_ === _0n) throw new Error('sign failed: k is zero'); // Fail if k' = 0.\n const { bytes: rx, scalar: k } = schnorrGetExtPubKey(k_); // Let R = k'⋅G.\n const e = challenge(rx, px, m); // Let e = int(hash/challenge(bytes(R) || bytes(P) || m)) mod n.\n const sig = new Uint8Array(64); // Let sig = bytes(R) || bytes((k + ed) mod n).\n sig.set(rx, 0);\n sig.set(numTo32b(modN(k + e * d)), 32);\n // If Verify(bytes(P), m, sig) (see below) returns failure, abort\n if (!schnorrVerify(sig, m, px)) throw new Error('sign: Invalid signature produced');\n return sig;\n}\n\n/**\n * Verifies Schnorr signature.\n * Will swallow errors & return false except for initial type validation of arguments.\n */\nfunction schnorrVerify(signature: Hex, message: Hex, publicKey: Hex): boolean {\n const sig = ensureBytes('signature', signature, 64);\n const m = ensureBytes('message', message);\n const pub = ensureBytes('publicKey', publicKey, 32);\n try {\n const P = lift_x(bytesToNumberBE(pub)); // P = lift_x(int(pk)); fail if that fails\n const r = bytesToNumberBE(sig.subarray(0, 32)); // Let r = int(sig[0:32]); fail if r ≥ p.\n if (!fe(r)) return false;\n const s = bytesToNumberBE(sig.subarray(32, 64)); // Let s = int(sig[32:64]); fail if s ≥ n.\n if (!ge(s)) return false;\n const e = challenge(numTo32b(r), pointToBytes(P), m); // int(challenge(bytes(r)||bytes(P)||m))%n\n const R = GmulAdd(P, s, modN(-e)); // R = s⋅G - e⋅P\n if (!R || !R.hasEvenY() || R.toAffine().x !== r) return false; // -eP == (n-e)P\n return true; // Fail if is_infinite(R) / not has_even_y(R) / x(R) ≠ r.\n } catch (error) {\n return false;\n }\n}\n\nexport const schnorr = /* @__PURE__ */ (() => ({\n getPublicKey: schnorrGetPublicKey,\n sign: schnorrSign,\n verify: schnorrVerify,\n utils: {\n randomPrivateKey: secp256k1.utils.randomPrivateKey,\n lift_x,\n pointToBytes,\n numberToBytesBE,\n bytesToNumberBE,\n taggedHash,\n mod,\n },\n}))();\n\nconst isoMap = /* @__PURE__ */ (() =>\n isogenyMap(\n Fp,\n [\n // xNum\n [\n '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7',\n '0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581',\n '0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262',\n '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c',\n ],\n // xDen\n [\n '0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b',\n '0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14',\n '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1\n ],\n // yNum\n [\n '0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c',\n '0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3',\n '0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931',\n '0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84',\n ],\n // yDen\n [\n '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b',\n '0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573',\n '0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f',\n '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1\n ],\n ].map((i) => i.map((j) => BigInt(j))) as [bigint[], bigint[], bigint[], bigint[]]\n ))();\nconst mapSWU = /* @__PURE__ */ (() =>\n mapToCurveSimpleSWU(Fp, {\n A: BigInt('0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533'),\n B: BigInt('1771'),\n Z: Fp.create(BigInt('-11')),\n }))();\nconst htf = /* @__PURE__ */ (() =>\n createHasher(\n secp256k1.ProjectivePoint,\n (scalars: bigint[]) => {\n const { x, y } = mapSWU(Fp.create(scalars[0]));\n return isoMap(x, y);\n },\n {\n DST: 'secp256k1_XMD:SHA-256_SSWU_RO_',\n encodeDST: 'secp256k1_XMD:SHA-256_SSWU_NU_',\n p: Fp.ORDER,\n m: 1,\n k: 128,\n expand: 'xmd',\n hash: sha256,\n }\n ))();\nexport const hashToCurve = /* @__PURE__ */ (() => htf.hashToCurve)();\nexport const encodeToCurve = /* @__PURE__ */ (() => htf.encodeToCurve)();\n", "\n/**\n * A constant for the zero address.\n *\n * (**i.e.** ``\"0x0000000000000000000000000000000000000000\"``)\n */\nexport const ZeroAddress: string = \"0x0000000000000000000000000000000000000000\";\n\n", "/**\n * A constant for the zero hash.\n *\n * (**i.e.** ``\"0x0000000000000000000000000000000000000000000000000000000000000000\"``)\n */\nexport const ZeroHash: string = \"0x0000000000000000000000000000000000000000000000000000000000000000\";\n\n", "\n/**\n * A constant for the order N for the secp256k1 curve.\n *\n * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``)\n */\nexport const N: bigint = BigInt(\"0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141\");\n\n/**\n * A constant for the number of wei in a single ether.\n *\n * (**i.e.** ``1000000000000000000n``)\n */\nexport const WeiPerEther: bigint = BigInt(\"1000000000000000000\");\n\n/**\n * A constant for the maximum value for a ``uint256``.\n *\n * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)\n */\nexport const MaxUint256: bigint = BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\n\n/**\n * A constant for the minimum value for an ``int256``.\n *\n * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``)\n */\nexport const MinInt256: bigint = BigInt(\"0x8000000000000000000000000000000000000000000000000000000000000000\") * BigInt(-1);\n\n/**\n * A constant for the maximum value for an ``int256``.\n *\n * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)\n */\nexport const MaxInt256: bigint = BigInt(\"0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\n", "// NFKC (composed) // (decomposed)\n\n/**\n * A constant for the ether symbol (normalized using NFKC).\n *\n * (**i.e.** ``\"\\\\u039e\"``)\n */\nexport const EtherSymbol: string = \"\\u039e\"; // \"\\uD835\\uDF63\";\n\n\n/**\n * A constant for the [[link-eip-191]] personal message prefix.\n *\n * (**i.e.** ``\"\\\\x19Ethereum Signed Message:\\\\n\"``)\n */\nexport const MessagePrefix: string = \"\\x19Ethereum Signed Message:\\n\";\n", "\nimport { ZeroHash } from \"../constants/index.js\";\nimport {\n concat, dataLength, getBigInt, getBytes, getNumber, hexlify,\n toBeArray, isHexString, zeroPadValue,\n assertArgument, assertPrivate\n} from \"../utils/index.js\";\n\nimport type {\n BigNumberish, BytesLike, Numeric\n} from \"../utils/index.js\";\n\n\n// Constants\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_2 = BigInt(2);\nconst BN_27 = BigInt(27);\nconst BN_28 = BigInt(28);\nconst BN_35 = BigInt(35);\n\n\nconst _guard = { };\n\n// @TODO: Allow Uint8Array\n\n/**\n * A SignatureLike\n *\n * @_docloc: api/crypto:Signing\n */\nexport type SignatureLike = Signature | string | {\n r: string;\n s: string;\n v: BigNumberish;\n yParity?: 0 | 1;\n yParityAndS?: string;\n} | {\n r: string;\n yParityAndS: string;\n yParity?: 0 | 1;\n s?: string;\n v?: number;\n} | {\n r: string;\n s: string;\n yParity: 0 | 1;\n v?: BigNumberish;\n yParityAndS?: string;\n};\n\nfunction toUint256(value: BigNumberish): string {\n return zeroPadValue(toBeArray(value), 32);\n}\n\n/**\n * A Signature @TODO\n *\n *\n * @_docloc: api/crypto:Signing\n */\nexport class Signature {\n #r: string;\n #s: string;\n #v: 27 | 28;\n #networkV: null | bigint;\n\n /**\n * The ``r`` value for a signautre.\n *\n * This represents the ``x`` coordinate of a \"reference\" or\n * challenge point, from which the ``y`` can be computed.\n */\n get r(): string { return this.#r; }\n set r(value: BytesLike) {\n assertArgument(dataLength(value) === 32, \"invalid r\", \"value\", value);\n this.#r = hexlify(value);\n }\n\n /**\n * The ``s`` value for a signature.\n */\n get s(): string { return this.#s; }\n set s(_value: BytesLike) {\n assertArgument(dataLength(_value) === 32, \"invalid s\", \"value\", _value);\n const value = hexlify(_value);\n assertArgument(parseInt(value.substring(0, 3)) < 8, \"non-canonical s\", \"value\", value);\n this.#s = value;\n }\n\n /**\n * The ``v`` value for a signature.\n *\n * Since a given ``x`` value for ``r`` has two possible values for\n * its correspondin ``y``, the ``v`` indicates which of the two ``y``\n * values to use.\n *\n * It is normalized to the values ``27`` or ``28`` for legacy\n * purposes.\n */\n get v(): 27 | 28 { return this.#v; }\n set v(value: BigNumberish) {\n const v = getNumber(value, \"value\");\n assertArgument(v === 27 || v === 28, \"invalid v\", \"v\", value);\n this.#v = v;\n }\n\n /**\n * The EIP-155 ``v`` for legacy transactions. For non-legacy\n * transactions, this value is ``null``.\n */\n get networkV(): null | bigint { return this.#networkV; }\n\n /**\n * The chain ID for EIP-155 legacy transactions. For non-legacy\n * transactions, this value is ``null``.\n */\n get legacyChainId(): null | bigint {\n const v = this.networkV;\n if (v == null) { return null; }\n return Signature.getChainId(v);\n }\n\n /**\n * The ``yParity`` for the signature.\n *\n * See ``v`` for more details on how this value is used.\n */\n get yParity(): 0 | 1 {\n return (this.v === 27) ? 0: 1;\n }\n\n /**\n * The [[link-eip-2098]] compact representation of the ``yParity``\n * and ``s`` compacted into a single ``bytes32``.\n */\n get yParityAndS(): string {\n // The EIP-2098 compact representation\n const yParityAndS = getBytes(this.s);\n if (this.yParity) { yParityAndS[0] |= 0x80; }\n return hexlify(yParityAndS);\n }\n\n /**\n * The [[link-eip-2098]] compact representation.\n */\n get compactSerialized(): string {\n return concat([ this.r, this.yParityAndS ]);\n }\n\n /**\n * The serialized representation.\n */\n get serialized(): string {\n return concat([ this.r, this.s, (this.yParity ? \"0x1c\": \"0x1b\") ]);\n }\n\n /**\n * @private\n */\n constructor(guard: any, r: string, s: string, v: 27 | 28) {\n assertPrivate(guard, _guard, \"Signature\");\n this.#r = r;\n this.#s = s;\n this.#v = v;\n this.#networkV = null;\n }\n\n [Symbol.for('nodejs.util.inspect.custom')](): string {\n return `Signature { r: \"${ this.r }\", s: \"${ this.s }\", yParity: ${ this.yParity }, networkV: ${ this.networkV } }`;\n }\n\n /**\n * Returns a new identical [[Signature]].\n */\n clone(): Signature {\n const clone = new Signature(_guard, this.r, this.s, this.v);\n if (this.networkV) { clone.#networkV = this.networkV; }\n return clone;\n }\n\n /**\n * Returns a representation that is compatible with ``JSON.stringify``.\n */\n toJSON(): any {\n const networkV = this.networkV;\n return {\n _type: \"signature\",\n networkV: ((networkV != null) ? networkV.toString(): null),\n r: this.r, s: this.s, v: this.v,\n };\n }\n\n /**\n * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions.\n *\n * @example:\n * Signature.getChainId(45)\n * //_result:\n *\n * Signature.getChainId(46)\n * //_result:\n */\n static getChainId(v: BigNumberish): bigint {\n const bv = getBigInt(v, \"v\");\n\n // The v is not an EIP-155 v, so it is the unspecified chain ID\n if ((bv == BN_27) || (bv == BN_28)) { return BN_0; }\n\n // Bad value for an EIP-155 v\n assertArgument(bv >= BN_35, \"invalid EIP-155 v\", \"v\", v);\n\n return (bv - BN_35) / BN_2;\n }\n\n /**\n * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions.\n *\n * Legacy transactions which use [[link-eip-155]] hijack the ``v``\n * property to include the chain ID.\n *\n * @example:\n * Signature.getChainIdV(5, 27)\n * //_result:\n *\n * Signature.getChainIdV(5, 28)\n * //_result:\n *\n */\n static getChainIdV(chainId: BigNumberish, v: 27 | 28): bigint {\n return (getBigInt(chainId) * BN_2) + BigInt(35 + v - 27);\n }\n\n /**\n * Compute the normalized legacy transaction ``v`` from a ``yParirty``,\n * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction.\n *\n * @example:\n * // The values 0 and 1 imply v is actually yParity\n * Signature.getNormalizedV(0)\n * //_result:\n *\n * // Legacy non-EIP-1559 transaction (i.e. 27 or 28)\n * Signature.getNormalizedV(27)\n * //_result:\n *\n * // Legacy EIP-155 transaction (i.e. >= 35)\n * Signature.getNormalizedV(46)\n * //_result:\n *\n * // Invalid values throw\n * Signature.getNormalizedV(5)\n * //_error:\n */\n static getNormalizedV(v: BigNumberish): 27 | 28 {\n const bv = getBigInt(v);\n\n if (bv === BN_0 || bv === BN_27) { return 27; }\n if (bv === BN_1 || bv === BN_28) { return 28; }\n\n assertArgument(bv >= BN_35, \"invalid v\", \"v\", v);\n\n // Otherwise, EIP-155 v means odd is 27 and even is 28\n return (bv & BN_1) ? 27: 28;\n }\n\n /**\n * Creates a new [[Signature]].\n *\n * If no %%sig%% is provided, a new [[Signature]] is created\n * with default values.\n *\n * If %%sig%% is a string, it is parsed.\n */\n static from(sig?: SignatureLike): Signature {\n function assertError(check: unknown, message: string): asserts check {\n assertArgument(check, message, \"signature\", sig);\n };\n\n if (sig == null) {\n return new Signature(_guard, ZeroHash, ZeroHash, 27);\n }\n\n if (typeof(sig) === \"string\") {\n const bytes = getBytes(sig, \"signature\");\n if (bytes.length === 64) {\n const r = hexlify(bytes.slice(0, 32));\n const s = bytes.slice(32, 64);\n const v = (s[0] & 0x80) ? 28: 27;\n s[0] &= 0x7f;\n return new Signature(_guard, r, hexlify(s), v);\n }\n\n if (bytes.length === 65) {\n const r = hexlify(bytes.slice(0, 32));\n const s = bytes.slice(32, 64);\n assertError((s[0] & 0x80) === 0, \"non-canonical s\");\n const v = Signature.getNormalizedV(bytes[64]);\n return new Signature(_guard, r, hexlify(s), v);\n }\n\n assertError(false, \"invalid raw signature length\");\n }\n\n if (sig instanceof Signature) { return sig.clone(); }\n\n // Get r\n const _r = sig.r;\n assertError(_r != null, \"missing r\");\n const r = toUint256(_r);\n\n // Get s; by any means necessary (we check consistency below)\n const s = (function(s?: string, yParityAndS?: string) {\n if (s != null) { return toUint256(s); }\n\n if (yParityAndS != null) {\n assertError(isHexString(yParityAndS, 32), \"invalid yParityAndS\");\n const bytes = getBytes(yParityAndS);\n bytes[0] &= 0x7f;\n return hexlify(bytes);\n }\n\n assertError(false, \"missing s\");\n })(sig.s, sig.yParityAndS);\n assertError((getBytes(s)[0] & 0x80) == 0, \"non-canonical s\");\n\n // Get v; by any means necessary (we check consistency below)\n const { networkV, v } = (function(_v?: BigNumberish, yParityAndS?: string, yParity?: Numeric): { networkV?: bigint, v: 27 | 28 } {\n if (_v != null) {\n const v = getBigInt(_v);\n return {\n networkV: ((v >= BN_35) ? v: undefined),\n v: Signature.getNormalizedV(v)\n };\n }\n\n if (yParityAndS != null) {\n assertError(isHexString(yParityAndS, 32), \"invalid yParityAndS\");\n return { v: ((getBytes(yParityAndS)[0] & 0x80) ? 28: 27) };\n }\n\n if (yParity != null) {\n switch (getNumber(yParity, \"sig.yParity\")) {\n case 0: return { v: 27 };\n case 1: return { v: 28 };\n }\n assertError(false, \"invalid yParity\");\n }\n\n assertError(false, \"missing v\");\n })(sig.v, sig.yParityAndS, sig.yParity);\n\n const result = new Signature(_guard, r, s, v);\n if (networkV) { result.#networkV = networkV; }\n\n // If multiple of v, yParity, yParityAndS we given, check they match\n assertError(sig.yParity == null || getNumber(sig.yParity, \"sig.yParity\") === result.yParity, \"yParity mismatch\");\n assertError(sig.yParityAndS == null || sig.yParityAndS === result.yParityAndS, \"yParityAndS mismatch\");\n\n return result;\n }\n}\n\n", "/**\n * Add details about signing here.\n *\n * @_subsection: api/crypto:Signing [about-signing]\n */\n\nimport { secp256k1 } from \"@noble/curves/secp256k1\";\n\nimport {\n concat, dataLength, getBytes, getBytesCopy, hexlify, toBeHex,\n assertArgument\n} from \"../utils/index.js\";\n\nimport { Signature } from \"./signature.js\";\n\nimport type { BytesLike } from \"../utils/index.js\";\n\nimport type { SignatureLike } from \"./index.js\";\n\n\n/**\n * A **SigningKey** provides high-level access to the elliptic curve\n * cryptography (ECC) operations and key management.\n */\nexport class SigningKey {\n #privateKey: string;\n\n /**\n * Creates a new **SigningKey** for %%privateKey%%.\n */\n constructor(privateKey: BytesLike) {\n assertArgument(dataLength(privateKey) === 32, \"invalid private key\", \"privateKey\", \"[REDACTED]\");\n this.#privateKey = hexlify(privateKey);\n }\n\n /**\n * The private key.\n */\n get privateKey(): string { return this.#privateKey; }\n\n /**\n * The uncompressed public key.\n *\n * This will always begin with the prefix ``0x04`` and be 132\n * characters long (the ``0x`` prefix and 130 hexadecimal nibbles).\n */\n get publicKey(): string { return SigningKey.computePublicKey(this.#privateKey); }\n\n /**\n * The compressed public key.\n *\n * This will always begin with either the prefix ``0x02`` or ``0x03``\n * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal\n * nibbles)\n */\n get compressedPublicKey(): string { return SigningKey.computePublicKey(this.#privateKey, true); }\n\n /**\n * Return the signature of the signed %%digest%%.\n */\n sign(digest: BytesLike): Signature {\n assertArgument(dataLength(digest) === 32, \"invalid digest length\", \"digest\", digest);\n\n const sig = secp256k1.sign(getBytesCopy(digest), getBytesCopy(this.#privateKey), {\n lowS: true\n });\n\n return Signature.from({\n r: toBeHex(sig.r, 32),\n s: toBeHex(sig.s, 32),\n v: (sig.recovery ? 0x1c: 0x1b)\n });\n }\n\n /**\n * Returns the [[link-wiki-ecdh]] shared secret between this\n * private key and the %%other%% key.\n *\n * The %%other%% key may be any type of key, a raw public key,\n * a compressed/uncompressed pubic key or aprivate key.\n *\n * Best practice is usually to use a cryptographic hash on the\n * returned value before using it as a symetric secret.\n *\n * @example:\n * sign1 = new SigningKey(id(\"some-secret-1\"))\n * sign2 = new SigningKey(id(\"some-secret-2\"))\n *\n * // Notice that privA.computeSharedSecret(pubB)...\n * sign1.computeSharedSecret(sign2.publicKey)\n * //_result:\n *\n * // ...is equal to privB.computeSharedSecret(pubA).\n * sign2.computeSharedSecret(sign1.publicKey)\n * //_result:\n */\n computeSharedSecret(other: BytesLike): string {\n const pubKey = SigningKey.computePublicKey(other);\n return hexlify(secp256k1.getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey), false));\n }\n\n /**\n * Compute the public key for %%key%%, optionally %%compressed%%.\n *\n * The %%key%% may be any type of key, a raw public key, a\n * compressed/uncompressed public key or private key.\n *\n * @example:\n * sign = new SigningKey(id(\"some-secret\"));\n *\n * // Compute the uncompressed public key for a private key\n * SigningKey.computePublicKey(sign.privateKey)\n * //_result:\n *\n * // Compute the compressed public key for a private key\n * SigningKey.computePublicKey(sign.privateKey, true)\n * //_result:\n *\n * // Compute the uncompressed public key\n * SigningKey.computePublicKey(sign.publicKey, false);\n * //_result:\n *\n * // Compute the Compressed a public key\n * SigningKey.computePublicKey(sign.publicKey, true);\n * //_result:\n */\n static computePublicKey(key: BytesLike, compressed?: boolean): string {\n let bytes = getBytes(key, \"key\");\n\n // private key\n if (bytes.length === 32) {\n const pubKey = secp256k1.getPublicKey(bytes, !!compressed);\n return hexlify(pubKey);\n }\n\n // raw public key; use uncompressed key with 0x04 prefix\n if (bytes.length === 64) {\n const pub = new Uint8Array(65);\n pub[0] = 0x04;\n pub.set(bytes, 1);\n bytes = pub;\n }\n\n const point = secp256k1.ProjectivePoint.fromHex(bytes);\n return hexlify(point.toRawBytes(compressed));\n }\n\n /**\n * Returns the public key for the private key which produced the\n * %%signature%% for the given %%digest%%.\n *\n * @example:\n * key = new SigningKey(id(\"some-secret\"))\n * digest = id(\"hello world\")\n * sig = key.sign(digest)\n *\n * // Notice the signer public key...\n * key.publicKey\n * //_result:\n *\n * // ...is equal to the recovered public key\n * SigningKey.recoverPublicKey(digest, sig)\n * //_result:\n *\n */\n static recoverPublicKey(digest: BytesLike, signature: SignatureLike): string {\n assertArgument(dataLength(digest) === 32, \"invalid digest length\", \"digest\", digest);\n\n const sig = Signature.from(signature);\n\n let secpSig = secp256k1.Signature.fromCompact(getBytesCopy(concat([ sig.r, sig.s ])));\n secpSig = secpSig.addRecoveryBit(sig.yParity);\n\n const pubKey = secpSig.recoverPublicKey(getBytesCopy(digest));\n assertArgument(pubKey != null, \"invalid signautre for digest\", \"signature\", signature);\n\n return \"0x\" + pubKey.toHex(false);\n }\n\n /**\n * Returns the point resulting from adding the ellipic curve points\n * %%p0%% and %%p1%%.\n *\n * This is not a common function most developers should require, but\n * can be useful for certain privacy-specific techniques.\n *\n * For example, it is used by [[HDNodeWallet]] to compute child\n * addresses from parent public keys and chain codes.\n */\n static addPoints(p0: BytesLike, p1: BytesLike, compressed?: boolean): string {\n const pub0 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2));\n const pub1 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2));\n return \"0x\" + pub0.add(pub1).toHex(!!compressed)\n }\n}\n\n", "/**\n * A fundamental building block of Ethereum is the underlying\n * cryptographic primitives.\n *\n * @_section: api/crypto:Cryptographic Functions [about-crypto]\n */\n\nnull\n\n// We import all these so we can export lock()\nimport { computeHmac } from \"./hmac.js\";\nimport { keccak256 } from \"./keccak.js\";\nimport { ripemd160 } from \"./ripemd160.js\";\nimport { pbkdf2 } from \"./pbkdf2.js\";\nimport { randomBytes } from \"./random.js\";\nimport { scrypt, scryptSync } from \"./scrypt.js\";\nimport { sha256, sha512 } from \"./sha2.js\";\n\nexport {\n computeHmac,\n\n randomBytes,\n\n keccak256,\n ripemd160,\n sha256, sha512,\n\n pbkdf2,\n scrypt, scryptSync\n};\n\nexport { SigningKey } from \"./signing-key.js\";\nexport { Signature } from \"./signature.js\";\n\n/**\n * Once called, prevents any future change to the underlying cryptographic\n * primitives using the ``.register`` feature for hooks.\n */\nfunction lock(): void {\n computeHmac.lock();\n keccak256.lock();\n pbkdf2.lock();\n randomBytes.lock();\n ripemd160.lock();\n scrypt.lock();\n scryptSync.lock();\n sha256.lock();\n sha512.lock();\n randomBytes.lock();\n}\n\nexport { lock };\n\n/////////////////////////////\n// Types\n\nexport type { ProgressCallback } from \"./scrypt.js\";\n\nexport type { SignatureLike } from \"./signature.js\";\n", "import { keccak256 } from \"../crypto/index.js\";\nimport { getBytes, assertArgument } from \"../utils/index.js\";\n\n\nconst BN_0 = BigInt(0);\nconst BN_36 = BigInt(36);\n\nfunction getChecksumAddress(address: string): string {\n// if (!isHexString(address, 20)) {\n// logger.throwArgumentError(\"invalid address\", \"address\", address);\n// }\n\n address = address.toLowerCase();\n\n const chars = address.substring(2).split(\"\");\n\n const expanded = new Uint8Array(40);\n for (let i = 0; i < 40; i++) {\n expanded[i] = chars[i].charCodeAt(0);\n }\n\n const hashed = getBytes(keccak256(expanded));\n\n for (let i = 0; i < 40; i += 2) {\n if ((hashed[i >> 1] >> 4) >= 8) {\n chars[i] = chars[i].toUpperCase();\n }\n if ((hashed[i >> 1] & 0x0f) >= 8) {\n chars[i + 1] = chars[i + 1].toUpperCase();\n }\n }\n\n return \"0x\" + chars.join(\"\");\n}\n\n// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number\n\n// Create lookup table\nconst ibanLookup: { [character: string]: string } = { };\nfor (let i = 0; i < 10; i++) { ibanLookup[String(i)] = String(i); }\nfor (let i = 0; i < 26; i++) { ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); }\n\n// How many decimal digits can we process? (for 64-bit float, this is 15)\n// i.e. Math.floor(Math.log10(Number.MAX_SAFE_INTEGER));\nconst safeDigits = 15;\n\nfunction ibanChecksum(address: string): string {\n address = address.toUpperCase();\n address = address.substring(4) + address.substring(0, 2) + \"00\";\n\n let expanded = address.split(\"\").map((c) => { return ibanLookup[c]; }).join(\"\");\n\n // Javascript can handle integers safely up to 15 (decimal) digits\n while (expanded.length >= safeDigits){\n let block = expanded.substring(0, safeDigits);\n expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);\n }\n\n let checksum = String(98 - (parseInt(expanded, 10) % 97));\n while (checksum.length < 2) { checksum = \"0\" + checksum; }\n\n return checksum;\n};\n\nconst Base36 = (function() {;\n const result: Record = { };\n for (let i = 0; i < 36; i++) {\n const key = \"0123456789abcdefghijklmnopqrstuvwxyz\"[i];\n result[key] = BigInt(i);\n }\n return result;\n})();\n\nfunction fromBase36(value: string): bigint {\n value = value.toLowerCase();\n\n let result = BN_0;\n for (let i = 0; i < value.length; i++) {\n result = result * BN_36 + Base36[value[i]];\n }\n return result;\n}\n\n/**\n * Returns a normalized and checksumed address for %%address%%.\n * This accepts non-checksum addresses, checksum addresses and\n * [[getIcapAddress]] formats.\n *\n * The checksum in Ethereum uses the capitalization (upper-case\n * vs lower-case) of the characters within an address to encode\n * its checksum, which offers, on average, a checksum of 15-bits.\n *\n * If %%address%% contains both upper-case and lower-case, it is\n * assumed to already be a checksum address and its checksum is\n * validated, and if the address fails its expected checksum an\n * error is thrown.\n *\n * If you wish the checksum of %%address%% to be ignore, it should\n * be converted to lower-case (i.e. ``.toLowercase()``) before\n * being passed in. This should be a very rare situation though,\n * that you wish to bypass the safegaurds in place to protect\n * against an address that has been incorrectly copied from another\n * source.\n *\n * @example:\n * // Adds the checksum (via upper-casing specific letters)\n * getAddress(\"0x8ba1f109551bd432803012645ac136ddd64dba72\")\n * //_result:\n *\n * // Converts ICAP address and adds checksum\n * getAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\");\n * //_result:\n *\n * // Throws an error if an address contains mixed case,\n * // but the checksum fails\n * getAddress(\"0x8Ba1f109551bD432803012645Ac136ddd64DBA72\")\n * //_error:\n */\nexport function getAddress(address: string): string {\n\n assertArgument(typeof(address) === \"string\", \"invalid address\", \"address\", address);\n\n if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {\n\n // Missing the 0x prefix\n if (!address.startsWith(\"0x\")) { address = \"0x\" + address; }\n\n const result = getChecksumAddress(address);\n\n // It is a checksummed address with a bad checksum\n assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address,\n \"bad address checksum\", \"address\", address);\n\n return result;\n }\n\n // Maybe ICAP? (we only support direct mode)\n if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {\n // It is an ICAP address with a bad checksum\n assertArgument(address.substring(2, 4) === ibanChecksum(address), \"bad icap checksum\", \"address\", address);\n\n let result = fromBase36(address.substring(4)).toString(16);\n while (result.length < 40) { result = \"0\" + result; }\n return getChecksumAddress(\"0x\" + result);\n }\n\n assertArgument(false, \"invalid address\", \"address\", address);\n}\n\n/**\n * The [ICAP Address format](link-icap) format is an early checksum\n * format which attempts to be compatible with the banking\n * industry [IBAN format](link-wiki-iban) for bank accounts.\n *\n * It is no longer common or a recommended format.\n *\n * @example:\n * getIcapAddress(\"0x8ba1f109551bd432803012645ac136ddd64dba72\");\n * //_result:\n *\n * getIcapAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\");\n * //_result:\n *\n * // Throws an error if the ICAP checksum is wrong\n * getIcapAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37\");\n * //_error:\n */\nexport function getIcapAddress(address: string): string {\n //let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase();\n let base36 = BigInt(getAddress(address)).toString(36).toUpperCase();\n while (base36.length < 30) { base36 = \"0\" + base36; }\n return \"XE\" + ibanChecksum(\"XE00\" + base36) + base36;\n}\n", "import { keccak256 } from \"../crypto/index.js\";\nimport {\n concat, dataSlice, getBigInt, getBytes, encodeRlp, assertArgument\n} from \"../utils/index.js\";\n\nimport { getAddress } from \"./address.js\";\n\nimport type { BigNumberish, BytesLike } from \"../utils/index.js\";\n\n\n// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed\n\n/**\n * Returns the address that would result from a ``CREATE`` for %%tx%%.\n *\n * This can be used to compute the address a contract will be\n * deployed to by an EOA when sending a deployment transaction (i.e.\n * when the ``to`` address is ``null``).\n *\n * This can also be used to compute the address a contract will be\n * deployed to by a contract, by using the contract's address as the\n * ``to`` and the contract's nonce.\n *\n * @example\n * from = \"0x8ba1f109551bD432803012645Ac136ddd64DBA72\";\n * nonce = 5;\n *\n * getCreateAddress({ from, nonce });\n * //_result:\n */\nexport function getCreateAddress(tx: { from: string, nonce: BigNumberish }): string {\n const from = getAddress(tx.from);\n const nonce = getBigInt(tx.nonce, \"tx.nonce\");\n\n let nonceHex = nonce.toString(16);\n if (nonceHex === \"0\") {\n nonceHex = \"0x\";\n } else if (nonceHex.length % 2) {\n nonceHex = \"0x0\" + nonceHex;\n } else {\n nonceHex = \"0x\" + nonceHex;\n }\n\n return getAddress(dataSlice(keccak256(encodeRlp([ from, nonceHex ])), 12));\n}\n\n/**\n * Returns the address that would result from a ``CREATE2`` operation\n * with the given %%from%%, %%salt%% and %%initCodeHash%%.\n *\n * To compute the %%initCodeHash%% from a contract's init code, use\n * the [[keccak256]] function.\n *\n * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]].\n *\n * @example\n * // The address of the contract\n * from = \"0x8ba1f109551bD432803012645Ac136ddd64DBA72\"\n *\n * // The salt\n * salt = id(\"HelloWorld\")\n *\n * // The hash of the initCode\n * initCode = \"0x6394198df16000526103ff60206004601c335afa6040516060f3\";\n * initCodeHash = keccak256(initCode)\n *\n * getCreate2Address(from, salt, initCodeHash)\n * //_result:\n */\nexport function getCreate2Address(_from: string, _salt: BytesLike, _initCodeHash: BytesLike): string {\n const from = getAddress(_from);\n const salt = getBytes(_salt, \"salt\");\n const initCodeHash = getBytes(_initCodeHash, \"initCodeHash\");\n\n assertArgument(salt.length === 32, \"salt must be 32 bytes\", \"salt\", _salt);\n\n assertArgument(initCodeHash.length === 32, \"initCodeHash must be 32 bytes\", \"initCodeHash\", _initCodeHash);\n\n return getAddress(dataSlice(keccak256(concat([ \"0xff\", from, salt, initCodeHash ])), 12))\n}\n", "import { assert, assertArgument } from \"../utils/index.js\";\n\nimport { getAddress } from \"./address.js\";\n\nimport type { Addressable, AddressLike, NameResolver } from \"./index.js\";\n\n\n/**\n * Returns true if %%value%% is an object which implements the\n * [[Addressable]] interface.\n *\n * @example:\n * // Wallets and AbstractSigner sub-classes\n * isAddressable(Wallet.createRandom())\n * //_result:\n *\n * // Contracts\n * contract = new Contract(\"dai.tokens.ethers.eth\", [ ], provider)\n * isAddressable(contract)\n * //_result:\n */\nexport function isAddressable(value: any): value is Addressable {\n return (value && typeof(value.getAddress) === \"function\");\n}\n\n/**\n * Returns true if %%value%% is a valid address.\n *\n * @example:\n * // Valid address\n * isAddress(\"0x8ba1f109551bD432803012645Ac136ddd64DBA72\")\n * //_result:\n *\n * // Valid ICAP address\n * isAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\")\n * //_result:\n *\n * // Invalid checksum\n * isAddress(\"0x8Ba1f109551bD432803012645Ac136ddd64DBa72\")\n * //_result:\n *\n * // Invalid ICAP checksum\n * isAddress(\"0x8Ba1f109551bD432803012645Ac136ddd64DBA72\")\n * //_result:\n *\n * // Not an address (an ENS name requires a provided and an\n * // asynchronous API to access)\n * isAddress(\"ricmoo.eth\")\n * //_result:\n */\nexport function isAddress(value: any): value is string {\n try {\n getAddress(value);\n return true;\n } catch (error) { }\n return false;\n}\n\nasync function checkAddress(target: any, promise: Promise): Promise {\n const result = await promise;\n if (result == null || result === \"0x0000000000000000000000000000000000000000\") {\n assert(typeof(target) !== \"string\", \"unconfigured name\", \"UNCONFIGURED_NAME\", { value: target });\n assertArgument(false, \"invalid AddressLike value; did not resolve to a value address\", \"target\", target);\n }\n return getAddress(result);\n}\n\n/**\n * Resolves to an address for the %%target%%, which may be any\n * supported address type, an [[Addressable]] or a Promise which\n * resolves to an address.\n *\n * If an ENS name is provided, but that name has not been correctly\n * configured a [[UnconfiguredNameError]] is thrown.\n *\n * @example:\n * addr = \"0x6B175474E89094C44Da98b954EedeAC495271d0F\"\n *\n * // Addresses are return synchronously\n * resolveAddress(addr, provider)\n * //_result:\n *\n * // Address promises are resolved asynchronously\n * resolveAddress(Promise.resolve(addr))\n * //_result:\n *\n * // ENS names are resolved asynchronously\n * resolveAddress(\"dai.tokens.ethers.eth\", provider)\n * //_result:\n *\n * // Addressable objects are resolved asynchronously\n * contract = new Contract(addr, [ ])\n * resolveAddress(contract, provider)\n * //_result:\n *\n * // Unconfigured ENS names reject\n * resolveAddress(\"nothing-here.ricmoo.eth\", provider)\n * //_error:\n *\n * // ENS names require a NameResolver object passed in\n * // (notice the provider was omitted)\n * resolveAddress(\"nothing-here.ricmoo.eth\")\n * //_error:\n */\nexport function resolveAddress(target: AddressLike, resolver?: null | NameResolver): string | Promise {\n\n if (typeof(target) === \"string\") {\n if (target.match(/^0x[0-9a-f]{40}$/i)) { return getAddress(target); }\n\n assert(resolver != null, \"ENS resolution requires a provider\",\n \"UNSUPPORTED_OPERATION\", { operation: \"resolveName\" });\n\n return checkAddress(target, resolver.resolveName(target));\n\n } else if (isAddressable(target)) {\n return checkAddress(target, target.getAddress());\n\n } else if (target && typeof(target.then) === \"function\") {\n return checkAddress(target, target);\n }\n\n assertArgument(false, \"unsupported addressable value\", \"target\", target);\n}\n", "/**\n * A Typed object allows a value to have its type explicitly\n * specified.\n *\n * For example, in Solidity, the value ``45`` could represent a\n * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent\n * a ``bytes2`` or ``bytes``.\n *\n * Since JavaScript has no meaningful way to explicitly inform any\n * APIs which what the type is, this allows transparent interoperation\n * with Soldity.\n *\n * @_subsection: api/abi:Typed Values\n */\n\nimport { assertPrivate, defineProperties } from \"../utils/index.js\";\n\nimport type { Addressable } from \"../address/index.js\";\nimport type { BigNumberish, BytesLike } from \"../utils/index.js\";\n\nimport type { Result } from \"./coders/abstract-coder.js\";\n\nconst _gaurd = { };\n\nfunction n(value: BigNumberish, width: number): Typed {\n let signed = false;\n if (width < 0) {\n signed = true;\n width *= -1;\n }\n\n // @TODO: Check range is valid for value\n return new Typed(_gaurd, `${ signed ? \"\": \"u\" }int${ width }`, value, { signed, width });\n}\n\nfunction b(value: BytesLike, size?: number): Typed {\n // @TODO: Check range is valid for value\n return new Typed(_gaurd, `bytes${ (size) ? size: \"\" }`, value, { size });\n}\n\n// @TODO: Remove this in v7, it was replaced by TypedBigInt\n/**\n * @_ignore:\n */\nexport interface TypedNumber extends Typed {\n value: number;\n defaultValue(): number;\n minValue(): number;\n maxValue(): number;\n}\n\n/**\n * A **Typed** that represents a numeric value.\n */\nexport interface TypedBigInt extends Typed {\n /**\n * The value.\n */\n value: bigint;\n\n /**\n * The default value for all numeric types is ``0``.\n */\n defaultValue(): bigint;\n\n /**\n * The minimum value for this type, accounting for bit-width and signed-ness.\n */\n minValue(): bigint;\n\n /**\n * The minimum value for this type, accounting for bit-width.\n */\n maxValue(): bigint;\n}\n\n/**\n * A **Typed** that represents a binary sequence of data as bytes.\n */\nexport interface TypedData extends Typed {\n /**\n * The value.\n */\n value: string;\n\n /**\n * The default value for this type.\n */\n defaultValue(): string;\n}\n\n/**\n * A **Typed** that represents a UTF-8 sequence of bytes.\n */\nexport interface TypedString extends Typed {\n /**\n * The value.\n */\n value: string;\n\n /**\n * The default value for the string type is the empty string (i.e. ``\"\"``).\n */\n defaultValue(): string;\n}\n\nconst _typedSymbol = Symbol.for(\"_ethers_typed\");\n\n/**\n * The **Typed** class to wrap values providing explicit type information.\n */\nexport class Typed {\n\n /**\n * The type, as a Solidity-compatible type.\n */\n readonly type!: string;\n\n /**\n * The actual value.\n */\n readonly value!: any;\n\n readonly #options: any;\n\n /**\n * @_ignore:\n */\n readonly _typedSymbol!: Symbol;\n\n /**\n * @_ignore:\n */\n constructor(gaurd: any, type: string, value: any, options?: any) {\n if (options == null) { options = null; }\n assertPrivate(_gaurd, gaurd, \"Typed\");\n defineProperties(this, { _typedSymbol, type, value });\n this.#options = options;\n\n // Check the value is valid\n this.format();\n }\n\n /**\n * Format the type as a Human-Readable type.\n */\n format(): string {\n if (this.type === \"array\") {\n throw new Error(\"\");\n } else if (this.type === \"dynamicArray\") {\n throw new Error(\"\");\n } else if (this.type === \"tuple\") {\n return `tuple(${ this.value.map((v: Typed) => v.format()).join(\",\") })`\n }\n\n return this.type;\n }\n\n /**\n * The default value returned by this type.\n */\n defaultValue(): string | number | bigint | Result {\n return 0;\n }\n\n /**\n * The minimum value for numeric types.\n */\n minValue(): string | number | bigint {\n return 0;\n }\n\n /**\n * The maximum value for numeric types.\n */\n maxValue(): string | number | bigint {\n return 0;\n }\n\n /**\n * Returns ``true`` and provides a type guard is this is a [[TypedBigInt]].\n */\n isBigInt(): this is TypedBigInt {\n return !!(this.type.match(/^u?int[0-9]+$/));\n }\n\n /**\n * Returns ``true`` and provides a type guard is this is a [[TypedData]].\n */\n isData(): this is TypedData {\n return this.type.startsWith(\"bytes\");\n }\n\n /**\n * Returns ``true`` and provides a type guard is this is a [[TypedString]].\n */\n isString(): this is TypedString {\n return (this.type === \"string\");\n }\n\n /**\n * Returns the tuple name, if this is a tuple. Throws otherwise.\n */\n get tupleName(): null | string {\n if (this.type !== \"tuple\") { throw TypeError(\"not a tuple\"); }\n return this.#options;\n }\n\n // Returns the length of this type as an array\n // - `null` indicates the length is unforced, it could be dynamic\n // - `-1` indicates the length is dynamic\n // - any other value indicates it is a static array and is its length\n\n /**\n * Returns the length of the array type or ``-1`` if it is dynamic.\n *\n * Throws if the type is not an array.\n */\n get arrayLength(): null | number {\n if (this.type !== \"array\") { throw TypeError(\"not an array\"); }\n if (this.#options === true) { return -1; }\n if (this.#options === false) { return (>(this.value)).length; }\n return null;\n }\n\n /**\n * Returns a new **Typed** of %%type%% with the %%value%%.\n */\n static from(type: string, value: any): Typed {\n return new Typed(_gaurd, type, value);\n }\n\n /**\n * Return a new ``uint8`` type for %%v%%.\n */\n static uint8(v: BigNumberish): Typed { return n(v, 8); }\n\n /**\n * Return a new ``uint16`` type for %%v%%.\n */\n static uint16(v: BigNumberish): Typed { return n(v, 16); }\n\n /**\n * Return a new ``uint24`` type for %%v%%.\n */\n static uint24(v: BigNumberish): Typed { return n(v, 24); }\n\n /**\n * Return a new ``uint32`` type for %%v%%.\n */\n static uint32(v: BigNumberish): Typed { return n(v, 32); }\n\n /**\n * Return a new ``uint40`` type for %%v%%.\n */\n static uint40(v: BigNumberish): Typed { return n(v, 40); }\n\n /**\n * Return a new ``uint48`` type for %%v%%.\n */\n static uint48(v: BigNumberish): Typed { return n(v, 48); }\n\n /**\n * Return a new ``uint56`` type for %%v%%.\n */\n static uint56(v: BigNumberish): Typed { return n(v, 56); }\n\n /**\n * Return a new ``uint64`` type for %%v%%.\n */\n static uint64(v: BigNumberish): Typed { return n(v, 64); }\n\n /**\n * Return a new ``uint72`` type for %%v%%.\n */\n static uint72(v: BigNumberish): Typed { return n(v, 72); }\n\n /**\n * Return a new ``uint80`` type for %%v%%.\n */\n static uint80(v: BigNumberish): Typed { return n(v, 80); }\n\n /**\n * Return a new ``uint88`` type for %%v%%.\n */\n static uint88(v: BigNumberish): Typed { return n(v, 88); }\n\n /**\n * Return a new ``uint96`` type for %%v%%.\n */\n static uint96(v: BigNumberish): Typed { return n(v, 96); }\n\n /**\n * Return a new ``uint104`` type for %%v%%.\n */\n static uint104(v: BigNumberish): Typed { return n(v, 104); }\n\n /**\n * Return a new ``uint112`` type for %%v%%.\n */\n static uint112(v: BigNumberish): Typed { return n(v, 112); }\n\n /**\n * Return a new ``uint120`` type for %%v%%.\n */\n static uint120(v: BigNumberish): Typed { return n(v, 120); }\n\n /**\n * Return a new ``uint128`` type for %%v%%.\n */\n static uint128(v: BigNumberish): Typed { return n(v, 128); }\n\n /**\n * Return a new ``uint136`` type for %%v%%.\n */\n static uint136(v: BigNumberish): Typed { return n(v, 136); }\n\n /**\n * Return a new ``uint144`` type for %%v%%.\n */\n static uint144(v: BigNumberish): Typed { return n(v, 144); }\n\n /**\n * Return a new ``uint152`` type for %%v%%.\n */\n static uint152(v: BigNumberish): Typed { return n(v, 152); }\n\n /**\n * Return a new ``uint160`` type for %%v%%.\n */\n static uint160(v: BigNumberish): Typed { return n(v, 160); }\n\n /**\n * Return a new ``uint168`` type for %%v%%.\n */\n static uint168(v: BigNumberish): Typed { return n(v, 168); }\n\n /**\n * Return a new ``uint176`` type for %%v%%.\n */\n static uint176(v: BigNumberish): Typed { return n(v, 176); }\n\n /**\n * Return a new ``uint184`` type for %%v%%.\n */\n static uint184(v: BigNumberish): Typed { return n(v, 184); }\n\n /**\n * Return a new ``uint192`` type for %%v%%.\n */\n static uint192(v: BigNumberish): Typed { return n(v, 192); }\n\n /**\n * Return a new ``uint200`` type for %%v%%.\n */\n static uint200(v: BigNumberish): Typed { return n(v, 200); }\n\n /**\n * Return a new ``uint208`` type for %%v%%.\n */\n static uint208(v: BigNumberish): Typed { return n(v, 208); }\n\n /**\n * Return a new ``uint216`` type for %%v%%.\n */\n static uint216(v: BigNumberish): Typed { return n(v, 216); }\n\n /**\n * Return a new ``uint224`` type for %%v%%.\n */\n static uint224(v: BigNumberish): Typed { return n(v, 224); }\n\n /**\n * Return a new ``uint232`` type for %%v%%.\n */\n static uint232(v: BigNumberish): Typed { return n(v, 232); }\n\n /**\n * Return a new ``uint240`` type for %%v%%.\n */\n static uint240(v: BigNumberish): Typed { return n(v, 240); }\n\n /**\n * Return a new ``uint248`` type for %%v%%.\n */\n static uint248(v: BigNumberish): Typed { return n(v, 248); }\n\n /**\n * Return a new ``uint256`` type for %%v%%.\n */\n static uint256(v: BigNumberish): Typed { return n(v, 256); }\n\n /**\n * Return a new ``uint256`` type for %%v%%.\n */\n static uint(v: BigNumberish): Typed { return n(v, 256); }\n\n /**\n * Return a new ``int8`` type for %%v%%.\n */\n static int8(v: BigNumberish): Typed { return n(v, -8); }\n\n /**\n * Return a new ``int16`` type for %%v%%.\n */\n static int16(v: BigNumberish): Typed { return n(v, -16); }\n\n /**\n * Return a new ``int24`` type for %%v%%.\n */\n static int24(v: BigNumberish): Typed { return n(v, -24); }\n\n /**\n * Return a new ``int32`` type for %%v%%.\n */\n static int32(v: BigNumberish): Typed { return n(v, -32); }\n\n /**\n * Return a new ``int40`` type for %%v%%.\n */\n static int40(v: BigNumberish): Typed { return n(v, -40); }\n\n /**\n * Return a new ``int48`` type for %%v%%.\n */\n static int48(v: BigNumberish): Typed { return n(v, -48); }\n\n /**\n * Return a new ``int56`` type for %%v%%.\n */\n static int56(v: BigNumberish): Typed { return n(v, -56); }\n\n /**\n * Return a new ``int64`` type for %%v%%.\n */\n static int64(v: BigNumberish): Typed { return n(v, -64); }\n\n /**\n * Return a new ``int72`` type for %%v%%.\n */\n static int72(v: BigNumberish): Typed { return n(v, -72); }\n\n /**\n * Return a new ``int80`` type for %%v%%.\n */\n static int80(v: BigNumberish): Typed { return n(v, -80); }\n\n /**\n * Return a new ``int88`` type for %%v%%.\n */\n static int88(v: BigNumberish): Typed { return n(v, -88); }\n\n /**\n * Return a new ``int96`` type for %%v%%.\n */\n static int96(v: BigNumberish): Typed { return n(v, -96); }\n\n /**\n * Return a new ``int104`` type for %%v%%.\n */\n static int104(v: BigNumberish): Typed { return n(v, -104); }\n\n /**\n * Return a new ``int112`` type for %%v%%.\n */\n static int112(v: BigNumberish): Typed { return n(v, -112); }\n\n /**\n * Return a new ``int120`` type for %%v%%.\n */\n static int120(v: BigNumberish): Typed { return n(v, -120); }\n\n /**\n * Return a new ``int128`` type for %%v%%.\n */\n static int128(v: BigNumberish): Typed { return n(v, -128); }\n\n /**\n * Return a new ``int136`` type for %%v%%.\n */\n static int136(v: BigNumberish): Typed { return n(v, -136); }\n\n /**\n * Return a new ``int144`` type for %%v%%.\n */\n static int144(v: BigNumberish): Typed { return n(v, -144); }\n\n /**\n * Return a new ``int52`` type for %%v%%.\n */\n static int152(v: BigNumberish): Typed { return n(v, -152); }\n\n /**\n * Return a new ``int160`` type for %%v%%.\n */\n static int160(v: BigNumberish): Typed { return n(v, -160); }\n\n /**\n * Return a new ``int168`` type for %%v%%.\n */\n static int168(v: BigNumberish): Typed { return n(v, -168); }\n\n /**\n * Return a new ``int176`` type for %%v%%.\n */\n static int176(v: BigNumberish): Typed { return n(v, -176); }\n\n /**\n * Return a new ``int184`` type for %%v%%.\n */\n static int184(v: BigNumberish): Typed { return n(v, -184); }\n\n /**\n * Return a new ``int92`` type for %%v%%.\n */\n static int192(v: BigNumberish): Typed { return n(v, -192); }\n\n /**\n * Return a new ``int200`` type for %%v%%.\n */\n static int200(v: BigNumberish): Typed { return n(v, -200); }\n\n /**\n * Return a new ``int208`` type for %%v%%.\n */\n static int208(v: BigNumberish): Typed { return n(v, -208); }\n\n /**\n * Return a new ``int216`` type for %%v%%.\n */\n static int216(v: BigNumberish): Typed { return n(v, -216); }\n\n /**\n * Return a new ``int224`` type for %%v%%.\n */\n static int224(v: BigNumberish): Typed { return n(v, -224); }\n\n /**\n * Return a new ``int232`` type for %%v%%.\n */\n static int232(v: BigNumberish): Typed { return n(v, -232); }\n\n /**\n * Return a new ``int240`` type for %%v%%.\n */\n static int240(v: BigNumberish): Typed { return n(v, -240); }\n\n /**\n * Return a new ``int248`` type for %%v%%.\n */\n static int248(v: BigNumberish): Typed { return n(v, -248); }\n\n /**\n * Return a new ``int256`` type for %%v%%.\n */\n static int256(v: BigNumberish): Typed { return n(v, -256); }\n\n /**\n * Return a new ``int256`` type for %%v%%.\n */\n static int(v: BigNumberish): Typed { return n(v, -256); }\n\n /**\n * Return a new ``bytes1`` type for %%v%%.\n */\n static bytes1(v: BytesLike): Typed { return b(v, 1); }\n\n /**\n * Return a new ``bytes2`` type for %%v%%.\n */\n static bytes2(v: BytesLike): Typed { return b(v, 2); }\n\n /**\n * Return a new ``bytes3`` type for %%v%%.\n */\n static bytes3(v: BytesLike): Typed { return b(v, 3); }\n\n /**\n * Return a new ``bytes4`` type for %%v%%.\n */\n static bytes4(v: BytesLike): Typed { return b(v, 4); }\n\n /**\n * Return a new ``bytes5`` type for %%v%%.\n */\n static bytes5(v: BytesLike): Typed { return b(v, 5); }\n\n /**\n * Return a new ``bytes6`` type for %%v%%.\n */\n static bytes6(v: BytesLike): Typed { return b(v, 6); }\n\n /**\n * Return a new ``bytes7`` type for %%v%%.\n */\n static bytes7(v: BytesLike): Typed { return b(v, 7); }\n\n /**\n * Return a new ``bytes8`` type for %%v%%.\n */\n static bytes8(v: BytesLike): Typed { return b(v, 8); }\n\n /**\n * Return a new ``bytes9`` type for %%v%%.\n */\n static bytes9(v: BytesLike): Typed { return b(v, 9); }\n\n /**\n * Return a new ``bytes10`` type for %%v%%.\n */\n static bytes10(v: BytesLike): Typed { return b(v, 10); }\n\n /**\n * Return a new ``bytes11`` type for %%v%%.\n */\n static bytes11(v: BytesLike): Typed { return b(v, 11); }\n\n /**\n * Return a new ``bytes12`` type for %%v%%.\n */\n static bytes12(v: BytesLike): Typed { return b(v, 12); }\n\n /**\n * Return a new ``bytes13`` type for %%v%%.\n */\n static bytes13(v: BytesLike): Typed { return b(v, 13); }\n\n /**\n * Return a new ``bytes14`` type for %%v%%.\n */\n static bytes14(v: BytesLike): Typed { return b(v, 14); }\n\n /**\n * Return a new ``bytes15`` type for %%v%%.\n */\n static bytes15(v: BytesLike): Typed { return b(v, 15); }\n\n /**\n * Return a new ``bytes16`` type for %%v%%.\n */\n static bytes16(v: BytesLike): Typed { return b(v, 16); }\n\n /**\n * Return a new ``bytes17`` type for %%v%%.\n */\n static bytes17(v: BytesLike): Typed { return b(v, 17); }\n\n /**\n * Return a new ``bytes18`` type for %%v%%.\n */\n static bytes18(v: BytesLike): Typed { return b(v, 18); }\n\n /**\n * Return a new ``bytes19`` type for %%v%%.\n */\n static bytes19(v: BytesLike): Typed { return b(v, 19); }\n\n /**\n * Return a new ``bytes20`` type for %%v%%.\n */\n static bytes20(v: BytesLike): Typed { return b(v, 20); }\n\n /**\n * Return a new ``bytes21`` type for %%v%%.\n */\n static bytes21(v: BytesLike): Typed { return b(v, 21); }\n\n /**\n * Return a new ``bytes22`` type for %%v%%.\n */\n static bytes22(v: BytesLike): Typed { return b(v, 22); }\n\n /**\n * Return a new ``bytes23`` type for %%v%%.\n */\n static bytes23(v: BytesLike): Typed { return b(v, 23); }\n\n /**\n * Return a new ``bytes24`` type for %%v%%.\n */\n static bytes24(v: BytesLike): Typed { return b(v, 24); }\n\n /**\n * Return a new ``bytes25`` type for %%v%%.\n */\n static bytes25(v: BytesLike): Typed { return b(v, 25); }\n\n /**\n * Return a new ``bytes26`` type for %%v%%.\n */\n static bytes26(v: BytesLike): Typed { return b(v, 26); }\n\n /**\n * Return a new ``bytes27`` type for %%v%%.\n */\n static bytes27(v: BytesLike): Typed { return b(v, 27); }\n\n /**\n * Return a new ``bytes28`` type for %%v%%.\n */\n static bytes28(v: BytesLike): Typed { return b(v, 28); }\n\n /**\n * Return a new ``bytes29`` type for %%v%%.\n */\n static bytes29(v: BytesLike): Typed { return b(v, 29); }\n\n /**\n * Return a new ``bytes30`` type for %%v%%.\n */\n static bytes30(v: BytesLike): Typed { return b(v, 30); }\n\n /**\n * Return a new ``bytes31`` type for %%v%%.\n */\n static bytes31(v: BytesLike): Typed { return b(v, 31); }\n\n /**\n * Return a new ``bytes32`` type for %%v%%.\n */\n static bytes32(v: BytesLike): Typed { return b(v, 32); }\n\n\n /**\n * Return a new ``address`` type for %%v%%.\n */\n static address(v: string | Addressable): Typed { return new Typed(_gaurd, \"address\", v); }\n\n /**\n * Return a new ``bool`` type for %%v%%.\n */\n static bool(v: any): Typed { return new Typed(_gaurd, \"bool\", !!v); }\n\n /**\n * Return a new ``bytes`` type for %%v%%.\n */\n static bytes(v: BytesLike): Typed { return new Typed(_gaurd, \"bytes\", v); }\n\n /**\n * Return a new ``string`` type for %%v%%.\n */\n static string(v: string): Typed { return new Typed(_gaurd, \"string\", v); }\n\n\n /**\n * Return a new ``array`` type for %%v%%, allowing %%dynamic%% length.\n */\n static array(v: Array, dynamic?: null | boolean): Typed {\n throw new Error(\"not implemented yet\");\n return new Typed(_gaurd, \"array\", v, dynamic);\n }\n\n\n /**\n * Return a new ``tuple`` type for %%v%%, with the optional %%name%%.\n */\n static tuple(v: Array | Record, name?: string): Typed {\n throw new Error(\"not implemented yet\");\n return new Typed(_gaurd, \"tuple\", v, name);\n }\n\n\n /**\n * Return a new ``uint8`` type for %%v%%.\n */\n static overrides(v: Record): Typed {\n return new Typed(_gaurd, \"overrides\", Object.assign({ }, v));\n }\n\n /**\n * Returns true only if %%value%% is a [[Typed]] instance.\n */\n static isTyped(value: any): value is Typed {\n return (value\n && typeof(value) === \"object\"\n && \"_typedSymbol\" in value\n && value._typedSymbol === _typedSymbol);\n }\n\n /**\n * If the value is a [[Typed]] instance, validates the underlying value\n * and returns it, otherwise returns value directly.\n *\n * This is useful for functions that with to accept either a [[Typed]]\n * object or values.\n */\n static dereference(value: Typed | T, type: string): T {\n if (Typed.isTyped(value)) {\n if (value.type !== type) {\n throw new Error(`invalid type: expecetd ${ type }, got ${ value.type }`);\n }\n return value.value;\n }\n return value;\n }\n}\n", "import { getAddress } from \"../../address/index.js\";\nimport { toBeHex } from \"../../utils/maths.js\";\n\nimport { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n\nimport type { Reader, Writer } from \"./abstract-coder.js\";\n\n\n/**\n * @_ignore\n */\nexport class AddressCoder extends Coder {\n\n constructor(localName: string) {\n super(\"address\", \"address\", localName, false);\n }\n\n defaultValue(): string {\n return \"0x0000000000000000000000000000000000000000\";\n }\n\n encode(writer: Writer, _value: string | Typed): number {\n let value = Typed.dereference(_value, \"string\");\n try {\n value = getAddress(value);\n } catch (error: any) {\n return this._throwError(error.message, _value);\n }\n return writer.writeValue(value);\n }\n\n decode(reader: Reader): any {\n return getAddress(toBeHex(reader.readValue(), 20));\n }\n}\n", "import { Coder } from \"./abstract-coder.js\";\n\nimport type { Reader, Writer } from \"./abstract-coder.js\";\n\n/**\n * Clones the functionality of an existing Coder, but without a localName\n *\n * @_ignore\n */\nexport class AnonymousCoder extends Coder {\n private coder: Coder;\n\n constructor(coder: Coder) {\n super(coder.name, coder.type, \"_\", coder.dynamic);\n this.coder = coder;\n }\n\n defaultValue(): any {\n return this.coder.defaultValue();\n }\n\n encode(writer: Writer, value: any): number {\n return this.coder.encode(writer, value);\n }\n\n decode(reader: Reader): any {\n return this.coder.decode(reader);\n }\n}\n", "import {\n defineProperties, isError, assert, assertArgument, assertArgumentCount\n} from \"../../utils/index.js\";\n\nimport { Typed } from \"../typed.js\";\n\nimport { Coder, Result, WordSize, Writer } from \"./abstract-coder.js\";\nimport { AnonymousCoder } from \"./anonymous.js\";\n\nimport type { Reader } from \"./abstract-coder.js\";\n\n/**\n * @_ignore\n */\nexport function pack(writer: Writer, coders: ReadonlyArray, values: Array | { [ name: string ]: any }): number {\n let arrayValues: Array = [ ];\n\n if (Array.isArray(values)) {\n arrayValues = values;\n\n } else if (values && typeof(values) === \"object\") {\n let unique: { [ name: string ]: boolean } = { };\n\n arrayValues = coders.map((coder) => {\n const name = coder.localName;\n assert(name, \"cannot encode object for signature with missing names\",\n \"INVALID_ARGUMENT\", { argument: \"values\", info: { coder }, value: values });\n\n assert(!unique[name], \"cannot encode object for signature with duplicate names\",\n \"INVALID_ARGUMENT\", { argument: \"values\", info: { coder }, value: values });\n\n unique[name] = true;\n\n return values[name];\n });\n\n } else {\n assertArgument(false, \"invalid tuple value\", \"tuple\", values);\n }\n\n assertArgument(coders.length === arrayValues.length, \"types/value length mismatch\", \"tuple\", values);\n\n let staticWriter = new Writer();\n let dynamicWriter = new Writer();\n\n let updateFuncs: Array<(baseOffset: number) => void> = [];\n coders.forEach((coder, index) => {\n let value = arrayValues[index];\n\n if (coder.dynamic) {\n // Get current dynamic offset (for the future pointer)\n let dynamicOffset = dynamicWriter.length;\n\n // Encode the dynamic value into the dynamicWriter\n coder.encode(dynamicWriter, value);\n\n // Prepare to populate the correct offset once we are done\n let updateFunc = staticWriter.writeUpdatableValue();\n updateFuncs.push((baseOffset: number) => {\n updateFunc(baseOffset + dynamicOffset);\n });\n\n } else {\n coder.encode(staticWriter, value);\n }\n });\n\n // Backfill all the dynamic offsets, now that we know the static length\n updateFuncs.forEach((func) => { func(staticWriter.length); });\n\n let length = writer.appendWriter(staticWriter);\n length += writer.appendWriter(dynamicWriter);\n return length;\n}\n\n/**\n * @_ignore\n */\nexport function unpack(reader: Reader, coders: ReadonlyArray): Result {\n let values: Array = [];\n let keys: Array = [ ];\n\n // A reader anchored to this base\n let baseReader = reader.subReader(0);\n\n coders.forEach((coder) => {\n let value: any = null;\n\n if (coder.dynamic) {\n let offset = reader.readIndex();\n let offsetReader = baseReader.subReader(offset);\n try {\n value = coder.decode(offsetReader);\n } catch (error: any) {\n // Cannot recover from this\n if (isError(error, \"BUFFER_OVERRUN\")) {\n throw error;\n }\n\n value = error;\n value.baseType = coder.name;\n value.name = coder.localName;\n value.type = coder.type;\n }\n\n } else {\n try {\n value = coder.decode(reader);\n } catch (error: any) {\n // Cannot recover from this\n if (isError(error, \"BUFFER_OVERRUN\")) {\n throw error;\n }\n\n value = error;\n value.baseType = coder.name;\n value.name = coder.localName;\n value.type = coder.type;\n }\n }\n\n if (value == undefined) {\n throw new Error(\"investigate\");\n }\n\n values.push(value);\n keys.push(coder.localName || null);\n });\n\n return Result.fromItems(values, keys);\n}\n\n/**\n * @_ignore\n */\nexport class ArrayCoder extends Coder {\n readonly coder!: Coder;\n readonly length!: number;\n\n constructor(coder: Coder, length: number, localName: string) {\n const type = (coder.type + \"[\" + (length >= 0 ? length: \"\") + \"]\");\n const dynamic = (length === -1 || coder.dynamic);\n super(\"array\", type, localName, dynamic);\n defineProperties(this, { coder, length });\n }\n\n defaultValue(): Array {\n // Verifies the child coder is valid (even if the array is dynamic or 0-length)\n const defaultChild = this.coder.defaultValue();\n\n const result: Array = [];\n for (let i = 0; i < this.length; i++) {\n result.push(defaultChild);\n }\n return result;\n }\n\n encode(writer: Writer, _value: Array | Typed): number {\n const value = Typed.dereference(_value, \"array\");\n\n if(!Array.isArray(value)) {\n this._throwError(\"expected array value\", value);\n }\n\n let count = this.length;\n\n if (count === -1) {\n count = value.length;\n writer.writeValue(value.length);\n }\n\n assertArgumentCount(value.length, count, \"coder array\" + (this.localName? (\" \"+ this.localName): \"\"));\n\n let coders: Array = [ ];\n for (let i = 0; i < value.length; i++) { coders.push(this.coder); }\n\n return pack(writer, coders, value);\n }\n\n decode(reader: Reader): any {\n let count = this.length;\n if (count === -1) {\n count = reader.readIndex();\n\n // Check that there is *roughly* enough data to ensure\n // stray random data is not being read as a length. Each\n // slot requires at least 32 bytes for their value (or 32\n // bytes as a link to the data). This could use a much\n // tighter bound, but we are erroring on the side of safety.\n assert(count * WordSize <= reader.dataLength, \"insufficient data length\",\n \"BUFFER_OVERRUN\", { buffer: reader.bytes, offset: count * WordSize, length: reader.dataLength });\n }\n let coders: Array = [];\n for (let i = 0; i < count; i++) { coders.push(new AnonymousCoder(this.coder)); }\n\n return unpack(reader, coders);\n }\n}\n\n", "import { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n\nimport type { Reader, Writer } from \"./abstract-coder.js\";\n\n/**\n * @_ignore\n */\nexport class BooleanCoder extends Coder {\n\n constructor(localName: string) {\n super(\"bool\", \"bool\", localName, false);\n }\n\n defaultValue(): boolean {\n return false;\n }\n\n encode(writer: Writer, _value: boolean | Typed): number {\n const value = Typed.dereference(_value, \"bool\");\n return writer.writeValue(value ? 1: 0);\n }\n\n decode(reader: Reader): any {\n return !!reader.readValue();\n }\n}\n", "import { getBytesCopy, hexlify } from \"../../utils/index.js\";\n\nimport { Coder } from \"./abstract-coder.js\";\n\nimport type { Reader, Writer } from \"./abstract-coder.js\";\n\n\n/**\n * @_ignore\n */\nexport class DynamicBytesCoder extends Coder {\n constructor(type: string, localName: string) {\n super(type, type, localName, true);\n }\n\n defaultValue(): string {\n return \"0x\";\n }\n\n encode(writer: Writer, value: any): number {\n value = getBytesCopy(value);\n let length = writer.writeValue(value.length);\n length += writer.writeBytes(value);\n return length;\n }\n\n decode(reader: Reader): any {\n return reader.readBytes(reader.readIndex(), true);\n }\n}\n\n/**\n * @_ignore\n */\nexport class BytesCoder extends DynamicBytesCoder {\n constructor(localName: string) {\n super(\"bytes\", localName);\n }\n\n decode(reader: Reader): any {\n return hexlify(super.decode(reader));\n }\n}\n", "\nimport { defineProperties, getBytesCopy, hexlify } from \"../../utils/index.js\";\n\nimport { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n\nimport type { BytesLike } from \"../../utils/index.js\";\n\nimport type { Reader, Writer } from \"./abstract-coder.js\";\n\n\n/**\n * @_ignore\n */\nexport class FixedBytesCoder extends Coder {\n readonly size!: number;\n\n constructor(size: number, localName: string) {\n let name = \"bytes\" + String(size);\n super(name, name, localName, false);\n defineProperties(this, { size }, { size: \"number\" });\n }\n\n defaultValue(): string {\n return (\"0x0000000000000000000000000000000000000000000000000000000000000000\").substring(0, 2 + this.size * 2);\n }\n\n encode(writer: Writer, _value: BytesLike | Typed): number {\n let data = getBytesCopy(Typed.dereference(_value, this.type));\n if (data.length !== this.size) { this._throwError(\"incorrect data length\", _value); }\n return writer.writeBytes(data);\n }\n\n decode(reader: Reader): any {\n return hexlify(reader.readBytes(this.size));\n }\n}\n", "import { Coder } from \"./abstract-coder.js\";\nimport type { Reader, Writer } from \"./abstract-coder.js\";\n\nconst Empty = new Uint8Array([ ]);\n\n/**\n * @_ignore\n */\nexport class NullCoder extends Coder {\n\n constructor(localName: string) {\n super(\"null\", \"\", localName, false);\n }\n\n defaultValue(): null {\n return null;\n }\n\n encode(writer: Writer, value: any): number {\n if (value != null) { this._throwError(\"not null\", value); }\n return writer.writeBytes(Empty);\n }\n\n decode(reader: Reader): any {\n reader.readBytes(0);\n return null;\n }\n}\n", "import {\n defineProperties, fromTwos, getBigInt, mask, toTwos\n} from \"../../utils/index.js\";\n\nimport { Typed } from \"../typed.js\";\nimport { Coder, WordSize } from \"./abstract-coder.js\";\n\nimport type { BigNumberish } from \"../../utils/index.js\";\n\nimport type { Reader, Writer } from \"./abstract-coder.js\";\n\n\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_MAX_UINT256 = BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\n\n/**\n * @_ignore\n */\nexport class NumberCoder extends Coder {\n readonly size!: number;\n readonly signed!: boolean;\n\n constructor(size: number, signed: boolean, localName: string) {\n const name = ((signed ? \"int\": \"uint\") + (size * 8));\n super(name, name, localName, false);\n\n defineProperties(this, { size, signed }, { size: \"number\", signed: \"boolean\" });\n }\n\n defaultValue(): number {\n return 0;\n }\n\n encode(writer: Writer, _value: BigNumberish | Typed): number {\n let value = getBigInt(Typed.dereference(_value, this.type));\n\n // Check bounds are safe for encoding\n let maxUintValue = mask(BN_MAX_UINT256, WordSize * 8);\n if (this.signed) {\n let bounds = mask(maxUintValue, (this.size * 8) - 1);\n if (value > bounds || value < -(bounds + BN_1)) {\n this._throwError(\"value out-of-bounds\", _value);\n }\n value = toTwos(value, 8 * WordSize);\n } else if (value < BN_0 || value > mask(maxUintValue, this.size * 8)) {\n this._throwError(\"value out-of-bounds\", _value);\n }\n\n return writer.writeValue(value);\n }\n\n decode(reader: Reader): any {\n let value = mask(reader.readValue(), this.size * 8);\n\n if (this.signed) {\n value = fromTwos(value, this.size * 8);\n }\n\n return value;\n }\n}\n\n", "import { toUtf8Bytes, toUtf8String } from \"../../utils/utf8.js\";\n\nimport { Typed } from \"../typed.js\";\nimport { DynamicBytesCoder } from \"./bytes.js\";\n\nimport type { Reader, Writer } from \"./abstract-coder.js\";\n\n\n/**\n * @_ignore\n */\nexport class StringCoder extends DynamicBytesCoder {\n\n constructor(localName: string) {\n super(\"string\", localName);\n }\n\n defaultValue(): string {\n return \"\";\n }\n\n encode(writer: Writer, _value: string | Typed): number {\n return super.encode(writer, toUtf8Bytes(Typed.dereference(_value, \"string\")));\n }\n\n decode(reader: Reader): any {\n return toUtf8String(super.decode(reader));\n }\n}\n", "import { defineProperties } from \"../../utils/properties.js\";\n\nimport { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n\nimport { pack, unpack } from \"./array.js\";\n\nimport type { Reader, Writer } from \"./abstract-coder.js\";\n\n/**\n * @_ignore\n */\nexport class TupleCoder extends Coder {\n readonly coders!: ReadonlyArray;\n\n constructor(coders: Array, localName: string) {\n let dynamic = false;\n const types: Array = [];\n coders.forEach((coder) => {\n if (coder.dynamic) { dynamic = true; }\n types.push(coder.type);\n });\n const type = (\"tuple(\" + types.join(\",\") + \")\");\n\n super(\"tuple\", type, localName, dynamic);\n defineProperties(this, { coders: Object.freeze(coders.slice()) });\n }\n\n defaultValue(): any {\n const values: any = [ ];\n this.coders.forEach((coder) => {\n values.push(coder.defaultValue());\n });\n\n // We only output named properties for uniquely named coders\n const uniqueNames = this.coders.reduce((accum, coder) => {\n const name = coder.localName;\n if (name) {\n if (!accum[name]) { accum[name] = 0; }\n accum[name]++;\n }\n return accum;\n }, <{ [ name: string ]: number }>{ });\n\n // Add named values\n this.coders.forEach((coder: Coder, index: number) => {\n let name = coder.localName;\n if (!name || uniqueNames[name] !== 1) { return; }\n\n if (name === \"length\") { name = \"_length\"; }\n\n if (values[name] != null) { return; }\n\n values[name] = values[index];\n });\n\n return Object.freeze(values);\n }\n\n encode(writer: Writer, _value: Array | { [ name: string ]: any } | Typed): number {\n const value = Typed.dereference(_value, \"tuple\");\n return pack(writer, this.coders, value);\n }\n\n decode(reader: Reader): any {\n return unpack(reader, this.coders);\n }\n}\n\n", "import { keccak256 } from \"../crypto/index.js\";\nimport { toUtf8Bytes } from \"../utils/index.js\";\n\n/**\n * A simple hashing function which operates on UTF-8 strings to\n * compute an 32-byte identifier.\n *\n * This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes\n * the [[keccak256]].\n *\n * @example:\n * id(\"hello world\")\n * //_result:\n */\nexport function id(value: string): string {\n return keccak256(toUtf8Bytes(value));\n}\n", "\nimport { keccak256 } from \"../crypto/index.js\";\nimport {\n concat, hexlify, assertArgument, toUtf8Bytes\n} from \"../utils/index.js\";\n\n\nimport { ens_normalize } from \"@adraffy/ens-normalize\";\n\nconst Zeros = new Uint8Array(32);\nZeros.fill(0);\n\nfunction checkComponent(comp: Uint8Array): Uint8Array {\n assertArgument(comp.length !== 0, \"invalid ENS name; empty component\", \"comp\", comp)\n return comp;\n}\n\nfunction ensNameSplit(name: string): Array {\n const bytes = toUtf8Bytes(ensNormalize(name));\n const comps: Array = [ ];\n\n if (name.length === 0) { return comps; }\n\n let last = 0;\n for (let i = 0; i < bytes.length; i++) {\n const d = bytes[i];\n\n // A separator (i.e. \".\"); copy this component\n if (d === 0x2e) {\n comps.push(checkComponent(bytes.slice(last, i)));\n last = i + 1;\n }\n }\n\n // There was a stray separator at the end of the name\n assertArgument(last < bytes.length, \"invalid ENS name; empty component\", \"name\", name);\n\n comps.push(checkComponent(bytes.slice(last)));\n return comps;\n}\n\n/**\n * Returns the ENS %%name%% normalized.\n */\nexport function ensNormalize(name: string): string {\n try {\n if (name.length === 0) { throw new Error(\"empty label\"); }\n return ens_normalize(name);\n } catch (error: any) {\n assertArgument(false, `invalid ENS name (${ error.message })`, \"name\", name);\n }\n}\n\n/**\n * Returns ``true`` if %%name%% is a valid ENS name.\n */\nexport function isValidName(name: string): name is string {\n try {\n return (ensNameSplit(name).length !== 0);\n } catch (error) { }\n return false;\n}\n\n/**\n * Returns the [[link-namehash]] for %%name%%.\n */\nexport function namehash(name: string): string {\n assertArgument(typeof(name) === \"string\", \"invalid ENS name; not a string\", \"name\", name);\n\n assertArgument(name.length, `invalid ENS name (empty label)`, \"name\", name);\n\n let result: string | Uint8Array = Zeros;\n\n const comps = ensNameSplit(name);\n while (comps.length) {\n result = keccak256(concat([ result, keccak256((comps.pop()))] ));\n }\n\n return hexlify(result);\n}\n\n/**\n * Returns the DNS encoded %%name%%.\n *\n * This is used for various parts of ENS name resolution, such\n * as the wildcard resolution.\n */\nexport function dnsEncode(name: string, _maxLength?: number): string {\n const length = (_maxLength != null) ? _maxLength: 63;\n\n assertArgument(length <= 255, \"DNS encoded label cannot exceed 255\", \"length\", length);\n\n return hexlify(concat(ensNameSplit(name).map((comp) => {\n assertArgument(comp.length <= length, `label ${ JSON.stringify(name) } exceeds ${ length } bytes`, \"name\", name);\n\n const bytes = new Uint8Array(comp.length + 1);\n bytes.set(comp, 1);\n bytes[0] = bytes.length - 1;\n return bytes;\n }))) + \"00\";\n}\n", "import { getAddress } from \"../address/index.js\";\nimport { assertArgument, isHexString } from \"../utils/index.js\";\n\nimport type { AccessList, AccessListish } from \"./index.js\";\n\n\nfunction accessSetify(addr: string, storageKeys: Array): { address: string,storageKeys: Array } {\n return {\n address: getAddress(addr),\n storageKeys: storageKeys.map((storageKey, index) => {\n assertArgument(isHexString(storageKey, 32), \"invalid slot\", `storageKeys[${ index }]`, storageKey);\n return storageKey.toLowerCase();\n })\n };\n}\n\n/**\n * Returns a [[AccessList]] from any ethers-supported access-list structure.\n */\nexport function accessListify(value: AccessListish): AccessList {\n if (Array.isArray(value)) {\n return (] | { address: string, storageKeys: Array}>>value).map((set, index) => {\n if (Array.isArray(set)) {\n assertArgument(set.length === 2, \"invalid slot set\", `value[${ index }]`, set);\n return accessSetify(set[0], set[1])\n }\n assertArgument(set != null && typeof(set) === \"object\", \"invalid address-slot set\", \"value\", value);\n return accessSetify(set.address, set.storageKeys);\n });\n }\n\n assertArgument(value != null && typeof(value) === \"object\", \"invalid access list\", \"value\", value);\n\n const result: Array<{ address: string, storageKeys: Array }> = Object.keys(value).map((addr) => {\n const storageKeys: Record = value[addr].reduce((accum, storageKey) => {\n accum[storageKey] = true;\n return accum;\n }, >{ });\n return accessSetify(addr, Object.keys(storageKeys).sort())\n });\n result.sort((a, b) => (a.address.localeCompare(b.address)));\n return result;\n}\n", "import { getAddress } from \"../address/index.js\";\nimport { keccak256, SigningKey } from \"../crypto/index.js\";\n\nimport type { SignatureLike } from \"../crypto/index.js\";\nimport type { BytesLike } from \"../utils/index.js\";\n\n/**\n * Returns the address for the %%key%%.\n *\n * The key may be any standard form of public key or a private key.\n */\nexport function computeAddress(key: string | SigningKey): string {\n let pubkey: string;\n if (typeof(key) === \"string\") {\n pubkey = SigningKey.computePublicKey(key, false);\n } else {\n pubkey = key.publicKey;\n }\n return getAddress(keccak256(\"0x\" + pubkey.substring(4)).substring(26));\n}\n\n/**\n * Returns the recovered address for the private key that was\n * used to sign %%digest%% that resulted in %%signature%%.\n */\nexport function recoverAddress(digest: BytesLike, signature: SignatureLike): string {\n return computeAddress(SigningKey.recoverPublicKey(digest, signature));\n}\n", "\nimport { getAddress } from \"../address/index.js\";\nimport { ZeroAddress } from \"../constants/addresses.js\";\nimport { keccak256, Signature, SigningKey } from \"../crypto/index.js\";\nimport {\n concat, decodeRlp, encodeRlp, getBytes, getBigInt, getNumber, hexlify,\n assert, assertArgument, isHexString, toBeArray, zeroPadValue\n} from \"../utils/index.js\";\n\nimport { accessListify } from \"./accesslist.js\";\nimport { recoverAddress } from \"./address.js\";\n\nimport type { BigNumberish, BytesLike } from \"../utils/index.js\";\nimport type { SignatureLike } from \"../crypto/index.js\";\n\nimport type { AccessList, AccessListish } from \"./index.js\";\n\n\nconst BN_0 = BigInt(0);\nconst BN_2 = BigInt(2);\nconst BN_27 = BigInt(27)\nconst BN_28 = BigInt(28)\nconst BN_35 = BigInt(35);\nconst BN_MAX_UINT = BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\n\n\n/**\n * A **TransactionLike** is an object which is appropriate as a loose\n * input for many operations which will populate missing properties of\n * a transaction.\n */\nexport interface TransactionLike {\n /**\n * The type.\n */\n type?: null | number;\n\n /**\n * The recipient address or ``null`` for an ``init`` transaction.\n */\n to?: null | A;\n\n /**\n * The sender.\n */\n from?: null | A;\n\n /**\n * The nonce.\n */\n nonce?: null | number;\n\n /**\n * The maximum amount of gas that can be used.\n */\n gasLimit?: null | BigNumberish;\n\n /**\n * The gas price for legacy and berlin transactions.\n */\n gasPrice?: null | BigNumberish;\n\n /**\n * The maximum priority fee per gas for london transactions.\n */\n maxPriorityFeePerGas?: null | BigNumberish;\n\n /**\n * The maximum total fee per gas for london transactions.\n */\n maxFeePerGas?: null | BigNumberish;\n\n /**\n * The data.\n */\n data?: null | string;\n\n /**\n * The value (in wei) to send.\n */\n value?: null | BigNumberish;\n\n /**\n * The chain ID the transaction is valid on.\n */\n chainId?: null | BigNumberish;\n\n /**\n * The transaction hash.\n */\n hash?: null | string;\n\n /**\n * The signature provided by the sender.\n */\n signature?: null | SignatureLike;\n\n /**\n * The access list for berlin and london transactions.\n */\n accessList?: null | AccessListish;\n\n /**\n * The maximum fee per blob gas (see [[link-eip-4844]]).\n */\n maxFeePerBlobGas?: null | BigNumberish;\n\n /**\n * The versioned hashes (see [[link-eip-4844]]).\n */\n blobVersionedHashes?: null | Array;\n}\n\nfunction handleAddress(value: string): null | string {\n if (value === \"0x\") { return null; }\n return getAddress(value);\n}\n\nfunction handleAccessList(value: any, param: string): AccessList {\n try {\n return accessListify(value);\n } catch (error: any) {\n assertArgument(false, error.message, param, value);\n }\n}\n\nfunction handleNumber(_value: string, param: string): number {\n if (_value === \"0x\") { return 0; }\n return getNumber(_value, param);\n}\n\nfunction handleUint(_value: string, param: string): bigint {\n if (_value === \"0x\") { return BN_0; }\n const value = getBigInt(_value, param);\n assertArgument(value <= BN_MAX_UINT, \"value exceeds uint size\", param, value);\n return value;\n}\n\nfunction formatNumber(_value: BigNumberish, name: string): Uint8Array {\n const value = getBigInt(_value, \"value\");\n const result = toBeArray(value);\n assertArgument(result.length <= 32, `value too large`, `tx.${ name }`, value);\n return result;\n}\n\nfunction formatAccessList(value: AccessListish): Array<[ string, Array ]> {\n return accessListify(value).map((set) => [ set.address, set.storageKeys ]);\n}\n\nfunction formatHashes(value: Array, param: string): Array {\n assertArgument(Array.isArray(value), `invalid ${ param }`, \"value\", value);\n for (let i = 0; i < value.length; i++) {\n assertArgument(isHexString(value[i], 32), \"invalid ${ param } hash\", `value[${ i }]`, value[i]);\n }\n return value;\n}\n\nfunction _parseLegacy(data: Uint8Array): TransactionLike {\n const fields: any = decodeRlp(data);\n\n assertArgument(Array.isArray(fields) && (fields.length === 9 || fields.length === 6),\n \"invalid field count for legacy transaction\", \"data\", data);\n\n const tx: TransactionLike = {\n type: 0,\n nonce: handleNumber(fields[0], \"nonce\"),\n gasPrice: handleUint(fields[1], \"gasPrice\"),\n gasLimit: handleUint(fields[2], \"gasLimit\"),\n to: handleAddress(fields[3]),\n value: handleUint(fields[4], \"value\"),\n data: hexlify(fields[5]),\n chainId: BN_0\n };\n\n // Legacy unsigned transaction\n if (fields.length === 6) { return tx; }\n\n const v = handleUint(fields[6], \"v\");\n const r = handleUint(fields[7], \"r\");\n const s = handleUint(fields[8], \"s\");\n\n if (r === BN_0 && s === BN_0) {\n // EIP-155 unsigned transaction\n tx.chainId = v;\n\n } else {\n\n // Compute the EIP-155 chain ID (or 0 for legacy)\n let chainId = (v - BN_35) / BN_2;\n if (chainId < BN_0) { chainId = BN_0; }\n tx.chainId = chainId\n\n // Signed Legacy Transaction\n assertArgument(chainId !== BN_0 || (v === BN_27 || v === BN_28), \"non-canonical legacy v\", \"v\", fields[6]);\n\n tx.signature = Signature.from({\n r: zeroPadValue(fields[7], 32),\n s: zeroPadValue(fields[8], 32),\n v\n });\n\n tx.hash = keccak256(data);\n }\n\n return tx;\n}\n\nfunction _serializeLegacy(tx: Transaction, sig?: Signature): string {\n const fields: Array = [\n formatNumber(tx.nonce, \"nonce\"),\n formatNumber(tx.gasPrice || 0, \"gasPrice\"),\n formatNumber(tx.gasLimit, \"gasLimit\"),\n (tx.to || \"0x\"),\n formatNumber(tx.value, \"value\"),\n tx.data,\n ];\n\n let chainId = BN_0;\n if (tx.chainId != BN_0) {\n // A chainId was provided; if non-zero we'll use EIP-155\n chainId = getBigInt(tx.chainId, \"tx.chainId\");\n\n // We have a chainId in the tx and an EIP-155 v in the signature,\n // make sure they agree with each other\n assertArgument(!sig || sig.networkV == null || sig.legacyChainId === chainId,\n \"tx.chainId/sig.v mismatch\", \"sig\", sig);\n\n } else if (tx.signature) {\n // No explicit chainId, but EIP-155 have a derived implicit chainId\n const legacy = tx.signature.legacyChainId;\n if (legacy != null) { chainId = legacy; }\n }\n\n // Requesting an unsigned transaction\n if (!sig) {\n // We have an EIP-155 transaction (chainId was specified and non-zero)\n if (chainId !== BN_0) {\n fields.push(toBeArray(chainId));\n fields.push(\"0x\");\n fields.push(\"0x\");\n }\n\n return encodeRlp(fields);\n }\n\n // @TODO: We should probably check that tx.signature, chainId, and sig\n // match but that logic could break existing code, so schedule\n // this for the next major bump.\n\n // Compute the EIP-155 v\n let v = BigInt(27 + sig.yParity);\n if (chainId !== BN_0) {\n v = Signature.getChainIdV(chainId, sig.v);\n } else if (BigInt(sig.v) !== v) {\n assertArgument(false, \"tx.chainId/sig.v mismatch\", \"sig\", sig);\n }\n\n // Add the signature\n fields.push(toBeArray(v));\n fields.push(toBeArray(sig.r));\n fields.push(toBeArray(sig.s));\n\n return encodeRlp(fields);\n}\n\nfunction _parseEipSignature(tx: TransactionLike, fields: Array): void {\n let yParity: number;\n try {\n yParity = handleNumber(fields[0], \"yParity\");\n if (yParity !== 0 && yParity !== 1) { throw new Error(\"bad yParity\"); }\n } catch (error) {\n assertArgument(false, \"invalid yParity\", \"yParity\", fields[0]);\n }\n\n const r = zeroPadValue(fields[1], 32);\n const s = zeroPadValue(fields[2], 32);\n\n const signature = Signature.from({ r, s, yParity });\n tx.signature = signature;\n}\n\nfunction _parseEip1559(data: Uint8Array): TransactionLike {\n const fields: any = decodeRlp(getBytes(data).slice(1));\n\n assertArgument(Array.isArray(fields) && (fields.length === 9 || fields.length === 12),\n \"invalid field count for transaction type: 2\", \"data\", hexlify(data));\n\n const tx: TransactionLike = {\n type: 2,\n chainId: handleUint(fields[0], \"chainId\"),\n nonce: handleNumber(fields[1], \"nonce\"),\n maxPriorityFeePerGas: handleUint(fields[2], \"maxPriorityFeePerGas\"),\n maxFeePerGas: handleUint(fields[3], \"maxFeePerGas\"),\n gasPrice: null,\n gasLimit: handleUint(fields[4], \"gasLimit\"),\n to: handleAddress(fields[5]),\n value: handleUint(fields[6], \"value\"),\n data: hexlify(fields[7]),\n accessList: handleAccessList(fields[8], \"accessList\"),\n };\n\n // Unsigned EIP-1559 Transaction\n if (fields.length === 9) { return tx; }\n\n tx.hash = keccak256(data);\n\n _parseEipSignature(tx, fields.slice(9));\n\n return tx;\n}\n\nfunction _serializeEip1559(tx: Transaction, sig?: Signature): string {\n const fields: Array = [\n formatNumber(tx.chainId, \"chainId\"),\n formatNumber(tx.nonce, \"nonce\"),\n formatNumber(tx.maxPriorityFeePerGas || 0, \"maxPriorityFeePerGas\"),\n formatNumber(tx.maxFeePerGas || 0, \"maxFeePerGas\"),\n formatNumber(tx.gasLimit, \"gasLimit\"),\n (tx.to || \"0x\"),\n formatNumber(tx.value, \"value\"),\n tx.data,\n formatAccessList(tx.accessList || [ ])\n ];\n\n if (sig) {\n fields.push(formatNumber(sig.yParity, \"yParity\"));\n fields.push(toBeArray(sig.r));\n fields.push(toBeArray(sig.s));\n }\n\n return concat([ \"0x02\", encodeRlp(fields)]);\n}\n\nfunction _parseEip2930(data: Uint8Array): TransactionLike {\n const fields: any = decodeRlp(getBytes(data).slice(1));\n\n assertArgument(Array.isArray(fields) && (fields.length === 8 || fields.length === 11),\n \"invalid field count for transaction type: 1\", \"data\", hexlify(data));\n\n const tx: TransactionLike = {\n type: 1,\n chainId: handleUint(fields[0], \"chainId\"),\n nonce: handleNumber(fields[1], \"nonce\"),\n gasPrice: handleUint(fields[2], \"gasPrice\"),\n gasLimit: handleUint(fields[3], \"gasLimit\"),\n to: handleAddress(fields[4]),\n value: handleUint(fields[5], \"value\"),\n data: hexlify(fields[6]),\n accessList: handleAccessList(fields[7], \"accessList\")\n };\n\n // Unsigned EIP-2930 Transaction\n if (fields.length === 8) { return tx; }\n\n tx.hash = keccak256(data);\n\n _parseEipSignature(tx, fields.slice(8));\n\n return tx;\n}\n\nfunction _serializeEip2930(tx: Transaction, sig?: Signature): string {\n const fields: any = [\n formatNumber(tx.chainId, \"chainId\"),\n formatNumber(tx.nonce, \"nonce\"),\n formatNumber(tx.gasPrice || 0, \"gasPrice\"),\n formatNumber(tx.gasLimit, \"gasLimit\"),\n (tx.to || \"0x\"),\n formatNumber(tx.value, \"value\"),\n tx.data,\n formatAccessList(tx.accessList || [ ])\n ];\n\n if (sig) {\n fields.push(formatNumber(sig.yParity, \"recoveryParam\"));\n fields.push(toBeArray(sig.r));\n fields.push(toBeArray(sig.s));\n }\n\n return concat([ \"0x01\", encodeRlp(fields)]);\n}\n\nfunction _parseEip4844(data: Uint8Array): TransactionLike {\n const fields: any = decodeRlp(getBytes(data).slice(1));\n\n assertArgument(Array.isArray(fields) && (fields.length === 11 || fields.length === 14),\n \"invalid field count for transaction type: 3\", \"data\", hexlify(data));\n\n const tx: TransactionLike = {\n type: 3,\n chainId: handleUint(fields[0], \"chainId\"),\n nonce: handleNumber(fields[1], \"nonce\"),\n maxPriorityFeePerGas: handleUint(fields[2], \"maxPriorityFeePerGas\"),\n maxFeePerGas: handleUint(fields[3], \"maxFeePerGas\"),\n gasPrice: null,\n gasLimit: handleUint(fields[4], \"gasLimit\"),\n to: handleAddress(fields[5]),\n value: handleUint(fields[6], \"value\"),\n data: hexlify(fields[7]),\n accessList: handleAccessList(fields[8], \"accessList\"),\n maxFeePerBlobGas: handleUint(fields[9], \"maxFeePerBlobGas\"),\n blobVersionedHashes: fields[10]\n };\n\n assertArgument(tx.to != null, \"invalid address for transaction type: 3\", \"data\", data);\n\n assertArgument(Array.isArray(tx.blobVersionedHashes), \"invalid blobVersionedHashes: must be an array\", \"data\", data);\n for (let i = 0; i < tx.blobVersionedHashes.length; i++) {\n assertArgument(isHexString(tx.blobVersionedHashes[i], 32), `invalid blobVersionedHash at index ${ i }: must be length 32`, \"data\", data);\n }\n\n // Unsigned EIP-4844 Transaction\n if (fields.length === 11) { return tx; }\n\n tx.hash = keccak256(data);\n\n _parseEipSignature(tx, fields.slice(11));\n\n return tx;\n}\n\nfunction _serializeEip4844(tx: Transaction, sig?: Signature): string {\n const fields: Array = [\n formatNumber(tx.chainId, \"chainId\"),\n formatNumber(tx.nonce, \"nonce\"),\n formatNumber(tx.maxPriorityFeePerGas || 0, \"maxPriorityFeePerGas\"),\n formatNumber(tx.maxFeePerGas || 0, \"maxFeePerGas\"),\n formatNumber(tx.gasLimit, \"gasLimit\"),\n (tx.to || ZeroAddress),\n formatNumber(tx.value, \"value\"),\n tx.data,\n formatAccessList(tx.accessList || [ ]),\n formatNumber(tx.maxFeePerBlobGas || 0, \"maxFeePerBlobGas\"),\n formatHashes(tx.blobVersionedHashes || [ ], \"blobVersionedHashes\")\n ];\n\n if (sig) {\n fields.push(formatNumber(sig.yParity, \"yParity\"));\n fields.push(toBeArray(sig.r));\n fields.push(toBeArray(sig.s));\n }\n\n return concat([ \"0x03\", encodeRlp(fields)]);\n}\n\n/**\n * A **Transaction** describes an operation to be executed on\n * Ethereum by an Externally Owned Account (EOA). It includes\n * who (the [[to]] address), what (the [[data]]) and how much (the\n * [[value]] in ether) the operation should entail.\n *\n * @example:\n * tx = new Transaction()\n * //_result:\n *\n * tx.data = \"0x1234\";\n * //_result:\n */\nexport class Transaction implements TransactionLike {\n #type: null | number;\n #to: null | string;\n #data: string;\n #nonce: number;\n #gasLimit: bigint;\n #gasPrice: null | bigint;\n #maxPriorityFeePerGas: null | bigint;\n #maxFeePerGas: null | bigint;\n #value: bigint;\n #chainId: bigint;\n #sig: null | Signature;\n #accessList: null | AccessList;\n #maxFeePerBlobGas: null | bigint;\n #blobVersionedHashes: null | Array;\n\n /**\n * The transaction type.\n *\n * If null, the type will be automatically inferred based on\n * explicit properties.\n */\n get type(): null | number { return this.#type; }\n set type(value: null | number | string) {\n switch (value) {\n case null:\n this.#type = null;\n break;\n case 0: case \"legacy\":\n this.#type = 0;\n break;\n case 1: case \"berlin\": case \"eip-2930\":\n this.#type = 1;\n break;\n case 2: case \"london\": case \"eip-1559\":\n this.#type = 2;\n break;\n case 3: case \"cancun\": case \"eip-4844\":\n this.#type = 3;\n break;\n default:\n assertArgument(false, \"unsupported transaction type\", \"type\", value);\n }\n }\n\n /**\n * The name of the transaction type.\n */\n get typeName(): null | string {\n switch (this.type) {\n case 0: return \"legacy\";\n case 1: return \"eip-2930\";\n case 2: return \"eip-1559\";\n case 3: return \"eip-4844\";\n }\n\n return null;\n }\n\n /**\n * The ``to`` address for the transaction or ``null`` if the\n * transaction is an ``init`` transaction.\n */\n get to(): null | string {\n const value = this.#to;\n if (value == null && this.type === 3) { return ZeroAddress; }\n return value;\n }\n set to(value: null | string) {\n this.#to = (value == null) ? null: getAddress(value);\n }\n\n /**\n * The transaction nonce.\n */\n get nonce(): number { return this.#nonce; }\n set nonce(value: BigNumberish) { this.#nonce = getNumber(value, \"value\"); }\n\n /**\n * The gas limit.\n */\n get gasLimit(): bigint { return this.#gasLimit; }\n set gasLimit(value: BigNumberish) { this.#gasLimit = getBigInt(value); }\n\n /**\n * The gas price.\n *\n * On legacy networks this defines the fee that will be paid. On\n * EIP-1559 networks, this should be ``null``.\n */\n get gasPrice(): null | bigint {\n const value = this.#gasPrice;\n if (value == null && (this.type === 0 || this.type === 1)) { return BN_0; }\n return value;\n }\n set gasPrice(value: null | BigNumberish) {\n this.#gasPrice = (value == null) ? null: getBigInt(value, \"gasPrice\");\n }\n\n /**\n * The maximum priority fee per unit of gas to pay. On legacy\n * networks this should be ``null``.\n */\n get maxPriorityFeePerGas(): null | bigint {\n const value = this.#maxPriorityFeePerGas;\n if (value == null) {\n if (this.type === 2 || this.type === 3) { return BN_0; }\n return null;\n }\n return value;\n }\n set maxPriorityFeePerGas(value: null | BigNumberish) {\n this.#maxPriorityFeePerGas = (value == null) ? null: getBigInt(value, \"maxPriorityFeePerGas\");\n }\n\n /**\n * The maximum total fee per unit of gas to pay. On legacy\n * networks this should be ``null``.\n */\n get maxFeePerGas(): null | bigint {\n const value = this.#maxFeePerGas;\n if (value == null) {\n if (this.type === 2 || this.type === 3) { return BN_0; }\n return null;\n }\n return value;\n }\n set maxFeePerGas(value: null | BigNumberish) {\n this.#maxFeePerGas = (value == null) ? null: getBigInt(value, \"maxFeePerGas\");\n }\n\n /**\n * The transaction data. For ``init`` transactions this is the\n * deployment code.\n */\n get data(): string { return this.#data; }\n set data(value: BytesLike) { this.#data = hexlify(value); }\n\n /**\n * The amount of ether (in wei) to send in this transactions.\n */\n get value(): bigint { return this.#value; }\n set value(value: BigNumberish) {\n this.#value = getBigInt(value, \"value\");\n }\n\n /**\n * The chain ID this transaction is valid on.\n */\n get chainId(): bigint { return this.#chainId; }\n set chainId(value: BigNumberish) { this.#chainId = getBigInt(value); }\n\n /**\n * If signed, the signature for this transaction.\n */\n get signature(): null | Signature { return this.#sig || null; }\n set signature(value: null | SignatureLike) {\n this.#sig = (value == null) ? null: Signature.from(value);\n }\n\n /**\n * The access list.\n *\n * An access list permits discounted (but pre-paid) access to\n * bytecode and state variable access within contract execution.\n */\n get accessList(): null | AccessList {\n const value = this.#accessList || null;\n if (value == null) {\n if (this.type === 1 || this.type === 2 || this.type === 3) {\n // @TODO: in v7, this should assign the value or become\n // a live object itself, otherwise mutation is inconsistent\n return [ ];\n }\n return null;\n }\n return value;\n }\n set accessList(value: null | AccessListish) {\n this.#accessList = (value == null) ? null: accessListify(value);\n }\n\n /**\n * The max fee per blob gas for Cancun transactions.\n */\n get maxFeePerBlobGas(): null | bigint {\n const value = this.#maxFeePerBlobGas;\n if (value == null && this.type === 3) { return BN_0; }\n return value;\n }\n set maxFeePerBlobGas(value: null | BigNumberish) {\n this.#maxFeePerBlobGas = (value == null) ? null: getBigInt(value, \"maxFeePerBlobGas\");\n }\n\n /**\n * The BLOB versioned hashes for Cancun transactions.\n */\n get blobVersionedHashes(): null | Array {\n // @TODO: Mutation is inconsistent; if unset, the returned value\n // cannot mutate the object, if set it can\n let value = this.#blobVersionedHashes;\n if (value == null && this.type === 3) { return [ ]; }\n return value;\n }\n set blobVersionedHashes(value: null | Array) {\n if (value != null) {\n assertArgument(Array.isArray(value), \"blobVersionedHashes must be an Array\", \"value\", value);\n value = value.slice();\n for (let i = 0; i < value.length; i++) {\n assertArgument(isHexString(value[i], 32), \"invalid blobVersionedHash\", `value[${ i }]`, value[i]);\n }\n }\n this.#blobVersionedHashes = value;\n }\n\n /**\n * Creates a new Transaction with default values.\n */\n constructor() {\n this.#type = null;\n this.#to = null;\n this.#nonce = 0;\n this.#gasLimit = BN_0;\n this.#gasPrice = null;\n this.#maxPriorityFeePerGas = null;\n this.#maxFeePerGas = null;\n this.#data = \"0x\";\n this.#value = BN_0;\n this.#chainId = BN_0;\n this.#sig = null;\n this.#accessList = null;\n this.#maxFeePerBlobGas = null;\n this.#blobVersionedHashes = null;\n }\n\n /**\n * The transaction hash, if signed. Otherwise, ``null``.\n */\n get hash(): null | string {\n if (this.signature == null) { return null; }\n return keccak256(this.serialized);\n }\n\n /**\n * The pre-image hash of this transaction.\n *\n * This is the digest that a [[Signer]] must sign to authorize\n * this transaction.\n */\n get unsignedHash(): string {\n return keccak256(this.unsignedSerialized);\n }\n\n /**\n * The sending address, if signed. Otherwise, ``null``.\n */\n get from(): null | string {\n if (this.signature == null) { return null; }\n return recoverAddress(this.unsignedHash, this.signature);\n }\n\n /**\n * The public key of the sender, if signed. Otherwise, ``null``.\n */\n get fromPublicKey(): null | string {\n if (this.signature == null) { return null; }\n return SigningKey.recoverPublicKey(this.unsignedHash, this.signature);\n }\n\n /**\n * Returns true if signed.\n *\n * This provides a Type Guard that properties requiring a signed\n * transaction are non-null.\n */\n isSigned(): this is (Transaction & { type: number, typeName: string, from: string, signature: Signature }) {\n return this.signature != null;\n }\n\n /**\n * The serialized transaction.\n *\n * This throws if the transaction is unsigned. For the pre-image,\n * use [[unsignedSerialized]].\n */\n get serialized(): string {\n assert(this.signature != null, \"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized\", \"UNSUPPORTED_OPERATION\", { operation: \".serialized\"});\n\n switch (this.inferType()) {\n case 0:\n return _serializeLegacy(this, this.signature);\n case 1:\n return _serializeEip2930(this, this.signature);\n case 2:\n return _serializeEip1559(this, this.signature);\n case 3:\n return _serializeEip4844(this, this.signature);\n }\n\n assert(false, \"unsupported transaction type\", \"UNSUPPORTED_OPERATION\", { operation: \".serialized\" });\n }\n\n /**\n * The transaction pre-image.\n *\n * The hash of this is the digest which needs to be signed to\n * authorize this transaction.\n */\n get unsignedSerialized(): string {\n switch (this.inferType()) {\n case 0:\n return _serializeLegacy(this);\n case 1:\n return _serializeEip2930(this);\n case 2:\n return _serializeEip1559(this);\n case 3:\n return _serializeEip4844(this);\n }\n\n assert(false, \"unsupported transaction type\", \"UNSUPPORTED_OPERATION\", { operation: \".unsignedSerialized\" });\n }\n\n /**\n * Return the most \"likely\" type; currently the highest\n * supported transaction type.\n */\n inferType(): number {\n const types = this.inferTypes();\n\n // Prefer London (EIP-1559) over Cancun (BLOb)\n if (types.indexOf(2) >= 0) { return 2; }\n\n // Return the highest inferred type\n return (types.pop());\n }\n\n /**\n * Validates the explicit properties and returns a list of compatible\n * transaction types.\n */\n inferTypes(): Array {\n\n // Checks that there are no conflicting properties set\n const hasGasPrice = this.gasPrice != null;\n const hasFee = (this.maxFeePerGas != null || this.maxPriorityFeePerGas != null);\n const hasAccessList = (this.accessList != null);\n const hasBlob = (this.#maxFeePerBlobGas != null || this.#blobVersionedHashes);\n\n //if (hasGasPrice && hasFee) {\n // throw new Error(\"transaction cannot have gasPrice and maxFeePerGas\");\n //}\n\n if (this.maxFeePerGas != null && this.maxPriorityFeePerGas != null) {\n assert(this.maxFeePerGas >= this.maxPriorityFeePerGas, \"priorityFee cannot be more than maxFee\", \"BAD_DATA\", { value: this });\n }\n\n //if (this.type === 2 && hasGasPrice) {\n // throw new Error(\"eip-1559 transaction cannot have gasPrice\");\n //}\n\n assert(!hasFee || (this.type !== 0 && this.type !== 1), \"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas\", \"BAD_DATA\", { value: this });\n assert(this.type !== 0 || !hasAccessList, \"legacy transaction cannot have accessList\", \"BAD_DATA\", { value: this })\n\n const types: Array = [ ];\n\n // Explicit type\n if (this.type != null) {\n types.push(this.type);\n\n } else {\n if (hasFee) {\n types.push(2);\n } else if (hasGasPrice) {\n types.push(1);\n if (!hasAccessList) { types.push(0); }\n } else if (hasAccessList) {\n types.push(1);\n types.push(2);\n } else if (hasBlob && this.to) {\n types.push(3);\n } else {\n types.push(0);\n types.push(1);\n types.push(2);\n types.push(3);\n }\n }\n\n types.sort();\n\n return types;\n }\n\n /**\n * Returns true if this transaction is a legacy transaction (i.e.\n * ``type === 0``).\n *\n * This provides a Type Guard that the related properties are\n * non-null.\n */\n isLegacy(): this is (Transaction & { type: 0, gasPrice: bigint }) {\n return (this.type === 0);\n }\n\n /**\n * Returns true if this transaction is berlin hardform transaction (i.e.\n * ``type === 1``).\n *\n * This provides a Type Guard that the related properties are\n * non-null.\n */\n isBerlin(): this is (Transaction & { type: 1, gasPrice: bigint, accessList: AccessList }) {\n return (this.type === 1);\n }\n\n /**\n * Returns true if this transaction is london hardform transaction (i.e.\n * ``type === 2``).\n *\n * This provides a Type Guard that the related properties are\n * non-null.\n */\n isLondon(): this is (Transaction & { type: 2, accessList: AccessList, maxFeePerGas: bigint, maxPriorityFeePerGas: bigint }) {\n return (this.type === 2);\n }\n\n /**\n * Returns true if this transaction is an [[link-eip-4844]] BLOB\n * transaction.\n *\n * This provides a Type Guard that the related properties are\n * non-null.\n */\n isCancun(): this is (Transaction & { type: 3, to: string, accessList: AccessList, maxFeePerGas: bigint, maxPriorityFeePerGas: bigint, maxFeePerBlobGas: bigint, blobVersionedHashes: Array }) {\n return (this.type === 3);\n }\n\n /**\n * Create a copy of this transaciton.\n */\n clone(): Transaction {\n return Transaction.from(this);\n }\n\n /**\n * Return a JSON-friendly object.\n */\n toJSON(): any {\n const s = (v: null | bigint) => {\n if (v == null) { return null; }\n return v.toString();\n };\n\n return {\n type: this.type,\n to: this.to,\n// from: this.from,\n data: this.data,\n nonce: this.nonce,\n gasLimit: s(this.gasLimit),\n gasPrice: s(this.gasPrice),\n maxPriorityFeePerGas: s(this.maxPriorityFeePerGas),\n maxFeePerGas: s(this.maxFeePerGas),\n value: s(this.value),\n chainId: s(this.chainId),\n sig: this.signature ? this.signature.toJSON(): null,\n accessList: this.accessList\n };\n }\n\n /**\n * Create a **Transaction** from a serialized transaction or a\n * Transaction-like object.\n */\n static from(tx?: string | TransactionLike): Transaction {\n if (tx == null) { return new Transaction(); }\n\n if (typeof(tx) === \"string\") {\n const payload = getBytes(tx);\n\n if (payload[0] >= 0x7f) { // @TODO: > vs >= ??\n return Transaction.from(_parseLegacy(payload));\n }\n\n switch(payload[0]) {\n case 1: return Transaction.from(_parseEip2930(payload));\n case 2: return Transaction.from(_parseEip1559(payload));\n case 3: return Transaction.from(_parseEip4844(payload));\n }\n assert(false, \"unsupported transaction type\", \"UNSUPPORTED_OPERATION\", { operation: \"from\" });\n }\n\n const result = new Transaction();\n if (tx.type != null) { result.type = tx.type; }\n if (tx.to != null) { result.to = tx.to; }\n if (tx.nonce != null) { result.nonce = tx.nonce; }\n if (tx.gasLimit != null) { result.gasLimit = tx.gasLimit; }\n if (tx.gasPrice != null) { result.gasPrice = tx.gasPrice; }\n if (tx.maxPriorityFeePerGas != null) { result.maxPriorityFeePerGas = tx.maxPriorityFeePerGas; }\n if (tx.maxFeePerGas != null) { result.maxFeePerGas = tx.maxFeePerGas; }\n if (tx.maxFeePerBlobGas != null) { result.maxFeePerBlobGas = tx.maxFeePerBlobGas; }\n if (tx.data != null) { result.data = tx.data; }\n if (tx.value != null) { result.value = tx.value; }\n if (tx.chainId != null) { result.chainId = tx.chainId; }\n if (tx.signature != null) { result.signature = Signature.from(tx.signature); }\n if (tx.accessList != null) { result.accessList = tx.accessList; }\n if (tx.blobVersionedHashes != null) { result.blobVersionedHashes = tx.blobVersionedHashes; }\n\n if (tx.hash != null) {\n assertArgument(result.isSigned(), \"unsigned transaction cannot define hash\", \"tx\", tx);\n assertArgument(result.hash === tx.hash, \"hash mismatch\", \"tx\", tx);\n }\n\n if (tx.from != null) {\n assertArgument(result.isSigned(), \"unsigned transaction cannot define from\", \"tx\", tx);\n assertArgument(result.from.toLowerCase() === (tx.from || \"\").toLowerCase(), \"from mismatch\", \"tx\", tx);\n }\n\n return result;\n }\n}\n", "import { keccak256 } from \"../crypto/index.js\";\nimport { MessagePrefix } from \"../constants/index.js\";\nimport { recoverAddress } from \"../transaction/index.js\";\nimport { concat, toUtf8Bytes } from \"../utils/index.js\";\n\nimport type { SignatureLike } from \"../crypto/index.js\";\n/**\n * Computes the [[link-eip-191]] personal-sign message digest to sign.\n *\n * This prefixes the message with [[MessagePrefix]] and the decimal length\n * of %%message%% and computes the [[keccak256]] digest.\n *\n * If %%message%% is a string, it is converted to its UTF-8 bytes\n * first. To compute the digest of a [[DataHexString]], it must be converted\n * to [bytes](getBytes).\n *\n * @example:\n * hashMessage(\"Hello World\")\n * //_result:\n *\n * // Hashes the SIX (6) string characters, i.e.\n * // [ \"0\", \"x\", \"4\", \"2\", \"4\", \"3\" ]\n * hashMessage(\"0x4243\")\n * //_result:\n *\n * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]...\n * hashMessage(getBytes(\"0x4243\"))\n * //_result:\n *\n * // ...which is equal to using data\n * hashMessage(new Uint8Array([ 0x42, 0x43 ]))\n * //_result:\n *\n */\nexport function hashMessage(message: Uint8Array | string): string {\n if (typeof(message) === \"string\") { message = toUtf8Bytes(message); }\n return keccak256(concat([\n toUtf8Bytes(MessagePrefix),\n toUtf8Bytes(String(message.length)),\n message\n ]));\n}\n\n/**\n * Return the address of the private key that produced\n * the signature %%sig%% during signing for %%message%%.\n */\nexport function verifyMessage(message: Uint8Array | string, sig: SignatureLike): string {\n const digest = hashMessage(message);\n return recoverAddress(digest, sig);\n}\n", "import { getAddress } from \"../address/index.js\";\nimport {\n keccak256 as _keccak256, sha256 as _sha256\n} from \"../crypto/index.js\";\nimport {\n concat, dataLength, getBytes, hexlify, toBeArray, toTwos, toUtf8Bytes, zeroPadBytes, zeroPadValue,\n assertArgument\n} from \"../utils/index.js\";\n\n\nconst regexBytes = new RegExp(\"^bytes([0-9]+)$\");\nconst regexNumber = new RegExp(\"^(u?int)([0-9]*)$\");\nconst regexArray = new RegExp(\"^(.*)\\\\[([0-9]*)\\\\]$\");\n\n\nfunction _pack(type: string, value: any, isArray?: boolean): Uint8Array {\n switch(type) {\n case \"address\":\n if (isArray) { return getBytes(zeroPadValue(value, 32)); }\n return getBytes(getAddress(value));\n case \"string\":\n return toUtf8Bytes(value);\n case \"bytes\":\n return getBytes(value);\n case \"bool\":\n value = (!!value ? \"0x01\": \"0x00\");\n if (isArray) { return getBytes(zeroPadValue(value, 32)); }\n return getBytes(value);\n }\n\n let match = type.match(regexNumber);\n if (match) {\n let signed = (match[1] === \"int\");\n let size = parseInt(match[2] || \"256\")\n\n assertArgument((!match[2] || match[2] === String(size)) && (size % 8 === 0) && size !== 0 && size <= 256, \"invalid number type\", \"type\", type);\n\n if (isArray) { size = 256; }\n\n if (signed) { value = toTwos(value, size); }\n\n return getBytes(zeroPadValue(toBeArray(value), size / 8));\n }\n\n match = type.match(regexBytes);\n if (match) {\n const size = parseInt(match[1]);\n\n assertArgument(String(size) === match[1] && size !== 0 && size <= 32, \"invalid bytes type\", \"type\", type);\n assertArgument(dataLength(value) === size, `invalid value for ${ type }`, \"value\", value);\n\n if (isArray) { return getBytes(zeroPadBytes(value, 32)); }\n return value;\n }\n\n match = type.match(regexArray);\n if (match && Array.isArray(value)) {\n const baseType = match[1];\n const count = parseInt(match[2] || String(value.length));\n assertArgument(count === value.length, `invalid array length for ${ type }`, \"value\", value);\n\n const result: Array = [];\n value.forEach(function(value) {\n result.push(_pack(baseType, value, true));\n });\n return getBytes(concat(result));\n }\n\n assertArgument(false, \"invalid type\", \"type\", type)\n}\n\n// @TODO: Array Enum\n\n/**\n * Computes the [[link-solc-packed]] representation of %%values%%\n * respectively to their %%types%%.\n *\n * @example:\n * addr = \"0x8ba1f109551bd432803012645ac136ddd64dba72\"\n * solidityPacked([ \"address\", \"uint\" ], [ addr, 45 ]);\n * //_result:\n */\nexport function solidityPacked(types: ReadonlyArray, values: ReadonlyArray): string {\n assertArgument(types.length === values.length, \"wrong number of values; expected ${ types.length }\", \"values\", values);\n\n const tight: Array = [];\n types.forEach(function(type, index) {\n tight.push(_pack(type, values[index]));\n });\n return hexlify(concat(tight));\n}\n\n/**\n * Computes the [[link-solc-packed]] [[keccak256]] hash of %%values%%\n * respectively to their %%types%%.\n *\n * @example:\n * addr = \"0x8ba1f109551bd432803012645ac136ddd64dba72\"\n * solidityPackedKeccak256([ \"address\", \"uint\" ], [ addr, 45 ]);\n * //_result:\n */\nexport function solidityPackedKeccak256(types: ReadonlyArray, values: ReadonlyArray): string {\n return _keccak256(solidityPacked(types, values));\n}\n\n/**\n * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%%\n * respectively to their %%types%%.\n *\n * @example:\n * addr = \"0x8ba1f109551bd432803012645ac136ddd64dba72\"\n * solidityPackedSha256([ \"address\", \"uint\" ], [ addr, 45 ]);\n * //_result:\n */\nexport function solidityPackedSha256(types: ReadonlyArray, values: ReadonlyArray): string {\n return _sha256(solidityPacked(types, values));\n}\n", "//import { TypedDataDomain, TypedDataField } from \"@ethersproject/providerabstract-signer\";\nimport { getAddress } from \"../address/index.js\";\nimport { keccak256 } from \"../crypto/index.js\";\nimport { recoverAddress } from \"../transaction/index.js\";\nimport {\n concat, defineProperties, getBigInt, getBytes, hexlify, isHexString, mask, toBeHex, toQuantity, toTwos, zeroPadValue,\n assertArgument\n} from \"../utils/index.js\";\n\nimport { id } from \"./id.js\";\n\nimport type { SignatureLike } from \"../crypto/index.js\";\nimport type { BigNumberish, BytesLike } from \"../utils/index.js\";\n\n\nconst padding = new Uint8Array(32);\npadding.fill(0);\n\nconst BN__1 = BigInt(-1);\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_MAX_UINT256 = BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\n\n// @TODO: in v7, verifyingContract should be an AddressLike and use resolveAddress\n\n/**\n * The domain for an [[link-eip-712]] payload.\n */\nexport interface TypedDataDomain {\n /**\n * The human-readable name of the signing domain.\n */\n name?: null | string;\n\n /**\n * The major version of the signing domain.\n */\n version?: null | string;\n\n /**\n * The chain ID of the signing domain.\n */\n chainId?: null | BigNumberish;\n\n /**\n * The the address of the contract that will verify the signature.\n */\n verifyingContract?: null | string;\n\n /**\n * A salt used for purposes decided by the specific domain.\n */\n salt?: null | BytesLike;\n};\n\n/**\n * A specific field of a structured [[link-eip-712]] type.\n */\nexport interface TypedDataField {\n /**\n * The field name.\n */\n name: string;\n\n /**\n * The type of the field.\n */\n type: string;\n};\n\nfunction hexPadRight(value: BytesLike): string {\n const bytes = getBytes(value);\n const padOffset = bytes.length % 32\n if (padOffset) {\n return concat([ bytes, padding.slice(padOffset) ]);\n }\n return hexlify(bytes);\n}\n\nconst hexTrue = toBeHex(BN_1, 32);\nconst hexFalse = toBeHex(BN_0, 32);\n\nconst domainFieldTypes: Record = {\n name: \"string\",\n version: \"string\",\n chainId: \"uint256\",\n verifyingContract: \"address\",\n salt: \"bytes32\"\n};\n\nconst domainFieldNames: Array = [\n \"name\", \"version\", \"chainId\", \"verifyingContract\", \"salt\"\n];\n\nfunction checkString(key: string): (value: any) => string {\n return function (value: any){\n assertArgument(typeof(value) === \"string\", `invalid domain value for ${ JSON.stringify(key) }`, `domain.${ key }`, value);\n return value;\n }\n}\n\nconst domainChecks: Record any> = {\n name: checkString(\"name\"),\n version: checkString(\"version\"),\n chainId: function(_value: any) {\n const value = getBigInt(_value, \"domain.chainId\");\n assertArgument(value >= 0, \"invalid chain ID\", \"domain.chainId\", _value);\n if (Number.isSafeInteger(value)) { return Number(value); }\n return toQuantity(value);\n },\n verifyingContract: function(value: any) {\n try {\n return getAddress(value).toLowerCase();\n } catch (error) { }\n assertArgument(false, `invalid domain value \"verifyingContract\"`, \"domain.verifyingContract\", value);\n },\n salt: function(value: any) {\n const bytes = getBytes(value, \"domain.salt\");\n assertArgument(bytes.length === 32, `invalid domain value \"salt\"`, \"domain.salt\", value);\n return hexlify(bytes);\n }\n}\n\nfunction getBaseEncoder(type: string): null | ((value: any) => string) {\n // intXX and uintXX\n {\n const match = type.match(/^(u?)int(\\d+)$/);\n if (match) {\n const signed = (match[1] === \"\");\n\n const width = parseInt(match[2]);\n assertArgument(width % 8 === 0 && width !== 0 && width <= 256 && match[2] === String(width), \"invalid numeric width\", \"type\", type);\n\n const boundsUpper = mask(BN_MAX_UINT256, signed ? (width - 1): width);\n const boundsLower = signed ? ((boundsUpper + BN_1) * BN__1): BN_0;\n\n return function(_value: BigNumberish) {\n const value = getBigInt(_value, \"value\");\n\n assertArgument(value >= boundsLower && value <= boundsUpper, `value out-of-bounds for ${ type }`, \"value\", value);\n\n return toBeHex(signed ? toTwos(value, 256): value, 32);\n };\n }\n }\n\n // bytesXX\n {\n const match = type.match(/^bytes(\\d+)$/);\n if (match) {\n const width = parseInt(match[1]);\n assertArgument(width !== 0 && width <= 32 && match[1] === String(width), \"invalid bytes width\", \"type\", type);\n\n return function(value: BytesLike) {\n const bytes = getBytes(value);\n assertArgument(bytes.length === width, `invalid length for ${ type }`, \"value\", value);\n return hexPadRight(value);\n };\n }\n }\n\n switch (type) {\n case \"address\": return function(value: string) {\n return zeroPadValue(getAddress(value), 32);\n };\n case \"bool\": return function(value: boolean) {\n return ((!value) ? hexFalse: hexTrue);\n };\n case \"bytes\": return function(value: BytesLike) {\n return keccak256(value);\n };\n case \"string\": return function(value: string) {\n return id(value);\n };\n }\n\n return null;\n}\n\nfunction encodeType(name: string, fields: Array): string {\n return `${ name }(${ fields.map(({ name, type }) => (type + \" \" + name)).join(\",\") })`;\n}\n\ntype ArrayResult = {\n base: string; // The base type\n index?: string; // the full Index (if any)\n array?: { // The Array... (if index)\n base: string; // ...base type (same as above)\n prefix: string; // ...sans the final Index\n count: number; // ...the final Index (-1 for dynamic)\n }\n};\n\n// foo[][3] => { base: \"foo\", index: \"[][3]\", array: {\n// base: \"foo\", prefix: \"foo[]\", count: 3 } }\nfunction splitArray(type: string): ArrayResult {\n const match = type.match(/^([^\\x5b]*)((\\x5b\\d*\\x5d)*)(\\x5b(\\d*)\\x5d)$/);\n if (match) {\n return {\n base: match[1],\n index: (match[2] + match[4]),\n array: {\n base: match[1],\n prefix: (match[1] + match[2]),\n count: (match[5] ? parseInt(match[5]): -1),\n }\n };\n }\n\n return { base: type };\n}\n\n/**\n * A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads\n * for signed typed data.\n *\n * This is useful for those that wish to compute various components of a\n * typed data hash, primary types, or sub-components, but generally the\n * higher level [[Signer-signTypedData]] is more useful.\n */\nexport class TypedDataEncoder {\n /**\n * The primary type for the structured [[types]].\n *\n * This is derived automatically from the [[types]], since no\n * recursion is possible, once the DAG for the types is consturcted\n * internally, the primary type must be the only remaining type with\n * no parent nodes.\n */\n readonly primaryType!: string;\n\n readonly #types: string;\n\n /**\n * The types.\n */\n get types(): Record> {\n return JSON.parse(this.#types);\n }\n\n readonly #fullTypes: Map\n\n readonly #encoderCache: Map string>;\n\n /**\n * Create a new **TypedDataEncoder** for %%types%%.\n *\n * This performs all necessary checking that types are valid and\n * do not violate the [[link-eip-712]] structural constraints as\n * well as computes the [[primaryType]].\n */\n constructor(_types: Record>) {\n this.#fullTypes = new Map();\n this.#encoderCache = new Map();\n\n // Link struct types to their direct child structs\n const links: Map> = new Map();\n\n // Link structs to structs which contain them as a child\n const parents: Map> = new Map();\n\n // Link all subtypes within a given struct\n const subtypes: Map> = new Map();\n\n const types: Record> = { };\n Object.keys(_types).forEach((type) => {\n types[type] = _types[type].map(({ name, type }) => {\n\n // Normalize the base type (unless name conflict)\n let { base, index } = splitArray(type);\n if (base === \"int\" && !_types[\"int\"]) { base = \"int256\"; }\n if (base === \"uint\" && !_types[\"uint\"]) { base = \"uint256\"; }\n\n return { name, type: (base + (index || \"\")) };\n });\n\n links.set(type, new Set());\n parents.set(type, [ ]);\n subtypes.set(type, new Set());\n });\n this.#types = JSON.stringify(types);\n\n for (const name in types) {\n const uniqueNames: Set = new Set();\n\n for (const field of types[name]) {\n\n // Check each field has a unique name\n assertArgument(!uniqueNames.has(field.name), `duplicate variable name ${ JSON.stringify(field.name) } in ${ JSON.stringify(name) }`, \"types\", _types);\n uniqueNames.add(field.name);\n\n // Get the base type (drop any array specifiers)\n const baseType = splitArray(field.type).base;\n assertArgument(baseType !== name, `circular type reference to ${ JSON.stringify(baseType) }`, \"types\", _types);\n\n // Is this a base encoding type?\n const encoder = getBaseEncoder(baseType);\n if (encoder) { continue; }\n\n assertArgument(parents.has(baseType), `unknown type ${ JSON.stringify(baseType) }`, \"types\", _types);\n\n // Add linkage\n (parents.get(baseType) as Array).push(name);\n (links.get(name) as Set).add(baseType);\n }\n }\n\n // Deduce the primary type\n const primaryTypes = Array.from(parents.keys()).filter((n) => ((parents.get(n) as Array).length === 0));\n assertArgument(primaryTypes.length !== 0, \"missing primary type\", \"types\", _types);\n assertArgument(primaryTypes.length === 1, `ambiguous primary types or unused types: ${ primaryTypes.map((t) => (JSON.stringify(t))).join(\", \") }`, \"types\", _types);\n\n defineProperties(this, { primaryType: primaryTypes[0] });\n\n // Check for circular type references\n function checkCircular(type: string, found: Set) {\n assertArgument(!found.has(type), `circular type reference to ${ JSON.stringify(type) }`, \"types\", _types);\n\n found.add(type);\n\n for (const child of (links.get(type) as Set)) {\n if (!parents.has(child)) { continue; }\n\n // Recursively check children\n checkCircular(child, found);\n\n // Mark all ancestors as having this decendant\n for (const subtype of found) {\n (subtypes.get(subtype) as Set).add(child);\n }\n }\n\n found.delete(type);\n }\n checkCircular(this.primaryType, new Set());\n\n // Compute each fully describe type\n for (const [ name, set ] of subtypes) {\n const st = Array.from(set);\n st.sort();\n this.#fullTypes.set(name, encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join(\"\"));\n }\n }\n\n /**\n * Returnthe encoder for the specific %%type%%.\n */\n getEncoder(type: string): (value: any) => string {\n let encoder = this.#encoderCache.get(type);\n if (!encoder) {\n encoder = this.#getEncoder(type);\n this.#encoderCache.set(type, encoder);\n }\n return encoder;\n }\n\n #getEncoder(type: string): (value: any) => string {\n\n // Basic encoder type (address, bool, uint256, etc)\n {\n const encoder = getBaseEncoder(type);\n if (encoder) { return encoder; }\n }\n\n // Array\n const array = splitArray(type).array;\n if (array) {\n const subtype = array.prefix;\n const subEncoder = this.getEncoder(subtype);\n return (value: Array) => {\n assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${ array.count }`, \"value\", value);\n\n let result = value.map(subEncoder);\n if (this.#fullTypes.has(subtype)) {\n result = result.map(keccak256);\n }\n\n return keccak256(concat(result));\n };\n }\n\n // Struct\n const fields = this.types[type];\n if (fields) {\n const encodedType = id(this.#fullTypes.get(type) as string);\n return (value: Record) => {\n const values = fields.map(({ name, type }) => {\n const result = this.getEncoder(type)(value[name]);\n if (this.#fullTypes.has(type)) { return keccak256(result); }\n return result;\n });\n values.unshift(encodedType);\n return concat(values);\n }\n }\n\n assertArgument(false, `unknown type: ${ type }`, \"type\", type);\n }\n\n /**\n * Return the full type for %%name%%.\n */\n encodeType(name: string): string {\n const result = this.#fullTypes.get(name);\n assertArgument(result, `unknown type: ${ JSON.stringify(name) }`, \"name\", name);\n return result;\n }\n\n /**\n * Return the encoded %%value%% for the %%type%%.\n */\n encodeData(type: string, value: any): string {\n return this.getEncoder(type)(value);\n }\n\n /**\n * Returns the hash of %%value%% for the type of %%name%%.\n */\n hashStruct(name: string, value: Record): string {\n return keccak256(this.encodeData(name, value));\n }\n\n /**\n * Return the fulled encoded %%value%% for the [[types]].\n */\n encode(value: Record): string {\n return this.encodeData(this.primaryType, value);\n }\n\n /**\n * Return the hash of the fully encoded %%value%% for the [[types]].\n */\n hash(value: Record): string {\n return this.hashStruct(this.primaryType, value);\n }\n\n /**\n * @_ignore:\n */\n _visit(type: string, value: any, callback: (type: string, data: any) => any): any {\n // Basic encoder type (address, bool, uint256, etc)\n {\n const encoder = getBaseEncoder(type);\n if (encoder) { return callback(type, value); }\n }\n\n // Array\n const array = splitArray(type).array;\n if (array) {\n assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${ array.count }`, \"value\", value);\n return value.map((v: any) => this._visit(array.prefix, v, callback));\n }\n\n // Struct\n const fields = this.types[type];\n if (fields) {\n return fields.reduce((accum, { name, type }) => {\n accum[name] = this._visit(type, value[name], callback);\n return accum;\n }, >{});\n }\n\n assertArgument(false, `unknown type: ${ type }`, \"type\", type);\n }\n\n /**\n * Call %%calback%% for each value in %%value%%, passing the type and\n * component within %%value%%.\n *\n * This is useful for replacing addresses or other transformation that\n * may be desired on each component, based on its type.\n */\n visit(value: Record, callback: (type: string, data: any) => any): any {\n return this._visit(this.primaryType, value, callback);\n }\n\n /**\n * Create a new **TypedDataEncoder** for %%types%%.\n */\n static from(types: Record>): TypedDataEncoder {\n return new TypedDataEncoder(types);\n }\n\n /**\n * Return the primary type for %%types%%.\n */\n static getPrimaryType(types: Record>): string {\n return TypedDataEncoder.from(types).primaryType;\n }\n\n /**\n * Return the hashed struct for %%value%% using %%types%% and %%name%%.\n */\n static hashStruct(name: string, types: Record>, value: Record): string {\n return TypedDataEncoder.from(types).hashStruct(name, value);\n }\n\n /**\n * Return the domain hash for %%domain%%.\n */\n static hashDomain(domain: TypedDataDomain): string {\n const domainFields: Array = [ ];\n for (const name in domain) {\n if ((>domain)[name] == null) { continue; }\n const type = domainFieldTypes[name];\n assertArgument(type, `invalid typed-data domain key: ${ JSON.stringify(name) }`, \"domain\", domain);\n domainFields.push({ name, type });\n }\n\n domainFields.sort((a, b) => {\n return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name);\n });\n\n return TypedDataEncoder.hashStruct(\"EIP712Domain\", { EIP712Domain: domainFields }, domain);\n }\n\n /**\n * Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%.\n */\n static encode(domain: TypedDataDomain, types: Record>, value: Record): string {\n return concat([\n \"0x1901\",\n TypedDataEncoder.hashDomain(domain),\n TypedDataEncoder.from(types).hash(value)\n ]);\n }\n\n /**\n * Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%.\n */\n static hash(domain: TypedDataDomain, types: Record>, value: Record): string {\n return keccak256(TypedDataEncoder.encode(domain, types, value));\n }\n\n // Replaces all address types with ENS names with their looked up address\n /**\n * Resolves to the value from resolving all addresses in %%value%% for\n * %%types%% and the %%domain%%.\n */\n static async resolveNames(domain: TypedDataDomain, types: Record>, value: Record, resolveName: (name: string) => Promise): Promise<{ domain: TypedDataDomain, value: any }> {\n // Make a copy to isolate it from the object passed in\n domain = Object.assign({ }, domain);\n\n // Allow passing null to ignore value\n for (const key in domain) {\n if ((>domain)[key] == null) {\n delete (>domain)[key];\n }\n }\n\n // Look up all ENS names\n const ensCache: Record = { };\n\n // Do we need to look up the domain's verifyingContract?\n if (domain.verifyingContract && !isHexString(domain.verifyingContract, 20)) {\n ensCache[domain.verifyingContract] = \"0x\";\n }\n\n // We are going to use the encoder to visit all the base values\n const encoder = TypedDataEncoder.from(types);\n\n // Get a list of all the addresses\n encoder.visit(value, (type: string, value: any) => {\n if (type === \"address\" && !isHexString(value, 20)) {\n ensCache[value] = \"0x\";\n }\n return value;\n });\n\n // Lookup each name\n for (const name in ensCache) {\n ensCache[name] = await resolveName(name);\n }\n\n // Replace the domain verifyingContract if needed\n if (domain.verifyingContract && ensCache[domain.verifyingContract]) {\n domain.verifyingContract = ensCache[domain.verifyingContract];\n }\n\n // Replace all ENS names with their address\n value = encoder.visit(value, (type: string, value: any) => {\n if (type === \"address\" && ensCache[value]) { return ensCache[value]; }\n return value;\n });\n\n return { domain, value };\n }\n\n /**\n * Returns the JSON-encoded payload expected by nodes which implement\n * the JSON-RPC [[link-eip-712]] method.\n */\n static getPayload(domain: TypedDataDomain, types: Record>, value: Record): any {\n // Validate the domain fields\n TypedDataEncoder.hashDomain(domain);\n\n // Derive the EIP712Domain Struct reference type\n const domainValues: Record = { };\n const domainTypes: Array<{ name: string, type:string }> = [ ];\n\n domainFieldNames.forEach((name) => {\n const value = (domain)[name];\n if (value == null) { return; }\n domainValues[name] = domainChecks[name](value);\n domainTypes.push({ name, type: domainFieldTypes[name] });\n });\n\n const encoder = TypedDataEncoder.from(types);\n\n // Get the normalized types\n types = encoder.types;\n\n const typesWithDomain = Object.assign({ }, types);\n assertArgument(typesWithDomain.EIP712Domain == null, \"types must not contain EIP712Domain type\", \"types.EIP712Domain\", types);\n\n typesWithDomain.EIP712Domain = domainTypes;\n\n // Validate the data structures and types\n encoder.encode(value);\n\n return {\n types: typesWithDomain,\n domain: domainValues,\n primaryType: encoder.primaryType,\n message: encoder.visit(value, (type: string, value: any) => {\n\n // bytes\n if (type.match(/^bytes(\\d*)/)) {\n return hexlify(getBytes(value));\n }\n\n // uint or int\n if (type.match(/^u?int/)) {\n return getBigInt(value).toString();\n }\n\n switch (type) {\n case \"address\":\n return value.toLowerCase();\n case \"bool\":\n return !!value;\n case \"string\":\n assertArgument(typeof(value) === \"string\", \"invalid string\", \"value\", value);\n return value;\n }\n\n assertArgument(false, \"unsupported type\", \"type\", type);\n })\n };\n }\n}\n\n/**\n * Compute the address used to sign the typed data for the %%signature%%.\n */\nexport function verifyTypedData(domain: TypedDataDomain, types: Record>, value: Record, signature: SignatureLike): string {\n return recoverAddress(TypedDataEncoder.hash(domain, types, value), signature);\n}\n", "/**\n * A fragment is a single item from an ABI, which may represent any of:\n *\n * - [Functions](FunctionFragment)\n * - [Events](EventFragment)\n * - [Constructors](ConstructorFragment)\n * - Custom [Errors](ErrorFragment)\n * - [Fallback or Receive](FallbackFragment) functions\n *\n * @_subsection api/abi/abi-coder:Fragments [about-fragments]\n */\n\nimport {\n defineProperties, getBigInt, getNumber,\n assert, assertPrivate, assertArgument\n} from \"../utils/index.js\";\nimport { id } from \"../hash/index.js\";\n\n/**\n * A Type description in a [JSON ABI format](link-solc-jsonabi).\n */\nexport interface JsonFragmentType {\n /**\n * The parameter name.\n */\n readonly name?: string;\n\n /**\n * If the parameter is indexed.\n */\n readonly indexed?: boolean;\n\n /**\n * The type of the parameter.\n */\n readonly type?: string;\n\n /**\n * The internal Solidity type.\n */\n readonly internalType?: string;\n\n /**\n * The components for a tuple.\n */\n readonly components?: ReadonlyArray;\n}\n\n/**\n * A fragment for a method, event or error in a [JSON ABI format](link-solc-jsonabi).\n */\nexport interface JsonFragment {\n /**\n * The name of the error, event, function, etc.\n */\n readonly name?: string;\n\n /**\n * The type of the fragment (e.g. ``event``, ``\"function\"``, etc.)\n */\n readonly type?: string;\n\n /**\n * If the event is anonymous.\n */\n readonly anonymous?: boolean;\n\n /**\n * If the function is payable.\n */\n readonly payable?: boolean;\n\n /**\n * If the function is constant.\n */\n readonly constant?: boolean;\n\n /**\n * The mutability state of the function.\n */\n readonly stateMutability?: string;\n\n /**\n * The input parameters.\n */\n readonly inputs?: ReadonlyArray;\n\n /**\n * The output parameters.\n */\n readonly outputs?: ReadonlyArray;\n\n /**\n * The gas limit to use when sending a transaction for this function.\n */\n readonly gas?: string;\n};\n\n/**\n * The format to serialize the output as.\n *\n * **``\"sighash\"``** - the bare formatting, used to compute the selector\n * or topic hash; this format cannot be reversed (as it discards ``indexed``)\n * so cannot by used to export an [[Interface]].\n *\n * **``\"minimal\"``** - Human-Readable ABI with minimal spacing and without\n * names, so it is compact, but will result in Result objects that cannot\n * be accessed by name.\n *\n * **``\"full\"``** - Full Human-Readable ABI, with readable spacing and names\n * intact; this is generally the recommended format.\n *\n * **``\"json\"``** - The [JSON ABI format](link-solc-jsonabi).\n */\nexport type FormatType = \"sighash\" | \"minimal\" | \"full\" | \"json\";\n\n// [ \"a\", \"b\" ] => { \"a\": 1, \"b\": 1 }\nfunction setify(items: Array): ReadonlySet {\n const result: Set = new Set();\n items.forEach((k) => result.add(k));\n return Object.freeze(result);\n}\n\nconst _kwVisibDeploy = \"external public payable override\";\nconst KwVisibDeploy = setify(_kwVisibDeploy.split(\" \"));\n\n// Visibility Keywords\nconst _kwVisib = \"constant external internal payable private public pure view override\";\nconst KwVisib = setify(_kwVisib.split(\" \"));\n\nconst _kwTypes = \"constructor error event fallback function receive struct\";\nconst KwTypes = setify(_kwTypes.split(\" \"));\n\nconst _kwModifiers = \"calldata memory storage payable indexed\";\nconst KwModifiers = setify(_kwModifiers.split(\" \"));\n\nconst _kwOther = \"tuple returns\";\n\n// All Keywords\nconst _keywords = [ _kwTypes, _kwModifiers, _kwOther, _kwVisib ].join(\" \");\nconst Keywords = setify(_keywords.split(\" \"));\n\n// Single character tokens\nconst SimpleTokens: Record = {\n \"(\": \"OPEN_PAREN\", \")\": \"CLOSE_PAREN\",\n \"[\": \"OPEN_BRACKET\", \"]\": \"CLOSE_BRACKET\",\n \",\": \"COMMA\", \"@\": \"AT\"\n};\n\n// Parser regexes to consume the next token\nconst regexWhitespacePrefix = new RegExp(\"^(\\\\s*)\");\nconst regexNumberPrefix = new RegExp(\"^([0-9]+)\");\nconst regexIdPrefix = new RegExp(\"^([a-zA-Z$_][a-zA-Z0-9$_]*)\");\n\n// Parser regexs to check validity\nconst regexId = new RegExp(\"^([a-zA-Z$_][a-zA-Z0-9$_]*)$\");\nconst regexType = new RegExp(\"^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$\");\n\n/**\n * @ignore:\n */\ntype Token = Readonly<{\n // Type of token (e.g. TYPE, KEYWORD, NUMBER, etc)\n type: string;\n\n // Offset into the original source code\n offset: number;\n\n // Actual text content of the token\n text: string;\n\n // The parenthesis depth\n depth: number;\n\n // If a parenthesis, the offset (in tokens) that balances it\n match: number;\n\n // For parenthesis and commas, the offset (in tokens) to the\n // previous/next parenthesis or comma in the list\n linkBack: number;\n linkNext: number;\n\n // If a BRACKET, the value inside\n value: number;\n}>;\n\nclass TokenString {\n #offset: number;\n #tokens: ReadonlyArray;\n\n get offset(): number { return this.#offset; }\n get length(): number { return this.#tokens.length - this.#offset; }\n\n constructor(tokens: ReadonlyArray) {\n this.#offset = 0;\n this.#tokens = tokens.slice();\n }\n\n clone(): TokenString { return new TokenString(this.#tokens); }\n reset(): void { this.#offset = 0; }\n\n #subTokenString(from: number = 0, to: number = 0): TokenString {\n return new TokenString(this.#tokens.slice(from, to).map((t) => {\n return Object.freeze(Object.assign({ }, t, {\n match: (t.match - from),\n linkBack: (t.linkBack - from),\n linkNext: (t.linkNext - from),\n }));\n }));\n }\n\n // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens\n popKeyword(allowed: ReadonlySet): string {\n const top = this.peek();\n if (top.type !== \"KEYWORD\" || !allowed.has(top.text)) { throw new Error(`expected keyword ${ top.text }`); }\n return this.pop().text;\n }\n\n // Pops and returns the value of the next token if it is `type`; throws if out of tokens\n popType(type: string): string {\n if (this.peek().type !== type) {\n const top = this.peek();\n throw new Error(`expected ${ type }; got ${ top.type } ${ JSON.stringify(top.text) }`);\n }\n return this.pop().text;\n }\n\n // Pops and returns a \"(\" TOKENS \")\"\n popParen(): TokenString {\n const top = this.peek();\n if (top.type !== \"OPEN_PAREN\") { throw new Error(\"bad start\"); }\n const result = this.#subTokenString(this.#offset + 1, top.match + 1);\n this.#offset = top.match + 1;\n return result;\n }\n\n // Pops and returns the items within \"(\" ITEM1 \",\" ITEM2 \",\" ... \")\"\n popParams(): Array {\n const top = this.peek();\n\n if (top.type !== \"OPEN_PAREN\") { throw new Error(\"bad start\"); }\n\n const result: Array = [ ];\n\n while(this.#offset < top.match - 1) {\n const link = this.peek().linkNext;\n result.push(this.#subTokenString(this.#offset + 1, link));\n this.#offset = link;\n }\n\n this.#offset = top.match + 1;\n\n return result;\n }\n\n // Returns the top Token, throwing if out of tokens\n peek(): Token {\n if (this.#offset >= this.#tokens.length) {\n throw new Error(\"out-of-bounds\");\n }\n return this.#tokens[this.#offset];\n }\n\n // Returns the next value, if it is a keyword in `allowed`\n peekKeyword(allowed: ReadonlySet): null | string {\n const top = this.peekType(\"KEYWORD\");\n return (top != null && allowed.has(top)) ? top: null;\n }\n\n // Returns the value of the next token if it is `type`\n peekType(type: string): null | string {\n if (this.length === 0) { return null; }\n const top = this.peek();\n return (top.type === type) ? top.text: null;\n }\n\n // Returns the next token; throws if out of tokens\n pop(): Token {\n const result = this.peek();\n this.#offset++;\n return result;\n }\n\n toString(): string {\n const tokens: Array = [ ];\n for (let i = this.#offset; i < this.#tokens.length; i++) {\n const token = this.#tokens[i];\n tokens.push(`${ token.type }:${ token.text }`);\n }\n return ``\n }\n}\n\ntype Writeable = { -readonly [P in keyof T]: T[P] };\n\nfunction lex(text: string): TokenString {\n const tokens: Array = [ ];\n\n const throwError = (message: string) => {\n const token = (offset < text.length) ? JSON.stringify(text[offset]): \"$EOI\";\n throw new Error(`invalid token ${ token } at ${ offset }: ${ message }`);\n };\n\n let brackets: Array = [ ];\n let commas: Array = [ ];\n\n let offset = 0;\n while (offset < text.length) {\n\n // Strip off any leading whitespace\n let cur = text.substring(offset);\n let match = cur.match(regexWhitespacePrefix);\n if (match) {\n offset += match[1].length;\n cur = text.substring(offset);\n }\n\n const token = { depth: brackets.length, linkBack: -1, linkNext: -1, match: -1, type: \"\", text: \"\", offset, value: -1 };\n tokens.push(token);\n\n let type = (SimpleTokens[cur[0]] || \"\");\n if (type) {\n token.type = type;\n token.text = cur[0];\n offset++;\n\n if (type === \"OPEN_PAREN\") {\n brackets.push(tokens.length - 1);\n commas.push(tokens.length - 1);\n\n } else if (type == \"CLOSE_PAREN\") {\n if (brackets.length === 0) { throwError(\"no matching open bracket\"); }\n\n token.match = brackets.pop() as number;\n (>(tokens[token.match])).match = tokens.length - 1;\n token.depth--;\n\n token.linkBack = commas.pop() as number;\n (>(tokens[token.linkBack])).linkNext = tokens.length - 1;\n\n } else if (type === \"COMMA\") {\n token.linkBack = commas.pop() as number;\n (>(tokens[token.linkBack])).linkNext = tokens.length - 1;\n commas.push(tokens.length - 1);\n\n } else if (type === \"OPEN_BRACKET\") {\n token.type = \"BRACKET\";\n\n } else if (type === \"CLOSE_BRACKET\") {\n // Remove the CLOSE_BRACKET\n let suffix = (tokens.pop() as Token).text;\n if (tokens.length > 0 && tokens[tokens.length - 1].type === \"NUMBER\") {\n const value = (tokens.pop() as Token).text;\n suffix = value + suffix;\n (>(tokens[tokens.length - 1])).value = getNumber(value);\n }\n if (tokens.length === 0 || tokens[tokens.length - 1].type !== \"BRACKET\") {\n throw new Error(\"missing opening bracket\");\n }\n (>(tokens[tokens.length - 1])).text += suffix;\n }\n\n continue;\n }\n\n match = cur.match(regexIdPrefix);\n if (match) {\n token.text = match[1];\n offset += token.text.length;\n\n if (Keywords.has(token.text)) {\n token.type = \"KEYWORD\";\n continue;\n }\n\n if (token.text.match(regexType)) {\n token.type = \"TYPE\";\n continue;\n }\n\n token.type = \"ID\";\n continue;\n }\n\n match = cur.match(regexNumberPrefix);\n if (match) {\n token.text = match[1];\n token.type = \"NUMBER\";\n offset += token.text.length;\n continue;\n }\n\n throw new Error(`unexpected token ${ JSON.stringify(cur[0]) } at position ${ offset }`);\n }\n\n return new TokenString(tokens.map((t) => Object.freeze(t)));\n}\n\n// Check only one of `allowed` is in `set`\nfunction allowSingle(set: ReadonlySet, allowed: ReadonlySet): void {\n let included: Array = [ ];\n for (const key in allowed.keys()) {\n if (set.has(key)) { included.push(key); }\n }\n if (included.length > 1) { throw new Error(`conflicting types: ${ included.join(\", \") }`); }\n}\n\n// Functions to process a Solidity Signature TokenString from left-to-right for...\n\n// ...the name with an optional type, returning the name\nfunction consumeName(type: string, tokens: TokenString): string {\n if (tokens.peekKeyword(KwTypes)) {\n const keyword = tokens.pop().text;\n if (keyword !== type) {\n throw new Error(`expected ${ type }, got ${ keyword }`);\n }\n }\n\n return tokens.popType(\"ID\");\n}\n\n// ...all keywords matching allowed, returning the keywords\nfunction consumeKeywords(tokens: TokenString, allowed?: ReadonlySet): ReadonlySet {\n const keywords: Set = new Set();\n while (true) {\n const keyword = tokens.peekType(\"KEYWORD\");\n\n if (keyword == null || (allowed && !allowed.has(keyword))) { break; }\n tokens.pop();\n\n if (keywords.has(keyword)) { throw new Error(`duplicate keywords: ${ JSON.stringify(keyword) }`); }\n keywords.add(keyword);\n }\n\n return Object.freeze(keywords);\n}\n\n// ...all visibility keywords, returning the coalesced mutability\nfunction consumeMutability(tokens: TokenString): \"payable\" | \"nonpayable\" | \"view\" | \"pure\" {\n let modifiers = consumeKeywords(tokens, KwVisib);\n\n // Detect conflicting modifiers\n allowSingle(modifiers, setify(\"constant payable nonpayable\".split(\" \")));\n allowSingle(modifiers, setify(\"pure view payable nonpayable\".split(\" \")));\n\n // Process mutability states\n if (modifiers.has(\"view\")) { return \"view\"; }\n if (modifiers.has(\"pure\")) { return \"pure\"; }\n if (modifiers.has(\"payable\")) { return \"payable\"; }\n if (modifiers.has(\"nonpayable\")) { return \"nonpayable\"; }\n\n // Process legacy `constant` last\n if (modifiers.has(\"constant\")) { return \"view\"; }\n\n return \"nonpayable\";\n}\n\n// ...a parameter list, returning the ParamType list\nfunction consumeParams(tokens: TokenString, allowIndexed?: boolean): Array {\n return tokens.popParams().map((t) => ParamType.from(t, allowIndexed));\n}\n\n// ...a gas limit, returning a BigNumber or null if none\nfunction consumeGas(tokens: TokenString): null | bigint {\n if (tokens.peekType(\"AT\")) {\n tokens.pop();\n if (tokens.peekType(\"NUMBER\")) {\n return getBigInt(tokens.pop().text);\n }\n throw new Error(\"invalid gas\");\n }\n return null;\n}\n\nfunction consumeEoi(tokens: TokenString): void {\n if (tokens.length) {\n throw new Error(`unexpected tokens at offset ${ tokens.offset }: ${ tokens.toString() }`);\n }\n}\n\nconst regexArrayType = new RegExp(/^(.*)\\[([0-9]*)\\]$/);\n\nfunction verifyBasicType(type: string): string {\n const match = type.match(regexType);\n assertArgument(match, \"invalid type\", \"type\", type);\n if (type === \"uint\") { return \"uint256\"; }\n if (type === \"int\") { return \"int256\"; }\n\n if (match[2]) {\n // bytesXX\n const length = parseInt(match[2]);\n assertArgument(length !== 0 && length <= 32, \"invalid bytes length\", \"type\", type);\n\n } else if (match[3]) {\n // intXX or uintXX\n const size = parseInt(match[3] as string);\n assertArgument(size !== 0 && size <= 256 && (size % 8) === 0, \"invalid numeric width\", \"type\", type);\n }\n\n return type;\n}\n\n// Make the Fragment constructors effectively private\nconst _guard = { };\n\n\n/**\n * When [walking](ParamType-walk) a [[ParamType]], this is called\n * on each component.\n */\nexport type ParamTypeWalkFunc = (type: string, value: any) => any;\n\n/**\n * When [walking asynchronously](ParamType-walkAsync) a [[ParamType]],\n * this is called on each component.\n */\nexport type ParamTypeWalkAsyncFunc = (type: string, value: any) => any | Promise;\n\nconst internal = Symbol.for(\"_ethers_internal\");\n\nconst ParamTypeInternal = \"_ParamTypeInternal\";\nconst ErrorFragmentInternal = \"_ErrorInternal\";\nconst EventFragmentInternal = \"_EventInternal\";\nconst ConstructorFragmentInternal = \"_ConstructorInternal\";\nconst FallbackFragmentInternal = \"_FallbackInternal\";\nconst FunctionFragmentInternal = \"_FunctionInternal\";\nconst StructFragmentInternal = \"_StructInternal\";\n\n/**\n * Each input and output of a [[Fragment]] is an Array of **ParamType**.\n */\nexport class ParamType {\n\n /**\n * The local name of the parameter (or ``\"\"`` if unbound)\n */\n readonly name!: string;\n\n /**\n * The fully qualified type (e.g. ``\"address\"``, ``\"tuple(address)\"``,\n * ``\"uint256[3][]\"``)\n */\n readonly type!: string;\n\n /**\n * The base type (e.g. ``\"address\"``, ``\"tuple\"``, ``\"array\"``)\n */\n readonly baseType!: string;\n\n /**\n * True if the parameters is indexed.\n *\n * For non-indexable types this is ``null``.\n */\n readonly indexed!: null | boolean;\n\n /**\n * The components for the tuple.\n *\n * For non-tuple types this is ``null``.\n */\n readonly components!: null | ReadonlyArray;\n\n /**\n * The array length, or ``-1`` for dynamic-lengthed arrays.\n *\n * For non-array types this is ``null``.\n */\n readonly arrayLength!: null | number;\n\n /**\n * The type of each child in the array.\n *\n * For non-array types this is ``null``.\n */\n readonly arrayChildren!: null | ParamType;\n\n\n /**\n * @private\n */\n constructor(guard: any, name: string, type: string, baseType: string, indexed: null | boolean, components: null | ReadonlyArray, arrayLength: null | number, arrayChildren: null | ParamType) {\n assertPrivate(guard, _guard, \"ParamType\");\n Object.defineProperty(this, internal, { value: ParamTypeInternal });\n\n if (components) { components = Object.freeze(components.slice()); }\n\n if (baseType === \"array\") {\n if (arrayLength == null || arrayChildren == null) {\n throw new Error(\"\");\n }\n } else if (arrayLength != null || arrayChildren != null) {\n throw new Error(\"\");\n }\n\n if (baseType === \"tuple\") {\n if (components == null) { throw new Error(\"\"); }\n } else if (components != null) {\n throw new Error(\"\");\n }\n\n defineProperties(this, {\n name, type, baseType, indexed, components, arrayLength, arrayChildren\n });\n }\n\n /**\n * Return a string representation of this type.\n *\n * For example,\n *\n * ``sighash\" => \"(uint256,address)\"``\n *\n * ``\"minimal\" => \"tuple(uint256,address) indexed\"``\n *\n * ``\"full\" => \"tuple(uint256 foo, address bar) indexed baz\"``\n */\n format(format?: FormatType): string {\n if (format == null) { format = \"sighash\"; }\n if (format === \"json\") {\n const name = this.name || \"\";\n\n if (this.isArray()) {\n const result = JSON.parse(this.arrayChildren.format(\"json\"));\n result.name = name;\n result.type += `[${ (this.arrayLength < 0 ? \"\": String(this.arrayLength)) }]`;\n return JSON.stringify(result);\n }\n\n const result: any = {\n type: ((this.baseType === \"tuple\") ? \"tuple\": this.type),\n name\n };\n\n\n if (typeof(this.indexed) === \"boolean\") { result.indexed = this.indexed; }\n if (this.isTuple()) {\n result.components = this.components.map((c) => JSON.parse(c.format(format)));\n }\n return JSON.stringify(result);\n }\n\n let result = \"\";\n\n // Array\n if (this.isArray()) {\n result += this.arrayChildren.format(format);\n result += `[${ (this.arrayLength < 0 ? \"\": String(this.arrayLength)) }]`;\n } else {\n if (this.isTuple()) {\n result += \"(\" + this.components.map(\n (comp) => comp.format(format)\n ).join((format === \"full\") ? \", \": \",\") + \")\";\n } else {\n result += this.type;\n }\n }\n\n if (format !== \"sighash\") {\n if (this.indexed === true) { result += \" indexed\"; }\n if (format === \"full\" && this.name) {\n result += \" \" + this.name;\n }\n }\n\n return result;\n }\n\n /**\n * Returns true if %%this%% is an Array type.\n *\n * This provides a type gaurd ensuring that [[arrayChildren]]\n * and [[arrayLength]] are non-null.\n */\n isArray(): this is (ParamType & { arrayChildren: ParamType, arrayLength: number }) {\n return (this.baseType === \"array\")\n }\n\n /**\n * Returns true if %%this%% is a Tuple type.\n *\n * This provides a type gaurd ensuring that [[components]]\n * is non-null.\n */\n isTuple(): this is (ParamType & { components: ReadonlyArray }) {\n return (this.baseType === \"tuple\");\n }\n\n /**\n * Returns true if %%this%% is an Indexable type.\n *\n * This provides a type gaurd ensuring that [[indexed]]\n * is non-null.\n */\n isIndexable(): this is (ParamType & { indexed: boolean }) {\n return (this.indexed != null);\n }\n\n /**\n * Walks the **ParamType** with %%value%%, calling %%process%%\n * on each type, destructing the %%value%% recursively.\n */\n walk(value: any, process: ParamTypeWalkFunc): any {\n if (this.isArray()) {\n if (!Array.isArray(value)) { throw new Error(\"invalid array value\"); }\n if (this.arrayLength !== -1 && value.length !== this.arrayLength) {\n throw new Error(\"array is wrong length\");\n }\n const _this = this;\n return value.map((v) => (_this.arrayChildren.walk(v, process)));\n }\n\n if (this.isTuple()) {\n if (!Array.isArray(value)) { throw new Error(\"invalid tuple value\"); }\n if (value.length !== this.components.length) {\n throw new Error(\"array is wrong length\");\n }\n const _this = this;\n return value.map((v, i) => (_this.components[i].walk(v, process)));\n }\n\n return process(this.type, value);\n }\n\n #walkAsync(promises: Array>, value: any, process: ParamTypeWalkAsyncFunc, setValue: (value: any) => void): void {\n\n if (this.isArray()) {\n if (!Array.isArray(value)) { throw new Error(\"invalid array value\"); }\n if (this.arrayLength !== -1 && value.length !== this.arrayLength) {\n throw new Error(\"array is wrong length\");\n }\n const childType = this.arrayChildren;\n\n const result = value.slice();\n result.forEach((value, index) => {\n childType.#walkAsync(promises, value, process, (value: any) => {\n result[index] = value;\n });\n });\n setValue(result);\n return;\n }\n\n if (this.isTuple()) {\n const components = this.components;\n\n // Convert the object into an array\n let result: Array;\n if (Array.isArray(value)) {\n result = value.slice();\n\n } else {\n if (value == null || typeof(value) !== \"object\") {\n throw new Error(\"invalid tuple value\");\n }\n\n result = components.map((param) => {\n if (!param.name) { throw new Error(\"cannot use object value with unnamed components\"); }\n if (!(param.name in value)) {\n throw new Error(`missing value for component ${ param.name }`);\n }\n return value[param.name];\n });\n }\n\n if (result.length !== this.components.length) {\n throw new Error(\"array is wrong length\");\n }\n\n result.forEach((value, index) => {\n components[index].#walkAsync(promises, value, process, (value: any) => {\n result[index] = value;\n });\n });\n setValue(result);\n return;\n }\n\n const result = process(this.type, value);\n if (result.then) {\n promises.push((async function() { setValue(await result); })());\n } else {\n setValue(result);\n }\n }\n\n /**\n * Walks the **ParamType** with %%value%%, asynchronously calling\n * %%process%% on each type, destructing the %%value%% recursively.\n *\n * This can be used to resolve ENS naes by walking and resolving each\n * ``\"address\"`` type.\n */\n async walkAsync(value: any, process: ParamTypeWalkAsyncFunc): Promise {\n const promises: Array> = [ ];\n const result: [ any ] = [ value ];\n this.#walkAsync(promises, value, process, (value: any) => {\n result[0] = value;\n });\n if (promises.length) { await Promise.all(promises); }\n return result[0];\n }\n\n /**\n * Creates a new **ParamType** for %%obj%%.\n *\n * If %%allowIndexed%% then the ``indexed`` keyword is permitted,\n * otherwise the ``indexed`` keyword will throw an error.\n */\n static from(obj: any, allowIndexed?: boolean): ParamType {\n if (ParamType.isParamType(obj)) { return obj; }\n\n if (typeof(obj) === \"string\") {\n try {\n return ParamType.from(lex(obj), allowIndexed);\n } catch (error) {\n assertArgument(false, \"invalid param type\", \"obj\", obj);\n }\n\n } else if (obj instanceof TokenString) {\n let type = \"\", baseType = \"\";\n let comps: null | Array = null;\n\n if (consumeKeywords(obj, setify([ \"tuple\" ])).has(\"tuple\") || obj.peekType(\"OPEN_PAREN\")) {\n // Tuple\n baseType = \"tuple\";\n comps = obj.popParams().map((t) => ParamType.from(t));\n type = `tuple(${ comps.map((c) => c.format()).join(\",\") })`;\n } else {\n // Normal\n type = verifyBasicType(obj.popType(\"TYPE\"));\n baseType = type;\n }\n\n // Check for Array\n let arrayChildren: null | ParamType = null;\n let arrayLength: null | number = null;\n\n while (obj.length && obj.peekType(\"BRACKET\")) {\n const bracket = obj.pop(); //arrays[i];\n arrayChildren = new ParamType(_guard, \"\", type, baseType, null, comps, arrayLength, arrayChildren);\n arrayLength = bracket.value;\n type += bracket.text;\n baseType = \"array\";\n comps = null;\n }\n\n let indexed: null | boolean = null;\n const keywords = consumeKeywords(obj, KwModifiers);\n if (keywords.has(\"indexed\")) {\n if (!allowIndexed) { throw new Error(\"\"); }\n indexed = true;\n }\n\n const name = (obj.peekType(\"ID\") ? obj.pop().text: \"\");\n\n if (obj.length) { throw new Error(\"leftover tokens\"); }\n\n return new ParamType(_guard, name, type, baseType, indexed, comps, arrayLength, arrayChildren);\n }\n\n const name = obj.name;\n assertArgument(!name || (typeof(name) === \"string\" && name.match(regexId)),\n \"invalid name\", \"obj.name\", name);\n\n let indexed = obj.indexed;\n if (indexed != null) {\n assertArgument(allowIndexed, \"parameter cannot be indexed\", \"obj.indexed\", obj.indexed);\n indexed = !!indexed;\n }\n\n let type = obj.type;\n\n let arrayMatch = type.match(regexArrayType);\n if (arrayMatch) {\n const arrayLength = parseInt(arrayMatch[2] || \"-1\");\n const arrayChildren = ParamType.from({\n type: arrayMatch[1],\n components: obj.components\n });\n\n return new ParamType(_guard, name || \"\", type, \"array\", indexed, null, arrayLength, arrayChildren);\n }\n\n if (type === \"tuple\" || type.startsWith(\"tuple(\"/* fix: ) */) || type.startsWith(\"(\" /* fix: ) */)) {\n const comps = (obj.components != null) ? obj.components.map((c: any) => ParamType.from(c)): null;\n const tuple = new ParamType(_guard, name || \"\", type, \"tuple\", indexed, comps, null, null);\n // @TODO: use lexer to validate and normalize type\n return tuple;\n }\n\n type = verifyBasicType(obj.type);\n\n return new ParamType(_guard, name || \"\", type, type, indexed, null, null, null);\n }\n\n /**\n * Returns true if %%value%% is a **ParamType**.\n */\n static isParamType(value: any): value is ParamType {\n return (value && value[internal] === ParamTypeInternal);\n }\n}\n\n/**\n * The type of a [[Fragment]].\n */\nexport type FragmentType = \"constructor\" | \"error\" | \"event\" | \"fallback\" | \"function\" | \"struct\";\n\n/**\n * An abstract class to represent An individual fragment from a parse ABI.\n */\nexport abstract class Fragment {\n /**\n * The type of the fragment.\n */\n readonly type!: FragmentType;\n\n /**\n * The inputs for the fragment.\n */\n readonly inputs!: ReadonlyArray;\n\n /**\n * @private\n */\n constructor(guard: any, type: FragmentType, inputs: ReadonlyArray) {\n assertPrivate(guard, _guard, \"Fragment\");\n inputs = Object.freeze(inputs.slice());\n defineProperties(this, { type, inputs });\n }\n\n /**\n * Returns a string representation of this fragment as %%format%%.\n */\n abstract format(format?: FormatType): string;\n\n /**\n * Creates a new **Fragment** for %%obj%%, wich can be any supported\n * ABI frgament type.\n */\n static from(obj: any): Fragment {\n if (typeof(obj) === \"string\") {\n\n // Try parsing JSON...\n try {\n Fragment.from(JSON.parse(obj));\n } catch (e) { }\n\n // ...otherwise, use the human-readable lexer\n return Fragment.from(lex(obj));\n }\n\n if (obj instanceof TokenString) {\n // Human-readable ABI (already lexed)\n\n const type = obj.peekKeyword(KwTypes);\n\n switch (type) {\n case \"constructor\": return ConstructorFragment.from(obj);\n case \"error\": return ErrorFragment.from(obj);\n case \"event\": return EventFragment.from(obj);\n case \"fallback\": case \"receive\":\n return FallbackFragment.from(obj);\n case \"function\": return FunctionFragment.from(obj);\n case \"struct\": return StructFragment.from(obj);\n }\n\n } else if (typeof(obj) === \"object\") {\n // JSON ABI\n\n switch (obj.type) {\n case \"constructor\": return ConstructorFragment.from(obj);\n case \"error\": return ErrorFragment.from(obj);\n case \"event\": return EventFragment.from(obj);\n case \"fallback\": case \"receive\":\n return FallbackFragment.from(obj);\n case \"function\": return FunctionFragment.from(obj);\n case \"struct\": return StructFragment.from(obj);\n }\n\n assert(false, `unsupported type: ${ obj.type }`, \"UNSUPPORTED_OPERATION\", {\n operation: \"Fragment.from\"\n });\n }\n\n assertArgument(false, \"unsupported frgament object\", \"obj\", obj);\n }\n\n /**\n * Returns true if %%value%% is a [[ConstructorFragment]].\n */\n static isConstructor(value: any): value is ConstructorFragment {\n return ConstructorFragment.isFragment(value);\n }\n\n /**\n * Returns true if %%value%% is an [[ErrorFragment]].\n */\n static isError(value: any): value is ErrorFragment {\n return ErrorFragment.isFragment(value);\n }\n\n /**\n * Returns true if %%value%% is an [[EventFragment]].\n */\n static isEvent(value: any): value is EventFragment {\n return EventFragment.isFragment(value);\n }\n\n /**\n * Returns true if %%value%% is a [[FunctionFragment]].\n */\n static isFunction(value: any): value is FunctionFragment {\n return FunctionFragment.isFragment(value);\n }\n\n /**\n * Returns true if %%value%% is a [[StructFragment]].\n */\n static isStruct(value: any): value is StructFragment {\n return StructFragment.isFragment(value);\n }\n}\n\n/**\n * An abstract class to represent An individual fragment\n * which has a name from a parse ABI.\n */\nexport abstract class NamedFragment extends Fragment {\n /**\n * The name of the fragment.\n */\n readonly name!: string;\n\n /**\n * @private\n */\n constructor(guard: any, type: FragmentType, name: string, inputs: ReadonlyArray) {\n super(guard, type, inputs);\n assertArgument(typeof(name) === \"string\" && name.match(regexId),\n \"invalid identifier\", \"name\", name);\n inputs = Object.freeze(inputs.slice());\n defineProperties(this, { name });\n }\n}\n\nfunction joinParams(format: FormatType, params: ReadonlyArray): string { \n return \"(\" + params.map((p) => p.format(format)).join((format === \"full\") ? \", \": \",\") + \")\";\n}\n\n/**\n * A Fragment which represents a //Custom Error//.\n */\nexport class ErrorFragment extends NamedFragment {\n /**\n * @private\n */\n constructor(guard: any, name: string, inputs: ReadonlyArray) {\n super(guard, \"error\", name, inputs);\n Object.defineProperty(this, internal, { value: ErrorFragmentInternal });\n }\n\n /**\n * The Custom Error selector.\n */\n get selector(): string {\n return id(this.format(\"sighash\")).substring(0, 10);\n }\n\n /**\n * Returns a string representation of this fragment as %%format%%.\n */\n format(format?: FormatType): string {\n if (format == null) { format = \"sighash\"; }\n if (format === \"json\") {\n return JSON.stringify({\n type: \"error\",\n name: this.name,\n inputs: this.inputs.map((input) => JSON.parse(input.format(format))),\n });\n }\n\n const result: Array = [ ];\n if (format !== \"sighash\") { result.push(\"error\"); }\n result.push(this.name + joinParams(format, this.inputs));\n return result.join(\" \");\n }\n\n /**\n * Returns a new **ErrorFragment** for %%obj%%.\n */\n static from(obj: any): ErrorFragment {\n if (ErrorFragment.isFragment(obj)) { return obj; }\n\n if (typeof(obj) === \"string\") {\n return ErrorFragment.from(lex(obj));\n\n } else if (obj instanceof TokenString) {\n const name = consumeName(\"error\", obj);\n const inputs = consumeParams(obj);\n consumeEoi(obj);\n\n return new ErrorFragment(_guard, name, inputs);\n }\n\n return new ErrorFragment(_guard, obj.name,\n obj.inputs ? obj.inputs.map(ParamType.from): [ ]);\n }\n\n /**\n * Returns ``true`` and provides a type guard if %%value%% is an\n * **ErrorFragment**.\n */\n static isFragment(value: any): value is ErrorFragment {\n return (value && value[internal] === ErrorFragmentInternal);\n }\n}\n\n/**\n * A Fragment which represents an Event.\n */\nexport class EventFragment extends NamedFragment {\n /**\n * Whether this event is anonymous.\n */\n readonly anonymous!: boolean;\n\n /**\n * @private\n */\n constructor(guard: any, name: string, inputs: ReadonlyArray, anonymous: boolean) {\n super(guard, \"event\", name, inputs);\n Object.defineProperty(this, internal, { value: EventFragmentInternal });\n defineProperties(this, { anonymous });\n }\n\n /**\n * The Event topic hash.\n */\n get topicHash(): string {\n return id(this.format(\"sighash\"));\n }\n\n /**\n * Returns a string representation of this event as %%format%%.\n */\n format(format?: FormatType): string {\n if (format == null) { format = \"sighash\"; }\n if (format === \"json\") {\n return JSON.stringify({\n type: \"event\",\n anonymous: this.anonymous,\n name: this.name,\n inputs: this.inputs.map((i) => JSON.parse(i.format(format)))\n });\n }\n\n const result: Array = [ ];\n if (format !== \"sighash\") { result.push(\"event\"); }\n result.push(this.name + joinParams(format, this.inputs));\n if (format !== \"sighash\" && this.anonymous) { result.push(\"anonymous\"); }\n return result.join(\" \");\n }\n\n /**\n * Return the topic hash for an event with %%name%% and %%params%%.\n */\n static getTopicHash(name: string, params?: Array): string {\n params = (params || []).map((p) => ParamType.from(p));\n const fragment = new EventFragment(_guard, name, params, false);\n return fragment.topicHash;\n }\n\n /**\n * Returns a new **EventFragment** for %%obj%%.\n */\n static from(obj: any): EventFragment {\n if (EventFragment.isFragment(obj)) { return obj; }\n\n if (typeof(obj) === \"string\") {\n try {\n return EventFragment.from(lex(obj));\n } catch (error) {\n assertArgument(false, \"invalid event fragment\", \"obj\", obj);\n }\n\n } else if (obj instanceof TokenString) {\n const name = consumeName(\"event\", obj);\n const inputs = consumeParams(obj, true);\n const anonymous = !!consumeKeywords(obj, setify([ \"anonymous\" ])).has(\"anonymous\");\n consumeEoi(obj);\n\n return new EventFragment(_guard, name, inputs, anonymous);\n }\n\n return new EventFragment(_guard, obj.name,\n obj.inputs ? obj.inputs.map((p: any) => ParamType.from(p, true)): [ ], !!obj.anonymous);\n }\n\n /**\n * Returns ``true`` and provides a type guard if %%value%% is an\n * **EventFragment**.\n */\n static isFragment(value: any): value is EventFragment {\n return (value && value[internal] === EventFragmentInternal);\n }\n}\n\n/**\n * A Fragment which represents a constructor.\n */\nexport class ConstructorFragment extends Fragment {\n\n /**\n * Whether the constructor can receive an endowment.\n */\n readonly payable!: boolean;\n\n /**\n * The recommended gas limit for deployment or ``null``.\n */\n readonly gas!: null | bigint;\n\n /**\n * @private\n */\n constructor(guard: any, type: FragmentType, inputs: ReadonlyArray, payable: boolean, gas: null | bigint) {\n super(guard, type, inputs);\n Object.defineProperty(this, internal, { value: ConstructorFragmentInternal });\n defineProperties(this, { payable, gas });\n }\n\n /**\n * Returns a string representation of this constructor as %%format%%.\n */\n format(format?: FormatType): string {\n assert(format != null && format !== \"sighash\", \"cannot format a constructor for sighash\",\n \"UNSUPPORTED_OPERATION\", { operation: \"format(sighash)\" });\n\n if (format === \"json\") {\n return JSON.stringify({\n type: \"constructor\",\n stateMutability: (this.payable ? \"payable\": \"undefined\"),\n payable: this.payable,\n gas: ((this.gas != null) ? this.gas: undefined),\n inputs: this.inputs.map((i) => JSON.parse(i.format(format)))\n });\n }\n\n const result = [ `constructor${ joinParams(format, this.inputs) }` ];\n if (this.payable) { result.push(\"payable\"); }\n if (this.gas != null) { result.push(`@${ this.gas.toString() }`); }\n return result.join(\" \");\n }\n\n /**\n * Returns a new **ConstructorFragment** for %%obj%%.\n */\n static from(obj: any): ConstructorFragment {\n if (ConstructorFragment.isFragment(obj)) { return obj; }\n\n if (typeof(obj) === \"string\") {\n try {\n return ConstructorFragment.from(lex(obj));\n } catch (error) {\n assertArgument(false, \"invalid constuctor fragment\", \"obj\", obj);\n }\n\n } else if (obj instanceof TokenString) {\n consumeKeywords(obj, setify([ \"constructor\" ]));\n const inputs = consumeParams(obj);\n const payable = !!consumeKeywords(obj, KwVisibDeploy).has(\"payable\");\n const gas = consumeGas(obj);\n consumeEoi(obj);\n\n return new ConstructorFragment(_guard, \"constructor\", inputs, payable, gas);\n }\n\n return new ConstructorFragment(_guard, \"constructor\",\n obj.inputs ? obj.inputs.map(ParamType.from): [ ],\n !!obj.payable, (obj.gas != null) ? obj.gas: null);\n }\n\n /**\n * Returns ``true`` and provides a type guard if %%value%% is a\n * **ConstructorFragment**.\n */\n static isFragment(value: any): value is ConstructorFragment {\n return (value && value[internal] === ConstructorFragmentInternal);\n }\n}\n\n/**\n * A Fragment which represents a method.\n */\nexport class FallbackFragment extends Fragment {\n\n /**\n * If the function can be sent value during invocation.\n */\n readonly payable!: boolean;\n\n constructor(guard: any, inputs: ReadonlyArray, payable: boolean) {\n super(guard, \"fallback\", inputs);\n Object.defineProperty(this, internal, { value: FallbackFragmentInternal });\n defineProperties(this, { payable });\n }\n\n /**\n * Returns a string representation of this fallback as %%format%%.\n */\n format(format?: FormatType): string {\n const type = ((this.inputs.length === 0) ? \"receive\": \"fallback\");\n\n if (format === \"json\") {\n const stateMutability = (this.payable ? \"payable\": \"nonpayable\");\n return JSON.stringify({ type, stateMutability });\n }\n\n return `${ type }()${ this.payable ? \" payable\": \"\" }`;\n }\n\n /**\n * Returns a new **FallbackFragment** for %%obj%%.\n */\n static from(obj: any): FallbackFragment {\n if (FallbackFragment.isFragment(obj)) { return obj; }\n\n if (typeof(obj) === \"string\") {\n try {\n return FallbackFragment.from(lex(obj));\n } catch (error) {\n assertArgument(false, \"invalid fallback fragment\", \"obj\", obj);\n }\n\n } else if (obj instanceof TokenString) {\n const errorObj = obj.toString();\n\n const topIsValid = obj.peekKeyword(setify([ \"fallback\", \"receive\" ]));\n assertArgument(topIsValid, \"type must be fallback or receive\", \"obj\", errorObj);\n\n const type = obj.popKeyword(setify([ \"fallback\", \"receive\" ]));\n\n // receive()\n if (type === \"receive\") {\n const inputs = consumeParams(obj);\n assertArgument(inputs.length === 0, `receive cannot have arguments`, \"obj.inputs\", inputs);\n consumeKeywords(obj, setify([ \"payable\" ]));\n consumeEoi(obj);\n return new FallbackFragment(_guard, [ ], true);\n }\n\n // fallback() [payable]\n // fallback(bytes) [payable] returns (bytes)\n let inputs = consumeParams(obj);\n if (inputs.length) {\n assertArgument(inputs.length === 1 && inputs[0].type === \"bytes\",\n \"invalid fallback inputs\", \"obj.inputs\",\n inputs.map((i) => i.format(\"minimal\")).join(\", \"));\n } else {\n inputs = [ ParamType.from(\"bytes\") ];\n }\n\n const mutability = consumeMutability(obj);\n assertArgument(mutability === \"nonpayable\" || mutability === \"payable\", \"fallback cannot be constants\", \"obj.stateMutability\", mutability);\n\n if (consumeKeywords(obj, setify([ \"returns\" ])).has(\"returns\")) {\n const outputs = consumeParams(obj);\n assertArgument(outputs.length === 1 && outputs[0].type === \"bytes\",\n \"invalid fallback outputs\", \"obj.outputs\",\n outputs.map((i) => i.format(\"minimal\")).join(\", \"));\n }\n\n consumeEoi(obj);\n\n return new FallbackFragment(_guard, inputs, mutability === \"payable\");\n }\n\n if (obj.type === \"receive\") {\n return new FallbackFragment(_guard, [ ], true);\n }\n\n if (obj.type === \"fallback\") {\n const inputs = [ ParamType.from(\"bytes\") ];\n const payable = (obj.stateMutability === \"payable\");\n return new FallbackFragment(_guard, inputs, payable);\n }\n\n assertArgument(false, \"invalid fallback description\", \"obj\", obj);\n }\n\n /**\n * Returns ``true`` and provides a type guard if %%value%% is a\n * **FallbackFragment**.\n */\n static isFragment(value: any): value is FallbackFragment {\n return (value && value[internal] === FallbackFragmentInternal);\n }\n}\n\n\n/**\n * A Fragment which represents a method.\n */\nexport class FunctionFragment extends NamedFragment {\n /**\n * If the function is constant (e.g. ``pure`` or ``view`` functions).\n */\n readonly constant!: boolean;\n\n /**\n * The returned types for the result of calling this function.\n */\n readonly outputs!: ReadonlyArray;\n\n /**\n * The state mutability (e.g. ``payable``, ``nonpayable``, ``view``\n * or ``pure``)\n */\n readonly stateMutability!: \"payable\" | \"nonpayable\" | \"view\" | \"pure\";\n\n /**\n * If the function can be sent value during invocation.\n */\n readonly payable!: boolean;\n\n /**\n * The recommended gas limit to send when calling this function.\n */\n readonly gas!: null | bigint;\n\n /**\n * @private\n */\n constructor(guard: any, name: string, stateMutability: \"payable\" | \"nonpayable\" | \"view\" | \"pure\", inputs: ReadonlyArray, outputs: ReadonlyArray, gas: null | bigint) {\n super(guard, \"function\", name, inputs);\n Object.defineProperty(this, internal, { value: FunctionFragmentInternal });\n outputs = Object.freeze(outputs.slice());\n const constant = (stateMutability === \"view\" || stateMutability === \"pure\");\n const payable = (stateMutability === \"payable\");\n defineProperties(this, { constant, gas, outputs, payable, stateMutability });\n }\n\n /**\n * The Function selector.\n */\n get selector(): string {\n return id(this.format(\"sighash\")).substring(0, 10);\n }\n\n /**\n * Returns a string representation of this function as %%format%%.\n */\n format(format?: FormatType): string {\n if (format == null) { format = \"sighash\"; }\n if (format === \"json\") {\n return JSON.stringify({\n type: \"function\",\n name: this.name,\n constant: this.constant,\n stateMutability: ((this.stateMutability !== \"nonpayable\") ? this.stateMutability: undefined),\n payable: this.payable,\n gas: ((this.gas != null) ? this.gas: undefined),\n inputs: this.inputs.map((i) => JSON.parse(i.format(format))),\n outputs: this.outputs.map((o) => JSON.parse(o.format(format))),\n });\n }\n\n const result: Array = [];\n\n if (format !== \"sighash\") { result.push(\"function\"); }\n\n result.push(this.name + joinParams(format, this.inputs));\n\n if (format !== \"sighash\") {\n if (this.stateMutability !== \"nonpayable\") {\n result.push(this.stateMutability);\n }\n\n if (this.outputs && this.outputs.length) {\n result.push(\"returns\");\n result.push(joinParams(format, this.outputs));\n }\n\n if (this.gas != null) { result.push(`@${ this.gas.toString() }`); }\n }\n return result.join(\" \");\n }\n\n /**\n * Return the selector for a function with %%name%% and %%params%%.\n */\n static getSelector(name: string, params?: Array): string {\n params = (params || []).map((p) => ParamType.from(p));\n const fragment = new FunctionFragment(_guard, name, \"view\", params, [ ], null);\n return fragment.selector;\n }\n\n /**\n * Returns a new **FunctionFragment** for %%obj%%.\n */\n static from(obj: any): FunctionFragment {\n if (FunctionFragment.isFragment(obj)) { return obj; }\n\n if (typeof(obj) === \"string\") {\n try {\n return FunctionFragment.from(lex(obj));\n } catch (error) {\n assertArgument(false, \"invalid function fragment\", \"obj\", obj);\n }\n\n } else if (obj instanceof TokenString) {\n const name = consumeName(\"function\", obj);\n const inputs = consumeParams(obj);\n const mutability = consumeMutability(obj);\n\n let outputs: Array = [ ];\n if (consumeKeywords(obj, setify([ \"returns\" ])).has(\"returns\")) {\n outputs = consumeParams(obj);\n }\n\n const gas = consumeGas(obj);\n\n consumeEoi(obj);\n\n return new FunctionFragment(_guard, name, mutability, inputs, outputs, gas);\n }\n\n let stateMutability = obj.stateMutability;\n\n // Use legacy Solidity ABI logic if stateMutability is missing\n if (stateMutability == null) {\n stateMutability = \"payable\";\n\n if (typeof(obj.constant) === \"boolean\") {\n stateMutability = \"view\";\n if (!obj.constant) {\n stateMutability = \"payable\"\n if (typeof(obj.payable) === \"boolean\" && !obj.payable) {\n stateMutability = \"nonpayable\";\n }\n }\n } else if (typeof(obj.payable) === \"boolean\" && !obj.payable) {\n stateMutability = \"nonpayable\";\n }\n }\n\n // @TODO: verifyState for stateMutability (e.g. throw if\n // payable: false but stateMutability is \"nonpayable\")\n\n return new FunctionFragment(_guard, obj.name, stateMutability,\n obj.inputs ? obj.inputs.map(ParamType.from): [ ],\n obj.outputs ? obj.outputs.map(ParamType.from): [ ],\n (obj.gas != null) ? obj.gas: null);\n }\n\n /**\n * Returns ``true`` and provides a type guard if %%value%% is a\n * **FunctionFragment**.\n */\n static isFragment(value: any): value is FunctionFragment {\n return (value && value[internal] === FunctionFragmentInternal);\n }\n}\n\n/**\n * A Fragment which represents a structure.\n */\nexport class StructFragment extends NamedFragment {\n\n /**\n * @private\n */\n constructor(guard: any, name: string, inputs: ReadonlyArray) {\n super(guard, \"struct\", name, inputs);\n Object.defineProperty(this, internal, { value: StructFragmentInternal });\n }\n\n /**\n * Returns a string representation of this struct as %%format%%.\n */\n format(): string {\n throw new Error(\"@TODO\");\n }\n\n /**\n * Returns a new **StructFragment** for %%obj%%.\n */\n static from(obj: any): StructFragment {\n if (typeof(obj) === \"string\") {\n try {\n return StructFragment.from(lex(obj));\n } catch (error) {\n assertArgument(false, \"invalid struct fragment\", \"obj\", obj);\n }\n\n } else if (obj instanceof TokenString) {\n const name = consumeName(\"struct\", obj);\n const inputs = consumeParams(obj);\n consumeEoi(obj);\n return new StructFragment(_guard, name, inputs);\n }\n\n return new StructFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from): [ ]);\n }\n\n// @TODO: fix this return type\n /**\n * Returns ``true`` and provides a type guard if %%value%% is a\n * **StructFragment**.\n */\n static isFragment(value: any): value is FunctionFragment {\n return (value && value[internal] === StructFragmentInternal);\n }\n}\n\n", "/**\n * When sending values to or receiving values from a [[Contract]], the\n * data is generally encoded using the [ABI standard](link-solc-abi).\n *\n * The AbiCoder provides a utility to encode values to ABI data and\n * decode values from ABI data.\n *\n * Most of the time, developers should favour the [[Contract]] class,\n * which further abstracts a lot of the finer details of ABI data.\n *\n * @_section api/abi/abi-coder:ABI Encoding\n */\n\n// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI\n\nimport { assertArgumentCount, assertArgument } from \"../utils/index.js\";\n\nimport { Coder, Reader, Result, Writer } from \"./coders/abstract-coder.js\";\nimport { AddressCoder } from \"./coders/address.js\";\nimport { ArrayCoder } from \"./coders/array.js\";\nimport { BooleanCoder } from \"./coders/boolean.js\";\nimport { BytesCoder } from \"./coders/bytes.js\";\nimport { FixedBytesCoder } from \"./coders/fixed-bytes.js\";\nimport { NullCoder } from \"./coders/null.js\";\nimport { NumberCoder } from \"./coders/number.js\";\nimport { StringCoder } from \"./coders/string.js\";\nimport { TupleCoder } from \"./coders/tuple.js\";\nimport { ParamType } from \"./fragments.js\";\n\nimport { getAddress } from \"../address/index.js\";\nimport { getBytes, hexlify, makeError } from \"../utils/index.js\";\n\nimport type {\n BytesLike,\n CallExceptionAction, CallExceptionError, CallExceptionTransaction\n} from \"../utils/index.js\";\n\n// https://docs.soliditylang.org/en/v0.8.17/control-structures.html\nconst PanicReasons: Map = new Map();\nPanicReasons.set(0x00, \"GENERIC_PANIC\");\nPanicReasons.set(0x01, \"ASSERT_FALSE\");\nPanicReasons.set(0x11, \"OVERFLOW\");\nPanicReasons.set(0x12, \"DIVIDE_BY_ZERO\");\nPanicReasons.set(0x21, \"ENUM_RANGE_ERROR\");\nPanicReasons.set(0x22, \"BAD_STORAGE_DATA\");\nPanicReasons.set(0x31, \"STACK_UNDERFLOW\");\nPanicReasons.set(0x32, \"ARRAY_RANGE_ERROR\");\nPanicReasons.set(0x41, \"OUT_OF_MEMORY\");\nPanicReasons.set(0x51, \"UNINITIALIZED_FUNCTION_CALL\");\n\nconst paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);\nconst paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);\n\n\nlet defaultCoder: null | AbiCoder = null;\nlet defaultMaxInflation = 1024;\n\nfunction getBuiltinCallException(action: CallExceptionAction, tx: { to?: null | string, from?: null | string, data?: string }, data: null | BytesLike, abiCoder: AbiCoder): CallExceptionError {\n let message = \"missing revert data\";\n\n let reason: null | string = null;\n const invocation = null;\n let revert: null | { signature: string, name: string, args: Array } = null;\n\n if (data) {\n message = \"execution reverted\";\n\n const bytes = getBytes(data);\n data = hexlify(data);\n\n if (bytes.length === 0) {\n message += \" (no data present; likely require(false) occurred\";\n reason = \"require(false)\";\n\n } else if (bytes.length % 32 !== 4) {\n message += \" (could not decode reason; invalid data length)\";\n\n } else if (hexlify(bytes.slice(0, 4)) === \"0x08c379a0\") {\n // Error(string)\n try {\n reason = abiCoder.decode([ \"string\" ], bytes.slice(4))[0]\n revert = {\n signature: \"Error(string)\",\n name: \"Error\",\n args: [ reason ]\n };\n message += `: ${ JSON.stringify(reason) }`;\n\n } catch (error) {\n message += \" (could not decode reason; invalid string data)\";\n }\n\n } else if (hexlify(bytes.slice(0, 4)) === \"0x4e487b71\") {\n // Panic(uint256)\n try {\n const code = Number(abiCoder.decode([ \"uint256\" ], bytes.slice(4))[0]);\n revert = {\n signature: \"Panic(uint256)\",\n name: \"Panic\",\n args: [ code ]\n };\n reason = `Panic due to ${ PanicReasons.get(code) || \"UNKNOWN\" }(${ code })`;\n message += `: ${ reason }`;\n } catch (error) {\n message += \" (could not decode panic code)\";\n }\n } else {\n message += \" (unknown custom error)\";\n }\n }\n\n const transaction: CallExceptionTransaction = {\n to: (tx.to ? getAddress(tx.to): null),\n data: (tx.data || \"0x\")\n };\n if (tx.from) { transaction.from = getAddress(tx.from); }\n\n return makeError(message, \"CALL_EXCEPTION\", {\n action, data, reason, transaction, invocation, revert\n });\n}\n\n/**\n * The **AbiCoder** is a low-level class responsible for encoding JavaScript\n * values into binary data and decoding binary data into JavaScript values.\n */\nexport class AbiCoder {\n\n #getCoder(param: ParamType): Coder {\n if (param.isArray()) {\n return new ArrayCoder(this.#getCoder(param.arrayChildren), param.arrayLength, param.name);\n }\n\n if (param.isTuple()) {\n return new TupleCoder(param.components.map((c) => this.#getCoder(c)), param.name);\n }\n\n switch (param.baseType) {\n case \"address\":\n return new AddressCoder(param.name);\n case \"bool\":\n return new BooleanCoder(param.name);\n case \"string\":\n return new StringCoder(param.name);\n case \"bytes\":\n return new BytesCoder(param.name);\n case \"\":\n return new NullCoder(param.name);\n }\n\n // u?int[0-9]*\n let match = param.type.match(paramTypeNumber);\n if (match) {\n let size = parseInt(match[2] || \"256\");\n assertArgument(size !== 0 && size <= 256 && (size % 8) === 0,\n \"invalid \" + match[1] + \" bit length\", \"param\", param);\n return new NumberCoder(size / 8, (match[1] === \"int\"), param.name);\n }\n\n // bytes[0-9]+\n match = param.type.match(paramTypeBytes);\n if (match) {\n let size = parseInt(match[1]);\n assertArgument(size !== 0 && size <= 32, \"invalid bytes length\", \"param\", param);\n return new FixedBytesCoder(size, param.name);\n }\n\n assertArgument(false, \"invalid type\", \"type\", param.type);\n }\n\n /**\n * Get the default values for the given %%types%%.\n *\n * For example, a ``uint`` is by default ``0`` and ``bool``\n * is by default ``false``.\n */\n getDefaultValue(types: ReadonlyArray): Result {\n const coders: Array = types.map((type) => this.#getCoder(ParamType.from(type)));\n const coder = new TupleCoder(coders, \"_\");\n return coder.defaultValue();\n }\n\n /**\n * Encode the %%values%% as the %%types%% into ABI data.\n *\n * @returns DataHexstring\n */\n encode(types: ReadonlyArray, values: ReadonlyArray): string {\n assertArgumentCount(values.length, types.length, \"types/values length mismatch\");\n\n const coders = types.map((type) => this.#getCoder(ParamType.from(type)));\n const coder = (new TupleCoder(coders, \"_\"));\n\n const writer = new Writer();\n coder.encode(writer, values);\n return writer.data;\n }\n\n /**\n * Decode the ABI %%data%% as the %%types%% into values.\n *\n * If %%loose%% decoding is enabled, then strict padding is\n * not enforced. Some older versions of Solidity incorrectly\n * padded event data emitted from ``external`` functions.\n */\n decode(types: ReadonlyArray, data: BytesLike, loose?: boolean): Result {\n const coders: Array = types.map((type) => this.#getCoder(ParamType.from(type)));\n const coder = new TupleCoder(coders, \"_\");\n return coder.decode(new Reader(data, loose, defaultMaxInflation));\n }\n\n static _setDefaultMaxInflation(value: number): void {\n assertArgument(typeof(value) === \"number\" && Number.isInteger(value), \"invalid defaultMaxInflation factor\", \"value\", value);\n defaultMaxInflation = value;\n }\n\n /**\n * Returns the shared singleton instance of a default [[AbiCoder]].\n *\n * On the first call, the instance is created internally.\n */\n static defaultAbiCoder(): AbiCoder {\n if (defaultCoder == null) {\n defaultCoder = new AbiCoder();\n }\n return defaultCoder;\n }\n\n /**\n * Returns an ethers-compatible [[CallExceptionError]] Error for the given\n * result %%data%% for the [[CallExceptionAction]] %%action%% against\n * the Transaction %%tx%%.\n */\n static getBuiltinCallException(action: CallExceptionAction, tx: { to?: null | string, from?: null | string, data?: string }, data: null | BytesLike): CallExceptionError {\n return getBuiltinCallException(action, tx, data, AbiCoder.defaultAbiCoder());\n }\n}\n", "/**\n * About bytes32 strings...\n *\n * @_docloc: api/utils:Bytes32 Strings\n */\n\nimport {\n getBytes, toUtf8Bytes, toUtf8String, zeroPadBytes\n} from \"../utils/index.js\";\n\nimport type { BytesLike } from \"../utils/index.js\";\n\n/**\n * Encodes %%text%% as a Bytes32 string.\n */\nexport function encodeBytes32String(text: string): string {\n\n // Get the bytes\n const bytes = toUtf8Bytes(text);\n\n // Check we have room for null-termination\n if (bytes.length > 31) { throw new Error(\"bytes32 string must be less than 32 bytes\"); }\n\n // Zero-pad (implicitly null-terminates)\n return zeroPadBytes(bytes, 32);\n}\n\n/**\n * Encodes the Bytes32-encoded %%bytes%% into a string.\n */\nexport function decodeBytes32String(_bytes: BytesLike): string {\n const data = getBytes(_bytes, \"bytes\");\n\n // Must be 32 bytes with a null-termination\n if (data.length !== 32) { throw new Error(\"invalid bytes32 - not 32 bytes long\"); }\n if (data[31] !== 0) { throw new Error(\"invalid bytes32 string - no null terminator\"); }\n\n // Find the null termination\n let length = 31;\n while (data[length - 1] === 0) { length--; }\n\n // Determine the string value\n return toUtf8String(data.slice(0, length));\n}\n\n", "/**\n * The Interface class is a low-level class that accepts an\n * ABI and provides all the necessary functionality to encode\n * and decode paramaters to and results from methods, events\n * and errors.\n *\n * It also provides several convenience methods to automatically\n * search and find matching transactions and events to parse them.\n *\n * @_subsection api/abi:Interfaces [interfaces]\n */\n\nimport { keccak256 } from \"../crypto/index.js\"\nimport { id } from \"../hash/index.js\"\nimport {\n concat, dataSlice, getBigInt, getBytes, getBytesCopy,\n hexlify, zeroPadBytes, zeroPadValue, isHexString, defineProperties,\n assertArgument, toBeHex, assert\n} from \"../utils/index.js\";\n\nimport { AbiCoder } from \"./abi-coder.js\";\nimport { checkResultErrors, Result } from \"./coders/abstract-coder.js\";\nimport {\n ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment,\n Fragment, FunctionFragment, ParamType\n} from \"./fragments.js\";\nimport { Typed } from \"./typed.js\";\n\nimport type { BigNumberish, BytesLike, CallExceptionError, CallExceptionTransaction } from \"../utils/index.js\";\n\nimport type { JsonFragment } from \"./fragments.js\";\n\n\nexport { checkResultErrors, Result };\n\n/**\n * When using the [[Interface-parseLog]] to automatically match a Log to its event\n * for parsing, a **LogDescription** is returned.\n */\nexport class LogDescription {\n /**\n * The matching fragment for the ``topic0``.\n */\n readonly fragment!: EventFragment;\n\n /**\n * The name of the Event.\n */\n readonly name!: string;\n\n /**\n * The full Event signature.\n */\n readonly signature!: string;\n\n /**\n * The topic hash for the Event.\n */\n readonly topic!: string;\n\n /**\n * The arguments passed into the Event with ``emit``.\n */\n readonly args!: Result\n\n /**\n * @_ignore:\n */\n constructor(fragment: EventFragment, topic: string, args: Result) {\n const name = fragment.name, signature = fragment.format();\n defineProperties(this, {\n fragment, name, signature, topic, args\n });\n }\n}\n\n/**\n * When using the [[Interface-parseTransaction]] to automatically match\n * a transaction data to its function for parsing,\n * a **TransactionDescription** is returned.\n */\nexport class TransactionDescription {\n /**\n * The matching fragment from the transaction ``data``.\n */\n readonly fragment!: FunctionFragment;\n\n /**\n * The name of the Function from the transaction ``data``.\n */\n readonly name!: string;\n\n /**\n * The arguments passed to the Function from the transaction ``data``.\n */\n readonly args!: Result;\n\n /**\n * The full Function signature from the transaction ``data``.\n */\n readonly signature!: string;\n\n /**\n * The selector for the Function from the transaction ``data``.\n */\n readonly selector!: string;\n\n /**\n * The ``value`` (in wei) from the transaction.\n */\n readonly value!: bigint;\n\n /**\n * @_ignore:\n */\n constructor(fragment: FunctionFragment, selector: string, args: Result, value: bigint) {\n const name = fragment.name, signature = fragment.format();\n defineProperties(this, {\n fragment, name, args, signature, selector, value\n });\n }\n}\n\n/**\n * When using the [[Interface-parseError]] to automatically match an\n * error for a call result for parsing, an **ErrorDescription** is returned.\n */\nexport class ErrorDescription {\n /**\n * The matching fragment.\n */\n readonly fragment!: ErrorFragment;\n\n /**\n * The name of the Error.\n */\n readonly name!: string;\n\n /**\n * The arguments passed to the Error with ``revert``.\n */\n readonly args!: Result;\n\n /**\n * The full Error signature.\n */\n readonly signature!: string;\n\n /**\n * The selector for the Error.\n */\n readonly selector!: string;\n\n /**\n * @_ignore:\n */\n constructor(fragment: ErrorFragment, selector: string, args: Result) {\n const name = fragment.name, signature = fragment.format();\n defineProperties(this, {\n fragment, name, args, signature, selector\n });\n }\n}\n\n/**\n * An **Indexed** is used as a value when a value that does not\n * fit within a topic (i.e. not a fixed-length, 32-byte type). It\n * is the ``keccak256`` of the value, and used for types such as\n * arrays, tuples, bytes and strings.\n */\nexport class Indexed {\n /**\n * The ``keccak256`` of the value logged.\n */\n readonly hash!: null | string;\n\n /**\n * @_ignore:\n */\n readonly _isIndexed!: boolean;\n\n /**\n * Returns ``true`` if %%value%% is an **Indexed**.\n *\n * This provides a Type Guard for property access.\n */\n static isIndexed(value: any): value is Indexed {\n return !!(value && value._isIndexed);\n }\n\n /**\n * @_ignore:\n */\n constructor(hash: null | string) {\n defineProperties(this, { hash, _isIndexed: true })\n }\n}\n\ntype ErrorInfo = {\n signature: string,\n inputs: Array,\n name: string,\n reason: (...args: Array) => string;\n};\n\n// https://docs.soliditylang.org/en/v0.8.13/control-structures.html?highlight=panic#panic-via-assert-and-error-via-require\nconst PanicReasons: Record = {\n \"0\": \"generic panic\",\n \"1\": \"assert(false)\",\n \"17\": \"arithmetic overflow\",\n \"18\": \"division or modulo by zero\",\n \"33\": \"enum overflow\",\n \"34\": \"invalid encoded storage byte array accessed\",\n \"49\": \"out-of-bounds array access; popping on an empty array\",\n \"50\": \"out-of-bounds access of an array or bytesN\",\n \"65\": \"out of memory\",\n \"81\": \"uninitialized function\",\n}\n\nconst BuiltinErrors: Record = {\n \"0x08c379a0\": {\n signature: \"Error(string)\",\n name: \"Error\",\n inputs: [ \"string\" ],\n reason: (message: string) => {\n return `reverted with reason string ${ JSON.stringify(message) }`;\n }\n },\n \"0x4e487b71\": {\n signature: \"Panic(uint256)\",\n name: \"Panic\",\n inputs: [ \"uint256\" ],\n reason: (code: bigint) => {\n let reason = \"unknown panic code\";\n if (code >= 0 && code <= 0xff && PanicReasons[code.toString()]) {\n reason = PanicReasons[code.toString()];\n }\n return `reverted with panic code 0x${ code.toString(16) } (${ reason })`;\n }\n }\n}\n\n/*\nfunction wrapAccessError(property: string, error: Error): Error {\n const wrap = new Error(`deferred error during ABI decoding triggered accessing ${ property }`);\n (wrap).error = error;\n return wrap;\n}\n*/\n/*\nfunction checkNames(fragment: Fragment, type: \"input\" | \"output\", params: Array): void {\n params.reduce((accum, param) => {\n if (param.name) {\n if (accum[param.name]) {\n logger.throwArgumentError(`duplicate ${ type } parameter ${ JSON.stringify(param.name) } in ${ fragment.format(\"full\") }`, \"fragment\", fragment);\n }\n accum[param.name] = true;\n }\n return accum;\n }, <{ [ name: string ]: boolean }>{ });\n}\n*/\n\n/**\n * An **InterfaceAbi** may be any supported ABI format.\n *\n * A string is expected to be a JSON string, which will be parsed\n * using ``JSON.parse``. This means that the value **must** be a valid\n * JSON string, with no stray commas, etc.\n *\n * An array may contain any combination of:\n * - Human-Readable fragments\n * - Parsed JSON fragment\n * - [[Fragment]] instances\n *\n * A **Human-Readable Fragment** is a string which resembles a Solidity\n * signature and is introduced in [this blog entry](link-ricmoo-humanreadableabi).\n * For example, ``function balanceOf(address) view returns (uint)``.\n *\n * A **Parsed JSON Fragment** is a JavaScript Object desribed in the\n * [Solidity documentation](link-solc-jsonabi).\n */\nexport type InterfaceAbi = string | ReadonlyArray;\n\n/**\n * An Interface abstracts many of the low-level details for\n * encoding and decoding the data on the blockchain.\n *\n * An ABI provides information on how to encode data to send to\n * a Contract, how to decode the results and events and how to\n * interpret revert errors.\n *\n * The ABI can be specified by [any supported format](InterfaceAbi).\n */\nexport class Interface {\n\n /**\n * All the Contract ABI members (i.e. methods, events, errors, etc).\n */\n readonly fragments!: ReadonlyArray;\n\n /**\n * The Contract constructor.\n */\n readonly deploy!: ConstructorFragment;\n\n /**\n * The Fallback method, if any.\n */\n readonly fallback!: null | FallbackFragment;\n\n /**\n * If receiving ether is supported.\n */\n readonly receive!: boolean;\n\n #errors: Map;\n #events: Map;\n #functions: Map;\n// #structs: Map;\n\n #abiCoder: AbiCoder;\n\n /**\n * Create a new Interface for the %%fragments%%.\n */\n constructor(fragments: InterfaceAbi) {\n let abi: ReadonlyArray = [ ];\n if (typeof(fragments) === \"string\") {\n abi = JSON.parse(fragments);\n } else {\n abi = fragments;\n }\n\n this.#functions = new Map();\n this.#errors = new Map();\n this.#events = new Map();\n// this.#structs = new Map();\n\n\n const frags: Array = [ ];\n for (const a of abi) {\n try {\n frags.push(Fragment.from(a));\n } catch (error: any) {\n console.log(`[Warning] Invalid Fragment ${ JSON.stringify(a) }:`, error.message);\n }\n }\n\n defineProperties(this, {\n fragments: Object.freeze(frags)\n });\n\n let fallback: null | FallbackFragment = null;\n let receive = false;\n\n this.#abiCoder = this.getAbiCoder();\n\n // Add all fragments by their signature\n this.fragments.forEach((fragment, index) => {\n let bucket: Map;\n switch (fragment.type) {\n case \"constructor\":\n if (this.deploy) {\n console.log(\"duplicate definition - constructor\");\n return;\n }\n //checkNames(fragment, \"input\", fragment.inputs);\n defineProperties(this, { deploy: fragment });\n return;\n\n case \"fallback\":\n if (fragment.inputs.length === 0) {\n receive = true;\n } else {\n assertArgument(!fallback || (fragment).payable !== fallback.payable,\n \"conflicting fallback fragments\", `fragments[${ index }]`, fragment);\n fallback = fragment;\n receive = fallback.payable;\n }\n return;\n\n case \"function\":\n //checkNames(fragment, \"input\", fragment.inputs);\n //checkNames(fragment, \"output\", (fragment).outputs);\n bucket = this.#functions;\n break;\n\n case \"event\":\n //checkNames(fragment, \"input\", fragment.inputs);\n bucket = this.#events;\n break;\n\n case \"error\":\n bucket = this.#errors;\n break;\n\n default:\n return;\n }\n\n // Two identical entries; ignore it\n const signature = fragment.format();\n if (bucket.has(signature)) { return; }\n\n bucket.set(signature, fragment);\n });\n\n // If we do not have a constructor add a default\n if (!this.deploy) {\n defineProperties(this, {\n deploy: ConstructorFragment.from(\"constructor()\")\n });\n }\n\n defineProperties(this, { fallback, receive });\n }\n\n /**\n * Returns the entire Human-Readable ABI, as an array of\n * signatures, optionally as %%minimal%% strings, which\n * removes parameter names and unneceesary spaces.\n */\n format(minimal?: boolean): Array {\n const format = (minimal ? \"minimal\": \"full\");\n const abi = this.fragments.map((f) => f.format(format));\n return abi;\n }\n\n /**\n * Return the JSON-encoded ABI. This is the format Solidiy\n * returns.\n */\n formatJson(): string {\n const abi = this.fragments.map((f) => f.format(\"json\"));\n\n // We need to re-bundle the JSON fragments a bit\n return JSON.stringify(abi.map((j) => JSON.parse(j)));\n }\n\n /**\n * The ABI coder that will be used to encode and decode binary\n * data.\n */\n getAbiCoder(): AbiCoder {\n return AbiCoder.defaultAbiCoder();\n }\n\n // Find a function definition by any means necessary (unless it is ambiguous)\n #getFunction(key: string, values: null | Array, forceUnique: boolean): null | FunctionFragment {\n\n // Selector\n if (isHexString(key)) {\n const selector = key.toLowerCase();\n for (const fragment of this.#functions.values()) {\n if (selector === fragment.selector) { return fragment; }\n }\n return null;\n }\n\n // It is a bare name, look up the function (will return null if ambiguous)\n if (key.indexOf(\"(\") === -1) {\n const matching: Array = [ ];\n for (const [ name, fragment ] of this.#functions) {\n if (name.split(\"(\"/* fix:) */)[0] === key) { matching.push(fragment); }\n }\n\n if (values) {\n const lastValue = (values.length > 0) ? values[values.length - 1]: null;\n\n let valueLength = values.length;\n let allowOptions = true;\n if (Typed.isTyped(lastValue) && lastValue.type === \"overrides\") {\n allowOptions = false;\n valueLength--;\n }\n\n // Remove all matches that don't have a compatible length. The args\n // may contain an overrides, so the match may have n or n - 1 parameters\n for (let i = matching.length - 1; i >= 0; i--) {\n const inputs = matching[i].inputs.length;\n if (inputs !== valueLength && (!allowOptions || inputs !== valueLength - 1)) {\n matching.splice(i, 1);\n }\n }\n\n // Remove all matches that don't match the Typed signature\n for (let i = matching.length - 1; i >= 0; i--) {\n const inputs = matching[i].inputs;\n for (let j = 0; j < values.length; j++) {\n // Not a typed value\n if (!Typed.isTyped(values[j])) { continue; }\n\n // We are past the inputs\n if (j >= inputs.length) {\n if (values[j].type === \"overrides\") { continue; }\n matching.splice(i, 1);\n break;\n }\n\n // Make sure the value type matches the input type\n if (values[j].type !== inputs[j].baseType) {\n matching.splice(i, 1);\n break;\n }\n }\n }\n }\n\n // We found a single matching signature with an overrides, but the\n // last value is something that cannot possibly be an options\n if (matching.length === 1 && values && values.length !== matching[0].inputs.length) {\n const lastArg = values[values.length - 1];\n if (lastArg == null || Array.isArray(lastArg) || typeof(lastArg) !== \"object\") {\n matching.splice(0, 1);\n }\n }\n\n if (matching.length === 0) { return null; }\n\n if (matching.length > 1 && forceUnique) {\n const matchStr = matching.map((m) => JSON.stringify(m.format())).join(\", \");\n assertArgument(false, `ambiguous function description (i.e. matches ${ matchStr })`, \"key\", key);\n }\n\n return matching[0];\n }\n\n // Normalize the signature and lookup the function\n const result = this.#functions.get(FunctionFragment.from(key).format());\n if (result) { return result; }\n\n return null;\n }\n\n /**\n * Get the function name for %%key%%, which may be a function selector,\n * function name or function signature that belongs to the ABI.\n */\n getFunctionName(key: string): string {\n const fragment = this.#getFunction(key, null, false);\n assertArgument(fragment, \"no matching function\", \"key\", key);\n return fragment.name;\n }\n\n /**\n * Returns true if %%key%% (a function selector, function name or\n * function signature) is present in the ABI.\n *\n * In the case of a function name, the name may be ambiguous, so\n * accessing the [[FunctionFragment]] may require refinement.\n */\n hasFunction(key: string): boolean {\n return !!this.#getFunction(key, null, false);\n }\n\n /**\n * Get the [[FunctionFragment]] for %%key%%, which may be a function\n * selector, function name or function signature that belongs to the ABI.\n *\n * If %%values%% is provided, it will use the Typed API to handle\n * ambiguous cases where multiple functions match by name.\n *\n * If the %%key%% and %%values%% do not refine to a single function in\n * the ABI, this will throw.\n */\n getFunction(key: string, values?: Array): null | FunctionFragment {\n return this.#getFunction(key, values || null, true);\n }\n\n /**\n * Iterate over all functions, calling %%callback%%, sorted by their name.\n */\n forEachFunction(callback: (func: FunctionFragment, index: number) => void): void {\n const names = Array.from(this.#functions.keys());\n names.sort((a, b) => a.localeCompare(b));\n for (let i = 0; i < names.length; i++) {\n const name = names[i];\n callback((this.#functions.get(name)), i);\n }\n }\n\n\n // Find an event definition by any means necessary (unless it is ambiguous)\n #getEvent(key: string, values: null | Array, forceUnique: boolean): null | EventFragment {\n\n // EventTopic\n if (isHexString(key)) {\n const eventTopic = key.toLowerCase();\n for (const fragment of this.#events.values()) {\n if (eventTopic === fragment.topicHash) { return fragment; }\n }\n return null;\n }\n\n // It is a bare name, look up the function (will return null if ambiguous)\n if (key.indexOf(\"(\") === -1) {\n const matching: Array = [ ];\n for (const [ name, fragment ] of this.#events) {\n if (name.split(\"(\"/* fix:) */)[0] === key) { matching.push(fragment); }\n }\n\n if (values) {\n // Remove all matches that don't have a compatible length.\n for (let i = matching.length - 1; i >= 0; i--) {\n if (matching[i].inputs.length < values.length) {\n matching.splice(i, 1);\n }\n }\n\n // Remove all matches that don't match the Typed signature\n for (let i = matching.length - 1; i >= 0; i--) {\n const inputs = matching[i].inputs;\n for (let j = 0; j < values.length; j++) {\n // Not a typed value\n if (!Typed.isTyped(values[j])) { continue; }\n\n // Make sure the value type matches the input type\n if (values[j].type !== inputs[j].baseType) {\n matching.splice(i, 1);\n break;\n }\n }\n }\n }\n\n if (matching.length === 0) { return null; }\n\n if (matching.length > 1 && forceUnique) {\n const matchStr = matching.map((m) => JSON.stringify(m.format())).join(\", \");\n assertArgument(false, `ambiguous event description (i.e. matches ${ matchStr })`, \"key\", key);\n }\n\n return matching[0];\n }\n\n // Normalize the signature and lookup the function\n const result = this.#events.get(EventFragment.from(key).format());\n if (result) { return result; }\n\n return null;\n }\n\n /**\n * Get the event name for %%key%%, which may be a topic hash,\n * event name or event signature that belongs to the ABI.\n */\n getEventName(key: string): string {\n const fragment = this.#getEvent(key, null, false);\n assertArgument(fragment, \"no matching event\", \"key\", key);\n\n return fragment.name;\n }\n\n /**\n * Returns true if %%key%% (an event topic hash, event name or\n * event signature) is present in the ABI.\n *\n * In the case of an event name, the name may be ambiguous, so\n * accessing the [[EventFragment]] may require refinement.\n */\n hasEvent(key: string): boolean {\n return !!this.#getEvent(key, null, false);\n }\n\n /**\n * Get the [[EventFragment]] for %%key%%, which may be a topic hash,\n * event name or event signature that belongs to the ABI.\n *\n * If %%values%% is provided, it will use the Typed API to handle\n * ambiguous cases where multiple events match by name.\n *\n * If the %%key%% and %%values%% do not refine to a single event in\n * the ABI, this will throw.\n */\n getEvent(key: string, values?: Array): null | EventFragment {\n return this.#getEvent(key, values || null, true)\n }\n\n /**\n * Iterate over all events, calling %%callback%%, sorted by their name.\n */\n forEachEvent(callback: (func: EventFragment, index: number) => void): void {\n const names = Array.from(this.#events.keys());\n names.sort((a, b) => a.localeCompare(b));\n for (let i = 0; i < names.length; i++) {\n const name = names[i];\n callback((this.#events.get(name)), i);\n }\n }\n\n /**\n * Get the [[ErrorFragment]] for %%key%%, which may be an error\n * selector, error name or error signature that belongs to the ABI.\n *\n * If %%values%% is provided, it will use the Typed API to handle\n * ambiguous cases where multiple errors match by name.\n *\n * If the %%key%% and %%values%% do not refine to a single error in\n * the ABI, this will throw.\n */\n getError(key: string, values?: Array): null | ErrorFragment {\n if (isHexString(key)) {\n const selector = key.toLowerCase();\n\n if (BuiltinErrors[selector]) {\n return ErrorFragment.from(BuiltinErrors[selector].signature);\n }\n\n for (const fragment of this.#errors.values()) {\n if (selector === fragment.selector) { return fragment; }\n }\n\n return null;\n }\n\n // It is a bare name, look up the function (will return null if ambiguous)\n if (key.indexOf(\"(\") === -1) {\n const matching: Array = [ ];\n for (const [ name, fragment ] of this.#errors) {\n if (name.split(\"(\"/* fix:) */)[0] === key) { matching.push(fragment); }\n }\n\n if (matching.length === 0) {\n if (key === \"Error\") { return ErrorFragment.from(\"error Error(string)\"); }\n if (key === \"Panic\") { return ErrorFragment.from(\"error Panic(uint256)\"); }\n return null;\n } else if (matching.length > 1) {\n const matchStr = matching.map((m) => JSON.stringify(m.format())).join(\", \");\n assertArgument(false, `ambiguous error description (i.e. ${ matchStr })`, \"name\", key);\n }\n\n return matching[0];\n }\n\n // Normalize the signature and lookup the function\n key = ErrorFragment.from(key).format()\n if (key === \"Error(string)\") { return ErrorFragment.from(\"error Error(string)\"); }\n if (key === \"Panic(uint256)\") { return ErrorFragment.from(\"error Panic(uint256)\"); }\n\n const result = this.#errors.get(key);\n if (result) { return result; }\n\n return null;\n }\n\n /**\n * Iterate over all errors, calling %%callback%%, sorted by their name.\n */\n forEachError(callback: (func: ErrorFragment, index: number) => void): void {\n const names = Array.from(this.#errors.keys());\n names.sort((a, b) => a.localeCompare(b));\n for (let i = 0; i < names.length; i++) {\n const name = names[i];\n callback((this.#errors.get(name)), i);\n }\n }\n\n // Get the 4-byte selector used by Solidity to identify a function\n /*\n getSelector(fragment: ErrorFragment | FunctionFragment): string {\n if (typeof(fragment) === \"string\") {\n const matches: Array = [ ];\n\n try { matches.push(this.getFunction(fragment)); } catch (error) { }\n try { matches.push(this.getError(fragment)); } catch (_) { }\n\n if (matches.length === 0) {\n logger.throwArgumentError(\"unknown fragment\", \"key\", fragment);\n } else if (matches.length > 1) {\n logger.throwArgumentError(\"ambiguous fragment matches function and error\", \"key\", fragment);\n }\n\n fragment = matches[0];\n }\n\n return dataSlice(id(fragment.format()), 0, 4);\n }\n */\n\n // Get the 32-byte topic hash used by Solidity to identify an event\n /*\n getEventTopic(fragment: EventFragment): string {\n //if (typeof(fragment) === \"string\") { fragment = this.getEvent(eventFragment); }\n return id(fragment.format());\n }\n */\n\n\n _decodeParams(params: ReadonlyArray, data: BytesLike): Result {\n return this.#abiCoder.decode(params, data)\n }\n\n _encodeParams(params: ReadonlyArray, values: ReadonlyArray): string {\n return this.#abiCoder.encode(params, values)\n }\n\n /**\n * Encodes a ``tx.data`` object for deploying the Contract with\n * the %%values%% as the constructor arguments.\n */\n encodeDeploy(values?: ReadonlyArray): string {\n return this._encodeParams(this.deploy.inputs, values || [ ]);\n }\n\n /**\n * Decodes the result %%data%% (e.g. from an ``eth_call``) for the\n * specified error (see [[getError]] for valid values for\n * %%key%%).\n *\n * Most developers should prefer the [[parseCallResult]] method instead,\n * which will automatically detect a ``CALL_EXCEPTION`` and throw the\n * corresponding error.\n */\n decodeErrorResult(fragment: ErrorFragment | string, data: BytesLike): Result {\n if (typeof(fragment) === \"string\") {\n const f = this.getError(fragment);\n assertArgument(f, \"unknown error\", \"fragment\", fragment);\n fragment = f;\n }\n\n assertArgument(dataSlice(data, 0, 4) === fragment.selector,\n `data signature does not match error ${ fragment.name }.`, \"data\", data);\n\n return this._decodeParams(fragment.inputs, dataSlice(data, 4));\n }\n\n /**\n * Encodes the transaction revert data for a call result that\n * reverted from the the Contract with the sepcified %%error%%\n * (see [[getError]] for valid values for %%fragment%%) with the %%values%%.\n *\n * This is generally not used by most developers, unless trying to mock\n * a result from a Contract.\n */\n encodeErrorResult(fragment: ErrorFragment | string, values?: ReadonlyArray): string {\n if (typeof(fragment) === \"string\") {\n const f = this.getError(fragment);\n assertArgument(f, \"unknown error\", \"fragment\", fragment);\n fragment = f;\n }\n\n return concat([\n fragment.selector,\n this._encodeParams(fragment.inputs, values || [ ])\n ]);\n }\n\n /**\n * Decodes the %%data%% from a transaction ``tx.data`` for\n * the function specified (see [[getFunction]] for valid values\n * for %%fragment%%).\n *\n * Most developers should prefer the [[parseTransaction]] method\n * instead, which will automatically detect the fragment.\n */\n decodeFunctionData(fragment: FunctionFragment | string, data: BytesLike): Result {\n if (typeof(fragment) === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n\n assertArgument(dataSlice(data, 0, 4) === fragment.selector,\n `data signature does not match function ${ fragment.name }.`, \"data\", data);\n\n return this._decodeParams(fragment.inputs, dataSlice(data, 4));\n }\n\n /**\n * Encodes the ``tx.data`` for a transaction that calls the function\n * specified (see [[getFunction]] for valid values for %%fragment%%) with\n * the %%values%%.\n */\n encodeFunctionData(fragment: FunctionFragment | string, values?: ReadonlyArray): string {\n if (typeof(fragment) === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n\n return concat([\n fragment.selector,\n this._encodeParams(fragment.inputs, values || [ ])\n ]);\n }\n\n /**\n * Decodes the result %%data%% (e.g. from an ``eth_call``) for the\n * specified function (see [[getFunction]] for valid values for\n * %%key%%).\n *\n * Most developers should prefer the [[parseCallResult]] method instead,\n * which will automatically detect a ``CALL_EXCEPTION`` and throw the\n * corresponding error.\n */\n decodeFunctionResult(fragment: FunctionFragment | string, data: BytesLike): Result {\n if (typeof(fragment) === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n\n let message = \"invalid length for result data\";\n\n const bytes = getBytesCopy(data);\n if ((bytes.length % 32) === 0) {\n try {\n return this.#abiCoder.decode(fragment.outputs, bytes);\n } catch (error) {\n message = \"could not decode result data\";\n }\n }\n\n // Call returned data with no error, but the data is junk\n assert(false, message, \"BAD_DATA\", {\n value: hexlify(bytes),\n info: { method: fragment.name, signature: fragment.format() }\n });\n }\n\n makeError(_data: BytesLike, tx: CallExceptionTransaction): CallExceptionError {\n const data = getBytes(_data, \"data\");\n\n const error = AbiCoder.getBuiltinCallException(\"call\", tx, data);\n\n // Not a built-in error; try finding a custom error\n const customPrefix = \"execution reverted (unknown custom error)\";\n if (error.message.startsWith(customPrefix)) {\n const selector = hexlify(data.slice(0, 4));\n\n const ef = this.getError(selector);\n if (ef) {\n try {\n const args = this.#abiCoder.decode(ef.inputs, data.slice(4));\n error.revert = {\n name: ef.name, signature: ef.format(), args\n };\n error.reason = error.revert.signature;\n error.message = `execution reverted: ${ error.reason }`\n } catch (e) {\n error.message = `execution reverted (coult not decode custom error)`\n }\n }\n }\n\n // Add the invocation, if available\n const parsed = this.parseTransaction(tx);\n if (parsed) {\n error.invocation = {\n method: parsed.name,\n signature: parsed.signature,\n args: parsed.args\n };\n }\n\n return error;\n }\n\n /**\n * Encodes the result data (e.g. from an ``eth_call``) for the\n * specified function (see [[getFunction]] for valid values\n * for %%fragment%%) with %%values%%.\n *\n * This is generally not used by most developers, unless trying to mock\n * a result from a Contract.\n */\n encodeFunctionResult(fragment: FunctionFragment | string, values?: ReadonlyArray): string {\n if (typeof(fragment) === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n return hexlify(this.#abiCoder.encode(fragment.outputs, values || [ ]));\n }\n/*\n spelunk(inputs: Array, values: ReadonlyArray, processfunc: (type: string, value: any) => Promise): Promise> {\n const promises: Array> = [ ];\n const process = function(type: ParamType, value: any): any {\n if (type.baseType === \"array\") {\n return descend(type.child\n }\n if (type. === \"address\") {\n }\n };\n\n const descend = function (inputs: Array, values: ReadonlyArray) {\n if (inputs.length !== values.length) { throw new Error(\"length mismatch\"); }\n \n };\n\n const result: Array = [ ];\n values.forEach((value, index) => {\n if (value == null) {\n topics.push(null);\n } else if (param.baseType === \"array\" || param.baseType === \"tuple\") {\n logger.throwArgumentError(\"filtering with tuples or arrays not supported\", (\"contract.\" + param.name), value);\n } else if (Array.isArray(value)) {\n topics.push(value.map((value) => encodeTopic(param, value)));\n } else {\n topics.push(encodeTopic(param, value));\n }\n });\n }\n*/\n // Create the filter for the event with search criteria (e.g. for eth_filterLog)\n encodeFilterTopics(fragment: EventFragment | string, values: ReadonlyArray): Array> {\n if (typeof(fragment) === \"string\") {\n const f = this.getEvent(fragment);\n assertArgument(f, \"unknown event\", \"eventFragment\", fragment);\n fragment = f;\n }\n\n assert(values.length <= fragment.inputs.length, `too many arguments for ${ fragment.format() }`,\n \"UNEXPECTED_ARGUMENT\", { count: values.length, expectedCount: fragment.inputs.length })\n\n const topics: Array> = [];\n if (!fragment.anonymous) { topics.push(fragment.topicHash); }\n\n // @TODO: Use the coders for this; to properly support tuples, etc.\n const encodeTopic = (param: ParamType, value: any): string => {\n if (param.type === \"string\") {\n return id(value);\n } else if (param.type === \"bytes\") {\n return keccak256(hexlify(value));\n }\n\n if (param.type === \"bool\" && typeof(value) === \"boolean\") {\n value = (value ? \"0x01\": \"0x00\");\n } else if (param.type.match(/^u?int/)) {\n value = toBeHex(value); // @TODO: Should this toTwos??\n } else if (param.type.match(/^bytes/)) {\n value = zeroPadBytes(value, 32);\n } else if (param.type === \"address\") {\n // Check addresses are valid\n this.#abiCoder.encode( [ \"address\" ], [ value ]);\n }\n\n return zeroPadValue(hexlify(value), 32);\n };\n\n values.forEach((value, index) => {\n\n const param = (fragment).inputs[index];\n\n if (!param.indexed) {\n assertArgument(value == null,\n \"cannot filter non-indexed parameters; must be null\", (\"contract.\" + param.name), value);\n return;\n }\n\n if (value == null) {\n topics.push(null);\n } else if (param.baseType === \"array\" || param.baseType === \"tuple\") {\n assertArgument(false, \"filtering with tuples or arrays not supported\", (\"contract.\" + param.name), value);\n } else if (Array.isArray(value)) {\n topics.push(value.map((value) => encodeTopic(param, value)));\n } else {\n topics.push(encodeTopic(param, value));\n }\n });\n\n // Trim off trailing nulls\n while (topics.length && topics[topics.length - 1] === null) {\n topics.pop();\n }\n\n return topics;\n }\n\n encodeEventLog(fragment: EventFragment | string, values: ReadonlyArray): { data: string, topics: Array } {\n if (typeof(fragment) === \"string\") {\n const f = this.getEvent(fragment);\n assertArgument(f, \"unknown event\", \"eventFragment\", fragment);\n fragment = f;\n }\n\n const topics: Array = [ ];\n\n const dataTypes: Array = [ ];\n const dataValues: Array = [ ];\n\n if (!fragment.anonymous) {\n topics.push(fragment.topicHash);\n }\n\n assertArgument(values.length === fragment.inputs.length,\n \"event arguments/values mismatch\", \"values\", values);\n\n fragment.inputs.forEach((param, index) => {\n const value = values[index];\n if (param.indexed) {\n if (param.type === \"string\") {\n topics.push(id(value))\n } else if (param.type === \"bytes\") {\n topics.push(keccak256(value))\n } else if (param.baseType === \"tuple\" || param.baseType === \"array\") {\n // @TODO\n throw new Error(\"not implemented\");\n } else {\n topics.push(this.#abiCoder.encode([ param.type] , [ value ]));\n }\n } else {\n dataTypes.push(param);\n dataValues.push(value);\n }\n });\n\n return {\n data: this.#abiCoder.encode(dataTypes , dataValues),\n topics: topics\n };\n }\n\n // Decode a filter for the event and the search criteria\n decodeEventLog(fragment: EventFragment | string, data: BytesLike, topics?: ReadonlyArray): Result {\n if (typeof(fragment) === \"string\") {\n const f = this.getEvent(fragment);\n assertArgument(f, \"unknown event\", \"eventFragment\", fragment);\n fragment = f;\n }\n\n if (topics != null && !fragment.anonymous) {\n const eventTopic = fragment.topicHash;\n assertArgument(isHexString(topics[0], 32) && topics[0].toLowerCase() === eventTopic,\n \"fragment/topic mismatch\", \"topics[0]\", topics[0]);\n topics = topics.slice(1);\n }\n\n const indexed: Array = [];\n const nonIndexed: Array = [];\n const dynamic: Array = [];\n\n fragment.inputs.forEach((param, index) => {\n if (param.indexed) {\n if (param.type === \"string\" || param.type === \"bytes\" || param.baseType === \"tuple\" || param.baseType === \"array\") {\n indexed.push(ParamType.from({ type: \"bytes32\", name: param.name }));\n dynamic.push(true);\n } else {\n indexed.push(param);\n dynamic.push(false);\n }\n } else {\n nonIndexed.push(param);\n dynamic.push(false);\n }\n });\n\n const resultIndexed = (topics != null) ? this.#abiCoder.decode(indexed, concat(topics)): null;\n const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true);\n\n //const result: (Array & { [ key: string ]: any }) = [ ];\n const values: Array = [ ];\n const keys: Array = [ ];\n let nonIndexedIndex = 0, indexedIndex = 0;\n fragment.inputs.forEach((param, index) => {\n let value: null | Indexed | Error = null;\n if (param.indexed) {\n if (resultIndexed == null) {\n value = new Indexed(null);\n\n } else if (dynamic[index]) {\n value = new Indexed(resultIndexed[indexedIndex++]);\n\n } else {\n try {\n value = resultIndexed[indexedIndex++];\n } catch (error: any) {\n value = error;\n }\n }\n } else {\n try {\n value = resultNonIndexed[nonIndexedIndex++];\n } catch (error: any) {\n value = error;\n }\n }\n\n values.push(value);\n keys.push(param.name || null);\n });\n\n return Result.fromItems(values, keys);\n }\n\n /**\n * Parses a transaction, finding the matching function and extracts\n * the parameter values along with other useful function details.\n *\n * If the matching function cannot be found, return null.\n */\n parseTransaction(tx: { data: string, value?: BigNumberish }): null | TransactionDescription {\n const data = getBytes(tx.data, \"tx.data\");\n const value = getBigInt((tx.value != null) ? tx.value: 0, \"tx.value\");\n\n const fragment = this.getFunction(hexlify(data.slice(0, 4)));\n\n if (!fragment) { return null; }\n\n const args = this.#abiCoder.decode(fragment.inputs, data.slice(4));\n return new TransactionDescription(fragment, fragment.selector, args, value);\n }\n\n parseCallResult(data: BytesLike): Result {\n throw new Error(\"@TODO\");\n }\n\n /**\n * Parses a receipt log, finding the matching event and extracts\n * the parameter values along with other useful event details.\n *\n * If the matching event cannot be found, returns null.\n */\n parseLog(log: { topics: ReadonlyArray, data: string}): null | LogDescription {\n const fragment = this.getEvent(log.topics[0]);\n\n if (!fragment || fragment.anonymous) { return null; }\n\n // @TODO: If anonymous, and the only method, and the input count matches, should we parse?\n // Probably not, because just because it is the only event in the ABI does\n // not mean we have the full ABI; maybe just a fragment?\n\n\n return new LogDescription(fragment, fragment.topicHash, this.decodeEventLog(fragment, log.data, log.topics));\n }\n\n /**\n * Parses a revert data, finding the matching error and extracts\n * the parameter values along with other useful error details.\n *\n * If the matching error cannot be found, returns null.\n */\n parseError(data: BytesLike): null | ErrorDescription {\n const hexData = hexlify(data);\n\n const fragment = this.getError(dataSlice(hexData, 0, 4));\n\n if (!fragment) { return null; }\n\n const args = this.#abiCoder.decode(fragment.inputs, dataSlice(hexData, 4));\n return new ErrorDescription(fragment, fragment.selector, args);\n }\n\n /**\n * Creates a new [[Interface]] from the ABI %%value%%.\n *\n * The %%value%% may be provided as an existing [[Interface]] object,\n * a JSON-encoded ABI or any Human-Readable ABI format.\n */\n static from(value: InterfaceAbi | Interface): Interface {\n // Already an Interface, which is immutable\n if (value instanceof Interface) { return value; }\n\n // JSON\n if (typeof(value) === \"string\") { return new Interface(JSON.parse(value)); }\n\n // Maybe an interface from an older version, or from a symlinked copy\n if (typeof((value).format) === \"function\") {\n return new Interface((value).format(\"json\"));\n }\n\n // Array of fragments\n return new Interface(value);\n }\n}\n", "//import { resolveAddress } from \"@ethersproject/address\";\nimport {\n defineProperties, getBigInt, getNumber, hexlify, resolveProperties,\n assert, assertArgument, isError, makeError\n} from \"../utils/index.js\";\nimport { accessListify } from \"../transaction/index.js\";\n\nimport type { AddressLike, NameResolver } from \"../address/index.js\";\nimport type { BigNumberish, EventEmitterable } from \"../utils/index.js\";\nimport type { Signature } from \"../crypto/index.js\";\nimport type { AccessList, AccessListish, TransactionLike } from \"../transaction/index.js\";\n\nimport type { ContractRunner } from \"./contracts.js\";\nimport type { Network } from \"./network.js\";\n\n\nconst BN_0 = BigInt(0);\n\n/**\n * A **BlockTag** specifies a specific block.\n *\n * **numeric value** - specifies the block height, where\n * the genesis block is block 0; many operations accept a negative\n * value which indicates the block number should be deducted from\n * the most recent block. A numeric value may be a ``number``, ``bigint``,\n * or a decimal of hex string.\n *\n * **blockhash** - specifies a specific block by its blockhash; this allows\n * potentially orphaned blocks to be specifed, without ambiguity, but many\n * backends do not support this for some operations.\n */\nexport type BlockTag = BigNumberish | string;\n\nimport {\n BlockParams, LogParams, TransactionReceiptParams,\n TransactionResponseParams\n} from \"./formatting.js\";\n\n// -----------------------\n\nfunction getValue(value: undefined | null | T): null | T {\n if (value == null) { return null; }\n return value;\n}\n\nfunction toJson(value: null | bigint): null | string {\n if (value == null) { return null; }\n return value.toString();\n}\n\n// @TODO? implements Required\n\n/**\n * A **FeeData** wraps all the fee-related values associated with\n * the network.\n */\nexport class FeeData {\n /**\n * The gas price for legacy networks.\n */\n readonly gasPrice!: null | bigint;\n\n /**\n * The maximum fee to pay per gas.\n *\n * The base fee per gas is defined by the network and based on\n * congestion, increasing the cost during times of heavy load\n * and lowering when less busy.\n *\n * The actual fee per gas will be the base fee for the block\n * and the priority fee, up to the max fee per gas.\n *\n * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559))\n */\n readonly maxFeePerGas!: null | bigint;\n\n /**\n * The additional amout to pay per gas to encourage a validator\n * to include the transaction.\n *\n * The purpose of this is to compensate the validator for the\n * adjusted risk for including a given transaction.\n *\n * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559))\n */\n readonly maxPriorityFeePerGas!: null | bigint;\n\n /**\n * Creates a new FeeData for %%gasPrice%%, %%maxFeePerGas%% and\n * %%maxPriorityFeePerGas%%.\n */\n constructor(gasPrice?: null | bigint, maxFeePerGas?: null | bigint, maxPriorityFeePerGas?: null | bigint) {\n defineProperties(this, {\n gasPrice: getValue(gasPrice),\n maxFeePerGas: getValue(maxFeePerGas),\n maxPriorityFeePerGas: getValue(maxPriorityFeePerGas)\n });\n }\n\n /**\n * Returns a JSON-friendly value.\n */\n toJSON(): any {\n const {\n gasPrice, maxFeePerGas, maxPriorityFeePerGas\n } = this;\n return {\n _type: \"FeeData\",\n gasPrice: toJson(gasPrice),\n maxFeePerGas: toJson(maxFeePerGas),\n maxPriorityFeePerGas: toJson(maxPriorityFeePerGas),\n };\n }\n}\n\n\n/**\n * A **TransactionRequest** is a transactions with potentially various\n * properties not defined, or with less strict types for its values.\n *\n * This is used to pass to various operations, which will internally\n * coerce any types and populate any necessary values.\n */\nexport interface TransactionRequest {\n /**\n * The transaction type.\n */\n type?: null | number;\n\n /**\n * The target of the transaction.\n */\n to?: null | AddressLike;\n\n /**\n * The sender of the transaction.\n */\n from?: null | AddressLike;\n\n /**\n * The nonce of the transaction, used to prevent replay attacks.\n */\n nonce?: null | number;\n\n /**\n * The maximum amount of gas to allow this transaction to consume.\n */\n gasLimit?: null | BigNumberish;\n\n /**\n * The gas price to use for legacy transactions or transactions on\n * legacy networks.\n *\n * Most of the time the ``max*FeePerGas`` is preferred.\n */\n gasPrice?: null | BigNumberish;\n\n /**\n * The [[link-eip-1559]] maximum priority fee to pay per gas.\n */\n maxPriorityFeePerGas?: null | BigNumberish;\n\n /**\n * The [[link-eip-1559]] maximum total fee to pay per gas. The actual\n * value used is protocol enforced to be the block's base fee.\n */\n maxFeePerGas?: null | BigNumberish;\n\n /**\n * The transaction data.\n */\n data?: null | string;\n\n /**\n * The transaction value (in wei).\n */\n value?: null | BigNumberish;\n\n /**\n * The chain ID for the network this transaction is valid on.\n */\n chainId?: null | BigNumberish;\n\n /**\n * The [[link-eip-2930]] access list. Storage slots included in the access\n * list are //warmed// by pre-loading them, so their initial cost to\n * fetch is guaranteed, but then each additional access is cheaper.\n */\n accessList?: null | AccessListish;\n\n /**\n * A custom object, which can be passed along for network-specific\n * values.\n */\n customData?: any;\n\n // Only meaningful when used for call\n\n /**\n * When using ``call`` or ``estimateGas``, this allows a specific\n * block to be queried. Many backends do not support this and when\n * unsupported errors are silently squelched and ``\"latest\"`` is used. \n */\n blockTag?: BlockTag;\n\n /**\n * When using ``call``, this enables CCIP-read, which permits the\n * provider to be redirected to web-based content during execution,\n * which is then further validated by the contract.\n *\n * There are potential security implications allowing CCIP-read, as\n * it could be used to expose the IP address or user activity during\n * the fetch to unexpected parties.\n */\n enableCcipRead?: boolean;\n\n // Todo?\n //gasMultiplier?: number;\n};\n\n/**\n * A **PreparedTransactionRequest** is identical to a [[TransactionRequest]]\n * except all the property types are strictly enforced.\n */\nexport interface PreparedTransactionRequest {\n /**\n * The transaction type.\n */\n type?: number;\n\n\n /**\n * The target of the transaction.\n */\n to?: AddressLike;\n\n /**\n * The sender of the transaction.\n */\n from?: AddressLike;\n\n /**\n * The nonce of the transaction, used to prevent replay attacks.\n */\n\n nonce?: number;\n\n /**\n * The maximum amount of gas to allow this transaction to consime.\n */\n gasLimit?: bigint;\n\n /**\n * The gas price to use for legacy transactions or transactions on\n * legacy networks.\n *\n * Most of the time the ``max*FeePerGas`` is preferred.\n */\n gasPrice?: bigint;\n\n /**\n * The [[link-eip-1559]] maximum priority fee to pay per gas.\n */\n maxPriorityFeePerGas?: bigint;\n\n /**\n * The [[link-eip-1559]] maximum total fee to pay per gas. The actual\n * value used is protocol enforced to be the block's base fee.\n */\n maxFeePerGas?: bigint;\n\n /**\n * The transaction data.\n */\n data?: string;\n\n\n /**\n * The transaction value (in wei).\n */\n value?: bigint;\n\n /**\n * The chain ID for the network this transaction is valid on.\n */\n chainId?: bigint;\n\n /**\n * The [[link-eip-2930]] access list. Storage slots included in the access\n * list are //warmed// by pre-loading them, so their initial cost to\n * fetch is guaranteed, but then each additional access is cheaper.\n */\n accessList?: AccessList;\n\n /**\n * A custom object, which can be passed along for network-specific\n * values.\n */\n customData?: any;\n\n\n\n /**\n * When using ``call`` or ``estimateGas``, this allows a specific\n * block to be queried. Many backends do not support this and when\n * unsupported errors are silently squelched and ``\"latest\"`` is used. \n */\n blockTag?: BlockTag;\n\n /**\n * When using ``call``, this enables CCIP-read, which permits the\n * provider to be redirected to web-based content during execution,\n * which is then further validated by the contract.\n *\n * There are potential security implications allowing CCIP-read, as\n * it could be used to expose the IP address or user activity during\n * the fetch to unexpected parties.\n */\n enableCcipRead?: boolean;\n}\n\n/**\n * Returns a copy of %%req%% with all properties coerced to their strict\n * types.\n */\nexport function copyRequest(req: TransactionRequest): PreparedTransactionRequest {\n const result: any = { };\n\n // These could be addresses, ENS names or Addressables\n if (req.to) { result.to = req.to; }\n if (req.from) { result.from = req.from; }\n\n if (req.data) { result.data = hexlify(req.data); }\n\n const bigIntKeys = \"chainId,gasLimit,gasPrice,maxFeePerGas,maxPriorityFeePerGas,value\".split(/,/);\n for (const key of bigIntKeys) {\n if (!(key in req) || (req)[key] == null) { continue; }\n result[key] = getBigInt((req)[key], `request.${ key }`);\n }\n\n const numberKeys = \"type,nonce\".split(/,/);\n for (const key of numberKeys) {\n if (!(key in req) || (req)[key] == null) { continue; }\n result[key] = getNumber((req)[key], `request.${ key }`);\n }\n\n if (req.accessList) {\n result.accessList = accessListify(req.accessList);\n }\n\n if (\"blockTag\" in req) { result.blockTag = req.blockTag; }\n\n if (\"enableCcipRead\" in req) {\n result.enableCcipRead = !!req.enableCcipRead\n }\n\n if (\"customData\" in req) {\n result.customData = req.customData;\n }\n\n return result;\n}\n\n//////////////////////\n// Block\n\n/**\n * An Interface to indicate a [[Block]] has been included in the\n * blockchain. This asserts a Type Guard that necessary properties\n * are non-null.\n *\n * Before a block is included, it is a //pending// block.\n */\nexport interface MinedBlock extends Block {\n /**\n * The block number also known as the block height.\n */\n readonly number: number;\n\n /**\n * The block hash.\n */\n readonly hash: string;\n\n /**\n * The block timestamp, in seconds from epoch.\n */\n readonly timestamp: number;\n\n /**\n * The block date, created from the [[timestamp]].\n */\n readonly date: Date;\n\n /**\n * The miner of the block, also known as the ``author`` or\n * block ``producer``.\n */\n readonly miner: string;\n}\n\n/**\n * A **Block** represents the data associated with a full block on\n * Ethereum.\n */\nexport class Block implements BlockParams, Iterable {\n\n /**\n * The provider connected to the block used to fetch additional details\n * if necessary.\n */\n readonly provider!: Provider;\n\n /**\n * The block number, sometimes called the block height. This is a\n * sequential number that is one higher than the parent block.\n */\n readonly number!: number;\n\n /**\n * The block hash.\n *\n * This hash includes all properties, so can be safely used to identify\n * an exact set of block properties.\n */\n readonly hash!: null | string;\n\n /**\n * The timestamp for this block, which is the number of seconds since\n * epoch that this block was included.\n */\n readonly timestamp!: number;\n\n /**\n * The block hash of the parent block.\n */\n readonly parentHash!: string;\n\n /**\n * The hash tree root of the parent beacon block for the given\n * execution block. See [[link-eip-4788]].\n */\n parentBeaconBlockRoot!: null | string;\n\n /**\n * The nonce.\n *\n * On legacy networks, this is the random number inserted which\n * permitted the difficulty target to be reached.\n */\n readonly nonce!: string;\n\n /**\n * The difficulty target.\n *\n * On legacy networks, this is the proof-of-work target required\n * for a block to meet the protocol rules to be included.\n *\n * On modern networks, this is a random number arrived at using\n * randao. @TODO: Find links?\n */\n readonly difficulty!: bigint;\n\n\n /**\n * The total gas limit for this block.\n */\n readonly gasLimit!: bigint;\n\n /**\n * The total gas used in this block.\n */\n readonly gasUsed!: bigint;\n\n\n /**\n * The root hash for the global state after applying changes\n * in this block.\n */\n readonly stateRoot!: null | string;\n\n /**\n * The hash of the transaction receipts trie.\n */\n readonly receiptsRoot!: null | string;\n\n /**\n * The total amount of blob gas consumed by the transactions\n * within the block. See [[link-eip-4844]].\n */\n readonly blobGasUsed!: null | bigint;\n\n /**\n * The running total of blob gas consumed in excess of the\n * target, prior to the block. See [[link-eip-4844]].\n */\n readonly excessBlobGas!: null | bigint;\n\n /**\n * The miner coinbase address, wihch receives any subsidies for\n * including this block.\n */\n readonly miner!: string;\n\n /**\n * Any extra data the validator wished to include.\n */\n readonly extraData!: string;\n\n /**\n * The base fee per gas that all transactions in this block were\n * charged.\n *\n * This adjusts after each block, depending on how congested the network\n * is.\n */\n readonly baseFeePerGas!: null | bigint;\n\n readonly #transactions: Array;\n\n /**\n * Create a new **Block** object.\n *\n * This should generally not be necessary as the unless implementing a\n * low-level library.\n */\n constructor(block: BlockParams, provider: Provider) {\n\n this.#transactions = block.transactions.map((tx) => {\n if (typeof(tx) !== \"string\") {\n return new TransactionResponse(tx, provider);\n }\n return tx;\n });\n\n defineProperties(this, {\n provider,\n\n hash: getValue(block.hash),\n\n number: block.number,\n timestamp: block.timestamp,\n\n parentHash: block.parentHash,\n parentBeaconBlockRoot: block.parentBeaconBlockRoot,\n\n nonce: block.nonce,\n difficulty: block.difficulty,\n\n gasLimit: block.gasLimit,\n gasUsed: block.gasUsed,\n blobGasUsed: block.blobGasUsed,\n excessBlobGas: block.excessBlobGas,\n miner: block.miner,\n extraData: block.extraData,\n\n baseFeePerGas: getValue(block.baseFeePerGas),\n\n stateRoot: block.stateRoot,\n receiptsRoot: block.receiptsRoot,\n });\n }\n\n /**\n * Returns the list of transaction hashes, in the order\n * they were executed within the block.\n */\n get transactions(): ReadonlyArray {\n return this.#transactions.map((tx) => {\n if (typeof(tx) === \"string\") { return tx; }\n return tx.hash;\n });\n }\n\n /**\n * Returns the complete transactions, in the order they\n * were executed within the block.\n *\n * This is only available for blocks which prefetched\n * transactions, by passing ``true`` to %%prefetchTxs%%\n * into [[Provider-getBlock]].\n */\n get prefetchedTransactions(): Array {\n const txs = this.#transactions.slice();\n\n // Doesn't matter...\n if (txs.length === 0) { return [ ]; }\n\n // Make sure we prefetched the transactions\n assert(typeof(txs[0]) === \"object\", \"transactions were not prefetched with block request\", \"UNSUPPORTED_OPERATION\", {\n operation: \"transactionResponses()\"\n });\n\n return >txs;\n }\n\n /**\n * Returns a JSON-friendly value.\n */\n toJSON(): any {\n const {\n baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash,\n miner, nonce, number, parentHash, parentBeaconBlockRoot,\n stateRoot, receiptsRoot, timestamp, transactions\n } = this;\n\n return {\n _type: \"Block\",\n baseFeePerGas: toJson(baseFeePerGas),\n difficulty: toJson(difficulty),\n extraData,\n gasLimit: toJson(gasLimit),\n gasUsed: toJson(gasUsed),\n blobGasUsed: toJson(this.blobGasUsed),\n excessBlobGas: toJson(this.excessBlobGas),\n hash, miner, nonce, number, parentHash, timestamp,\n parentBeaconBlockRoot, stateRoot, receiptsRoot,\n transactions,\n };\n }\n\n [Symbol.iterator](): Iterator {\n let index = 0;\n const txs = this.transactions;\n return {\n next: () => {\n if (index < this.length) {\n return {\n value: txs[index++], done: false\n }\n }\n return { value: undefined, done: true };\n }\n };\n }\n\n /**\n * The number of transactions in this block.\n */\n get length(): number { return this.#transactions.length; }\n\n /**\n * The [[link-js-date]] this block was included at.\n */\n get date(): null | Date {\n if (this.timestamp == null) { return null; }\n return new Date(this.timestamp * 1000);\n }\n\n /**\n * Get the transaction at %%indexe%% within this block.\n */\n async getTransaction(indexOrHash: number | string): Promise {\n // Find the internal value by its index or hash\n let tx: string | TransactionResponse | undefined = undefined;\n if (typeof(indexOrHash) === \"number\") {\n tx = this.#transactions[indexOrHash];\n\n } else {\n const hash = indexOrHash.toLowerCase();\n for (const v of this.#transactions) {\n if (typeof(v) === \"string\") {\n if (v !== hash) { continue; }\n tx = v;\n break;\n } else {\n if (v.hash === hash) { continue; }\n tx = v;\n break;\n }\n }\n }\n if (tx == null) { throw new Error(\"no such tx\"); }\n\n if (typeof(tx) === \"string\") {\n return (await this.provider.getTransaction(tx));\n } else {\n return tx;\n }\n }\n\n /**\n * If a **Block** was fetched with a request to include the transactions\n * this will allow synchronous access to those transactions.\n *\n * If the transactions were not prefetched, this will throw.\n */\n getPrefetchedTransaction(indexOrHash: number | string): TransactionResponse {\n const txs = this.prefetchedTransactions;\n if (typeof(indexOrHash) === \"number\") {\n return txs[indexOrHash];\n }\n\n indexOrHash = indexOrHash.toLowerCase();\n for (const tx of txs) {\n if (tx.hash === indexOrHash) { return tx; }\n }\n\n assertArgument(false, \"no matching transaction\", \"indexOrHash\", indexOrHash);\n }\n\n /**\n * Returns true if this block been mined. This provides a type guard\n * for all properties on a [[MinedBlock]].\n */\n isMined(): this is MinedBlock { return !!this.hash; }\n\n /**\n * Returns true if this block is an [[link-eip-2930]] block.\n */\n isLondon(): this is (Block & { baseFeePerGas: bigint }) {\n return !!this.baseFeePerGas;\n }\n\n /**\n * @_ignore:\n */\n orphanedEvent(): OrphanFilter {\n if (!this.isMined()) { throw new Error(\"\"); }\n return createOrphanedBlockFilter(this);\n }\n}\n\n//////////////////////\n// Log\n\n/**\n * A **Log** in Ethereum represents an event that has been included in a\n * transaction using the ``LOG*`` opcodes, which are most commonly used by\n * Solidity's emit for announcing events.\n */\nexport class Log implements LogParams {\n\n /**\n * The provider connected to the log used to fetch additional details\n * if necessary.\n */\n readonly provider: Provider;\n\n /**\n * The transaction hash of the transaction this log occurred in. Use the\n * [[Log-getTransaction]] to get the [[TransactionResponse]].\n */\n readonly transactionHash!: string;\n\n /**\n * The block hash of the block this log occurred in. Use the\n * [[Log-getBlock]] to get the [[Block]].\n */\n readonly blockHash!: string;\n\n /**\n * The block number of the block this log occurred in. It is preferred\n * to use the [[Block-hash]] when fetching the related [[Block]],\n * since in the case of an orphaned block, the block at that height may\n * have changed.\n */\n readonly blockNumber!: number;\n\n /**\n * If the **Log** represents a block that was removed due to an orphaned\n * block, this will be true.\n *\n * This can only happen within an orphan event listener.\n */\n readonly removed!: boolean;\n\n /**\n * The address of the contract that emitted this log.\n */\n readonly address!: string;\n\n /**\n * The data included in this log when it was emitted.\n */\n readonly data!: string;\n\n /**\n * The indexed topics included in this log when it was emitted.\n *\n * All topics are included in the bloom filters, so they can be\n * efficiently filtered using the [[Provider-getLogs]] method.\n */\n readonly topics!: ReadonlyArray;\n\n /**\n * The index within the block this log occurred at. This is generally\n * not useful to developers, but can be used with the various roots\n * to proof inclusion within a block.\n */\n readonly index!: number;\n\n /**\n * The index within the transaction of this log.\n */\n readonly transactionIndex!: number;\n\n /**\n * @_ignore:\n */\n constructor(log: LogParams, provider: Provider) {\n this.provider = provider;\n\n const topics = Object.freeze(log.topics.slice());\n defineProperties(this, {\n transactionHash: log.transactionHash,\n blockHash: log.blockHash,\n blockNumber: log.blockNumber,\n\n removed: log.removed,\n\n address: log.address,\n data: log.data,\n\n topics,\n\n index: log.index,\n transactionIndex: log.transactionIndex,\n });\n }\n\n /**\n * Returns a JSON-compatible object.\n */\n toJSON(): any {\n const {\n address, blockHash, blockNumber, data, index,\n removed, topics, transactionHash, transactionIndex\n } = this;\n\n return {\n _type: \"log\",\n address, blockHash, blockNumber, data, index,\n removed, topics, transactionHash, transactionIndex\n };\n }\n\n /**\n * Returns the block that this log occurred in.\n */\n async getBlock(): Promise {\n const block = await this.provider.getBlock(this.blockHash);\n assert(!!block, \"failed to find transaction\", \"UNKNOWN_ERROR\", { });\n return block;\n }\n\n /**\n * Returns the transaction that this log occurred in.\n */\n async getTransaction(): Promise {\n const tx = await this.provider.getTransaction(this.transactionHash);\n assert(!!tx, \"failed to find transaction\", \"UNKNOWN_ERROR\", { });\n return tx;\n }\n\n /**\n * Returns the transaction receipt fot the transaction that this\n * log occurred in.\n */\n async getTransactionReceipt(): Promise {\n const receipt = await this.provider.getTransactionReceipt(this.transactionHash);\n assert(!!receipt, \"failed to find transaction receipt\", \"UNKNOWN_ERROR\", { });\n return receipt;\n }\n\n /**\n * @_ignore:\n */\n removedEvent(): OrphanFilter {\n return createRemovedLogFilter(this);\n }\n}\n\n//////////////////////\n// Transaction Receipt\n\n/*\nexport interface LegacyTransactionReceipt {\n byzantium: false;\n status: null;\n root: string;\n}\n\nexport interface ByzantiumTransactionReceipt {\n byzantium: true;\n status: number;\n root: null;\n}\n*/\n\n/**\n * A **TransactionReceipt** includes additional information about a\n * transaction that is only available after it has been mined.\n */\nexport class TransactionReceipt implements TransactionReceiptParams, Iterable {\n /**\n * The provider connected to the log used to fetch additional details\n * if necessary.\n */\n readonly provider!: Provider;\n\n /**\n * The address the transaction was sent to.\n */\n readonly to!: null | string;\n\n /**\n * The sender of the transaction.\n */\n readonly from!: string;\n\n /**\n * The address of the contract if the transaction was directly\n * responsible for deploying one.\n *\n * This is non-null **only** if the ``to`` is empty and the ``data``\n * was successfully executed as initcode.\n */\n readonly contractAddress!: null | string;\n\n /**\n * The transaction hash.\n */\n readonly hash!: string;\n\n /**\n * The index of this transaction within the block transactions.\n */\n readonly index!: number;\n\n /**\n * The block hash of the [[Block]] this transaction was included in.\n */\n readonly blockHash!: string;\n\n /**\n * The block number of the [[Block]] this transaction was included in.\n */\n readonly blockNumber!: number;\n\n /**\n * The bloom filter bytes that represent all logs that occurred within\n * this transaction. This is generally not useful for most developers,\n * but can be used to validate the included logs.\n */\n readonly logsBloom!: string;\n\n /**\n * The actual amount of gas used by this transaction.\n *\n * When creating a transaction, the amount of gas that will be used can\n * only be approximated, but the sender must pay the gas fee for the\n * entire gas limit. After the transaction, the difference is refunded.\n */\n readonly gasUsed!: bigint;\n\n /**\n * The gas used for BLObs. See [[link-eip-4844]].\n */\n readonly blobGasUsed!: null | bigint;\n\n /**\n * The amount of gas used by all transactions within the block for this\n * and all transactions with a lower ``index``.\n *\n * This is generally not useful for developers but can be used to\n * validate certain aspects of execution.\n */\n readonly cumulativeGasUsed!: bigint;\n\n /**\n * The actual gas price used during execution.\n *\n * Due to the complexity of [[link-eip-1559]] this value can only\n * be caluclated after the transaction has been mined, snce the base\n * fee is protocol-enforced.\n */\n readonly gasPrice!: bigint;\n\n /**\n * The price paid per BLOB in gas. See [[link-eip-4844]].\n */\n readonly blobGasPrice!: null | bigint;\n\n /**\n * The [[link-eip-2718]] transaction type.\n */\n readonly type!: number;\n //readonly byzantium!: boolean;\n\n /**\n * The status of this transaction, indicating success (i.e. ``1``) or\n * a revert (i.e. ``0``).\n *\n * This is available in post-byzantium blocks, but some backends may\n * backfill this value.\n */\n readonly status!: null | number;\n\n /**\n * The root hash of this transaction.\n *\n * This is no present and was only included in pre-byzantium blocks, but\n * could be used to validate certain parts of the receipt.\n */\n readonly root!: null | string;\n\n readonly #logs: ReadonlyArray;\n\n /**\n * @_ignore:\n */\n constructor(tx: TransactionReceiptParams, provider: Provider) {\n this.#logs = Object.freeze(tx.logs.map((log) => {\n return new Log(log, provider);\n }));\n\n let gasPrice = BN_0;\n if (tx.effectiveGasPrice != null) {\n gasPrice = tx.effectiveGasPrice;\n } else if (tx.gasPrice != null) {\n gasPrice = tx.gasPrice;\n }\n\n defineProperties(this, {\n provider,\n\n to: tx.to,\n from: tx.from,\n contractAddress: tx.contractAddress,\n\n hash: tx.hash,\n index: tx.index,\n\n blockHash: tx.blockHash,\n blockNumber: tx.blockNumber,\n\n logsBloom: tx.logsBloom,\n\n gasUsed: tx.gasUsed,\n cumulativeGasUsed: tx.cumulativeGasUsed,\n blobGasUsed: tx.blobGasUsed,\n gasPrice,\n blobGasPrice: tx.blobGasPrice,\n\n type: tx.type,\n //byzantium: tx.byzantium,\n status: tx.status,\n root: tx.root\n });\n }\n\n /**\n * The logs for this transaction.\n */\n get logs(): ReadonlyArray { return this.#logs; }\n\n /**\n * Returns a JSON-compatible representation.\n */\n toJSON(): any {\n const {\n to, from, contractAddress, hash, index,\n blockHash, blockNumber, logsBloom,\n logs, //byzantium, \n status, root\n } = this;\n\n return {\n _type: \"TransactionReceipt\",\n blockHash, blockNumber,\n //byzantium, \n contractAddress,\n cumulativeGasUsed: toJson(this.cumulativeGasUsed),\n from,\n gasPrice: toJson(this.gasPrice),\n blobGasUsed: toJson(this.blobGasUsed),\n blobGasPrice: toJson(this.blobGasPrice),\n gasUsed: toJson(this.gasUsed),\n hash, index, logs, logsBloom, root, status, to\n };\n }\n\n /**\n * @_ignore:\n */\n get length(): number { return this.logs.length; }\n\n [Symbol.iterator](): Iterator {\n let index = 0;\n return {\n next: () => {\n if (index < this.length) {\n return { value: this.logs[index++], done: false }\n }\n return { value: undefined, done: true };\n }\n };\n }\n\n /**\n * The total fee for this transaction, in wei.\n */\n get fee(): bigint {\n return this.gasUsed * this.gasPrice;\n }\n\n /**\n * Resolves to the block this transaction occurred in.\n */\n async getBlock(): Promise {\n const block = await this.provider.getBlock(this.blockHash);\n if (block == null) { throw new Error(\"TODO\"); }\n return block;\n }\n\n /**\n * Resolves to the transaction this transaction occurred in.\n */\n async getTransaction(): Promise {\n const tx = await this.provider.getTransaction(this.hash);\n if (tx == null) { throw new Error(\"TODO\"); }\n return tx;\n }\n\n /**\n * Resolves to the return value of the execution of this transaction.\n *\n * Support for this feature is limited, as it requires an archive node\n * with the ``debug_`` or ``trace_`` API enabled.\n */\n async getResult(): Promise {\n return (await this.provider.getTransactionResult(this.hash));\n }\n\n /**\n * Resolves to the number of confirmations this transaction has.\n */\n async confirmations(): Promise {\n return (await this.provider.getBlockNumber()) - this.blockNumber + 1;\n }\n\n /**\n * @_ignore:\n */\n removedEvent(): OrphanFilter {\n return createRemovedTransactionFilter(this);\n }\n\n /**\n * @_ignore:\n */\n reorderedEvent(other?: TransactionResponse): OrphanFilter {\n assert(!other || other.isMined(), \"unmined 'other' transction cannot be orphaned\",\n \"UNSUPPORTED_OPERATION\", { operation: \"reorderedEvent(other)\" });\n return createReorderedTransactionFilter(this, other);\n }\n}\n\n\n//////////////////////\n// Transaction Response\n\n/**\n * A **MinedTransactionResponse** is an interface representing a\n * transaction which has been mined and allows for a type guard for its\n * property values being defined.\n */\nexport interface MinedTransactionResponse extends TransactionResponse {\n /**\n * The block number this transaction occurred in.\n */\n blockNumber: number;\n\n /**\n * The block hash this transaction occurred in.\n */\n blockHash: string;\n\n /**\n * The date this transaction occurred on.\n */\n date: Date;\n}\n\n\n/**\n * A **TransactionResponse** includes all properties about a transaction\n * that was sent to the network, which may or may not be included in a\n * block.\n *\n * The [[TransactionResponse-isMined]] can be used to check if the\n * transaction has been mined as well as type guard that the otherwise\n * possibly ``null`` properties are defined.\n */\nexport class TransactionResponse implements TransactionLike, TransactionResponseParams {\n /**\n * The provider this is connected to, which will influence how its\n * methods will resolve its async inspection methods.\n */\n readonly provider: Provider;\n\n /**\n * The block number of the block that this transaction was included in.\n *\n * This is ``null`` for pending transactions.\n */\n readonly blockNumber: null | number;\n\n /**\n * The blockHash of the block that this transaction was included in.\n *\n * This is ``null`` for pending transactions.\n */\n readonly blockHash: null | string;\n\n /**\n * The index within the block that this transaction resides at.\n */\n readonly index!: number;\n\n /**\n * The transaction hash.\n */\n readonly hash!: string;\n\n /**\n * The [[link-eip-2718]] transaction envelope type. This is\n * ``0`` for legacy transactions types.\n */\n readonly type!: number;\n\n /**\n * The receiver of this transaction.\n *\n * If ``null``, then the transaction is an initcode transaction.\n * This means the result of executing the [[data]] will be deployed\n * as a new contract on chain (assuming it does not revert) and the\n * address may be computed using [[getCreateAddress]].\n */\n readonly to!: null | string;\n\n /**\n * The sender of this transaction. It is implicitly computed\n * from the transaction pre-image hash (as the digest) and the\n * [[signature]] using ecrecover.\n */\n readonly from!: string;\n\n /**\n * The nonce, which is used to prevent replay attacks and offer\n * a method to ensure transactions from a given sender are explicitly\n * ordered.\n *\n * When sending a transaction, this must be equal to the number of\n * transactions ever sent by [[from]].\n */\n readonly nonce!: number;\n\n /**\n * The maximum units of gas this transaction can consume. If execution\n * exceeds this, the entries transaction is reverted and the sender\n * is charged for the full amount, despite not state changes being made.\n */\n readonly gasLimit!: bigint;\n\n /**\n * The gas price can have various values, depending on the network.\n *\n * In modern networks, for transactions that are included this is\n * the //effective gas price// (the fee per gas that was actually\n * charged), while for transactions that have not been included yet\n * is the [[maxFeePerGas]].\n *\n * For legacy transactions, or transactions on legacy networks, this\n * is the fee that will be charged per unit of gas the transaction\n * consumes.\n */\n readonly gasPrice!: bigint;\n\n /**\n * The maximum priority fee (per unit of gas) to allow a\n * validator to charge the sender. This is inclusive of the\n * [[maxFeeFeePerGas]].\n */\n readonly maxPriorityFeePerGas!: null | bigint;\n\n /**\n * The maximum fee (per unit of gas) to allow this transaction\n * to charge the sender.\n */\n readonly maxFeePerGas!: null | bigint;\n\n /**\n * The [[link-eip-4844]] max fee per BLOb gas.\n */\n readonly maxFeePerBlobGas!: null | bigint;\n\n /**\n * The data.\n */\n readonly data!: string;\n\n /**\n * The value, in wei. Use [[formatEther]] to format this value\n * as ether.\n */\n readonly value!: bigint;\n\n /**\n * The chain ID.\n */\n readonly chainId!: bigint;\n\n /**\n * The signature.\n */\n readonly signature!: Signature;\n\n /**\n * The [[link-eip-2930]] access list for transaction types that\n * support it, otherwise ``null``.\n */\n readonly accessList!: null | AccessList;\n\n /**\n * The [[link-eip-4844]] BLOb versioned hashes.\n */\n readonly blobVersionedHashes!: null | Array;\n\n #startBlock: number;\n\n /**\n * @_ignore:\n */\n constructor(tx: TransactionResponseParams, provider: Provider) {\n this.provider = provider;\n\n this.blockNumber = (tx.blockNumber != null) ? tx.blockNumber: null;\n this.blockHash = (tx.blockHash != null) ? tx.blockHash: null;\n\n this.hash = tx.hash;\n this.index = tx.index;\n\n this.type = tx.type;\n\n this.from = tx.from;\n this.to = tx.to || null;\n\n this.gasLimit = tx.gasLimit;\n this.nonce = tx.nonce;\n this.data = tx.data;\n this.value = tx.value;\n\n this.gasPrice = tx.gasPrice;\n this.maxPriorityFeePerGas = (tx.maxPriorityFeePerGas != null) ? tx.maxPriorityFeePerGas: null;\n this.maxFeePerGas = (tx.maxFeePerGas != null) ? tx.maxFeePerGas: null;\n this.maxFeePerBlobGas = (tx.maxFeePerBlobGas != null) ? tx.maxFeePerBlobGas: null;\n\n this.chainId = tx.chainId;\n this.signature = tx.signature;\n\n this.accessList = (tx.accessList != null) ? tx.accessList: null;\n this.blobVersionedHashes = (tx.blobVersionedHashes != null) ? tx.blobVersionedHashes: null;\n\n this.#startBlock = -1;\n }\n\n /**\n * Returns a JSON-compatible representation of this transaction.\n */\n toJSON(): any {\n const {\n blockNumber, blockHash, index, hash, type, to, from, nonce,\n data, signature, accessList, blobVersionedHashes\n } = this;\n\n return {\n _type: \"TransactionResponse\",\n accessList, blockNumber, blockHash,\n blobVersionedHashes,\n chainId: toJson(this.chainId),\n data, from,\n gasLimit: toJson(this.gasLimit),\n gasPrice: toJson(this.gasPrice),\n hash,\n maxFeePerGas: toJson(this.maxFeePerGas),\n maxPriorityFeePerGas: toJson(this.maxPriorityFeePerGas),\n maxFeePerBlobGas: toJson(this.maxFeePerBlobGas),\n nonce, signature, to, index, type,\n value: toJson(this.value),\n };\n }\n\n /**\n * Resolves to the Block that this transaction was included in.\n *\n * This will return null if the transaction has not been included yet.\n */\n async getBlock(): Promise {\n let blockNumber = this.blockNumber;\n if (blockNumber == null) {\n const tx = await this.getTransaction();\n if (tx) { blockNumber = tx.blockNumber; }\n }\n if (blockNumber == null) { return null; }\n const block = this.provider.getBlock(blockNumber);\n if (block == null) { throw new Error(\"TODO\"); }\n return block;\n }\n\n /**\n * Resolves to this transaction being re-requested from the\n * provider. This can be used if you have an unmined transaction\n * and wish to get an up-to-date populated instance.\n */\n async getTransaction(): Promise {\n return this.provider.getTransaction(this.hash);\n }\n\n /**\n * Resolve to the number of confirmations this transaction has.\n */\n async confirmations(): Promise {\n if (this.blockNumber == null) {\n const { tx, blockNumber } = await resolveProperties({\n tx: this.getTransaction(),\n blockNumber: this.provider.getBlockNumber()\n });\n\n // Not mined yet...\n if (tx == null || tx.blockNumber == null) { return 0; }\n\n return blockNumber - tx.blockNumber + 1;\n }\n\n const blockNumber = await this.provider.getBlockNumber();\n return blockNumber - this.blockNumber + 1;\n }\n\n /**\n * Resolves once this transaction has been mined and has\n * %%confirms%% blocks including it (default: ``1``) with an\n * optional %%timeout%%.\n *\n * This can resolve to ``null`` only if %%confirms%% is ``0``\n * and the transaction has not been mined, otherwise this will\n * wait until enough confirmations have completed.\n */\n async wait(_confirms?: number, _timeout?: number): Promise {\n const confirms = (_confirms == null) ? 1: _confirms;\n const timeout = (_timeout == null) ? 0: _timeout;\n\n let startBlock = this.#startBlock\n let nextScan = -1;\n let stopScanning = (startBlock === -1) ? true: false;\n const checkReplacement = async () => {\n // Get the current transaction count for this sender\n if (stopScanning) { return null; }\n const { blockNumber, nonce } = await resolveProperties({\n blockNumber: this.provider.getBlockNumber(),\n nonce: this.provider.getTransactionCount(this.from)\n });\n\n // No transaction or our nonce has not been mined yet; but we\n // can start scanning later when we do start\n if (nonce < this.nonce) {\n startBlock = blockNumber;\n return;\n }\n\n // We were mined; no replacement\n if (stopScanning) { return null; }\n const mined = await this.getTransaction();\n if (mined && mined.blockNumber != null) { return; }\n\n // We were replaced; start scanning for that transaction\n\n // Starting to scan; look back a few extra blocks for safety\n if (nextScan === -1) {\n nextScan = startBlock - 3;\n if (nextScan < this.#startBlock) { nextScan = this.#startBlock; }\n }\n\n while (nextScan <= blockNumber) {\n // Get the next block to scan\n if (stopScanning) { return null; }\n const block = await this.provider.getBlock(nextScan, true);\n\n // This should not happen; but we'll try again shortly\n if (block == null) { return; }\n\n // We were mined; no replacement\n for (const hash of block) {\n if (hash === this.hash) { return; }\n }\n\n // Search for the transaction that replaced us\n for (let i = 0; i < block.length; i++) {\n const tx: TransactionResponse = await block.getTransaction(i);\n\n if (tx.from === this.from && tx.nonce === this.nonce) {\n // Get the receipt\n if (stopScanning) { return null; }\n const receipt = await this.provider.getTransactionReceipt(tx.hash);\n\n // This should not happen; but we'll try again shortly\n if (receipt == null) { return; }\n\n // We will retry this on the next block (this case could be optimized)\n if ((blockNumber - receipt.blockNumber + 1) < confirms) { return; }\n\n // The reason we were replaced\n let reason: \"replaced\" | \"repriced\" | \"cancelled\" = \"replaced\";\n if (tx.data === this.data && tx.to === this.to && tx.value === this.value) {\n reason = \"repriced\";\n } else if (tx.data === \"0x\" && tx.from === tx.to && tx.value === BN_0) {\n reason = \"cancelled\"\n }\n\n assert(false, \"transaction was replaced\", \"TRANSACTION_REPLACED\", {\n cancelled: (reason === \"replaced\" || reason === \"cancelled\"),\n reason,\n replacement: tx.replaceableTransaction(startBlock),\n hash: tx.hash,\n receipt\n });\n }\n }\n\n nextScan++;\n }\n return;\n };\n\n const checkReceipt = (receipt: null | TransactionReceipt) => {\n if (receipt == null || receipt.status !== 0) { return receipt; }\n assert(false, \"transaction execution reverted\", \"CALL_EXCEPTION\", {\n action: \"sendTransaction\",\n data: null, reason: null, invocation: null, revert: null,\n transaction: {\n to: receipt.to,\n from: receipt.from,\n data: \"\" // @TODO: in v7, split out sendTransaction properties\n }, receipt\n });\n };\n\n const receipt = await this.provider.getTransactionReceipt(this.hash);\n\n if (confirms === 0) { return checkReceipt(receipt); }\n\n if (receipt) {\n if ((await receipt.confirmations()) >= confirms) {\n return checkReceipt(receipt);\n }\n\n } else {\n // Check for a replacement; throws if a replacement was found\n await checkReplacement();\n\n // Allow null only when the confirms is 0\n if (confirms === 0) { return null; }\n }\n\n const waiter = new Promise((resolve, reject) => {\n // List of things to cancel when we have a result (one way or the other)\n const cancellers: Array<() => void> = [ ];\n const cancel = () => { cancellers.forEach((c) => c()); };\n\n // On cancel, stop scanning for replacements\n cancellers.push(() => { stopScanning = true; });\n\n // Set up any timeout requested\n if (timeout > 0) {\n const timer = setTimeout(() => {\n cancel();\n reject(makeError(\"wait for transaction timeout\", \"TIMEOUT\"));\n }, timeout);\n cancellers.push(() => { clearTimeout(timer); });\n }\n\n const txListener = async (receipt: TransactionReceipt) => {\n // Done; return it!\n if ((await receipt.confirmations()) >= confirms) {\n cancel();\n try {\n resolve(checkReceipt(receipt));\n } catch (error) { reject(error); }\n }\n };\n cancellers.push(() => { this.provider.off(this.hash, txListener); });\n this.provider.on(this.hash, txListener);\n // We support replacement detection; start checking\n if (startBlock >= 0) {\n const replaceListener = async () => {\n try {\n // Check for a replacement; this throws only if one is found\n await checkReplacement();\n\n } catch (error) {\n // We were replaced (with enough confirms); re-throw the error\n if (isError(error, \"TRANSACTION_REPLACED\")) {\n cancel();\n reject(error);\n return;\n }\n }\n\n // Rescheudle a check on the next block\n if (!stopScanning) {\n this.provider.once(\"block\", replaceListener);\n }\n };\n cancellers.push(() => { this.provider.off(\"block\", replaceListener); });\n this.provider.once(\"block\", replaceListener);\n }\n });\n\n return await >waiter;\n }\n\n /**\n * Returns ``true`` if this transaction has been included.\n *\n * This is effective only as of the time the TransactionResponse\n * was instantiated. To get up-to-date information, use\n * [[getTransaction]].\n *\n * This provides a Type Guard that this transaction will have\n * non-null property values for properties that are null for\n * unmined transactions.\n */\n isMined(): this is MinedTransactionResponse {\n return (this.blockHash != null);\n }\n\n /**\n * Returns true if the transaction is a legacy (i.e. ``type == 0``)\n * transaction.\n *\n * This provides a Type Guard that this transaction will have\n * the ``null``-ness for hardfork-specific properties set correctly.\n */\n isLegacy(): this is (TransactionResponse & { accessList: null, maxFeePerGas: null, maxPriorityFeePerGas: null }) {\n return (this.type === 0)\n }\n\n /**\n * Returns true if the transaction is a Berlin (i.e. ``type == 1``)\n * transaction. See [[link-eip-2070]].\n *\n * This provides a Type Guard that this transaction will have\n * the ``null``-ness for hardfork-specific properties set correctly.\n */\n isBerlin(): this is (TransactionResponse & { accessList: AccessList, maxFeePerGas: null, maxPriorityFeePerGas: null }) {\n return (this.type === 1);\n }\n\n /**\n * Returns true if the transaction is a London (i.e. ``type == 2``)\n * transaction. See [[link-eip-1559]].\n *\n * This provides a Type Guard that this transaction will have\n * the ``null``-ness for hardfork-specific properties set correctly.\n */\n isLondon(): this is (TransactionResponse & { accessList: AccessList, maxFeePerGas: bigint, maxPriorityFeePerGas: bigint }){\n return (this.type === 2);\n }\n\n /**\n * Returns true if hte transaction is a Cancun (i.e. ``type == 3``)\n * transaction. See [[link-eip-4844]].\n */\n isCancun(): this is (TransactionResponse & { accessList: AccessList, maxFeePerGas: bigint, maxPriorityFeePerGas: bigint, maxFeePerBlobGas: bigint, blobVersionedHashes: Array }){\n return (this.type === 3);\n }\n\n /**\n * Returns a filter which can be used to listen for orphan events\n * that evict this transaction.\n */\n removedEvent(): OrphanFilter {\n assert(this.isMined(), \"unmined transaction canot be orphaned\",\n \"UNSUPPORTED_OPERATION\", { operation: \"removeEvent()\" });\n return createRemovedTransactionFilter(this);\n }\n\n /**\n * Returns a filter which can be used to listen for orphan events\n * that re-order this event against %%other%%.\n */\n reorderedEvent(other?: TransactionResponse): OrphanFilter {\n assert(this.isMined(), \"unmined transaction canot be orphaned\",\n \"UNSUPPORTED_OPERATION\", { operation: \"removeEvent()\" });\n\n assert(!other || other.isMined(), \"unmined 'other' transaction canot be orphaned\",\n \"UNSUPPORTED_OPERATION\", { operation: \"removeEvent()\" });\n\n return createReorderedTransactionFilter(this, other);\n }\n\n /**\n * Returns a new TransactionResponse instance which has the ability to\n * detect (and throw an error) if the transaction is replaced, which\n * will begin scanning at %%startBlock%%.\n *\n * This should generally not be used by developers and is intended\n * primarily for internal use. Setting an incorrect %%startBlock%% can\n * have devastating performance consequences if used incorrectly.\n */\n replaceableTransaction(startBlock: number): TransactionResponse {\n assertArgument(Number.isInteger(startBlock) && startBlock >= 0, \"invalid startBlock\", \"startBlock\", startBlock);\n const tx = new TransactionResponse(this, this.provider);\n tx.#startBlock = startBlock;\n return tx;\n }\n}\n\n\n//////////////////////\n// OrphanFilter\n\n/**\n * An Orphan Filter allows detecting when an orphan block has\n * resulted in dropping a block or transaction or has resulted\n * in transactions changing order.\n *\n * Not currently fully supported.\n */\nexport type OrphanFilter = {\n orphan: \"drop-block\",\n hash: string,\n number: number\n} | {\n orphan: \"drop-transaction\",\n tx: { hash: string, blockHash: string, blockNumber: number },\n other?: { hash: string, blockHash: string, blockNumber: number }\n} | {\n orphan: \"reorder-transaction\",\n tx: { hash: string, blockHash: string, blockNumber: number },\n other?: { hash: string, blockHash: string, blockNumber: number }\n} | {\n orphan: \"drop-log\",\n log: {\n transactionHash: string,\n blockHash: string,\n blockNumber: number,\n address: string,\n data: string,\n topics: ReadonlyArray,\n index: number\n }\n};\n\nfunction createOrphanedBlockFilter(block: { hash: string, number: number }): OrphanFilter {\n return { orphan: \"drop-block\", hash: block.hash, number: block.number };\n}\n\nfunction createReorderedTransactionFilter(tx: { hash: string, blockHash: string, blockNumber: number }, other?: { hash: string, blockHash: string, blockNumber: number }): OrphanFilter {\n return { orphan: \"reorder-transaction\", tx, other };\n}\n\nfunction createRemovedTransactionFilter(tx: { hash: string, blockHash: string, blockNumber: number }): OrphanFilter {\n return { orphan: \"drop-transaction\", tx };\n}\n\nfunction createRemovedLogFilter(log: { blockHash: string, transactionHash: string, blockNumber: number, address: string, data: string, topics: ReadonlyArray, index: number }): OrphanFilter {\n return { orphan: \"drop-log\", log: {\n transactionHash: log.transactionHash,\n blockHash: log.blockHash,\n blockNumber: log.blockNumber,\n address: log.address,\n data: log.data,\n topics: Object.freeze(log.topics.slice()),\n index: log.index\n } };\n}\n\n//////////////////////\n// EventFilter\n\n/**\n * A **TopicFilter** provides a struture to define bloom-filter\n * queries.\n *\n * Each field that is ``null`` matches **any** value, a field that is\n * a ``string`` must match exactly that value and and ``array`` is\n * effectively an ``OR``-ed set, where any one of those values must\n * match.\n */\nexport type TopicFilter = Array>;\n\n// @TODO:\n//export type DeferableTopicFilter = Array | Array>>;\n\n/**\n * An **EventFilter** allows efficiently filtering logs (also known as\n * events) using bloom filters included within blocks.\n */\nexport interface EventFilter {\n address?: AddressLike | Array;\n topics?: TopicFilter;\n}\n\n/**\n * A **Filter** allows searching a specific range of blocks for mathcing\n * logs.\n */\nexport interface Filter extends EventFilter {\n\n /**\n * The start block for the filter (inclusive).\n */\n fromBlock?: BlockTag;\n\n /**\n * The end block for the filter (inclusive).\n */\n toBlock?: BlockTag;\n}\n\n/**\n * A **FilterByBlockHash** allows searching a specific block for mathcing\n * logs.\n */\nexport interface FilterByBlockHash extends EventFilter {\n /**\n * The blockhash of the specific block for the filter.\n */\n blockHash?: string;\n}\n\n\n//////////////////////\n// ProviderEvent\n\n/**\n * A **ProviderEvent** provides the types of events that can be subscribed\n * to on a [[Provider]].\n *\n * Each provider may include additional possible events it supports, but\n * the most commonly supported are:\n *\n * **``\"block\"``** - calls the listener with the current block number on each\n * new block.\n *\n * **``\"error\"``** - calls the listener on each async error that occurs during\n * the event loop, with the error.\n *\n * **``\"debug\"``** - calls the listener on debug events, which can be used to\n * troubleshoot network errors, provider problems, etc.\n *\n * **``transaction hash``** - calls the listener on each block after the\n * transaction has been mined; generally ``.once`` is more appropriate for\n * this event.\n *\n * **``Array``** - calls the listener on each log that matches the filter.\n *\n * [[EventFilter]] - calls the listener with each matching log\n */\nexport type ProviderEvent = string | Array> | EventFilter | OrphanFilter;\n\n\n//////////////////////\n// Provider\n\n/**\n * A **Provider** is the primary method to interact with the read-only\n * content on Ethereum.\n *\n * It allows access to details about accounts, blocks and transactions\n * and the ability to query event logs and simulate contract execution.\n *\n * Account data includes the [balance](getBalance),\n * [transaction count](getTransactionCount), [code](getCode) and\n * [state trie storage](getStorage).\n *\n * Simulating execution can be used to [call](call),\n * [estimate gas](estimateGas) and\n * [get transaction results](getTransactionResult).\n *\n * The [[broadcastTransaction]] is the only method which allows updating\n * the blockchain, but it is usually accessed by a [[Signer]], since a\n * private key must be used to sign the transaction before it can be\n * broadcast.\n */\nexport interface Provider extends ContractRunner, EventEmitterable, NameResolver {\n\n /**\n * The provider iteself.\n *\n * This is part of the necessary API for executing a contract, as\n * it provides a common property on any [[ContractRunner]] that\n * can be used to access the read-only portion of the runner.\n */\n provider: this;\n\n /**\n * Shutdown any resources this provider is using. No additional\n * calls should be made to this provider after calling this.\n */\n destroy(): void;\n\n ////////////////////\n // State\n\n /**\n * Get the current block number.\n */\n getBlockNumber(): Promise;\n\n /**\n * Get the connected [[Network]].\n */\n getNetwork(): Promise;\n\n /**\n * Get the best guess at the recommended [[FeeData]].\n */\n getFeeData(): Promise;\n\n\n ////////////////////\n // Account\n\n /**\n * Get the account balance (in wei) of %%address%%. If %%blockTag%%\n * is specified and the node supports archive access for that\n * %%blockTag%%, the balance is as of that [[BlockTag]].\n *\n * @note On nodes without archive access enabled, the %%blockTag%% may be\n * **silently ignored** by the node, which may cause issues if relied on.\n */\n getBalance(address: AddressLike, blockTag?: BlockTag): Promise;\n\n /**\n * Get the number of transactions ever sent for %%address%%, which\n * is used as the ``nonce`` when sending a transaction. If\n * %%blockTag%% is specified and the node supports archive access\n * for that %%blockTag%%, the transaction count is as of that\n * [[BlockTag]].\n *\n * @note On nodes without archive access enabled, the %%blockTag%% may be\n * **silently ignored** by the node, which may cause issues if relied on.\n */\n getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise;\n\n /**\n * Get the bytecode for %%address%%.\n *\n * @note On nodes without archive access enabled, the %%blockTag%% may be\n * **silently ignored** by the node, which may cause issues if relied on.\n */\n getCode(address: AddressLike, blockTag?: BlockTag): Promise\n\n /**\n * Get the storage slot value for %%address%% at slot %%position%%.\n *\n * @note On nodes without archive access enabled, the %%blockTag%% may be\n * **silently ignored** by the node, which may cause issues if relied on.\n */\n getStorage(address: AddressLike, position: BigNumberish, blockTag?: BlockTag): Promise\n\n\n ////////////////////\n // Execution\n\n /**\n * Estimates the amount of gas required to executre %%tx%%.\n */\n estimateGas(tx: TransactionRequest): Promise;\n\n /**\n * Simulate the execution of %%tx%%. If the call reverts, it will\n * throw a [[CallExceptionError]] which includes the revert data.\n */\n call(tx: TransactionRequest): Promise\n\n /**\n * Broadcasts the %%signedTx%% to the network, adding it to the\n * memory pool of any node for which the transaction meets the\n * rebroadcast requirements.\n */\n broadcastTransaction(signedTx: string): Promise;\n\n\n ////////////////////\n // Queries\n\n /**\n * Resolves to the block for %%blockHashOrBlockTag%%.\n *\n * If %%prefetchTxs%%, and the backend supports including transactions\n * with block requests, all transactions will be included and the\n * [[Block]] object will not need to make remote calls for getting\n * transactions.\n */\n getBlock(blockHashOrBlockTag: BlockTag | string, prefetchTxs?: boolean): Promise;\n\n /**\n * Resolves to the transaction for %%hash%%.\n *\n * If the transaction is unknown or on pruning nodes which\n * discard old transactions this resolves to ``null``.\n */\n getTransaction(hash: string): Promise;\n\n /**\n * Resolves to the transaction receipt for %%hash%%, if mined.\n *\n * If the transaction has not been mined, is unknown or on\n * pruning nodes which discard old transactions this resolves to\n * ``null``.\n */\n getTransactionReceipt(hash: string): Promise;\n\n /**\n * Resolves to the result returned by the executions of %%hash%%.\n *\n * This is only supported on nodes with archive access and with\n * the necessary debug APIs enabled.\n */\n getTransactionResult(hash: string): Promise;\n\n\n ////////////////////\n // Bloom-filter Queries\n\n /**\n * Resolves to the list of Logs that match %%filter%%\n */\n getLogs(filter: Filter | FilterByBlockHash): Promise>;\n\n\n ////////////////////\n // ENS\n\n /**\n * Resolves to the address configured for the %%ensName%% or\n * ``null`` if unconfigured.\n */\n resolveName(ensName: string): Promise;\n\n /**\n * Resolves to the ENS name associated for the %%address%% or\n * ``null`` if the //primary name// is not configured.\n *\n * Users must perform additional steps to configure a //primary name//,\n * which is not currently common.\n */\n lookupAddress(address: string): Promise;\n\n /**\n * Waits until the transaction %%hash%% is mined and has %%confirms%%\n * confirmations.\n */\n waitForTransaction(hash: string, confirms?: number, timeout?: number): Promise;\n\n /**\n * Resolves to the block at %%blockTag%% once it has been mined.\n *\n * This can be useful for waiting some number of blocks by using\n * the ``currentBlockNumber + N``.\n */\n waitForBlock(blockTag?: BlockTag): Promise;\n}\n", "// import from provider.ts instead of index.ts to prevent circular dep\n// from EtherscanProvider\nimport {\n Block, Log, TransactionReceipt, TransactionResponse\n} from \"../providers/provider.js\";\nimport { defineProperties, EventPayload } from \"../utils/index.js\";\n\nimport type { EventFragment, Interface, Result } from \"../abi/index.js\";\nimport type { Listener } from \"../utils/index.js\";\nimport type {\n Provider\n} from \"../providers/index.js\";\n\nimport type { BaseContract } from \"./contract.js\";\nimport type { ContractEventName } from \"./types.js\";\n\n/**\n * An **EventLog** contains additional properties parsed from the [[Log]].\n */\nexport class EventLog extends Log {\n /**\n * The Contract Interface.\n */\n readonly interface!: Interface;\n\n /**\n * The matching event.\n */\n readonly fragment!: EventFragment;\n\n /**\n * The parsed arguments passed to the event by ``emit``.\n */\n readonly args!: Result;\n\n /**\n * @_ignore:\n */\n constructor(log: Log, iface: Interface, fragment: EventFragment) {\n super(log, log.provider);\n const args = iface.decodeEventLog(fragment, log.data, log.topics);\n defineProperties(this, { args, fragment, interface: iface });\n }\n\n /**\n * The name of the event.\n */\n get eventName(): string { return this.fragment.name; }\n\n /**\n * The signature of the event.\n */\n get eventSignature(): string { return this.fragment.format(); }\n}\n\n/**\n * An **EventLog** contains additional properties parsed from the [[Log]].\n */\nexport class UndecodedEventLog extends Log {\n\n /**\n * The error encounted when trying to decode the log.\n */\n readonly error!: Error;\n\n /**\n * @_ignore:\n */\n constructor(log: Log, error: Error) {\n super(log, log.provider);\n defineProperties(this, { error });\n }\n}\n\n/**\n * A **ContractTransactionReceipt** includes the parsed logs from a\n * [[TransactionReceipt]].\n */\nexport class ContractTransactionReceipt extends TransactionReceipt {\n readonly #iface: Interface;\n\n /**\n * @_ignore:\n */\n constructor(iface: Interface, provider: Provider, tx: TransactionReceipt) {\n super(tx, provider);\n this.#iface = iface;\n }\n\n /**\n * The parsed logs for any [[Log]] which has a matching event in the\n * Contract ABI.\n */\n get logs(): Array {\n return super.logs.map((log) => {\n const fragment = log.topics.length ? this.#iface.getEvent(log.topics[0]): null;\n if (fragment) {\n try {\n return new EventLog(log, this.#iface, fragment)\n } catch (error: any) {\n return new UndecodedEventLog(log, error);\n }\n }\n\n return log;\n });\n }\n\n}\n\n/**\n * A **ContractTransactionResponse** will return a\n * [[ContractTransactionReceipt]] when waited on.\n */\nexport class ContractTransactionResponse extends TransactionResponse {\n readonly #iface: Interface;\n\n /**\n * @_ignore:\n */\n constructor(iface: Interface, provider: Provider, tx: TransactionResponse) {\n super(tx, provider);\n this.#iface = iface;\n }\n\n /**\n * Resolves once this transaction has been mined and has\n * %%confirms%% blocks including it (default: ``1``) with an\n * optional %%timeout%%.\n *\n * This can resolve to ``null`` only if %%confirms%% is ``0``\n * and the transaction has not been mined, otherwise this will\n * wait until enough confirmations have completed.\n */\n async wait(confirms?: number, timeout?: number): Promise {\n const receipt = await super.wait(confirms, timeout);\n if (receipt == null) { return null; }\n return new ContractTransactionReceipt(this.#iface, this.provider, receipt);\n }\n}\n\n/**\n * A **ContractUnknownEventPayload** is included as the last parameter to\n * Contract Events when the event does not match any events in the ABI.\n */\nexport class ContractUnknownEventPayload extends EventPayload {\n /**\n * The log with no matching events.\n */\n readonly log!: Log;\n\n /**\n * @_event:\n */\n constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, log: Log) {\n super(contract, listener, filter);\n defineProperties(this, { log });\n }\n\n /**\n * Resolves to the block the event occured in.\n */\n async getBlock(): Promise {\n return await this.log.getBlock();\n }\n\n /**\n * Resolves to the transaction the event occured in.\n */\n async getTransaction(): Promise {\n return await this.log.getTransaction();\n }\n\n /**\n * Resolves to the transaction receipt the event occured in.\n */\n async getTransactionReceipt(): Promise {\n return await this.log.getTransactionReceipt();\n }\n}\n\n/**\n * A **ContractEventPayload** is included as the last parameter to\n * Contract Events when the event is known.\n */\nexport class ContractEventPayload extends ContractUnknownEventPayload {\n\n /**\n * The matching event.\n */\n declare readonly fragment: EventFragment;\n\n /**\n * The log, with parsed properties.\n */\n declare readonly log: EventLog;\n\n /**\n * The parsed arguments passed to the event by ``emit``.\n */\n declare readonly args: Result;\n\n /**\n * @_ignore:\n */\n constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, fragment: EventFragment, _log: Log) {\n super(contract, listener, filter, new EventLog(_log, contract.interface, fragment));\n const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics);\n defineProperties(this, { args, fragment });\n }\n\n /**\n * The event name.\n */\n get eventName(): string {\n return this.fragment.name;\n }\n\n /**\n * The event signature.\n */\n get eventSignature(): string {\n return this.fragment.format();\n }\n}\n", "import { Interface, Typed } from \"../abi/index.js\";\nimport { isAddressable, resolveAddress } from \"../address/index.js\";\n// import from provider.ts instead of index.ts to prevent circular dep\n// from EtherscanProvider\nimport { copyRequest, Log, TransactionResponse } from \"../providers/provider.js\";\nimport {\n defineProperties, getBigInt, isCallException, isHexString, resolveProperties,\n isError, makeError, assert, assertArgument\n} from \"../utils/index.js\";\n\nimport {\n ContractEventPayload, ContractUnknownEventPayload,\n ContractTransactionResponse,\n EventLog, UndecodedEventLog\n} from \"./wrappers.js\";\n\nimport type { EventFragment, FunctionFragment, InterfaceAbi, ParamType, Result } from \"../abi/index.js\";\nimport type { Addressable, NameResolver } from \"../address/index.js\";\nimport type { EventEmitterable, Listener } from \"../utils/index.js\";\nimport type {\n BlockTag, ContractRunner, Provider, TransactionRequest, TopicFilter\n} from \"../providers/index.js\";\n\nimport type {\n BaseContractMethod,\n ContractEventName,\n ContractInterface,\n ContractMethodArgs,\n ContractMethod,\n ContractEventArgs,\n ContractEvent,\n ContractTransaction,\n DeferredTopicFilter,\n WrappedFallback\n} from \"./types.js\";\n\nconst BN_0 = BigInt(0);\n\ninterface ContractRunnerCaller extends ContractRunner {\n call: (tx: TransactionRequest) => Promise;\n}\n\ninterface ContractRunnerEstimater extends ContractRunner {\n estimateGas: (tx: TransactionRequest) => Promise;\n}\n\ninterface ContractRunnerSender extends ContractRunner {\n sendTransaction: (tx: TransactionRequest) => Promise;\n}\n\ninterface ContractRunnerResolver extends ContractRunner {\n resolveName: (name: string | Addressable) => Promise;\n}\n\nfunction canCall(value: any): value is ContractRunnerCaller {\n return (value && typeof(value.call) === \"function\");\n}\n\nfunction canEstimate(value: any): value is ContractRunnerEstimater {\n return (value && typeof(value.estimateGas) === \"function\");\n}\n\nfunction canResolve(value: any): value is ContractRunnerResolver {\n return (value && typeof(value.resolveName) === \"function\");\n}\n\nfunction canSend(value: any): value is ContractRunnerSender {\n return (value && typeof(value.sendTransaction) === \"function\");\n}\n\nfunction getResolver(value: any): undefined | NameResolver {\n if (value != null) {\n if (canResolve(value)) { return value; }\n if (value.provider) { return value.provider; }\n }\n return undefined;\n}\n\nclass PreparedTopicFilter implements DeferredTopicFilter {\n #filter: Promise;\n readonly fragment!: EventFragment;\n\n constructor(contract: BaseContract, fragment: EventFragment, args: Array) {\n defineProperties(this, { fragment });\n if (fragment.inputs.length < args.length) {\n throw new Error(\"too many arguments\");\n }\n\n // Recursively descend into args and resolve any addresses\n const runner = getRunner(contract.runner, \"resolveName\");\n const resolver = canResolve(runner) ? runner: null;\n this.#filter = (async function() {\n const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => {\n const arg = args[index];\n if (arg == null) { return null; }\n\n return param.walkAsync(args[index], (type, value) => {\n if (type === \"address\") {\n if (Array.isArray(value)) {\n return Promise.all(value.map((v) => resolveAddress(v, resolver)));\n }\n return resolveAddress(value, resolver);\n }\n return value;\n });\n }));\n\n return contract.interface.encodeFilterTopics(fragment, resolvedArgs);\n })();\n }\n\n getTopicFilter(): Promise {\n return this.#filter;\n }\n}\n\n\n// A = Arguments passed in as a tuple\n// R = The result type of the call (i.e. if only one return type,\n// the qualified type, otherwise Result)\n// D = The type the default call will return (i.e. R for view/pure,\n// TransactionResponse otherwise)\n//export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse> {\n\nfunction getRunner(value: any, feature: keyof ContractRunner): null | T {\n if (value == null) { return null; }\n if (typeof(value[feature]) === \"function\") { return value; }\n if (value.provider && typeof(value.provider[feature]) === \"function\") {\n return value.provider;\n }\n return null;\n}\n\nfunction getProvider(value: null | ContractRunner): null | Provider {\n if (value == null) { return null; }\n return value.provider || null;\n}\n\n/**\n * @_ignore:\n */\nexport async function copyOverrides(arg: any, allowed?: Array): Promise> {\n\n // Make sure the overrides passed in are a valid overrides object\n const _overrides = Typed.dereference(arg, \"overrides\");\n assertArgument(typeof(_overrides) === \"object\", \"invalid overrides parameter\", \"overrides\", arg);\n\n // Create a shallow copy (we'll deep-ify anything needed during normalizing)\n const overrides = copyRequest(_overrides);\n\n assertArgument(overrides.to == null || (allowed || [ ]).indexOf(\"to\") >= 0,\n \"cannot override to\", \"overrides.to\", overrides.to);\n assertArgument(overrides.data == null || (allowed || [ ]).indexOf(\"data\") >= 0,\n \"cannot override data\", \"overrides.data\", overrides.data);\n\n // Resolve any from\n if (overrides.from) { overrides.from = overrides.from; }\n\n return >overrides;\n}\n\n/**\n * @_ignore:\n */\nexport async function resolveArgs(_runner: null | ContractRunner, inputs: ReadonlyArray, args: Array): Promise> {\n // Recursively descend into args and resolve any addresses\n const runner = getRunner(_runner, \"resolveName\");\n const resolver = canResolve(runner) ? runner: null;\n return await Promise.all(inputs.map((param, index) => {\n return param.walkAsync(args[index], (type, value) => {\n value = Typed.dereference(value, type);\n if (type === \"address\") { return resolveAddress(value, resolver); }\n return value;\n });\n }));\n}\n\nfunction buildWrappedFallback(contract: BaseContract): WrappedFallback {\n\n const populateTransaction = async function(overrides?: Omit): Promise {\n // If an overrides was passed in, copy it and normalize the values\n\n const tx: ContractTransaction = (await copyOverrides<\"data\">(overrides, [ \"data\" ]));\n tx.to = await contract.getAddress();\n\n if (tx.from) {\n tx.from = await resolveAddress(tx.from, getResolver(contract.runner));\n }\n\n const iface = contract.interface;\n\n const noValue = (getBigInt((tx.value || BN_0), \"overrides.value\") === BN_0);\n const noData = ((tx.data || \"0x\") === \"0x\");\n\n if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) {\n assertArgument(false, \"cannot send data to receive or send value to non-payable fallback\", \"overrides\", overrides);\n }\n\n assertArgument(iface.fallback || noData,\n \"cannot send data to receive-only contract\", \"overrides.data\", tx.data);\n\n // Only allow payable contracts to set non-zero value\n const payable = iface.receive || (iface.fallback && iface.fallback.payable);\n assertArgument(payable || noValue,\n \"cannot send value to non-payable fallback\", \"overrides.value\", tx.value);\n\n // Only allow fallback contracts to set non-empty data\n assertArgument(iface.fallback || noData,\n \"cannot send data to receive-only contract\", \"overrides.data\", tx.data);\n\n return tx;\n }\n\n const staticCall = async function(overrides?: Omit): Promise {\n const runner = getRunner(contract.runner, \"call\");\n assert(canCall(runner), \"contract runner does not support calling\",\n \"UNSUPPORTED_OPERATION\", { operation: \"call\" });\n\n const tx = await populateTransaction(overrides);\n\n try {\n return await runner.call(tx);\n } catch (error: any) {\n if (isCallException(error) && error.data) {\n throw contract.interface.makeError(error.data, tx);\n }\n throw error;\n }\n }\n\n const send = async function(overrides?: Omit): Promise {\n const runner = contract.runner;\n assert(canSend(runner), \"contract runner does not support sending transactions\",\n \"UNSUPPORTED_OPERATION\", { operation: \"sendTransaction\" });\n\n const tx = await runner.sendTransaction(await populateTransaction(overrides));\n const provider = getProvider(contract.runner);\n // @TODO: the provider can be null; make a custom dummy provider that will throw a\n // meaningful error\n return new ContractTransactionResponse(contract.interface, provider, tx);\n }\n\n const estimateGas = async function(overrides?: Omit): Promise {\n const runner = getRunner(contract.runner, \"estimateGas\");\n assert(canEstimate(runner), \"contract runner does not support gas estimation\",\n \"UNSUPPORTED_OPERATION\", { operation: \"estimateGas\" });\n\n return await runner.estimateGas(await populateTransaction(overrides));\n }\n\n const method = async (overrides?: Omit) => {\n return await send(overrides);\n };\n\n defineProperties(method, {\n _contract: contract,\n\n estimateGas,\n populateTransaction,\n send, staticCall\n });\n\n return method;\n}\n\nfunction buildWrappedMethod = Array, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse>(contract: BaseContract, key: string): BaseContractMethod {\n\n const getFragment = function(...args: ContractMethodArgs): FunctionFragment {\n const fragment = contract.interface.getFunction(key, args);\n assert(fragment, \"no matching fragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n info: { key, args }\n });\n return fragment;\n }\n\n const populateTransaction = async function(...args: ContractMethodArgs): Promise {\n const fragment = getFragment(...args);\n\n // If an overrides was passed in, copy it and normalize the values\n let overrides: Omit = { };\n if (fragment.inputs.length + 1 === args.length) {\n overrides = await copyOverrides(args.pop());\n\n if (overrides.from) {\n overrides.from = await resolveAddress(overrides.from, getResolver(contract.runner));\n }\n }\n\n if (fragment.inputs.length !== args.length) {\n throw new Error(\"internal error: fragment inputs doesn't match arguments; should not happen\");\n }\n\n const resolvedArgs = await resolveArgs(contract.runner, fragment.inputs, args);\n\n return Object.assign({ }, overrides, await resolveProperties({\n to: contract.getAddress(),\n data: contract.interface.encodeFunctionData(fragment, resolvedArgs)\n }));\n }\n\n const staticCall = async function(...args: ContractMethodArgs): Promise {\n const result = await staticCallResult(...args);\n if (result.length === 1) { return result[0]; }\n return result;\n }\n\n const send = async function(...args: ContractMethodArgs): Promise {\n const runner = contract.runner;\n assert(canSend(runner), \"contract runner does not support sending transactions\",\n \"UNSUPPORTED_OPERATION\", { operation: \"sendTransaction\" });\n\n const tx = await runner.sendTransaction(await populateTransaction(...args));\n const provider = getProvider(contract.runner);\n // @TODO: the provider can be null; make a custom dummy provider that will throw a\n // meaningful error\n return new ContractTransactionResponse(contract.interface, provider, tx);\n }\n\n const estimateGas = async function(...args: ContractMethodArgs): Promise {\n const runner = getRunner(contract.runner, \"estimateGas\");\n assert(canEstimate(runner), \"contract runner does not support gas estimation\",\n \"UNSUPPORTED_OPERATION\", { operation: \"estimateGas\" });\n\n return await runner.estimateGas(await populateTransaction(...args));\n }\n\n const staticCallResult = async function(...args: ContractMethodArgs): Promise {\n const runner = getRunner(contract.runner, \"call\");\n assert(canCall(runner), \"contract runner does not support calling\",\n \"UNSUPPORTED_OPERATION\", { operation: \"call\" });\n\n const tx = await populateTransaction(...args);\n\n let result = \"0x\";\n try {\n result = await runner.call(tx);\n } catch (error: any) {\n if (isCallException(error) && error.data) {\n throw contract.interface.makeError(error.data, tx);\n }\n throw error;\n }\n\n const fragment = getFragment(...args);\n return contract.interface.decodeFunctionResult(fragment, result);\n };\n\n const method = async (...args: ContractMethodArgs) => {\n const fragment = getFragment(...args);\n if (fragment.constant) { return await staticCall(...args); }\n return await send(...args);\n };\n\n defineProperties(method, {\n name: contract.interface.getFunctionName(key),\n _contract: contract, _key: key,\n\n getFragment,\n\n estimateGas,\n populateTransaction,\n send, staticCall, staticCallResult,\n });\n\n // Only works on non-ambiguous keys (refined fragment is always non-ambiguous)\n Object.defineProperty(method, \"fragment\", {\n configurable: false,\n enumerable: true,\n get: () => {\n const fragment = contract.interface.getFunction(key);\n assert(fragment, \"no matching fragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n info: { key }\n });\n return fragment;\n }\n });\n\n return >method;\n}\n\nfunction buildWrappedEvent = Array>(contract: BaseContract, key: string): ContractEvent {\n\n const getFragment = function(...args: ContractEventArgs): EventFragment {\n const fragment = contract.interface.getEvent(key, args);\n\n assert(fragment, \"no matching fragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n info: { key, args }\n });\n\n return fragment;\n }\n\n const method = function(...args: ContractMethodArgs): PreparedTopicFilter {\n return new PreparedTopicFilter(contract, getFragment(...args), args);\n };\n\n defineProperties(method, {\n name: contract.interface.getEventName(key),\n _contract: contract, _key: key,\n\n getFragment\n });\n\n // Only works on non-ambiguous keys (refined fragment is always non-ambiguous)\n Object.defineProperty(method, \"fragment\", {\n configurable: false,\n enumerable: true,\n get: () => {\n const fragment = contract.interface.getEvent(key);\n\n assert(fragment, \"no matching fragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n info: { key }\n });\n\n return fragment;\n }\n });\n\n return >method;\n}\n\ntype Sub = {\n tag: string;\n listeners: Array<{ listener: Listener, once: boolean }>,\n start: () => void;\n stop: () => void;\n};\n\n\n// The combination of TypeScrype, Private Fields and Proxies makes\n// the world go boom; so we hide variables with some trickery keeping\n// a symbol attached to each BaseContract which its sub-class (even\n// via a Proxy) can reach and use to look up its internal values.\n\nconst internal = Symbol.for(\"_ethersInternal_contract\");\ntype Internal = {\n addrPromise: Promise;\n addr: null | string;\n\n deployTx: null | ContractTransactionResponse;\n\n subs: Map;\n};\n\nconst internalValues: WeakMap = new WeakMap();\n\nfunction setInternal(contract: BaseContract, values: Internal): void {\n internalValues.set(contract[internal], values);\n}\n\nfunction getInternal(contract: BaseContract): Internal {\n return internalValues.get(contract[internal]) as Internal;\n}\n\nfunction isDeferred(value: any): value is DeferredTopicFilter {\n return (value && typeof(value) === \"object\" && (\"getTopicFilter\" in value) &&\n (typeof(value.getTopicFilter) === \"function\") && value.fragment);\n}\n\nasync function getSubInfo(contract: BaseContract, event: ContractEventName): Promise<{ fragment: null | EventFragment, tag: string, topics: TopicFilter }> {\n let topics: Array>;\n let fragment: null | EventFragment = null;\n\n // Convert named events to topicHash and get the fragment for\n // events which need deconstructing.\n\n if (Array.isArray(event)) {\n const topicHashify = function(name: string): string {\n if (isHexString(name, 32)) { return name; }\n const fragment = contract.interface.getEvent(name);\n assertArgument(fragment, \"unknown fragment\", \"name\", name);\n return fragment.topicHash;\n }\n\n // Array of Topics and Names; e.g. `[ \"0x1234...89ab\", \"Transfer(address)\" ]`\n topics = event.map((e) => {\n if (e == null) { return null; }\n if (Array.isArray(e)) { return e.map(topicHashify); }\n return topicHashify(e);\n });\n\n } else if (event === \"*\") {\n topics = [ null ];\n\n } else if (typeof(event) === \"string\") {\n if (isHexString(event, 32)) {\n // Topic Hash\n topics = [ event ];\n } else {\n // Name or Signature; e.g. `\"Transfer\", `\"Transfer(address)\"`\n fragment = contract.interface.getEvent(event);\n assertArgument(fragment, \"unknown fragment\", \"event\", event);\n topics = [ fragment.topicHash ];\n }\n\n } else if (isDeferred(event)) {\n // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)`\n topics = await event.getTopicFilter();\n\n } else if (\"fragment\" in event) {\n // ContractEvent; e.g. `contract.filter.Transfer`\n fragment = event.fragment;\n topics = [ fragment.topicHash ];\n\n } else {\n assertArgument(false, \"unknown event name\", \"event\", event);\n }\n\n // Normalize topics and sort TopicSets\n topics = topics.map((t) => {\n if (t == null) { return null; }\n if (Array.isArray(t)) {\n const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values());\n if (items.length === 1) { return items[0]; }\n items.sort();\n return items;\n }\n return t.toLowerCase();\n });\n\n const tag = topics.map((t) => {\n if (t == null) { return \"null\"; }\n if (Array.isArray(t)) { return t.join(\"|\"); }\n return t;\n }).join(\"&\");\n\n return { fragment, tag, topics }\n}\n\nasync function hasSub(contract: BaseContract, event: ContractEventName): Promise {\n const { subs } = getInternal(contract);\n return subs.get((await getSubInfo(contract, event)).tag) || null;\n}\n\nasync function getSub(contract: BaseContract, operation: string, event: ContractEventName): Promise {\n // Make sure our runner can actually subscribe to events\n const provider = getProvider(contract.runner);\n assert(provider, \"contract runner does not support subscribing\",\n \"UNSUPPORTED_OPERATION\", { operation });\n\n const { fragment, tag, topics } = await getSubInfo(contract, event);\n\n const { addr, subs } = getInternal(contract);\n\n let sub = subs.get(tag);\n if (!sub) {\n const address: string | Addressable = (addr ? addr: contract);\n const filter = { address, topics };\n const listener = (log: Log) => {\n let foundFragment = fragment;\n if (foundFragment == null) {\n try {\n foundFragment = contract.interface.getEvent(log.topics[0]);\n } catch (error) { }\n }\n\n // If fragment is null, we do not deconstruct the args to emit\n\n if (foundFragment) {\n const _foundFragment = foundFragment;\n const args = fragment ? contract.interface.decodeEventLog(fragment, log.data, log.topics): [ ];\n emit(contract, event, args, (listener: null | Listener) => {\n return new ContractEventPayload(contract, listener, event, _foundFragment, log);\n });\n } else {\n emit(contract, event, [ ], (listener: null | Listener) => {\n return new ContractUnknownEventPayload(contract, listener, event, log);\n });\n }\n };\n\n let starting: Array> = [ ];\n const start = () => {\n if (starting.length) { return; }\n starting.push(provider.on(filter, listener));\n };\n\n const stop = async () => {\n if (starting.length == 0) { return; }\n\n let started = starting;\n starting = [ ];\n await Promise.all(started);\n provider.off(filter, listener);\n };\n\n sub = { tag, listeners: [ ], start, stop };\n subs.set(tag, sub);\n }\n return sub;\n}\n\n// We use this to ensure one emit resolves before firing the next to\n// ensure correct ordering (note this cannot throw and just adds the\n// notice to the event queu using setTimeout).\nlet lastEmit: Promise = Promise.resolve();\n\ntype PayloadFunc = (listener: null | Listener) => ContractUnknownEventPayload;\n\nasync function _emit(contract: BaseContract, event: ContractEventName, args: Array, payloadFunc: null | PayloadFunc): Promise {\n await lastEmit;\n\n const sub = await hasSub(contract, event);\n if (!sub) { return false; }\n\n const count = sub.listeners.length;\n sub.listeners = sub.listeners.filter(({ listener, once }) => {\n const passArgs = Array.from(args);\n if (payloadFunc) {\n passArgs.push(payloadFunc(once ? null: listener));\n }\n try {\n listener.call(contract, ...passArgs);\n } catch (error) { }\n return !once;\n });\n\n if (sub.listeners.length === 0) {\n sub.stop();\n getInternal(contract).subs.delete(sub.tag);\n }\n\n return (count > 0);\n}\n\nasync function emit(contract: BaseContract, event: ContractEventName, args: Array, payloadFunc: null | PayloadFunc): Promise {\n try {\n await lastEmit;\n } catch (error) { }\n\n const resultPromise = _emit(contract, event, args, payloadFunc);\n lastEmit = resultPromise;\n return await resultPromise;\n}\n\nconst passProperties = [ \"then\" ];\nexport class BaseContract implements Addressable, EventEmitterable {\n /**\n * The target to connect to.\n *\n * This can be an address, ENS name or any [[Addressable]], such as\n * another contract. To get the resovled address, use the ``getAddress``\n * method.\n */\n readonly target!: string | Addressable;\n\n /**\n * The contract Interface.\n */\n readonly interface!: Interface;\n\n /**\n * The connected runner. This is generally a [[Provider]] or a\n * [[Signer]], which dictates what operations are supported.\n *\n * For example, a **Contract** connected to a [[Provider]] may\n * only execute read-only operations.\n */\n readonly runner!: null | ContractRunner;\n\n /**\n * All the Events available on this contract.\n */\n readonly filters!: Record;\n\n /**\n * @_ignore:\n */\n readonly [internal]: any;\n\n /**\n * The fallback or receive function if any.\n */\n readonly fallback!: null | WrappedFallback;\n\n /**\n * Creates a new contract connected to %%target%% with the %%abi%% and\n * optionally connected to a %%runner%% to perform operations on behalf\n * of.\n */\n constructor(target: string | Addressable, abi: Interface | InterfaceAbi, runner?: null | ContractRunner, _deployTx?: null | TransactionResponse) {\n assertArgument(typeof(target) === \"string\" || isAddressable(target),\n \"invalid value for Contract target\", \"target\", target);\n\n if (runner == null) { runner = null; }\n const iface = Interface.from(abi);\n defineProperties(this, { target, runner, interface: iface });\n\n Object.defineProperty(this, internal, { value: { } });\n\n let addrPromise;\n let addr: null | string = null;\n\n let deployTx: null | ContractTransactionResponse = null;\n if (_deployTx) {\n const provider = getProvider(runner);\n // @TODO: the provider can be null; make a custom dummy provider that will throw a\n // meaningful error\n deployTx = new ContractTransactionResponse(this.interface, provider, _deployTx);\n }\n\n let subs = new Map();\n\n // Resolve the target as the address\n if (typeof(target) === \"string\") {\n if (isHexString(target)) {\n addr = target;\n addrPromise = Promise.resolve(target);\n\n } else {\n const resolver = getRunner(runner, \"resolveName\");\n if (!canResolve(resolver)) {\n throw makeError(\"contract runner does not support name resolution\", \"UNSUPPORTED_OPERATION\", {\n operation: \"resolveName\"\n });\n }\n\n addrPromise = resolver.resolveName(target).then((addr) => {\n if (addr == null) {\n throw makeError(\"an ENS name used for a contract target must be correctly configured\", \"UNCONFIGURED_NAME\", {\n value: target\n });\n }\n getInternal(this).addr = addr;\n return addr;\n });\n }\n } else {\n addrPromise = target.getAddress().then((addr) => {\n if (addr == null) { throw new Error(\"TODO\"); }\n getInternal(this).addr = addr;\n return addr;\n });\n }\n\n // Set our private values\n setInternal(this, { addrPromise, addr, deployTx, subs });\n\n // Add the event filters\n const filters = new Proxy({ }, {\n get: (target, prop, receiver) => {\n // Pass important checks (like `then` for Promise) through\n if (typeof(prop) === \"symbol\" || passProperties.indexOf(prop) >= 0) {\n return Reflect.get(target, prop, receiver);\n }\n\n try {\n return this.getEvent(prop);\n } catch (error) {\n if (!isError(error, \"INVALID_ARGUMENT\") || error.argument !== \"key\") {\n throw error;\n }\n }\n\n return undefined;\n },\n has: (target, prop) => {\n // Pass important checks (like `then` for Promise) through\n if (passProperties.indexOf(prop) >= 0) {\n return Reflect.has(target, prop);\n }\n\n return Reflect.has(target, prop) || this.interface.hasEvent(String(prop));\n }\n });\n defineProperties(this, { filters });\n\n defineProperties(this, {\n fallback: ((iface.receive || iface.fallback) ? (buildWrappedFallback(this)): null)\n });\n\n // Return a Proxy that will respond to functions\n return new Proxy(this, {\n get: (target, prop, receiver) => {\n if (typeof(prop) === \"symbol\" || prop in target || passProperties.indexOf(prop) >= 0) {\n return Reflect.get(target, prop, receiver);\n }\n\n // Undefined properties should return undefined\n try {\n return target.getFunction(prop);\n } catch (error) {\n if (!isError(error, \"INVALID_ARGUMENT\") || error.argument !== \"key\") {\n throw error;\n }\n }\n\n return undefined;\n },\n has: (target, prop) => {\n if (typeof(prop) === \"symbol\" || prop in target || passProperties.indexOf(prop) >= 0) {\n return Reflect.has(target, prop);\n }\n\n return target.interface.hasFunction(prop);\n }\n });\n\n }\n\n /**\n * Return a new Contract instance with the same target and ABI, but\n * a different %%runner%%.\n */\n connect(runner: null | ContractRunner): BaseContract {\n return new BaseContract(this.target, this.interface, runner);\n }\n\n /**\n * Return a new Contract instance with the same ABI and runner, but\n * a different %%target%%.\n */\n attach(target: string | Addressable): BaseContract {\n return new BaseContract(target, this.interface, this.runner);\n }\n\n /**\n * Return the resolved address of this Contract.\n */\n async getAddress(): Promise { return await getInternal(this).addrPromise; }\n\n /**\n * Return the deployed bytecode or null if no bytecode is found.\n */\n async getDeployedCode(): Promise {\n const provider = getProvider(this.runner);\n assert(provider, \"runner does not support .provider\",\n \"UNSUPPORTED_OPERATION\", { operation: \"getDeployedCode\" });\n\n const code = await provider.getCode(await this.getAddress());\n if (code === \"0x\") { return null; }\n return code;\n }\n\n /**\n * Resolve to this Contract once the bytecode has been deployed, or\n * resolve immediately if already deployed.\n */\n async waitForDeployment(): Promise {\n // We have the deployement transaction; just use that (throws if deployement fails)\n const deployTx = this.deploymentTransaction();\n if (deployTx) {\n await deployTx.wait();\n return this;\n }\n\n // Check for code\n const code = await this.getDeployedCode();\n if (code != null) { return this; }\n\n // Make sure we can subscribe to a provider event\n const provider = getProvider(this.runner);\n assert(provider != null, \"contract runner does not support .provider\",\n \"UNSUPPORTED_OPERATION\", { operation: \"waitForDeployment\" });\n\n return new Promise((resolve, reject) => {\n const checkCode = async () => {\n try {\n const code = await this.getDeployedCode();\n if (code != null) { return resolve(this); }\n provider.once(\"block\", checkCode);\n } catch (error) {\n reject(error);\n }\n };\n checkCode();\n });\n }\n\n /**\n * Return the transaction used to deploy this contract.\n *\n * This is only available if this instance was returned from a\n * [[ContractFactory]].\n */\n deploymentTransaction(): null | ContractTransactionResponse {\n return getInternal(this).deployTx;\n }\n\n /**\n * Return the function for a given name. This is useful when a contract\n * method name conflicts with a JavaScript name such as ``prototype`` or\n * when using a Contract programatically.\n */\n getFunction(key: string | FunctionFragment): T {\n if (typeof(key) !== \"string\") { key = key.format(); }\n const func = buildWrappedMethod(this, key);\n return func;\n }\n\n /**\n * Return the event for a given name. This is useful when a contract\n * event name conflicts with a JavaScript name such as ``prototype`` or\n * when using a Contract programatically.\n */\n getEvent(key: string | EventFragment): ContractEvent {\n if (typeof(key) !== \"string\") { key = key.format(); }\n return buildWrappedEvent(this, key);\n }\n\n /**\n * @_ignore:\n */\n async queryTransaction(hash: string): Promise> {\n throw new Error(\"@TODO\");\n }\n\n /*\n // @TODO: this is a non-backwards compatible change, but will be added\n // in v7 and in a potential SmartContract class in an upcoming\n // v6 release\n async getTransactionReceipt(hash: string): Promise {\n const provider = getProvider(this.runner);\n assert(provider, \"contract runner does not have a provider\",\n \"UNSUPPORTED_OPERATION\", { operation: \"queryTransaction\" });\n\n const receipt = await provider.getTransactionReceipt(hash);\n if (receipt == null) { return null; }\n\n return new ContractTransactionReceipt(this.interface, provider, receipt);\n }\n */\n\n /**\n * Provide historic access to event data for %%event%% in the range\n * %%fromBlock%% (default: ``0``) to %%toBlock%% (default: ``\"latest\"``)\n * inclusive.\n */\n async queryFilter(event: ContractEventName, fromBlock?: BlockTag, toBlock?: BlockTag): Promise> {\n if (fromBlock == null) { fromBlock = 0; }\n if (toBlock == null) { toBlock = \"latest\"; }\n const { addr, addrPromise } = getInternal(this);\n const address = (addr ? addr: (await addrPromise));\n const { fragment, topics } = await getSubInfo(this, event);\n const filter = { address, topics, fromBlock, toBlock };\n\n const provider = getProvider(this.runner);\n assert(provider, \"contract runner does not have a provider\",\n \"UNSUPPORTED_OPERATION\", { operation: \"queryFilter\" });\n\n return (await provider.getLogs(filter)).map((log) => {\n let foundFragment = fragment;\n if (foundFragment == null) {\n try {\n foundFragment = this.interface.getEvent(log.topics[0]);\n } catch (error) { }\n }\n\n if (foundFragment) {\n try {\n return new EventLog(log, this.interface, foundFragment);\n } catch (error: any) {\n return new UndecodedEventLog(log, error);\n }\n }\n\n return new Log(log, provider);\n });\n }\n\n /**\n * Add an event %%listener%% for the %%event%%.\n */\n async on(event: ContractEventName, listener: Listener): Promise {\n const sub = await getSub(this, \"on\", event);\n sub.listeners.push({ listener, once: false });\n sub.start();\n return this;\n }\n\n /**\n * Add an event %%listener%% for the %%event%%, but remove the listener\n * after it is fired once.\n */\n async once(event: ContractEventName, listener: Listener): Promise {\n const sub = await getSub(this, \"once\", event);\n sub.listeners.push({ listener, once: true });\n sub.start();\n return this;\n }\n\n /**\n * Emit an %%event%% calling all listeners with %%args%%.\n *\n * Resolves to ``true`` if any listeners were called.\n */\n async emit(event: ContractEventName, ...args: Array): Promise {\n return await emit(this, event, args, null);\n }\n\n /**\n * Resolves to the number of listeners of %%event%% or the total number\n * of listeners if unspecified.\n */\n async listenerCount(event?: ContractEventName): Promise {\n if (event) {\n const sub = await hasSub(this, event);\n if (!sub) { return 0; }\n return sub.listeners.length;\n }\n\n const { subs } = getInternal(this);\n\n let total = 0;\n for (const { listeners } of subs.values()) {\n total += listeners.length;\n }\n return total;\n }\n\n /**\n * Resolves to the listeners subscribed to %%event%% or all listeners\n * if unspecified.\n */\n async listeners(event?: ContractEventName): Promise> {\n if (event) {\n const sub = await hasSub(this, event);\n if (!sub) { return [ ]; }\n return sub.listeners.map(({ listener }) => listener);\n }\n\n const { subs } = getInternal(this);\n\n let result: Array = [ ];\n for (const { listeners } of subs.values()) {\n result = result.concat(listeners.map(({ listener }) => listener));\n }\n return result;\n }\n\n /**\n * Remove the %%listener%% from the listeners for %%event%% or remove\n * all listeners if unspecified.\n */\n async off(event: ContractEventName, listener?: Listener): Promise {\n const sub = await hasSub(this, event);\n if (!sub) { return this; }\n\n if (listener) {\n const index = sub.listeners.map(({ listener }) => listener).indexOf(listener);\n if (index >= 0) { sub.listeners.splice(index, 1); }\n }\n\n if (listener == null || sub.listeners.length === 0) {\n sub.stop();\n getInternal(this).subs.delete(sub.tag);\n }\n\n return this;\n }\n\n /**\n * Remove all the listeners for %%event%% or remove all listeners if\n * unspecified.\n */\n async removeAllListeners(event?: ContractEventName): Promise {\n if (event) {\n const sub = await hasSub(this, event);\n if (!sub) { return this; }\n sub.stop();\n getInternal(this).subs.delete(sub.tag);\n } else {\n const { subs } = getInternal(this);\n for (const { tag, stop } of subs.values()) {\n stop();\n subs.delete(tag);\n }\n }\n\n return this;\n }\n\n /**\n * Alias for [on].\n */\n async addListener(event: ContractEventName, listener: Listener): Promise {\n return await this.on(event, listener);\n }\n\n /**\n * Alias for [off].\n */\n async removeListener(event: ContractEventName, listener: Listener): Promise {\n return await this.off(event, listener);\n }\n\n /**\n * Create a new Class for the %%abi%%.\n */\n static buildClass(abi: Interface | InterfaceAbi): new (target: string, runner?: null | ContractRunner) => BaseContract & Omit {\n class CustomContract extends BaseContract {\n constructor(address: string, runner: null | ContractRunner = null) {\n super(address, abi, runner);\n }\n }\n return CustomContract as any;\n };\n\n /**\n * Create a new BaseContract with a specified Interface.\n */\n static from(target: string, abi: Interface | InterfaceAbi, runner?: null | ContractRunner): BaseContract & Omit {\n if (runner == null) { runner = null; }\n const contract = new this(target, abi, runner );\n return contract as any;\n }\n}\n\nfunction _ContractBase(): new (target: string | Addressable, abi: Interface | InterfaceAbi, runner?: null | ContractRunner) => BaseContract & Omit {\n return BaseContract as any;\n}\n\n/**\n * A [[BaseContract]] with no type guards on its methods or events.\n */\nexport class Contract extends _ContractBase() { }\n", "\nimport { Interface } from \"../abi/index.js\";\nimport { getCreateAddress } from \"../address/index.js\";\nimport {\n concat, defineProperties, getBytes, hexlify,\n assert, assertArgument\n} from \"../utils/index.js\";\n\nimport { BaseContract, copyOverrides, resolveArgs } from \"./contract.js\";\n\nimport type { InterfaceAbi } from \"../abi/index.js\";\nimport type { Addressable } from \"../address/index.js\";\nimport type { ContractRunner } from \"../providers/index.js\";\nimport type { BytesLike } from \"../utils/index.js\";\n\nimport type {\n ContractInterface, ContractMethodArgs, ContractDeployTransaction,\n} from \"./types.js\";\nimport type { ContractTransactionResponse } from \"./wrappers.js\";\n\n\n// A = Arguments to the constructor\n// I = Interface of deployed contracts\n\n/**\n * A **ContractFactory** is used to deploy a Contract to the blockchain.\n */\nexport class ContractFactory = Array, I = BaseContract> {\n\n /**\n * The Contract Interface.\n */\n readonly interface!: Interface;\n\n /**\n * The Contract deployment bytecode. Often called the initcode.\n */\n readonly bytecode!: string;\n\n /**\n * The ContractRunner to deploy the Contract as.\n */\n readonly runner!: null | ContractRunner;\n\n /**\n * Create a new **ContractFactory** with %%abi%% and %%bytecode%%,\n * optionally connected to %%runner%%.\n *\n * The %%bytecode%% may be the ``bytecode`` property within the\n * standard Solidity JSON output.\n */\n constructor(abi: Interface | InterfaceAbi, bytecode: BytesLike | { object: string }, runner?: null | ContractRunner) {\n const iface = Interface.from(abi);\n\n // Dereference Solidity bytecode objects and allow a missing `0x`-prefix\n if (bytecode instanceof Uint8Array) {\n bytecode = hexlify(getBytes(bytecode));\n } else {\n if (typeof(bytecode) === \"object\") { bytecode = bytecode.object; }\n if (!bytecode.startsWith(\"0x\")) { bytecode = \"0x\" + bytecode; }\n bytecode = hexlify(getBytes(bytecode));\n }\n\n defineProperties(this, {\n bytecode, interface: iface, runner: (runner || null)\n });\n }\n\n attach(target: string | Addressable): BaseContract & Omit {\n return new (BaseContract)(target, this.interface, this.runner);\n }\n\n /**\n * Resolves to the transaction to deploy the contract, passing %%args%%\n * into the constructor.\n */\n async getDeployTransaction(...args: ContractMethodArgs): Promise {\n let overrides: Omit = { };\n\n const fragment = this.interface.deploy;\n\n if (fragment.inputs.length + 1 === args.length) {\n overrides = await copyOverrides(args.pop());\n }\n\n if (fragment.inputs.length !== args.length) {\n throw new Error(\"incorrect number of arguments to constructor\");\n }\n\n const resolvedArgs = await resolveArgs(this.runner, fragment.inputs, args);\n\n const data = concat([ this.bytecode, this.interface.encodeDeploy(resolvedArgs) ]);\n return Object.assign({ }, overrides, { data });\n }\n\n /**\n * Resolves to the Contract deployed by passing %%args%% into the\n * constructor.\n *\n * This will resolve to the Contract before it has been deployed to the\n * network, so the [[BaseContract-waitForDeployment]] should be used before\n * sending any transactions to it.\n */\n async deploy(...args: ContractMethodArgs): Promise> {\n const tx = await this.getDeployTransaction(...args);\n\n assert(this.runner && typeof(this.runner.sendTransaction) === \"function\",\n \"factory runner does not support sending transactions\", \"UNSUPPORTED_OPERATION\", {\n operation: \"sendTransaction\" });\n\n const sentTx = await this.runner.sendTransaction(tx);\n const address = getCreateAddress(sentTx);\n return new (BaseContract)(address, this.interface, this.runner, sentTx);\n }\n\n /**\n * Return a new **ContractFactory** with the same ABI and bytecode,\n * but connected to %%runner%%.\n */\n connect(runner: null | ContractRunner): ContractFactory {\n return new ContractFactory(this.interface, this.bytecode, runner);\n }\n\n /**\n * Create a new **ContractFactory** from the standard Solidity JSON output.\n */\n static fromSolidity = Array, I = ContractInterface>(output: any, runner?: ContractRunner): ContractFactory {\n assertArgument(output != null, \"bad compiler output\", \"output\", output);\n\n if (typeof(output) === \"string\") { output = JSON.parse(output); }\n\n const abi = output.abi;\n\n let bytecode = \"\";\n if (output.bytecode) {\n bytecode = output.bytecode;\n } else if (output.evm && output.evm.bytecode) {\n bytecode = output.evm.bytecode;\n }\n\n return new this(abi, bytecode, runner);\n }\n}\n", "/**\n * ENS is a service which allows easy-to-remember names to map to\n * network addresses.\n *\n * @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver]\n */\n\nimport { getAddress } from \"../address/index.js\";\nimport { ZeroAddress } from \"../constants/index.js\";\nimport { Contract } from \"../contract/index.js\";\nimport { dnsEncode, namehash } from \"../hash/index.js\";\nimport {\n hexlify, isHexString, toBeHex,\n defineProperties, encodeBase58,\n assert, assertArgument, isError,\n FetchRequest\n} from \"../utils/index.js\";\n\nimport type { FunctionFragment } from \"../abi/index.js\";\n\nimport type { BytesLike } from \"../utils/index.js\";\n\nimport type { AbstractProvider, AbstractProviderPlugin } from \"./abstract-provider.js\";\nimport type { EnsPlugin } from \"./plugins-network.js\";\nimport type { Provider } from \"./provider.js\";\n\n// @TODO: This should use the fetch-data:ipfs gateway\n// Trim off the ipfs:// prefix and return the default gateway URL\nfunction getIpfsLink(link: string): string {\n if (link.match(/^ipfs:\\/\\/ipfs\\//i)) {\n link = link.substring(12);\n } else if (link.match(/^ipfs:\\/\\//i)) {\n link = link.substring(7);\n } else {\n assertArgument(false, \"unsupported IPFS format\", \"link\", link);\n }\n\n return `https:/\\/gateway.ipfs.io/ipfs/${ link }`;\n}\n\n/**\n * The type of data found during a steip during avatar resolution.\n */\nexport type AvatarLinkageType = \"name\" | \"avatar\" | \"!avatar\" | \"url\" | \"data\" | \"ipfs\" |\n \"erc721\" | \"erc1155\" | \"!erc721-caip\" | \"!erc1155-caip\" |\n \"!owner\" | \"owner\" | \"!balance\" | \"balance\" |\n \"metadata-url-base\" | \"metadata-url-expanded\" | \"metadata-url\" | \"!metadata-url\" |\n \"!metadata\" | \"metadata\" |\n \"!imageUrl\" | \"imageUrl-ipfs\" | \"imageUrl\" | \"!imageUrl-ipfs\";\n\n/**\n * An individual record for each step during avatar resolution.\n */\nexport interface AvatarLinkage {\n /**\n * The type of linkage.\n */\n type: AvatarLinkageType;\n\n /**\n * The linkage value.\n */\n value: string;\n};\n\n/**\n * When resolving an avatar for an ENS name, there are many\n * steps involved, fetching metadata, validating results, et cetera.\n *\n * Some applications may wish to analyse this data, or use this data\n * to diagnose promblems, so an **AvatarResult** provides details of\n * each completed step during avatar resolution.\n */\nexport interface AvatarResult {\n /**\n * How the [[url]] was arrived at, resolving the many steps required\n * for an avatar URL.\n */\n linkage: Array;\n\n /**\n * The avatar URL or null if the avatar was not set, or there was\n * an issue during validation (such as the address not owning the\n * avatar or a metadata error).\n */\n url: null | string;\n};\n\n/**\n * A provider plugin super-class for processing multicoin address types.\n */\nexport abstract class MulticoinProviderPlugin implements AbstractProviderPlugin {\n /**\n * The name.\n */\n readonly name!: string;\n\n /**\n * Creates a new **MulticoinProviderPluing** for %%name%%.\n */\n constructor(name: string) {\n defineProperties(this, { name });\n }\n\n connect(proivder: Provider): MulticoinProviderPlugin {\n return this;\n }\n\n /**\n * Returns ``true`` if %%coinType%% is supported by this plugin.\n */\n supportsCoinType(coinType: number): boolean {\n return false;\n }\n\n /**\n * Resovles to the encoded %%address%% for %%coinType%%.\n */\n async encodeAddress(coinType: number, address: string): Promise {\n throw new Error(\"unsupported coin\");\n }\n\n /**\n * Resovles to the decoded %%data%% for %%coinType%%.\n */\n async decodeAddress(coinType: number, data: BytesLike): Promise {\n throw new Error(\"unsupported coin\");\n }\n}\n\nconst BasicMulticoinPluginId = \"org.ethers.plugins.provider.BasicMulticoin\";\n\n/**\n * A **BasicMulticoinProviderPlugin** provides service for common\n * coin types, which do not require additional libraries to encode or\n * decode.\n */\nexport class BasicMulticoinProviderPlugin extends MulticoinProviderPlugin {\n /**\n * Creates a new **BasicMulticoinProviderPlugin**.\n */\n constructor() {\n super(BasicMulticoinPluginId);\n }\n}\n\nconst matcherIpfs = new RegExp(\"^(ipfs):/\\/(.*)$\", \"i\");\nconst matchers = [\n new RegExp(\"^(https):/\\/(.*)$\", \"i\"),\n new RegExp(\"^(data):(.*)$\", \"i\"),\n matcherIpfs,\n new RegExp(\"^eip155:[0-9]+/(erc[0-9]+):(.*)$\", \"i\"),\n];\n\n/**\n * A connected object to a resolved ENS name resolver, which can be\n * used to query additional details.\n */\nexport class EnsResolver {\n /**\n * The connected provider.\n */\n provider!: AbstractProvider;\n\n /**\n * The address of the resolver.\n */\n address!: string;\n\n /**\n * The name this resolver was resolved against.\n */\n name!: string;\n\n // For EIP-2544 names, the ancestor that provided the resolver\n #supports2544: null | Promise;\n\n #resolver: Contract;\n\n constructor(provider: AbstractProvider, address: string, name: string) {\n defineProperties(this, { provider, address, name });\n this.#supports2544 = null;\n\n this.#resolver = new Contract(address, [\n \"function supportsInterface(bytes4) view returns (bool)\",\n \"function resolve(bytes, bytes) view returns (bytes)\",\n \"function addr(bytes32) view returns (address)\",\n \"function addr(bytes32, uint) view returns (bytes)\",\n \"function text(bytes32, string) view returns (string)\",\n \"function contenthash(bytes32) view returns (bytes)\",\n ], provider);\n\n }\n\n /**\n * Resolves to true if the resolver supports wildcard resolution.\n */\n async supportsWildcard(): Promise {\n if (this.#supports2544 == null) {\n this.#supports2544 = (async () => {\n try {\n return await this.#resolver.supportsInterface(\"0x9061b923\");\n } catch (error) {\n // Wildcard resolvers must understand supportsInterface\n // and return true.\n if (isError(error, \"CALL_EXCEPTION\")) { return false; }\n\n // Let future attempts try again...\n this.#supports2544 = null;\n\n throw error;\n }\n })();\n }\n\n return await this.#supports2544;\n }\n\n async #fetch(funcName: string, params?: Array): Promise {\n params = (params || []).slice();\n const iface = this.#resolver.interface;\n\n // The first parameters is always the nodehash\n params.unshift(namehash(this.name))\n\n let fragment: null | FunctionFragment = null;\n if (await this.supportsWildcard()) {\n fragment = iface.getFunction(funcName);\n assert(fragment, \"missing fragment\", \"UNKNOWN_ERROR\", {\n info: { funcName }\n });\n\n params = [\n dnsEncode(this.name, 255),\n iface.encodeFunctionData(fragment, params)\n ];\n\n funcName = \"resolve(bytes,bytes)\";\n }\n\n params.push({\n enableCcipRead: true\n });\n\n try {\n const result = await this.#resolver[funcName](...params);\n\n if (fragment) {\n return iface.decodeFunctionResult(fragment, result)[0];\n }\n\n return result;\n } catch (error: any) {\n if (!isError(error, \"CALL_EXCEPTION\")) { throw error; }\n }\n\n return null;\n }\n\n /**\n * Resolves to the address for %%coinType%% or null if the\n * provided %%coinType%% has not been configured.\n */\n async getAddress(coinType?: number): Promise {\n if (coinType == null) { coinType = 60; }\n if (coinType === 60) {\n try {\n const result = await this.#fetch(\"addr(bytes32)\");\n\n // No address\n if (result == null || result === ZeroAddress) { return null; }\n\n return result;\n } catch (error: any) {\n if (isError(error, \"CALL_EXCEPTION\")) { return null; }\n throw error;\n }\n }\n\n // Try decoding its EVM canonical chain as an EVM chain address first\n if (coinType >= 0 && coinType < 0x80000000) {\n let ethCoinType = coinType + 0x80000000;\n\n const data = await this.#fetch(\"addr(bytes32,uint)\", [ ethCoinType ]);\n if (isHexString(data, 20)) { return getAddress(data); }\n }\n\n let coinPlugin: null | MulticoinProviderPlugin = null;\n for (const plugin of this.provider.plugins) {\n if (!(plugin instanceof MulticoinProviderPlugin)) { continue; }\n if (plugin.supportsCoinType(coinType)) {\n coinPlugin = plugin;\n break;\n }\n }\n\n if (coinPlugin == null) { return null; }\n\n // keccak256(\"addr(bytes32,uint256\")\n const data = await this.#fetch(\"addr(bytes32,uint)\", [ coinType ]);\n\n // No address\n if (data == null || data === \"0x\") { return null; }\n\n // Compute the address\n const address = await coinPlugin.decodeAddress(coinType, data);\n\n if (address != null) { return address; }\n\n assert(false, `invalid coin data`, \"UNSUPPORTED_OPERATION\", {\n operation: `getAddress(${ coinType })`,\n info: { coinType, data }\n });\n }\n\n /**\n * Resolves to the EIP-634 text record for %%key%%, or ``null``\n * if unconfigured.\n */\n async getText(key: string): Promise {\n const data = await this.#fetch(\"text(bytes32,string)\", [ key ]);\n if (data == null || data === \"0x\") { return null; }\n return data;\n }\n\n /**\n * Rsolves to the content-hash or ``null`` if unconfigured.\n */\n async getContentHash(): Promise {\n // keccak256(\"contenthash()\")\n const data = await this.#fetch(\"contenthash(bytes32)\");\n\n // No contenthash\n if (data == null || data === \"0x\") { return null; }\n\n // IPFS (CID: 1, Type: 70=DAG-PB, 72=libp2p-key)\n const ipfs = data.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);\n if (ipfs) {\n const scheme = (ipfs[1] === \"e3010170\") ? \"ipfs\": \"ipns\";\n const length = parseInt(ipfs[4], 16);\n if (ipfs[5].length === length * 2) {\n return `${ scheme }:/\\/${ encodeBase58(\"0x\" + ipfs[2])}`;\n }\n }\n\n // Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32)\n const swarm = data.match(/^0xe40101fa011b20([0-9a-f]*)$/)\n if (swarm && swarm[1].length === 64) {\n return `bzz:/\\/${ swarm[1] }`;\n }\n\n assert(false, `invalid or unsupported content hash data`, \"UNSUPPORTED_OPERATION\", {\n operation: \"getContentHash()\",\n info: { data }\n });\n }\n\n /**\n * Resolves to the avatar url or ``null`` if the avatar is either\n * unconfigured or incorrectly configured (e.g. references an NFT\n * not owned by the address).\n *\n * If diagnosing issues with configurations, the [[_getAvatar]]\n * method may be useful.\n */\n async getAvatar(): Promise {\n const avatar = await this._getAvatar();\n return avatar.url;\n }\n\n /**\n * When resolving an avatar, there are many steps involved, such\n * fetching metadata and possibly validating ownership of an\n * NFT.\n *\n * This method can be used to examine each step and the value it\n * was working from.\n */\n async _getAvatar(): Promise {\n const linkage: Array = [ { type: \"name\", value: this.name } ];\n try {\n // test data for ricmoo.eth\n //const avatar = \"eip155:1/erc721:0x265385c7f4132228A0d54EB1A9e7460b91c0cC68/29233\";\n const avatar = await this.getText(\"avatar\");\n if (avatar == null) {\n linkage.push({ type: \"!avatar\", value: \"\" });\n return { url: null, linkage };\n }\n linkage.push({ type: \"avatar\", value: avatar });\n\n for (let i = 0; i < matchers.length; i++) {\n const match = avatar.match(matchers[i]);\n if (match == null) { continue; }\n\n const scheme = match[1].toLowerCase();\n\n switch (scheme) {\n case \"https\":\n case \"data\":\n linkage.push({ type: \"url\", value: avatar });\n return { linkage, url: avatar };\n case \"ipfs\": {\n const url = getIpfsLink(avatar);\n linkage.push({ type: \"ipfs\", value: avatar });\n linkage.push({ type: \"url\", value: url });\n return { linkage, url };\n }\n\n case \"erc721\":\n case \"erc1155\": {\n // Depending on the ERC type, use tokenURI(uint256) or url(uint256)\n const selector = (scheme === \"erc721\") ? \"tokenURI(uint256)\": \"uri(uint256)\";\n linkage.push({ type: scheme, value: avatar });\n\n // The owner of this name\n const owner = await this.getAddress();\n if (owner == null) {\n linkage.push({ type: \"!owner\", value: \"\" });\n return { url: null, linkage };\n }\n\n const comps = (match[2] || \"\").split(\"/\");\n if (comps.length !== 2) {\n linkage.push({ type: `!${ scheme }caip`, value: (match[2] || \"\") });\n return { url: null, linkage };\n }\n\n const tokenId = comps[1];\n\n const contract = new Contract(comps[0], [\n // ERC-721\n \"function tokenURI(uint) view returns (string)\",\n \"function ownerOf(uint) view returns (address)\",\n\n // ERC-1155\n \"function uri(uint) view returns (string)\",\n \"function balanceOf(address, uint256) view returns (uint)\"\n ], this.provider);\n\n // Check that this account owns the token\n if (scheme === \"erc721\") {\n const tokenOwner = await contract.ownerOf(tokenId);\n\n if (owner !== tokenOwner) {\n linkage.push({ type: \"!owner\", value: tokenOwner });\n return { url: null, linkage };\n }\n linkage.push({ type: \"owner\", value: tokenOwner });\n\n } else if (scheme === \"erc1155\") {\n const balance = await contract.balanceOf(owner, tokenId);\n if (!balance) {\n linkage.push({ type: \"!balance\", value: \"0\" });\n return { url: null, linkage };\n }\n linkage.push({ type: \"balance\", value: balance.toString() });\n }\n\n // Call the token contract for the metadata URL\n let metadataUrl = await contract[selector](tokenId);\n if (metadataUrl == null || metadataUrl === \"0x\") {\n linkage.push({ type: \"!metadata-url\", value: \"\" });\n return { url: null, linkage };\n }\n\n linkage.push({ type: \"metadata-url-base\", value: metadataUrl });\n\n // ERC-1155 allows a generic {id} in the URL\n if (scheme === \"erc1155\") {\n metadataUrl = metadataUrl.replace(\"{id}\", toBeHex(tokenId, 32).substring(2));\n linkage.push({ type: \"metadata-url-expanded\", value: metadataUrl });\n }\n\n // Transform IPFS metadata links\n if (metadataUrl.match(/^ipfs:/i)) {\n metadataUrl = getIpfsLink(metadataUrl);\n }\n linkage.push({ type: \"metadata-url\", value: metadataUrl });\n\n // Get the token metadata\n let metadata: any = { };\n const response = await (new FetchRequest(metadataUrl)).send();\n response.assertOk();\n\n try {\n metadata = response.bodyJson;\n } catch (error) {\n try {\n linkage.push({ type: \"!metadata\", value: response.bodyText });\n } catch (error) {\n const bytes = response.body;\n if (bytes) {\n linkage.push({ type: \"!metadata\", value: hexlify(bytes) });\n }\n return { url: null, linkage };\n }\n return { url: null, linkage };\n }\n\n if (!metadata) {\n linkage.push({ type: \"!metadata\", value: \"\" });\n return { url: null, linkage };\n }\n\n linkage.push({ type: \"metadata\", value: JSON.stringify(metadata) });\n\n // Pull the image URL out\n let imageUrl = metadata.image;\n if (typeof(imageUrl) !== \"string\") {\n linkage.push({ type: \"!imageUrl\", value: \"\" });\n return { url: null, linkage };\n }\n\n if (imageUrl.match(/^(https:\\/\\/|data:)/i)) {\n // Allow\n } else {\n // Transform IPFS link to gateway\n const ipfs = imageUrl.match(matcherIpfs);\n if (ipfs == null) {\n linkage.push({ type: \"!imageUrl-ipfs\", value: imageUrl });\n return { url: null, linkage };\n }\n\n linkage.push({ type: \"imageUrl-ipfs\", value: imageUrl });\n imageUrl = getIpfsLink(imageUrl);\n }\n\n linkage.push({ type: \"url\", value: imageUrl });\n\n return { linkage, url: imageUrl };\n }\n }\n }\n } catch (error) { }\n\n return { linkage, url: null };\n }\n\n static async getEnsAddress(provider: Provider): Promise {\n const network = await provider.getNetwork();\n\n const ensPlugin = network.getPlugin(\"org.ethers.plugins.network.Ens\");\n\n // No ENS...\n assert(ensPlugin, \"network does not support ENS\", \"UNSUPPORTED_OPERATION\", {\n operation: \"getEnsAddress\", info: { network } });\n\n return ensPlugin.address;\n }\n\n static async #getResolver(provider: Provider, name: string): Promise {\n const ensAddr = await EnsResolver.getEnsAddress(provider);\n\n try {\n const contract = new Contract(ensAddr, [\n \"function resolver(bytes32) view returns (address)\"\n ], provider);\n\n const addr = await contract.resolver(namehash(name), {\n enableCcipRead: true\n });\n\n if (addr === ZeroAddress) { return null; }\n return addr;\n\n } catch (error) {\n // ENS registry cannot throw errors on resolver(bytes32),\n // so probably a link error\n throw error;\n }\n\n return null;\n }\n\n /**\n * Resolve to the ENS resolver for %%name%% using %%provider%% or\n * ``null`` if unconfigured.\n */\n static async fromName(provider: AbstractProvider, name: string): Promise {\n\n let currentName = name;\n while (true) {\n if (currentName === \"\" || currentName === \".\") { return null; }\n\n // Optimization since the eth node cannot change and does\n // not have a wildcard resolver\n if (name !== \"eth\" && currentName === \"eth\") { return null; }\n\n // Check the current node for a resolver\n const addr = await EnsResolver.#getResolver(provider, currentName);\n\n // Found a resolver!\n if (addr != null) {\n const resolver = new EnsResolver(provider, addr, name);\n\n // Legacy resolver found, using EIP-2544 so it isn't safe to use\n if (currentName !== name && !(await resolver.supportsWildcard())) { return null; }\n\n return resolver;\n }\n\n // Get the parent node\n currentName = currentName.split(\".\").slice(1).join(\".\");\n }\n }\n}\n", "/**\n * @_ignore\n */\nimport { getAddress, getCreateAddress } from \"../address/index.js\";\nimport { Signature } from \"../crypto/index.js\"\nimport { accessListify } from \"../transaction/index.js\";\nimport {\n getBigInt, getNumber, hexlify, isHexString, zeroPadValue,\n assert, assertArgument\n} from \"../utils/index.js\";\n\nimport type {\n BlockParams, LogParams,\n TransactionReceiptParams, TransactionResponseParams,\n} from \"./formatting.js\";\n\n\nconst BN_0 = BigInt(0);\n\nexport type FormatFunc = (value: any) => any;\n\nexport function allowNull(format: FormatFunc, nullValue?: any): FormatFunc {\n return (function(value: any) {\n if (value == null) { return nullValue; }\n return format(value);\n });\n}\n\nexport function arrayOf(format: FormatFunc, allowNull?: boolean): FormatFunc {\n return ((array: any) => {\n if (allowNull && array == null) { return null; }\n if (!Array.isArray(array)) { throw new Error(\"not an array\"); }\n return array.map((i) => format(i));\n });\n}\n\n// Requires an object which matches a fleet of other formatters\n// Any FormatFunc may return `undefined` to have the value omitted\n// from the result object. Calls preserve `this`.\nexport function object(format: Record, altNames?: Record>): FormatFunc {\n return ((value: any) => {\n const result: any = { };\n for (const key in format) {\n let srcKey = key;\n if (altNames && key in altNames && !(srcKey in value)) {\n for (const altKey of altNames[key]) {\n if (altKey in value) {\n srcKey = altKey;\n break;\n }\n }\n }\n\n try {\n const nv = format[key](value[srcKey]);\n if (nv !== undefined) { result[key] = nv; }\n } catch (error) {\n const message = (error instanceof Error) ? error.message: \"not-an-error\";\n assert(false, `invalid value for value.${ key } (${ message })`, \"BAD_DATA\", { value })\n }\n }\n return result;\n });\n}\n\nexport function formatBoolean(value: any): boolean {\n switch (value) {\n case true: case \"true\":\n return true;\n case false: case \"false\":\n return false;\n }\n assertArgument(false, `invalid boolean; ${ JSON.stringify(value) }`, \"value\", value);\n}\n\nexport function formatData(value: string): string {\n assertArgument(isHexString(value, true), \"invalid data\", \"value\", value);\n return value;\n}\n\nexport function formatHash(value: any): string {\n assertArgument(isHexString(value, 32), \"invalid hash\", \"value\", value);\n return value;\n}\n\nexport function formatUint256(value: any): string {\n if (!isHexString(value)) {\n throw new Error(\"invalid uint256\");\n }\n return zeroPadValue(value, 32);\n}\n\nconst _formatLog = object({\n address: getAddress,\n blockHash: formatHash,\n blockNumber: getNumber,\n data: formatData,\n index: getNumber,\n removed: allowNull(formatBoolean, false),\n topics: arrayOf(formatHash),\n transactionHash: formatHash,\n transactionIndex: getNumber,\n}, {\n index: [ \"logIndex\" ]\n});\n\nexport function formatLog(value: any): LogParams {\n return _formatLog(value);\n}\n\nconst _formatBlock = object({\n hash: allowNull(formatHash),\n parentHash: formatHash,\n parentBeaconBlockRoot: allowNull(formatHash, null),\n\n number: getNumber,\n\n timestamp: getNumber,\n nonce: allowNull(formatData),\n difficulty: getBigInt,\n\n gasLimit: getBigInt,\n gasUsed: getBigInt,\n\n stateRoot: allowNull(formatHash, null),\n receiptsRoot: allowNull(formatHash, null),\n\n blobGasUsed: allowNull(getBigInt, null),\n excessBlobGas: allowNull(getBigInt, null),\n\n miner: allowNull(getAddress),\n extraData: formatData,\n\n baseFeePerGas: allowNull(getBigInt)\n});\n\nexport function formatBlock(value: any): BlockParams {\n const result = _formatBlock(value);\n result.transactions = value.transactions.map((tx: string | TransactionResponseParams) => {\n if (typeof(tx) === \"string\") { return tx; }\n return formatTransactionResponse(tx);\n });\n return result;\n}\n\nconst _formatReceiptLog = object({\n transactionIndex: getNumber,\n blockNumber: getNumber,\n transactionHash: formatHash,\n address: getAddress,\n topics: arrayOf(formatHash),\n data: formatData,\n index: getNumber,\n blockHash: formatHash,\n}, {\n index: [ \"logIndex\" ]\n});\n\nexport function formatReceiptLog(value: any): LogParams {\n return _formatReceiptLog(value);\n}\n\nconst _formatTransactionReceipt = object({\n to: allowNull(getAddress, null),\n from: allowNull(getAddress, null),\n contractAddress: allowNull(getAddress, null),\n // should be allowNull(hash), but broken-EIP-658 support is handled in receipt\n index: getNumber,\n root: allowNull(hexlify),\n gasUsed: getBigInt,\n blobGasUsed: allowNull(getBigInt, null),\n logsBloom: allowNull(formatData),\n blockHash: formatHash,\n hash: formatHash,\n logs: arrayOf(formatReceiptLog),\n blockNumber: getNumber,\n //confirmations: allowNull(getNumber, null),\n cumulativeGasUsed: getBigInt,\n effectiveGasPrice: allowNull(getBigInt),\n blobGasPrice: allowNull(getBigInt, null),\n status: allowNull(getNumber),\n type: allowNull(getNumber, 0)\n}, {\n effectiveGasPrice: [ \"gasPrice\" ],\n hash: [ \"transactionHash\" ],\n index: [ \"transactionIndex\" ],\n});\n\nexport function formatTransactionReceipt(value: any): TransactionReceiptParams {\n return _formatTransactionReceipt(value);\n}\n\nexport function formatTransactionResponse(value: any): TransactionResponseParams {\n\n // Some clients (TestRPC) do strange things like return 0x0 for the\n // 0 address; correct this to be a real address\n if (value.to && getBigInt(value.to) === BN_0) {\n value.to = \"0x0000000000000000000000000000000000000000\";\n }\n\n const result = object({\n hash: formatHash,\n\n // Some nodes do not return this, usually test nodes (like Ganache)\n index: allowNull(getNumber, undefined),\n\n type: (value: any) => {\n if (value === \"0x\" || value == null) { return 0; }\n return getNumber(value);\n },\n accessList: allowNull(accessListify, null),\n blobVersionedHashes: allowNull(arrayOf(formatHash, true), null),\n\n blockHash: allowNull(formatHash, null),\n blockNumber: allowNull(getNumber, null),\n transactionIndex: allowNull(getNumber, null),\n\n from: getAddress,\n\n // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) must be set\n gasPrice: allowNull(getBigInt),\n maxPriorityFeePerGas: allowNull(getBigInt),\n maxFeePerGas: allowNull(getBigInt),\n maxFeePerBlobGas: allowNull(getBigInt, null),\n\n gasLimit: getBigInt,\n to: allowNull(getAddress, null),\n value: getBigInt,\n nonce: getNumber,\n data: formatData,\n\n creates: allowNull(getAddress, null),\n\n chainId: allowNull(getBigInt, null)\n }, {\n data: [ \"input\" ],\n gasLimit: [ \"gas\" ],\n index: [ \"transactionIndex\" ]\n })(value);\n\n // If to and creates are empty, populate the creates from the value\n if (result.to == null && result.creates == null) {\n result.creates = getCreateAddress(result);\n }\n\n // @TODO: Check fee data\n\n // Add an access list to supported transaction types\n if ((value.type === 1 || value.type === 2) && value.accessList == null) {\n result.accessList = [ ];\n }\n\n // Compute the signature\n if (value.signature) {\n result.signature = Signature.from(value.signature);\n } else {\n result.signature = Signature.from(value);\n }\n\n // Some backends omit ChainId on legacy transactions, but we can compute it\n if (result.chainId == null) {\n const chainId = result.signature.legacyChainId;\n if (chainId != null) { result.chainId = chainId; }\n }\n\n\n // @TODO: check chainID\n /*\n if (value.chainId != null) {\n let chainId = value.chainId;\n\n if (isHexString(chainId)) {\n chainId = BigNumber.from(chainId).toNumber();\n }\n\n result.chainId = chainId;\n\n } else {\n let chainId = value.networkId;\n\n // geth-etc returns chainId\n if (chainId == null && result.v == null) {\n chainId = value.chainId;\n }\n\n if (isHexString(chainId)) {\n chainId = BigNumber.from(chainId).toNumber();\n }\n\n if (typeof(chainId) !== \"number\" && result.v != null) {\n chainId = (result.v - 35) / 2;\n if (chainId < 0) { chainId = 0; }\n chainId = parseInt(chainId);\n }\n\n if (typeof(chainId) !== \"number\") { chainId = 0; }\n\n result.chainId = chainId;\n }\n */\n\n // 0x0000... should actually be null\n if (result.blockHash && getBigInt(result.blockHash) === BN_0) {\n result.blockHash = null;\n }\n\n return result;\n}\n", "import { defineProperties } from \"../utils/properties.js\";\n\nimport { assertArgument } from \"../utils/index.js\";\n\nimport type { FeeData, Provider } from \"./provider.js\";\nimport type { FetchRequest } from \"../utils/fetch.js\";\n\n\nconst EnsAddress = \"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e\";\n\n/**\n * A **NetworkPlugin** provides additional functionality on a [[Network]].\n */\nexport class NetworkPlugin {\n /**\n * The name of the plugin.\n *\n * It is recommended to use reverse-domain-notation, which permits\n * unique names with a known authority as well as hierarchal entries.\n */\n readonly name!: string;\n\n /**\n * Creates a new **NetworkPlugin**.\n */\n constructor(name: string) {\n defineProperties(this, { name });\n }\n\n /**\n * Creates a copy of this plugin.\n */\n clone(): NetworkPlugin {\n return new NetworkPlugin(this.name);\n }\n\n// validate(network: Network): NetworkPlugin {\n// return this;\n// }\n}\n\n\n/**\n * The gas cost parameters for a [[GasCostPlugin]].\n */\nexport type GasCostParameters = {\n /**\n * The transactions base fee.\n */\n txBase?: number;\n\n /**\n * The fee for creating a new account.\n */\n txCreate?: number;\n\n /**\n * The fee per zero-byte in the data.\n */\n txDataZero?: number;\n\n /**\n * The fee per non-zero-byte in the data.\n */\n txDataNonzero?: number;\n\n /**\n * The fee per storage key in the [[link-eip-2930]] access list.\n */\n txAccessListStorageKey?: number;\n\n /**\n * The fee per address in the [[link-eip-2930]] access list.\n */\n txAccessListAddress?: number;\n};\n\n/**\n * A **GasCostPlugin** allows a network to provide alternative values when\n * computing the intrinsic gas required for a transaction.\n */\nexport class GasCostPlugin extends NetworkPlugin implements GasCostParameters {\n /**\n * The block number to treat these values as valid from.\n *\n * This allows a hardfork to have updated values included as well as\n * mulutiple hardforks to be supported.\n */\n readonly effectiveBlock!: number;\n\n /**\n * The transactions base fee.\n */\n readonly txBase!: number;\n\n /**\n * The fee for creating a new account.\n */\n readonly txCreate!: number;\n\n /**\n * The fee per zero-byte in the data.\n */\n readonly txDataZero!: number;\n\n /**\n * The fee per non-zero-byte in the data.\n */\n readonly txDataNonzero!: number;\n\n /**\n * The fee per storage key in the [[link-eip-2930]] access list.\n */\n readonly txAccessListStorageKey!: number;\n\n /**\n * The fee per address in the [[link-eip-2930]] access list.\n */\n readonly txAccessListAddress!: number;\n\n\n /**\n * Creates a new GasCostPlugin from %%effectiveBlock%% until the\n * latest block or another GasCostPlugin supercedes that block number,\n * with the associated %%costs%%.\n */\n constructor(effectiveBlock?: number, costs?: GasCostParameters) {\n if (effectiveBlock == null) { effectiveBlock = 0; }\n super(`org.ethers.network.plugins.GasCost#${ (effectiveBlock || 0) }`);\n\n const props: Record = { effectiveBlock };\n function set(name: keyof GasCostParameters, nullish: number): void {\n let value = (costs || { })[name];\n if (value == null) { value = nullish; }\n assertArgument(typeof(value) === \"number\", `invalud value for ${ name }`, \"costs\", costs);\n props[name] = value;\n }\n\n set(\"txBase\", 21000);\n set(\"txCreate\", 32000);\n set(\"txDataZero\", 4);\n set(\"txDataNonzero\", 16);\n set(\"txAccessListStorageKey\", 1900);\n set(\"txAccessListAddress\", 2400);\n\n defineProperties(this, props);\n }\n\n clone(): GasCostPlugin {\n return new GasCostPlugin(this.effectiveBlock, this);\n }\n}\n\n/**\n * An **EnsPlugin** allows a [[Network]] to specify the ENS Registry\n * Contract address and the target network to use when using that\n * contract.\n *\n * Various testnets have their own instance of the contract to use, but\n * in general, the mainnet instance supports multi-chain addresses and\n * should be used.\n */\nexport class EnsPlugin extends NetworkPlugin {\n\n /**\n * The ENS Registrty Contract address.\n */\n readonly address!: string;\n\n /**\n * The chain ID that the ENS contract lives on.\n */\n readonly targetNetwork!: number;\n\n /**\n * Creates a new **EnsPlugin** connected to %%address%% on the\n * %%targetNetwork%%. The default ENS address and mainnet is used\n * if unspecified.\n */\n constructor(address?: null | string, targetNetwork?: null | number) {\n super(\"org.ethers.plugins.network.Ens\");\n defineProperties(this, {\n address: (address || EnsAddress),\n targetNetwork: ((targetNetwork == null) ? 1: targetNetwork)\n });\n }\n\n clone(): EnsPlugin {\n return new EnsPlugin(this.address, this.targetNetwork);\n }\n}\n\n/**\n * A **FeeDataNetworkPlugin** allows a network to provide and alternate\n * means to specify its fee data.\n *\n * For example, a network which does not support [[link-eip-1559]] may\n * choose to use a Gas Station site to approximate the gas price.\n */\nexport class FeeDataNetworkPlugin extends NetworkPlugin {\n readonly #feeDataFunc: (provider: Provider) => Promise;\n\n /**\n * The fee data function provided to the constructor.\n */\n get feeDataFunc(): (provider: Provider) => Promise {\n return this.#feeDataFunc;\n }\n\n /**\n * Creates a new **FeeDataNetworkPlugin**.\n */\n constructor(feeDataFunc: (provider: Provider) => Promise) {\n super(\"org.ethers.plugins.network.FeeData\");\n this.#feeDataFunc = feeDataFunc;\n }\n\n /**\n * Resolves to the fee data.\n */\n async getFeeData(provider: Provider): Promise {\n return await this.#feeDataFunc(provider);\n }\n\n clone(): FeeDataNetworkPlugin {\n return new FeeDataNetworkPlugin(this.#feeDataFunc);\n }\n}\n\nexport class FetchUrlFeeDataNetworkPlugin extends NetworkPlugin {\n readonly #url: string;\n readonly #processFunc: (f: () => Promise, p: Provider, r: FetchRequest) => Promise<{ gasPrice?: null | bigint, maxFeePerGas?: null | bigint, maxPriorityFeePerGas?: null | bigint }>;\n\n /**\n * The URL to initialize the FetchRequest with in %%processFunc%%.\n */\n get url(): string { return this.#url; }\n\n /**\n * The callback to use when computing the FeeData.\n */\n get processFunc(): (f: () => Promise, p: Provider, r: FetchRequest) => Promise<{ gasPrice?: null | bigint, maxFeePerGas?: null | bigint, maxPriorityFeePerGas?: null | bigint }> { return this.#processFunc; }\n\n /**\n * Creates a new **FetchUrlFeeDataNetworkPlugin** which will\n * be used when computing the fee data for the network.\n */\n constructor(url: string, processFunc: (f: () => Promise, p: Provider, r: FetchRequest) => Promise<{ gasPrice?: null | bigint, maxFeePerGas?: null | bigint, maxPriorityFeePerGas?: null | bigint }>) {\n super(\"org.ethers.plugins.network.FetchUrlFeeDataPlugin\");\n this.#url = url;\n this.#processFunc = processFunc;\n }\n\n // We are immutable, so we can serve as our own clone\n clone(): FetchUrlFeeDataNetworkPlugin { return this; }\n}\n\n/*\nexport class CustomBlockNetworkPlugin extends NetworkPlugin {\n readonly #blockFunc: (provider: Provider, block: BlockParams) => Block;\n readonly #blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block;\n\n constructor(blockFunc: (provider: Provider, block: BlockParams) => Block, blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block) {\n super(\"org.ethers.network-plugins.custom-block\");\n this.#blockFunc = blockFunc;\n this.#blockWithTxsFunc = blockWithTxsFunc;\n }\n\n async getBlock(provider: Provider, block: BlockParams): Promise> {\n return await this.#blockFunc(provider, block);\n }\n\n async getBlockions(provider: Provider, block: BlockParams): Promise> {\n return await this.#blockWithTxsFunc(provider, block);\n }\n\n clone(): CustomBlockNetworkPlugin {\n return new CustomBlockNetworkPlugin(this.#blockFunc, this.#blockWithTxsFunc);\n }\n}\n*/\n", "/**\n * A **Network** encapsulates the various properties required to\n * interact with a specific chain.\n *\n * @_subsection: api/providers:Networks [networks]\n */\n\nimport { accessListify } from \"../transaction/index.js\";\nimport { getBigInt, assert, assertArgument } from \"../utils/index.js\";\n\nimport {\n EnsPlugin, FetchUrlFeeDataNetworkPlugin, GasCostPlugin\n} from \"./plugins-network.js\";\n\nimport type { BigNumberish } from \"../utils/index.js\";\nimport type { TransactionLike } from \"../transaction/index.js\";\n\nimport type { NetworkPlugin } from \"./plugins-network.js\";\n\n\n/**\n * A Networkish can be used to allude to a Network, by specifing:\n * - a [[Network]] object\n * - a well-known (or registered) network name\n * - a well-known (or registered) chain ID\n * - an object with sufficient details to describe a network\n */\nexport type Networkish = Network | number | bigint | string | {\n name?: string,\n chainId?: number,\n //layerOneConnection?: Provider,\n ensAddress?: string,\n ensNetwork?: number\n};\n\n\n\n\n/* * * *\n// Networks which operation against an L2 can use this plugin to\n// specify how to access L1, for the purpose of resolving ENS,\n// for example.\nexport class LayerOneConnectionPlugin extends NetworkPlugin {\n readonly provider!: Provider;\n// @TODO: Rename to ChainAccess and allow for connecting to any chain\n constructor(provider: Provider) {\n super(\"org.ethers.plugins.layer-one-connection\");\n defineProperties(this, { provider });\n }\n\n clone(): LayerOneConnectionPlugin {\n return new LayerOneConnectionPlugin(this.provider);\n }\n}\n*/\n\n\nconst Networks: Map Network> = new Map();\n\n\n/**\n * A **Network** provides access to a chain's properties and allows\n * for plug-ins to extend functionality.\n */\nexport class Network {\n #name: string;\n #chainId: bigint;\n\n #plugins: Map;\n\n /**\n * Creates a new **Network** for %%name%% and %%chainId%%.\n */\n constructor(name: string, chainId: BigNumberish) {\n this.#name = name;\n this.#chainId = getBigInt(chainId);\n this.#plugins = new Map();\n }\n\n /**\n * Returns a JSON-compatible representation of a Network.\n */\n toJSON(): any {\n return { name: this.name, chainId: String(this.chainId) };\n }\n\n /**\n * The network common name.\n *\n * This is the canonical name, as networks migh have multiple\n * names.\n */\n get name(): string { return this.#name; }\n set name(value: string) { this.#name = value; }\n\n /**\n * The network chain ID.\n */\n get chainId(): bigint { return this.#chainId; }\n set chainId(value: BigNumberish) { this.#chainId = getBigInt(value, \"chainId\"); }\n\n /**\n * Returns true if %%other%% matches this network. Any chain ID\n * must match, and if no chain ID is present, the name must match.\n *\n * This method does not currently check for additional properties,\n * such as ENS address or plug-in compatibility.\n */\n matches(other: Networkish): boolean {\n if (other == null) { return false; }\n\n if (typeof(other) === \"string\") {\n try {\n return (this.chainId === getBigInt(other));\n } catch (error) { }\n return (this.name === other);\n }\n\n if (typeof(other) === \"number\" || typeof(other) === \"bigint\") {\n try {\n return (this.chainId === getBigInt(other));\n } catch (error) { }\n return false;\n }\n\n if (typeof(other) === \"object\") {\n if (other.chainId != null) {\n try {\n return (this.chainId === getBigInt(other.chainId));\n } catch (error) { }\n return false;\n }\n if (other.name != null) {\n return (this.name === other.name);\n }\n return false;\n }\n\n return false;\n }\n\n /**\n * Returns the list of plugins currently attached to this Network.\n */\n get plugins(): Array {\n return Array.from(this.#plugins.values());\n }\n\n /**\n * Attach a new %%plugin%% to this Network. The network name\n * must be unique, excluding any fragment.\n */\n attachPlugin(plugin: NetworkPlugin): this {\n if (this.#plugins.get(plugin.name)) {\n throw new Error(`cannot replace existing plugin: ${ plugin.name } `);\n }\n this.#plugins.set(plugin.name, plugin.clone());\n return this;\n }\n\n /**\n * Return the plugin, if any, matching %%name%% exactly. Plugins\n * with fragments will not be returned unless %%name%% includes\n * a fragment.\n */\n getPlugin(name: string): null | T {\n return (this.#plugins.get(name)) || null;\n }\n\n /**\n * Gets a list of all plugins that match %%name%%, with otr without\n * a fragment.\n */\n getPlugins(basename: string): Array {\n return >(this.plugins.filter((p) => (p.name.split(\"#\")[0] === basename)));\n }\n\n /**\n * Create a copy of this Network.\n */\n clone(): Network {\n const clone = new Network(this.name, this.chainId);\n this.plugins.forEach((plugin) => {\n clone.attachPlugin(plugin.clone());\n });\n return clone;\n }\n\n /**\n * Compute the intrinsic gas required for a transaction.\n *\n * A GasCostPlugin can be attached to override the default\n * values.\n */\n computeIntrinsicGas(tx: TransactionLike): number {\n const costs = this.getPlugin(\"org.ethers.plugins.network.GasCost\") || (new GasCostPlugin());\n\n let gas = costs.txBase;\n if (tx.to == null) { gas += costs.txCreate; }\n if (tx.data) {\n for (let i = 2; i < tx.data.length; i += 2) {\n if (tx.data.substring(i, i + 2) === \"00\") {\n gas += costs.txDataZero;\n } else {\n gas += costs.txDataNonzero;\n }\n }\n }\n\n if (tx.accessList) {\n const accessList = accessListify(tx.accessList);\n for (const addr in accessList) {\n gas += costs.txAccessListAddress + costs.txAccessListStorageKey * accessList[addr].storageKeys.length;\n }\n }\n\n return gas;\n }\n\n /**\n * Returns a new Network for the %%network%% name or chainId.\n */\n static from(network?: Networkish): Network {\n injectCommonNetworks();\n\n // Default network\n if (network == null) { return Network.from(\"mainnet\"); }\n\n // Canonical name or chain ID\n if (typeof(network) === \"number\") { network = BigInt(network); }\n if (typeof(network) === \"string\" || typeof(network) === \"bigint\") {\n const networkFunc = Networks.get(network);\n if (networkFunc) { return networkFunc(); }\n if (typeof(network) === \"bigint\") {\n return new Network(\"unknown\", network);\n }\n\n assertArgument(false, \"unknown network\", \"network\", network);\n }\n\n // Clonable with network-like abilities\n if (typeof((network).clone) === \"function\") {\n const clone = (network).clone();\n //if (typeof(network.name) !== \"string\" || typeof(network.chainId) !== \"number\") {\n //}\n return clone;\n }\n\n // Networkish\n if (typeof(network) === \"object\") {\n assertArgument(typeof(network.name) === \"string\" && typeof(network.chainId) === \"number\",\n \"invalid network object name or chainId\", \"network\", network);\n\n const custom = new Network((network.name), (network.chainId));\n\n if ((network).ensAddress || (network).ensNetwork != null) {\n custom.attachPlugin(new EnsPlugin((network).ensAddress, (network).ensNetwork));\n }\n\n //if ((network).layerOneConnection) {\n // custom.attachPlugin(new LayerOneConnectionPlugin((network).layerOneConnection));\n //}\n\n return custom;\n }\n\n assertArgument(false, \"invalid network\", \"network\", network);\n }\n\n /**\n * Register %%nameOrChainId%% with a function which returns\n * an instance of a Network representing that chain.\n */\n static register(nameOrChainId: string | number | bigint, networkFunc: () => Network): void {\n if (typeof(nameOrChainId) === \"number\") { nameOrChainId = BigInt(nameOrChainId); }\n const existing = Networks.get(nameOrChainId);\n if (existing) {\n assertArgument(false, `conflicting network for ${ JSON.stringify(existing.name) }`, \"nameOrChainId\", nameOrChainId);\n }\n Networks.set(nameOrChainId, networkFunc);\n }\n}\n\n\ntype Options = {\n ensNetwork?: number;\n altNames?: Array;\n plugins?: Array;\n};\n\n// We don't want to bring in formatUnits because it is backed by\n// FixedNumber and we want to keep Networks tiny. The values\n// included by the Gas Stations are also IEEE 754 with lots of\n// rounding issues and exceed the strict checks formatUnits has.\nfunction parseUnits(_value: number | string, decimals: number): bigint {\n const value = String(_value);\n if (!value.match(/^[0-9.]+$/)) {\n throw new Error(`invalid gwei value: ${ _value }`);\n }\n\n // Break into [ whole, fraction ]\n const comps = value.split(\".\");\n if (comps.length === 1) { comps.push(\"\"); }\n\n // More than 1 decimal point or too many fractional positions\n if (comps.length !== 2) {\n throw new Error(`invalid gwei value: ${ _value }`);\n }\n\n // Pad the fraction to 9 decimalplaces\n while (comps[1].length < decimals) { comps[1] += \"0\"; }\n\n // Too many decimals and some non-zero ending, take the ceiling\n if (comps[1].length > 9) {\n let frac = BigInt(comps[1].substring(0, 9));\n if (!comps[1].substring(9).match(/^0+$/)) { frac++; }\n comps[1] = frac.toString();\n }\n\n return BigInt(comps[0] + comps[1]);\n}\n\n// Used by Polygon to use a gas station for fee data\nfunction getGasStationPlugin(url: string) {\n return new FetchUrlFeeDataNetworkPlugin(url, async (fetchFeeData, provider, request) => {\n\n // Prevent Cloudflare from blocking our request in node.js\n request.setHeader(\"User-Agent\", \"ethers\");\n\n let response;\n try {\n const [ _response, _feeData ] = await Promise.all([\n request.send(), fetchFeeData()\n ]);\n response = _response;\n const payload = response.bodyJson.standard;\n const feeData = {\n gasPrice: _feeData.gasPrice,\n maxFeePerGas: parseUnits(payload.maxFee, 9),\n maxPriorityFeePerGas: parseUnits(payload.maxPriorityFee, 9),\n };\n return feeData;\n } catch (error: any) {\n assert(false, `error encountered with polygon gas station (${ JSON.stringify(request.url) })`, \"SERVER_ERROR\", { request, response, error });\n }\n });\n}\n\n// See: https://chainlist.org\nlet injected = false;\nfunction injectCommonNetworks(): void {\n if (injected) { return; }\n injected = true;\n\n /// Register popular Ethereum networks\n function registerEth(name: string, chainId: number, options: Options): void {\n const func = function() {\n const network = new Network(name, chainId);\n\n // We use 0 to disable ENS\n if (options.ensNetwork != null) {\n network.attachPlugin(new EnsPlugin(null, options.ensNetwork));\n }\n\n network.attachPlugin(new GasCostPlugin());\n\n (options.plugins || []).forEach((plugin) => {\n network.attachPlugin(plugin);\n });\n\n return network;\n };\n\n // Register the network by name and chain ID\n Network.register(name, func);\n Network.register(chainId, func);\n\n if (options.altNames) {\n options.altNames.forEach((name) => {\n Network.register(name, func);\n });\n }\n }\n\n registerEth(\"mainnet\", 1, { ensNetwork: 1, altNames: [ \"homestead\" ] });\n registerEth(\"ropsten\", 3, { ensNetwork: 3 });\n registerEth(\"rinkeby\", 4, { ensNetwork: 4 });\n registerEth(\"goerli\", 5, { ensNetwork: 5 });\n registerEth(\"kovan\", 42, { ensNetwork: 42 });\n registerEth(\"sepolia\", 11155111, { ensNetwork: 11155111 });\n registerEth(\"holesky\", 17000, { ensNetwork: 17000 });\n\n registerEth(\"classic\", 61, { });\n registerEth(\"classicKotti\", 6, { });\n\n registerEth(\"arbitrum\", 42161, {\n ensNetwork: 1,\n });\n registerEth(\"arbitrum-goerli\", 421613, { });\n registerEth(\"arbitrum-sepolia\", 421614, { });\n\n registerEth(\"base\", 8453, { ensNetwork: 1 });\n registerEth(\"base-goerli\", 84531, { });\n registerEth(\"base-sepolia\", 84532, { });\n\n registerEth(\"bnb\", 56, { ensNetwork: 1 });\n registerEth(\"bnbt\", 97, { });\n\n registerEth(\"linea\", 59144, { ensNetwork: 1 });\n registerEth(\"linea-goerli\", 59140, { });\n\n registerEth(\"matic\", 137, {\n ensNetwork: 1,\n plugins: [\n getGasStationPlugin(\"https:/\\/gasstation.polygon.technology/v2\")\n ]\n });\n registerEth(\"matic-mumbai\", 80001, {\n altNames: [ \"maticMumbai\", \"maticmum\" ], // @TODO: Future remove these alts\n plugins: [\n getGasStationPlugin(\"https:/\\/gasstation-testnet.polygon.technology/v2\")\n ]\n });\n\n registerEth(\"optimism\", 10, {\n ensNetwork: 1,\n plugins: [ ]\n });\n registerEth(\"optimism-goerli\", 420, { });\n registerEth(\"optimism-sepolia\", 11155420, { });\n\n registerEth(\"xdai\", 100, { ensNetwork: 1 });\n}\n", "import { assert, isHexString } from \"../utils/index.js\";\n\nimport type { AbstractProvider, Subscriber } from \"./abstract-provider.js\";\nimport type { EventFilter, OrphanFilter, ProviderEvent } from \"./provider.js\";\n\nfunction copy(obj: any): any {\n return JSON.parse(JSON.stringify(obj));\n}\n\n/**\n * Return the polling subscriber for common events.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport function getPollingSubscriber(provider: AbstractProvider, event: ProviderEvent): Subscriber {\n if (event === \"block\") { return new PollingBlockSubscriber(provider); }\n if (isHexString(event, 32)) { return new PollingTransactionSubscriber(provider, event); }\n\n assert(false, \"unsupported polling event\", \"UNSUPPORTED_OPERATION\", {\n operation: \"getPollingSubscriber\", info: { event }\n });\n}\n\n// @TODO: refactor this\n\n/**\n * A **PollingBlockSubscriber** polls at a regular interval for a change\n * in the block number.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingBlockSubscriber implements Subscriber {\n #provider: AbstractProvider;\n #poller: null | number;\n\n #interval: number;\n\n // The most recent block we have scanned for events. The value -2\n // indicates we still need to fetch an initial block number\n #blockNumber: number;\n\n /**\n * Create a new **PollingBlockSubscriber** attached to %%provider%%.\n */\n constructor(provider: AbstractProvider) {\n this.#provider = provider;\n this.#poller = null;\n this.#interval = 4000;\n\n this.#blockNumber = -2;\n }\n\n /**\n * The polling interval.\n */\n get pollingInterval(): number { return this.#interval; }\n set pollingInterval(value: number) { this.#interval = value; }\n\n async #poll(): Promise {\n try {\n const blockNumber = await this.#provider.getBlockNumber();\n\n // Bootstrap poll to setup our initial block number\n if (this.#blockNumber === -2) {\n this.#blockNumber = blockNumber;\n return;\n }\n\n // @TODO: Put a cap on the maximum number of events per loop?\n\n if (blockNumber !== this.#blockNumber) {\n for (let b = this.#blockNumber + 1; b <= blockNumber; b++) {\n // We have been stopped\n if (this.#poller == null) { return; }\n\n await this.#provider.emit(\"block\", b);\n }\n\n this.#blockNumber = blockNumber;\n }\n\n } catch (error) {\n // @TODO: Minor bump, add an \"error\" event to let subscribers\n // know things went awry.\n //console.log(error);\n }\n\n // We have been stopped\n if (this.#poller == null) { return; }\n\n this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval);\n }\n\n start(): void {\n if (this.#poller) { return; }\n this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval);\n this.#poll();\n }\n\n stop(): void {\n if (!this.#poller) { return; }\n this.#provider._clearTimeout(this.#poller);\n this.#poller = null;\n }\n\n pause(dropWhilePaused?: boolean): void {\n this.stop();\n if (dropWhilePaused) { this.#blockNumber = -2; }\n }\n\n resume(): void {\n this.start();\n }\n}\n\n\n/**\n * An **OnBlockSubscriber** can be sub-classed, with a [[_poll]]\n * implmentation which will be called on every new block.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class OnBlockSubscriber implements Subscriber {\n #provider: AbstractProvider;\n #poll: (b: number) => void;\n #running: boolean;\n\n /**\n * Create a new **OnBlockSubscriber** attached to %%provider%%.\n */\n constructor(provider: AbstractProvider) {\n this.#provider = provider;\n this.#running = false;\n this.#poll = (blockNumber: number) => {\n this._poll(blockNumber, this.#provider);\n }\n }\n\n /**\n * Called on every new block.\n */\n async _poll(blockNumber: number, provider: AbstractProvider): Promise {\n throw new Error(\"sub-classes must override this\");\n }\n\n start(): void {\n if (this.#running) { return; }\n this.#running = true;\n\n this.#poll(-2);\n this.#provider.on(\"block\", this.#poll);\n }\n\n stop(): void {\n if (!this.#running) { return; }\n this.#running = false;\n\n this.#provider.off(\"block\", this.#poll);\n }\n\n pause(dropWhilePaused?: boolean): void { this.stop(); }\n resume(): void { this.start(); }\n}\n\nexport class PollingBlockTagSubscriber extends OnBlockSubscriber {\n readonly #tag: string;\n #lastBlock: number;\n\n constructor(provider: AbstractProvider, tag: string) {\n super(provider);\n this.#tag = tag;\n this.#lastBlock = -2;\n }\n\n pause(dropWhilePaused?: boolean): void {\n if (dropWhilePaused) { this.#lastBlock = -2; }\n super.pause(dropWhilePaused);\n }\n\n async _poll(blockNumber: number, provider: AbstractProvider): Promise {\n const block = await provider.getBlock(this.#tag);\n if (block == null) { return; }\n\n if (this.#lastBlock === -2) {\n this.#lastBlock = block.number;\n } else if (block.number > this.#lastBlock) {\n provider.emit(this.#tag, block.number);\n this.#lastBlock = block.number;\n }\n }\n}\n\n\n/**\n * @_ignore:\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingOrphanSubscriber extends OnBlockSubscriber {\n #filter: OrphanFilter;\n\n constructor(provider: AbstractProvider, filter: OrphanFilter) {\n super(provider);\n this.#filter = copy(filter);\n }\n\n async _poll(blockNumber: number, provider: AbstractProvider): Promise {\n throw new Error(\"@TODO\");\n console.log(this.#filter);\n }\n}\n\n/**\n * A **PollingTransactionSubscriber** will poll for a given transaction\n * hash for its receipt.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingTransactionSubscriber extends OnBlockSubscriber {\n #hash: string;\n\n /**\n * Create a new **PollingTransactionSubscriber** attached to\n * %%provider%%, listening for %%hash%%.\n */\n constructor(provider: AbstractProvider, hash: string) {\n super(provider);\n this.#hash = hash;\n }\n\n async _poll(blockNumber: number, provider: AbstractProvider): Promise {\n const tx = await provider.getTransactionReceipt(this.#hash);\n if (tx) { provider.emit(this.#hash, tx); }\n }\n}\n\n/**\n * A **PollingEventSubscriber** will poll for a given filter for its logs.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class PollingEventSubscriber implements Subscriber {\n #provider: AbstractProvider;\n #filter: EventFilter;\n #poller: (b: number) => void;\n\n #running: boolean;\n\n // The most recent block we have scanned for events. The value -2\n // indicates we still need to fetch an initial block number\n #blockNumber: number;\n\n /**\n * Create a new **PollingTransactionSubscriber** attached to\n * %%provider%%, listening for %%filter%%.\n */\n constructor(provider: AbstractProvider, filter: EventFilter) {\n this.#provider = provider;\n this.#filter = copy(filter);\n this.#poller = this.#poll.bind(this);\n this.#running = false;\n this.#blockNumber = -2;\n }\n\n async #poll(blockNumber: number): Promise {\n // The initial block hasn't been determined yet\n if (this.#blockNumber === -2) { return; }\n\n const filter = copy(this.#filter);\n filter.fromBlock = this.#blockNumber + 1;\n filter.toBlock = blockNumber;\n\n const logs = await this.#provider.getLogs(filter);\n\n // No logs could just mean the node has not indexed them yet,\n // so we keep a sliding window of 60 blocks to keep scanning\n if (logs.length === 0) {\n if (this.#blockNumber < blockNumber - 60) {\n this.#blockNumber = blockNumber - 60;\n }\n return;\n }\n\n for (const log of logs) {\n this.#provider.emit(this.#filter, log);\n\n // Only advance the block number when logs were found to\n // account for networks (like BNB and Polygon) which may\n // sacrifice event consistency for block event speed\n this.#blockNumber = log.blockNumber;\n }\n }\n\n start(): void {\n if (this.#running) { return; }\n this.#running = true;\n\n if (this.#blockNumber === -2) {\n this.#provider.getBlockNumber().then((blockNumber) => {\n this.#blockNumber = blockNumber;\n });\n }\n this.#provider.on(\"block\", this.#poller);\n }\n\n stop(): void {\n if (!this.#running) { return; }\n this.#running = false;\n\n this.#provider.off(\"block\", this.#poller);\n }\n\n pause(dropWhilePaused?: boolean): void {\n this.stop();\n if (dropWhilePaused) { this.#blockNumber = -2; }\n }\n\n resume(): void {\n this.start();\n }\n}\n", "/**\n * The available providers should suffice for most developers purposes,\n * but the [[AbstractProvider]] class has many features which enable\n * sub-classing it for specific purposes.\n *\n * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider]\n */\n\n// @TODO\n// Event coalescence\n// When we register an event with an async value (e.g. address is a Signer\n// or ENS name), we need to add it immeidately for the Event API, but also\n// need time to resolve the address. Upon resolving the address, we need to\n// migrate the listener to the static event. We also need to maintain a map\n// of Signer/ENS name to address so we can sync respond to listenerCount.\n\nimport { getAddress, resolveAddress } from \"../address/index.js\";\nimport { ZeroAddress } from \"../constants/index.js\";\nimport { Contract } from \"../contract/index.js\";\nimport { namehash } from \"../hash/index.js\";\nimport { Transaction } from \"../transaction/index.js\";\nimport {\n concat, dataLength, dataSlice, hexlify, isHexString,\n getBigInt, getBytes, getNumber,\n isCallException, isError, makeError, assert, assertArgument,\n FetchRequest,\n toBeArray, toQuantity,\n defineProperties, EventPayload, resolveProperties,\n toUtf8String\n} from \"../utils/index.js\";\n\nimport { EnsResolver } from \"./ens-resolver.js\";\nimport {\n formatBlock, formatLog, formatTransactionReceipt, formatTransactionResponse\n} from \"./format.js\";\nimport { Network } from \"./network.js\";\nimport { copyRequest, Block, FeeData, Log, TransactionReceipt, TransactionResponse } from \"./provider.js\";\nimport {\n PollingBlockSubscriber, PollingBlockTagSubscriber, PollingEventSubscriber,\n PollingOrphanSubscriber, PollingTransactionSubscriber\n} from \"./subscriber-polling.js\";\n\nimport type { Addressable, AddressLike } from \"../address/index.js\";\nimport type { BigNumberish, BytesLike } from \"../utils/index.js\";\nimport type { Listener } from \"../utils/index.js\";\n\nimport type { Networkish } from \"./network.js\";\nimport type { FetchUrlFeeDataNetworkPlugin } from \"./plugins-network.js\";\n//import type { MaxPriorityFeePlugin } from \"./plugins-network.js\";\nimport type {\n BlockParams, LogParams, TransactionReceiptParams,\n TransactionResponseParams\n} from \"./formatting.js\";\n\nimport type {\n BlockTag, EventFilter, Filter, FilterByBlockHash, OrphanFilter,\n PreparedTransactionRequest, Provider, ProviderEvent,\n TransactionRequest\n} from \"./provider.js\";\n\ntype Timer = ReturnType;\n\n\n// Constants\nconst BN_2 = BigInt(2);\n\nconst MAX_CCIP_REDIRECTS = 10;\n\nfunction isPromise(value: any): value is Promise {\n return (value && typeof(value.then) === \"function\");\n}\n\nfunction getTag(prefix: string, value: any): string {\n return prefix + \":\" + JSON.stringify(value, (k, v) => {\n if (v == null) { return \"null\"; }\n if (typeof(v) === \"bigint\") { return `bigint:${ v.toString() }`}\n if (typeof(v) === \"string\") { return v.toLowerCase(); }\n\n // Sort object keys\n if (typeof(v) === \"object\" && !Array.isArray(v)) {\n const keys = Object.keys(v);\n keys.sort();\n return keys.reduce((accum, key) => {\n accum[key] = v[key];\n return accum;\n }, { });\n }\n\n return v;\n });\n}\n\n/**\n * The types of additional event values that can be emitted for the\n * ``\"debug\"`` event.\n */\nexport type DebugEventAbstractProvider = {\n action: \"sendCcipReadFetchRequest\",\n request: FetchRequest\n index: number\n urls: Array\n} | {\n action: \"receiveCcipReadFetchResult\",\n request: FetchRequest,\n result: any\n} | {\n action: \"receiveCcipReadFetchError\",\n request: FetchRequest,\n result: any\n} | {\n action: \"sendCcipReadCall\",\n transaction: { to: string, data: string }\n} | {\n action: \"receiveCcipReadCallResult\",\n transaction: { to: string, data: string }\n result: string\n} | {\n action: \"receiveCcipReadCallError\",\n transaction: { to: string, data: string }\n error: Error\n};\n\n\n/**\n * The value passed to the [[AbstractProvider-_getSubscriber]] method.\n *\n * Only developers sub-classing [[AbstractProvider[[ will care about this,\n * if they are modifying a low-level feature of how subscriptions operate.\n */\nexport type Subscription = {\n type: \"block\" | \"close\" | \"debug\" | \"error\" | \"finalized\" | \"network\" | \"pending\" | \"safe\",\n tag: string\n} | {\n type: \"transaction\",\n tag: string,\n hash: string\n} | {\n type: \"event\",\n tag: string,\n filter: EventFilter\n} | {\n type: \"orphan\",\n tag: string,\n filter: OrphanFilter\n};\n\n/**\n * A **Subscriber** manages a subscription.\n *\n * Only developers sub-classing [[AbstractProvider[[ will care about this,\n * if they are modifying a low-level feature of how subscriptions operate.\n */\nexport interface Subscriber {\n /**\n * Called initially when a subscriber is added the first time.\n */\n start(): void;\n\n /**\n * Called when there are no more subscribers to the event.\n */\n stop(): void;\n\n /**\n * Called when the subscription should pause.\n *\n * If %%dropWhilePaused%%, events that occur while paused should not\n * be emitted [[resume]].\n */\n pause(dropWhilePaused?: boolean): void;\n\n /**\n * Resume a paused subscriber.\n */\n resume(): void;\n\n /**\n * The frequency (in ms) to poll for events, if polling is used by\n * the subscriber.\n *\n * For non-polling subscribers, this must return ``undefined``.\n */\n pollingInterval?: number;\n}\n\n/**\n * An **UnmanagedSubscriber** is useful for events which do not require\n * any additional management, such as ``\"debug\"`` which only requires\n * emit in synchronous event loop triggered calls.\n */\nexport class UnmanagedSubscriber implements Subscriber {\n /**\n * The name fof the event.\n */\n name!: string;\n\n /**\n * Create a new UnmanagedSubscriber with %%name%%.\n */\n constructor(name: string) { defineProperties(this, { name }); }\n\n start(): void { }\n stop(): void { }\n\n pause(dropWhilePaused?: boolean): void { }\n resume(): void { }\n}\n\ntype Sub = {\n tag: string;\n nameMap: Map\n addressableMap: WeakMap;\n listeners: Array<{ listener: Listener, once: boolean }>;\n // @TODO: get rid of this, as it is (and has to be)\n // tracked in subscriber\n started: boolean;\n subscriber: Subscriber;\n};\n\nfunction copy(value: T): T {\n return JSON.parse(JSON.stringify(value));\n}\n\nfunction concisify(items: Array): Array {\n items = Array.from((new Set(items)).values())\n items.sort();\n return items;\n}\n\n\nasync function getSubscription(_event: ProviderEvent, provider: AbstractProvider): Promise {\n if (_event == null) { throw new Error(\"invalid event\"); }\n\n // Normalize topic array info an EventFilter\n if (Array.isArray(_event)) { _event = { topics: _event }; }\n\n if (typeof(_event) === \"string\") {\n switch (_event) {\n case \"block\":\n case \"debug\":\n case \"error\":\n case \"finalized\":\n case \"network\":\n case \"pending\":\n case \"safe\": {\n return { type: _event, tag: _event };\n }\n }\n }\n\n if (isHexString(_event, 32)) {\n const hash = _event.toLowerCase();\n return { type: \"transaction\", tag: getTag(\"tx\", { hash }), hash };\n }\n\n if ((_event).orphan) {\n const event = _event;\n // @TODO: Should lowercase and whatnot things here instead of copy...\n return { type: \"orphan\", tag: getTag(\"orphan\", event), filter: copy(event) };\n }\n\n if (((_event).address || (_event).topics)) {\n const event = _event;\n\n const filter: any = {\n topics: ((event.topics || []).map((t) => {\n if (t == null) { return null; }\n if (Array.isArray(t)) {\n return concisify(t.map((t) => t.toLowerCase()));\n }\n return t.toLowerCase();\n }))\n };\n\n if (event.address) {\n const addresses: Array = [ ];\n const promises: Array> = [ ];\n\n const addAddress = (addr: AddressLike) => {\n if (isHexString(addr)) {\n addresses.push(addr);\n } else {\n promises.push((async () => {\n addresses.push(await resolveAddress(addr, provider));\n })());\n }\n }\n\n if (Array.isArray(event.address)) {\n event.address.forEach(addAddress);\n } else {\n addAddress(event.address);\n }\n if (promises.length) { await Promise.all(promises); }\n filter.address = concisify(addresses.map((a) => a.toLowerCase()));\n }\n\n return { filter, tag: getTag(\"event\", filter), type: \"event\" };\n }\n\n assertArgument(false, \"unknown ProviderEvent\", \"event\", _event);\n}\n\nfunction getTime(): number { return (new Date()).getTime(); }\n\n/**\n * An **AbstractPlugin** is used to provide additional internal services\n * to an [[AbstractProvider]] without adding backwards-incompatible changes\n * to method signatures or other internal and complex logic.\n */\nexport interface AbstractProviderPlugin {\n /**\n * The reverse domain notation of the plugin.\n */\n readonly name: string;\n\n /**\n * Creates a new instance of the plugin, connected to %%provider%%.\n */\n connect(provider: AbstractProvider): AbstractProviderPlugin;\n}\n\n/**\n * A normalized filter used for [[PerformActionRequest]] objects.\n */\nexport type PerformActionFilter = {\n address?: string | Array;\n topics?: Array>;\n fromBlock?: BlockTag;\n toBlock?: BlockTag;\n} | {\n address?: string | Array;\n topics?: Array>;\n blockHash?: string;\n};\n\n/**\n * A normalized transactions used for [[PerformActionRequest]] objects.\n */\nexport interface PerformActionTransaction extends PreparedTransactionRequest {\n /**\n * The ``to`` address of the transaction.\n */\n to?: string;\n\n /**\n * The sender of the transaction.\n */\n from?: string;\n}\n\n/**\n * The [[AbstractProvider]] methods will normalize all values and pass this\n * type to [[AbstractProvider-_perform]].\n */\nexport type PerformActionRequest = {\n method: \"broadcastTransaction\",\n signedTransaction: string\n} | {\n method: \"call\",\n transaction: PerformActionTransaction, blockTag: BlockTag\n} | {\n method: \"chainId\"\n} | {\n method: \"estimateGas\",\n transaction: PerformActionTransaction\n} | {\n method: \"getBalance\",\n address: string, blockTag: BlockTag\n} | {\n method: \"getBlock\",\n blockTag: BlockTag, includeTransactions: boolean\n} | {\n method: \"getBlock\",\n blockHash: string, includeTransactions: boolean\n} | {\n method: \"getBlockNumber\"\n} | {\n method: \"getCode\",\n address: string, blockTag: BlockTag\n} | {\n method: \"getGasPrice\"\n} | {\n method: \"getLogs\",\n filter: PerformActionFilter\n} | {\n method: \"getPriorityFee\"\n} | {\n method: \"getStorage\",\n address: string, position: bigint, blockTag: BlockTag\n} | {\n method: \"getTransaction\",\n hash: string\n} | {\n method: \"getTransactionCount\",\n address: string, blockTag: BlockTag\n} | {\n method: \"getTransactionReceipt\",\n hash: string\n} | {\n method: \"getTransactionResult\",\n hash: string\n};\n\ntype _PerformAccountRequest = {\n method: \"getBalance\" | \"getTransactionCount\" | \"getCode\"\n} | {\n method: \"getStorage\", position: bigint\n}\n\n/**\n * Options for configuring some internal aspects of an [[AbstractProvider]].\n *\n * **``cacheTimeout``** - how long to cache a low-level ``_perform``\n * for, based on input parameters. This reduces the number of calls\n * to getChainId and getBlockNumber, but may break test chains which\n * can perform operations (internally) synchronously. Use ``-1`` to\n * disable, ``0`` will only buffer within the same event loop and\n * any other value is in ms. (default: ``250``)\n */\nexport type AbstractProviderOptions = {\n cacheTimeout?: number;\n pollingInterval?: number;\n};\n\nconst defaultOptions = {\n cacheTimeout: 250,\n pollingInterval: 4000\n};\n\ntype CcipArgs = {\n sender: string;\n urls: Array;\n calldata: string;\n selector: string;\n extraData: string;\n errorArgs: Array\n};\n\n/**\n * An **AbstractProvider** provides a base class for other sub-classes to\n * implement the [[Provider]] API by normalizing input arguments and\n * formatting output results as well as tracking events for consistent\n * behaviour on an eventually-consistent network.\n */\nexport class AbstractProvider implements Provider {\n\n #subs: Map;\n #plugins: Map;\n\n // null=unpaused, true=paused+dropWhilePaused, false=paused\n #pausedState: null | boolean;\n\n #destroyed: boolean;\n\n #networkPromise: null | Promise;\n readonly #anyNetwork: boolean;\n\n #performCache: Map>;\n\n // The most recent block number if running an event or -1 if no \"block\" event\n #lastBlockNumber: number;\n\n #nextTimer: number;\n #timers: Map void, time: number }>;\n\n #disableCcipRead: boolean;\n\n #options: Required;\n\n /**\n * Create a new **AbstractProvider** connected to %%network%%, or\n * use the various network detection capabilities to discover the\n * [[Network]] if necessary.\n */\n constructor(_network?: \"any\" | Networkish, options?: AbstractProviderOptions) {\n this.#options = Object.assign({ }, defaultOptions, options || { });\n\n if (_network === \"any\") {\n this.#anyNetwork = true;\n this.#networkPromise = null;\n } else if (_network) {\n const network = Network.from(_network);\n this.#anyNetwork = false;\n this.#networkPromise = Promise.resolve(network);\n setTimeout(() => { this.emit(\"network\", network, null); }, 0);\n } else {\n this.#anyNetwork = false;\n this.#networkPromise = null;\n }\n\n this.#lastBlockNumber = -1;\n\n this.#performCache = new Map();\n\n this.#subs = new Map();\n this.#plugins = new Map();\n this.#pausedState = null;\n\n this.#destroyed = false;\n\n this.#nextTimer = 1;\n this.#timers = new Map();\n\n this.#disableCcipRead = false;\n }\n\n get pollingInterval(): number { return this.#options.pollingInterval; }\n\n /**\n * Returns ``this``, to allow an **AbstractProvider** to implement\n * the [[ContractRunner]] interface.\n */\n get provider(): this { return this; }\n\n /**\n * Returns all the registered plug-ins.\n */\n get plugins(): Array {\n return Array.from(this.#plugins.values());\n }\n\n /**\n * Attach a new plug-in.\n */\n attachPlugin(plugin: AbstractProviderPlugin): this {\n if (this.#plugins.get(plugin.name)) {\n throw new Error(`cannot replace existing plugin: ${ plugin.name } `);\n }\n this.#plugins.set(plugin.name, plugin.connect(this));\n return this;\n }\n\n /**\n * Get a plugin by name.\n */\n getPlugin(name: string): null | T {\n return (this.#plugins.get(name)) || null;\n }\n\n /**\n * Prevent any CCIP-read operation, regardless of whether requested\n * in a [[call]] using ``enableCcipRead``.\n */\n get disableCcipRead(): boolean { return this.#disableCcipRead; }\n set disableCcipRead(value: boolean) { this.#disableCcipRead = !!value; }\n\n // Shares multiple identical requests made during the same 250ms\n async #perform(req: PerformActionRequest): Promise {\n const timeout = this.#options.cacheTimeout;\n\n // Caching disabled\n if (timeout < 0) { return await this._perform(req); }\n\n // Create a tag\n const tag = getTag(req.method, req);\n\n let perform = this.#performCache.get(tag);\n if (!perform) {\n perform = this._perform(req);\n\n this.#performCache.set(tag, perform);\n\n setTimeout(() => {\n if (this.#performCache.get(tag) === perform) {\n this.#performCache.delete(tag);\n }\n }, timeout);\n }\n\n return await perform;\n }\n\n /**\n * Resolves to the data for executing the CCIP-read operations.\n */\n async ccipReadFetch(tx: PerformActionTransaction, calldata: string, urls: Array): Promise {\n if (this.disableCcipRead || urls.length === 0 || tx.to == null) { return null; }\n\n const sender = tx.to.toLowerCase();\n const data = calldata.toLowerCase();\n\n const errorMessages: Array = [ ];\n\n for (let i = 0; i < urls.length; i++) {\n const url = urls[i];\n\n // URL expansion\n const href = url.replace(\"{sender}\", sender).replace(\"{data}\", data);\n\n // If no {data} is present, use POST; otherwise GET\n //const json: string | null = (url.indexOf(\"{data}\") >= 0) ? null: JSON.stringify({ data, sender });\n\n //const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => {\n // value.status = response.statusCode;\n // return value;\n //});\n const request = new FetchRequest(href);\n if (url.indexOf(\"{data}\") === -1) {\n request.body = { data, sender };\n }\n\n this.emit(\"debug\", { action: \"sendCcipReadFetchRequest\", request, index: i, urls });\n\n let errorMessage = \"unknown error\";\n\n const resp = await request.send();\n try {\n const result = resp.bodyJson;\n if (result.data) {\n this.emit(\"debug\", { action: \"receiveCcipReadFetchResult\", request, result });\n return result.data;\n }\n if (result.message) { errorMessage = result.message; }\n this.emit(\"debug\", { action: \"receiveCcipReadFetchError\", request, result });\n } catch (error) { }\n\n // 4xx indicates the result is not present; stop\n assert(resp.statusCode < 400 || resp.statusCode >= 500, `response not found during CCIP fetch: ${ errorMessage }`,\n \"OFFCHAIN_FAULT\", { reason: \"404_MISSING_RESOURCE\", transaction: tx, info: { url, errorMessage } });\n\n // 5xx indicates server issue; try the next url\n errorMessages.push(errorMessage);\n }\n\n assert(false, `error encountered during CCIP fetch: ${ errorMessages.map((m) => JSON.stringify(m)).join(\", \") }`, \"OFFCHAIN_FAULT\", {\n reason: \"500_SERVER_ERROR\",\n transaction: tx, info: { urls, errorMessages }\n });\n }\n\n /**\n * Provides the opportunity for a sub-class to wrap a block before\n * returning it, to add additional properties or an alternate\n * sub-class of [[Block]].\n */\n _wrapBlock(value: BlockParams, network: Network): Block {\n return new Block(formatBlock(value), this);\n }\n\n /**\n * Provides the opportunity for a sub-class to wrap a log before\n * returning it, to add additional properties or an alternate\n * sub-class of [[Log]].\n */\n _wrapLog(value: LogParams, network: Network): Log {\n return new Log(formatLog(value), this);\n }\n\n /**\n * Provides the opportunity for a sub-class to wrap a transaction\n * receipt before returning it, to add additional properties or an\n * alternate sub-class of [[TransactionReceipt]].\n */\n _wrapTransactionReceipt(value: TransactionReceiptParams, network: Network): TransactionReceipt {\n return new TransactionReceipt(formatTransactionReceipt(value), this);\n }\n\n /**\n * Provides the opportunity for a sub-class to wrap a transaction\n * response before returning it, to add additional properties or an\n * alternate sub-class of [[TransactionResponse]].\n */\n _wrapTransactionResponse(tx: TransactionResponseParams, network: Network): TransactionResponse {\n return new TransactionResponse(formatTransactionResponse(tx), this);\n }\n\n /**\n * Resolves to the Network, forcing a network detection using whatever\n * technique the sub-class requires.\n *\n * Sub-classes **must** override this.\n */\n _detectNetwork(): Promise {\n assert(false, \"sub-classes must implement this\", \"UNSUPPORTED_OPERATION\", {\n operation: \"_detectNetwork\"\n });\n }\n\n /**\n * Sub-classes should use this to perform all built-in operations. All\n * methods sanitizes and normalizes the values passed into this.\n *\n * Sub-classes **must** override this.\n */\n async _perform(req: PerformActionRequest): Promise {\n assert(false, `unsupported method: ${ req.method }`, \"UNSUPPORTED_OPERATION\", {\n operation: req.method,\n info: req\n });\n }\n\n // State\n\n async getBlockNumber(): Promise {\n const blockNumber = getNumber(await this.#perform({ method: \"getBlockNumber\" }), \"%response\");\n if (this.#lastBlockNumber >= 0) { this.#lastBlockNumber = blockNumber; }\n return blockNumber;\n }\n\n /**\n * Returns or resolves to the address for %%address%%, resolving ENS\n * names and [[Addressable]] objects and returning if already an\n * address.\n */\n _getAddress(address: AddressLike): string | Promise {\n return resolveAddress(address, this);\n }\n\n /**\n * Returns or resolves to a valid block tag for %%blockTag%%, resolving\n * negative values and returning if already a valid block tag.\n */\n _getBlockTag(blockTag?: BlockTag): string | Promise {\n if (blockTag == null) { return \"latest\"; }\n\n switch (blockTag) {\n case \"earliest\":\n return \"0x0\";\n case \"finalized\":\n case \"latest\":\n case \"pending\":\n case \"safe\":\n return blockTag;\n }\n\n\n if (isHexString(blockTag)) {\n if (isHexString(blockTag, 32)) { return blockTag; }\n return toQuantity(blockTag);\n }\n\n if (typeof(blockTag) === \"bigint\") {\n blockTag = getNumber(blockTag, \"blockTag\");\n }\n\n if (typeof(blockTag) === \"number\") {\n if (blockTag >= 0) { return toQuantity(blockTag); }\n if (this.#lastBlockNumber >= 0) { return toQuantity(this.#lastBlockNumber + blockTag); }\n return this.getBlockNumber().then((b) => toQuantity(b + blockTag));\n }\n\n assertArgument(false, \"invalid blockTag\", \"blockTag\", blockTag);\n }\n\n /**\n * Returns or resolves to a filter for %%filter%%, resolving any ENS\n * names or [[Addressable]] object and returning if already a valid\n * filter.\n */\n _getFilter(filter: Filter | FilterByBlockHash): PerformActionFilter | Promise {\n\n // Create a canonical representation of the topics\n const topics = (filter.topics || [ ]).map((t) => {\n if (t == null) { return null; }\n if (Array.isArray(t)) {\n return concisify(t.map((t) => t.toLowerCase()));\n }\n return t.toLowerCase();\n });\n\n const blockHash = (\"blockHash\" in filter) ? filter.blockHash: undefined;\n\n const resolve = (_address: Array, fromBlock?: string, toBlock?: string) => {\n let address: undefined | string | Array = undefined;\n switch (_address.length) {\n case 0: break;\n case 1:\n address = _address[0];\n break;\n default:\n _address.sort();\n address = _address;\n }\n\n if (blockHash) {\n if (fromBlock != null || toBlock != null) {\n throw new Error(\"invalid filter\");\n }\n }\n\n const filter = { };\n if (address) { filter.address = address; }\n if (topics.length) { filter.topics = topics; }\n if (fromBlock) { filter.fromBlock = fromBlock; }\n if (toBlock) { filter.toBlock = toBlock; }\n if (blockHash) { filter.blockHash = blockHash; }\n\n return filter;\n };\n\n // Addresses could be async (ENS names or Addressables)\n let address: Array> = [ ];\n if (filter.address) {\n if (Array.isArray(filter.address)) {\n for (const addr of filter.address) { address.push(this._getAddress(addr)); }\n } else {\n address.push(this._getAddress(filter.address));\n }\n }\n\n let fromBlock: undefined | string | Promise = undefined;\n if (\"fromBlock\" in filter) { fromBlock = this._getBlockTag(filter.fromBlock); }\n\n let toBlock: undefined | string | Promise = undefined;\n if (\"toBlock\" in filter) { toBlock = this._getBlockTag(filter.toBlock); }\n\n if (address.filter((a) => (typeof(a) !== \"string\")).length ||\n (fromBlock != null && typeof(fromBlock) !== \"string\") ||\n (toBlock != null && typeof(toBlock) !== \"string\")) {\n\n return Promise.all([ Promise.all(address), fromBlock, toBlock ]).then((result) => {\n return resolve(result[0], result[1], result[2]);\n });\n }\n\n return resolve(>address, fromBlock, toBlock);\n }\n\n /**\n * Returns or resovles to a transaction for %%request%%, resolving\n * any ENS names or [[Addressable]] and returning if already a valid\n * transaction.\n */\n _getTransactionRequest(_request: TransactionRequest): PerformActionTransaction | Promise {\n const request = copyRequest(_request);\n\n const promises: Array> = [ ];\n [ \"to\", \"from\" ].forEach((key) => {\n if ((request)[key] == null) { return; }\n\n const addr = resolveAddress((request)[key], this);\n if (isPromise(addr)) {\n promises.push((async function() { (request)[key] = await addr; })());\n } else {\n (request)[key] = addr;\n }\n });\n\n if (request.blockTag != null) {\n const blockTag = this._getBlockTag(request.blockTag);\n if (isPromise(blockTag)) {\n promises.push((async function() { request.blockTag = await blockTag; })());\n } else {\n request.blockTag = blockTag;\n }\n }\n\n if (promises.length) {\n return (async function() {\n await Promise.all(promises);\n return request;\n })();\n }\n\n return request;\n }\n\n async getNetwork(): Promise {\n\n // No explicit network was set and this is our first time\n if (this.#networkPromise == null) {\n\n // Detect the current network (shared with all calls)\n const detectNetwork = (async () => {\n try {\n const network = await this._detectNetwork();\n this.emit(\"network\", network, null);\n return network;\n } catch (error) {\n if (this.#networkPromise === detectNetwork!) {\n this.#networkPromise = null;\n }\n throw error;\n }\n })();\n\n this.#networkPromise = detectNetwork;\n return (await detectNetwork).clone();\n }\n\n const networkPromise = this.#networkPromise;\n\n const [ expected, actual ] = await Promise.all([\n networkPromise, // Possibly an explicit Network\n this._detectNetwork() // The actual connected network\n ]);\n\n if (expected.chainId !== actual.chainId) {\n if (this.#anyNetwork) {\n // The \"any\" network can change, so notify listeners\n this.emit(\"network\", actual, expected);\n\n // Update the network if something else hasn't already changed it\n if (this.#networkPromise === networkPromise) {\n this.#networkPromise = Promise.resolve(actual);\n }\n } else {\n // Otherwise, we do not allow changes to the underlying network\n assert(false, `network changed: ${ expected.chainId } => ${ actual.chainId } `, \"NETWORK_ERROR\", {\n event: \"changed\"\n });\n }\n }\n\n return expected.clone();\n }\n\n async getFeeData(): Promise {\n const network = await this.getNetwork();\n\n const getFeeDataFunc = async () => {\n const { _block, gasPrice, priorityFee } = await resolveProperties({\n _block: this.#getBlock(\"latest\", false),\n gasPrice: ((async () => {\n try {\n const value = await this.#perform({ method: \"getGasPrice\" });\n return getBigInt(value, \"%response\");\n } catch (error) { }\n return null\n })()),\n priorityFee: ((async () => {\n try {\n const value = await this.#perform({ method: \"getPriorityFee\" });\n return getBigInt(value, \"%response\");\n } catch (error) { }\n return null;\n })())\n });\n\n let maxFeePerGas: null | bigint = null;\n let maxPriorityFeePerGas: null | bigint = null;\n\n // These are the recommended EIP-1559 heuristics for fee data\n const block = this._wrapBlock(_block, network);\n if (block && block.baseFeePerGas) {\n maxPriorityFeePerGas = (priorityFee != null) ? priorityFee: BigInt(\"1000000000\");\n maxFeePerGas = (block.baseFeePerGas * BN_2) + maxPriorityFeePerGas;\n }\n\n return new FeeData(gasPrice, maxFeePerGas, maxPriorityFeePerGas);\n };\n\n // Check for a FeeDataNetWorkPlugin\n const plugin = network.getPlugin(\"org.ethers.plugins.network.FetchUrlFeeDataPlugin\");\n if (plugin) {\n const req = new FetchRequest(plugin.url);\n const feeData = await plugin.processFunc(getFeeDataFunc, this, req);\n return new FeeData(feeData.gasPrice, feeData.maxFeePerGas, feeData.maxPriorityFeePerGas);\n }\n\n return await getFeeDataFunc();\n }\n\n\n async estimateGas(_tx: TransactionRequest): Promise {\n let tx = this._getTransactionRequest(_tx);\n if (isPromise(tx)) { tx = await tx; }\n return getBigInt(await this.#perform({\n method: \"estimateGas\", transaction: tx\n }), \"%response\");\n }\n\n async #call(tx: PerformActionTransaction, blockTag: string, attempt: number): Promise {\n assert (attempt < MAX_CCIP_REDIRECTS, \"CCIP read exceeded maximum redirections\", \"OFFCHAIN_FAULT\", {\n reason: \"TOO_MANY_REDIRECTS\",\n transaction: Object.assign({ }, tx, { blockTag, enableCcipRead: true })\n });\n\n // This came in as a PerformActionTransaction, so to/from are safe; we can cast\n const transaction = copyRequest(tx);\n\n try {\n return hexlify(await this._perform({ method: \"call\", transaction, blockTag }));\n\n } catch (error: any) {\n // CCIP Read OffchainLookup\n if (!this.disableCcipRead && isCallException(error) && error.data && attempt >= 0 && blockTag === \"latest\" && transaction.to != null && dataSlice(error.data, 0, 4) === \"0x556f1830\") {\n const data = error.data;\n\n const txSender = await resolveAddress(transaction.to, this);\n\n // Parse the CCIP Read Arguments\n let ccipArgs: CcipArgs;\n try {\n ccipArgs = parseOffchainLookup(dataSlice(error.data, 4));\n } catch (error: any) {\n assert(false, error.message, \"OFFCHAIN_FAULT\", {\n reason: \"BAD_DATA\", transaction, info: { data } });\n }\n\n // Check the sender of the OffchainLookup matches the transaction\n assert(ccipArgs.sender.toLowerCase() === txSender.toLowerCase(),\n \"CCIP Read sender mismatch\", \"CALL_EXCEPTION\", {\n action: \"call\",\n data,\n reason: \"OffchainLookup\",\n transaction: transaction, // @TODO: populate data?\n invocation: null,\n revert: {\n signature: \"OffchainLookup(address,string[],bytes,bytes4,bytes)\",\n name: \"OffchainLookup\",\n args: ccipArgs.errorArgs\n }\n });\n\n const ccipResult = await this.ccipReadFetch(transaction, ccipArgs.calldata, ccipArgs.urls);\n assert(ccipResult != null, \"CCIP Read failed to fetch data\", \"OFFCHAIN_FAULT\", {\n reason: \"FETCH_FAILED\", transaction, info: { data: error.data, errorArgs: ccipArgs.errorArgs } });\n\n const tx = {\n to: txSender,\n data: concat([ ccipArgs.selector, encodeBytes([ ccipResult, ccipArgs.extraData ]) ])\n };\n\n this.emit(\"debug\", { action: \"sendCcipReadCall\", transaction: tx });\n try {\n const result = await this.#call(tx, blockTag, attempt + 1);\n this.emit(\"debug\", { action: \"receiveCcipReadCallResult\", transaction: Object.assign({ }, tx), result });\n return result;\n } catch (error) {\n this.emit(\"debug\", { action: \"receiveCcipReadCallError\", transaction: Object.assign({ }, tx), error });\n throw error;\n }\n }\n\n throw error;\n }\n }\n\n async #checkNetwork(promise: Promise): Promise {\n const { value } = await resolveProperties({\n network: this.getNetwork(),\n value: promise\n });\n return value;\n }\n\n async call(_tx: TransactionRequest): Promise {\n const { tx, blockTag } = await resolveProperties({\n tx: this._getTransactionRequest(_tx),\n blockTag: this._getBlockTag(_tx.blockTag)\n });\n\n return await this.#checkNetwork(this.#call(tx, blockTag, _tx.enableCcipRead ? 0: -1));\n }\n\n // Account\n async #getAccountValue(request: _PerformAccountRequest, _address: AddressLike, _blockTag?: BlockTag): Promise {\n let address: string | Promise = this._getAddress(_address);\n let blockTag: string | Promise = this._getBlockTag(_blockTag);\n\n if (typeof(address) !== \"string\" || typeof(blockTag) !== \"string\") {\n [ address, blockTag ] = await Promise.all([ address, blockTag ]);\n }\n\n return await this.#checkNetwork(this.#perform(Object.assign(request, { address, blockTag })));\n }\n\n async getBalance(address: AddressLike, blockTag?: BlockTag): Promise {\n return getBigInt(await this.#getAccountValue({ method: \"getBalance\" }, address, blockTag), \"%response\");\n }\n\n async getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise {\n return getNumber(await this.#getAccountValue({ method: \"getTransactionCount\" }, address, blockTag), \"%response\");\n }\n\n async getCode(address: AddressLike, blockTag?: BlockTag): Promise {\n return hexlify(await this.#getAccountValue({ method: \"getCode\" }, address, blockTag));\n }\n\n async getStorage(address: AddressLike, _position: BigNumberish, blockTag?: BlockTag): Promise {\n const position = getBigInt(_position, \"position\");\n return hexlify(await this.#getAccountValue({ method: \"getStorage\", position }, address, blockTag));\n }\n\n // Write\n async broadcastTransaction(signedTx: string): Promise {\n const { blockNumber, hash, network } = await resolveProperties({\n blockNumber: this.getBlockNumber(),\n hash: this._perform({\n method: \"broadcastTransaction\",\n signedTransaction: signedTx\n }),\n network: this.getNetwork()\n });\n\n const tx = Transaction.from(signedTx);\n if (tx.hash !== hash) {\n throw new Error(\"@TODO: the returned hash did not match\");\n }\n\n return this._wrapTransactionResponse(tx, network).replaceableTransaction(blockNumber);\n }\n\n async #getBlock(block: BlockTag | string, includeTransactions: boolean): Promise {\n // @TODO: Add CustomBlockPlugin check\n\n if (isHexString(block, 32)) {\n return await this.#perform({\n method: \"getBlock\", blockHash: block, includeTransactions\n });\n }\n\n let blockTag = this._getBlockTag(block);\n if (typeof(blockTag) !== \"string\") { blockTag = await blockTag; }\n\n return await this.#perform({\n method: \"getBlock\", blockTag, includeTransactions\n });\n }\n\n // Queries\n async getBlock(block: BlockTag | string, prefetchTxs?: boolean): Promise {\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#getBlock(block, !!prefetchTxs)\n });\n if (params == null) { return null; }\n\n return this._wrapBlock(params, network);\n }\n\n async getTransaction(hash: string): Promise {\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#perform({ method: \"getTransaction\", hash })\n });\n if (params == null) { return null; }\n\n return this._wrapTransactionResponse(params, network);\n }\n\n async getTransactionReceipt(hash: string): Promise {\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#perform({ method: \"getTransactionReceipt\", hash })\n });\n if (params == null) { return null; }\n\n // Some backends did not backfill the effectiveGasPrice into old transactions\n // in the receipt, so we look it up manually and inject it.\n if (params.gasPrice == null && params.effectiveGasPrice == null) {\n const tx = await this.#perform({ method: \"getTransaction\", hash });\n if (tx == null) { throw new Error(\"report this; could not find tx or effectiveGasPrice\"); }\n params.effectiveGasPrice = tx.gasPrice;\n }\n\n return this._wrapTransactionReceipt(params, network);\n }\n\n async getTransactionResult(hash: string): Promise {\n const { result } = await resolveProperties({\n network: this.getNetwork(),\n result: this.#perform({ method: \"getTransactionResult\", hash })\n });\n if (result == null) { return null; }\n return hexlify(result);\n }\n\n // Bloom-filter Queries\n async getLogs(_filter: Filter | FilterByBlockHash): Promise> {\n let filter = this._getFilter(_filter);\n if (isPromise(filter)) { filter = await filter; }\n\n const { network, params } = await resolveProperties({\n network: this.getNetwork(),\n params: this.#perform>({ method: \"getLogs\", filter })\n });\n\n return params.map((p) => this._wrapLog(p, network));\n }\n\n // ENS\n _getProvider(chainId: number): AbstractProvider {\n assert(false, \"provider cannot connect to target network\", \"UNSUPPORTED_OPERATION\", {\n operation: \"_getProvider()\"\n });\n }\n\n async getResolver(name: string): Promise {\n return await EnsResolver.fromName(this, name);\n }\n\n async getAvatar(name: string): Promise {\n const resolver = await this.getResolver(name);\n if (resolver) { return await resolver.getAvatar(); }\n return null;\n }\n\n async resolveName(name: string): Promise{\n const resolver = await this.getResolver(name);\n if (resolver) { return await resolver.getAddress(); }\n return null;\n }\n\n async lookupAddress(address: string): Promise {\n address = getAddress(address);\n const node = namehash(address.substring(2).toLowerCase() + \".addr.reverse\");\n\n try {\n\n const ensAddr = await EnsResolver.getEnsAddress(this);\n const ensContract = new Contract(ensAddr, [\n \"function resolver(bytes32) view returns (address)\"\n ], this);\n\n const resolver = await ensContract.resolver(node);\n if (resolver == null || resolver === ZeroAddress) { return null; }\n\n const resolverContract = new Contract(resolver, [\n \"function name(bytes32) view returns (string)\"\n ], this);\n const name = await resolverContract.name(node);\n\n // Failed forward resolution\n const check = await this.resolveName(name);\n if (check !== address) { return null; }\n\n return name;\n\n } catch (error) {\n // No data was returned from the resolver\n if (isError(error, \"BAD_DATA\") && error.value === \"0x\") {\n return null;\n }\n\n // Something reerted\n if (isError(error, \"CALL_EXCEPTION\")) { return null; }\n\n throw error;\n }\n\n return null;\n }\n\n async waitForTransaction(hash: string, _confirms?: null | number, timeout?: null | number): Promise {\n const confirms = (_confirms != null) ? _confirms: 1;\n if (confirms === 0) { return this.getTransactionReceipt(hash); }\n\n return new Promise(async (resolve, reject) => {\n let timer: null | Timer = null;\n\n const listener = (async (blockNumber: number) => {\n try {\n const receipt = await this.getTransactionReceipt(hash);\n if (receipt != null) {\n if (blockNumber - receipt.blockNumber + 1 >= confirms) {\n resolve(receipt);\n //this.off(\"block\", listener);\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n return;\n }\n }\n } catch (error) {\n console.log(\"EEE\", error);\n }\n this.once(\"block\", listener);\n });\n\n if (timeout != null) {\n timer = setTimeout(() => {\n if (timer == null) { return; }\n timer = null;\n this.off(\"block\", listener);\n reject(makeError(\"timeout\", \"TIMEOUT\", { reason: \"timeout\" }));\n }, timeout);\n }\n\n listener(await this.getBlockNumber());\n });\n }\n\n async waitForBlock(blockTag?: BlockTag): Promise {\n assert(false, \"not implemented yet\", \"NOT_IMPLEMENTED\", {\n operation: \"waitForBlock\"\n });\n }\n\n /**\n * Clear a timer created using the [[_setTimeout]] method.\n */\n _clearTimeout(timerId: number): void {\n const timer = this.#timers.get(timerId);\n if (!timer) { return; }\n if (timer.timer) { clearTimeout(timer.timer); }\n this.#timers.delete(timerId);\n }\n\n /**\n * Create a timer that will execute %%func%% after at least %%timeout%%\n * (in ms). If %%timeout%% is unspecified, then %%func%% will execute\n * in the next event loop.\n *\n * [Pausing](AbstractProvider-paused) the provider will pause any\n * associated timers.\n */\n _setTimeout(_func: () => void, timeout?: number): number {\n if (timeout == null) { timeout = 0; }\n const timerId = this.#nextTimer++;\n const func = () => {\n this.#timers.delete(timerId);\n _func();\n };\n\n if (this.paused) {\n this.#timers.set(timerId, { timer: null, func, time: timeout });\n } else {\n const timer = setTimeout(func, timeout);\n this.#timers.set(timerId, { timer, func, time: getTime() });\n }\n\n return timerId;\n }\n\n /**\n * Perform %%func%% on each subscriber.\n */\n _forEachSubscriber(func: (s: Subscriber) => void): void {\n for (const sub of this.#subs.values()) {\n func(sub.subscriber);\n }\n }\n\n /**\n * Sub-classes may override this to customize subscription\n * implementations.\n */\n _getSubscriber(sub: Subscription): Subscriber {\n switch (sub.type) {\n case \"debug\":\n case \"error\":\n case \"network\":\n return new UnmanagedSubscriber(sub.type);\n case \"block\": {\n const subscriber = new PollingBlockSubscriber(this);\n subscriber.pollingInterval = this.pollingInterval;\n return subscriber;\n }\n case \"safe\": case \"finalized\":\n return new PollingBlockTagSubscriber(this, sub.type);\n case \"event\":\n return new PollingEventSubscriber(this, sub.filter);\n case \"transaction\":\n return new PollingTransactionSubscriber(this, sub.hash);\n case \"orphan\":\n return new PollingOrphanSubscriber(this, sub.filter);\n }\n\n throw new Error(`unsupported event: ${ sub.type }`);\n }\n\n /**\n * If a [[Subscriber]] fails and needs to replace itself, this\n * method may be used.\n *\n * For example, this is used for providers when using the\n * ``eth_getFilterChanges`` method, which can return null if state\n * filters are not supported by the backend, allowing the Subscriber\n * to swap in a [[PollingEventSubscriber]].\n */\n _recoverSubscriber(oldSub: Subscriber, newSub: Subscriber): void {\n for (const sub of this.#subs.values()) {\n if (sub.subscriber === oldSub) {\n if (sub.started) { sub.subscriber.stop(); }\n sub.subscriber = newSub;\n if (sub.started) { newSub.start(); }\n if (this.#pausedState != null) { newSub.pause(this.#pausedState); }\n break;\n }\n }\n }\n\n async #hasSub(event: ProviderEvent, emitArgs?: Array): Promise {\n let sub = await getSubscription(event, this);\n // This is a log that is removing an existing log; we actually want\n // to emit an orphan event for the removed log\n if (sub.type === \"event\" && emitArgs && emitArgs.length > 0 && emitArgs[0].removed === true) {\n sub = await getSubscription({ orphan: \"drop-log\", log: emitArgs[0] }, this);\n }\n return this.#subs.get(sub.tag) || null;\n }\n\n async #getSub(event: ProviderEvent): Promise {\n const subscription = await getSubscription(event, this);\n\n // Prevent tampering with our tag in any subclass' _getSubscriber\n const tag = subscription.tag;\n\n let sub = this.#subs.get(tag);\n if (!sub) {\n const subscriber = this._getSubscriber(subscription);\n\n const addressableMap = new WeakMap();\n const nameMap = new Map();\n sub = { subscriber, tag, addressableMap, nameMap, started: false, listeners: [ ] };\n this.#subs.set(tag, sub);\n }\n\n return sub;\n }\n\n async on(event: ProviderEvent, listener: Listener): Promise {\n const sub = await this.#getSub(event);\n sub.listeners.push({ listener, once: false });\n if (!sub.started) {\n sub.subscriber.start();\n sub.started = true;\n if (this.#pausedState != null) { sub.subscriber.pause(this.#pausedState); }\n }\n return this;\n }\n\n async once(event: ProviderEvent, listener: Listener): Promise {\n const sub = await this.#getSub(event);\n sub.listeners.push({ listener, once: true });\n if (!sub.started) {\n sub.subscriber.start();\n sub.started = true;\n if (this.#pausedState != null) { sub.subscriber.pause(this.#pausedState); }\n }\n return this;\n }\n\n async emit(event: ProviderEvent, ...args: Array): Promise {\n const sub = await this.#hasSub(event, args);\n // If there is not subscription or if a recent emit removed\n // the last of them (which also deleted the sub) do nothing\n if (!sub || sub.listeners.length === 0) { return false; };\n\n const count = sub.listeners.length;\n sub.listeners = sub.listeners.filter(({ listener, once }) => {\n const payload = new EventPayload(this, (once ? null: listener), event);\n try {\n listener.call(this, ...args, payload);\n } catch(error) { }\n return !once;\n });\n\n if (sub.listeners.length === 0) {\n if (sub.started) { sub.subscriber.stop(); }\n this.#subs.delete(sub.tag);\n }\n\n return (count > 0);\n }\n\n async listenerCount(event?: ProviderEvent): Promise {\n if (event) {\n const sub = await this.#hasSub(event);\n if (!sub) { return 0; }\n return sub.listeners.length;\n }\n\n let total = 0;\n for (const { listeners } of this.#subs.values()) {\n total += listeners.length;\n }\n return total;\n }\n\n async listeners(event?: ProviderEvent): Promise> {\n if (event) {\n const sub = await this.#hasSub(event);\n if (!sub) { return [ ]; }\n return sub.listeners.map(({ listener }) => listener);\n }\n let result: Array = [ ];\n for (const { listeners } of this.#subs.values()) {\n result = result.concat(listeners.map(({ listener }) => listener));\n }\n return result;\n }\n\n async off(event: ProviderEvent, listener?: Listener): Promise {\n const sub = await this.#hasSub(event);\n if (!sub) { return this; }\n\n if (listener) {\n const index = sub.listeners.map(({ listener }) => listener).indexOf(listener);\n if (index >= 0) { sub.listeners.splice(index, 1); }\n }\n\n if (!listener || sub.listeners.length === 0) {\n if (sub.started) { sub.subscriber.stop(); }\n this.#subs.delete(sub.tag);\n }\n\n return this;\n }\n\n async removeAllListeners(event?: ProviderEvent): Promise {\n if (event) {\n const { tag, started, subscriber } = await this.#getSub(event);\n if (started) { subscriber.stop(); }\n this.#subs.delete(tag);\n } else {\n for (const [ tag, { started, subscriber } ] of this.#subs) {\n if (started) { subscriber.stop(); }\n this.#subs.delete(tag);\n }\n }\n return this;\n }\n\n // Alias for \"on\"\n async addListener(event: ProviderEvent, listener: Listener): Promise {\n return await this.on(event, listener);\n }\n\n // Alias for \"off\"\n async removeListener(event: ProviderEvent, listener: Listener): Promise {\n return this.off(event, listener);\n }\n\n /**\n * If this provider has been destroyed using the [[destroy]] method.\n *\n * Once destroyed, all resources are reclaimed, internal event loops\n * and timers are cleaned up and no further requests may be sent to\n * the provider.\n */\n get destroyed(): boolean {\n return this.#destroyed;\n }\n\n /**\n * Sub-classes may use this to shutdown any sockets or release their\n * resources and reject any pending requests.\n *\n * Sub-classes **must** call ``super.destroy()``.\n */\n destroy(): void {\n // Stop all listeners\n this.removeAllListeners();\n\n // Shut down all tiemrs\n for (const timerId of this.#timers.keys()) {\n this._clearTimeout(timerId);\n }\n\n this.#destroyed = true;\n }\n\n /**\n * Whether the provider is currently paused.\n *\n * A paused provider will not emit any events, and generally should\n * not make any requests to the network, but that is up to sub-classes\n * to manage.\n *\n * Setting ``paused = true`` is identical to calling ``.pause(false)``,\n * which will buffer any events that occur while paused until the\n * provider is unpaused.\n */\n get paused(): boolean { return (this.#pausedState != null); }\n set paused(pause: boolean) {\n if (!!pause === this.paused) { return; }\n\n if (this.paused) {\n this.resume();\n } else {\n this.pause(false);\n }\n }\n\n /**\n * Pause the provider. If %%dropWhilePaused%%, any events that occur\n * while paused are dropped, otherwise all events will be emitted once\n * the provider is unpaused.\n */\n pause(dropWhilePaused?: boolean): void {\n this.#lastBlockNumber = -1;\n\n if (this.#pausedState != null) {\n if (this.#pausedState == !!dropWhilePaused) { return; }\n assert(false, \"cannot change pause type; resume first\", \"UNSUPPORTED_OPERATION\", {\n operation: \"pause\"\n });\n }\n\n this._forEachSubscriber((s) => s.pause(dropWhilePaused));\n this.#pausedState = !!dropWhilePaused;\n\n for (const timer of this.#timers.values()) {\n // Clear the timer\n if (timer.timer) { clearTimeout(timer.timer); }\n\n // Remaining time needed for when we become unpaused\n timer.time = getTime() - timer.time;\n }\n }\n\n /**\n * Resume the provider.\n */\n resume(): void {\n if (this.#pausedState == null) { return; }\n\n this._forEachSubscriber((s) => s.resume());\n this.#pausedState = null;\n for (const timer of this.#timers.values()) {\n // Remaining time when we were paused\n let timeout = timer.time;\n if (timeout < 0) { timeout = 0; }\n\n // Start time (in cause paused, so we con compute remaininf time)\n timer.time = getTime();\n\n // Start the timer\n setTimeout(timer.func, timeout);\n }\n }\n}\n\n\nfunction _parseString(result: string, start: number): null | string {\n try {\n const bytes = _parseBytes(result, start);\n if (bytes) { return toUtf8String(bytes); }\n } catch(error) { }\n return null;\n}\n\nfunction _parseBytes(result: string, start: number): null | string {\n if (result === \"0x\") { return null; }\n try {\n const offset = getNumber(dataSlice(result, start, start + 32));\n const length = getNumber(dataSlice(result, offset, offset + 32));\n\n return dataSlice(result, offset + 32, offset + 32 + length);\n } catch (error) { }\n return null;\n}\n\nfunction numPad(value: number): Uint8Array {\n const result = toBeArray(value);\n if (result.length > 32) { throw new Error(\"internal; should not happen\"); }\n\n const padded = new Uint8Array(32);\n padded.set(result, 32 - result.length);\n return padded;\n}\n\nfunction bytesPad(value: Uint8Array): Uint8Array {\n if ((value.length % 32) === 0) { return value; }\n\n const result = new Uint8Array(Math.ceil(value.length / 32) * 32);\n result.set(value);\n return result;\n}\n\nconst empty: Uint8Array = new Uint8Array([ ]);\n\n// ABI Encodes a series of (bytes, bytes, ...)\nfunction encodeBytes(datas: Array): string {\n const result: Array = [ ];\n\n let byteCount = 0;\n\n // Add place-holders for pointers as we add items\n for (let i = 0; i < datas.length; i++) {\n result.push(empty);\n byteCount += 32;\n }\n\n for (let i = 0; i < datas.length; i++) {\n const data = getBytes(datas[i]);\n\n // Update the bytes offset\n result[i] = numPad(byteCount);\n\n // The length and padded value of data\n result.push(numPad(data.length));\n result.push(bytesPad(data));\n byteCount += 32 + Math.ceil(data.length / 32) * 32;\n }\n\n return concat(result);\n}\n\nconst zeros = \"0x0000000000000000000000000000000000000000000000000000000000000000\"\nfunction parseOffchainLookup(data: string): CcipArgs {\n const result: CcipArgs = {\n sender: \"\", urls: [ ], calldata: \"\", selector: \"\", extraData: \"\", errorArgs: [ ]\n };\n\n assert(dataLength(data) >= 5 * 32, \"insufficient OffchainLookup data\", \"OFFCHAIN_FAULT\", {\n reason: \"insufficient OffchainLookup data\"\n });\n\n const sender = dataSlice(data, 0, 32);\n assert(dataSlice(sender, 0, 12) === dataSlice(zeros, 0, 12), \"corrupt OffchainLookup sender\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup sender\"\n });\n result.sender = dataSlice(sender, 12);\n\n // Read the URLs from the response\n try {\n const urls: Array = [];\n const urlsOffset = getNumber(dataSlice(data, 32, 64));\n const urlsLength = getNumber(dataSlice(data, urlsOffset, urlsOffset + 32));\n const urlsData = dataSlice(data, urlsOffset + 32);\n for (let u = 0; u < urlsLength; u++) {\n const url = _parseString(urlsData, u * 32);\n if (url == null) { throw new Error(\"abort\"); }\n urls.push(url);\n }\n result.urls = urls;\n } catch (error) {\n assert(false, \"corrupt OffchainLookup urls\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup urls\"\n });\n }\n\n // Get the CCIP calldata to forward\n try {\n const calldata = _parseBytes(data, 64);\n if (calldata == null) { throw new Error(\"abort\"); }\n result.calldata = calldata;\n } catch (error) {\n assert(false, \"corrupt OffchainLookup calldata\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup calldata\"\n });\n }\n\n // Get the callbackSelector (bytes4)\n assert(dataSlice(data, 100, 128) === dataSlice(zeros, 0, 28), \"corrupt OffchainLookup callbaackSelector\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup callbaackSelector\"\n });\n result.selector = dataSlice(data, 96, 100);\n\n // Get the extra data to send back to the contract as context\n try {\n const extraData = _parseBytes(data, 128);\n if (extraData == null) { throw new Error(\"abort\"); }\n result.extraData = extraData;\n } catch (error) {\n assert(false, \"corrupt OffchainLookup extraData\", \"OFFCHAIN_FAULT\", {\n reason: \"corrupt OffchainLookup extraData\"\n });\n }\n\n result.errorArgs = \"sender,urls,calldata,selector,extraData\".split(/,/).map((k) => (result)[k])\n\n return result;\n}\n", "/**\n * Generally the [[Wallet]] and [[JsonRpcSigner]] and their sub-classes\n * are sufficent for most developers, but this is provided to\n * fascilitate more complex Signers.\n *\n * @_section: api/providers/abstract-signer: Subclassing Signer [abstract-signer]\n */\nimport { resolveAddress } from \"../address/index.js\";\nimport { Transaction } from \"../transaction/index.js\";\nimport {\n defineProperties, getBigInt, resolveProperties,\n assert, assertArgument\n} from \"../utils/index.js\";\n\nimport { copyRequest } from \"./provider.js\";\n\nimport type { TypedDataDomain, TypedDataField } from \"../hash/index.js\";\nimport type { TransactionLike } from \"../transaction/index.js\";\n\nimport type {\n BlockTag, Provider, TransactionRequest, TransactionResponse\n} from \"./provider.js\";\nimport type { Signer } from \"./signer.js\";\n\n\nfunction checkProvider(signer: AbstractSigner, operation: string): Provider {\n if (signer.provider) { return signer.provider; }\n assert(false, \"missing provider\", \"UNSUPPORTED_OPERATION\", { operation });\n}\n\nasync function populate(signer: AbstractSigner, tx: TransactionRequest): Promise> {\n let pop: any = copyRequest(tx);\n\n if (pop.to != null) { pop.to = resolveAddress(pop.to, signer); }\n\n if (pop.from != null) {\n const from = pop.from;\n pop.from = Promise.all([\n signer.getAddress(),\n resolveAddress(from, signer)\n ]).then(([ address, from ]) => {\n assertArgument(address.toLowerCase() === from.toLowerCase(),\n \"transaction from mismatch\", \"tx.from\", from);\n return address;\n });\n } else {\n pop.from = signer.getAddress();\n }\n\n return await resolveProperties(pop);\n}\n\n\n/**\n * An **AbstractSigner** includes most of teh functionality required\n * to get a [[Signer]] working as expected, but requires a few\n * Signer-specific methods be overridden.\n *\n */\nexport abstract class AbstractSigner

implements Signer {\n /**\n * The provider this signer is connected to.\n */\n readonly provider!: P;\n\n /**\n * Creates a new Signer connected to %%provider%%.\n */\n constructor(provider?: P) {\n defineProperties(this, { provider: (provider || null) });\n }\n\n /**\n * Resolves to the Signer address.\n */\n abstract getAddress(): Promise;\n\n /**\n * Returns the signer connected to %%provider%%.\n *\n * This may throw, for example, a Signer connected over a Socket or\n * to a specific instance of a node may not be transferrable.\n */\n abstract connect(provider: null | Provider): Signer;\n\n async getNonce(blockTag?: BlockTag): Promise {\n return checkProvider(this, \"getTransactionCount\").getTransactionCount(await this.getAddress(), blockTag);\n }\n\n async populateCall(tx: TransactionRequest): Promise> {\n const pop = await populate(this, tx);\n return pop;\n }\n\n async populateTransaction(tx: TransactionRequest): Promise> {\n const provider = checkProvider(this, \"populateTransaction\");\n\n const pop = await populate(this, tx);\n\n if (pop.nonce == null) {\n pop.nonce = await this.getNonce(\"pending\");\n }\n\n if (pop.gasLimit == null) {\n pop.gasLimit = await this.estimateGas(pop);\n }\n\n // Populate the chain ID\n const network = await ((this.provider)).getNetwork();\n if (pop.chainId != null) {\n const chainId = getBigInt(pop.chainId);\n assertArgument(chainId === network.chainId, \"transaction chainId mismatch\", \"tx.chainId\", tx.chainId);\n } else {\n pop.chainId = network.chainId;\n }\n\n // Do not allow mixing pre-eip-1559 and eip-1559 properties\n const hasEip1559 = (pop.maxFeePerGas != null || pop.maxPriorityFeePerGas != null);\n if (pop.gasPrice != null && (pop.type === 2 || hasEip1559)) {\n assertArgument(false, \"eip-1559 transaction do not support gasPrice\", \"tx\", tx);\n } else if ((pop.type === 0 || pop.type === 1) && hasEip1559) {\n assertArgument(false, \"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas\", \"tx\", tx);\n }\n\n if ((pop.type === 2 || pop.type == null) && (pop.maxFeePerGas != null && pop.maxPriorityFeePerGas != null)) {\n // Fully-formed EIP-1559 transaction (skip getFeeData)\n pop.type = 2;\n\n } else if (pop.type === 0 || pop.type === 1) {\n // Explicit Legacy or EIP-2930 transaction\n\n // We need to get fee data to determine things\n const feeData = await provider.getFeeData();\n\n assert(feeData.gasPrice != null, \"network does not support gasPrice\", \"UNSUPPORTED_OPERATION\", {\n operation: \"getGasPrice\" });\n\n // Populate missing gasPrice\n if (pop.gasPrice == null) { pop.gasPrice = feeData.gasPrice; }\n\n } else {\n\n // We need to get fee data to determine things\n const feeData = await provider.getFeeData();\n\n if (pop.type == null) {\n // We need to auto-detect the intended type of this transaction...\n\n if (feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null) {\n // The network supports EIP-1559!\n\n // Upgrade transaction from null to eip-1559\n pop.type = 2;\n\n if (pop.gasPrice != null) {\n // Using legacy gasPrice property on an eip-1559 network,\n // so use gasPrice as both fee properties\n const gasPrice = pop.gasPrice;\n delete pop.gasPrice;\n pop.maxFeePerGas = gasPrice;\n pop.maxPriorityFeePerGas = gasPrice;\n\n } else {\n // Populate missing fee data\n\n if (pop.maxFeePerGas == null) {\n pop.maxFeePerGas = feeData.maxFeePerGas;\n }\n\n if (pop.maxPriorityFeePerGas == null) {\n pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas;\n }\n }\n\n } else if (feeData.gasPrice != null) {\n // Network doesn't support EIP-1559...\n\n // ...but they are trying to use EIP-1559 properties\n assert(!hasEip1559, \"network does not support EIP-1559\", \"UNSUPPORTED_OPERATION\", {\n operation: \"populateTransaction\" });\n\n // Populate missing fee data\n if (pop.gasPrice == null) {\n pop.gasPrice = feeData.gasPrice;\n }\n\n // Explicitly set untyped transaction to legacy\n // @TODO: Maybe this shold allow type 1?\n pop.type = 0;\n\n } else {\n // getFeeData has failed us.\n assert(false, \"failed to get consistent fee data\", \"UNSUPPORTED_OPERATION\", {\n operation: \"signer.getFeeData\" });\n }\n\n } else if (pop.type === 2) {\n // Explicitly using EIP-1559\n\n // Populate missing fee data\n if (pop.maxFeePerGas == null) {\n pop.maxFeePerGas = feeData.maxFeePerGas;\n }\n\n if (pop.maxPriorityFeePerGas == null) {\n pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas;\n }\n }\n }\n\n//@TOOD: Don't await all over the place; save them up for\n// the end for better batching\n return await resolveProperties(pop);\n }\n\n async estimateGas(tx: TransactionRequest): Promise {\n return checkProvider(this, \"estimateGas\").estimateGas(await this.populateCall(tx));\n }\n\n async call(tx: TransactionRequest): Promise {\n return checkProvider(this, \"call\").call(await this.populateCall(tx));\n }\n\n async resolveName(name: string): Promise {\n const provider = checkProvider(this, \"resolveName\");\n return await provider.resolveName(name);\n }\n\n async sendTransaction(tx: TransactionRequest): Promise {\n const provider = checkProvider(this, \"sendTransaction\");\n\n const pop = await this.populateTransaction(tx);\n delete pop.from;\n const txObj = Transaction.from(pop);\n return await provider.broadcastTransaction(await this.signTransaction(txObj));\n }\n\n abstract signTransaction(tx: TransactionRequest): Promise;\n abstract signMessage(message: string | Uint8Array): Promise;\n abstract signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise;\n}\n\n/**\n * A **VoidSigner** is a class deisgned to allow an address to be used\n * in any API which accepts a Signer, but for which there are no\n * credentials available to perform any actual signing.\n *\n * This for example allow impersonating an account for the purpose of\n * static calls or estimating gas, but does not allow sending transactions.\n */\nexport class VoidSigner extends AbstractSigner {\n /**\n * The signer address.\n */\n readonly address!: string;\n\n /**\n * Creates a new **VoidSigner** with %%address%% attached to\n * %%provider%%.\n */\n constructor(address: string, provider?: null | Provider) {\n super(provider);\n defineProperties(this, { address });\n }\n\n async getAddress(): Promise { return this.address; }\n\n connect(provider: null | Provider): VoidSigner {\n return new VoidSigner(this.address, provider);\n }\n\n #throwUnsupported(suffix: string, operation: string): never {\n assert(false, `VoidSigner cannot sign ${ suffix }`, \"UNSUPPORTED_OPERATION\", { operation });\n }\n\n async signTransaction(tx: TransactionRequest): Promise {\n this.#throwUnsupported(\"transactions\", \"signTransaction\");\n }\n\n async signMessage(message: string | Uint8Array): Promise {\n this.#throwUnsupported(\"messages\", \"signMessage\");\n }\n\n async signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise {\n this.#throwUnsupported(\"typed-data\", \"signTypedData\");\n }\n}\n\n", "/**\n * There are many awesome community services that provide Ethereum\n * nodes both for developers just starting out and for large-scale\n * communities.\n *\n * @_section: api/providers/thirdparty: Community Providers [thirdparty]\n */\n\n/**\n * Providers which offer community credentials should extend this\n * to notify any interested consumers whether community credentials\n * are in-use.\n */\nexport interface CommunityResourcable {\n /**\n * Returns true of the instance is connected using the community\n * credentials.\n */\n isCommunityResource(): boolean;\n}\n\n// Show the throttle message only once per service\nconst shown: Set = new Set();\n\n/**\n * Displays a warning in tht console when the community resource is\n * being used too heavily by the app, recommending the developer\n * acquire their own credentials instead of using the community\n * credentials.\n *\n * The notification will only occur once per service.\n */\nexport function showThrottleMessage(service: string): void {\n if (shown.has(service)) { return; }\n shown.add(service);\n\n console.log(\"========= NOTICE =========\")\n console.log(`Request-Rate Exceeded for ${ service } (this message will not be repeated)`);\n console.log(\"\");\n console.log(\"The default API keys for each service are provided as a highly-throttled,\");\n console.log(\"community resource for low-traffic projects and early prototyping.\");\n console.log(\"\");\n console.log(\"While your application will continue to function, we highly recommended\");\n console.log(\"signing up for your own API keys to improve performance, increase your\");\n console.log(\"request rate/limit and enable other perks, such as metrics and advanced APIs.\");\n console.log(\"\");\n console.log(\"For more details: https:/\\/docs.ethers.org/api-keys/\");\n console.log(\"==========================\");\n}\n", "import { isError } from \"../utils/index.js\";\n\nimport { PollingEventSubscriber } from \"./subscriber-polling.js\";\n\nimport type { AbstractProvider, Subscriber } from \"./abstract-provider.js\";\nimport type { Network } from \"./network.js\";\nimport type { EventFilter } from \"./provider.js\";\nimport type { JsonRpcApiProvider } from \"./provider-jsonrpc.js\";\n\nfunction copy(obj: any): any {\n return JSON.parse(JSON.stringify(obj));\n}\n\n/**\n * Some backends support subscribing to events using a Filter ID.\n *\n * When subscribing with this technique, the node issues a unique\n * //Filter ID//. At this point the node dedicates resources to\n * the filter, so that periodic calls to follow up on the //Filter ID//\n * will receive any events since the last call.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class FilterIdSubscriber implements Subscriber {\n #provider: JsonRpcApiProvider;\n\n #filterIdPromise: null | Promise;\n #poller: (b: number) => Promise;\n\n #running: boolean;\n\n #network: null | Network;\n\n #hault: boolean;\n\n /**\n * Creates a new **FilterIdSubscriber** which will used [[_subscribe]]\n * and [[_emitResults]] to setup the subscription and provide the event\n * to the %%provider%%.\n */\n constructor(provider: JsonRpcApiProvider) {\n this.#provider = provider;\n\n this.#filterIdPromise = null;\n this.#poller = this.#poll.bind(this);\n\n this.#running = false;\n\n this.#network = null;\n\n this.#hault = false;\n }\n\n /**\n * Sub-classes **must** override this to begin the subscription.\n */\n _subscribe(provider: JsonRpcApiProvider): Promise {\n throw new Error(\"subclasses must override this\");\n }\n\n /**\n * Sub-classes **must** override this handle the events.\n */\n _emitResults(provider: AbstractProvider, result: Array): Promise {\n throw new Error(\"subclasses must override this\");\n }\n\n /**\n * Sub-classes **must** override this handle recovery on errors.\n */\n _recover(provider: AbstractProvider): Subscriber {\n throw new Error(\"subclasses must override this\");\n }\n\n async #poll(blockNumber: number): Promise {\n try {\n // Subscribe if necessary\n if (this.#filterIdPromise == null) {\n this.#filterIdPromise = this._subscribe(this.#provider);\n }\n\n // Get the Filter ID\n let filterId: null | string = null;\n try {\n filterId = await this.#filterIdPromise;\n } catch (error) {\n if (!isError(error, \"UNSUPPORTED_OPERATION\") || error.operation !== \"eth_newFilter\") {\n throw error;\n }\n }\n\n // The backend does not support Filter ID; downgrade to\n // polling\n if (filterId == null) {\n this.#filterIdPromise = null;\n this.#provider._recoverSubscriber(this, this._recover(this.#provider));\n return;\n }\n\n const network = await this.#provider.getNetwork();\n if (!this.#network) { this.#network = network; }\n\n if ((this.#network as Network).chainId !== network.chainId) {\n throw new Error(\"chaid changed\");\n }\n\n if (this.#hault) { return; }\n\n const result = await this.#provider.send(\"eth_getFilterChanges\", [ filterId ]);\n await this._emitResults(this.#provider, result);\n } catch (error) { console.log(\"@TODO\", error); }\n\n this.#provider.once(\"block\", this.#poller);\n }\n\n #teardown(): void {\n const filterIdPromise = this.#filterIdPromise;\n if (filterIdPromise) {\n this.#filterIdPromise = null;\n filterIdPromise.then((filterId) => {\n this.#provider.send(\"eth_uninstallFilter\", [ filterId ]);\n });\n }\n }\n\n start(): void {\n if (this.#running) { return; }\n this.#running = true;\n\n this.#poll(-2);\n }\n\n stop(): void {\n if (!this.#running) { return; }\n this.#running = false;\n\n this.#hault = true;\n this.#teardown();\n this.#provider.off(\"block\", this.#poller);\n }\n\n pause(dropWhilePaused?: boolean): void {\n if (dropWhilePaused){ this.#teardown(); }\n this.#provider.off(\"block\", this.#poller);\n }\n\n resume(): void { this.start(); }\n}\n\n/**\n * A **FilterIdSubscriber** for receiving contract events.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class FilterIdEventSubscriber extends FilterIdSubscriber {\n #event: EventFilter;\n\n /**\n * Creates a new **FilterIdEventSubscriber** attached to %%provider%%\n * listening for %%filter%%.\n */\n constructor(provider: JsonRpcApiProvider, filter: EventFilter) {\n super(provider);\n this.#event = copy(filter);\n }\n\n _recover(provider: AbstractProvider): Subscriber {\n return new PollingEventSubscriber(provider, this.#event);\n }\n\n async _subscribe(provider: JsonRpcApiProvider): Promise {\n const filterId = await provider.send(\"eth_newFilter\", [ this.#event ]);\n return filterId;\n }\n\n async _emitResults(provider: JsonRpcApiProvider, results: Array): Promise {\n for (const result of results) {\n provider.emit(this.#event, provider._wrapLog(result, provider._network));\n }\n }\n}\n\n/**\n * A **FilterIdSubscriber** for receiving pending transactions events.\n *\n * @_docloc: api/providers/abstract-provider\n */\nexport class FilterIdPendingSubscriber extends FilterIdSubscriber {\n async _subscribe(provider: JsonRpcApiProvider): Promise {\n return await provider.send(\"eth_newPendingTransactionFilter\", [ ]);\n }\n\n async _emitResults(provider: JsonRpcApiProvider, results: Array): Promise {\n for (const result of results) {\n provider.emit(\"pending\", result);\n }\n }\n}\n", "/**\n * One of the most common ways to interact with the blockchain is\n * by a node running a JSON-RPC interface which can be connected to,\n * based on the transport, using:\n *\n * - HTTP or HTTPS - [[JsonRpcProvider]]\n * - WebSocket - [[WebSocketProvider]]\n * - IPC - [[IpcSocketProvider]]\n *\n * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider]\n */\n\n// @TODO:\n// - Add the batching API\n\n// https://playground.open-rpc.org/?schemaUrl=https://raw.githubusercontent.com/ethereum/eth1.0-apis/assembled-spec/openrpc.json&uiSchema%5BappBar%5D%5Bui:splitView%5D=true&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false\n\nimport { AbiCoder } from \"../abi/index.js\";\nimport { getAddress, resolveAddress } from \"../address/index.js\";\nimport { TypedDataEncoder } from \"../hash/index.js\";\nimport { accessListify } from \"../transaction/index.js\";\nimport {\n defineProperties, getBigInt, hexlify, isHexString, toQuantity, toUtf8Bytes,\n isError, makeError, assert, assertArgument,\n FetchRequest, resolveProperties\n} from \"../utils/index.js\";\n\nimport { AbstractProvider, UnmanagedSubscriber } from \"./abstract-provider.js\";\nimport { AbstractSigner } from \"./abstract-signer.js\";\nimport { Network } from \"./network.js\";\nimport { FilterIdEventSubscriber, FilterIdPendingSubscriber } from \"./subscriber-filterid.js\";\nimport { PollingEventSubscriber } from \"./subscriber-polling.js\";\n\nimport type { TypedDataDomain, TypedDataField } from \"../hash/index.js\";\nimport type { TransactionLike } from \"../transaction/index.js\";\n\nimport type { PerformActionRequest, Subscriber, Subscription } from \"./abstract-provider.js\";\nimport type { Networkish } from \"./network.js\";\nimport type { Provider, TransactionRequest, TransactionResponse } from \"./provider.js\";\nimport type { Signer } from \"./signer.js\";\n\ntype Timer = ReturnType;\n\nconst Primitive = \"bigint,boolean,function,number,string,symbol\".split(/,/g);\n//const Methods = \"getAddress,then\".split(/,/g);\nfunction deepCopy(value: T): T {\n if (value == null || Primitive.indexOf(typeof(value)) >= 0) {\n return value;\n }\n\n // Keep any Addressable\n if (typeof((value).getAddress) === \"function\") {\n return value;\n }\n\n if (Array.isArray(value)) { return (value.map(deepCopy)); }\n\n if (typeof(value) === \"object\") {\n return Object.keys(value).reduce((accum, key) => {\n accum[key] = (value)[key];\n return accum;\n }, { });\n }\n\n throw new Error(`should not happen: ${ value } (${ typeof(value) })`);\n}\n\nfunction stall(duration: number): Promise {\n return new Promise((resolve) => { setTimeout(resolve, duration); });\n}\n\nfunction getLowerCase(value: string): string {\n if (value) { return value.toLowerCase(); }\n return value;\n}\n\ninterface Pollable {\n pollingInterval: number;\n}\n\nfunction isPollable(value: any): value is Pollable {\n return (value && typeof(value.pollingInterval) === \"number\");\n}\n\n/**\n * A JSON-RPC payload, which are sent to a JSON-RPC server.\n */\nexport type JsonRpcPayload = {\n /**\n * The JSON-RPC request ID.\n */\n id: number;\n\n /**\n * The JSON-RPC request method.\n */\n method: string;\n\n /**\n * The JSON-RPC request parameters.\n */\n params: Array | Record;\n\n /**\n * A required constant in the JSON-RPC specification.\n */\n jsonrpc: \"2.0\";\n};\n\n/**\n * A JSON-RPC result, which are returned on success from a JSON-RPC server.\n */\nexport type JsonRpcResult = {\n /**\n * The response ID to match it to the relevant request.\n */\n id: number;\n\n /**\n * The response result.\n */\n result: any;\n};\n\n/**\n * A JSON-RPC error, which are returned on failure from a JSON-RPC server.\n */\nexport type JsonRpcError = {\n /**\n * The response ID to match it to the relevant request.\n */\n id: number;\n\n /**\n * The response error.\n */\n error: {\n code: number;\n message?: string;\n data?: any;\n }\n};\n\n/**\n * When subscribing to the ``\"debug\"`` event, the [[Listener]] will\n * receive this object as the first parameter.\n */\nexport type DebugEventJsonRpcApiProvider = {\n action: \"sendRpcPayload\",\n payload: JsonRpcPayload | Array\n} | {\n action: \"receiveRpcResult\",\n result: Array\n} | {\n action: \"receiveRpcError\",\n error: Error\n};\n\n/**\n * Options for configuring a [[JsonRpcApiProvider]]. Much of this\n * is targetted towards sub-classes, which often will not expose\n * any of these options to their consumers.\n *\n * **``polling``** - use the polling strategy is used immediately\n * for events; otherwise, attempt to use filters and fall back onto\n * polling (default: ``false``)\n *\n * **``staticNetwork``** - do not request chain ID on requests to\n * validate the underlying chain has not changed (default: ``null``)\n *\n * This should **ONLY** be used if it is **certain** that the network\n * cannot change, such as when using INFURA (since the URL dictates the\n * network). If the network is assumed static and it does change, this\n * can have tragic consequences. For example, this **CANNOT** be used\n * with MetaMask, since the user can select a new network from the\n * drop-down at any time.\n *\n * **``batchStallTime``** - how long (ms) to aggregate requests into a\n * single batch. ``0`` indicates batching will only encompass the current\n * event loop. If ``batchMaxCount = 1``, this is ignored. (default: ``10``)\n *\n * **``batchMaxSize``** - target maximum size (bytes) to allow per batch\n * request (default: 1Mb)\n *\n * **``batchMaxCount``** - maximum number of requests to allow in a batch.\n * If ``batchMaxCount = 1``, then batching is disabled. (default: ``100``)\n *\n * **``cacheTimeout``** - passed as [[AbstractProviderOptions]].\n */\nexport type JsonRpcApiProviderOptions = {\n polling?: boolean;\n staticNetwork?: null | boolean | Network;\n batchStallTime?: number;\n batchMaxSize?: number;\n batchMaxCount?: number;\n\n cacheTimeout?: number;\n pollingInterval?: number;\n};\n\nconst defaultOptions = {\n polling: false,\n staticNetwork: null,\n\n batchStallTime: 10, // 10ms\n batchMaxSize: (1 << 20), // 1Mb\n batchMaxCount: 100, // 100 requests\n\n cacheTimeout: 250,\n pollingInterval: 4000\n}\n\n/**\n * A **JsonRpcTransactionRequest** is formatted as needed by the JSON-RPC\n * Ethereum API specification.\n */\nexport interface JsonRpcTransactionRequest {\n /**\n * The sender address to use when signing.\n */\n from?: string;\n\n /**\n * The target address.\n */\n to?: string;\n\n /**\n * The transaction data.\n */\n data?: string;\n\n /**\n * The chain ID the transaction is valid on.\n */\n chainId?: string;\n\n /**\n * The [[link-eip-2718]] transaction type.\n */\n type?: string;\n\n /**\n * The maximum amount of gas to allow a transaction to consume.\n *\n * In most other places in ethers, this is called ``gasLimit`` which\n * differs from the JSON-RPC Ethereum API specification.\n */\n gas?: string;\n\n /**\n * The gas price per wei for transactions prior to [[link-eip-1559]].\n */\n gasPrice?: string;\n\n /**\n * The maximum fee per gas for [[link-eip-1559]] transactions.\n */\n maxFeePerGas?: string;\n\n /**\n * The maximum priority fee per gas for [[link-eip-1559]] transactions.\n */\n maxPriorityFeePerGas?: string;\n\n /**\n * The nonce for the transaction.\n */\n nonce?: string;\n\n /**\n * The transaction value (in wei).\n */\n value?: string;\n\n /**\n * The transaction access list.\n */\n accessList?: Array<{ address: string, storageKeys: Array }>;\n}\n\n// @TODO: Unchecked Signers\n\nexport class JsonRpcSigner extends AbstractSigner {\n address!: string;\n\n constructor(provider: JsonRpcApiProvider, address: string) {\n super(provider);\n address = getAddress(address);\n defineProperties(this, { address });\n }\n\n connect(provider: null | Provider): Signer {\n assert(false, \"cannot reconnect JsonRpcSigner\", \"UNSUPPORTED_OPERATION\", {\n operation: \"signer.connect\"\n });\n }\n\n async getAddress(): Promise {\n return this.address;\n }\n\n // JSON-RPC will automatially fill in nonce, etc. so we just check from\n async populateTransaction(tx: TransactionRequest): Promise> {\n return await this.populateCall(tx);\n }\n\n // Returns just the hash of the transaction after sent, which is what\n // the bare JSON-RPC API does;\n async sendUncheckedTransaction(_tx: TransactionRequest): Promise {\n const tx = deepCopy(_tx);\n\n const promises: Array> = [];\n\n // Make sure the from matches the sender\n if (tx.from) {\n const _from = tx.from;\n promises.push((async () => {\n const from = await resolveAddress(_from, this.provider);\n assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(),\n \"from address mismatch\", \"transaction\", _tx);\n tx.from = from;\n })());\n } else {\n tx.from = this.address;\n }\n\n // The JSON-RPC for eth_sendTransaction uses 90000 gas; if the user\n // wishes to use this, it is easy to specify explicitly, otherwise\n // we look it up for them.\n if (tx.gasLimit == null) {\n promises.push((async () => {\n tx.gasLimit = await this.provider.estimateGas({ ...tx, from: this.address});\n })());\n }\n\n // The address may be an ENS name or Addressable\n if (tx.to != null) {\n const _to = tx.to;\n promises.push((async () => {\n tx.to = await resolveAddress(_to, this.provider);\n })());\n }\n\n // Wait until all of our properties are filled in\n if (promises.length) { await Promise.all(promises); }\n\n const hexTx = this.provider.getRpcTransaction(tx);\n\n return this.provider.send(\"eth_sendTransaction\", [ hexTx ]);\n }\n\n async sendTransaction(tx: TransactionRequest): Promise {\n // This cannot be mined any earlier than any recent block\n const blockNumber = await this.provider.getBlockNumber();\n\n // Send the transaction\n const hash = await this.sendUncheckedTransaction(tx);\n\n // Unfortunately, JSON-RPC only provides and opaque transaction hash\n // for a response, and we need the actual transaction, so we poll\n // for it; it should show up very quickly\n return await (new Promise((resolve, reject) => {\n const timeouts = [ 1000, 100 ];\n let invalids = 0;\n\n const checkTx = async () => {\n\n try {\n // Try getting the transaction\n const tx = await this.provider.getTransaction(hash);\n\n if (tx != null) {\n resolve(tx.replaceableTransaction(blockNumber));\n return;\n }\n\n } catch (error) {\n\n // If we were cancelled: stop polling.\n // If the data is bad: the node returns bad transactions\n // If the network changed: calling again will also fail\n // If unsupported: likely destroyed\n if (isError(error, \"CANCELLED\") || isError(error, \"BAD_DATA\") ||\n isError(error, \"NETWORK_ERROR\" || isError(error, \"UNSUPPORTED_OPERATION\"))) {\n\n if (error.info == null) { error.info = { }; }\n error.info.sendTransactionHash = hash;\n\n reject(error);\n return;\n }\n\n // Stop-gap for misbehaving backends; see #4513\n if (isError(error, \"INVALID_ARGUMENT\")) {\n invalids++;\n if (error.info == null) { error.info = { }; }\n error.info.sendTransactionHash = hash;\n if (invalids > 10) {\n reject(error);\n return;\n }\n }\n\n // Notify anyone that cares; but we will try again, since\n // it is likely an intermittent service error\n this.provider.emit(\"error\", makeError(\"failed to fetch transation after sending (will try again)\", \"UNKNOWN_ERROR\", { error }));\n }\n\n // Wait another 4 seconds\n this.provider._setTimeout(() => { checkTx(); }, timeouts.pop() || 4000);\n };\n checkTx();\n }));\n }\n\n async signTransaction(_tx: TransactionRequest): Promise {\n const tx = deepCopy(_tx);\n\n // Make sure the from matches the sender\n if (tx.from) {\n const from = await resolveAddress(tx.from, this.provider);\n assertArgument(from != null && from.toLowerCase() === this.address.toLowerCase(),\n \"from address mismatch\", \"transaction\", _tx);\n tx.from = from;\n } else {\n tx.from = this.address;\n }\n\n const hexTx = this.provider.getRpcTransaction(tx);\n return await this.provider.send(\"eth_signTransaction\", [ hexTx ]);\n }\n\n\n async signMessage(_message: string | Uint8Array): Promise {\n const message = ((typeof(_message) === \"string\") ? toUtf8Bytes(_message): _message);\n return await this.provider.send(\"personal_sign\", [\n hexlify(message), this.address.toLowerCase() ]);\n }\n\n async signTypedData(domain: TypedDataDomain, types: Record>, _value: Record): Promise {\n const value = deepCopy(_value);\n\n // Populate any ENS names (in-place)\n const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (value: string) => {\n const address = await resolveAddress(value);\n assertArgument(address != null, \"TypedData does not support null address\", \"value\", value);\n return address;\n });\n\n return await this.provider.send(\"eth_signTypedData_v4\", [\n this.address.toLowerCase(),\n JSON.stringify(TypedDataEncoder.getPayload(populated.domain, types, populated.value))\n ]);\n }\n\n async unlock(password: string): Promise {\n return this.provider.send(\"personal_unlockAccount\", [\n this.address.toLowerCase(), password, null ]);\n }\n\n // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign\n async _legacySignMessage(_message: string | Uint8Array): Promise {\n const message = ((typeof(_message) === \"string\") ? toUtf8Bytes(_message): _message);\n return await this.provider.send(\"eth_sign\", [\n this.address.toLowerCase(), hexlify(message) ]);\n }\n}\n\ntype ResolveFunc = (result: JsonRpcResult) => void;\ntype RejectFunc = (error: Error) => void;\n\ntype Payload = { payload: JsonRpcPayload, resolve: ResolveFunc, reject: RejectFunc };\n\n/**\n * The JsonRpcApiProvider is an abstract class and **MUST** be\n * sub-classed.\n *\n * It provides the base for all JSON-RPC-based Provider interaction.\n *\n * Sub-classing Notes:\n * - a sub-class MUST override _send\n * - a sub-class MUST call the `_start()` method once connected\n */\nexport abstract class JsonRpcApiProvider extends AbstractProvider {\n\n #options: Required;\n\n // The next ID to use for the JSON-RPC ID field\n #nextId: number;\n\n // Payloads are queued and triggered in batches using the drainTimer\n #payloads: Array;\n #drainTimer: null | Timer;\n\n #notReady: null | {\n promise: Promise,\n resolve: null | ((v: void) => void)\n };\n\n #network: null | Network;\n #pendingDetectNetwork: null | Promise;\n\n #scheduleDrain(): void {\n if (this.#drainTimer) { return; }\n\n // If we aren't using batching, no harm in sending it immediately\n const stallTime = (this._getOption(\"batchMaxCount\") === 1) ? 0: this._getOption(\"batchStallTime\");\n\n this.#drainTimer = setTimeout(() => {\n this.#drainTimer = null;\n\n const payloads = this.#payloads;\n this.#payloads = [ ];\n\n while (payloads.length) {\n\n // Create payload batches that satisfy our batch constraints\n const batch = [ (payloads.shift()) ];\n while (payloads.length) {\n if (batch.length === this.#options.batchMaxCount) { break; }\n batch.push((payloads.shift()));\n const bytes = JSON.stringify(batch.map((p) => p.payload));\n if (bytes.length > this.#options.batchMaxSize) {\n payloads.unshift((batch.pop()));\n break;\n }\n }\n\n // Process the result to each payload\n (async () => {\n const payload = ((batch.length === 1) ? batch[0].payload: batch.map((p) => p.payload));\n\n this.emit(\"debug\", { action: \"sendRpcPayload\", payload });\n\n try {\n const result = await this._send(payload);\n this.emit(\"debug\", { action: \"receiveRpcResult\", result });\n\n // Process results in batch order\n for (const { resolve, reject, payload } of batch) {\n\n if (this.destroyed) {\n reject(makeError(\"provider destroyed; cancelled request\", \"UNSUPPORTED_OPERATION\", { operation: payload.method }));\n continue;\n }\n\n // Find the matching result\n const resp = result.filter((r) => (r.id === payload.id))[0];\n\n // No result; the node failed us in unexpected ways\n if (resp == null) {\n const error = makeError(\"missing response for request\", \"BAD_DATA\", {\n value: result, info: { payload }\n });\n this.emit(\"error\", error);\n reject(error);\n continue;\n }\n\n // The response is an error\n if (\"error\" in resp) {\n reject(this.getRpcError(payload, resp));\n continue;\n }\n\n // All good; send the result\n resolve(resp.result);\n }\n\n } catch (error: any) {\n this.emit(\"debug\", { action: \"receiveRpcError\", error });\n\n for (const { reject } of batch) {\n // @TODO: augment the error with the payload\n reject(error);\n }\n }\n })();\n }\n }, stallTime);\n }\n\n constructor(network?: Networkish, options?: JsonRpcApiProviderOptions) {\n super(network, options);\n\n this.#nextId = 1;\n this.#options = Object.assign({ }, defaultOptions, options || { });\n\n this.#payloads = [ ];\n this.#drainTimer = null;\n\n this.#network = null;\n this.#pendingDetectNetwork = null;\n\n {\n let resolve: null | ((value: void) => void) = null;\n const promise = new Promise((_resolve: (value: void) => void) => {\n resolve = _resolve;\n });\n this.#notReady = { promise, resolve };\n }\n\n const staticNetwork = this._getOption(\"staticNetwork\");\n if (typeof(staticNetwork) === \"boolean\") {\n assertArgument(!staticNetwork || network !== \"any\", \"staticNetwork cannot be used on special network 'any'\", \"options\", options);\n if (staticNetwork && network != null) {\n this.#network = Network.from(network);\n }\n\n } else if (staticNetwork) {\n // Make sure any static network is compatbile with the provided netwrok\n assertArgument(network == null || staticNetwork.matches(network),\n \"staticNetwork MUST match network object\", \"options\", options);\n this.#network = staticNetwork;\n }\n }\n\n /**\n * Returns the value associated with the option %%key%%.\n *\n * Sub-classes can use this to inquire about configuration options.\n */\n _getOption(key: K): JsonRpcApiProviderOptions[K] {\n return this.#options[key];\n }\n\n /**\n * Gets the [[Network]] this provider has committed to. On each call, the network\n * is detected, and if it has changed, the call will reject.\n */\n get _network(): Network {\n assert (this.#network, \"network is not available yet\", \"NETWORK_ERROR\");\n return this.#network;\n }\n\n /**\n * Sends a JSON-RPC %%payload%% (or a batch) to the underlying channel.\n *\n * Sub-classes **MUST** override this.\n */\n abstract _send(payload: JsonRpcPayload | Array): Promise>;\n\n\n /**\n * Resolves to the non-normalized value by performing %%req%%.\n *\n * Sub-classes may override this to modify behavior of actions,\n * and should generally call ``super._perform`` as a fallback.\n */\n async _perform(req: PerformActionRequest): Promise {\n\n // Legacy networks do not like the type field being passed along (which\n // is fair), so we delete type if it is 0 and a non-EIP-1559 network\n if (req.method === \"call\" || req.method === \"estimateGas\") {\n let tx = req.transaction;\n if (tx && tx.type != null && getBigInt(tx.type)) {\n // If there are no EIP-1559 properties, it might be non-EIP-a559\n if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) {\n const feeData = await this.getFeeData();\n if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) {\n // Network doesn't know about EIP-1559 (and hence type)\n req = Object.assign({ }, req, {\n transaction: Object.assign({ }, tx, { type: undefined })\n });\n }\n }\n }\n }\n\n const request = this.getRpcRequest(req);\n\n if (request != null) {\n return await this.send(request.method, request.args);\n }\n\n return super._perform(req);\n }\n\n /**\n * Sub-classes may override this; it detects the *actual* network that\n * we are **currently** connected to.\n *\n * Keep in mind that [[send]] may only be used once [[ready]], otherwise the\n * _send primitive must be used instead.\n */\n async _detectNetwork(): Promise {\n const network = this._getOption(\"staticNetwork\");\n if (network) {\n if (network === true) {\n if (this.#network) { return this.#network; }\n } else {\n return network;\n }\n }\n\n if (this.#pendingDetectNetwork) {\n return await this.#pendingDetectNetwork;\n }\n\n // If we are ready, use ``send``, which enabled requests to be batched\n if (this.ready) {\n this.#pendingDetectNetwork = (async () => {\n try {\n const result = Network.from(getBigInt(await this.send(\"eth_chainId\", [ ])));\n this.#pendingDetectNetwork = null;\n return result;\n } catch (error) {\n this.#pendingDetectNetwork = null;\n throw error;\n }\n })();\n return await this.#pendingDetectNetwork;\n }\n\n // We are not ready yet; use the primitive _send\n this.#pendingDetectNetwork = (async () => {\n const payload: JsonRpcPayload = {\n id: this.#nextId++, method: \"eth_chainId\", params: [ ], jsonrpc: \"2.0\"\n };\n\n this.emit(\"debug\", { action: \"sendRpcPayload\", payload });\n\n let result: JsonRpcResult | JsonRpcError;\n try {\n result = (await this._send(payload))[0];\n this.#pendingDetectNetwork = null;\n } catch (error) {\n this.#pendingDetectNetwork = null;\n this.emit(\"debug\", { action: \"receiveRpcError\", error });\n throw error;\n }\n\n this.emit(\"debug\", { action: \"receiveRpcResult\", result });\n\n if (\"result\" in result) {\n return Network.from(getBigInt(result.result));\n }\n\n throw this.getRpcError(payload, result);\n })();\n\n return await this.#pendingDetectNetwork;\n }\n\n /**\n * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls\n * will be passed to [[_send]] from [[send]]. If it is overridden, then\n * ``super._start()`` **MUST** be called.\n *\n * Calling it multiple times is safe and has no effect.\n */\n _start(): void {\n if (this.#notReady == null || this.#notReady.resolve == null) { return; }\n\n this.#notReady.resolve();\n this.#notReady = null;\n\n (async () => {\n\n // Bootstrap the network\n while (this.#network == null && !this.destroyed) {\n try {\n this.#network = await this._detectNetwork();\n } catch (error) {\n if (this.destroyed) { break; }\n console.log(\"JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)\");\n this.emit(\"error\", makeError(\"failed to bootstrap network detection\", \"NETWORK_ERROR\", { event: \"initial-network-discovery\", info: { error } }));\n await stall(1000);\n }\n }\n\n // Start dispatching requests\n this.#scheduleDrain();\n })();\n }\n\n /**\n * Resolves once the [[_start]] has been called. This can be used in\n * sub-classes to defer sending data until the connection has been\n * established.\n */\n async _waitUntilReady(): Promise {\n if (this.#notReady == null) { return; }\n return await this.#notReady.promise;\n }\n\n\n /**\n * Return a Subscriber that will manage the %%sub%%.\n *\n * Sub-classes may override this to modify the behavior of\n * subscription management.\n */\n _getSubscriber(sub: Subscription): Subscriber {\n\n // Pending Filters aren't availble via polling\n if (sub.type === \"pending\") { return new FilterIdPendingSubscriber(this); }\n\n if (sub.type === \"event\") {\n if (this._getOption(\"polling\")) {\n return new PollingEventSubscriber(this, sub.filter);\n }\n return new FilterIdEventSubscriber(this, sub.filter);\n }\n\n // Orphaned Logs are handled automatically, by the filter, since\n // logs with removed are emitted by it\n if (sub.type === \"orphan\" && sub.filter.orphan === \"drop-log\") {\n return new UnmanagedSubscriber(\"orphan\");\n }\n\n return super._getSubscriber(sub);\n }\n\n /**\n * Returns true only if the [[_start]] has been called.\n */\n get ready(): boolean { return this.#notReady == null; }\n\n /**\n * Returns %%tx%% as a normalized JSON-RPC transaction request,\n * which has all values hexlified and any numeric values converted\n * to Quantity values.\n */\n getRpcTransaction(tx: TransactionRequest): JsonRpcTransactionRequest {\n const result: JsonRpcTransactionRequest = {};\n\n // JSON-RPC now requires numeric values to be \"quantity\" values\n [\"chainId\", \"gasLimit\", \"gasPrice\", \"type\", \"maxFeePerGas\", \"maxPriorityFeePerGas\", \"nonce\", \"value\"].forEach((key) => {\n if ((tx)[key] == null) { return; }\n let dstKey = key;\n if (key === \"gasLimit\") { dstKey = \"gas\"; }\n (result)[dstKey] = toQuantity(getBigInt((tx)[key], `tx.${ key }`));\n });\n\n // Make sure addresses and data are lowercase\n [\"from\", \"to\", \"data\"].forEach((key) => {\n if ((tx)[key] == null) { return; }\n (result)[key] = hexlify((tx)[key]);\n });\n\n // Normalize the access list object\n if (tx.accessList) {\n result[\"accessList\"] = accessListify(tx.accessList);\n }\n\n return result;\n }\n\n /**\n * Returns the request method and arguments required to perform\n * %%req%%.\n */\n getRpcRequest(req: PerformActionRequest): null | { method: string, args: Array } {\n switch (req.method) {\n case \"chainId\":\n return { method: \"eth_chainId\", args: [ ] };\n\n case \"getBlockNumber\":\n return { method: \"eth_blockNumber\", args: [ ] };\n\n case \"getGasPrice\":\n return { method: \"eth_gasPrice\", args: [] };\n\n case \"getPriorityFee\":\n return { method: \"eth_maxPriorityFeePerGas\", args: [ ] };\n\n case \"getBalance\":\n return {\n method: \"eth_getBalance\",\n args: [ getLowerCase(req.address), req.blockTag ]\n };\n\n case \"getTransactionCount\":\n return {\n method: \"eth_getTransactionCount\",\n args: [ getLowerCase(req.address), req.blockTag ]\n };\n\n case \"getCode\":\n return {\n method: \"eth_getCode\",\n args: [ getLowerCase(req.address), req.blockTag ]\n };\n\n case \"getStorage\":\n return {\n method: \"eth_getStorageAt\",\n args: [\n getLowerCase(req.address),\n (\"0x\" + req.position.toString(16)),\n req.blockTag\n ]\n };\n\n case \"broadcastTransaction\":\n return {\n method: \"eth_sendRawTransaction\",\n args: [ req.signedTransaction ]\n };\n\n case \"getBlock\":\n if (\"blockTag\" in req) {\n return {\n method: \"eth_getBlockByNumber\",\n args: [ req.blockTag, !!req.includeTransactions ]\n };\n } else if (\"blockHash\" in req) {\n return {\n method: \"eth_getBlockByHash\",\n args: [ req.blockHash, !!req.includeTransactions ]\n };\n }\n break;\n\n case \"getTransaction\":\n return {\n method: \"eth_getTransactionByHash\",\n args: [ req.hash ]\n };\n\n case \"getTransactionReceipt\":\n return {\n method: \"eth_getTransactionReceipt\",\n args: [ req.hash ]\n };\n\n case \"call\":\n return {\n method: \"eth_call\",\n args: [ this.getRpcTransaction(req.transaction), req.blockTag ]\n };\n\n case \"estimateGas\": {\n return {\n method: \"eth_estimateGas\",\n args: [ this.getRpcTransaction(req.transaction) ]\n };\n }\n\n case \"getLogs\":\n if (req.filter && req.filter.address != null) {\n if (Array.isArray(req.filter.address)) {\n req.filter.address = req.filter.address.map(getLowerCase);\n } else {\n req.filter.address = getLowerCase(req.filter.address);\n }\n }\n return { method: \"eth_getLogs\", args: [ req.filter ] };\n }\n\n return null;\n }\n\n /**\n * Returns an ethers-style Error for the given JSON-RPC error\n * %%payload%%, coalescing the various strings and error shapes\n * that different nodes return, coercing them into a machine-readable\n * standardized error.\n */\n getRpcError(payload: JsonRpcPayload, _error: JsonRpcError): Error {\n const { method } = payload;\n const { error } = _error;\n\n if (method === \"eth_estimateGas\" && error.message) {\n const msg = error.message;\n if (!msg.match(/revert/i) && msg.match(/insufficient funds/i)) {\n return makeError(\"insufficient funds\", \"INSUFFICIENT_FUNDS\", {\n transaction: ((payload).params[0]),\n info: { payload, error }\n });\n }\n }\n\n if (method === \"eth_call\" || method === \"eth_estimateGas\") {\n const result = spelunkData(error);\n\n const e = AbiCoder.getBuiltinCallException(\n (method === \"eth_call\") ? \"call\": \"estimateGas\",\n ((payload).params[0]),\n (result ? result.data: null)\n );\n e.info = { error, payload };\n return e;\n }\n\n // Only estimateGas and call can return arbitrary contract-defined text, so now we\n // we can process text safely.\n\n const message = JSON.stringify(spelunkMessage(error));\n\n if (typeof(error.message) === \"string\" && error.message.match(/user denied|ethers-user-denied/i)) {\n const actionMap: Record = {\n eth_sign: \"signMessage\",\n personal_sign: \"signMessage\",\n eth_signTypedData_v4: \"signTypedData\",\n eth_signTransaction: \"signTransaction\",\n eth_sendTransaction: \"sendTransaction\",\n eth_requestAccounts: \"requestAccess\",\n wallet_requestAccounts: \"requestAccess\",\n };\n\n return makeError(`user rejected action`, \"ACTION_REJECTED\", {\n action: (actionMap[method] || \"unknown\") ,\n reason: \"rejected\",\n info: { payload, error }\n });\n }\n\n if (method === \"eth_sendRawTransaction\" || method === \"eth_sendTransaction\") {\n const transaction = >((payload).params[0]);\n\n if (message.match(/insufficient funds|base fee exceeds gas limit/i)) {\n return makeError(\"insufficient funds for intrinsic transaction cost\", \"INSUFFICIENT_FUNDS\", {\n transaction, info: { error }\n });\n }\n\n if (message.match(/nonce/i) && message.match(/too low/i)) {\n return makeError(\"nonce has already been used\", \"NONCE_EXPIRED\", { transaction, info: { error } });\n }\n\n // \"replacement transaction underpriced\"\n if (message.match(/replacement transaction/i) && message.match(/underpriced/i)) {\n return makeError(\"replacement fee too low\", \"REPLACEMENT_UNDERPRICED\", { transaction, info: { error } });\n }\n\n if (message.match(/only replay-protected/i)) {\n return makeError(\"legacy pre-eip-155 transactions not supported\", \"UNSUPPORTED_OPERATION\", {\n operation: method, info: { transaction, info: { error } }\n });\n }\n }\n\n let unsupported = !!message.match(/the method .* does not exist/i);\n if (!unsupported) {\n if (error && (error).details && (error).details.startsWith(\"Unauthorized method:\")) {\n unsupported = true;\n }\n }\n\n if (unsupported) {\n return makeError(\"unsupported operation\", \"UNSUPPORTED_OPERATION\", {\n operation: payload.method, info: { error, payload }\n });\n }\n\n return makeError(\"could not coalesce error\", \"UNKNOWN_ERROR\", { error, payload });\n }\n\n\n /**\n * Requests the %%method%% with %%params%% via the JSON-RPC protocol\n * over the underlying channel. This can be used to call methods\n * on the backend that do not have a high-level API within the Provider\n * API.\n *\n * This method queues requests according to the batch constraints\n * in the options, assigns the request a unique ID.\n *\n * **Do NOT override** this method in sub-classes; instead\n * override [[_send]] or force the options values in the\n * call to the constructor to modify this method's behavior.\n */\n send(method: string, params: Array | Record): Promise {\n // @TODO: cache chainId?? purge on switch_networks\n\n // We have been destroyed; no operations are supported anymore\n if (this.destroyed) {\n return Promise.reject(makeError(\"provider destroyed; cancelled request\", \"UNSUPPORTED_OPERATION\", { operation: method }));\n }\n\n const id = this.#nextId++;\n const promise = new Promise((resolve, reject) => {\n this.#payloads.push({\n resolve, reject,\n payload: { method, params, id, jsonrpc: \"2.0\" }\n });\n });\n\n // If there is not a pending drainTimer, set one\n this.#scheduleDrain();\n\n return >promise;\n }\n\n /**\n * Resolves to the [[Signer]] account for %%address%% managed by\n * the client.\n *\n * If the %%address%% is a number, it is used as an index in the\n * the accounts from [[listAccounts]].\n *\n * This can only be used on clients which manage accounts (such as\n * Geth with imported account or MetaMask).\n *\n * Throws if the account doesn't exist.\n */\n async getSigner(address?: number | string): Promise {\n if (address == null) { address = 0; }\n\n const accountsPromise = this.send(\"eth_accounts\", [ ]);\n\n // Account index\n if (typeof(address) === \"number\") {\n const accounts = >(await accountsPromise);\n if (address >= accounts.length) { throw new Error(\"no such account\"); }\n return new JsonRpcSigner(this, accounts[address]);\n }\n\n const { accounts } = await resolveProperties({\n network: this.getNetwork(),\n accounts: accountsPromise\n });\n\n // Account address\n address = getAddress(address);\n for (const account of accounts) {\n if (getAddress(account) === address) {\n return new JsonRpcSigner(this, address);\n }\n }\n\n throw new Error(\"invalid account\");\n }\n\n async listAccounts(): Promise> {\n const accounts: Array = await this.send(\"eth_accounts\", [ ]);\n return accounts.map((a) => new JsonRpcSigner(this, a));\n }\n\n destroy(): void {\n\n // Stop processing requests\n if (this.#drainTimer) {\n clearTimeout(this.#drainTimer);\n this.#drainTimer = null;\n }\n\n // Cancel all pending requests\n for (const { payload, reject } of this.#payloads) {\n reject(makeError(\"provider destroyed; cancelled request\", \"UNSUPPORTED_OPERATION\", { operation: payload.method }));\n }\n\n this.#payloads = [ ];\n\n // Parent clean-up\n super.destroy();\n\n }\n}\n\n// @TODO: remove this in v7, it is not exported because this functionality\n// is exposed in the JsonRpcApiProvider by setting polling to true. It should\n// be safe to remove regardless, because it isn't reachable, but just in case.\n/**\n * @_ignore:\n */\nexport abstract class JsonRpcApiPollingProvider extends JsonRpcApiProvider {\n #pollingInterval: number;\n constructor(network?: Networkish, options?: JsonRpcApiProviderOptions) {\n super(network, options);\n\n this.#pollingInterval = 4000;\n }\n\n _getSubscriber(sub: Subscription): Subscriber {\n const subscriber = super._getSubscriber(sub);\n if (isPollable(subscriber)) {\n subscriber.pollingInterval = this.#pollingInterval;\n }\n return subscriber;\n }\n\n /**\n * The polling interval (default: 4000 ms)\n */\n get pollingInterval(): number { return this.#pollingInterval; }\n set pollingInterval(value: number) {\n if (!Number.isInteger(value) || value < 0) { throw new Error(\"invalid interval\"); }\n this.#pollingInterval = value;\n this._forEachSubscriber((sub) => {\n if (isPollable(sub)) {\n sub.pollingInterval = this.#pollingInterval;\n }\n });\n }\n}\n\n/**\n * The JsonRpcProvider is one of the most common Providers,\n * which performs all operations over HTTP (or HTTPS) requests.\n *\n * Events are processed by polling the backend for the current block\n * number; when it advances, all block-base events are then checked\n * for updates.\n */\nexport class JsonRpcProvider extends JsonRpcApiPollingProvider {\n #connect: FetchRequest;\n\n constructor(url?: string | FetchRequest, network?: Networkish, options?: JsonRpcApiProviderOptions) {\n if (url == null) { url = \"http:/\\/localhost:8545\"; }\n super(network, options);\n\n if (typeof(url) === \"string\") {\n this.#connect = new FetchRequest(url);\n } else {\n this.#connect = url.clone();\n }\n }\n\n _getConnection(): FetchRequest {\n return this.#connect.clone();\n }\n\n async send(method: string, params: Array | Record): Promise {\n // All requests are over HTTP, so we can just start handling requests\n // We do this here rather than the constructor so that we don't send any\n // requests to the network (i.e. eth_chainId) until we absolutely have to.\n await this._start();\n\n return await super.send(method, params);\n }\n\n async _send(payload: JsonRpcPayload | Array): Promise> {\n // Configure a POST connection for the requested method\n const request = this._getConnection();\n request.body = JSON.stringify(payload);\n request.setHeader(\"content-type\", \"application/json\");\n const response = await request.send();\n response.assertOk();\n\n let resp = response.bodyJson;\n if (!Array.isArray(resp)) { resp = [ resp ]; }\n\n return resp;\n }\n}\n\nfunction spelunkData(value: any): null | { message: string, data: string } {\n if (value == null) { return null; }\n\n // These *are* the droids we're looking for.\n if (typeof(value.message) === \"string\" && value.message.match(/revert/i) && isHexString(value.data)) {\n return { message: value.message, data: value.data };\n }\n\n // Spelunk further...\n if (typeof(value) === \"object\") {\n for (const key in value) {\n const result = spelunkData(value[key]);\n if (result) { return result; }\n }\n return null;\n }\n\n // Might be a JSON string we can further descend...\n if (typeof(value) === \"string\") {\n try {\n return spelunkData(JSON.parse(value));\n } catch (error) { }\n }\n\n return null;\n}\n\nfunction _spelunkMessage(value: any, result: Array): void {\n if (value == null) { return; }\n\n // These *are* the droids we're looking for.\n if (typeof(value.message) === \"string\") {\n result.push(value.message);\n }\n\n // Spelunk further...\n if (typeof(value) === \"object\") {\n for (const key in value) {\n _spelunkMessage(value[key], result);\n }\n }\n\n // Might be a JSON string we can further descend...\n if (typeof(value) === \"string\") {\n try {\n return _spelunkMessage(JSON.parse(value), result);\n } catch (error) { }\n }\n}\n\nfunction spelunkMessage(value: any): Array {\n const result: Array = [ ];\n _spelunkMessage(value, result);\n return result;\n}\n", "/**\n * [[link-ankr]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Sepolia Testnet (``sepolia``)\n * - Arbitrum (``arbitrum``)\n * - Base (``base``)\n * - Base Goerlia Testnet (``base-goerli``)\n * - Base Sepolia Testnet (``base-sepolia``)\n * - BNB (``bnb``)\n * - BNB Testnet (``bnbt``)\n * - Optimism (``optimism``)\n * - Optimism Goerli Testnet (``optimism-goerli``)\n * - Optimism Sepolia Testnet (``optimism-sepolia``)\n * - Polygon (``matic``)\n * - Polygon Mumbai Testnet (``matic-mumbai``)\n *\n * @_subsection: api/providers/thirdparty:Ankr [providers-ankr]\n */\nimport {\n defineProperties, FetchRequest, assertArgument\n} from \"../utils/index.js\";\n\nimport { AbstractProvider } from \"./abstract-provider.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\n\nimport type { CommunityResourcable } from \"./community.js\";\nimport type { Networkish } from \"./network.js\";\nimport type { JsonRpcError, JsonRpcPayload } from \"./provider-jsonrpc.js\";\n\n\nconst defaultApiKey = \"9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972\";\n\nfunction getHost(name: string): string {\n switch (name) {\n case \"mainnet\":\n return \"rpc.ankr.com/eth\";\n case \"goerli\":\n return \"rpc.ankr.com/eth_goerli\";\n case \"sepolia\":\n return \"rpc.ankr.com/eth_sepolia\";\n\n case \"arbitrum\":\n return \"rpc.ankr.com/arbitrum\";\n case \"base\":\n return \"rpc.ankr.com/base\";\n case \"base-goerli\":\n return \"rpc.ankr.com/base_goerli\";\n case \"base-sepolia\":\n return \"rpc.ankr.com/base_sepolia\";\n case \"bnb\":\n return \"rpc.ankr.com/bsc\";\n case \"bnbt\":\n return \"rpc.ankr.com/bsc_testnet_chapel\";\n case \"matic\":\n return \"rpc.ankr.com/polygon\";\n case \"matic-mumbai\":\n return \"rpc.ankr.com/polygon_mumbai\";\n case \"optimism\":\n return \"rpc.ankr.com/optimism\";\n case \"optimism-goerli\":\n return \"rpc.ankr.com/optimism_testnet\";\n case \"optimism-sepolia\":\n return \"rpc.ankr.com/optimism_sepolia\";\n }\n\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n\n\n/**\n * The **AnkrProvider** connects to the [[link-ankr]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-ankr-signup).\n */\nexport class AnkrProvider extends JsonRpcProvider implements CommunityResourcable {\n\n /**\n * The API key for the Ankr connection.\n */\n readonly apiKey!: string;\n\n /**\n * Create a new **AnkrProvider**.\n *\n * By default connecting to ``mainnet`` with a highly throttled\n * API key.\n */\n constructor(_network?: Networkish, apiKey?: null | string) {\n if (_network == null) { _network = \"mainnet\"; }\n const network = Network.from(_network);\n if (apiKey == null) { apiKey = defaultApiKey; }\n\n // Ankr does not support filterId, so we force polling\n const options = { polling: true, staticNetwork: network };\n\n const request = AnkrProvider.getRequest(network, apiKey);\n super(request, network, options);\n\n defineProperties(this, { apiKey });\n }\n\n _getProvider(chainId: number): AbstractProvider {\n try {\n return new AnkrProvider(chainId, this.apiKey);\n } catch (error) { }\n return super._getProvider(chainId);\n }\n\n /**\n * Returns a prepared request for connecting to %%network%% with\n * %%apiKey%%.\n */\n static getRequest(network: Network, apiKey?: null | string): FetchRequest {\n if (apiKey == null) { apiKey = defaultApiKey; }\n\n const request = new FetchRequest(`https:/\\/${ getHost(network.name) }/${ apiKey }`);\n request.allowGzip = true;\n\n if (apiKey === defaultApiKey) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"AnkrProvider\");\n return true;\n };\n }\n\n return request;\n }\n\n getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error {\n if (payload.method === \"eth_sendRawTransaction\") {\n if (error && error.error && error.error.message === \"INTERNAL_ERROR: could not replace existing tx\") {\n error.error.message = \"replacement transaction underpriced\";\n }\n }\n\n return super.getRpcError(payload, error);\n }\n\n isCommunityResource(): boolean {\n return (this.apiKey === defaultApiKey);\n }\n}\n", "/**\n * [[link-alchemy]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Sepolia Testnet (``sepolia``)\n * - Arbitrum (``arbitrum``)\n * - Arbitrum Goerli Testnet (``arbitrum-goerli``)\n * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)\n * - Base (``base``)\n * - Base Goerlia Testnet (``base-goerli``)\n * - Base Sepolia Testnet (``base-sepolia``)\n * - Optimism (``optimism``)\n * - Optimism Goerli Testnet (``optimism-goerli``)\n * - Optimism Sepolia Testnet (``optimism-sepolia``)\n * - Polygon (``matic``)\n * - Polygon Mumbai Testnet (``matic-mumbai``)\n *\n * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy]\n */\n\nimport {\n defineProperties, resolveProperties, assert, assertArgument,\n FetchRequest\n} from \"../utils/index.js\";\n\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\n\nimport type { AbstractProvider, PerformActionRequest } from \"./abstract-provider.js\";\nimport type { CommunityResourcable } from \"./community.js\";\nimport type { Networkish } from \"./network.js\";\n\n\nconst defaultApiKey = \"_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC\"\n\nfunction getHost(name: string): string {\n switch(name) {\n case \"mainnet\":\n return \"eth-mainnet.alchemyapi.io\";\n case \"goerli\":\n return \"eth-goerli.g.alchemy.com\";\n case \"sepolia\":\n return \"eth-sepolia.g.alchemy.com\";\n\n case \"arbitrum\":\n return \"arb-mainnet.g.alchemy.com\";\n case \"arbitrum-goerli\":\n return \"arb-goerli.g.alchemy.com\";\n case \"arbitrum-sepolia\":\n return \"arb-sepolia.g.alchemy.com\";\n case \"base\":\n return \"base-mainnet.g.alchemy.com\";\n case \"base-goerli\":\n return \"base-goerli.g.alchemy.com\";\n case \"base-sepolia\":\n return \"base-sepolia.g.alchemy.com\";\n case \"matic\":\n return \"polygon-mainnet.g.alchemy.com\";\n case \"matic-mumbai\":\n return \"polygon-mumbai.g.alchemy.com\";\n case \"optimism\":\n return \"opt-mainnet.g.alchemy.com\";\n case \"optimism-goerli\":\n return \"opt-goerli.g.alchemy.com\";\n case \"optimism-sepolia\":\n return \"opt-sepolia.g.alchemy.com\";\n }\n\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n\n/**\n * The **AlchemyProvider** connects to the [[link-alchemy]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-alchemy-signup).\n *\n * @_docloc: api/providers/thirdparty\n */\nexport class AlchemyProvider extends JsonRpcProvider implements CommunityResourcable {\n readonly apiKey!: string;\n\n constructor(_network?: Networkish, apiKey?: null | string) {\n if (_network == null) { _network = \"mainnet\"; }\n const network = Network.from(_network);\n if (apiKey == null) { apiKey = defaultApiKey; }\n\n const request = AlchemyProvider.getRequest(network, apiKey);\n super(request, network, { staticNetwork: network });\n\n defineProperties(this, { apiKey });\n }\n\n _getProvider(chainId: number): AbstractProvider {\n try {\n return new AlchemyProvider(chainId, this.apiKey);\n } catch (error) { }\n return super._getProvider(chainId);\n }\n\n async _perform(req: PerformActionRequest): Promise {\n\n // https://docs.alchemy.com/reference/trace-transaction\n if (req.method === \"getTransactionResult\") {\n const { trace, tx } = await resolveProperties({\n trace: this.send(\"trace_transaction\", [ req.hash ]),\n tx: this.getTransaction(req.hash)\n });\n if (trace == null || tx == null) { return null; }\n\n let data: undefined | string;\n let error = false;\n try {\n data = trace[0].result.output;\n error = (trace[0].error === \"Reverted\");\n } catch (error) { }\n\n if (data) {\n assert(!error, \"an error occurred during transaction executions\", \"CALL_EXCEPTION\", {\n action: \"getTransactionResult\",\n data,\n reason: null,\n transaction: tx,\n invocation: null,\n revert: null // @TODO\n });\n return data;\n }\n\n assert(false, \"could not parse trace result\", \"BAD_DATA\", { value: trace });\n }\n\n return await super._perform(req);\n }\n\n isCommunityResource(): boolean {\n return (this.apiKey === defaultApiKey);\n }\n\n static getRequest(network: Network, apiKey?: string): FetchRequest {\n if (apiKey == null) { apiKey = defaultApiKey; }\n\n const request = new FetchRequest(`https:/\\/${ getHost(network.name) }/v2/${ apiKey }`);\n request.allowGzip = true;\n\n if (apiKey === defaultApiKey) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"alchemy\");\n return true;\n }\n }\n\n return request;\n }\n}\n", "/**\n * About Cloudflare\n *\n * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare]\n */\n\nimport { assertArgument } from \"../utils/index.js\";\n\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\n\nimport type { Networkish } from \"./network.js\";\n\n/**\n * About Cloudflare...\n */\nexport class CloudflareProvider extends JsonRpcProvider {\n constructor(_network?: Networkish) {\n if (_network == null) { _network = \"mainnet\"; }\n const network = Network.from(_network);\n assertArgument(network.name === \"mainnet\", \"unsupported network\", \"network\", _network);\n super(\"https:/\\/cloudflare-eth.com/\", network, { staticNetwork: network });\n }\n}\n", "/**\n * [[link-etherscan]] provides a third-party service for connecting to\n * various blockchains over a combination of JSON-RPC and custom API\n * endpoints.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Sepolia Testnet (``sepolia``)\n * - Sepolia Testnet (``holesky``)\n * - Arbitrum (``arbitrum``)\n * - Arbitrum Goerli Testnet (``arbitrum-goerli``)\n * - BNB Smart Chain Mainnet (``bnb``)\n * - BNB Smart Chain Testnet (``bnbt``)\n * - Optimism (``optimism``)\n * - Optimism Goerli Testnet (``optimism-goerli``)\n * - Polygon (``matic``)\n * - Polygon Mumbai Testnet (``matic-mumbai``)\n *\n * @_subsection api/providers/thirdparty:Etherscan [providers-etherscan]\n */\n\nimport { AbiCoder } from \"../abi/index.js\";\nimport { Contract } from \"../contract/index.js\";\nimport { accessListify, Transaction } from \"../transaction/index.js\";\nimport {\n defineProperties,\n hexlify, toQuantity,\n FetchRequest,\n assert, assertArgument, isError,\n// parseUnits,\n toUtf8String\n } from \"../utils/index.js\";\n\nimport { AbstractProvider } from \"./abstract-provider.js\";\nimport { Network } from \"./network.js\";\nimport { NetworkPlugin } from \"./plugins-network.js\";\nimport { showThrottleMessage } from \"./community.js\";\n\nimport { PerformActionRequest } from \"./abstract-provider.js\";\nimport type { Networkish } from \"./network.js\";\n//import type { } from \"./pagination\";\nimport type { TransactionRequest } from \"./provider.js\";\n\nconst THROTTLE = 2000;\n\nfunction isPromise(value: any): value is Promise {\n return (value && typeof(value.then) === \"function\");\n}\n\n\n/**\n * When subscribing to the ``\"debug\"`` event on an Etherscan-based\n * provider, the events receive a **DebugEventEtherscanProvider**\n * payload.\n *\n * @_docloc: api/providers/thirdparty:Etherscan\n */\nexport type DebugEventEtherscanProvider = {\n action: \"sendRequest\",\n id: number,\n url: string,\n payload: Record\n} | {\n action: \"receiveRequest\",\n id: number,\n result: any\n} | {\n action: \"receiveError\",\n id: number,\n error: any\n};\n\nconst EtherscanPluginId = \"org.ethers.plugins.provider.Etherscan\";\n\n/**\n * A Network can include an **EtherscanPlugin** to provide\n * a custom base URL.\n *\n * @_docloc: api/providers/thirdparty:Etherscan\n */\nexport class EtherscanPlugin extends NetworkPlugin {\n /**\n * The Etherscan API base URL.\n */\n readonly baseUrl!: string;\n\n /**\n * Creates a new **EtherscanProvider** which will use\n * %%baseUrl%%.\n */\n constructor(baseUrl: string) {\n super(EtherscanPluginId);\n defineProperties(this, { baseUrl });\n }\n\n clone(): EtherscanPlugin {\n return new EtherscanPlugin(this.baseUrl);\n }\n}\n\nconst skipKeys = [ \"enableCcipRead\" ];\n\nlet nextId = 1;\n\n/**\n * The **EtherscanBaseProvider** is the super-class of\n * [[EtherscanProvider]], which should generally be used instead.\n *\n * Since the **EtherscanProvider** includes additional code for\n * [[Contract]] access, in //rare cases// that contracts are not\n * used, this class can reduce code size.\n *\n * @_docloc: api/providers/thirdparty:Etherscan\n */\nexport class EtherscanProvider extends AbstractProvider {\n\n /**\n * The connected network.\n */\n readonly network!: Network;\n\n /**\n * The API key or null if using the community provided bandwidth.\n */\n readonly apiKey!: null | string;\n\n readonly #plugin: null | EtherscanPlugin;\n\n /**\n * Creates a new **EtherscanBaseProvider**.\n */\n constructor(_network?: Networkish, _apiKey?: string) {\n const apiKey = (_apiKey != null) ? _apiKey: null;\n\n super();\n\n const network = Network.from(_network);\n\n this.#plugin = network.getPlugin(EtherscanPluginId);\n\n defineProperties(this, { apiKey, network });\n\n // Test that the network is supported by Etherscan\n this.getBaseUrl();\n }\n\n /**\n * Returns the base URL.\n *\n * If an [[EtherscanPlugin]] is configured on the\n * [[EtherscanBaseProvider_network]], returns the plugin's\n * baseUrl.\n */\n getBaseUrl(): string {\n if (this.#plugin) { return this.#plugin.baseUrl; }\n\n switch(this.network.name) {\n case \"mainnet\":\n return \"https:/\\/api.etherscan.io\";\n case \"goerli\":\n return \"https:/\\/api-goerli.etherscan.io\";\n case \"sepolia\":\n return \"https:/\\/api-sepolia.etherscan.io\";\n case \"holesky\":\n return \"https:/\\/api-holesky.etherscan.io\";\n\n case \"arbitrum\":\n return \"https:/\\/api.arbiscan.io\";\n case \"arbitrum-goerli\":\n return \"https:/\\/api-goerli.arbiscan.io\";\n case \"bnb\":\n return \"https:/\\/api.bscscan.com\";\n case \"bnbt\":\n return \"https:/\\/api-testnet.bscscan.com\";\n case \"matic\":\n return \"https:/\\/api.polygonscan.com\";\n case \"matic-mumbai\":\n return \"https:/\\/api-testnet.polygonscan.com\";\n case \"optimism\":\n return \"https:/\\/api-optimistic.etherscan.io\";\n case \"optimism-goerli\":\n return \"https:/\\/api-goerli-optimistic.etherscan.io\";\n\n default:\n }\n\n assertArgument(false, \"unsupported network\", \"network\", this.network);\n }\n\n /**\n * Returns the URL for the %%module%% and %%params%%.\n */\n getUrl(module: string, params: Record): string {\n const query = Object.keys(params).reduce((accum, key) => {\n const value = params[key];\n if (value != null) {\n accum += `&${ key }=${ value }`\n }\n return accum\n }, \"\");\n const apiKey = ((this.apiKey) ? `&apikey=${ this.apiKey }`: \"\");\n return `${ this.getBaseUrl() }/api?module=${ module }${ query }${ apiKey }`;\n }\n\n /**\n * Returns the URL for using POST requests.\n */\n getPostUrl(): string {\n return `${ this.getBaseUrl() }/api`;\n }\n\n /**\n * Returns the parameters for using POST requests.\n */\n getPostData(module: string, params: Record): Record {\n params.module = module;\n params.apikey = this.apiKey;\n return params;\n }\n\n async detectNetwork(): Promise {\n return this.network;\n }\n\n /**\n * Resolves to the result of calling %%module%% with %%params%%.\n *\n * If %%post%%, the request is made as a POST request.\n */\n async fetch(module: string, params: Record, post?: boolean): Promise {\n const id = nextId++;\n\n const url = (post ? this.getPostUrl(): this.getUrl(module, params));\n const payload = (post ? this.getPostData(module, params): null);\n\n this.emit(\"debug\", { action: \"sendRequest\", id, url, payload: payload });\n\n const request = new FetchRequest(url);\n request.setThrottleParams({ slotInterval: 1000 });\n request.retryFunc = (req, resp, attempt: number) => {\n if (this.isCommunityResource()) {\n showThrottleMessage(\"Etherscan\");\n }\n return Promise.resolve(true);\n };\n request.processFunc = async (request, response) => {\n const result = response.hasBody() ? JSON.parse(toUtf8String(response.body)): { };\n const throttle = ((typeof(result.result) === \"string\") ? result.result: \"\").toLowerCase().indexOf(\"rate limit\") >= 0;\n if (module === \"proxy\") {\n // This JSON response indicates we are being throttled\n if (result && result.status == 0 && result.message == \"NOTOK\" && throttle) {\n this.emit(\"debug\", { action: \"receiveError\", id, reason: \"proxy-NOTOK\", error: result });\n response.throwThrottleError(result.result, THROTTLE);\n }\n } else {\n if (throttle) {\n this.emit(\"debug\", { action: \"receiveError\", id, reason: \"null result\", error: result.result });\n response.throwThrottleError(result.result, THROTTLE);\n }\n }\n return response;\n };\n\n if (payload) {\n request.setHeader(\"content-type\", \"application/x-www-form-urlencoded; charset=UTF-8\");\n request.body = Object.keys(payload).map((k) => `${ k }=${ payload[k] }`).join(\"&\");\n }\n\n const response = await request.send();\n try {\n response.assertOk();\n } catch (error) {\n this.emit(\"debug\", { action: \"receiveError\", id, error, reason: \"assertOk\" });\n assert(false, \"response error\", \"SERVER_ERROR\", { request, response });\n }\n\n if (!response.hasBody()) {\n this.emit(\"debug\", { action: \"receiveError\", id, error: \"missing body\", reason: \"null body\" });\n assert(false, \"missing response\", \"SERVER_ERROR\", { request, response });\n }\n\n const result = JSON.parse(toUtf8String(response.body));\n if (module === \"proxy\") {\n if (result.jsonrpc != \"2.0\") {\n this.emit(\"debug\", { action: \"receiveError\", id, result, reason: \"invalid JSON-RPC\" });\n assert(false, \"invalid JSON-RPC response (missing jsonrpc='2.0')\", \"SERVER_ERROR\", { request, response, info: { result } });\n }\n\n if (result.error) {\n this.emit(\"debug\", { action: \"receiveError\", id, result, reason: \"JSON-RPC error\" });\n assert(false, \"error response\", \"SERVER_ERROR\", { request, response, info: { result } });\n }\n\n this.emit(\"debug\", { action: \"receiveRequest\", id, result });\n\n return result.result;\n\n } else {\n // getLogs, getHistory have weird success responses\n if (result.status == 0 && (result.message === \"No records found\" || result.message === \"No transactions found\")) {\n this.emit(\"debug\", { action: \"receiveRequest\", id, result });\n return result.result;\n }\n\n if (result.status != 1 || (typeof(result.message) === \"string\" && !result.message.match(/^OK/))) {\n this.emit(\"debug\", { action: \"receiveError\", id, result });\n assert(false, \"error response\", \"SERVER_ERROR\", { request, response, info: { result } });\n }\n\n this.emit(\"debug\", { action: \"receiveRequest\", id, result });\n\n return result.result;\n }\n }\n\n /**\n * Returns %%transaction%% normalized for the Etherscan API.\n */\n _getTransactionPostData(transaction: TransactionRequest): Record {\n const result: Record = { };\n for (let key in transaction) {\n if (skipKeys.indexOf(key) >= 0) { continue; }\n\n if ((transaction)[key] == null) { continue; }\n let value = (transaction)[key];\n if (key === \"type\" && value === 0) { continue; }\n if (key === \"blockTag\" && value === \"latest\") { continue; }\n\n // Quantity-types require no leading zero, unless 0\n if (({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true })[key]) {\n value = toQuantity(value);\n } else if (key === \"accessList\") {\n value = \"[\" + accessListify(value).map((set) => {\n return `{address:\"${ set.address }\",storageKeys:[\"${ set.storageKeys.join('\",\"') }\"]}`;\n }).join(\",\") + \"]\";\n } else {\n value = hexlify(value);\n }\n result[key] = value;\n }\n return result;\n }\n\n /**\n * Throws the normalized Etherscan error.\n */\n _checkError(req: PerformActionRequest, error: Error, transaction: any): never {\n\n // Pull any message out if, possible\n let message = \"\";\n if (isError(error, \"SERVER_ERROR\")) {\n // Check for an error emitted by a proxy call\n try {\n message = (error).info.result.error.message;\n } catch (e) { }\n\n if (!message) {\n try {\n message = (error).info.message;\n } catch (e) { }\n }\n }\n\n if (req.method === \"estimateGas\") {\n if (!message.match(/revert/i) && message.match(/insufficient funds/i)) {\n assert(false, \"insufficient funds\", \"INSUFFICIENT_FUNDS\", {\n transaction: req.transaction\n });\n }\n }\n\n if (req.method === \"call\" || req.method === \"estimateGas\") {\n if (message.match(/execution reverted/i)) {\n let data = \"\";\n try {\n data = (error).info.result.error.data;\n } catch (error) { }\n\n const e = AbiCoder.getBuiltinCallException(req.method, req.transaction, data);\n e.info = { request: req, error }\n throw e;\n }\n }\n\n if (message) {\n if (req.method === \"broadcastTransaction\") {\n const transaction = Transaction.from(req.signedTransaction);\n if (message.match(/replacement/i) && message.match(/underpriced/i)) {\n assert(false, \"replacement fee too low\", \"REPLACEMENT_UNDERPRICED\", {\n transaction\n });\n }\n\n if (message.match(/insufficient funds/)) {\n assert(false, \"insufficient funds for intrinsic transaction cost\", \"INSUFFICIENT_FUNDS\", {\n transaction\n });\n }\n\n if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) {\n assert(false, \"nonce has already been used\", \"NONCE_EXPIRED\", {\n transaction\n });\n }\n }\n }\n\n // Something we could not process\n throw error;\n }\n\n async _detectNetwork(): Promise {\n return this.network;\n }\n\n async _perform(req: PerformActionRequest): Promise {\n switch (req.method) {\n case \"chainId\":\n return this.network.chainId;\n\n case \"getBlockNumber\":\n return this.fetch(\"proxy\", { action: \"eth_blockNumber\" });\n\n case \"getGasPrice\":\n return this.fetch(\"proxy\", { action: \"eth_gasPrice\" });\n\n case \"getPriorityFee\":\n // This is temporary until Etherscan completes support\n if (this.network.name === \"mainnet\") {\n return \"1000000000\";\n } else if (this.network.name === \"optimism\") {\n return \"1000000\";\n } else {\n throw new Error(\"fallback onto the AbstractProvider default\");\n }\n /* Working with Etherscan to get this added:\n try {\n const test = await this.fetch(\"proxy\", {\n action: \"eth_maxPriorityFeePerGas\"\n });\n console.log(test);\n return test;\n } catch (e) {\n console.log(\"DEBUG\", e);\n throw e;\n }\n */\n /* This might be safe; but due to rounding neither myself\n or Etherscan are necessarily comfortable with this. :)\n try {\n const result = await this.fetch(\"gastracker\", { action: \"gasoracle\" });\n console.log(result);\n const gasPrice = parseUnits(result.SafeGasPrice, \"gwei\");\n const baseFee = parseUnits(result.suggestBaseFee, \"gwei\");\n const priorityFee = gasPrice - baseFee;\n if (priorityFee < 0) { throw new Error(\"negative priority fee; defer to abstract provider default\"); }\n return priorityFee;\n } catch (error) {\n console.log(\"DEBUG\", error);\n throw error;\n }\n */\n\n case \"getBalance\":\n // Returns base-10 result\n return this.fetch(\"account\", {\n action: \"balance\",\n address: req.address,\n tag: req.blockTag\n });\n\n case \"getTransactionCount\":\n return this.fetch(\"proxy\", {\n action: \"eth_getTransactionCount\",\n address: req.address,\n tag: req.blockTag\n });\n\n case \"getCode\":\n return this.fetch(\"proxy\", {\n action: \"eth_getCode\",\n address: req.address,\n tag: req.blockTag\n });\n\n case \"getStorage\":\n return this.fetch(\"proxy\", {\n action: \"eth_getStorageAt\",\n address: req.address,\n position: req.position,\n tag: req.blockTag\n });\n\n case \"broadcastTransaction\":\n return this.fetch(\"proxy\", {\n action: \"eth_sendRawTransaction\",\n hex: req.signedTransaction\n }, true).catch((error) => {\n return this._checkError(req, error, req.signedTransaction);\n });\n\n case \"getBlock\":\n if (\"blockTag\" in req) {\n return this.fetch(\"proxy\", {\n action: \"eth_getBlockByNumber\",\n tag: req.blockTag,\n boolean: (req.includeTransactions ? \"true\": \"false\")\n });\n }\n\n assert(false, \"getBlock by blockHash not supported by Etherscan\", \"UNSUPPORTED_OPERATION\", {\n operation: \"getBlock(blockHash)\"\n });\n\n case \"getTransaction\":\n return this.fetch(\"proxy\", {\n action: \"eth_getTransactionByHash\",\n txhash: req.hash\n });\n\n case \"getTransactionReceipt\":\n return this.fetch(\"proxy\", {\n action: \"eth_getTransactionReceipt\",\n txhash: req.hash\n });\n\n case \"call\": {\n if (req.blockTag !== \"latest\") {\n throw new Error(\"EtherscanProvider does not support blockTag for call\");\n }\n\n const postData = this._getTransactionPostData(req.transaction);\n postData.module = \"proxy\";\n postData.action = \"eth_call\";\n\n try {\n return await this.fetch(\"proxy\", postData, true);\n } catch (error) {\n return this._checkError(req, error, req.transaction);\n }\n }\n\n case \"estimateGas\": {\n const postData = this._getTransactionPostData(req.transaction);\n postData.module = \"proxy\";\n postData.action = \"eth_estimateGas\";\n\n try {\n return await this.fetch(\"proxy\", postData, true);\n } catch (error) {\n return this._checkError(req, error, req.transaction);\n }\n }\n/*\n case \"getLogs\": {\n // Needs to complain if more than one address is passed in\n const args: Record = { action: \"getLogs\" }\n\n if (params.filter.fromBlock) {\n args.fromBlock = checkLogTag(params.filter.fromBlock);\n }\n\n if (params.filter.toBlock) {\n args.toBlock = checkLogTag(params.filter.toBlock);\n }\n\n if (params.filter.address) {\n args.address = params.filter.address;\n }\n\n // @TODO: We can handle slightly more complicated logs using the logs API\n if (params.filter.topics && params.filter.topics.length > 0) {\n if (params.filter.topics.length > 1) {\n logger.throwError(\"unsupported topic count\", Logger.Errors.UNSUPPORTED_OPERATION, { topics: params.filter.topics });\n }\n if (params.filter.topics.length === 1) {\n const topic0 = params.filter.topics[0];\n if (typeof(topic0) !== \"string\" || topic0.length !== 66) {\n logger.throwError(\"unsupported topic format\", Logger.Errors.UNSUPPORTED_OPERATION, { topic0: topic0 });\n }\n args.topic0 = topic0;\n }\n }\n\n const logs: Array = await this.fetch(\"logs\", args);\n\n // Cache txHash => blockHash\n let blocks: { [tag: string]: string } = {};\n\n // Add any missing blockHash to the logs\n for (let i = 0; i < logs.length; i++) {\n const log = logs[i];\n if (log.blockHash != null) { continue; }\n if (blocks[log.blockNumber] == null) {\n const block = await this.getBlock(log.blockNumber);\n if (block) {\n blocks[log.blockNumber] = block.hash;\n }\n }\n\n log.blockHash = blocks[log.blockNumber];\n }\n\n return logs;\n }\n*/\n default:\n break;\n }\n\n return super._perform(req);\n }\n\n async getNetwork(): Promise {\n return this.network;\n }\n\n /**\n * Resolves to the current price of ether.\n *\n * This returns ``0`` on any network other than ``mainnet``.\n */\n async getEtherPrice(): Promise {\n if (this.network.name !== \"mainnet\") { return 0.0; }\n return parseFloat((await this.fetch(\"stats\", { action: \"ethprice\" })).ethusd);\n }\n\n /**\n * Resolves to a [Contract]] for %%address%%, using the\n * Etherscan API to retreive the Contract ABI.\n */\n async getContract(_address: string): Promise {\n let address = this._getAddress(_address);\n if (isPromise(address)) { address = await address; }\n\n try {\n const resp = await this.fetch(\"contract\", {\n action: \"getabi\", address });\n const abi = JSON.parse(resp);\n return new Contract(address, abi, this);\n } catch (error) {\n return null;\n }\n }\n\n isCommunityResource(): boolean {\n return (this.apiKey == null);\n }\n}\n", "\nfunction getGlobal(): any {\n if (typeof self !== 'undefined') { return self; }\n if (typeof window !== 'undefined') { return window; }\n if (typeof global !== 'undefined') { return global; }\n throw new Error('unable to locate global object');\n};\n\nconst _WebSocket = getGlobal().WebSocket;\n\nexport { _WebSocket as WebSocket };\n", "/**\n * Generic long-lived socket provider.\n *\n * Sub-classing notes\n * - a sub-class MUST call the `_start()` method once connected\n * - a sub-class MUST override the `_write(string)` method\n * - a sub-class MUST call `_processMessage(string)` for each message\n *\n * @_subsection: api/providers/abstract-provider:Socket Providers [about-socketProvider]\n */\n\nimport { UnmanagedSubscriber } from \"./abstract-provider.js\";\nimport { assert, assertArgument, makeError } from \"../utils/index.js\";\nimport { JsonRpcApiProvider } from \"./provider-jsonrpc.js\";\n\nimport type { Subscriber, Subscription } from \"./abstract-provider.js\";\nimport type { EventFilter } from \"./provider.js\";\nimport type {\n JsonRpcApiProviderOptions, JsonRpcError, JsonRpcPayload, JsonRpcResult\n} from \"./provider-jsonrpc.js\";\nimport type { Networkish } from \"./network.js\";\n\n\ntype JsonRpcSubscription = {\n method: string,\n params: {\n result: any,\n subscription: string\n }\n};\n\n/**\n * A **SocketSubscriber** uses a socket transport to handle events and\n * should use [[_emit]] to manage the events.\n */\nexport class SocketSubscriber implements Subscriber {\n #provider: SocketProvider;\n\n #filter: string;\n\n /**\n * The filter.\n */\n get filter(): Array { return JSON.parse(this.#filter); }\n\n #filterId: null | Promise;\n #paused: null | boolean;\n\n #emitPromise: null | Promise;\n\n /**\n * Creates a new **SocketSubscriber** attached to %%provider%% listening\n * to %%filter%%.\n */\n constructor(provider: SocketProvider, filter: Array) {\n this.#provider = provider;\n this.#filter = JSON.stringify(filter);\n this.#filterId = null;\n this.#paused = null;\n this.#emitPromise = null;\n }\n\n start(): void {\n this.#filterId = this.#provider.send(\"eth_subscribe\", this.filter).then((filterId) => {;\n this.#provider._register(filterId, this);\n return filterId;\n });\n }\n\n stop(): void {\n (>(this.#filterId)).then((filterId) => {\n this.#provider.send(\"eth_unsubscribe\", [ filterId ]);\n });\n this.#filterId = null;\n }\n\n // @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs\n // and resume\n pause(dropWhilePaused?: boolean): void {\n assert(dropWhilePaused, \"preserve logs while paused not supported by SocketSubscriber yet\",\n \"UNSUPPORTED_OPERATION\", { operation: \"pause(false)\" });\n this.#paused = !!dropWhilePaused;\n }\n\n resume(): void {\n this.#paused = null;\n }\n\n /**\n * @_ignore:\n */\n _handleMessage(message: any): void {\n if (this.#filterId == null) { return; }\n if (this.#paused === null) {\n let emitPromise: null | Promise = this.#emitPromise;\n if (emitPromise == null) {\n emitPromise = this._emit(this.#provider, message);\n } else {\n emitPromise = emitPromise.then(async () => {\n await this._emit(this.#provider, message);\n });\n }\n this.#emitPromise = emitPromise.then(() => {\n if (this.#emitPromise === emitPromise) {\n this.#emitPromise = null;\n }\n });\n }\n }\n\n /**\n * Sub-classes **must** override this to emit the events on the\n * provider.\n */\n async _emit(provider: SocketProvider, message: any): Promise {\n throw new Error(\"sub-classes must implemente this; _emit\");\n }\n}\n\n/**\n * A **SocketBlockSubscriber** listens for ``newHeads`` events and emits\n * ``\"block\"`` events.\n */\nexport class SocketBlockSubscriber extends SocketSubscriber {\n /**\n * @_ignore:\n */\n constructor(provider: SocketProvider) {\n super(provider, [ \"newHeads\" ]);\n }\n\n async _emit(provider: SocketProvider, message: any): Promise {\n provider.emit(\"block\", parseInt(message.number));\n }\n}\n\n/**\n * A **SocketPendingSubscriber** listens for pending transacitons and emits\n * ``\"pending\"`` events.\n */\nexport class SocketPendingSubscriber extends SocketSubscriber {\n\n /**\n * @_ignore:\n */\n constructor(provider: SocketProvider) {\n super(provider, [ \"newPendingTransactions\" ]);\n }\n\n async _emit(provider: SocketProvider, message: any): Promise {\n provider.emit(\"pending\", message);\n }\n}\n\n/**\n * A **SocketEventSubscriber** listens for event logs.\n */\nexport class SocketEventSubscriber extends SocketSubscriber {\n #logFilter: string;\n\n /**\n * The filter.\n */\n get logFilter(): EventFilter { return JSON.parse(this.#logFilter); }\n\n /**\n * @_ignore:\n */\n constructor(provider: SocketProvider, filter: EventFilter) {\n super(provider, [ \"logs\", filter ]);\n this.#logFilter = JSON.stringify(filter);\n }\n\n async _emit(provider: SocketProvider, message: any): Promise {\n provider.emit(this.logFilter, provider._wrapLog(message, provider._network));\n }\n}\n\n/**\n * A **SocketProvider** is backed by a long-lived connection over a\n * socket, which can subscribe and receive real-time messages over\n * its communication channel.\n */\nexport class SocketProvider extends JsonRpcApiProvider {\n #callbacks: Map void, reject: (e: Error) => void }>;\n\n // Maps each filterId to its subscriber\n #subs: Map;\n\n // If any events come in before a subscriber has finished\n // registering, queue them\n #pending: Map>;\n\n /**\n * Creates a new **SocketProvider** connected to %%network%%.\n *\n * If unspecified, the network will be discovered.\n */\n constructor(network?: Networkish, _options?: JsonRpcApiProviderOptions) {\n // Copy the options\n const options = Object.assign({ }, (_options != null) ? _options: { });\n\n // Support for batches is generally not supported for\n // connection-base providers; if this changes in the future\n // the _send should be updated to reflect this\n assertArgument(options.batchMaxCount == null || options.batchMaxCount === 1,\n \"sockets-based providers do not support batches\", \"options.batchMaxCount\", _options);\n options.batchMaxCount = 1;\n\n // Socket-based Providers (generally) cannot change their network,\n // since they have a long-lived connection; but let people override\n // this if they have just cause.\n if (options.staticNetwork == null) { options.staticNetwork = true; }\n\n super(network, options);\n this.#callbacks = new Map();\n this.#subs = new Map();\n this.#pending = new Map();\n }\n\n // This value is only valid after _start has been called\n /*\n get _network(): Network {\n if (this.#network == null) {\n throw new Error(\"this shouldn't happen\");\n }\n return this.#network.clone();\n }\n */\n\n _getSubscriber(sub: Subscription): Subscriber {\n switch (sub.type) {\n case \"close\":\n return new UnmanagedSubscriber(\"close\");\n case \"block\":\n return new SocketBlockSubscriber(this);\n case \"pending\":\n return new SocketPendingSubscriber(this);\n case \"event\":\n return new SocketEventSubscriber(this, sub.filter);\n case \"orphan\":\n // Handled auto-matically within AbstractProvider\n // when the log.removed = true\n if (sub.filter.orphan === \"drop-log\") {\n return new UnmanagedSubscriber(\"drop-log\");\n }\n }\n return super._getSubscriber(sub);\n }\n\n /**\n * Register a new subscriber. This is used internalled by Subscribers\n * and generally is unecessary unless extending capabilities.\n */\n _register(filterId: number | string, subscriber: SocketSubscriber): void {\n this.#subs.set(filterId, subscriber);\n const pending = this.#pending.get(filterId);\n if (pending) {\n for (const message of pending) {\n subscriber._handleMessage(message);\n }\n this.#pending.delete(filterId);\n }\n }\n\n async _send(payload: JsonRpcPayload | Array): Promise> {\n // WebSocket provider doesn't accept batches\n assertArgument(!Array.isArray(payload), \"WebSocket does not support batch send\", \"payload\", payload);\n\n // @TODO: stringify payloads here and store to prevent mutations\n\n // Prepare a promise to respond to\n const promise = new Promise((resolve, reject) => {\n this.#callbacks.set(payload.id, { payload, resolve, reject });\n });\n\n // Wait until the socket is connected before writing to it\n await this._waitUntilReady();\n\n // Write the request to the socket\n await this._write(JSON.stringify(payload));\n\n return >[ await promise ];\n }\n\n // Sub-classes must call this once they are connected\n /*\n async _start(): Promise {\n if (this.#ready) { return; }\n\n for (const { payload } of this.#callbacks.values()) {\n await this._write(JSON.stringify(payload));\n }\n\n this.#ready = (async function() {\n await super._start();\n })();\n }\n */\n\n /**\n * Sub-classes **must** call this with messages received over their\n * transport to be processed and dispatched.\n */\n async _processMessage(message: string): Promise {\n const result = (JSON.parse(message));\n\n if (result && typeof(result) === \"object\" && \"id\" in result) {\n const callback = this.#callbacks.get(result.id);\n if (callback == null) {\n this.emit(\"error\", makeError(\"received result for unknown id\", \"UNKNOWN_ERROR\", {\n reasonCode: \"UNKNOWN_ID\",\n result\n }));\n return;\n }\n this.#callbacks.delete(result.id);\n\n callback.resolve(result);\n\n } else if (result && result.method === \"eth_subscription\") {\n const filterId = result.params.subscription;\n const subscriber = this.#subs.get(filterId);\n if (subscriber) {\n subscriber._handleMessage(result.params.result);\n } else {\n let pending = this.#pending.get(filterId);\n if (pending == null) {\n pending = [ ];\n this.#pending.set(filterId, pending);\n }\n pending.push(result.params.result);\n }\n\n } else {\n this.emit(\"error\", makeError(\"received unexpected message\", \"UNKNOWN_ERROR\", {\n reasonCode: \"UNEXPECTED_MESSAGE\",\n result\n }));\n return;\n }\n }\n\n /**\n * Sub-classes **must** override this to send %%message%% over their\n * transport.\n */\n async _write(message: string): Promise {\n throw new Error(\"sub-classes must override this\");\n }\n}\n", "\n\nimport { WebSocket as _WebSocket } from \"./ws.js\"; /*-browser*/\n\nimport { SocketProvider } from \"./provider-socket.js\";\n\nimport type { JsonRpcApiProviderOptions} from \"./provider-jsonrpc.js\";\nimport type { Networkish } from \"./network.js\";\n\n/**\n * A generic interface to a Websocket-like object.\n */\nexport interface WebSocketLike {\n onopen: null | ((...args: Array) => any);\n onmessage: null | ((...args: Array) => any);\n onerror: null | ((...args: Array) => any);\n\n readyState: number;\n\n send(payload: any): void;\n close(code?: number, reason?: string): void;\n}\n\n/**\n * A function which can be used to re-create a WebSocket connection\n * on disconnect.\n */\nexport type WebSocketCreator = () => WebSocketLike;\n\n/**\n * A JSON-RPC provider which is backed by a WebSocket.\n *\n * WebSockets are often preferred because they retain a live connection\n * to a server, which permits more instant access to events.\n *\n * However, this incurs higher server infrasturture costs, so additional\n * resources may be required to host your own WebSocket nodes and many\n * third-party services charge additional fees for WebSocket endpoints.\n */\nexport class WebSocketProvider extends SocketProvider {\n #connect: null | WebSocketCreator;\n\n #websocket: null | WebSocketLike;\n get websocket(): WebSocketLike {\n if (this.#websocket == null) { throw new Error(\"websocket closed\"); }\n return this.#websocket;\n }\n\n constructor(url: string | WebSocketLike | WebSocketCreator, network?: Networkish, options?: JsonRpcApiProviderOptions) {\n super(network, options);\n if (typeof(url) === \"string\") {\n this.#connect = () => { return new _WebSocket(url); };\n this.#websocket = this.#connect();\n } else if (typeof(url) === \"function\") {\n this.#connect = url;\n this.#websocket = url();\n } else {\n this.#connect = null;\n this.#websocket = url;\n }\n\n this.websocket.onopen = async () => {\n try {\n await this._start()\n this.resume();\n } catch (error) {\n console.log(\"failed to start WebsocketProvider\", error);\n // @TODO: now what? Attempt reconnect?\n }\n };\n\n this.websocket.onmessage = (message: { data: string }) => {\n this._processMessage(message.data);\n };\n/*\n this.websocket.onclose = (event) => {\n // @TODO: What event.code should we reconnect on?\n const reconnect = false;\n if (reconnect) {\n this.pause(true);\n if (this.#connect) {\n this.#websocket = this.#connect();\n this.#websocket.onopen = ...\n // @TODO: this requires the super class to rebroadcast; move it there\n }\n this._reconnect();\n }\n };\n*/\n }\n\n async _write(message: string): Promise {\n this.websocket.send(message);\n }\n\n async destroy(): Promise {\n if (this.#websocket != null) {\n this.#websocket.close();\n this.#websocket = null;\n }\n super.destroy();\n }\n}\n", "/**\n * [[link-infura]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Sepolia Testnet (``sepolia``)\n * - Arbitrum (``arbitrum``)\n * - Arbitrum Goerli Testnet (``arbitrum-goerli``)\n * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)\n * - Base (``base``)\n * - Base Goerlia Testnet (``base-goerli``)\n * - Base Sepolia Testnet (``base-sepolia``)\n * - BNB Smart Chain Mainnet (``bnb``)\n * - BNB Smart Chain Testnet (``bnbt``)\n * - Linea (``linea``)\n * - Linea Goerlia Testnet (``linea-goerli``)\n * - Optimism (``optimism``)\n * - Optimism Goerli Testnet (``optimism-goerli``)\n * - Optimism Sepolia Testnet (``optimism-sepolia``)\n * - Polygon (``matic``)\n * - Polygon Mumbai Testnet (``matic-mumbai``)\n *\n * @_subsection: api/providers/thirdparty:INFURA [providers-infura]\n */\nimport {\n defineProperties, FetchRequest, assert, assertArgument\n} from \"../utils/index.js\";\n\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nimport { WebSocketProvider } from \"./provider-websocket.js\";\n\nimport type { AbstractProvider } from \"./abstract-provider.js\";\nimport type { CommunityResourcable } from \"./community.js\";\nimport type { Networkish } from \"./network.js\";\n\n\nconst defaultProjectId = \"84842078b09946638c03157f83405213\";\n\nfunction getHost(name: string): string {\n switch(name) {\n case \"mainnet\":\n return \"mainnet.infura.io\";\n case \"goerli\":\n return \"goerli.infura.io\";\n case \"sepolia\":\n return \"sepolia.infura.io\";\n\n case \"arbitrum\":\n return \"arbitrum-mainnet.infura.io\";\n case \"arbitrum-goerli\":\n return \"arbitrum-goerli.infura.io\";\n case \"arbitrum-sepolia\":\n return \"arbitrum-sepolia.infura.io\";\n case \"base\":\n return \"base-mainnet.infura.io\";\n case \"base-goerlia\":\n return \"base-goerli.infura.io\";\n case \"base-sepolia\":\n return \"base-sepolia.infura.io\";\n case \"bnb\":\n return \"bnbsmartchain-mainnet.infura.io\";\n case \"bnbt\":\n return \"bnbsmartchain-testnet.infura.io\";\n case \"linea\":\n return \"linea-mainnet.infura.io\";\n case \"linea-goerli\":\n return \"linea-goerli.infura.io\";\n case \"matic\":\n return \"polygon-mainnet.infura.io\";\n case \"matic-mumbai\":\n return \"polygon-mumbai.infura.io\";\n case \"optimism\":\n return \"optimism-mainnet.infura.io\";\n case \"optimism-goerli\":\n return \"optimism-goerli.infura.io\";\n case \"optimism-sepolia\":\n return \"optimism-sepolia.infura.io\";\n }\n\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n\n/**\n * The **InfuraWebSocketProvider** connects to the [[link-infura]]\n * WebSocket end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-infura-signup).\n */\nexport class InfuraWebSocketProvider extends WebSocketProvider implements CommunityResourcable {\n\n /**\n * The Project ID for the INFURA connection.\n */\n readonly projectId!: string;\n\n /**\n * The Project Secret.\n *\n * If null, no authenticated requests are made. This should not\n * be used outside of private contexts.\n */\n readonly projectSecret!: null | string;\n\n /**\n * Creates a new **InfuraWebSocketProvider**.\n */\n constructor(network?: Networkish, projectId?: string) {\n const provider = new InfuraProvider(network, projectId);\n\n const req = provider._getConnection();\n assert(!req.credentials, \"INFURA WebSocket project secrets unsupported\",\n \"UNSUPPORTED_OPERATION\", { operation: \"InfuraProvider.getWebSocketProvider()\" });\n\n const url = req.url.replace(/^http/i, \"ws\").replace(\"/v3/\", \"/ws/v3/\");\n super(url, network);\n\n defineProperties(this, {\n projectId: provider.projectId,\n projectSecret: provider.projectSecret\n });\n }\n\n isCommunityResource(): boolean {\n return (this.projectId === defaultProjectId);\n }\n}\n\n/**\n * The **InfuraProvider** connects to the [[link-infura]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-infura-signup).\n */\nexport class InfuraProvider extends JsonRpcProvider implements CommunityResourcable {\n /**\n * The Project ID for the INFURA connection.\n */\n readonly projectId!: string;\n\n /**\n * The Project Secret.\n *\n * If null, no authenticated requests are made. This should not\n * be used outside of private contexts.\n */\n readonly projectSecret!: null | string;\n\n /**\n * Creates a new **InfuraProvider**.\n */\n constructor(_network?: Networkish, projectId?: null | string, projectSecret?: null | string) {\n if (_network == null) { _network = \"mainnet\"; }\n const network = Network.from(_network);\n if (projectId == null) { projectId = defaultProjectId; }\n if (projectSecret == null) { projectSecret = null; }\n\n const request = InfuraProvider.getRequest(network, projectId, projectSecret);\n super(request, network, { staticNetwork: network });\n\n defineProperties(this, { projectId, projectSecret });\n }\n\n _getProvider(chainId: number): AbstractProvider {\n try {\n return new InfuraProvider(chainId, this.projectId, this.projectSecret);\n } catch (error) { }\n return super._getProvider(chainId);\n }\n\n isCommunityResource(): boolean {\n return (this.projectId === defaultProjectId);\n }\n\n /**\n * Creates a new **InfuraWebSocketProvider**.\n */\n static getWebSocketProvider(network?: Networkish, projectId?: string): InfuraWebSocketProvider {\n return new InfuraWebSocketProvider(network, projectId);\n }\n\n /**\n * Returns a prepared request for connecting to %%network%%\n * with %%projectId%% and %%projectSecret%%.\n */\n static getRequest(network: Network, projectId?: null | string, projectSecret?: null | string): FetchRequest {\n if (projectId == null) { projectId = defaultProjectId; }\n if (projectSecret == null) { projectSecret = null; }\n\n const request = new FetchRequest(`https:/\\/${ getHost(network.name) }/v3/${ projectId }`);\n request.allowGzip = true;\n if (projectSecret) { request.setCredentials(\"\", projectSecret); }\n\n if (projectId === defaultProjectId) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"InfuraProvider\");\n return true;\n };\n }\n\n return request;\n }\n}\n", "/**\n * [[link-quicknode]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Sepolia Testnet (``sepolia``)\n * - Holesky Testnet (``holesky``)\n * - Arbitrum (``arbitrum``)\n * - Arbitrum Goerli Testnet (``arbitrum-goerli``)\n * - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)\n * - Base Mainnet (``base``);\n * - Base Goerli Testnet (``base-goerli``);\n * - Base Sepolia Testnet (``base-sepolia``);\n * - BNB Smart Chain Mainnet (``bnb``)\n * - BNB Smart Chain Testnet (``bnbt``)\n * - Optimism (``optimism``)\n * - Optimism Goerli Testnet (``optimism-goerli``)\n * - Optimism Sepolia Testnet (``optimism-sepolia``)\n * - Polygon (``matic``)\n * - Polygon Mumbai Testnet (``matic-mumbai``)\n *\n * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode]\n */\n\nimport {\n defineProperties, FetchRequest, assertArgument\n} from \"../utils/index.js\";\n\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\n\nimport type { AbstractProvider } from \"./abstract-provider.js\";\nimport type { CommunityResourcable } from \"./community.js\";\nimport type { Networkish } from \"./network.js\";\n\n\nconst defaultToken = \"919b412a057b5e9c9b6dce193c5a60242d6efadb\";\n\nfunction getHost(name: string): string {\n switch(name) {\n case \"mainnet\":\n return \"ethers.quiknode.pro\";\n case \"goerli\":\n return \"ethers.ethereum-goerli.quiknode.pro\";\n case \"sepolia\":\n return \"ethers.ethereum-sepolia.quiknode.pro\";\n case \"holesky\":\n return \"ethers.ethereum-holesky.quiknode.pro\";\n\n case \"arbitrum\":\n return \"ethers.arbitrum-mainnet.quiknode.pro\";\n case \"arbitrum-goerli\":\n return \"ethers.arbitrum-goerli.quiknode.pro\";\n case \"arbitrum-sepolia\":\n return \"ethers.arbitrum-sepolia.quiknode.pro\";\n case \"base\":\n return \"ethers.base-mainnet.quiknode.pro\";\n case \"base-goerli\":\n return \"ethers.base-goerli.quiknode.pro\";\n case \"base-spolia\":\n return \"ethers.base-sepolia.quiknode.pro\";\n case \"bnb\":\n return \"ethers.bsc.quiknode.pro\";\n case \"bnbt\":\n return \"ethers.bsc-testnet.quiknode.pro\";\n case \"matic\":\n return \"ethers.matic.quiknode.pro\";\n case \"matic-mumbai\":\n return \"ethers.matic-testnet.quiknode.pro\";\n case \"optimism\":\n return \"ethers.optimism.quiknode.pro\";\n case \"optimism-goerli\":\n return \"ethers.optimism-goerli.quiknode.pro\";\n case \"optimism-sepolia\":\n return \"ethers.optimism-sepolia.quiknode.pro\";\n case \"xdai\":\n return \"ethers.xdai.quiknode.pro\";\n }\n\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n\n/*\n@TODO:\n These networks are not currently present in the Network\n default included networks. Research them and ensure they\n are EVM compatible and work with ethers\n\n http://ethers.matic-amoy.quiknode.pro\n\n http://ethers.avalanche-mainnet.quiknode.pro\n http://ethers.avalanche-testnet.quiknode.pro\n http://ethers.blast-sepolia.quiknode.pro\n http://ethers.celo-mainnet.quiknode.pro\n http://ethers.fantom.quiknode.pro\n http://ethers.imx-demo.quiknode.pro\n http://ethers.imx-mainnet.quiknode.pro\n http://ethers.imx-testnet.quiknode.pro\n http://ethers.near-mainnet.quiknode.pro\n http://ethers.near-testnet.quiknode.pro\n http://ethers.nova-mainnet.quiknode.pro\n http://ethers.scroll-mainnet.quiknode.pro\n http://ethers.scroll-testnet.quiknode.pro\n http://ethers.tron-mainnet.quiknode.pro\n http://ethers.zkevm-mainnet.quiknode.pro\n http://ethers.zkevm-testnet.quiknode.pro\n http://ethers.zksync-mainnet.quiknode.pro\n http://ethers.zksync-testnet.quiknode.pro\n*/\n\n\n\n/**\n * The **QuickNodeProvider** connects to the [[link-quicknode]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API token is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-quicknode).\n */\nexport class QuickNodeProvider extends JsonRpcProvider implements CommunityResourcable {\n /**\n * The API token.\n */\n readonly token!: string;\n\n /**\n * Creates a new **QuickNodeProvider**.\n */\n constructor(_network?: Networkish, token?: null | string) {\n if (_network == null) { _network = \"mainnet\"; }\n const network = Network.from(_network);\n if (token == null) { token = defaultToken; }\n\n const request = QuickNodeProvider.getRequest(network, token);\n super(request, network, { staticNetwork: network });\n\n defineProperties(this, { token });\n }\n\n _getProvider(chainId: number): AbstractProvider {\n try {\n return new QuickNodeProvider(chainId, this.token);\n } catch (error) { }\n return super._getProvider(chainId);\n }\n\n isCommunityResource(): boolean {\n return (this.token === defaultToken);\n }\n\n /**\n * Returns a new request prepared for %%network%% and the\n * %%token%%.\n */\n static getRequest(network: Network, token?: null | string): FetchRequest {\n if (token == null) { token = defaultToken; }\n\n const request = new FetchRequest(`https:/\\/${ getHost(network.name) }/${ token }`);\n request.allowGzip = true;\n //if (projectSecret) { request.setCredentials(\"\", projectSecret); }\n\n if (token === defaultToken) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"QuickNodeProvider\");\n return true;\n };\n }\n\n return request;\n }\n}\n", "/**\n * A **FallbackProvider** provides resilience, security and performance\n * in a way that is customizable and configurable.\n *\n * @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider]\n */\nimport {\n assert, assertArgument, getBigInt, getNumber, isError\n} from \"../utils/index.js\";\n\nimport { AbstractProvider } from \"./abstract-provider.js\";\nimport { Network } from \"./network.js\"\n\nimport type { PerformActionRequest } from \"./abstract-provider.js\";\nimport type { Networkish } from \"./network.js\"\n\nconst BN_1 = BigInt(\"1\");\nconst BN_2 = BigInt(\"2\");\n\nfunction shuffle(array: Array): void {\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n const tmp = array[i];\n array[i] = array[j];\n array[j] = tmp;\n }\n}\n\nfunction stall(duration: number): Promise {\n return new Promise((resolve) => { setTimeout(resolve, duration); });\n}\n\nfunction getTime(): number { return (new Date()).getTime(); }\n\nfunction stringify(value: any): string {\n return JSON.stringify(value, (key, value) => {\n if (typeof(value) === \"bigint\") {\n return { type: \"bigint\", value: value.toString() };\n }\n return value;\n });\n}\n\n/**\n * A configuration entry for how to use a [[Provider]].\n */\nexport interface FallbackProviderConfig {\n\n /**\n * The provider.\n */\n provider: AbstractProvider;\n\n /**\n * The amount of time to wait before kicking off the next provider.\n *\n * Any providers that have not responded can still respond and be\n * counted, but this ensures new providers start.\n */\n stallTimeout?: number;\n\n /**\n * The priority. Lower priority providers are dispatched first.\n */\n priority?: number;\n\n /**\n * The amount of weight a provider is given against the quorum.\n */\n weight?: number;\n};\n\nconst defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 };\n\n// We track a bunch of extra stuff that might help debug problems or\n// optimize infrastructure later on.\n/**\n * The statistics and state maintained for a [[Provider]].\n */\nexport interface FallbackProviderState extends Required {\n\n /**\n * The most recent blockNumber this provider has reported (-2 if none).\n */\n blockNumber: number;\n\n /**\n * The number of total requests ever sent to this provider.\n */\n requests: number;\n\n /**\n * The number of responses that errored.\n */\n errorResponses: number;\n\n /**\n * The number of responses that occured after the result resolved.\n */\n lateResponses: number;\n\n /**\n * How many times syncing was required to catch up the expected block.\n */\n outOfSync: number;\n\n /**\n * The number of requests which reported unsupported operation.\n */\n unsupportedEvents: number;\n\n /**\n * A rolling average (5% current duration) for response time.\n */\n rollingDuration: number;\n\n /**\n * The ratio of quorum-agreed results to total.\n */\n score: number;\n}\n\ninterface Config extends FallbackProviderState {\n _updateNumber: null | Promise;\n _network: null | Network;\n _totalTime: number;\n _lastFatalError: null | Error;\n _lastFatalErrorTimestamp: number;\n}\n\nconst defaultState = {\n blockNumber: -2, requests: 0, lateResponses: 0, errorResponses: 0,\n outOfSync: -1, unsupportedEvents: 0, rollingDuration: 0, score: 0,\n _network: null, _updateNumber: null, _totalTime: 0,\n _lastFatalError: null, _lastFatalErrorTimestamp: 0\n};\n\n\nasync function waitForSync(config: Config, blockNumber: number): Promise {\n while (config.blockNumber < 0 || config.blockNumber < blockNumber) {\n if (!config._updateNumber) {\n config._updateNumber = (async () => {\n try {\n const blockNumber = await config.provider.getBlockNumber();\n if (blockNumber > config.blockNumber) {\n config.blockNumber = blockNumber;\n }\n } catch (error: any) {\n config.blockNumber = -2;\n config._lastFatalError = error;\n config._lastFatalErrorTimestamp = getTime();\n }\n config._updateNumber = null;\n })();\n }\n await config._updateNumber;\n config.outOfSync++;\n if (config._lastFatalError) { break; }\n }\n}\n\n/**\n * Additional options to configure a [[FallbackProvider]].\n */\nexport type FallbackProviderOptions = {\n // How many providers must agree on a value before reporting\n // back the response\n quorum?: number;\n\n // How many providers must have reported the same event\n // for it to be emitted (currently unimplmented)\n eventQuorum?: number;\n\n // How many providers to dispatch each event to simultaneously.\n // Set this to 0 to use getLog polling, which implies eventQuorum\n // is equal to quorum. (currently unimplemented)\n eventWorkers?: number;\n\n cacheTimeout?: number;\n\n pollingInterval?: number;\n};\n\ntype RunnerResult = { result: any } | { error: Error };\n\ntype RunnerState = {\n config: Config;\n staller: null | Promise;\n didBump: boolean;\n perform: null | Promise;\n result: null | RunnerResult;\n}\n\nfunction _normalize(value: any): string {\n if (value == null) { return \"null\"; }\n\n if (Array.isArray(value)) {\n return \"[\" + (value.map(_normalize)).join(\",\") + \"]\";\n }\n\n if (typeof(value) === \"object\" && typeof(value.toJSON) === \"function\") {\n return _normalize(value.toJSON());\n }\n\n switch (typeof(value)) {\n case \"boolean\": case \"symbol\":\n return value.toString();\n case \"bigint\": case \"number\":\n return BigInt(value).toString();\n case \"string\":\n return JSON.stringify(value);\n case \"object\": {\n const keys = Object.keys(value);\n keys.sort();\n return \"{\" + keys.map((k) => `${ JSON.stringify(k) }:${ _normalize(value[k]) }`).join(\",\") + \"}\";\n }\n }\n\n console.log(\"Could not serialize\", value);\n throw new Error(\"Hmm...\");\n}\n\nfunction normalizeResult(value: RunnerResult): { tag: string, value: any } {\n\n if (\"error\" in value) {\n const error = value.error;\n return { tag: _normalize(error), value: error };\n }\n\n const result = value.result;\n return { tag: _normalize(result), value: result };\n}\n\ntype TallyResult = {\n tag: string;\n value: any;\n weight: number;\n};\n\n// This strategy picks the highest weight result, as long as the weight is\n// equal to or greater than quorum\nfunction checkQuorum(quorum: number, results: Array): any | Error {\n const tally: Map = new Map();\n for (const { value, tag, weight } of results) {\n const t = tally.get(tag) || { value, weight: 0 };\n t.weight += weight;\n tally.set(tag, t);\n }\n\n let best: null | { value: any, weight: number } = null;\n\n for (const r of tally.values()) {\n if (r.weight >= quorum && (!best || r.weight > best.weight)) {\n best = r;\n }\n }\n\n if (best) { return best.value; }\n\n return undefined;\n}\n\nfunction getMedian(quorum: number, results: Array): undefined | bigint | Error {\n let resultWeight = 0;\n\n const errorMap: Map = new Map();\n let bestError: null | { weight: number, value: Error } = null;\n\n const values: Array = [ ];\n for (const { value, tag, weight } of results) {\n if (value instanceof Error) {\n const e = errorMap.get(tag) || { value, weight: 0 };\n e.weight += weight;\n errorMap.set(tag, e);\n\n if (bestError == null || e.weight > bestError.weight) { bestError = e; }\n } else {\n values.push(BigInt(value));\n resultWeight += weight;\n }\n }\n\n if (resultWeight < quorum) {\n // We have quorum for an error\n if (bestError && bestError.weight >= quorum) { return bestError.value; }\n\n // We do not have quorum for a result\n return undefined;\n }\n\n // Get the sorted values\n values.sort((a, b) => ((a < b) ? -1: (b > a) ? 1: 0));\n\n const mid = Math.floor(values.length / 2);\n\n // Odd-length; take the middle value\n if (values.length % 2) { return values[mid]; }\n\n // Even length; take the ceiling of the mean of the center two values\n return (values[mid - 1] + values[mid] + BN_1) / BN_2;\n}\n\nfunction getAnyResult(quorum: number, results: Array): undefined | any | Error {\n // If any value or error meets quorum, that is our preferred result\n const result = checkQuorum(quorum, results);\n if (result !== undefined) { return result; }\n\n // Otherwise, do we have any result?\n for (const r of results) {\n if (r.value) { return r.value; }\n }\n\n // Nope!\n return undefined;\n}\n\nfunction getFuzzyMode(quorum: number, results: Array): undefined | number {\n if (quorum === 1) { return getNumber(getMedian(quorum, results), \"%internal\"); }\n\n const tally: Map = new Map();\n const add = (result: number, weight: number) => {\n const t = tally.get(result) || { result, weight: 0 };\n t.weight += weight;\n tally.set(result, t);\n };\n\n for (const { weight, value } of results) {\n const r = getNumber(value);\n add(r - 1, weight);\n add(r, weight);\n add(r + 1, weight);\n }\n\n let bestWeight = 0;\n let bestResult: undefined | number = undefined;\n\n for (const { weight, result } of tally.values()) {\n // Use this result, if this result meets quorum and has either:\n // - a better weight\n // - or equal weight, but the result is larger\n if (weight >= quorum && (weight > bestWeight || (bestResult != null && weight === bestWeight && result > bestResult))) {\n bestWeight = weight;\n bestResult = result;\n }\n }\n\n return bestResult;\n}\n\n/**\n * A **FallbackProvider** manages several [[Providers]] providing\n * resilience by switching between slow or misbehaving nodes, security\n * by requiring multiple backends to aggree and performance by allowing\n * faster backends to respond earlier.\n *\n */\nexport class FallbackProvider extends AbstractProvider {\n\n /**\n * The number of backends that must agree on a value before it is\n * accpeted.\n */\n readonly quorum: number;\n\n /**\n * @_ignore:\n */\n readonly eventQuorum: number;\n\n /**\n * @_ignore:\n */\n readonly eventWorkers: number;\n\n readonly #configs: Array;\n\n #height: number;\n #initialSyncPromise: null | Promise;\n\n /**\n * Creates a new **FallbackProvider** with %%providers%% connected to\n * %%network%%.\n *\n * If a [[Provider]] is included in %%providers%%, defaults are used\n * for the configuration.\n */\n constructor(providers: Array, network?: Networkish, options?: FallbackProviderOptions) {\n super(network, options);\n\n this.#configs = providers.map((p) => {\n if (p instanceof AbstractProvider) {\n return Object.assign({ provider: p }, defaultConfig, defaultState );\n } else {\n return Object.assign({ }, defaultConfig, p, defaultState );\n }\n });\n\n this.#height = -2;\n this.#initialSyncPromise = null;\n\n if (options && options.quorum != null) {\n this.quorum = options.quorum;\n } else {\n this.quorum = Math.ceil(this.#configs.reduce((accum, config) => {\n accum += config.weight;\n return accum;\n }, 0) / 2);\n }\n\n this.eventQuorum = 1;\n this.eventWorkers = 1;\n\n assertArgument(this.quorum <= this.#configs.reduce((a, c) => (a + c.weight), 0),\n \"quorum exceed provider wieght\", \"quorum\", this.quorum);\n }\n\n get providerConfigs(): Array {\n return this.#configs.map((c) => {\n const result: any = Object.assign({ }, c);\n for (const key in result) {\n if (key[0] === \"_\") { delete result[key]; }\n }\n return result;\n });\n }\n\n async _detectNetwork(): Promise {\n return Network.from(getBigInt(await this._perform({ method: \"chainId\" })));\n }\n\n // @TODO: Add support to select providers to be the event subscriber\n //_getSubscriber(sub: Subscription): Subscriber {\n // throw new Error(\"@TODO\");\n //}\n\n /**\n * Transforms a %%req%% into the correct method call on %%provider%%.\n */\n async _translatePerform(provider: AbstractProvider, req: PerformActionRequest): Promise {\n switch (req.method) {\n case \"broadcastTransaction\":\n return await provider.broadcastTransaction(req.signedTransaction);\n case \"call\":\n return await provider.call(Object.assign({ }, req.transaction, { blockTag: req.blockTag }));\n case \"chainId\":\n return (await provider.getNetwork()).chainId;\n case \"estimateGas\":\n return await provider.estimateGas(req.transaction);\n case \"getBalance\":\n return await provider.getBalance(req.address, req.blockTag);\n case \"getBlock\": {\n const block = (\"blockHash\" in req) ? req.blockHash: req.blockTag;\n return await provider.getBlock(block, req.includeTransactions);\n }\n case \"getBlockNumber\":\n return await provider.getBlockNumber();\n case \"getCode\":\n return await provider.getCode(req.address, req.blockTag);\n case \"getGasPrice\":\n return (await provider.getFeeData()).gasPrice;\n case \"getPriorityFee\":\n return (await provider.getFeeData()).maxPriorityFeePerGas;\n case \"getLogs\":\n return await provider.getLogs(req.filter);\n case \"getStorage\":\n return await provider.getStorage(req.address, req.position, req.blockTag);\n case \"getTransaction\":\n return await provider.getTransaction(req.hash);\n case \"getTransactionCount\":\n return await provider.getTransactionCount(req.address, req.blockTag);\n case \"getTransactionReceipt\":\n return await provider.getTransactionReceipt(req.hash);\n case \"getTransactionResult\":\n return await provider.getTransactionResult(req.hash);\n }\n }\n\n // Grab the next (random) config that is not already part of\n // the running set\n #getNextConfig(running: Set): null | Config {\n // @TODO: Maybe do a check here to favour (heavily) providers that\n // do not require waitForSync and disfavour providers that\n // seem down-ish or are behaving slowly\n\n const configs = Array.from(running).map((r) => r.config)\n\n // Shuffle the states, sorted by priority\n const allConfigs = this.#configs.slice();\n shuffle(allConfigs);\n allConfigs.sort((a, b) => (a.priority - b.priority));\n\n for (const config of allConfigs) {\n if (config._lastFatalError) { continue; }\n if (configs.indexOf(config) === -1) { return config; }\n }\n\n return null;\n }\n\n // Adds a new runner (if available) to running.\n #addRunner(running: Set, req: PerformActionRequest): null | RunnerState {\n const config = this.#getNextConfig(running);\n\n // No runners available\n if (config == null) { return null; }\n\n // Create a new runner\n const runner: RunnerState = {\n config, result: null, didBump: false,\n perform: null, staller: null\n };\n\n const now = getTime();\n\n // Start performing this operation\n runner.perform = (async () => {\n try {\n config.requests++;\n const result = await this._translatePerform(config.provider, req);\n runner.result = { result };\n } catch (error: any) {\n config.errorResponses++;\n runner.result = { error };\n }\n\n const dt = (getTime() - now);\n config._totalTime += dt;\n\n config.rollingDuration = 0.95 * config.rollingDuration + 0.05 * dt;\n\n runner.perform = null;\n })();\n\n // Start a staller; when this times out, it's time to force\n // kicking off another runner because we are taking too long\n runner.staller = (async () => {\n await stall(config.stallTimeout);\n runner.staller = null;\n })();\n\n running.add(runner);\n return runner;\n }\n\n // Initializes the blockNumber and network for each runner and\n // blocks until initialized\n async #initialSync(): Promise {\n let initialSync = this.#initialSyncPromise;\n if (!initialSync) {\n const promises: Array> = [ ];\n this.#configs.forEach((config) => {\n promises.push((async () => {\n await waitForSync(config, 0);\n if (!config._lastFatalError) {\n config._network = await config.provider.getNetwork();\n }\n })());\n });\n\n this.#initialSyncPromise = initialSync = (async () => {\n // Wait for all providers to have a block number and network\n await Promise.all(promises);\n\n // Check all the networks match\n let chainId: null | bigint = null;\n for (const config of this.#configs) {\n if (config._lastFatalError) { continue; }\n const network = (config._network);\n if (chainId == null) {\n chainId = network.chainId;\n } else if (network.chainId !== chainId) {\n assert(false, \"cannot mix providers on different networks\", \"UNSUPPORTED_OPERATION\", {\n operation: \"new FallbackProvider\"\n });\n }\n }\n })();\n }\n\n await initialSync\n }\n\n\n async #checkQuorum(running: Set, req: PerformActionRequest): Promise {\n // Get all the result objects\n const results: Array = [ ];\n for (const runner of running) {\n if (runner.result != null) {\n const { tag, value } = normalizeResult(runner.result);\n results.push({ tag, value, weight: runner.config.weight });\n }\n }\n\n // Are there enough results to event meet quorum?\n if (results.reduce((a, r) => (a + r.weight), 0) < this.quorum) {\n return undefined;\n }\n\n switch (req.method) {\n case \"getBlockNumber\": {\n // We need to get the bootstrap block height\n if (this.#height === -2) {\n this.#height = Math.ceil(getNumber(getMedian(this.quorum, this.#configs.filter((c) => (!c._lastFatalError)).map((c) => ({\n value: c.blockNumber,\n tag: getNumber(c.blockNumber).toString(),\n weight: c.weight\n })))));\n }\n\n // Find the mode across all the providers, allowing for\n // a little drift between block heights\n const mode = getFuzzyMode(this.quorum, results);\n if (mode === undefined) { return undefined; }\n if (mode > this.#height) { this.#height = mode; }\n return this.#height;\n }\n\n case \"getGasPrice\":\n case \"getPriorityFee\":\n case \"estimateGas\":\n return getMedian(this.quorum, results);\n\n case \"getBlock\":\n // Pending blocks are in the mempool and already\n // quite untrustworthy; just grab anything\n if (\"blockTag\" in req && req.blockTag === \"pending\") {\n return getAnyResult(this.quorum, results);\n }\n return checkQuorum(this.quorum, results);\n\n case \"call\":\n case \"chainId\":\n case \"getBalance\":\n case \"getTransactionCount\":\n case \"getCode\":\n case \"getStorage\":\n case \"getTransaction\":\n case \"getTransactionReceipt\":\n case \"getLogs\":\n return checkQuorum(this.quorum, results);\n\n case \"broadcastTransaction\":\n return getAnyResult(this.quorum, results);\n }\n\n assert(false, \"unsupported method\", \"UNSUPPORTED_OPERATION\", {\n operation: `_perform(${ stringify((req).method) })`\n });\n }\n\n async #waitForQuorum(running: Set, req: PerformActionRequest): Promise {\n if (running.size === 0) { throw new Error(\"no runners?!\"); }\n\n // Any promises that are interesting to watch for; an expired stall\n // or a successful perform\n const interesting: Array> = [ ];\n\n let newRunners = 0;\n for (const runner of running) {\n\n // No responses, yet; keep an eye on it\n if (runner.perform) {\n interesting.push(runner.perform);\n }\n\n // Still stalling...\n if (runner.staller) {\n interesting.push(runner.staller);\n continue;\n }\n\n // This runner has already triggered another runner\n if (runner.didBump) { continue; }\n\n // Got a response (result or error) or stalled; kick off another runner\n runner.didBump = true;\n newRunners++;\n }\n\n // Check if we have reached quorum on a result (or error)\n const value = await this.#checkQuorum(running, req);\n if (value !== undefined) {\n if (value instanceof Error) { throw value; }\n return value;\n }\n\n // Add any new runners, because a staller timed out or a result\n // or error response came in.\n for (let i = 0; i < newRunners; i++) {\n this.#addRunner(running, req);\n }\n\n // All providers have returned, and we have no result\n\n assert(interesting.length > 0, \"quorum not met\", \"SERVER_ERROR\", {\n request: \"%sub-requests\",\n info: { request: req, results: Array.from(running).map((r) => stringify(r.result)) }\n });\n\n // Wait for someone to either complete its perform or stall out\n await Promise.race(interesting);\n\n // This is recursive, but at worst case the depth is 2x the\n // number of providers (each has a perform and a staller)\n return await this.#waitForQuorum(running, req);\n }\n\n async _perform(req: PerformActionRequest): Promise {\n // Broadcasting a transaction is rare (ish) and already incurs\n // a cost on the user, so spamming is safe-ish. Just send it to\n // every backend.\n if (req.method === \"broadcastTransaction\") {\n // Once any broadcast provides a positive result, use it. No\n // need to wait for anyone else\n const results: Array = this.#configs.map((c) => null);\n const broadcasts = this.#configs.map(async ({ provider, weight }, index) => {\n try {\n const result = await provider._perform(req);\n results[index] = Object.assign(normalizeResult({ result }), { weight });\n } catch (error: any) {\n results[index] = Object.assign(normalizeResult({ error }), { weight });\n }\n });\n\n // As each promise finishes...\n while (true) {\n // Check for a valid broadcast result\n const done = >results.filter((r) => (r != null));\n for (const { value } of done) {\n if (!(value instanceof Error)) { return value; }\n }\n\n // Check for a legit broadcast error (one which we cannot\n // recover from; some nodes may return the following red\n // herring events:\n // - alredy seend (UNKNOWN_ERROR)\n // - NONCE_EXPIRED\n // - REPLACEMENT_UNDERPRICED\n const result = checkQuorum(this.quorum, >results.filter((r) => (r != null)));\n if (isError(result, \"INSUFFICIENT_FUNDS\")) {\n throw result;\n }\n\n // Kick off the next provider (if any)\n const waiting = broadcasts.filter((b, i) => (results[i] == null));\n if (waiting.length === 0) { break; }\n await Promise.race(waiting);\n }\n\n // Use standard quorum results; any result was returned above,\n // so this will find any error that met quorum if any\n const result = getAnyResult(this.quorum, >results);\n assert(result !== undefined, \"problem multi-broadcasting\", \"SERVER_ERROR\", {\n request: \"%sub-requests\",\n info: { request: req, results: results.map(stringify) }\n })\n if (result instanceof Error) { throw result; }\n return result;\n }\n\n await this.#initialSync();\n\n // Bootstrap enough runners to meet quorum\n const running: Set = new Set();\n let inflightQuorum = 0;\n while (true) {\n const runner = this.#addRunner(running, req);\n if (runner == null) { break; }\n inflightQuorum += runner.config.weight;\n if (inflightQuorum >= this.quorum) { break; }\n }\n\n const result = await this.#waitForQuorum(running, req);\n\n // Track requests sent to a provider that are still\n // outstanding after quorum has been otherwise found\n for (const runner of running) {\n if (runner.perform && runner.result == null) {\n runner.config.lateResponses++;\n }\n }\n\n return result;\n }\n\n async destroy(): Promise {\n for (const { provider } of this.#configs) {\n provider.destroy();\n }\n super.destroy();\n }\n}\n", "\nimport { assert } from \"../utils/index.js\";\n\nimport { AnkrProvider } from \"./provider-ankr.js\";\nimport { AlchemyProvider } from \"./provider-alchemy.js\";\nimport { CloudflareProvider } from \"./provider-cloudflare.js\";\nimport { EtherscanProvider } from \"./provider-etherscan.js\";\nimport { InfuraProvider } from \"./provider-infura.js\";\n//import { PocketProvider } from \"./provider-pocket.js\";\nimport { QuickNodeProvider } from \"./provider-quicknode.js\";\n\nimport { FallbackProvider } from \"./provider-fallback.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\nimport { Network } from \"./network.js\";\nimport { WebSocketProvider } from \"./provider-websocket.js\";\n\nimport type { AbstractProvider } from \"./abstract-provider.js\";\nimport type { Networkish } from \"./network.js\";\nimport { WebSocketLike } from \"./provider-websocket.js\";\n\nfunction isWebSocketLike(value: any): value is WebSocketLike {\n return (value && typeof(value.send) === \"function\" &&\n typeof(value.close) === \"function\");\n}\n\nconst Testnets = \"goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt\".split(\" \");\n\n/**\n * Returns a default provider for %%network%%.\n *\n * If %%network%% is a [[WebSocketLike]] or string that begins with\n * ``\"ws:\"`` or ``\"wss:\"``, a [[WebSocketProvider]] is returned backed\n * by that WebSocket or URL.\n *\n * If %%network%% is a string that begins with ``\"HTTP:\"`` or ``\"HTTPS:\"``,\n * a [[JsonRpcProvider]] is returned connected to that URL.\n *\n * Otherwise, a default provider is created backed by well-known public\n * Web3 backends (such as [[link-infura]]) using community-provided API\n * keys.\n *\n * The %%options%% allows specifying custom API keys per backend (setting\n * an API key to ``\"-\"`` will omit that provider) and ``options.exclusive``\n * can be set to either a backend name or and array of backend names, which\n * will whitelist **only** those backends.\n *\n * Current backend strings supported are:\n * - ``\"alchemy\"``\n * - ``\"ankr\"``\n * - ``\"cloudflare\"``\n * - ``\"etherscan\"``\n * - ``\"infura\"``\n * - ``\"publicPolygon\"``\n * - ``\"quicknode\"``\n *\n * @example:\n * // Connect to a local Geth node\n * provider = getDefaultProvider(\"http://localhost:8545/\");\n *\n * // Connect to Ethereum mainnet with any current and future\n * // third-party services available\n * provider = getDefaultProvider(\"mainnet\");\n *\n * // Connect to Polygon, but only allow Etherscan and\n * // INFURA and use \"MY_API_KEY\" in calls to Etherscan.\n * provider = getDefaultProvider(\"matic\", {\n * etherscan: \"MY_API_KEY\",\n * exclusive: [ \"etherscan\", \"infura\" ]\n * });\n */\nexport function getDefaultProvider(network?: string | Networkish | WebSocketLike, options?: any): AbstractProvider {\n if (options == null) { options = { }; }\n\n const allowService = (name: string) => {\n if (options[name] === \"-\") { return false; }\n if (typeof(options.exclusive) === \"string\") {\n return (name === options.exclusive);\n }\n if (Array.isArray(options.exclusive)) {\n return (options.exclusive.indexOf(name) !== -1);\n }\n return true;\n };\n\n if (typeof(network) === \"string\" && network.match(/^https?:/)) {\n return new JsonRpcProvider(network);\n }\n\n if (typeof(network) === \"string\" && network.match(/^wss?:/) || isWebSocketLike(network)) {\n return new WebSocketProvider(network);\n }\n\n // Get the network and name, if possible\n let staticNetwork: null | Network = null;\n try {\n staticNetwork = Network.from(network);\n } catch (error) { }\n\n\n const providers: Array = [ ];\n\n if (allowService(\"publicPolygon\") && staticNetwork) {\n if (staticNetwork.name === \"matic\") {\n providers.push(new JsonRpcProvider(\"https:/\\/polygon-rpc.com/\", staticNetwork, { staticNetwork }));\n }\n }\n\n if (allowService(\"alchemy\")) {\n try {\n providers.push(new AlchemyProvider(network, options.alchemy));\n } catch (error) { }\n }\n\n if (allowService(\"ankr\") && options.ankr != null) {\n try {\n providers.push(new AnkrProvider(network, options.ankr));\n } catch (error) { }\n }\n\n if (allowService(\"cloudflare\")) {\n try {\n providers.push(new CloudflareProvider(network));\n } catch (error) { }\n }\n\n if (allowService(\"etherscan\")) {\n try {\n providers.push(new EtherscanProvider(network, options.etherscan));\n } catch (error) { }\n }\n\n if (allowService(\"infura\")) {\n try {\n let projectId = options.infura;\n let projectSecret: undefined | string = undefined;\n if (typeof(projectId) === \"object\") {\n projectSecret = projectId.projectSecret;\n projectId = projectId.projectId;\n }\n providers.push(new InfuraProvider(network, projectId, projectSecret));\n } catch (error) { }\n }\n/*\n if (options.pocket !== \"-\") {\n try {\n let appId = options.pocket;\n let secretKey: undefined | string = undefined;\n let loadBalancer: undefined | boolean = undefined;\n if (typeof(appId) === \"object\") {\n loadBalancer = !!appId.loadBalancer;\n secretKey = appId.secretKey;\n appId = appId.appId;\n }\n providers.push(new PocketProvider(network, appId, secretKey, loadBalancer));\n } catch (error) { console.log(error); }\n }\n*/\n if (allowService(\"quicknode\")) {\n try {\n let token = options.quicknode;\n providers.push(new QuickNodeProvider(network, token));\n } catch (error) { }\n }\n\n assert(providers.length, \"unsupported default network\", \"UNSUPPORTED_OPERATION\", {\n operation: \"getDefaultProvider\"\n });\n\n // No need for a FallbackProvider\n if (providers.length === 1) { return providers[0]; }\n\n // We use the floor because public third-party providers can be unreliable,\n // so a low number of providers with a large quorum will fail too often\n let quorum = Math.floor(providers.length / 2);\n if (quorum > 2) { quorum = 2; }\n\n // Testnets don't need as strong a security gaurantee and speed is\n // more useful during testing\n if (staticNetwork && Testnets.indexOf(staticNetwork.name) !== -1) { quorum = 1; }\n\n // Provided override qorum takes priority\n if (options && options.quorum) { quorum = options.quorum; }\n\n return new FallbackProvider(providers, undefined, { quorum });\n}\n", "import { defineProperties } from \"../utils/index.js\";\nimport { AbstractSigner } from \"./abstract-signer.js\";\n\nimport type { TypedDataDomain, TypedDataField } from \"../hash/index.js\";\n\nimport type {\n BlockTag, Provider, TransactionRequest, TransactionResponse\n} from \"./provider.js\";\nimport type { Signer } from \"./signer.js\";\n\n\n/**\n * A **NonceManager** wraps another [[Signer]] and automatically manages\n * the nonce, ensuring serialized and sequential nonces are used during\n * transaction.\n */\nexport class NonceManager extends AbstractSigner {\n /**\n * The Signer being managed.\n */\n signer!: Signer;\n\n #noncePromise: null | Promise;\n #delta: number;\n\n /**\n * Creates a new **NonceManager** to manage %%signer%%.\n */\n constructor(signer: Signer) {\n super(signer.provider);\n defineProperties(this, { signer });\n\n this.#noncePromise = null;\n this.#delta = 0;\n }\n\n async getAddress(): Promise {\n return this.signer.getAddress();\n }\n\n connect(provider: null | Provider): NonceManager {\n return new NonceManager(this.signer.connect(provider));\n }\n\n async getNonce(blockTag?: BlockTag): Promise {\n if (blockTag === \"pending\") {\n if (this.#noncePromise == null) {\n this.#noncePromise = super.getNonce(\"pending\");\n }\n\n const delta = this.#delta;\n return (await this.#noncePromise) + delta;\n }\n\n return super.getNonce(blockTag);\n }\n\n /**\n * Manually increment the nonce. This may be useful when managng\n * offline transactions.\n */\n increment(): void {\n this.#delta++;\n }\n\n /**\n * Resets the nonce, causing the **NonceManager** to reload the current\n * nonce from the blockchain on the next transaction.\n */\n reset(): void {\n this.#delta = 0;\n this.#noncePromise = null;\n }\n\n async sendTransaction(tx: TransactionRequest): Promise {\n const noncePromise = this.getNonce(\"pending\");\n this.increment();\n\n tx = await this.signer.populateTransaction(tx);\n tx.nonce = await noncePromise;\n\n // @TODO: Maybe handle interesting/recoverable errors?\n // Like don't increment if the tx was certainly not sent\n return await this.signer.sendTransaction(tx);\n }\n\n signTransaction(tx: TransactionRequest): Promise {\n return this.signer.signTransaction(tx);\n }\n\n signMessage(message: string | Uint8Array): Promise {\n return this.signer.signMessage(message);\n }\n\n signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise {\n return this.signer.signTypedData(domain, types, value);\n }\n}\n", "import { assertArgument } from \"../utils/index.js\";\n\nimport { JsonRpcApiPollingProvider } from \"./provider-jsonrpc.js\";\n\nimport type {\n JsonRpcError, JsonRpcPayload, JsonRpcResult,\n JsonRpcSigner\n} from \"./provider-jsonrpc.js\";\nimport type { Networkish } from \"./network.js\";\n\n/**\n * The interface to an [[link-eip-1193]] provider, which is a standard\n * used by most injected providers, which the [[BrowserProvider]] accepts\n * and exposes the API of.\n */\nexport interface Eip1193Provider {\n /**\n * See [[link-eip-1193]] for details on this method.\n */\n request(request: { method: string, params?: Array | Record }): Promise;\n};\n\n/**\n * The possible additional events dispatched when using the ``\"debug\"``\n * event on a [[BrowserProvider]].\n */\nexport type DebugEventBrowserProvider = {\n action: \"sendEip1193Payload\",\n payload: { method: string, params: Array }\n} | {\n action: \"receiveEip1193Result\",\n result: any\n} | {\n action: \"receiveEip1193Error\",\n error: Error\n};\n\n\n/**\n * A **BrowserProvider** is intended to wrap an injected provider which\n * adheres to the [[link-eip-1193]] standard, which most (if not all)\n * currently do.\n */\nexport class BrowserProvider extends JsonRpcApiPollingProvider {\n #request: (method: string, params: Array | Record) => Promise;\n\n /**\n * Connnect to the %%ethereum%% provider, optionally forcing the\n * %%network%%.\n */\n constructor(ethereum: Eip1193Provider, network?: Networkish) {\n assertArgument(ethereum && ethereum.request, \"invalid EIP-1193 provider\", \"ethereum\", ethereum);\n\n super(network, { batchMaxCount: 1 });\n\n this.#request = async (method: string, params: Array | Record) => {\n const payload = { method, params };\n this.emit(\"debug\", { action: \"sendEip1193Request\", payload });\n try {\n const result = await ethereum.request(payload);\n this.emit(\"debug\", { action: \"receiveEip1193Result\", result });\n return result;\n } catch (e: any) {\n const error = new Error(e.message);\n (error).code = e.code;\n (error).data = e.data;\n (error).payload = payload;\n this.emit(\"debug\", { action: \"receiveEip1193Error\", error });\n throw error;\n }\n };\n }\n\n async send(method: string, params: Array | Record): Promise {\n await this._start();\n\n return await super.send(method, params);\n }\n\n async _send(payload: JsonRpcPayload | Array): Promise> {\n assertArgument(!Array.isArray(payload), \"EIP-1193 does not support batch request\", \"payload\", payload);\n\n try {\n const result = await this.#request(payload.method, payload.params || [ ]);\n return [ { id: payload.id, result } ];\n } catch (e: any) {\n return [ {\n id: payload.id,\n error: { code: e.code, data: e.data, message: e.message }\n } ];\n }\n }\n\n getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error {\n\n error = JSON.parse(JSON.stringify(error));\n\n // EIP-1193 gives us some machine-readable error codes, so rewrite\n // them into \n switch (error.error.code || -1) {\n case 4001:\n error.error.message = `ethers-user-denied: ${ error.error.message }`;\n break;\n case 4200:\n error.error.message = `ethers-unsupported: ${ error.error.message }`;\n break;\n }\n\n return super.getRpcError(payload, error);\n }\n\n /**\n * Resolves to ``true`` if the provider manages the %%address%%.\n */\n async hasSigner(address: number | string): Promise {\n if (address == null) { address = 0; }\n\n const accounts = await this.send(\"eth_accounts\", [ ]);\n if (typeof(address) === \"number\") {\n return (accounts.length > address);\n }\n\n address = address.toLowerCase();\n return accounts.filter((a: string) => (a.toLowerCase() === address)).length !== 0;\n }\n\n async getSigner(address?: number | string): Promise {\n if (address == null) { address = 0; }\n\n if (!(await this.hasSigner(address))) {\n try {\n //const resp = \n await this.#request(\"eth_requestAccounts\", [ ]);\n //console.log(\"RESP\", resp);\n\n } catch (error: any) {\n const payload = error.payload;\n throw this.getRpcError(payload, { id: payload.id, error });\n }\n }\n\n return await super.getSigner(address);\n }\n}\n", "/**\n * [[link-pocket]] provides a third-party service for connecting to\n * various blockchains over JSON-RPC.\n *\n * **Supported Networks**\n *\n * - Ethereum Mainnet (``mainnet``)\n * - Goerli Testnet (``goerli``)\n * - Polygon (``matic``)\n * - Arbitrum (``arbitrum``)\n *\n * @_subsection: api/providers/thirdparty:Pocket [providers-pocket]\n */\nimport {\n defineProperties, FetchRequest, assertArgument\n} from \"../utils/index.js\";\n\nimport { AbstractProvider } from \"./abstract-provider.js\";\nimport { showThrottleMessage } from \"./community.js\";\nimport { Network } from \"./network.js\";\nimport { JsonRpcProvider } from \"./provider-jsonrpc.js\";\n\nimport type { CommunityResourcable } from \"./community.js\";\nimport type { Networkish } from \"./network.js\";\n\nconst defaultApplicationId = \"62e1ad51b37b8e00394bda3b\";\n\nfunction getHost(name: string): string {\n switch (name) {\n case \"mainnet\":\n return \"eth-mainnet.gateway.pokt.network\";\n case \"goerli\":\n return \"eth-goerli.gateway.pokt.network\";\n\n case \"matic\":\n return \"poly-mainnet.gateway.pokt.network\";\n case \"matic-mumbai\":\n return \"polygon-mumbai-rpc.gateway.pokt.network\";\n }\n\n assertArgument(false, \"unsupported network\", \"network\", name);\n}\n\n\n/**\n * The **PocketProvider** connects to the [[link-pocket]]\n * JSON-RPC end-points.\n *\n * By default, a highly-throttled API key is used, which is\n * appropriate for quick prototypes and simple scripts. To\n * gain access to an increased rate-limit, it is highly\n * recommended to [sign up here](link-pocket-signup).\n */\nexport class PocketProvider extends JsonRpcProvider implements CommunityResourcable {\n\n /**\n * The Application ID for the Pocket connection.\n */\n readonly applicationId!: string;\n\n /**\n * The Application Secret for making authenticated requests\n * to the Pocket connection.\n */\n readonly applicationSecret!: null | string;\n\n /**\n * Create a new **PocketProvider**.\n *\n * By default connecting to ``mainnet`` with a highly throttled\n * API key.\n */\n constructor(_network?: Networkish, applicationId?: null | string, applicationSecret?: null | string) {\n if (_network == null) { _network = \"mainnet\"; }\n const network = Network.from(_network);\n if (applicationId == null) { applicationId = defaultApplicationId; }\n if (applicationSecret == null) { applicationSecret = null; }\n\n const options = { staticNetwork: network };\n\n const request = PocketProvider.getRequest(network, applicationId, applicationSecret);\n super(request, network, options);\n\n defineProperties(this, { applicationId, applicationSecret });\n }\n\n _getProvider(chainId: number): AbstractProvider {\n try {\n return new PocketProvider(chainId, this.applicationId, this.applicationSecret);\n } catch (error) { }\n return super._getProvider(chainId);\n }\n\n /**\n * Returns a prepared request for connecting to %%network%% with\n * %%applicationId%%.\n */\n static getRequest(network: Network, applicationId?: null | string, applicationSecret?: null | string): FetchRequest {\n if (applicationId == null) { applicationId = defaultApplicationId; }\n\n const request = new FetchRequest(`https:/\\/${ getHost(network.name) }/v1/lb/${ applicationId }`);\n request.allowGzip = true;\n\n if (applicationSecret) {\n request.setCredentials(\"\", applicationSecret);\n }\n\n if (applicationId === defaultApplicationId) {\n request.retryFunc = async (request, response, attempt) => {\n showThrottleMessage(\"PocketProvider\");\n return true;\n };\n }\n\n return request;\n }\n\n isCommunityResource(): boolean {\n return (this.applicationId === defaultApplicationId);\n }\n}\n", "const IpcSocketProvider = undefined;\n\nexport { IpcSocketProvider };\n", "import { getAddress, resolveAddress } from \"../address/index.js\";\nimport { hashMessage, TypedDataEncoder } from \"../hash/index.js\";\nimport { AbstractSigner } from \"../providers/index.js\";\nimport { computeAddress, Transaction } from \"../transaction/index.js\";\nimport {\n defineProperties, resolveProperties, assert, assertArgument\n} from \"../utils/index.js\";\n\nimport type { SigningKey } from \"../crypto/index.js\";\nimport type { TypedDataDomain, TypedDataField } from \"../hash/index.js\";\nimport type { Provider, TransactionRequest } from \"../providers/index.js\";\nimport type { TransactionLike } from \"../transaction/index.js\";\n\n\n/**\n * The **BaseWallet** is a stream-lined implementation of a\n * [[Signer]] that operates with a private key.\n *\n * It is preferred to use the [[Wallet]] class, as it offers\n * additional functionality and simplifies loading a variety\n * of JSON formats, Mnemonic Phrases, etc.\n *\n * This class may be of use for those attempting to implement\n * a minimal Signer.\n */\nexport class BaseWallet extends AbstractSigner {\n /**\n * The wallet address.\n */\n readonly address!: string;\n\n readonly #signingKey: SigningKey;\n\n /**\n * Creates a new BaseWallet for %%privateKey%%, optionally\n * connected to %%provider%%.\n *\n * If %%provider%% is not specified, only offline methods can\n * be used.\n */\n constructor(privateKey: SigningKey, provider?: null | Provider) {\n super(provider);\n\n assertArgument(privateKey && typeof(privateKey.sign) === \"function\", \"invalid private key\", \"privateKey\", \"[ REDACTED ]\");\n\n this.#signingKey = privateKey;\n\n const address = computeAddress(this.signingKey.publicKey);\n defineProperties(this, { address });\n }\n\n // Store private values behind getters to reduce visibility\n // in console.log\n\n /**\n * The [[SigningKey]] used for signing payloads.\n */\n get signingKey(): SigningKey { return this.#signingKey; }\n\n /**\n * The private key for this wallet.\n */\n get privateKey(): string { return this.signingKey.privateKey; }\n\n async getAddress(): Promise { return this.address; }\n\n connect(provider: null | Provider): BaseWallet {\n return new BaseWallet(this.#signingKey, provider);\n }\n\n async signTransaction(tx: TransactionRequest): Promise {\n\n // Replace any Addressable or ENS name with an address\n const { to, from } = await resolveProperties({\n to: (tx.to ? resolveAddress(tx.to, this.provider): undefined),\n from: (tx.from ? resolveAddress(tx.from, this.provider): undefined)\n });\n\n if (to != null) { tx.to = to; }\n if (from != null) { tx.from = from; }\n\n if (tx.from != null) {\n assertArgument(getAddress((tx.from)) === this.address,\n \"transaction from address mismatch\", \"tx.from\", tx.from);\n delete tx.from;\n }\n\n // Build the transaction\n const btx = Transaction.from(>tx);\n btx.signature = this.signingKey.sign(btx.unsignedHash);\n\n return btx.serialized;\n }\n\n async signMessage(message: string | Uint8Array): Promise {\n return this.signMessageSync(message);\n }\n\n // @TODO: Add a secialized signTx and signTyped sync that enforces\n // all parameters are known?\n /**\n * Returns the signature for %%message%% signed with this wallet.\n */\n signMessageSync(message: string | Uint8Array): string {\n return this.signingKey.sign(hashMessage(message)).serialized;\n }\n\n async signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise {\n\n // Populate any ENS names\n const populated = await TypedDataEncoder.resolveNames(domain, types, value, async (name: string) => {\n // @TODO: this should use resolveName; addresses don't\n // need a provider\n\n assert(this.provider != null, \"cannot resolve ENS names without a provider\", \"UNSUPPORTED_OPERATION\", {\n operation: \"resolveName\",\n info: { name }\n });\n\n const address = await this.provider.resolveName(name);\n assert(address != null, \"unconfigured ENS name\", \"UNCONFIGURED_NAME\", {\n value: name\n });\n\n return address;\n });\n\n return this.signingKey.sign(TypedDataEncoder.hash(populated.domain, types, populated.value)).serialized;\n }\n}\n", "import { assertArgument } from \"../utils/index.js\";\n\n\nconst subsChrs = \" !#$%&'()*+,-./<=>?@[]^_`{|}~\";\nconst Word = /^[a-z]*$/i;\n\nfunction unfold(words: Array, sep: string): Array {\n let initial = 97;\n return words.reduce((accum, word) => {\n if (word === sep) {\n initial++;\n } else if (word.match(Word)) {\n accum.push(String.fromCharCode(initial) + word);\n } else {\n initial = 97;\n accum.push(word);\n }\n return accum;\n }, >[]);\n}\n\n/**\n * @_ignore\n */\nexport function decode(data: string, subs: string): Array {\n\n // Replace all the substitutions with their expanded form\n for (let i = subsChrs.length - 1; i >= 0; i--) {\n data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2));\n }\n\n // Get all tle clumps; each suffix, first-increment and second-increment\n const clumps: Array = [ ];\n const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => {\n if (semi) {\n for (let i = parseInt(semi); i >= 0; i--) { clumps.push(\";\"); }\n } else {\n clumps.push(item.toLowerCase());\n }\n return \"\";\n });\n /* c8 ignore start */\n if (leftover) { throw new Error(`leftovers: ${ JSON.stringify(leftover) }`); }\n /* c8 ignore stop */\n\n return unfold(unfold(clumps, \";\"), \":\");\n}\n\n/**\n * @_ignore\n */\nexport function decodeOwl(data: string): Array {\n assertArgument(data[0] === \"0\", \"unsupported auwl data\", \"data\", data);\n\n return decode(\n data.substring(1 + 2 * subsChrs.length),\n data.substring(1, 1 + 2 * subsChrs.length));\n}\n", "import { defineProperties } from \"../utils/index.js\";\n\n/**\n * A Wordlist represents a collection of language-specific\n * words used to encode and devoce [[link-bip-39]] encoded data\n * by mapping words to 11-bit values and vice versa.\n */\nexport abstract class Wordlist {\n locale!: string;\n\n /**\n * Creates a new Wordlist instance.\n *\n * Sub-classes MUST call this if they provide their own constructor,\n * passing in the locale string of the language.\n *\n * Generally there is no need to create instances of a Wordlist,\n * since each language-specific Wordlist creates an instance and\n * there is no state kept internally, so they are safe to share.\n */\n constructor(locale: string) {\n defineProperties(this, { locale });\n }\n\n /**\n * Sub-classes may override this to provide a language-specific\n * method for spliting %%phrase%% into individual words.\n *\n * By default, %%phrase%% is split using any sequences of\n * white-space as defined by regular expressions (i.e. ``/\\s+/``).\n */\n split(phrase: string): Array {\n return phrase.toLowerCase().split(/\\s+/g)\n }\n\n /**\n * Sub-classes may override this to provider a language-specific\n * method for joining %%words%% into a phrase.\n *\n * By default, %%words%% are joined by a single space.\n */\n join(words: Array): string {\n return words.join(\" \");\n }\n\n /**\n * Maps an 11-bit value into its coresponding word in the list.\n *\n * Sub-classes MUST override this.\n */\n abstract getWord(index: number): string;\n\n /**\n * Maps a word to its corresponding 11-bit value.\n *\n * Sub-classes MUST override this.\n */\n abstract getWordIndex(word: string): number;\n}\n", "\n// Use the encode-latin.js script to create the necessary\n// data files to be consumed by this class\n\nimport { id } from \"../hash/index.js\";\nimport { assertArgument } from \"../utils/index.js\";\n\nimport { decodeOwl } from \"./decode-owl.js\";\nimport { Wordlist } from \"./wordlist.js\";\n\n/**\n * An OWL format Wordlist is an encoding method that exploits\n * the general locality of alphabetically sorted words to\n * achieve a simple but effective means of compression.\n *\n * This class is generally not useful to most developers as\n * it is used mainly internally to keep Wordlists for languages\n * based on ASCII-7 small.\n *\n * If necessary, there are tools within the ``generation/`` folder\n * to create the necessary data.\n */\nexport class WordlistOwl extends Wordlist {\n #data: string;\n #checksum: string;\n\n /**\n * Creates a new Wordlist for %%locale%% using the OWL %%data%%\n * and validated against the %%checksum%%.\n */\n constructor(locale: string, data: string, checksum: string) {\n super(locale);\n this.#data = data;\n this.#checksum = checksum;\n this.#words = null;\n }\n\n /**\n * The OWL-encoded data.\n */\n get _data(): string { return this.#data; }\n\n /**\n * Decode all the words for the wordlist.\n */\n _decodeWords(): Array {\n return decodeOwl(this.#data);\n }\n\n #words: null | Array;\n #loadWords(): Array {\n if (this.#words == null) {\n const words = this._decodeWords();\n\n // Verify the computed list matches the official list\n const checksum = id(words.join(\"\\n\") + \"\\n\");\n /* c8 ignore start */\n if (checksum !== this.#checksum) {\n throw new Error(`BIP39 Wordlist for ${ this.locale } FAILED`);\n }\n /* c8 ignore stop */\n\n this.#words = words;\n }\n return this.#words;\n }\n\n getWord(index: number): string {\n const words = this.#loadWords();\n assertArgument(index >= 0 && index < words.length, `invalid word index: ${ index }`, \"index\", index);\n return words[index];\n }\n\n getWordIndex(word: string): number {\n return this.#loadWords().indexOf(word);\n }\n}\n", "import { WordlistOwl } from \"./wordlist-owl.js\";\n\nconst words = \"0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dR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od3Dd!DnightLk~]M-NdNimumN%Nu>Rac!Rr%S ySs/akeXXedXtu*5Bi!DelDifyMM|N.%NkeyN, N`OnR$ReRn(gSqu.oTh T]T%Unta(U'VeVie5ChFf(LeLtiplySc!SeumShroomS-/Tu$3Self/ yTh:I=MePk(Rrow/yT]Tu*3ArCkEdGati=G!@I` PhewR=/TTw%kUtr$V WsXt3CeGht5B!I'M(eeOd!Rm$R`SeTab!TeTh(gTi)VelW5C!?Mb R'T:K0EyJe@Li+Scu*S =Ta(Vious0CurEAyEa'Ed+U{UgUn+2EmEtIntL?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO\";\nconst checksum = \"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60\";\n\nlet wordlist: null | LangEn = null;\n\n/**\n * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39).\n *\n * @_docloc: api/wordlists\n */\nexport class LangEn extends WordlistOwl {\n\n /**\n * Creates a new instance of the English language Wordlist.\n *\n * This should be unnecessary most of the time as the exported\n * [[langEn]] should suffice.\n *\n * @_ignore:\n */\n constructor() { super(\"en\", words, checksum); }\n\n /**\n * Returns a singleton instance of a ``LangEn``, creating it\n * if this is the first time being called.\n */\n static wordlist(): LangEn {\n if (wordlist == null) { wordlist = new LangEn(); }\n return wordlist;\n }\n}\n", "import { pbkdf2, sha256 } from \"../crypto/index.js\";\nimport {\n defineProperties, getBytes, hexlify, assertNormalize, assertPrivate, assertArgument, toUtf8Bytes\n} from \"../utils/index.js\";\nimport { LangEn } from \"../wordlists/lang-en.js\";\n\nimport type { BytesLike } from \"../utils/index.js\";\nimport type { Wordlist } from \"../wordlists/index.js\";\n\n\n// Returns a byte with the MSB bits set\nfunction getUpperMask(bits: number): number {\n return ((1 << bits) - 1) << (8 - bits) & 0xff;\n}\n\n// Returns a byte with the LSB bits set\nfunction getLowerMask(bits: number): number {\n return ((1 << bits) - 1) & 0xff;\n}\n\n\nfunction mnemonicToEntropy(mnemonic: string, wordlist?: null | Wordlist): string {\n assertNormalize(\"NFKD\");\n\n if (wordlist == null) { wordlist = LangEn.wordlist(); }\n\n const words = wordlist.split(mnemonic);\n assertArgument((words.length % 3) === 0 && words.length >= 12 && words.length <= 24,\n \"invalid mnemonic length\", \"mnemonic\", \"[ REDACTED ]\");\n\n const entropy = new Uint8Array(Math.ceil(11 * words.length / 8));\n\n let offset = 0;\n for (let i = 0; i < words.length; i++) {\n let index = wordlist.getWordIndex(words[i].normalize(\"NFKD\"));\n assertArgument(index >= 0, `invalid mnemonic word at index ${ i }`, \"mnemonic\", \"[ REDACTED ]\");\n\n for (let bit = 0; bit < 11; bit++) {\n if (index & (1 << (10 - bit))) {\n entropy[offset >> 3] |= (1 << (7 - (offset % 8)));\n }\n offset++;\n }\n }\n\n const entropyBits = 32 * words.length / 3;\n\n\n const checksumBits = words.length / 3;\n const checksumMask = getUpperMask(checksumBits);\n\n const checksum = getBytes(sha256(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;\n\n assertArgument(checksum === (entropy[entropy.length - 1] & checksumMask),\n \"invalid mnemonic checksum\", \"mnemonic\", \"[ REDACTED ]\");\n\n return hexlify(entropy.slice(0, entropyBits / 8));\n}\n\nfunction entropyToMnemonic(entropy: Uint8Array, wordlist?: null | Wordlist): string {\n\n assertArgument((entropy.length % 4) === 0 && entropy.length >= 16 && entropy.length <= 32,\n \"invalid entropy size\", \"entropy\", \"[ REDACTED ]\");\n\n if (wordlist == null) { wordlist = LangEn.wordlist(); }\n\n const indices: Array = [ 0 ];\n\n let remainingBits = 11;\n for (let i = 0; i < entropy.length; i++) {\n\n // Consume the whole byte (with still more to go)\n if (remainingBits > 8) {\n indices[indices.length - 1] <<= 8;\n indices[indices.length - 1] |= entropy[i];\n\n remainingBits -= 8;\n\n // This byte will complete an 11-bit index\n } else {\n indices[indices.length - 1] <<= remainingBits;\n indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits);\n\n // Start the next word\n indices.push(entropy[i] & getLowerMask(8 - remainingBits));\n\n remainingBits += 3;\n }\n }\n\n // Compute the checksum bits\n const checksumBits = entropy.length / 4;\n const checksum = parseInt(sha256(entropy).substring(2, 4), 16) & getUpperMask(checksumBits);\n\n // Shift the checksum into the word indices\n indices[indices.length - 1] <<= checksumBits;\n indices[indices.length - 1] |= (checksum >> (8 - checksumBits));\n\n return wordlist.join(indices.map((index) => (wordlist).getWord(index)));\n}\n\nconst _guard = { };\n\n/**\n * A **Mnemonic** wraps all properties required to compute [[link-bip-39]]\n * seeds and convert between phrases and entropy.\n */\nexport class Mnemonic {\n /**\n * The mnemonic phrase of 12, 15, 18, 21 or 24 words.\n *\n * Use the [[wordlist]] ``split`` method to get the individual words.\n */\n readonly phrase!: string;\n\n /**\n * The password used for this mnemonic. If no password is used this\n * is the empty string (i.e. ``\"\"``) as per the specification.\n */\n readonly password!: string;\n\n /**\n * The wordlist for this mnemonic.\n */\n readonly wordlist!: Wordlist;\n\n /**\n * The underlying entropy which the mnemonic encodes.\n */\n readonly entropy!: string;\n\n /**\n * @private\n */\n constructor(guard: any, entropy: string, phrase: string, password?: null | string, wordlist?: null | Wordlist) {\n if (password == null) { password = \"\"; }\n if (wordlist == null) { wordlist = LangEn.wordlist(); }\n assertPrivate(guard, _guard, \"Mnemonic\");\n defineProperties(this, { phrase, password, wordlist, entropy });\n }\n\n /**\n * Returns the seed for the mnemonic.\n */\n computeSeed(): string {\n const salt = toUtf8Bytes(\"mnemonic\" + this.password, \"NFKD\");\n return pbkdf2(toUtf8Bytes(this.phrase, \"NFKD\"), salt, 2048, 64, \"sha512\");\n }\n\n /**\n * Creates a new Mnemonic for the %%phrase%%.\n *\n * The default %%password%% is the empty string and the default\n * wordlist is the [English wordlists](LangEn).\n */\n static fromPhrase(phrase: string, password?: null | string, wordlist?: null | Wordlist): Mnemonic {\n // Normalize the case and space; throws if invalid\n const entropy = mnemonicToEntropy(phrase, wordlist);\n phrase = entropyToMnemonic(getBytes(entropy), wordlist);\n return new Mnemonic(_guard, entropy, phrase, password, wordlist);\n }\n\n /**\n * Create a new **Mnemonic** from the %%entropy%%.\n *\n * The default %%password%% is the empty string and the default\n * wordlist is the [English wordlists](LangEn).\n */\n static fromEntropy(_entropy: BytesLike, password?: null | string, wordlist?: null | Wordlist): Mnemonic {\n const entropy = getBytes(_entropy, \"entropy\");\n const phrase = entropyToMnemonic(entropy, wordlist);\n return new Mnemonic(_guard, hexlify(entropy), phrase, password, wordlist);\n }\n\n /**\n * Returns the phrase for %%mnemonic%%.\n */\n static entropyToPhrase(_entropy: BytesLike, wordlist?: null | Wordlist): string {\n const entropy = getBytes(_entropy, \"entropy\");\n return entropyToMnemonic(entropy, wordlist);\n }\n\n /**\n * Returns the entropy for %%phrase%%.\n */\n static phraseToEntropy(phrase: string, wordlist?: null | Wordlist): string {\n return mnemonicToEntropy(phrase, wordlist);\n }\n\n /**\n * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase.\n *\n * This checks all the provided words belong to the %%wordlist%%,\n * that the length is valid and the checksum is correct.\n */\n static isValidMnemonic(phrase: string, wordlist?: null | Wordlist): boolean {\n try {\n mnemonicToEntropy(phrase, wordlist);\n return true;\n } catch (error) { }\n return false;\n }\n}\n", "/*! MIT License. Copyright 2015-2022 Richard Moore . See LICENSE.txt. */\n\n// Number of rounds by keysize\nconst numberOfRounds: Record = { 16: 10, 24: 12, 32: 14 };\n\n// Round constant words\nconst rcon = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91];\n\n// S-box and Inverse S-box (S is for Substitution)\nconst S = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0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, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d];\n\n// Transformations for encryption\nconst T1 = [0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a];\nconst T2 = [0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616];\nconst T3 = [0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16];\nconst T4 = [0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c];\n\n// Transformations for decryption\nconst T5 = [0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742];\nconst T6 = [0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857];\nconst T7 = [0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8];\nconst T8 = [0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0];\n\n// Transformations for decryption key expansion\nconst U1 = [0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3];\nconst U2 = [0x00000000, 0x0b0e090d, 0x161c121a, 0x1d121b17, 0x2c382434, 0x27362d39, 0x3a24362e, 0x312a3f23, 0x58704868, 0x537e4165, 0x4e6c5a72, 0x4562537f, 0x74486c5c, 0x7f466551, 0x62547e46, 0x695a774b, 0xb0e090d0, 0xbbee99dd, 0xa6fc82ca, 0xadf28bc7, 0x9cd8b4e4, 0x97d6bde9, 0x8ac4a6fe, 0x81caaff3, 0xe890d8b8, 0xe39ed1b5, 0xfe8ccaa2, 0xf582c3af, 0xc4a8fc8c, 0xcfa6f581, 0xd2b4ee96, 0xd9bae79b, 0x7bdb3bbb, 0x70d532b6, 0x6dc729a1, 0x66c920ac, 0x57e31f8f, 0x5ced1682, 0x41ff0d95, 0x4af10498, 0x23ab73d3, 0x28a57ade, 0x35b761c9, 0x3eb968c4, 0x0f9357e7, 0x049d5eea, 0x198f45fd, 0x12814cf0, 0xcb3bab6b, 0xc035a266, 0xdd27b971, 0xd629b07c, 0xe7038f5f, 0xec0d8652, 0xf11f9d45, 0xfa119448, 0x934be303, 0x9845ea0e, 0x8557f119, 0x8e59f814, 0xbf73c737, 0xb47dce3a, 0xa96fd52d, 0xa261dc20, 0xf6ad766d, 0xfda37f60, 0xe0b16477, 0xebbf6d7a, 0xda955259, 0xd19b5b54, 0xcc894043, 0xc787494e, 0xaedd3e05, 0xa5d33708, 0xb8c12c1f, 0xb3cf2512, 0x82e51a31, 0x89eb133c, 0x94f9082b, 0x9ff70126, 0x464de6bd, 0x4d43efb0, 0x5051f4a7, 0x5b5ffdaa, 0x6a75c289, 0x617bcb84, 0x7c69d093, 0x7767d99e, 0x1e3daed5, 0x1533a7d8, 0x0821bccf, 0x032fb5c2, 0x32058ae1, 0x390b83ec, 0x241998fb, 0x2f1791f6, 0x8d764dd6, 0x867844db, 0x9b6a5fcc, 0x906456c1, 0xa14e69e2, 0xaa4060ef, 0xb7527bf8, 0xbc5c72f5, 0xd50605be, 0xde080cb3, 0xc31a17a4, 0xc8141ea9, 0xf93e218a, 0xf2302887, 0xef223390, 0xe42c3a9d, 0x3d96dd06, 0x3698d40b, 0x2b8acf1c, 0x2084c611, 0x11aef932, 0x1aa0f03f, 0x07b2eb28, 0x0cbce225, 0x65e6956e, 0x6ee89c63, 0x73fa8774, 0x78f48e79, 0x49deb15a, 0x42d0b857, 0x5fc2a340, 0x54ccaa4d, 0xf741ecda, 0xfc4fe5d7, 0xe15dfec0, 0xea53f7cd, 0xdb79c8ee, 0xd077c1e3, 0xcd65daf4, 0xc66bd3f9, 0xaf31a4b2, 0xa43fadbf, 0xb92db6a8, 0xb223bfa5, 0x83098086, 0x8807898b, 0x9515929c, 0x9e1b9b91, 0x47a17c0a, 0x4caf7507, 0x51bd6e10, 0x5ab3671d, 0x6b99583e, 0x60975133, 0x7d854a24, 0x768b4329, 0x1fd13462, 0x14df3d6f, 0x09cd2678, 0x02c32f75, 0x33e91056, 0x38e7195b, 0x25f5024c, 0x2efb0b41, 0x8c9ad761, 0x8794de6c, 0x9a86c57b, 0x9188cc76, 0xa0a2f355, 0xabacfa58, 0xb6bee14f, 0xbdb0e842, 0xd4ea9f09, 0xdfe49604, 0xc2f68d13, 0xc9f8841e, 0xf8d2bb3d, 0xf3dcb230, 0xeecea927, 0xe5c0a02a, 0x3c7a47b1, 0x37744ebc, 0x2a6655ab, 0x21685ca6, 0x10426385, 0x1b4c6a88, 0x065e719f, 0x0d507892, 0x640a0fd9, 0x6f0406d4, 0x72161dc3, 0x791814ce, 0x48322bed, 0x433c22e0, 0x5e2e39f7, 0x552030fa, 0x01ec9ab7, 0x0ae293ba, 0x17f088ad, 0x1cfe81a0, 0x2dd4be83, 0x26dab78e, 0x3bc8ac99, 0x30c6a594, 0x599cd2df, 0x5292dbd2, 0x4f80c0c5, 0x448ec9c8, 0x75a4f6eb, 0x7eaaffe6, 0x63b8e4f1, 0x68b6edfc, 0xb10c0a67, 0xba02036a, 0xa710187d, 0xac1e1170, 0x9d342e53, 0x963a275e, 0x8b283c49, 0x80263544, 0xe97c420f, 0xe2724b02, 0xff605015, 0xf46e5918, 0xc544663b, 0xce4a6f36, 0xd3587421, 0xd8567d2c, 0x7a37a10c, 0x7139a801, 0x6c2bb316, 0x6725ba1b, 0x560f8538, 0x5d018c35, 0x40139722, 0x4b1d9e2f, 0x2247e964, 0x2949e069, 0x345bfb7e, 0x3f55f273, 0x0e7fcd50, 0x0571c45d, 0x1863df4a, 0x136dd647, 0xcad731dc, 0xc1d938d1, 0xdccb23c6, 0xd7c52acb, 0xe6ef15e8, 0xede11ce5, 0xf0f307f2, 0xfbfd0eff, 0x92a779b4, 0x99a970b9, 0x84bb6bae, 0x8fb562a3, 0xbe9f5d80, 0xb591548d, 0xa8834f9a, 0xa38d4697];\nconst U3 = [0x00000000, 0x0d0b0e09, 0x1a161c12, 0x171d121b, 0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f, 0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253, 0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77, 0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b, 0xe49cd8b4, 0xe997d6bd, 0xfe8ac4a6, 0xf381caaf, 0xb8e890d8, 0xb5e39ed1, 0xa2fe8cca, 0xaff582c3, 0x8cc4a8fc, 0x81cfa6f5, 0x96d2b4ee, 0x9bd9bae7, 0xbb7bdb3b, 0xb670d532, 0xa16dc729, 0xac66c920, 0x8f57e31f, 0x825ced16, 0x9541ff0d, 0x984af104, 0xd323ab73, 0xde28a57a, 0xc935b761, 0xc43eb968, 0xe70f9357, 0xea049d5e, 0xfd198f45, 0xf012814c, 0x6bcb3bab, 0x66c035a2, 0x71dd27b9, 0x7cd629b0, 0x5fe7038f, 0x52ec0d86, 0x45f11f9d, 0x48fa1194, 0x03934be3, 0x0e9845ea, 0x198557f1, 0x148e59f8, 0x37bf73c7, 0x3ab47dce, 0x2da96fd5, 0x20a261dc, 0x6df6ad76, 0x60fda37f, 0x77e0b164, 0x7aebbf6d, 0x59da9552, 0x54d19b5b, 0x43cc8940, 0x4ec78749, 0x05aedd3e, 0x08a5d337, 0x1fb8c12c, 0x12b3cf25, 0x3182e51a, 0x3c89eb13, 0x2b94f908, 0x269ff701, 0xbd464de6, 0xb04d43ef, 0xa75051f4, 0xaa5b5ffd, 0x896a75c2, 0x84617bcb, 0x937c69d0, 0x9e7767d9, 0xd51e3dae, 0xd81533a7, 0xcf0821bc, 0xc2032fb5, 0xe132058a, 0xec390b83, 0xfb241998, 0xf62f1791, 0xd68d764d, 0xdb867844, 0xcc9b6a5f, 0xc1906456, 0xe2a14e69, 0xefaa4060, 0xf8b7527b, 0xf5bc5c72, 0xbed50605, 0xb3de080c, 0xa4c31a17, 0xa9c8141e, 0x8af93e21, 0x87f23028, 0x90ef2233, 0x9de42c3a, 0x063d96dd, 0x0b3698d4, 0x1c2b8acf, 0x112084c6, 0x3211aef9, 0x3f1aa0f0, 0x2807b2eb, 0x250cbce2, 0x6e65e695, 0x636ee89c, 0x7473fa87, 0x7978f48e, 0x5a49deb1, 0x5742d0b8, 0x405fc2a3, 0x4d54ccaa, 0xdaf741ec, 0xd7fc4fe5, 0xc0e15dfe, 0xcdea53f7, 0xeedb79c8, 0xe3d077c1, 0xf4cd65da, 0xf9c66bd3, 0xb2af31a4, 0xbfa43fad, 0xa8b92db6, 0xa5b223bf, 0x86830980, 0x8b880789, 0x9c951592, 0x919e1b9b, 0x0a47a17c, 0x074caf75, 0x1051bd6e, 0x1d5ab367, 0x3e6b9958, 0x33609751, 0x247d854a, 0x29768b43, 0x621fd134, 0x6f14df3d, 0x7809cd26, 0x7502c32f, 0x5633e910, 0x5b38e719, 0x4c25f502, 0x412efb0b, 0x618c9ad7, 0x6c8794de, 0x7b9a86c5, 0x769188cc, 0x55a0a2f3, 0x58abacfa, 0x4fb6bee1, 0x42bdb0e8, 0x09d4ea9f, 0x04dfe496, 0x13c2f68d, 0x1ec9f884, 0x3df8d2bb, 0x30f3dcb2, 0x27eecea9, 0x2ae5c0a0, 0xb13c7a47, 0xbc37744e, 0xab2a6655, 0xa621685c, 0x85104263, 0x881b4c6a, 0x9f065e71, 0x920d5078, 0xd9640a0f, 0xd46f0406, 0xc372161d, 0xce791814, 0xed48322b, 0xe0433c22, 0xf75e2e39, 0xfa552030, 0xb701ec9a, 0xba0ae293, 0xad17f088, 0xa01cfe81, 0x832dd4be, 0x8e26dab7, 0x993bc8ac, 0x9430c6a5, 0xdf599cd2, 0xd25292db, 0xc54f80c0, 0xc8448ec9, 0xeb75a4f6, 0xe67eaaff, 0xf163b8e4, 0xfc68b6ed, 0x67b10c0a, 0x6aba0203, 0x7da71018, 0x70ac1e11, 0x539d342e, 0x5e963a27, 0x498b283c, 0x44802635, 0x0fe97c42, 0x02e2724b, 0x15ff6050, 0x18f46e59, 0x3bc54466, 0x36ce4a6f, 0x21d35874, 0x2cd8567d, 0x0c7a37a1, 0x017139a8, 0x166c2bb3, 0x1b6725ba, 0x38560f85, 0x355d018c, 0x22401397, 0x2f4b1d9e, 0x642247e9, 0x692949e0, 0x7e345bfb, 0x733f55f2, 0x500e7fcd, 0x5d0571c4, 0x4a1863df, 0x47136dd6, 0xdccad731, 0xd1c1d938, 0xc6dccb23, 0xcbd7c52a, 0xe8e6ef15, 0xe5ede11c, 0xf2f0f307, 0xfffbfd0e, 0xb492a779, 0xb999a970, 0xae84bb6b, 0xa38fb562, 0x80be9f5d, 0x8db59154, 0x9aa8834f, 0x97a38d46];\nconst U4 = [0x00000000, 0x090d0b0e, 0x121a161c, 0x1b171d12, 0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a, 0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562, 0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a, 0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2, 0xb4e49cd8, 0xbde997d6, 0xa6fe8ac4, 0xaff381ca, 0xd8b8e890, 0xd1b5e39e, 0xcaa2fe8c, 0xc3aff582, 0xfc8cc4a8, 0xf581cfa6, 0xee96d2b4, 0xe79bd9ba, 0x3bbb7bdb, 0x32b670d5, 0x29a16dc7, 0x20ac66c9, 0x1f8f57e3, 0x16825ced, 0x0d9541ff, 0x04984af1, 0x73d323ab, 0x7ade28a5, 0x61c935b7, 0x68c43eb9, 0x57e70f93, 0x5eea049d, 0x45fd198f, 0x4cf01281, 0xab6bcb3b, 0xa266c035, 0xb971dd27, 0xb07cd629, 0x8f5fe703, 0x8652ec0d, 0x9d45f11f, 0x9448fa11, 0xe303934b, 0xea0e9845, 0xf1198557, 0xf8148e59, 0xc737bf73, 0xce3ab47d, 0xd52da96f, 0xdc20a261, 0x766df6ad, 0x7f60fda3, 0x6477e0b1, 0x6d7aebbf, 0x5259da95, 0x5b54d19b, 0x4043cc89, 0x494ec787, 0x3e05aedd, 0x3708a5d3, 0x2c1fb8c1, 0x2512b3cf, 0x1a3182e5, 0x133c89eb, 0x082b94f9, 0x01269ff7, 0xe6bd464d, 0xefb04d43, 0xf4a75051, 0xfdaa5b5f, 0xc2896a75, 0xcb84617b, 0xd0937c69, 0xd99e7767, 0xaed51e3d, 0xa7d81533, 0xbccf0821, 0xb5c2032f, 0x8ae13205, 0x83ec390b, 0x98fb2419, 0x91f62f17, 0x4dd68d76, 0x44db8678, 0x5fcc9b6a, 0x56c19064, 0x69e2a14e, 0x60efaa40, 0x7bf8b752, 0x72f5bc5c, 0x05bed506, 0x0cb3de08, 0x17a4c31a, 0x1ea9c814, 0x218af93e, 0x2887f230, 0x3390ef22, 0x3a9de42c, 0xdd063d96, 0xd40b3698, 0xcf1c2b8a, 0xc6112084, 0xf93211ae, 0xf03f1aa0, 0xeb2807b2, 0xe2250cbc, 0x956e65e6, 0x9c636ee8, 0x877473fa, 0x8e7978f4, 0xb15a49de, 0xb85742d0, 0xa3405fc2, 0xaa4d54cc, 0xecdaf741, 0xe5d7fc4f, 0xfec0e15d, 0xf7cdea53, 0xc8eedb79, 0xc1e3d077, 0xdaf4cd65, 0xd3f9c66b, 0xa4b2af31, 0xadbfa43f, 0xb6a8b92d, 0xbfa5b223, 0x80868309, 0x898b8807, 0x929c9515, 0x9b919e1b, 0x7c0a47a1, 0x75074caf, 0x6e1051bd, 0x671d5ab3, 0x583e6b99, 0x51336097, 0x4a247d85, 0x4329768b, 0x34621fd1, 0x3d6f14df, 0x267809cd, 0x2f7502c3, 0x105633e9, 0x195b38e7, 0x024c25f5, 0x0b412efb, 0xd7618c9a, 0xde6c8794, 0xc57b9a86, 0xcc769188, 0xf355a0a2, 0xfa58abac, 0xe14fb6be, 0xe842bdb0, 0x9f09d4ea, 0x9604dfe4, 0x8d13c2f6, 0x841ec9f8, 0xbb3df8d2, 0xb230f3dc, 0xa927eece, 0xa02ae5c0, 0x47b13c7a, 0x4ebc3774, 0x55ab2a66, 0x5ca62168, 0x63851042, 0x6a881b4c, 0x719f065e, 0x78920d50, 0x0fd9640a, 0x06d46f04, 0x1dc37216, 0x14ce7918, 0x2bed4832, 0x22e0433c, 0x39f75e2e, 0x30fa5520, 0x9ab701ec, 0x93ba0ae2, 0x88ad17f0, 0x81a01cfe, 0xbe832dd4, 0xb78e26da, 0xac993bc8, 0xa59430c6, 0xd2df599c, 0xdbd25292, 0xc0c54f80, 0xc9c8448e, 0xf6eb75a4, 0xffe67eaa, 0xe4f163b8, 0xedfc68b6, 0x0a67b10c, 0x036aba02, 0x187da710, 0x1170ac1e, 0x2e539d34, 0x275e963a, 0x3c498b28, 0x35448026, 0x420fe97c, 0x4b02e272, 0x5015ff60, 0x5918f46e, 0x663bc544, 0x6f36ce4a, 0x7421d358, 0x7d2cd856, 0xa10c7a37, 0xa8017139, 0xb3166c2b, 0xba1b6725, 0x8538560f, 0x8c355d01, 0x97224013, 0x9e2f4b1d, 0xe9642247, 0xe0692949, 0xfb7e345b, 0xf2733f55, 0xcd500e7f, 0xc45d0571, 0xdf4a1863, 0xd647136d, 0x31dccad7, 0x38d1c1d9, 0x23c6dccb, 0x2acbd7c5, 0x15e8e6ef, 0x1ce5ede1, 0x07f2f0f3, 0x0efffbfd, 0x79b492a7, 0x70b999a9, 0x6bae84bb, 0x62a38fb5, 0x5d80be9f, 0x548db591, 0x4f9aa883, 0x4697a38d];\n\nfunction convertToInt32(bytes: Uint8Array): Array {\n const result = [ ];\n for (let i = 0; i < bytes.length; i += 4) {\n result.push((bytes[i] << 24) | (bytes[i + 1] << 16) | (bytes[i + 2] << 8) | bytes[i + 3]);\n }\n return result;\n}\n\nexport class AES {\n readonly #key: Uint8Array;\n readonly #Kd: Array>;\n readonly #Ke: Array>;\n\n get key(): Uint8Array { return this.#key.slice(); }\n\n constructor(key: Uint8Array) {\n if (!(this instanceof AES)) {\n throw Error('AES must be instanitated with `new`');\n }\n\n this.#key = new Uint8Array(key);\n\n const rounds = numberOfRounds[this.key.length];\n if (rounds == null) {\n throw new TypeError('invalid key size (must be 16, 24 or 32 bytes)');\n }\n\n // encryption round keys\n this.#Ke = [];\n\n // decryption round keys\n this.#Kd = [];\n\n for (let i = 0; i <= rounds; i++) {\n this.#Ke.push([0, 0, 0, 0]);\n this.#Kd.push([0, 0, 0, 0]);\n }\n\n const roundKeyCount = (rounds + 1) * 4;\n const KC = this.key.length / 4;\n\n // convert the key into ints\n const tk = convertToInt32(this.key);\n\n // copy values into round key arrays\n let index;\n for (let i = 0; i < KC; i++) {\n index = i >> 2;\n this.#Ke[index][i % 4] = tk[i];\n this.#Kd[rounds - index][i % 4] = tk[i];\n }\n\n // key expansion (fips-197 section 5.2)\n let rconpointer = 0;\n let t = KC, tt;\n while (t < roundKeyCount) {\n tt = tk[KC - 1];\n tk[0] ^= ((S[(tt >> 16) & 0xFF] << 24) ^\n (S[(tt >> 8) & 0xFF] << 16) ^\n (S[ tt & 0xFF] << 8) ^\n S[(tt >> 24) & 0xFF] ^\n (rcon[rconpointer] << 24));\n rconpointer += 1;\n\n // key expansion (for non-256 bit)\n if (KC != 8) {\n for (let i = 1; i < KC; i++) {\n tk[i] ^= tk[i - 1];\n }\n\n // key expansion for 256-bit keys is \"slightly different\" (fips-197)\n } else {\n for (let i = 1; i < (KC / 2); i++) {\n tk[i] ^= tk[i - 1];\n }\n tt = tk[(KC / 2) - 1];\n\n tk[KC / 2] ^= (S[ tt & 0xFF] ^\n (S[(tt >> 8) & 0xFF] << 8) ^\n (S[(tt >> 16) & 0xFF] << 16) ^\n (S[(tt >> 24) & 0xFF] << 24));\n\n for (let i = (KC / 2) + 1; i < KC; i++) {\n tk[i] ^= tk[i - 1];\n }\n }\n\n // copy values into round key arrays\n let i = 0, r, c;\n while (i < KC && t < roundKeyCount) {\n r = t >> 2;\n c = t % 4;\n this.#Ke[r][c] = tk[i];\n this.#Kd[rounds - r][c] = tk[i++];\n t++;\n }\n }\n\n // inverse-cipher-ify the decryption round key (fips-197 section 5.3)\n for (let r = 1; r < rounds; r++) {\n for (let c = 0; c < 4; c++) {\n tt = this.#Kd[r][c];\n this.#Kd[r][c] = (U1[(tt >> 24) & 0xFF] ^\n U2[(tt >> 16) & 0xFF] ^\n U3[(tt >> 8) & 0xFF] ^\n U4[ tt & 0xFF]);\n }\n }\n }\n\n encrypt(plaintext: Uint8Array): Uint8Array {\n if (plaintext.length != 16) {\n throw new TypeError('invalid plaintext size (must be 16 bytes)');\n }\n\n const rounds = this.#Ke.length - 1;\n const a = [0, 0, 0, 0];\n\n // convert plaintext to (ints ^ key)\n let t = convertToInt32(plaintext);\n for (let i = 0; i < 4; i++) {\n t[i] ^= this.#Ke[0][i];\n }\n\n // apply round transforms\n for (let r = 1; r < rounds; r++) {\n for (let i = 0; i < 4; i++) {\n a[i] = (T1[(t[ i ] >> 24) & 0xff] ^\n T2[(t[(i + 1) % 4] >> 16) & 0xff] ^\n T3[(t[(i + 2) % 4] >> 8) & 0xff] ^\n T4[ t[(i + 3) % 4] & 0xff] ^\n this.#Ke[r][i]);\n }\n t = a.slice();\n }\n\n // the last round is special\n const result = new Uint8Array(16);\n let tt = 0;\n for (let i = 0; i < 4; i++) {\n tt = this.#Ke[rounds][i];\n result[4 * i ] = (S[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff;\n result[4 * i + 1] = (S[(t[(i + 1) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff;\n result[4 * i + 2] = (S[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff;\n result[4 * i + 3] = (S[ t[(i + 3) % 4] & 0xff] ^ tt ) & 0xff;\n }\n\n return result;\n }\n\n decrypt(ciphertext: Uint8Array): Uint8Array {\n if (ciphertext.length != 16) {\n throw new TypeError('invalid ciphertext size (must be 16 bytes)');\n }\n\n const rounds = this.#Kd.length - 1;\n const a = [0, 0, 0, 0];\n\n // convert plaintext to (ints ^ key)\n let t = convertToInt32(ciphertext);\n for (let i = 0; i < 4; i++) {\n t[i] ^= this.#Kd[0][i];\n }\n\n // apply round transforms\n for (let r = 1; r < rounds; r++) {\n for (let i = 0; i < 4; i++) {\n a[i] = (T5[(t[ i ] >> 24) & 0xff] ^\n T6[(t[(i + 3) % 4] >> 16) & 0xff] ^\n T7[(t[(i + 2) % 4] >> 8) & 0xff] ^\n T8[ t[(i + 1) % 4] & 0xff] ^\n this.#Kd[r][i]);\n }\n t = a.slice();\n }\n\n // the last round is special\n const result = new Uint8Array(16);\n let tt = 0;\n for (let i = 0; i < 4; i++) {\n tt = this.#Kd[rounds][i];\n result[4 * i ] = (Si[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff;\n result[4 * i + 1] = (Si[(t[(i + 3) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff;\n result[4 * i + 2] = (Si[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff;\n result[4 * i + 3] = (Si[ t[(i + 1) % 4] & 0xff] ^ tt ) & 0xff;\n }\n\n return result;\n }\n}\n", "\nimport { AES } from \"./aes.js\";\n\nexport abstract class ModeOfOperation {\n readonly aes!: AES;\n readonly name!: string;\n\n constructor(name: string, key: Uint8Array, cls?: any) {\n if (cls && !(this instanceof cls)) {\n throw new Error(`${ name } must be instantiated with \"new\"`);\n }\n\n Object.defineProperties(this, {\n aes: { enumerable: true, value: new AES(key) },\n name: { enumerable: true, value: name }\n });\n }\n\n abstract encrypt(plaintext: Uint8Array): Uint8Array;\n abstract decrypt(ciphertext: Uint8Array): Uint8Array;\n}\n", "// Cipher Block Chaining\n\nimport { ModeOfOperation } from \"./mode.js\";\n\nexport class CBC extends ModeOfOperation {\n #iv: Uint8Array;\n #lastBlock: Uint8Array;\n\n constructor(key: Uint8Array, iv?: Uint8Array) {\n super(\"ECC\", key, CBC);\n\n if (iv) {\n if (iv.length % 16) {\n throw new TypeError(\"invalid iv size (must be 16 bytes)\");\n }\n this.#iv = new Uint8Array(iv);\n } else {\n this.#iv = new Uint8Array(16);\n }\n\n this.#lastBlock = this.iv;\n }\n\n get iv(): Uint8Array { return new Uint8Array(this.#iv); }\n\n encrypt(plaintext: Uint8Array): Uint8Array {\n if (plaintext.length % 16) {\n throw new TypeError(\"invalid plaintext size (must be multiple of 16 bytes)\");\n }\n\n const ciphertext = new Uint8Array(plaintext.length);\n for (let i = 0; i < plaintext.length; i += 16) {\n for (let j = 0; j < 16; j++) {\n this.#lastBlock[j] ^= plaintext[i + j];\n }\n\n this.#lastBlock = this.aes.encrypt(this.#lastBlock);\n ciphertext.set(this.#lastBlock, i);\n }\n\n return ciphertext;\n }\n\n decrypt(ciphertext: Uint8Array): Uint8Array {\n if (ciphertext.length % 16) {\n throw new TypeError(\"invalid ciphertext size (must be multiple of 16 bytes)\");\n }\n\n const plaintext = new Uint8Array(ciphertext.length);\n for (let i = 0; i < ciphertext.length; i += 16) {\n const block = this.aes.decrypt(ciphertext.subarray(i, i + 16));\n\n for (let j = 0; j < 16; j++) {\n plaintext[i + j] = block[j] ^ this.#lastBlock[j];\n this.#lastBlock[j] = ciphertext[i + j];\n }\n }\n\n return plaintext;\n }\n}\n", "// Cipher Feedback\n\nimport { ModeOfOperation } from \"./mode.js\";\n\nexport class CFB extends ModeOfOperation {\n #iv: Uint8Array;\n #shiftRegister: Uint8Array;\n\n readonly segmentSize!: number;\n\n constructor(key: Uint8Array, iv?: Uint8Array, segmentSize: number = 8) {\n super(\"CFB\", key, CFB);\n\n // This library currently only handles byte-aligned segmentSize\n if (!Number.isInteger(segmentSize) || (segmentSize % 8)) {\n throw new TypeError(\"invalid segmentSize\");\n }\n\n Object.defineProperties(this, {\n segmentSize: { enumerable: true, value: segmentSize }\n });\n\n if (iv) {\n if (iv.length % 16) {\n throw new TypeError(\"invalid iv size (must be 16 bytes)\");\n }\n this.#iv = new Uint8Array(iv);\n } else {\n this.#iv = new Uint8Array(16);\n }\n\n this.#shiftRegister = this.iv;\n }\n\n get iv(): Uint8Array { return new Uint8Array(this.#iv); }\n\n #shift(data: Uint8Array): void {\n const segmentSize = this.segmentSize / 8;\n\n // Shift the register\n this.#shiftRegister.set(this.#shiftRegister.subarray(segmentSize));\n this.#shiftRegister.set(data.subarray(0, segmentSize), 16 - segmentSize);\n }\n\n encrypt(plaintext: Uint8Array): Uint8Array {\n if (8 * plaintext.length % this.segmentSize) {\n throw new TypeError(\"invalid plaintext size (must be multiple of segmentSize bytes)\");\n }\n\n const segmentSize = this.segmentSize / 8;\n\n const ciphertext = new Uint8Array(plaintext);\n\n for (let i = 0; i < ciphertext.length; i += segmentSize) {\n const xorSegment = this.aes.encrypt(this.#shiftRegister);\n for (let j = 0; j < segmentSize; j++) {\n ciphertext[i + j] ^= xorSegment[j];\n }\n\n this.#shift(ciphertext.subarray(i));\n }\n\n return ciphertext;\n }\n\n decrypt(ciphertext: Uint8Array): Uint8Array {\n if (8 * ciphertext.length % this.segmentSize) {\n throw new TypeError(\"invalid ciphertext size (must be multiple of segmentSize bytes)\");\n }\n\n const segmentSize = this.segmentSize / 8;\n\n const plaintext = new Uint8Array(ciphertext);\n\n for (let i = 0; i < plaintext.length; i += segmentSize) {\n const xorSegment = this.aes.encrypt(this.#shiftRegister);\n for (let j = 0; j < segmentSize; j++) {\n plaintext[i + j] ^= xorSegment[j];\n }\n\n this.#shift(ciphertext.subarray(i));\n }\n\n return plaintext;\n }\n}\n", "// Counter Mode\n\nimport { ModeOfOperation } from \"./mode.js\";\n\nexport class CTR extends ModeOfOperation {\n\n // Remaining bytes for the one-time pad\n #remaining: Uint8Array;\n #remainingIndex: number;\n\n // The current counter\n #counter: Uint8Array;\n\n constructor(key: Uint8Array, initialValue?: number | Uint8Array) {\n super(\"CTR\", key, CTR);\n\n this.#counter = new Uint8Array(16)\n this.#counter.fill(0);\n\n this.#remaining = this.#counter; // This will be discarded immediately\n this.#remainingIndex = 16;\n\n if (initialValue == null) { initialValue = 1; }\n\n if (typeof(initialValue) === \"number\") {\n this.setCounterValue(initialValue);\n } else {\n this.setCounterBytes(initialValue);\n }\n }\n\n get counter(): Uint8Array { return new Uint8Array(this.#counter); }\n\n setCounterValue(value: number): void {\n if (!Number.isInteger(value) || value < 0 || value > Number.MAX_SAFE_INTEGER) {\n throw new TypeError(\"invalid counter initial integer value\");\n }\n\n for (let index = 15; index >= 0; --index) {\n this.#counter[index] = value % 256;\n value = Math.floor(value / 256);\n }\n }\n\n setCounterBytes(value: Uint8Array): void {\n if (value.length !== 16) {\n throw new TypeError(\"invalid counter initial Uint8Array value length\");\n }\n\n this.#counter.set(value);\n }\n\n increment() {\n for (let i = 15; i >= 0; i--) {\n if (this.#counter[i] === 255) {\n this.#counter[i] = 0;\n } else {\n this.#counter[i]++;\n break;\n }\n }\n }\n\n encrypt(plaintext: Uint8Array): Uint8Array {\n const crypttext = new Uint8Array(plaintext);\n\n for (let i = 0; i < crypttext.length; i++) {\n if (this.#remainingIndex === 16) {\n this.#remaining = this.aes.encrypt(this.#counter);\n this.#remainingIndex = 0;\n this.increment();\n }\n crypttext[i] ^= this.#remaining[this.#remainingIndex++];\n }\n\n return crypttext;\n }\n\n decrypt(ciphertext: Uint8Array): Uint8Array {\n return this.encrypt(ciphertext);\n }\n}\n", "\nexport function pkcs7Pad(data: Uint8Array): Uint8Array {\n const padder = 16 - (data.length % 16);\n\n const result = new Uint8Array(data.length + padder);\n result.set(data);\n\n for (let i = data.length; i < result.length; i++) {\n result[i] = padder;\n }\n\n return result;\n}\n\nexport function pkcs7Strip(data: Uint8Array): Uint8Array {\n if (data.length < 16) { throw new TypeError('PKCS#7 invalid length'); }\n\n const padder = data[data.length - 1];\n if (padder > 16) { throw new TypeError('PKCS#7 padding byte out of range'); }\n\n const length = data.length - padder;\n for (let i = 0; i < padder; i++) {\n if (data[length + i] !== padder) {\n throw new TypeError('PKCS#7 invalid padding byte');\n }\n }\n\n return new Uint8Array(data.subarray(0, length));\n}\n", "/**\n * @_ignore\n */\n\nimport {\n getBytesCopy, assertArgument, toUtf8Bytes\n} from \"../utils/index.js\";\n\nexport function looseArrayify(hexString: string): Uint8Array {\n if (typeof(hexString) === \"string\" && !hexString.startsWith(\"0x\")) {\n hexString = \"0x\" + hexString;\n }\n return getBytesCopy(hexString);\n}\n\nexport function zpad(value: String | number, length: number): String {\n value = String(value);\n while (value.length < length) { value = '0' + value; }\n return value;\n}\n\nexport function getPassword(password: string | Uint8Array): Uint8Array {\n if (typeof(password) === 'string') {\n return toUtf8Bytes(password, \"NFKC\");\n }\n return getBytesCopy(password);\n}\n\nexport function spelunk(object: any, _path: string): T {\n\n const match = _path.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);\n assertArgument(match != null, \"invalid path\", \"path\", _path);\n\n const path = match[1];\n const type = match[3];\n const reqd = (match[4] === \"!\");\n\n let cur = object;\n for (const comp of path.toLowerCase().split('.')) {\n\n // Search for a child object with a case-insensitive matching key\n if (Array.isArray(cur)) {\n if (!comp.match(/^[0-9]+$/)) { break; }\n cur = cur[parseInt(comp)];\n\n } else if (typeof(cur) === \"object\") {\n let found: any = null;\n for (const key in cur) {\n if (key.toLowerCase() === comp) {\n found = cur[key];\n break;\n }\n }\n cur = found;\n\n } else {\n cur = null;\n }\n\n if (cur == null) { break; }\n }\n\n assertArgument(!reqd || cur != null, \"missing required value\", \"path\", path);\n\n if (type && cur != null) {\n if (type === \"int\") {\n if (typeof(cur) === \"string\" && cur.match(/^-?[0-9]+$/)) {\n return parseInt(cur);\n } else if (Number.isSafeInteger(cur)) {\n return cur;\n }\n }\n\n if (type === \"number\") {\n if (typeof(cur) === \"string\" && cur.match(/^-?[0-9.]*$/)) {\n return parseFloat(cur);\n }\n }\n\n if (type === \"data\") {\n if (typeof(cur) === \"string\") { return looseArrayify(cur); }\n }\n\n if (type === \"array\" && Array.isArray(cur)) { return cur; }\n if (type === typeof(cur)) { return cur; }\n\n assertArgument(false, `wrong type found for ${ type } `, \"path\", path);\n }\n\n return cur;\n}\n/*\nexport function follow(object: any, path: string): null | string {\n let currentChild = object;\n\n for (const comp of path.toLowerCase().split('/')) {\n\n // Search for a child object with a case-insensitive matching key\n let matchingChild = null;\n for (const key in currentChild) {\n if (key.toLowerCase() === comp) {\n matchingChild = currentChild[key];\n break;\n }\n }\n\n if (matchingChild === null) { return null; }\n\n currentChild = matchingChild;\n }\n\n return currentChild;\n}\n\n// \"path/to/something:type!\"\nexport function followRequired(data: any, path: string): string {\n const value = follow(data, path);\n if (value != null) { return value; }\n return logger.throwArgumentError(\"invalid value\", `data:${ path }`,\n JSON.stringify(data));\n}\n*/\n// See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4)\n/*\nexport function uuidV4(randomBytes: BytesLike): string {\n const bytes = getBytes(randomBytes, \"randomBytes\");\n\n // Section: 4.1.3:\n // - time_hi_and_version[12:16] = 0b0100\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n\n // Section 4.4\n // - clock_seq_hi_and_reserved[6] = 0b0\n // - clock_seq_hi_and_reserved[7] = 0b1\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n\n const value = hexlify(bytes);\n\n return [\n value.substring(2, 10),\n value.substring(10, 14),\n value.substring(14, 18),\n value.substring(18, 22),\n value.substring(22, 34),\n ].join(\"-\");\n}\n*/\n", "/**\n * The JSON Wallet formats allow a simple way to store the private\n * keys needed in Ethereum along with related information and allows\n * for extensible forms of encryption.\n *\n * These utilities facilitate decrypting and encrypting the most common\n * JSON Wallet formats.\n *\n * @_subsection: api/wallet:JSON Wallets [json-wallets]\n */\n\nimport { CTR } from \"aes-js\";\n\nimport { getAddress } from \"../address/index.js\";\nimport { keccak256, pbkdf2, randomBytes, scrypt, scryptSync } from \"../crypto/index.js\";\nimport { computeAddress } from \"../transaction/index.js\";\nimport {\n concat, getBytes, hexlify, uuidV4, assert, assertArgument\n} from \"../utils/index.js\";\n\nimport { getPassword, spelunk, zpad } from \"./utils.js\";\n\nimport type { ProgressCallback } from \"../crypto/index.js\";\nimport type { BytesLike } from \"../utils/index.js\";\n\nimport { version } from \"../_version.js\";\n\n\nconst defaultPath = \"m/44'/60'/0'/0/0\";\n\n/**\n * The contents of a JSON Keystore Wallet.\n */\nexport type KeystoreAccount = {\n address: string;\n privateKey: string;\n mnemonic?: {\n path?: string;\n locale?: string;\n entropy: string;\n }\n};\n\n/**\n * The parameters to use when encrypting a JSON Keystore Wallet.\n */\nexport type EncryptOptions = {\n progressCallback?: ProgressCallback;\n iv?: BytesLike;\n entropy?: BytesLike;\n client?: string;\n salt?: BytesLike;\n uuid?: string;\n scrypt?: {\n N?: number;\n r?: number;\n p?: number;\n }\n}\n\n/**\n * Returns true if %%json%% is a valid JSON Keystore Wallet.\n */\nexport function isKeystoreJson(json: string): boolean {\n try {\n const data = JSON.parse(json);\n const version = ((data.version != null) ? parseInt(data.version): 0);\n if (version === 3) { return true; }\n } catch (error) { }\n return false;\n}\n\nfunction decrypt(data: any, key: Uint8Array, ciphertext: Uint8Array): string {\n const cipher = spelunk(data, \"crypto.cipher:string\");\n if (cipher === \"aes-128-ctr\") {\n const iv = spelunk(data, \"crypto.cipherparams.iv:data!\")\n const aesCtr = new CTR(key, iv);\n return hexlify(aesCtr.decrypt(ciphertext));\n }\n\n assert(false, \"unsupported cipher\", \"UNSUPPORTED_OPERATION\", {\n operation: \"decrypt\"\n });\n}\n\nfunction getAccount(data: any, _key: string): KeystoreAccount {\n const key = getBytes(_key);\n const ciphertext = spelunk(data, \"crypto.ciphertext:data!\");\n\n const computedMAC = hexlify(keccak256(concat([ key.slice(16, 32), ciphertext ]))).substring(2);\n assertArgument(computedMAC === spelunk(data, \"crypto.mac:string!\").toLowerCase(),\n \"incorrect password\", \"password\", \"[ REDACTED ]\");\n\n const privateKey = decrypt(data, key.slice(0, 16), ciphertext);\n\n const address = computeAddress(privateKey);\n if (data.address) {\n let check = data.address.toLowerCase();\n if (!check.startsWith(\"0x\")) { check = \"0x\" + check; }\n\n assertArgument(getAddress(check) === address, \"keystore address/privateKey mismatch\", \"address\", data.address);\n }\n\n const account: KeystoreAccount = { address, privateKey };\n\n // Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase\n const version = spelunk(data, \"x-ethers.version:string\");\n if (version === \"0.1\") {\n const mnemonicKey = key.slice(32, 64);\n\n const mnemonicCiphertext = spelunk(data, \"x-ethers.mnemonicCiphertext:data!\");\n const mnemonicIv = spelunk(data, \"x-ethers.mnemonicCounter:data!\");\n\n const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv);\n\n account.mnemonic = {\n path: (spelunk(data, \"x-ethers.path:string\") || defaultPath),\n locale: (spelunk(data, \"x-ethers.locale:string\") || \"en\"),\n entropy: hexlify(getBytes(mnemonicAesCtr.decrypt(mnemonicCiphertext)))\n };\n }\n\n return account;\n}\n\ntype ScryptParams = {\n name: \"scrypt\";\n salt: Uint8Array;\n N: number;\n r: number;\n p: number;\n dkLen: number;\n};\n\ntype KdfParams = ScryptParams | {\n name: \"pbkdf2\";\n salt: Uint8Array;\n count: number;\n dkLen: number;\n algorithm: \"sha256\" | \"sha512\";\n};\n\nfunction getDecryptKdfParams(data: any): KdfParams {\n const kdf = spelunk(data, \"crypto.kdf:string\");\n if (kdf && typeof(kdf) === \"string\") {\n if (kdf.toLowerCase() === \"scrypt\") {\n const salt = spelunk(data, \"crypto.kdfparams.salt:data!\");\n const N = spelunk(data, \"crypto.kdfparams.n:int!\");\n const r = spelunk(data, \"crypto.kdfparams.r:int!\");\n const p = spelunk(data, \"crypto.kdfparams.p:int!\");\n\n // Make sure N is a power of 2\n assertArgument(N > 0 && (N & (N - 1)) === 0, \"invalid kdf.N\", \"kdf.N\", N);\n assertArgument(r > 0 && p > 0, \"invalid kdf\", \"kdf\", kdf);\n\n const dkLen = spelunk(data, \"crypto.kdfparams.dklen:int!\");\n assertArgument(dkLen === 32, \"invalid kdf.dklen\", \"kdf.dflen\", dkLen);\n\n return { name: \"scrypt\", salt, N, r, p, dkLen: 64 };\n\n } else if (kdf.toLowerCase() === \"pbkdf2\") {\n\n const salt = spelunk(data, \"crypto.kdfparams.salt:data!\");\n\n const prf = spelunk(data, \"crypto.kdfparams.prf:string!\");\n const algorithm = prf.split(\"-\").pop();\n assertArgument(algorithm === \"sha256\" || algorithm === \"sha512\", \"invalid kdf.pdf\", \"kdf.pdf\", prf);\n\n const count = spelunk(data, \"crypto.kdfparams.c:int!\");\n\n const dkLen = spelunk(data, \"crypto.kdfparams.dklen:int!\");\n assertArgument(dkLen === 32, \"invalid kdf.dklen\", \"kdf.dklen\", dkLen);\n\n return { name: \"pbkdf2\", salt, count, dkLen, algorithm };\n }\n }\n\n assertArgument(false, \"unsupported key-derivation function\", \"kdf\", kdf);\n}\n\n\n/**\n * Returns the account details for the JSON Keystore Wallet %%json%%\n * using %%password%%.\n *\n * It is preferred to use the [async version](decryptKeystoreJson)\n * instead, which allows a [[ProgressCallback]] to keep the user informed\n * as to the decryption status.\n *\n * This method will block the event loop (freezing all UI) until decryption\n * is complete, which can take quite some time, depending on the wallet\n * paramters and platform.\n */\nexport function decryptKeystoreJsonSync(json: string, _password: string | Uint8Array): KeystoreAccount {\n const data = JSON.parse(json);\n\n const password = getPassword(_password);\n\n const params = getDecryptKdfParams(data);\n if (params.name === \"pbkdf2\") {\n const { salt, count, dkLen, algorithm } = params;\n const key = pbkdf2(password, salt, count, dkLen, algorithm);\n return getAccount(data, key);\n }\n\n assert(params.name === \"scrypt\", \"cannot be reached\", \"UNKNOWN_ERROR\", { params })\n\n const { salt, N, r, p, dkLen } = params;\n const key = scryptSync(password, salt, N, r, p, dkLen);\n return getAccount(data, key);\n}\n\nfunction stall(duration: number): Promise {\n return new Promise((resolve) => { setTimeout(() => { resolve(); }, duration); });\n}\n\n/**\n * Resolves to the decrypted JSON Keystore Wallet %%json%% using the\n * %%password%%.\n *\n * If provided, %%progress%% will be called periodically during the\n * decrpytion to provide feedback, and if the function returns\n * ``false`` will halt decryption.\n *\n * The %%progressCallback%% will **always** receive ``0`` before\n * decryption begins and ``1`` when complete.\n */\nexport async function decryptKeystoreJson(json: string, _password: string | Uint8Array, progress?: ProgressCallback): Promise {\n const data = JSON.parse(json);\n\n const password = getPassword(_password);\n\n const params = getDecryptKdfParams(data);\n if (params.name === \"pbkdf2\") {\n if (progress) {\n progress(0);\n await stall(0);\n }\n const { salt, count, dkLen, algorithm } = params;\n const key = pbkdf2(password, salt, count, dkLen, algorithm);\n if (progress) {\n progress(1);\n await stall(0);\n }\n return getAccount(data, key);\n }\n\n assert(params.name === \"scrypt\", \"cannot be reached\", \"UNKNOWN_ERROR\", { params })\n\n const { salt, N, r, p, dkLen } = params;\n const key = await scrypt(password, salt, N, r, p, dkLen, progress);\n return getAccount(data, key);\n}\n\nfunction getEncryptKdfParams(options: EncryptOptions): ScryptParams {\n // Check/generate the salt\n const salt = (options.salt != null) ? getBytes(options.salt, \"options.salt\"): randomBytes(32);\n\n // Override the scrypt password-based key derivation function parameters\n let N = (1 << 17), r = 8, p = 1;\n if (options.scrypt) {\n if (options.scrypt.N) { N = options.scrypt.N; }\n if (options.scrypt.r) { r = options.scrypt.r; }\n if (options.scrypt.p) { p = options.scrypt.p; }\n }\n assertArgument(typeof(N) === \"number\" && N > 0 && Number.isSafeInteger(N) && (BigInt(N) & BigInt(N - 1)) === BigInt(0), \"invalid scrypt N parameter\", \"options.N\", N);\n assertArgument(typeof(r) === \"number\" && r > 0 && Number.isSafeInteger(r), \"invalid scrypt r parameter\", \"options.r\", r);\n assertArgument(typeof(p) === \"number\" && p > 0 && Number.isSafeInteger(p), \"invalid scrypt p parameter\", \"options.p\", p);\n\n return { name: \"scrypt\", dkLen: 32, salt, N, r, p };\n}\n\nfunction _encryptKeystore(key: Uint8Array, kdf: ScryptParams, account: KeystoreAccount, options: EncryptOptions): any {\n\n const privateKey = getBytes(account.privateKey, \"privateKey\");\n\n // Override initialization vector\n const iv = (options.iv != null) ? getBytes(options.iv, \"options.iv\"): randomBytes(16);\n assertArgument(iv.length === 16, \"invalid options.iv length\", \"options.iv\", options.iv);\n\n // Override the uuid\n const uuidRandom = (options.uuid != null) ? getBytes(options.uuid, \"options.uuid\"): randomBytes(16);\n assertArgument(uuidRandom.length === 16, \"invalid options.uuid length\", \"options.uuid\", options.iv);\n\n // This will be used to encrypt the wallet (as per Web3 secret storage)\n // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix)\n // - 32 bytes AES key to encrypt mnemonic with (required here to be Ethers Wallet)\n const derivedKey = key.slice(0, 16);\n const macPrefix = key.slice(16, 32);\n\n // Encrypt the private key\n const aesCtr = new CTR(derivedKey, iv);\n const ciphertext = getBytes(aesCtr.encrypt(privateKey));\n\n // Compute the message authentication code, used to check the password\n const mac = keccak256(concat([ macPrefix, ciphertext ]))\n\n // See: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition\n const data: { [key: string]: any } = {\n address: account.address.substring(2).toLowerCase(),\n id: uuidV4(uuidRandom),\n version: 3,\n Crypto: {\n cipher: \"aes-128-ctr\",\n cipherparams: {\n iv: hexlify(iv).substring(2),\n },\n ciphertext: hexlify(ciphertext).substring(2),\n kdf: \"scrypt\",\n kdfparams: {\n salt: hexlify(kdf.salt).substring(2),\n n: kdf.N,\n dklen: 32,\n p: kdf.p,\n r: kdf.r\n },\n mac: mac.substring(2)\n }\n };\n\n // If we have a mnemonic, encrypt it into the JSON wallet\n if (account.mnemonic) {\n const client = (options.client != null) ? options.client: `ethers/${ version }`;\n\n const path = account.mnemonic.path || defaultPath;\n const locale = account.mnemonic.locale || \"en\";\n\n const mnemonicKey = key.slice(32, 64);\n\n const entropy = getBytes(account.mnemonic.entropy, \"account.mnemonic.entropy\");\n const mnemonicIv = randomBytes(16);\n const mnemonicAesCtr = new CTR(mnemonicKey, mnemonicIv);\n const mnemonicCiphertext = getBytes(mnemonicAesCtr.encrypt(entropy));\n\n const now = new Date();\n const timestamp = (now.getUTCFullYear() + \"-\" +\n zpad(now.getUTCMonth() + 1, 2) + \"-\" +\n zpad(now.getUTCDate(), 2) + \"T\" +\n zpad(now.getUTCHours(), 2) + \"-\" +\n zpad(now.getUTCMinutes(), 2) + \"-\" +\n zpad(now.getUTCSeconds(), 2) + \".0Z\");\n const gethFilename = (\"UTC--\" + timestamp + \"--\" + data.address);\n\n data[\"x-ethers\"] = {\n client, gethFilename, path, locale,\n mnemonicCounter: hexlify(mnemonicIv).substring(2),\n mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2),\n version: \"0.1\"\n };\n }\n\n return JSON.stringify(data);\n}\n\n/**\n * Return the JSON Keystore Wallet for %%account%% encrypted with\n * %%password%%.\n *\n * The %%options%% can be used to tune the password-based key\n * derivation function parameters, explicitly set the random values\n * used. Any provided [[ProgressCallback]] is ignord.\n */\nexport function encryptKeystoreJsonSync(account: KeystoreAccount, password: string | Uint8Array, options?: EncryptOptions): string {\n if (options == null) { options = { }; }\n\n const passwordBytes = getPassword(password);\n const kdf = getEncryptKdfParams(options);\n const key = scryptSync(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64);\n return _encryptKeystore(getBytes(key), kdf, account, options);\n}\n\n/**\n * Resolved to the JSON Keystore Wallet for %%account%% encrypted\n * with %%password%%.\n *\n * The %%options%% can be used to tune the password-based key\n * derivation function parameters, explicitly set the random values\n * used and provide a [[ProgressCallback]] to receive periodic updates\n * on the completion status..\n */\nexport async function encryptKeystoreJson(account: KeystoreAccount, password: string | Uint8Array, options?: EncryptOptions): Promise {\n if (options == null) { options = { }; }\n\n const passwordBytes = getPassword(password);\n const kdf = getEncryptKdfParams(options);\n const key = await scrypt(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64, options.progressCallback);\n return _encryptKeystore(getBytes(key), kdf, account, options);\n}\n\n", "/**\n * Explain HD Wallets..\n *\n * @_subsection: api/wallet:HD Wallets [hd-wallets]\n */\nimport { computeHmac, randomBytes, ripemd160, SigningKey, sha256 } from \"../crypto/index.js\";\nimport { VoidSigner } from \"../providers/index.js\";\nimport { computeAddress } from \"../transaction/index.js\";\nimport {\n concat, dataSlice, decodeBase58, defineProperties, encodeBase58,\n getBytes, hexlify, isBytesLike,\n getNumber, toBeArray, toBigInt, toBeHex,\n assertPrivate, assert, assertArgument\n} from \"../utils/index.js\";\nimport { LangEn } from \"../wordlists/lang-en.js\";\n\nimport { BaseWallet } from \"./base-wallet.js\";\nimport { Mnemonic } from \"./mnemonic.js\";\nimport {\n encryptKeystoreJson, encryptKeystoreJsonSync,\n} from \"./json-keystore.js\";\n\nimport type { ProgressCallback } from \"../crypto/index.js\";\nimport type { Provider } from \"../providers/index.js\";\nimport type { BytesLike, Numeric } from \"../utils/index.js\";\nimport type { Wordlist } from \"../wordlists/index.js\";\n\nimport type { KeystoreAccount } from \"./json-keystore.js\";\n\n/**\n * The default derivation path for Ethereum HD Nodes. (i.e. ``\"m/44'/60'/0'/0/0\"``)\n */\nexport const defaultPath: string = \"m/44'/60'/0'/0/0\";\n\n\n// \"Bitcoin seed\"\nconst MasterSecret = new Uint8Array([ 66, 105, 116, 99, 111, 105, 110, 32, 115, 101, 101, 100 ]);\n\nconst HardenedBit = 0x80000000;\n\nconst N = BigInt(\"0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141\");\n\nconst Nibbles = \"0123456789abcdef\";\nfunction zpad(value: number, length: number): string {\n let result = \"\";\n while (value) {\n result = Nibbles[value % 16] + result;\n value = Math.trunc(value / 16);\n }\n while (result.length < length * 2) { result = \"0\" + result; }\n return \"0x\" + result;\n}\n\nfunction encodeBase58Check(_value: BytesLike): string {\n const value = getBytes(_value);\n const check = dataSlice(sha256(sha256(value)), 0, 4);\n const bytes = concat([ value, check ]);\n return encodeBase58(bytes);\n}\n\nconst _guard = { };\n\nfunction ser_I(index: number, chainCode: string, publicKey: string, privateKey: null | string): { IL: Uint8Array, IR: Uint8Array } {\n const data = new Uint8Array(37);\n\n if (index & HardenedBit) {\n assert(privateKey != null, \"cannot derive child of neutered node\", \"UNSUPPORTED_OPERATION\", {\n operation: \"deriveChild\"\n });\n\n // Data = 0x00 || ser_256(k_par)\n data.set(getBytes(privateKey), 1);\n\n } else {\n // Data = ser_p(point(k_par))\n data.set(getBytes(publicKey));\n }\n\n // Data += ser_32(i)\n for (let i = 24; i >= 0; i -= 8) { data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff); }\n const I = getBytes(computeHmac(\"sha512\", chainCode, data));\n\n return { IL: I.slice(0, 32), IR: I.slice(32) };\n}\n\ntype HDNodeLike = { depth: number, deriveChild: (i: number) => T };\nfunction derivePath>(node: T, path: string): T {\n const components = path.split(\"/\");\n\n assertArgument(components.length > 0, \"invalid path\", \"path\", path);\n\n if (components[0] === \"m\") {\n assertArgument(node.depth === 0, `cannot derive root path (i.e. path starting with \"m/\") for a node at non-zero depth ${ node.depth }`, \"path\", path);\n components.shift();\n }\n\n let result: T = node;\n for (let i = 0; i < components.length; i++) {\n const component = components[i];\n\n if (component.match(/^[0-9]+'$/)) {\n const index = parseInt(component.substring(0, component.length - 1));\n assertArgument(index < HardenedBit, \"invalid path index\", `path[${ i }]`, component);\n result = result.deriveChild(HardenedBit + index);\n\n } else if (component.match(/^[0-9]+$/)) {\n const index = parseInt(component);\n assertArgument(index < HardenedBit, \"invalid path index\", `path[${ i }]`, component);\n result = result.deriveChild(index);\n\n } else {\n assertArgument(false, \"invalid path component\", `path[${ i }]`, component);\n }\n }\n\n return result;\n}\n\n/**\n * An **HDNodeWallet** is a [[Signer]] backed by the private key derived\n * from an HD Node using the [[link-bip-32]] stantard.\n *\n * An HD Node forms a hierarchal structure with each HD Node having a\n * private key and the ability to derive child HD Nodes, defined by\n * a path indicating the index of each child.\n */\nexport class HDNodeWallet extends BaseWallet {\n /**\n * The compressed public key.\n */\n readonly publicKey!: string;\n\n /**\n * The fingerprint.\n *\n * A fingerprint allows quick qay to detect parent and child nodes,\n * but developers should be prepared to deal with collisions as it\n * is only 4 bytes.\n */\n readonly fingerprint!: string;\n\n /**\n * The parent fingerprint.\n */\n readonly parentFingerprint!: string;\n\n /**\n * The mnemonic used to create this HD Node, if available.\n *\n * Sources such as extended keys do not encode the mnemonic, in\n * which case this will be ``null``.\n */\n readonly mnemonic!: null | Mnemonic;\n\n /**\n * The chaincode, which is effectively a public key used\n * to derive children.\n */\n readonly chainCode!: string;\n\n /**\n * The derivation path of this wallet.\n *\n * Since extended keys do not provider full path details, this\n * may be ``null``, if instantiated from a source that does not\n * enocde it.\n */\n readonly path!: null | string;\n\n /**\n * The child index of this wallet. Values over ``2 *\\* 31`` indicate\n * the node is hardened.\n */\n readonly index!: number;\n\n /**\n * The depth of this wallet, which is the number of components\n * in its path.\n */\n readonly depth!: number;\n\n /**\n * @private\n */\n constructor(guard: any, signingKey: SigningKey, parentFingerprint: string, chainCode: string, path: null | string, index: number, depth: number, mnemonic: null | Mnemonic, provider: null | Provider) {\n super(signingKey, provider);\n assertPrivate(guard, _guard, \"HDNodeWallet\");\n\n defineProperties(this, { publicKey: signingKey.compressedPublicKey });\n\n const fingerprint = dataSlice(ripemd160(sha256(this.publicKey)), 0, 4);\n defineProperties(this, {\n parentFingerprint, fingerprint,\n chainCode, path, index, depth\n });\n\n defineProperties(this, { mnemonic });\n }\n\n connect(provider: null | Provider): HDNodeWallet {\n return new HDNodeWallet(_guard, this.signingKey, this.parentFingerprint,\n this.chainCode, this.path, this.index, this.depth, this.mnemonic, provider);\n }\n\n #account(): KeystoreAccount {\n const account: KeystoreAccount = { address: this.address, privateKey: this.privateKey };\n const m = this.mnemonic;\n if (this.path && m && m.wordlist.locale === \"en\" && m.password === \"\") {\n account.mnemonic = {\n path: this.path,\n locale: \"en\",\n entropy: m.entropy\n };\n }\n\n return account;\n }\n\n /**\n * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with\n * %%password%%.\n *\n * If %%progressCallback%% is specified, it will receive periodic\n * updates as the encryption process progreses.\n */\n async encrypt(password: Uint8Array | string, progressCallback?: ProgressCallback): Promise {\n return await encryptKeystoreJson(this.#account(), password, { progressCallback });\n }\n\n /**\n * Returns a [JSON Keystore Wallet](json-wallets) encryped with\n * %%password%%.\n *\n * It is preferred to use the [async version](encrypt) instead,\n * which allows a [[ProgressCallback]] to keep the user informed.\n *\n * This method will block the event loop (freezing all UI) until\n * it is complete, which may be a non-trivial duration.\n */\n encryptSync(password: Uint8Array | string): string {\n return encryptKeystoreJsonSync(this.#account(), password);\n }\n\n /**\n * The extended key.\n *\n * This key will begin with the prefix ``xpriv`` and can be used to\n * reconstruct this HD Node to derive its children.\n */\n get extendedKey(): string {\n // We only support the mainnet values for now, but if anyone needs\n // testnet values, let me know. I believe current sentiment is that\n // we should always use mainnet, and use BIP-44 to derive the network\n // - Mainnet: public=0x0488B21E, private=0x0488ADE4\n // - Testnet: public=0x043587CF, private=0x04358394\n\n assert(this.depth < 256, \"Depth too deep\", \"UNSUPPORTED_OPERATION\", { operation: \"extendedKey\" });\n\n return encodeBase58Check(concat([\n \"0x0488ADE4\", zpad(this.depth, 1), this.parentFingerprint,\n zpad(this.index, 4), this.chainCode,\n concat([ \"0x00\", this.privateKey ])\n ]));\n }\n\n /**\n * Returns true if this wallet has a path, providing a Type Guard\n * that the path is non-null.\n */\n hasPath(): this is { path: string } { return (this.path != null); }\n\n /**\n * Returns a neutered HD Node, which removes the private details\n * of an HD Node.\n *\n * A neutered node has no private key, but can be used to derive\n * child addresses and other public data about the HD Node.\n */\n neuter(): HDNodeVoidWallet {\n return new HDNodeVoidWallet(_guard, this.address, this.publicKey,\n this.parentFingerprint, this.chainCode, this.path, this.index,\n this.depth, this.provider);\n }\n\n /**\n * Return the child for %%index%%.\n */\n deriveChild(_index: Numeric): HDNodeWallet {\n const index = getNumber(_index, \"index\");\n assertArgument(index <= 0xffffffff, \"invalid index\", \"index\", index);\n\n // Base path\n let path = this.path;\n if (path) {\n path += \"/\" + (index & ~HardenedBit);\n if (index & HardenedBit) { path += \"'\"; }\n }\n\n const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, this.privateKey);\n const ki = new SigningKey(toBeHex((toBigInt(IL) + BigInt(this.privateKey)) % N, 32));\n\n return new HDNodeWallet(_guard, ki, this.fingerprint, hexlify(IR),\n path, index, this.depth + 1, this.mnemonic, this.provider);\n\n }\n\n /**\n * Return the HDNode for %%path%% from this node.\n */\n derivePath(path: string): HDNodeWallet {\n return derivePath(this, path);\n }\n\n static #fromSeed(_seed: BytesLike, mnemonic: null | Mnemonic): HDNodeWallet {\n assertArgument(isBytesLike(_seed), \"invalid seed\", \"seed\", \"[REDACTED]\");\n\n const seed = getBytes(_seed, \"seed\");\n assertArgument(seed.length >= 16 && seed.length <= 64 , \"invalid seed\", \"seed\", \"[REDACTED]\");\n\n const I = getBytes(computeHmac(\"sha512\", MasterSecret, seed));\n const signingKey = new SigningKey(hexlify(I.slice(0, 32)));\n\n return new HDNodeWallet(_guard, signingKey, \"0x00000000\", hexlify(I.slice(32)),\n \"m\", 0, 0, mnemonic, null);\n }\n\n /**\n * Creates a new HD Node from %%extendedKey%%.\n *\n * If the %%extendedKey%% will either have a prefix or ``xpub`` or\n * ``xpriv``, returning a neutered HD Node ([[HDNodeVoidWallet]])\n * or full HD Node ([[HDNodeWallet) respectively.\n */\n static fromExtendedKey(extendedKey: string): HDNodeWallet | HDNodeVoidWallet {\n const bytes = toBeArray(decodeBase58(extendedKey)); // @TODO: redact\n\n assertArgument(bytes.length === 82 || encodeBase58Check(bytes.slice(0, 78)) === extendedKey,\n \"invalid extended key\", \"extendedKey\", \"[ REDACTED ]\");\n\n const depth = bytes[4];\n const parentFingerprint = hexlify(bytes.slice(5, 9));\n const index = parseInt(hexlify(bytes.slice(9, 13)).substring(2), 16);\n const chainCode = hexlify(bytes.slice(13, 45));\n const key = bytes.slice(45, 78);\n\n switch (hexlify(bytes.slice(0, 4))) {\n // Public Key\n case \"0x0488b21e\": case \"0x043587cf\": {\n const publicKey = hexlify(key);\n return new HDNodeVoidWallet(_guard, computeAddress(publicKey), publicKey,\n parentFingerprint, chainCode, null, index, depth, null);\n }\n\n // Private Key\n case \"0x0488ade4\": case \"0x04358394 \":\n if (key[0] !== 0) { break; }\n return new HDNodeWallet(_guard, new SigningKey(key.slice(1)),\n parentFingerprint, chainCode, null, index, depth, null, null);\n }\n\n\n assertArgument(false, \"invalid extended key prefix\", \"extendedKey\", \"[ REDACTED ]\");\n }\n\n /**\n * Creates a new random HDNode.\n */\n static createRandom(password?: string, path?: string, wordlist?: Wordlist): HDNodeWallet {\n if (password == null) { password = \"\"; }\n if (path == null) { path = defaultPath; }\n if (wordlist == null) { wordlist = LangEn.wordlist(); }\n const mnemonic = Mnemonic.fromEntropy(randomBytes(16), password, wordlist)\n return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path);\n }\n\n /**\n * Create an HD Node from %%mnemonic%%.\n */\n static fromMnemonic(mnemonic: Mnemonic, path?: string): HDNodeWallet {\n if (!path) { path = defaultPath; }\n return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path);\n }\n\n /**\n * Creates an HD Node from a mnemonic %%phrase%%.\n */\n static fromPhrase(phrase: string, password?: string, path?: string, wordlist?: Wordlist): HDNodeWallet {\n if (password == null) { password = \"\"; }\n if (path == null) { path = defaultPath; }\n if (wordlist == null) { wordlist = LangEn.wordlist(); }\n const mnemonic = Mnemonic.fromPhrase(phrase, password, wordlist)\n return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path);\n }\n\n /**\n * Creates an HD Node from a %%seed%%.\n */\n static fromSeed(seed: BytesLike): HDNodeWallet {\n return HDNodeWallet.#fromSeed(seed, null);\n }\n}\n\n/**\n * A **HDNodeVoidWallet** cannot sign, but provides access to\n * the children nodes of a [[link-bip-32]] HD wallet addresses.\n *\n * The can be created by using an extended ``xpub`` key to\n * [[HDNodeWallet_fromExtendedKey]] or by \n * [nuetering](HDNodeWallet-neuter) a [[HDNodeWallet]].\n */\nexport class HDNodeVoidWallet extends VoidSigner {\n /**\n * The compressed public key.\n */\n readonly publicKey!: string;\n\n /**\n * The fingerprint.\n *\n * A fingerprint allows quick qay to detect parent and child nodes,\n * but developers should be prepared to deal with collisions as it\n * is only 4 bytes.\n */\n readonly fingerprint!: string;\n\n /**\n * The parent node fingerprint.\n */\n readonly parentFingerprint!: string;\n\n /**\n * The chaincode, which is effectively a public key used\n * to derive children.\n */\n readonly chainCode!: string;\n\n /**\n * The derivation path of this wallet.\n *\n * Since extended keys do not provider full path details, this\n * may be ``null``, if instantiated from a source that does not\n * enocde it.\n */\n readonly path!: null | string;\n\n /**\n * The child index of this wallet. Values over ``2 *\\* 31`` indicate\n * the node is hardened.\n */\n readonly index!: number;\n\n /**\n * The depth of this wallet, which is the number of components\n * in its path.\n */\n readonly depth!: number;\n\n /**\n * @private\n */\n constructor(guard: any, address: string, publicKey: string, parentFingerprint: string, chainCode: string, path: null | string, index: number, depth: number, provider: null | Provider) {\n super(address, provider);\n assertPrivate(guard, _guard, \"HDNodeVoidWallet\");\n\n defineProperties(this, { publicKey });\n\n const fingerprint = dataSlice(ripemd160(sha256(publicKey)), 0, 4);\n defineProperties(this, {\n publicKey, fingerprint, parentFingerprint, chainCode, path, index, depth\n });\n }\n\n connect(provider: null | Provider): HDNodeVoidWallet {\n return new HDNodeVoidWallet(_guard, this.address, this.publicKey,\n this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, provider);\n }\n\n /**\n * The extended key.\n *\n * This key will begin with the prefix ``xpub`` and can be used to\n * reconstruct this neutered key to derive its children addresses.\n */\n get extendedKey(): string {\n // We only support the mainnet values for now, but if anyone needs\n // testnet values, let me know. I believe current sentiment is that\n // we should always use mainnet, and use BIP-44 to derive the network\n // - Mainnet: public=0x0488B21E, private=0x0488ADE4\n // - Testnet: public=0x043587CF, private=0x04358394\n\n assert(this.depth < 256, \"Depth too deep\", \"UNSUPPORTED_OPERATION\", { operation: \"extendedKey\" });\n\n return encodeBase58Check(concat([\n \"0x0488B21E\",\n zpad(this.depth, 1),\n this.parentFingerprint,\n zpad(this.index, 4),\n this.chainCode,\n this.publicKey,\n ]));\n }\n\n /**\n * Returns true if this wallet has a path, providing a Type Guard\n * that the path is non-null.\n */\n hasPath(): this is { path: string } { return (this.path != null); }\n\n /**\n * Return the child for %%index%%.\n */\n deriveChild(_index: Numeric): HDNodeVoidWallet {\n const index = getNumber(_index, \"index\");\n assertArgument(index <= 0xffffffff, \"invalid index\", \"index\", index);\n\n // Base path\n let path = this.path;\n if (path) {\n path += \"/\" + (index & ~HardenedBit);\n if (index & HardenedBit) { path += \"'\"; }\n }\n\n const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, null);\n const Ki = SigningKey.addPoints(IL, this.publicKey, true);\n\n const address = computeAddress(Ki);\n\n return new HDNodeVoidWallet(_guard, address, Ki, this.fingerprint, hexlify(IR),\n path, index, this.depth + 1, this.provider);\n\n }\n\n /**\n * Return the signer for %%path%% from this node.\n */\n derivePath(path: string): HDNodeVoidWallet {\n return derivePath(this, path);\n }\n}\n\n/*\nexport class HDNodeWalletManager {\n #root: HDNodeWallet;\n\n constructor(phrase: string, password?: null | string, path?: null | string, locale?: null | Wordlist) {\n if (password == null) { password = \"\"; }\n if (path == null) { path = \"m/44'/60'/0'/0\"; }\n if (locale == null) { locale = LangEn.wordlist(); }\n this.#root = HDNodeWallet.fromPhrase(phrase, password, path, locale);\n }\n\n getSigner(index?: number): HDNodeWallet {\n return this.#root.deriveChild((index == null) ? 0: index);\n }\n}\n*/\n\n/**\n * Returns the [[link-bip-32]] path for the account at %%index%%.\n *\n * This is the pattern used by wallets like Ledger.\n *\n * There is also an [alternate pattern](getIndexedAccountPath) used by\n * some software.\n */\nexport function getAccountPath(_index: Numeric): string {\n const index = getNumber(_index, \"index\");\n assertArgument(index >= 0 && index < HardenedBit, \"invalid account index\", \"index\", index);\n return `m/44'/60'/${ index }'/0/0`;\n}\n\n/**\n * Returns the path using an alternative pattern for deriving accounts,\n * at %%index%%.\n *\n * This derivation path uses the //index// component rather than the\n * //account// component to derive sequential accounts.\n *\n * This is the pattern used by wallets like MetaMask.\n */\nexport function getIndexedAccountPath(_index: Numeric): string {\n const index = getNumber(_index, \"index\");\n assertArgument(index >= 0 && index < HardenedBit, \"invalid account index\", \"index\", index);\n return `m/44'/60'/0'/0/${ index}`;\n}\n\n", "/**\n * @_subsection: api/wallet:JSON Wallets [json-wallets]\n */\n\nimport { CBC, pkcs7Strip } from \"aes-js\";\n\nimport { getAddress } from \"../address/index.js\";\nimport { pbkdf2 } from \"../crypto/index.js\";\nimport { id } from \"../hash/index.js\";\nimport { getBytes, assertArgument } from \"../utils/index.js\";\n\nimport { getPassword, looseArrayify, spelunk } from \"./utils.js\";\n\n\n/**\n * The data stored within a JSON Crowdsale wallet is fairly\n * minimal.\n */\nexport type CrowdsaleAccount = {\n privateKey: string;\n address: string;\n}\n\n/**\n * Returns true if %%json%% is a valid JSON Crowdsale wallet.\n */\nexport function isCrowdsaleJson(json: string): boolean {\n try {\n const data = JSON.parse(json);\n if (data.encseed) { return true; }\n } catch (error) { }\n return false;\n}\n\n// See: https://github.com/ethereum/pyethsaletool\n\n/**\n * Before Ethereum launched, it was necessary to create a wallet\n * format for backers to use, which would be used to receive ether\n * as a reward for contributing to the project.\n *\n * The [[link-crowdsale]] format is now obsolete, but it is still\n * useful to support and the additional code is fairly trivial as\n * all the primitives required are used through core portions of\n * the library.\n */\nexport function decryptCrowdsaleJson(json: string, _password: string | Uint8Array): CrowdsaleAccount {\n const data = JSON.parse(json);\n const password = getPassword(_password);\n\n // Ethereum Address\n const address = getAddress(spelunk(data, \"ethaddr:string!\"));\n\n // Encrypted Seed\n const encseed = looseArrayify(spelunk(data, \"encseed:string!\"));\n assertArgument(encseed && (encseed.length % 16) === 0, \"invalid encseed\", \"json\", json);\n\n const key = getBytes(pbkdf2(password, password, 2000, 32, \"sha256\")).slice(0, 16);\n\n const iv = encseed.slice(0, 16);\n const encryptedSeed = encseed.slice(16);\n\n // Decrypt the seed\n const aesCbc = new CBC(key, iv);\n const seed = pkcs7Strip(getBytes(aesCbc.decrypt(encryptedSeed)));\n\n // This wallet format is weird... Convert the binary encoded hex to a string.\n let seedHex = \"\";\n for (let i = 0; i < seed.length; i++) {\n seedHex += String.fromCharCode(seed[i]);\n }\n\n return { address, privateKey: id(seedHex) };\n}\n", "import { SigningKey } from \"../crypto/index.js\";\nimport { assertArgument } from \"../utils/index.js\";\n\nimport { BaseWallet } from \"./base-wallet.js\";\nimport { HDNodeWallet } from \"./hdwallet.js\";\nimport { decryptCrowdsaleJson, isCrowdsaleJson } from \"./json-crowdsale.js\";\nimport {\n decryptKeystoreJson, decryptKeystoreJsonSync,\n encryptKeystoreJson, encryptKeystoreJsonSync,\n isKeystoreJson\n} from \"./json-keystore.js\";\nimport { Mnemonic } from \"./mnemonic.js\";\n\nimport type { ProgressCallback } from \"../crypto/index.js\";\nimport type { Provider } from \"../providers/index.js\";\n\nimport type { CrowdsaleAccount } from \"./json-crowdsale.js\";\nimport type { KeystoreAccount } from \"./json-keystore.js\";\n\n\nfunction stall(duration: number): Promise {\n return new Promise((resolve) => { setTimeout(() => { resolve(); }, duration); });\n}\n\n/**\n * A **Wallet** manages a single private key which is used to sign\n * transactions, messages and other common payloads.\n *\n * This class is generally the main entry point for developers\n * that wish to use a private key directly, as it can create\n * instances from a large variety of common sources, including\n * raw private key, [[link-bip-39]] mnemonics and encrypte JSON\n * wallets.\n */\nexport class Wallet extends BaseWallet {\n\n /**\n * Create a new wallet for the private %%key%%, optionally connected\n * to %%provider%%.\n */\n constructor(key: string | SigningKey, provider?: null | Provider) {\n if (typeof(key) === \"string\" && !key.startsWith(\"0x\")) {\n key = \"0x\" + key;\n }\n\n let signingKey = (typeof(key) === \"string\") ? new SigningKey(key): key;\n super(signingKey, provider);\n }\n\n connect(provider: null | Provider): Wallet {\n return new Wallet(this.signingKey, provider);\n }\n\n /**\n * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with\n * %%password%%.\n *\n * If %%progressCallback%% is specified, it will receive periodic\n * updates as the encryption process progreses.\n */\n async encrypt(password: Uint8Array | string, progressCallback?: ProgressCallback): Promise {\n const account = { address: this.address, privateKey: this.privateKey };\n return await encryptKeystoreJson(account, password, { progressCallback });\n }\n\n /**\n * Returns a [JSON Keystore Wallet](json-wallets) encryped with\n * %%password%%.\n *\n * It is preferred to use the [async version](encrypt) instead,\n * which allows a [[ProgressCallback]] to keep the user informed.\n *\n * This method will block the event loop (freezing all UI) until\n * it is complete, which may be a non-trivial duration.\n */\n encryptSync(password: Uint8Array | string): string {\n const account = { address: this.address, privateKey: this.privateKey };\n return encryptKeystoreJsonSync(account, password);\n }\n\n static #fromAccount(account: null | CrowdsaleAccount | KeystoreAccount): HDNodeWallet | Wallet {\n assertArgument(account, \"invalid JSON wallet\", \"json\", \"[ REDACTED ]\");\n\n if (\"mnemonic\" in account && account.mnemonic && account.mnemonic.locale === \"en\") {\n const mnemonic = Mnemonic.fromEntropy(account.mnemonic.entropy);\n const wallet = HDNodeWallet.fromMnemonic(mnemonic, account.mnemonic.path);\n if (wallet.address === account.address && wallet.privateKey === account.privateKey) {\n return wallet;\n }\n console.log(\"WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key\");\n }\n\n const wallet = new Wallet(account.privateKey);\n\n assertArgument(wallet.address === account.address,\n \"address/privateKey mismatch\", \"json\", \"[ REDACTED ]\");\n\n return wallet;\n }\n\n /**\n * Creates (asynchronously) a **Wallet** by decrypting the %%json%%\n * with %%password%%.\n *\n * If %%progress%% is provided, it is called periodically during\n * decryption so that any UI can be updated.\n */\n static async fromEncryptedJson(json: string, password: Uint8Array | string, progress?: ProgressCallback): Promise {\n let account: null | CrowdsaleAccount | KeystoreAccount = null;\n if (isKeystoreJson(json)) {\n account = await decryptKeystoreJson(json, password, progress);\n\n } else if (isCrowdsaleJson(json)) {\n if (progress) { progress(0); await stall(0); }\n account = decryptCrowdsaleJson(json, password);\n if (progress) { progress(1); await stall(0); }\n\n }\n\n return Wallet.#fromAccount(account);\n }\n\n /**\n * Creates a **Wallet** by decrypting the %%json%% with %%password%%.\n *\n * The [[fromEncryptedJson]] method is preferred, as this method\n * will lock up and freeze the UI during decryption, which may take\n * some time.\n */\n static fromEncryptedJsonSync(json: string, password: Uint8Array | string): HDNodeWallet | Wallet {\n let account: null | CrowdsaleAccount | KeystoreAccount = null;\n if (isKeystoreJson(json)) {\n account = decryptKeystoreJsonSync(json, password);\n } else if (isCrowdsaleJson(json)) {\n account = decryptCrowdsaleJson(json, password);\n } else {\n assertArgument(false, \"invalid JSON wallet\", \"json\", \"[ REDACTED ]\");\n }\n\n return Wallet.#fromAccount(account);\n }\n\n /**\n * Creates a new random [[HDNodeWallet]] using the available\n * [cryptographic random source](randomBytes).\n *\n * If there is no crytographic random source, this will throw.\n */\n static createRandom(provider?: null | Provider): HDNodeWallet {\n const wallet = HDNodeWallet.createRandom();\n if (provider) { return wallet.connect(provider); }\n return wallet;\n }\n\n /**\n * Creates a [[HDNodeWallet]] for %%phrase%%.\n */\n static fromPhrase(phrase: string, provider?: Provider): HDNodeWallet {\n const wallet = HDNodeWallet.fromPhrase(phrase);\n if (provider) { return wallet.connect(provider); }\n return wallet;\n }\n}\n", "const Base64 = \")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_\";\n\n/**\n * @_ignore\n */\nexport function decodeBits(width: number, data: string): Array {\n const maxValue = (1 << width) - 1;\n const result: Array = [ ];\n let accum = 0, bits = 0, flood = 0;\n for (let i = 0; i < data.length; i++) {\n\n // Accumulate 6 bits of data\n accum = ((accum << 6) | Base64.indexOf(data[i]));\n bits += 6;\n\n // While we have enough for a word...\n while (bits >= width) {\n // ...read the word\n const value = (accum >> (bits - width));\n accum &= (1 << (bits - width)) - 1;\n bits -= width;\n\n // A value of 0 indicates we exceeded maxValue, it\n // floods over into the next value\n if (value === 0) {\n flood += maxValue;\n } else {\n result.push(value + flood);\n flood = 0;\n }\n }\n }\n\n return result;\n}\n", "import { assertArgument } from \"../utils/index.js\";\n\nimport { decodeBits } from \"./bit-reader.js\";\nimport { decodeOwl } from \"./decode-owl.js\";\n\n/**\n * @_ignore\n */\nexport function decodeOwlA(data: string, accents: string): Array {\n let words = decodeOwl(data).join(\",\");\n\n // Inject the accents\n accents.split(/,/g).forEach((accent) => {\n\n const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/);\n assertArgument(match !== null, \"internal error parsing accents\", \"accents\", accents);\n\n let posOffset = 0;\n const positions = decodeBits(parseInt(match[3]), match[4]);\n const charCode = parseInt(match[2]);\n const regex = new RegExp(`([${ match[1] }])`, \"g\");\n words = words.replace(regex, (all, letter) => {\n const rem = --positions[posOffset];\n if (rem === 0) {\n letter = String.fromCharCode(letter.charCodeAt(0), charCode);\n posOffset++;\n }\n return letter;\n });\n });\n\n return words.split(\",\");\n}\n", "\nimport { WordlistOwl } from \"./wordlist-owl.js\";\nimport { decodeOwlA } from \"./decode-owla.js\";\n\n/**\n * An OWL-A format Wordlist extends the OWL format to add an\n * overlay onto an OWL format Wordlist to support diacritic\n * marks.\n *\n * This class is generally not useful to most developers as\n * it is used mainly internally to keep Wordlists for languages\n * based on latin-1 small.\n *\n * If necessary, there are tools within the ``generation/`` folder\n * to create the necessary data.\n */\nexport class WordlistOwlA extends WordlistOwl {\n #accent: string;\n\n\n /**\n * Creates a new Wordlist for %%locale%% using the OWLA %%data%%\n * and %%accent%% data and validated against the %%checksum%%.\n */\n constructor(locale: string, data: string, accent: string, checksum: string) {\n super(locale, data, checksum);\n this.#accent = accent;\n }\n\n /**\n * The OWLA-encoded accent data.\n */\n get _accent(): string { return this.#accent; }\n\n /**\n * Decode all the words for the wordlist.\n */\n _decodeWords(): Array {\n return decodeOwlA(this._data, this._accent);\n }\n}\n", "\nimport { LangEn } from \"./lang-en.js\";\n\nimport type { Wordlist } from \"./wordlist.js\";\n\nexport const wordlists: Record = {\n en: LangEn.wordlist(),\n};\n"], - "mappings": ";;;;;;;;;;;;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAAAC;EAAA,mBAAAC;EAAA;;;mBAAAC;EAAA,cAAAC;EAAA;gBAAAC;EAAA,cAAAC;EAAA;;;;;;;;;;;;;;;;;;;;;;;;ACGO,IAAM,UAAkB;;;ACC/B,SAAS,UAAU,OAAY,MAAc,MAAY;AACrD,QAAM,QAAQ,KAAK,MAAM,GAAG,EAAE,IAAI,OAAK,EAAE,KAAI,CAAE;AAC/C,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACnC,YAAQ,MAAM;MACV,KAAK;AACD;MACJ,KAAK;MACL,KAAK;MACL,KAAK;MACL,KAAK;AACD,YAAI,OAAO,UAAW,MAAM;AAAE;;;;AAI1C,QAAM,QAAa,IAAI,MAAM,0BAA2B,IAAK,EAAE;AAC/D,QAAM,OAAO;AACb,QAAM,WAAW,SAAU,IAAK;AAChC,QAAM,QAAQ;AAEd,QAAM;AACV;AAMA,eAAsB,kBAAqB,OAAgD;AACvF,QAAM,OAAO,OAAO,KAAK,KAAK;AAC9B,QAAM,UAAU,MAAM,QAAQ,IAAI,K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B,gBAAQ;;;;AAKpB,SAAO;AACX;;;AC1BM,SAAU,WAAW,MAAc,SAAe;AACpD,MAAIC,SAAQ,UAAU,IAAI,EAAE,KAAK,GAAG;AAGpC,UAAQ,MAAM,IAAI,EAAE,QAAQ,CAAC,WAAU;AAEnC,UAAM,QAAQ,OAAO,MAAM,+BAA+B;AAC1D,mBAAe,UAAU,MAAM,kCAAkC,WAAW,OAAO;AAEnF,QAAI,YAAY;AAChB,UAAM,YAAY,WAAW,SAAS,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;AACzD,UAAM,WAAW,SAAS,MAAM,CAAC,CAAC;AAClC,UAAM,QAAQ,IAAI,OAAO,KAAM,MAAM,CAAC,CAAE,MAAM,GAAG;AACjD,IAAAA,SAAQA,OAAM,QAAQ,OAAO,CAAC,KAAK,WAAU;AACzC,YAAM,MAAM,EAAE,UAAU,SAAS;AACjC,UAAI,QAAQ,GAAG;AACX,iBAAS,OAAO,aAAa,OAAO,WAAW,CAAC,GAAG,QAAQ;AAC3D;;AAEJ,aAAO;IACX,CAAC;EACL,CAAC;AAED,SAAOA,OAAM,MAAM,GAAG;AAC1B;;;AC/BA;AAeM,IAAO,eAAP,cAA4B,YAAW;;;;;EAQzC,YAAY,QAAgB,MAAc,QAAgBC,WAAgB;AACtE,UAAM,QAAQ,MAAMA,SAAQ;AARhC;AASI,uBAAK,SAAU;EACnB;;;;EAKA,IAAI,UAAO;AAAa,WAAO,mBAAK;EAAS;;;;EAK7C,eAAY;AACR,WAAO,WAAW,KAAK,OAAO,KAAK,OAAO;EAC9C;;AAtBA;;;ACZG,IAAM,YAAsC;EACjD,IAAI,OAAO,SAAQ;;", - "names": ["defaultPath", "pbkdf2", "randomBytes", "ripemd160", "scrypt", "sha256", "sha512", "copy", "bytes", "_value", "mask", "BN_0", "_value", "bytes", "_data", "bytes", "output", "bytes", "_signal", "_request", "_a", "response", "delay", "_headers", "_body", "stall", "BN_0", "BN_1", "_value", "b", "_format", "offset", "_data", "object", "length", "randomBytes", "bytes", "_guard", "names", "args", "object", "bytes", "_data", "_a", "n", "b", "hash", "hash", "hash", "isLE", "_32n", "b", "T1", "T2", "n", "n", "crypto", "randomBytes", "locked", "_data", "bytes", "locked", "_data", "locked", "ripemd160", "_data", "locked", "pbkdf2", "locked", "randomBytes", "rotl", "b", "N", "Pi", "N", "scrypt", "sha256", "_data", "sha512", "concatBytes", "utf8ToBytes", "_0n", "_1n", "_2n", "u8a", "hexes", "bytes", "n", "b", "gen", "object", "_0n", "_1n", "_2n", "b", "number", "n", "S", "Fp", "ge", "n2", "f", "_0n", "_1n", "n", "bitLen", "isLE", "_0n", "f", "_1n", "b", "bytes", "isLE", "_1n", "_0n", "_1n", "n", "window", "f", "mask", "Fp", "s", "_0n", "_1n", "_2n", "_3n", "_4n", "toBytes", "concatBytes", "bytes", "b", "n", "Point", "U1", "U2", "f", "a", "modN", "number", "Signature", "hash", "randomBytes", "_a", "_sig", "r", "tv5", "c1", "c2", "utf8ToBytes", "b", "concatBytes", "hash", "Point", "hash", "_1n", "_2n", "b", "_3n", "n", "_0n", "concatBytes", "BN_0", "BN_1", "_guard", "_value", "bytes", "r", "s", "v", "_r", "_v", "bytes", "pbkdf2", "randomBytes", "ripemd160", "scrypt", "sha256", "sha512", "BN_0", "checksum", "BN_0", "_value", "_value", "_value", "_value", "BN_0", "BN_1", "_value", "_value", "_value", "Zeros", "bytes", "b", "BN_0", "BN_2", "BN_27", "BN_28", "BN_35", "_value", "_data", "value", "sha256", "BN_0", "BN_1", "BN_MAX_UINT256", "bytes", "BN_1", "BN_0", "_value", "BN_MAX_UINT256", "name", "_types", "type", "n", "b", "value", "_offset", "throwError", "_guard", "result", "value", "type", "indexed", "name", "_a", "inputs", "bytes", "bytes", "hash", "PanicReasons", "f", "names", "b", "bytes", "_data", "value", "BN_0", "getValue", "getValue", "hash", "number", "BN_0", "blockNumber", "_timeout", "receipt", "_iface", "BN_0", "internal", "fragment", "t", "listener", "passProperties", "addr", "target", "code", "hash", "output", "data", "error", "bytes", "_a", "BN_0", "allowNull", "BN_0", "value", "_url", "_chainId", "parseUnits", "_value", "name", "b", "_provider", "_poll", "_filter", "hash", "_poller", "_running", "_blockNumber", "poll_fn", "BN_2", "copy", "_event", "hash", "t", "getTime", "_plugins", "_options", "_network", "b", "fromBlock", "toBlock", "address", "filter", "_request", "_filter", "listener", "error", "tx", "bytes", "from", "copy", "_provider", "_poller", "_running", "_poll", "poll_fn", "defaultOptions", "_to", "hash", "tx", "_value", "value", "_options", "_network", "_error", "id", "accounts", "bytes", "payload", "_network", "request", "defaultApiKey", "getHost", "_network", "error", "request", "_network", "isPromise", "_network", "id", "request", "response", "result", "error", "transaction", "getGlobal", "getGlobal", "_provider", "_filter", "_subs", "_options", "_connect", "getHost", "_network", "request", "getHost", "_network", "request", "BN_1", "BN_2", "stall", "getTime", "stringify", "value", "blockNumber", "getTime", "b", "BN_1", "BN_2", "add", "result", "stringify", "stall", "_request", "getHost", "_network", "request", "words", "words", "_data", "checksum", "words", "wordlist", "words", "checksum", "sha256", "_guard", "pbkdf2", "bytes", "i", "__classPrivateFieldSet", "__classPrivateFieldGet", "__classPrivateFieldGet", "__classPrivateFieldSet", "__classPrivateFieldGet", "_a", "object", "version", "N", "salt", "dkLen", "key", "pbkdf2", "stall", "scrypt", "randomBytes", "defaultPath", "N", "Nibbles", "zpad", "_value", "sha256", "bytes", "_guard", "ripemd160", "wordlist", "_a", "randomBytes", "pbkdf2", "stall", "_a", "wallet", "maxValue", "words", "checksum"] -} diff --git a/node_modules/.vite/deps/graphql.js b/node_modules/.vite/deps/graphql.js deleted file mode 100644 index 76a442fb..00000000 --- a/node_modules/.vite/deps/graphql.js +++ /dev/null @@ -1,11880 +0,0 @@ -import "./chunk-TXPGJST7.js"; - -// node_modules/graphql/version.mjs -var version = "16.8.1"; -var versionInfo = Object.freeze({ - major: 16, - minor: 8, - patch: 1, - preReleaseTag: null -}); - -// node_modules/graphql/jsutils/devAssert.mjs -function devAssert(condition, message) { - const booleanCondition = Boolean(condition); - if (!booleanCondition) { - throw new Error(message); - } -} - -// node_modules/graphql/jsutils/isPromise.mjs -function isPromise(value) { - return typeof (value === null || value === void 0 ? void 0 : value.then) === "function"; -} - -// node_modules/graphql/jsutils/isObjectLike.mjs -function isObjectLike(value) { - return typeof value == "object" && value !== null; -} - -// node_modules/graphql/jsutils/invariant.mjs -function invariant(condition, message) { - const booleanCondition = Boolean(condition); - if (!booleanCondition) { - throw new Error( - message != null ? message : "Unexpected invariant triggered." - ); - } -} - -// node_modules/graphql/language/location.mjs -var LineRegExp = /\r\n|[\n\r]/g; -function getLocation(source, position) { - let lastLineStart = 0; - let line = 1; - for (const match of source.body.matchAll(LineRegExp)) { - typeof match.index === "number" || invariant(false); - if (match.index >= position) { - break; - } - lastLineStart = match.index + match[0].length; - line += 1; - } - return { - line, - column: position + 1 - lastLineStart - }; -} - -// node_modules/graphql/language/printLocation.mjs -function printLocation(location) { - return printSourceLocation( - location.source, - getLocation(location.source, location.start) - ); -} -function printSourceLocation(source, sourceLocation) { - const firstLineColumnOffset = source.locationOffset.column - 1; - const body = "".padStart(firstLineColumnOffset) + source.body; - const lineIndex = sourceLocation.line - 1; - const lineOffset = source.locationOffset.line - 1; - const lineNum = sourceLocation.line + lineOffset; - const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0; - const columnNum = sourceLocation.column + columnOffset; - const locationStr = `${source.name}:${lineNum}:${columnNum} -`; - const lines = body.split(/\r\n|[\n\r]/g); - const locationLine = lines[lineIndex]; - if (locationLine.length > 120) { - const subLineIndex = Math.floor(columnNum / 80); - const subLineColumnNum = columnNum % 80; - const subLines = []; - for (let i = 0; i < locationLine.length; i += 80) { - subLines.push(locationLine.slice(i, i + 80)); - } - return locationStr + printPrefixedLines([ - [`${lineNum} |`, subLines[0]], - ...subLines.slice(1, subLineIndex + 1).map((subLine) => ["|", subLine]), - ["|", "^".padStart(subLineColumnNum)], - ["|", subLines[subLineIndex + 1]] - ]); - } - return locationStr + printPrefixedLines([ - // Lines specified like this: ["prefix", "string"], - [`${lineNum - 1} |`, lines[lineIndex - 1]], - [`${lineNum} |`, locationLine], - ["|", "^".padStart(columnNum)], - [`${lineNum + 1} |`, lines[lineIndex + 1]] - ]); -} -function printPrefixedLines(lines) { - const existingLines = lines.filter(([_, line]) => line !== void 0); - const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length)); - return existingLines.map(([prefix, line]) => prefix.padStart(padLen) + (line ? " " + line : "")).join("\n"); -} - -// node_modules/graphql/error/GraphQLError.mjs -function toNormalizedOptions(args) { - const firstArg = args[0]; - if (firstArg == null || "kind" in firstArg || "length" in firstArg) { - return { - nodes: firstArg, - source: args[1], - positions: args[2], - path: args[3], - originalError: args[4], - extensions: args[5] - }; - } - return firstArg; -} -var GraphQLError = class _GraphQLError extends Error { - /** - * An array of `{ line, column }` locations within the source GraphQL document - * which correspond to this error. - * - * Errors during validation often contain multiple locations, for example to - * point out two things with the same name. Errors during execution include a - * single location, the field which produced the error. - * - * Enumerable, and appears in the result of JSON.stringify(). - */ - /** - * An array describing the JSON-path into the execution response which - * corresponds to this error. Only included for errors during execution. - * - * Enumerable, and appears in the result of JSON.stringify(). - */ - /** - * An array of GraphQL AST Nodes corresponding to this error. - */ - /** - * The source GraphQL document for the first location of this error. - * - * Note that if this Error represents more than one node, the source may not - * represent nodes after the first node. - */ - /** - * An array of character offsets within the source GraphQL document - * which correspond to this error. - */ - /** - * The original error thrown from a field resolver during execution. - */ - /** - * Extension fields to add to the formatted error. - */ - /** - * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead. - */ - constructor(message, ...rawArgs) { - var _this$nodes, _nodeLocations$, _ref; - const { nodes, source, positions, path, originalError, extensions } = toNormalizedOptions(rawArgs); - super(message); - this.name = "GraphQLError"; - this.path = path !== null && path !== void 0 ? path : void 0; - this.originalError = originalError !== null && originalError !== void 0 ? originalError : void 0; - this.nodes = undefinedIfEmpty( - Array.isArray(nodes) ? nodes : nodes ? [nodes] : void 0 - ); - const nodeLocations = undefinedIfEmpty( - (_this$nodes = this.nodes) === null || _this$nodes === void 0 ? void 0 : _this$nodes.map((node) => node.loc).filter((loc) => loc != null) - ); - this.source = source !== null && source !== void 0 ? source : nodeLocations === null || nodeLocations === void 0 ? void 0 : (_nodeLocations$ = nodeLocations[0]) === null || _nodeLocations$ === void 0 ? void 0 : _nodeLocations$.source; - this.positions = positions !== null && positions !== void 0 ? positions : nodeLocations === null || nodeLocations === void 0 ? void 0 : nodeLocations.map((loc) => loc.start); - this.locations = positions && source ? positions.map((pos) => getLocation(source, pos)) : nodeLocations === null || nodeLocations === void 0 ? void 0 : nodeLocations.map((loc) => getLocation(loc.source, loc.start)); - const originalExtensions = isObjectLike( - originalError === null || originalError === void 0 ? void 0 : originalError.extensions - ) ? originalError === null || originalError === void 0 ? void 0 : originalError.extensions : void 0; - this.extensions = (_ref = extensions !== null && extensions !== void 0 ? extensions : originalExtensions) !== null && _ref !== void 0 ? _ref : /* @__PURE__ */ Object.create(null); - Object.defineProperties(this, { - message: { - writable: true, - enumerable: true - }, - name: { - enumerable: false - }, - nodes: { - enumerable: false - }, - source: { - enumerable: false - }, - positions: { - enumerable: false - }, - originalError: { - enumerable: false - } - }); - if (originalError !== null && originalError !== void 0 && originalError.stack) { - Object.defineProperty(this, "stack", { - value: originalError.stack, - writable: true, - configurable: true - }); - } else if (Error.captureStackTrace) { - Error.captureStackTrace(this, _GraphQLError); - } else { - Object.defineProperty(this, "stack", { - value: Error().stack, - writable: true, - configurable: true - }); - } - } - get [Symbol.toStringTag]() { - return "GraphQLError"; - } - toString() { - let output = this.message; - if (this.nodes) { - for (const node of this.nodes) { - if (node.loc) { - output += "\n\n" + printLocation(node.loc); - } - } - } else if (this.source && this.locations) { - for (const location of this.locations) { - output += "\n\n" + printSourceLocation(this.source, location); - } - } - return output; - } - toJSON() { - const formattedError = { - message: this.message - }; - if (this.locations != null) { - formattedError.locations = this.locations; - } - if (this.path != null) { - formattedError.path = this.path; - } - if (this.extensions != null && Object.keys(this.extensions).length > 0) { - formattedError.extensions = this.extensions; - } - return formattedError; - } -}; -function undefinedIfEmpty(array) { - return array === void 0 || array.length === 0 ? void 0 : array; -} -function printError(error) { - return error.toString(); -} -function formatError(error) { - return error.toJSON(); -} - -// node_modules/graphql/error/syntaxError.mjs -function syntaxError(source, position, description) { - return new GraphQLError(`Syntax Error: ${description}`, { - source, - positions: [position] - }); -} - -// node_modules/graphql/language/ast.mjs -var Location = class { - /** - * The character offset at which this Node begins. - */ - /** - * The character offset at which this Node ends. - */ - /** - * The Token at which this Node begins. - */ - /** - * The Token at which this Node ends. - */ - /** - * The Source document the AST represents. - */ - constructor(startToken, endToken, source) { - this.start = startToken.start; - this.end = endToken.end; - this.startToken = startToken; - this.endToken = endToken; - this.source = source; - } - get [Symbol.toStringTag]() { - return "Location"; - } - toJSON() { - return { - start: this.start, - end: this.end - }; - } -}; -var Token = class { - /** - * The kind of Token. - */ - /** - * The character offset at which this Node begins. - */ - /** - * The character offset at which this Node ends. - */ - /** - * The 1-indexed line number on which this Token appears. - */ - /** - * The 1-indexed column number at which this Token begins. - */ - /** - * For non-punctuation tokens, represents the interpreted value of the token. - * - * Note: is undefined for punctuation tokens, but typed as string for - * convenience in the parser. - */ - /** - * Tokens exist as nodes in a double-linked-list amongst all tokens - * including ignored tokens. is always the first node and - * the last. - */ - constructor(kind, start, end, line, column, value) { - this.kind = kind; - this.start = start; - this.end = end; - this.line = line; - this.column = column; - this.value = value; - this.prev = null; - this.next = null; - } - get [Symbol.toStringTag]() { - return "Token"; - } - toJSON() { - return { - kind: this.kind, - value: this.value, - line: this.line, - column: this.column - }; - } -}; -var QueryDocumentKeys = { - Name: [], - Document: ["definitions"], - OperationDefinition: [ - "name", - "variableDefinitions", - "directives", - "selectionSet" - ], - VariableDefinition: ["variable", "type", "defaultValue", "directives"], - Variable: ["name"], - SelectionSet: ["selections"], - Field: ["alias", "name", "arguments", "directives", "selectionSet"], - Argument: ["name", "value"], - FragmentSpread: ["name", "directives"], - InlineFragment: ["typeCondition", "directives", "selectionSet"], - FragmentDefinition: [ - "name", - // Note: fragment variable definitions are deprecated and will removed in v17.0.0 - "variableDefinitions", - "typeCondition", - "directives", - "selectionSet" - ], - IntValue: [], - FloatValue: [], - StringValue: [], - BooleanValue: [], - NullValue: [], - EnumValue: [], - ListValue: ["values"], - ObjectValue: ["fields"], - ObjectField: ["name", "value"], - Directive: ["name", "arguments"], - NamedType: ["name"], - ListType: ["type"], - NonNullType: ["type"], - SchemaDefinition: ["description", "directives", "operationTypes"], - OperationTypeDefinition: ["type"], - ScalarTypeDefinition: ["description", "name", "directives"], - ObjectTypeDefinition: [ - "description", - "name", - "interfaces", - "directives", - "fields" - ], - FieldDefinition: ["description", "name", "arguments", "type", "directives"], - InputValueDefinition: [ - "description", - "name", - "type", - "defaultValue", - "directives" - ], - InterfaceTypeDefinition: [ - "description", - "name", - "interfaces", - "directives", - "fields" - ], - UnionTypeDefinition: ["description", "name", "directives", "types"], - EnumTypeDefinition: ["description", "name", "directives", "values"], - EnumValueDefinition: ["description", "name", "directives"], - InputObjectTypeDefinition: ["description", "name", "directives", "fields"], - DirectiveDefinition: ["description", "name", "arguments", "locations"], - SchemaExtension: ["directives", "operationTypes"], - ScalarTypeExtension: ["name", "directives"], - ObjectTypeExtension: ["name", "interfaces", "directives", "fields"], - InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"], - UnionTypeExtension: ["name", "directives", "types"], - EnumTypeExtension: ["name", "directives", "values"], - InputObjectTypeExtension: ["name", "directives", "fields"] -}; -var kindValues = new Set(Object.keys(QueryDocumentKeys)); -function isNode(maybeNode) { - const maybeKind = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind; - return typeof maybeKind === "string" && kindValues.has(maybeKind); -} -var OperationTypeNode; -(function(OperationTypeNode2) { - OperationTypeNode2["QUERY"] = "query"; - OperationTypeNode2["MUTATION"] = "mutation"; - OperationTypeNode2["SUBSCRIPTION"] = "subscription"; -})(OperationTypeNode || (OperationTypeNode = {})); - -// node_modules/graphql/language/directiveLocation.mjs -var DirectiveLocation; -(function(DirectiveLocation2) { - DirectiveLocation2["QUERY"] = "QUERY"; - DirectiveLocation2["MUTATION"] = "MUTATION"; - DirectiveLocation2["SUBSCRIPTION"] = "SUBSCRIPTION"; - DirectiveLocation2["FIELD"] = "FIELD"; - DirectiveLocation2["FRAGMENT_DEFINITION"] = "FRAGMENT_DEFINITION"; - DirectiveLocation2["FRAGMENT_SPREAD"] = "FRAGMENT_SPREAD"; - DirectiveLocation2["INLINE_FRAGMENT"] = "INLINE_FRAGMENT"; - DirectiveLocation2["VARIABLE_DEFINITION"] = "VARIABLE_DEFINITION"; - DirectiveLocation2["SCHEMA"] = "SCHEMA"; - DirectiveLocation2["SCALAR"] = "SCALAR"; - DirectiveLocation2["OBJECT"] = "OBJECT"; - DirectiveLocation2["FIELD_DEFINITION"] = "FIELD_DEFINITION"; - DirectiveLocation2["ARGUMENT_DEFINITION"] = "ARGUMENT_DEFINITION"; - DirectiveLocation2["INTERFACE"] = "INTERFACE"; - DirectiveLocation2["UNION"] = "UNION"; - DirectiveLocation2["ENUM"] = "ENUM"; - DirectiveLocation2["ENUM_VALUE"] = "ENUM_VALUE"; - DirectiveLocation2["INPUT_OBJECT"] = "INPUT_OBJECT"; - DirectiveLocation2["INPUT_FIELD_DEFINITION"] = "INPUT_FIELD_DEFINITION"; -})(DirectiveLocation || (DirectiveLocation = {})); - -// node_modules/graphql/language/kinds.mjs -var Kind; -(function(Kind2) { - Kind2["NAME"] = "Name"; - Kind2["DOCUMENT"] = "Document"; - Kind2["OPERATION_DEFINITION"] = "OperationDefinition"; - Kind2["VARIABLE_DEFINITION"] = "VariableDefinition"; - Kind2["SELECTION_SET"] = "SelectionSet"; - Kind2["FIELD"] = "Field"; - Kind2["ARGUMENT"] = "Argument"; - Kind2["FRAGMENT_SPREAD"] = "FragmentSpread"; - Kind2["INLINE_FRAGMENT"] = "InlineFragment"; - Kind2["FRAGMENT_DEFINITION"] = "FragmentDefinition"; - Kind2["VARIABLE"] = "Variable"; - Kind2["INT"] = "IntValue"; - Kind2["FLOAT"] = "FloatValue"; - Kind2["STRING"] = "StringValue"; - Kind2["BOOLEAN"] = "BooleanValue"; - Kind2["NULL"] = "NullValue"; - Kind2["ENUM"] = "EnumValue"; - Kind2["LIST"] = "ListValue"; - Kind2["OBJECT"] = "ObjectValue"; - Kind2["OBJECT_FIELD"] = "ObjectField"; - Kind2["DIRECTIVE"] = "Directive"; - Kind2["NAMED_TYPE"] = "NamedType"; - Kind2["LIST_TYPE"] = "ListType"; - Kind2["NON_NULL_TYPE"] = "NonNullType"; - Kind2["SCHEMA_DEFINITION"] = "SchemaDefinition"; - Kind2["OPERATION_TYPE_DEFINITION"] = "OperationTypeDefinition"; - Kind2["SCALAR_TYPE_DEFINITION"] = "ScalarTypeDefinition"; - Kind2["OBJECT_TYPE_DEFINITION"] = "ObjectTypeDefinition"; - Kind2["FIELD_DEFINITION"] = "FieldDefinition"; - Kind2["INPUT_VALUE_DEFINITION"] = "InputValueDefinition"; - Kind2["INTERFACE_TYPE_DEFINITION"] = "InterfaceTypeDefinition"; - Kind2["UNION_TYPE_DEFINITION"] = "UnionTypeDefinition"; - Kind2["ENUM_TYPE_DEFINITION"] = "EnumTypeDefinition"; - Kind2["ENUM_VALUE_DEFINITION"] = "EnumValueDefinition"; - Kind2["INPUT_OBJECT_TYPE_DEFINITION"] = "InputObjectTypeDefinition"; - Kind2["DIRECTIVE_DEFINITION"] = "DirectiveDefinition"; - Kind2["SCHEMA_EXTENSION"] = "SchemaExtension"; - Kind2["SCALAR_TYPE_EXTENSION"] = "ScalarTypeExtension"; - Kind2["OBJECT_TYPE_EXTENSION"] = "ObjectTypeExtension"; - Kind2["INTERFACE_TYPE_EXTENSION"] = "InterfaceTypeExtension"; - Kind2["UNION_TYPE_EXTENSION"] = "UnionTypeExtension"; - Kind2["ENUM_TYPE_EXTENSION"] = "EnumTypeExtension"; - Kind2["INPUT_OBJECT_TYPE_EXTENSION"] = "InputObjectTypeExtension"; -})(Kind || (Kind = {})); - -// node_modules/graphql/language/characterClasses.mjs -function isWhiteSpace(code) { - return code === 9 || code === 32; -} -function isDigit(code) { - return code >= 48 && code <= 57; -} -function isLetter(code) { - return code >= 97 && code <= 122 || // A-Z - code >= 65 && code <= 90; -} -function isNameStart(code) { - return isLetter(code) || code === 95; -} -function isNameContinue(code) { - return isLetter(code) || isDigit(code) || code === 95; -} - -// node_modules/graphql/language/blockString.mjs -function dedentBlockStringLines(lines) { - var _firstNonEmptyLine2; - let commonIndent = Number.MAX_SAFE_INTEGER; - let firstNonEmptyLine = null; - let lastNonEmptyLine = -1; - for (let i = 0; i < lines.length; ++i) { - var _firstNonEmptyLine; - const line = lines[i]; - const indent2 = leadingWhitespace(line); - if (indent2 === line.length) { - continue; - } - firstNonEmptyLine = (_firstNonEmptyLine = firstNonEmptyLine) !== null && _firstNonEmptyLine !== void 0 ? _firstNonEmptyLine : i; - lastNonEmptyLine = i; - if (i !== 0 && indent2 < commonIndent) { - commonIndent = indent2; - } - } - return lines.map((line, i) => i === 0 ? line : line.slice(commonIndent)).slice( - (_firstNonEmptyLine2 = firstNonEmptyLine) !== null && _firstNonEmptyLine2 !== void 0 ? _firstNonEmptyLine2 : 0, - lastNonEmptyLine + 1 - ); -} -function leadingWhitespace(str) { - let i = 0; - while (i < str.length && isWhiteSpace(str.charCodeAt(i))) { - ++i; - } - return i; -} -function isPrintableAsBlockString(value) { - if (value === "") { - return true; - } - let isEmptyLine = true; - let hasIndent = false; - let hasCommonIndent = true; - let seenNonEmptyLine = false; - for (let i = 0; i < value.length; ++i) { - switch (value.codePointAt(i)) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 11: - case 12: - case 14: - case 15: - return false; - case 13: - return false; - case 10: - if (isEmptyLine && !seenNonEmptyLine) { - return false; - } - seenNonEmptyLine = true; - isEmptyLine = true; - hasIndent = false; - break; - case 9: - case 32: - hasIndent || (hasIndent = isEmptyLine); - break; - default: - hasCommonIndent && (hasCommonIndent = hasIndent); - isEmptyLine = false; - } - } - if (isEmptyLine) { - return false; - } - if (hasCommonIndent && seenNonEmptyLine) { - return false; - } - return true; -} -function printBlockString(value, options) { - const escapedValue = value.replace(/"""/g, '\\"""'); - const lines = escapedValue.split(/\r\n|[\n\r]/g); - const isSingleLine = lines.length === 1; - const forceLeadingNewLine = lines.length > 1 && lines.slice(1).every((line) => line.length === 0 || isWhiteSpace(line.charCodeAt(0))); - const hasTrailingTripleQuotes = escapedValue.endsWith('\\"""'); - const hasTrailingQuote = value.endsWith('"') && !hasTrailingTripleQuotes; - const hasTrailingSlash = value.endsWith("\\"); - const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash; - const printAsMultipleLines = !(options !== null && options !== void 0 && options.minimize) && // add leading and trailing new lines only if it improves readability - (!isSingleLine || value.length > 70 || forceTrailingNewline || forceLeadingNewLine || hasTrailingTripleQuotes); - let result = ""; - const skipLeadingNewLine = isSingleLine && isWhiteSpace(value.charCodeAt(0)); - if (printAsMultipleLines && !skipLeadingNewLine || forceLeadingNewLine) { - result += "\n"; - } - result += escapedValue; - if (printAsMultipleLines || forceTrailingNewline) { - result += "\n"; - } - return '"""' + result + '"""'; -} - -// node_modules/graphql/language/tokenKind.mjs -var TokenKind; -(function(TokenKind2) { - TokenKind2["SOF"] = ""; - TokenKind2["EOF"] = ""; - TokenKind2["BANG"] = "!"; - TokenKind2["DOLLAR"] = "$"; - TokenKind2["AMP"] = "&"; - TokenKind2["PAREN_L"] = "("; - TokenKind2["PAREN_R"] = ")"; - TokenKind2["SPREAD"] = "..."; - TokenKind2["COLON"] = ":"; - TokenKind2["EQUALS"] = "="; - TokenKind2["AT"] = "@"; - TokenKind2["BRACKET_L"] = "["; - TokenKind2["BRACKET_R"] = "]"; - TokenKind2["BRACE_L"] = "{"; - TokenKind2["PIPE"] = "|"; - TokenKind2["BRACE_R"] = "}"; - TokenKind2["NAME"] = "Name"; - TokenKind2["INT"] = "Int"; - TokenKind2["FLOAT"] = "Float"; - TokenKind2["STRING"] = "String"; - TokenKind2["BLOCK_STRING"] = "BlockString"; - TokenKind2["COMMENT"] = "Comment"; -})(TokenKind || (TokenKind = {})); - -// node_modules/graphql/language/lexer.mjs -var Lexer = class { - /** - * The previously focused non-ignored token. - */ - /** - * The currently focused non-ignored token. - */ - /** - * The (1-indexed) line containing the current token. - */ - /** - * The character offset at which the current line begins. - */ - constructor(source) { - const startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0); - this.source = source; - this.lastToken = startOfFileToken; - this.token = startOfFileToken; - this.line = 1; - this.lineStart = 0; - } - get [Symbol.toStringTag]() { - return "Lexer"; - } - /** - * Advances the token stream to the next non-ignored token. - */ - advance() { - this.lastToken = this.token; - const token = this.token = this.lookahead(); - return token; - } - /** - * Looks ahead and returns the next non-ignored token, but does not change - * the state of Lexer. - */ - lookahead() { - let token = this.token; - if (token.kind !== TokenKind.EOF) { - do { - if (token.next) { - token = token.next; - } else { - const nextToken = readNextToken(this, token.end); - token.next = nextToken; - nextToken.prev = token; - token = nextToken; - } - } while (token.kind === TokenKind.COMMENT); - } - return token; - } -}; -function isPunctuatorTokenKind(kind) { - return kind === TokenKind.BANG || kind === TokenKind.DOLLAR || kind === TokenKind.AMP || kind === TokenKind.PAREN_L || kind === TokenKind.PAREN_R || kind === TokenKind.SPREAD || kind === TokenKind.COLON || kind === TokenKind.EQUALS || kind === TokenKind.AT || kind === TokenKind.BRACKET_L || kind === TokenKind.BRACKET_R || kind === TokenKind.BRACE_L || kind === TokenKind.PIPE || kind === TokenKind.BRACE_R; -} -function isUnicodeScalarValue(code) { - return code >= 0 && code <= 55295 || code >= 57344 && code <= 1114111; -} -function isSupplementaryCodePoint(body, location) { - return isLeadingSurrogate(body.charCodeAt(location)) && isTrailingSurrogate(body.charCodeAt(location + 1)); -} -function isLeadingSurrogate(code) { - return code >= 55296 && code <= 56319; -} -function isTrailingSurrogate(code) { - return code >= 56320 && code <= 57343; -} -function printCodePointAt(lexer, location) { - const code = lexer.source.body.codePointAt(location); - if (code === void 0) { - return TokenKind.EOF; - } else if (code >= 32 && code <= 126) { - const char = String.fromCodePoint(code); - return char === '"' ? `'"'` : `"${char}"`; - } - return "U+" + code.toString(16).toUpperCase().padStart(4, "0"); -} -function createToken(lexer, kind, start, end, value) { - const line = lexer.line; - const col = 1 + start - lexer.lineStart; - return new Token(kind, start, end, line, col, value); -} -function readNextToken(lexer, start) { - const body = lexer.source.body; - const bodyLength = body.length; - let position = start; - while (position < bodyLength) { - const code = body.charCodeAt(position); - switch (code) { - case 65279: - case 9: - case 32: - case 44: - ++position; - continue; - case 10: - ++position; - ++lexer.line; - lexer.lineStart = position; - continue; - case 13: - if (body.charCodeAt(position + 1) === 10) { - position += 2; - } else { - ++position; - } - ++lexer.line; - lexer.lineStart = position; - continue; - case 35: - return readComment(lexer, position); - case 33: - return createToken(lexer, TokenKind.BANG, position, position + 1); - case 36: - return createToken(lexer, TokenKind.DOLLAR, position, position + 1); - case 38: - return createToken(lexer, TokenKind.AMP, position, position + 1); - case 40: - return createToken(lexer, TokenKind.PAREN_L, position, position + 1); - case 41: - return createToken(lexer, TokenKind.PAREN_R, position, position + 1); - case 46: - if (body.charCodeAt(position + 1) === 46 && body.charCodeAt(position + 2) === 46) { - return createToken(lexer, TokenKind.SPREAD, position, position + 3); - } - break; - case 58: - return createToken(lexer, TokenKind.COLON, position, position + 1); - case 61: - return createToken(lexer, TokenKind.EQUALS, position, position + 1); - case 64: - return createToken(lexer, TokenKind.AT, position, position + 1); - case 91: - return createToken(lexer, TokenKind.BRACKET_L, position, position + 1); - case 93: - return createToken(lexer, TokenKind.BRACKET_R, position, position + 1); - case 123: - return createToken(lexer, TokenKind.BRACE_L, position, position + 1); - case 124: - return createToken(lexer, TokenKind.PIPE, position, position + 1); - case 125: - return createToken(lexer, TokenKind.BRACE_R, position, position + 1); - case 34: - if (body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) { - return readBlockString(lexer, position); - } - return readString(lexer, position); - } - if (isDigit(code) || code === 45) { - return readNumber(lexer, position, code); - } - if (isNameStart(code)) { - return readName(lexer, position); - } - throw syntaxError( - lexer.source, - position, - code === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : isUnicodeScalarValue(code) || isSupplementaryCodePoint(body, position) ? `Unexpected character: ${printCodePointAt(lexer, position)}.` : `Invalid character: ${printCodePointAt(lexer, position)}.` - ); - } - return createToken(lexer, TokenKind.EOF, bodyLength, bodyLength); -} -function readComment(lexer, start) { - const body = lexer.source.body; - const bodyLength = body.length; - let position = start + 1; - while (position < bodyLength) { - const code = body.charCodeAt(position); - if (code === 10 || code === 13) { - break; - } - if (isUnicodeScalarValue(code)) { - ++position; - } else if (isSupplementaryCodePoint(body, position)) { - position += 2; - } else { - break; - } - } - return createToken( - lexer, - TokenKind.COMMENT, - start, - position, - body.slice(start + 1, position) - ); -} -function readNumber(lexer, start, firstCode) { - const body = lexer.source.body; - let position = start; - let code = firstCode; - let isFloat = false; - if (code === 45) { - code = body.charCodeAt(++position); - } - if (code === 48) { - code = body.charCodeAt(++position); - if (isDigit(code)) { - throw syntaxError( - lexer.source, - position, - `Invalid number, unexpected digit after 0: ${printCodePointAt( - lexer, - position - )}.` - ); - } - } else { - position = readDigits(lexer, position, code); - code = body.charCodeAt(position); - } - if (code === 46) { - isFloat = true; - code = body.charCodeAt(++position); - position = readDigits(lexer, position, code); - code = body.charCodeAt(position); - } - if (code === 69 || code === 101) { - isFloat = true; - code = body.charCodeAt(++position); - if (code === 43 || code === 45) { - code = body.charCodeAt(++position); - } - position = readDigits(lexer, position, code); - code = body.charCodeAt(position); - } - if (code === 46 || isNameStart(code)) { - throw syntaxError( - lexer.source, - position, - `Invalid number, expected digit but got: ${printCodePointAt( - lexer, - position - )}.` - ); - } - return createToken( - lexer, - isFloat ? TokenKind.FLOAT : TokenKind.INT, - start, - position, - body.slice(start, position) - ); -} -function readDigits(lexer, start, firstCode) { - if (!isDigit(firstCode)) { - throw syntaxError( - lexer.source, - start, - `Invalid number, expected digit but got: ${printCodePointAt( - lexer, - start - )}.` - ); - } - const body = lexer.source.body; - let position = start + 1; - while (isDigit(body.charCodeAt(position))) { - ++position; - } - return position; -} -function readString(lexer, start) { - const body = lexer.source.body; - const bodyLength = body.length; - let position = start + 1; - let chunkStart = position; - let value = ""; - while (position < bodyLength) { - const code = body.charCodeAt(position); - if (code === 34) { - value += body.slice(chunkStart, position); - return createToken(lexer, TokenKind.STRING, start, position + 1, value); - } - if (code === 92) { - value += body.slice(chunkStart, position); - const escape = body.charCodeAt(position + 1) === 117 ? body.charCodeAt(position + 2) === 123 ? readEscapedUnicodeVariableWidth(lexer, position) : readEscapedUnicodeFixedWidth(lexer, position) : readEscapedCharacter(lexer, position); - value += escape.value; - position += escape.size; - chunkStart = position; - continue; - } - if (code === 10 || code === 13) { - break; - } - if (isUnicodeScalarValue(code)) { - ++position; - } else if (isSupplementaryCodePoint(body, position)) { - position += 2; - } else { - throw syntaxError( - lexer.source, - position, - `Invalid character within String: ${printCodePointAt( - lexer, - position - )}.` - ); - } - } - throw syntaxError(lexer.source, position, "Unterminated string."); -} -function readEscapedUnicodeVariableWidth(lexer, position) { - const body = lexer.source.body; - let point = 0; - let size = 3; - while (size < 12) { - const code = body.charCodeAt(position + size++); - if (code === 125) { - if (size < 5 || !isUnicodeScalarValue(point)) { - break; - } - return { - value: String.fromCodePoint(point), - size - }; - } - point = point << 4 | readHexDigit(code); - if (point < 0) { - break; - } - } - throw syntaxError( - lexer.source, - position, - `Invalid Unicode escape sequence: "${body.slice( - position, - position + size - )}".` - ); -} -function readEscapedUnicodeFixedWidth(lexer, position) { - const body = lexer.source.body; - const code = read16BitHexCode(body, position + 2); - if (isUnicodeScalarValue(code)) { - return { - value: String.fromCodePoint(code), - size: 6 - }; - } - if (isLeadingSurrogate(code)) { - if (body.charCodeAt(position + 6) === 92 && body.charCodeAt(position + 7) === 117) { - const trailingCode = read16BitHexCode(body, position + 8); - if (isTrailingSurrogate(trailingCode)) { - return { - value: String.fromCodePoint(code, trailingCode), - size: 12 - }; - } - } - } - throw syntaxError( - lexer.source, - position, - `Invalid Unicode escape sequence: "${body.slice(position, position + 6)}".` - ); -} -function read16BitHexCode(body, position) { - return readHexDigit(body.charCodeAt(position)) << 12 | readHexDigit(body.charCodeAt(position + 1)) << 8 | readHexDigit(body.charCodeAt(position + 2)) << 4 | readHexDigit(body.charCodeAt(position + 3)); -} -function readHexDigit(code) { - return code >= 48 && code <= 57 ? code - 48 : code >= 65 && code <= 70 ? code - 55 : code >= 97 && code <= 102 ? code - 87 : -1; -} -function readEscapedCharacter(lexer, position) { - const body = lexer.source.body; - const code = body.charCodeAt(position + 1); - switch (code) { - case 34: - return { - value: '"', - size: 2 - }; - case 92: - return { - value: "\\", - size: 2 - }; - case 47: - return { - value: "/", - size: 2 - }; - case 98: - return { - value: "\b", - size: 2 - }; - case 102: - return { - value: "\f", - size: 2 - }; - case 110: - return { - value: "\n", - size: 2 - }; - case 114: - return { - value: "\r", - size: 2 - }; - case 116: - return { - value: " ", - size: 2 - }; - } - throw syntaxError( - lexer.source, - position, - `Invalid character escape sequence: "${body.slice( - position, - position + 2 - )}".` - ); -} -function readBlockString(lexer, start) { - const body = lexer.source.body; - const bodyLength = body.length; - let lineStart = lexer.lineStart; - let position = start + 3; - let chunkStart = position; - let currentLine = ""; - const blockLines = []; - while (position < bodyLength) { - const code = body.charCodeAt(position); - if (code === 34 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) { - currentLine += body.slice(chunkStart, position); - blockLines.push(currentLine); - const token = createToken( - lexer, - TokenKind.BLOCK_STRING, - start, - position + 3, - // Return a string of the lines joined with U+000A. - dedentBlockStringLines(blockLines).join("\n") - ); - lexer.line += blockLines.length - 1; - lexer.lineStart = lineStart; - return token; - } - if (code === 92 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34 && body.charCodeAt(position + 3) === 34) { - currentLine += body.slice(chunkStart, position); - chunkStart = position + 1; - position += 4; - continue; - } - if (code === 10 || code === 13) { - currentLine += body.slice(chunkStart, position); - blockLines.push(currentLine); - if (code === 13 && body.charCodeAt(position + 1) === 10) { - position += 2; - } else { - ++position; - } - currentLine = ""; - chunkStart = position; - lineStart = position; - continue; - } - if (isUnicodeScalarValue(code)) { - ++position; - } else if (isSupplementaryCodePoint(body, position)) { - position += 2; - } else { - throw syntaxError( - lexer.source, - position, - `Invalid character within String: ${printCodePointAt( - lexer, - position - )}.` - ); - } - } - throw syntaxError(lexer.source, position, "Unterminated string."); -} -function readName(lexer, start) { - const body = lexer.source.body; - const bodyLength = body.length; - let position = start + 1; - while (position < bodyLength) { - const code = body.charCodeAt(position); - if (isNameContinue(code)) { - ++position; - } else { - break; - } - } - return createToken( - lexer, - TokenKind.NAME, - start, - position, - body.slice(start, position) - ); -} - -// node_modules/graphql/jsutils/inspect.mjs -var MAX_ARRAY_LENGTH = 10; -var MAX_RECURSIVE_DEPTH = 2; -function inspect(value) { - return formatValue(value, []); -} -function formatValue(value, seenValues) { - switch (typeof value) { - case "string": - return JSON.stringify(value); - case "function": - return value.name ? `[function ${value.name}]` : "[function]"; - case "object": - return formatObjectValue(value, seenValues); - default: - return String(value); - } -} -function formatObjectValue(value, previouslySeenValues) { - if (value === null) { - return "null"; - } - if (previouslySeenValues.includes(value)) { - return "[Circular]"; - } - const seenValues = [...previouslySeenValues, value]; - if (isJSONable(value)) { - const jsonValue = value.toJSON(); - if (jsonValue !== value) { - return typeof jsonValue === "string" ? jsonValue : formatValue(jsonValue, seenValues); - } - } else if (Array.isArray(value)) { - return formatArray(value, seenValues); - } - return formatObject(value, seenValues); -} -function isJSONable(value) { - return typeof value.toJSON === "function"; -} -function formatObject(object, seenValues) { - const entries = Object.entries(object); - if (entries.length === 0) { - return "{}"; - } - if (seenValues.length > MAX_RECURSIVE_DEPTH) { - return "[" + getObjectTag(object) + "]"; - } - const properties = entries.map( - ([key, value]) => key + ": " + formatValue(value, seenValues) - ); - return "{ " + properties.join(", ") + " }"; -} -function formatArray(array, seenValues) { - if (array.length === 0) { - return "[]"; - } - if (seenValues.length > MAX_RECURSIVE_DEPTH) { - return "[Array]"; - } - const len = Math.min(MAX_ARRAY_LENGTH, array.length); - const remaining = array.length - len; - const items = []; - for (let i = 0; i < len; ++i) { - items.push(formatValue(array[i], seenValues)); - } - if (remaining === 1) { - items.push("... 1 more item"); - } else if (remaining > 1) { - items.push(`... ${remaining} more items`); - } - return "[" + items.join(", ") + "]"; -} -function getObjectTag(object) { - const tag = Object.prototype.toString.call(object).replace(/^\[object /, "").replace(/]$/, ""); - if (tag === "Object" && typeof object.constructor === "function") { - const name = object.constructor.name; - if (typeof name === "string" && name !== "") { - return name; - } - } - return tag; -} - -// node_modules/graphql/jsutils/instanceOf.mjs -var instanceOf = ( - /* c8 ignore next 6 */ - // FIXME: https://github.com/graphql/graphql-js/issues/2317 - globalThis.process && globalThis.process.env.NODE_ENV === "production" ? function instanceOf2(value, constructor) { - return value instanceof constructor; - } : function instanceOf3(value, constructor) { - if (value instanceof constructor) { - return true; - } - if (typeof value === "object" && value !== null) { - var _value$constructor; - const className = constructor.prototype[Symbol.toStringTag]; - const valueClassName = ( - // We still need to support constructor's name to detect conflicts with older versions of this library. - Symbol.toStringTag in value ? value[Symbol.toStringTag] : (_value$constructor = value.constructor) === null || _value$constructor === void 0 ? void 0 : _value$constructor.name - ); - if (className === valueClassName) { - const stringifiedValue = inspect(value); - throw new Error(`Cannot use ${className} "${stringifiedValue}" from another module or realm. - -Ensure that there is only one instance of "graphql" in the node_modules -directory. If different versions of "graphql" are the dependencies of other -relied on modules, use "resolutions" to ensure only one version is installed. - -https://yarnpkg.com/en/docs/selective-version-resolutions - -Duplicate "graphql" modules cannot be used at the same time since different -versions may have different capabilities and behavior. The data from one -version used in the function from another could produce confusing and -spurious results.`); - } - } - return false; - } -); - -// node_modules/graphql/language/source.mjs -var Source = class { - constructor(body, name = "GraphQL request", locationOffset = { - line: 1, - column: 1 - }) { - typeof body === "string" || devAssert(false, `Body must be a string. Received: ${inspect(body)}.`); - this.body = body; - this.name = name; - this.locationOffset = locationOffset; - this.locationOffset.line > 0 || devAssert( - false, - "line in locationOffset is 1-indexed and must be positive." - ); - this.locationOffset.column > 0 || devAssert( - false, - "column in locationOffset is 1-indexed and must be positive." - ); - } - get [Symbol.toStringTag]() { - return "Source"; - } -}; -function isSource(source) { - return instanceOf(source, Source); -} - -// node_modules/graphql/language/parser.mjs -function parse(source, options) { - const parser = new Parser(source, options); - return parser.parseDocument(); -} -function parseValue(source, options) { - const parser = new Parser(source, options); - parser.expectToken(TokenKind.SOF); - const value = parser.parseValueLiteral(false); - parser.expectToken(TokenKind.EOF); - return value; -} -function parseConstValue(source, options) { - const parser = new Parser(source, options); - parser.expectToken(TokenKind.SOF); - const value = parser.parseConstValueLiteral(); - parser.expectToken(TokenKind.EOF); - return value; -} -function parseType(source, options) { - const parser = new Parser(source, options); - parser.expectToken(TokenKind.SOF); - const type = parser.parseTypeReference(); - parser.expectToken(TokenKind.EOF); - return type; -} -var Parser = class { - constructor(source, options = {}) { - const sourceObj = isSource(source) ? source : new Source(source); - this._lexer = new Lexer(sourceObj); - this._options = options; - this._tokenCounter = 0; - } - /** - * Converts a name lex token into a name parse node. - */ - parseName() { - const token = this.expectToken(TokenKind.NAME); - return this.node(token, { - kind: Kind.NAME, - value: token.value - }); - } - // Implements the parsing rules in the Document section. - /** - * Document : Definition+ - */ - parseDocument() { - return this.node(this._lexer.token, { - kind: Kind.DOCUMENT, - definitions: this.many( - TokenKind.SOF, - this.parseDefinition, - TokenKind.EOF - ) - }); - } - /** - * Definition : - * - ExecutableDefinition - * - TypeSystemDefinition - * - TypeSystemExtension - * - * ExecutableDefinition : - * - OperationDefinition - * - FragmentDefinition - * - * TypeSystemDefinition : - * - SchemaDefinition - * - TypeDefinition - * - DirectiveDefinition - * - * TypeDefinition : - * - ScalarTypeDefinition - * - ObjectTypeDefinition - * - InterfaceTypeDefinition - * - UnionTypeDefinition - * - EnumTypeDefinition - * - InputObjectTypeDefinition - */ - parseDefinition() { - if (this.peek(TokenKind.BRACE_L)) { - return this.parseOperationDefinition(); - } - const hasDescription = this.peekDescription(); - const keywordToken = hasDescription ? this._lexer.lookahead() : this._lexer.token; - if (keywordToken.kind === TokenKind.NAME) { - switch (keywordToken.value) { - case "schema": - return this.parseSchemaDefinition(); - case "scalar": - return this.parseScalarTypeDefinition(); - case "type": - return this.parseObjectTypeDefinition(); - case "interface": - return this.parseInterfaceTypeDefinition(); - case "union": - return this.parseUnionTypeDefinition(); - case "enum": - return this.parseEnumTypeDefinition(); - case "input": - return this.parseInputObjectTypeDefinition(); - case "directive": - return this.parseDirectiveDefinition(); - } - if (hasDescription) { - throw syntaxError( - this._lexer.source, - this._lexer.token.start, - "Unexpected description, descriptions are supported only on type definitions." - ); - } - switch (keywordToken.value) { - case "query": - case "mutation": - case "subscription": - return this.parseOperationDefinition(); - case "fragment": - return this.parseFragmentDefinition(); - case "extend": - return this.parseTypeSystemExtension(); - } - } - throw this.unexpected(keywordToken); - } - // Implements the parsing rules in the Operations section. - /** - * OperationDefinition : - * - SelectionSet - * - OperationType Name? VariableDefinitions? Directives? SelectionSet - */ - parseOperationDefinition() { - const start = this._lexer.token; - if (this.peek(TokenKind.BRACE_L)) { - return this.node(start, { - kind: Kind.OPERATION_DEFINITION, - operation: OperationTypeNode.QUERY, - name: void 0, - variableDefinitions: [], - directives: [], - selectionSet: this.parseSelectionSet() - }); - } - const operation = this.parseOperationType(); - let name; - if (this.peek(TokenKind.NAME)) { - name = this.parseName(); - } - return this.node(start, { - kind: Kind.OPERATION_DEFINITION, - operation, - name, - variableDefinitions: this.parseVariableDefinitions(), - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet() - }); - } - /** - * OperationType : one of query mutation subscription - */ - parseOperationType() { - const operationToken = this.expectToken(TokenKind.NAME); - switch (operationToken.value) { - case "query": - return OperationTypeNode.QUERY; - case "mutation": - return OperationTypeNode.MUTATION; - case "subscription": - return OperationTypeNode.SUBSCRIPTION; - } - throw this.unexpected(operationToken); - } - /** - * VariableDefinitions : ( VariableDefinition+ ) - */ - parseVariableDefinitions() { - return this.optionalMany( - TokenKind.PAREN_L, - this.parseVariableDefinition, - TokenKind.PAREN_R - ); - } - /** - * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? - */ - parseVariableDefinition() { - return this.node(this._lexer.token, { - kind: Kind.VARIABLE_DEFINITION, - variable: this.parseVariable(), - type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()), - defaultValue: this.expectOptionalToken(TokenKind.EQUALS) ? this.parseConstValueLiteral() : void 0, - directives: this.parseConstDirectives() - }); - } - /** - * Variable : $ Name - */ - parseVariable() { - const start = this._lexer.token; - this.expectToken(TokenKind.DOLLAR); - return this.node(start, { - kind: Kind.VARIABLE, - name: this.parseName() - }); - } - /** - * ``` - * SelectionSet : { Selection+ } - * ``` - */ - parseSelectionSet() { - return this.node(this._lexer.token, { - kind: Kind.SELECTION_SET, - selections: this.many( - TokenKind.BRACE_L, - this.parseSelection, - TokenKind.BRACE_R - ) - }); - } - /** - * Selection : - * - Field - * - FragmentSpread - * - InlineFragment - */ - parseSelection() { - return this.peek(TokenKind.SPREAD) ? this.parseFragment() : this.parseField(); - } - /** - * Field : Alias? Name Arguments? Directives? SelectionSet? - * - * Alias : Name : - */ - parseField() { - const start = this._lexer.token; - const nameOrAlias = this.parseName(); - let alias; - let name; - if (this.expectOptionalToken(TokenKind.COLON)) { - alias = nameOrAlias; - name = this.parseName(); - } else { - name = nameOrAlias; - } - return this.node(start, { - kind: Kind.FIELD, - alias, - name, - arguments: this.parseArguments(false), - directives: this.parseDirectives(false), - selectionSet: this.peek(TokenKind.BRACE_L) ? this.parseSelectionSet() : void 0 - }); - } - /** - * Arguments[Const] : ( Argument[?Const]+ ) - */ - parseArguments(isConst) { - const item = isConst ? this.parseConstArgument : this.parseArgument; - return this.optionalMany(TokenKind.PAREN_L, item, TokenKind.PAREN_R); - } - /** - * Argument[Const] : Name : Value[?Const] - */ - parseArgument(isConst = false) { - const start = this._lexer.token; - const name = this.parseName(); - this.expectToken(TokenKind.COLON); - return this.node(start, { - kind: Kind.ARGUMENT, - name, - value: this.parseValueLiteral(isConst) - }); - } - parseConstArgument() { - return this.parseArgument(true); - } - // Implements the parsing rules in the Fragments section. - /** - * Corresponds to both FragmentSpread and InlineFragment in the spec. - * - * FragmentSpread : ... FragmentName Directives? - * - * InlineFragment : ... TypeCondition? Directives? SelectionSet - */ - parseFragment() { - const start = this._lexer.token; - this.expectToken(TokenKind.SPREAD); - const hasTypeCondition = this.expectOptionalKeyword("on"); - if (!hasTypeCondition && this.peek(TokenKind.NAME)) { - return this.node(start, { - kind: Kind.FRAGMENT_SPREAD, - name: this.parseFragmentName(), - directives: this.parseDirectives(false) - }); - } - return this.node(start, { - kind: Kind.INLINE_FRAGMENT, - typeCondition: hasTypeCondition ? this.parseNamedType() : void 0, - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet() - }); - } - /** - * FragmentDefinition : - * - fragment FragmentName on TypeCondition Directives? SelectionSet - * - * TypeCondition : NamedType - */ - parseFragmentDefinition() { - const start = this._lexer.token; - this.expectKeyword("fragment"); - if (this._options.allowLegacyFragmentVariables === true) { - return this.node(start, { - kind: Kind.FRAGMENT_DEFINITION, - name: this.parseFragmentName(), - variableDefinitions: this.parseVariableDefinitions(), - typeCondition: (this.expectKeyword("on"), this.parseNamedType()), - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet() - }); - } - return this.node(start, { - kind: Kind.FRAGMENT_DEFINITION, - name: this.parseFragmentName(), - typeCondition: (this.expectKeyword("on"), this.parseNamedType()), - directives: this.parseDirectives(false), - selectionSet: this.parseSelectionSet() - }); - } - /** - * FragmentName : Name but not `on` - */ - parseFragmentName() { - if (this._lexer.token.value === "on") { - throw this.unexpected(); - } - return this.parseName(); - } - // Implements the parsing rules in the Values section. - /** - * Value[Const] : - * - [~Const] Variable - * - IntValue - * - FloatValue - * - StringValue - * - BooleanValue - * - NullValue - * - EnumValue - * - ListValue[?Const] - * - ObjectValue[?Const] - * - * BooleanValue : one of `true` `false` - * - * NullValue : `null` - * - * EnumValue : Name but not `true`, `false` or `null` - */ - parseValueLiteral(isConst) { - const token = this._lexer.token; - switch (token.kind) { - case TokenKind.BRACKET_L: - return this.parseList(isConst); - case TokenKind.BRACE_L: - return this.parseObject(isConst); - case TokenKind.INT: - this.advanceLexer(); - return this.node(token, { - kind: Kind.INT, - value: token.value - }); - case TokenKind.FLOAT: - this.advanceLexer(); - return this.node(token, { - kind: Kind.FLOAT, - value: token.value - }); - case TokenKind.STRING: - case TokenKind.BLOCK_STRING: - return this.parseStringLiteral(); - case TokenKind.NAME: - this.advanceLexer(); - switch (token.value) { - case "true": - return this.node(token, { - kind: Kind.BOOLEAN, - value: true - }); - case "false": - return this.node(token, { - kind: Kind.BOOLEAN, - value: false - }); - case "null": - return this.node(token, { - kind: Kind.NULL - }); - default: - return this.node(token, { - kind: Kind.ENUM, - value: token.value - }); - } - case TokenKind.DOLLAR: - if (isConst) { - this.expectToken(TokenKind.DOLLAR); - if (this._lexer.token.kind === TokenKind.NAME) { - const varName = this._lexer.token.value; - throw syntaxError( - this._lexer.source, - token.start, - `Unexpected variable "$${varName}" in constant value.` - ); - } else { - throw this.unexpected(token); - } - } - return this.parseVariable(); - default: - throw this.unexpected(); - } - } - parseConstValueLiteral() { - return this.parseValueLiteral(true); - } - parseStringLiteral() { - const token = this._lexer.token; - this.advanceLexer(); - return this.node(token, { - kind: Kind.STRING, - value: token.value, - block: token.kind === TokenKind.BLOCK_STRING - }); - } - /** - * ListValue[Const] : - * - [ ] - * - [ Value[?Const]+ ] - */ - parseList(isConst) { - const item = () => this.parseValueLiteral(isConst); - return this.node(this._lexer.token, { - kind: Kind.LIST, - values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R) - }); - } - /** - * ``` - * ObjectValue[Const] : - * - { } - * - { ObjectField[?Const]+ } - * ``` - */ - parseObject(isConst) { - const item = () => this.parseObjectField(isConst); - return this.node(this._lexer.token, { - kind: Kind.OBJECT, - fields: this.any(TokenKind.BRACE_L, item, TokenKind.BRACE_R) - }); - } - /** - * ObjectField[Const] : Name : Value[?Const] - */ - parseObjectField(isConst) { - const start = this._lexer.token; - const name = this.parseName(); - this.expectToken(TokenKind.COLON); - return this.node(start, { - kind: Kind.OBJECT_FIELD, - name, - value: this.parseValueLiteral(isConst) - }); - } - // Implements the parsing rules in the Directives section. - /** - * Directives[Const] : Directive[?Const]+ - */ - parseDirectives(isConst) { - const directives = []; - while (this.peek(TokenKind.AT)) { - directives.push(this.parseDirective(isConst)); - } - return directives; - } - parseConstDirectives() { - return this.parseDirectives(true); - } - /** - * ``` - * Directive[Const] : @ Name Arguments[?Const]? - * ``` - */ - parseDirective(isConst) { - const start = this._lexer.token; - this.expectToken(TokenKind.AT); - return this.node(start, { - kind: Kind.DIRECTIVE, - name: this.parseName(), - arguments: this.parseArguments(isConst) - }); - } - // Implements the parsing rules in the Types section. - /** - * Type : - * - NamedType - * - ListType - * - NonNullType - */ - parseTypeReference() { - const start = this._lexer.token; - let type; - if (this.expectOptionalToken(TokenKind.BRACKET_L)) { - const innerType = this.parseTypeReference(); - this.expectToken(TokenKind.BRACKET_R); - type = this.node(start, { - kind: Kind.LIST_TYPE, - type: innerType - }); - } else { - type = this.parseNamedType(); - } - if (this.expectOptionalToken(TokenKind.BANG)) { - return this.node(start, { - kind: Kind.NON_NULL_TYPE, - type - }); - } - return type; - } - /** - * NamedType : Name - */ - parseNamedType() { - return this.node(this._lexer.token, { - kind: Kind.NAMED_TYPE, - name: this.parseName() - }); - } - // Implements the parsing rules in the Type Definition section. - peekDescription() { - return this.peek(TokenKind.STRING) || this.peek(TokenKind.BLOCK_STRING); - } - /** - * Description : StringValue - */ - parseDescription() { - if (this.peekDescription()) { - return this.parseStringLiteral(); - } - } - /** - * ``` - * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ } - * ``` - */ - parseSchemaDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword("schema"); - const directives = this.parseConstDirectives(); - const operationTypes = this.many( - TokenKind.BRACE_L, - this.parseOperationTypeDefinition, - TokenKind.BRACE_R - ); - return this.node(start, { - kind: Kind.SCHEMA_DEFINITION, - description, - directives, - operationTypes - }); - } - /** - * OperationTypeDefinition : OperationType : NamedType - */ - parseOperationTypeDefinition() { - const start = this._lexer.token; - const operation = this.parseOperationType(); - this.expectToken(TokenKind.COLON); - const type = this.parseNamedType(); - return this.node(start, { - kind: Kind.OPERATION_TYPE_DEFINITION, - operation, - type - }); - } - /** - * ScalarTypeDefinition : Description? scalar Name Directives[Const]? - */ - parseScalarTypeDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword("scalar"); - const name = this.parseName(); - const directives = this.parseConstDirectives(); - return this.node(start, { - kind: Kind.SCALAR_TYPE_DEFINITION, - description, - name, - directives - }); - } - /** - * ObjectTypeDefinition : - * Description? - * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition? - */ - parseObjectTypeDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword("type"); - const name = this.parseName(); - const interfaces = this.parseImplementsInterfaces(); - const directives = this.parseConstDirectives(); - const fields = this.parseFieldsDefinition(); - return this.node(start, { - kind: Kind.OBJECT_TYPE_DEFINITION, - description, - name, - interfaces, - directives, - fields - }); - } - /** - * ImplementsInterfaces : - * - implements `&`? NamedType - * - ImplementsInterfaces & NamedType - */ - parseImplementsInterfaces() { - return this.expectOptionalKeyword("implements") ? this.delimitedMany(TokenKind.AMP, this.parseNamedType) : []; - } - /** - * ``` - * FieldsDefinition : { FieldDefinition+ } - * ``` - */ - parseFieldsDefinition() { - return this.optionalMany( - TokenKind.BRACE_L, - this.parseFieldDefinition, - TokenKind.BRACE_R - ); - } - /** - * FieldDefinition : - * - Description? Name ArgumentsDefinition? : Type Directives[Const]? - */ - parseFieldDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - const name = this.parseName(); - const args = this.parseArgumentDefs(); - this.expectToken(TokenKind.COLON); - const type = this.parseTypeReference(); - const directives = this.parseConstDirectives(); - return this.node(start, { - kind: Kind.FIELD_DEFINITION, - description, - name, - arguments: args, - type, - directives - }); - } - /** - * ArgumentsDefinition : ( InputValueDefinition+ ) - */ - parseArgumentDefs() { - return this.optionalMany( - TokenKind.PAREN_L, - this.parseInputValueDef, - TokenKind.PAREN_R - ); - } - /** - * InputValueDefinition : - * - Description? Name : Type DefaultValue? Directives[Const]? - */ - parseInputValueDef() { - const start = this._lexer.token; - const description = this.parseDescription(); - const name = this.parseName(); - this.expectToken(TokenKind.COLON); - const type = this.parseTypeReference(); - let defaultValue; - if (this.expectOptionalToken(TokenKind.EQUALS)) { - defaultValue = this.parseConstValueLiteral(); - } - const directives = this.parseConstDirectives(); - return this.node(start, { - kind: Kind.INPUT_VALUE_DEFINITION, - description, - name, - type, - defaultValue, - directives - }); - } - /** - * InterfaceTypeDefinition : - * - Description? interface Name Directives[Const]? FieldsDefinition? - */ - parseInterfaceTypeDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword("interface"); - const name = this.parseName(); - const interfaces = this.parseImplementsInterfaces(); - const directives = this.parseConstDirectives(); - const fields = this.parseFieldsDefinition(); - return this.node(start, { - kind: Kind.INTERFACE_TYPE_DEFINITION, - description, - name, - interfaces, - directives, - fields - }); - } - /** - * UnionTypeDefinition : - * - Description? union Name Directives[Const]? UnionMemberTypes? - */ - parseUnionTypeDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword("union"); - const name = this.parseName(); - const directives = this.parseConstDirectives(); - const types = this.parseUnionMemberTypes(); - return this.node(start, { - kind: Kind.UNION_TYPE_DEFINITION, - description, - name, - directives, - types - }); - } - /** - * UnionMemberTypes : - * - = `|`? NamedType - * - UnionMemberTypes | NamedType - */ - parseUnionMemberTypes() { - return this.expectOptionalToken(TokenKind.EQUALS) ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType) : []; - } - /** - * EnumTypeDefinition : - * - Description? enum Name Directives[Const]? EnumValuesDefinition? - */ - parseEnumTypeDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword("enum"); - const name = this.parseName(); - const directives = this.parseConstDirectives(); - const values = this.parseEnumValuesDefinition(); - return this.node(start, { - kind: Kind.ENUM_TYPE_DEFINITION, - description, - name, - directives, - values - }); - } - /** - * ``` - * EnumValuesDefinition : { EnumValueDefinition+ } - * ``` - */ - parseEnumValuesDefinition() { - return this.optionalMany( - TokenKind.BRACE_L, - this.parseEnumValueDefinition, - TokenKind.BRACE_R - ); - } - /** - * EnumValueDefinition : Description? EnumValue Directives[Const]? - */ - parseEnumValueDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - const name = this.parseEnumValueName(); - const directives = this.parseConstDirectives(); - return this.node(start, { - kind: Kind.ENUM_VALUE_DEFINITION, - description, - name, - directives - }); - } - /** - * EnumValue : Name but not `true`, `false` or `null` - */ - parseEnumValueName() { - if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null") { - throw syntaxError( - this._lexer.source, - this._lexer.token.start, - `${getTokenDesc( - this._lexer.token - )} is reserved and cannot be used for an enum value.` - ); - } - return this.parseName(); - } - /** - * InputObjectTypeDefinition : - * - Description? input Name Directives[Const]? InputFieldsDefinition? - */ - parseInputObjectTypeDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword("input"); - const name = this.parseName(); - const directives = this.parseConstDirectives(); - const fields = this.parseInputFieldsDefinition(); - return this.node(start, { - kind: Kind.INPUT_OBJECT_TYPE_DEFINITION, - description, - name, - directives, - fields - }); - } - /** - * ``` - * InputFieldsDefinition : { InputValueDefinition+ } - * ``` - */ - parseInputFieldsDefinition() { - return this.optionalMany( - TokenKind.BRACE_L, - this.parseInputValueDef, - TokenKind.BRACE_R - ); - } - /** - * TypeSystemExtension : - * - SchemaExtension - * - TypeExtension - * - * TypeExtension : - * - ScalarTypeExtension - * - ObjectTypeExtension - * - InterfaceTypeExtension - * - UnionTypeExtension - * - EnumTypeExtension - * - InputObjectTypeDefinition - */ - parseTypeSystemExtension() { - const keywordToken = this._lexer.lookahead(); - if (keywordToken.kind === TokenKind.NAME) { - switch (keywordToken.value) { - case "schema": - return this.parseSchemaExtension(); - case "scalar": - return this.parseScalarTypeExtension(); - case "type": - return this.parseObjectTypeExtension(); - case "interface": - return this.parseInterfaceTypeExtension(); - case "union": - return this.parseUnionTypeExtension(); - case "enum": - return this.parseEnumTypeExtension(); - case "input": - return this.parseInputObjectTypeExtension(); - } - } - throw this.unexpected(keywordToken); - } - /** - * ``` - * SchemaExtension : - * - extend schema Directives[Const]? { OperationTypeDefinition+ } - * - extend schema Directives[Const] - * ``` - */ - parseSchemaExtension() { - const start = this._lexer.token; - this.expectKeyword("extend"); - this.expectKeyword("schema"); - const directives = this.parseConstDirectives(); - const operationTypes = this.optionalMany( - TokenKind.BRACE_L, - this.parseOperationTypeDefinition, - TokenKind.BRACE_R - ); - if (directives.length === 0 && operationTypes.length === 0) { - throw this.unexpected(); - } - return this.node(start, { - kind: Kind.SCHEMA_EXTENSION, - directives, - operationTypes - }); - } - /** - * ScalarTypeExtension : - * - extend scalar Name Directives[Const] - */ - parseScalarTypeExtension() { - const start = this._lexer.token; - this.expectKeyword("extend"); - this.expectKeyword("scalar"); - const name = this.parseName(); - const directives = this.parseConstDirectives(); - if (directives.length === 0) { - throw this.unexpected(); - } - return this.node(start, { - kind: Kind.SCALAR_TYPE_EXTENSION, - name, - directives - }); - } - /** - * ObjectTypeExtension : - * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition - * - extend type Name ImplementsInterfaces? Directives[Const] - * - extend type Name ImplementsInterfaces - */ - parseObjectTypeExtension() { - const start = this._lexer.token; - this.expectKeyword("extend"); - this.expectKeyword("type"); - const name = this.parseName(); - const interfaces = this.parseImplementsInterfaces(); - const directives = this.parseConstDirectives(); - const fields = this.parseFieldsDefinition(); - if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) { - throw this.unexpected(); - } - return this.node(start, { - kind: Kind.OBJECT_TYPE_EXTENSION, - name, - interfaces, - directives, - fields - }); - } - /** - * InterfaceTypeExtension : - * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition - * - extend interface Name ImplementsInterfaces? Directives[Const] - * - extend interface Name ImplementsInterfaces - */ - parseInterfaceTypeExtension() { - const start = this._lexer.token; - this.expectKeyword("extend"); - this.expectKeyword("interface"); - const name = this.parseName(); - const interfaces = this.parseImplementsInterfaces(); - const directives = this.parseConstDirectives(); - const fields = this.parseFieldsDefinition(); - if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) { - throw this.unexpected(); - } - return this.node(start, { - kind: Kind.INTERFACE_TYPE_EXTENSION, - name, - interfaces, - directives, - fields - }); - } - /** - * UnionTypeExtension : - * - extend union Name Directives[Const]? UnionMemberTypes - * - extend union Name Directives[Const] - */ - parseUnionTypeExtension() { - const start = this._lexer.token; - this.expectKeyword("extend"); - this.expectKeyword("union"); - const name = this.parseName(); - const directives = this.parseConstDirectives(); - const types = this.parseUnionMemberTypes(); - if (directives.length === 0 && types.length === 0) { - throw this.unexpected(); - } - return this.node(start, { - kind: Kind.UNION_TYPE_EXTENSION, - name, - directives, - types - }); - } - /** - * EnumTypeExtension : - * - extend enum Name Directives[Const]? EnumValuesDefinition - * - extend enum Name Directives[Const] - */ - parseEnumTypeExtension() { - const start = this._lexer.token; - this.expectKeyword("extend"); - this.expectKeyword("enum"); - const name = this.parseName(); - const directives = this.parseConstDirectives(); - const values = this.parseEnumValuesDefinition(); - if (directives.length === 0 && values.length === 0) { - throw this.unexpected(); - } - return this.node(start, { - kind: Kind.ENUM_TYPE_EXTENSION, - name, - directives, - values - }); - } - /** - * InputObjectTypeExtension : - * - extend input Name Directives[Const]? InputFieldsDefinition - * - extend input Name Directives[Const] - */ - parseInputObjectTypeExtension() { - const start = this._lexer.token; - this.expectKeyword("extend"); - this.expectKeyword("input"); - const name = this.parseName(); - const directives = this.parseConstDirectives(); - const fields = this.parseInputFieldsDefinition(); - if (directives.length === 0 && fields.length === 0) { - throw this.unexpected(); - } - return this.node(start, { - kind: Kind.INPUT_OBJECT_TYPE_EXTENSION, - name, - directives, - fields - }); - } - /** - * ``` - * DirectiveDefinition : - * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations - * ``` - */ - parseDirectiveDefinition() { - const start = this._lexer.token; - const description = this.parseDescription(); - this.expectKeyword("directive"); - this.expectToken(TokenKind.AT); - const name = this.parseName(); - const args = this.parseArgumentDefs(); - const repeatable = this.expectOptionalKeyword("repeatable"); - this.expectKeyword("on"); - const locations = this.parseDirectiveLocations(); - return this.node(start, { - kind: Kind.DIRECTIVE_DEFINITION, - description, - name, - arguments: args, - repeatable, - locations - }); - } - /** - * DirectiveLocations : - * - `|`? DirectiveLocation - * - DirectiveLocations | DirectiveLocation - */ - parseDirectiveLocations() { - return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation); - } - /* - * DirectiveLocation : - * - ExecutableDirectiveLocation - * - TypeSystemDirectiveLocation - * - * ExecutableDirectiveLocation : one of - * `QUERY` - * `MUTATION` - * `SUBSCRIPTION` - * `FIELD` - * `FRAGMENT_DEFINITION` - * `FRAGMENT_SPREAD` - * `INLINE_FRAGMENT` - * - * TypeSystemDirectiveLocation : one of - * `SCHEMA` - * `SCALAR` - * `OBJECT` - * `FIELD_DEFINITION` - * `ARGUMENT_DEFINITION` - * `INTERFACE` - * `UNION` - * `ENUM` - * `ENUM_VALUE` - * `INPUT_OBJECT` - * `INPUT_FIELD_DEFINITION` - */ - parseDirectiveLocation() { - const start = this._lexer.token; - const name = this.parseName(); - if (Object.prototype.hasOwnProperty.call(DirectiveLocation, name.value)) { - return name; - } - throw this.unexpected(start); - } - // Core parsing utility functions - /** - * Returns a node that, if configured to do so, sets a "loc" field as a - * location object, used to identify the place in the source that created a - * given parsed object. - */ - node(startToken, node) { - if (this._options.noLocation !== true) { - node.loc = new Location( - startToken, - this._lexer.lastToken, - this._lexer.source - ); - } - return node; - } - /** - * Determines if the next token is of a given kind - */ - peek(kind) { - return this._lexer.token.kind === kind; - } - /** - * If the next token is of the given kind, return that token after advancing the lexer. - * Otherwise, do not change the parser state and throw an error. - */ - expectToken(kind) { - const token = this._lexer.token; - if (token.kind === kind) { - this.advanceLexer(); - return token; - } - throw syntaxError( - this._lexer.source, - token.start, - `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.` - ); - } - /** - * If the next token is of the given kind, return "true" after advancing the lexer. - * Otherwise, do not change the parser state and return "false". - */ - expectOptionalToken(kind) { - const token = this._lexer.token; - if (token.kind === kind) { - this.advanceLexer(); - return true; - } - return false; - } - /** - * If the next token is a given keyword, advance the lexer. - * Otherwise, do not change the parser state and throw an error. - */ - expectKeyword(value) { - const token = this._lexer.token; - if (token.kind === TokenKind.NAME && token.value === value) { - this.advanceLexer(); - } else { - throw syntaxError( - this._lexer.source, - token.start, - `Expected "${value}", found ${getTokenDesc(token)}.` - ); - } - } - /** - * If the next token is a given keyword, return "true" after advancing the lexer. - * Otherwise, do not change the parser state and return "false". - */ - expectOptionalKeyword(value) { - const token = this._lexer.token; - if (token.kind === TokenKind.NAME && token.value === value) { - this.advanceLexer(); - return true; - } - return false; - } - /** - * Helper function for creating an error when an unexpected lexed token is encountered. - */ - unexpected(atToken) { - const token = atToken !== null && atToken !== void 0 ? atToken : this._lexer.token; - return syntaxError( - this._lexer.source, - token.start, - `Unexpected ${getTokenDesc(token)}.` - ); - } - /** - * Returns a possibly empty list of parse nodes, determined by the parseFn. - * This list begins with a lex token of openKind and ends with a lex token of closeKind. - * Advances the parser to the next lex token after the closing token. - */ - any(openKind, parseFn, closeKind) { - this.expectToken(openKind); - const nodes = []; - while (!this.expectOptionalToken(closeKind)) { - nodes.push(parseFn.call(this)); - } - return nodes; - } - /** - * Returns a list of parse nodes, determined by the parseFn. - * It can be empty only if open token is missing otherwise it will always return non-empty list - * that begins with a lex token of openKind and ends with a lex token of closeKind. - * Advances the parser to the next lex token after the closing token. - */ - optionalMany(openKind, parseFn, closeKind) { - if (this.expectOptionalToken(openKind)) { - const nodes = []; - do { - nodes.push(parseFn.call(this)); - } while (!this.expectOptionalToken(closeKind)); - return nodes; - } - return []; - } - /** - * Returns a non-empty list of parse nodes, determined by the parseFn. - * This list begins with a lex token of openKind and ends with a lex token of closeKind. - * Advances the parser to the next lex token after the closing token. - */ - many(openKind, parseFn, closeKind) { - this.expectToken(openKind); - const nodes = []; - do { - nodes.push(parseFn.call(this)); - } while (!this.expectOptionalToken(closeKind)); - return nodes; - } - /** - * Returns a non-empty list of parse nodes, determined by the parseFn. - * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind. - * Advances the parser to the next lex token after last item in the list. - */ - delimitedMany(delimiterKind, parseFn) { - this.expectOptionalToken(delimiterKind); - const nodes = []; - do { - nodes.push(parseFn.call(this)); - } while (this.expectOptionalToken(delimiterKind)); - return nodes; - } - advanceLexer() { - const { maxTokens } = this._options; - const token = this._lexer.advance(); - if (maxTokens !== void 0 && token.kind !== TokenKind.EOF) { - ++this._tokenCounter; - if (this._tokenCounter > maxTokens) { - throw syntaxError( - this._lexer.source, - token.start, - `Document contains more that ${maxTokens} tokens. Parsing aborted.` - ); - } - } - } -}; -function getTokenDesc(token) { - const value = token.value; - return getTokenKindDesc(token.kind) + (value != null ? ` "${value}"` : ""); -} -function getTokenKindDesc(kind) { - return isPunctuatorTokenKind(kind) ? `"${kind}"` : kind; -} - -// node_modules/graphql/jsutils/didYouMean.mjs -var MAX_SUGGESTIONS = 5; -function didYouMean(firstArg, secondArg) { - const [subMessage, suggestionsArg] = secondArg ? [firstArg, secondArg] : [void 0, firstArg]; - let message = " Did you mean "; - if (subMessage) { - message += subMessage + " "; - } - const suggestions = suggestionsArg.map((x) => `"${x}"`); - switch (suggestions.length) { - case 0: - return ""; - case 1: - return message + suggestions[0] + "?"; - case 2: - return message + suggestions[0] + " or " + suggestions[1] + "?"; - } - const selected = suggestions.slice(0, MAX_SUGGESTIONS); - const lastItem = selected.pop(); - return message + selected.join(", ") + ", or " + lastItem + "?"; -} - -// node_modules/graphql/jsutils/identityFunc.mjs -function identityFunc(x) { - return x; -} - -// node_modules/graphql/jsutils/keyMap.mjs -function keyMap(list, keyFn) { - const result = /* @__PURE__ */ Object.create(null); - for (const item of list) { - result[keyFn(item)] = item; - } - return result; -} - -// node_modules/graphql/jsutils/keyValMap.mjs -function keyValMap(list, keyFn, valFn) { - const result = /* @__PURE__ */ Object.create(null); - for (const item of list) { - result[keyFn(item)] = valFn(item); - } - return result; -} - -// node_modules/graphql/jsutils/mapValue.mjs -function mapValue(map, fn) { - const result = /* @__PURE__ */ Object.create(null); - for (const key of Object.keys(map)) { - result[key] = fn(map[key], key); - } - return result; -} - -// node_modules/graphql/jsutils/naturalCompare.mjs -function naturalCompare(aStr, bStr) { - let aIndex = 0; - let bIndex = 0; - while (aIndex < aStr.length && bIndex < bStr.length) { - let aChar = aStr.charCodeAt(aIndex); - let bChar = bStr.charCodeAt(bIndex); - if (isDigit2(aChar) && isDigit2(bChar)) { - let aNum = 0; - do { - ++aIndex; - aNum = aNum * 10 + aChar - DIGIT_0; - aChar = aStr.charCodeAt(aIndex); - } while (isDigit2(aChar) && aNum > 0); - let bNum = 0; - do { - ++bIndex; - bNum = bNum * 10 + bChar - DIGIT_0; - bChar = bStr.charCodeAt(bIndex); - } while (isDigit2(bChar) && bNum > 0); - if (aNum < bNum) { - return -1; - } - if (aNum > bNum) { - return 1; - } - } else { - if (aChar < bChar) { - return -1; - } - if (aChar > bChar) { - return 1; - } - ++aIndex; - ++bIndex; - } - } - return aStr.length - bStr.length; -} -var DIGIT_0 = 48; -var DIGIT_9 = 57; -function isDigit2(code) { - return !isNaN(code) && DIGIT_0 <= code && code <= DIGIT_9; -} - -// node_modules/graphql/jsutils/suggestionList.mjs -function suggestionList(input, options) { - const optionsByDistance = /* @__PURE__ */ Object.create(null); - const lexicalDistance = new LexicalDistance(input); - const threshold = Math.floor(input.length * 0.4) + 1; - for (const option of options) { - const distance = lexicalDistance.measure(option, threshold); - if (distance !== void 0) { - optionsByDistance[option] = distance; - } - } - return Object.keys(optionsByDistance).sort((a, b) => { - const distanceDiff = optionsByDistance[a] - optionsByDistance[b]; - return distanceDiff !== 0 ? distanceDiff : naturalCompare(a, b); - }); -} -var LexicalDistance = class { - constructor(input) { - this._input = input; - this._inputLowerCase = input.toLowerCase(); - this._inputArray = stringToArray(this._inputLowerCase); - this._rows = [ - new Array(input.length + 1).fill(0), - new Array(input.length + 1).fill(0), - new Array(input.length + 1).fill(0) - ]; - } - measure(option, threshold) { - if (this._input === option) { - return 0; - } - const optionLowerCase = option.toLowerCase(); - if (this._inputLowerCase === optionLowerCase) { - return 1; - } - let a = stringToArray(optionLowerCase); - let b = this._inputArray; - if (a.length < b.length) { - const tmp = a; - a = b; - b = tmp; - } - const aLength = a.length; - const bLength = b.length; - if (aLength - bLength > threshold) { - return void 0; - } - const rows = this._rows; - for (let j = 0; j <= bLength; j++) { - rows[0][j] = j; - } - for (let i = 1; i <= aLength; i++) { - const upRow = rows[(i - 1) % 3]; - const currentRow = rows[i % 3]; - let smallestCell = currentRow[0] = i; - for (let j = 1; j <= bLength; j++) { - const cost = a[i - 1] === b[j - 1] ? 0 : 1; - let currentCell = Math.min( - upRow[j] + 1, - // delete - currentRow[j - 1] + 1, - // insert - upRow[j - 1] + cost - // substitute - ); - if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) { - const doubleDiagonalCell = rows[(i - 2) % 3][j - 2]; - currentCell = Math.min(currentCell, doubleDiagonalCell + 1); - } - if (currentCell < smallestCell) { - smallestCell = currentCell; - } - currentRow[j] = currentCell; - } - if (smallestCell > threshold) { - return void 0; - } - } - const distance = rows[aLength % 3][bLength]; - return distance <= threshold ? distance : void 0; - } -}; -function stringToArray(str) { - const strLength = str.length; - const array = new Array(strLength); - for (let i = 0; i < strLength; ++i) { - array[i] = str.charCodeAt(i); - } - return array; -} - -// node_modules/graphql/jsutils/toObjMap.mjs -function toObjMap(obj) { - if (obj == null) { - return /* @__PURE__ */ Object.create(null); - } - if (Object.getPrototypeOf(obj) === null) { - return obj; - } - const map = /* @__PURE__ */ Object.create(null); - for (const [key, value] of Object.entries(obj)) { - map[key] = value; - } - return map; -} - -// node_modules/graphql/language/printString.mjs -function printString(str) { - return `"${str.replace(escapedRegExp, escapedReplacer)}"`; -} -var escapedRegExp = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g; -function escapedReplacer(str) { - return escapeSequences[str.charCodeAt(0)]; -} -var escapeSequences = [ - "\\u0000", - "\\u0001", - "\\u0002", - "\\u0003", - "\\u0004", - "\\u0005", - "\\u0006", - "\\u0007", - "\\b", - "\\t", - "\\n", - "\\u000B", - "\\f", - "\\r", - "\\u000E", - "\\u000F", - "\\u0010", - "\\u0011", - "\\u0012", - "\\u0013", - "\\u0014", - "\\u0015", - "\\u0016", - "\\u0017", - "\\u0018", - "\\u0019", - "\\u001A", - "\\u001B", - "\\u001C", - "\\u001D", - "\\u001E", - "\\u001F", - "", - "", - '\\"', - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - // 2F - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - // 3F - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - // 4F - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "\\\\", - "", - "", - "", - // 5F - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - // 6F - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "\\u007F", - "\\u0080", - "\\u0081", - "\\u0082", - "\\u0083", - "\\u0084", - "\\u0085", - "\\u0086", - "\\u0087", - "\\u0088", - "\\u0089", - "\\u008A", - "\\u008B", - "\\u008C", - "\\u008D", - "\\u008E", - "\\u008F", - "\\u0090", - "\\u0091", - "\\u0092", - "\\u0093", - "\\u0094", - "\\u0095", - "\\u0096", - "\\u0097", - "\\u0098", - "\\u0099", - "\\u009A", - "\\u009B", - "\\u009C", - "\\u009D", - "\\u009E", - "\\u009F" -]; - -// node_modules/graphql/language/visitor.mjs -var BREAK = Object.freeze({}); -function visit(root, visitor, visitorKeys = QueryDocumentKeys) { - const enterLeaveMap = /* @__PURE__ */ new Map(); - for (const kind of Object.values(Kind)) { - enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind)); - } - let stack = void 0; - let inArray = Array.isArray(root); - let keys = [root]; - let index = -1; - let edits = []; - let node = root; - let key = void 0; - let parent = void 0; - const path = []; - const ancestors = []; - do { - index++; - const isLeaving = index === keys.length; - const isEdited = isLeaving && edits.length !== 0; - if (isLeaving) { - key = ancestors.length === 0 ? void 0 : path[path.length - 1]; - node = parent; - parent = ancestors.pop(); - if (isEdited) { - if (inArray) { - node = node.slice(); - let editOffset = 0; - for (const [editKey, editValue] of edits) { - const arrayKey = editKey - editOffset; - if (editValue === null) { - node.splice(arrayKey, 1); - editOffset++; - } else { - node[arrayKey] = editValue; - } - } - } else { - node = Object.defineProperties( - {}, - Object.getOwnPropertyDescriptors(node) - ); - for (const [editKey, editValue] of edits) { - node[editKey] = editValue; - } - } - } - index = stack.index; - keys = stack.keys; - edits = stack.edits; - inArray = stack.inArray; - stack = stack.prev; - } else if (parent) { - key = inArray ? index : keys[index]; - node = parent[key]; - if (node === null || node === void 0) { - continue; - } - path.push(key); - } - let result; - if (!Array.isArray(node)) { - var _enterLeaveMap$get, _enterLeaveMap$get2; - isNode(node) || devAssert(false, `Invalid AST Node: ${inspect(node)}.`); - const visitFn = isLeaving ? (_enterLeaveMap$get = enterLeaveMap.get(node.kind)) === null || _enterLeaveMap$get === void 0 ? void 0 : _enterLeaveMap$get.leave : (_enterLeaveMap$get2 = enterLeaveMap.get(node.kind)) === null || _enterLeaveMap$get2 === void 0 ? void 0 : _enterLeaveMap$get2.enter; - result = visitFn === null || visitFn === void 0 ? void 0 : visitFn.call(visitor, node, key, parent, path, ancestors); - if (result === BREAK) { - break; - } - if (result === false) { - if (!isLeaving) { - path.pop(); - continue; - } - } else if (result !== void 0) { - edits.push([key, result]); - if (!isLeaving) { - if (isNode(result)) { - node = result; - } else { - path.pop(); - continue; - } - } - } - } - if (result === void 0 && isEdited) { - edits.push([key, node]); - } - if (isLeaving) { - path.pop(); - } else { - var _node$kind; - stack = { - inArray, - index, - keys, - edits, - prev: stack - }; - inArray = Array.isArray(node); - keys = inArray ? node : (_node$kind = visitorKeys[node.kind]) !== null && _node$kind !== void 0 ? _node$kind : []; - index = -1; - edits = []; - if (parent) { - ancestors.push(parent); - } - parent = node; - } - } while (stack !== void 0); - if (edits.length !== 0) { - return edits[edits.length - 1][1]; - } - return root; -} -function visitInParallel(visitors) { - const skipping = new Array(visitors.length).fill(null); - const mergedVisitor = /* @__PURE__ */ Object.create(null); - for (const kind of Object.values(Kind)) { - let hasVisitor = false; - const enterList = new Array(visitors.length).fill(void 0); - const leaveList = new Array(visitors.length).fill(void 0); - for (let i = 0; i < visitors.length; ++i) { - const { enter, leave } = getEnterLeaveForKind(visitors[i], kind); - hasVisitor || (hasVisitor = enter != null || leave != null); - enterList[i] = enter; - leaveList[i] = leave; - } - if (!hasVisitor) { - continue; - } - const mergedEnterLeave = { - enter(...args) { - const node = args[0]; - for (let i = 0; i < visitors.length; i++) { - if (skipping[i] === null) { - var _enterList$i; - const result = (_enterList$i = enterList[i]) === null || _enterList$i === void 0 ? void 0 : _enterList$i.apply(visitors[i], args); - if (result === false) { - skipping[i] = node; - } else if (result === BREAK) { - skipping[i] = BREAK; - } else if (result !== void 0) { - return result; - } - } - } - }, - leave(...args) { - const node = args[0]; - for (let i = 0; i < visitors.length; i++) { - if (skipping[i] === null) { - var _leaveList$i; - const result = (_leaveList$i = leaveList[i]) === null || _leaveList$i === void 0 ? void 0 : _leaveList$i.apply(visitors[i], args); - if (result === BREAK) { - skipping[i] = BREAK; - } else if (result !== void 0 && result !== false) { - return result; - } - } else if (skipping[i] === node) { - skipping[i] = null; - } - } - } - }; - mergedVisitor[kind] = mergedEnterLeave; - } - return mergedVisitor; -} -function getEnterLeaveForKind(visitor, kind) { - const kindVisitor = visitor[kind]; - if (typeof kindVisitor === "object") { - return kindVisitor; - } else if (typeof kindVisitor === "function") { - return { - enter: kindVisitor, - leave: void 0 - }; - } - return { - enter: visitor.enter, - leave: visitor.leave - }; -} -function getVisitFn(visitor, kind, isLeaving) { - const { enter, leave } = getEnterLeaveForKind(visitor, kind); - return isLeaving ? leave : enter; -} - -// node_modules/graphql/language/printer.mjs -function print(ast) { - return visit(ast, printDocASTReducer); -} -var MAX_LINE_LENGTH = 80; -var printDocASTReducer = { - Name: { - leave: (node) => node.value - }, - Variable: { - leave: (node) => "$" + node.name - }, - // Document - Document: { - leave: (node) => join(node.definitions, "\n\n") - }, - OperationDefinition: { - leave(node) { - const varDefs = wrap("(", join(node.variableDefinitions, ", "), ")"); - const prefix = join( - [ - node.operation, - join([node.name, varDefs]), - join(node.directives, " ") - ], - " " - ); - return (prefix === "query" ? "" : prefix + " ") + node.selectionSet; - } - }, - VariableDefinition: { - leave: ({ variable, type, defaultValue, directives }) => variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ", join(directives, " ")) - }, - SelectionSet: { - leave: ({ selections }) => block(selections) - }, - Field: { - leave({ alias, name, arguments: args, directives, selectionSet }) { - const prefix = wrap("", alias, ": ") + name; - let argsLine = prefix + wrap("(", join(args, ", "), ")"); - if (argsLine.length > MAX_LINE_LENGTH) { - argsLine = prefix + wrap("(\n", indent(join(args, "\n")), "\n)"); - } - return join([argsLine, join(directives, " "), selectionSet], " "); - } - }, - Argument: { - leave: ({ name, value }) => name + ": " + value - }, - // Fragments - FragmentSpread: { - leave: ({ name, directives }) => "..." + name + wrap(" ", join(directives, " ")) - }, - InlineFragment: { - leave: ({ typeCondition, directives, selectionSet }) => join( - [ - "...", - wrap("on ", typeCondition), - join(directives, " "), - selectionSet - ], - " " - ) - }, - FragmentDefinition: { - leave: ({ name, typeCondition, variableDefinitions, directives, selectionSet }) => ( - // or removed in the future. - `fragment ${name}${wrap("(", join(variableDefinitions, ", "), ")")} on ${typeCondition} ${wrap("", join(directives, " "), " ")}` + selectionSet - ) - }, - // Value - IntValue: { - leave: ({ value }) => value - }, - FloatValue: { - leave: ({ value }) => value - }, - StringValue: { - leave: ({ value, block: isBlockString }) => isBlockString ? printBlockString(value) : printString(value) - }, - BooleanValue: { - leave: ({ value }) => value ? "true" : "false" - }, - NullValue: { - leave: () => "null" - }, - EnumValue: { - leave: ({ value }) => value - }, - ListValue: { - leave: ({ values }) => "[" + join(values, ", ") + "]" - }, - ObjectValue: { - leave: ({ fields }) => "{" + join(fields, ", ") + "}" - }, - ObjectField: { - leave: ({ name, value }) => name + ": " + value - }, - // Directive - Directive: { - leave: ({ name, arguments: args }) => "@" + name + wrap("(", join(args, ", "), ")") - }, - // Type - NamedType: { - leave: ({ name }) => name - }, - ListType: { - leave: ({ type }) => "[" + type + "]" - }, - NonNullType: { - leave: ({ type }) => type + "!" - }, - // Type System Definitions - SchemaDefinition: { - leave: ({ description, directives, operationTypes }) => wrap("", description, "\n") + join(["schema", join(directives, " "), block(operationTypes)], " ") - }, - OperationTypeDefinition: { - leave: ({ operation, type }) => operation + ": " + type - }, - ScalarTypeDefinition: { - leave: ({ description, name, directives }) => wrap("", description, "\n") + join(["scalar", name, join(directives, " ")], " ") - }, - ObjectTypeDefinition: { - leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join( - [ - "type", - name, - wrap("implements ", join(interfaces, " & ")), - join(directives, " "), - block(fields) - ], - " " - ) - }, - FieldDefinition: { - leave: ({ description, name, arguments: args, type, directives }) => wrap("", description, "\n") + name + (hasMultilineItems(args) ? wrap("(\n", indent(join(args, "\n")), "\n)") : wrap("(", join(args, ", "), ")")) + ": " + type + wrap(" ", join(directives, " ")) - }, - InputValueDefinition: { - leave: ({ description, name, type, defaultValue, directives }) => wrap("", description, "\n") + join( - [name + ": " + type, wrap("= ", defaultValue), join(directives, " ")], - " " - ) - }, - InterfaceTypeDefinition: { - leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join( - [ - "interface", - name, - wrap("implements ", join(interfaces, " & ")), - join(directives, " "), - block(fields) - ], - " " - ) - }, - UnionTypeDefinition: { - leave: ({ description, name, directives, types }) => wrap("", description, "\n") + join( - ["union", name, join(directives, " "), wrap("= ", join(types, " | "))], - " " - ) - }, - EnumTypeDefinition: { - leave: ({ description, name, directives, values }) => wrap("", description, "\n") + join(["enum", name, join(directives, " "), block(values)], " ") - }, - EnumValueDefinition: { - leave: ({ description, name, directives }) => wrap("", description, "\n") + join([name, join(directives, " ")], " ") - }, - InputObjectTypeDefinition: { - leave: ({ description, name, directives, fields }) => wrap("", description, "\n") + join(["input", name, join(directives, " "), block(fields)], " ") - }, - DirectiveDefinition: { - leave: ({ description, name, arguments: args, repeatable, locations }) => wrap("", description, "\n") + "directive @" + name + (hasMultilineItems(args) ? wrap("(\n", indent(join(args, "\n")), "\n)") : wrap("(", join(args, ", "), ")")) + (repeatable ? " repeatable" : "") + " on " + join(locations, " | ") - }, - SchemaExtension: { - leave: ({ directives, operationTypes }) => join( - ["extend schema", join(directives, " "), block(operationTypes)], - " " - ) - }, - ScalarTypeExtension: { - leave: ({ name, directives }) => join(["extend scalar", name, join(directives, " ")], " ") - }, - ObjectTypeExtension: { - leave: ({ name, interfaces, directives, fields }) => join( - [ - "extend type", - name, - wrap("implements ", join(interfaces, " & ")), - join(directives, " "), - block(fields) - ], - " " - ) - }, - InterfaceTypeExtension: { - leave: ({ name, interfaces, directives, fields }) => join( - [ - "extend interface", - name, - wrap("implements ", join(interfaces, " & ")), - join(directives, " "), - block(fields) - ], - " " - ) - }, - UnionTypeExtension: { - leave: ({ name, directives, types }) => join( - [ - "extend union", - name, - join(directives, " "), - wrap("= ", join(types, " | ")) - ], - " " - ) - }, - EnumTypeExtension: { - leave: ({ name, directives, values }) => join(["extend enum", name, join(directives, " "), block(values)], " ") - }, - InputObjectTypeExtension: { - leave: ({ name, directives, fields }) => join(["extend input", name, join(directives, " "), block(fields)], " ") - } -}; -function join(maybeArray, separator = "") { - var _maybeArray$filter$jo; - return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter((x) => x).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : ""; -} -function block(array) { - return wrap("{\n", indent(join(array, "\n")), "\n}"); -} -function wrap(start, maybeString, end = "") { - return maybeString != null && maybeString !== "" ? start + maybeString + end : ""; -} -function indent(str) { - return wrap(" ", str.replace(/\n/g, "\n ")); -} -function hasMultilineItems(maybeArray) { - var _maybeArray$some; - return (_maybeArray$some = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.some((str) => str.includes("\n"))) !== null && _maybeArray$some !== void 0 ? _maybeArray$some : false; -} - -// node_modules/graphql/utilities/valueFromASTUntyped.mjs -function valueFromASTUntyped(valueNode, variables) { - switch (valueNode.kind) { - case Kind.NULL: - return null; - case Kind.INT: - return parseInt(valueNode.value, 10); - case Kind.FLOAT: - return parseFloat(valueNode.value); - case Kind.STRING: - case Kind.ENUM: - case Kind.BOOLEAN: - return valueNode.value; - case Kind.LIST: - return valueNode.values.map( - (node) => valueFromASTUntyped(node, variables) - ); - case Kind.OBJECT: - return keyValMap( - valueNode.fields, - (field) => field.name.value, - (field) => valueFromASTUntyped(field.value, variables) - ); - case Kind.VARIABLE: - return variables === null || variables === void 0 ? void 0 : variables[valueNode.name.value]; - } -} - -// node_modules/graphql/type/assertName.mjs -function assertName(name) { - name != null || devAssert(false, "Must provide name."); - typeof name === "string" || devAssert(false, "Expected name to be a string."); - if (name.length === 0) { - throw new GraphQLError("Expected name to be a non-empty string."); - } - for (let i = 1; i < name.length; ++i) { - if (!isNameContinue(name.charCodeAt(i))) { - throw new GraphQLError( - `Names must only contain [_a-zA-Z0-9] but "${name}" does not.` - ); - } - } - if (!isNameStart(name.charCodeAt(0))) { - throw new GraphQLError( - `Names must start with [_a-zA-Z] but "${name}" does not.` - ); - } - return name; -} -function assertEnumValueName(name) { - if (name === "true" || name === "false" || name === "null") { - throw new GraphQLError(`Enum values cannot be named: ${name}`); - } - return assertName(name); -} - -// node_modules/graphql/type/definition.mjs -function isType(type) { - return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isInputObjectType(type) || isListType(type) || isNonNullType(type); -} -function assertType(type) { - if (!isType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL type.`); - } - return type; -} -function isScalarType(type) { - return instanceOf(type, GraphQLScalarType); -} -function assertScalarType(type) { - if (!isScalarType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL Scalar type.`); - } - return type; -} -function isObjectType(type) { - return instanceOf(type, GraphQLObjectType); -} -function assertObjectType(type) { - if (!isObjectType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL Object type.`); - } - return type; -} -function isInterfaceType(type) { - return instanceOf(type, GraphQLInterfaceType); -} -function assertInterfaceType(type) { - if (!isInterfaceType(type)) { - throw new Error( - `Expected ${inspect(type)} to be a GraphQL Interface type.` - ); - } - return type; -} -function isUnionType(type) { - return instanceOf(type, GraphQLUnionType); -} -function assertUnionType(type) { - if (!isUnionType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL Union type.`); - } - return type; -} -function isEnumType(type) { - return instanceOf(type, GraphQLEnumType); -} -function assertEnumType(type) { - if (!isEnumType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL Enum type.`); - } - return type; -} -function isInputObjectType(type) { - return instanceOf(type, GraphQLInputObjectType); -} -function assertInputObjectType(type) { - if (!isInputObjectType(type)) { - throw new Error( - `Expected ${inspect(type)} to be a GraphQL Input Object type.` - ); - } - return type; -} -function isListType(type) { - return instanceOf(type, GraphQLList); -} -function assertListType(type) { - if (!isListType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL List type.`); - } - return type; -} -function isNonNullType(type) { - return instanceOf(type, GraphQLNonNull); -} -function assertNonNullType(type) { - if (!isNonNullType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL Non-Null type.`); - } - return type; -} -function isInputType(type) { - return isScalarType(type) || isEnumType(type) || isInputObjectType(type) || isWrappingType(type) && isInputType(type.ofType); -} -function assertInputType(type) { - if (!isInputType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL input type.`); - } - return type; -} -function isOutputType(type) { - return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isWrappingType(type) && isOutputType(type.ofType); -} -function assertOutputType(type) { - if (!isOutputType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL output type.`); - } - return type; -} -function isLeafType(type) { - return isScalarType(type) || isEnumType(type); -} -function assertLeafType(type) { - if (!isLeafType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL leaf type.`); - } - return type; -} -function isCompositeType(type) { - return isObjectType(type) || isInterfaceType(type) || isUnionType(type); -} -function assertCompositeType(type) { - if (!isCompositeType(type)) { - throw new Error( - `Expected ${inspect(type)} to be a GraphQL composite type.` - ); - } - return type; -} -function isAbstractType(type) { - return isInterfaceType(type) || isUnionType(type); -} -function assertAbstractType(type) { - if (!isAbstractType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL abstract type.`); - } - return type; -} -var GraphQLList = class { - constructor(ofType) { - isType(ofType) || devAssert(false, `Expected ${inspect(ofType)} to be a GraphQL type.`); - this.ofType = ofType; - } - get [Symbol.toStringTag]() { - return "GraphQLList"; - } - toString() { - return "[" + String(this.ofType) + "]"; - } - toJSON() { - return this.toString(); - } -}; -var GraphQLNonNull = class { - constructor(ofType) { - isNullableType(ofType) || devAssert( - false, - `Expected ${inspect(ofType)} to be a GraphQL nullable type.` - ); - this.ofType = ofType; - } - get [Symbol.toStringTag]() { - return "GraphQLNonNull"; - } - toString() { - return String(this.ofType) + "!"; - } - toJSON() { - return this.toString(); - } -}; -function isWrappingType(type) { - return isListType(type) || isNonNullType(type); -} -function assertWrappingType(type) { - if (!isWrappingType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL wrapping type.`); - } - return type; -} -function isNullableType(type) { - return isType(type) && !isNonNullType(type); -} -function assertNullableType(type) { - if (!isNullableType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL nullable type.`); - } - return type; -} -function getNullableType(type) { - if (type) { - return isNonNullType(type) ? type.ofType : type; - } -} -function isNamedType(type) { - return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isInputObjectType(type); -} -function assertNamedType(type) { - if (!isNamedType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL named type.`); - } - return type; -} -function getNamedType(type) { - if (type) { - let unwrappedType = type; - while (isWrappingType(unwrappedType)) { - unwrappedType = unwrappedType.ofType; - } - return unwrappedType; - } -} -function resolveReadonlyArrayThunk(thunk) { - return typeof thunk === "function" ? thunk() : thunk; -} -function resolveObjMapThunk(thunk) { - return typeof thunk === "function" ? thunk() : thunk; -} -var GraphQLScalarType = class { - constructor(config) { - var _config$parseValue, _config$serialize, _config$parseLiteral, _config$extensionASTN; - const parseValue2 = (_config$parseValue = config.parseValue) !== null && _config$parseValue !== void 0 ? _config$parseValue : identityFunc; - this.name = assertName(config.name); - this.description = config.description; - this.specifiedByURL = config.specifiedByURL; - this.serialize = (_config$serialize = config.serialize) !== null && _config$serialize !== void 0 ? _config$serialize : identityFunc; - this.parseValue = parseValue2; - this.parseLiteral = (_config$parseLiteral = config.parseLiteral) !== null && _config$parseLiteral !== void 0 ? _config$parseLiteral : (node, variables) => parseValue2(valueFromASTUntyped(node, variables)); - this.extensions = toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = (_config$extensionASTN = config.extensionASTNodes) !== null && _config$extensionASTN !== void 0 ? _config$extensionASTN : []; - config.specifiedByURL == null || typeof config.specifiedByURL === "string" || devAssert( - false, - `${this.name} must provide "specifiedByURL" as a string, but got: ${inspect(config.specifiedByURL)}.` - ); - config.serialize == null || typeof config.serialize === "function" || devAssert( - false, - `${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.` - ); - if (config.parseLiteral) { - typeof config.parseValue === "function" && typeof config.parseLiteral === "function" || devAssert( - false, - `${this.name} must provide both "parseValue" and "parseLiteral" functions.` - ); - } - } - get [Symbol.toStringTag]() { - return "GraphQLScalarType"; - } - toConfig() { - return { - name: this.name, - description: this.description, - specifiedByURL: this.specifiedByURL, - serialize: this.serialize, - parseValue: this.parseValue, - parseLiteral: this.parseLiteral, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes - }; - } - toString() { - return this.name; - } - toJSON() { - return this.toString(); - } -}; -var GraphQLObjectType = class { - constructor(config) { - var _config$extensionASTN2; - this.name = assertName(config.name); - this.description = config.description; - this.isTypeOf = config.isTypeOf; - this.extensions = toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = (_config$extensionASTN2 = config.extensionASTNodes) !== null && _config$extensionASTN2 !== void 0 ? _config$extensionASTN2 : []; - this._fields = () => defineFieldMap(config); - this._interfaces = () => defineInterfaces(config); - config.isTypeOf == null || typeof config.isTypeOf === "function" || devAssert( - false, - `${this.name} must provide "isTypeOf" as a function, but got: ${inspect(config.isTypeOf)}.` - ); - } - get [Symbol.toStringTag]() { - return "GraphQLObjectType"; - } - getFields() { - if (typeof this._fields === "function") { - this._fields = this._fields(); - } - return this._fields; - } - getInterfaces() { - if (typeof this._interfaces === "function") { - this._interfaces = this._interfaces(); - } - return this._interfaces; - } - toConfig() { - return { - name: this.name, - description: this.description, - interfaces: this.getInterfaces(), - fields: fieldsToFieldsConfig(this.getFields()), - isTypeOf: this.isTypeOf, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes - }; - } - toString() { - return this.name; - } - toJSON() { - return this.toString(); - } -}; -function defineInterfaces(config) { - var _config$interfaces; - const interfaces = resolveReadonlyArrayThunk( - (_config$interfaces = config.interfaces) !== null && _config$interfaces !== void 0 ? _config$interfaces : [] - ); - Array.isArray(interfaces) || devAssert( - false, - `${config.name} interfaces must be an Array or a function which returns an Array.` - ); - return interfaces; -} -function defineFieldMap(config) { - const fieldMap = resolveObjMapThunk(config.fields); - isPlainObj(fieldMap) || devAssert( - false, - `${config.name} fields must be an object with field names as keys or a function which returns such an object.` - ); - return mapValue(fieldMap, (fieldConfig, fieldName) => { - var _fieldConfig$args; - isPlainObj(fieldConfig) || devAssert( - false, - `${config.name}.${fieldName} field config must be an object.` - ); - fieldConfig.resolve == null || typeof fieldConfig.resolve === "function" || devAssert( - false, - `${config.name}.${fieldName} field resolver must be a function if provided, but got: ${inspect(fieldConfig.resolve)}.` - ); - const argsConfig = (_fieldConfig$args = fieldConfig.args) !== null && _fieldConfig$args !== void 0 ? _fieldConfig$args : {}; - isPlainObj(argsConfig) || devAssert( - false, - `${config.name}.${fieldName} args must be an object with argument names as keys.` - ); - return { - name: assertName(fieldName), - description: fieldConfig.description, - type: fieldConfig.type, - args: defineArguments(argsConfig), - resolve: fieldConfig.resolve, - subscribe: fieldConfig.subscribe, - deprecationReason: fieldConfig.deprecationReason, - extensions: toObjMap(fieldConfig.extensions), - astNode: fieldConfig.astNode - }; - }); -} -function defineArguments(config) { - return Object.entries(config).map(([argName, argConfig]) => ({ - name: assertName(argName), - description: argConfig.description, - type: argConfig.type, - defaultValue: argConfig.defaultValue, - deprecationReason: argConfig.deprecationReason, - extensions: toObjMap(argConfig.extensions), - astNode: argConfig.astNode - })); -} -function isPlainObj(obj) { - return isObjectLike(obj) && !Array.isArray(obj); -} -function fieldsToFieldsConfig(fields) { - return mapValue(fields, (field) => ({ - description: field.description, - type: field.type, - args: argsToArgsConfig(field.args), - resolve: field.resolve, - subscribe: field.subscribe, - deprecationReason: field.deprecationReason, - extensions: field.extensions, - astNode: field.astNode - })); -} -function argsToArgsConfig(args) { - return keyValMap( - args, - (arg) => arg.name, - (arg) => ({ - description: arg.description, - type: arg.type, - defaultValue: arg.defaultValue, - deprecationReason: arg.deprecationReason, - extensions: arg.extensions, - astNode: arg.astNode - }) - ); -} -function isRequiredArgument(arg) { - return isNonNullType(arg.type) && arg.defaultValue === void 0; -} -var GraphQLInterfaceType = class { - constructor(config) { - var _config$extensionASTN3; - this.name = assertName(config.name); - this.description = config.description; - this.resolveType = config.resolveType; - this.extensions = toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = (_config$extensionASTN3 = config.extensionASTNodes) !== null && _config$extensionASTN3 !== void 0 ? _config$extensionASTN3 : []; - this._fields = defineFieldMap.bind(void 0, config); - this._interfaces = defineInterfaces.bind(void 0, config); - config.resolveType == null || typeof config.resolveType === "function" || devAssert( - false, - `${this.name} must provide "resolveType" as a function, but got: ${inspect(config.resolveType)}.` - ); - } - get [Symbol.toStringTag]() { - return "GraphQLInterfaceType"; - } - getFields() { - if (typeof this._fields === "function") { - this._fields = this._fields(); - } - return this._fields; - } - getInterfaces() { - if (typeof this._interfaces === "function") { - this._interfaces = this._interfaces(); - } - return this._interfaces; - } - toConfig() { - return { - name: this.name, - description: this.description, - interfaces: this.getInterfaces(), - fields: fieldsToFieldsConfig(this.getFields()), - resolveType: this.resolveType, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes - }; - } - toString() { - return this.name; - } - toJSON() { - return this.toString(); - } -}; -var GraphQLUnionType = class { - constructor(config) { - var _config$extensionASTN4; - this.name = assertName(config.name); - this.description = config.description; - this.resolveType = config.resolveType; - this.extensions = toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = (_config$extensionASTN4 = config.extensionASTNodes) !== null && _config$extensionASTN4 !== void 0 ? _config$extensionASTN4 : []; - this._types = defineTypes.bind(void 0, config); - config.resolveType == null || typeof config.resolveType === "function" || devAssert( - false, - `${this.name} must provide "resolveType" as a function, but got: ${inspect(config.resolveType)}.` - ); - } - get [Symbol.toStringTag]() { - return "GraphQLUnionType"; - } - getTypes() { - if (typeof this._types === "function") { - this._types = this._types(); - } - return this._types; - } - toConfig() { - return { - name: this.name, - description: this.description, - types: this.getTypes(), - resolveType: this.resolveType, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes - }; - } - toString() { - return this.name; - } - toJSON() { - return this.toString(); - } -}; -function defineTypes(config) { - const types = resolveReadonlyArrayThunk(config.types); - Array.isArray(types) || devAssert( - false, - `Must provide Array of types or a function which returns such an array for Union ${config.name}.` - ); - return types; -} -var GraphQLEnumType = class { - /* */ - constructor(config) { - var _config$extensionASTN5; - this.name = assertName(config.name); - this.description = config.description; - this.extensions = toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = (_config$extensionASTN5 = config.extensionASTNodes) !== null && _config$extensionASTN5 !== void 0 ? _config$extensionASTN5 : []; - this._values = defineEnumValues(this.name, config.values); - this._valueLookup = new Map( - this._values.map((enumValue) => [enumValue.value, enumValue]) - ); - this._nameLookup = keyMap(this._values, (value) => value.name); - } - get [Symbol.toStringTag]() { - return "GraphQLEnumType"; - } - getValues() { - return this._values; - } - getValue(name) { - return this._nameLookup[name]; - } - serialize(outputValue) { - const enumValue = this._valueLookup.get(outputValue); - if (enumValue === void 0) { - throw new GraphQLError( - `Enum "${this.name}" cannot represent value: ${inspect(outputValue)}` - ); - } - return enumValue.name; - } - parseValue(inputValue) { - if (typeof inputValue !== "string") { - const valueStr = inspect(inputValue); - throw new GraphQLError( - `Enum "${this.name}" cannot represent non-string value: ${valueStr}.` + didYouMeanEnumValue(this, valueStr) - ); - } - const enumValue = this.getValue(inputValue); - if (enumValue == null) { - throw new GraphQLError( - `Value "${inputValue}" does not exist in "${this.name}" enum.` + didYouMeanEnumValue(this, inputValue) - ); - } - return enumValue.value; - } - parseLiteral(valueNode, _variables) { - if (valueNode.kind !== Kind.ENUM) { - const valueStr = print(valueNode); - throw new GraphQLError( - `Enum "${this.name}" cannot represent non-enum value: ${valueStr}.` + didYouMeanEnumValue(this, valueStr), - { - nodes: valueNode - } - ); - } - const enumValue = this.getValue(valueNode.value); - if (enumValue == null) { - const valueStr = print(valueNode); - throw new GraphQLError( - `Value "${valueStr}" does not exist in "${this.name}" enum.` + didYouMeanEnumValue(this, valueStr), - { - nodes: valueNode - } - ); - } - return enumValue.value; - } - toConfig() { - const values = keyValMap( - this.getValues(), - (value) => value.name, - (value) => ({ - description: value.description, - value: value.value, - deprecationReason: value.deprecationReason, - extensions: value.extensions, - astNode: value.astNode - }) - ); - return { - name: this.name, - description: this.description, - values, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes - }; - } - toString() { - return this.name; - } - toJSON() { - return this.toString(); - } -}; -function didYouMeanEnumValue(enumType, unknownValueStr) { - const allNames = enumType.getValues().map((value) => value.name); - const suggestedValues = suggestionList(unknownValueStr, allNames); - return didYouMean("the enum value", suggestedValues); -} -function defineEnumValues(typeName, valueMap) { - isPlainObj(valueMap) || devAssert( - false, - `${typeName} values must be an object with value names as keys.` - ); - return Object.entries(valueMap).map(([valueName, valueConfig]) => { - isPlainObj(valueConfig) || devAssert( - false, - `${typeName}.${valueName} must refer to an object with a "value" key representing an internal value but got: ${inspect(valueConfig)}.` - ); - return { - name: assertEnumValueName(valueName), - description: valueConfig.description, - value: valueConfig.value !== void 0 ? valueConfig.value : valueName, - deprecationReason: valueConfig.deprecationReason, - extensions: toObjMap(valueConfig.extensions), - astNode: valueConfig.astNode - }; - }); -} -var GraphQLInputObjectType = class { - constructor(config) { - var _config$extensionASTN6; - this.name = assertName(config.name); - this.description = config.description; - this.extensions = toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = (_config$extensionASTN6 = config.extensionASTNodes) !== null && _config$extensionASTN6 !== void 0 ? _config$extensionASTN6 : []; - this._fields = defineInputFieldMap.bind(void 0, config); - } - get [Symbol.toStringTag]() { - return "GraphQLInputObjectType"; - } - getFields() { - if (typeof this._fields === "function") { - this._fields = this._fields(); - } - return this._fields; - } - toConfig() { - const fields = mapValue(this.getFields(), (field) => ({ - description: field.description, - type: field.type, - defaultValue: field.defaultValue, - deprecationReason: field.deprecationReason, - extensions: field.extensions, - astNode: field.astNode - })); - return { - name: this.name, - description: this.description, - fields, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes - }; - } - toString() { - return this.name; - } - toJSON() { - return this.toString(); - } -}; -function defineInputFieldMap(config) { - const fieldMap = resolveObjMapThunk(config.fields); - isPlainObj(fieldMap) || devAssert( - false, - `${config.name} fields must be an object with field names as keys or a function which returns such an object.` - ); - return mapValue(fieldMap, (fieldConfig, fieldName) => { - !("resolve" in fieldConfig) || devAssert( - false, - `${config.name}.${fieldName} field has a resolve property, but Input Types cannot define resolvers.` - ); - return { - name: assertName(fieldName), - description: fieldConfig.description, - type: fieldConfig.type, - defaultValue: fieldConfig.defaultValue, - deprecationReason: fieldConfig.deprecationReason, - extensions: toObjMap(fieldConfig.extensions), - astNode: fieldConfig.astNode - }; - }); -} -function isRequiredInputField(field) { - return isNonNullType(field.type) && field.defaultValue === void 0; -} - -// node_modules/graphql/utilities/typeComparators.mjs -function isEqualType(typeA, typeB) { - if (typeA === typeB) { - return true; - } - if (isNonNullType(typeA) && isNonNullType(typeB)) { - return isEqualType(typeA.ofType, typeB.ofType); - } - if (isListType(typeA) && isListType(typeB)) { - return isEqualType(typeA.ofType, typeB.ofType); - } - return false; -} -function isTypeSubTypeOf(schema, maybeSubType, superType) { - if (maybeSubType === superType) { - return true; - } - if (isNonNullType(superType)) { - if (isNonNullType(maybeSubType)) { - return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); - } - return false; - } - if (isNonNullType(maybeSubType)) { - return isTypeSubTypeOf(schema, maybeSubType.ofType, superType); - } - if (isListType(superType)) { - if (isListType(maybeSubType)) { - return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); - } - return false; - } - if (isListType(maybeSubType)) { - return false; - } - return isAbstractType(superType) && (isInterfaceType(maybeSubType) || isObjectType(maybeSubType)) && schema.isSubType(superType, maybeSubType); -} -function doTypesOverlap(schema, typeA, typeB) { - if (typeA === typeB) { - return true; - } - if (isAbstractType(typeA)) { - if (isAbstractType(typeB)) { - return schema.getPossibleTypes(typeA).some((type) => schema.isSubType(typeB, type)); - } - return schema.isSubType(typeA, typeB); - } - if (isAbstractType(typeB)) { - return schema.isSubType(typeB, typeA); - } - return false; -} - -// node_modules/graphql/type/scalars.mjs -var GRAPHQL_MAX_INT = 2147483647; -var GRAPHQL_MIN_INT = -2147483648; -var GraphQLInt = new GraphQLScalarType({ - name: "Int", - description: "The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.", - serialize(outputValue) { - const coercedValue = serializeObject(outputValue); - if (typeof coercedValue === "boolean") { - return coercedValue ? 1 : 0; - } - let num = coercedValue; - if (typeof coercedValue === "string" && coercedValue !== "") { - num = Number(coercedValue); - } - if (typeof num !== "number" || !Number.isInteger(num)) { - throw new GraphQLError( - `Int cannot represent non-integer value: ${inspect(coercedValue)}` - ); - } - if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) { - throw new GraphQLError( - "Int cannot represent non 32-bit signed integer value: " + inspect(coercedValue) - ); - } - return num; - }, - parseValue(inputValue) { - if (typeof inputValue !== "number" || !Number.isInteger(inputValue)) { - throw new GraphQLError( - `Int cannot represent non-integer value: ${inspect(inputValue)}` - ); - } - if (inputValue > GRAPHQL_MAX_INT || inputValue < GRAPHQL_MIN_INT) { - throw new GraphQLError( - `Int cannot represent non 32-bit signed integer value: ${inputValue}` - ); - } - return inputValue; - }, - parseLiteral(valueNode) { - if (valueNode.kind !== Kind.INT) { - throw new GraphQLError( - `Int cannot represent non-integer value: ${print(valueNode)}`, - { - nodes: valueNode - } - ); - } - const num = parseInt(valueNode.value, 10); - if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) { - throw new GraphQLError( - `Int cannot represent non 32-bit signed integer value: ${valueNode.value}`, - { - nodes: valueNode - } - ); - } - return num; - } -}); -var GraphQLFloat = new GraphQLScalarType({ - name: "Float", - description: "The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).", - serialize(outputValue) { - const coercedValue = serializeObject(outputValue); - if (typeof coercedValue === "boolean") { - return coercedValue ? 1 : 0; - } - let num = coercedValue; - if (typeof coercedValue === "string" && coercedValue !== "") { - num = Number(coercedValue); - } - if (typeof num !== "number" || !Number.isFinite(num)) { - throw new GraphQLError( - `Float cannot represent non numeric value: ${inspect(coercedValue)}` - ); - } - return num; - }, - parseValue(inputValue) { - if (typeof inputValue !== "number" || !Number.isFinite(inputValue)) { - throw new GraphQLError( - `Float cannot represent non numeric value: ${inspect(inputValue)}` - ); - } - return inputValue; - }, - parseLiteral(valueNode) { - if (valueNode.kind !== Kind.FLOAT && valueNode.kind !== Kind.INT) { - throw new GraphQLError( - `Float cannot represent non numeric value: ${print(valueNode)}`, - valueNode - ); - } - return parseFloat(valueNode.value); - } -}); -var GraphQLString = new GraphQLScalarType({ - name: "String", - description: "The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.", - serialize(outputValue) { - const coercedValue = serializeObject(outputValue); - if (typeof coercedValue === "string") { - return coercedValue; - } - if (typeof coercedValue === "boolean") { - return coercedValue ? "true" : "false"; - } - if (typeof coercedValue === "number" && Number.isFinite(coercedValue)) { - return coercedValue.toString(); - } - throw new GraphQLError( - `String cannot represent value: ${inspect(outputValue)}` - ); - }, - parseValue(inputValue) { - if (typeof inputValue !== "string") { - throw new GraphQLError( - `String cannot represent a non string value: ${inspect(inputValue)}` - ); - } - return inputValue; - }, - parseLiteral(valueNode) { - if (valueNode.kind !== Kind.STRING) { - throw new GraphQLError( - `String cannot represent a non string value: ${print(valueNode)}`, - { - nodes: valueNode - } - ); - } - return valueNode.value; - } -}); -var GraphQLBoolean = new GraphQLScalarType({ - name: "Boolean", - description: "The `Boolean` scalar type represents `true` or `false`.", - serialize(outputValue) { - const coercedValue = serializeObject(outputValue); - if (typeof coercedValue === "boolean") { - return coercedValue; - } - if (Number.isFinite(coercedValue)) { - return coercedValue !== 0; - } - throw new GraphQLError( - `Boolean cannot represent a non boolean value: ${inspect(coercedValue)}` - ); - }, - parseValue(inputValue) { - if (typeof inputValue !== "boolean") { - throw new GraphQLError( - `Boolean cannot represent a non boolean value: ${inspect(inputValue)}` - ); - } - return inputValue; - }, - parseLiteral(valueNode) { - if (valueNode.kind !== Kind.BOOLEAN) { - throw new GraphQLError( - `Boolean cannot represent a non boolean value: ${print(valueNode)}`, - { - nodes: valueNode - } - ); - } - return valueNode.value; - } -}); -var GraphQLID = new GraphQLScalarType({ - name: "ID", - description: 'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.', - serialize(outputValue) { - const coercedValue = serializeObject(outputValue); - if (typeof coercedValue === "string") { - return coercedValue; - } - if (Number.isInteger(coercedValue)) { - return String(coercedValue); - } - throw new GraphQLError( - `ID cannot represent value: ${inspect(outputValue)}` - ); - }, - parseValue(inputValue) { - if (typeof inputValue === "string") { - return inputValue; - } - if (typeof inputValue === "number" && Number.isInteger(inputValue)) { - return inputValue.toString(); - } - throw new GraphQLError(`ID cannot represent value: ${inspect(inputValue)}`); - }, - parseLiteral(valueNode) { - if (valueNode.kind !== Kind.STRING && valueNode.kind !== Kind.INT) { - throw new GraphQLError( - "ID cannot represent a non-string and non-integer value: " + print(valueNode), - { - nodes: valueNode - } - ); - } - return valueNode.value; - } -}); -var specifiedScalarTypes = Object.freeze([ - GraphQLString, - GraphQLInt, - GraphQLFloat, - GraphQLBoolean, - GraphQLID -]); -function isSpecifiedScalarType(type) { - return specifiedScalarTypes.some(({ name }) => type.name === name); -} -function serializeObject(outputValue) { - if (isObjectLike(outputValue)) { - if (typeof outputValue.valueOf === "function") { - const valueOfResult = outputValue.valueOf(); - if (!isObjectLike(valueOfResult)) { - return valueOfResult; - } - } - if (typeof outputValue.toJSON === "function") { - return outputValue.toJSON(); - } - } - return outputValue; -} - -// node_modules/graphql/type/directives.mjs -function isDirective(directive) { - return instanceOf(directive, GraphQLDirective); -} -function assertDirective(directive) { - if (!isDirective(directive)) { - throw new Error( - `Expected ${inspect(directive)} to be a GraphQL directive.` - ); - } - return directive; -} -var GraphQLDirective = class { - constructor(config) { - var _config$isRepeatable, _config$args; - this.name = assertName(config.name); - this.description = config.description; - this.locations = config.locations; - this.isRepeatable = (_config$isRepeatable = config.isRepeatable) !== null && _config$isRepeatable !== void 0 ? _config$isRepeatable : false; - this.extensions = toObjMap(config.extensions); - this.astNode = config.astNode; - Array.isArray(config.locations) || devAssert(false, `@${config.name} locations must be an Array.`); - const args = (_config$args = config.args) !== null && _config$args !== void 0 ? _config$args : {}; - isObjectLike(args) && !Array.isArray(args) || devAssert( - false, - `@${config.name} args must be an object with argument names as keys.` - ); - this.args = defineArguments(args); - } - get [Symbol.toStringTag]() { - return "GraphQLDirective"; - } - toConfig() { - return { - name: this.name, - description: this.description, - locations: this.locations, - args: argsToArgsConfig(this.args), - isRepeatable: this.isRepeatable, - extensions: this.extensions, - astNode: this.astNode - }; - } - toString() { - return "@" + this.name; - } - toJSON() { - return this.toString(); - } -}; -var GraphQLIncludeDirective = new GraphQLDirective({ - name: "include", - description: "Directs the executor to include this field or fragment only when the `if` argument is true.", - locations: [ - DirectiveLocation.FIELD, - DirectiveLocation.FRAGMENT_SPREAD, - DirectiveLocation.INLINE_FRAGMENT - ], - args: { - if: { - type: new GraphQLNonNull(GraphQLBoolean), - description: "Included when true." - } - } -}); -var GraphQLSkipDirective = new GraphQLDirective({ - name: "skip", - description: "Directs the executor to skip this field or fragment when the `if` argument is true.", - locations: [ - DirectiveLocation.FIELD, - DirectiveLocation.FRAGMENT_SPREAD, - DirectiveLocation.INLINE_FRAGMENT - ], - args: { - if: { - type: new GraphQLNonNull(GraphQLBoolean), - description: "Skipped when true." - } - } -}); -var DEFAULT_DEPRECATION_REASON = "No longer supported"; -var GraphQLDeprecatedDirective = new GraphQLDirective({ - name: "deprecated", - description: "Marks an element of a GraphQL schema as no longer supported.", - locations: [ - DirectiveLocation.FIELD_DEFINITION, - DirectiveLocation.ARGUMENT_DEFINITION, - DirectiveLocation.INPUT_FIELD_DEFINITION, - DirectiveLocation.ENUM_VALUE - ], - args: { - reason: { - type: GraphQLString, - description: "Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).", - defaultValue: DEFAULT_DEPRECATION_REASON - } - } -}); -var GraphQLSpecifiedByDirective = new GraphQLDirective({ - name: "specifiedBy", - description: "Exposes a URL that specifies the behavior of this scalar.", - locations: [DirectiveLocation.SCALAR], - args: { - url: { - type: new GraphQLNonNull(GraphQLString), - description: "The URL that specifies the behavior of this scalar." - } - } -}); -var specifiedDirectives = Object.freeze([ - GraphQLIncludeDirective, - GraphQLSkipDirective, - GraphQLDeprecatedDirective, - GraphQLSpecifiedByDirective -]); -function isSpecifiedDirective(directive) { - return specifiedDirectives.some(({ name }) => name === directive.name); -} - -// node_modules/graphql/jsutils/isIterableObject.mjs -function isIterableObject(maybeIterable) { - return typeof maybeIterable === "object" && typeof (maybeIterable === null || maybeIterable === void 0 ? void 0 : maybeIterable[Symbol.iterator]) === "function"; -} - -// node_modules/graphql/utilities/astFromValue.mjs -function astFromValue(value, type) { - if (isNonNullType(type)) { - const astValue = astFromValue(value, type.ofType); - if ((astValue === null || astValue === void 0 ? void 0 : astValue.kind) === Kind.NULL) { - return null; - } - return astValue; - } - if (value === null) { - return { - kind: Kind.NULL - }; - } - if (value === void 0) { - return null; - } - if (isListType(type)) { - const itemType = type.ofType; - if (isIterableObject(value)) { - const valuesNodes = []; - for (const item of value) { - const itemNode = astFromValue(item, itemType); - if (itemNode != null) { - valuesNodes.push(itemNode); - } - } - return { - kind: Kind.LIST, - values: valuesNodes - }; - } - return astFromValue(value, itemType); - } - if (isInputObjectType(type)) { - if (!isObjectLike(value)) { - return null; - } - const fieldNodes = []; - for (const field of Object.values(type.getFields())) { - const fieldValue = astFromValue(value[field.name], field.type); - if (fieldValue) { - fieldNodes.push({ - kind: Kind.OBJECT_FIELD, - name: { - kind: Kind.NAME, - value: field.name - }, - value: fieldValue - }); - } - } - return { - kind: Kind.OBJECT, - fields: fieldNodes - }; - } - if (isLeafType(type)) { - const serialized = type.serialize(value); - if (serialized == null) { - return null; - } - if (typeof serialized === "boolean") { - return { - kind: Kind.BOOLEAN, - value: serialized - }; - } - if (typeof serialized === "number" && Number.isFinite(serialized)) { - const stringNum = String(serialized); - return integerStringRegExp.test(stringNum) ? { - kind: Kind.INT, - value: stringNum - } : { - kind: Kind.FLOAT, - value: stringNum - }; - } - if (typeof serialized === "string") { - if (isEnumType(type)) { - return { - kind: Kind.ENUM, - value: serialized - }; - } - if (type === GraphQLID && integerStringRegExp.test(serialized)) { - return { - kind: Kind.INT, - value: serialized - }; - } - return { - kind: Kind.STRING, - value: serialized - }; - } - throw new TypeError(`Cannot convert value to AST: ${inspect(serialized)}.`); - } - invariant(false, "Unexpected input type: " + inspect(type)); -} -var integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/; - -// node_modules/graphql/type/introspection.mjs -var __Schema = new GraphQLObjectType({ - name: "__Schema", - description: "A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.", - fields: () => ({ - description: { - type: GraphQLString, - resolve: (schema) => schema.description - }, - types: { - description: "A list of all types supported by this server.", - type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__Type))), - resolve(schema) { - return Object.values(schema.getTypeMap()); - } - }, - queryType: { - description: "The type that query operations will be rooted at.", - type: new GraphQLNonNull(__Type), - resolve: (schema) => schema.getQueryType() - }, - mutationType: { - description: "If this server supports mutation, the type that mutation operations will be rooted at.", - type: __Type, - resolve: (schema) => schema.getMutationType() - }, - subscriptionType: { - description: "If this server support subscription, the type that subscription operations will be rooted at.", - type: __Type, - resolve: (schema) => schema.getSubscriptionType() - }, - directives: { - description: "A list of all directives supported by this server.", - type: new GraphQLNonNull( - new GraphQLList(new GraphQLNonNull(__Directive)) - ), - resolve: (schema) => schema.getDirectives() - } - }) -}); -var __Directive = new GraphQLObjectType({ - name: "__Directive", - description: "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", - fields: () => ({ - name: { - type: new GraphQLNonNull(GraphQLString), - resolve: (directive) => directive.name - }, - description: { - type: GraphQLString, - resolve: (directive) => directive.description - }, - isRepeatable: { - type: new GraphQLNonNull(GraphQLBoolean), - resolve: (directive) => directive.isRepeatable - }, - locations: { - type: new GraphQLNonNull( - new GraphQLList(new GraphQLNonNull(__DirectiveLocation)) - ), - resolve: (directive) => directive.locations - }, - args: { - type: new GraphQLNonNull( - new GraphQLList(new GraphQLNonNull(__InputValue)) - ), - args: { - includeDeprecated: { - type: GraphQLBoolean, - defaultValue: false - } - }, - resolve(field, { includeDeprecated }) { - return includeDeprecated ? field.args : field.args.filter((arg) => arg.deprecationReason == null); - } - } - }) -}); -var __DirectiveLocation = new GraphQLEnumType({ - name: "__DirectiveLocation", - description: "A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.", - values: { - QUERY: { - value: DirectiveLocation.QUERY, - description: "Location adjacent to a query operation." - }, - MUTATION: { - value: DirectiveLocation.MUTATION, - description: "Location adjacent to a mutation operation." - }, - SUBSCRIPTION: { - value: DirectiveLocation.SUBSCRIPTION, - description: "Location adjacent to a subscription operation." - }, - FIELD: { - value: DirectiveLocation.FIELD, - description: "Location adjacent to a field." - }, - FRAGMENT_DEFINITION: { - value: DirectiveLocation.FRAGMENT_DEFINITION, - description: "Location adjacent to a fragment definition." - }, - FRAGMENT_SPREAD: { - value: DirectiveLocation.FRAGMENT_SPREAD, - description: "Location adjacent to a fragment spread." - }, - INLINE_FRAGMENT: { - value: DirectiveLocation.INLINE_FRAGMENT, - description: "Location adjacent to an inline fragment." - }, - VARIABLE_DEFINITION: { - value: DirectiveLocation.VARIABLE_DEFINITION, - description: "Location adjacent to a variable definition." - }, - SCHEMA: { - value: DirectiveLocation.SCHEMA, - description: "Location adjacent to a schema definition." - }, - SCALAR: { - value: DirectiveLocation.SCALAR, - description: "Location adjacent to a scalar definition." - }, - OBJECT: { - value: DirectiveLocation.OBJECT, - description: "Location adjacent to an object type definition." - }, - FIELD_DEFINITION: { - value: DirectiveLocation.FIELD_DEFINITION, - description: "Location adjacent to a field definition." - }, - ARGUMENT_DEFINITION: { - value: DirectiveLocation.ARGUMENT_DEFINITION, - description: "Location adjacent to an argument definition." - }, - INTERFACE: { - value: DirectiveLocation.INTERFACE, - description: "Location adjacent to an interface definition." - }, - UNION: { - value: DirectiveLocation.UNION, - description: "Location adjacent to a union definition." - }, - ENUM: { - value: DirectiveLocation.ENUM, - description: "Location adjacent to an enum definition." - }, - ENUM_VALUE: { - value: DirectiveLocation.ENUM_VALUE, - description: "Location adjacent to an enum value definition." - }, - INPUT_OBJECT: { - value: DirectiveLocation.INPUT_OBJECT, - description: "Location adjacent to an input object type definition." - }, - INPUT_FIELD_DEFINITION: { - value: DirectiveLocation.INPUT_FIELD_DEFINITION, - description: "Location adjacent to an input object field definition." - } - } -}); -var __Type = new GraphQLObjectType({ - name: "__Type", - description: "The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.", - fields: () => ({ - kind: { - type: new GraphQLNonNull(__TypeKind), - resolve(type) { - if (isScalarType(type)) { - return TypeKind.SCALAR; - } - if (isObjectType(type)) { - return TypeKind.OBJECT; - } - if (isInterfaceType(type)) { - return TypeKind.INTERFACE; - } - if (isUnionType(type)) { - return TypeKind.UNION; - } - if (isEnumType(type)) { - return TypeKind.ENUM; - } - if (isInputObjectType(type)) { - return TypeKind.INPUT_OBJECT; - } - if (isListType(type)) { - return TypeKind.LIST; - } - if (isNonNullType(type)) { - return TypeKind.NON_NULL; - } - invariant(false, `Unexpected type: "${inspect(type)}".`); - } - }, - name: { - type: GraphQLString, - resolve: (type) => "name" in type ? type.name : void 0 - }, - description: { - type: GraphQLString, - resolve: (type) => ( - /* c8 ignore next */ - "description" in type ? type.description : void 0 - ) - }, - specifiedByURL: { - type: GraphQLString, - resolve: (obj) => "specifiedByURL" in obj ? obj.specifiedByURL : void 0 - }, - fields: { - type: new GraphQLList(new GraphQLNonNull(__Field)), - args: { - includeDeprecated: { - type: GraphQLBoolean, - defaultValue: false - } - }, - resolve(type, { includeDeprecated }) { - if (isObjectType(type) || isInterfaceType(type)) { - const fields = Object.values(type.getFields()); - return includeDeprecated ? fields : fields.filter((field) => field.deprecationReason == null); - } - } - }, - interfaces: { - type: new GraphQLList(new GraphQLNonNull(__Type)), - resolve(type) { - if (isObjectType(type) || isInterfaceType(type)) { - return type.getInterfaces(); - } - } - }, - possibleTypes: { - type: new GraphQLList(new GraphQLNonNull(__Type)), - resolve(type, _args, _context, { schema }) { - if (isAbstractType(type)) { - return schema.getPossibleTypes(type); - } - } - }, - enumValues: { - type: new GraphQLList(new GraphQLNonNull(__EnumValue)), - args: { - includeDeprecated: { - type: GraphQLBoolean, - defaultValue: false - } - }, - resolve(type, { includeDeprecated }) { - if (isEnumType(type)) { - const values = type.getValues(); - return includeDeprecated ? values : values.filter((field) => field.deprecationReason == null); - } - } - }, - inputFields: { - type: new GraphQLList(new GraphQLNonNull(__InputValue)), - args: { - includeDeprecated: { - type: GraphQLBoolean, - defaultValue: false - } - }, - resolve(type, { includeDeprecated }) { - if (isInputObjectType(type)) { - const values = Object.values(type.getFields()); - return includeDeprecated ? values : values.filter((field) => field.deprecationReason == null); - } - } - }, - ofType: { - type: __Type, - resolve: (type) => "ofType" in type ? type.ofType : void 0 - } - }) -}); -var __Field = new GraphQLObjectType({ - name: "__Field", - description: "Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.", - fields: () => ({ - name: { - type: new GraphQLNonNull(GraphQLString), - resolve: (field) => field.name - }, - description: { - type: GraphQLString, - resolve: (field) => field.description - }, - args: { - type: new GraphQLNonNull( - new GraphQLList(new GraphQLNonNull(__InputValue)) - ), - args: { - includeDeprecated: { - type: GraphQLBoolean, - defaultValue: false - } - }, - resolve(field, { includeDeprecated }) { - return includeDeprecated ? field.args : field.args.filter((arg) => arg.deprecationReason == null); - } - }, - type: { - type: new GraphQLNonNull(__Type), - resolve: (field) => field.type - }, - isDeprecated: { - type: new GraphQLNonNull(GraphQLBoolean), - resolve: (field) => field.deprecationReason != null - }, - deprecationReason: { - type: GraphQLString, - resolve: (field) => field.deprecationReason - } - }) -}); -var __InputValue = new GraphQLObjectType({ - name: "__InputValue", - description: "Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.", - fields: () => ({ - name: { - type: new GraphQLNonNull(GraphQLString), - resolve: (inputValue) => inputValue.name - }, - description: { - type: GraphQLString, - resolve: (inputValue) => inputValue.description - }, - type: { - type: new GraphQLNonNull(__Type), - resolve: (inputValue) => inputValue.type - }, - defaultValue: { - type: GraphQLString, - description: "A GraphQL-formatted string representing the default value for this input value.", - resolve(inputValue) { - const { type, defaultValue } = inputValue; - const valueAST = astFromValue(defaultValue, type); - return valueAST ? print(valueAST) : null; - } - }, - isDeprecated: { - type: new GraphQLNonNull(GraphQLBoolean), - resolve: (field) => field.deprecationReason != null - }, - deprecationReason: { - type: GraphQLString, - resolve: (obj) => obj.deprecationReason - } - }) -}); -var __EnumValue = new GraphQLObjectType({ - name: "__EnumValue", - description: "One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.", - fields: () => ({ - name: { - type: new GraphQLNonNull(GraphQLString), - resolve: (enumValue) => enumValue.name - }, - description: { - type: GraphQLString, - resolve: (enumValue) => enumValue.description - }, - isDeprecated: { - type: new GraphQLNonNull(GraphQLBoolean), - resolve: (enumValue) => enumValue.deprecationReason != null - }, - deprecationReason: { - type: GraphQLString, - resolve: (enumValue) => enumValue.deprecationReason - } - }) -}); -var TypeKind; -(function(TypeKind2) { - TypeKind2["SCALAR"] = "SCALAR"; - TypeKind2["OBJECT"] = "OBJECT"; - TypeKind2["INTERFACE"] = "INTERFACE"; - TypeKind2["UNION"] = "UNION"; - TypeKind2["ENUM"] = "ENUM"; - TypeKind2["INPUT_OBJECT"] = "INPUT_OBJECT"; - TypeKind2["LIST"] = "LIST"; - TypeKind2["NON_NULL"] = "NON_NULL"; -})(TypeKind || (TypeKind = {})); -var __TypeKind = new GraphQLEnumType({ - name: "__TypeKind", - description: "An enum describing what kind of type a given `__Type` is.", - values: { - SCALAR: { - value: TypeKind.SCALAR, - description: "Indicates this type is a scalar." - }, - OBJECT: { - value: TypeKind.OBJECT, - description: "Indicates this type is an object. `fields` and `interfaces` are valid fields." - }, - INTERFACE: { - value: TypeKind.INTERFACE, - description: "Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields." - }, - UNION: { - value: TypeKind.UNION, - description: "Indicates this type is a union. `possibleTypes` is a valid field." - }, - ENUM: { - value: TypeKind.ENUM, - description: "Indicates this type is an enum. `enumValues` is a valid field." - }, - INPUT_OBJECT: { - value: TypeKind.INPUT_OBJECT, - description: "Indicates this type is an input object. `inputFields` is a valid field." - }, - LIST: { - value: TypeKind.LIST, - description: "Indicates this type is a list. `ofType` is a valid field." - }, - NON_NULL: { - value: TypeKind.NON_NULL, - description: "Indicates this type is a non-null. `ofType` is a valid field." - } - } -}); -var SchemaMetaFieldDef = { - name: "__schema", - type: new GraphQLNonNull(__Schema), - description: "Access the current type schema of this server.", - args: [], - resolve: (_source, _args, _context, { schema }) => schema, - deprecationReason: void 0, - extensions: /* @__PURE__ */ Object.create(null), - astNode: void 0 -}; -var TypeMetaFieldDef = { - name: "__type", - type: __Type, - description: "Request the type information of a single type.", - args: [ - { - name: "name", - description: void 0, - type: new GraphQLNonNull(GraphQLString), - defaultValue: void 0, - deprecationReason: void 0, - extensions: /* @__PURE__ */ Object.create(null), - astNode: void 0 - } - ], - resolve: (_source, { name }, _context, { schema }) => schema.getType(name), - deprecationReason: void 0, - extensions: /* @__PURE__ */ Object.create(null), - astNode: void 0 -}; -var TypeNameMetaFieldDef = { - name: "__typename", - type: new GraphQLNonNull(GraphQLString), - description: "The name of the current Object type at runtime.", - args: [], - resolve: (_source, _args, _context, { parentType }) => parentType.name, - deprecationReason: void 0, - extensions: /* @__PURE__ */ Object.create(null), - astNode: void 0 -}; -var introspectionTypes = Object.freeze([ - __Schema, - __Directive, - __DirectiveLocation, - __Type, - __Field, - __InputValue, - __EnumValue, - __TypeKind -]); -function isIntrospectionType(type) { - return introspectionTypes.some(({ name }) => type.name === name); -} - -// node_modules/graphql/type/schema.mjs -function isSchema(schema) { - return instanceOf(schema, GraphQLSchema); -} -function assertSchema(schema) { - if (!isSchema(schema)) { - throw new Error(`Expected ${inspect(schema)} to be a GraphQL schema.`); - } - return schema; -} -var GraphQLSchema = class { - // Used as a cache for validateSchema(). - constructor(config) { - var _config$extensionASTN, _config$directives; - this.__validationErrors = config.assumeValid === true ? [] : void 0; - isObjectLike(config) || devAssert(false, "Must provide configuration object."); - !config.types || Array.isArray(config.types) || devAssert( - false, - `"types" must be Array if provided but got: ${inspect(config.types)}.` - ); - !config.directives || Array.isArray(config.directives) || devAssert( - false, - `"directives" must be Array if provided but got: ${inspect(config.directives)}.` - ); - this.description = config.description; - this.extensions = toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = (_config$extensionASTN = config.extensionASTNodes) !== null && _config$extensionASTN !== void 0 ? _config$extensionASTN : []; - this._queryType = config.query; - this._mutationType = config.mutation; - this._subscriptionType = config.subscription; - this._directives = (_config$directives = config.directives) !== null && _config$directives !== void 0 ? _config$directives : specifiedDirectives; - const allReferencedTypes = new Set(config.types); - if (config.types != null) { - for (const type of config.types) { - allReferencedTypes.delete(type); - collectReferencedTypes(type, allReferencedTypes); - } - } - if (this._queryType != null) { - collectReferencedTypes(this._queryType, allReferencedTypes); - } - if (this._mutationType != null) { - collectReferencedTypes(this._mutationType, allReferencedTypes); - } - if (this._subscriptionType != null) { - collectReferencedTypes(this._subscriptionType, allReferencedTypes); - } - for (const directive of this._directives) { - if (isDirective(directive)) { - for (const arg of directive.args) { - collectReferencedTypes(arg.type, allReferencedTypes); - } - } - } - collectReferencedTypes(__Schema, allReferencedTypes); - this._typeMap = /* @__PURE__ */ Object.create(null); - this._subTypeMap = /* @__PURE__ */ Object.create(null); - this._implementationsMap = /* @__PURE__ */ Object.create(null); - for (const namedType of allReferencedTypes) { - if (namedType == null) { - continue; - } - const typeName = namedType.name; - typeName || devAssert( - false, - "One of the provided types for building the Schema is missing a name." - ); - if (this._typeMap[typeName] !== void 0) { - throw new Error( - `Schema must contain uniquely named types but contains multiple types named "${typeName}".` - ); - } - this._typeMap[typeName] = namedType; - if (isInterfaceType(namedType)) { - for (const iface of namedType.getInterfaces()) { - if (isInterfaceType(iface)) { - let implementations = this._implementationsMap[iface.name]; - if (implementations === void 0) { - implementations = this._implementationsMap[iface.name] = { - objects: [], - interfaces: [] - }; - } - implementations.interfaces.push(namedType); - } - } - } else if (isObjectType(namedType)) { - for (const iface of namedType.getInterfaces()) { - if (isInterfaceType(iface)) { - let implementations = this._implementationsMap[iface.name]; - if (implementations === void 0) { - implementations = this._implementationsMap[iface.name] = { - objects: [], - interfaces: [] - }; - } - implementations.objects.push(namedType); - } - } - } - } - } - get [Symbol.toStringTag]() { - return "GraphQLSchema"; - } - getQueryType() { - return this._queryType; - } - getMutationType() { - return this._mutationType; - } - getSubscriptionType() { - return this._subscriptionType; - } - getRootType(operation) { - switch (operation) { - case OperationTypeNode.QUERY: - return this.getQueryType(); - case OperationTypeNode.MUTATION: - return this.getMutationType(); - case OperationTypeNode.SUBSCRIPTION: - return this.getSubscriptionType(); - } - } - getTypeMap() { - return this._typeMap; - } - getType(name) { - return this.getTypeMap()[name]; - } - getPossibleTypes(abstractType) { - return isUnionType(abstractType) ? abstractType.getTypes() : this.getImplementations(abstractType).objects; - } - getImplementations(interfaceType) { - const implementations = this._implementationsMap[interfaceType.name]; - return implementations !== null && implementations !== void 0 ? implementations : { - objects: [], - interfaces: [] - }; - } - isSubType(abstractType, maybeSubType) { - let map = this._subTypeMap[abstractType.name]; - if (map === void 0) { - map = /* @__PURE__ */ Object.create(null); - if (isUnionType(abstractType)) { - for (const type of abstractType.getTypes()) { - map[type.name] = true; - } - } else { - const implementations = this.getImplementations(abstractType); - for (const type of implementations.objects) { - map[type.name] = true; - } - for (const type of implementations.interfaces) { - map[type.name] = true; - } - } - this._subTypeMap[abstractType.name] = map; - } - return map[maybeSubType.name] !== void 0; - } - getDirectives() { - return this._directives; - } - getDirective(name) { - return this.getDirectives().find((directive) => directive.name === name); - } - toConfig() { - return { - description: this.description, - query: this.getQueryType(), - mutation: this.getMutationType(), - subscription: this.getSubscriptionType(), - types: Object.values(this.getTypeMap()), - directives: this.getDirectives(), - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes, - assumeValid: this.__validationErrors !== void 0 - }; - } -}; -function collectReferencedTypes(type, typeSet) { - const namedType = getNamedType(type); - if (!typeSet.has(namedType)) { - typeSet.add(namedType); - if (isUnionType(namedType)) { - for (const memberType of namedType.getTypes()) { - collectReferencedTypes(memberType, typeSet); - } - } else if (isObjectType(namedType) || isInterfaceType(namedType)) { - for (const interfaceType of namedType.getInterfaces()) { - collectReferencedTypes(interfaceType, typeSet); - } - for (const field of Object.values(namedType.getFields())) { - collectReferencedTypes(field.type, typeSet); - for (const arg of field.args) { - collectReferencedTypes(arg.type, typeSet); - } - } - } else if (isInputObjectType(namedType)) { - for (const field of Object.values(namedType.getFields())) { - collectReferencedTypes(field.type, typeSet); - } - } - } - return typeSet; -} - -// node_modules/graphql/type/validate.mjs -function validateSchema(schema) { - assertSchema(schema); - if (schema.__validationErrors) { - return schema.__validationErrors; - } - const context = new SchemaValidationContext(schema); - validateRootTypes(context); - validateDirectives(context); - validateTypes(context); - const errors = context.getErrors(); - schema.__validationErrors = errors; - return errors; -} -function assertValidSchema(schema) { - const errors = validateSchema(schema); - if (errors.length !== 0) { - throw new Error(errors.map((error) => error.message).join("\n\n")); - } -} -var SchemaValidationContext = class { - constructor(schema) { - this._errors = []; - this.schema = schema; - } - reportError(message, nodes) { - const _nodes = Array.isArray(nodes) ? nodes.filter(Boolean) : nodes; - this._errors.push( - new GraphQLError(message, { - nodes: _nodes - }) - ); - } - getErrors() { - return this._errors; - } -}; -function validateRootTypes(context) { - const schema = context.schema; - const queryType = schema.getQueryType(); - if (!queryType) { - context.reportError("Query root type must be provided.", schema.astNode); - } else if (!isObjectType(queryType)) { - var _getOperationTypeNode; - context.reportError( - `Query root type must be Object type, it cannot be ${inspect( - queryType - )}.`, - (_getOperationTypeNode = getOperationTypeNode( - schema, - OperationTypeNode.QUERY - )) !== null && _getOperationTypeNode !== void 0 ? _getOperationTypeNode : queryType.astNode - ); - } - const mutationType = schema.getMutationType(); - if (mutationType && !isObjectType(mutationType)) { - var _getOperationTypeNode2; - context.reportError( - `Mutation root type must be Object type if provided, it cannot be ${inspect(mutationType)}.`, - (_getOperationTypeNode2 = getOperationTypeNode( - schema, - OperationTypeNode.MUTATION - )) !== null && _getOperationTypeNode2 !== void 0 ? _getOperationTypeNode2 : mutationType.astNode - ); - } - const subscriptionType = schema.getSubscriptionType(); - if (subscriptionType && !isObjectType(subscriptionType)) { - var _getOperationTypeNode3; - context.reportError( - `Subscription root type must be Object type if provided, it cannot be ${inspect(subscriptionType)}.`, - (_getOperationTypeNode3 = getOperationTypeNode( - schema, - OperationTypeNode.SUBSCRIPTION - )) !== null && _getOperationTypeNode3 !== void 0 ? _getOperationTypeNode3 : subscriptionType.astNode - ); - } -} -function getOperationTypeNode(schema, operation) { - var _flatMap$find; - return (_flatMap$find = [schema.astNode, ...schema.extensionASTNodes].flatMap( - // FIXME: https://github.com/graphql/graphql-js/issues/2203 - (schemaNode) => { - var _schemaNode$operation; - return ( - /* c8 ignore next */ - (_schemaNode$operation = schemaNode === null || schemaNode === void 0 ? void 0 : schemaNode.operationTypes) !== null && _schemaNode$operation !== void 0 ? _schemaNode$operation : [] - ); - } - ).find((operationNode) => operationNode.operation === operation)) === null || _flatMap$find === void 0 ? void 0 : _flatMap$find.type; -} -function validateDirectives(context) { - for (const directive of context.schema.getDirectives()) { - if (!isDirective(directive)) { - context.reportError( - `Expected directive but got: ${inspect(directive)}.`, - directive === null || directive === void 0 ? void 0 : directive.astNode - ); - continue; - } - validateName(context, directive); - for (const arg of directive.args) { - validateName(context, arg); - if (!isInputType(arg.type)) { - context.reportError( - `The type of @${directive.name}(${arg.name}:) must be Input Type but got: ${inspect(arg.type)}.`, - arg.astNode - ); - } - if (isRequiredArgument(arg) && arg.deprecationReason != null) { - var _arg$astNode; - context.reportError( - `Required argument @${directive.name}(${arg.name}:) cannot be deprecated.`, - [ - getDeprecatedDirectiveNode(arg.astNode), - (_arg$astNode = arg.astNode) === null || _arg$astNode === void 0 ? void 0 : _arg$astNode.type - ] - ); - } - } - } -} -function validateName(context, node) { - if (node.name.startsWith("__")) { - context.reportError( - `Name "${node.name}" must not begin with "__", which is reserved by GraphQL introspection.`, - node.astNode - ); - } -} -function validateTypes(context) { - const validateInputObjectCircularRefs = createInputObjectCircularRefsValidator(context); - const typeMap = context.schema.getTypeMap(); - for (const type of Object.values(typeMap)) { - if (!isNamedType(type)) { - context.reportError( - `Expected GraphQL named type but got: ${inspect(type)}.`, - type.astNode - ); - continue; - } - if (!isIntrospectionType(type)) { - validateName(context, type); - } - if (isObjectType(type)) { - validateFields(context, type); - validateInterfaces(context, type); - } else if (isInterfaceType(type)) { - validateFields(context, type); - validateInterfaces(context, type); - } else if (isUnionType(type)) { - validateUnionMembers(context, type); - } else if (isEnumType(type)) { - validateEnumValues(context, type); - } else if (isInputObjectType(type)) { - validateInputFields(context, type); - validateInputObjectCircularRefs(type); - } - } -} -function validateFields(context, type) { - const fields = Object.values(type.getFields()); - if (fields.length === 0) { - context.reportError(`Type ${type.name} must define one or more fields.`, [ - type.astNode, - ...type.extensionASTNodes - ]); - } - for (const field of fields) { - validateName(context, field); - if (!isOutputType(field.type)) { - var _field$astNode; - context.reportError( - `The type of ${type.name}.${field.name} must be Output Type but got: ${inspect(field.type)}.`, - (_field$astNode = field.astNode) === null || _field$astNode === void 0 ? void 0 : _field$astNode.type - ); - } - for (const arg of field.args) { - const argName = arg.name; - validateName(context, arg); - if (!isInputType(arg.type)) { - var _arg$astNode2; - context.reportError( - `The type of ${type.name}.${field.name}(${argName}:) must be Input Type but got: ${inspect(arg.type)}.`, - (_arg$astNode2 = arg.astNode) === null || _arg$astNode2 === void 0 ? void 0 : _arg$astNode2.type - ); - } - if (isRequiredArgument(arg) && arg.deprecationReason != null) { - var _arg$astNode3; - context.reportError( - `Required argument ${type.name}.${field.name}(${argName}:) cannot be deprecated.`, - [ - getDeprecatedDirectiveNode(arg.astNode), - (_arg$astNode3 = arg.astNode) === null || _arg$astNode3 === void 0 ? void 0 : _arg$astNode3.type - ] - ); - } - } - } -} -function validateInterfaces(context, type) { - const ifaceTypeNames = /* @__PURE__ */ Object.create(null); - for (const iface of type.getInterfaces()) { - if (!isInterfaceType(iface)) { - context.reportError( - `Type ${inspect(type)} must only implement Interface types, it cannot implement ${inspect(iface)}.`, - getAllImplementsInterfaceNodes(type, iface) - ); - continue; - } - if (type === iface) { - context.reportError( - `Type ${type.name} cannot implement itself because it would create a circular reference.`, - getAllImplementsInterfaceNodes(type, iface) - ); - continue; - } - if (ifaceTypeNames[iface.name]) { - context.reportError( - `Type ${type.name} can only implement ${iface.name} once.`, - getAllImplementsInterfaceNodes(type, iface) - ); - continue; - } - ifaceTypeNames[iface.name] = true; - validateTypeImplementsAncestors(context, type, iface); - validateTypeImplementsInterface(context, type, iface); - } -} -function validateTypeImplementsInterface(context, type, iface) { - const typeFieldMap = type.getFields(); - for (const ifaceField of Object.values(iface.getFields())) { - const fieldName = ifaceField.name; - const typeField = typeFieldMap[fieldName]; - if (!typeField) { - context.reportError( - `Interface field ${iface.name}.${fieldName} expected but ${type.name} does not provide it.`, - [ifaceField.astNode, type.astNode, ...type.extensionASTNodes] - ); - continue; - } - if (!isTypeSubTypeOf(context.schema, typeField.type, ifaceField.type)) { - var _ifaceField$astNode, _typeField$astNode; - context.reportError( - `Interface field ${iface.name}.${fieldName} expects type ${inspect(ifaceField.type)} but ${type.name}.${fieldName} is type ${inspect(typeField.type)}.`, - [ - (_ifaceField$astNode = ifaceField.astNode) === null || _ifaceField$astNode === void 0 ? void 0 : _ifaceField$astNode.type, - (_typeField$astNode = typeField.astNode) === null || _typeField$astNode === void 0 ? void 0 : _typeField$astNode.type - ] - ); - } - for (const ifaceArg of ifaceField.args) { - const argName = ifaceArg.name; - const typeArg = typeField.args.find((arg) => arg.name === argName); - if (!typeArg) { - context.reportError( - `Interface field argument ${iface.name}.${fieldName}(${argName}:) expected but ${type.name}.${fieldName} does not provide it.`, - [ifaceArg.astNode, typeField.astNode] - ); - continue; - } - if (!isEqualType(ifaceArg.type, typeArg.type)) { - var _ifaceArg$astNode, _typeArg$astNode; - context.reportError( - `Interface field argument ${iface.name}.${fieldName}(${argName}:) expects type ${inspect(ifaceArg.type)} but ${type.name}.${fieldName}(${argName}:) is type ${inspect(typeArg.type)}.`, - [ - (_ifaceArg$astNode = ifaceArg.astNode) === null || _ifaceArg$astNode === void 0 ? void 0 : _ifaceArg$astNode.type, - (_typeArg$astNode = typeArg.astNode) === null || _typeArg$astNode === void 0 ? void 0 : _typeArg$astNode.type - ] - ); - } - } - for (const typeArg of typeField.args) { - const argName = typeArg.name; - const ifaceArg = ifaceField.args.find((arg) => arg.name === argName); - if (!ifaceArg && isRequiredArgument(typeArg)) { - context.reportError( - `Object field ${type.name}.${fieldName} includes required argument ${argName} that is missing from the Interface field ${iface.name}.${fieldName}.`, - [typeArg.astNode, ifaceField.astNode] - ); - } - } - } -} -function validateTypeImplementsAncestors(context, type, iface) { - const ifaceInterfaces = type.getInterfaces(); - for (const transitive of iface.getInterfaces()) { - if (!ifaceInterfaces.includes(transitive)) { - context.reportError( - transitive === type ? `Type ${type.name} cannot implement ${iface.name} because it would create a circular reference.` : `Type ${type.name} must implement ${transitive.name} because it is implemented by ${iface.name}.`, - [ - ...getAllImplementsInterfaceNodes(iface, transitive), - ...getAllImplementsInterfaceNodes(type, iface) - ] - ); - } - } -} -function validateUnionMembers(context, union) { - const memberTypes = union.getTypes(); - if (memberTypes.length === 0) { - context.reportError( - `Union type ${union.name} must define one or more member types.`, - [union.astNode, ...union.extensionASTNodes] - ); - } - const includedTypeNames = /* @__PURE__ */ Object.create(null); - for (const memberType of memberTypes) { - if (includedTypeNames[memberType.name]) { - context.reportError( - `Union type ${union.name} can only include type ${memberType.name} once.`, - getUnionMemberTypeNodes(union, memberType.name) - ); - continue; - } - includedTypeNames[memberType.name] = true; - if (!isObjectType(memberType)) { - context.reportError( - `Union type ${union.name} can only include Object types, it cannot include ${inspect(memberType)}.`, - getUnionMemberTypeNodes(union, String(memberType)) - ); - } - } -} -function validateEnumValues(context, enumType) { - const enumValues = enumType.getValues(); - if (enumValues.length === 0) { - context.reportError( - `Enum type ${enumType.name} must define one or more values.`, - [enumType.astNode, ...enumType.extensionASTNodes] - ); - } - for (const enumValue of enumValues) { - validateName(context, enumValue); - } -} -function validateInputFields(context, inputObj) { - const fields = Object.values(inputObj.getFields()); - if (fields.length === 0) { - context.reportError( - `Input Object type ${inputObj.name} must define one or more fields.`, - [inputObj.astNode, ...inputObj.extensionASTNodes] - ); - } - for (const field of fields) { - validateName(context, field); - if (!isInputType(field.type)) { - var _field$astNode2; - context.reportError( - `The type of ${inputObj.name}.${field.name} must be Input Type but got: ${inspect(field.type)}.`, - (_field$astNode2 = field.astNode) === null || _field$astNode2 === void 0 ? void 0 : _field$astNode2.type - ); - } - if (isRequiredInputField(field) && field.deprecationReason != null) { - var _field$astNode3; - context.reportError( - `Required input field ${inputObj.name}.${field.name} cannot be deprecated.`, - [ - getDeprecatedDirectiveNode(field.astNode), - (_field$astNode3 = field.astNode) === null || _field$astNode3 === void 0 ? void 0 : _field$astNode3.type - ] - ); - } - } -} -function createInputObjectCircularRefsValidator(context) { - const visitedTypes = /* @__PURE__ */ Object.create(null); - const fieldPath = []; - const fieldPathIndexByTypeName = /* @__PURE__ */ Object.create(null); - return detectCycleRecursive; - function detectCycleRecursive(inputObj) { - if (visitedTypes[inputObj.name]) { - return; - } - visitedTypes[inputObj.name] = true; - fieldPathIndexByTypeName[inputObj.name] = fieldPath.length; - const fields = Object.values(inputObj.getFields()); - for (const field of fields) { - if (isNonNullType(field.type) && isInputObjectType(field.type.ofType)) { - const fieldType = field.type.ofType; - const cycleIndex = fieldPathIndexByTypeName[fieldType.name]; - fieldPath.push(field); - if (cycleIndex === void 0) { - detectCycleRecursive(fieldType); - } else { - const cyclePath = fieldPath.slice(cycleIndex); - const pathStr = cyclePath.map((fieldObj) => fieldObj.name).join("."); - context.reportError( - `Cannot reference Input Object "${fieldType.name}" within itself through a series of non-null fields: "${pathStr}".`, - cyclePath.map((fieldObj) => fieldObj.astNode) - ); - } - fieldPath.pop(); - } - } - fieldPathIndexByTypeName[inputObj.name] = void 0; - } -} -function getAllImplementsInterfaceNodes(type, iface) { - const { astNode, extensionASTNodes } = type; - const nodes = astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; - return nodes.flatMap((typeNode) => { - var _typeNode$interfaces; - return ( - /* c8 ignore next */ - (_typeNode$interfaces = typeNode.interfaces) !== null && _typeNode$interfaces !== void 0 ? _typeNode$interfaces : [] - ); - }).filter((ifaceNode) => ifaceNode.name.value === iface.name); -} -function getUnionMemberTypeNodes(union, typeName) { - const { astNode, extensionASTNodes } = union; - const nodes = astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; - return nodes.flatMap((unionNode) => { - var _unionNode$types; - return ( - /* c8 ignore next */ - (_unionNode$types = unionNode.types) !== null && _unionNode$types !== void 0 ? _unionNode$types : [] - ); - }).filter((typeNode) => typeNode.name.value === typeName); -} -function getDeprecatedDirectiveNode(definitionNode) { - var _definitionNode$direc; - return definitionNode === null || definitionNode === void 0 ? void 0 : (_definitionNode$direc = definitionNode.directives) === null || _definitionNode$direc === void 0 ? void 0 : _definitionNode$direc.find( - (node) => node.name.value === GraphQLDeprecatedDirective.name - ); -} - -// node_modules/graphql/utilities/typeFromAST.mjs -function typeFromAST(schema, typeNode) { - switch (typeNode.kind) { - case Kind.LIST_TYPE: { - const innerType = typeFromAST(schema, typeNode.type); - return innerType && new GraphQLList(innerType); - } - case Kind.NON_NULL_TYPE: { - const innerType = typeFromAST(schema, typeNode.type); - return innerType && new GraphQLNonNull(innerType); - } - case Kind.NAMED_TYPE: - return schema.getType(typeNode.name.value); - } -} - -// node_modules/graphql/utilities/TypeInfo.mjs -var TypeInfo = class { - constructor(schema, initialType, getFieldDefFn) { - this._schema = schema; - this._typeStack = []; - this._parentTypeStack = []; - this._inputTypeStack = []; - this._fieldDefStack = []; - this._defaultValueStack = []; - this._directive = null; - this._argument = null; - this._enumValue = null; - this._getFieldDef = getFieldDefFn !== null && getFieldDefFn !== void 0 ? getFieldDefFn : getFieldDef; - if (initialType) { - if (isInputType(initialType)) { - this._inputTypeStack.push(initialType); - } - if (isCompositeType(initialType)) { - this._parentTypeStack.push(initialType); - } - if (isOutputType(initialType)) { - this._typeStack.push(initialType); - } - } - } - get [Symbol.toStringTag]() { - return "TypeInfo"; - } - getType() { - if (this._typeStack.length > 0) { - return this._typeStack[this._typeStack.length - 1]; - } - } - getParentType() { - if (this._parentTypeStack.length > 0) { - return this._parentTypeStack[this._parentTypeStack.length - 1]; - } - } - getInputType() { - if (this._inputTypeStack.length > 0) { - return this._inputTypeStack[this._inputTypeStack.length - 1]; - } - } - getParentInputType() { - if (this._inputTypeStack.length > 1) { - return this._inputTypeStack[this._inputTypeStack.length - 2]; - } - } - getFieldDef() { - if (this._fieldDefStack.length > 0) { - return this._fieldDefStack[this._fieldDefStack.length - 1]; - } - } - getDefaultValue() { - if (this._defaultValueStack.length > 0) { - return this._defaultValueStack[this._defaultValueStack.length - 1]; - } - } - getDirective() { - return this._directive; - } - getArgument() { - return this._argument; - } - getEnumValue() { - return this._enumValue; - } - enter(node) { - const schema = this._schema; - switch (node.kind) { - case Kind.SELECTION_SET: { - const namedType = getNamedType(this.getType()); - this._parentTypeStack.push( - isCompositeType(namedType) ? namedType : void 0 - ); - break; - } - case Kind.FIELD: { - const parentType = this.getParentType(); - let fieldDef; - let fieldType; - if (parentType) { - fieldDef = this._getFieldDef(schema, parentType, node); - if (fieldDef) { - fieldType = fieldDef.type; - } - } - this._fieldDefStack.push(fieldDef); - this._typeStack.push(isOutputType(fieldType) ? fieldType : void 0); - break; - } - case Kind.DIRECTIVE: - this._directive = schema.getDirective(node.name.value); - break; - case Kind.OPERATION_DEFINITION: { - const rootType = schema.getRootType(node.operation); - this._typeStack.push(isObjectType(rootType) ? rootType : void 0); - break; - } - case Kind.INLINE_FRAGMENT: - case Kind.FRAGMENT_DEFINITION: { - const typeConditionAST = node.typeCondition; - const outputType = typeConditionAST ? typeFromAST(schema, typeConditionAST) : getNamedType(this.getType()); - this._typeStack.push(isOutputType(outputType) ? outputType : void 0); - break; - } - case Kind.VARIABLE_DEFINITION: { - const inputType = typeFromAST(schema, node.type); - this._inputTypeStack.push( - isInputType(inputType) ? inputType : void 0 - ); - break; - } - case Kind.ARGUMENT: { - var _this$getDirective; - let argDef; - let argType; - const fieldOrDirective = (_this$getDirective = this.getDirective()) !== null && _this$getDirective !== void 0 ? _this$getDirective : this.getFieldDef(); - if (fieldOrDirective) { - argDef = fieldOrDirective.args.find( - (arg) => arg.name === node.name.value - ); - if (argDef) { - argType = argDef.type; - } - } - this._argument = argDef; - this._defaultValueStack.push(argDef ? argDef.defaultValue : void 0); - this._inputTypeStack.push(isInputType(argType) ? argType : void 0); - break; - } - case Kind.LIST: { - const listType = getNullableType(this.getInputType()); - const itemType = isListType(listType) ? listType.ofType : listType; - this._defaultValueStack.push(void 0); - this._inputTypeStack.push(isInputType(itemType) ? itemType : void 0); - break; - } - case Kind.OBJECT_FIELD: { - const objectType = getNamedType(this.getInputType()); - let inputFieldType; - let inputField; - if (isInputObjectType(objectType)) { - inputField = objectType.getFields()[node.name.value]; - if (inputField) { - inputFieldType = inputField.type; - } - } - this._defaultValueStack.push( - inputField ? inputField.defaultValue : void 0 - ); - this._inputTypeStack.push( - isInputType(inputFieldType) ? inputFieldType : void 0 - ); - break; - } - case Kind.ENUM: { - const enumType = getNamedType(this.getInputType()); - let enumValue; - if (isEnumType(enumType)) { - enumValue = enumType.getValue(node.value); - } - this._enumValue = enumValue; - break; - } - default: - } - } - leave(node) { - switch (node.kind) { - case Kind.SELECTION_SET: - this._parentTypeStack.pop(); - break; - case Kind.FIELD: - this._fieldDefStack.pop(); - this._typeStack.pop(); - break; - case Kind.DIRECTIVE: - this._directive = null; - break; - case Kind.OPERATION_DEFINITION: - case Kind.INLINE_FRAGMENT: - case Kind.FRAGMENT_DEFINITION: - this._typeStack.pop(); - break; - case Kind.VARIABLE_DEFINITION: - this._inputTypeStack.pop(); - break; - case Kind.ARGUMENT: - this._argument = null; - this._defaultValueStack.pop(); - this._inputTypeStack.pop(); - break; - case Kind.LIST: - case Kind.OBJECT_FIELD: - this._defaultValueStack.pop(); - this._inputTypeStack.pop(); - break; - case Kind.ENUM: - this._enumValue = null; - break; - default: - } - } -}; -function getFieldDef(schema, parentType, fieldNode) { - const name = fieldNode.name.value; - if (name === SchemaMetaFieldDef.name && schema.getQueryType() === parentType) { - return SchemaMetaFieldDef; - } - if (name === TypeMetaFieldDef.name && schema.getQueryType() === parentType) { - return TypeMetaFieldDef; - } - if (name === TypeNameMetaFieldDef.name && isCompositeType(parentType)) { - return TypeNameMetaFieldDef; - } - if (isObjectType(parentType) || isInterfaceType(parentType)) { - return parentType.getFields()[name]; - } -} -function visitWithTypeInfo(typeInfo, visitor) { - return { - enter(...args) { - const node = args[0]; - typeInfo.enter(node); - const fn = getEnterLeaveForKind(visitor, node.kind).enter; - if (fn) { - const result = fn.apply(visitor, args); - if (result !== void 0) { - typeInfo.leave(node); - if (isNode(result)) { - typeInfo.enter(result); - } - } - return result; - } - }, - leave(...args) { - const node = args[0]; - const fn = getEnterLeaveForKind(visitor, node.kind).leave; - let result; - if (fn) { - result = fn.apply(visitor, args); - } - typeInfo.leave(node); - return result; - } - }; -} - -// node_modules/graphql/language/predicates.mjs -function isDefinitionNode(node) { - return isExecutableDefinitionNode(node) || isTypeSystemDefinitionNode(node) || isTypeSystemExtensionNode(node); -} -function isExecutableDefinitionNode(node) { - return node.kind === Kind.OPERATION_DEFINITION || node.kind === Kind.FRAGMENT_DEFINITION; -} -function isSelectionNode(node) { - return node.kind === Kind.FIELD || node.kind === Kind.FRAGMENT_SPREAD || node.kind === Kind.INLINE_FRAGMENT; -} -function isValueNode(node) { - return node.kind === Kind.VARIABLE || node.kind === Kind.INT || node.kind === Kind.FLOAT || node.kind === Kind.STRING || node.kind === Kind.BOOLEAN || node.kind === Kind.NULL || node.kind === Kind.ENUM || node.kind === Kind.LIST || node.kind === Kind.OBJECT; -} -function isConstValueNode(node) { - return isValueNode(node) && (node.kind === Kind.LIST ? node.values.some(isConstValueNode) : node.kind === Kind.OBJECT ? node.fields.some((field) => isConstValueNode(field.value)) : node.kind !== Kind.VARIABLE); -} -function isTypeNode(node) { - return node.kind === Kind.NAMED_TYPE || node.kind === Kind.LIST_TYPE || node.kind === Kind.NON_NULL_TYPE; -} -function isTypeSystemDefinitionNode(node) { - return node.kind === Kind.SCHEMA_DEFINITION || isTypeDefinitionNode(node) || node.kind === Kind.DIRECTIVE_DEFINITION; -} -function isTypeDefinitionNode(node) { - return node.kind === Kind.SCALAR_TYPE_DEFINITION || node.kind === Kind.OBJECT_TYPE_DEFINITION || node.kind === Kind.INTERFACE_TYPE_DEFINITION || node.kind === Kind.UNION_TYPE_DEFINITION || node.kind === Kind.ENUM_TYPE_DEFINITION || node.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION; -} -function isTypeSystemExtensionNode(node) { - return node.kind === Kind.SCHEMA_EXTENSION || isTypeExtensionNode(node); -} -function isTypeExtensionNode(node) { - return node.kind === Kind.SCALAR_TYPE_EXTENSION || node.kind === Kind.OBJECT_TYPE_EXTENSION || node.kind === Kind.INTERFACE_TYPE_EXTENSION || node.kind === Kind.UNION_TYPE_EXTENSION || node.kind === Kind.ENUM_TYPE_EXTENSION || node.kind === Kind.INPUT_OBJECT_TYPE_EXTENSION; -} - -// node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs -function ExecutableDefinitionsRule(context) { - return { - Document(node) { - for (const definition of node.definitions) { - if (!isExecutableDefinitionNode(definition)) { - const defName = definition.kind === Kind.SCHEMA_DEFINITION || definition.kind === Kind.SCHEMA_EXTENSION ? "schema" : '"' + definition.name.value + '"'; - context.reportError( - new GraphQLError(`The ${defName} definition is not executable.`, { - nodes: definition - }) - ); - } - } - return false; - } - }; -} - -// node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.mjs -function FieldsOnCorrectTypeRule(context) { - return { - Field(node) { - const type = context.getParentType(); - if (type) { - const fieldDef = context.getFieldDef(); - if (!fieldDef) { - const schema = context.getSchema(); - const fieldName = node.name.value; - let suggestion = didYouMean( - "to use an inline fragment on", - getSuggestedTypeNames(schema, type, fieldName) - ); - if (suggestion === "") { - suggestion = didYouMean(getSuggestedFieldNames(type, fieldName)); - } - context.reportError( - new GraphQLError( - `Cannot query field "${fieldName}" on type "${type.name}".` + suggestion, - { - nodes: node - } - ) - ); - } - } - } - }; -} -function getSuggestedTypeNames(schema, type, fieldName) { - if (!isAbstractType(type)) { - return []; - } - const suggestedTypes = /* @__PURE__ */ new Set(); - const usageCount = /* @__PURE__ */ Object.create(null); - for (const possibleType of schema.getPossibleTypes(type)) { - if (!possibleType.getFields()[fieldName]) { - continue; - } - suggestedTypes.add(possibleType); - usageCount[possibleType.name] = 1; - for (const possibleInterface of possibleType.getInterfaces()) { - var _usageCount$possibleI; - if (!possibleInterface.getFields()[fieldName]) { - continue; - } - suggestedTypes.add(possibleInterface); - usageCount[possibleInterface.name] = ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== null && _usageCount$possibleI !== void 0 ? _usageCount$possibleI : 0) + 1; - } - } - return [...suggestedTypes].sort((typeA, typeB) => { - const usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name]; - if (usageCountDiff !== 0) { - return usageCountDiff; - } - if (isInterfaceType(typeA) && schema.isSubType(typeA, typeB)) { - return -1; - } - if (isInterfaceType(typeB) && schema.isSubType(typeB, typeA)) { - return 1; - } - return naturalCompare(typeA.name, typeB.name); - }).map((x) => x.name); -} -function getSuggestedFieldNames(type, fieldName) { - if (isObjectType(type) || isInterfaceType(type)) { - const possibleFieldNames = Object.keys(type.getFields()); - return suggestionList(fieldName, possibleFieldNames); - } - return []; -} - -// node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs -function FragmentsOnCompositeTypesRule(context) { - return { - InlineFragment(node) { - const typeCondition = node.typeCondition; - if (typeCondition) { - const type = typeFromAST(context.getSchema(), typeCondition); - if (type && !isCompositeType(type)) { - const typeStr = print(typeCondition); - context.reportError( - new GraphQLError( - `Fragment cannot condition on non composite type "${typeStr}".`, - { - nodes: typeCondition - } - ) - ); - } - } - }, - FragmentDefinition(node) { - const type = typeFromAST(context.getSchema(), node.typeCondition); - if (type && !isCompositeType(type)) { - const typeStr = print(node.typeCondition); - context.reportError( - new GraphQLError( - `Fragment "${node.name.value}" cannot condition on non composite type "${typeStr}".`, - { - nodes: node.typeCondition - } - ) - ); - } - } - }; -} - -// node_modules/graphql/validation/rules/KnownArgumentNamesRule.mjs -function KnownArgumentNamesRule(context) { - return { - // eslint-disable-next-line new-cap - ...KnownArgumentNamesOnDirectivesRule(context), - Argument(argNode) { - const argDef = context.getArgument(); - const fieldDef = context.getFieldDef(); - const parentType = context.getParentType(); - if (!argDef && fieldDef && parentType) { - const argName = argNode.name.value; - const knownArgsNames = fieldDef.args.map((arg) => arg.name); - const suggestions = suggestionList(argName, knownArgsNames); - context.reportError( - new GraphQLError( - `Unknown argument "${argName}" on field "${parentType.name}.${fieldDef.name}".` + didYouMean(suggestions), - { - nodes: argNode - } - ) - ); - } - } - }; -} -function KnownArgumentNamesOnDirectivesRule(context) { - const directiveArgs = /* @__PURE__ */ Object.create(null); - const schema = context.getSchema(); - const definedDirectives = schema ? schema.getDirectives() : specifiedDirectives; - for (const directive of definedDirectives) { - directiveArgs[directive.name] = directive.args.map((arg) => arg.name); - } - const astDefinitions = context.getDocument().definitions; - for (const def of astDefinitions) { - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - var _def$arguments; - const argsNodes = (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 ? _def$arguments : []; - directiveArgs[def.name.value] = argsNodes.map((arg) => arg.name.value); - } - } - return { - Directive(directiveNode) { - const directiveName = directiveNode.name.value; - const knownArgs = directiveArgs[directiveName]; - if (directiveNode.arguments && knownArgs) { - for (const argNode of directiveNode.arguments) { - const argName = argNode.name.value; - if (!knownArgs.includes(argName)) { - const suggestions = suggestionList(argName, knownArgs); - context.reportError( - new GraphQLError( - `Unknown argument "${argName}" on directive "@${directiveName}".` + didYouMean(suggestions), - { - nodes: argNode - } - ) - ); - } - } - } - return false; - } - }; -} - -// node_modules/graphql/validation/rules/KnownDirectivesRule.mjs -function KnownDirectivesRule(context) { - const locationsMap = /* @__PURE__ */ Object.create(null); - const schema = context.getSchema(); - const definedDirectives = schema ? schema.getDirectives() : specifiedDirectives; - for (const directive of definedDirectives) { - locationsMap[directive.name] = directive.locations; - } - const astDefinitions = context.getDocument().definitions; - for (const def of astDefinitions) { - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - locationsMap[def.name.value] = def.locations.map((name) => name.value); - } - } - return { - Directive(node, _key, _parent, _path, ancestors) { - const name = node.name.value; - const locations = locationsMap[name]; - if (!locations) { - context.reportError( - new GraphQLError(`Unknown directive "@${name}".`, { - nodes: node - }) - ); - return; - } - const candidateLocation = getDirectiveLocationForASTPath(ancestors); - if (candidateLocation && !locations.includes(candidateLocation)) { - context.reportError( - new GraphQLError( - `Directive "@${name}" may not be used on ${candidateLocation}.`, - { - nodes: node - } - ) - ); - } - } - }; -} -function getDirectiveLocationForASTPath(ancestors) { - const appliedTo = ancestors[ancestors.length - 1]; - "kind" in appliedTo || invariant(false); - switch (appliedTo.kind) { - case Kind.OPERATION_DEFINITION: - return getDirectiveLocationForOperation(appliedTo.operation); - case Kind.FIELD: - return DirectiveLocation.FIELD; - case Kind.FRAGMENT_SPREAD: - return DirectiveLocation.FRAGMENT_SPREAD; - case Kind.INLINE_FRAGMENT: - return DirectiveLocation.INLINE_FRAGMENT; - case Kind.FRAGMENT_DEFINITION: - return DirectiveLocation.FRAGMENT_DEFINITION; - case Kind.VARIABLE_DEFINITION: - return DirectiveLocation.VARIABLE_DEFINITION; - case Kind.SCHEMA_DEFINITION: - case Kind.SCHEMA_EXTENSION: - return DirectiveLocation.SCHEMA; - case Kind.SCALAR_TYPE_DEFINITION: - case Kind.SCALAR_TYPE_EXTENSION: - return DirectiveLocation.SCALAR; - case Kind.OBJECT_TYPE_DEFINITION: - case Kind.OBJECT_TYPE_EXTENSION: - return DirectiveLocation.OBJECT; - case Kind.FIELD_DEFINITION: - return DirectiveLocation.FIELD_DEFINITION; - case Kind.INTERFACE_TYPE_DEFINITION: - case Kind.INTERFACE_TYPE_EXTENSION: - return DirectiveLocation.INTERFACE; - case Kind.UNION_TYPE_DEFINITION: - case Kind.UNION_TYPE_EXTENSION: - return DirectiveLocation.UNION; - case Kind.ENUM_TYPE_DEFINITION: - case Kind.ENUM_TYPE_EXTENSION: - return DirectiveLocation.ENUM; - case Kind.ENUM_VALUE_DEFINITION: - return DirectiveLocation.ENUM_VALUE; - case Kind.INPUT_OBJECT_TYPE_DEFINITION: - case Kind.INPUT_OBJECT_TYPE_EXTENSION: - return DirectiveLocation.INPUT_OBJECT; - case Kind.INPUT_VALUE_DEFINITION: { - const parentNode = ancestors[ancestors.length - 3]; - "kind" in parentNode || invariant(false); - return parentNode.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION ? DirectiveLocation.INPUT_FIELD_DEFINITION : DirectiveLocation.ARGUMENT_DEFINITION; - } - default: - invariant(false, "Unexpected kind: " + inspect(appliedTo.kind)); - } -} -function getDirectiveLocationForOperation(operation) { - switch (operation) { - case OperationTypeNode.QUERY: - return DirectiveLocation.QUERY; - case OperationTypeNode.MUTATION: - return DirectiveLocation.MUTATION; - case OperationTypeNode.SUBSCRIPTION: - return DirectiveLocation.SUBSCRIPTION; - } -} - -// node_modules/graphql/validation/rules/KnownFragmentNamesRule.mjs -function KnownFragmentNamesRule(context) { - return { - FragmentSpread(node) { - const fragmentName = node.name.value; - const fragment = context.getFragment(fragmentName); - if (!fragment) { - context.reportError( - new GraphQLError(`Unknown fragment "${fragmentName}".`, { - nodes: node.name - }) - ); - } - } - }; -} - -// node_modules/graphql/validation/rules/KnownTypeNamesRule.mjs -function KnownTypeNamesRule(context) { - const schema = context.getSchema(); - const existingTypesMap = schema ? schema.getTypeMap() : /* @__PURE__ */ Object.create(null); - const definedTypes = /* @__PURE__ */ Object.create(null); - for (const def of context.getDocument().definitions) { - if (isTypeDefinitionNode(def)) { - definedTypes[def.name.value] = true; - } - } - const typeNames = [ - ...Object.keys(existingTypesMap), - ...Object.keys(definedTypes) - ]; - return { - NamedType(node, _1, parent, _2, ancestors) { - const typeName = node.name.value; - if (!existingTypesMap[typeName] && !definedTypes[typeName]) { - var _ancestors$; - const definitionNode = (_ancestors$ = ancestors[2]) !== null && _ancestors$ !== void 0 ? _ancestors$ : parent; - const isSDL = definitionNode != null && isSDLNode(definitionNode); - if (isSDL && standardTypeNames.includes(typeName)) { - return; - } - const suggestedTypes = suggestionList( - typeName, - isSDL ? standardTypeNames.concat(typeNames) : typeNames - ); - context.reportError( - new GraphQLError( - `Unknown type "${typeName}".` + didYouMean(suggestedTypes), - { - nodes: node - } - ) - ); - } - } - }; -} -var standardTypeNames = [...specifiedScalarTypes, ...introspectionTypes].map( - (type) => type.name -); -function isSDLNode(value) { - return "kind" in value && (isTypeSystemDefinitionNode(value) || isTypeSystemExtensionNode(value)); -} - -// node_modules/graphql/validation/rules/LoneAnonymousOperationRule.mjs -function LoneAnonymousOperationRule(context) { - let operationCount = 0; - return { - Document(node) { - operationCount = node.definitions.filter( - (definition) => definition.kind === Kind.OPERATION_DEFINITION - ).length; - }, - OperationDefinition(node) { - if (!node.name && operationCount > 1) { - context.reportError( - new GraphQLError( - "This anonymous operation must be the only defined operation.", - { - nodes: node - } - ) - ); - } - } - }; -} - -// node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.mjs -function LoneSchemaDefinitionRule(context) { - var _ref, _ref2, _oldSchema$astNode; - const oldSchema = context.getSchema(); - const alreadyDefined = (_ref = (_ref2 = (_oldSchema$astNode = oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.astNode) !== null && _oldSchema$astNode !== void 0 ? _oldSchema$astNode : oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.getQueryType()) !== null && _ref2 !== void 0 ? _ref2 : oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.getMutationType()) !== null && _ref !== void 0 ? _ref : oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.getSubscriptionType(); - let schemaDefinitionsCount = 0; - return { - SchemaDefinition(node) { - if (alreadyDefined) { - context.reportError( - new GraphQLError( - "Cannot define a new schema within a schema extension.", - { - nodes: node - } - ) - ); - return; - } - if (schemaDefinitionsCount > 0) { - context.reportError( - new GraphQLError("Must provide only one schema definition.", { - nodes: node - }) - ); - } - ++schemaDefinitionsCount; - } - }; -} - -// node_modules/graphql/validation/rules/NoFragmentCyclesRule.mjs -function NoFragmentCyclesRule(context) { - const visitedFrags = /* @__PURE__ */ Object.create(null); - const spreadPath = []; - const spreadPathIndexByName = /* @__PURE__ */ Object.create(null); - return { - OperationDefinition: () => false, - FragmentDefinition(node) { - detectCycleRecursive(node); - return false; - } - }; - function detectCycleRecursive(fragment) { - if (visitedFrags[fragment.name.value]) { - return; - } - const fragmentName = fragment.name.value; - visitedFrags[fragmentName] = true; - const spreadNodes = context.getFragmentSpreads(fragment.selectionSet); - if (spreadNodes.length === 0) { - return; - } - spreadPathIndexByName[fragmentName] = spreadPath.length; - for (const spreadNode of spreadNodes) { - const spreadName = spreadNode.name.value; - const cycleIndex = spreadPathIndexByName[spreadName]; - spreadPath.push(spreadNode); - if (cycleIndex === void 0) { - const spreadFragment = context.getFragment(spreadName); - if (spreadFragment) { - detectCycleRecursive(spreadFragment); - } - } else { - const cyclePath = spreadPath.slice(cycleIndex); - const viaPath = cyclePath.slice(0, -1).map((s) => '"' + s.name.value + '"').join(", "); - context.reportError( - new GraphQLError( - `Cannot spread fragment "${spreadName}" within itself` + (viaPath !== "" ? ` via ${viaPath}.` : "."), - { - nodes: cyclePath - } - ) - ); - } - spreadPath.pop(); - } - spreadPathIndexByName[fragmentName] = void 0; - } -} - -// node_modules/graphql/validation/rules/NoUndefinedVariablesRule.mjs -function NoUndefinedVariablesRule(context) { - let variableNameDefined = /* @__PURE__ */ Object.create(null); - return { - OperationDefinition: { - enter() { - variableNameDefined = /* @__PURE__ */ Object.create(null); - }, - leave(operation) { - const usages = context.getRecursiveVariableUsages(operation); - for (const { node } of usages) { - const varName = node.name.value; - if (variableNameDefined[varName] !== true) { - context.reportError( - new GraphQLError( - operation.name ? `Variable "$${varName}" is not defined by operation "${operation.name.value}".` : `Variable "$${varName}" is not defined.`, - { - nodes: [node, operation] - } - ) - ); - } - } - } - }, - VariableDefinition(node) { - variableNameDefined[node.variable.name.value] = true; - } - }; -} - -// node_modules/graphql/validation/rules/NoUnusedFragmentsRule.mjs -function NoUnusedFragmentsRule(context) { - const operationDefs = []; - const fragmentDefs = []; - return { - OperationDefinition(node) { - operationDefs.push(node); - return false; - }, - FragmentDefinition(node) { - fragmentDefs.push(node); - return false; - }, - Document: { - leave() { - const fragmentNameUsed = /* @__PURE__ */ Object.create(null); - for (const operation of operationDefs) { - for (const fragment of context.getRecursivelyReferencedFragments( - operation - )) { - fragmentNameUsed[fragment.name.value] = true; - } - } - for (const fragmentDef of fragmentDefs) { - const fragName = fragmentDef.name.value; - if (fragmentNameUsed[fragName] !== true) { - context.reportError( - new GraphQLError(`Fragment "${fragName}" is never used.`, { - nodes: fragmentDef - }) - ); - } - } - } - } - }; -} - -// node_modules/graphql/validation/rules/NoUnusedVariablesRule.mjs -function NoUnusedVariablesRule(context) { - let variableDefs = []; - return { - OperationDefinition: { - enter() { - variableDefs = []; - }, - leave(operation) { - const variableNameUsed = /* @__PURE__ */ Object.create(null); - const usages = context.getRecursiveVariableUsages(operation); - for (const { node } of usages) { - variableNameUsed[node.name.value] = true; - } - for (const variableDef of variableDefs) { - const variableName = variableDef.variable.name.value; - if (variableNameUsed[variableName] !== true) { - context.reportError( - new GraphQLError( - operation.name ? `Variable "$${variableName}" is never used in operation "${operation.name.value}".` : `Variable "$${variableName}" is never used.`, - { - nodes: variableDef - } - ) - ); - } - } - } - }, - VariableDefinition(def) { - variableDefs.push(def); - } - }; -} - -// node_modules/graphql/utilities/sortValueNode.mjs -function sortValueNode(valueNode) { - switch (valueNode.kind) { - case Kind.OBJECT: - return { ...valueNode, fields: sortFields(valueNode.fields) }; - case Kind.LIST: - return { ...valueNode, values: valueNode.values.map(sortValueNode) }; - case Kind.INT: - case Kind.FLOAT: - case Kind.STRING: - case Kind.BOOLEAN: - case Kind.NULL: - case Kind.ENUM: - case Kind.VARIABLE: - return valueNode; - } -} -function sortFields(fields) { - return fields.map((fieldNode) => ({ - ...fieldNode, - value: sortValueNode(fieldNode.value) - })).sort( - (fieldA, fieldB) => naturalCompare(fieldA.name.value, fieldB.name.value) - ); -} - -// node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.mjs -function reasonMessage(reason) { - if (Array.isArray(reason)) { - return reason.map( - ([responseName, subReason]) => `subfields "${responseName}" conflict because ` + reasonMessage(subReason) - ).join(" and "); - } - return reason; -} -function OverlappingFieldsCanBeMergedRule(context) { - const comparedFragmentPairs = new PairSet(); - const cachedFieldsAndFragmentNames = /* @__PURE__ */ new Map(); - return { - SelectionSet(selectionSet) { - const conflicts = findConflictsWithinSelectionSet( - context, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - context.getParentType(), - selectionSet - ); - for (const [[responseName, reason], fields1, fields2] of conflicts) { - const reasonMsg = reasonMessage(reason); - context.reportError( - new GraphQLError( - `Fields "${responseName}" conflict because ${reasonMsg}. Use different aliases on the fields to fetch both if this was intentional.`, - { - nodes: fields1.concat(fields2) - } - ) - ); - } - } - }; -} -function findConflictsWithinSelectionSet(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentType, selectionSet) { - const conflicts = []; - const [fieldMap, fragmentNames] = getFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - parentType, - selectionSet - ); - collectConflictsWithin( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - fieldMap - ); - if (fragmentNames.length !== 0) { - for (let i = 0; i < fragmentNames.length; i++) { - collectConflictsBetweenFieldsAndFragment( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - false, - fieldMap, - fragmentNames[i] - ); - for (let j = i + 1; j < fragmentNames.length; j++) { - collectConflictsBetweenFragments( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - false, - fragmentNames[i], - fragmentNames[j] - ); - } - } - } - return conflicts; -} -function collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fragmentName) { - const fragment = context.getFragment(fragmentName); - if (!fragment) { - return; - } - const [fieldMap2, referencedFragmentNames] = getReferencedFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - fragment - ); - if (fieldMap === fieldMap2) { - return; - } - collectConflictsBetween( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fieldMap, - fieldMap2 - ); - for (const referencedFragmentName of referencedFragmentNames) { - if (comparedFragmentPairs.has( - referencedFragmentName, - fragmentName, - areMutuallyExclusive - )) { - continue; - } - comparedFragmentPairs.add( - referencedFragmentName, - fragmentName, - areMutuallyExclusive - ); - collectConflictsBetweenFieldsAndFragment( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fieldMap, - referencedFragmentName - ); - } -} -function collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentName1, fragmentName2) { - if (fragmentName1 === fragmentName2) { - return; - } - if (comparedFragmentPairs.has( - fragmentName1, - fragmentName2, - areMutuallyExclusive - )) { - return; - } - comparedFragmentPairs.add(fragmentName1, fragmentName2, areMutuallyExclusive); - const fragment1 = context.getFragment(fragmentName1); - const fragment2 = context.getFragment(fragmentName2); - if (!fragment1 || !fragment2) { - return; - } - const [fieldMap1, referencedFragmentNames1] = getReferencedFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - fragment1 - ); - const [fieldMap2, referencedFragmentNames2] = getReferencedFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - fragment2 - ); - collectConflictsBetween( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fieldMap1, - fieldMap2 - ); - for (const referencedFragmentName2 of referencedFragmentNames2) { - collectConflictsBetweenFragments( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fragmentName1, - referencedFragmentName2 - ); - } - for (const referencedFragmentName1 of referencedFragmentNames1) { - collectConflictsBetweenFragments( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - referencedFragmentName1, - fragmentName2 - ); - } -} -function findConflictsBetweenSubSelectionSets(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, parentType1, selectionSet1, parentType2, selectionSet2) { - const conflicts = []; - const [fieldMap1, fragmentNames1] = getFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - parentType1, - selectionSet1 - ); - const [fieldMap2, fragmentNames2] = getFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - parentType2, - selectionSet2 - ); - collectConflictsBetween( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fieldMap1, - fieldMap2 - ); - for (const fragmentName2 of fragmentNames2) { - collectConflictsBetweenFieldsAndFragment( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fieldMap1, - fragmentName2 - ); - } - for (const fragmentName1 of fragmentNames1) { - collectConflictsBetweenFieldsAndFragment( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fieldMap2, - fragmentName1 - ); - } - for (const fragmentName1 of fragmentNames1) { - for (const fragmentName2 of fragmentNames2) { - collectConflictsBetweenFragments( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fragmentName1, - fragmentName2 - ); - } - } - return conflicts; -} -function collectConflictsWithin(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, fieldMap) { - for (const [responseName, fields] of Object.entries(fieldMap)) { - if (fields.length > 1) { - for (let i = 0; i < fields.length; i++) { - for (let j = i + 1; j < fields.length; j++) { - const conflict = findConflict( - context, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - false, - // within one collection is never mutually exclusive - responseName, - fields[i], - fields[j] - ); - if (conflict) { - conflicts.push(conflict); - } - } - } - } - } -} -function collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, fieldMap1, fieldMap2) { - for (const [responseName, fields1] of Object.entries(fieldMap1)) { - const fields2 = fieldMap2[responseName]; - if (fields2) { - for (const field1 of fields1) { - for (const field2 of fields2) { - const conflict = findConflict( - context, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - parentFieldsAreMutuallyExclusive, - responseName, - field1, - field2 - ); - if (conflict) { - conflicts.push(conflict); - } - } - } - } - } -} -function findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, responseName, field1, field2) { - const [parentType1, node1, def1] = field1; - const [parentType2, node2, def2] = field2; - const areMutuallyExclusive = parentFieldsAreMutuallyExclusive || parentType1 !== parentType2 && isObjectType(parentType1) && isObjectType(parentType2); - if (!areMutuallyExclusive) { - const name1 = node1.name.value; - const name2 = node2.name.value; - if (name1 !== name2) { - return [ - [responseName, `"${name1}" and "${name2}" are different fields`], - [node1], - [node2] - ]; - } - if (!sameArguments(node1, node2)) { - return [ - [responseName, "they have differing arguments"], - [node1], - [node2] - ]; - } - } - const type1 = def1 === null || def1 === void 0 ? void 0 : def1.type; - const type2 = def2 === null || def2 === void 0 ? void 0 : def2.type; - if (type1 && type2 && doTypesConflict(type1, type2)) { - return [ - [ - responseName, - `they return conflicting types "${inspect(type1)}" and "${inspect( - type2 - )}"` - ], - [node1], - [node2] - ]; - } - const selectionSet1 = node1.selectionSet; - const selectionSet2 = node2.selectionSet; - if (selectionSet1 && selectionSet2) { - const conflicts = findConflictsBetweenSubSelectionSets( - context, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - getNamedType(type1), - selectionSet1, - getNamedType(type2), - selectionSet2 - ); - return subfieldConflicts(conflicts, responseName, node1, node2); - } -} -function sameArguments(node1, node2) { - const args1 = node1.arguments; - const args2 = node2.arguments; - if (args1 === void 0 || args1.length === 0) { - return args2 === void 0 || args2.length === 0; - } - if (args2 === void 0 || args2.length === 0) { - return false; - } - if (args1.length !== args2.length) { - return false; - } - const values2 = new Map(args2.map(({ name, value }) => [name.value, value])); - return args1.every((arg1) => { - const value1 = arg1.value; - const value2 = values2.get(arg1.name.value); - if (value2 === void 0) { - return false; - } - return stringifyValue(value1) === stringifyValue(value2); - }); -} -function stringifyValue(value) { - return print(sortValueNode(value)); -} -function doTypesConflict(type1, type2) { - if (isListType(type1)) { - return isListType(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true; - } - if (isListType(type2)) { - return true; - } - if (isNonNullType(type1)) { - return isNonNullType(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true; - } - if (isNonNullType(type2)) { - return true; - } - if (isLeafType(type1) || isLeafType(type2)) { - return type1 !== type2; - } - return false; -} -function getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType, selectionSet) { - const cached = cachedFieldsAndFragmentNames.get(selectionSet); - if (cached) { - return cached; - } - const nodeAndDefs = /* @__PURE__ */ Object.create(null); - const fragmentNames = /* @__PURE__ */ Object.create(null); - _collectFieldsAndFragmentNames( - context, - parentType, - selectionSet, - nodeAndDefs, - fragmentNames - ); - const result = [nodeAndDefs, Object.keys(fragmentNames)]; - cachedFieldsAndFragmentNames.set(selectionSet, result); - return result; -} -function getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment) { - const cached = cachedFieldsAndFragmentNames.get(fragment.selectionSet); - if (cached) { - return cached; - } - const fragmentType = typeFromAST(context.getSchema(), fragment.typeCondition); - return getFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - fragmentType, - fragment.selectionSet - ); -} -function _collectFieldsAndFragmentNames(context, parentType, selectionSet, nodeAndDefs, fragmentNames) { - for (const selection of selectionSet.selections) { - switch (selection.kind) { - case Kind.FIELD: { - const fieldName = selection.name.value; - let fieldDef; - if (isObjectType(parentType) || isInterfaceType(parentType)) { - fieldDef = parentType.getFields()[fieldName]; - } - const responseName = selection.alias ? selection.alias.value : fieldName; - if (!nodeAndDefs[responseName]) { - nodeAndDefs[responseName] = []; - } - nodeAndDefs[responseName].push([parentType, selection, fieldDef]); - break; - } - case Kind.FRAGMENT_SPREAD: - fragmentNames[selection.name.value] = true; - break; - case Kind.INLINE_FRAGMENT: { - const typeCondition = selection.typeCondition; - const inlineFragmentType = typeCondition ? typeFromAST(context.getSchema(), typeCondition) : parentType; - _collectFieldsAndFragmentNames( - context, - inlineFragmentType, - selection.selectionSet, - nodeAndDefs, - fragmentNames - ); - break; - } - } - } -} -function subfieldConflicts(conflicts, responseName, node1, node2) { - if (conflicts.length > 0) { - return [ - [responseName, conflicts.map(([reason]) => reason)], - [node1, ...conflicts.map(([, fields1]) => fields1).flat()], - [node2, ...conflicts.map(([, , fields2]) => fields2).flat()] - ]; - } -} -var PairSet = class { - constructor() { - this._data = /* @__PURE__ */ new Map(); - } - has(a, b, areMutuallyExclusive) { - var _this$_data$get; - const [key1, key2] = a < b ? [a, b] : [b, a]; - const result = (_this$_data$get = this._data.get(key1)) === null || _this$_data$get === void 0 ? void 0 : _this$_data$get.get(key2); - if (result === void 0) { - return false; - } - return areMutuallyExclusive ? true : areMutuallyExclusive === result; - } - add(a, b, areMutuallyExclusive) { - const [key1, key2] = a < b ? [a, b] : [b, a]; - const map = this._data.get(key1); - if (map === void 0) { - this._data.set(key1, /* @__PURE__ */ new Map([[key2, areMutuallyExclusive]])); - } else { - map.set(key2, areMutuallyExclusive); - } - } -}; - -// node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.mjs -function PossibleFragmentSpreadsRule(context) { - return { - InlineFragment(node) { - const fragType = context.getType(); - const parentType = context.getParentType(); - if (isCompositeType(fragType) && isCompositeType(parentType) && !doTypesOverlap(context.getSchema(), fragType, parentType)) { - const parentTypeStr = inspect(parentType); - const fragTypeStr = inspect(fragType); - context.reportError( - new GraphQLError( - `Fragment cannot be spread here as objects of type "${parentTypeStr}" can never be of type "${fragTypeStr}".`, - { - nodes: node - } - ) - ); - } - }, - FragmentSpread(node) { - const fragName = node.name.value; - const fragType = getFragmentType(context, fragName); - const parentType = context.getParentType(); - if (fragType && parentType && !doTypesOverlap(context.getSchema(), fragType, parentType)) { - const parentTypeStr = inspect(parentType); - const fragTypeStr = inspect(fragType); - context.reportError( - new GraphQLError( - `Fragment "${fragName}" cannot be spread here as objects of type "${parentTypeStr}" can never be of type "${fragTypeStr}".`, - { - nodes: node - } - ) - ); - } - } - }; -} -function getFragmentType(context, name) { - const frag = context.getFragment(name); - if (frag) { - const type = typeFromAST(context.getSchema(), frag.typeCondition); - if (isCompositeType(type)) { - return type; - } - } -} - -// node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.mjs -function PossibleTypeExtensionsRule(context) { - const schema = context.getSchema(); - const definedTypes = /* @__PURE__ */ Object.create(null); - for (const def of context.getDocument().definitions) { - if (isTypeDefinitionNode(def)) { - definedTypes[def.name.value] = def; - } - } - return { - ScalarTypeExtension: checkExtension, - ObjectTypeExtension: checkExtension, - InterfaceTypeExtension: checkExtension, - UnionTypeExtension: checkExtension, - EnumTypeExtension: checkExtension, - InputObjectTypeExtension: checkExtension - }; - function checkExtension(node) { - const typeName = node.name.value; - const defNode = definedTypes[typeName]; - const existingType = schema === null || schema === void 0 ? void 0 : schema.getType(typeName); - let expectedKind; - if (defNode) { - expectedKind = defKindToExtKind[defNode.kind]; - } else if (existingType) { - expectedKind = typeToExtKind(existingType); - } - if (expectedKind) { - if (expectedKind !== node.kind) { - const kindStr = extensionKindToTypeName(node.kind); - context.reportError( - new GraphQLError(`Cannot extend non-${kindStr} type "${typeName}".`, { - nodes: defNode ? [defNode, node] : node - }) - ); - } - } else { - const allTypeNames = Object.keys({ - ...definedTypes, - ...schema === null || schema === void 0 ? void 0 : schema.getTypeMap() - }); - const suggestedTypes = suggestionList(typeName, allTypeNames); - context.reportError( - new GraphQLError( - `Cannot extend type "${typeName}" because it is not defined.` + didYouMean(suggestedTypes), - { - nodes: node.name - } - ) - ); - } - } -} -var defKindToExtKind = { - [Kind.SCALAR_TYPE_DEFINITION]: Kind.SCALAR_TYPE_EXTENSION, - [Kind.OBJECT_TYPE_DEFINITION]: Kind.OBJECT_TYPE_EXTENSION, - [Kind.INTERFACE_TYPE_DEFINITION]: Kind.INTERFACE_TYPE_EXTENSION, - [Kind.UNION_TYPE_DEFINITION]: Kind.UNION_TYPE_EXTENSION, - [Kind.ENUM_TYPE_DEFINITION]: Kind.ENUM_TYPE_EXTENSION, - [Kind.INPUT_OBJECT_TYPE_DEFINITION]: Kind.INPUT_OBJECT_TYPE_EXTENSION -}; -function typeToExtKind(type) { - if (isScalarType(type)) { - return Kind.SCALAR_TYPE_EXTENSION; - } - if (isObjectType(type)) { - return Kind.OBJECT_TYPE_EXTENSION; - } - if (isInterfaceType(type)) { - return Kind.INTERFACE_TYPE_EXTENSION; - } - if (isUnionType(type)) { - return Kind.UNION_TYPE_EXTENSION; - } - if (isEnumType(type)) { - return Kind.ENUM_TYPE_EXTENSION; - } - if (isInputObjectType(type)) { - return Kind.INPUT_OBJECT_TYPE_EXTENSION; - } - invariant(false, "Unexpected type: " + inspect(type)); -} -function extensionKindToTypeName(kind) { - switch (kind) { - case Kind.SCALAR_TYPE_EXTENSION: - return "scalar"; - case Kind.OBJECT_TYPE_EXTENSION: - return "object"; - case Kind.INTERFACE_TYPE_EXTENSION: - return "interface"; - case Kind.UNION_TYPE_EXTENSION: - return "union"; - case Kind.ENUM_TYPE_EXTENSION: - return "enum"; - case Kind.INPUT_OBJECT_TYPE_EXTENSION: - return "input object"; - default: - invariant(false, "Unexpected kind: " + inspect(kind)); - } -} - -// node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs -function ProvidedRequiredArgumentsRule(context) { - return { - // eslint-disable-next-line new-cap - ...ProvidedRequiredArgumentsOnDirectivesRule(context), - Field: { - // Validate on leave to allow for deeper errors to appear first. - leave(fieldNode) { - var _fieldNode$arguments; - const fieldDef = context.getFieldDef(); - if (!fieldDef) { - return false; - } - const providedArgs = new Set( - // FIXME: https://github.com/graphql/graphql-js/issues/2203 - /* c8 ignore next */ - (_fieldNode$arguments = fieldNode.arguments) === null || _fieldNode$arguments === void 0 ? void 0 : _fieldNode$arguments.map((arg) => arg.name.value) - ); - for (const argDef of fieldDef.args) { - if (!providedArgs.has(argDef.name) && isRequiredArgument(argDef)) { - const argTypeStr = inspect(argDef.type); - context.reportError( - new GraphQLError( - `Field "${fieldDef.name}" argument "${argDef.name}" of type "${argTypeStr}" is required, but it was not provided.`, - { - nodes: fieldNode - } - ) - ); - } - } - } - } - }; -} -function ProvidedRequiredArgumentsOnDirectivesRule(context) { - var _schema$getDirectives; - const requiredArgsMap = /* @__PURE__ */ Object.create(null); - const schema = context.getSchema(); - const definedDirectives = (_schema$getDirectives = schema === null || schema === void 0 ? void 0 : schema.getDirectives()) !== null && _schema$getDirectives !== void 0 ? _schema$getDirectives : specifiedDirectives; - for (const directive of definedDirectives) { - requiredArgsMap[directive.name] = keyMap( - directive.args.filter(isRequiredArgument), - (arg) => arg.name - ); - } - const astDefinitions = context.getDocument().definitions; - for (const def of astDefinitions) { - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - var _def$arguments; - const argNodes = (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 ? _def$arguments : []; - requiredArgsMap[def.name.value] = keyMap( - argNodes.filter(isRequiredArgumentNode), - (arg) => arg.name.value - ); - } - } - return { - Directive: { - // Validate on leave to allow for deeper errors to appear first. - leave(directiveNode) { - const directiveName = directiveNode.name.value; - const requiredArgs = requiredArgsMap[directiveName]; - if (requiredArgs) { - var _directiveNode$argume; - const argNodes = (_directiveNode$argume = directiveNode.arguments) !== null && _directiveNode$argume !== void 0 ? _directiveNode$argume : []; - const argNodeMap = new Set(argNodes.map((arg) => arg.name.value)); - for (const [argName, argDef] of Object.entries(requiredArgs)) { - if (!argNodeMap.has(argName)) { - const argType = isType(argDef.type) ? inspect(argDef.type) : print(argDef.type); - context.reportError( - new GraphQLError( - `Directive "@${directiveName}" argument "${argName}" of type "${argType}" is required, but it was not provided.`, - { - nodes: directiveNode - } - ) - ); - } - } - } - } - } - }; -} -function isRequiredArgumentNode(arg) { - return arg.type.kind === Kind.NON_NULL_TYPE && arg.defaultValue == null; -} - -// node_modules/graphql/validation/rules/ScalarLeafsRule.mjs -function ScalarLeafsRule(context) { - return { - Field(node) { - const type = context.getType(); - const selectionSet = node.selectionSet; - if (type) { - if (isLeafType(getNamedType(type))) { - if (selectionSet) { - const fieldName = node.name.value; - const typeStr = inspect(type); - context.reportError( - new GraphQLError( - `Field "${fieldName}" must not have a selection since type "${typeStr}" has no subfields.`, - { - nodes: selectionSet - } - ) - ); - } - } else if (!selectionSet) { - const fieldName = node.name.value; - const typeStr = inspect(type); - context.reportError( - new GraphQLError( - `Field "${fieldName}" of type "${typeStr}" must have a selection of subfields. Did you mean "${fieldName} { ... }"?`, - { - nodes: node - } - ) - ); - } - } - } - }; -} - -// node_modules/graphql/jsutils/printPathArray.mjs -function printPathArray(path) { - return path.map( - (key) => typeof key === "number" ? "[" + key.toString() + "]" : "." + key - ).join(""); -} - -// node_modules/graphql/jsutils/Path.mjs -function addPath(prev, key, typename) { - return { - prev, - key, - typename - }; -} -function pathToArray(path) { - const flattened = []; - let curr = path; - while (curr) { - flattened.push(curr.key); - curr = curr.prev; - } - return flattened.reverse(); -} - -// node_modules/graphql/utilities/coerceInputValue.mjs -function coerceInputValue(inputValue, type, onError = defaultOnError) { - return coerceInputValueImpl(inputValue, type, onError, void 0); -} -function defaultOnError(path, invalidValue, error) { - let errorPrefix = "Invalid value " + inspect(invalidValue); - if (path.length > 0) { - errorPrefix += ` at "value${printPathArray(path)}"`; - } - error.message = errorPrefix + ": " + error.message; - throw error; -} -function coerceInputValueImpl(inputValue, type, onError, path) { - if (isNonNullType(type)) { - if (inputValue != null) { - return coerceInputValueImpl(inputValue, type.ofType, onError, path); - } - onError( - pathToArray(path), - inputValue, - new GraphQLError( - `Expected non-nullable type "${inspect(type)}" not to be null.` - ) - ); - return; - } - if (inputValue == null) { - return null; - } - if (isListType(type)) { - const itemType = type.ofType; - if (isIterableObject(inputValue)) { - return Array.from(inputValue, (itemValue, index) => { - const itemPath = addPath(path, index, void 0); - return coerceInputValueImpl(itemValue, itemType, onError, itemPath); - }); - } - return [coerceInputValueImpl(inputValue, itemType, onError, path)]; - } - if (isInputObjectType(type)) { - if (!isObjectLike(inputValue)) { - onError( - pathToArray(path), - inputValue, - new GraphQLError(`Expected type "${type.name}" to be an object.`) - ); - return; - } - const coercedValue = {}; - const fieldDefs = type.getFields(); - for (const field of Object.values(fieldDefs)) { - const fieldValue = inputValue[field.name]; - if (fieldValue === void 0) { - if (field.defaultValue !== void 0) { - coercedValue[field.name] = field.defaultValue; - } else if (isNonNullType(field.type)) { - const typeStr = inspect(field.type); - onError( - pathToArray(path), - inputValue, - new GraphQLError( - `Field "${field.name}" of required type "${typeStr}" was not provided.` - ) - ); - } - continue; - } - coercedValue[field.name] = coerceInputValueImpl( - fieldValue, - field.type, - onError, - addPath(path, field.name, type.name) - ); - } - for (const fieldName of Object.keys(inputValue)) { - if (!fieldDefs[fieldName]) { - const suggestions = suggestionList( - fieldName, - Object.keys(type.getFields()) - ); - onError( - pathToArray(path), - inputValue, - new GraphQLError( - `Field "${fieldName}" is not defined by type "${type.name}".` + didYouMean(suggestions) - ) - ); - } - } - return coercedValue; - } - if (isLeafType(type)) { - let parseResult; - try { - parseResult = type.parseValue(inputValue); - } catch (error) { - if (error instanceof GraphQLError) { - onError(pathToArray(path), inputValue, error); - } else { - onError( - pathToArray(path), - inputValue, - new GraphQLError(`Expected type "${type.name}". ` + error.message, { - originalError: error - }) - ); - } - return; - } - if (parseResult === void 0) { - onError( - pathToArray(path), - inputValue, - new GraphQLError(`Expected type "${type.name}".`) - ); - } - return parseResult; - } - invariant(false, "Unexpected input type: " + inspect(type)); -} - -// node_modules/graphql/utilities/valueFromAST.mjs -function valueFromAST(valueNode, type, variables) { - if (!valueNode) { - return; - } - if (valueNode.kind === Kind.VARIABLE) { - const variableName = valueNode.name.value; - if (variables == null || variables[variableName] === void 0) { - return; - } - const variableValue = variables[variableName]; - if (variableValue === null && isNonNullType(type)) { - return; - } - return variableValue; - } - if (isNonNullType(type)) { - if (valueNode.kind === Kind.NULL) { - return; - } - return valueFromAST(valueNode, type.ofType, variables); - } - if (valueNode.kind === Kind.NULL) { - return null; - } - if (isListType(type)) { - const itemType = type.ofType; - if (valueNode.kind === Kind.LIST) { - const coercedValues = []; - for (const itemNode of valueNode.values) { - if (isMissingVariable(itemNode, variables)) { - if (isNonNullType(itemType)) { - return; - } - coercedValues.push(null); - } else { - const itemValue = valueFromAST(itemNode, itemType, variables); - if (itemValue === void 0) { - return; - } - coercedValues.push(itemValue); - } - } - return coercedValues; - } - const coercedValue = valueFromAST(valueNode, itemType, variables); - if (coercedValue === void 0) { - return; - } - return [coercedValue]; - } - if (isInputObjectType(type)) { - if (valueNode.kind !== Kind.OBJECT) { - return; - } - const coercedObj = /* @__PURE__ */ Object.create(null); - const fieldNodes = keyMap(valueNode.fields, (field) => field.name.value); - for (const field of Object.values(type.getFields())) { - const fieldNode = fieldNodes[field.name]; - if (!fieldNode || isMissingVariable(fieldNode.value, variables)) { - if (field.defaultValue !== void 0) { - coercedObj[field.name] = field.defaultValue; - } else if (isNonNullType(field.type)) { - return; - } - continue; - } - const fieldValue = valueFromAST(fieldNode.value, field.type, variables); - if (fieldValue === void 0) { - return; - } - coercedObj[field.name] = fieldValue; - } - return coercedObj; - } - if (isLeafType(type)) { - let result; - try { - result = type.parseLiteral(valueNode, variables); - } catch (_error) { - return; - } - if (result === void 0) { - return; - } - return result; - } - invariant(false, "Unexpected input type: " + inspect(type)); -} -function isMissingVariable(valueNode, variables) { - return valueNode.kind === Kind.VARIABLE && (variables == null || variables[valueNode.name.value] === void 0); -} - -// node_modules/graphql/execution/values.mjs -function getVariableValues(schema, varDefNodes, inputs, options) { - const errors = []; - const maxErrors = options === null || options === void 0 ? void 0 : options.maxErrors; - try { - const coerced = coerceVariableValues( - schema, - varDefNodes, - inputs, - (error) => { - if (maxErrors != null && errors.length >= maxErrors) { - throw new GraphQLError( - "Too many errors processing variables, error limit reached. Execution aborted." - ); - } - errors.push(error); - } - ); - if (errors.length === 0) { - return { - coerced - }; - } - } catch (error) { - errors.push(error); - } - return { - errors - }; -} -function coerceVariableValues(schema, varDefNodes, inputs, onError) { - const coercedValues = {}; - for (const varDefNode of varDefNodes) { - const varName = varDefNode.variable.name.value; - const varType = typeFromAST(schema, varDefNode.type); - if (!isInputType(varType)) { - const varTypeStr = print(varDefNode.type); - onError( - new GraphQLError( - `Variable "$${varName}" expected value of type "${varTypeStr}" which cannot be used as an input type.`, - { - nodes: varDefNode.type - } - ) - ); - continue; - } - if (!hasOwnProperty(inputs, varName)) { - if (varDefNode.defaultValue) { - coercedValues[varName] = valueFromAST(varDefNode.defaultValue, varType); - } else if (isNonNullType(varType)) { - const varTypeStr = inspect(varType); - onError( - new GraphQLError( - `Variable "$${varName}" of required type "${varTypeStr}" was not provided.`, - { - nodes: varDefNode - } - ) - ); - } - continue; - } - const value = inputs[varName]; - if (value === null && isNonNullType(varType)) { - const varTypeStr = inspect(varType); - onError( - new GraphQLError( - `Variable "$${varName}" of non-null type "${varTypeStr}" must not be null.`, - { - nodes: varDefNode - } - ) - ); - continue; - } - coercedValues[varName] = coerceInputValue( - value, - varType, - (path, invalidValue, error) => { - let prefix = `Variable "$${varName}" got invalid value ` + inspect(invalidValue); - if (path.length > 0) { - prefix += ` at "${varName}${printPathArray(path)}"`; - } - onError( - new GraphQLError(prefix + "; " + error.message, { - nodes: varDefNode, - originalError: error - }) - ); - } - ); - } - return coercedValues; -} -function getArgumentValues(def, node, variableValues) { - var _node$arguments; - const coercedValues = {}; - const argumentNodes = (_node$arguments = node.arguments) !== null && _node$arguments !== void 0 ? _node$arguments : []; - const argNodeMap = keyMap(argumentNodes, (arg) => arg.name.value); - for (const argDef of def.args) { - const name = argDef.name; - const argType = argDef.type; - const argumentNode = argNodeMap[name]; - if (!argumentNode) { - if (argDef.defaultValue !== void 0) { - coercedValues[name] = argDef.defaultValue; - } else if (isNonNullType(argType)) { - throw new GraphQLError( - `Argument "${name}" of required type "${inspect(argType)}" was not provided.`, - { - nodes: node - } - ); - } - continue; - } - const valueNode = argumentNode.value; - let isNull = valueNode.kind === Kind.NULL; - if (valueNode.kind === Kind.VARIABLE) { - const variableName = valueNode.name.value; - if (variableValues == null || !hasOwnProperty(variableValues, variableName)) { - if (argDef.defaultValue !== void 0) { - coercedValues[name] = argDef.defaultValue; - } else if (isNonNullType(argType)) { - throw new GraphQLError( - `Argument "${name}" of required type "${inspect(argType)}" was provided the variable "$${variableName}" which was not provided a runtime value.`, - { - nodes: valueNode - } - ); - } - continue; - } - isNull = variableValues[variableName] == null; - } - if (isNull && isNonNullType(argType)) { - throw new GraphQLError( - `Argument "${name}" of non-null type "${inspect(argType)}" must not be null.`, - { - nodes: valueNode - } - ); - } - const coercedValue = valueFromAST(valueNode, argType, variableValues); - if (coercedValue === void 0) { - throw new GraphQLError( - `Argument "${name}" has invalid value ${print(valueNode)}.`, - { - nodes: valueNode - } - ); - } - coercedValues[name] = coercedValue; - } - return coercedValues; -} -function getDirectiveValues(directiveDef, node, variableValues) { - var _node$directives; - const directiveNode = (_node$directives = node.directives) === null || _node$directives === void 0 ? void 0 : _node$directives.find( - (directive) => directive.name.value === directiveDef.name - ); - if (directiveNode) { - return getArgumentValues(directiveDef, directiveNode, variableValues); - } -} -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -// node_modules/graphql/execution/collectFields.mjs -function collectFields(schema, fragments, variableValues, runtimeType, selectionSet) { - const fields = /* @__PURE__ */ new Map(); - collectFieldsImpl( - schema, - fragments, - variableValues, - runtimeType, - selectionSet, - fields, - /* @__PURE__ */ new Set() - ); - return fields; -} -function collectSubfields(schema, fragments, variableValues, returnType, fieldNodes) { - const subFieldNodes = /* @__PURE__ */ new Map(); - const visitedFragmentNames = /* @__PURE__ */ new Set(); - for (const node of fieldNodes) { - if (node.selectionSet) { - collectFieldsImpl( - schema, - fragments, - variableValues, - returnType, - node.selectionSet, - subFieldNodes, - visitedFragmentNames - ); - } - } - return subFieldNodes; -} -function collectFieldsImpl(schema, fragments, variableValues, runtimeType, selectionSet, fields, visitedFragmentNames) { - for (const selection of selectionSet.selections) { - switch (selection.kind) { - case Kind.FIELD: { - if (!shouldIncludeNode(variableValues, selection)) { - continue; - } - const name = getFieldEntryKey(selection); - const fieldList = fields.get(name); - if (fieldList !== void 0) { - fieldList.push(selection); - } else { - fields.set(name, [selection]); - } - break; - } - case Kind.INLINE_FRAGMENT: { - if (!shouldIncludeNode(variableValues, selection) || !doesFragmentConditionMatch(schema, selection, runtimeType)) { - continue; - } - collectFieldsImpl( - schema, - fragments, - variableValues, - runtimeType, - selection.selectionSet, - fields, - visitedFragmentNames - ); - break; - } - case Kind.FRAGMENT_SPREAD: { - const fragName = selection.name.value; - if (visitedFragmentNames.has(fragName) || !shouldIncludeNode(variableValues, selection)) { - continue; - } - visitedFragmentNames.add(fragName); - const fragment = fragments[fragName]; - if (!fragment || !doesFragmentConditionMatch(schema, fragment, runtimeType)) { - continue; - } - collectFieldsImpl( - schema, - fragments, - variableValues, - runtimeType, - fragment.selectionSet, - fields, - visitedFragmentNames - ); - break; - } - } - } -} -function shouldIncludeNode(variableValues, node) { - const skip = getDirectiveValues(GraphQLSkipDirective, node, variableValues); - if ((skip === null || skip === void 0 ? void 0 : skip.if) === true) { - return false; - } - const include = getDirectiveValues( - GraphQLIncludeDirective, - node, - variableValues - ); - if ((include === null || include === void 0 ? void 0 : include.if) === false) { - return false; - } - return true; -} -function doesFragmentConditionMatch(schema, fragment, type) { - const typeConditionNode = fragment.typeCondition; - if (!typeConditionNode) { - return true; - } - const conditionalType = typeFromAST(schema, typeConditionNode); - if (conditionalType === type) { - return true; - } - if (isAbstractType(conditionalType)) { - return schema.isSubType(conditionalType, type); - } - return false; -} -function getFieldEntryKey(node) { - return node.alias ? node.alias.value : node.name.value; -} - -// node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.mjs -function SingleFieldSubscriptionsRule(context) { - return { - OperationDefinition(node) { - if (node.operation === "subscription") { - const schema = context.getSchema(); - const subscriptionType = schema.getSubscriptionType(); - if (subscriptionType) { - const operationName = node.name ? node.name.value : null; - const variableValues = /* @__PURE__ */ Object.create(null); - const document = context.getDocument(); - const fragments = /* @__PURE__ */ Object.create(null); - for (const definition of document.definitions) { - if (definition.kind === Kind.FRAGMENT_DEFINITION) { - fragments[definition.name.value] = definition; - } - } - const fields = collectFields( - schema, - fragments, - variableValues, - subscriptionType, - node.selectionSet - ); - if (fields.size > 1) { - const fieldSelectionLists = [...fields.values()]; - const extraFieldSelectionLists = fieldSelectionLists.slice(1); - const extraFieldSelections = extraFieldSelectionLists.flat(); - context.reportError( - new GraphQLError( - operationName != null ? `Subscription "${operationName}" must select only one top level field.` : "Anonymous Subscription must select only one top level field.", - { - nodes: extraFieldSelections - } - ) - ); - } - for (const fieldNodes of fields.values()) { - const field = fieldNodes[0]; - const fieldName = field.name.value; - if (fieldName.startsWith("__")) { - context.reportError( - new GraphQLError( - operationName != null ? `Subscription "${operationName}" must not select an introspection top level field.` : "Anonymous Subscription must not select an introspection top level field.", - { - nodes: fieldNodes - } - ) - ); - } - } - } - } - } - }; -} - -// node_modules/graphql/jsutils/groupBy.mjs -function groupBy(list, keyFn) { - const result = /* @__PURE__ */ new Map(); - for (const item of list) { - const key = keyFn(item); - const group = result.get(key); - if (group === void 0) { - result.set(key, [item]); - } else { - group.push(item); - } - } - return result; -} - -// node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.mjs -function UniqueArgumentDefinitionNamesRule(context) { - return { - DirectiveDefinition(directiveNode) { - var _directiveNode$argume; - const argumentNodes = (_directiveNode$argume = directiveNode.arguments) !== null && _directiveNode$argume !== void 0 ? _directiveNode$argume : []; - return checkArgUniqueness(`@${directiveNode.name.value}`, argumentNodes); - }, - InterfaceTypeDefinition: checkArgUniquenessPerField, - InterfaceTypeExtension: checkArgUniquenessPerField, - ObjectTypeDefinition: checkArgUniquenessPerField, - ObjectTypeExtension: checkArgUniquenessPerField - }; - function checkArgUniquenessPerField(typeNode) { - var _typeNode$fields; - const typeName = typeNode.name.value; - const fieldNodes = (_typeNode$fields = typeNode.fields) !== null && _typeNode$fields !== void 0 ? _typeNode$fields : []; - for (const fieldDef of fieldNodes) { - var _fieldDef$arguments; - const fieldName = fieldDef.name.value; - const argumentNodes = (_fieldDef$arguments = fieldDef.arguments) !== null && _fieldDef$arguments !== void 0 ? _fieldDef$arguments : []; - checkArgUniqueness(`${typeName}.${fieldName}`, argumentNodes); - } - return false; - } - function checkArgUniqueness(parentName, argumentNodes) { - const seenArgs = groupBy(argumentNodes, (arg) => arg.name.value); - for (const [argName, argNodes] of seenArgs) { - if (argNodes.length > 1) { - context.reportError( - new GraphQLError( - `Argument "${parentName}(${argName}:)" can only be defined once.`, - { - nodes: argNodes.map((node) => node.name) - } - ) - ); - } - } - return false; - } -} - -// node_modules/graphql/validation/rules/UniqueArgumentNamesRule.mjs -function UniqueArgumentNamesRule(context) { - return { - Field: checkArgUniqueness, - Directive: checkArgUniqueness - }; - function checkArgUniqueness(parentNode) { - var _parentNode$arguments; - const argumentNodes = (_parentNode$arguments = parentNode.arguments) !== null && _parentNode$arguments !== void 0 ? _parentNode$arguments : []; - const seenArgs = groupBy(argumentNodes, (arg) => arg.name.value); - for (const [argName, argNodes] of seenArgs) { - if (argNodes.length > 1) { - context.reportError( - new GraphQLError( - `There can be only one argument named "${argName}".`, - { - nodes: argNodes.map((node) => node.name) - } - ) - ); - } - } - } -} - -// node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.mjs -function UniqueDirectiveNamesRule(context) { - const knownDirectiveNames = /* @__PURE__ */ Object.create(null); - const schema = context.getSchema(); - return { - DirectiveDefinition(node) { - const directiveName = node.name.value; - if (schema !== null && schema !== void 0 && schema.getDirective(directiveName)) { - context.reportError( - new GraphQLError( - `Directive "@${directiveName}" already exists in the schema. It cannot be redefined.`, - { - nodes: node.name - } - ) - ); - return; - } - if (knownDirectiveNames[directiveName]) { - context.reportError( - new GraphQLError( - `There can be only one directive named "@${directiveName}".`, - { - nodes: [knownDirectiveNames[directiveName], node.name] - } - ) - ); - } else { - knownDirectiveNames[directiveName] = node.name; - } - return false; - } - }; -} - -// node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs -function UniqueDirectivesPerLocationRule(context) { - const uniqueDirectiveMap = /* @__PURE__ */ Object.create(null); - const schema = context.getSchema(); - const definedDirectives = schema ? schema.getDirectives() : specifiedDirectives; - for (const directive of definedDirectives) { - uniqueDirectiveMap[directive.name] = !directive.isRepeatable; - } - const astDefinitions = context.getDocument().definitions; - for (const def of astDefinitions) { - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - uniqueDirectiveMap[def.name.value] = !def.repeatable; - } - } - const schemaDirectives = /* @__PURE__ */ Object.create(null); - const typeDirectivesMap = /* @__PURE__ */ Object.create(null); - return { - // Many different AST nodes may contain directives. Rather than listing - // them all, just listen for entering any node, and check to see if it - // defines any directives. - enter(node) { - if (!("directives" in node) || !node.directives) { - return; - } - let seenDirectives; - if (node.kind === Kind.SCHEMA_DEFINITION || node.kind === Kind.SCHEMA_EXTENSION) { - seenDirectives = schemaDirectives; - } else if (isTypeDefinitionNode(node) || isTypeExtensionNode(node)) { - const typeName = node.name.value; - seenDirectives = typeDirectivesMap[typeName]; - if (seenDirectives === void 0) { - typeDirectivesMap[typeName] = seenDirectives = /* @__PURE__ */ Object.create(null); - } - } else { - seenDirectives = /* @__PURE__ */ Object.create(null); - } - for (const directive of node.directives) { - const directiveName = directive.name.value; - if (uniqueDirectiveMap[directiveName]) { - if (seenDirectives[directiveName]) { - context.reportError( - new GraphQLError( - `The directive "@${directiveName}" can only be used once at this location.`, - { - nodes: [seenDirectives[directiveName], directive] - } - ) - ); - } else { - seenDirectives[directiveName] = directive; - } - } - } - } - }; -} - -// node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.mjs -function UniqueEnumValueNamesRule(context) { - const schema = context.getSchema(); - const existingTypeMap = schema ? schema.getTypeMap() : /* @__PURE__ */ Object.create(null); - const knownValueNames = /* @__PURE__ */ Object.create(null); - return { - EnumTypeDefinition: checkValueUniqueness, - EnumTypeExtension: checkValueUniqueness - }; - function checkValueUniqueness(node) { - var _node$values; - const typeName = node.name.value; - if (!knownValueNames[typeName]) { - knownValueNames[typeName] = /* @__PURE__ */ Object.create(null); - } - const valueNodes = (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : []; - const valueNames = knownValueNames[typeName]; - for (const valueDef of valueNodes) { - const valueName = valueDef.name.value; - const existingType = existingTypeMap[typeName]; - if (isEnumType(existingType) && existingType.getValue(valueName)) { - context.reportError( - new GraphQLError( - `Enum value "${typeName}.${valueName}" already exists in the schema. It cannot also be defined in this type extension.`, - { - nodes: valueDef.name - } - ) - ); - } else if (valueNames[valueName]) { - context.reportError( - new GraphQLError( - `Enum value "${typeName}.${valueName}" can only be defined once.`, - { - nodes: [valueNames[valueName], valueDef.name] - } - ) - ); - } else { - valueNames[valueName] = valueDef.name; - } - } - return false; - } -} - -// node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.mjs -function UniqueFieldDefinitionNamesRule(context) { - const schema = context.getSchema(); - const existingTypeMap = schema ? schema.getTypeMap() : /* @__PURE__ */ Object.create(null); - const knownFieldNames = /* @__PURE__ */ Object.create(null); - return { - InputObjectTypeDefinition: checkFieldUniqueness, - InputObjectTypeExtension: checkFieldUniqueness, - InterfaceTypeDefinition: checkFieldUniqueness, - InterfaceTypeExtension: checkFieldUniqueness, - ObjectTypeDefinition: checkFieldUniqueness, - ObjectTypeExtension: checkFieldUniqueness - }; - function checkFieldUniqueness(node) { - var _node$fields; - const typeName = node.name.value; - if (!knownFieldNames[typeName]) { - knownFieldNames[typeName] = /* @__PURE__ */ Object.create(null); - } - const fieldNodes = (_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : []; - const fieldNames = knownFieldNames[typeName]; - for (const fieldDef of fieldNodes) { - const fieldName = fieldDef.name.value; - if (hasField(existingTypeMap[typeName], fieldName)) { - context.reportError( - new GraphQLError( - `Field "${typeName}.${fieldName}" already exists in the schema. It cannot also be defined in this type extension.`, - { - nodes: fieldDef.name - } - ) - ); - } else if (fieldNames[fieldName]) { - context.reportError( - new GraphQLError( - `Field "${typeName}.${fieldName}" can only be defined once.`, - { - nodes: [fieldNames[fieldName], fieldDef.name] - } - ) - ); - } else { - fieldNames[fieldName] = fieldDef.name; - } - } - return false; - } -} -function hasField(type, fieldName) { - if (isObjectType(type) || isInterfaceType(type) || isInputObjectType(type)) { - return type.getFields()[fieldName] != null; - } - return false; -} - -// node_modules/graphql/validation/rules/UniqueFragmentNamesRule.mjs -function UniqueFragmentNamesRule(context) { - const knownFragmentNames = /* @__PURE__ */ Object.create(null); - return { - OperationDefinition: () => false, - FragmentDefinition(node) { - const fragmentName = node.name.value; - if (knownFragmentNames[fragmentName]) { - context.reportError( - new GraphQLError( - `There can be only one fragment named "${fragmentName}".`, - { - nodes: [knownFragmentNames[fragmentName], node.name] - } - ) - ); - } else { - knownFragmentNames[fragmentName] = node.name; - } - return false; - } - }; -} - -// node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.mjs -function UniqueInputFieldNamesRule(context) { - const knownNameStack = []; - let knownNames = /* @__PURE__ */ Object.create(null); - return { - ObjectValue: { - enter() { - knownNameStack.push(knownNames); - knownNames = /* @__PURE__ */ Object.create(null); - }, - leave() { - const prevKnownNames = knownNameStack.pop(); - prevKnownNames || invariant(false); - knownNames = prevKnownNames; - } - }, - ObjectField(node) { - const fieldName = node.name.value; - if (knownNames[fieldName]) { - context.reportError( - new GraphQLError( - `There can be only one input field named "${fieldName}".`, - { - nodes: [knownNames[fieldName], node.name] - } - ) - ); - } else { - knownNames[fieldName] = node.name; - } - } - }; -} - -// node_modules/graphql/validation/rules/UniqueOperationNamesRule.mjs -function UniqueOperationNamesRule(context) { - const knownOperationNames = /* @__PURE__ */ Object.create(null); - return { - OperationDefinition(node) { - const operationName = node.name; - if (operationName) { - if (knownOperationNames[operationName.value]) { - context.reportError( - new GraphQLError( - `There can be only one operation named "${operationName.value}".`, - { - nodes: [ - knownOperationNames[operationName.value], - operationName - ] - } - ) - ); - } else { - knownOperationNames[operationName.value] = operationName; - } - } - return false; - }, - FragmentDefinition: () => false - }; -} - -// node_modules/graphql/validation/rules/UniqueOperationTypesRule.mjs -function UniqueOperationTypesRule(context) { - const schema = context.getSchema(); - const definedOperationTypes = /* @__PURE__ */ Object.create(null); - const existingOperationTypes = schema ? { - query: schema.getQueryType(), - mutation: schema.getMutationType(), - subscription: schema.getSubscriptionType() - } : {}; - return { - SchemaDefinition: checkOperationTypes, - SchemaExtension: checkOperationTypes - }; - function checkOperationTypes(node) { - var _node$operationTypes; - const operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : []; - for (const operationType of operationTypesNodes) { - const operation = operationType.operation; - const alreadyDefinedOperationType = definedOperationTypes[operation]; - if (existingOperationTypes[operation]) { - context.reportError( - new GraphQLError( - `Type for ${operation} already defined in the schema. It cannot be redefined.`, - { - nodes: operationType - } - ) - ); - } else if (alreadyDefinedOperationType) { - context.reportError( - new GraphQLError( - `There can be only one ${operation} type in schema.`, - { - nodes: [alreadyDefinedOperationType, operationType] - } - ) - ); - } else { - definedOperationTypes[operation] = operationType; - } - } - return false; - } -} - -// node_modules/graphql/validation/rules/UniqueTypeNamesRule.mjs -function UniqueTypeNamesRule(context) { - const knownTypeNames = /* @__PURE__ */ Object.create(null); - const schema = context.getSchema(); - return { - ScalarTypeDefinition: checkTypeName, - ObjectTypeDefinition: checkTypeName, - InterfaceTypeDefinition: checkTypeName, - UnionTypeDefinition: checkTypeName, - EnumTypeDefinition: checkTypeName, - InputObjectTypeDefinition: checkTypeName - }; - function checkTypeName(node) { - const typeName = node.name.value; - if (schema !== null && schema !== void 0 && schema.getType(typeName)) { - context.reportError( - new GraphQLError( - `Type "${typeName}" already exists in the schema. It cannot also be defined in this type definition.`, - { - nodes: node.name - } - ) - ); - return; - } - if (knownTypeNames[typeName]) { - context.reportError( - new GraphQLError(`There can be only one type named "${typeName}".`, { - nodes: [knownTypeNames[typeName], node.name] - }) - ); - } else { - knownTypeNames[typeName] = node.name; - } - return false; - } -} - -// node_modules/graphql/validation/rules/UniqueVariableNamesRule.mjs -function UniqueVariableNamesRule(context) { - return { - OperationDefinition(operationNode) { - var _operationNode$variab; - const variableDefinitions = (_operationNode$variab = operationNode.variableDefinitions) !== null && _operationNode$variab !== void 0 ? _operationNode$variab : []; - const seenVariableDefinitions = groupBy( - variableDefinitions, - (node) => node.variable.name.value - ); - for (const [variableName, variableNodes] of seenVariableDefinitions) { - if (variableNodes.length > 1) { - context.reportError( - new GraphQLError( - `There can be only one variable named "$${variableName}".`, - { - nodes: variableNodes.map((node) => node.variable.name) - } - ) - ); - } - } - } - }; -} - -// node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs -function ValuesOfCorrectTypeRule(context) { - return { - ListValue(node) { - const type = getNullableType(context.getParentInputType()); - if (!isListType(type)) { - isValidValueNode(context, node); - return false; - } - }, - ObjectValue(node) { - const type = getNamedType(context.getInputType()); - if (!isInputObjectType(type)) { - isValidValueNode(context, node); - return false; - } - const fieldNodeMap = keyMap(node.fields, (field) => field.name.value); - for (const fieldDef of Object.values(type.getFields())) { - const fieldNode = fieldNodeMap[fieldDef.name]; - if (!fieldNode && isRequiredInputField(fieldDef)) { - const typeStr = inspect(fieldDef.type); - context.reportError( - new GraphQLError( - `Field "${type.name}.${fieldDef.name}" of required type "${typeStr}" was not provided.`, - { - nodes: node - } - ) - ); - } - } - }, - ObjectField(node) { - const parentType = getNamedType(context.getParentInputType()); - const fieldType = context.getInputType(); - if (!fieldType && isInputObjectType(parentType)) { - const suggestions = suggestionList( - node.name.value, - Object.keys(parentType.getFields()) - ); - context.reportError( - new GraphQLError( - `Field "${node.name.value}" is not defined by type "${parentType.name}".` + didYouMean(suggestions), - { - nodes: node - } - ) - ); - } - }, - NullValue(node) { - const type = context.getInputType(); - if (isNonNullType(type)) { - context.reportError( - new GraphQLError( - `Expected value of type "${inspect(type)}", found ${print(node)}.`, - { - nodes: node - } - ) - ); - } - }, - EnumValue: (node) => isValidValueNode(context, node), - IntValue: (node) => isValidValueNode(context, node), - FloatValue: (node) => isValidValueNode(context, node), - StringValue: (node) => isValidValueNode(context, node), - BooleanValue: (node) => isValidValueNode(context, node) - }; -} -function isValidValueNode(context, node) { - const locationType = context.getInputType(); - if (!locationType) { - return; - } - const type = getNamedType(locationType); - if (!isLeafType(type)) { - const typeStr = inspect(locationType); - context.reportError( - new GraphQLError( - `Expected value of type "${typeStr}", found ${print(node)}.`, - { - nodes: node - } - ) - ); - return; - } - try { - const parseResult = type.parseLiteral( - node, - void 0 - /* variables */ - ); - if (parseResult === void 0) { - const typeStr = inspect(locationType); - context.reportError( - new GraphQLError( - `Expected value of type "${typeStr}", found ${print(node)}.`, - { - nodes: node - } - ) - ); - } - } catch (error) { - const typeStr = inspect(locationType); - if (error instanceof GraphQLError) { - context.reportError(error); - } else { - context.reportError( - new GraphQLError( - `Expected value of type "${typeStr}", found ${print(node)}; ` + error.message, - { - nodes: node, - originalError: error - } - ) - ); - } - } -} - -// node_modules/graphql/validation/rules/VariablesAreInputTypesRule.mjs -function VariablesAreInputTypesRule(context) { - return { - VariableDefinition(node) { - const type = typeFromAST(context.getSchema(), node.type); - if (type !== void 0 && !isInputType(type)) { - const variableName = node.variable.name.value; - const typeName = print(node.type); - context.reportError( - new GraphQLError( - `Variable "$${variableName}" cannot be non-input type "${typeName}".`, - { - nodes: node.type - } - ) - ); - } - } - }; -} - -// node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.mjs -function VariablesInAllowedPositionRule(context) { - let varDefMap = /* @__PURE__ */ Object.create(null); - return { - OperationDefinition: { - enter() { - varDefMap = /* @__PURE__ */ Object.create(null); - }, - leave(operation) { - const usages = context.getRecursiveVariableUsages(operation); - for (const { node, type, defaultValue } of usages) { - const varName = node.name.value; - const varDef = varDefMap[varName]; - if (varDef && type) { - const schema = context.getSchema(); - const varType = typeFromAST(schema, varDef.type); - if (varType && !allowedVariableUsage( - schema, - varType, - varDef.defaultValue, - type, - defaultValue - )) { - const varTypeStr = inspect(varType); - const typeStr = inspect(type); - context.reportError( - new GraphQLError( - `Variable "$${varName}" of type "${varTypeStr}" used in position expecting type "${typeStr}".`, - { - nodes: [varDef, node] - } - ) - ); - } - } - } - } - }, - VariableDefinition(node) { - varDefMap[node.variable.name.value] = node; - } - }; -} -function allowedVariableUsage(schema, varType, varDefaultValue, locationType, locationDefaultValue) { - if (isNonNullType(locationType) && !isNonNullType(varType)) { - const hasNonNullVariableDefaultValue = varDefaultValue != null && varDefaultValue.kind !== Kind.NULL; - const hasLocationDefaultValue = locationDefaultValue !== void 0; - if (!hasNonNullVariableDefaultValue && !hasLocationDefaultValue) { - return false; - } - const nullableLocationType = locationType.ofType; - return isTypeSubTypeOf(schema, varType, nullableLocationType); - } - return isTypeSubTypeOf(schema, varType, locationType); -} - -// node_modules/graphql/validation/specifiedRules.mjs -var specifiedRules = Object.freeze([ - ExecutableDefinitionsRule, - UniqueOperationNamesRule, - LoneAnonymousOperationRule, - SingleFieldSubscriptionsRule, - KnownTypeNamesRule, - FragmentsOnCompositeTypesRule, - VariablesAreInputTypesRule, - ScalarLeafsRule, - FieldsOnCorrectTypeRule, - UniqueFragmentNamesRule, - KnownFragmentNamesRule, - NoUnusedFragmentsRule, - PossibleFragmentSpreadsRule, - NoFragmentCyclesRule, - UniqueVariableNamesRule, - NoUndefinedVariablesRule, - NoUnusedVariablesRule, - KnownDirectivesRule, - UniqueDirectivesPerLocationRule, - KnownArgumentNamesRule, - UniqueArgumentNamesRule, - ValuesOfCorrectTypeRule, - ProvidedRequiredArgumentsRule, - VariablesInAllowedPositionRule, - OverlappingFieldsCanBeMergedRule, - UniqueInputFieldNamesRule -]); -var specifiedSDLRules = Object.freeze([ - LoneSchemaDefinitionRule, - UniqueOperationTypesRule, - UniqueTypeNamesRule, - UniqueEnumValueNamesRule, - UniqueFieldDefinitionNamesRule, - UniqueArgumentDefinitionNamesRule, - UniqueDirectiveNamesRule, - KnownTypeNamesRule, - KnownDirectivesRule, - UniqueDirectivesPerLocationRule, - PossibleTypeExtensionsRule, - KnownArgumentNamesOnDirectivesRule, - UniqueArgumentNamesRule, - UniqueInputFieldNamesRule, - ProvidedRequiredArgumentsOnDirectivesRule -]); - -// node_modules/graphql/validation/ValidationContext.mjs -var ASTValidationContext = class { - constructor(ast, onError) { - this._ast = ast; - this._fragments = void 0; - this._fragmentSpreads = /* @__PURE__ */ new Map(); - this._recursivelyReferencedFragments = /* @__PURE__ */ new Map(); - this._onError = onError; - } - get [Symbol.toStringTag]() { - return "ASTValidationContext"; - } - reportError(error) { - this._onError(error); - } - getDocument() { - return this._ast; - } - getFragment(name) { - let fragments; - if (this._fragments) { - fragments = this._fragments; - } else { - fragments = /* @__PURE__ */ Object.create(null); - for (const defNode of this.getDocument().definitions) { - if (defNode.kind === Kind.FRAGMENT_DEFINITION) { - fragments[defNode.name.value] = defNode; - } - } - this._fragments = fragments; - } - return fragments[name]; - } - getFragmentSpreads(node) { - let spreads = this._fragmentSpreads.get(node); - if (!spreads) { - spreads = []; - const setsToVisit = [node]; - let set; - while (set = setsToVisit.pop()) { - for (const selection of set.selections) { - if (selection.kind === Kind.FRAGMENT_SPREAD) { - spreads.push(selection); - } else if (selection.selectionSet) { - setsToVisit.push(selection.selectionSet); - } - } - } - this._fragmentSpreads.set(node, spreads); - } - return spreads; - } - getRecursivelyReferencedFragments(operation) { - let fragments = this._recursivelyReferencedFragments.get(operation); - if (!fragments) { - fragments = []; - const collectedNames = /* @__PURE__ */ Object.create(null); - const nodesToVisit = [operation.selectionSet]; - let node; - while (node = nodesToVisit.pop()) { - for (const spread of this.getFragmentSpreads(node)) { - const fragName = spread.name.value; - if (collectedNames[fragName] !== true) { - collectedNames[fragName] = true; - const fragment = this.getFragment(fragName); - if (fragment) { - fragments.push(fragment); - nodesToVisit.push(fragment.selectionSet); - } - } - } - } - this._recursivelyReferencedFragments.set(operation, fragments); - } - return fragments; - } -}; -var SDLValidationContext = class extends ASTValidationContext { - constructor(ast, schema, onError) { - super(ast, onError); - this._schema = schema; - } - get [Symbol.toStringTag]() { - return "SDLValidationContext"; - } - getSchema() { - return this._schema; - } -}; -var ValidationContext = class extends ASTValidationContext { - constructor(schema, ast, typeInfo, onError) { - super(ast, onError); - this._schema = schema; - this._typeInfo = typeInfo; - this._variableUsages = /* @__PURE__ */ new Map(); - this._recursiveVariableUsages = /* @__PURE__ */ new Map(); - } - get [Symbol.toStringTag]() { - return "ValidationContext"; - } - getSchema() { - return this._schema; - } - getVariableUsages(node) { - let usages = this._variableUsages.get(node); - if (!usages) { - const newUsages = []; - const typeInfo = new TypeInfo(this._schema); - visit( - node, - visitWithTypeInfo(typeInfo, { - VariableDefinition: () => false, - Variable(variable) { - newUsages.push({ - node: variable, - type: typeInfo.getInputType(), - defaultValue: typeInfo.getDefaultValue() - }); - } - }) - ); - usages = newUsages; - this._variableUsages.set(node, usages); - } - return usages; - } - getRecursiveVariableUsages(operation) { - let usages = this._recursiveVariableUsages.get(operation); - if (!usages) { - usages = this.getVariableUsages(operation); - for (const frag of this.getRecursivelyReferencedFragments(operation)) { - usages = usages.concat(this.getVariableUsages(frag)); - } - this._recursiveVariableUsages.set(operation, usages); - } - return usages; - } - getType() { - return this._typeInfo.getType(); - } - getParentType() { - return this._typeInfo.getParentType(); - } - getInputType() { - return this._typeInfo.getInputType(); - } - getParentInputType() { - return this._typeInfo.getParentInputType(); - } - getFieldDef() { - return this._typeInfo.getFieldDef(); - } - getDirective() { - return this._typeInfo.getDirective(); - } - getArgument() { - return this._typeInfo.getArgument(); - } - getEnumValue() { - return this._typeInfo.getEnumValue(); - } -}; - -// node_modules/graphql/validation/validate.mjs -function validate(schema, documentAST, rules = specifiedRules, options, typeInfo = new TypeInfo(schema)) { - var _options$maxErrors; - const maxErrors = (_options$maxErrors = options === null || options === void 0 ? void 0 : options.maxErrors) !== null && _options$maxErrors !== void 0 ? _options$maxErrors : 100; - documentAST || devAssert(false, "Must provide document."); - assertValidSchema(schema); - const abortObj = Object.freeze({}); - const errors = []; - const context = new ValidationContext( - schema, - documentAST, - typeInfo, - (error) => { - if (errors.length >= maxErrors) { - errors.push( - new GraphQLError( - "Too many validation errors, error limit reached. Validation aborted." - ) - ); - throw abortObj; - } - errors.push(error); - } - ); - const visitor = visitInParallel(rules.map((rule) => rule(context))); - try { - visit(documentAST, visitWithTypeInfo(typeInfo, visitor)); - } catch (e) { - if (e !== abortObj) { - throw e; - } - } - return errors; -} -function validateSDL(documentAST, schemaToExtend, rules = specifiedSDLRules) { - const errors = []; - const context = new SDLValidationContext( - documentAST, - schemaToExtend, - (error) => { - errors.push(error); - } - ); - const visitors = rules.map((rule) => rule(context)); - visit(documentAST, visitInParallel(visitors)); - return errors; -} -function assertValidSDL(documentAST) { - const errors = validateSDL(documentAST); - if (errors.length !== 0) { - throw new Error(errors.map((error) => error.message).join("\n\n")); - } -} -function assertValidSDLExtension(documentAST, schema) { - const errors = validateSDL(documentAST, schema); - if (errors.length !== 0) { - throw new Error(errors.map((error) => error.message).join("\n\n")); - } -} - -// node_modules/graphql/jsutils/memoize3.mjs -function memoize3(fn) { - let cache0; - return function memoized(a1, a2, a3) { - if (cache0 === void 0) { - cache0 = /* @__PURE__ */ new WeakMap(); - } - let cache1 = cache0.get(a1); - if (cache1 === void 0) { - cache1 = /* @__PURE__ */ new WeakMap(); - cache0.set(a1, cache1); - } - let cache2 = cache1.get(a2); - if (cache2 === void 0) { - cache2 = /* @__PURE__ */ new WeakMap(); - cache1.set(a2, cache2); - } - let fnResult = cache2.get(a3); - if (fnResult === void 0) { - fnResult = fn(a1, a2, a3); - cache2.set(a3, fnResult); - } - return fnResult; - }; -} - -// node_modules/graphql/jsutils/promiseForObject.mjs -function promiseForObject(object) { - return Promise.all(Object.values(object)).then((resolvedValues) => { - const resolvedObject = /* @__PURE__ */ Object.create(null); - for (const [i, key] of Object.keys(object).entries()) { - resolvedObject[key] = resolvedValues[i]; - } - return resolvedObject; - }); -} - -// node_modules/graphql/jsutils/promiseReduce.mjs -function promiseReduce(values, callbackFn, initialValue) { - let accumulator = initialValue; - for (const value of values) { - accumulator = isPromise(accumulator) ? accumulator.then((resolved) => callbackFn(resolved, value)) : callbackFn(accumulator, value); - } - return accumulator; -} - -// node_modules/graphql/jsutils/toError.mjs -function toError(thrownValue) { - return thrownValue instanceof Error ? thrownValue : new NonErrorThrown(thrownValue); -} -var NonErrorThrown = class extends Error { - constructor(thrownValue) { - super("Unexpected error value: " + inspect(thrownValue)); - this.name = "NonErrorThrown"; - this.thrownValue = thrownValue; - } -}; - -// node_modules/graphql/error/locatedError.mjs -function locatedError(rawOriginalError, nodes, path) { - var _nodes; - const originalError = toError(rawOriginalError); - if (isLocatedGraphQLError(originalError)) { - return originalError; - } - return new GraphQLError(originalError.message, { - nodes: (_nodes = originalError.nodes) !== null && _nodes !== void 0 ? _nodes : nodes, - source: originalError.source, - positions: originalError.positions, - path, - originalError - }); -} -function isLocatedGraphQLError(error) { - return Array.isArray(error.path); -} - -// node_modules/graphql/execution/execute.mjs -var collectSubfields2 = memoize3( - (exeContext, returnType, fieldNodes) => collectSubfields( - exeContext.schema, - exeContext.fragments, - exeContext.variableValues, - returnType, - fieldNodes - ) -); -function execute(args) { - arguments.length < 2 || devAssert( - false, - "graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead." - ); - const { schema, document, variableValues, rootValue } = args; - assertValidExecutionArguments(schema, document, variableValues); - const exeContext = buildExecutionContext(args); - if (!("schema" in exeContext)) { - return { - errors: exeContext - }; - } - try { - const { operation } = exeContext; - const result = executeOperation(exeContext, operation, rootValue); - if (isPromise(result)) { - return result.then( - (data) => buildResponse(data, exeContext.errors), - (error) => { - exeContext.errors.push(error); - return buildResponse(null, exeContext.errors); - } - ); - } - return buildResponse(result, exeContext.errors); - } catch (error) { - exeContext.errors.push(error); - return buildResponse(null, exeContext.errors); - } -} -function executeSync(args) { - const result = execute(args); - if (isPromise(result)) { - throw new Error("GraphQL execution failed to complete synchronously."); - } - return result; -} -function buildResponse(data, errors) { - return errors.length === 0 ? { - data - } : { - errors, - data - }; -} -function assertValidExecutionArguments(schema, document, rawVariableValues) { - document || devAssert(false, "Must provide document."); - assertValidSchema(schema); - rawVariableValues == null || isObjectLike(rawVariableValues) || devAssert( - false, - "Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided." - ); -} -function buildExecutionContext(args) { - var _definition$name, _operation$variableDe; - const { - schema, - document, - rootValue, - contextValue, - variableValues: rawVariableValues, - operationName, - fieldResolver, - typeResolver, - subscribeFieldResolver - } = args; - let operation; - const fragments = /* @__PURE__ */ Object.create(null); - for (const definition of document.definitions) { - switch (definition.kind) { - case Kind.OPERATION_DEFINITION: - if (operationName == null) { - if (operation !== void 0) { - return [ - new GraphQLError( - "Must provide operation name if query contains multiple operations." - ) - ]; - } - operation = definition; - } else if (((_definition$name = definition.name) === null || _definition$name === void 0 ? void 0 : _definition$name.value) === operationName) { - operation = definition; - } - break; - case Kind.FRAGMENT_DEFINITION: - fragments[definition.name.value] = definition; - break; - default: - } - } - if (!operation) { - if (operationName != null) { - return [new GraphQLError(`Unknown operation named "${operationName}".`)]; - } - return [new GraphQLError("Must provide an operation.")]; - } - const variableDefinitions = (_operation$variableDe = operation.variableDefinitions) !== null && _operation$variableDe !== void 0 ? _operation$variableDe : []; - const coercedVariableValues = getVariableValues( - schema, - variableDefinitions, - rawVariableValues !== null && rawVariableValues !== void 0 ? rawVariableValues : {}, - { - maxErrors: 50 - } - ); - if (coercedVariableValues.errors) { - return coercedVariableValues.errors; - } - return { - schema, - fragments, - rootValue, - contextValue, - operation, - variableValues: coercedVariableValues.coerced, - fieldResolver: fieldResolver !== null && fieldResolver !== void 0 ? fieldResolver : defaultFieldResolver, - typeResolver: typeResolver !== null && typeResolver !== void 0 ? typeResolver : defaultTypeResolver, - subscribeFieldResolver: subscribeFieldResolver !== null && subscribeFieldResolver !== void 0 ? subscribeFieldResolver : defaultFieldResolver, - errors: [] - }; -} -function executeOperation(exeContext, operation, rootValue) { - const rootType = exeContext.schema.getRootType(operation.operation); - if (rootType == null) { - throw new GraphQLError( - `Schema is not configured to execute ${operation.operation} operation.`, - { - nodes: operation - } - ); - } - const rootFields = collectFields( - exeContext.schema, - exeContext.fragments, - exeContext.variableValues, - rootType, - operation.selectionSet - ); - const path = void 0; - switch (operation.operation) { - case OperationTypeNode.QUERY: - return executeFields(exeContext, rootType, rootValue, path, rootFields); - case OperationTypeNode.MUTATION: - return executeFieldsSerially( - exeContext, - rootType, - rootValue, - path, - rootFields - ); - case OperationTypeNode.SUBSCRIPTION: - return executeFields(exeContext, rootType, rootValue, path, rootFields); - } -} -function executeFieldsSerially(exeContext, parentType, sourceValue, path, fields) { - return promiseReduce( - fields.entries(), - (results, [responseName, fieldNodes]) => { - const fieldPath = addPath(path, responseName, parentType.name); - const result = executeField( - exeContext, - parentType, - sourceValue, - fieldNodes, - fieldPath - ); - if (result === void 0) { - return results; - } - if (isPromise(result)) { - return result.then((resolvedResult) => { - results[responseName] = resolvedResult; - return results; - }); - } - results[responseName] = result; - return results; - }, - /* @__PURE__ */ Object.create(null) - ); -} -function executeFields(exeContext, parentType, sourceValue, path, fields) { - const results = /* @__PURE__ */ Object.create(null); - let containsPromise = false; - try { - for (const [responseName, fieldNodes] of fields.entries()) { - const fieldPath = addPath(path, responseName, parentType.name); - const result = executeField( - exeContext, - parentType, - sourceValue, - fieldNodes, - fieldPath - ); - if (result !== void 0) { - results[responseName] = result; - if (isPromise(result)) { - containsPromise = true; - } - } - } - } catch (error) { - if (containsPromise) { - return promiseForObject(results).finally(() => { - throw error; - }); - } - throw error; - } - if (!containsPromise) { - return results; - } - return promiseForObject(results); -} -function executeField(exeContext, parentType, source, fieldNodes, path) { - var _fieldDef$resolve; - const fieldDef = getFieldDef2(exeContext.schema, parentType, fieldNodes[0]); - if (!fieldDef) { - return; - } - const returnType = fieldDef.type; - const resolveFn = (_fieldDef$resolve = fieldDef.resolve) !== null && _fieldDef$resolve !== void 0 ? _fieldDef$resolve : exeContext.fieldResolver; - const info = buildResolveInfo( - exeContext, - fieldDef, - fieldNodes, - parentType, - path - ); - try { - const args = getArgumentValues( - fieldDef, - fieldNodes[0], - exeContext.variableValues - ); - const contextValue = exeContext.contextValue; - const result = resolveFn(source, args, contextValue, info); - let completed; - if (isPromise(result)) { - completed = result.then( - (resolved) => completeValue(exeContext, returnType, fieldNodes, info, path, resolved) - ); - } else { - completed = completeValue( - exeContext, - returnType, - fieldNodes, - info, - path, - result - ); - } - if (isPromise(completed)) { - return completed.then(void 0, (rawError) => { - const error = locatedError(rawError, fieldNodes, pathToArray(path)); - return handleFieldError(error, returnType, exeContext); - }); - } - return completed; - } catch (rawError) { - const error = locatedError(rawError, fieldNodes, pathToArray(path)); - return handleFieldError(error, returnType, exeContext); - } -} -function buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path) { - return { - fieldName: fieldDef.name, - fieldNodes, - returnType: fieldDef.type, - parentType, - path, - schema: exeContext.schema, - fragments: exeContext.fragments, - rootValue: exeContext.rootValue, - operation: exeContext.operation, - variableValues: exeContext.variableValues - }; -} -function handleFieldError(error, returnType, exeContext) { - if (isNonNullType(returnType)) { - throw error; - } - exeContext.errors.push(error); - return null; -} -function completeValue(exeContext, returnType, fieldNodes, info, path, result) { - if (result instanceof Error) { - throw result; - } - if (isNonNullType(returnType)) { - const completed = completeValue( - exeContext, - returnType.ofType, - fieldNodes, - info, - path, - result - ); - if (completed === null) { - throw new Error( - `Cannot return null for non-nullable field ${info.parentType.name}.${info.fieldName}.` - ); - } - return completed; - } - if (result == null) { - return null; - } - if (isListType(returnType)) { - return completeListValue( - exeContext, - returnType, - fieldNodes, - info, - path, - result - ); - } - if (isLeafType(returnType)) { - return completeLeafValue(returnType, result); - } - if (isAbstractType(returnType)) { - return completeAbstractValue( - exeContext, - returnType, - fieldNodes, - info, - path, - result - ); - } - if (isObjectType(returnType)) { - return completeObjectValue( - exeContext, - returnType, - fieldNodes, - info, - path, - result - ); - } - invariant( - false, - "Cannot complete value of unexpected output type: " + inspect(returnType) - ); -} -function completeListValue(exeContext, returnType, fieldNodes, info, path, result) { - if (!isIterableObject(result)) { - throw new GraphQLError( - `Expected Iterable, but did not find one for field "${info.parentType.name}.${info.fieldName}".` - ); - } - const itemType = returnType.ofType; - let containsPromise = false; - const completedResults = Array.from(result, (item, index) => { - const itemPath = addPath(path, index, void 0); - try { - let completedItem; - if (isPromise(item)) { - completedItem = item.then( - (resolved) => completeValue( - exeContext, - itemType, - fieldNodes, - info, - itemPath, - resolved - ) - ); - } else { - completedItem = completeValue( - exeContext, - itemType, - fieldNodes, - info, - itemPath, - item - ); - } - if (isPromise(completedItem)) { - containsPromise = true; - return completedItem.then(void 0, (rawError) => { - const error = locatedError( - rawError, - fieldNodes, - pathToArray(itemPath) - ); - return handleFieldError(error, itemType, exeContext); - }); - } - return completedItem; - } catch (rawError) { - const error = locatedError(rawError, fieldNodes, pathToArray(itemPath)); - return handleFieldError(error, itemType, exeContext); - } - }); - return containsPromise ? Promise.all(completedResults) : completedResults; -} -function completeLeafValue(returnType, result) { - const serializedResult = returnType.serialize(result); - if (serializedResult == null) { - throw new Error( - `Expected \`${inspect(returnType)}.serialize(${inspect(result)})\` to return non-nullable value, returned: ${inspect(serializedResult)}` - ); - } - return serializedResult; -} -function completeAbstractValue(exeContext, returnType, fieldNodes, info, path, result) { - var _returnType$resolveTy; - const resolveTypeFn = (_returnType$resolveTy = returnType.resolveType) !== null && _returnType$resolveTy !== void 0 ? _returnType$resolveTy : exeContext.typeResolver; - const contextValue = exeContext.contextValue; - const runtimeType = resolveTypeFn(result, contextValue, info, returnType); - if (isPromise(runtimeType)) { - return runtimeType.then( - (resolvedRuntimeType) => completeObjectValue( - exeContext, - ensureValidRuntimeType( - resolvedRuntimeType, - exeContext, - returnType, - fieldNodes, - info, - result - ), - fieldNodes, - info, - path, - result - ) - ); - } - return completeObjectValue( - exeContext, - ensureValidRuntimeType( - runtimeType, - exeContext, - returnType, - fieldNodes, - info, - result - ), - fieldNodes, - info, - path, - result - ); -} -function ensureValidRuntimeType(runtimeTypeName, exeContext, returnType, fieldNodes, info, result) { - if (runtimeTypeName == null) { - throw new GraphQLError( - `Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}". Either the "${returnType.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`, - fieldNodes - ); - } - if (isObjectType(runtimeTypeName)) { - throw new GraphQLError( - "Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead." - ); - } - if (typeof runtimeTypeName !== "string") { - throw new GraphQLError( - `Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}" with value ${inspect(result)}, received "${inspect(runtimeTypeName)}".` - ); - } - const runtimeType = exeContext.schema.getType(runtimeTypeName); - if (runtimeType == null) { - throw new GraphQLError( - `Abstract type "${returnType.name}" was resolved to a type "${runtimeTypeName}" that does not exist inside the schema.`, - { - nodes: fieldNodes - } - ); - } - if (!isObjectType(runtimeType)) { - throw new GraphQLError( - `Abstract type "${returnType.name}" was resolved to a non-object type "${runtimeTypeName}".`, - { - nodes: fieldNodes - } - ); - } - if (!exeContext.schema.isSubType(returnType, runtimeType)) { - throw new GraphQLError( - `Runtime Object type "${runtimeType.name}" is not a possible type for "${returnType.name}".`, - { - nodes: fieldNodes - } - ); - } - return runtimeType; -} -function completeObjectValue(exeContext, returnType, fieldNodes, info, path, result) { - const subFieldNodes = collectSubfields2(exeContext, returnType, fieldNodes); - if (returnType.isTypeOf) { - const isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info); - if (isPromise(isTypeOf)) { - return isTypeOf.then((resolvedIsTypeOf) => { - if (!resolvedIsTypeOf) { - throw invalidReturnTypeError(returnType, result, fieldNodes); - } - return executeFields( - exeContext, - returnType, - result, - path, - subFieldNodes - ); - }); - } - if (!isTypeOf) { - throw invalidReturnTypeError(returnType, result, fieldNodes); - } - } - return executeFields(exeContext, returnType, result, path, subFieldNodes); -} -function invalidReturnTypeError(returnType, result, fieldNodes) { - return new GraphQLError( - `Expected value of type "${returnType.name}" but got: ${inspect(result)}.`, - { - nodes: fieldNodes - } - ); -} -var defaultTypeResolver = function(value, contextValue, info, abstractType) { - if (isObjectLike(value) && typeof value.__typename === "string") { - return value.__typename; - } - const possibleTypes = info.schema.getPossibleTypes(abstractType); - const promisedIsTypeOfResults = []; - for (let i = 0; i < possibleTypes.length; i++) { - const type = possibleTypes[i]; - if (type.isTypeOf) { - const isTypeOfResult = type.isTypeOf(value, contextValue, info); - if (isPromise(isTypeOfResult)) { - promisedIsTypeOfResults[i] = isTypeOfResult; - } else if (isTypeOfResult) { - return type.name; - } - } - } - if (promisedIsTypeOfResults.length) { - return Promise.all(promisedIsTypeOfResults).then((isTypeOfResults) => { - for (let i = 0; i < isTypeOfResults.length; i++) { - if (isTypeOfResults[i]) { - return possibleTypes[i].name; - } - } - }); - } -}; -var defaultFieldResolver = function(source, args, contextValue, info) { - if (isObjectLike(source) || typeof source === "function") { - const property = source[info.fieldName]; - if (typeof property === "function") { - return source[info.fieldName](args, contextValue, info); - } - return property; - } -}; -function getFieldDef2(schema, parentType, fieldNode) { - const fieldName = fieldNode.name.value; - if (fieldName === SchemaMetaFieldDef.name && schema.getQueryType() === parentType) { - return SchemaMetaFieldDef; - } else if (fieldName === TypeMetaFieldDef.name && schema.getQueryType() === parentType) { - return TypeMetaFieldDef; - } else if (fieldName === TypeNameMetaFieldDef.name) { - return TypeNameMetaFieldDef; - } - return parentType.getFields()[fieldName]; -} - -// node_modules/graphql/graphql.mjs -function graphql(args) { - return new Promise((resolve) => resolve(graphqlImpl(args))); -} -function graphqlSync(args) { - const result = graphqlImpl(args); - if (isPromise(result)) { - throw new Error("GraphQL execution failed to complete synchronously."); - } - return result; -} -function graphqlImpl(args) { - arguments.length < 2 || devAssert( - false, - "graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead." - ); - const { - schema, - source, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - typeResolver - } = args; - const schemaValidationErrors = validateSchema(schema); - if (schemaValidationErrors.length > 0) { - return { - errors: schemaValidationErrors - }; - } - let document; - try { - document = parse(source); - } catch (syntaxError2) { - return { - errors: [syntaxError2] - }; - } - const validationErrors = validate(schema, document); - if (validationErrors.length > 0) { - return { - errors: validationErrors - }; - } - return execute({ - schema, - document, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - typeResolver - }); -} - -// node_modules/graphql/jsutils/isAsyncIterable.mjs -function isAsyncIterable(maybeAsyncIterable) { - return typeof (maybeAsyncIterable === null || maybeAsyncIterable === void 0 ? void 0 : maybeAsyncIterable[Symbol.asyncIterator]) === "function"; -} - -// node_modules/graphql/execution/mapAsyncIterator.mjs -function mapAsyncIterator(iterable, callback) { - const iterator = iterable[Symbol.asyncIterator](); - async function mapResult(result) { - if (result.done) { - return result; - } - try { - return { - value: await callback(result.value), - done: false - }; - } catch (error) { - if (typeof iterator.return === "function") { - try { - await iterator.return(); - } catch (_e) { - } - } - throw error; - } - } - return { - async next() { - return mapResult(await iterator.next()); - }, - async return() { - return typeof iterator.return === "function" ? mapResult(await iterator.return()) : { - value: void 0, - done: true - }; - }, - async throw(error) { - if (typeof iterator.throw === "function") { - return mapResult(await iterator.throw(error)); - } - throw error; - }, - [Symbol.asyncIterator]() { - return this; - } - }; -} - -// node_modules/graphql/execution/subscribe.mjs -async function subscribe(args) { - arguments.length < 2 || devAssert( - false, - "graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead." - ); - const resultOrStream = await createSourceEventStream(args); - if (!isAsyncIterable(resultOrStream)) { - return resultOrStream; - } - const mapSourceToResponse = (payload) => execute({ ...args, rootValue: payload }); - return mapAsyncIterator(resultOrStream, mapSourceToResponse); -} -function toNormalizedArgs(args) { - const firstArg = args[0]; - if (firstArg && "document" in firstArg) { - return firstArg; - } - return { - schema: firstArg, - // FIXME: when underlying TS bug fixed, see https://github.com/microsoft/TypeScript/issues/31613 - document: args[1], - rootValue: args[2], - contextValue: args[3], - variableValues: args[4], - operationName: args[5], - subscribeFieldResolver: args[6] - }; -} -async function createSourceEventStream(...rawArgs) { - const args = toNormalizedArgs(rawArgs); - const { schema, document, variableValues } = args; - assertValidExecutionArguments(schema, document, variableValues); - const exeContext = buildExecutionContext(args); - if (!("schema" in exeContext)) { - return { - errors: exeContext - }; - } - try { - const eventStream = await executeSubscription(exeContext); - if (!isAsyncIterable(eventStream)) { - throw new Error( - `Subscription field must return Async Iterable. Received: ${inspect(eventStream)}.` - ); - } - return eventStream; - } catch (error) { - if (error instanceof GraphQLError) { - return { - errors: [error] - }; - } - throw error; - } -} -async function executeSubscription(exeContext) { - const { schema, fragments, operation, variableValues, rootValue } = exeContext; - const rootType = schema.getSubscriptionType(); - if (rootType == null) { - throw new GraphQLError( - "Schema is not configured to execute subscription operation.", - { - nodes: operation - } - ); - } - const rootFields = collectFields( - schema, - fragments, - variableValues, - rootType, - operation.selectionSet - ); - const [responseName, fieldNodes] = [...rootFields.entries()][0]; - const fieldDef = getFieldDef2(schema, rootType, fieldNodes[0]); - if (!fieldDef) { - const fieldName = fieldNodes[0].name.value; - throw new GraphQLError( - `The subscription field "${fieldName}" is not defined.`, - { - nodes: fieldNodes - } - ); - } - const path = addPath(void 0, responseName, rootType.name); - const info = buildResolveInfo( - exeContext, - fieldDef, - fieldNodes, - rootType, - path - ); - try { - var _fieldDef$subscribe; - const args = getArgumentValues(fieldDef, fieldNodes[0], variableValues); - const contextValue = exeContext.contextValue; - const resolveFn = (_fieldDef$subscribe = fieldDef.subscribe) !== null && _fieldDef$subscribe !== void 0 ? _fieldDef$subscribe : exeContext.subscribeFieldResolver; - const eventStream = await resolveFn(rootValue, args, contextValue, info); - if (eventStream instanceof Error) { - throw eventStream; - } - return eventStream; - } catch (error) { - throw locatedError(error, fieldNodes, pathToArray(path)); - } -} - -// node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.mjs -function NoDeprecatedCustomRule(context) { - return { - Field(node) { - const fieldDef = context.getFieldDef(); - const deprecationReason = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.deprecationReason; - if (fieldDef && deprecationReason != null) { - const parentType = context.getParentType(); - parentType != null || invariant(false); - context.reportError( - new GraphQLError( - `The field ${parentType.name}.${fieldDef.name} is deprecated. ${deprecationReason}`, - { - nodes: node - } - ) - ); - } - }, - Argument(node) { - const argDef = context.getArgument(); - const deprecationReason = argDef === null || argDef === void 0 ? void 0 : argDef.deprecationReason; - if (argDef && deprecationReason != null) { - const directiveDef = context.getDirective(); - if (directiveDef != null) { - context.reportError( - new GraphQLError( - `Directive "@${directiveDef.name}" argument "${argDef.name}" is deprecated. ${deprecationReason}`, - { - nodes: node - } - ) - ); - } else { - const parentType = context.getParentType(); - const fieldDef = context.getFieldDef(); - parentType != null && fieldDef != null || invariant(false); - context.reportError( - new GraphQLError( - `Field "${parentType.name}.${fieldDef.name}" argument "${argDef.name}" is deprecated. ${deprecationReason}`, - { - nodes: node - } - ) - ); - } - } - }, - ObjectField(node) { - const inputObjectDef = getNamedType(context.getParentInputType()); - if (isInputObjectType(inputObjectDef)) { - const inputFieldDef = inputObjectDef.getFields()[node.name.value]; - const deprecationReason = inputFieldDef === null || inputFieldDef === void 0 ? void 0 : inputFieldDef.deprecationReason; - if (deprecationReason != null) { - context.reportError( - new GraphQLError( - `The input field ${inputObjectDef.name}.${inputFieldDef.name} is deprecated. ${deprecationReason}`, - { - nodes: node - } - ) - ); - } - } - }, - EnumValue(node) { - const enumValueDef = context.getEnumValue(); - const deprecationReason = enumValueDef === null || enumValueDef === void 0 ? void 0 : enumValueDef.deprecationReason; - if (enumValueDef && deprecationReason != null) { - const enumTypeDef = getNamedType(context.getInputType()); - enumTypeDef != null || invariant(false); - context.reportError( - new GraphQLError( - `The enum value "${enumTypeDef.name}.${enumValueDef.name}" is deprecated. ${deprecationReason}`, - { - nodes: node - } - ) - ); - } - } - }; -} - -// node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs -function NoSchemaIntrospectionCustomRule(context) { - return { - Field(node) { - const type = getNamedType(context.getType()); - if (type && isIntrospectionType(type)) { - context.reportError( - new GraphQLError( - `GraphQL introspection has been disabled, but the requested query contained the field "${node.name.value}".`, - { - nodes: node - } - ) - ); - } - } - }; -} - -// node_modules/graphql/utilities/getIntrospectionQuery.mjs -function getIntrospectionQuery(options) { - const optionsWithDefault = { - descriptions: true, - specifiedByUrl: false, - directiveIsRepeatable: false, - schemaDescription: false, - inputValueDeprecation: false, - ...options - }; - const descriptions = optionsWithDefault.descriptions ? "description" : ""; - const specifiedByUrl = optionsWithDefault.specifiedByUrl ? "specifiedByURL" : ""; - const directiveIsRepeatable = optionsWithDefault.directiveIsRepeatable ? "isRepeatable" : ""; - const schemaDescription = optionsWithDefault.schemaDescription ? descriptions : ""; - function inputDeprecation(str) { - return optionsWithDefault.inputValueDeprecation ? str : ""; - } - return ` - query IntrospectionQuery { - __schema { - ${schemaDescription} - queryType { name } - mutationType { name } - subscriptionType { name } - types { - ...FullType - } - directives { - name - ${descriptions} - ${directiveIsRepeatable} - locations - args${inputDeprecation("(includeDeprecated: true)")} { - ...InputValue - } - } - } - } - - fragment FullType on __Type { - kind - name - ${descriptions} - ${specifiedByUrl} - fields(includeDeprecated: true) { - name - ${descriptions} - args${inputDeprecation("(includeDeprecated: true)")} { - ...InputValue - } - type { - ...TypeRef - } - isDeprecated - deprecationReason - } - inputFields${inputDeprecation("(includeDeprecated: true)")} { - ...InputValue - } - interfaces { - ...TypeRef - } - enumValues(includeDeprecated: true) { - name - ${descriptions} - isDeprecated - deprecationReason - } - possibleTypes { - ...TypeRef - } - } - - fragment InputValue on __InputValue { - name - ${descriptions} - type { ...TypeRef } - defaultValue - ${inputDeprecation("isDeprecated")} - ${inputDeprecation("deprecationReason")} - } - - fragment TypeRef on __Type { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - } - } - } - } - } - } - } - } - } - } - `; -} - -// node_modules/graphql/utilities/getOperationAST.mjs -function getOperationAST(documentAST, operationName) { - let operation = null; - for (const definition of documentAST.definitions) { - if (definition.kind === Kind.OPERATION_DEFINITION) { - var _definition$name; - if (operationName == null) { - if (operation) { - return null; - } - operation = definition; - } else if (((_definition$name = definition.name) === null || _definition$name === void 0 ? void 0 : _definition$name.value) === operationName) { - return definition; - } - } - } - return operation; -} - -// node_modules/graphql/utilities/getOperationRootType.mjs -function getOperationRootType(schema, operation) { - if (operation.operation === "query") { - const queryType = schema.getQueryType(); - if (!queryType) { - throw new GraphQLError( - "Schema does not define the required query root type.", - { - nodes: operation - } - ); - } - return queryType; - } - if (operation.operation === "mutation") { - const mutationType = schema.getMutationType(); - if (!mutationType) { - throw new GraphQLError("Schema is not configured for mutations.", { - nodes: operation - }); - } - return mutationType; - } - if (operation.operation === "subscription") { - const subscriptionType = schema.getSubscriptionType(); - if (!subscriptionType) { - throw new GraphQLError("Schema is not configured for subscriptions.", { - nodes: operation - }); - } - return subscriptionType; - } - throw new GraphQLError( - "Can only have query, mutation and subscription operations.", - { - nodes: operation - } - ); -} - -// node_modules/graphql/utilities/introspectionFromSchema.mjs -function introspectionFromSchema(schema, options) { - const optionsWithDefaults = { - specifiedByUrl: true, - directiveIsRepeatable: true, - schemaDescription: true, - inputValueDeprecation: true, - ...options - }; - const document = parse(getIntrospectionQuery(optionsWithDefaults)); - const result = executeSync({ - schema, - document - }); - !result.errors && result.data || invariant(false); - return result.data; -} - -// node_modules/graphql/utilities/buildClientSchema.mjs -function buildClientSchema(introspection, options) { - isObjectLike(introspection) && isObjectLike(introspection.__schema) || devAssert( - false, - `Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: ${inspect( - introspection - )}.` - ); - const schemaIntrospection = introspection.__schema; - const typeMap = keyValMap( - schemaIntrospection.types, - (typeIntrospection) => typeIntrospection.name, - (typeIntrospection) => buildType(typeIntrospection) - ); - for (const stdType of [...specifiedScalarTypes, ...introspectionTypes]) { - if (typeMap[stdType.name]) { - typeMap[stdType.name] = stdType; - } - } - const queryType = schemaIntrospection.queryType ? getObjectType(schemaIntrospection.queryType) : null; - const mutationType = schemaIntrospection.mutationType ? getObjectType(schemaIntrospection.mutationType) : null; - const subscriptionType = schemaIntrospection.subscriptionType ? getObjectType(schemaIntrospection.subscriptionType) : null; - const directives = schemaIntrospection.directives ? schemaIntrospection.directives.map(buildDirective) : []; - return new GraphQLSchema({ - description: schemaIntrospection.description, - query: queryType, - mutation: mutationType, - subscription: subscriptionType, - types: Object.values(typeMap), - directives, - assumeValid: options === null || options === void 0 ? void 0 : options.assumeValid - }); - function getType(typeRef) { - if (typeRef.kind === TypeKind.LIST) { - const itemRef = typeRef.ofType; - if (!itemRef) { - throw new Error("Decorated type deeper than introspection query."); - } - return new GraphQLList(getType(itemRef)); - } - if (typeRef.kind === TypeKind.NON_NULL) { - const nullableRef = typeRef.ofType; - if (!nullableRef) { - throw new Error("Decorated type deeper than introspection query."); - } - const nullableType = getType(nullableRef); - return new GraphQLNonNull(assertNullableType(nullableType)); - } - return getNamedType2(typeRef); - } - function getNamedType2(typeRef) { - const typeName = typeRef.name; - if (!typeName) { - throw new Error(`Unknown type reference: ${inspect(typeRef)}.`); - } - const type = typeMap[typeName]; - if (!type) { - throw new Error( - `Invalid or incomplete schema, unknown type: ${typeName}. Ensure that a full introspection query is used in order to build a client schema.` - ); - } - return type; - } - function getObjectType(typeRef) { - return assertObjectType(getNamedType2(typeRef)); - } - function getInterfaceType(typeRef) { - return assertInterfaceType(getNamedType2(typeRef)); - } - function buildType(type) { - if (type != null && type.name != null && type.kind != null) { - switch (type.kind) { - case TypeKind.SCALAR: - return buildScalarDef(type); - case TypeKind.OBJECT: - return buildObjectDef(type); - case TypeKind.INTERFACE: - return buildInterfaceDef(type); - case TypeKind.UNION: - return buildUnionDef(type); - case TypeKind.ENUM: - return buildEnumDef(type); - case TypeKind.INPUT_OBJECT: - return buildInputObjectDef(type); - } - } - const typeStr = inspect(type); - throw new Error( - `Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ${typeStr}.` - ); - } - function buildScalarDef(scalarIntrospection) { - return new GraphQLScalarType({ - name: scalarIntrospection.name, - description: scalarIntrospection.description, - specifiedByURL: scalarIntrospection.specifiedByURL - }); - } - function buildImplementationsList(implementingIntrospection) { - if (implementingIntrospection.interfaces === null && implementingIntrospection.kind === TypeKind.INTERFACE) { - return []; - } - if (!implementingIntrospection.interfaces) { - const implementingIntrospectionStr = inspect(implementingIntrospection); - throw new Error( - `Introspection result missing interfaces: ${implementingIntrospectionStr}.` - ); - } - return implementingIntrospection.interfaces.map(getInterfaceType); - } - function buildObjectDef(objectIntrospection) { - return new GraphQLObjectType({ - name: objectIntrospection.name, - description: objectIntrospection.description, - interfaces: () => buildImplementationsList(objectIntrospection), - fields: () => buildFieldDefMap(objectIntrospection) - }); - } - function buildInterfaceDef(interfaceIntrospection) { - return new GraphQLInterfaceType({ - name: interfaceIntrospection.name, - description: interfaceIntrospection.description, - interfaces: () => buildImplementationsList(interfaceIntrospection), - fields: () => buildFieldDefMap(interfaceIntrospection) - }); - } - function buildUnionDef(unionIntrospection) { - if (!unionIntrospection.possibleTypes) { - const unionIntrospectionStr = inspect(unionIntrospection); - throw new Error( - `Introspection result missing possibleTypes: ${unionIntrospectionStr}.` - ); - } - return new GraphQLUnionType({ - name: unionIntrospection.name, - description: unionIntrospection.description, - types: () => unionIntrospection.possibleTypes.map(getObjectType) - }); - } - function buildEnumDef(enumIntrospection) { - if (!enumIntrospection.enumValues) { - const enumIntrospectionStr = inspect(enumIntrospection); - throw new Error( - `Introspection result missing enumValues: ${enumIntrospectionStr}.` - ); - } - return new GraphQLEnumType({ - name: enumIntrospection.name, - description: enumIntrospection.description, - values: keyValMap( - enumIntrospection.enumValues, - (valueIntrospection) => valueIntrospection.name, - (valueIntrospection) => ({ - description: valueIntrospection.description, - deprecationReason: valueIntrospection.deprecationReason - }) - ) - }); - } - function buildInputObjectDef(inputObjectIntrospection) { - if (!inputObjectIntrospection.inputFields) { - const inputObjectIntrospectionStr = inspect(inputObjectIntrospection); - throw new Error( - `Introspection result missing inputFields: ${inputObjectIntrospectionStr}.` - ); - } - return new GraphQLInputObjectType({ - name: inputObjectIntrospection.name, - description: inputObjectIntrospection.description, - fields: () => buildInputValueDefMap(inputObjectIntrospection.inputFields) - }); - } - function buildFieldDefMap(typeIntrospection) { - if (!typeIntrospection.fields) { - throw new Error( - `Introspection result missing fields: ${inspect(typeIntrospection)}.` - ); - } - return keyValMap( - typeIntrospection.fields, - (fieldIntrospection) => fieldIntrospection.name, - buildField - ); - } - function buildField(fieldIntrospection) { - const type = getType(fieldIntrospection.type); - if (!isOutputType(type)) { - const typeStr = inspect(type); - throw new Error( - `Introspection must provide output type for fields, but received: ${typeStr}.` - ); - } - if (!fieldIntrospection.args) { - const fieldIntrospectionStr = inspect(fieldIntrospection); - throw new Error( - `Introspection result missing field args: ${fieldIntrospectionStr}.` - ); - } - return { - description: fieldIntrospection.description, - deprecationReason: fieldIntrospection.deprecationReason, - type, - args: buildInputValueDefMap(fieldIntrospection.args) - }; - } - function buildInputValueDefMap(inputValueIntrospections) { - return keyValMap( - inputValueIntrospections, - (inputValue) => inputValue.name, - buildInputValue - ); - } - function buildInputValue(inputValueIntrospection) { - const type = getType(inputValueIntrospection.type); - if (!isInputType(type)) { - const typeStr = inspect(type); - throw new Error( - `Introspection must provide input type for arguments, but received: ${typeStr}.` - ); - } - const defaultValue = inputValueIntrospection.defaultValue != null ? valueFromAST(parseValue(inputValueIntrospection.defaultValue), type) : void 0; - return { - description: inputValueIntrospection.description, - type, - defaultValue, - deprecationReason: inputValueIntrospection.deprecationReason - }; - } - function buildDirective(directiveIntrospection) { - if (!directiveIntrospection.args) { - const directiveIntrospectionStr = inspect(directiveIntrospection); - throw new Error( - `Introspection result missing directive args: ${directiveIntrospectionStr}.` - ); - } - if (!directiveIntrospection.locations) { - const directiveIntrospectionStr = inspect(directiveIntrospection); - throw new Error( - `Introspection result missing directive locations: ${directiveIntrospectionStr}.` - ); - } - return new GraphQLDirective({ - name: directiveIntrospection.name, - description: directiveIntrospection.description, - isRepeatable: directiveIntrospection.isRepeatable, - locations: directiveIntrospection.locations.slice(), - args: buildInputValueDefMap(directiveIntrospection.args) - }); - } -} - -// node_modules/graphql/utilities/extendSchema.mjs -function extendSchema(schema, documentAST, options) { - assertSchema(schema); - documentAST != null && documentAST.kind === Kind.DOCUMENT || devAssert(false, "Must provide valid Document AST."); - if ((options === null || options === void 0 ? void 0 : options.assumeValid) !== true && (options === null || options === void 0 ? void 0 : options.assumeValidSDL) !== true) { - assertValidSDLExtension(documentAST, schema); - } - const schemaConfig = schema.toConfig(); - const extendedConfig = extendSchemaImpl(schemaConfig, documentAST, options); - return schemaConfig === extendedConfig ? schema : new GraphQLSchema(extendedConfig); -} -function extendSchemaImpl(schemaConfig, documentAST, options) { - var _schemaDef, _schemaDef$descriptio, _schemaDef2, _options$assumeValid; - const typeDefs = []; - const typeExtensionsMap = /* @__PURE__ */ Object.create(null); - const directiveDefs = []; - let schemaDef; - const schemaExtensions = []; - for (const def of documentAST.definitions) { - if (def.kind === Kind.SCHEMA_DEFINITION) { - schemaDef = def; - } else if (def.kind === Kind.SCHEMA_EXTENSION) { - schemaExtensions.push(def); - } else if (isTypeDefinitionNode(def)) { - typeDefs.push(def); - } else if (isTypeExtensionNode(def)) { - const extendedTypeName = def.name.value; - const existingTypeExtensions = typeExtensionsMap[extendedTypeName]; - typeExtensionsMap[extendedTypeName] = existingTypeExtensions ? existingTypeExtensions.concat([def]) : [def]; - } else if (def.kind === Kind.DIRECTIVE_DEFINITION) { - directiveDefs.push(def); - } - } - if (Object.keys(typeExtensionsMap).length === 0 && typeDefs.length === 0 && directiveDefs.length === 0 && schemaExtensions.length === 0 && schemaDef == null) { - return schemaConfig; - } - const typeMap = /* @__PURE__ */ Object.create(null); - for (const existingType of schemaConfig.types) { - typeMap[existingType.name] = extendNamedType(existingType); - } - for (const typeNode of typeDefs) { - var _stdTypeMap$name; - const name = typeNode.name.value; - typeMap[name] = (_stdTypeMap$name = stdTypeMap[name]) !== null && _stdTypeMap$name !== void 0 ? _stdTypeMap$name : buildType(typeNode); - } - const operationTypes = { - // Get the extended root operation types. - query: schemaConfig.query && replaceNamedType(schemaConfig.query), - mutation: schemaConfig.mutation && replaceNamedType(schemaConfig.mutation), - subscription: schemaConfig.subscription && replaceNamedType(schemaConfig.subscription), - // Then, incorporate schema definition and all schema extensions. - ...schemaDef && getOperationTypes([schemaDef]), - ...getOperationTypes(schemaExtensions) - }; - return { - description: (_schemaDef = schemaDef) === null || _schemaDef === void 0 ? void 0 : (_schemaDef$descriptio = _schemaDef.description) === null || _schemaDef$descriptio === void 0 ? void 0 : _schemaDef$descriptio.value, - ...operationTypes, - types: Object.values(typeMap), - directives: [ - ...schemaConfig.directives.map(replaceDirective), - ...directiveDefs.map(buildDirective) - ], - extensions: /* @__PURE__ */ Object.create(null), - astNode: (_schemaDef2 = schemaDef) !== null && _schemaDef2 !== void 0 ? _schemaDef2 : schemaConfig.astNode, - extensionASTNodes: schemaConfig.extensionASTNodes.concat(schemaExtensions), - assumeValid: (_options$assumeValid = options === null || options === void 0 ? void 0 : options.assumeValid) !== null && _options$assumeValid !== void 0 ? _options$assumeValid : false - }; - function replaceType(type) { - if (isListType(type)) { - return new GraphQLList(replaceType(type.ofType)); - } - if (isNonNullType(type)) { - return new GraphQLNonNull(replaceType(type.ofType)); - } - return replaceNamedType(type); - } - function replaceNamedType(type) { - return typeMap[type.name]; - } - function replaceDirective(directive) { - const config = directive.toConfig(); - return new GraphQLDirective({ - ...config, - args: mapValue(config.args, extendArg) - }); - } - function extendNamedType(type) { - if (isIntrospectionType(type) || isSpecifiedScalarType(type)) { - return type; - } - if (isScalarType(type)) { - return extendScalarType(type); - } - if (isObjectType(type)) { - return extendObjectType(type); - } - if (isInterfaceType(type)) { - return extendInterfaceType(type); - } - if (isUnionType(type)) { - return extendUnionType(type); - } - if (isEnumType(type)) { - return extendEnumType(type); - } - if (isInputObjectType(type)) { - return extendInputObjectType(type); - } - invariant(false, "Unexpected type: " + inspect(type)); - } - function extendInputObjectType(type) { - var _typeExtensionsMap$co; - const config = type.toConfig(); - const extensions = (_typeExtensionsMap$co = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co !== void 0 ? _typeExtensionsMap$co : []; - return new GraphQLInputObjectType({ - ...config, - fields: () => ({ - ...mapValue(config.fields, (field) => ({ - ...field, - type: replaceType(field.type) - })), - ...buildInputFieldMap(extensions) - }), - extensionASTNodes: config.extensionASTNodes.concat(extensions) - }); - } - function extendEnumType(type) { - var _typeExtensionsMap$ty; - const config = type.toConfig(); - const extensions = (_typeExtensionsMap$ty = typeExtensionsMap[type.name]) !== null && _typeExtensionsMap$ty !== void 0 ? _typeExtensionsMap$ty : []; - return new GraphQLEnumType({ - ...config, - values: { ...config.values, ...buildEnumValueMap(extensions) }, - extensionASTNodes: config.extensionASTNodes.concat(extensions) - }); - } - function extendScalarType(type) { - var _typeExtensionsMap$co2; - const config = type.toConfig(); - const extensions = (_typeExtensionsMap$co2 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co2 !== void 0 ? _typeExtensionsMap$co2 : []; - let specifiedByURL = config.specifiedByURL; - for (const extensionNode of extensions) { - var _getSpecifiedByURL; - specifiedByURL = (_getSpecifiedByURL = getSpecifiedByURL(extensionNode)) !== null && _getSpecifiedByURL !== void 0 ? _getSpecifiedByURL : specifiedByURL; - } - return new GraphQLScalarType({ - ...config, - specifiedByURL, - extensionASTNodes: config.extensionASTNodes.concat(extensions) - }); - } - function extendObjectType(type) { - var _typeExtensionsMap$co3; - const config = type.toConfig(); - const extensions = (_typeExtensionsMap$co3 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co3 !== void 0 ? _typeExtensionsMap$co3 : []; - return new GraphQLObjectType({ - ...config, - interfaces: () => [ - ...type.getInterfaces().map(replaceNamedType), - ...buildInterfaces(extensions) - ], - fields: () => ({ - ...mapValue(config.fields, extendField), - ...buildFieldMap(extensions) - }), - extensionASTNodes: config.extensionASTNodes.concat(extensions) - }); - } - function extendInterfaceType(type) { - var _typeExtensionsMap$co4; - const config = type.toConfig(); - const extensions = (_typeExtensionsMap$co4 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co4 !== void 0 ? _typeExtensionsMap$co4 : []; - return new GraphQLInterfaceType({ - ...config, - interfaces: () => [ - ...type.getInterfaces().map(replaceNamedType), - ...buildInterfaces(extensions) - ], - fields: () => ({ - ...mapValue(config.fields, extendField), - ...buildFieldMap(extensions) - }), - extensionASTNodes: config.extensionASTNodes.concat(extensions) - }); - } - function extendUnionType(type) { - var _typeExtensionsMap$co5; - const config = type.toConfig(); - const extensions = (_typeExtensionsMap$co5 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co5 !== void 0 ? _typeExtensionsMap$co5 : []; - return new GraphQLUnionType({ - ...config, - types: () => [ - ...type.getTypes().map(replaceNamedType), - ...buildUnionTypes(extensions) - ], - extensionASTNodes: config.extensionASTNodes.concat(extensions) - }); - } - function extendField(field) { - return { - ...field, - type: replaceType(field.type), - args: field.args && mapValue(field.args, extendArg) - }; - } - function extendArg(arg) { - return { ...arg, type: replaceType(arg.type) }; - } - function getOperationTypes(nodes) { - const opTypes = {}; - for (const node of nodes) { - var _node$operationTypes; - const operationTypesNodes = ( - /* c8 ignore next */ - (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : [] - ); - for (const operationType of operationTypesNodes) { - opTypes[operationType.operation] = getNamedType2(operationType.type); - } - } - return opTypes; - } - function getNamedType2(node) { - var _stdTypeMap$name2; - const name = node.name.value; - const type = (_stdTypeMap$name2 = stdTypeMap[name]) !== null && _stdTypeMap$name2 !== void 0 ? _stdTypeMap$name2 : typeMap[name]; - if (type === void 0) { - throw new Error(`Unknown type: "${name}".`); - } - return type; - } - function getWrappedType(node) { - if (node.kind === Kind.LIST_TYPE) { - return new GraphQLList(getWrappedType(node.type)); - } - if (node.kind === Kind.NON_NULL_TYPE) { - return new GraphQLNonNull(getWrappedType(node.type)); - } - return getNamedType2(node); - } - function buildDirective(node) { - var _node$description; - return new GraphQLDirective({ - name: node.name.value, - description: (_node$description = node.description) === null || _node$description === void 0 ? void 0 : _node$description.value, - // @ts-expect-error - locations: node.locations.map(({ value }) => value), - isRepeatable: node.repeatable, - args: buildArgumentMap(node.arguments), - astNode: node - }); - } - function buildFieldMap(nodes) { - const fieldConfigMap = /* @__PURE__ */ Object.create(null); - for (const node of nodes) { - var _node$fields; - const nodeFields = ( - /* c8 ignore next */ - (_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : [] - ); - for (const field of nodeFields) { - var _field$description; - fieldConfigMap[field.name.value] = { - // Note: While this could make assertions to get the correctly typed - // value, that would throw immediately while type system validation - // with validateSchema() will produce more actionable results. - type: getWrappedType(field.type), - description: (_field$description = field.description) === null || _field$description === void 0 ? void 0 : _field$description.value, - args: buildArgumentMap(field.arguments), - deprecationReason: getDeprecationReason(field), - astNode: field - }; - } - } - return fieldConfigMap; - } - function buildArgumentMap(args) { - const argsNodes = ( - /* c8 ignore next */ - args !== null && args !== void 0 ? args : [] - ); - const argConfigMap = /* @__PURE__ */ Object.create(null); - for (const arg of argsNodes) { - var _arg$description; - const type = getWrappedType(arg.type); - argConfigMap[arg.name.value] = { - type, - description: (_arg$description = arg.description) === null || _arg$description === void 0 ? void 0 : _arg$description.value, - defaultValue: valueFromAST(arg.defaultValue, type), - deprecationReason: getDeprecationReason(arg), - astNode: arg - }; - } - return argConfigMap; - } - function buildInputFieldMap(nodes) { - const inputFieldMap = /* @__PURE__ */ Object.create(null); - for (const node of nodes) { - var _node$fields2; - const fieldsNodes = ( - /* c8 ignore next */ - (_node$fields2 = node.fields) !== null && _node$fields2 !== void 0 ? _node$fields2 : [] - ); - for (const field of fieldsNodes) { - var _field$description2; - const type = getWrappedType(field.type); - inputFieldMap[field.name.value] = { - type, - description: (_field$description2 = field.description) === null || _field$description2 === void 0 ? void 0 : _field$description2.value, - defaultValue: valueFromAST(field.defaultValue, type), - deprecationReason: getDeprecationReason(field), - astNode: field - }; - } - } - return inputFieldMap; - } - function buildEnumValueMap(nodes) { - const enumValueMap = /* @__PURE__ */ Object.create(null); - for (const node of nodes) { - var _node$values; - const valuesNodes = ( - /* c8 ignore next */ - (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : [] - ); - for (const value of valuesNodes) { - var _value$description; - enumValueMap[value.name.value] = { - description: (_value$description = value.description) === null || _value$description === void 0 ? void 0 : _value$description.value, - deprecationReason: getDeprecationReason(value), - astNode: value - }; - } - } - return enumValueMap; - } - function buildInterfaces(nodes) { - return nodes.flatMap( - // FIXME: https://github.com/graphql/graphql-js/issues/2203 - (node) => { - var _node$interfaces$map, _node$interfaces; - return ( - /* c8 ignore next */ - (_node$interfaces$map = (_node$interfaces = node.interfaces) === null || _node$interfaces === void 0 ? void 0 : _node$interfaces.map(getNamedType2)) !== null && _node$interfaces$map !== void 0 ? _node$interfaces$map : [] - ); - } - ); - } - function buildUnionTypes(nodes) { - return nodes.flatMap( - // FIXME: https://github.com/graphql/graphql-js/issues/2203 - (node) => { - var _node$types$map, _node$types; - return ( - /* c8 ignore next */ - (_node$types$map = (_node$types = node.types) === null || _node$types === void 0 ? void 0 : _node$types.map(getNamedType2)) !== null && _node$types$map !== void 0 ? _node$types$map : [] - ); - } - ); - } - function buildType(astNode) { - var _typeExtensionsMap$na; - const name = astNode.name.value; - const extensionASTNodes = (_typeExtensionsMap$na = typeExtensionsMap[name]) !== null && _typeExtensionsMap$na !== void 0 ? _typeExtensionsMap$na : []; - switch (astNode.kind) { - case Kind.OBJECT_TYPE_DEFINITION: { - var _astNode$description; - const allNodes = [astNode, ...extensionASTNodes]; - return new GraphQLObjectType({ - name, - description: (_astNode$description = astNode.description) === null || _astNode$description === void 0 ? void 0 : _astNode$description.value, - interfaces: () => buildInterfaces(allNodes), - fields: () => buildFieldMap(allNodes), - astNode, - extensionASTNodes - }); - } - case Kind.INTERFACE_TYPE_DEFINITION: { - var _astNode$description2; - const allNodes = [astNode, ...extensionASTNodes]; - return new GraphQLInterfaceType({ - name, - description: (_astNode$description2 = astNode.description) === null || _astNode$description2 === void 0 ? void 0 : _astNode$description2.value, - interfaces: () => buildInterfaces(allNodes), - fields: () => buildFieldMap(allNodes), - astNode, - extensionASTNodes - }); - } - case Kind.ENUM_TYPE_DEFINITION: { - var _astNode$description3; - const allNodes = [astNode, ...extensionASTNodes]; - return new GraphQLEnumType({ - name, - description: (_astNode$description3 = astNode.description) === null || _astNode$description3 === void 0 ? void 0 : _astNode$description3.value, - values: buildEnumValueMap(allNodes), - astNode, - extensionASTNodes - }); - } - case Kind.UNION_TYPE_DEFINITION: { - var _astNode$description4; - const allNodes = [astNode, ...extensionASTNodes]; - return new GraphQLUnionType({ - name, - description: (_astNode$description4 = astNode.description) === null || _astNode$description4 === void 0 ? void 0 : _astNode$description4.value, - types: () => buildUnionTypes(allNodes), - astNode, - extensionASTNodes - }); - } - case Kind.SCALAR_TYPE_DEFINITION: { - var _astNode$description5; - return new GraphQLScalarType({ - name, - description: (_astNode$description5 = astNode.description) === null || _astNode$description5 === void 0 ? void 0 : _astNode$description5.value, - specifiedByURL: getSpecifiedByURL(astNode), - astNode, - extensionASTNodes - }); - } - case Kind.INPUT_OBJECT_TYPE_DEFINITION: { - var _astNode$description6; - const allNodes = [astNode, ...extensionASTNodes]; - return new GraphQLInputObjectType({ - name, - description: (_astNode$description6 = astNode.description) === null || _astNode$description6 === void 0 ? void 0 : _astNode$description6.value, - fields: () => buildInputFieldMap(allNodes), - astNode, - extensionASTNodes - }); - } - } - } -} -var stdTypeMap = keyMap( - [...specifiedScalarTypes, ...introspectionTypes], - (type) => type.name -); -function getDeprecationReason(node) { - const deprecated = getDirectiveValues(GraphQLDeprecatedDirective, node); - return deprecated === null || deprecated === void 0 ? void 0 : deprecated.reason; -} -function getSpecifiedByURL(node) { - const specifiedBy = getDirectiveValues(GraphQLSpecifiedByDirective, node); - return specifiedBy === null || specifiedBy === void 0 ? void 0 : specifiedBy.url; -} - -// node_modules/graphql/utilities/buildASTSchema.mjs -function buildASTSchema(documentAST, options) { - documentAST != null && documentAST.kind === Kind.DOCUMENT || devAssert(false, "Must provide valid Document AST."); - if ((options === null || options === void 0 ? void 0 : options.assumeValid) !== true && (options === null || options === void 0 ? void 0 : options.assumeValidSDL) !== true) { - assertValidSDL(documentAST); - } - const emptySchemaConfig = { - description: void 0, - types: [], - directives: [], - extensions: /* @__PURE__ */ Object.create(null), - extensionASTNodes: [], - assumeValid: false - }; - const config = extendSchemaImpl(emptySchemaConfig, documentAST, options); - if (config.astNode == null) { - for (const type of config.types) { - switch (type.name) { - case "Query": - config.query = type; - break; - case "Mutation": - config.mutation = type; - break; - case "Subscription": - config.subscription = type; - break; - } - } - } - const directives = [ - ...config.directives, - // If specified directives were not explicitly declared, add them. - ...specifiedDirectives.filter( - (stdDirective) => config.directives.every( - (directive) => directive.name !== stdDirective.name - ) - ) - ]; - return new GraphQLSchema({ ...config, directives }); -} -function buildSchema(source, options) { - const document = parse(source, { - noLocation: options === null || options === void 0 ? void 0 : options.noLocation, - allowLegacyFragmentVariables: options === null || options === void 0 ? void 0 : options.allowLegacyFragmentVariables - }); - return buildASTSchema(document, { - assumeValidSDL: options === null || options === void 0 ? void 0 : options.assumeValidSDL, - assumeValid: options === null || options === void 0 ? void 0 : options.assumeValid - }); -} - -// node_modules/graphql/utilities/lexicographicSortSchema.mjs -function lexicographicSortSchema(schema) { - const schemaConfig = schema.toConfig(); - const typeMap = keyValMap( - sortByName(schemaConfig.types), - (type) => type.name, - sortNamedType - ); - return new GraphQLSchema({ - ...schemaConfig, - types: Object.values(typeMap), - directives: sortByName(schemaConfig.directives).map(sortDirective), - query: replaceMaybeType(schemaConfig.query), - mutation: replaceMaybeType(schemaConfig.mutation), - subscription: replaceMaybeType(schemaConfig.subscription) - }); - function replaceType(type) { - if (isListType(type)) { - return new GraphQLList(replaceType(type.ofType)); - } else if (isNonNullType(type)) { - return new GraphQLNonNull(replaceType(type.ofType)); - } - return replaceNamedType(type); - } - function replaceNamedType(type) { - return typeMap[type.name]; - } - function replaceMaybeType(maybeType) { - return maybeType && replaceNamedType(maybeType); - } - function sortDirective(directive) { - const config = directive.toConfig(); - return new GraphQLDirective({ - ...config, - locations: sortBy(config.locations, (x) => x), - args: sortArgs(config.args) - }); - } - function sortArgs(args) { - return sortObjMap(args, (arg) => ({ ...arg, type: replaceType(arg.type) })); - } - function sortFields2(fieldsMap) { - return sortObjMap(fieldsMap, (field) => ({ - ...field, - type: replaceType(field.type), - args: field.args && sortArgs(field.args) - })); - } - function sortInputFields(fieldsMap) { - return sortObjMap(fieldsMap, (field) => ({ - ...field, - type: replaceType(field.type) - })); - } - function sortTypes(array) { - return sortByName(array).map(replaceNamedType); - } - function sortNamedType(type) { - if (isScalarType(type) || isIntrospectionType(type)) { - return type; - } - if (isObjectType(type)) { - const config = type.toConfig(); - return new GraphQLObjectType({ - ...config, - interfaces: () => sortTypes(config.interfaces), - fields: () => sortFields2(config.fields) - }); - } - if (isInterfaceType(type)) { - const config = type.toConfig(); - return new GraphQLInterfaceType({ - ...config, - interfaces: () => sortTypes(config.interfaces), - fields: () => sortFields2(config.fields) - }); - } - if (isUnionType(type)) { - const config = type.toConfig(); - return new GraphQLUnionType({ - ...config, - types: () => sortTypes(config.types) - }); - } - if (isEnumType(type)) { - const config = type.toConfig(); - return new GraphQLEnumType({ - ...config, - values: sortObjMap(config.values, (value) => value) - }); - } - if (isInputObjectType(type)) { - const config = type.toConfig(); - return new GraphQLInputObjectType({ - ...config, - fields: () => sortInputFields(config.fields) - }); - } - invariant(false, "Unexpected type: " + inspect(type)); - } -} -function sortObjMap(map, sortValueFn) { - const sortedMap = /* @__PURE__ */ Object.create(null); - for (const key of Object.keys(map).sort(naturalCompare)) { - sortedMap[key] = sortValueFn(map[key]); - } - return sortedMap; -} -function sortByName(array) { - return sortBy(array, (obj) => obj.name); -} -function sortBy(array, mapToKey) { - return array.slice().sort((obj1, obj2) => { - const key1 = mapToKey(obj1); - const key2 = mapToKey(obj2); - return naturalCompare(key1, key2); - }); -} - -// node_modules/graphql/utilities/printSchema.mjs -function printSchema(schema) { - return printFilteredSchema( - schema, - (n) => !isSpecifiedDirective(n), - isDefinedType - ); -} -function printIntrospectionSchema(schema) { - return printFilteredSchema(schema, isSpecifiedDirective, isIntrospectionType); -} -function isDefinedType(type) { - return !isSpecifiedScalarType(type) && !isIntrospectionType(type); -} -function printFilteredSchema(schema, directiveFilter, typeFilter) { - const directives = schema.getDirectives().filter(directiveFilter); - const types = Object.values(schema.getTypeMap()).filter(typeFilter); - return [ - printSchemaDefinition(schema), - ...directives.map((directive) => printDirective(directive)), - ...types.map((type) => printType(type)) - ].filter(Boolean).join("\n\n"); -} -function printSchemaDefinition(schema) { - if (schema.description == null && isSchemaOfCommonNames(schema)) { - return; - } - const operationTypes = []; - const queryType = schema.getQueryType(); - if (queryType) { - operationTypes.push(` query: ${queryType.name}`); - } - const mutationType = schema.getMutationType(); - if (mutationType) { - operationTypes.push(` mutation: ${mutationType.name}`); - } - const subscriptionType = schema.getSubscriptionType(); - if (subscriptionType) { - operationTypes.push(` subscription: ${subscriptionType.name}`); - } - return printDescription(schema) + `schema { -${operationTypes.join("\n")} -}`; -} -function isSchemaOfCommonNames(schema) { - const queryType = schema.getQueryType(); - if (queryType && queryType.name !== "Query") { - return false; - } - const mutationType = schema.getMutationType(); - if (mutationType && mutationType.name !== "Mutation") { - return false; - } - const subscriptionType = schema.getSubscriptionType(); - if (subscriptionType && subscriptionType.name !== "Subscription") { - return false; - } - return true; -} -function printType(type) { - if (isScalarType(type)) { - return printScalar(type); - } - if (isObjectType(type)) { - return printObject(type); - } - if (isInterfaceType(type)) { - return printInterface(type); - } - if (isUnionType(type)) { - return printUnion(type); - } - if (isEnumType(type)) { - return printEnum(type); - } - if (isInputObjectType(type)) { - return printInputObject(type); - } - invariant(false, "Unexpected type: " + inspect(type)); -} -function printScalar(type) { - return printDescription(type) + `scalar ${type.name}` + printSpecifiedByURL(type); -} -function printImplementedInterfaces(type) { - const interfaces = type.getInterfaces(); - return interfaces.length ? " implements " + interfaces.map((i) => i.name).join(" & ") : ""; -} -function printObject(type) { - return printDescription(type) + `type ${type.name}` + printImplementedInterfaces(type) + printFields(type); -} -function printInterface(type) { - return printDescription(type) + `interface ${type.name}` + printImplementedInterfaces(type) + printFields(type); -} -function printUnion(type) { - const types = type.getTypes(); - const possibleTypes = types.length ? " = " + types.join(" | ") : ""; - return printDescription(type) + "union " + type.name + possibleTypes; -} -function printEnum(type) { - const values = type.getValues().map( - (value, i) => printDescription(value, " ", !i) + " " + value.name + printDeprecated(value.deprecationReason) - ); - return printDescription(type) + `enum ${type.name}` + printBlock(values); -} -function printInputObject(type) { - const fields = Object.values(type.getFields()).map( - (f, i) => printDescription(f, " ", !i) + " " + printInputValue(f) - ); - return printDescription(type) + `input ${type.name}` + printBlock(fields); -} -function printFields(type) { - const fields = Object.values(type.getFields()).map( - (f, i) => printDescription(f, " ", !i) + " " + f.name + printArgs(f.args, " ") + ": " + String(f.type) + printDeprecated(f.deprecationReason) - ); - return printBlock(fields); -} -function printBlock(items) { - return items.length !== 0 ? " {\n" + items.join("\n") + "\n}" : ""; -} -function printArgs(args, indentation = "") { - if (args.length === 0) { - return ""; - } - if (args.every((arg) => !arg.description)) { - return "(" + args.map(printInputValue).join(", ") + ")"; - } - return "(\n" + args.map( - (arg, i) => printDescription(arg, " " + indentation, !i) + " " + indentation + printInputValue(arg) - ).join("\n") + "\n" + indentation + ")"; -} -function printInputValue(arg) { - const defaultAST = astFromValue(arg.defaultValue, arg.type); - let argDecl = arg.name + ": " + String(arg.type); - if (defaultAST) { - argDecl += ` = ${print(defaultAST)}`; - } - return argDecl + printDeprecated(arg.deprecationReason); -} -function printDirective(directive) { - return printDescription(directive) + "directive @" + directive.name + printArgs(directive.args) + (directive.isRepeatable ? " repeatable" : "") + " on " + directive.locations.join(" | "); -} -function printDeprecated(reason) { - if (reason == null) { - return ""; - } - if (reason !== DEFAULT_DEPRECATION_REASON) { - const astValue = print({ - kind: Kind.STRING, - value: reason - }); - return ` @deprecated(reason: ${astValue})`; - } - return " @deprecated"; -} -function printSpecifiedByURL(scalar) { - if (scalar.specifiedByURL == null) { - return ""; - } - const astValue = print({ - kind: Kind.STRING, - value: scalar.specifiedByURL - }); - return ` @specifiedBy(url: ${astValue})`; -} -function printDescription(def, indentation = "", firstInBlock = true) { - const { description } = def; - if (description == null) { - return ""; - } - const blockString = print({ - kind: Kind.STRING, - value: description, - block: isPrintableAsBlockString(description) - }); - const prefix = indentation && !firstInBlock ? "\n" + indentation : indentation; - return prefix + blockString.replace(/\n/g, "\n" + indentation) + "\n"; -} - -// node_modules/graphql/utilities/concatAST.mjs -function concatAST(documents) { - const definitions = []; - for (const doc of documents) { - definitions.push(...doc.definitions); - } - return { - kind: Kind.DOCUMENT, - definitions - }; -} - -// node_modules/graphql/utilities/separateOperations.mjs -function separateOperations(documentAST) { - const operations = []; - const depGraph = /* @__PURE__ */ Object.create(null); - for (const definitionNode of documentAST.definitions) { - switch (definitionNode.kind) { - case Kind.OPERATION_DEFINITION: - operations.push(definitionNode); - break; - case Kind.FRAGMENT_DEFINITION: - depGraph[definitionNode.name.value] = collectDependencies( - definitionNode.selectionSet - ); - break; - default: - } - } - const separatedDocumentASTs = /* @__PURE__ */ Object.create(null); - for (const operation of operations) { - const dependencies = /* @__PURE__ */ new Set(); - for (const fragmentName of collectDependencies(operation.selectionSet)) { - collectTransitiveDependencies(dependencies, depGraph, fragmentName); - } - const operationName = operation.name ? operation.name.value : ""; - separatedDocumentASTs[operationName] = { - kind: Kind.DOCUMENT, - definitions: documentAST.definitions.filter( - (node) => node === operation || node.kind === Kind.FRAGMENT_DEFINITION && dependencies.has(node.name.value) - ) - }; - } - return separatedDocumentASTs; -} -function collectTransitiveDependencies(collected, depGraph, fromName) { - if (!collected.has(fromName)) { - collected.add(fromName); - const immediateDeps = depGraph[fromName]; - if (immediateDeps !== void 0) { - for (const toName of immediateDeps) { - collectTransitiveDependencies(collected, depGraph, toName); - } - } - } -} -function collectDependencies(selectionSet) { - const dependencies = []; - visit(selectionSet, { - FragmentSpread(node) { - dependencies.push(node.name.value); - } - }); - return dependencies; -} - -// node_modules/graphql/utilities/stripIgnoredCharacters.mjs -function stripIgnoredCharacters(source) { - const sourceObj = isSource(source) ? source : new Source(source); - const body = sourceObj.body; - const lexer = new Lexer(sourceObj); - let strippedBody = ""; - let wasLastAddedTokenNonPunctuator = false; - while (lexer.advance().kind !== TokenKind.EOF) { - const currentToken = lexer.token; - const tokenKind = currentToken.kind; - const isNonPunctuator = !isPunctuatorTokenKind(currentToken.kind); - if (wasLastAddedTokenNonPunctuator) { - if (isNonPunctuator || currentToken.kind === TokenKind.SPREAD) { - strippedBody += " "; - } - } - const tokenBody = body.slice(currentToken.start, currentToken.end); - if (tokenKind === TokenKind.BLOCK_STRING) { - strippedBody += printBlockString(currentToken.value, { - minimize: true - }); - } else { - strippedBody += tokenBody; - } - wasLastAddedTokenNonPunctuator = isNonPunctuator; - } - return strippedBody; -} - -// node_modules/graphql/utilities/assertValidName.mjs -function assertValidName(name) { - const error = isValidNameError(name); - if (error) { - throw error; - } - return name; -} -function isValidNameError(name) { - typeof name === "string" || devAssert(false, "Expected name to be a string."); - if (name.startsWith("__")) { - return new GraphQLError( - `Name "${name}" must not begin with "__", which is reserved by GraphQL introspection.` - ); - } - try { - assertName(name); - } catch (error) { - return error; - } -} - -// node_modules/graphql/utilities/findBreakingChanges.mjs -var BreakingChangeType; -(function(BreakingChangeType2) { - BreakingChangeType2["TYPE_REMOVED"] = "TYPE_REMOVED"; - BreakingChangeType2["TYPE_CHANGED_KIND"] = "TYPE_CHANGED_KIND"; - BreakingChangeType2["TYPE_REMOVED_FROM_UNION"] = "TYPE_REMOVED_FROM_UNION"; - BreakingChangeType2["VALUE_REMOVED_FROM_ENUM"] = "VALUE_REMOVED_FROM_ENUM"; - BreakingChangeType2["REQUIRED_INPUT_FIELD_ADDED"] = "REQUIRED_INPUT_FIELD_ADDED"; - BreakingChangeType2["IMPLEMENTED_INTERFACE_REMOVED"] = "IMPLEMENTED_INTERFACE_REMOVED"; - BreakingChangeType2["FIELD_REMOVED"] = "FIELD_REMOVED"; - BreakingChangeType2["FIELD_CHANGED_KIND"] = "FIELD_CHANGED_KIND"; - BreakingChangeType2["REQUIRED_ARG_ADDED"] = "REQUIRED_ARG_ADDED"; - BreakingChangeType2["ARG_REMOVED"] = "ARG_REMOVED"; - BreakingChangeType2["ARG_CHANGED_KIND"] = "ARG_CHANGED_KIND"; - BreakingChangeType2["DIRECTIVE_REMOVED"] = "DIRECTIVE_REMOVED"; - BreakingChangeType2["DIRECTIVE_ARG_REMOVED"] = "DIRECTIVE_ARG_REMOVED"; - BreakingChangeType2["REQUIRED_DIRECTIVE_ARG_ADDED"] = "REQUIRED_DIRECTIVE_ARG_ADDED"; - BreakingChangeType2["DIRECTIVE_REPEATABLE_REMOVED"] = "DIRECTIVE_REPEATABLE_REMOVED"; - BreakingChangeType2["DIRECTIVE_LOCATION_REMOVED"] = "DIRECTIVE_LOCATION_REMOVED"; -})(BreakingChangeType || (BreakingChangeType = {})); -var DangerousChangeType; -(function(DangerousChangeType2) { - DangerousChangeType2["VALUE_ADDED_TO_ENUM"] = "VALUE_ADDED_TO_ENUM"; - DangerousChangeType2["TYPE_ADDED_TO_UNION"] = "TYPE_ADDED_TO_UNION"; - DangerousChangeType2["OPTIONAL_INPUT_FIELD_ADDED"] = "OPTIONAL_INPUT_FIELD_ADDED"; - DangerousChangeType2["OPTIONAL_ARG_ADDED"] = "OPTIONAL_ARG_ADDED"; - DangerousChangeType2["IMPLEMENTED_INTERFACE_ADDED"] = "IMPLEMENTED_INTERFACE_ADDED"; - DangerousChangeType2["ARG_DEFAULT_VALUE_CHANGE"] = "ARG_DEFAULT_VALUE_CHANGE"; -})(DangerousChangeType || (DangerousChangeType = {})); -function findBreakingChanges(oldSchema, newSchema) { - return findSchemaChanges(oldSchema, newSchema).filter( - (change) => change.type in BreakingChangeType - ); -} -function findDangerousChanges(oldSchema, newSchema) { - return findSchemaChanges(oldSchema, newSchema).filter( - (change) => change.type in DangerousChangeType - ); -} -function findSchemaChanges(oldSchema, newSchema) { - return [ - ...findTypeChanges(oldSchema, newSchema), - ...findDirectiveChanges(oldSchema, newSchema) - ]; -} -function findDirectiveChanges(oldSchema, newSchema) { - const schemaChanges = []; - const directivesDiff = diff( - oldSchema.getDirectives(), - newSchema.getDirectives() - ); - for (const oldDirective of directivesDiff.removed) { - schemaChanges.push({ - type: BreakingChangeType.DIRECTIVE_REMOVED, - description: `${oldDirective.name} was removed.` - }); - } - for (const [oldDirective, newDirective] of directivesDiff.persisted) { - const argsDiff = diff(oldDirective.args, newDirective.args); - for (const newArg of argsDiff.added) { - if (isRequiredArgument(newArg)) { - schemaChanges.push({ - type: BreakingChangeType.REQUIRED_DIRECTIVE_ARG_ADDED, - description: `A required arg ${newArg.name} on directive ${oldDirective.name} was added.` - }); - } - } - for (const oldArg of argsDiff.removed) { - schemaChanges.push({ - type: BreakingChangeType.DIRECTIVE_ARG_REMOVED, - description: `${oldArg.name} was removed from ${oldDirective.name}.` - }); - } - if (oldDirective.isRepeatable && !newDirective.isRepeatable) { - schemaChanges.push({ - type: BreakingChangeType.DIRECTIVE_REPEATABLE_REMOVED, - description: `Repeatable flag was removed from ${oldDirective.name}.` - }); - } - for (const location of oldDirective.locations) { - if (!newDirective.locations.includes(location)) { - schemaChanges.push({ - type: BreakingChangeType.DIRECTIVE_LOCATION_REMOVED, - description: `${location} was removed from ${oldDirective.name}.` - }); - } - } - } - return schemaChanges; -} -function findTypeChanges(oldSchema, newSchema) { - const schemaChanges = []; - const typesDiff = diff( - Object.values(oldSchema.getTypeMap()), - Object.values(newSchema.getTypeMap()) - ); - for (const oldType of typesDiff.removed) { - schemaChanges.push({ - type: BreakingChangeType.TYPE_REMOVED, - description: isSpecifiedScalarType(oldType) ? `Standard scalar ${oldType.name} was removed because it is not referenced anymore.` : `${oldType.name} was removed.` - }); - } - for (const [oldType, newType] of typesDiff.persisted) { - if (isEnumType(oldType) && isEnumType(newType)) { - schemaChanges.push(...findEnumTypeChanges(oldType, newType)); - } else if (isUnionType(oldType) && isUnionType(newType)) { - schemaChanges.push(...findUnionTypeChanges(oldType, newType)); - } else if (isInputObjectType(oldType) && isInputObjectType(newType)) { - schemaChanges.push(...findInputObjectTypeChanges(oldType, newType)); - } else if (isObjectType(oldType) && isObjectType(newType)) { - schemaChanges.push( - ...findFieldChanges(oldType, newType), - ...findImplementedInterfacesChanges(oldType, newType) - ); - } else if (isInterfaceType(oldType) && isInterfaceType(newType)) { - schemaChanges.push( - ...findFieldChanges(oldType, newType), - ...findImplementedInterfacesChanges(oldType, newType) - ); - } else if (oldType.constructor !== newType.constructor) { - schemaChanges.push({ - type: BreakingChangeType.TYPE_CHANGED_KIND, - description: `${oldType.name} changed from ${typeKindName(oldType)} to ${typeKindName(newType)}.` - }); - } - } - return schemaChanges; -} -function findInputObjectTypeChanges(oldType, newType) { - const schemaChanges = []; - const fieldsDiff = diff( - Object.values(oldType.getFields()), - Object.values(newType.getFields()) - ); - for (const newField of fieldsDiff.added) { - if (isRequiredInputField(newField)) { - schemaChanges.push({ - type: BreakingChangeType.REQUIRED_INPUT_FIELD_ADDED, - description: `A required field ${newField.name} on input type ${oldType.name} was added.` - }); - } else { - schemaChanges.push({ - type: DangerousChangeType.OPTIONAL_INPUT_FIELD_ADDED, - description: `An optional field ${newField.name} on input type ${oldType.name} was added.` - }); - } - } - for (const oldField of fieldsDiff.removed) { - schemaChanges.push({ - type: BreakingChangeType.FIELD_REMOVED, - description: `${oldType.name}.${oldField.name} was removed.` - }); - } - for (const [oldField, newField] of fieldsDiff.persisted) { - const isSafe = isChangeSafeForInputObjectFieldOrFieldArg( - oldField.type, - newField.type - ); - if (!isSafe) { - schemaChanges.push({ - type: BreakingChangeType.FIELD_CHANGED_KIND, - description: `${oldType.name}.${oldField.name} changed type from ${String(oldField.type)} to ${String(newField.type)}.` - }); - } - } - return schemaChanges; -} -function findUnionTypeChanges(oldType, newType) { - const schemaChanges = []; - const possibleTypesDiff = diff(oldType.getTypes(), newType.getTypes()); - for (const newPossibleType of possibleTypesDiff.added) { - schemaChanges.push({ - type: DangerousChangeType.TYPE_ADDED_TO_UNION, - description: `${newPossibleType.name} was added to union type ${oldType.name}.` - }); - } - for (const oldPossibleType of possibleTypesDiff.removed) { - schemaChanges.push({ - type: BreakingChangeType.TYPE_REMOVED_FROM_UNION, - description: `${oldPossibleType.name} was removed from union type ${oldType.name}.` - }); - } - return schemaChanges; -} -function findEnumTypeChanges(oldType, newType) { - const schemaChanges = []; - const valuesDiff = diff(oldType.getValues(), newType.getValues()); - for (const newValue of valuesDiff.added) { - schemaChanges.push({ - type: DangerousChangeType.VALUE_ADDED_TO_ENUM, - description: `${newValue.name} was added to enum type ${oldType.name}.` - }); - } - for (const oldValue of valuesDiff.removed) { - schemaChanges.push({ - type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM, - description: `${oldValue.name} was removed from enum type ${oldType.name}.` - }); - } - return schemaChanges; -} -function findImplementedInterfacesChanges(oldType, newType) { - const schemaChanges = []; - const interfacesDiff = diff(oldType.getInterfaces(), newType.getInterfaces()); - for (const newInterface of interfacesDiff.added) { - schemaChanges.push({ - type: DangerousChangeType.IMPLEMENTED_INTERFACE_ADDED, - description: `${newInterface.name} added to interfaces implemented by ${oldType.name}.` - }); - } - for (const oldInterface of interfacesDiff.removed) { - schemaChanges.push({ - type: BreakingChangeType.IMPLEMENTED_INTERFACE_REMOVED, - description: `${oldType.name} no longer implements interface ${oldInterface.name}.` - }); - } - return schemaChanges; -} -function findFieldChanges(oldType, newType) { - const schemaChanges = []; - const fieldsDiff = diff( - Object.values(oldType.getFields()), - Object.values(newType.getFields()) - ); - for (const oldField of fieldsDiff.removed) { - schemaChanges.push({ - type: BreakingChangeType.FIELD_REMOVED, - description: `${oldType.name}.${oldField.name} was removed.` - }); - } - for (const [oldField, newField] of fieldsDiff.persisted) { - schemaChanges.push(...findArgChanges(oldType, oldField, newField)); - const isSafe = isChangeSafeForObjectOrInterfaceField( - oldField.type, - newField.type - ); - if (!isSafe) { - schemaChanges.push({ - type: BreakingChangeType.FIELD_CHANGED_KIND, - description: `${oldType.name}.${oldField.name} changed type from ${String(oldField.type)} to ${String(newField.type)}.` - }); - } - } - return schemaChanges; -} -function findArgChanges(oldType, oldField, newField) { - const schemaChanges = []; - const argsDiff = diff(oldField.args, newField.args); - for (const oldArg of argsDiff.removed) { - schemaChanges.push({ - type: BreakingChangeType.ARG_REMOVED, - description: `${oldType.name}.${oldField.name} arg ${oldArg.name} was removed.` - }); - } - for (const [oldArg, newArg] of argsDiff.persisted) { - const isSafe = isChangeSafeForInputObjectFieldOrFieldArg( - oldArg.type, - newArg.type - ); - if (!isSafe) { - schemaChanges.push({ - type: BreakingChangeType.ARG_CHANGED_KIND, - description: `${oldType.name}.${oldField.name} arg ${oldArg.name} has changed type from ${String(oldArg.type)} to ${String(newArg.type)}.` - }); - } else if (oldArg.defaultValue !== void 0) { - if (newArg.defaultValue === void 0) { - schemaChanges.push({ - type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, - description: `${oldType.name}.${oldField.name} arg ${oldArg.name} defaultValue was removed.` - }); - } else { - const oldValueStr = stringifyValue2(oldArg.defaultValue, oldArg.type); - const newValueStr = stringifyValue2(newArg.defaultValue, newArg.type); - if (oldValueStr !== newValueStr) { - schemaChanges.push({ - type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, - description: `${oldType.name}.${oldField.name} arg ${oldArg.name} has changed defaultValue from ${oldValueStr} to ${newValueStr}.` - }); - } - } - } - } - for (const newArg of argsDiff.added) { - if (isRequiredArgument(newArg)) { - schemaChanges.push({ - type: BreakingChangeType.REQUIRED_ARG_ADDED, - description: `A required arg ${newArg.name} on ${oldType.name}.${oldField.name} was added.` - }); - } else { - schemaChanges.push({ - type: DangerousChangeType.OPTIONAL_ARG_ADDED, - description: `An optional arg ${newArg.name} on ${oldType.name}.${oldField.name} was added.` - }); - } - } - return schemaChanges; -} -function isChangeSafeForObjectOrInterfaceField(oldType, newType) { - if (isListType(oldType)) { - return ( - // if they're both lists, make sure the underlying types are compatible - isListType(newType) && isChangeSafeForObjectOrInterfaceField( - oldType.ofType, - newType.ofType - ) || // moving from nullable to non-null of the same underlying type is safe - isNonNullType(newType) && isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType) - ); - } - if (isNonNullType(oldType)) { - return isNonNullType(newType) && isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType); - } - return ( - // if they're both named types, see if their names are equivalent - isNamedType(newType) && oldType.name === newType.name || // moving from nullable to non-null of the same underlying type is safe - isNonNullType(newType) && isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType) - ); -} -function isChangeSafeForInputObjectFieldOrFieldArg(oldType, newType) { - if (isListType(oldType)) { - return isListType(newType) && isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType); - } - if (isNonNullType(oldType)) { - return ( - // if they're both non-null, make sure the underlying types are - // compatible - isNonNullType(newType) && isChangeSafeForInputObjectFieldOrFieldArg( - oldType.ofType, - newType.ofType - ) || // moving from non-null to nullable of the same underlying type is safe - !isNonNullType(newType) && isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType) - ); - } - return isNamedType(newType) && oldType.name === newType.name; -} -function typeKindName(type) { - if (isScalarType(type)) { - return "a Scalar type"; - } - if (isObjectType(type)) { - return "an Object type"; - } - if (isInterfaceType(type)) { - return "an Interface type"; - } - if (isUnionType(type)) { - return "a Union type"; - } - if (isEnumType(type)) { - return "an Enum type"; - } - if (isInputObjectType(type)) { - return "an Input type"; - } - invariant(false, "Unexpected type: " + inspect(type)); -} -function stringifyValue2(value, type) { - const ast = astFromValue(value, type); - ast != null || invariant(false); - return print(sortValueNode(ast)); -} -function diff(oldArray, newArray) { - const added = []; - const removed = []; - const persisted = []; - const oldMap = keyMap(oldArray, ({ name }) => name); - const newMap = keyMap(newArray, ({ name }) => name); - for (const oldItem of oldArray) { - const newItem = newMap[oldItem.name]; - if (newItem === void 0) { - removed.push(oldItem); - } else { - persisted.push([oldItem, newItem]); - } - } - for (const newItem of newArray) { - if (oldMap[newItem.name] === void 0) { - added.push(newItem); - } - } - return { - added, - persisted, - removed - }; -} -export { - BREAK, - BreakingChangeType, - DEFAULT_DEPRECATION_REASON, - DangerousChangeType, - DirectiveLocation, - ExecutableDefinitionsRule, - FieldsOnCorrectTypeRule, - FragmentsOnCompositeTypesRule, - GRAPHQL_MAX_INT, - GRAPHQL_MIN_INT, - GraphQLBoolean, - GraphQLDeprecatedDirective, - GraphQLDirective, - GraphQLEnumType, - GraphQLError, - GraphQLFloat, - GraphQLID, - GraphQLIncludeDirective, - GraphQLInputObjectType, - GraphQLInt, - GraphQLInterfaceType, - GraphQLList, - GraphQLNonNull, - GraphQLObjectType, - GraphQLScalarType, - GraphQLSchema, - GraphQLSkipDirective, - GraphQLSpecifiedByDirective, - GraphQLString, - GraphQLUnionType, - Kind, - KnownArgumentNamesRule, - KnownDirectivesRule, - KnownFragmentNamesRule, - KnownTypeNamesRule, - Lexer, - Location, - LoneAnonymousOperationRule, - LoneSchemaDefinitionRule, - NoDeprecatedCustomRule, - NoFragmentCyclesRule, - NoSchemaIntrospectionCustomRule, - NoUndefinedVariablesRule, - NoUnusedFragmentsRule, - NoUnusedVariablesRule, - OperationTypeNode, - OverlappingFieldsCanBeMergedRule, - PossibleFragmentSpreadsRule, - PossibleTypeExtensionsRule, - ProvidedRequiredArgumentsRule, - ScalarLeafsRule, - SchemaMetaFieldDef, - SingleFieldSubscriptionsRule, - Source, - Token, - TokenKind, - TypeInfo, - TypeKind, - TypeMetaFieldDef, - TypeNameMetaFieldDef, - UniqueArgumentDefinitionNamesRule, - UniqueArgumentNamesRule, - UniqueDirectiveNamesRule, - UniqueDirectivesPerLocationRule, - UniqueEnumValueNamesRule, - UniqueFieldDefinitionNamesRule, - UniqueFragmentNamesRule, - UniqueInputFieldNamesRule, - UniqueOperationNamesRule, - UniqueOperationTypesRule, - UniqueTypeNamesRule, - UniqueVariableNamesRule, - ValidationContext, - ValuesOfCorrectTypeRule, - VariablesAreInputTypesRule, - VariablesInAllowedPositionRule, - __Directive, - __DirectiveLocation, - __EnumValue, - __Field, - __InputValue, - __Schema, - __Type, - __TypeKind, - assertAbstractType, - assertCompositeType, - assertDirective, - assertEnumType, - assertEnumValueName, - assertInputObjectType, - assertInputType, - assertInterfaceType, - assertLeafType, - assertListType, - assertName, - assertNamedType, - assertNonNullType, - assertNullableType, - assertObjectType, - assertOutputType, - assertScalarType, - assertSchema, - assertType, - assertUnionType, - assertValidName, - assertValidSchema, - assertWrappingType, - astFromValue, - buildASTSchema, - buildClientSchema, - buildSchema, - coerceInputValue, - concatAST, - createSourceEventStream, - defaultFieldResolver, - defaultTypeResolver, - doTypesOverlap, - execute, - executeSync, - extendSchema, - findBreakingChanges, - findDangerousChanges, - formatError, - getArgumentValues, - getDirectiveValues, - getEnterLeaveForKind, - getIntrospectionQuery, - getLocation, - getNamedType, - getNullableType, - getOperationAST, - getOperationRootType, - getVariableValues, - getVisitFn, - graphql, - graphqlSync, - introspectionFromSchema, - introspectionTypes, - isAbstractType, - isCompositeType, - isConstValueNode, - isDefinitionNode, - isDirective, - isEnumType, - isEqualType, - isExecutableDefinitionNode, - isInputObjectType, - isInputType, - isInterfaceType, - isIntrospectionType, - isLeafType, - isListType, - isNamedType, - isNonNullType, - isNullableType, - isObjectType, - isOutputType, - isRequiredArgument, - isRequiredInputField, - isScalarType, - isSchema, - isSelectionNode, - isSpecifiedDirective, - isSpecifiedScalarType, - isType, - isTypeDefinitionNode, - isTypeExtensionNode, - isTypeNode, - isTypeSubTypeOf, - isTypeSystemDefinitionNode, - isTypeSystemExtensionNode, - isUnionType, - isValidNameError, - isValueNode, - isWrappingType, - lexicographicSortSchema, - locatedError, - parse, - parseConstValue, - parseType, - parseValue, - print, - printError, - printIntrospectionSchema, - printLocation, - printSchema, - printSourceLocation, - printType, - resolveObjMapThunk, - resolveReadonlyArrayThunk, - pathToArray as responsePathAsArray, - separateOperations, - specifiedDirectives, - specifiedRules, - specifiedScalarTypes, - stripIgnoredCharacters, - subscribe, - syntaxError, - typeFromAST, - validate, - validateSchema, - valueFromAST, - valueFromASTUntyped, - version, - versionInfo, - visit, - visitInParallel, - visitWithTypeInfo -}; -//# sourceMappingURL=graphql.js.map diff --git a/node_modules/.vite/deps/graphql.js.map b/node_modules/.vite/deps/graphql.js.map deleted file mode 100644 index 6b27b453..00000000 --- a/node_modules/.vite/deps/graphql.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../../graphql/version.mjs", "../../graphql/jsutils/devAssert.mjs", "../../graphql/jsutils/isPromise.mjs", "../../graphql/jsutils/isObjectLike.mjs", "../../graphql/jsutils/invariant.mjs", "../../graphql/language/location.mjs", "../../graphql/language/printLocation.mjs", "../../graphql/error/GraphQLError.mjs", "../../graphql/error/syntaxError.mjs", "../../graphql/language/ast.mjs", "../../graphql/language/directiveLocation.mjs", "../../graphql/language/kinds.mjs", "../../graphql/language/characterClasses.mjs", "../../graphql/language/blockString.mjs", "../../graphql/language/tokenKind.mjs", "../../graphql/language/lexer.mjs", "../../graphql/jsutils/inspect.mjs", "../../graphql/jsutils/instanceOf.mjs", "../../graphql/language/source.mjs", "../../graphql/language/parser.mjs", "../../graphql/jsutils/didYouMean.mjs", "../../graphql/jsutils/identityFunc.mjs", "../../graphql/jsutils/keyMap.mjs", "../../graphql/jsutils/keyValMap.mjs", "../../graphql/jsutils/mapValue.mjs", "../../graphql/jsutils/naturalCompare.mjs", "../../graphql/jsutils/suggestionList.mjs", "../../graphql/jsutils/toObjMap.mjs", "../../graphql/language/printString.mjs", "../../graphql/language/visitor.mjs", "../../graphql/language/printer.mjs", "../../graphql/utilities/valueFromASTUntyped.mjs", "../../graphql/type/assertName.mjs", "../../graphql/type/definition.mjs", "../../graphql/utilities/typeComparators.mjs", "../../graphql/type/scalars.mjs", "../../graphql/type/directives.mjs", "../../graphql/jsutils/isIterableObject.mjs", "../../graphql/utilities/astFromValue.mjs", "../../graphql/type/introspection.mjs", "../../graphql/type/schema.mjs", "../../graphql/type/validate.mjs", "../../graphql/utilities/typeFromAST.mjs", "../../graphql/utilities/TypeInfo.mjs", "../../graphql/language/predicates.mjs", "../../graphql/validation/rules/ExecutableDefinitionsRule.mjs", "../../graphql/validation/rules/FieldsOnCorrectTypeRule.mjs", "../../graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs", "../../graphql/validation/rules/KnownArgumentNamesRule.mjs", "../../graphql/validation/rules/KnownDirectivesRule.mjs", "../../graphql/validation/rules/KnownFragmentNamesRule.mjs", "../../graphql/validation/rules/KnownTypeNamesRule.mjs", "../../graphql/validation/rules/LoneAnonymousOperationRule.mjs", "../../graphql/validation/rules/LoneSchemaDefinitionRule.mjs", "../../graphql/validation/rules/NoFragmentCyclesRule.mjs", "../../graphql/validation/rules/NoUndefinedVariablesRule.mjs", "../../graphql/validation/rules/NoUnusedFragmentsRule.mjs", "../../graphql/validation/rules/NoUnusedVariablesRule.mjs", "../../graphql/utilities/sortValueNode.mjs", "../../graphql/validation/rules/OverlappingFieldsCanBeMergedRule.mjs", "../../graphql/validation/rules/PossibleFragmentSpreadsRule.mjs", "../../graphql/validation/rules/PossibleTypeExtensionsRule.mjs", "../../graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs", "../../graphql/validation/rules/ScalarLeafsRule.mjs", "../../graphql/jsutils/printPathArray.mjs", "../../graphql/jsutils/Path.mjs", "../../graphql/utilities/coerceInputValue.mjs", "../../graphql/utilities/valueFromAST.mjs", "../../graphql/execution/values.mjs", "../../graphql/execution/collectFields.mjs", "../../graphql/validation/rules/SingleFieldSubscriptionsRule.mjs", "../../graphql/jsutils/groupBy.mjs", "../../graphql/validation/rules/UniqueArgumentDefinitionNamesRule.mjs", "../../graphql/validation/rules/UniqueArgumentNamesRule.mjs", "../../graphql/validation/rules/UniqueDirectiveNamesRule.mjs", "../../graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs", "../../graphql/validation/rules/UniqueEnumValueNamesRule.mjs", "../../graphql/validation/rules/UniqueFieldDefinitionNamesRule.mjs", "../../graphql/validation/rules/UniqueFragmentNamesRule.mjs", "../../graphql/validation/rules/UniqueInputFieldNamesRule.mjs", "../../graphql/validation/rules/UniqueOperationNamesRule.mjs", "../../graphql/validation/rules/UniqueOperationTypesRule.mjs", "../../graphql/validation/rules/UniqueTypeNamesRule.mjs", "../../graphql/validation/rules/UniqueVariableNamesRule.mjs", "../../graphql/validation/rules/ValuesOfCorrectTypeRule.mjs", "../../graphql/validation/rules/VariablesAreInputTypesRule.mjs", "../../graphql/validation/rules/VariablesInAllowedPositionRule.mjs", "../../graphql/validation/specifiedRules.mjs", "../../graphql/validation/ValidationContext.mjs", "../../graphql/validation/validate.mjs", "../../graphql/jsutils/memoize3.mjs", "../../graphql/jsutils/promiseForObject.mjs", "../../graphql/jsutils/promiseReduce.mjs", "../../graphql/jsutils/toError.mjs", "../../graphql/error/locatedError.mjs", "../../graphql/execution/execute.mjs", "../../graphql/graphql.mjs", "../../graphql/jsutils/isAsyncIterable.mjs", "../../graphql/execution/mapAsyncIterator.mjs", "../../graphql/execution/subscribe.mjs", "../../graphql/validation/rules/custom/NoDeprecatedCustomRule.mjs", "../../graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs", "../../graphql/utilities/getIntrospectionQuery.mjs", "../../graphql/utilities/getOperationAST.mjs", "../../graphql/utilities/getOperationRootType.mjs", "../../graphql/utilities/introspectionFromSchema.mjs", "../../graphql/utilities/buildClientSchema.mjs", "../../graphql/utilities/extendSchema.mjs", "../../graphql/utilities/buildASTSchema.mjs", "../../graphql/utilities/lexicographicSortSchema.mjs", "../../graphql/utilities/printSchema.mjs", "../../graphql/utilities/concatAST.mjs", "../../graphql/utilities/separateOperations.mjs", "../../graphql/utilities/stripIgnoredCharacters.mjs", "../../graphql/utilities/assertValidName.mjs", "../../graphql/utilities/findBreakingChanges.mjs"], - "sourcesContent": ["// Note: This file is autogenerated using \"resources/gen-version.js\" script and\n// automatically updated by \"npm version\" command.\n\n/**\n * A string containing the version of the GraphQL.js library\n */\nexport const version = '16.8.1';\n/**\n * An object containing the components of the GraphQL.js version string\n */\n\nexport const versionInfo = Object.freeze({\n major: 16,\n minor: 8,\n patch: 1,\n preReleaseTag: null,\n});\n", "export function devAssert(condition, message) {\n const booleanCondition = Boolean(condition);\n\n if (!booleanCondition) {\n throw new Error(message);\n }\n}\n", "/**\n * Returns true if the value acts like a Promise, i.e. has a \"then\" function,\n * otherwise returns false.\n */\nexport function isPromise(value) {\n return (\n typeof (value === null || value === void 0 ? void 0 : value.then) ===\n 'function'\n );\n}\n", "/**\n * Return true if `value` is object-like. A value is object-like if it's not\n * `null` and has a `typeof` result of \"object\".\n */\nexport function isObjectLike(value) {\n return typeof value == 'object' && value !== null;\n}\n", "export function invariant(condition, message) {\n const booleanCondition = Boolean(condition);\n\n if (!booleanCondition) {\n throw new Error(\n message != null ? message : 'Unexpected invariant triggered.',\n );\n }\n}\n", "import { invariant } from '../jsutils/invariant.mjs';\nconst LineRegExp = /\\r\\n|[\\n\\r]/g;\n/**\n * Represents a location in a Source.\n */\n\n/**\n * Takes a Source and a UTF-8 character offset, and returns the corresponding\n * line and column as a SourceLocation.\n */\nexport function getLocation(source, position) {\n let lastLineStart = 0;\n let line = 1;\n\n for (const match of source.body.matchAll(LineRegExp)) {\n typeof match.index === 'number' || invariant(false);\n\n if (match.index >= position) {\n break;\n }\n\n lastLineStart = match.index + match[0].length;\n line += 1;\n }\n\n return {\n line,\n column: position + 1 - lastLineStart,\n };\n}\n", "import { getLocation } from './location.mjs';\n\n/**\n * Render a helpful description of the location in the GraphQL Source document.\n */\nexport function printLocation(location) {\n return printSourceLocation(\n location.source,\n getLocation(location.source, location.start),\n );\n}\n/**\n * Render a helpful description of the location in the GraphQL Source document.\n */\n\nexport function printSourceLocation(source, sourceLocation) {\n const firstLineColumnOffset = source.locationOffset.column - 1;\n const body = ''.padStart(firstLineColumnOffset) + source.body;\n const lineIndex = sourceLocation.line - 1;\n const lineOffset = source.locationOffset.line - 1;\n const lineNum = sourceLocation.line + lineOffset;\n const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0;\n const columnNum = sourceLocation.column + columnOffset;\n const locationStr = `${source.name}:${lineNum}:${columnNum}\\n`;\n const lines = body.split(/\\r\\n|[\\n\\r]/g);\n const locationLine = lines[lineIndex]; // Special case for minified documents\n\n if (locationLine.length > 120) {\n const subLineIndex = Math.floor(columnNum / 80);\n const subLineColumnNum = columnNum % 80;\n const subLines = [];\n\n for (let i = 0; i < locationLine.length; i += 80) {\n subLines.push(locationLine.slice(i, i + 80));\n }\n\n return (\n locationStr +\n printPrefixedLines([\n [`${lineNum} |`, subLines[0]],\n ...subLines.slice(1, subLineIndex + 1).map((subLine) => ['|', subLine]),\n ['|', '^'.padStart(subLineColumnNum)],\n ['|', subLines[subLineIndex + 1]],\n ])\n );\n }\n\n return (\n locationStr +\n printPrefixedLines([\n // Lines specified like this: [\"prefix\", \"string\"],\n [`${lineNum - 1} |`, lines[lineIndex - 1]],\n [`${lineNum} |`, locationLine],\n ['|', '^'.padStart(columnNum)],\n [`${lineNum + 1} |`, lines[lineIndex + 1]],\n ])\n );\n}\n\nfunction printPrefixedLines(lines) {\n const existingLines = lines.filter(([_, line]) => line !== undefined);\n const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length));\n return existingLines\n .map(([prefix, line]) => prefix.padStart(padLen) + (line ? ' ' + line : ''))\n .join('\\n');\n}\n", "import { isObjectLike } from '../jsutils/isObjectLike.mjs';\nimport { getLocation } from '../language/location.mjs';\nimport {\n printLocation,\n printSourceLocation,\n} from '../language/printLocation.mjs';\n\nfunction toNormalizedOptions(args) {\n const firstArg = args[0];\n\n if (firstArg == null || 'kind' in firstArg || 'length' in firstArg) {\n return {\n nodes: firstArg,\n source: args[1],\n positions: args[2],\n path: args[3],\n originalError: args[4],\n extensions: args[5],\n };\n }\n\n return firstArg;\n}\n/**\n * A GraphQLError describes an Error found during the parse, validate, or\n * execute phases of performing a GraphQL operation. In addition to a message\n * and stack trace, it also includes information about the locations in a\n * GraphQL document and/or execution result that correspond to the Error.\n */\n\nexport class GraphQLError extends Error {\n /**\n * An array of `{ line, column }` locations within the source GraphQL document\n * which correspond to this error.\n *\n * Errors during validation often contain multiple locations, for example to\n * point out two things with the same name. Errors during execution include a\n * single location, the field which produced the error.\n *\n * Enumerable, and appears in the result of JSON.stringify().\n */\n\n /**\n * An array describing the JSON-path into the execution response which\n * corresponds to this error. Only included for errors during execution.\n *\n * Enumerable, and appears in the result of JSON.stringify().\n */\n\n /**\n * An array of GraphQL AST Nodes corresponding to this error.\n */\n\n /**\n * The source GraphQL document for the first location of this error.\n *\n * Note that if this Error represents more than one node, the source may not\n * represent nodes after the first node.\n */\n\n /**\n * An array of character offsets within the source GraphQL document\n * which correspond to this error.\n */\n\n /**\n * The original error thrown from a field resolver during execution.\n */\n\n /**\n * Extension fields to add to the formatted error.\n */\n\n /**\n * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.\n */\n constructor(message, ...rawArgs) {\n var _this$nodes, _nodeLocations$, _ref;\n\n const { nodes, source, positions, path, originalError, extensions } =\n toNormalizedOptions(rawArgs);\n super(message);\n this.name = 'GraphQLError';\n this.path = path !== null && path !== void 0 ? path : undefined;\n this.originalError =\n originalError !== null && originalError !== void 0\n ? originalError\n : undefined; // Compute list of blame nodes.\n\n this.nodes = undefinedIfEmpty(\n Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined,\n );\n const nodeLocations = undefinedIfEmpty(\n (_this$nodes = this.nodes) === null || _this$nodes === void 0\n ? void 0\n : _this$nodes.map((node) => node.loc).filter((loc) => loc != null),\n ); // Compute locations in the source for the given nodes/positions.\n\n this.source =\n source !== null && source !== void 0\n ? source\n : nodeLocations === null || nodeLocations === void 0\n ? void 0\n : (_nodeLocations$ = nodeLocations[0]) === null ||\n _nodeLocations$ === void 0\n ? void 0\n : _nodeLocations$.source;\n this.positions =\n positions !== null && positions !== void 0\n ? positions\n : nodeLocations === null || nodeLocations === void 0\n ? void 0\n : nodeLocations.map((loc) => loc.start);\n this.locations =\n positions && source\n ? positions.map((pos) => getLocation(source, pos))\n : nodeLocations === null || nodeLocations === void 0\n ? void 0\n : nodeLocations.map((loc) => getLocation(loc.source, loc.start));\n const originalExtensions = isObjectLike(\n originalError === null || originalError === void 0\n ? void 0\n : originalError.extensions,\n )\n ? originalError === null || originalError === void 0\n ? void 0\n : originalError.extensions\n : undefined;\n this.extensions =\n (_ref =\n extensions !== null && extensions !== void 0\n ? extensions\n : originalExtensions) !== null && _ref !== void 0\n ? _ref\n : Object.create(null); // Only properties prescribed by the spec should be enumerable.\n // Keep the rest as non-enumerable.\n\n Object.defineProperties(this, {\n message: {\n writable: true,\n enumerable: true,\n },\n name: {\n enumerable: false,\n },\n nodes: {\n enumerable: false,\n },\n source: {\n enumerable: false,\n },\n positions: {\n enumerable: false,\n },\n originalError: {\n enumerable: false,\n },\n }); // Include (non-enumerable) stack trace.\n\n /* c8 ignore start */\n // FIXME: https://github.com/graphql/graphql-js/issues/2317\n\n if (\n originalError !== null &&\n originalError !== void 0 &&\n originalError.stack\n ) {\n Object.defineProperty(this, 'stack', {\n value: originalError.stack,\n writable: true,\n configurable: true,\n });\n } else if (Error.captureStackTrace) {\n Error.captureStackTrace(this, GraphQLError);\n } else {\n Object.defineProperty(this, 'stack', {\n value: Error().stack,\n writable: true,\n configurable: true,\n });\n }\n /* c8 ignore stop */\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLError';\n }\n\n toString() {\n let output = this.message;\n\n if (this.nodes) {\n for (const node of this.nodes) {\n if (node.loc) {\n output += '\\n\\n' + printLocation(node.loc);\n }\n }\n } else if (this.source && this.locations) {\n for (const location of this.locations) {\n output += '\\n\\n' + printSourceLocation(this.source, location);\n }\n }\n\n return output;\n }\n\n toJSON() {\n const formattedError = {\n message: this.message,\n };\n\n if (this.locations != null) {\n formattedError.locations = this.locations;\n }\n\n if (this.path != null) {\n formattedError.path = this.path;\n }\n\n if (this.extensions != null && Object.keys(this.extensions).length > 0) {\n formattedError.extensions = this.extensions;\n }\n\n return formattedError;\n }\n}\n\nfunction undefinedIfEmpty(array) {\n return array === undefined || array.length === 0 ? undefined : array;\n}\n/**\n * See: https://spec.graphql.org/draft/#sec-Errors\n */\n\n/**\n * Prints a GraphQLError to a string, representing useful location information\n * about the error's position in the source.\n *\n * @deprecated Please use `error.toString` instead. Will be removed in v17\n */\nexport function printError(error) {\n return error.toString();\n}\n/**\n * Given a GraphQLError, format it according to the rules described by the\n * Response Format, Errors section of the GraphQL Specification.\n *\n * @deprecated Please use `error.toJSON` instead. Will be removed in v17\n */\n\nexport function formatError(error) {\n return error.toJSON();\n}\n", "import { GraphQLError } from './GraphQLError.mjs';\n/**\n * Produces a GraphQLError representing a syntax error, containing useful\n * descriptive information about the syntax error's position in the source.\n */\n\nexport function syntaxError(source, position, description) {\n return new GraphQLError(`Syntax Error: ${description}`, {\n source,\n positions: [position],\n });\n}\n", "/**\n * Contains a range of UTF-8 character offsets and token references that\n * identify the region of the source from which the AST derived.\n */\nexport class Location {\n /**\n * The character offset at which this Node begins.\n */\n\n /**\n * The character offset at which this Node ends.\n */\n\n /**\n * The Token at which this Node begins.\n */\n\n /**\n * The Token at which this Node ends.\n */\n\n /**\n * The Source document the AST represents.\n */\n constructor(startToken, endToken, source) {\n this.start = startToken.start;\n this.end = endToken.end;\n this.startToken = startToken;\n this.endToken = endToken;\n this.source = source;\n }\n\n get [Symbol.toStringTag]() {\n return 'Location';\n }\n\n toJSON() {\n return {\n start: this.start,\n end: this.end,\n };\n }\n}\n/**\n * Represents a range of characters represented by a lexical token\n * within a Source.\n */\n\nexport class Token {\n /**\n * The kind of Token.\n */\n\n /**\n * The character offset at which this Node begins.\n */\n\n /**\n * The character offset at which this Node ends.\n */\n\n /**\n * The 1-indexed line number on which this Token appears.\n */\n\n /**\n * The 1-indexed column number at which this Token begins.\n */\n\n /**\n * For non-punctuation tokens, represents the interpreted value of the token.\n *\n * Note: is undefined for punctuation tokens, but typed as string for\n * convenience in the parser.\n */\n\n /**\n * Tokens exist as nodes in a double-linked-list amongst all tokens\n * including ignored tokens. is always the first node and \n * the last.\n */\n constructor(kind, start, end, line, column, value) {\n this.kind = kind;\n this.start = start;\n this.end = end;\n this.line = line;\n this.column = column; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\n this.value = value;\n this.prev = null;\n this.next = null;\n }\n\n get [Symbol.toStringTag]() {\n return 'Token';\n }\n\n toJSON() {\n return {\n kind: this.kind,\n value: this.value,\n line: this.line,\n column: this.column,\n };\n }\n}\n/**\n * The list of all possible AST node types.\n */\n\n/**\n * @internal\n */\nexport const QueryDocumentKeys = {\n Name: [],\n Document: ['definitions'],\n OperationDefinition: [\n 'name',\n 'variableDefinitions',\n 'directives',\n 'selectionSet',\n ],\n VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'],\n Variable: ['name'],\n SelectionSet: ['selections'],\n Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'],\n Argument: ['name', 'value'],\n FragmentSpread: ['name', 'directives'],\n InlineFragment: ['typeCondition', 'directives', 'selectionSet'],\n FragmentDefinition: [\n 'name', // Note: fragment variable definitions are deprecated and will removed in v17.0.0\n 'variableDefinitions',\n 'typeCondition',\n 'directives',\n 'selectionSet',\n ],\n IntValue: [],\n FloatValue: [],\n StringValue: [],\n BooleanValue: [],\n NullValue: [],\n EnumValue: [],\n ListValue: ['values'],\n ObjectValue: ['fields'],\n ObjectField: ['name', 'value'],\n Directive: ['name', 'arguments'],\n NamedType: ['name'],\n ListType: ['type'],\n NonNullType: ['type'],\n SchemaDefinition: ['description', 'directives', 'operationTypes'],\n OperationTypeDefinition: ['type'],\n ScalarTypeDefinition: ['description', 'name', 'directives'],\n ObjectTypeDefinition: [\n 'description',\n 'name',\n 'interfaces',\n 'directives',\n 'fields',\n ],\n FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'],\n InputValueDefinition: [\n 'description',\n 'name',\n 'type',\n 'defaultValue',\n 'directives',\n ],\n InterfaceTypeDefinition: [\n 'description',\n 'name',\n 'interfaces',\n 'directives',\n 'fields',\n ],\n UnionTypeDefinition: ['description', 'name', 'directives', 'types'],\n EnumTypeDefinition: ['description', 'name', 'directives', 'values'],\n EnumValueDefinition: ['description', 'name', 'directives'],\n InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'],\n DirectiveDefinition: ['description', 'name', 'arguments', 'locations'],\n SchemaExtension: ['directives', 'operationTypes'],\n ScalarTypeExtension: ['name', 'directives'],\n ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'],\n InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'],\n UnionTypeExtension: ['name', 'directives', 'types'],\n EnumTypeExtension: ['name', 'directives', 'values'],\n InputObjectTypeExtension: ['name', 'directives', 'fields'],\n};\nconst kindValues = new Set(Object.keys(QueryDocumentKeys));\n/**\n * @internal\n */\n\nexport function isNode(maybeNode) {\n const maybeKind =\n maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind;\n return typeof maybeKind === 'string' && kindValues.has(maybeKind);\n}\n/** Name */\n\nvar OperationTypeNode;\n\n(function (OperationTypeNode) {\n OperationTypeNode['QUERY'] = 'query';\n OperationTypeNode['MUTATION'] = 'mutation';\n OperationTypeNode['SUBSCRIPTION'] = 'subscription';\n})(OperationTypeNode || (OperationTypeNode = {}));\n\nexport { OperationTypeNode };\n", "/**\n * The set of allowed directive location values.\n */\nvar DirectiveLocation;\n\n(function (DirectiveLocation) {\n DirectiveLocation['QUERY'] = 'QUERY';\n DirectiveLocation['MUTATION'] = 'MUTATION';\n DirectiveLocation['SUBSCRIPTION'] = 'SUBSCRIPTION';\n DirectiveLocation['FIELD'] = 'FIELD';\n DirectiveLocation['FRAGMENT_DEFINITION'] = 'FRAGMENT_DEFINITION';\n DirectiveLocation['FRAGMENT_SPREAD'] = 'FRAGMENT_SPREAD';\n DirectiveLocation['INLINE_FRAGMENT'] = 'INLINE_FRAGMENT';\n DirectiveLocation['VARIABLE_DEFINITION'] = 'VARIABLE_DEFINITION';\n DirectiveLocation['SCHEMA'] = 'SCHEMA';\n DirectiveLocation['SCALAR'] = 'SCALAR';\n DirectiveLocation['OBJECT'] = 'OBJECT';\n DirectiveLocation['FIELD_DEFINITION'] = 'FIELD_DEFINITION';\n DirectiveLocation['ARGUMENT_DEFINITION'] = 'ARGUMENT_DEFINITION';\n DirectiveLocation['INTERFACE'] = 'INTERFACE';\n DirectiveLocation['UNION'] = 'UNION';\n DirectiveLocation['ENUM'] = 'ENUM';\n DirectiveLocation['ENUM_VALUE'] = 'ENUM_VALUE';\n DirectiveLocation['INPUT_OBJECT'] = 'INPUT_OBJECT';\n DirectiveLocation['INPUT_FIELD_DEFINITION'] = 'INPUT_FIELD_DEFINITION';\n})(DirectiveLocation || (DirectiveLocation = {}));\n\nexport { DirectiveLocation };\n/**\n * The enum type representing the directive location values.\n *\n * @deprecated Please use `DirectiveLocation`. Will be remove in v17.\n */\n", "/**\n * The set of allowed kind values for AST nodes.\n */\nvar Kind;\n\n(function (Kind) {\n Kind['NAME'] = 'Name';\n Kind['DOCUMENT'] = 'Document';\n Kind['OPERATION_DEFINITION'] = 'OperationDefinition';\n Kind['VARIABLE_DEFINITION'] = 'VariableDefinition';\n Kind['SELECTION_SET'] = 'SelectionSet';\n Kind['FIELD'] = 'Field';\n Kind['ARGUMENT'] = 'Argument';\n Kind['FRAGMENT_SPREAD'] = 'FragmentSpread';\n Kind['INLINE_FRAGMENT'] = 'InlineFragment';\n Kind['FRAGMENT_DEFINITION'] = 'FragmentDefinition';\n Kind['VARIABLE'] = 'Variable';\n Kind['INT'] = 'IntValue';\n Kind['FLOAT'] = 'FloatValue';\n Kind['STRING'] = 'StringValue';\n Kind['BOOLEAN'] = 'BooleanValue';\n Kind['NULL'] = 'NullValue';\n Kind['ENUM'] = 'EnumValue';\n Kind['LIST'] = 'ListValue';\n Kind['OBJECT'] = 'ObjectValue';\n Kind['OBJECT_FIELD'] = 'ObjectField';\n Kind['DIRECTIVE'] = 'Directive';\n Kind['NAMED_TYPE'] = 'NamedType';\n Kind['LIST_TYPE'] = 'ListType';\n Kind['NON_NULL_TYPE'] = 'NonNullType';\n Kind['SCHEMA_DEFINITION'] = 'SchemaDefinition';\n Kind['OPERATION_TYPE_DEFINITION'] = 'OperationTypeDefinition';\n Kind['SCALAR_TYPE_DEFINITION'] = 'ScalarTypeDefinition';\n Kind['OBJECT_TYPE_DEFINITION'] = 'ObjectTypeDefinition';\n Kind['FIELD_DEFINITION'] = 'FieldDefinition';\n Kind['INPUT_VALUE_DEFINITION'] = 'InputValueDefinition';\n Kind['INTERFACE_TYPE_DEFINITION'] = 'InterfaceTypeDefinition';\n Kind['UNION_TYPE_DEFINITION'] = 'UnionTypeDefinition';\n Kind['ENUM_TYPE_DEFINITION'] = 'EnumTypeDefinition';\n Kind['ENUM_VALUE_DEFINITION'] = 'EnumValueDefinition';\n Kind['INPUT_OBJECT_TYPE_DEFINITION'] = 'InputObjectTypeDefinition';\n Kind['DIRECTIVE_DEFINITION'] = 'DirectiveDefinition';\n Kind['SCHEMA_EXTENSION'] = 'SchemaExtension';\n Kind['SCALAR_TYPE_EXTENSION'] = 'ScalarTypeExtension';\n Kind['OBJECT_TYPE_EXTENSION'] = 'ObjectTypeExtension';\n Kind['INTERFACE_TYPE_EXTENSION'] = 'InterfaceTypeExtension';\n Kind['UNION_TYPE_EXTENSION'] = 'UnionTypeExtension';\n Kind['ENUM_TYPE_EXTENSION'] = 'EnumTypeExtension';\n Kind['INPUT_OBJECT_TYPE_EXTENSION'] = 'InputObjectTypeExtension';\n})(Kind || (Kind = {}));\n\nexport { Kind };\n/**\n * The enum type representing the possible kind values of AST nodes.\n *\n * @deprecated Please use `Kind`. Will be remove in v17.\n */\n", "/**\n * ```\n * WhiteSpace ::\n * - \"Horizontal Tab (U+0009)\"\n * - \"Space (U+0020)\"\n * ```\n * @internal\n */\nexport function isWhiteSpace(code) {\n return code === 0x0009 || code === 0x0020;\n}\n/**\n * ```\n * Digit :: one of\n * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9`\n * ```\n * @internal\n */\n\nexport function isDigit(code) {\n return code >= 0x0030 && code <= 0x0039;\n}\n/**\n * ```\n * Letter :: one of\n * - `A` `B` `C` `D` `E` `F` `G` `H` `I` `J` `K` `L` `M`\n * - `N` `O` `P` `Q` `R` `S` `T` `U` `V` `W` `X` `Y` `Z`\n * - `a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m`\n * - `n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z`\n * ```\n * @internal\n */\n\nexport function isLetter(code) {\n return (\n (code >= 0x0061 && code <= 0x007a) || // A-Z\n (code >= 0x0041 && code <= 0x005a) // a-z\n );\n}\n/**\n * ```\n * NameStart ::\n * - Letter\n * - `_`\n * ```\n * @internal\n */\n\nexport function isNameStart(code) {\n return isLetter(code) || code === 0x005f;\n}\n/**\n * ```\n * NameContinue ::\n * - Letter\n * - Digit\n * - `_`\n * ```\n * @internal\n */\n\nexport function isNameContinue(code) {\n return isLetter(code) || isDigit(code) || code === 0x005f;\n}\n", "import { isWhiteSpace } from './characterClasses.mjs';\n/**\n * Produces the value of a block string from its parsed raw value, similar to\n * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc.\n *\n * This implements the GraphQL spec's BlockStringValue() static algorithm.\n *\n * @internal\n */\n\nexport function dedentBlockStringLines(lines) {\n var _firstNonEmptyLine2;\n\n let commonIndent = Number.MAX_SAFE_INTEGER;\n let firstNonEmptyLine = null;\n let lastNonEmptyLine = -1;\n\n for (let i = 0; i < lines.length; ++i) {\n var _firstNonEmptyLine;\n\n const line = lines[i];\n const indent = leadingWhitespace(line);\n\n if (indent === line.length) {\n continue; // skip empty lines\n }\n\n firstNonEmptyLine =\n (_firstNonEmptyLine = firstNonEmptyLine) !== null &&\n _firstNonEmptyLine !== void 0\n ? _firstNonEmptyLine\n : i;\n lastNonEmptyLine = i;\n\n if (i !== 0 && indent < commonIndent) {\n commonIndent = indent;\n }\n }\n\n return lines // Remove common indentation from all lines but first.\n .map((line, i) => (i === 0 ? line : line.slice(commonIndent))) // Remove leading and trailing blank lines.\n .slice(\n (_firstNonEmptyLine2 = firstNonEmptyLine) !== null &&\n _firstNonEmptyLine2 !== void 0\n ? _firstNonEmptyLine2\n : 0,\n lastNonEmptyLine + 1,\n );\n}\n\nfunction leadingWhitespace(str) {\n let i = 0;\n\n while (i < str.length && isWhiteSpace(str.charCodeAt(i))) {\n ++i;\n }\n\n return i;\n}\n/**\n * @internal\n */\n\nexport function isPrintableAsBlockString(value) {\n if (value === '') {\n return true; // empty string is printable\n }\n\n let isEmptyLine = true;\n let hasIndent = false;\n let hasCommonIndent = true;\n let seenNonEmptyLine = false;\n\n for (let i = 0; i < value.length; ++i) {\n switch (value.codePointAt(i)) {\n case 0x0000:\n case 0x0001:\n case 0x0002:\n case 0x0003:\n case 0x0004:\n case 0x0005:\n case 0x0006:\n case 0x0007:\n case 0x0008:\n case 0x000b:\n case 0x000c:\n case 0x000e:\n case 0x000f:\n return false;\n // Has non-printable characters\n\n case 0x000d:\n // \\r\n return false;\n // Has \\r or \\r\\n which will be replaced as \\n\n\n case 10:\n // \\n\n if (isEmptyLine && !seenNonEmptyLine) {\n return false; // Has leading new line\n }\n\n seenNonEmptyLine = true;\n isEmptyLine = true;\n hasIndent = false;\n break;\n\n case 9: // \\t\n\n case 32:\n // \n hasIndent || (hasIndent = isEmptyLine);\n break;\n\n default:\n hasCommonIndent && (hasCommonIndent = hasIndent);\n isEmptyLine = false;\n }\n }\n\n if (isEmptyLine) {\n return false; // Has trailing empty lines\n }\n\n if (hasCommonIndent && seenNonEmptyLine) {\n return false; // Has internal indent\n }\n\n return true;\n}\n/**\n * Print a block string in the indented block form by adding a leading and\n * trailing blank line. However, if a block string starts with whitespace and is\n * a single-line, adding a leading blank line would strip that whitespace.\n *\n * @internal\n */\n\nexport function printBlockString(value, options) {\n const escapedValue = value.replace(/\"\"\"/g, '\\\\\"\"\"'); // Expand a block string's raw value into independent lines.\n\n const lines = escapedValue.split(/\\r\\n|[\\n\\r]/g);\n const isSingleLine = lines.length === 1; // If common indentation is found we can fix some of those cases by adding leading new line\n\n const forceLeadingNewLine =\n lines.length > 1 &&\n lines\n .slice(1)\n .every((line) => line.length === 0 || isWhiteSpace(line.charCodeAt(0))); // Trailing triple quotes just looks confusing but doesn't force trailing new line\n\n const hasTrailingTripleQuotes = escapedValue.endsWith('\\\\\"\"\"'); // Trailing quote (single or double) or slash forces trailing new line\n\n const hasTrailingQuote = value.endsWith('\"') && !hasTrailingTripleQuotes;\n const hasTrailingSlash = value.endsWith('\\\\');\n const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash;\n const printAsMultipleLines =\n !(options !== null && options !== void 0 && options.minimize) && // add leading and trailing new lines only if it improves readability\n (!isSingleLine ||\n value.length > 70 ||\n forceTrailingNewline ||\n forceLeadingNewLine ||\n hasTrailingTripleQuotes);\n let result = ''; // Format a multi-line block quote to account for leading space.\n\n const skipLeadingNewLine = isSingleLine && isWhiteSpace(value.charCodeAt(0));\n\n if ((printAsMultipleLines && !skipLeadingNewLine) || forceLeadingNewLine) {\n result += '\\n';\n }\n\n result += escapedValue;\n\n if (printAsMultipleLines || forceTrailingNewline) {\n result += '\\n';\n }\n\n return '\"\"\"' + result + '\"\"\"';\n}\n", "/**\n * An exported enum describing the different kinds of tokens that the\n * lexer emits.\n */\nvar TokenKind;\n\n(function (TokenKind) {\n TokenKind['SOF'] = '';\n TokenKind['EOF'] = '';\n TokenKind['BANG'] = '!';\n TokenKind['DOLLAR'] = '$';\n TokenKind['AMP'] = '&';\n TokenKind['PAREN_L'] = '(';\n TokenKind['PAREN_R'] = ')';\n TokenKind['SPREAD'] = '...';\n TokenKind['COLON'] = ':';\n TokenKind['EQUALS'] = '=';\n TokenKind['AT'] = '@';\n TokenKind['BRACKET_L'] = '[';\n TokenKind['BRACKET_R'] = ']';\n TokenKind['BRACE_L'] = '{';\n TokenKind['PIPE'] = '|';\n TokenKind['BRACE_R'] = '}';\n TokenKind['NAME'] = 'Name';\n TokenKind['INT'] = 'Int';\n TokenKind['FLOAT'] = 'Float';\n TokenKind['STRING'] = 'String';\n TokenKind['BLOCK_STRING'] = 'BlockString';\n TokenKind['COMMENT'] = 'Comment';\n})(TokenKind || (TokenKind = {}));\n\nexport { TokenKind };\n/**\n * The enum type representing the token kinds values.\n *\n * @deprecated Please use `TokenKind`. Will be remove in v17.\n */\n", "import { syntaxError } from '../error/syntaxError.mjs';\nimport { Token } from './ast.mjs';\nimport { dedentBlockStringLines } from './blockString.mjs';\nimport { isDigit, isNameContinue, isNameStart } from './characterClasses.mjs';\nimport { TokenKind } from './tokenKind.mjs';\n/**\n * Given a Source object, creates a Lexer for that source.\n * A Lexer is a stateful stream generator in that every time\n * it is advanced, it returns the next token in the Source. Assuming the\n * source lexes, the final Token emitted by the lexer will be of kind\n * EOF, after which the lexer will repeatedly return the same EOF token\n * whenever called.\n */\n\nexport class Lexer {\n /**\n * The previously focused non-ignored token.\n */\n\n /**\n * The currently focused non-ignored token.\n */\n\n /**\n * The (1-indexed) line containing the current token.\n */\n\n /**\n * The character offset at which the current line begins.\n */\n constructor(source) {\n const startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0);\n this.source = source;\n this.lastToken = startOfFileToken;\n this.token = startOfFileToken;\n this.line = 1;\n this.lineStart = 0;\n }\n\n get [Symbol.toStringTag]() {\n return 'Lexer';\n }\n /**\n * Advances the token stream to the next non-ignored token.\n */\n\n advance() {\n this.lastToken = this.token;\n const token = (this.token = this.lookahead());\n return token;\n }\n /**\n * Looks ahead and returns the next non-ignored token, but does not change\n * the state of Lexer.\n */\n\n lookahead() {\n let token = this.token;\n\n if (token.kind !== TokenKind.EOF) {\n do {\n if (token.next) {\n token = token.next;\n } else {\n // Read the next token and form a link in the token linked-list.\n const nextToken = readNextToken(this, token.end); // @ts-expect-error next is only mutable during parsing.\n\n token.next = nextToken; // @ts-expect-error prev is only mutable during parsing.\n\n nextToken.prev = token;\n token = nextToken;\n }\n } while (token.kind === TokenKind.COMMENT);\n }\n\n return token;\n }\n}\n/**\n * @internal\n */\n\nexport function isPunctuatorTokenKind(kind) {\n return (\n kind === TokenKind.BANG ||\n kind === TokenKind.DOLLAR ||\n kind === TokenKind.AMP ||\n kind === TokenKind.PAREN_L ||\n kind === TokenKind.PAREN_R ||\n kind === TokenKind.SPREAD ||\n kind === TokenKind.COLON ||\n kind === TokenKind.EQUALS ||\n kind === TokenKind.AT ||\n kind === TokenKind.BRACKET_L ||\n kind === TokenKind.BRACKET_R ||\n kind === TokenKind.BRACE_L ||\n kind === TokenKind.PIPE ||\n kind === TokenKind.BRACE_R\n );\n}\n/**\n * A Unicode scalar value is any Unicode code point except surrogate code\n * points. In other words, the inclusive ranges of values 0x0000 to 0xD7FF and\n * 0xE000 to 0x10FFFF.\n *\n * SourceCharacter ::\n * - \"Any Unicode scalar value\"\n */\n\nfunction isUnicodeScalarValue(code) {\n return (\n (code >= 0x0000 && code <= 0xd7ff) || (code >= 0xe000 && code <= 0x10ffff)\n );\n}\n/**\n * The GraphQL specification defines source text as a sequence of unicode scalar\n * values (which Unicode defines to exclude surrogate code points). However\n * JavaScript defines strings as a sequence of UTF-16 code units which may\n * include surrogates. A surrogate pair is a valid source character as it\n * encodes a supplementary code point (above U+FFFF), but unpaired surrogate\n * code points are not valid source characters.\n */\n\nfunction isSupplementaryCodePoint(body, location) {\n return (\n isLeadingSurrogate(body.charCodeAt(location)) &&\n isTrailingSurrogate(body.charCodeAt(location + 1))\n );\n}\n\nfunction isLeadingSurrogate(code) {\n return code >= 0xd800 && code <= 0xdbff;\n}\n\nfunction isTrailingSurrogate(code) {\n return code >= 0xdc00 && code <= 0xdfff;\n}\n/**\n * Prints the code point (or end of file reference) at a given location in a\n * source for use in error messages.\n *\n * Printable ASCII is printed quoted, while other points are printed in Unicode\n * code point form (ie. U+1234).\n */\n\nfunction printCodePointAt(lexer, location) {\n const code = lexer.source.body.codePointAt(location);\n\n if (code === undefined) {\n return TokenKind.EOF;\n } else if (code >= 0x0020 && code <= 0x007e) {\n // Printable ASCII\n const char = String.fromCodePoint(code);\n return char === '\"' ? \"'\\\"'\" : `\"${char}\"`;\n } // Unicode code point\n\n return 'U+' + code.toString(16).toUpperCase().padStart(4, '0');\n}\n/**\n * Create a token with line and column location information.\n */\n\nfunction createToken(lexer, kind, start, end, value) {\n const line = lexer.line;\n const col = 1 + start - lexer.lineStart;\n return new Token(kind, start, end, line, col, value);\n}\n/**\n * Gets the next token from the source starting at the given position.\n *\n * This skips over whitespace until it finds the next lexable token, then lexes\n * punctuators immediately or calls the appropriate helper function for more\n * complicated tokens.\n */\n\nfunction readNextToken(lexer, start) {\n const body = lexer.source.body;\n const bodyLength = body.length;\n let position = start;\n\n while (position < bodyLength) {\n const code = body.charCodeAt(position); // SourceCharacter\n\n switch (code) {\n // Ignored ::\n // - UnicodeBOM\n // - WhiteSpace\n // - LineTerminator\n // - Comment\n // - Comma\n //\n // UnicodeBOM :: \"Byte Order Mark (U+FEFF)\"\n //\n // WhiteSpace ::\n // - \"Horizontal Tab (U+0009)\"\n // - \"Space (U+0020)\"\n //\n // Comma :: ,\n case 0xfeff: // \n\n case 0x0009: // \\t\n\n case 0x0020: // \n\n case 0x002c:\n // ,\n ++position;\n continue;\n // LineTerminator ::\n // - \"New Line (U+000A)\"\n // - \"Carriage Return (U+000D)\" [lookahead != \"New Line (U+000A)\"]\n // - \"Carriage Return (U+000D)\" \"New Line (U+000A)\"\n\n case 0x000a:\n // \\n\n ++position;\n ++lexer.line;\n lexer.lineStart = position;\n continue;\n\n case 0x000d:\n // \\r\n if (body.charCodeAt(position + 1) === 0x000a) {\n position += 2;\n } else {\n ++position;\n }\n\n ++lexer.line;\n lexer.lineStart = position;\n continue;\n // Comment\n\n case 0x0023:\n // #\n return readComment(lexer, position);\n // Token ::\n // - Punctuator\n // - Name\n // - IntValue\n // - FloatValue\n // - StringValue\n //\n // Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | }\n\n case 0x0021:\n // !\n return createToken(lexer, TokenKind.BANG, position, position + 1);\n\n case 0x0024:\n // $\n return createToken(lexer, TokenKind.DOLLAR, position, position + 1);\n\n case 0x0026:\n // &\n return createToken(lexer, TokenKind.AMP, position, position + 1);\n\n case 0x0028:\n // (\n return createToken(lexer, TokenKind.PAREN_L, position, position + 1);\n\n case 0x0029:\n // )\n return createToken(lexer, TokenKind.PAREN_R, position, position + 1);\n\n case 0x002e:\n // .\n if (\n body.charCodeAt(position + 1) === 0x002e &&\n body.charCodeAt(position + 2) === 0x002e\n ) {\n return createToken(lexer, TokenKind.SPREAD, position, position + 3);\n }\n\n break;\n\n case 0x003a:\n // :\n return createToken(lexer, TokenKind.COLON, position, position + 1);\n\n case 0x003d:\n // =\n return createToken(lexer, TokenKind.EQUALS, position, position + 1);\n\n case 0x0040:\n // @\n return createToken(lexer, TokenKind.AT, position, position + 1);\n\n case 0x005b:\n // [\n return createToken(lexer, TokenKind.BRACKET_L, position, position + 1);\n\n case 0x005d:\n // ]\n return createToken(lexer, TokenKind.BRACKET_R, position, position + 1);\n\n case 0x007b:\n // {\n return createToken(lexer, TokenKind.BRACE_L, position, position + 1);\n\n case 0x007c:\n // |\n return createToken(lexer, TokenKind.PIPE, position, position + 1);\n\n case 0x007d:\n // }\n return createToken(lexer, TokenKind.BRACE_R, position, position + 1);\n // StringValue\n\n case 0x0022:\n // \"\n if (\n body.charCodeAt(position + 1) === 0x0022 &&\n body.charCodeAt(position + 2) === 0x0022\n ) {\n return readBlockString(lexer, position);\n }\n\n return readString(lexer, position);\n } // IntValue | FloatValue (Digit | -)\n\n if (isDigit(code) || code === 0x002d) {\n return readNumber(lexer, position, code);\n } // Name\n\n if (isNameStart(code)) {\n return readName(lexer, position);\n }\n\n throw syntaxError(\n lexer.source,\n position,\n code === 0x0027\n ? 'Unexpected single quote character (\\'), did you mean to use a double quote (\")?'\n : isUnicodeScalarValue(code) || isSupplementaryCodePoint(body, position)\n ? `Unexpected character: ${printCodePointAt(lexer, position)}.`\n : `Invalid character: ${printCodePointAt(lexer, position)}.`,\n );\n }\n\n return createToken(lexer, TokenKind.EOF, bodyLength, bodyLength);\n}\n/**\n * Reads a comment token from the source file.\n *\n * ```\n * Comment :: # CommentChar* [lookahead != CommentChar]\n *\n * CommentChar :: SourceCharacter but not LineTerminator\n * ```\n */\n\nfunction readComment(lexer, start) {\n const body = lexer.source.body;\n const bodyLength = body.length;\n let position = start + 1;\n\n while (position < bodyLength) {\n const code = body.charCodeAt(position); // LineTerminator (\\n | \\r)\n\n if (code === 0x000a || code === 0x000d) {\n break;\n } // SourceCharacter\n\n if (isUnicodeScalarValue(code)) {\n ++position;\n } else if (isSupplementaryCodePoint(body, position)) {\n position += 2;\n } else {\n break;\n }\n }\n\n return createToken(\n lexer,\n TokenKind.COMMENT,\n start,\n position,\n body.slice(start + 1, position),\n );\n}\n/**\n * Reads a number token from the source file, either a FloatValue or an IntValue\n * depending on whether a FractionalPart or ExponentPart is encountered.\n *\n * ```\n * IntValue :: IntegerPart [lookahead != {Digit, `.`, NameStart}]\n *\n * IntegerPart ::\n * - NegativeSign? 0\n * - NegativeSign? NonZeroDigit Digit*\n *\n * NegativeSign :: -\n *\n * NonZeroDigit :: Digit but not `0`\n *\n * FloatValue ::\n * - IntegerPart FractionalPart ExponentPart [lookahead != {Digit, `.`, NameStart}]\n * - IntegerPart FractionalPart [lookahead != {Digit, `.`, NameStart}]\n * - IntegerPart ExponentPart [lookahead != {Digit, `.`, NameStart}]\n *\n * FractionalPart :: . Digit+\n *\n * ExponentPart :: ExponentIndicator Sign? Digit+\n *\n * ExponentIndicator :: one of `e` `E`\n *\n * Sign :: one of + -\n * ```\n */\n\nfunction readNumber(lexer, start, firstCode) {\n const body = lexer.source.body;\n let position = start;\n let code = firstCode;\n let isFloat = false; // NegativeSign (-)\n\n if (code === 0x002d) {\n code = body.charCodeAt(++position);\n } // Zero (0)\n\n if (code === 0x0030) {\n code = body.charCodeAt(++position);\n\n if (isDigit(code)) {\n throw syntaxError(\n lexer.source,\n position,\n `Invalid number, unexpected digit after 0: ${printCodePointAt(\n lexer,\n position,\n )}.`,\n );\n }\n } else {\n position = readDigits(lexer, position, code);\n code = body.charCodeAt(position);\n } // Full stop (.)\n\n if (code === 0x002e) {\n isFloat = true;\n code = body.charCodeAt(++position);\n position = readDigits(lexer, position, code);\n code = body.charCodeAt(position);\n } // E e\n\n if (code === 0x0045 || code === 0x0065) {\n isFloat = true;\n code = body.charCodeAt(++position); // + -\n\n if (code === 0x002b || code === 0x002d) {\n code = body.charCodeAt(++position);\n }\n\n position = readDigits(lexer, position, code);\n code = body.charCodeAt(position);\n } // Numbers cannot be followed by . or NameStart\n\n if (code === 0x002e || isNameStart(code)) {\n throw syntaxError(\n lexer.source,\n position,\n `Invalid number, expected digit but got: ${printCodePointAt(\n lexer,\n position,\n )}.`,\n );\n }\n\n return createToken(\n lexer,\n isFloat ? TokenKind.FLOAT : TokenKind.INT,\n start,\n position,\n body.slice(start, position),\n );\n}\n/**\n * Returns the new position in the source after reading one or more digits.\n */\n\nfunction readDigits(lexer, start, firstCode) {\n if (!isDigit(firstCode)) {\n throw syntaxError(\n lexer.source,\n start,\n `Invalid number, expected digit but got: ${printCodePointAt(\n lexer,\n start,\n )}.`,\n );\n }\n\n const body = lexer.source.body;\n let position = start + 1; // +1 to skip first firstCode\n\n while (isDigit(body.charCodeAt(position))) {\n ++position;\n }\n\n return position;\n}\n/**\n * Reads a single-quote string token from the source file.\n *\n * ```\n * StringValue ::\n * - `\"\"` [lookahead != `\"`]\n * - `\"` StringCharacter+ `\"`\n *\n * StringCharacter ::\n * - SourceCharacter but not `\"` or `\\` or LineTerminator\n * - `\\u` EscapedUnicode\n * - `\\` EscapedCharacter\n *\n * EscapedUnicode ::\n * - `{` HexDigit+ `}`\n * - HexDigit HexDigit HexDigit HexDigit\n *\n * EscapedCharacter :: one of `\"` `\\` `/` `b` `f` `n` `r` `t`\n * ```\n */\n\nfunction readString(lexer, start) {\n const body = lexer.source.body;\n const bodyLength = body.length;\n let position = start + 1;\n let chunkStart = position;\n let value = '';\n\n while (position < bodyLength) {\n const code = body.charCodeAt(position); // Closing Quote (\")\n\n if (code === 0x0022) {\n value += body.slice(chunkStart, position);\n return createToken(lexer, TokenKind.STRING, start, position + 1, value);\n } // Escape Sequence (\\)\n\n if (code === 0x005c) {\n value += body.slice(chunkStart, position);\n const escape =\n body.charCodeAt(position + 1) === 0x0075 // u\n ? body.charCodeAt(position + 2) === 0x007b // {\n ? readEscapedUnicodeVariableWidth(lexer, position)\n : readEscapedUnicodeFixedWidth(lexer, position)\n : readEscapedCharacter(lexer, position);\n value += escape.value;\n position += escape.size;\n chunkStart = position;\n continue;\n } // LineTerminator (\\n | \\r)\n\n if (code === 0x000a || code === 0x000d) {\n break;\n } // SourceCharacter\n\n if (isUnicodeScalarValue(code)) {\n ++position;\n } else if (isSupplementaryCodePoint(body, position)) {\n position += 2;\n } else {\n throw syntaxError(\n lexer.source,\n position,\n `Invalid character within String: ${printCodePointAt(\n lexer,\n position,\n )}.`,\n );\n }\n }\n\n throw syntaxError(lexer.source, position, 'Unterminated string.');\n} // The string value and lexed size of an escape sequence.\n\nfunction readEscapedUnicodeVariableWidth(lexer, position) {\n const body = lexer.source.body;\n let point = 0;\n let size = 3; // Cannot be larger than 12 chars (\\u{00000000}).\n\n while (size < 12) {\n const code = body.charCodeAt(position + size++); // Closing Brace (})\n\n if (code === 0x007d) {\n // Must be at least 5 chars (\\u{0}) and encode a Unicode scalar value.\n if (size < 5 || !isUnicodeScalarValue(point)) {\n break;\n }\n\n return {\n value: String.fromCodePoint(point),\n size,\n };\n } // Append this hex digit to the code point.\n\n point = (point << 4) | readHexDigit(code);\n\n if (point < 0) {\n break;\n }\n }\n\n throw syntaxError(\n lexer.source,\n position,\n `Invalid Unicode escape sequence: \"${body.slice(\n position,\n position + size,\n )}\".`,\n );\n}\n\nfunction readEscapedUnicodeFixedWidth(lexer, position) {\n const body = lexer.source.body;\n const code = read16BitHexCode(body, position + 2);\n\n if (isUnicodeScalarValue(code)) {\n return {\n value: String.fromCodePoint(code),\n size: 6,\n };\n } // GraphQL allows JSON-style surrogate pair escape sequences, but only when\n // a valid pair is formed.\n\n if (isLeadingSurrogate(code)) {\n // \\u\n if (\n body.charCodeAt(position + 6) === 0x005c &&\n body.charCodeAt(position + 7) === 0x0075\n ) {\n const trailingCode = read16BitHexCode(body, position + 8);\n\n if (isTrailingSurrogate(trailingCode)) {\n // JavaScript defines strings as a sequence of UTF-16 code units and\n // encodes Unicode code points above U+FFFF using a surrogate pair of\n // code units. Since this is a surrogate pair escape sequence, just\n // include both codes into the JavaScript string value. Had JavaScript\n // not been internally based on UTF-16, then this surrogate pair would\n // be decoded to retrieve the supplementary code point.\n return {\n value: String.fromCodePoint(code, trailingCode),\n size: 12,\n };\n }\n }\n }\n\n throw syntaxError(\n lexer.source,\n position,\n `Invalid Unicode escape sequence: \"${body.slice(position, position + 6)}\".`,\n );\n}\n/**\n * Reads four hexadecimal characters and returns the positive integer that 16bit\n * hexadecimal string represents. For example, \"000f\" will return 15, and \"dead\"\n * will return 57005.\n *\n * Returns a negative number if any char was not a valid hexadecimal digit.\n */\n\nfunction read16BitHexCode(body, position) {\n // readHexDigit() returns -1 on error. ORing a negative value with any other\n // value always produces a negative value.\n return (\n (readHexDigit(body.charCodeAt(position)) << 12) |\n (readHexDigit(body.charCodeAt(position + 1)) << 8) |\n (readHexDigit(body.charCodeAt(position + 2)) << 4) |\n readHexDigit(body.charCodeAt(position + 3))\n );\n}\n/**\n * Reads a hexadecimal character and returns its positive integer value (0-15).\n *\n * '0' becomes 0, '9' becomes 9\n * 'A' becomes 10, 'F' becomes 15\n * 'a' becomes 10, 'f' becomes 15\n *\n * Returns -1 if the provided character code was not a valid hexadecimal digit.\n *\n * HexDigit :: one of\n * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9`\n * - `A` `B` `C` `D` `E` `F`\n * - `a` `b` `c` `d` `e` `f`\n */\n\nfunction readHexDigit(code) {\n return code >= 0x0030 && code <= 0x0039 // 0-9\n ? code - 0x0030\n : code >= 0x0041 && code <= 0x0046 // A-F\n ? code - 0x0037\n : code >= 0x0061 && code <= 0x0066 // a-f\n ? code - 0x0057\n : -1;\n}\n/**\n * | Escaped Character | Code Point | Character Name |\n * | ----------------- | ---------- | ---------------------------- |\n * | `\"` | U+0022 | double quote |\n * | `\\` | U+005C | reverse solidus (back slash) |\n * | `/` | U+002F | solidus (forward slash) |\n * | `b` | U+0008 | backspace |\n * | `f` | U+000C | form feed |\n * | `n` | U+000A | line feed (new line) |\n * | `r` | U+000D | carriage return |\n * | `t` | U+0009 | horizontal tab |\n */\n\nfunction readEscapedCharacter(lexer, position) {\n const body = lexer.source.body;\n const code = body.charCodeAt(position + 1);\n\n switch (code) {\n case 0x0022:\n // \"\n return {\n value: '\\u0022',\n size: 2,\n };\n\n case 0x005c:\n // \\\n return {\n value: '\\u005c',\n size: 2,\n };\n\n case 0x002f:\n // /\n return {\n value: '\\u002f',\n size: 2,\n };\n\n case 0x0062:\n // b\n return {\n value: '\\u0008',\n size: 2,\n };\n\n case 0x0066:\n // f\n return {\n value: '\\u000c',\n size: 2,\n };\n\n case 0x006e:\n // n\n return {\n value: '\\u000a',\n size: 2,\n };\n\n case 0x0072:\n // r\n return {\n value: '\\u000d',\n size: 2,\n };\n\n case 0x0074:\n // t\n return {\n value: '\\u0009',\n size: 2,\n };\n }\n\n throw syntaxError(\n lexer.source,\n position,\n `Invalid character escape sequence: \"${body.slice(\n position,\n position + 2,\n )}\".`,\n );\n}\n/**\n * Reads a block string token from the source file.\n *\n * ```\n * StringValue ::\n * - `\"\"\"` BlockStringCharacter* `\"\"\"`\n *\n * BlockStringCharacter ::\n * - SourceCharacter but not `\"\"\"` or `\\\"\"\"`\n * - `\\\"\"\"`\n * ```\n */\n\nfunction readBlockString(lexer, start) {\n const body = lexer.source.body;\n const bodyLength = body.length;\n let lineStart = lexer.lineStart;\n let position = start + 3;\n let chunkStart = position;\n let currentLine = '';\n const blockLines = [];\n\n while (position < bodyLength) {\n const code = body.charCodeAt(position); // Closing Triple-Quote (\"\"\")\n\n if (\n code === 0x0022 &&\n body.charCodeAt(position + 1) === 0x0022 &&\n body.charCodeAt(position + 2) === 0x0022\n ) {\n currentLine += body.slice(chunkStart, position);\n blockLines.push(currentLine);\n const token = createToken(\n lexer,\n TokenKind.BLOCK_STRING,\n start,\n position + 3, // Return a string of the lines joined with U+000A.\n dedentBlockStringLines(blockLines).join('\\n'),\n );\n lexer.line += blockLines.length - 1;\n lexer.lineStart = lineStart;\n return token;\n } // Escaped Triple-Quote (\\\"\"\")\n\n if (\n code === 0x005c &&\n body.charCodeAt(position + 1) === 0x0022 &&\n body.charCodeAt(position + 2) === 0x0022 &&\n body.charCodeAt(position + 3) === 0x0022\n ) {\n currentLine += body.slice(chunkStart, position);\n chunkStart = position + 1; // skip only slash\n\n position += 4;\n continue;\n } // LineTerminator\n\n if (code === 0x000a || code === 0x000d) {\n currentLine += body.slice(chunkStart, position);\n blockLines.push(currentLine);\n\n if (code === 0x000d && body.charCodeAt(position + 1) === 0x000a) {\n position += 2;\n } else {\n ++position;\n }\n\n currentLine = '';\n chunkStart = position;\n lineStart = position;\n continue;\n } // SourceCharacter\n\n if (isUnicodeScalarValue(code)) {\n ++position;\n } else if (isSupplementaryCodePoint(body, position)) {\n position += 2;\n } else {\n throw syntaxError(\n lexer.source,\n position,\n `Invalid character within String: ${printCodePointAt(\n lexer,\n position,\n )}.`,\n );\n }\n }\n\n throw syntaxError(lexer.source, position, 'Unterminated string.');\n}\n/**\n * Reads an alphanumeric + underscore name from the source.\n *\n * ```\n * Name ::\n * - NameStart NameContinue* [lookahead != NameContinue]\n * ```\n */\n\nfunction readName(lexer, start) {\n const body = lexer.source.body;\n const bodyLength = body.length;\n let position = start + 1;\n\n while (position < bodyLength) {\n const code = body.charCodeAt(position);\n\n if (isNameContinue(code)) {\n ++position;\n } else {\n break;\n }\n }\n\n return createToken(\n lexer,\n TokenKind.NAME,\n start,\n position,\n body.slice(start, position),\n );\n}\n", "const MAX_ARRAY_LENGTH = 10;\nconst MAX_RECURSIVE_DEPTH = 2;\n/**\n * Used to print values in error messages.\n */\n\nexport function inspect(value) {\n return formatValue(value, []);\n}\n\nfunction formatValue(value, seenValues) {\n switch (typeof value) {\n case 'string':\n return JSON.stringify(value);\n\n case 'function':\n return value.name ? `[function ${value.name}]` : '[function]';\n\n case 'object':\n return formatObjectValue(value, seenValues);\n\n default:\n return String(value);\n }\n}\n\nfunction formatObjectValue(value, previouslySeenValues) {\n if (value === null) {\n return 'null';\n }\n\n if (previouslySeenValues.includes(value)) {\n return '[Circular]';\n }\n\n const seenValues = [...previouslySeenValues, value];\n\n if (isJSONable(value)) {\n const jsonValue = value.toJSON(); // check for infinite recursion\n\n if (jsonValue !== value) {\n return typeof jsonValue === 'string'\n ? jsonValue\n : formatValue(jsonValue, seenValues);\n }\n } else if (Array.isArray(value)) {\n return formatArray(value, seenValues);\n }\n\n return formatObject(value, seenValues);\n}\n\nfunction isJSONable(value) {\n return typeof value.toJSON === 'function';\n}\n\nfunction formatObject(object, seenValues) {\n const entries = Object.entries(object);\n\n if (entries.length === 0) {\n return '{}';\n }\n\n if (seenValues.length > MAX_RECURSIVE_DEPTH) {\n return '[' + getObjectTag(object) + ']';\n }\n\n const properties = entries.map(\n ([key, value]) => key + ': ' + formatValue(value, seenValues),\n );\n return '{ ' + properties.join(', ') + ' }';\n}\n\nfunction formatArray(array, seenValues) {\n if (array.length === 0) {\n return '[]';\n }\n\n if (seenValues.length > MAX_RECURSIVE_DEPTH) {\n return '[Array]';\n }\n\n const len = Math.min(MAX_ARRAY_LENGTH, array.length);\n const remaining = array.length - len;\n const items = [];\n\n for (let i = 0; i < len; ++i) {\n items.push(formatValue(array[i], seenValues));\n }\n\n if (remaining === 1) {\n items.push('... 1 more item');\n } else if (remaining > 1) {\n items.push(`... ${remaining} more items`);\n }\n\n return '[' + items.join(', ') + ']';\n}\n\nfunction getObjectTag(object) {\n const tag = Object.prototype.toString\n .call(object)\n .replace(/^\\[object /, '')\n .replace(/]$/, '');\n\n if (tag === 'Object' && typeof object.constructor === 'function') {\n const name = object.constructor.name;\n\n if (typeof name === 'string' && name !== '') {\n return name;\n }\n }\n\n return tag;\n}\n", "import { inspect } from './inspect.mjs';\n/**\n * A replacement for instanceof which includes an error warning when multi-realm\n * constructors are detected.\n * See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production\n * See: https://webpack.js.org/guides/production/\n */\n\nexport const instanceOf =\n /* c8 ignore next 6 */\n // FIXME: https://github.com/graphql/graphql-js/issues/2317\n globalThis.process && globalThis.process.env.NODE_ENV === 'production'\n ? function instanceOf(value, constructor) {\n return value instanceof constructor;\n }\n : function instanceOf(value, constructor) {\n if (value instanceof constructor) {\n return true;\n }\n\n if (typeof value === 'object' && value !== null) {\n var _value$constructor;\n\n // Prefer Symbol.toStringTag since it is immune to minification.\n const className = constructor.prototype[Symbol.toStringTag];\n const valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library.\n Symbol.toStringTag in value // @ts-expect-error TS bug see, https://github.com/microsoft/TypeScript/issues/38009\n ? value[Symbol.toStringTag]\n : (_value$constructor = value.constructor) === null ||\n _value$constructor === void 0\n ? void 0\n : _value$constructor.name;\n\n if (className === valueClassName) {\n const stringifiedValue = inspect(value);\n throw new Error(`Cannot use ${className} \"${stringifiedValue}\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.`);\n }\n }\n\n return false;\n };\n", "import { devAssert } from '../jsutils/devAssert.mjs';\nimport { inspect } from '../jsutils/inspect.mjs';\nimport { instanceOf } from '../jsutils/instanceOf.mjs';\n\n/**\n * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are\n * optional, but they are useful for clients who store GraphQL documents in source files.\n * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might\n * be useful for `name` to be `\"Foo.graphql\"` and location to be `{ line: 40, column: 1 }`.\n * The `line` and `column` properties in `locationOffset` are 1-indexed.\n */\nexport class Source {\n constructor(\n body,\n name = 'GraphQL request',\n locationOffset = {\n line: 1,\n column: 1,\n },\n ) {\n typeof body === 'string' ||\n devAssert(false, `Body must be a string. Received: ${inspect(body)}.`);\n this.body = body;\n this.name = name;\n this.locationOffset = locationOffset;\n this.locationOffset.line > 0 ||\n devAssert(\n false,\n 'line in locationOffset is 1-indexed and must be positive.',\n );\n this.locationOffset.column > 0 ||\n devAssert(\n false,\n 'column in locationOffset is 1-indexed and must be positive.',\n );\n }\n\n get [Symbol.toStringTag]() {\n return 'Source';\n }\n}\n/**\n * Test if the given value is a Source object.\n *\n * @internal\n */\n\nexport function isSource(source) {\n return instanceOf(source, Source);\n}\n", "import { syntaxError } from '../error/syntaxError.mjs';\nimport { Location, OperationTypeNode } from './ast.mjs';\nimport { DirectiveLocation } from './directiveLocation.mjs';\nimport { Kind } from './kinds.mjs';\nimport { isPunctuatorTokenKind, Lexer } from './lexer.mjs';\nimport { isSource, Source } from './source.mjs';\nimport { TokenKind } from './tokenKind.mjs';\n/**\n * Configuration options to control parser behavior\n */\n\n/**\n * Given a GraphQL source, parses it into a Document.\n * Throws GraphQLError if a syntax error is encountered.\n */\nexport function parse(source, options) {\n const parser = new Parser(source, options);\n return parser.parseDocument();\n}\n/**\n * Given a string containing a GraphQL value (ex. `[42]`), parse the AST for\n * that value.\n * Throws GraphQLError if a syntax error is encountered.\n *\n * This is useful within tools that operate upon GraphQL Values directly and\n * in isolation of complete GraphQL documents.\n *\n * Consider providing the results to the utility function: valueFromAST().\n */\n\nexport function parseValue(source, options) {\n const parser = new Parser(source, options);\n parser.expectToken(TokenKind.SOF);\n const value = parser.parseValueLiteral(false);\n parser.expectToken(TokenKind.EOF);\n return value;\n}\n/**\n * Similar to parseValue(), but raises a parse error if it encounters a\n * variable. The return type will be a constant value.\n */\n\nexport function parseConstValue(source, options) {\n const parser = new Parser(source, options);\n parser.expectToken(TokenKind.SOF);\n const value = parser.parseConstValueLiteral();\n parser.expectToken(TokenKind.EOF);\n return value;\n}\n/**\n * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for\n * that type.\n * Throws GraphQLError if a syntax error is encountered.\n *\n * This is useful within tools that operate upon GraphQL Types directly and\n * in isolation of complete GraphQL documents.\n *\n * Consider providing the results to the utility function: typeFromAST().\n */\n\nexport function parseType(source, options) {\n const parser = new Parser(source, options);\n parser.expectToken(TokenKind.SOF);\n const type = parser.parseTypeReference();\n parser.expectToken(TokenKind.EOF);\n return type;\n}\n/**\n * This class is exported only to assist people in implementing their own parsers\n * without duplicating too much code and should be used only as last resort for cases\n * such as experimental syntax or if certain features could not be contributed upstream.\n *\n * It is still part of the internal API and is versioned, so any changes to it are never\n * considered breaking changes. If you still need to support multiple versions of the\n * library, please use the `versionInfo` variable for version detection.\n *\n * @internal\n */\n\nexport class Parser {\n constructor(source, options = {}) {\n const sourceObj = isSource(source) ? source : new Source(source);\n this._lexer = new Lexer(sourceObj);\n this._options = options;\n this._tokenCounter = 0;\n }\n /**\n * Converts a name lex token into a name parse node.\n */\n\n parseName() {\n const token = this.expectToken(TokenKind.NAME);\n return this.node(token, {\n kind: Kind.NAME,\n value: token.value,\n });\n } // Implements the parsing rules in the Document section.\n\n /**\n * Document : Definition+\n */\n\n parseDocument() {\n return this.node(this._lexer.token, {\n kind: Kind.DOCUMENT,\n definitions: this.many(\n TokenKind.SOF,\n this.parseDefinition,\n TokenKind.EOF,\n ),\n });\n }\n /**\n * Definition :\n * - ExecutableDefinition\n * - TypeSystemDefinition\n * - TypeSystemExtension\n *\n * ExecutableDefinition :\n * - OperationDefinition\n * - FragmentDefinition\n *\n * TypeSystemDefinition :\n * - SchemaDefinition\n * - TypeDefinition\n * - DirectiveDefinition\n *\n * TypeDefinition :\n * - ScalarTypeDefinition\n * - ObjectTypeDefinition\n * - InterfaceTypeDefinition\n * - UnionTypeDefinition\n * - EnumTypeDefinition\n * - InputObjectTypeDefinition\n */\n\n parseDefinition() {\n if (this.peek(TokenKind.BRACE_L)) {\n return this.parseOperationDefinition();\n } // Many definitions begin with a description and require a lookahead.\n\n const hasDescription = this.peekDescription();\n const keywordToken = hasDescription\n ? this._lexer.lookahead()\n : this._lexer.token;\n\n if (keywordToken.kind === TokenKind.NAME) {\n switch (keywordToken.value) {\n case 'schema':\n return this.parseSchemaDefinition();\n\n case 'scalar':\n return this.parseScalarTypeDefinition();\n\n case 'type':\n return this.parseObjectTypeDefinition();\n\n case 'interface':\n return this.parseInterfaceTypeDefinition();\n\n case 'union':\n return this.parseUnionTypeDefinition();\n\n case 'enum':\n return this.parseEnumTypeDefinition();\n\n case 'input':\n return this.parseInputObjectTypeDefinition();\n\n case 'directive':\n return this.parseDirectiveDefinition();\n }\n\n if (hasDescription) {\n throw syntaxError(\n this._lexer.source,\n this._lexer.token.start,\n 'Unexpected description, descriptions are supported only on type definitions.',\n );\n }\n\n switch (keywordToken.value) {\n case 'query':\n case 'mutation':\n case 'subscription':\n return this.parseOperationDefinition();\n\n case 'fragment':\n return this.parseFragmentDefinition();\n\n case 'extend':\n return this.parseTypeSystemExtension();\n }\n }\n\n throw this.unexpected(keywordToken);\n } // Implements the parsing rules in the Operations section.\n\n /**\n * OperationDefinition :\n * - SelectionSet\n * - OperationType Name? VariableDefinitions? Directives? SelectionSet\n */\n\n parseOperationDefinition() {\n const start = this._lexer.token;\n\n if (this.peek(TokenKind.BRACE_L)) {\n return this.node(start, {\n kind: Kind.OPERATION_DEFINITION,\n operation: OperationTypeNode.QUERY,\n name: undefined,\n variableDefinitions: [],\n directives: [],\n selectionSet: this.parseSelectionSet(),\n });\n }\n\n const operation = this.parseOperationType();\n let name;\n\n if (this.peek(TokenKind.NAME)) {\n name = this.parseName();\n }\n\n return this.node(start, {\n kind: Kind.OPERATION_DEFINITION,\n operation,\n name,\n variableDefinitions: this.parseVariableDefinitions(),\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n });\n }\n /**\n * OperationType : one of query mutation subscription\n */\n\n parseOperationType() {\n const operationToken = this.expectToken(TokenKind.NAME);\n\n switch (operationToken.value) {\n case 'query':\n return OperationTypeNode.QUERY;\n\n case 'mutation':\n return OperationTypeNode.MUTATION;\n\n case 'subscription':\n return OperationTypeNode.SUBSCRIPTION;\n }\n\n throw this.unexpected(operationToken);\n }\n /**\n * VariableDefinitions : ( VariableDefinition+ )\n */\n\n parseVariableDefinitions() {\n return this.optionalMany(\n TokenKind.PAREN_L,\n this.parseVariableDefinition,\n TokenKind.PAREN_R,\n );\n }\n /**\n * VariableDefinition : Variable : Type DefaultValue? Directives[Const]?\n */\n\n parseVariableDefinition() {\n return this.node(this._lexer.token, {\n kind: Kind.VARIABLE_DEFINITION,\n variable: this.parseVariable(),\n type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()),\n defaultValue: this.expectOptionalToken(TokenKind.EQUALS)\n ? this.parseConstValueLiteral()\n : undefined,\n directives: this.parseConstDirectives(),\n });\n }\n /**\n * Variable : $ Name\n */\n\n parseVariable() {\n const start = this._lexer.token;\n this.expectToken(TokenKind.DOLLAR);\n return this.node(start, {\n kind: Kind.VARIABLE,\n name: this.parseName(),\n });\n }\n /**\n * ```\n * SelectionSet : { Selection+ }\n * ```\n */\n\n parseSelectionSet() {\n return this.node(this._lexer.token, {\n kind: Kind.SELECTION_SET,\n selections: this.many(\n TokenKind.BRACE_L,\n this.parseSelection,\n TokenKind.BRACE_R,\n ),\n });\n }\n /**\n * Selection :\n * - Field\n * - FragmentSpread\n * - InlineFragment\n */\n\n parseSelection() {\n return this.peek(TokenKind.SPREAD)\n ? this.parseFragment()\n : this.parseField();\n }\n /**\n * Field : Alias? Name Arguments? Directives? SelectionSet?\n *\n * Alias : Name :\n */\n\n parseField() {\n const start = this._lexer.token;\n const nameOrAlias = this.parseName();\n let alias;\n let name;\n\n if (this.expectOptionalToken(TokenKind.COLON)) {\n alias = nameOrAlias;\n name = this.parseName();\n } else {\n name = nameOrAlias;\n }\n\n return this.node(start, {\n kind: Kind.FIELD,\n alias,\n name,\n arguments: this.parseArguments(false),\n directives: this.parseDirectives(false),\n selectionSet: this.peek(TokenKind.BRACE_L)\n ? this.parseSelectionSet()\n : undefined,\n });\n }\n /**\n * Arguments[Const] : ( Argument[?Const]+ )\n */\n\n parseArguments(isConst) {\n const item = isConst ? this.parseConstArgument : this.parseArgument;\n return this.optionalMany(TokenKind.PAREN_L, item, TokenKind.PAREN_R);\n }\n /**\n * Argument[Const] : Name : Value[?Const]\n */\n\n parseArgument(isConst = false) {\n const start = this._lexer.token;\n const name = this.parseName();\n this.expectToken(TokenKind.COLON);\n return this.node(start, {\n kind: Kind.ARGUMENT,\n name,\n value: this.parseValueLiteral(isConst),\n });\n }\n\n parseConstArgument() {\n return this.parseArgument(true);\n } // Implements the parsing rules in the Fragments section.\n\n /**\n * Corresponds to both FragmentSpread and InlineFragment in the spec.\n *\n * FragmentSpread : ... FragmentName Directives?\n *\n * InlineFragment : ... TypeCondition? Directives? SelectionSet\n */\n\n parseFragment() {\n const start = this._lexer.token;\n this.expectToken(TokenKind.SPREAD);\n const hasTypeCondition = this.expectOptionalKeyword('on');\n\n if (!hasTypeCondition && this.peek(TokenKind.NAME)) {\n return this.node(start, {\n kind: Kind.FRAGMENT_SPREAD,\n name: this.parseFragmentName(),\n directives: this.parseDirectives(false),\n });\n }\n\n return this.node(start, {\n kind: Kind.INLINE_FRAGMENT,\n typeCondition: hasTypeCondition ? this.parseNamedType() : undefined,\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n });\n }\n /**\n * FragmentDefinition :\n * - fragment FragmentName on TypeCondition Directives? SelectionSet\n *\n * TypeCondition : NamedType\n */\n\n parseFragmentDefinition() {\n const start = this._lexer.token;\n this.expectKeyword('fragment'); // Legacy support for defining variables within fragments changes\n // the grammar of FragmentDefinition:\n // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet\n\n if (this._options.allowLegacyFragmentVariables === true) {\n return this.node(start, {\n kind: Kind.FRAGMENT_DEFINITION,\n name: this.parseFragmentName(),\n variableDefinitions: this.parseVariableDefinitions(),\n typeCondition: (this.expectKeyword('on'), this.parseNamedType()),\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n });\n }\n\n return this.node(start, {\n kind: Kind.FRAGMENT_DEFINITION,\n name: this.parseFragmentName(),\n typeCondition: (this.expectKeyword('on'), this.parseNamedType()),\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n });\n }\n /**\n * FragmentName : Name but not `on`\n */\n\n parseFragmentName() {\n if (this._lexer.token.value === 'on') {\n throw this.unexpected();\n }\n\n return this.parseName();\n } // Implements the parsing rules in the Values section.\n\n /**\n * Value[Const] :\n * - [~Const] Variable\n * - IntValue\n * - FloatValue\n * - StringValue\n * - BooleanValue\n * - NullValue\n * - EnumValue\n * - ListValue[?Const]\n * - ObjectValue[?Const]\n *\n * BooleanValue : one of `true` `false`\n *\n * NullValue : `null`\n *\n * EnumValue : Name but not `true`, `false` or `null`\n */\n\n parseValueLiteral(isConst) {\n const token = this._lexer.token;\n\n switch (token.kind) {\n case TokenKind.BRACKET_L:\n return this.parseList(isConst);\n\n case TokenKind.BRACE_L:\n return this.parseObject(isConst);\n\n case TokenKind.INT:\n this.advanceLexer();\n return this.node(token, {\n kind: Kind.INT,\n value: token.value,\n });\n\n case TokenKind.FLOAT:\n this.advanceLexer();\n return this.node(token, {\n kind: Kind.FLOAT,\n value: token.value,\n });\n\n case TokenKind.STRING:\n case TokenKind.BLOCK_STRING:\n return this.parseStringLiteral();\n\n case TokenKind.NAME:\n this.advanceLexer();\n\n switch (token.value) {\n case 'true':\n return this.node(token, {\n kind: Kind.BOOLEAN,\n value: true,\n });\n\n case 'false':\n return this.node(token, {\n kind: Kind.BOOLEAN,\n value: false,\n });\n\n case 'null':\n return this.node(token, {\n kind: Kind.NULL,\n });\n\n default:\n return this.node(token, {\n kind: Kind.ENUM,\n value: token.value,\n });\n }\n\n case TokenKind.DOLLAR:\n if (isConst) {\n this.expectToken(TokenKind.DOLLAR);\n\n if (this._lexer.token.kind === TokenKind.NAME) {\n const varName = this._lexer.token.value;\n throw syntaxError(\n this._lexer.source,\n token.start,\n `Unexpected variable \"$${varName}\" in constant value.`,\n );\n } else {\n throw this.unexpected(token);\n }\n }\n\n return this.parseVariable();\n\n default:\n throw this.unexpected();\n }\n }\n\n parseConstValueLiteral() {\n return this.parseValueLiteral(true);\n }\n\n parseStringLiteral() {\n const token = this._lexer.token;\n this.advanceLexer();\n return this.node(token, {\n kind: Kind.STRING,\n value: token.value,\n block: token.kind === TokenKind.BLOCK_STRING,\n });\n }\n /**\n * ListValue[Const] :\n * - [ ]\n * - [ Value[?Const]+ ]\n */\n\n parseList(isConst) {\n const item = () => this.parseValueLiteral(isConst);\n\n return this.node(this._lexer.token, {\n kind: Kind.LIST,\n values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R),\n });\n }\n /**\n * ```\n * ObjectValue[Const] :\n * - { }\n * - { ObjectField[?Const]+ }\n * ```\n */\n\n parseObject(isConst) {\n const item = () => this.parseObjectField(isConst);\n\n return this.node(this._lexer.token, {\n kind: Kind.OBJECT,\n fields: this.any(TokenKind.BRACE_L, item, TokenKind.BRACE_R),\n });\n }\n /**\n * ObjectField[Const] : Name : Value[?Const]\n */\n\n parseObjectField(isConst) {\n const start = this._lexer.token;\n const name = this.parseName();\n this.expectToken(TokenKind.COLON);\n return this.node(start, {\n kind: Kind.OBJECT_FIELD,\n name,\n value: this.parseValueLiteral(isConst),\n });\n } // Implements the parsing rules in the Directives section.\n\n /**\n * Directives[Const] : Directive[?Const]+\n */\n\n parseDirectives(isConst) {\n const directives = [];\n\n while (this.peek(TokenKind.AT)) {\n directives.push(this.parseDirective(isConst));\n }\n\n return directives;\n }\n\n parseConstDirectives() {\n return this.parseDirectives(true);\n }\n /**\n * ```\n * Directive[Const] : @ Name Arguments[?Const]?\n * ```\n */\n\n parseDirective(isConst) {\n const start = this._lexer.token;\n this.expectToken(TokenKind.AT);\n return this.node(start, {\n kind: Kind.DIRECTIVE,\n name: this.parseName(),\n arguments: this.parseArguments(isConst),\n });\n } // Implements the parsing rules in the Types section.\n\n /**\n * Type :\n * - NamedType\n * - ListType\n * - NonNullType\n */\n\n parseTypeReference() {\n const start = this._lexer.token;\n let type;\n\n if (this.expectOptionalToken(TokenKind.BRACKET_L)) {\n const innerType = this.parseTypeReference();\n this.expectToken(TokenKind.BRACKET_R);\n type = this.node(start, {\n kind: Kind.LIST_TYPE,\n type: innerType,\n });\n } else {\n type = this.parseNamedType();\n }\n\n if (this.expectOptionalToken(TokenKind.BANG)) {\n return this.node(start, {\n kind: Kind.NON_NULL_TYPE,\n type,\n });\n }\n\n return type;\n }\n /**\n * NamedType : Name\n */\n\n parseNamedType() {\n return this.node(this._lexer.token, {\n kind: Kind.NAMED_TYPE,\n name: this.parseName(),\n });\n } // Implements the parsing rules in the Type Definition section.\n\n peekDescription() {\n return this.peek(TokenKind.STRING) || this.peek(TokenKind.BLOCK_STRING);\n }\n /**\n * Description : StringValue\n */\n\n parseDescription() {\n if (this.peekDescription()) {\n return this.parseStringLiteral();\n }\n }\n /**\n * ```\n * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ }\n * ```\n */\n\n parseSchemaDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('schema');\n const directives = this.parseConstDirectives();\n const operationTypes = this.many(\n TokenKind.BRACE_L,\n this.parseOperationTypeDefinition,\n TokenKind.BRACE_R,\n );\n return this.node(start, {\n kind: Kind.SCHEMA_DEFINITION,\n description,\n directives,\n operationTypes,\n });\n }\n /**\n * OperationTypeDefinition : OperationType : NamedType\n */\n\n parseOperationTypeDefinition() {\n const start = this._lexer.token;\n const operation = this.parseOperationType();\n this.expectToken(TokenKind.COLON);\n const type = this.parseNamedType();\n return this.node(start, {\n kind: Kind.OPERATION_TYPE_DEFINITION,\n operation,\n type,\n });\n }\n /**\n * ScalarTypeDefinition : Description? scalar Name Directives[Const]?\n */\n\n parseScalarTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('scalar');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n return this.node(start, {\n kind: Kind.SCALAR_TYPE_DEFINITION,\n description,\n name,\n directives,\n });\n }\n /**\n * ObjectTypeDefinition :\n * Description?\n * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?\n */\n\n parseObjectTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('type');\n const name = this.parseName();\n const interfaces = this.parseImplementsInterfaces();\n const directives = this.parseConstDirectives();\n const fields = this.parseFieldsDefinition();\n return this.node(start, {\n kind: Kind.OBJECT_TYPE_DEFINITION,\n description,\n name,\n interfaces,\n directives,\n fields,\n });\n }\n /**\n * ImplementsInterfaces :\n * - implements `&`? NamedType\n * - ImplementsInterfaces & NamedType\n */\n\n parseImplementsInterfaces() {\n return this.expectOptionalKeyword('implements')\n ? this.delimitedMany(TokenKind.AMP, this.parseNamedType)\n : [];\n }\n /**\n * ```\n * FieldsDefinition : { FieldDefinition+ }\n * ```\n */\n\n parseFieldsDefinition() {\n return this.optionalMany(\n TokenKind.BRACE_L,\n this.parseFieldDefinition,\n TokenKind.BRACE_R,\n );\n }\n /**\n * FieldDefinition :\n * - Description? Name ArgumentsDefinition? : Type Directives[Const]?\n */\n\n parseFieldDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n const name = this.parseName();\n const args = this.parseArgumentDefs();\n this.expectToken(TokenKind.COLON);\n const type = this.parseTypeReference();\n const directives = this.parseConstDirectives();\n return this.node(start, {\n kind: Kind.FIELD_DEFINITION,\n description,\n name,\n arguments: args,\n type,\n directives,\n });\n }\n /**\n * ArgumentsDefinition : ( InputValueDefinition+ )\n */\n\n parseArgumentDefs() {\n return this.optionalMany(\n TokenKind.PAREN_L,\n this.parseInputValueDef,\n TokenKind.PAREN_R,\n );\n }\n /**\n * InputValueDefinition :\n * - Description? Name : Type DefaultValue? Directives[Const]?\n */\n\n parseInputValueDef() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n const name = this.parseName();\n this.expectToken(TokenKind.COLON);\n const type = this.parseTypeReference();\n let defaultValue;\n\n if (this.expectOptionalToken(TokenKind.EQUALS)) {\n defaultValue = this.parseConstValueLiteral();\n }\n\n const directives = this.parseConstDirectives();\n return this.node(start, {\n kind: Kind.INPUT_VALUE_DEFINITION,\n description,\n name,\n type,\n defaultValue,\n directives,\n });\n }\n /**\n * InterfaceTypeDefinition :\n * - Description? interface Name Directives[Const]? FieldsDefinition?\n */\n\n parseInterfaceTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('interface');\n const name = this.parseName();\n const interfaces = this.parseImplementsInterfaces();\n const directives = this.parseConstDirectives();\n const fields = this.parseFieldsDefinition();\n return this.node(start, {\n kind: Kind.INTERFACE_TYPE_DEFINITION,\n description,\n name,\n interfaces,\n directives,\n fields,\n });\n }\n /**\n * UnionTypeDefinition :\n * - Description? union Name Directives[Const]? UnionMemberTypes?\n */\n\n parseUnionTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('union');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const types = this.parseUnionMemberTypes();\n return this.node(start, {\n kind: Kind.UNION_TYPE_DEFINITION,\n description,\n name,\n directives,\n types,\n });\n }\n /**\n * UnionMemberTypes :\n * - = `|`? NamedType\n * - UnionMemberTypes | NamedType\n */\n\n parseUnionMemberTypes() {\n return this.expectOptionalToken(TokenKind.EQUALS)\n ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType)\n : [];\n }\n /**\n * EnumTypeDefinition :\n * - Description? enum Name Directives[Const]? EnumValuesDefinition?\n */\n\n parseEnumTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('enum');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const values = this.parseEnumValuesDefinition();\n return this.node(start, {\n kind: Kind.ENUM_TYPE_DEFINITION,\n description,\n name,\n directives,\n values,\n });\n }\n /**\n * ```\n * EnumValuesDefinition : { EnumValueDefinition+ }\n * ```\n */\n\n parseEnumValuesDefinition() {\n return this.optionalMany(\n TokenKind.BRACE_L,\n this.parseEnumValueDefinition,\n TokenKind.BRACE_R,\n );\n }\n /**\n * EnumValueDefinition : Description? EnumValue Directives[Const]?\n */\n\n parseEnumValueDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n const name = this.parseEnumValueName();\n const directives = this.parseConstDirectives();\n return this.node(start, {\n kind: Kind.ENUM_VALUE_DEFINITION,\n description,\n name,\n directives,\n });\n }\n /**\n * EnumValue : Name but not `true`, `false` or `null`\n */\n\n parseEnumValueName() {\n if (\n this._lexer.token.value === 'true' ||\n this._lexer.token.value === 'false' ||\n this._lexer.token.value === 'null'\n ) {\n throw syntaxError(\n this._lexer.source,\n this._lexer.token.start,\n `${getTokenDesc(\n this._lexer.token,\n )} is reserved and cannot be used for an enum value.`,\n );\n }\n\n return this.parseName();\n }\n /**\n * InputObjectTypeDefinition :\n * - Description? input Name Directives[Const]? InputFieldsDefinition?\n */\n\n parseInputObjectTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('input');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const fields = this.parseInputFieldsDefinition();\n return this.node(start, {\n kind: Kind.INPUT_OBJECT_TYPE_DEFINITION,\n description,\n name,\n directives,\n fields,\n });\n }\n /**\n * ```\n * InputFieldsDefinition : { InputValueDefinition+ }\n * ```\n */\n\n parseInputFieldsDefinition() {\n return this.optionalMany(\n TokenKind.BRACE_L,\n this.parseInputValueDef,\n TokenKind.BRACE_R,\n );\n }\n /**\n * TypeSystemExtension :\n * - SchemaExtension\n * - TypeExtension\n *\n * TypeExtension :\n * - ScalarTypeExtension\n * - ObjectTypeExtension\n * - InterfaceTypeExtension\n * - UnionTypeExtension\n * - EnumTypeExtension\n * - InputObjectTypeDefinition\n */\n\n parseTypeSystemExtension() {\n const keywordToken = this._lexer.lookahead();\n\n if (keywordToken.kind === TokenKind.NAME) {\n switch (keywordToken.value) {\n case 'schema':\n return this.parseSchemaExtension();\n\n case 'scalar':\n return this.parseScalarTypeExtension();\n\n case 'type':\n return this.parseObjectTypeExtension();\n\n case 'interface':\n return this.parseInterfaceTypeExtension();\n\n case 'union':\n return this.parseUnionTypeExtension();\n\n case 'enum':\n return this.parseEnumTypeExtension();\n\n case 'input':\n return this.parseInputObjectTypeExtension();\n }\n }\n\n throw this.unexpected(keywordToken);\n }\n /**\n * ```\n * SchemaExtension :\n * - extend schema Directives[Const]? { OperationTypeDefinition+ }\n * - extend schema Directives[Const]\n * ```\n */\n\n parseSchemaExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('schema');\n const directives = this.parseConstDirectives();\n const operationTypes = this.optionalMany(\n TokenKind.BRACE_L,\n this.parseOperationTypeDefinition,\n TokenKind.BRACE_R,\n );\n\n if (directives.length === 0 && operationTypes.length === 0) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.SCHEMA_EXTENSION,\n directives,\n operationTypes,\n });\n }\n /**\n * ScalarTypeExtension :\n * - extend scalar Name Directives[Const]\n */\n\n parseScalarTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('scalar');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n\n if (directives.length === 0) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.SCALAR_TYPE_EXTENSION,\n name,\n directives,\n });\n }\n /**\n * ObjectTypeExtension :\n * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition\n * - extend type Name ImplementsInterfaces? Directives[Const]\n * - extend type Name ImplementsInterfaces\n */\n\n parseObjectTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('type');\n const name = this.parseName();\n const interfaces = this.parseImplementsInterfaces();\n const directives = this.parseConstDirectives();\n const fields = this.parseFieldsDefinition();\n\n if (\n interfaces.length === 0 &&\n directives.length === 0 &&\n fields.length === 0\n ) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.OBJECT_TYPE_EXTENSION,\n name,\n interfaces,\n directives,\n fields,\n });\n }\n /**\n * InterfaceTypeExtension :\n * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition\n * - extend interface Name ImplementsInterfaces? Directives[Const]\n * - extend interface Name ImplementsInterfaces\n */\n\n parseInterfaceTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('interface');\n const name = this.parseName();\n const interfaces = this.parseImplementsInterfaces();\n const directives = this.parseConstDirectives();\n const fields = this.parseFieldsDefinition();\n\n if (\n interfaces.length === 0 &&\n directives.length === 0 &&\n fields.length === 0\n ) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.INTERFACE_TYPE_EXTENSION,\n name,\n interfaces,\n directives,\n fields,\n });\n }\n /**\n * UnionTypeExtension :\n * - extend union Name Directives[Const]? UnionMemberTypes\n * - extend union Name Directives[Const]\n */\n\n parseUnionTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('union');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const types = this.parseUnionMemberTypes();\n\n if (directives.length === 0 && types.length === 0) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.UNION_TYPE_EXTENSION,\n name,\n directives,\n types,\n });\n }\n /**\n * EnumTypeExtension :\n * - extend enum Name Directives[Const]? EnumValuesDefinition\n * - extend enum Name Directives[Const]\n */\n\n parseEnumTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('enum');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const values = this.parseEnumValuesDefinition();\n\n if (directives.length === 0 && values.length === 0) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.ENUM_TYPE_EXTENSION,\n name,\n directives,\n values,\n });\n }\n /**\n * InputObjectTypeExtension :\n * - extend input Name Directives[Const]? InputFieldsDefinition\n * - extend input Name Directives[Const]\n */\n\n parseInputObjectTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('input');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const fields = this.parseInputFieldsDefinition();\n\n if (directives.length === 0 && fields.length === 0) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.INPUT_OBJECT_TYPE_EXTENSION,\n name,\n directives,\n fields,\n });\n }\n /**\n * ```\n * DirectiveDefinition :\n * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations\n * ```\n */\n\n parseDirectiveDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('directive');\n this.expectToken(TokenKind.AT);\n const name = this.parseName();\n const args = this.parseArgumentDefs();\n const repeatable = this.expectOptionalKeyword('repeatable');\n this.expectKeyword('on');\n const locations = this.parseDirectiveLocations();\n return this.node(start, {\n kind: Kind.DIRECTIVE_DEFINITION,\n description,\n name,\n arguments: args,\n repeatable,\n locations,\n });\n }\n /**\n * DirectiveLocations :\n * - `|`? DirectiveLocation\n * - DirectiveLocations | DirectiveLocation\n */\n\n parseDirectiveLocations() {\n return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation);\n }\n /*\n * DirectiveLocation :\n * - ExecutableDirectiveLocation\n * - TypeSystemDirectiveLocation\n *\n * ExecutableDirectiveLocation : one of\n * `QUERY`\n * `MUTATION`\n * `SUBSCRIPTION`\n * `FIELD`\n * `FRAGMENT_DEFINITION`\n * `FRAGMENT_SPREAD`\n * `INLINE_FRAGMENT`\n *\n * TypeSystemDirectiveLocation : one of\n * `SCHEMA`\n * `SCALAR`\n * `OBJECT`\n * `FIELD_DEFINITION`\n * `ARGUMENT_DEFINITION`\n * `INTERFACE`\n * `UNION`\n * `ENUM`\n * `ENUM_VALUE`\n * `INPUT_OBJECT`\n * `INPUT_FIELD_DEFINITION`\n */\n\n parseDirectiveLocation() {\n const start = this._lexer.token;\n const name = this.parseName();\n\n if (Object.prototype.hasOwnProperty.call(DirectiveLocation, name.value)) {\n return name;\n }\n\n throw this.unexpected(start);\n } // Core parsing utility functions\n\n /**\n * Returns a node that, if configured to do so, sets a \"loc\" field as a\n * location object, used to identify the place in the source that created a\n * given parsed object.\n */\n\n node(startToken, node) {\n if (this._options.noLocation !== true) {\n node.loc = new Location(\n startToken,\n this._lexer.lastToken,\n this._lexer.source,\n );\n }\n\n return node;\n }\n /**\n * Determines if the next token is of a given kind\n */\n\n peek(kind) {\n return this._lexer.token.kind === kind;\n }\n /**\n * If the next token is of the given kind, return that token after advancing the lexer.\n * Otherwise, do not change the parser state and throw an error.\n */\n\n expectToken(kind) {\n const token = this._lexer.token;\n\n if (token.kind === kind) {\n this.advanceLexer();\n return token;\n }\n\n throw syntaxError(\n this._lexer.source,\n token.start,\n `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`,\n );\n }\n /**\n * If the next token is of the given kind, return \"true\" after advancing the lexer.\n * Otherwise, do not change the parser state and return \"false\".\n */\n\n expectOptionalToken(kind) {\n const token = this._lexer.token;\n\n if (token.kind === kind) {\n this.advanceLexer();\n return true;\n }\n\n return false;\n }\n /**\n * If the next token is a given keyword, advance the lexer.\n * Otherwise, do not change the parser state and throw an error.\n */\n\n expectKeyword(value) {\n const token = this._lexer.token;\n\n if (token.kind === TokenKind.NAME && token.value === value) {\n this.advanceLexer();\n } else {\n throw syntaxError(\n this._lexer.source,\n token.start,\n `Expected \"${value}\", found ${getTokenDesc(token)}.`,\n );\n }\n }\n /**\n * If the next token is a given keyword, return \"true\" after advancing the lexer.\n * Otherwise, do not change the parser state and return \"false\".\n */\n\n expectOptionalKeyword(value) {\n const token = this._lexer.token;\n\n if (token.kind === TokenKind.NAME && token.value === value) {\n this.advanceLexer();\n return true;\n }\n\n return false;\n }\n /**\n * Helper function for creating an error when an unexpected lexed token is encountered.\n */\n\n unexpected(atToken) {\n const token =\n atToken !== null && atToken !== void 0 ? atToken : this._lexer.token;\n return syntaxError(\n this._lexer.source,\n token.start,\n `Unexpected ${getTokenDesc(token)}.`,\n );\n }\n /**\n * Returns a possibly empty list of parse nodes, determined by the parseFn.\n * This list begins with a lex token of openKind and ends with a lex token of closeKind.\n * Advances the parser to the next lex token after the closing token.\n */\n\n any(openKind, parseFn, closeKind) {\n this.expectToken(openKind);\n const nodes = [];\n\n while (!this.expectOptionalToken(closeKind)) {\n nodes.push(parseFn.call(this));\n }\n\n return nodes;\n }\n /**\n * Returns a list of parse nodes, determined by the parseFn.\n * It can be empty only if open token is missing otherwise it will always return non-empty list\n * that begins with a lex token of openKind and ends with a lex token of closeKind.\n * Advances the parser to the next lex token after the closing token.\n */\n\n optionalMany(openKind, parseFn, closeKind) {\n if (this.expectOptionalToken(openKind)) {\n const nodes = [];\n\n do {\n nodes.push(parseFn.call(this));\n } while (!this.expectOptionalToken(closeKind));\n\n return nodes;\n }\n\n return [];\n }\n /**\n * Returns a non-empty list of parse nodes, determined by the parseFn.\n * This list begins with a lex token of openKind and ends with a lex token of closeKind.\n * Advances the parser to the next lex token after the closing token.\n */\n\n many(openKind, parseFn, closeKind) {\n this.expectToken(openKind);\n const nodes = [];\n\n do {\n nodes.push(parseFn.call(this));\n } while (!this.expectOptionalToken(closeKind));\n\n return nodes;\n }\n /**\n * Returns a non-empty list of parse nodes, determined by the parseFn.\n * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.\n * Advances the parser to the next lex token after last item in the list.\n */\n\n delimitedMany(delimiterKind, parseFn) {\n this.expectOptionalToken(delimiterKind);\n const nodes = [];\n\n do {\n nodes.push(parseFn.call(this));\n } while (this.expectOptionalToken(delimiterKind));\n\n return nodes;\n }\n\n advanceLexer() {\n const { maxTokens } = this._options;\n\n const token = this._lexer.advance();\n\n if (maxTokens !== undefined && token.kind !== TokenKind.EOF) {\n ++this._tokenCounter;\n\n if (this._tokenCounter > maxTokens) {\n throw syntaxError(\n this._lexer.source,\n token.start,\n `Document contains more that ${maxTokens} tokens. Parsing aborted.`,\n );\n }\n }\n }\n}\n/**\n * A helper function to describe a token as a string for debugging.\n */\n\nfunction getTokenDesc(token) {\n const value = token.value;\n return getTokenKindDesc(token.kind) + (value != null ? ` \"${value}\"` : '');\n}\n/**\n * A helper function to describe a token kind as a string for debugging.\n */\n\nfunction getTokenKindDesc(kind) {\n return isPunctuatorTokenKind(kind) ? `\"${kind}\"` : kind;\n}\n", "const MAX_SUGGESTIONS = 5;\n/**\n * Given [ A, B, C ] return ' Did you mean A, B, or C?'.\n */\n\nexport function didYouMean(firstArg, secondArg) {\n const [subMessage, suggestionsArg] = secondArg\n ? [firstArg, secondArg]\n : [undefined, firstArg];\n let message = ' Did you mean ';\n\n if (subMessage) {\n message += subMessage + ' ';\n }\n\n const suggestions = suggestionsArg.map((x) => `\"${x}\"`);\n\n switch (suggestions.length) {\n case 0:\n return '';\n\n case 1:\n return message + suggestions[0] + '?';\n\n case 2:\n return message + suggestions[0] + ' or ' + suggestions[1] + '?';\n }\n\n const selected = suggestions.slice(0, MAX_SUGGESTIONS);\n const lastItem = selected.pop();\n return message + selected.join(', ') + ', or ' + lastItem + '?';\n}\n", "/**\n * Returns the first argument it receives.\n */\nexport function identityFunc(x) {\n return x;\n}\n", "/**\n * Creates a keyed JS object from an array, given a function to produce the keys\n * for each value in the array.\n *\n * This provides a convenient lookup for the array items if the key function\n * produces unique results.\n * ```ts\n * const phoneBook = [\n * { name: 'Jon', num: '555-1234' },\n * { name: 'Jenny', num: '867-5309' }\n * ]\n *\n * const entriesByName = keyMap(\n * phoneBook,\n * entry => entry.name\n * )\n *\n * // {\n * // Jon: { name: 'Jon', num: '555-1234' },\n * // Jenny: { name: 'Jenny', num: '867-5309' }\n * // }\n *\n * const jennyEntry = entriesByName['Jenny']\n *\n * // { name: 'Jenny', num: '857-6309' }\n * ```\n */\nexport function keyMap(list, keyFn) {\n const result = Object.create(null);\n\n for (const item of list) {\n result[keyFn(item)] = item;\n }\n\n return result;\n}\n", "/**\n * Creates a keyed JS object from an array, given a function to produce the keys\n * and a function to produce the values from each item in the array.\n * ```ts\n * const phoneBook = [\n * { name: 'Jon', num: '555-1234' },\n * { name: 'Jenny', num: '867-5309' }\n * ]\n *\n * // { Jon: '555-1234', Jenny: '867-5309' }\n * const phonesByName = keyValMap(\n * phoneBook,\n * entry => entry.name,\n * entry => entry.num\n * )\n * ```\n */\nexport function keyValMap(list, keyFn, valFn) {\n const result = Object.create(null);\n\n for (const item of list) {\n result[keyFn(item)] = valFn(item);\n }\n\n return result;\n}\n", "/**\n * Creates an object map with the same keys as `map` and values generated by\n * running each value of `map` thru `fn`.\n */\nexport function mapValue(map, fn) {\n const result = Object.create(null);\n\n for (const key of Object.keys(map)) {\n result[key] = fn(map[key], key);\n }\n\n return result;\n}\n", "/**\n * Returns a number indicating whether a reference string comes before, or after,\n * or is the same as the given string in natural sort order.\n *\n * See: https://en.wikipedia.org/wiki/Natural_sort_order\n *\n */\nexport function naturalCompare(aStr, bStr) {\n let aIndex = 0;\n let bIndex = 0;\n\n while (aIndex < aStr.length && bIndex < bStr.length) {\n let aChar = aStr.charCodeAt(aIndex);\n let bChar = bStr.charCodeAt(bIndex);\n\n if (isDigit(aChar) && isDigit(bChar)) {\n let aNum = 0;\n\n do {\n ++aIndex;\n aNum = aNum * 10 + aChar - DIGIT_0;\n aChar = aStr.charCodeAt(aIndex);\n } while (isDigit(aChar) && aNum > 0);\n\n let bNum = 0;\n\n do {\n ++bIndex;\n bNum = bNum * 10 + bChar - DIGIT_0;\n bChar = bStr.charCodeAt(bIndex);\n } while (isDigit(bChar) && bNum > 0);\n\n if (aNum < bNum) {\n return -1;\n }\n\n if (aNum > bNum) {\n return 1;\n }\n } else {\n if (aChar < bChar) {\n return -1;\n }\n\n if (aChar > bChar) {\n return 1;\n }\n\n ++aIndex;\n ++bIndex;\n }\n }\n\n return aStr.length - bStr.length;\n}\nconst DIGIT_0 = 48;\nconst DIGIT_9 = 57;\n\nfunction isDigit(code) {\n return !isNaN(code) && DIGIT_0 <= code && code <= DIGIT_9;\n}\n", "import { naturalCompare } from './naturalCompare.mjs';\n/**\n * Given an invalid input string and a list of valid options, returns a filtered\n * list of valid options sorted based on their similarity with the input.\n */\n\nexport function suggestionList(input, options) {\n const optionsByDistance = Object.create(null);\n const lexicalDistance = new LexicalDistance(input);\n const threshold = Math.floor(input.length * 0.4) + 1;\n\n for (const option of options) {\n const distance = lexicalDistance.measure(option, threshold);\n\n if (distance !== undefined) {\n optionsByDistance[option] = distance;\n }\n }\n\n return Object.keys(optionsByDistance).sort((a, b) => {\n const distanceDiff = optionsByDistance[a] - optionsByDistance[b];\n return distanceDiff !== 0 ? distanceDiff : naturalCompare(a, b);\n });\n}\n/**\n * Computes the lexical distance between strings A and B.\n *\n * The \"distance\" between two strings is given by counting the minimum number\n * of edits needed to transform string A into string B. An edit can be an\n * insertion, deletion, or substitution of a single character, or a swap of two\n * adjacent characters.\n *\n * Includes a custom alteration from Damerau-Levenshtein to treat case changes\n * as a single edit which helps identify mis-cased values with an edit distance\n * of 1.\n *\n * This distance can be useful for detecting typos in input or sorting\n */\n\nclass LexicalDistance {\n constructor(input) {\n this._input = input;\n this._inputLowerCase = input.toLowerCase();\n this._inputArray = stringToArray(this._inputLowerCase);\n this._rows = [\n new Array(input.length + 1).fill(0),\n new Array(input.length + 1).fill(0),\n new Array(input.length + 1).fill(0),\n ];\n }\n\n measure(option, threshold) {\n if (this._input === option) {\n return 0;\n }\n\n const optionLowerCase = option.toLowerCase(); // Any case change counts as a single edit\n\n if (this._inputLowerCase === optionLowerCase) {\n return 1;\n }\n\n let a = stringToArray(optionLowerCase);\n let b = this._inputArray;\n\n if (a.length < b.length) {\n const tmp = a;\n a = b;\n b = tmp;\n }\n\n const aLength = a.length;\n const bLength = b.length;\n\n if (aLength - bLength > threshold) {\n return undefined;\n }\n\n const rows = this._rows;\n\n for (let j = 0; j <= bLength; j++) {\n rows[0][j] = j;\n }\n\n for (let i = 1; i <= aLength; i++) {\n const upRow = rows[(i - 1) % 3];\n const currentRow = rows[i % 3];\n let smallestCell = (currentRow[0] = i);\n\n for (let j = 1; j <= bLength; j++) {\n const cost = a[i - 1] === b[j - 1] ? 0 : 1;\n let currentCell = Math.min(\n upRow[j] + 1, // delete\n currentRow[j - 1] + 1, // insert\n upRow[j - 1] + cost, // substitute\n );\n\n if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {\n // transposition\n const doubleDiagonalCell = rows[(i - 2) % 3][j - 2];\n currentCell = Math.min(currentCell, doubleDiagonalCell + 1);\n }\n\n if (currentCell < smallestCell) {\n smallestCell = currentCell;\n }\n\n currentRow[j] = currentCell;\n } // Early exit, since distance can't go smaller than smallest element of the previous row.\n\n if (smallestCell > threshold) {\n return undefined;\n }\n }\n\n const distance = rows[aLength % 3][bLength];\n return distance <= threshold ? distance : undefined;\n }\n}\n\nfunction stringToArray(str) {\n const strLength = str.length;\n const array = new Array(strLength);\n\n for (let i = 0; i < strLength; ++i) {\n array[i] = str.charCodeAt(i);\n }\n\n return array;\n}\n", "export function toObjMap(obj) {\n if (obj == null) {\n return Object.create(null);\n }\n\n if (Object.getPrototypeOf(obj) === null) {\n return obj;\n }\n\n const map = Object.create(null);\n\n for (const [key, value] of Object.entries(obj)) {\n map[key] = value;\n }\n\n return map;\n}\n", "/**\n * Prints a string as a GraphQL StringValue literal. Replaces control characters\n * and excluded characters (\" U+0022 and \\\\ U+005C) with escape sequences.\n */\nexport function printString(str) {\n return `\"${str.replace(escapedRegExp, escapedReplacer)}\"`;\n} // eslint-disable-next-line no-control-regex\n\nconst escapedRegExp = /[\\x00-\\x1f\\x22\\x5c\\x7f-\\x9f]/g;\n\nfunction escapedReplacer(str) {\n return escapeSequences[str.charCodeAt(0)];\n} // prettier-ignore\n\nconst escapeSequences = [\n '\\\\u0000',\n '\\\\u0001',\n '\\\\u0002',\n '\\\\u0003',\n '\\\\u0004',\n '\\\\u0005',\n '\\\\u0006',\n '\\\\u0007',\n '\\\\b',\n '\\\\t',\n '\\\\n',\n '\\\\u000B',\n '\\\\f',\n '\\\\r',\n '\\\\u000E',\n '\\\\u000F',\n '\\\\u0010',\n '\\\\u0011',\n '\\\\u0012',\n '\\\\u0013',\n '\\\\u0014',\n '\\\\u0015',\n '\\\\u0016',\n '\\\\u0017',\n '\\\\u0018',\n '\\\\u0019',\n '\\\\u001A',\n '\\\\u001B',\n '\\\\u001C',\n '\\\\u001D',\n '\\\\u001E',\n '\\\\u001F',\n '',\n '',\n '\\\\\"',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '', // 2F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '', // 3F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '', // 4F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '\\\\\\\\',\n '',\n '',\n '', // 5F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '', // 6F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '\\\\u007F',\n '\\\\u0080',\n '\\\\u0081',\n '\\\\u0082',\n '\\\\u0083',\n '\\\\u0084',\n '\\\\u0085',\n '\\\\u0086',\n '\\\\u0087',\n '\\\\u0088',\n '\\\\u0089',\n '\\\\u008A',\n '\\\\u008B',\n '\\\\u008C',\n '\\\\u008D',\n '\\\\u008E',\n '\\\\u008F',\n '\\\\u0090',\n '\\\\u0091',\n '\\\\u0092',\n '\\\\u0093',\n '\\\\u0094',\n '\\\\u0095',\n '\\\\u0096',\n '\\\\u0097',\n '\\\\u0098',\n '\\\\u0099',\n '\\\\u009A',\n '\\\\u009B',\n '\\\\u009C',\n '\\\\u009D',\n '\\\\u009E',\n '\\\\u009F',\n];\n", "import { devAssert } from '../jsutils/devAssert.mjs';\nimport { inspect } from '../jsutils/inspect.mjs';\nimport { isNode, QueryDocumentKeys } from './ast.mjs';\nimport { Kind } from './kinds.mjs';\n/**\n * A visitor is provided to visit, it contains the collection of\n * relevant functions to be called during the visitor's traversal.\n */\n\nexport const BREAK = Object.freeze({});\n/**\n * visit() will walk through an AST using a depth-first traversal, calling\n * the visitor's enter function at each node in the traversal, and calling the\n * leave function after visiting that node and all of its child nodes.\n *\n * By returning different values from the enter and leave functions, the\n * behavior of the visitor can be altered, including skipping over a sub-tree of\n * the AST (by returning false), editing the AST by returning a value or null\n * to remove the value, or to stop the whole traversal by returning BREAK.\n *\n * When using visit() to edit an AST, the original AST will not be modified, and\n * a new version of the AST with the changes applied will be returned from the\n * visit function.\n *\n * ```ts\n * const editedAST = visit(ast, {\n * enter(node, key, parent, path, ancestors) {\n * // @return\n * // undefined: no action\n * // false: skip visiting this node\n * // visitor.BREAK: stop visiting altogether\n * // null: delete this node\n * // any value: replace this node with the returned value\n * },\n * leave(node, key, parent, path, ancestors) {\n * // @return\n * // undefined: no action\n * // false: no action\n * // visitor.BREAK: stop visiting altogether\n * // null: delete this node\n * // any value: replace this node with the returned value\n * }\n * });\n * ```\n *\n * Alternatively to providing enter() and leave() functions, a visitor can\n * instead provide functions named the same as the kinds of AST nodes, or\n * enter/leave visitors at a named key, leading to three permutations of the\n * visitor API:\n *\n * 1) Named visitors triggered when entering a node of a specific kind.\n *\n * ```ts\n * visit(ast, {\n * Kind(node) {\n * // enter the \"Kind\" node\n * }\n * })\n * ```\n *\n * 2) Named visitors that trigger upon entering and leaving a node of a specific kind.\n *\n * ```ts\n * visit(ast, {\n * Kind: {\n * enter(node) {\n * // enter the \"Kind\" node\n * }\n * leave(node) {\n * // leave the \"Kind\" node\n * }\n * }\n * })\n * ```\n *\n * 3) Generic visitors that trigger upon entering and leaving any node.\n *\n * ```ts\n * visit(ast, {\n * enter(node) {\n * // enter any node\n * },\n * leave(node) {\n * // leave any node\n * }\n * })\n * ```\n */\n\nexport function visit(root, visitor, visitorKeys = QueryDocumentKeys) {\n const enterLeaveMap = new Map();\n\n for (const kind of Object.values(Kind)) {\n enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind));\n }\n /* eslint-disable no-undef-init */\n\n let stack = undefined;\n let inArray = Array.isArray(root);\n let keys = [root];\n let index = -1;\n let edits = [];\n let node = root;\n let key = undefined;\n let parent = undefined;\n const path = [];\n const ancestors = [];\n /* eslint-enable no-undef-init */\n\n do {\n index++;\n const isLeaving = index === keys.length;\n const isEdited = isLeaving && edits.length !== 0;\n\n if (isLeaving) {\n key = ancestors.length === 0 ? undefined : path[path.length - 1];\n node = parent;\n parent = ancestors.pop();\n\n if (isEdited) {\n if (inArray) {\n node = node.slice();\n let editOffset = 0;\n\n for (const [editKey, editValue] of edits) {\n const arrayKey = editKey - editOffset;\n\n if (editValue === null) {\n node.splice(arrayKey, 1);\n editOffset++;\n } else {\n node[arrayKey] = editValue;\n }\n }\n } else {\n node = Object.defineProperties(\n {},\n Object.getOwnPropertyDescriptors(node),\n );\n\n for (const [editKey, editValue] of edits) {\n node[editKey] = editValue;\n }\n }\n }\n\n index = stack.index;\n keys = stack.keys;\n edits = stack.edits;\n inArray = stack.inArray;\n stack = stack.prev;\n } else if (parent) {\n key = inArray ? index : keys[index];\n node = parent[key];\n\n if (node === null || node === undefined) {\n continue;\n }\n\n path.push(key);\n }\n\n let result;\n\n if (!Array.isArray(node)) {\n var _enterLeaveMap$get, _enterLeaveMap$get2;\n\n isNode(node) || devAssert(false, `Invalid AST Node: ${inspect(node)}.`);\n const visitFn = isLeaving\n ? (_enterLeaveMap$get = enterLeaveMap.get(node.kind)) === null ||\n _enterLeaveMap$get === void 0\n ? void 0\n : _enterLeaveMap$get.leave\n : (_enterLeaveMap$get2 = enterLeaveMap.get(node.kind)) === null ||\n _enterLeaveMap$get2 === void 0\n ? void 0\n : _enterLeaveMap$get2.enter;\n result =\n visitFn === null || visitFn === void 0\n ? void 0\n : visitFn.call(visitor, node, key, parent, path, ancestors);\n\n if (result === BREAK) {\n break;\n }\n\n if (result === false) {\n if (!isLeaving) {\n path.pop();\n continue;\n }\n } else if (result !== undefined) {\n edits.push([key, result]);\n\n if (!isLeaving) {\n if (isNode(result)) {\n node = result;\n } else {\n path.pop();\n continue;\n }\n }\n }\n }\n\n if (result === undefined && isEdited) {\n edits.push([key, node]);\n }\n\n if (isLeaving) {\n path.pop();\n } else {\n var _node$kind;\n\n stack = {\n inArray,\n index,\n keys,\n edits,\n prev: stack,\n };\n inArray = Array.isArray(node);\n keys = inArray\n ? node\n : (_node$kind = visitorKeys[node.kind]) !== null &&\n _node$kind !== void 0\n ? _node$kind\n : [];\n index = -1;\n edits = [];\n\n if (parent) {\n ancestors.push(parent);\n }\n\n parent = node;\n }\n } while (stack !== undefined);\n\n if (edits.length !== 0) {\n // New root\n return edits[edits.length - 1][1];\n }\n\n return root;\n}\n/**\n * Creates a new visitor instance which delegates to many visitors to run in\n * parallel. Each visitor will be visited for each node before moving on.\n *\n * If a prior visitor edits a node, no following visitors will see that node.\n */\n\nexport function visitInParallel(visitors) {\n const skipping = new Array(visitors.length).fill(null);\n const mergedVisitor = Object.create(null);\n\n for (const kind of Object.values(Kind)) {\n let hasVisitor = false;\n const enterList = new Array(visitors.length).fill(undefined);\n const leaveList = new Array(visitors.length).fill(undefined);\n\n for (let i = 0; i < visitors.length; ++i) {\n const { enter, leave } = getEnterLeaveForKind(visitors[i], kind);\n hasVisitor || (hasVisitor = enter != null || leave != null);\n enterList[i] = enter;\n leaveList[i] = leave;\n }\n\n if (!hasVisitor) {\n continue;\n }\n\n const mergedEnterLeave = {\n enter(...args) {\n const node = args[0];\n\n for (let i = 0; i < visitors.length; i++) {\n if (skipping[i] === null) {\n var _enterList$i;\n\n const result =\n (_enterList$i = enterList[i]) === null || _enterList$i === void 0\n ? void 0\n : _enterList$i.apply(visitors[i], args);\n\n if (result === false) {\n skipping[i] = node;\n } else if (result === BREAK) {\n skipping[i] = BREAK;\n } else if (result !== undefined) {\n return result;\n }\n }\n }\n },\n\n leave(...args) {\n const node = args[0];\n\n for (let i = 0; i < visitors.length; i++) {\n if (skipping[i] === null) {\n var _leaveList$i;\n\n const result =\n (_leaveList$i = leaveList[i]) === null || _leaveList$i === void 0\n ? void 0\n : _leaveList$i.apply(visitors[i], args);\n\n if (result === BREAK) {\n skipping[i] = BREAK;\n } else if (result !== undefined && result !== false) {\n return result;\n }\n } else if (skipping[i] === node) {\n skipping[i] = null;\n }\n }\n },\n };\n mergedVisitor[kind] = mergedEnterLeave;\n }\n\n return mergedVisitor;\n}\n/**\n * Given a visitor instance and a node kind, return EnterLeaveVisitor for that kind.\n */\n\nexport function getEnterLeaveForKind(visitor, kind) {\n const kindVisitor = visitor[kind];\n\n if (typeof kindVisitor === 'object') {\n // { Kind: { enter() {}, leave() {} } }\n return kindVisitor;\n } else if (typeof kindVisitor === 'function') {\n // { Kind() {} }\n return {\n enter: kindVisitor,\n leave: undefined,\n };\n } // { enter() {}, leave() {} }\n\n return {\n enter: visitor.enter,\n leave: visitor.leave,\n };\n}\n/**\n * Given a visitor instance, if it is leaving or not, and a node kind, return\n * the function the visitor runtime should call.\n *\n * @deprecated Please use `getEnterLeaveForKind` instead. Will be removed in v17\n */\n\n/* c8 ignore next 8 */\n\nexport function getVisitFn(visitor, kind, isLeaving) {\n const { enter, leave } = getEnterLeaveForKind(visitor, kind);\n return isLeaving ? leave : enter;\n}\n", "import { printBlockString } from './blockString.mjs';\nimport { printString } from './printString.mjs';\nimport { visit } from './visitor.mjs';\n/**\n * Converts an AST into a string, using one set of reasonable\n * formatting rules.\n */\n\nexport function print(ast) {\n return visit(ast, printDocASTReducer);\n}\nconst MAX_LINE_LENGTH = 80;\nconst printDocASTReducer = {\n Name: {\n leave: (node) => node.value,\n },\n Variable: {\n leave: (node) => '$' + node.name,\n },\n // Document\n Document: {\n leave: (node) => join(node.definitions, '\\n\\n'),\n },\n OperationDefinition: {\n leave(node) {\n const varDefs = wrap('(', join(node.variableDefinitions, ', '), ')');\n const prefix = join(\n [\n node.operation,\n join([node.name, varDefs]),\n join(node.directives, ' '),\n ],\n ' ',\n ); // Anonymous queries with no directives or variable definitions can use\n // the query short form.\n\n return (prefix === 'query' ? '' : prefix + ' ') + node.selectionSet;\n },\n },\n VariableDefinition: {\n leave: ({ variable, type, defaultValue, directives }) =>\n variable +\n ': ' +\n type +\n wrap(' = ', defaultValue) +\n wrap(' ', join(directives, ' ')),\n },\n SelectionSet: {\n leave: ({ selections }) => block(selections),\n },\n Field: {\n leave({ alias, name, arguments: args, directives, selectionSet }) {\n const prefix = wrap('', alias, ': ') + name;\n let argsLine = prefix + wrap('(', join(args, ', '), ')');\n\n if (argsLine.length > MAX_LINE_LENGTH) {\n argsLine = prefix + wrap('(\\n', indent(join(args, '\\n')), '\\n)');\n }\n\n return join([argsLine, join(directives, ' '), selectionSet], ' ');\n },\n },\n Argument: {\n leave: ({ name, value }) => name + ': ' + value,\n },\n // Fragments\n FragmentSpread: {\n leave: ({ name, directives }) =>\n '...' + name + wrap(' ', join(directives, ' ')),\n },\n InlineFragment: {\n leave: ({ typeCondition, directives, selectionSet }) =>\n join(\n [\n '...',\n wrap('on ', typeCondition),\n join(directives, ' '),\n selectionSet,\n ],\n ' ',\n ),\n },\n FragmentDefinition: {\n leave: (\n { name, typeCondition, variableDefinitions, directives, selectionSet }, // Note: fragment variable definitions are experimental and may be changed\n ) =>\n // or removed in the future.\n `fragment ${name}${wrap('(', join(variableDefinitions, ', '), ')')} ` +\n `on ${typeCondition} ${wrap('', join(directives, ' '), ' ')}` +\n selectionSet,\n },\n // Value\n IntValue: {\n leave: ({ value }) => value,\n },\n FloatValue: {\n leave: ({ value }) => value,\n },\n StringValue: {\n leave: ({ value, block: isBlockString }) =>\n isBlockString ? printBlockString(value) : printString(value),\n },\n BooleanValue: {\n leave: ({ value }) => (value ? 'true' : 'false'),\n },\n NullValue: {\n leave: () => 'null',\n },\n EnumValue: {\n leave: ({ value }) => value,\n },\n ListValue: {\n leave: ({ values }) => '[' + join(values, ', ') + ']',\n },\n ObjectValue: {\n leave: ({ fields }) => '{' + join(fields, ', ') + '}',\n },\n ObjectField: {\n leave: ({ name, value }) => name + ': ' + value,\n },\n // Directive\n Directive: {\n leave: ({ name, arguments: args }) =>\n '@' + name + wrap('(', join(args, ', '), ')'),\n },\n // Type\n NamedType: {\n leave: ({ name }) => name,\n },\n ListType: {\n leave: ({ type }) => '[' + type + ']',\n },\n NonNullType: {\n leave: ({ type }) => type + '!',\n },\n // Type System Definitions\n SchemaDefinition: {\n leave: ({ description, directives, operationTypes }) =>\n wrap('', description, '\\n') +\n join(['schema', join(directives, ' '), block(operationTypes)], ' '),\n },\n OperationTypeDefinition: {\n leave: ({ operation, type }) => operation + ': ' + type,\n },\n ScalarTypeDefinition: {\n leave: ({ description, name, directives }) =>\n wrap('', description, '\\n') +\n join(['scalar', name, join(directives, ' ')], ' '),\n },\n ObjectTypeDefinition: {\n leave: ({ description, name, interfaces, directives, fields }) =>\n wrap('', description, '\\n') +\n join(\n [\n 'type',\n name,\n wrap('implements ', join(interfaces, ' & ')),\n join(directives, ' '),\n block(fields),\n ],\n ' ',\n ),\n },\n FieldDefinition: {\n leave: ({ description, name, arguments: args, type, directives }) =>\n wrap('', description, '\\n') +\n name +\n (hasMultilineItems(args)\n ? wrap('(\\n', indent(join(args, '\\n')), '\\n)')\n : wrap('(', join(args, ', '), ')')) +\n ': ' +\n type +\n wrap(' ', join(directives, ' ')),\n },\n InputValueDefinition: {\n leave: ({ description, name, type, defaultValue, directives }) =>\n wrap('', description, '\\n') +\n join(\n [name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')],\n ' ',\n ),\n },\n InterfaceTypeDefinition: {\n leave: ({ description, name, interfaces, directives, fields }) =>\n wrap('', description, '\\n') +\n join(\n [\n 'interface',\n name,\n wrap('implements ', join(interfaces, ' & ')),\n join(directives, ' '),\n block(fields),\n ],\n ' ',\n ),\n },\n UnionTypeDefinition: {\n leave: ({ description, name, directives, types }) =>\n wrap('', description, '\\n') +\n join(\n ['union', name, join(directives, ' '), wrap('= ', join(types, ' | '))],\n ' ',\n ),\n },\n EnumTypeDefinition: {\n leave: ({ description, name, directives, values }) =>\n wrap('', description, '\\n') +\n join(['enum', name, join(directives, ' '), block(values)], ' '),\n },\n EnumValueDefinition: {\n leave: ({ description, name, directives }) =>\n wrap('', description, '\\n') + join([name, join(directives, ' ')], ' '),\n },\n InputObjectTypeDefinition: {\n leave: ({ description, name, directives, fields }) =>\n wrap('', description, '\\n') +\n join(['input', name, join(directives, ' '), block(fields)], ' '),\n },\n DirectiveDefinition: {\n leave: ({ description, name, arguments: args, repeatable, locations }) =>\n wrap('', description, '\\n') +\n 'directive @' +\n name +\n (hasMultilineItems(args)\n ? wrap('(\\n', indent(join(args, '\\n')), '\\n)')\n : wrap('(', join(args, ', '), ')')) +\n (repeatable ? ' repeatable' : '') +\n ' on ' +\n join(locations, ' | '),\n },\n SchemaExtension: {\n leave: ({ directives, operationTypes }) =>\n join(\n ['extend schema', join(directives, ' '), block(operationTypes)],\n ' ',\n ),\n },\n ScalarTypeExtension: {\n leave: ({ name, directives }) =>\n join(['extend scalar', name, join(directives, ' ')], ' '),\n },\n ObjectTypeExtension: {\n leave: ({ name, interfaces, directives, fields }) =>\n join(\n [\n 'extend type',\n name,\n wrap('implements ', join(interfaces, ' & ')),\n join(directives, ' '),\n block(fields),\n ],\n ' ',\n ),\n },\n InterfaceTypeExtension: {\n leave: ({ name, interfaces, directives, fields }) =>\n join(\n [\n 'extend interface',\n name,\n wrap('implements ', join(interfaces, ' & ')),\n join(directives, ' '),\n block(fields),\n ],\n ' ',\n ),\n },\n UnionTypeExtension: {\n leave: ({ name, directives, types }) =>\n join(\n [\n 'extend union',\n name,\n join(directives, ' '),\n wrap('= ', join(types, ' | ')),\n ],\n ' ',\n ),\n },\n EnumTypeExtension: {\n leave: ({ name, directives, values }) =>\n join(['extend enum', name, join(directives, ' '), block(values)], ' '),\n },\n InputObjectTypeExtension: {\n leave: ({ name, directives, fields }) =>\n join(['extend input', name, join(directives, ' '), block(fields)], ' '),\n },\n};\n/**\n * Given maybeArray, print an empty string if it is null or empty, otherwise\n * print all items together separated by separator if provided\n */\n\nfunction join(maybeArray, separator = '') {\n var _maybeArray$filter$jo;\n\n return (_maybeArray$filter$jo =\n maybeArray === null || maybeArray === void 0\n ? void 0\n : maybeArray.filter((x) => x).join(separator)) !== null &&\n _maybeArray$filter$jo !== void 0\n ? _maybeArray$filter$jo\n : '';\n}\n/**\n * Given array, print each item on its own line, wrapped in an indented `{ }` block.\n */\n\nfunction block(array) {\n return wrap('{\\n', indent(join(array, '\\n')), '\\n}');\n}\n/**\n * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string.\n */\n\nfunction wrap(start, maybeString, end = '') {\n return maybeString != null && maybeString !== ''\n ? start + maybeString + end\n : '';\n}\n\nfunction indent(str) {\n return wrap(' ', str.replace(/\\n/g, '\\n '));\n}\n\nfunction hasMultilineItems(maybeArray) {\n var _maybeArray$some;\n\n // FIXME: https://github.com/graphql/graphql-js/issues/2203\n\n /* c8 ignore next */\n return (_maybeArray$some =\n maybeArray === null || maybeArray === void 0\n ? void 0\n : maybeArray.some((str) => str.includes('\\n'))) !== null &&\n _maybeArray$some !== void 0\n ? _maybeArray$some\n : false;\n}\n", "import { keyValMap } from '../jsutils/keyValMap.mjs';\nimport { Kind } from '../language/kinds.mjs';\n/**\n * Produces a JavaScript value given a GraphQL Value AST.\n *\n * Unlike `valueFromAST()`, no type is provided. The resulting JavaScript value\n * will reflect the provided GraphQL value AST.\n *\n * | GraphQL Value | JavaScript Value |\n * | -------------------- | ---------------- |\n * | Input Object | Object |\n * | List | Array |\n * | Boolean | Boolean |\n * | String / Enum | String |\n * | Int / Float | Number |\n * | Null | null |\n *\n */\n\nexport function valueFromASTUntyped(valueNode, variables) {\n switch (valueNode.kind) {\n case Kind.NULL:\n return null;\n\n case Kind.INT:\n return parseInt(valueNode.value, 10);\n\n case Kind.FLOAT:\n return parseFloat(valueNode.value);\n\n case Kind.STRING:\n case Kind.ENUM:\n case Kind.BOOLEAN:\n return valueNode.value;\n\n case Kind.LIST:\n return valueNode.values.map((node) =>\n valueFromASTUntyped(node, variables),\n );\n\n case Kind.OBJECT:\n return keyValMap(\n valueNode.fields,\n (field) => field.name.value,\n (field) => valueFromASTUntyped(field.value, variables),\n );\n\n case Kind.VARIABLE:\n return variables === null || variables === void 0\n ? void 0\n : variables[valueNode.name.value];\n }\n}\n", "import { devAssert } from '../jsutils/devAssert.mjs';\nimport { GraphQLError } from '../error/GraphQLError.mjs';\nimport { isNameContinue, isNameStart } from '../language/characterClasses.mjs';\n/**\n * Upholds the spec rules about naming.\n */\n\nexport function assertName(name) {\n name != null || devAssert(false, 'Must provide name.');\n typeof name === 'string' || devAssert(false, 'Expected name to be a string.');\n\n if (name.length === 0) {\n throw new GraphQLError('Expected name to be a non-empty string.');\n }\n\n for (let i = 1; i < name.length; ++i) {\n if (!isNameContinue(name.charCodeAt(i))) {\n throw new GraphQLError(\n `Names must only contain [_a-zA-Z0-9] but \"${name}\" does not.`,\n );\n }\n }\n\n if (!isNameStart(name.charCodeAt(0))) {\n throw new GraphQLError(\n `Names must start with [_a-zA-Z] but \"${name}\" does not.`,\n );\n }\n\n return name;\n}\n/**\n * Upholds the spec rules about naming enum values.\n *\n * @internal\n */\n\nexport function assertEnumValueName(name) {\n if (name === 'true' || name === 'false' || name === 'null') {\n throw new GraphQLError(`Enum values cannot be named: ${name}`);\n }\n\n return assertName(name);\n}\n", "import { devAssert } from '../jsutils/devAssert.mjs';\nimport { didYouMean } from '../jsutils/didYouMean.mjs';\nimport { identityFunc } from '../jsutils/identityFunc.mjs';\nimport { inspect } from '../jsutils/inspect.mjs';\nimport { instanceOf } from '../jsutils/instanceOf.mjs';\nimport { isObjectLike } from '../jsutils/isObjectLike.mjs';\nimport { keyMap } from '../jsutils/keyMap.mjs';\nimport { keyValMap } from '../jsutils/keyValMap.mjs';\nimport { mapValue } from '../jsutils/mapValue.mjs';\nimport { suggestionList } from '../jsutils/suggestionList.mjs';\nimport { toObjMap } from '../jsutils/toObjMap.mjs';\nimport { GraphQLError } from '../error/GraphQLError.mjs';\nimport { Kind } from '../language/kinds.mjs';\nimport { print } from '../language/printer.mjs';\nimport { valueFromASTUntyped } from '../utilities/valueFromASTUntyped.mjs';\nimport { assertEnumValueName, assertName } from './assertName.mjs';\nexport function isType(type) {\n return (\n isScalarType(type) ||\n isObjectType(type) ||\n isInterfaceType(type) ||\n isUnionType(type) ||\n isEnumType(type) ||\n isInputObjectType(type) ||\n isListType(type) ||\n isNonNullType(type)\n );\n}\nexport function assertType(type) {\n if (!isType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL type.`);\n }\n\n return type;\n}\n/**\n * There are predicates for each kind of GraphQL type.\n */\n\nexport function isScalarType(type) {\n return instanceOf(type, GraphQLScalarType);\n}\nexport function assertScalarType(type) {\n if (!isScalarType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL Scalar type.`);\n }\n\n return type;\n}\nexport function isObjectType(type) {\n return instanceOf(type, GraphQLObjectType);\n}\nexport function assertObjectType(type) {\n if (!isObjectType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL Object type.`);\n }\n\n return type;\n}\nexport function isInterfaceType(type) {\n return instanceOf(type, GraphQLInterfaceType);\n}\nexport function assertInterfaceType(type) {\n if (!isInterfaceType(type)) {\n throw new Error(\n `Expected ${inspect(type)} to be a GraphQL Interface type.`,\n );\n }\n\n return type;\n}\nexport function isUnionType(type) {\n return instanceOf(type, GraphQLUnionType);\n}\nexport function assertUnionType(type) {\n if (!isUnionType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL Union type.`);\n }\n\n return type;\n}\nexport function isEnumType(type) {\n return instanceOf(type, GraphQLEnumType);\n}\nexport function assertEnumType(type) {\n if (!isEnumType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL Enum type.`);\n }\n\n return type;\n}\nexport function isInputObjectType(type) {\n return instanceOf(type, GraphQLInputObjectType);\n}\nexport function assertInputObjectType(type) {\n if (!isInputObjectType(type)) {\n throw new Error(\n `Expected ${inspect(type)} to be a GraphQL Input Object type.`,\n );\n }\n\n return type;\n}\nexport function isListType(type) {\n return instanceOf(type, GraphQLList);\n}\nexport function assertListType(type) {\n if (!isListType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL List type.`);\n }\n\n return type;\n}\nexport function isNonNullType(type) {\n return instanceOf(type, GraphQLNonNull);\n}\nexport function assertNonNullType(type) {\n if (!isNonNullType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL Non-Null type.`);\n }\n\n return type;\n}\n/**\n * These types may be used as input types for arguments and directives.\n */\n\nexport function isInputType(type) {\n return (\n isScalarType(type) ||\n isEnumType(type) ||\n isInputObjectType(type) ||\n (isWrappingType(type) && isInputType(type.ofType))\n );\n}\nexport function assertInputType(type) {\n if (!isInputType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL input type.`);\n }\n\n return type;\n}\n/**\n * These types may be used as output types as the result of fields.\n */\n\nexport function isOutputType(type) {\n return (\n isScalarType(type) ||\n isObjectType(type) ||\n isInterfaceType(type) ||\n isUnionType(type) ||\n isEnumType(type) ||\n (isWrappingType(type) && isOutputType(type.ofType))\n );\n}\nexport function assertOutputType(type) {\n if (!isOutputType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL output type.`);\n }\n\n return type;\n}\n/**\n * These types may describe types which may be leaf values.\n */\n\nexport function isLeafType(type) {\n return isScalarType(type) || isEnumType(type);\n}\nexport function assertLeafType(type) {\n if (!isLeafType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL leaf type.`);\n }\n\n return type;\n}\n/**\n * These types may describe the parent context of a selection set.\n */\n\nexport function isCompositeType(type) {\n return isObjectType(type) || isInterfaceType(type) || isUnionType(type);\n}\nexport function assertCompositeType(type) {\n if (!isCompositeType(type)) {\n throw new Error(\n `Expected ${inspect(type)} to be a GraphQL composite type.`,\n );\n }\n\n return type;\n}\n/**\n * These types may describe the parent context of a selection set.\n */\n\nexport function isAbstractType(type) {\n return isInterfaceType(type) || isUnionType(type);\n}\nexport function assertAbstractType(type) {\n if (!isAbstractType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL abstract type.`);\n }\n\n return type;\n}\n/**\n * List Type Wrapper\n *\n * A list is a wrapping type which points to another type.\n * Lists are often created within the context of defining the fields of\n * an object type.\n *\n * Example:\n *\n * ```ts\n * const PersonType = new GraphQLObjectType({\n * name: 'Person',\n * fields: () => ({\n * parents: { type: new GraphQLList(PersonType) },\n * children: { type: new GraphQLList(PersonType) },\n * })\n * })\n * ```\n */\n\nexport class GraphQLList {\n constructor(ofType) {\n isType(ofType) ||\n devAssert(false, `Expected ${inspect(ofType)} to be a GraphQL type.`);\n this.ofType = ofType;\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLList';\n }\n\n toString() {\n return '[' + String(this.ofType) + ']';\n }\n\n toJSON() {\n return this.toString();\n }\n}\n/**\n * Non-Null Type Wrapper\n *\n * A non-null is a wrapping type which points to another type.\n * Non-null types enforce that their values are never null and can ensure\n * an error is raised if this ever occurs during a request. It is useful for\n * fields which you can make a strong guarantee on non-nullability, for example\n * usually the id field of a database row will never be null.\n *\n * Example:\n *\n * ```ts\n * const RowType = new GraphQLObjectType({\n * name: 'Row',\n * fields: () => ({\n * id: { type: new GraphQLNonNull(GraphQLString) },\n * })\n * })\n * ```\n * Note: the enforcement of non-nullability occurs within the executor.\n */\n\nexport class GraphQLNonNull {\n constructor(ofType) {\n isNullableType(ofType) ||\n devAssert(\n false,\n `Expected ${inspect(ofType)} to be a GraphQL nullable type.`,\n );\n this.ofType = ofType;\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLNonNull';\n }\n\n toString() {\n return String(this.ofType) + '!';\n }\n\n toJSON() {\n return this.toString();\n }\n}\n/**\n * These types wrap and modify other types\n */\n\nexport function isWrappingType(type) {\n return isListType(type) || isNonNullType(type);\n}\nexport function assertWrappingType(type) {\n if (!isWrappingType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL wrapping type.`);\n }\n\n return type;\n}\n/**\n * These types can all accept null as a value.\n */\n\nexport function isNullableType(type) {\n return isType(type) && !isNonNullType(type);\n}\nexport function assertNullableType(type) {\n if (!isNullableType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL nullable type.`);\n }\n\n return type;\n}\nexport function getNullableType(type) {\n if (type) {\n return isNonNullType(type) ? type.ofType : type;\n }\n}\n/**\n * These named types do not include modifiers like List or NonNull.\n */\n\nexport function isNamedType(type) {\n return (\n isScalarType(type) ||\n isObjectType(type) ||\n isInterfaceType(type) ||\n isUnionType(type) ||\n isEnumType(type) ||\n isInputObjectType(type)\n );\n}\nexport function assertNamedType(type) {\n if (!isNamedType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL named type.`);\n }\n\n return type;\n}\nexport function getNamedType(type) {\n if (type) {\n let unwrappedType = type;\n\n while (isWrappingType(unwrappedType)) {\n unwrappedType = unwrappedType.ofType;\n }\n\n return unwrappedType;\n }\n}\n/**\n * Used while defining GraphQL types to allow for circular references in\n * otherwise immutable type definitions.\n */\n\nexport function resolveReadonlyArrayThunk(thunk) {\n return typeof thunk === 'function' ? thunk() : thunk;\n}\nexport function resolveObjMapThunk(thunk) {\n return typeof thunk === 'function' ? thunk() : thunk;\n}\n/**\n * Custom extensions\n *\n * @remarks\n * Use a unique identifier name for your extension, for example the name of\n * your library or project. Do not use a shortened identifier as this increases\n * the risk of conflicts. We recommend you add at most one extension field,\n * an object which can contain all the values you need.\n */\n\n/**\n * Scalar Type Definition\n *\n * The leaf values of any request and input values to arguments are\n * Scalars (or Enums) and are defined with a name and a series of functions\n * used to parse input from ast or variables and to ensure validity.\n *\n * If a type's serialize function returns `null` or does not return a value\n * (i.e. it returns `undefined`) then an error will be raised and a `null`\n * value will be returned in the response. It is always better to validate\n *\n * Example:\n *\n * ```ts\n * const OddType = new GraphQLScalarType({\n * name: 'Odd',\n * serialize(value) {\n * if (!Number.isFinite(value)) {\n * throw new Error(\n * `Scalar \"Odd\" cannot represent \"${value}\" since it is not a finite number.`,\n * );\n * }\n *\n * if (value % 2 === 0) {\n * throw new Error(`Scalar \"Odd\" cannot represent \"${value}\" since it is even.`);\n * }\n * return value;\n * }\n * });\n * ```\n */\nexport class GraphQLScalarType {\n constructor(config) {\n var _config$parseValue,\n _config$serialize,\n _config$parseLiteral,\n _config$extensionASTN;\n\n const parseValue =\n (_config$parseValue = config.parseValue) !== null &&\n _config$parseValue !== void 0\n ? _config$parseValue\n : identityFunc;\n this.name = assertName(config.name);\n this.description = config.description;\n this.specifiedByURL = config.specifiedByURL;\n this.serialize =\n (_config$serialize = config.serialize) !== null &&\n _config$serialize !== void 0\n ? _config$serialize\n : identityFunc;\n this.parseValue = parseValue;\n this.parseLiteral =\n (_config$parseLiteral = config.parseLiteral) !== null &&\n _config$parseLiteral !== void 0\n ? _config$parseLiteral\n : (node, variables) => parseValue(valueFromASTUntyped(node, variables));\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n this.extensionASTNodes =\n (_config$extensionASTN = config.extensionASTNodes) !== null &&\n _config$extensionASTN !== void 0\n ? _config$extensionASTN\n : [];\n config.specifiedByURL == null ||\n typeof config.specifiedByURL === 'string' ||\n devAssert(\n false,\n `${this.name} must provide \"specifiedByURL\" as a string, ` +\n `but got: ${inspect(config.specifiedByURL)}.`,\n );\n config.serialize == null ||\n typeof config.serialize === 'function' ||\n devAssert(\n false,\n `${this.name} must provide \"serialize\" function. If this custom Scalar is also used as an input type, ensure \"parseValue\" and \"parseLiteral\" functions are also provided.`,\n );\n\n if (config.parseLiteral) {\n (typeof config.parseValue === 'function' &&\n typeof config.parseLiteral === 'function') ||\n devAssert(\n false,\n `${this.name} must provide both \"parseValue\" and \"parseLiteral\" functions.`,\n );\n }\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLScalarType';\n }\n\n toConfig() {\n return {\n name: this.name,\n description: this.description,\n specifiedByURL: this.specifiedByURL,\n serialize: this.serialize,\n parseValue: this.parseValue,\n parseLiteral: this.parseLiteral,\n extensions: this.extensions,\n astNode: this.astNode,\n extensionASTNodes: this.extensionASTNodes,\n };\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\n/**\n * Object Type Definition\n *\n * Almost all of the GraphQL types you define will be object types. Object types\n * have a name, but most importantly describe their fields.\n *\n * Example:\n *\n * ```ts\n * const AddressType = new GraphQLObjectType({\n * name: 'Address',\n * fields: {\n * street: { type: GraphQLString },\n * number: { type: GraphQLInt },\n * formatted: {\n * type: GraphQLString,\n * resolve(obj) {\n * return obj.number + ' ' + obj.street\n * }\n * }\n * }\n * });\n * ```\n *\n * When two types need to refer to each other, or a type needs to refer to\n * itself in a field, you can use a function expression (aka a closure or a\n * thunk) to supply the fields lazily.\n *\n * Example:\n *\n * ```ts\n * const PersonType = new GraphQLObjectType({\n * name: 'Person',\n * fields: () => ({\n * name: { type: GraphQLString },\n * bestFriend: { type: PersonType },\n * })\n * });\n * ```\n */\nexport class GraphQLObjectType {\n constructor(config) {\n var _config$extensionASTN2;\n\n this.name = assertName(config.name);\n this.description = config.description;\n this.isTypeOf = config.isTypeOf;\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n this.extensionASTNodes =\n (_config$extensionASTN2 = config.extensionASTNodes) !== null &&\n _config$extensionASTN2 !== void 0\n ? _config$extensionASTN2\n : [];\n\n this._fields = () => defineFieldMap(config);\n\n this._interfaces = () => defineInterfaces(config);\n\n config.isTypeOf == null ||\n typeof config.isTypeOf === 'function' ||\n devAssert(\n false,\n `${this.name} must provide \"isTypeOf\" as a function, ` +\n `but got: ${inspect(config.isTypeOf)}.`,\n );\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLObjectType';\n }\n\n getFields() {\n if (typeof this._fields === 'function') {\n this._fields = this._fields();\n }\n\n return this._fields;\n }\n\n getInterfaces() {\n if (typeof this._interfaces === 'function') {\n this._interfaces = this._interfaces();\n }\n\n return this._interfaces;\n }\n\n toConfig() {\n return {\n name: this.name,\n description: this.description,\n interfaces: this.getInterfaces(),\n fields: fieldsToFieldsConfig(this.getFields()),\n isTypeOf: this.isTypeOf,\n extensions: this.extensions,\n astNode: this.astNode,\n extensionASTNodes: this.extensionASTNodes,\n };\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\nfunction defineInterfaces(config) {\n var _config$interfaces;\n\n const interfaces = resolveReadonlyArrayThunk(\n (_config$interfaces = config.interfaces) !== null &&\n _config$interfaces !== void 0\n ? _config$interfaces\n : [],\n );\n Array.isArray(interfaces) ||\n devAssert(\n false,\n `${config.name} interfaces must be an Array or a function which returns an Array.`,\n );\n return interfaces;\n}\n\nfunction defineFieldMap(config) {\n const fieldMap = resolveObjMapThunk(config.fields);\n isPlainObj(fieldMap) ||\n devAssert(\n false,\n `${config.name} fields must be an object with field names as keys or a function which returns such an object.`,\n );\n return mapValue(fieldMap, (fieldConfig, fieldName) => {\n var _fieldConfig$args;\n\n isPlainObj(fieldConfig) ||\n devAssert(\n false,\n `${config.name}.${fieldName} field config must be an object.`,\n );\n fieldConfig.resolve == null ||\n typeof fieldConfig.resolve === 'function' ||\n devAssert(\n false,\n `${config.name}.${fieldName} field resolver must be a function if ` +\n `provided, but got: ${inspect(fieldConfig.resolve)}.`,\n );\n const argsConfig =\n (_fieldConfig$args = fieldConfig.args) !== null &&\n _fieldConfig$args !== void 0\n ? _fieldConfig$args\n : {};\n isPlainObj(argsConfig) ||\n devAssert(\n false,\n `${config.name}.${fieldName} args must be an object with argument names as keys.`,\n );\n return {\n name: assertName(fieldName),\n description: fieldConfig.description,\n type: fieldConfig.type,\n args: defineArguments(argsConfig),\n resolve: fieldConfig.resolve,\n subscribe: fieldConfig.subscribe,\n deprecationReason: fieldConfig.deprecationReason,\n extensions: toObjMap(fieldConfig.extensions),\n astNode: fieldConfig.astNode,\n };\n });\n}\n\nexport function defineArguments(config) {\n return Object.entries(config).map(([argName, argConfig]) => ({\n name: assertName(argName),\n description: argConfig.description,\n type: argConfig.type,\n defaultValue: argConfig.defaultValue,\n deprecationReason: argConfig.deprecationReason,\n extensions: toObjMap(argConfig.extensions),\n astNode: argConfig.astNode,\n }));\n}\n\nfunction isPlainObj(obj) {\n return isObjectLike(obj) && !Array.isArray(obj);\n}\n\nfunction fieldsToFieldsConfig(fields) {\n return mapValue(fields, (field) => ({\n description: field.description,\n type: field.type,\n args: argsToArgsConfig(field.args),\n resolve: field.resolve,\n subscribe: field.subscribe,\n deprecationReason: field.deprecationReason,\n extensions: field.extensions,\n astNode: field.astNode,\n }));\n}\n/**\n * @internal\n */\n\nexport function argsToArgsConfig(args) {\n return keyValMap(\n args,\n (arg) => arg.name,\n (arg) => ({\n description: arg.description,\n type: arg.type,\n defaultValue: arg.defaultValue,\n deprecationReason: arg.deprecationReason,\n extensions: arg.extensions,\n astNode: arg.astNode,\n }),\n );\n}\nexport function isRequiredArgument(arg) {\n return isNonNullType(arg.type) && arg.defaultValue === undefined;\n}\n\n/**\n * Interface Type Definition\n *\n * When a field can return one of a heterogeneous set of types, a Interface type\n * is used to describe what types are possible, what fields are in common across\n * all types, as well as a function to determine which type is actually used\n * when the field is resolved.\n *\n * Example:\n *\n * ```ts\n * const EntityType = new GraphQLInterfaceType({\n * name: 'Entity',\n * fields: {\n * name: { type: GraphQLString }\n * }\n * });\n * ```\n */\nexport class GraphQLInterfaceType {\n constructor(config) {\n var _config$extensionASTN3;\n\n this.name = assertName(config.name);\n this.description = config.description;\n this.resolveType = config.resolveType;\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n this.extensionASTNodes =\n (_config$extensionASTN3 = config.extensionASTNodes) !== null &&\n _config$extensionASTN3 !== void 0\n ? _config$extensionASTN3\n : [];\n this._fields = defineFieldMap.bind(undefined, config);\n this._interfaces = defineInterfaces.bind(undefined, config);\n config.resolveType == null ||\n typeof config.resolveType === 'function' ||\n devAssert(\n false,\n `${this.name} must provide \"resolveType\" as a function, ` +\n `but got: ${inspect(config.resolveType)}.`,\n );\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLInterfaceType';\n }\n\n getFields() {\n if (typeof this._fields === 'function') {\n this._fields = this._fields();\n }\n\n return this._fields;\n }\n\n getInterfaces() {\n if (typeof this._interfaces === 'function') {\n this._interfaces = this._interfaces();\n }\n\n return this._interfaces;\n }\n\n toConfig() {\n return {\n name: this.name,\n description: this.description,\n interfaces: this.getInterfaces(),\n fields: fieldsToFieldsConfig(this.getFields()),\n resolveType: this.resolveType,\n extensions: this.extensions,\n astNode: this.astNode,\n extensionASTNodes: this.extensionASTNodes,\n };\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\n/**\n * Union Type Definition\n *\n * When a field can return one of a heterogeneous set of types, a Union type\n * is used to describe what types are possible as well as providing a function\n * to determine which type is actually used when the field is resolved.\n *\n * Example:\n *\n * ```ts\n * const PetType = new GraphQLUnionType({\n * name: 'Pet',\n * types: [ DogType, CatType ],\n * resolveType(value) {\n * if (value instanceof Dog) {\n * return DogType;\n * }\n * if (value instanceof Cat) {\n * return CatType;\n * }\n * }\n * });\n * ```\n */\nexport class GraphQLUnionType {\n constructor(config) {\n var _config$extensionASTN4;\n\n this.name = assertName(config.name);\n this.description = config.description;\n this.resolveType = config.resolveType;\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n this.extensionASTNodes =\n (_config$extensionASTN4 = config.extensionASTNodes) !== null &&\n _config$extensionASTN4 !== void 0\n ? _config$extensionASTN4\n : [];\n this._types = defineTypes.bind(undefined, config);\n config.resolveType == null ||\n typeof config.resolveType === 'function' ||\n devAssert(\n false,\n `${this.name} must provide \"resolveType\" as a function, ` +\n `but got: ${inspect(config.resolveType)}.`,\n );\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLUnionType';\n }\n\n getTypes() {\n if (typeof this._types === 'function') {\n this._types = this._types();\n }\n\n return this._types;\n }\n\n toConfig() {\n return {\n name: this.name,\n description: this.description,\n types: this.getTypes(),\n resolveType: this.resolveType,\n extensions: this.extensions,\n astNode: this.astNode,\n extensionASTNodes: this.extensionASTNodes,\n };\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\nfunction defineTypes(config) {\n const types = resolveReadonlyArrayThunk(config.types);\n Array.isArray(types) ||\n devAssert(\n false,\n `Must provide Array of types or a function which returns such an array for Union ${config.name}.`,\n );\n return types;\n}\n\n/**\n * Enum Type Definition\n *\n * Some leaf values of requests and input values are Enums. GraphQL serializes\n * Enum values as strings, however internally Enums can be represented by any\n * kind of type, often integers.\n *\n * Example:\n *\n * ```ts\n * const RGBType = new GraphQLEnumType({\n * name: 'RGB',\n * values: {\n * RED: { value: 0 },\n * GREEN: { value: 1 },\n * BLUE: { value: 2 }\n * }\n * });\n * ```\n *\n * Note: If a value is not provided in a definition, the name of the enum value\n * will be used as its internal value.\n */\nexport class GraphQLEnumType {\n /* */\n constructor(config) {\n var _config$extensionASTN5;\n\n this.name = assertName(config.name);\n this.description = config.description;\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n this.extensionASTNodes =\n (_config$extensionASTN5 = config.extensionASTNodes) !== null &&\n _config$extensionASTN5 !== void 0\n ? _config$extensionASTN5\n : [];\n this._values = defineEnumValues(this.name, config.values);\n this._valueLookup = new Map(\n this._values.map((enumValue) => [enumValue.value, enumValue]),\n );\n this._nameLookup = keyMap(this._values, (value) => value.name);\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLEnumType';\n }\n\n getValues() {\n return this._values;\n }\n\n getValue(name) {\n return this._nameLookup[name];\n }\n\n serialize(outputValue) {\n const enumValue = this._valueLookup.get(outputValue);\n\n if (enumValue === undefined) {\n throw new GraphQLError(\n `Enum \"${this.name}\" cannot represent value: ${inspect(outputValue)}`,\n );\n }\n\n return enumValue.name;\n }\n\n parseValue(inputValue) /* T */\n {\n if (typeof inputValue !== 'string') {\n const valueStr = inspect(inputValue);\n throw new GraphQLError(\n `Enum \"${this.name}\" cannot represent non-string value: ${valueStr}.` +\n didYouMeanEnumValue(this, valueStr),\n );\n }\n\n const enumValue = this.getValue(inputValue);\n\n if (enumValue == null) {\n throw new GraphQLError(\n `Value \"${inputValue}\" does not exist in \"${this.name}\" enum.` +\n didYouMeanEnumValue(this, inputValue),\n );\n }\n\n return enumValue.value;\n }\n\n parseLiteral(valueNode, _variables) /* T */\n {\n // Note: variables will be resolved to a value before calling this function.\n if (valueNode.kind !== Kind.ENUM) {\n const valueStr = print(valueNode);\n throw new GraphQLError(\n `Enum \"${this.name}\" cannot represent non-enum value: ${valueStr}.` +\n didYouMeanEnumValue(this, valueStr),\n {\n nodes: valueNode,\n },\n );\n }\n\n const enumValue = this.getValue(valueNode.value);\n\n if (enumValue == null) {\n const valueStr = print(valueNode);\n throw new GraphQLError(\n `Value \"${valueStr}\" does not exist in \"${this.name}\" enum.` +\n didYouMeanEnumValue(this, valueStr),\n {\n nodes: valueNode,\n },\n );\n }\n\n return enumValue.value;\n }\n\n toConfig() {\n const values = keyValMap(\n this.getValues(),\n (value) => value.name,\n (value) => ({\n description: value.description,\n value: value.value,\n deprecationReason: value.deprecationReason,\n extensions: value.extensions,\n astNode: value.astNode,\n }),\n );\n return {\n name: this.name,\n description: this.description,\n values,\n extensions: this.extensions,\n astNode: this.astNode,\n extensionASTNodes: this.extensionASTNodes,\n };\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\nfunction didYouMeanEnumValue(enumType, unknownValueStr) {\n const allNames = enumType.getValues().map((value) => value.name);\n const suggestedValues = suggestionList(unknownValueStr, allNames);\n return didYouMean('the enum value', suggestedValues);\n}\n\nfunction defineEnumValues(typeName, valueMap) {\n isPlainObj(valueMap) ||\n devAssert(\n false,\n `${typeName} values must be an object with value names as keys.`,\n );\n return Object.entries(valueMap).map(([valueName, valueConfig]) => {\n isPlainObj(valueConfig) ||\n devAssert(\n false,\n `${typeName}.${valueName} must refer to an object with a \"value\" key ` +\n `representing an internal value but got: ${inspect(valueConfig)}.`,\n );\n return {\n name: assertEnumValueName(valueName),\n description: valueConfig.description,\n value: valueConfig.value !== undefined ? valueConfig.value : valueName,\n deprecationReason: valueConfig.deprecationReason,\n extensions: toObjMap(valueConfig.extensions),\n astNode: valueConfig.astNode,\n };\n });\n}\n\n/**\n * Input Object Type Definition\n *\n * An input object defines a structured collection of fields which may be\n * supplied to a field argument.\n *\n * Using `NonNull` will ensure that a value must be provided by the query\n *\n * Example:\n *\n * ```ts\n * const GeoPoint = new GraphQLInputObjectType({\n * name: 'GeoPoint',\n * fields: {\n * lat: { type: new GraphQLNonNull(GraphQLFloat) },\n * lon: { type: new GraphQLNonNull(GraphQLFloat) },\n * alt: { type: GraphQLFloat, defaultValue: 0 },\n * }\n * });\n * ```\n */\nexport class GraphQLInputObjectType {\n constructor(config) {\n var _config$extensionASTN6;\n\n this.name = assertName(config.name);\n this.description = config.description;\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n this.extensionASTNodes =\n (_config$extensionASTN6 = config.extensionASTNodes) !== null &&\n _config$extensionASTN6 !== void 0\n ? _config$extensionASTN6\n : [];\n this._fields = defineInputFieldMap.bind(undefined, config);\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLInputObjectType';\n }\n\n getFields() {\n if (typeof this._fields === 'function') {\n this._fields = this._fields();\n }\n\n return this._fields;\n }\n\n toConfig() {\n const fields = mapValue(this.getFields(), (field) => ({\n description: field.description,\n type: field.type,\n defaultValue: field.defaultValue,\n deprecationReason: field.deprecationReason,\n extensions: field.extensions,\n astNode: field.astNode,\n }));\n return {\n name: this.name,\n description: this.description,\n fields,\n extensions: this.extensions,\n astNode: this.astNode,\n extensionASTNodes: this.extensionASTNodes,\n };\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\nfunction defineInputFieldMap(config) {\n const fieldMap = resolveObjMapThunk(config.fields);\n isPlainObj(fieldMap) ||\n devAssert(\n false,\n `${config.name} fields must be an object with field names as keys or a function which returns such an object.`,\n );\n return mapValue(fieldMap, (fieldConfig, fieldName) => {\n !('resolve' in fieldConfig) ||\n devAssert(\n false,\n `${config.name}.${fieldName} field has a resolve property, but Input Types cannot define resolvers.`,\n );\n return {\n name: assertName(fieldName),\n description: fieldConfig.description,\n type: fieldConfig.type,\n defaultValue: fieldConfig.defaultValue,\n deprecationReason: fieldConfig.deprecationReason,\n extensions: toObjMap(fieldConfig.extensions),\n astNode: fieldConfig.astNode,\n };\n });\n}\n\nexport function isRequiredInputField(field) {\n return isNonNullType(field.type) && field.defaultValue === undefined;\n}\n", "import {\n isAbstractType,\n isInterfaceType,\n isListType,\n isNonNullType,\n isObjectType,\n} from '../type/definition.mjs';\n\n/**\n * Provided two types, return true if the types are equal (invariant).\n */\nexport function isEqualType(typeA, typeB) {\n // Equivalent types are equal.\n if (typeA === typeB) {\n return true;\n } // If either type is non-null, the other must also be non-null.\n\n if (isNonNullType(typeA) && isNonNullType(typeB)) {\n return isEqualType(typeA.ofType, typeB.ofType);\n } // If either type is a list, the other must also be a list.\n\n if (isListType(typeA) && isListType(typeB)) {\n return isEqualType(typeA.ofType, typeB.ofType);\n } // Otherwise the types are not equal.\n\n return false;\n}\n/**\n * Provided a type and a super type, return true if the first type is either\n * equal or a subset of the second super type (covariant).\n */\n\nexport function isTypeSubTypeOf(schema, maybeSubType, superType) {\n // Equivalent type is a valid subtype\n if (maybeSubType === superType) {\n return true;\n } // If superType is non-null, maybeSubType must also be non-null.\n\n if (isNonNullType(superType)) {\n if (isNonNullType(maybeSubType)) {\n return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType);\n }\n\n return false;\n }\n\n if (isNonNullType(maybeSubType)) {\n // If superType is nullable, maybeSubType may be non-null or nullable.\n return isTypeSubTypeOf(schema, maybeSubType.ofType, superType);\n } // If superType type is a list, maybeSubType type must also be a list.\n\n if (isListType(superType)) {\n if (isListType(maybeSubType)) {\n return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType);\n }\n\n return false;\n }\n\n if (isListType(maybeSubType)) {\n // If superType is not a list, maybeSubType must also be not a list.\n return false;\n } // If superType type is an abstract type, check if it is super type of maybeSubType.\n // Otherwise, the child type is not a valid subtype of the parent type.\n\n return (\n isAbstractType(superType) &&\n (isInterfaceType(maybeSubType) || isObjectType(maybeSubType)) &&\n schema.isSubType(superType, maybeSubType)\n );\n}\n/**\n * Provided two composite types, determine if they \"overlap\". Two composite\n * types overlap when the Sets of possible concrete types for each intersect.\n *\n * This is often used to determine if a fragment of a given type could possibly\n * be visited in a context of another type.\n *\n * This function is commutative.\n */\n\nexport function doTypesOverlap(schema, typeA, typeB) {\n // Equivalent types overlap\n if (typeA === typeB) {\n return true;\n }\n\n if (isAbstractType(typeA)) {\n if (isAbstractType(typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema\n .getPossibleTypes(typeA)\n .some((type) => schema.isSubType(typeB, type));\n } // Determine if the latter type is a possible concrete type of the former.\n\n return schema.isSubType(typeA, typeB);\n }\n\n if (isAbstractType(typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isSubType(typeB, typeA);\n } // Otherwise the types do not overlap.\n\n return false;\n}\n", "import { inspect } from '../jsutils/inspect.mjs';\nimport { isObjectLike } from '../jsutils/isObjectLike.mjs';\nimport { GraphQLError } from '../error/GraphQLError.mjs';\nimport { Kind } from '../language/kinds.mjs';\nimport { print } from '../language/printer.mjs';\nimport { GraphQLScalarType } from './definition.mjs';\n/**\n * Maximum possible Int value as per GraphQL Spec (32-bit signed integer).\n * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe up-to 2^53 - 1\n * */\n\nexport const GRAPHQL_MAX_INT = 2147483647;\n/**\n * Minimum possible Int value as per GraphQL Spec (32-bit signed integer).\n * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe starting at -(2^53 - 1)\n * */\n\nexport const GRAPHQL_MIN_INT = -2147483648;\nexport const GraphQLInt = new GraphQLScalarType({\n name: 'Int',\n description:\n 'The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.',\n\n serialize(outputValue) {\n const coercedValue = serializeObject(outputValue);\n\n if (typeof coercedValue === 'boolean') {\n return coercedValue ? 1 : 0;\n }\n\n let num = coercedValue;\n\n if (typeof coercedValue === 'string' && coercedValue !== '') {\n num = Number(coercedValue);\n }\n\n if (typeof num !== 'number' || !Number.isInteger(num)) {\n throw new GraphQLError(\n `Int cannot represent non-integer value: ${inspect(coercedValue)}`,\n );\n }\n\n if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) {\n throw new GraphQLError(\n 'Int cannot represent non 32-bit signed integer value: ' +\n inspect(coercedValue),\n );\n }\n\n return num;\n },\n\n parseValue(inputValue) {\n if (typeof inputValue !== 'number' || !Number.isInteger(inputValue)) {\n throw new GraphQLError(\n `Int cannot represent non-integer value: ${inspect(inputValue)}`,\n );\n }\n\n if (inputValue > GRAPHQL_MAX_INT || inputValue < GRAPHQL_MIN_INT) {\n throw new GraphQLError(\n `Int cannot represent non 32-bit signed integer value: ${inputValue}`,\n );\n }\n\n return inputValue;\n },\n\n parseLiteral(valueNode) {\n if (valueNode.kind !== Kind.INT) {\n throw new GraphQLError(\n `Int cannot represent non-integer value: ${print(valueNode)}`,\n {\n nodes: valueNode,\n },\n );\n }\n\n const num = parseInt(valueNode.value, 10);\n\n if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) {\n throw new GraphQLError(\n `Int cannot represent non 32-bit signed integer value: ${valueNode.value}`,\n {\n nodes: valueNode,\n },\n );\n }\n\n return num;\n },\n});\nexport const GraphQLFloat = new GraphQLScalarType({\n name: 'Float',\n description:\n 'The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).',\n\n serialize(outputValue) {\n const coercedValue = serializeObject(outputValue);\n\n if (typeof coercedValue === 'boolean') {\n return coercedValue ? 1 : 0;\n }\n\n let num = coercedValue;\n\n if (typeof coercedValue === 'string' && coercedValue !== '') {\n num = Number(coercedValue);\n }\n\n if (typeof num !== 'number' || !Number.isFinite(num)) {\n throw new GraphQLError(\n `Float cannot represent non numeric value: ${inspect(coercedValue)}`,\n );\n }\n\n return num;\n },\n\n parseValue(inputValue) {\n if (typeof inputValue !== 'number' || !Number.isFinite(inputValue)) {\n throw new GraphQLError(\n `Float cannot represent non numeric value: ${inspect(inputValue)}`,\n );\n }\n\n return inputValue;\n },\n\n parseLiteral(valueNode) {\n if (valueNode.kind !== Kind.FLOAT && valueNode.kind !== Kind.INT) {\n throw new GraphQLError(\n `Float cannot represent non numeric value: ${print(valueNode)}`,\n valueNode,\n );\n }\n\n return parseFloat(valueNode.value);\n },\n});\nexport const GraphQLString = new GraphQLScalarType({\n name: 'String',\n description:\n 'The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.',\n\n serialize(outputValue) {\n const coercedValue = serializeObject(outputValue); // Serialize string, boolean and number values to a string, but do not\n // attempt to coerce object, function, symbol, or other types as strings.\n\n if (typeof coercedValue === 'string') {\n return coercedValue;\n }\n\n if (typeof coercedValue === 'boolean') {\n return coercedValue ? 'true' : 'false';\n }\n\n if (typeof coercedValue === 'number' && Number.isFinite(coercedValue)) {\n return coercedValue.toString();\n }\n\n throw new GraphQLError(\n `String cannot represent value: ${inspect(outputValue)}`,\n );\n },\n\n parseValue(inputValue) {\n if (typeof inputValue !== 'string') {\n throw new GraphQLError(\n `String cannot represent a non string value: ${inspect(inputValue)}`,\n );\n }\n\n return inputValue;\n },\n\n parseLiteral(valueNode) {\n if (valueNode.kind !== Kind.STRING) {\n throw new GraphQLError(\n `String cannot represent a non string value: ${print(valueNode)}`,\n {\n nodes: valueNode,\n },\n );\n }\n\n return valueNode.value;\n },\n});\nexport const GraphQLBoolean = new GraphQLScalarType({\n name: 'Boolean',\n description: 'The `Boolean` scalar type represents `true` or `false`.',\n\n serialize(outputValue) {\n const coercedValue = serializeObject(outputValue);\n\n if (typeof coercedValue === 'boolean') {\n return coercedValue;\n }\n\n if (Number.isFinite(coercedValue)) {\n return coercedValue !== 0;\n }\n\n throw new GraphQLError(\n `Boolean cannot represent a non boolean value: ${inspect(coercedValue)}`,\n );\n },\n\n parseValue(inputValue) {\n if (typeof inputValue !== 'boolean') {\n throw new GraphQLError(\n `Boolean cannot represent a non boolean value: ${inspect(inputValue)}`,\n );\n }\n\n return inputValue;\n },\n\n parseLiteral(valueNode) {\n if (valueNode.kind !== Kind.BOOLEAN) {\n throw new GraphQLError(\n `Boolean cannot represent a non boolean value: ${print(valueNode)}`,\n {\n nodes: valueNode,\n },\n );\n }\n\n return valueNode.value;\n },\n});\nexport const GraphQLID = new GraphQLScalarType({\n name: 'ID',\n description:\n 'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `\"4\"`) or integer (such as `4`) input value will be accepted as an ID.',\n\n serialize(outputValue) {\n const coercedValue = serializeObject(outputValue);\n\n if (typeof coercedValue === 'string') {\n return coercedValue;\n }\n\n if (Number.isInteger(coercedValue)) {\n return String(coercedValue);\n }\n\n throw new GraphQLError(\n `ID cannot represent value: ${inspect(outputValue)}`,\n );\n },\n\n parseValue(inputValue) {\n if (typeof inputValue === 'string') {\n return inputValue;\n }\n\n if (typeof inputValue === 'number' && Number.isInteger(inputValue)) {\n return inputValue.toString();\n }\n\n throw new GraphQLError(`ID cannot represent value: ${inspect(inputValue)}`);\n },\n\n parseLiteral(valueNode) {\n if (valueNode.kind !== Kind.STRING && valueNode.kind !== Kind.INT) {\n throw new GraphQLError(\n 'ID cannot represent a non-string and non-integer value: ' +\n print(valueNode),\n {\n nodes: valueNode,\n },\n );\n }\n\n return valueNode.value;\n },\n});\nexport const specifiedScalarTypes = Object.freeze([\n GraphQLString,\n GraphQLInt,\n GraphQLFloat,\n GraphQLBoolean,\n GraphQLID,\n]);\nexport function isSpecifiedScalarType(type) {\n return specifiedScalarTypes.some(({ name }) => type.name === name);\n} // Support serializing objects with custom valueOf() or toJSON() functions -\n// a common way to represent a complex value which can be represented as\n// a string (ex: MongoDB id objects).\n\nfunction serializeObject(outputValue) {\n if (isObjectLike(outputValue)) {\n if (typeof outputValue.valueOf === 'function') {\n const valueOfResult = outputValue.valueOf();\n\n if (!isObjectLike(valueOfResult)) {\n return valueOfResult;\n }\n }\n\n if (typeof outputValue.toJSON === 'function') {\n return outputValue.toJSON();\n }\n }\n\n return outputValue;\n}\n", "import { devAssert } from '../jsutils/devAssert.mjs';\nimport { inspect } from '../jsutils/inspect.mjs';\nimport { instanceOf } from '../jsutils/instanceOf.mjs';\nimport { isObjectLike } from '../jsutils/isObjectLike.mjs';\nimport { toObjMap } from '../jsutils/toObjMap.mjs';\nimport { DirectiveLocation } from '../language/directiveLocation.mjs';\nimport { assertName } from './assertName.mjs';\nimport {\n argsToArgsConfig,\n defineArguments,\n GraphQLNonNull,\n} from './definition.mjs';\nimport { GraphQLBoolean, GraphQLString } from './scalars.mjs';\n/**\n * Test if the given value is a GraphQL directive.\n */\n\nexport function isDirective(directive) {\n return instanceOf(directive, GraphQLDirective);\n}\nexport function assertDirective(directive) {\n if (!isDirective(directive)) {\n throw new Error(\n `Expected ${inspect(directive)} to be a GraphQL directive.`,\n );\n }\n\n return directive;\n}\n/**\n * Custom extensions\n *\n * @remarks\n * Use a unique identifier name for your extension, for example the name of\n * your library or project. Do not use a shortened identifier as this increases\n * the risk of conflicts. We recommend you add at most one extension field,\n * an object which can contain all the values you need.\n */\n\n/**\n * Directives are used by the GraphQL runtime as a way of modifying execution\n * behavior. Type system creators will usually not create these directly.\n */\nexport class GraphQLDirective {\n constructor(config) {\n var _config$isRepeatable, _config$args;\n\n this.name = assertName(config.name);\n this.description = config.description;\n this.locations = config.locations;\n this.isRepeatable =\n (_config$isRepeatable = config.isRepeatable) !== null &&\n _config$isRepeatable !== void 0\n ? _config$isRepeatable\n : false;\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n Array.isArray(config.locations) ||\n devAssert(false, `@${config.name} locations must be an Array.`);\n const args =\n (_config$args = config.args) !== null && _config$args !== void 0\n ? _config$args\n : {};\n (isObjectLike(args) && !Array.isArray(args)) ||\n devAssert(\n false,\n `@${config.name} args must be an object with argument names as keys.`,\n );\n this.args = defineArguments(args);\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLDirective';\n }\n\n toConfig() {\n return {\n name: this.name,\n description: this.description,\n locations: this.locations,\n args: argsToArgsConfig(this.args),\n isRepeatable: this.isRepeatable,\n extensions: this.extensions,\n astNode: this.astNode,\n };\n }\n\n toString() {\n return '@' + this.name;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\n/**\n * Used to conditionally include fields or fragments.\n */\nexport const GraphQLIncludeDirective = new GraphQLDirective({\n name: 'include',\n description:\n 'Directs the executor to include this field or fragment only when the `if` argument is true.',\n locations: [\n DirectiveLocation.FIELD,\n DirectiveLocation.FRAGMENT_SPREAD,\n DirectiveLocation.INLINE_FRAGMENT,\n ],\n args: {\n if: {\n type: new GraphQLNonNull(GraphQLBoolean),\n description: 'Included when true.',\n },\n },\n});\n/**\n * Used to conditionally skip (exclude) fields or fragments.\n */\n\nexport const GraphQLSkipDirective = new GraphQLDirective({\n name: 'skip',\n description:\n 'Directs the executor to skip this field or fragment when the `if` argument is true.',\n locations: [\n DirectiveLocation.FIELD,\n DirectiveLocation.FRAGMENT_SPREAD,\n DirectiveLocation.INLINE_FRAGMENT,\n ],\n args: {\n if: {\n type: new GraphQLNonNull(GraphQLBoolean),\n description: 'Skipped when true.',\n },\n },\n});\n/**\n * Constant string used for default reason for a deprecation.\n */\n\nexport const DEFAULT_DEPRECATION_REASON = 'No longer supported';\n/**\n * Used to declare element of a GraphQL schema as deprecated.\n */\n\nexport const GraphQLDeprecatedDirective = new GraphQLDirective({\n name: 'deprecated',\n description: 'Marks an element of a GraphQL schema as no longer supported.',\n locations: [\n DirectiveLocation.FIELD_DEFINITION,\n DirectiveLocation.ARGUMENT_DEFINITION,\n DirectiveLocation.INPUT_FIELD_DEFINITION,\n DirectiveLocation.ENUM_VALUE,\n ],\n args: {\n reason: {\n type: GraphQLString,\n description:\n 'Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).',\n defaultValue: DEFAULT_DEPRECATION_REASON,\n },\n },\n});\n/**\n * Used to provide a URL for specifying the behavior of custom scalar definitions.\n */\n\nexport const GraphQLSpecifiedByDirective = new GraphQLDirective({\n name: 'specifiedBy',\n description: 'Exposes a URL that specifies the behavior of this scalar.',\n locations: [DirectiveLocation.SCALAR],\n args: {\n url: {\n type: new GraphQLNonNull(GraphQLString),\n description: 'The URL that specifies the behavior of this scalar.',\n },\n },\n});\n/**\n * The full list of specified directives.\n */\n\nexport const specifiedDirectives = Object.freeze([\n GraphQLIncludeDirective,\n GraphQLSkipDirective,\n GraphQLDeprecatedDirective,\n GraphQLSpecifiedByDirective,\n]);\nexport function isSpecifiedDirective(directive) {\n return specifiedDirectives.some(({ name }) => name === directive.name);\n}\n", "/**\n * Returns true if the provided object is an Object (i.e. not a string literal)\n * and implements the Iterator protocol.\n *\n * This may be used in place of [Array.isArray()][isArray] to determine if\n * an object should be iterated-over e.g. Array, Map, Set, Int8Array,\n * TypedArray, etc. but excludes string literals.\n *\n * @example\n * ```ts\n * isIterableObject([ 1, 2, 3 ]) // true\n * isIterableObject(new Map()) // true\n * isIterableObject('ABC') // false\n * isIterableObject({ key: 'value' }) // false\n * isIterableObject({ length: 1, 0: 'Alpha' }) // false\n * ```\n */\nexport function isIterableObject(maybeIterable) {\n return (\n typeof maybeIterable === 'object' &&\n typeof (maybeIterable === null || maybeIterable === void 0\n ? void 0\n : maybeIterable[Symbol.iterator]) === 'function'\n );\n}\n", "import { inspect } from '../jsutils/inspect.mjs';\nimport { invariant } from '../jsutils/invariant.mjs';\nimport { isIterableObject } from '../jsutils/isIterableObject.mjs';\nimport { isObjectLike } from '../jsutils/isObjectLike.mjs';\nimport { Kind } from '../language/kinds.mjs';\nimport {\n isEnumType,\n isInputObjectType,\n isLeafType,\n isListType,\n isNonNullType,\n} from '../type/definition.mjs';\nimport { GraphQLID } from '../type/scalars.mjs';\n/**\n * Produces a GraphQL Value AST given a JavaScript object.\n * Function will match JavaScript/JSON values to GraphQL AST schema format\n * by using suggested GraphQLInputType. For example:\n *\n * astFromValue(\"value\", GraphQLString)\n *\n * A GraphQL type must be provided, which will be used to interpret different\n * JavaScript values.\n *\n * | JSON Value | GraphQL Value |\n * | ------------- | -------------------- |\n * | Object | Input Object |\n * | Array | List |\n * | Boolean | Boolean |\n * | String | String / Enum Value |\n * | Number | Int / Float |\n * | Unknown | Enum Value |\n * | null | NullValue |\n *\n */\n\nexport function astFromValue(value, type) {\n if (isNonNullType(type)) {\n const astValue = astFromValue(value, type.ofType);\n\n if (\n (astValue === null || astValue === void 0 ? void 0 : astValue.kind) ===\n Kind.NULL\n ) {\n return null;\n }\n\n return astValue;\n } // only explicit null, not undefined, NaN\n\n if (value === null) {\n return {\n kind: Kind.NULL,\n };\n } // undefined\n\n if (value === undefined) {\n return null;\n } // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but\n // the value is not an array, convert the value using the list's item type.\n\n if (isListType(type)) {\n const itemType = type.ofType;\n\n if (isIterableObject(value)) {\n const valuesNodes = [];\n\n for (const item of value) {\n const itemNode = astFromValue(item, itemType);\n\n if (itemNode != null) {\n valuesNodes.push(itemNode);\n }\n }\n\n return {\n kind: Kind.LIST,\n values: valuesNodes,\n };\n }\n\n return astFromValue(value, itemType);\n } // Populate the fields of the input object by creating ASTs from each value\n // in the JavaScript object according to the fields in the input type.\n\n if (isInputObjectType(type)) {\n if (!isObjectLike(value)) {\n return null;\n }\n\n const fieldNodes = [];\n\n for (const field of Object.values(type.getFields())) {\n const fieldValue = astFromValue(value[field.name], field.type);\n\n if (fieldValue) {\n fieldNodes.push({\n kind: Kind.OBJECT_FIELD,\n name: {\n kind: Kind.NAME,\n value: field.name,\n },\n value: fieldValue,\n });\n }\n }\n\n return {\n kind: Kind.OBJECT,\n fields: fieldNodes,\n };\n }\n\n if (isLeafType(type)) {\n // Since value is an internally represented value, it must be serialized\n // to an externally represented value before converting into an AST.\n const serialized = type.serialize(value);\n\n if (serialized == null) {\n return null;\n } // Others serialize based on their corresponding JavaScript scalar types.\n\n if (typeof serialized === 'boolean') {\n return {\n kind: Kind.BOOLEAN,\n value: serialized,\n };\n } // JavaScript numbers can be Int or Float values.\n\n if (typeof serialized === 'number' && Number.isFinite(serialized)) {\n const stringNum = String(serialized);\n return integerStringRegExp.test(stringNum)\n ? {\n kind: Kind.INT,\n value: stringNum,\n }\n : {\n kind: Kind.FLOAT,\n value: stringNum,\n };\n }\n\n if (typeof serialized === 'string') {\n // Enum types use Enum literals.\n if (isEnumType(type)) {\n return {\n kind: Kind.ENUM,\n value: serialized,\n };\n } // ID types can use Int literals.\n\n if (type === GraphQLID && integerStringRegExp.test(serialized)) {\n return {\n kind: Kind.INT,\n value: serialized,\n };\n }\n\n return {\n kind: Kind.STRING,\n value: serialized,\n };\n }\n\n throw new TypeError(`Cannot convert value to AST: ${inspect(serialized)}.`);\n }\n /* c8 ignore next 3 */\n // Not reachable, all possible types have been considered.\n\n false || invariant(false, 'Unexpected input type: ' + inspect(type));\n}\n/**\n * IntValue:\n * - NegativeSign? 0\n * - NegativeSign? NonZeroDigit ( Digit+ )?\n */\n\nconst integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/;\n", "import { inspect } from '../jsutils/inspect.mjs';\nimport { invariant } from '../jsutils/invariant.mjs';\nimport { DirectiveLocation } from '../language/directiveLocation.mjs';\nimport { print } from '../language/printer.mjs';\nimport { astFromValue } from '../utilities/astFromValue.mjs';\nimport {\n GraphQLEnumType,\n GraphQLList,\n GraphQLNonNull,\n GraphQLObjectType,\n isAbstractType,\n isEnumType,\n isInputObjectType,\n isInterfaceType,\n isListType,\n isNonNullType,\n isObjectType,\n isScalarType,\n isUnionType,\n} from './definition.mjs';\nimport { GraphQLBoolean, GraphQLString } from './scalars.mjs';\nexport const __Schema = new GraphQLObjectType({\n name: '__Schema',\n description:\n 'A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.',\n fields: () => ({\n description: {\n type: GraphQLString,\n resolve: (schema) => schema.description,\n },\n types: {\n description: 'A list of all types supported by this server.',\n type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__Type))),\n\n resolve(schema) {\n return Object.values(schema.getTypeMap());\n },\n },\n queryType: {\n description: 'The type that query operations will be rooted at.',\n type: new GraphQLNonNull(__Type),\n resolve: (schema) => schema.getQueryType(),\n },\n mutationType: {\n description:\n 'If this server supports mutation, the type that mutation operations will be rooted at.',\n type: __Type,\n resolve: (schema) => schema.getMutationType(),\n },\n subscriptionType: {\n description:\n 'If this server support subscription, the type that subscription operations will be rooted at.',\n type: __Type,\n resolve: (schema) => schema.getSubscriptionType(),\n },\n directives: {\n description: 'A list of all directives supported by this server.',\n type: new GraphQLNonNull(\n new GraphQLList(new GraphQLNonNull(__Directive)),\n ),\n resolve: (schema) => schema.getDirectives(),\n },\n }),\n});\nexport const __Directive = new GraphQLObjectType({\n name: '__Directive',\n description:\n \"A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\\n\\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.\",\n fields: () => ({\n name: {\n type: new GraphQLNonNull(GraphQLString),\n resolve: (directive) => directive.name,\n },\n description: {\n type: GraphQLString,\n resolve: (directive) => directive.description,\n },\n isRepeatable: {\n type: new GraphQLNonNull(GraphQLBoolean),\n resolve: (directive) => directive.isRepeatable,\n },\n locations: {\n type: new GraphQLNonNull(\n new GraphQLList(new GraphQLNonNull(__DirectiveLocation)),\n ),\n resolve: (directive) => directive.locations,\n },\n args: {\n type: new GraphQLNonNull(\n new GraphQLList(new GraphQLNonNull(__InputValue)),\n ),\n args: {\n includeDeprecated: {\n type: GraphQLBoolean,\n defaultValue: false,\n },\n },\n\n resolve(field, { includeDeprecated }) {\n return includeDeprecated\n ? field.args\n : field.args.filter((arg) => arg.deprecationReason == null);\n },\n },\n }),\n});\nexport const __DirectiveLocation = new GraphQLEnumType({\n name: '__DirectiveLocation',\n description:\n 'A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.',\n values: {\n QUERY: {\n value: DirectiveLocation.QUERY,\n description: 'Location adjacent to a query operation.',\n },\n MUTATION: {\n value: DirectiveLocation.MUTATION,\n description: 'Location adjacent to a mutation operation.',\n },\n SUBSCRIPTION: {\n value: DirectiveLocation.SUBSCRIPTION,\n description: 'Location adjacent to a subscription operation.',\n },\n FIELD: {\n value: DirectiveLocation.FIELD,\n description: 'Location adjacent to a field.',\n },\n FRAGMENT_DEFINITION: {\n value: DirectiveLocation.FRAGMENT_DEFINITION,\n description: 'Location adjacent to a fragment definition.',\n },\n FRAGMENT_SPREAD: {\n value: DirectiveLocation.FRAGMENT_SPREAD,\n description: 'Location adjacent to a fragment spread.',\n },\n INLINE_FRAGMENT: {\n value: DirectiveLocation.INLINE_FRAGMENT,\n description: 'Location adjacent to an inline fragment.',\n },\n VARIABLE_DEFINITION: {\n value: DirectiveLocation.VARIABLE_DEFINITION,\n description: 'Location adjacent to a variable definition.',\n },\n SCHEMA: {\n value: DirectiveLocation.SCHEMA,\n description: 'Location adjacent to a schema definition.',\n },\n SCALAR: {\n value: DirectiveLocation.SCALAR,\n description: 'Location adjacent to a scalar definition.',\n },\n OBJECT: {\n value: DirectiveLocation.OBJECT,\n description: 'Location adjacent to an object type definition.',\n },\n FIELD_DEFINITION: {\n value: DirectiveLocation.FIELD_DEFINITION,\n description: 'Location adjacent to a field definition.',\n },\n ARGUMENT_DEFINITION: {\n value: DirectiveLocation.ARGUMENT_DEFINITION,\n description: 'Location adjacent to an argument definition.',\n },\n INTERFACE: {\n value: DirectiveLocation.INTERFACE,\n description: 'Location adjacent to an interface definition.',\n },\n UNION: {\n value: DirectiveLocation.UNION,\n description: 'Location adjacent to a union definition.',\n },\n ENUM: {\n value: DirectiveLocation.ENUM,\n description: 'Location adjacent to an enum definition.',\n },\n ENUM_VALUE: {\n value: DirectiveLocation.ENUM_VALUE,\n description: 'Location adjacent to an enum value definition.',\n },\n INPUT_OBJECT: {\n value: DirectiveLocation.INPUT_OBJECT,\n description: 'Location adjacent to an input object type definition.',\n },\n INPUT_FIELD_DEFINITION: {\n value: DirectiveLocation.INPUT_FIELD_DEFINITION,\n description: 'Location adjacent to an input object field definition.',\n },\n },\n});\nexport const __Type = new GraphQLObjectType({\n name: '__Type',\n description:\n 'The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\\n\\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.',\n fields: () => ({\n kind: {\n type: new GraphQLNonNull(__TypeKind),\n\n resolve(type) {\n if (isScalarType(type)) {\n return TypeKind.SCALAR;\n }\n\n if (isObjectType(type)) {\n return TypeKind.OBJECT;\n }\n\n if (isInterfaceType(type)) {\n return TypeKind.INTERFACE;\n }\n\n if (isUnionType(type)) {\n return TypeKind.UNION;\n }\n\n if (isEnumType(type)) {\n return TypeKind.ENUM;\n }\n\n if (isInputObjectType(type)) {\n return TypeKind.INPUT_OBJECT;\n }\n\n if (isListType(type)) {\n return TypeKind.LIST;\n }\n\n if (isNonNullType(type)) {\n return TypeKind.NON_NULL;\n }\n /* c8 ignore next 3 */\n // Not reachable, all possible types have been considered)\n\n false || invariant(false, `Unexpected type: \"${inspect(type)}\".`);\n },\n },\n name: {\n type: GraphQLString,\n resolve: (type) => ('name' in type ? type.name : undefined),\n },\n description: {\n type: GraphQLString,\n resolve: (\n type, // FIXME: add test case\n ) =>\n /* c8 ignore next */\n 'description' in type ? type.description : undefined,\n },\n specifiedByURL: {\n type: GraphQLString,\n resolve: (obj) =>\n 'specifiedByURL' in obj ? obj.specifiedByURL : undefined,\n },\n fields: {\n type: new GraphQLList(new GraphQLNonNull(__Field)),\n args: {\n includeDeprecated: {\n type: GraphQLBoolean,\n defaultValue: false,\n },\n },\n\n resolve(type, { includeDeprecated }) {\n if (isObjectType(type) || isInterfaceType(type)) {\n const fields = Object.values(type.getFields());\n return includeDeprecated\n ? fields\n : fields.filter((field) => field.deprecationReason == null);\n }\n },\n },\n interfaces: {\n type: new GraphQLList(new GraphQLNonNull(__Type)),\n\n resolve(type) {\n if (isObjectType(type) || isInterfaceType(type)) {\n return type.getInterfaces();\n }\n },\n },\n possibleTypes: {\n type: new GraphQLList(new GraphQLNonNull(__Type)),\n\n resolve(type, _args, _context, { schema }) {\n if (isAbstractType(type)) {\n return schema.getPossibleTypes(type);\n }\n },\n },\n enumValues: {\n type: new GraphQLList(new GraphQLNonNull(__EnumValue)),\n args: {\n includeDeprecated: {\n type: GraphQLBoolean,\n defaultValue: false,\n },\n },\n\n resolve(type, { includeDeprecated }) {\n if (isEnumType(type)) {\n const values = type.getValues();\n return includeDeprecated\n ? values\n : values.filter((field) => field.deprecationReason == null);\n }\n },\n },\n inputFields: {\n type: new GraphQLList(new GraphQLNonNull(__InputValue)),\n args: {\n includeDeprecated: {\n type: GraphQLBoolean,\n defaultValue: false,\n },\n },\n\n resolve(type, { includeDeprecated }) {\n if (isInputObjectType(type)) {\n const values = Object.values(type.getFields());\n return includeDeprecated\n ? values\n : values.filter((field) => field.deprecationReason == null);\n }\n },\n },\n ofType: {\n type: __Type,\n resolve: (type) => ('ofType' in type ? type.ofType : undefined),\n },\n }),\n});\nexport const __Field = new GraphQLObjectType({\n name: '__Field',\n description:\n 'Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.',\n fields: () => ({\n name: {\n type: new GraphQLNonNull(GraphQLString),\n resolve: (field) => field.name,\n },\n description: {\n type: GraphQLString,\n resolve: (field) => field.description,\n },\n args: {\n type: new GraphQLNonNull(\n new GraphQLList(new GraphQLNonNull(__InputValue)),\n ),\n args: {\n includeDeprecated: {\n type: GraphQLBoolean,\n defaultValue: false,\n },\n },\n\n resolve(field, { includeDeprecated }) {\n return includeDeprecated\n ? field.args\n : field.args.filter((arg) => arg.deprecationReason == null);\n },\n },\n type: {\n type: new GraphQLNonNull(__Type),\n resolve: (field) => field.type,\n },\n isDeprecated: {\n type: new GraphQLNonNull(GraphQLBoolean),\n resolve: (field) => field.deprecationReason != null,\n },\n deprecationReason: {\n type: GraphQLString,\n resolve: (field) => field.deprecationReason,\n },\n }),\n});\nexport const __InputValue = new GraphQLObjectType({\n name: '__InputValue',\n description:\n 'Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.',\n fields: () => ({\n name: {\n type: new GraphQLNonNull(GraphQLString),\n resolve: (inputValue) => inputValue.name,\n },\n description: {\n type: GraphQLString,\n resolve: (inputValue) => inputValue.description,\n },\n type: {\n type: new GraphQLNonNull(__Type),\n resolve: (inputValue) => inputValue.type,\n },\n defaultValue: {\n type: GraphQLString,\n description:\n 'A GraphQL-formatted string representing the default value for this input value.',\n\n resolve(inputValue) {\n const { type, defaultValue } = inputValue;\n const valueAST = astFromValue(defaultValue, type);\n return valueAST ? print(valueAST) : null;\n },\n },\n isDeprecated: {\n type: new GraphQLNonNull(GraphQLBoolean),\n resolve: (field) => field.deprecationReason != null,\n },\n deprecationReason: {\n type: GraphQLString,\n resolve: (obj) => obj.deprecationReason,\n },\n }),\n});\nexport const __EnumValue = new GraphQLObjectType({\n name: '__EnumValue',\n description:\n 'One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.',\n fields: () => ({\n name: {\n type: new GraphQLNonNull(GraphQLString),\n resolve: (enumValue) => enumValue.name,\n },\n description: {\n type: GraphQLString,\n resolve: (enumValue) => enumValue.description,\n },\n isDeprecated: {\n type: new GraphQLNonNull(GraphQLBoolean),\n resolve: (enumValue) => enumValue.deprecationReason != null,\n },\n deprecationReason: {\n type: GraphQLString,\n resolve: (enumValue) => enumValue.deprecationReason,\n },\n }),\n});\nvar TypeKind;\n\n(function (TypeKind) {\n TypeKind['SCALAR'] = 'SCALAR';\n TypeKind['OBJECT'] = 'OBJECT';\n TypeKind['INTERFACE'] = 'INTERFACE';\n TypeKind['UNION'] = 'UNION';\n TypeKind['ENUM'] = 'ENUM';\n TypeKind['INPUT_OBJECT'] = 'INPUT_OBJECT';\n TypeKind['LIST'] = 'LIST';\n TypeKind['NON_NULL'] = 'NON_NULL';\n})(TypeKind || (TypeKind = {}));\n\nexport { TypeKind };\nexport const __TypeKind = new GraphQLEnumType({\n name: '__TypeKind',\n description: 'An enum describing what kind of type a given `__Type` is.',\n values: {\n SCALAR: {\n value: TypeKind.SCALAR,\n description: 'Indicates this type is a scalar.',\n },\n OBJECT: {\n value: TypeKind.OBJECT,\n description:\n 'Indicates this type is an object. `fields` and `interfaces` are valid fields.',\n },\n INTERFACE: {\n value: TypeKind.INTERFACE,\n description:\n 'Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields.',\n },\n UNION: {\n value: TypeKind.UNION,\n description:\n 'Indicates this type is a union. `possibleTypes` is a valid field.',\n },\n ENUM: {\n value: TypeKind.ENUM,\n description:\n 'Indicates this type is an enum. `enumValues` is a valid field.',\n },\n INPUT_OBJECT: {\n value: TypeKind.INPUT_OBJECT,\n description:\n 'Indicates this type is an input object. `inputFields` is a valid field.',\n },\n LIST: {\n value: TypeKind.LIST,\n description: 'Indicates this type is a list. `ofType` is a valid field.',\n },\n NON_NULL: {\n value: TypeKind.NON_NULL,\n description:\n 'Indicates this type is a non-null. `ofType` is a valid field.',\n },\n },\n});\n/**\n * Note that these are GraphQLField and not GraphQLFieldConfig,\n * so the format for args is different.\n */\n\nexport const SchemaMetaFieldDef = {\n name: '__schema',\n type: new GraphQLNonNull(__Schema),\n description: 'Access the current type schema of this server.',\n args: [],\n resolve: (_source, _args, _context, { schema }) => schema,\n deprecationReason: undefined,\n extensions: Object.create(null),\n astNode: undefined,\n};\nexport const TypeMetaFieldDef = {\n name: '__type',\n type: __Type,\n description: 'Request the type information of a single type.',\n args: [\n {\n name: 'name',\n description: undefined,\n type: new GraphQLNonNull(GraphQLString),\n defaultValue: undefined,\n deprecationReason: undefined,\n extensions: Object.create(null),\n astNode: undefined,\n },\n ],\n resolve: (_source, { name }, _context, { schema }) => schema.getType(name),\n deprecationReason: undefined,\n extensions: Object.create(null),\n astNode: undefined,\n};\nexport const TypeNameMetaFieldDef = {\n name: '__typename',\n type: new GraphQLNonNull(GraphQLString),\n description: 'The name of the current Object type at runtime.',\n args: [],\n resolve: (_source, _args, _context, { parentType }) => parentType.name,\n deprecationReason: undefined,\n extensions: Object.create(null),\n astNode: undefined,\n};\nexport const introspectionTypes = Object.freeze([\n __Schema,\n __Directive,\n __DirectiveLocation,\n __Type,\n __Field,\n __InputValue,\n __EnumValue,\n __TypeKind,\n]);\nexport function isIntrospectionType(type) {\n return introspectionTypes.some(({ name }) => type.name === name);\n}\n", "import { devAssert } from '../jsutils/devAssert.mjs';\nimport { inspect } from '../jsutils/inspect.mjs';\nimport { instanceOf } from '../jsutils/instanceOf.mjs';\nimport { isObjectLike } from '../jsutils/isObjectLike.mjs';\nimport { toObjMap } from '../jsutils/toObjMap.mjs';\nimport { OperationTypeNode } from '../language/ast.mjs';\nimport {\n getNamedType,\n isInputObjectType,\n isInterfaceType,\n isObjectType,\n isUnionType,\n} from './definition.mjs';\nimport { isDirective, specifiedDirectives } from './directives.mjs';\nimport { __Schema } from './introspection.mjs';\n/**\n * Test if the given value is a GraphQL schema.\n */\n\nexport function isSchema(schema) {\n return instanceOf(schema, GraphQLSchema);\n}\nexport function assertSchema(schema) {\n if (!isSchema(schema)) {\n throw new Error(`Expected ${inspect(schema)} to be a GraphQL schema.`);\n }\n\n return schema;\n}\n/**\n * Custom extensions\n *\n * @remarks\n * Use a unique identifier name for your extension, for example the name of\n * your library or project. Do not use a shortened identifier as this increases\n * the risk of conflicts. We recommend you add at most one extension field,\n * an object which can contain all the values you need.\n */\n\n/**\n * Schema Definition\n *\n * A Schema is created by supplying the root types of each type of operation,\n * query and mutation (optional). A schema definition is then supplied to the\n * validator and executor.\n *\n * Example:\n *\n * ```ts\n * const MyAppSchema = new GraphQLSchema({\n * query: MyAppQueryRootType,\n * mutation: MyAppMutationRootType,\n * })\n * ```\n *\n * Note: When the schema is constructed, by default only the types that are\n * reachable by traversing the root types are included, other types must be\n * explicitly referenced.\n *\n * Example:\n *\n * ```ts\n * const characterInterface = new GraphQLInterfaceType({\n * name: 'Character',\n * ...\n * });\n *\n * const humanType = new GraphQLObjectType({\n * name: 'Human',\n * interfaces: [characterInterface],\n * ...\n * });\n *\n * const droidType = new GraphQLObjectType({\n * name: 'Droid',\n * interfaces: [characterInterface],\n * ...\n * });\n *\n * const schema = new GraphQLSchema({\n * query: new GraphQLObjectType({\n * name: 'Query',\n * fields: {\n * hero: { type: characterInterface, ... },\n * }\n * }),\n * ...\n * // Since this schema references only the `Character` interface it's\n * // necessary to explicitly list the types that implement it if\n * // you want them to be included in the final schema.\n * types: [humanType, droidType],\n * })\n * ```\n *\n * Note: If an array of `directives` are provided to GraphQLSchema, that will be\n * the exact list of directives represented and allowed. If `directives` is not\n * provided then a default set of the specified directives (e.g. `@include` and\n * `@skip`) will be used. If you wish to provide *additional* directives to these\n * specified directives, you must explicitly declare them. Example:\n *\n * ```ts\n * const MyAppSchema = new GraphQLSchema({\n * ...\n * directives: specifiedDirectives.concat([ myCustomDirective ]),\n * })\n * ```\n */\nexport class GraphQLSchema {\n // Used as a cache for validateSchema().\n constructor(config) {\n var _config$extensionASTN, _config$directives;\n\n // If this schema was built from a source known to be valid, then it may be\n // marked with assumeValid to avoid an additional type system validation.\n this.__validationErrors = config.assumeValid === true ? [] : undefined; // Check for common mistakes during construction to produce early errors.\n\n isObjectLike(config) ||\n devAssert(false, 'Must provide configuration object.');\n !config.types ||\n Array.isArray(config.types) ||\n devAssert(\n false,\n `\"types\" must be Array if provided but got: ${inspect(config.types)}.`,\n );\n !config.directives ||\n Array.isArray(config.directives) ||\n devAssert(\n false,\n '\"directives\" must be Array if provided but got: ' +\n `${inspect(config.directives)}.`,\n );\n this.description = config.description;\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n this.extensionASTNodes =\n (_config$extensionASTN = config.extensionASTNodes) !== null &&\n _config$extensionASTN !== void 0\n ? _config$extensionASTN\n : [];\n this._queryType = config.query;\n this._mutationType = config.mutation;\n this._subscriptionType = config.subscription; // Provide specified directives (e.g. @include and @skip) by default.\n\n this._directives =\n (_config$directives = config.directives) !== null &&\n _config$directives !== void 0\n ? _config$directives\n : specifiedDirectives; // To preserve order of user-provided types, we add first to add them to\n // the set of \"collected\" types, so `collectReferencedTypes` ignore them.\n\n const allReferencedTypes = new Set(config.types);\n\n if (config.types != null) {\n for (const type of config.types) {\n // When we ready to process this type, we remove it from \"collected\" types\n // and then add it together with all dependent types in the correct position.\n allReferencedTypes.delete(type);\n collectReferencedTypes(type, allReferencedTypes);\n }\n }\n\n if (this._queryType != null) {\n collectReferencedTypes(this._queryType, allReferencedTypes);\n }\n\n if (this._mutationType != null) {\n collectReferencedTypes(this._mutationType, allReferencedTypes);\n }\n\n if (this._subscriptionType != null) {\n collectReferencedTypes(this._subscriptionType, allReferencedTypes);\n }\n\n for (const directive of this._directives) {\n // Directives are not validated until validateSchema() is called.\n if (isDirective(directive)) {\n for (const arg of directive.args) {\n collectReferencedTypes(arg.type, allReferencedTypes);\n }\n }\n }\n\n collectReferencedTypes(__Schema, allReferencedTypes); // Storing the resulting map for reference by the schema.\n\n this._typeMap = Object.create(null);\n this._subTypeMap = Object.create(null); // Keep track of all implementations by interface name.\n\n this._implementationsMap = Object.create(null);\n\n for (const namedType of allReferencedTypes) {\n if (namedType == null) {\n continue;\n }\n\n const typeName = namedType.name;\n typeName ||\n devAssert(\n false,\n 'One of the provided types for building the Schema is missing a name.',\n );\n\n if (this._typeMap[typeName] !== undefined) {\n throw new Error(\n `Schema must contain uniquely named types but contains multiple types named \"${typeName}\".`,\n );\n }\n\n this._typeMap[typeName] = namedType;\n\n if (isInterfaceType(namedType)) {\n // Store implementations by interface.\n for (const iface of namedType.getInterfaces()) {\n if (isInterfaceType(iface)) {\n let implementations = this._implementationsMap[iface.name];\n\n if (implementations === undefined) {\n implementations = this._implementationsMap[iface.name] = {\n objects: [],\n interfaces: [],\n };\n }\n\n implementations.interfaces.push(namedType);\n }\n }\n } else if (isObjectType(namedType)) {\n // Store implementations by objects.\n for (const iface of namedType.getInterfaces()) {\n if (isInterfaceType(iface)) {\n let implementations = this._implementationsMap[iface.name];\n\n if (implementations === undefined) {\n implementations = this._implementationsMap[iface.name] = {\n objects: [],\n interfaces: [],\n };\n }\n\n implementations.objects.push(namedType);\n }\n }\n }\n }\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLSchema';\n }\n\n getQueryType() {\n return this._queryType;\n }\n\n getMutationType() {\n return this._mutationType;\n }\n\n getSubscriptionType() {\n return this._subscriptionType;\n }\n\n getRootType(operation) {\n switch (operation) {\n case OperationTypeNode.QUERY:\n return this.getQueryType();\n\n case OperationTypeNode.MUTATION:\n return this.getMutationType();\n\n case OperationTypeNode.SUBSCRIPTION:\n return this.getSubscriptionType();\n }\n }\n\n getTypeMap() {\n return this._typeMap;\n }\n\n getType(name) {\n return this.getTypeMap()[name];\n }\n\n getPossibleTypes(abstractType) {\n return isUnionType(abstractType)\n ? abstractType.getTypes()\n : this.getImplementations(abstractType).objects;\n }\n\n getImplementations(interfaceType) {\n const implementations = this._implementationsMap[interfaceType.name];\n return implementations !== null && implementations !== void 0\n ? implementations\n : {\n objects: [],\n interfaces: [],\n };\n }\n\n isSubType(abstractType, maybeSubType) {\n let map = this._subTypeMap[abstractType.name];\n\n if (map === undefined) {\n map = Object.create(null);\n\n if (isUnionType(abstractType)) {\n for (const type of abstractType.getTypes()) {\n map[type.name] = true;\n }\n } else {\n const implementations = this.getImplementations(abstractType);\n\n for (const type of implementations.objects) {\n map[type.name] = true;\n }\n\n for (const type of implementations.interfaces) {\n map[type.name] = true;\n }\n }\n\n this._subTypeMap[abstractType.name] = map;\n }\n\n return map[maybeSubType.name] !== undefined;\n }\n\n getDirectives() {\n return this._directives;\n }\n\n getDirective(name) {\n return this.getDirectives().find((directive) => directive.name === name);\n }\n\n toConfig() {\n return {\n description: this.description,\n query: this.getQueryType(),\n mutation: this.getMutationType(),\n subscription: this.getSubscriptionType(),\n types: Object.values(this.getTypeMap()),\n directives: this.getDirectives(),\n extensions: this.extensions,\n astNode: this.astNode,\n extensionASTNodes: this.extensionASTNodes,\n assumeValid: this.__validationErrors !== undefined,\n };\n }\n}\n\nfunction collectReferencedTypes(type, typeSet) {\n const namedType = getNamedType(type);\n\n if (!typeSet.has(namedType)) {\n typeSet.add(namedType);\n\n if (isUnionType(namedType)) {\n for (const memberType of namedType.getTypes()) {\n collectReferencedTypes(memberType, typeSet);\n }\n } else if (isObjectType(namedType) || isInterfaceType(namedType)) {\n for (const interfaceType of namedType.getInterfaces()) {\n collectReferencedTypes(interfaceType, typeSet);\n }\n\n for (const field of Object.values(namedType.getFields())) {\n collectReferencedTypes(field.type, typeSet);\n\n for (const arg of field.args) {\n collectReferencedTypes(arg.type, typeSet);\n }\n }\n } else if (isInputObjectType(namedType)) {\n for (const field of Object.values(namedType.getFields())) {\n collectReferencedTypes(field.type, typeSet);\n }\n }\n }\n\n return typeSet;\n}\n", "import { inspect } from '../jsutils/inspect.mjs';\nimport { GraphQLError } from '../error/GraphQLError.mjs';\nimport { OperationTypeNode } from '../language/ast.mjs';\nimport { isEqualType, isTypeSubTypeOf } from '../utilities/typeComparators.mjs';\nimport {\n isEnumType,\n isInputObjectType,\n isInputType,\n isInterfaceType,\n isNamedType,\n isNonNullType,\n isObjectType,\n isOutputType,\n isRequiredArgument,\n isRequiredInputField,\n isUnionType,\n} from './definition.mjs';\nimport { GraphQLDeprecatedDirective, isDirective } from './directives.mjs';\nimport { isIntrospectionType } from './introspection.mjs';\nimport { assertSchema } from './schema.mjs';\n/**\n * Implements the \"Type Validation\" sub-sections of the specification's\n * \"Type System\" section.\n *\n * Validation runs synchronously, returning an array of encountered errors, or\n * an empty array if no errors were encountered and the Schema is valid.\n */\n\nexport function validateSchema(schema) {\n // First check to ensure the provided value is in fact a GraphQLSchema.\n assertSchema(schema); // If this Schema has already been validated, return the previous results.\n\n if (schema.__validationErrors) {\n return schema.__validationErrors;\n } // Validate the schema, producing a list of errors.\n\n const context = new SchemaValidationContext(schema);\n validateRootTypes(context);\n validateDirectives(context);\n validateTypes(context); // Persist the results of validation before returning to ensure validation\n // does not run multiple times for this schema.\n\n const errors = context.getErrors();\n schema.__validationErrors = errors;\n return errors;\n}\n/**\n * Utility function which asserts a schema is valid by throwing an error if\n * it is invalid.\n */\n\nexport function assertValidSchema(schema) {\n const errors = validateSchema(schema);\n\n if (errors.length !== 0) {\n throw new Error(errors.map((error) => error.message).join('\\n\\n'));\n }\n}\n\nclass SchemaValidationContext {\n constructor(schema) {\n this._errors = [];\n this.schema = schema;\n }\n\n reportError(message, nodes) {\n const _nodes = Array.isArray(nodes) ? nodes.filter(Boolean) : nodes;\n\n this._errors.push(\n new GraphQLError(message, {\n nodes: _nodes,\n }),\n );\n }\n\n getErrors() {\n return this._errors;\n }\n}\n\nfunction validateRootTypes(context) {\n const schema = context.schema;\n const queryType = schema.getQueryType();\n\n if (!queryType) {\n context.reportError('Query root type must be provided.', schema.astNode);\n } else if (!isObjectType(queryType)) {\n var _getOperationTypeNode;\n\n context.reportError(\n `Query root type must be Object type, it cannot be ${inspect(\n queryType,\n )}.`,\n (_getOperationTypeNode = getOperationTypeNode(\n schema,\n OperationTypeNode.QUERY,\n )) !== null && _getOperationTypeNode !== void 0\n ? _getOperationTypeNode\n : queryType.astNode,\n );\n }\n\n const mutationType = schema.getMutationType();\n\n if (mutationType && !isObjectType(mutationType)) {\n var _getOperationTypeNode2;\n\n context.reportError(\n 'Mutation root type must be Object type if provided, it cannot be ' +\n `${inspect(mutationType)}.`,\n (_getOperationTypeNode2 = getOperationTypeNode(\n schema,\n OperationTypeNode.MUTATION,\n )) !== null && _getOperationTypeNode2 !== void 0\n ? _getOperationTypeNode2\n : mutationType.astNode,\n );\n }\n\n const subscriptionType = schema.getSubscriptionType();\n\n if (subscriptionType && !isObjectType(subscriptionType)) {\n var _getOperationTypeNode3;\n\n context.reportError(\n 'Subscription root type must be Object type if provided, it cannot be ' +\n `${inspect(subscriptionType)}.`,\n (_getOperationTypeNode3 = getOperationTypeNode(\n schema,\n OperationTypeNode.SUBSCRIPTION,\n )) !== null && _getOperationTypeNode3 !== void 0\n ? _getOperationTypeNode3\n : subscriptionType.astNode,\n );\n }\n}\n\nfunction getOperationTypeNode(schema, operation) {\n var _flatMap$find;\n\n return (_flatMap$find = [schema.astNode, ...schema.extensionASTNodes]\n .flatMap(\n // FIXME: https://github.com/graphql/graphql-js/issues/2203\n (schemaNode) => {\n var _schemaNode$operation;\n\n return (\n /* c8 ignore next */\n (_schemaNode$operation =\n schemaNode === null || schemaNode === void 0\n ? void 0\n : schemaNode.operationTypes) !== null &&\n _schemaNode$operation !== void 0\n ? _schemaNode$operation\n : []\n );\n },\n )\n .find((operationNode) => operationNode.operation === operation)) === null ||\n _flatMap$find === void 0\n ? void 0\n : _flatMap$find.type;\n}\n\nfunction validateDirectives(context) {\n for (const directive of context.schema.getDirectives()) {\n // Ensure all directives are in fact GraphQL directives.\n if (!isDirective(directive)) {\n context.reportError(\n `Expected directive but got: ${inspect(directive)}.`,\n directive === null || directive === void 0 ? void 0 : directive.astNode,\n );\n continue;\n } // Ensure they are named correctly.\n\n validateName(context, directive); // TODO: Ensure proper locations.\n // Ensure the arguments are valid.\n\n for (const arg of directive.args) {\n // Ensure they are named correctly.\n validateName(context, arg); // Ensure the type is an input type.\n\n if (!isInputType(arg.type)) {\n context.reportError(\n `The type of @${directive.name}(${arg.name}:) must be Input Type ` +\n `but got: ${inspect(arg.type)}.`,\n arg.astNode,\n );\n }\n\n if (isRequiredArgument(arg) && arg.deprecationReason != null) {\n var _arg$astNode;\n\n context.reportError(\n `Required argument @${directive.name}(${arg.name}:) cannot be deprecated.`,\n [\n getDeprecatedDirectiveNode(arg.astNode),\n (_arg$astNode = arg.astNode) === null || _arg$astNode === void 0\n ? void 0\n : _arg$astNode.type,\n ],\n );\n }\n }\n }\n}\n\nfunction validateName(context, node) {\n // Ensure names are valid, however introspection types opt out.\n if (node.name.startsWith('__')) {\n context.reportError(\n `Name \"${node.name}\" must not begin with \"__\", which is reserved by GraphQL introspection.`,\n node.astNode,\n );\n }\n}\n\nfunction validateTypes(context) {\n const validateInputObjectCircularRefs =\n createInputObjectCircularRefsValidator(context);\n const typeMap = context.schema.getTypeMap();\n\n for (const type of Object.values(typeMap)) {\n // Ensure all provided types are in fact GraphQL type.\n if (!isNamedType(type)) {\n context.reportError(\n `Expected GraphQL named type but got: ${inspect(type)}.`,\n type.astNode,\n );\n continue;\n } // Ensure it is named correctly (excluding introspection types).\n\n if (!isIntrospectionType(type)) {\n validateName(context, type);\n }\n\n if (isObjectType(type)) {\n // Ensure fields are valid\n validateFields(context, type); // Ensure objects implement the interfaces they claim to.\n\n validateInterfaces(context, type);\n } else if (isInterfaceType(type)) {\n // Ensure fields are valid.\n validateFields(context, type); // Ensure interfaces implement the interfaces they claim to.\n\n validateInterfaces(context, type);\n } else if (isUnionType(type)) {\n // Ensure Unions include valid member types.\n validateUnionMembers(context, type);\n } else if (isEnumType(type)) {\n // Ensure Enums have valid values.\n validateEnumValues(context, type);\n } else if (isInputObjectType(type)) {\n // Ensure Input Object fields are valid.\n validateInputFields(context, type); // Ensure Input Objects do not contain non-nullable circular references\n\n validateInputObjectCircularRefs(type);\n }\n }\n}\n\nfunction validateFields(context, type) {\n const fields = Object.values(type.getFields()); // Objects and Interfaces both must define one or more fields.\n\n if (fields.length === 0) {\n context.reportError(`Type ${type.name} must define one or more fields.`, [\n type.astNode,\n ...type.extensionASTNodes,\n ]);\n }\n\n for (const field of fields) {\n // Ensure they are named correctly.\n validateName(context, field); // Ensure the type is an output type\n\n if (!isOutputType(field.type)) {\n var _field$astNode;\n\n context.reportError(\n `The type of ${type.name}.${field.name} must be Output Type ` +\n `but got: ${inspect(field.type)}.`,\n (_field$astNode = field.astNode) === null || _field$astNode === void 0\n ? void 0\n : _field$astNode.type,\n );\n } // Ensure the arguments are valid\n\n for (const arg of field.args) {\n const argName = arg.name; // Ensure they are named correctly.\n\n validateName(context, arg); // Ensure the type is an input type\n\n if (!isInputType(arg.type)) {\n var _arg$astNode2;\n\n context.reportError(\n `The type of ${type.name}.${field.name}(${argName}:) must be Input ` +\n `Type but got: ${inspect(arg.type)}.`,\n (_arg$astNode2 = arg.astNode) === null || _arg$astNode2 === void 0\n ? void 0\n : _arg$astNode2.type,\n );\n }\n\n if (isRequiredArgument(arg) && arg.deprecationReason != null) {\n var _arg$astNode3;\n\n context.reportError(\n `Required argument ${type.name}.${field.name}(${argName}:) cannot be deprecated.`,\n [\n getDeprecatedDirectiveNode(arg.astNode),\n (_arg$astNode3 = arg.astNode) === null || _arg$astNode3 === void 0\n ? void 0\n : _arg$astNode3.type,\n ],\n );\n }\n }\n }\n}\n\nfunction validateInterfaces(context, type) {\n const ifaceTypeNames = Object.create(null);\n\n for (const iface of type.getInterfaces()) {\n if (!isInterfaceType(iface)) {\n context.reportError(\n `Type ${inspect(type)} must only implement Interface types, ` +\n `it cannot implement ${inspect(iface)}.`,\n getAllImplementsInterfaceNodes(type, iface),\n );\n continue;\n }\n\n if (type === iface) {\n context.reportError(\n `Type ${type.name} cannot implement itself because it would create a circular reference.`,\n getAllImplementsInterfaceNodes(type, iface),\n );\n continue;\n }\n\n if (ifaceTypeNames[iface.name]) {\n context.reportError(\n `Type ${type.name} can only implement ${iface.name} once.`,\n getAllImplementsInterfaceNodes(type, iface),\n );\n continue;\n }\n\n ifaceTypeNames[iface.name] = true;\n validateTypeImplementsAncestors(context, type, iface);\n validateTypeImplementsInterface(context, type, iface);\n }\n}\n\nfunction validateTypeImplementsInterface(context, type, iface) {\n const typeFieldMap = type.getFields(); // Assert each interface field is implemented.\n\n for (const ifaceField of Object.values(iface.getFields())) {\n const fieldName = ifaceField.name;\n const typeField = typeFieldMap[fieldName]; // Assert interface field exists on type.\n\n if (!typeField) {\n context.reportError(\n `Interface field ${iface.name}.${fieldName} expected but ${type.name} does not provide it.`,\n [ifaceField.astNode, type.astNode, ...type.extensionASTNodes],\n );\n continue;\n } // Assert interface field type is satisfied by type field type, by being\n // a valid subtype. (covariant)\n\n if (!isTypeSubTypeOf(context.schema, typeField.type, ifaceField.type)) {\n var _ifaceField$astNode, _typeField$astNode;\n\n context.reportError(\n `Interface field ${iface.name}.${fieldName} expects type ` +\n `${inspect(ifaceField.type)} but ${type.name}.${fieldName} ` +\n `is type ${inspect(typeField.type)}.`,\n [\n (_ifaceField$astNode = ifaceField.astNode) === null ||\n _ifaceField$astNode === void 0\n ? void 0\n : _ifaceField$astNode.type,\n (_typeField$astNode = typeField.astNode) === null ||\n _typeField$astNode === void 0\n ? void 0\n : _typeField$astNode.type,\n ],\n );\n } // Assert each interface field arg is implemented.\n\n for (const ifaceArg of ifaceField.args) {\n const argName = ifaceArg.name;\n const typeArg = typeField.args.find((arg) => arg.name === argName); // Assert interface field arg exists on object field.\n\n if (!typeArg) {\n context.reportError(\n `Interface field argument ${iface.name}.${fieldName}(${argName}:) expected but ${type.name}.${fieldName} does not provide it.`,\n [ifaceArg.astNode, typeField.astNode],\n );\n continue;\n } // Assert interface field arg type matches object field arg type.\n // (invariant)\n // TODO: change to contravariant?\n\n if (!isEqualType(ifaceArg.type, typeArg.type)) {\n var _ifaceArg$astNode, _typeArg$astNode;\n\n context.reportError(\n `Interface field argument ${iface.name}.${fieldName}(${argName}:) ` +\n `expects type ${inspect(ifaceArg.type)} but ` +\n `${type.name}.${fieldName}(${argName}:) is type ` +\n `${inspect(typeArg.type)}.`,\n [\n (_ifaceArg$astNode = ifaceArg.astNode) === null ||\n _ifaceArg$astNode === void 0\n ? void 0\n : _ifaceArg$astNode.type,\n (_typeArg$astNode = typeArg.astNode) === null ||\n _typeArg$astNode === void 0\n ? void 0\n : _typeArg$astNode.type,\n ],\n );\n } // TODO: validate default values?\n } // Assert additional arguments must not be required.\n\n for (const typeArg of typeField.args) {\n const argName = typeArg.name;\n const ifaceArg = ifaceField.args.find((arg) => arg.name === argName);\n\n if (!ifaceArg && isRequiredArgument(typeArg)) {\n context.reportError(\n `Object field ${type.name}.${fieldName} includes required argument ${argName} that is missing from the Interface field ${iface.name}.${fieldName}.`,\n [typeArg.astNode, ifaceField.astNode],\n );\n }\n }\n }\n}\n\nfunction validateTypeImplementsAncestors(context, type, iface) {\n const ifaceInterfaces = type.getInterfaces();\n\n for (const transitive of iface.getInterfaces()) {\n if (!ifaceInterfaces.includes(transitive)) {\n context.reportError(\n transitive === type\n ? `Type ${type.name} cannot implement ${iface.name} because it would create a circular reference.`\n : `Type ${type.name} must implement ${transitive.name} because it is implemented by ${iface.name}.`,\n [\n ...getAllImplementsInterfaceNodes(iface, transitive),\n ...getAllImplementsInterfaceNodes(type, iface),\n ],\n );\n }\n }\n}\n\nfunction validateUnionMembers(context, union) {\n const memberTypes = union.getTypes();\n\n if (memberTypes.length === 0) {\n context.reportError(\n `Union type ${union.name} must define one or more member types.`,\n [union.astNode, ...union.extensionASTNodes],\n );\n }\n\n const includedTypeNames = Object.create(null);\n\n for (const memberType of memberTypes) {\n if (includedTypeNames[memberType.name]) {\n context.reportError(\n `Union type ${union.name} can only include type ${memberType.name} once.`,\n getUnionMemberTypeNodes(union, memberType.name),\n );\n continue;\n }\n\n includedTypeNames[memberType.name] = true;\n\n if (!isObjectType(memberType)) {\n context.reportError(\n `Union type ${union.name} can only include Object types, ` +\n `it cannot include ${inspect(memberType)}.`,\n getUnionMemberTypeNodes(union, String(memberType)),\n );\n }\n }\n}\n\nfunction validateEnumValues(context, enumType) {\n const enumValues = enumType.getValues();\n\n if (enumValues.length === 0) {\n context.reportError(\n `Enum type ${enumType.name} must define one or more values.`,\n [enumType.astNode, ...enumType.extensionASTNodes],\n );\n }\n\n for (const enumValue of enumValues) {\n // Ensure valid name.\n validateName(context, enumValue);\n }\n}\n\nfunction validateInputFields(context, inputObj) {\n const fields = Object.values(inputObj.getFields());\n\n if (fields.length === 0) {\n context.reportError(\n `Input Object type ${inputObj.name} must define one or more fields.`,\n [inputObj.astNode, ...inputObj.extensionASTNodes],\n );\n } // Ensure the arguments are valid\n\n for (const field of fields) {\n // Ensure they are named correctly.\n validateName(context, field); // Ensure the type is an input type\n\n if (!isInputType(field.type)) {\n var _field$astNode2;\n\n context.reportError(\n `The type of ${inputObj.name}.${field.name} must be Input Type ` +\n `but got: ${inspect(field.type)}.`,\n (_field$astNode2 = field.astNode) === null || _field$astNode2 === void 0\n ? void 0\n : _field$astNode2.type,\n );\n }\n\n if (isRequiredInputField(field) && field.deprecationReason != null) {\n var _field$astNode3;\n\n context.reportError(\n `Required input field ${inputObj.name}.${field.name} cannot be deprecated.`,\n [\n getDeprecatedDirectiveNode(field.astNode),\n (_field$astNode3 = field.astNode) === null ||\n _field$astNode3 === void 0\n ? void 0\n : _field$astNode3.type,\n ],\n );\n }\n }\n}\n\nfunction createInputObjectCircularRefsValidator(context) {\n // Modified copy of algorithm from 'src/validation/rules/NoFragmentCycles.js'.\n // Tracks already visited types to maintain O(N) and to ensure that cycles\n // are not redundantly reported.\n const visitedTypes = Object.create(null); // Array of types nodes used to produce meaningful errors\n\n const fieldPath = []; // Position in the type path\n\n const fieldPathIndexByTypeName = Object.create(null);\n return detectCycleRecursive; // This does a straight-forward DFS to find cycles.\n // It does not terminate when a cycle was found but continues to explore\n // the graph to find all possible cycles.\n\n function detectCycleRecursive(inputObj) {\n if (visitedTypes[inputObj.name]) {\n return;\n }\n\n visitedTypes[inputObj.name] = true;\n fieldPathIndexByTypeName[inputObj.name] = fieldPath.length;\n const fields = Object.values(inputObj.getFields());\n\n for (const field of fields) {\n if (isNonNullType(field.type) && isInputObjectType(field.type.ofType)) {\n const fieldType = field.type.ofType;\n const cycleIndex = fieldPathIndexByTypeName[fieldType.name];\n fieldPath.push(field);\n\n if (cycleIndex === undefined) {\n detectCycleRecursive(fieldType);\n } else {\n const cyclePath = fieldPath.slice(cycleIndex);\n const pathStr = cyclePath.map((fieldObj) => fieldObj.name).join('.');\n context.reportError(\n `Cannot reference Input Object \"${fieldType.name}\" within itself through a series of non-null fields: \"${pathStr}\".`,\n cyclePath.map((fieldObj) => fieldObj.astNode),\n );\n }\n\n fieldPath.pop();\n }\n }\n\n fieldPathIndexByTypeName[inputObj.name] = undefined;\n }\n}\n\nfunction getAllImplementsInterfaceNodes(type, iface) {\n const { astNode, extensionASTNodes } = type;\n const nodes =\n astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; // FIXME: https://github.com/graphql/graphql-js/issues/2203\n\n return nodes\n .flatMap((typeNode) => {\n var _typeNode$interfaces;\n\n return (\n /* c8 ignore next */\n (_typeNode$interfaces = typeNode.interfaces) !== null &&\n _typeNode$interfaces !== void 0\n ? _typeNode$interfaces\n : []\n );\n })\n .filter((ifaceNode) => ifaceNode.name.value === iface.name);\n}\n\nfunction getUnionMemberTypeNodes(union, typeName) {\n const { astNode, extensionASTNodes } = union;\n const nodes =\n astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; // FIXME: https://github.com/graphql/graphql-js/issues/2203\n\n return nodes\n .flatMap((unionNode) => {\n var _unionNode$types;\n\n return (\n /* c8 ignore next */\n (_unionNode$types = unionNode.types) !== null &&\n _unionNode$types !== void 0\n ? _unionNode$types\n : []\n );\n })\n .filter((typeNode) => typeNode.name.value === typeName);\n}\n\nfunction getDeprecatedDirectiveNode(definitionNode) {\n var _definitionNode$direc;\n\n return definitionNode === null || definitionNode === void 0\n ? void 0\n : (_definitionNode$direc = definitionNode.directives) === null ||\n _definitionNode$direc === void 0\n ? void 0\n : _definitionNode$direc.find(\n (node) => node.name.value === GraphQLDeprecatedDirective.name,\n );\n}\n", "import { Kind } from '../language/kinds.mjs';\nimport { GraphQLList, GraphQLNonNull } from '../type/definition.mjs';\nexport function typeFromAST(schema, typeNode) {\n switch (typeNode.kind) {\n case Kind.LIST_TYPE: {\n const innerType = typeFromAST(schema, typeNode.type);\n return innerType && new GraphQLList(innerType);\n }\n\n case Kind.NON_NULL_TYPE: {\n const innerType = typeFromAST(schema, typeNode.type);\n return innerType && new GraphQLNonNull(innerType);\n }\n\n case Kind.NAMED_TYPE:\n return schema.getType(typeNode.name.value);\n }\n}\n", "import { isNode } from '../language/ast.mjs';\nimport { Kind } from '../language/kinds.mjs';\nimport { getEnterLeaveForKind } from '../language/visitor.mjs';\nimport {\n getNamedType,\n getNullableType,\n isCompositeType,\n isEnumType,\n isInputObjectType,\n isInputType,\n isInterfaceType,\n isListType,\n isObjectType,\n isOutputType,\n} from '../type/definition.mjs';\nimport {\n SchemaMetaFieldDef,\n TypeMetaFieldDef,\n TypeNameMetaFieldDef,\n} from '../type/introspection.mjs';\nimport { typeFromAST } from './typeFromAST.mjs';\n/**\n * TypeInfo is a utility class which, given a GraphQL schema, can keep track\n * of the current field and type definitions at any point in a GraphQL document\n * AST during a recursive descent by calling `enter(node)` and `leave(node)`.\n */\n\nexport class TypeInfo {\n constructor(\n schema,\n /**\n * Initial type may be provided in rare cases to facilitate traversals\n * beginning somewhere other than documents.\n */\n initialType,\n /** @deprecated will be removed in 17.0.0 */\n getFieldDefFn,\n ) {\n this._schema = schema;\n this._typeStack = [];\n this._parentTypeStack = [];\n this._inputTypeStack = [];\n this._fieldDefStack = [];\n this._defaultValueStack = [];\n this._directive = null;\n this._argument = null;\n this._enumValue = null;\n this._getFieldDef =\n getFieldDefFn !== null && getFieldDefFn !== void 0\n ? getFieldDefFn\n : getFieldDef;\n\n if (initialType) {\n if (isInputType(initialType)) {\n this._inputTypeStack.push(initialType);\n }\n\n if (isCompositeType(initialType)) {\n this._parentTypeStack.push(initialType);\n }\n\n if (isOutputType(initialType)) {\n this._typeStack.push(initialType);\n }\n }\n }\n\n get [Symbol.toStringTag]() {\n return 'TypeInfo';\n }\n\n getType() {\n if (this._typeStack.length > 0) {\n return this._typeStack[this._typeStack.length - 1];\n }\n }\n\n getParentType() {\n if (this._parentTypeStack.length > 0) {\n return this._parentTypeStack[this._parentTypeStack.length - 1];\n }\n }\n\n getInputType() {\n if (this._inputTypeStack.length > 0) {\n return this._inputTypeStack[this._inputTypeStack.length - 1];\n }\n }\n\n getParentInputType() {\n if (this._inputTypeStack.length > 1) {\n return this._inputTypeStack[this._inputTypeStack.length - 2];\n }\n }\n\n getFieldDef() {\n if (this._fieldDefStack.length > 0) {\n return this._fieldDefStack[this._fieldDefStack.length - 1];\n }\n }\n\n getDefaultValue() {\n if (this._defaultValueStack.length > 0) {\n return this._defaultValueStack[this._defaultValueStack.length - 1];\n }\n }\n\n getDirective() {\n return this._directive;\n }\n\n getArgument() {\n return this._argument;\n }\n\n getEnumValue() {\n return this._enumValue;\n }\n\n enter(node) {\n const schema = this._schema; // Note: many of the types below are explicitly typed as \"unknown\" to drop\n // any assumptions of a valid schema to ensure runtime types are properly\n // checked before continuing since TypeInfo is used as part of validation\n // which occurs before guarantees of schema and document validity.\n\n switch (node.kind) {\n case Kind.SELECTION_SET: {\n const namedType = getNamedType(this.getType());\n\n this._parentTypeStack.push(\n isCompositeType(namedType) ? namedType : undefined,\n );\n\n break;\n }\n\n case Kind.FIELD: {\n const parentType = this.getParentType();\n let fieldDef;\n let fieldType;\n\n if (parentType) {\n fieldDef = this._getFieldDef(schema, parentType, node);\n\n if (fieldDef) {\n fieldType = fieldDef.type;\n }\n }\n\n this._fieldDefStack.push(fieldDef);\n\n this._typeStack.push(isOutputType(fieldType) ? fieldType : undefined);\n\n break;\n }\n\n case Kind.DIRECTIVE:\n this._directive = schema.getDirective(node.name.value);\n break;\n\n case Kind.OPERATION_DEFINITION: {\n const rootType = schema.getRootType(node.operation);\n\n this._typeStack.push(isObjectType(rootType) ? rootType : undefined);\n\n break;\n }\n\n case Kind.INLINE_FRAGMENT:\n case Kind.FRAGMENT_DEFINITION: {\n const typeConditionAST = node.typeCondition;\n const outputType = typeConditionAST\n ? typeFromAST(schema, typeConditionAST)\n : getNamedType(this.getType());\n\n this._typeStack.push(isOutputType(outputType) ? outputType : undefined);\n\n break;\n }\n\n case Kind.VARIABLE_DEFINITION: {\n const inputType = typeFromAST(schema, node.type);\n\n this._inputTypeStack.push(\n isInputType(inputType) ? inputType : undefined,\n );\n\n break;\n }\n\n case Kind.ARGUMENT: {\n var _this$getDirective;\n\n let argDef;\n let argType;\n const fieldOrDirective =\n (_this$getDirective = this.getDirective()) !== null &&\n _this$getDirective !== void 0\n ? _this$getDirective\n : this.getFieldDef();\n\n if (fieldOrDirective) {\n argDef = fieldOrDirective.args.find(\n (arg) => arg.name === node.name.value,\n );\n\n if (argDef) {\n argType = argDef.type;\n }\n }\n\n this._argument = argDef;\n\n this._defaultValueStack.push(argDef ? argDef.defaultValue : undefined);\n\n this._inputTypeStack.push(isInputType(argType) ? argType : undefined);\n\n break;\n }\n\n case Kind.LIST: {\n const listType = getNullableType(this.getInputType());\n const itemType = isListType(listType) ? listType.ofType : listType; // List positions never have a default value.\n\n this._defaultValueStack.push(undefined);\n\n this._inputTypeStack.push(isInputType(itemType) ? itemType : undefined);\n\n break;\n }\n\n case Kind.OBJECT_FIELD: {\n const objectType = getNamedType(this.getInputType());\n let inputFieldType;\n let inputField;\n\n if (isInputObjectType(objectType)) {\n inputField = objectType.getFields()[node.name.value];\n\n if (inputField) {\n inputFieldType = inputField.type;\n }\n }\n\n this._defaultValueStack.push(\n inputField ? inputField.defaultValue : undefined,\n );\n\n this._inputTypeStack.push(\n isInputType(inputFieldType) ? inputFieldType : undefined,\n );\n\n break;\n }\n\n case Kind.ENUM: {\n const enumType = getNamedType(this.getInputType());\n let enumValue;\n\n if (isEnumType(enumType)) {\n enumValue = enumType.getValue(node.value);\n }\n\n this._enumValue = enumValue;\n break;\n }\n\n default: // Ignore other nodes\n }\n }\n\n leave(node) {\n switch (node.kind) {\n case Kind.SELECTION_SET:\n this._parentTypeStack.pop();\n\n break;\n\n case Kind.FIELD:\n this._fieldDefStack.pop();\n\n this._typeStack.pop();\n\n break;\n\n case Kind.DIRECTIVE:\n this._directive = null;\n break;\n\n case Kind.OPERATION_DEFINITION:\n case Kind.INLINE_FRAGMENT:\n case Kind.FRAGMENT_DEFINITION:\n this._typeStack.pop();\n\n break;\n\n case Kind.VARIABLE_DEFINITION:\n this._inputTypeStack.pop();\n\n break;\n\n case Kind.ARGUMENT:\n this._argument = null;\n\n this._defaultValueStack.pop();\n\n this._inputTypeStack.pop();\n\n break;\n\n case Kind.LIST:\n case Kind.OBJECT_FIELD:\n this._defaultValueStack.pop();\n\n this._inputTypeStack.pop();\n\n break;\n\n case Kind.ENUM:\n this._enumValue = null;\n break;\n\n default: // Ignore other nodes\n }\n }\n}\n\n/**\n * Not exactly the same as the executor's definition of getFieldDef, in this\n * statically evaluated environment we do not always have an Object type,\n * and need to handle Interface and Union types.\n */\nfunction getFieldDef(schema, parentType, fieldNode) {\n const name = fieldNode.name.value;\n\n if (\n name === SchemaMetaFieldDef.name &&\n schema.getQueryType() === parentType\n ) {\n return SchemaMetaFieldDef;\n }\n\n if (name === TypeMetaFieldDef.name && schema.getQueryType() === parentType) {\n return TypeMetaFieldDef;\n }\n\n if (name === TypeNameMetaFieldDef.name && isCompositeType(parentType)) {\n return TypeNameMetaFieldDef;\n }\n\n if (isObjectType(parentType) || isInterfaceType(parentType)) {\n return parentType.getFields()[name];\n }\n}\n/**\n * Creates a new visitor instance which maintains a provided TypeInfo instance\n * along with visiting visitor.\n */\n\nexport function visitWithTypeInfo(typeInfo, visitor) {\n return {\n enter(...args) {\n const node = args[0];\n typeInfo.enter(node);\n const fn = getEnterLeaveForKind(visitor, node.kind).enter;\n\n if (fn) {\n const result = fn.apply(visitor, args);\n\n if (result !== undefined) {\n typeInfo.leave(node);\n\n if (isNode(result)) {\n typeInfo.enter(result);\n }\n }\n\n return result;\n }\n },\n\n leave(...args) {\n const node = args[0];\n const fn = getEnterLeaveForKind(visitor, node.kind).leave;\n let result;\n\n if (fn) {\n result = fn.apply(visitor, args);\n }\n\n typeInfo.leave(node);\n return result;\n },\n };\n}\n", "import { Kind } from './kinds.mjs';\nexport function isDefinitionNode(node) {\n return (\n isExecutableDefinitionNode(node) ||\n isTypeSystemDefinitionNode(node) ||\n isTypeSystemExtensionNode(node)\n );\n}\nexport function isExecutableDefinitionNode(node) {\n return (\n node.kind === Kind.OPERATION_DEFINITION ||\n node.kind === Kind.FRAGMENT_DEFINITION\n );\n}\nexport function isSelectionNode(node) {\n return (\n node.kind === Kind.FIELD ||\n node.kind === Kind.FRAGMENT_SPREAD ||\n node.kind === Kind.INLINE_FRAGMENT\n );\n}\nexport function isValueNode(node) {\n return (\n node.kind === Kind.VARIABLE ||\n node.kind === Kind.INT ||\n node.kind === Kind.FLOAT ||\n node.kind === Kind.STRING ||\n node.kind === Kind.BOOLEAN ||\n node.kind === Kind.NULL ||\n node.kind === Kind.ENUM ||\n node.kind === Kind.LIST ||\n node.kind === Kind.OBJECT\n );\n}\nexport function isConstValueNode(node) {\n return (\n isValueNode(node) &&\n (node.kind === Kind.LIST\n ? node.values.some(isConstValueNode)\n : node.kind === Kind.OBJECT\n ? node.fields.some((field) => isConstValueNode(field.value))\n : node.kind !== Kind.VARIABLE)\n );\n}\nexport function isTypeNode(node) {\n return (\n node.kind === Kind.NAMED_TYPE ||\n node.kind === Kind.LIST_TYPE ||\n node.kind === Kind.NON_NULL_TYPE\n );\n}\nexport function isTypeSystemDefinitionNode(node) {\n return (\n node.kind === Kind.SCHEMA_DEFINITION ||\n isTypeDefinitionNode(node) ||\n node.kind === Kind.DIRECTIVE_DEFINITION\n );\n}\nexport function isTypeDefinitionNode(node) {\n return (\n node.kind === Kind.SCALAR_TYPE_DEFINITION ||\n node.kind === Kind.OBJECT_TYPE_DEFINITION ||\n node.kind === Kind.INTERFACE_TYPE_DEFINITION ||\n node.kind === Kind.UNION_TYPE_DEFINITION ||\n node.kind === Kind.ENUM_TYPE_DEFINITION ||\n node.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION\n );\n}\nexport function isTypeSystemExtensionNode(node) {\n return node.kind === Kind.SCHEMA_EXTENSION || isTypeExtensionNode(node);\n}\nexport function isTypeExtensionNode(node) {\n return (\n node.kind === Kind.SCALAR_TYPE_EXTENSION ||\n node.kind === Kind.OBJECT_TYPE_EXTENSION ||\n node.kind === Kind.INTERFACE_TYPE_EXTENSION ||\n node.kind === Kind.UNION_TYPE_EXTENSION ||\n node.kind === Kind.ENUM_TYPE_EXTENSION ||\n node.kind === Kind.INPUT_OBJECT_TYPE_EXTENSION\n );\n}\n", "import { GraphQLError } from '../../error/GraphQLError.mjs';\nimport { Kind } from '../../language/kinds.mjs';\nimport { isExecutableDefinitionNode } from '../../language/predicates.mjs';\n\n/**\n * Executable definitions\n *\n * A GraphQL document is only valid for execution if all definitions are either\n * operation or fragment definitions.\n *\n * See https://spec.graphql.org/draft/#sec-Executable-Definitions\n */\nexport function ExecutableDefinitionsRule(context) {\n return {\n Document(node) {\n for (const definition of node.definitions) {\n if (!isExecutableDefinitionNode(definition)) {\n const defName =\n definition.kind === Kind.SCHEMA_DEFINITION ||\n definition.kind === Kind.SCHEMA_EXTENSION\n ? 'schema'\n : '\"' + definition.name.value + '\"';\n context.reportError(\n new GraphQLError(`The ${defName} definition is not executable.`, {\n nodes: definition,\n }),\n );\n }\n }\n\n return false;\n },\n };\n}\n", "import { didYouMean } from '../../jsutils/didYouMean.mjs';\nimport { naturalCompare } from '../../jsutils/naturalCompare.mjs';\nimport { suggestionList } from '../../jsutils/suggestionList.mjs';\nimport { GraphQLError } from '../../error/GraphQLError.mjs';\nimport {\n isAbstractType,\n isInterfaceType,\n isObjectType,\n} from '../../type/definition.mjs';\n\n/**\n * Fields on correct type\n *\n * A GraphQL document is only valid if all fields selected are defined by the\n * parent type, or are an allowed meta field such as __typename.\n *\n * See https://spec.graphql.org/draft/#sec-Field-Selections\n */\nexport function FieldsOnCorrectTypeRule(context) {\n return {\n Field(node) {\n const type = context.getParentType();\n\n if (type) {\n const fieldDef = context.getFieldDef();\n\n if (!fieldDef) {\n // This field doesn't exist, lets look for suggestions.\n const schema = context.getSchema();\n const fieldName = node.name.value; // First determine if there are any suggested types to condition on.\n\n let suggestion = didYouMean(\n 'to use an inline fragment on',\n getSuggestedTypeNames(schema, type, fieldName),\n ); // If there are no suggested types, then perhaps this was a typo?\n\n if (suggestion === '') {\n suggestion = didYouMean(getSuggestedFieldNames(type, fieldName));\n } // Report an error, including helpful suggestions.\n\n context.reportError(\n new GraphQLError(\n `Cannot query field \"${fieldName}\" on type \"${type.name}\".` +\n suggestion,\n {\n nodes: node,\n },\n ),\n );\n }\n }\n },\n };\n}\n/**\n * Go through all of the implementations of type, as well as the interfaces that\n * they implement. If any of those types include the provided field, suggest them,\n * sorted by how often the type is referenced.\n */\n\nfunction getSuggestedTypeNames(schema, type, fieldName) {\n if (!isAbstractType(type)) {\n // Must be an Object type, which does not have possible fields.\n return [];\n }\n\n const suggestedTypes = new Set();\n const usageCount = Object.create(null);\n\n for (const possibleType of schema.getPossibleTypes(type)) {\n if (!possibleType.getFields()[fieldName]) {\n continue;\n } // This object type defines this field.\n\n suggestedTypes.add(possibleType);\n usageCount[possibleType.name] = 1;\n\n for (const possibleInterface of possibleType.getInterfaces()) {\n var _usageCount$possibleI;\n\n if (!possibleInterface.getFields()[fieldName]) {\n continue;\n } // This interface type defines this field.\n\n suggestedTypes.add(possibleInterface);\n usageCount[possibleInterface.name] =\n ((_usageCount$possibleI = usageCount[possibleInterface.name]) !==\n null && _usageCount$possibleI !== void 0\n ? _usageCount$possibleI\n : 0) + 1;\n }\n }\n\n return [...suggestedTypes]\n .sort((typeA, typeB) => {\n // Suggest both interface and object types based on how common they are.\n const usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name];\n\n if (usageCountDiff !== 0) {\n return usageCountDiff;\n } // Suggest super types first followed by subtypes\n\n if (isInterfaceType(typeA) && schema.isSubType(typeA, typeB)) {\n return -1;\n }\n\n if (isInterfaceType(typeB) && schema.isSubType(typeB, typeA)) {\n return 1;\n }\n\n return naturalCompare(typeA.name, typeB.name);\n })\n .map((x) => x.name);\n}\n/**\n * For the field name provided, determine if there are any similar field names\n * that may be the result of a typo.\n */\n\nfunction getSuggestedFieldNames(type, fieldName) {\n if (isObjectType(type) || isInterfaceType(type)) {\n const possibleFieldNames = Object.keys(type.getFields());\n return suggestionList(fieldName, possibleFieldNames);\n } // Otherwise, must be a Union type, which does not define fields.\n\n return [];\n}\n", "import { GraphQLError } from '../../error/GraphQLError.mjs';\nimport { print } from '../../language/printer.mjs';\nimport { isCompositeType } from '../../type/definition.mjs';\nimport { typeFromAST } from '../../utilities/typeFromAST.mjs';\n\n/**\n * Fragments on composite type\n *\n * Fragments use a type condition to determine if they apply, since fragments\n * can only be spread into a composite type (object, interface, or union), the\n * type condition must also be a composite type.\n *\n * See https://spec.graphql.org/draft/#sec-Fragments-On-Composite-Types\n */\nexport function FragmentsOnCompositeTypesRule(context) {\n return {\n InlineFragment(node) {\n const typeCondition = node.typeCondition;\n\n if (typeCondition) {\n const type = typeFromAST(context.getSchema(), typeCondition);\n\n if (type && !isCompositeType(type)) {\n const typeStr = print(typeCondition);\n context.reportError(\n new GraphQLError(\n `Fragment cannot condition on non composite type \"${typeStr}\".`,\n {\n nodes: typeCondition,\n },\n ),\n );\n }\n }\n },\n\n FragmentDefinition(node) {\n const type = typeFromAST(context.getSchema(), node.typeCondition);\n\n if (type && !isCompositeType(type)) {\n const typeStr = print(node.typeCondition);\n context.reportError(\n new GraphQLError(\n `Fragment \"${node.name.value}\" cannot condition on non composite type \"${typeStr}\".`,\n {\n nodes: node.typeCondition,\n },\n ),\n );\n }\n },\n };\n}\n", "import { didYouMean } from '../../jsutils/didYouMean.mjs';\nimport { suggestionList } from '../../jsutils/suggestionList.mjs';\nimport { GraphQLError } from '../../error/GraphQLError.mjs';\nimport { Kind } from '../../language/kinds.mjs';\nimport { specifiedDirectives } from '../../type/directives.mjs';\n\n/**\n * Known argument names\n *\n * A GraphQL field is only valid if all supplied arguments are defined by\n * that field.\n *\n * See https://spec.graphql.org/draft/#sec-Argument-Names\n * See https://spec.graphql.org/draft/#sec-Directives-Are-In-Valid-Locations\n */\nexport function KnownArgumentNamesRule(context) {\n return {\n // eslint-disable-next-line new-cap\n ...KnownArgumentNamesOnDirectivesRule(context),\n\n Argument(argNode) {\n const argDef = context.getArgument();\n const fieldDef = context.getFieldDef();\n const parentType = context.getParentType();\n\n if (!argDef && fieldDef && parentType) {\n const argName = argNode.name.value;\n const knownArgsNames = fieldDef.args.map((arg) => arg.name);\n const suggestions = suggestionList(argName, knownArgsNames);\n context.reportError(\n new GraphQLError(\n `Unknown argument \"${argName}\" on field \"${parentType.name}.${fieldDef.name}\".` +\n didYouMean(suggestions),\n {\n nodes: argNode,\n },\n ),\n );\n }\n },\n };\n}\n/**\n * @internal\n */\n\nexport function KnownArgumentNamesOnDirectivesRule(context) {\n const directiveArgs = Object.create(null);\n const schema = context.getSchema();\n const definedDirectives = schema\n ? schema.getDirectives()\n : specifiedDirectives;\n\n for (const directive of definedDirectives) {\n directiveArgs[directive.name] = directive.args.map((arg) => arg.name);\n }\n\n const astDefinitions = context.getDocument().definitions;\n\n for (const def of astDefinitions) {\n if (def.kind === Kind.DIRECTIVE_DEFINITION) {\n var _def$arguments;\n\n // FIXME: https://github.com/graphql/graphql-js/issues/2203\n\n /* c8 ignore next */\n const argsNodes =\n (_def$arguments = def.arguments) !== null && _def$arguments !== void 0\n ? _def$arguments\n : [];\n directiveArgs[def.name.value] = argsNodes.map((arg) => arg.name.value);\n }\n }\n\n return {\n Directive(directiveNode) {\n const directiveName = directiveNode.name.value;\n const knownArgs = directiveArgs[directiveName];\n\n if (directiveNode.arguments && knownArgs) {\n for (const argNode of directiveNode.arguments) {\n const argName = argNode.name.value;\n\n if (!knownArgs.includes(argName)) {\n const suggestions = suggestionList(argName, knownArgs);\n context.reportError(\n new GraphQLError(\n `Unknown argument \"${argName}\" on directive \"@${directiveName}\".` +\n didYouMean(suggestions),\n {\n nodes: argNode,\n },\n ),\n );\n }\n }\n }\n\n return false;\n },\n };\n}\n", "import { inspect } from '../../jsutils/inspect.mjs';\nimport { invariant } from '../../jsutils/invariant.mjs';\nimport { GraphQLError } from '../../error/GraphQLError.mjs';\nimport { OperationTypeNode } from '../../language/ast.mjs';\nimport { DirectiveLocation } from '../../language/directiveLocation.mjs';\nimport { Kind } from '../../language/kinds.mjs';\nimport { specifiedDirectives } from '../../type/directives.mjs';\n\n/**\n * Known directives\n *\n * A GraphQL document is only valid if all `@directives` are known by the\n * schema and legally positioned.\n *\n * See https://spec.graphql.org/draft/#sec-Directives-Are-Defined\n */\nexport function KnownDirectivesRule(context) {\n const locationsMap = Object.create(null);\n const schema = context.getSchema();\n const definedDirectives = schema\n ? schema.getDirectives()\n : specifiedDirectives;\n\n for (const directive of definedDirectives) {\n locationsMap[directive.name] = directive.locations;\n }\n\n const astDefinitions = context.getDocument().definitions;\n\n for (const def of astDefinitions) {\n if (def.kind === Kind.DIRECTIVE_DEFINITION) {\n locationsMap[def.name.value] = def.locations.map((name) => name.value);\n }\n }\n\n return {\n Directive(node, _key, _parent, _path, ancestors) {\n const name = node.name.value;\n const locations = locationsMap[name];\n\n if (!locations) {\n context.reportError(\n new GraphQLError(`Unknown directive \"@${name}\".`, {\n nodes: node,\n }),\n );\n return;\n }\n\n const candidateLocation = getDirectiveLocationForASTPath(ancestors);\n\n if (candidateLocation && !locations.includes(candidateLocation)) {\n context.reportError(\n new GraphQLError(\n `Directive \"@${name}\" may not be used on ${candidateLocation}.`,\n {\n nodes: node,\n },\n ),\n );\n }\n },\n };\n}\n\nfunction getDirectiveLocationForASTPath(ancestors) {\n const appliedTo = ancestors[ancestors.length - 1];\n 'kind' in appliedTo || invariant(false);\n\n switch (appliedTo.kind) {\n case Kind.OPERATION_DEFINITION:\n return getDirectiveLocationForOperation(appliedTo.operation);\n\n case Kind.FIELD:\n return DirectiveLocation.FIELD;\n\n case Kind.FRAGMENT_SPREAD:\n return DirectiveLocation.FRAGMENT_SPREAD;\n\n case Kind.INLINE_FRAGMENT:\n return DirectiveLocation.INLINE_FRAGMENT;\n\n case Kind.FRAGMENT_DEFINITION:\n return DirectiveLocation.FRAGMENT_DEFINITION;\n\n case Kind.VARIABLE_DEFINITION:\n return DirectiveLocation.VARIABLE_DEFINITION;\n\n case Kind.SCHEMA_DEFINITION:\n case Kind.SCHEMA_EXTENSION:\n return DirectiveLocation.SCHEMA;\n\n case Kind.SCALAR_TYPE_DEFINITION:\n case Kind.SCALAR_TYPE_EXTENSION:\n return DirectiveLocation.SCALAR;\n\n case Kind.OBJECT_TYPE_DEFINITION:\n case Kind.OBJECT_TYPE_EXTENSION:\n return DirectiveLocation.OBJECT;\n\n case Kind.FIELD_DEFINITION:\n return DirectiveLocation.FIELD_DEFINITION;\n\n case Kind.INTERFACE_TYPE_DEFINITION:\n case Kind.INTERFACE_TYPE_EXTENSION:\n return DirectiveLocation.INTERFACE;\n\n case Kind.UNION_TYPE_DEFINITION:\n case Kind.UNION_TYPE_EXTENSION:\n return DirectiveLocation.UNION;\n\n case Kind.ENUM_TYPE_DEFINITION:\n case Kind.ENUM_TYPE_EXTENSION:\n return DirectiveLocation.ENUM;\n\n case Kind.ENUM_VALUE_DEFINITION:\n return DirectiveLocation.ENUM_VALUE;\n\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n case Kind.INPUT_OBJECT_TYPE_EXTENSION:\n return DirectiveLocation.INPUT_OBJECT;\n\n case Kind.INPUT_VALUE_DEFINITION: {\n const parentNode = ancestors[ancestors.length - 3];\n 'kind' in parentNode || invariant(false);\n return parentNode.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION\n ? DirectiveLocation.INPUT_FIELD_DEFINITION\n : DirectiveLocation.ARGUMENT_DEFINITION;\n }\n // Not reachable, all possible types have been considered.\n\n /* c8 ignore next */\n\n default:\n false || invariant(false, 'Unexpected kind: ' + inspect(appliedTo.kind));\n }\n}\n\nfunction getDirectiveLocationForOperation(operation) {\n switch (operation) {\n case OperationTypeNode.QUERY:\n return DirectiveLocation.QUERY;\n\n case OperationTypeNode.MUTATION:\n return DirectiveLocation.MUTATION;\n\n case OperationTypeNode.SUBSCRIPTION:\n return DirectiveLocation.SUBSCRIPTION;\n }\n}\n", "import { GraphQLError } from '../../error/GraphQLError.mjs';\n\n/**\n * Known fragment names\n *\n * A GraphQL document is only valid if all `...Fragment` fragment spreads refer\n * to fragments defined in the same document.\n *\n * See https://spec.graphql.org/draft/#sec-Fragment-spread-target-defined\n */\nexport function KnownFragmentNamesRule(context) {\n return {\n FragmentSpread(node) {\n const fragmentName = node.name.value;\n const fragment = context.getFragment(fragmentName);\n\n if (!fragment) {\n context.reportError(\n new GraphQLError(`Unknown fragment \"${fragmentName}\".`, {\n nodes: node.name,\n }),\n );\n }\n },\n };\n}\n", "import { didYouMean } from '../../jsutils/didYouMean.mjs';\nimport { suggestionList } from '../../jsutils/suggestionList.mjs';\nimport { GraphQLError } from '../../error/GraphQLError.mjs';\nimport {\n isTypeDefinitionNode,\n isTypeSystemDefinitionNode,\n isTypeSystemExtensionNode,\n} from '../../language/predicates.mjs';\nimport { introspectionTypes } from '../../type/introspection.mjs';\nimport { specifiedScalarTypes } from '../../type/scalars.mjs';\n\n/**\n * Known type names\n *\n * A GraphQL document is only valid if referenced types (specifically\n * variable definitions and fragment conditions) are defined by the type schema.\n *\n * See https://spec.graphql.org/draft/#sec-Fragment-Spread-Type-Existence\n */\nexport function KnownTypeNamesRule(context) {\n const schema = context.getSchema();\n const existingTypesMap = schema ? schema.getTypeMap() : Object.create(null);\n const definedTypes = Object.create(null);\n\n for (const def of context.getDocument().definitions) {\n if (isTypeDefinitionNode(def)) {\n definedTypes[def.name.value] = true;\n }\n }\n\n const typeNames = [\n ...Object.keys(existingTypesMap),\n ...Object.keys(definedTypes),\n ];\n return {\n NamedType(node, _1, parent, _2, ancestors) {\n const typeName = node.name.value;\n\n if (!existingTypesMap[typeName] && !definedTypes[typeName]) {\n var _ancestors$;\n\n const definitionNode =\n (_ancestors$ = ancestors[2]) !== null && _ancestors$ !== void 0\n ? _ancestors$\n : parent;\n const isSDL = definitionNode != null && isSDLNode(definitionNode);\n\n if (isSDL && standardTypeNames.includes(typeName)) {\n return;\n }\n\n const suggestedTypes = suggestionList(\n typeName,\n isSDL ? standardTypeNames.concat(typeNames) : typeNames,\n );\n context.reportError(\n new GraphQLError(\n `Unknown type \"${typeName}\".` + didYouMean(suggestedTypes),\n {\n nodes: node,\n },\n ),\n );\n }\n },\n };\n}\nconst standardTypeNames = [...specifiedScalarTypes, ...introspectionTypes].map(\n (type) => type.name,\n);\n\nfunction isSDLNode(value) {\n return (\n 'kind' in value &&\n (isTypeSystemDefinitionNode(value) || isTypeSystemExtensionNode(value))\n );\n}\n", "import { GraphQLError } from '../../error/GraphQLError.mjs';\nimport { Kind } from '../../language/kinds.mjs';\n\n/**\n * Lone anonymous operation\n *\n * A GraphQL document is only valid if when it contains an anonymous operation\n * (the query short-hand) that it contains only that one operation definition.\n *\n * See https://spec.graphql.org/draft/#sec-Lone-Anonymous-Operation\n */\nexport function LoneAnonymousOperationRule(context) {\n let operationCount = 0;\n return {\n Document(node) {\n operationCount = node.definitions.filter(\n (definition) => definition.kind === Kind.OPERATION_DEFINITION,\n ).length;\n },\n\n OperationDefinition(node) {\n if (!node.name && operationCount > 1) {\n context.reportError(\n new GraphQLError(\n 'This anonymous operation must be the only defined operation.',\n {\n nodes: node,\n },\n ),\n );\n }\n },\n };\n}\n", "import { GraphQLError } from '../../error/GraphQLError.mjs';\n\n/**\n * Lone Schema definition\n *\n * A GraphQL document is only valid if it contains only one schema definition.\n */\nexport function LoneSchemaDefinitionRule(context) {\n var _ref, _ref2, _oldSchema$astNode;\n\n const oldSchema = context.getSchema();\n const alreadyDefined =\n (_ref =\n (_ref2 =\n (_oldSchema$astNode =\n oldSchema === null || oldSchema === void 0\n ? void 0\n : oldSchema.astNode) !== null && _oldSchema$astNode !== void 0\n ? _oldSchema$astNode\n : oldSchema === null || oldSchema === void 0\n ? void 0\n : oldSchema.getQueryType()) !== null && _ref2 !== void 0\n ? _ref2\n : oldSchema === null || oldSchema === void 0\n ? void 0\n : oldSchema.getMutationType()) !== null && _ref !== void 0\n ? _ref\n : oldSchema === null || oldSchema === void 0\n ? void 0\n : oldSchema.getSubscriptionType();\n let schemaDefinitionsCount = 0;\n return {\n SchemaDefinition(node) {\n if (alreadyDefined) {\n context.reportError(\n new GraphQLError(\n 'Cannot define a new schema within a schema extension.',\n {\n nodes: node,\n },\n ),\n );\n return;\n }\n\n if (schemaDefinitionsCount > 0) {\n context.reportError(\n new GraphQLError('Must provide only one schema definition.', {\n nodes: node,\n }),\n );\n }\n\n ++schemaDefinitionsCount;\n },\n };\n}\n", "import { GraphQLError } from '../../error/GraphQLError.mjs';\n\n/**\n * No fragment cycles\n *\n * The graph of fragment spreads must not form any cycles including spreading itself.\n * Otherwise an operation could infinitely spread or infinitely execute on cycles in the underlying data.\n *\n * See https://spec.graphql.org/draft/#sec-Fragment-spreads-must-not-form-cycles\n */\nexport function NoFragmentCyclesRule(context) {\n // Tracks already visited fragments to maintain O(N) and to ensure that cycles\n // are not redundantly reported.\n const visitedFrags = Object.create(null); // Array of AST nodes used to produce meaningful errors\n\n const spreadPath = []; // Position in the spread path\n\n const spreadPathIndexByName = Object.create(null);\n return {\n OperationDefinition: () => false,\n\n FragmentDefinition(node) {\n detectCycleRecursive(node);\n return false;\n },\n }; // This does a straight-forward DFS to find cycles.\n // It does not terminate when a cycle was found but continues to explore\n // the graph to find all possible cycles.\n\n function detectCycleRecursive(fragment) {\n if (visitedFrags[fragment.name.value]) {\n return;\n }\n\n const fragmentName = fragment.name.value;\n visitedFrags[fragmentName] = true;\n const spreadNodes = context.getFragmentSpreads(fragment.selectionSet);\n\n if (spreadNodes.length === 0) {\n return;\n }\n\n spreadPathIndexByName[fragmentName] = spreadPath.length;\n\n for (const spreadNode of spreadNodes) {\n const spreadName = spreadNode.name.value;\n const cycleIndex = spreadPathIndexByName[spreadName];\n spreadPath.push(spreadNode);\n\n if (cycleIndex === undefined) {\n const spreadFragment = context.getFragment(spreadName);\n\n if (spreadFragment) {\n detectCycleRecursive(spreadFragment);\n }\n } else {\n const cyclePath = spreadPath.slice(cycleIndex);\n const viaPath = cyclePath\n .slice(0, -1)\n .map((s) => '\"' + s.name.value + '\"')\n .join(', ');\n context.reportError(\n new GraphQLError(\n `Cannot spread fragment \"${spreadName}\" within itself` +\n (viaPath !== '' ? ` via ${viaPath}.` : '.'),\n {\n nodes: cyclePath,\n },\n ),\n );\n }\n\n spreadPath.pop();\n }\n\n spreadPathIndexByName[fragmentName] = undefined;\n }\n}\n", "import { GraphQLError } from '../../error/GraphQLError.mjs';\n\n/**\n * No undefined variables\n *\n * A GraphQL operation is only valid if all variables encountered, both directly\n * and via fragment spreads, are defined by that operation.\n *\n * See https://spec.graphql.org/draft/#sec-All-Variable-Uses-Defined\n */\nexport function NoUndefinedVariablesRule(context) {\n let variableNameDefined = Object.create(null);\n return {\n OperationDefinition: {\n enter() {\n variableNameDefined = Object.create(null);\n },\n\n leave(operation) {\n const usages = context.getRecursiveVariableUsages(operation);\n\n for (const { node } of usages) {\n const varName = node.name.value;\n\n if (variableNameDefined[varName] !== true) {\n context.reportError(\n new GraphQLError(\n operation.name\n ? `Variable \"$${varName}\" is not defined by operation \"${operation.name.value}\".`\n : `Variable \"$${varName}\" is not defined.`,\n {\n nodes: [node, operation],\n },\n ),\n );\n }\n }\n },\n },\n\n VariableDefinition(node) {\n variableNameDefined[node.variable.name.value] = true;\n },\n };\n}\n", "import { GraphQLError } from '../../error/GraphQLError.mjs';\n\n/**\n * No unused fragments\n *\n * A GraphQL document is only valid if all fragment definitions are spread\n * within operations, or spread within other fragments spread within operations.\n *\n * See https://spec.graphql.org/draft/#sec-Fragments-Must-Be-Used\n */\nexport function NoUnusedFragmentsRule(context) {\n const operationDefs = [];\n const fragmentDefs = [];\n return {\n OperationDefinition(node) {\n operationDefs.push(node);\n return false;\n },\n\n FragmentDefinition(node) {\n fragmentDefs.push(node);\n return false;\n },\n\n Document: {\n leave() {\n const fragmentNameUsed = Object.create(null);\n\n for (const operation of operationDefs) {\n for (const fragment of context.getRecursivelyReferencedFragments(\n operation,\n )) {\n fragmentNameUsed[fragment.name.value] = true;\n }\n }\n\n for (const fragmentDef of fragmentDefs) {\n const fragName = fragmentDef.name.value;\n\n if (fragmentNameUsed[fragName] !== true) {\n context.reportError(\n new GraphQLError(`Fragment \"${fragName}\" is never used.`, {\n nodes: fragmentDef,\n }),\n );\n }\n }\n },\n },\n };\n}\n", "import { GraphQLError } from '../../error/GraphQLError.mjs';\n\n/**\n * No unused variables\n *\n * A GraphQL operation is only valid if all variables defined by an operation\n * are used, either directly or within a spread fragment.\n *\n * See https://spec.graphql.org/draft/#sec-All-Variables-Used\n */\nexport function NoUnusedVariablesRule(context) {\n let variableDefs = [];\n return {\n OperationDefinition: {\n enter() {\n variableDefs = [];\n },\n\n leave(operation) {\n const variableNameUsed = Object.create(null);\n const usages = context.getRecursiveVariableUsages(operation);\n\n for (const { node } of usages) {\n variableNameUsed[node.name.value] = true;\n }\n\n for (const variableDef of variableDefs) {\n const variableName = variableDef.variable.name.value;\n\n if (variableNameUsed[variableName] !== true) {\n context.reportError(\n new GraphQLError(\n operation.name\n ? `Variable \"$${variableName}\" is never used in operation \"${operation.name.value}\".`\n : `Variable \"$${variableName}\" is never used.`,\n {\n nodes: variableDef,\n },\n ),\n );\n }\n }\n },\n },\n\n VariableDefinition(def) {\n variableDefs.push(def);\n },\n };\n}\n", "import { naturalCompare } from '../jsutils/naturalCompare.mjs';\nimport { Kind } from '../language/kinds.mjs';\n/**\n * Sort ValueNode.\n *\n * This function returns a sorted copy of the given ValueNode.\n *\n * @internal\n */\n\nexport function sortValueNode(valueNode) {\n switch (valueNode.kind) {\n case Kind.OBJECT:\n return { ...valueNode, fields: sortFields(valueNode.fields) };\n\n case Kind.LIST:\n return { ...valueNode, values: valueNode.values.map(sortValueNode) };\n\n case Kind.INT:\n case Kind.FLOAT:\n case Kind.STRING:\n case Kind.BOOLEAN:\n case Kind.NULL:\n case Kind.ENUM:\n case Kind.VARIABLE:\n return valueNode;\n }\n}\n\nfunction sortFields(fields) {\n return fields\n .map((fieldNode) => ({\n ...fieldNode,\n value: sortValueNode(fieldNode.value),\n }))\n .sort((fieldA, fieldB) =>\n naturalCompare(fieldA.name.value, fieldB.name.value),\n );\n}\n", "import { inspect } from '../../jsutils/inspect.mjs';\nimport { GraphQLError } from '../../error/GraphQLError.mjs';\nimport { Kind } from '../../language/kinds.mjs';\nimport { print } from '../../language/printer.mjs';\nimport {\n getNamedType,\n isInterfaceType,\n isLeafType,\n isListType,\n isNonNullType,\n isObjectType,\n} from '../../type/definition.mjs';\nimport { sortValueNode } from '../../utilities/sortValueNode.mjs';\nimport { typeFromAST } from '../../utilities/typeFromAST.mjs';\n\nfunction reasonMessage(reason) {\n if (Array.isArray(reason)) {\n return reason\n .map(\n ([responseName, subReason]) =>\n `subfields \"${responseName}\" conflict because ` +\n reasonMessage(subReason),\n )\n .join(' and ');\n }\n\n return reason;\n}\n/**\n * Overlapping fields can be merged\n *\n * A selection set is only valid if all fields (including spreading any\n * fragments) either correspond to distinct response names or can be merged\n * without ambiguity.\n *\n * See https://spec.graphql.org/draft/#sec-Field-Selection-Merging\n */\n\nexport function OverlappingFieldsCanBeMergedRule(context) {\n // A memoization for when two fragments are compared \"between\" each other for\n // conflicts. Two fragments may be compared many times, so memoizing this can\n // dramatically improve the performance of this validator.\n const comparedFragmentPairs = new PairSet(); // A cache for the \"field map\" and list of fragment names found in any given\n // selection set. Selection sets may be asked for this information multiple\n // times, so this improves the performance of this validator.\n\n const cachedFieldsAndFragmentNames = new Map();\n return {\n SelectionSet(selectionSet) {\n const conflicts = findConflictsWithinSelectionSet(\n context,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n context.getParentType(),\n selectionSet,\n );\n\n for (const [[responseName, reason], fields1, fields2] of conflicts) {\n const reasonMsg = reasonMessage(reason);\n context.reportError(\n new GraphQLError(\n `Fields \"${responseName}\" conflict because ${reasonMsg}. Use different aliases on the fields to fetch both if this was intentional.`,\n {\n nodes: fields1.concat(fields2),\n },\n ),\n );\n }\n },\n };\n}\n\n/**\n * Algorithm:\n *\n * Conflicts occur when two fields exist in a query which will produce the same\n * response name, but represent differing values, thus creating a conflict.\n * The algorithm below finds all conflicts via making a series of comparisons\n * between fields. In order to compare as few fields as possible, this makes\n * a series of comparisons \"within\" sets of fields and \"between\" sets of fields.\n *\n * Given any selection set, a collection produces both a set of fields by\n * also including all inline fragments, as well as a list of fragments\n * referenced by fragment spreads.\n *\n * A) Each selection set represented in the document first compares \"within\" its\n * collected set of fields, finding any conflicts between every pair of\n * overlapping fields.\n * Note: This is the *only time* that a the fields \"within\" a set are compared\n * to each other. After this only fields \"between\" sets are compared.\n *\n * B) Also, if any fragment is referenced in a selection set, then a\n * comparison is made \"between\" the original set of fields and the\n * referenced fragment.\n *\n * C) Also, if multiple fragments are referenced, then comparisons\n * are made \"between\" each referenced fragment.\n *\n * D) When comparing \"between\" a set of fields and a referenced fragment, first\n * a comparison is made between each field in the original set of fields and\n * each field in the the referenced set of fields.\n *\n * E) Also, if any fragment is referenced in the referenced selection set,\n * then a comparison is made \"between\" the original set of fields and the\n * referenced fragment (recursively referring to step D).\n *\n * F) When comparing \"between\" two fragments, first a comparison is made between\n * each field in the first referenced set of fields and each field in the the\n * second referenced set of fields.\n *\n * G) Also, any fragments referenced by the first must be compared to the\n * second, and any fragments referenced by the second must be compared to the\n * first (recursively referring to step F).\n *\n * H) When comparing two fields, if both have selection sets, then a comparison\n * is made \"between\" both selection sets, first comparing the set of fields in\n * the first selection set with the set of fields in the second.\n *\n * I) Also, if any fragment is referenced in either selection set, then a\n * comparison is made \"between\" the other set of fields and the\n * referenced fragment.\n *\n * J) Also, if two fragments are referenced in both selection sets, then a\n * comparison is made \"between\" the two fragments.\n *\n */\n// Find all conflicts found \"within\" a selection set, including those found\n// via spreading in fragments. Called when visiting each SelectionSet in the\n// GraphQL Document.\nfunction findConflictsWithinSelectionSet(\n context,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n parentType,\n selectionSet,\n) {\n const conflicts = [];\n const [fieldMap, fragmentNames] = getFieldsAndFragmentNames(\n context,\n cachedFieldsAndFragmentNames,\n parentType,\n selectionSet,\n ); // (A) Find find all conflicts \"within\" the fields of this selection set.\n // Note: this is the *only place* `collectConflictsWithin` is called.\n\n collectConflictsWithin(\n context,\n conflicts,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n fieldMap,\n );\n\n if (fragmentNames.length !== 0) {\n // (B) Then collect conflicts between these fields and those represented by\n // each spread fragment name found.\n for (let i = 0; i < fragmentNames.length; i++) {\n collectConflictsBetweenFieldsAndFragment(\n context,\n conflicts,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n false,\n fieldMap,\n fragmentNames[i],\n ); // (C) Then compare this fragment with all other fragments found in this\n // selection set to collect conflicts between fragments spread together.\n // This compares each item in the list of fragment names to every other\n // item in that same list (except for itself).\n\n for (let j = i + 1; j < fragmentNames.length; j++) {\n collectConflictsBetweenFragments(\n context,\n conflicts,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n false,\n fragmentNames[i],\n fragmentNames[j],\n );\n }\n }\n }\n\n return conflicts;\n} // Collect all conflicts found between a set of fields and a fragment reference\n// including via spreading in any nested fragments.\n\nfunction collectConflictsBetweenFieldsAndFragment(\n context,\n conflicts,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n areMutuallyExclusive,\n fieldMap,\n fragmentName,\n) {\n const fragment = context.getFragment(fragmentName);\n\n if (!fragment) {\n return;\n }\n\n const [fieldMap2, referencedFragmentNames] =\n getReferencedFieldsAndFragmentNames(\n context,\n cachedFieldsAndFragmentNames,\n fragment,\n ); // Do not compare a fragment's fieldMap to itself.\n\n if (fieldMap === fieldMap2) {\n return;\n } // (D) First collect any conflicts between the provided collection of fields\n // and the collection of fields represented by the given fragment.\n\n collectConflictsBetween(\n context,\n conflicts,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n areMutuallyExclusive,\n fieldMap,\n fieldMap2,\n ); // (E) Then collect any conflicts between the provided collection of fields\n // and any fragment names found in the given fragment.\n\n for (const referencedFragmentName of referencedFragmentNames) {\n // Memoize so two fragments are not compared for conflicts more than once.\n if (\n comparedFragmentPairs.has(\n referencedFragmentName,\n fragmentName,\n areMutuallyExclusive,\n )\n ) {\n continue;\n }\n\n comparedFragmentPairs.add(\n referencedFragmentName,\n fragmentName,\n areMutuallyExclusive,\n );\n collectConflictsBetweenFieldsAndFragment(\n context,\n conflicts,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n areMutuallyExclusive,\n fieldMap,\n referencedFragmentName,\n );\n }\n} // Collect all conflicts found between two fragments, including via spreading in\n// any nested fragments.\n\nfunction collectConflictsBetweenFragments(\n context,\n conflicts,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n areMutuallyExclusive,\n fragmentName1,\n fragmentName2,\n) {\n // No need to compare a fragment to itself.\n if (fragmentName1 === fragmentName2) {\n return;\n } // Memoize so two fragments are not compared for conflicts more than once.\n\n if (\n comparedFragmentPairs.has(\n fragmentName1,\n fragmentName2,\n areMutuallyExclusive,\n )\n ) {\n return;\n }\n\n comparedFragmentPairs.add(fragmentName1, fragmentName2, areMutuallyExclusive);\n const fragment1 = context.getFragment(fragmentName1);\n const fragment2 = context.getFragment(fragmentName2);\n\n if (!fragment1 || !fragment2) {\n return;\n }\n\n const [fieldMap1, referencedFragmentNames1] =\n getReferencedFieldsAndFragmentNames(\n context,\n cachedFieldsAndFragmentNames,\n fragment1,\n );\n const [fieldMap2, referencedFragmentNames2] =\n getReferencedFieldsAndFragmentNames(\n context,\n cachedFieldsAndFragmentNames,\n fragment2,\n ); // (F) First, collect all conflicts between these two collections of fields\n // (not including any nested fragments).\n\n collectConflictsBetween(\n context,\n conflicts,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n areMutuallyExclusive,\n fieldMap1,\n fieldMap2,\n ); // (G) Then collect conflicts between the first fragment and any nested\n // fragments spread in the second fragment.\n\n for (const referencedFragmentName2 of referencedFragmentNames2) {\n collectConflictsBetweenFragments(\n context,\n conflicts,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n areMutuallyExclusive,\n fragmentName1,\n referencedFragmentName2,\n );\n } // (G) Then collect conflicts between the second fragment and any nested\n // fragments spread in the first fragment.\n\n for (const referencedFragmentName1 of referencedFragmentNames1) {\n collectConflictsBetweenFragments(\n context,\n conflicts,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n areMutuallyExclusive,\n referencedFragmentName1,\n fragmentName2,\n );\n }\n} // Find all conflicts found between two selection sets, including those found\n// via spreading in fragments. Called when determining if conflicts exist\n// between the sub-fields of two overlapping fields.\n\nfunction findConflictsBetweenSubSelectionSets(\n context,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n areMutuallyExclusive,\n parentType1,\n selectionSet1,\n parentType2,\n selectionSet2,\n) {\n const conflicts = [];\n const [fieldMap1, fragmentNames1] = getFieldsAndFragmentNames(\n context,\n cachedFieldsAndFragmentNames,\n parentType1,\n selectionSet1,\n );\n const [fieldMap2, fragmentNames2] = getFieldsAndFragmentNames(\n context,\n cachedFieldsAndFragmentNames,\n parentType2,\n selectionSet2,\n ); // (H) First, collect all conflicts between these two collections of field.\n\n collectConflictsBetween(\n context,\n conflicts,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n areMutuallyExclusive,\n fieldMap1,\n fieldMap2,\n ); // (I) Then collect conflicts between the first collection of fields and\n // those referenced by each fragment name associated with the second.\n\n for (const fragmentName2 of fragmentNames2) {\n collectConflictsBetweenFieldsAndFragment(\n context,\n conflicts,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n areMutuallyExclusive,\n fieldMap1,\n fragmentName2,\n );\n } // (I) Then collect conflicts between the second collection of fields and\n // those referenced by each fragment name associated with the first.\n\n for (const fragmentName1 of fragmentNames1) {\n collectConflictsBetweenFieldsAndFragment(\n context,\n conflicts,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n areMutuallyExclusive,\n fieldMap2,\n fragmentName1,\n );\n } // (J) Also collect conflicts between any fragment names by the first and\n // fragment names by the second. This compares each item in the first set of\n // names to each item in the second set of names.\n\n for (const fragmentName1 of fragmentNames1) {\n for (const fragmentName2 of fragmentNames2) {\n collectConflictsBetweenFragments(\n context,\n conflicts,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n areMutuallyExclusive,\n fragmentName1,\n fragmentName2,\n );\n }\n }\n\n return conflicts;\n} // Collect all Conflicts \"within\" one collection of fields.\n\nfunction collectConflictsWithin(\n context,\n conflicts,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n fieldMap,\n) {\n // A field map is a keyed collection, where each key represents a response\n // name and the value at that key is a list of all fields which provide that\n // response name. For every response name, if there are multiple fields, they\n // must be compared to find a potential conflict.\n for (const [responseName, fields] of Object.entries(fieldMap)) {\n // This compares every field in the list to every other field in this list\n // (except to itself). If the list only has one item, nothing needs to\n // be compared.\n if (fields.length > 1) {\n for (let i = 0; i < fields.length; i++) {\n for (let j = i + 1; j < fields.length; j++) {\n const conflict = findConflict(\n context,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n false, // within one collection is never mutually exclusive\n responseName,\n fields[i],\n fields[j],\n );\n\n if (conflict) {\n conflicts.push(conflict);\n }\n }\n }\n }\n }\n} // Collect all Conflicts between two collections of fields. This is similar to,\n// but different from the `collectConflictsWithin` function above. This check\n// assumes that `collectConflictsWithin` has already been called on each\n// provided collection of fields. This is true because this validator traverses\n// each individual selection set.\n\nfunction collectConflictsBetween(\n context,\n conflicts,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n parentFieldsAreMutuallyExclusive,\n fieldMap1,\n fieldMap2,\n) {\n // A field map is a keyed collection, where each key represents a response\n // name and the value at that key is a list of all fields which provide that\n // response name. For any response name which appears in both provided field\n // maps, each field from the first field map must be compared to every field\n // in the second field map to find potential conflicts.\n for (const [responseName, fields1] of Object.entries(fieldMap1)) {\n const fields2 = fieldMap2[responseName];\n\n if (fields2) {\n for (const field1 of fields1) {\n for (const field2 of fields2) {\n const conflict = findConflict(\n context,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n parentFieldsAreMutuallyExclusive,\n responseName,\n field1,\n field2,\n );\n\n if (conflict) {\n conflicts.push(conflict);\n }\n }\n }\n }\n }\n} // Determines if there is a conflict between two particular fields, including\n// comparing their sub-fields.\n\nfunction findConflict(\n context,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n parentFieldsAreMutuallyExclusive,\n responseName,\n field1,\n field2,\n) {\n const [parentType1, node1, def1] = field1;\n const [parentType2, node2, def2] = field2; // If it is known that two fields could not possibly apply at the same\n // time, due to the parent types, then it is safe to permit them to diverge\n // in aliased field or arguments used as they will not present any ambiguity\n // by differing.\n // It is known that two parent types could never overlap if they are\n // different Object types. Interface or Union types might overlap - if not\n // in the current state of the schema, then perhaps in some future version,\n // thus may not safely diverge.\n\n const areMutuallyExclusive =\n parentFieldsAreMutuallyExclusive ||\n (parentType1 !== parentType2 &&\n isObjectType(parentType1) &&\n isObjectType(parentType2));\n\n if (!areMutuallyExclusive) {\n // Two aliases must refer to the same field.\n const name1 = node1.name.value;\n const name2 = node2.name.value;\n\n if (name1 !== name2) {\n return [\n [responseName, `\"${name1}\" and \"${name2}\" are different fields`],\n [node1],\n [node2],\n ];\n } // Two field calls must have the same arguments.\n\n if (!sameArguments(node1, node2)) {\n return [\n [responseName, 'they have differing arguments'],\n [node1],\n [node2],\n ];\n }\n } // The return type for each field.\n\n const type1 = def1 === null || def1 === void 0 ? void 0 : def1.type;\n const type2 = def2 === null || def2 === void 0 ? void 0 : def2.type;\n\n if (type1 && type2 && doTypesConflict(type1, type2)) {\n return [\n [\n responseName,\n `they return conflicting types \"${inspect(type1)}\" and \"${inspect(\n type2,\n )}\"`,\n ],\n [node1],\n [node2],\n ];\n } // Collect and compare sub-fields. Use the same \"visited fragment names\" list\n // for both collections so fields in a fragment reference are never\n // compared to themselves.\n\n const selectionSet1 = node1.selectionSet;\n const selectionSet2 = node2.selectionSet;\n\n if (selectionSet1 && selectionSet2) {\n const conflicts = findConflictsBetweenSubSelectionSets(\n context,\n cachedFieldsAndFragmentNames,\n comparedFragmentPairs,\n areMutuallyExclusive,\n getNamedType(type1),\n selectionSet1,\n getNamedType(type2),\n selectionSet2,\n );\n return subfieldConflicts(conflicts, responseName, node1, node2);\n }\n}\n\nfunction sameArguments(node1, node2) {\n const args1 = node1.arguments;\n const args2 = node2.arguments;\n\n if (args1 === undefined || args1.length === 0) {\n return args2 === undefined || args2.length === 0;\n }\n\n if (args2 === undefined || args2.length === 0) {\n return false;\n }\n /* c8 ignore next */\n\n if (args1.length !== args2.length) {\n /* c8 ignore next */\n return false;\n /* c8 ignore next */\n }\n\n const values2 = new Map(args2.map(({ name, value }) => [name.value, value]));\n return args1.every((arg1) => {\n const value1 = arg1.value;\n const value2 = values2.get(arg1.name.value);\n\n if (value2 === undefined) {\n return false;\n }\n\n return stringifyValue(value1) === stringifyValue(value2);\n });\n}\n\nfunction stringifyValue(value) {\n return print(sortValueNode(value));\n} // Two types conflict if both types could not apply to a value simultaneously.\n// Composite types are ignored as their individual field types will be compared\n// later recursively. However List and Non-Null types must match.\n\nfunction doTypesConflict(type1, type2) {\n if (isListType(type1)) {\n return isListType(type2)\n ? doTypesConflict(type1.ofType, type2.ofType)\n : true;\n }\n\n if (isListType(type2)) {\n return true;\n }\n\n if (isNonNullType(type1)) {\n return isNonNullType(type2)\n ? doTypesConflict(type1.ofType, type2.ofType)\n : true;\n }\n\n if (isNonNullType(type2)) {\n return true;\n }\n\n if (isLeafType(type1) || isLeafType(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response\n// name to field nodes and definitions) as well as a list of fragment names\n// referenced via fragment spreads.\n\nfunction getFieldsAndFragmentNames(\n context,\n cachedFieldsAndFragmentNames,\n parentType,\n selectionSet,\n) {\n const cached = cachedFieldsAndFragmentNames.get(selectionSet);\n\n if (cached) {\n return cached;\n }\n\n const nodeAndDefs = Object.create(null);\n const fragmentNames = Object.create(null);\n\n _collectFieldsAndFragmentNames(\n context,\n parentType,\n selectionSet,\n nodeAndDefs,\n fragmentNames,\n );\n\n const result = [nodeAndDefs, Object.keys(fragmentNames)];\n cachedFieldsAndFragmentNames.set(selectionSet, result);\n return result;\n} // Given a reference to a fragment, return the represented collection of fields\n// as well as a list of nested fragment names referenced via fragment spreads.\n\nfunction getReferencedFieldsAndFragmentNames(\n context,\n cachedFieldsAndFragmentNames,\n fragment,\n) {\n // Short-circuit building a type from the node if possible.\n const cached = cachedFieldsAndFragmentNames.get(fragment.selectionSet);\n\n if (cached) {\n return cached;\n }\n\n const fragmentType = typeFromAST(context.getSchema(), fragment.typeCondition);\n return getFieldsAndFragmentNames(\n context,\n cachedFieldsAndFragmentNames,\n fragmentType,\n fragment.selectionSet,\n );\n}\n\nfunction _collectFieldsAndFragmentNames(\n context,\n parentType,\n selectionSet,\n nodeAndDefs,\n fragmentNames,\n) {\n for (const selection of selectionSet.selections) {\n switch (selection.kind) {\n case Kind.FIELD: {\n const fieldName = selection.name.value;\n let fieldDef;\n\n if (isObjectType(parentType) || isInterfaceType(parentType)) {\n fieldDef = parentType.getFields()[fieldName];\n }\n\n const responseName = selection.alias\n ? selection.alias.value\n : fieldName;\n\n if (!nodeAndDefs[responseName]) {\n nodeAndDefs[responseName] = [];\n }\n\n nodeAndDefs[responseName].push([parentType, selection, fieldDef]);\n break;\n }\n\n case Kind.FRAGMENT_SPREAD:\n fragmentNames[selection.name.value] = true;\n break;\n\n case Kind.INLINE_FRAGMENT: {\n const typeCondition = selection.typeCondition;\n const inlineFragmentType = typeCondition\n ? typeFromAST(context.getSchema(), typeCondition)\n : parentType;\n\n _collectFieldsAndFragmentNames(\n context,\n inlineFragmentType,\n selection.selectionSet,\n nodeAndDefs,\n fragmentNames,\n );\n\n break;\n }\n }\n }\n} // Given a series of Conflicts which occurred between two sub-fields, generate\n// a single Conflict.\n\nfunction subfieldConflicts(conflicts, responseName, node1, node2) {\n if (conflicts.length > 0) {\n return [\n [responseName, conflicts.map(([reason]) => reason)],\n [node1, ...conflicts.map(([, fields1]) => fields1).flat()],\n [node2, ...conflicts.map(([, , fields2]) => fields2).flat()],\n ];\n }\n}\n/**\n * A way to keep track of pairs of things when the ordering of the pair does not matter.\n */\n\nclass PairSet {\n constructor() {\n this._data = new Map();\n }\n\n has(a, b, areMutuallyExclusive) {\n var _this$_data$get;\n\n const [key1, key2] = a < b ? [a, b] : [b, a];\n const result =\n (_this$_data$get = this._data.get(key1)) === null ||\n _this$_data$get === void 0\n ? void 0\n : _this$_data$get.get(key2);\n\n if (result === undefined) {\n return false;\n } // areMutuallyExclusive being false is a superset of being true, hence if\n // we want to know if this PairSet \"has\" these two with no exclusivity,\n // we have to ensure it was added as such.\n\n return areMutuallyExclusive ? true : areMutuallyExclusive === result;\n }\n\n add(a, b, areMutuallyExclusive) {\n const [key1, key2] = a < b ? [a, b] : [b, a];\n\n const map = this._data.get(key1);\n\n if (map === undefined) {\n this._data.set(key1, new Map([[key2, areMutuallyExclusive]]));\n } else {\n map.set(key2, areMutuallyExclusive);\n }\n }\n}\n", "import { inspect } from '../../jsutils/inspect.mjs';\nimport { GraphQLError } from '../../error/GraphQLError.mjs';\nimport { isCompositeType } from '../../type/definition.mjs';\nimport { doTypesOverlap } from '../../utilities/typeComparators.mjs';\nimport { typeFromAST } from '../../utilities/typeFromAST.mjs';\n\n/**\n * Possible fragment spread\n *\n * A fragment spread is only valid if the type condition could ever possibly\n * be true: if there is a non-empty intersection of the possible parent types,\n * and possible types which pass the type condition.\n */\nexport function PossibleFragmentSpreadsRule(context) {\n return {\n InlineFragment(node) {\n const fragType = context.getType();\n const parentType = context.getParentType();\n\n if (\n isCompositeType(fragType) &&\n isCompositeType(parentType) &&\n !doTypesOverlap(context.getSchema(), fragType, parentType)\n ) {\n const parentTypeStr = inspect(parentType);\n const fragTypeStr = inspect(fragType);\n context.reportError(\n new GraphQLError(\n `Fragment cannot be spread here as objects of type \"${parentTypeStr}\" can never be of type \"${fragTypeStr}\".`,\n {\n nodes: node,\n },\n ),\n );\n }\n },\n\n FragmentSpread(node) {\n const fragName = node.name.value;\n const fragType = getFragmentType(context, fragName);\n const parentType = context.getParentType();\n\n if (\n fragType &&\n parentType &&\n !doTypesOverlap(context.getSchema(), fragType, parentType)\n ) {\n const parentTypeStr = inspect(parentType);\n const fragTypeStr = inspect(fragType);\n context.reportError(\n new GraphQLError(\n `Fragment \"${fragName}\" cannot be spread here as objects of type \"${parentTypeStr}\" can never be of type \"${fragTypeStr}\".`,\n {\n nodes: node,\n },\n ),\n );\n }\n },\n };\n}\n\nfunction getFragmentType(context, name) {\n const frag = context.getFragment(name);\n\n if (frag) {\n const type = typeFromAST(context.getSchema(), frag.typeCondition);\n\n if (isCompositeType(type)) {\n return type;\n }\n }\n}\n", "import { didYouMean } from '../../jsutils/didYouMean.mjs';\nimport { inspect } from '../../jsutils/inspect.mjs';\nimport { invariant } from '../../jsutils/invariant.mjs';\nimport { suggestionList } from '../../jsutils/suggestionList.mjs';\nimport { GraphQLError } from '../../error/GraphQLError.mjs';\nimport { Kind } from '../../language/kinds.mjs';\nimport { isTypeDefinitionNode } from '../../language/predicates.mjs';\nimport {\n isEnumType,\n isInputObjectType,\n isInterfaceType,\n isObjectType,\n isScalarType,\n isUnionType,\n} from '../../type/definition.mjs';\n\n/**\n * Possible type extension\n *\n * A type extension is only valid if the type is defined and has the same kind.\n */\nexport function PossibleTypeExtensionsRule(context) {\n const schema = context.getSchema();\n const definedTypes = Object.create(null);\n\n for (const def of context.getDocument().definitions) {\n if (isTypeDefinitionNode(def)) {\n definedTypes[def.name.value] = def;\n }\n }\n\n return {\n ScalarTypeExtension: checkExtension,\n ObjectTypeExtension: checkExtension,\n InterfaceTypeExtension: checkExtension,\n UnionTypeExtension: checkExtension,\n EnumTypeExtension: checkExtension,\n InputObjectTypeExtension: checkExtension,\n };\n\n function checkExtension(node) {\n const typeName = node.name.value;\n const defNode = definedTypes[typeName];\n const existingType =\n schema === null || schema === void 0 ? void 0 : schema.getType(typeName);\n let expectedKind;\n\n if (defNode) {\n expectedKind = defKindToExtKind[defNode.kind];\n } else if (existingType) {\n expectedKind = typeToExtKind(existingType);\n }\n\n if (expectedKind) {\n if (expectedKind !== node.kind) {\n const kindStr = extensionKindToTypeName(node.kind);\n context.reportError(\n new GraphQLError(`Cannot extend non-${kindStr} type \"${typeName}\".`, {\n nodes: defNode ? [defNode, node] : node,\n }),\n );\n }\n } else {\n const allTypeNames = Object.keys({\n ...definedTypes,\n ...(schema === null || schema === void 0\n ? void 0\n : schema.getTypeMap()),\n });\n const suggestedTypes = suggestionList(typeName, allTypeNames);\n context.reportError(\n new GraphQLError(\n `Cannot extend type \"${typeName}\" because it is not defined.` +\n didYouMean(suggestedTypes),\n {\n nodes: node.name,\n },\n ),\n );\n }\n }\n}\nconst defKindToExtKind = {\n [Kind.SCALAR_TYPE_DEFINITION]: Kind.SCALAR_TYPE_EXTENSION,\n [Kind.OBJECT_TYPE_DEFINITION]: Kind.OBJECT_TYPE_EXTENSION,\n [Kind.INTERFACE_TYPE_DEFINITION]: Kind.INTERFACE_TYPE_EXTENSION,\n [Kind.UNION_TYPE_DEFINITION]: Kind.UNION_TYPE_EXTENSION,\n [Kind.ENUM_TYPE_DEFINITION]: Kind.ENUM_TYPE_EXTENSION,\n [Kind.INPUT_OBJECT_TYPE_DEFINITION]: Kind.INPUT_OBJECT_TYPE_EXTENSION,\n};\n\nfunction typeToExtKind(type) {\n if (isScalarType(type)) {\n return Kind.SCALAR_TYPE_EXTENSION;\n }\n\n if (isObjectType(type)) {\n return Kind.OBJECT_TYPE_EXTENSION;\n }\n\n if (isInterfaceType(type)) {\n return Kind.INTERFACE_TYPE_EXTENSION;\n }\n\n if (isUnionType(type)) {\n return Kind.UNION_TYPE_EXTENSION;\n }\n\n if (isEnumType(type)) {\n return Kind.ENUM_TYPE_EXTENSION;\n }\n\n if (isInputObjectType(type)) {\n return Kind.INPUT_OBJECT_TYPE_EXTENSION;\n }\n /* c8 ignore next 3 */\n // Not reachable. All possible types have been considered\n\n false || invariant(false, 'Unexpected type: ' + inspect(type));\n}\n\nfunction extensionKindToTypeName(kind) {\n switch (kind) {\n case Kind.SCALAR_TYPE_EXTENSION:\n return 'scalar';\n\n case Kind.OBJECT_TYPE_EXTENSION:\n return 'object';\n\n case Kind.INTERFACE_TYPE_EXTENSION:\n return 'interface';\n\n case Kind.UNION_TYPE_EXTENSION:\n return 'union';\n\n case Kind.ENUM_TYPE_EXTENSION:\n return 'enum';\n\n case Kind.INPUT_OBJECT_TYPE_EXTENSION:\n return 'input object';\n // Not reachable. All possible types have been considered\n\n /* c8 ignore next */\n\n default:\n false || invariant(false, 'Unexpected kind: ' + inspect(kind));\n }\n}\n", "import { inspect } from '../../jsutils/inspect.mjs';\nimport { keyMap } from '../../jsutils/keyMap.mjs';\nimport { GraphQLError } from '../../error/GraphQLError.mjs';\nimport { Kind } from '../../language/kinds.mjs';\nimport { print } from '../../language/printer.mjs';\nimport { isRequiredArgument, isType } from '../../type/definition.mjs';\nimport { specifiedDirectives } from '../../type/directives.mjs';\n\n/**\n * Provided required arguments\n *\n * A field or directive is only valid if all required (non-null without a\n * default value) field arguments have been provided.\n */\nexport function ProvidedRequiredArgumentsRule(context) {\n return {\n // eslint-disable-next-line new-cap\n ...ProvidedRequiredArgumentsOnDirectivesRule(context),\n Field: {\n // Validate on leave to allow for deeper errors to appear first.\n leave(fieldNode) {\n var _fieldNode$arguments;\n\n const fieldDef = context.getFieldDef();\n\n if (!fieldDef) {\n return false;\n }\n\n const providedArgs = new Set( // FIXME: https://github.com/graphql/graphql-js/issues/2203\n /* c8 ignore next */\n (_fieldNode$arguments = fieldNode.arguments) === null ||\n _fieldNode$arguments === void 0\n ? void 0\n : _fieldNode$arguments.map((arg) => arg.name.value),\n );\n\n for (const argDef of fieldDef.args) {\n if (!providedArgs.has(argDef.name) && isRequiredArgument(argDef)) {\n const argTypeStr = inspect(argDef.type);\n context.reportError(\n new GraphQLError(\n `Field \"${fieldDef.name}\" argument \"${argDef.name}\" of type \"${argTypeStr}\" is required, but it was not provided.`,\n {\n nodes: fieldNode,\n },\n ),\n );\n }\n }\n },\n },\n };\n}\n/**\n * @internal\n */\n\nexport function ProvidedRequiredArgumentsOnDirectivesRule(context) {\n var _schema$getDirectives;\n\n const requiredArgsMap = Object.create(null);\n const schema = context.getSchema();\n const definedDirectives =\n (_schema$getDirectives =\n schema === null || schema === void 0\n ? void 0\n : schema.getDirectives()) !== null && _schema$getDirectives !== void 0\n ? _schema$getDirectives\n : specifiedDirectives;\n\n for (const directive of definedDirectives) {\n requiredArgsMap[directive.name] = keyMap(\n directive.args.filter(isRequiredArgument),\n (arg) => arg.name,\n );\n }\n\n const astDefinitions = context.getDocument().definitions;\n\n for (const def of astDefinitions) {\n if (def.kind === Kind.DIRECTIVE_DEFINITION) {\n var _def$arguments;\n\n // FIXME: https://github.com/graphql/graphql-js/issues/2203\n\n /* c8 ignore next */\n const argNodes =\n (_def$arguments = def.arguments) !== null && _def$arguments !== void 0\n ? _def$arguments\n : [];\n requiredArgsMap[def.name.value] = keyMap(\n argNodes.filter(isRequiredArgumentNode),\n (arg) => arg.name.value,\n );\n }\n }\n\n return {\n Directive: {\n // Validate on leave to allow for deeper errors to appear first.\n leave(directiveNode) {\n const directiveName = directiveNode.name.value;\n const requiredArgs = requiredArgsMap[directiveName];\n\n if (requiredArgs) {\n var _directiveNode$argume;\n\n // FIXME: https://github.com/graphql/graphql-js/issues/2203\n\n /* c8 ignore next */\n const argNodes =\n (_directiveNode$argume = directiveNode.arguments) !== null &&\n _directiveNode$argume !== void 0\n ? _directiveNode$argume\n : [];\n const argNodeMap = new Set(argNodes.map((arg) => arg.name.value));\n\n for (const [argName, argDef] of Object.entries(requiredArgs)) {\n if (!argNodeMap.has(argName)) {\n const argType = isType(argDef.type)\n ? inspect(argDef.type)\n : print(argDef.type);\n context.reportError(\n new GraphQLError(\n `Directive \"@${directiveName}\" argument \"${argName}\" of type \"${argType}\" is required, but it was not provided.`,\n {\n nodes: directiveNode,\n },\n ),\n );\n }\n }\n }\n },\n },\n };\n}\n\nfunction isRequiredArgumentNode(arg) {\n return arg.type.kind === Kind.NON_NULL_TYPE && arg.defaultValue == null;\n}\n", "import { inspect } from '../../jsutils/inspect.mjs';\nimport { GraphQLError } from '../../error/GraphQLError.mjs';\nimport { getNamedType, isLeafType } from '../../type/definition.mjs';\n\n/**\n * Scalar leafs\n *\n * A GraphQL document is valid only if all leaf fields (fields without\n * sub selections) are of scalar or enum types.\n */\nexport function ScalarLeafsRule(context) {\n return {\n Field(node) {\n const type = context.getType();\n const selectionSet = node.selectionSet;\n\n if (type) {\n if (isLeafType(getNamedType(type))) {\n if (selectionSet) {\n const fieldName = node.name.value;\n const typeStr = inspect(type);\n context.reportError(\n new GraphQLError(\n `Field \"${fieldName}\" must not have a selection since type \"${typeStr}\" has no subfields.`,\n {\n nodes: selectionSet,\n },\n ),\n );\n }\n } else if (!selectionSet) {\n const fieldName = node.name.value;\n const typeStr = inspect(type);\n context.reportError(\n new GraphQLError(\n `Field \"${fieldName}\" of type \"${typeStr}\" must have a selection of subfields. Did you mean \"${fieldName} { ... }\"?`,\n {\n nodes: node,\n },\n ),\n );\n }\n }\n },\n };\n}\n", "/**\n * Build a string describing the path.\n */\nexport function printPathArray(path) {\n return path\n .map((key) =>\n typeof key === 'number' ? '[' + key.toString() + ']' : '.' + key,\n )\n .join('');\n}\n", "/**\n * Given a Path and a key, return a new Path containing the new key.\n */\nexport function addPath(prev, key, typename) {\n return {\n prev,\n key,\n typename,\n };\n}\n/**\n * Given a Path, return an Array of the path keys.\n */\n\nexport function pathToArray(path) {\n const flattened = [];\n let curr = path;\n\n while (curr) {\n flattened.push(curr.key);\n curr = curr.prev;\n }\n\n return flattened.reverse();\n}\n", "import { didYouMean } from '../jsutils/didYouMean.mjs';\nimport { inspect } from '../jsutils/inspect.mjs';\nimport { invariant } from '../jsutils/invariant.mjs';\nimport { isIterableObject } from '../jsutils/isIterableObject.mjs';\nimport { isObjectLike } from '../jsutils/isObjectLike.mjs';\nimport { addPath, pathToArray } from '../jsutils/Path.mjs';\nimport { printPathArray } from '../jsutils/printPathArray.mjs';\nimport { suggestionList } from '../jsutils/suggestionList.mjs';\nimport { GraphQLError } from '../error/GraphQLError.mjs';\nimport {\n isInputObjectType,\n isLeafType,\n isListType,\n isNonNullType,\n} from '../type/definition.mjs';\n\n/**\n * Coerces a JavaScript value given a GraphQL Input Type.\n */\nexport function coerceInputValue(inputValue, type, onError = defaultOnError) {\n return coerceInputValueImpl(inputValue, type, onError, undefined);\n}\n\nfunction defaultOnError(path, invalidValue, error) {\n let errorPrefix = 'Invalid value ' + inspect(invalidValue);\n\n if (path.length > 0) {\n errorPrefix += ` at \"value${printPathArray(path)}\"`;\n }\n\n error.message = errorPrefix + ': ' + error.message;\n throw error;\n}\n\nfunction coerceInputValueImpl(inputValue, type, onError, path) {\n if (isNonNullType(type)) {\n if (inputValue != null) {\n return coerceInputValueImpl(inputValue, type.ofType, onError, path);\n }\n\n onError(\n pathToArray(path),\n inputValue,\n new GraphQLError(\n `Expected non-nullable type \"${inspect(type)}\" not to be null.`,\n ),\n );\n return;\n }\n\n if (inputValue == null) {\n // Explicitly return the value null.\n return null;\n }\n\n if (isListType(type)) {\n const itemType = type.ofType;\n\n if (isIterableObject(inputValue)) {\n return Array.from(inputValue, (itemValue, index) => {\n const itemPath = addPath(path, index, undefined);\n return coerceInputValueImpl(itemValue, itemType, onError, itemPath);\n });\n } // Lists accept a non-list value as a list of one.\n\n return [coerceInputValueImpl(inputValue, itemType, onError, path)];\n }\n\n if (isInputObjectType(type)) {\n if (!isObjectLike(inputValue)) {\n onError(\n pathToArray(path),\n inputValue,\n new GraphQLError(`Expected type \"${type.name}\" to be an object.`),\n );\n return;\n }\n\n const coercedValue = {};\n const fieldDefs = type.getFields();\n\n for (const field of Object.values(fieldDefs)) {\n const fieldValue = inputValue[field.name];\n\n if (fieldValue === undefined) {\n if (field.defaultValue !== undefined) {\n coercedValue[field.name] = field.defaultValue;\n } else if (isNonNullType(field.type)) {\n const typeStr = inspect(field.type);\n onError(\n pathToArray(path),\n inputValue,\n new GraphQLError(\n `Field \"${field.name}\" of required type \"${typeStr}\" was not provided.`,\n ),\n );\n }\n\n continue;\n }\n\n coercedValue[field.name] = coerceInputValueImpl(\n fieldValue,\n field.type,\n onError,\n addPath(path, field.name, type.name),\n );\n } // Ensure every provided field is defined.\n\n for (const fieldName of Object.keys(inputValue)) {\n if (!fieldDefs[fieldName]) {\n const suggestions = suggestionList(\n fieldName,\n Object.keys(type.getFields()),\n );\n onError(\n pathToArray(path),\n inputValue,\n new GraphQLError(\n `Field \"${fieldName}\" is not defined by type \"${type.name}\".` +\n didYouMean(suggestions),\n ),\n );\n }\n }\n\n return coercedValue;\n }\n\n if (isLeafType(type)) {\n let parseResult; // Scalars and Enums determine if a input value is valid via parseValue(),\n // which can throw to indicate failure. If it throws, maintain a reference\n // to the original error.\n\n try {\n parseResult = type.parseValue(inputValue);\n } catch (error) {\n if (error instanceof GraphQLError) {\n onError(pathToArray(path), inputValue, error);\n } else {\n onError(\n pathToArray(path),\n inputValue,\n new GraphQLError(`Expected type \"${type.name}\". ` + error.message, {\n originalError: error,\n }),\n );\n }\n\n return;\n }\n\n if (parseResult === undefined) {\n onError(\n pathToArray(path),\n inputValue,\n new GraphQLError(`Expected type \"${type.name}\".`),\n );\n }\n\n return parseResult;\n }\n /* c8 ignore next 3 */\n // Not reachable, all possible types have been considered.\n\n false || invariant(false, 'Unexpected input type: ' + inspect(type));\n}\n", "import { inspect } from '../jsutils/inspect.mjs';\nimport { invariant } from '../jsutils/invariant.mjs';\nimport { keyMap } from '../jsutils/keyMap.mjs';\nimport { Kind } from '../language/kinds.mjs';\nimport {\n isInputObjectType,\n isLeafType,\n isListType,\n isNonNullType,\n} from '../type/definition.mjs';\n/**\n * Produces a JavaScript value given a GraphQL Value AST.\n *\n * A GraphQL type must be provided, which will be used to interpret different\n * GraphQL Value literals.\n *\n * Returns `undefined` when the value could not be validly coerced according to\n * the provided type.\n *\n * | GraphQL Value | JSON Value |\n * | -------------------- | ------------- |\n * | Input Object | Object |\n * | List | Array |\n * | Boolean | Boolean |\n * | String | String |\n * | Int / Float | Number |\n * | Enum Value | Unknown |\n * | NullValue | null |\n *\n */\n\nexport function valueFromAST(valueNode, type, variables) {\n if (!valueNode) {\n // When there is no node, then there is also no value.\n // Importantly, this is different from returning the value null.\n return;\n }\n\n if (valueNode.kind === Kind.VARIABLE) {\n const variableName = valueNode.name.value;\n\n if (variables == null || variables[variableName] === undefined) {\n // No valid return value.\n return;\n }\n\n const variableValue = variables[variableName];\n\n if (variableValue === null && isNonNullType(type)) {\n return; // Invalid: intentionally return no value.\n } // Note: This does no further checking that this variable is correct.\n // This assumes that this query has been validated and the variable\n // usage here is of the correct type.\n\n return variableValue;\n }\n\n if (isNonNullType(type)) {\n if (valueNode.kind === Kind.NULL) {\n return; // Invalid: intentionally return no value.\n }\n\n return valueFromAST(valueNode, type.ofType, variables);\n }\n\n if (valueNode.kind === Kind.NULL) {\n // This is explicitly returning the value null.\n return null;\n }\n\n if (isListType(type)) {\n const itemType = type.ofType;\n\n if (valueNode.kind === Kind.LIST) {\n const coercedValues = [];\n\n for (const itemNode of valueNode.values) {\n if (isMissingVariable(itemNode, variables)) {\n // If an array contains a missing variable, it is either coerced to\n // null or if the item type is non-null, it considered invalid.\n if (isNonNullType(itemType)) {\n return; // Invalid: intentionally return no value.\n }\n\n coercedValues.push(null);\n } else {\n const itemValue = valueFromAST(itemNode, itemType, variables);\n\n if (itemValue === undefined) {\n return; // Invalid: intentionally return no value.\n }\n\n coercedValues.push(itemValue);\n }\n }\n\n return coercedValues;\n }\n\n const coercedValue = valueFromAST(valueNode, itemType, variables);\n\n if (coercedValue === undefined) {\n return; // Invalid: intentionally return no value.\n }\n\n return [coercedValue];\n }\n\n if (isInputObjectType(type)) {\n if (valueNode.kind !== Kind.OBJECT) {\n return; // Invalid: intentionally return no value.\n }\n\n const coercedObj = Object.create(null);\n const fieldNodes = keyMap(valueNode.fields, (field) => field.name.value);\n\n for (const field of Object.values(type.getFields())) {\n const fieldNode = fieldNodes[field.name];\n\n if (!fieldNode || isMissingVariable(fieldNode.value, variables)) {\n if (field.defaultValue !== undefined) {\n coercedObj[field.name] = field.defaultValue;\n } else if (isNonNullType(field.type)) {\n return; // Invalid: intentionally return no value.\n }\n\n continue;\n }\n\n const fieldValue = valueFromAST(fieldNode.value, field.type, variables);\n\n if (fieldValue === undefined) {\n return; // Invalid: intentionally return no value.\n }\n\n coercedObj[field.name] = fieldValue;\n }\n\n return coercedObj;\n }\n\n if (isLeafType(type)) {\n // Scalars and Enums fulfill parsing a literal value via parseLiteral().\n // Invalid values represent a failure to parse correctly, in which case\n // no value is returned.\n let result;\n\n try {\n result = type.parseLiteral(valueNode, variables);\n } catch (_error) {\n return; // Invalid: intentionally return no value.\n }\n\n if (result === undefined) {\n return; // Invalid: intentionally return no value.\n }\n\n return result;\n }\n /* c8 ignore next 3 */\n // Not reachable, all possible input types have been considered.\n\n false || invariant(false, 'Unexpected input type: ' + inspect(type));\n} // Returns true if the provided valueNode is a variable which is not defined\n// in the set of variables.\n\nfunction isMissingVariable(valueNode, variables) {\n return (\n valueNode.kind === Kind.VARIABLE &&\n (variables == null || variables[valueNode.name.value] === undefined)\n );\n}\n", "import { inspect } from '../jsutils/inspect.mjs';\nimport { keyMap } from '../jsutils/keyMap.mjs';\nimport { printPathArray } from '../jsutils/printPathArray.mjs';\nimport { GraphQLError } from '../error/GraphQLError.mjs';\nimport { Kind } from '../language/kinds.mjs';\nimport { print } from '../language/printer.mjs';\nimport { isInputType, isNonNullType } from '../type/definition.mjs';\nimport { coerceInputValue } from '../utilities/coerceInputValue.mjs';\nimport { typeFromAST } from '../utilities/typeFromAST.mjs';\nimport { valueFromAST } from '../utilities/valueFromAST.mjs';\n\n/**\n * Prepares an object map of variableValues of the correct type based on the\n * provided variable definitions and arbitrary input. If the input cannot be\n * parsed to match the variable definitions, a GraphQLError will be thrown.\n *\n * Note: The returned value is a plain Object with a prototype, since it is\n * exposed to user code. Care should be taken to not pull values from the\n * Object prototype.\n */\nexport function getVariableValues(schema, varDefNodes, inputs, options) {\n const errors = [];\n const maxErrors =\n options === null || options === void 0 ? void 0 : options.maxErrors;\n\n try {\n const coerced = coerceVariableValues(\n schema,\n varDefNodes,\n inputs,\n (error) => {\n if (maxErrors != null && errors.length >= maxErrors) {\n throw new GraphQLError(\n 'Too many errors processing variables, error limit reached. Execution aborted.',\n );\n }\n\n errors.push(error);\n },\n );\n\n if (errors.length === 0) {\n return {\n coerced,\n };\n }\n } catch (error) {\n errors.push(error);\n }\n\n return {\n errors,\n };\n}\n\nfunction coerceVariableValues(schema, varDefNodes, inputs, onError) {\n const coercedValues = {};\n\n for (const varDefNode of varDefNodes) {\n const varName = varDefNode.variable.name.value;\n const varType = typeFromAST(schema, varDefNode.type);\n\n if (!isInputType(varType)) {\n // Must use input types for variables. This should be caught during\n // validation, however is checked again here for safety.\n const varTypeStr = print(varDefNode.type);\n onError(\n new GraphQLError(\n `Variable \"$${varName}\" expected value of type \"${varTypeStr}\" which cannot be used as an input type.`,\n {\n nodes: varDefNode.type,\n },\n ),\n );\n continue;\n }\n\n if (!hasOwnProperty(inputs, varName)) {\n if (varDefNode.defaultValue) {\n coercedValues[varName] = valueFromAST(varDefNode.defaultValue, varType);\n } else if (isNonNullType(varType)) {\n const varTypeStr = inspect(varType);\n onError(\n new GraphQLError(\n `Variable \"$${varName}\" of required type \"${varTypeStr}\" was not provided.`,\n {\n nodes: varDefNode,\n },\n ),\n );\n }\n\n continue;\n }\n\n const value = inputs[varName];\n\n if (value === null && isNonNullType(varType)) {\n const varTypeStr = inspect(varType);\n onError(\n new GraphQLError(\n `Variable \"$${varName}\" of non-null type \"${varTypeStr}\" must not be null.`,\n {\n nodes: varDefNode,\n },\n ),\n );\n continue;\n }\n\n coercedValues[varName] = coerceInputValue(\n value,\n varType,\n (path, invalidValue, error) => {\n let prefix =\n `Variable \"$${varName}\" got invalid value ` + inspect(invalidValue);\n\n if (path.length > 0) {\n prefix += ` at \"${varName}${printPathArray(path)}\"`;\n }\n\n onError(\n new GraphQLError(prefix + '; ' + error.message, {\n nodes: varDefNode,\n originalError: error,\n }),\n );\n },\n );\n }\n\n return coercedValues;\n}\n/**\n * Prepares an object map of argument values given a list of argument\n * definitions and list of argument AST nodes.\n *\n * Note: The returned value is a plain Object with a prototype, since it is\n * exposed to user code. Care should be taken to not pull values from the\n * Object prototype.\n */\n\nexport function getArgumentValues(def, node, variableValues) {\n var _node$arguments;\n\n const coercedValues = {}; // FIXME: https://github.com/graphql/graphql-js/issues/2203\n\n /* c8 ignore next */\n\n const argumentNodes =\n (_node$arguments = node.arguments) !== null && _node$arguments !== void 0\n ? _node$arguments\n : [];\n const argNodeMap = keyMap(argumentNodes, (arg) => arg.name.value);\n\n for (const argDef of def.args) {\n const name = argDef.name;\n const argType = argDef.type;\n const argumentNode = argNodeMap[name];\n\n if (!argumentNode) {\n if (argDef.defaultValue !== undefined) {\n coercedValues[name] = argDef.defaultValue;\n } else if (isNonNullType(argType)) {\n throw new GraphQLError(\n `Argument \"${name}\" of required type \"${inspect(argType)}\" ` +\n 'was not provided.',\n {\n nodes: node,\n },\n );\n }\n\n continue;\n }\n\n const valueNode = argumentNode.value;\n let isNull = valueNode.kind === Kind.NULL;\n\n if (valueNode.kind === Kind.VARIABLE) {\n const variableName = valueNode.name.value;\n\n if (\n variableValues == null ||\n !hasOwnProperty(variableValues, variableName)\n ) {\n if (argDef.defaultValue !== undefined) {\n coercedValues[name] = argDef.defaultValue;\n } else if (isNonNullType(argType)) {\n throw new GraphQLError(\n `Argument \"${name}\" of required type \"${inspect(argType)}\" ` +\n `was provided the variable \"$${variableName}\" which was not provided a runtime value.`,\n {\n nodes: valueNode,\n },\n );\n }\n\n continue;\n }\n\n isNull = variableValues[variableName] == null;\n }\n\n if (isNull && isNonNullType(argType)) {\n throw new GraphQLError(\n `Argument \"${name}\" of non-null type \"${inspect(argType)}\" ` +\n 'must not be null.',\n {\n nodes: valueNode,\n },\n );\n }\n\n const coercedValue = valueFromAST(valueNode, argType, variableValues);\n\n if (coercedValue === undefined) {\n // Note: ValuesOfCorrectTypeRule validation should catch this before\n // execution. This is a runtime check to ensure execution does not\n // continue with an invalid argument value.\n throw new GraphQLError(\n `Argument \"${name}\" has invalid value ${print(valueNode)}.`,\n {\n nodes: valueNode,\n },\n );\n }\n\n coercedValues[name] = coercedValue;\n }\n\n return coercedValues;\n}\n/**\n * Prepares an object map of argument values given a directive definition\n * and a AST node which may contain directives. Optionally also accepts a map\n * of variable values.\n *\n * If the directive does not exist on the node, returns undefined.\n *\n * Note: The returned value is a plain Object with a prototype, since it is\n * exposed to user code. Care should be taken to not pull values from the\n * Object prototype.\n */\n\nexport function getDirectiveValues(directiveDef, node, variableValues) {\n var _node$directives;\n\n const directiveNode =\n (_node$directives = node.directives) === null || _node$directives === void 0\n ? void 0\n : _node$directives.find(\n (directive) => directive.name.value === directiveDef.name,\n );\n\n if (directiveNode) {\n return getArgumentValues(directiveDef, directiveNode, variableValues);\n }\n}\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n", "import { Kind } from '../language/kinds.mjs';\nimport { isAbstractType } from '../type/definition.mjs';\nimport {\n GraphQLIncludeDirective,\n GraphQLSkipDirective,\n} from '../type/directives.mjs';\nimport { typeFromAST } from '../utilities/typeFromAST.mjs';\nimport { getDirectiveValues } from './values.mjs';\n/**\n * Given a selectionSet, collects all of the fields and returns them.\n *\n * CollectFields requires the \"runtime type\" of an object. For a field that\n * returns an Interface or Union type, the \"runtime type\" will be the actual\n * object type returned by that field.\n *\n * @internal\n */\n\nexport function collectFields(\n schema,\n fragments,\n variableValues,\n runtimeType,\n selectionSet,\n) {\n const fields = new Map();\n collectFieldsImpl(\n schema,\n fragments,\n variableValues,\n runtimeType,\n selectionSet,\n fields,\n new Set(),\n );\n return fields;\n}\n/**\n * Given an array of field nodes, collects all of the subfields of the passed\n * in fields, and returns them at the end.\n *\n * CollectSubFields requires the \"return type\" of an object. For a field that\n * returns an Interface or Union type, the \"return type\" will be the actual\n * object type returned by that field.\n *\n * @internal\n */\n\nexport function collectSubfields(\n schema,\n fragments,\n variableValues,\n returnType,\n fieldNodes,\n) {\n const subFieldNodes = new Map();\n const visitedFragmentNames = new Set();\n\n for (const node of fieldNodes) {\n if (node.selectionSet) {\n collectFieldsImpl(\n schema,\n fragments,\n variableValues,\n returnType,\n node.selectionSet,\n subFieldNodes,\n visitedFragmentNames,\n );\n }\n }\n\n return subFieldNodes;\n}\n\nfunction collectFieldsImpl(\n schema,\n fragments,\n variableValues,\n runtimeType,\n selectionSet,\n fields,\n visitedFragmentNames,\n) {\n for (const selection of selectionSet.selections) {\n switch (selection.kind) {\n case Kind.FIELD: {\n if (!shouldIncludeNode(variableValues, selection)) {\n continue;\n }\n\n const name = getFieldEntryKey(selection);\n const fieldList = fields.get(name);\n\n if (fieldList !== undefined) {\n fieldList.push(selection);\n } else {\n fields.set(name, [selection]);\n }\n\n break;\n }\n\n case Kind.INLINE_FRAGMENT: {\n if (\n !shouldIncludeNode(variableValues, selection) ||\n !doesFragmentConditionMatch(schema, selection, runtimeType)\n ) {\n continue;\n }\n\n collectFieldsImpl(\n schema,\n fragments,\n variableValues,\n runtimeType,\n selection.selectionSet,\n fields,\n visitedFragmentNames,\n );\n break;\n }\n\n case Kind.FRAGMENT_SPREAD: {\n const fragName = selection.name.value;\n\n if (\n visitedFragmentNames.has(fragName) ||\n !shouldIncludeNode(variableValues, selection)\n ) {\n continue;\n }\n\n visitedFragmentNames.add(fragName);\n const fragment = fragments[fragName];\n\n if (\n !fragment ||\n !doesFragmentConditionMatch(schema, fragment, runtimeType)\n ) {\n continue;\n }\n\n collectFieldsImpl(\n schema,\n fragments,\n variableValues,\n runtimeType,\n fragment.selectionSet,\n fields,\n visitedFragmentNames,\n );\n break;\n }\n }\n }\n}\n/**\n * Determines if a field should be included based on the `@include` and `@skip`\n * directives, where `@skip` has higher precedence than `@include`.\n */\n\nfunction shouldIncludeNode(variableValues, node) {\n const skip = getDirectiveValues(GraphQLSkipDirective, node, variableValues);\n\n if ((skip === null || skip === void 0 ? void 0 : skip.if) === true) {\n return false;\n }\n\n const include = getDirectiveValues(\n GraphQLIncludeDirective,\n node,\n variableValues,\n );\n\n if (\n (include === null || include === void 0 ? void 0 : include.if) === false\n ) {\n return false;\n }\n\n return true;\n}\n/**\n * Determines if a fragment is applicable to the given type.\n */\n\nfunction doesFragmentConditionMatch(schema, fragment, type) {\n const typeConditionNode = fragment.typeCondition;\n\n if (!typeConditionNode) {\n return true;\n }\n\n const conditionalType = typeFromAST(schema, typeConditionNode);\n\n if (conditionalType === type) {\n return true;\n }\n\n if (isAbstractType(conditionalType)) {\n return schema.isSubType(conditionalType, type);\n }\n\n return false;\n}\n/**\n * Implements the logic to compute the key of a given field's entry\n */\n\nfunction getFieldEntryKey(node) {\n return node.alias ? node.alias.value : node.name.value;\n}\n", "import { GraphQLError } from '../../error/GraphQLError.mjs';\nimport { Kind } from '../../language/kinds.mjs';\nimport { collectFields } from '../../execution/collectFields.mjs';\n\n/**\n * Subscriptions must only include a non-introspection field.\n *\n * A GraphQL subscription is valid only if it contains a single root field and\n * that root field is not an introspection field.\n *\n * See https://spec.graphql.org/draft/#sec-Single-root-field\n */\nexport function SingleFieldSubscriptionsRule(context) {\n return {\n OperationDefinition(node) {\n if (node.operation === 'subscription') {\n const schema = context.getSchema();\n const subscriptionType = schema.getSubscriptionType();\n\n if (subscriptionType) {\n const operationName = node.name ? node.name.value : null;\n const variableValues = Object.create(null);\n const document = context.getDocument();\n const fragments = Object.create(null);\n\n for (const definition of document.definitions) {\n if (definition.kind === Kind.FRAGMENT_DEFINITION) {\n fragments[definition.name.value] = definition;\n }\n }\n\n const fields = collectFields(\n schema,\n fragments,\n variableValues,\n subscriptionType,\n node.selectionSet,\n );\n\n if (fields.size > 1) {\n const fieldSelectionLists = [...fields.values()];\n const extraFieldSelectionLists = fieldSelectionLists.slice(1);\n const extraFieldSelections = extraFieldSelectionLists.flat();\n context.reportError(\n new GraphQLError(\n operationName != null\n ? `Subscription \"${operationName}\" must select only one top level field.`\n : 'Anonymous Subscription must select only one top level field.',\n {\n nodes: extraFieldSelections,\n },\n ),\n );\n }\n\n for (const fieldNodes of fields.values()) {\n const field = fieldNodes[0];\n const fieldName = field.name.value;\n\n if (fieldName.startsWith('__')) {\n context.reportError(\n new GraphQLError(\n operationName != null\n ? `Subscription \"${operationName}\" must not select an introspection top level field.`\n : 'Anonymous Subscription must not select an introspection top level field.',\n {\n nodes: fieldNodes,\n },\n ),\n );\n }\n }\n }\n }\n },\n };\n}\n", "/**\n * Groups array items into a Map, given a function to produce grouping key.\n */\nexport function groupBy(list, keyFn) {\n const result = new Map();\n\n for (const item of list) {\n const key = keyFn(item);\n const group = result.get(key);\n\n if (group === undefined) {\n result.set(key, [item]);\n } else {\n group.push(item);\n }\n }\n\n return result;\n}\n", "import { groupBy } from '../../jsutils/groupBy.mjs';\nimport { GraphQLError } from '../../error/GraphQLError.mjs';\n\n/**\n * Unique argument definition names\n *\n * A GraphQL Object or Interface type is only valid if all its fields have uniquely named arguments.\n * A GraphQL Directive is only valid if all its arguments are uniquely named.\n */\nexport function UniqueArgumentDefinitionNamesRule(context) {\n return {\n DirectiveDefinition(directiveNode) {\n var _directiveNode$argume;\n\n // FIXME: https://github.com/graphql/graphql-js/issues/2203\n\n /* c8 ignore next */\n const argumentNodes =\n (_directiveNode$argume = directiveNode.arguments) !== null &&\n _directiveNode$argume !== void 0\n ? _directiveNode$argume\n : [];\n return checkArgUniqueness(`@${directiveNode.name.value}`, argumentNodes);\n },\n\n InterfaceTypeDefinition: checkArgUniquenessPerField,\n InterfaceTypeExtension: checkArgUniquenessPerField,\n ObjectTypeDefinition: checkArgUniquenessPerField,\n ObjectTypeExtension: checkArgUniquenessPerField,\n };\n\n function checkArgUniquenessPerField(typeNode) {\n var _typeNode$fields;\n\n const typeName = typeNode.name.value; // FIXME: https://github.com/graphql/graphql-js/issues/2203\n\n /* c8 ignore next */\n\n const fieldNodes =\n (_typeNode$fields = typeNode.fields) !== null &&\n _typeNode$fields !== void 0\n ? _typeNode$fields\n : [];\n\n for (const fieldDef of fieldNodes) {\n var _fieldDef$arguments;\n\n const fieldName = fieldDef.name.value; // FIXME: https://github.com/graphql/graphql-js/issues/2203\n\n /* c8 ignore next */\n\n const argumentNodes =\n (_fieldDef$arguments = fieldDef.arguments) !== null &&\n _fieldDef$arguments !== void 0\n ? _fieldDef$arguments\n : [];\n checkArgUniqueness(`${typeName}.${fieldName}`, argumentNodes);\n }\n\n return false;\n }\n\n function checkArgUniqueness(parentName, argumentNodes) {\n const seenArgs = groupBy(argumentNodes, (arg) => arg.name.value);\n\n for (const [argName, argNodes] of seenArgs) {\n if (argNodes.length > 1) {\n context.reportError(\n new GraphQLError(\n `Argument \"${parentName}(${argName}:)\" can only be defined once.`,\n {\n nodes: argNodes.map((node) => node.name),\n },\n ),\n );\n }\n }\n\n return false;\n }\n}\n", "import { groupBy } from '../../jsutils/groupBy.mjs';\nimport { GraphQLError } from '../../error/GraphQLError.mjs';\n\n/**\n * Unique argument names\n *\n * A GraphQL field or directive is only valid if all supplied arguments are\n * uniquely named.\n *\n * See https://spec.graphql.org/draft/#sec-Argument-Names\n */\nexport function UniqueArgumentNamesRule(context) {\n return {\n Field: checkArgUniqueness,\n Directive: checkArgUniqueness,\n };\n\n function checkArgUniqueness(parentNode) {\n var _parentNode$arguments;\n\n // FIXME: https://github.com/graphql/graphql-js/issues/2203\n\n /* c8 ignore next */\n const argumentNodes =\n (_parentNode$arguments = parentNode.arguments) !== null &&\n _parentNode$arguments !== void 0\n ? _parentNode$arguments\n : [];\n const seenArgs = groupBy(argumentNodes, (arg) => arg.name.value);\n\n for (const [argName, argNodes] of seenArgs) {\n if (argNodes.length > 1) {\n context.reportError(\n new GraphQLError(\n `There can be only one argument named \"${argName}\".`,\n {\n nodes: argNodes.map((node) => node.name),\n },\n ),\n );\n }\n }\n }\n}\n", "import { GraphQLError } from '../../error/GraphQLError.mjs';\n\n/**\n * Unique directive names\n *\n * A GraphQL document is only valid if all defined directives have unique names.\n */\nexport function UniqueDirectiveNamesRule(context) {\n const knownDirectiveNames = Object.create(null);\n const schema = context.getSchema();\n return {\n DirectiveDefinition(node) {\n const directiveName = node.name.value;\n\n if (\n schema !== null &&\n schema !== void 0 &&\n schema.getDirective(directiveName)\n ) {\n context.reportError(\n new GraphQLError(\n `Directive \"@${directiveName}\" already exists in the schema. It cannot be redefined.`,\n {\n nodes: node.name,\n },\n ),\n );\n return;\n }\n\n if (knownDirectiveNames[directiveName]) {\n context.reportError(\n new GraphQLError(\n `There can be only one directive named \"@${directiveName}\".`,\n {\n nodes: [knownDirectiveNames[directiveName], node.name],\n },\n ),\n );\n } else {\n knownDirectiveNames[directiveName] = node.name;\n }\n\n return false;\n },\n };\n}\n", "import { GraphQLError } from '../../error/GraphQLError.mjs';\nimport { Kind } from '../../language/kinds.mjs';\nimport {\n isTypeDefinitionNode,\n isTypeExtensionNode,\n} from '../../language/predicates.mjs';\nimport { specifiedDirectives } from '../../type/directives.mjs';\n\n/**\n * Unique directive names per location\n *\n * A GraphQL document is only valid if all non-repeatable directives at\n * a given location are uniquely named.\n *\n * See https://spec.graphql.org/draft/#sec-Directives-Are-Unique-Per-Location\n */\nexport function UniqueDirectivesPerLocationRule(context) {\n const uniqueDirectiveMap = Object.create(null);\n const schema = context.getSchema();\n const definedDirectives = schema\n ? schema.getDirectives()\n : specifiedDirectives;\n\n for (const directive of definedDirectives) {\n uniqueDirectiveMap[directive.name] = !directive.isRepeatable;\n }\n\n const astDefinitions = context.getDocument().definitions;\n\n for (const def of astDefinitions) {\n if (def.kind === Kind.DIRECTIVE_DEFINITION) {\n uniqueDirectiveMap[def.name.value] = !def.repeatable;\n }\n }\n\n const schemaDirectives = Object.create(null);\n const typeDirectivesMap = Object.create(null);\n return {\n // Many different AST nodes may contain directives. Rather than listing\n // them all, just listen for entering any node, and check to see if it\n // defines any directives.\n enter(node) {\n if (!('directives' in node) || !node.directives) {\n return;\n }\n\n let seenDirectives;\n\n if (\n node.kind === Kind.SCHEMA_DEFINITION ||\n node.kind === Kind.SCHEMA_EXTENSION\n ) {\n seenDirectives = schemaDirectives;\n } else if (isTypeDefinitionNode(node) || isTypeExtensionNode(node)) {\n const typeName = node.name.value;\n seenDirectives = typeDirectivesMap[typeName];\n\n if (seenDirectives === undefined) {\n typeDirectivesMap[typeName] = seenDirectives = Object.create(null);\n }\n } else {\n seenDirectives = Object.create(null);\n }\n\n for (const directive of node.directives) {\n const directiveName = directive.name.value;\n\n if (uniqueDirectiveMap[directiveName]) {\n if (seenDirectives[directiveName]) {\n context.reportError(\n new GraphQLError(\n `The directive \"@${directiveName}\" can only be used once at this location.`,\n {\n nodes: [seenDirectives[directiveName], directive],\n },\n ),\n );\n } else {\n seenDirectives[directiveName] = directive;\n }\n }\n }\n },\n };\n}\n", "import { GraphQLError } from '../../error/GraphQLError.mjs';\nimport { isEnumType } from '../../type/definition.mjs';\n\n/**\n * Unique enum value names\n *\n * A GraphQL enum type is only valid if all its values are uniquely named.\n */\nexport function UniqueEnumValueNamesRule(context) {\n const schema = context.getSchema();\n const existingTypeMap = schema ? schema.getTypeMap() : Object.create(null);\n const knownValueNames = Object.create(null);\n return {\n EnumTypeDefinition: checkValueUniqueness,\n EnumTypeExtension: checkValueUniqueness,\n };\n\n function checkValueUniqueness(node) {\n var _node$values;\n\n const typeName = node.name.value;\n\n if (!knownValueNames[typeName]) {\n knownValueNames[typeName] = Object.create(null);\n } // FIXME: https://github.com/graphql/graphql-js/issues/2203\n\n /* c8 ignore next */\n\n const valueNodes =\n (_node$values = node.values) !== null && _node$values !== void 0\n ? _node$values\n : [];\n const valueNames = knownValueNames[typeName];\n\n for (const valueDef of valueNodes) {\n const valueName = valueDef.name.value;\n const existingType = existingTypeMap[typeName];\n\n if (isEnumType(existingType) && existingType.getValue(valueName)) {\n context.reportError(\n new GraphQLError(\n `Enum value \"${typeName}.${valueName}\" already exists in the schema. It cannot also be defined in this type extension.`,\n {\n nodes: valueDef.name,\n },\n ),\n );\n } else if (valueNames[valueName]) {\n context.reportError(\n new GraphQLError(\n `Enum value \"${typeName}.${valueName}\" can only be defined once.`,\n {\n nodes: [valueNames[valueName], valueDef.name],\n },\n ),\n );\n } else {\n valueNames[valueName] = valueDef.name;\n }\n }\n\n return false;\n }\n}\n", "import { GraphQLError } from '../../error/GraphQLError.mjs';\nimport {\n isInputObjectType,\n isInterfaceType,\n isObjectType,\n} from '../../type/definition.mjs';\n\n/**\n * Unique field definition names\n *\n * A GraphQL complex type is only valid if all its fields are uniquely named.\n */\nexport function UniqueFieldDefinitionNamesRule(context) {\n const schema = context.getSchema();\n const existingTypeMap = schema ? schema.getTypeMap() : Object.create(null);\n const knownFieldNames = Object.create(null);\n return {\n InputObjectTypeDefinition: checkFieldUniqueness,\n InputObjectTypeExtension: checkFieldUniqueness,\n InterfaceTypeDefinition: checkFieldUniqueness,\n InterfaceTypeExtension: checkFieldUniqueness,\n ObjectTypeDefinition: checkFieldUniqueness,\n ObjectTypeExtension: checkFieldUniqueness,\n };\n\n function checkFieldUniqueness(node) {\n var _node$fields;\n\n const typeName = node.name.value;\n\n if (!knownFieldNames[typeName]) {\n knownFieldNames[typeName] = Object.create(null);\n } // FIXME: https://github.com/graphql/graphql-js/issues/2203\n\n /* c8 ignore next */\n\n const fieldNodes =\n (_node$fields = node.fields) !== null && _node$fields !== void 0\n ? _node$fields\n : [];\n const fieldNames = knownFieldNames[typeName];\n\n for (const fieldDef of fieldNodes) {\n const fieldName = fieldDef.name.value;\n\n if (hasField(existingTypeMap[typeName], fieldName)) {\n context.reportError(\n new GraphQLError(\n `Field \"${typeName}.${fieldName}\" already exists in the schema. It cannot also be defined in this type extension.`,\n {\n nodes: fieldDef.name,\n },\n ),\n );\n } else if (fieldNames[fieldName]) {\n context.reportError(\n new GraphQLError(\n `Field \"${typeName}.${fieldName}\" can only be defined once.`,\n {\n nodes: [fieldNames[fieldName], fieldDef.name],\n },\n ),\n );\n } else {\n fieldNames[fieldName] = fieldDef.name;\n }\n }\n\n return false;\n }\n}\n\nfunction hasField(type, fieldName) {\n if (isObjectType(type) || isInterfaceType(type) || isInputObjectType(type)) {\n return type.getFields()[fieldName] != null;\n }\n\n return false;\n}\n", "import { GraphQLError } from '../../error/GraphQLError.mjs';\n\n/**\n * Unique fragment names\n *\n * A GraphQL document is only valid if all defined fragments have unique names.\n *\n * See https://spec.graphql.org/draft/#sec-Fragment-Name-Uniqueness\n */\nexport function UniqueFragmentNamesRule(context) {\n const knownFragmentNames = Object.create(null);\n return {\n OperationDefinition: () => false,\n\n FragmentDefinition(node) {\n const fragmentName = node.name.value;\n\n if (knownFragmentNames[fragmentName]) {\n context.reportError(\n new GraphQLError(\n `There can be only one fragment named \"${fragmentName}\".`,\n {\n nodes: [knownFragmentNames[fragmentName], node.name],\n },\n ),\n );\n } else {\n knownFragmentNames[fragmentName] = node.name;\n }\n\n return false;\n },\n };\n}\n", "import { invariant } from '../../jsutils/invariant.mjs';\nimport { GraphQLError } from '../../error/GraphQLError.mjs';\n\n/**\n * Unique input field names\n *\n * A GraphQL input object value is only valid if all supplied fields are\n * uniquely named.\n *\n * See https://spec.graphql.org/draft/#sec-Input-Object-Field-Uniqueness\n */\nexport function UniqueInputFieldNamesRule(context) {\n const knownNameStack = [];\n let knownNames = Object.create(null);\n return {\n ObjectValue: {\n enter() {\n knownNameStack.push(knownNames);\n knownNames = Object.create(null);\n },\n\n leave() {\n const prevKnownNames = knownNameStack.pop();\n prevKnownNames || invariant(false);\n knownNames = prevKnownNames;\n },\n },\n\n ObjectField(node) {\n const fieldName = node.name.value;\n\n if (knownNames[fieldName]) {\n context.reportError(\n new GraphQLError(\n `There can be only one input field named \"${fieldName}\".`,\n {\n nodes: [knownNames[fieldName], node.name],\n },\n ),\n );\n } else {\n knownNames[fieldName] = node.name;\n }\n },\n };\n}\n", "import { GraphQLError } from '../../error/GraphQLError.mjs';\n\n/**\n * Unique operation names\n *\n * A GraphQL document is only valid if all defined operations have unique names.\n *\n * See https://spec.graphql.org/draft/#sec-Operation-Name-Uniqueness\n */\nexport function UniqueOperationNamesRule(context) {\n const knownOperationNames = Object.create(null);\n return {\n OperationDefinition(node) {\n const operationName = node.name;\n\n if (operationName) {\n if (knownOperationNames[operationName.value]) {\n context.reportError(\n new GraphQLError(\n `There can be only one operation named \"${operationName.value}\".`,\n {\n nodes: [\n knownOperationNames[operationName.value],\n operationName,\n ],\n },\n ),\n );\n } else {\n knownOperationNames[operationName.value] = operationName;\n }\n }\n\n return false;\n },\n\n FragmentDefinition: () => false,\n };\n}\n", "import { GraphQLError } from '../../error/GraphQLError.mjs';\n\n/**\n * Unique operation types\n *\n * A GraphQL document is only valid if it has only one type per operation.\n */\nexport function UniqueOperationTypesRule(context) {\n const schema = context.getSchema();\n const definedOperationTypes = Object.create(null);\n const existingOperationTypes = schema\n ? {\n query: schema.getQueryType(),\n mutation: schema.getMutationType(),\n subscription: schema.getSubscriptionType(),\n }\n : {};\n return {\n SchemaDefinition: checkOperationTypes,\n SchemaExtension: checkOperationTypes,\n };\n\n function checkOperationTypes(node) {\n var _node$operationTypes;\n\n // See: https://github.com/graphql/graphql-js/issues/2203\n\n /* c8 ignore next */\n const operationTypesNodes =\n (_node$operationTypes = node.operationTypes) !== null &&\n _node$operationTypes !== void 0\n ? _node$operationTypes\n : [];\n\n for (const operationType of operationTypesNodes) {\n const operation = operationType.operation;\n const alreadyDefinedOperationType = definedOperationTypes[operation];\n\n if (existingOperationTypes[operation]) {\n context.reportError(\n new GraphQLError(\n `Type for ${operation} already defined in the schema. It cannot be redefined.`,\n {\n nodes: operationType,\n },\n ),\n );\n } else if (alreadyDefinedOperationType) {\n context.reportError(\n new GraphQLError(\n `There can be only one ${operation} type in schema.`,\n {\n nodes: [alreadyDefinedOperationType, operationType],\n },\n ),\n );\n } else {\n definedOperationTypes[operation] = operationType;\n }\n }\n\n return false;\n }\n}\n", "import { GraphQLError } from '../../error/GraphQLError.mjs';\n\n/**\n * Unique type names\n *\n * A GraphQL document is only valid if all defined types have unique names.\n */\nexport function UniqueTypeNamesRule(context) {\n const knownTypeNames = Object.create(null);\n const schema = context.getSchema();\n return {\n ScalarTypeDefinition: checkTypeName,\n ObjectTypeDefinition: checkTypeName,\n InterfaceTypeDefinition: checkTypeName,\n UnionTypeDefinition: checkTypeName,\n EnumTypeDefinition: checkTypeName,\n InputObjectTypeDefinition: checkTypeName,\n };\n\n function checkTypeName(node) {\n const typeName = node.name.value;\n\n if (schema !== null && schema !== void 0 && schema.getType(typeName)) {\n context.reportError(\n new GraphQLError(\n `Type \"${typeName}\" already exists in the schema. It cannot also be defined in this type definition.`,\n {\n nodes: node.name,\n },\n ),\n );\n return;\n }\n\n if (knownTypeNames[typeName]) {\n context.reportError(\n new GraphQLError(`There can be only one type named \"${typeName}\".`, {\n nodes: [knownTypeNames[typeName], node.name],\n }),\n );\n } else {\n knownTypeNames[typeName] = node.name;\n }\n\n return false;\n }\n}\n", "import { groupBy } from '../../jsutils/groupBy.mjs';\nimport { GraphQLError } from '../../error/GraphQLError.mjs';\n\n/**\n * Unique variable names\n *\n * A GraphQL operation is only valid if all its variables are uniquely named.\n */\nexport function UniqueVariableNamesRule(context) {\n return {\n OperationDefinition(operationNode) {\n var _operationNode$variab;\n\n // See: https://github.com/graphql/graphql-js/issues/2203\n\n /* c8 ignore next */\n const variableDefinitions =\n (_operationNode$variab = operationNode.variableDefinitions) !== null &&\n _operationNode$variab !== void 0\n ? _operationNode$variab\n : [];\n const seenVariableDefinitions = groupBy(\n variableDefinitions,\n (node) => node.variable.name.value,\n );\n\n for (const [variableName, variableNodes] of seenVariableDefinitions) {\n if (variableNodes.length > 1) {\n context.reportError(\n new GraphQLError(\n `There can be only one variable named \"$${variableName}\".`,\n {\n nodes: variableNodes.map((node) => node.variable.name),\n },\n ),\n );\n }\n }\n },\n };\n}\n", "import { didYouMean } from '../../jsutils/didYouMean.mjs';\nimport { inspect } from '../../jsutils/inspect.mjs';\nimport { keyMap } from '../../jsutils/keyMap.mjs';\nimport { suggestionList } from '../../jsutils/suggestionList.mjs';\nimport { GraphQLError } from '../../error/GraphQLError.mjs';\nimport { print } from '../../language/printer.mjs';\nimport {\n getNamedType,\n getNullableType,\n isInputObjectType,\n isLeafType,\n isListType,\n isNonNullType,\n isRequiredInputField,\n} from '../../type/definition.mjs';\n\n/**\n * Value literals of correct type\n *\n * A GraphQL document is only valid if all value literals are of the type\n * expected at their position.\n *\n * See https://spec.graphql.org/draft/#sec-Values-of-Correct-Type\n */\nexport function ValuesOfCorrectTypeRule(context) {\n return {\n ListValue(node) {\n // Note: TypeInfo will traverse into a list's item type, so look to the\n // parent input type to check if it is a list.\n const type = getNullableType(context.getParentInputType());\n\n if (!isListType(type)) {\n isValidValueNode(context, node);\n return false; // Don't traverse further.\n }\n },\n\n ObjectValue(node) {\n const type = getNamedType(context.getInputType());\n\n if (!isInputObjectType(type)) {\n isValidValueNode(context, node);\n return false; // Don't traverse further.\n } // Ensure every required field exists.\n\n const fieldNodeMap = keyMap(node.fields, (field) => field.name.value);\n\n for (const fieldDef of Object.values(type.getFields())) {\n const fieldNode = fieldNodeMap[fieldDef.name];\n\n if (!fieldNode && isRequiredInputField(fieldDef)) {\n const typeStr = inspect(fieldDef.type);\n context.reportError(\n new GraphQLError(\n `Field \"${type.name}.${fieldDef.name}\" of required type \"${typeStr}\" was not provided.`,\n {\n nodes: node,\n },\n ),\n );\n }\n }\n },\n\n ObjectField(node) {\n const parentType = getNamedType(context.getParentInputType());\n const fieldType = context.getInputType();\n\n if (!fieldType && isInputObjectType(parentType)) {\n const suggestions = suggestionList(\n node.name.value,\n Object.keys(parentType.getFields()),\n );\n context.reportError(\n new GraphQLError(\n `Field \"${node.name.value}\" is not defined by type \"${parentType.name}\".` +\n didYouMean(suggestions),\n {\n nodes: node,\n },\n ),\n );\n }\n },\n\n NullValue(node) {\n const type = context.getInputType();\n\n if (isNonNullType(type)) {\n context.reportError(\n new GraphQLError(\n `Expected value of type \"${inspect(type)}\", found ${print(node)}.`,\n {\n nodes: node,\n },\n ),\n );\n }\n },\n\n EnumValue: (node) => isValidValueNode(context, node),\n IntValue: (node) => isValidValueNode(context, node),\n FloatValue: (node) => isValidValueNode(context, node),\n StringValue: (node) => isValidValueNode(context, node),\n BooleanValue: (node) => isValidValueNode(context, node),\n };\n}\n/**\n * Any value literal may be a valid representation of a Scalar, depending on\n * that scalar type.\n */\n\nfunction isValidValueNode(context, node) {\n // Report any error at the full type expected by the location.\n const locationType = context.getInputType();\n\n if (!locationType) {\n return;\n }\n\n const type = getNamedType(locationType);\n\n if (!isLeafType(type)) {\n const typeStr = inspect(locationType);\n context.reportError(\n new GraphQLError(\n `Expected value of type \"${typeStr}\", found ${print(node)}.`,\n {\n nodes: node,\n },\n ),\n );\n return;\n } // Scalars and Enums determine if a literal value is valid via parseLiteral(),\n // which may throw or return an invalid value to indicate failure.\n\n try {\n const parseResult = type.parseLiteral(\n node,\n undefined,\n /* variables */\n );\n\n if (parseResult === undefined) {\n const typeStr = inspect(locationType);\n context.reportError(\n new GraphQLError(\n `Expected value of type \"${typeStr}\", found ${print(node)}.`,\n {\n nodes: node,\n },\n ),\n );\n }\n } catch (error) {\n const typeStr = inspect(locationType);\n\n if (error instanceof GraphQLError) {\n context.reportError(error);\n } else {\n context.reportError(\n new GraphQLError(\n `Expected value of type \"${typeStr}\", found ${print(node)}; ` +\n error.message,\n {\n nodes: node,\n originalError: error,\n },\n ),\n );\n }\n }\n}\n", "import { GraphQLError } from '../../error/GraphQLError.mjs';\nimport { print } from '../../language/printer.mjs';\nimport { isInputType } from '../../type/definition.mjs';\nimport { typeFromAST } from '../../utilities/typeFromAST.mjs';\n\n/**\n * Variables are input types\n *\n * A GraphQL operation is only valid if all the variables it defines are of\n * input types (scalar, enum, or input object).\n *\n * See https://spec.graphql.org/draft/#sec-Variables-Are-Input-Types\n */\nexport function VariablesAreInputTypesRule(context) {\n return {\n VariableDefinition(node) {\n const type = typeFromAST(context.getSchema(), node.type);\n\n if (type !== undefined && !isInputType(type)) {\n const variableName = node.variable.name.value;\n const typeName = print(node.type);\n context.reportError(\n new GraphQLError(\n `Variable \"$${variableName}\" cannot be non-input type \"${typeName}\".`,\n {\n nodes: node.type,\n },\n ),\n );\n }\n },\n };\n}\n", "import { inspect } from '../../jsutils/inspect.mjs';\nimport { GraphQLError } from '../../error/GraphQLError.mjs';\nimport { Kind } from '../../language/kinds.mjs';\nimport { isNonNullType } from '../../type/definition.mjs';\nimport { isTypeSubTypeOf } from '../../utilities/typeComparators.mjs';\nimport { typeFromAST } from '../../utilities/typeFromAST.mjs';\n\n/**\n * Variables in allowed position\n *\n * Variable usages must be compatible with the arguments they are passed to.\n *\n * See https://spec.graphql.org/draft/#sec-All-Variable-Usages-are-Allowed\n */\nexport function VariablesInAllowedPositionRule(context) {\n let varDefMap = Object.create(null);\n return {\n OperationDefinition: {\n enter() {\n varDefMap = Object.create(null);\n },\n\n leave(operation) {\n const usages = context.getRecursiveVariableUsages(operation);\n\n for (const { node, type, defaultValue } of usages) {\n const varName = node.name.value;\n const varDef = varDefMap[varName];\n\n if (varDef && type) {\n // A var type is allowed if it is the same or more strict (e.g. is\n // a subtype of) than the expected type. It can be more strict if\n // the variable type is non-null when the expected type is nullable.\n // If both are list types, the variable item type can be more strict\n // than the expected item type (contravariant).\n const schema = context.getSchema();\n const varType = typeFromAST(schema, varDef.type);\n\n if (\n varType &&\n !allowedVariableUsage(\n schema,\n varType,\n varDef.defaultValue,\n type,\n defaultValue,\n )\n ) {\n const varTypeStr = inspect(varType);\n const typeStr = inspect(type);\n context.reportError(\n new GraphQLError(\n `Variable \"$${varName}\" of type \"${varTypeStr}\" used in position expecting type \"${typeStr}\".`,\n {\n nodes: [varDef, node],\n },\n ),\n );\n }\n }\n }\n },\n },\n\n VariableDefinition(node) {\n varDefMap[node.variable.name.value] = node;\n },\n };\n}\n/**\n * Returns true if the variable is allowed in the location it was found,\n * which includes considering if default values exist for either the variable\n * or the location at which it is located.\n */\n\nfunction allowedVariableUsage(\n schema,\n varType,\n varDefaultValue,\n locationType,\n locationDefaultValue,\n) {\n if (isNonNullType(locationType) && !isNonNullType(varType)) {\n const hasNonNullVariableDefaultValue =\n varDefaultValue != null && varDefaultValue.kind !== Kind.NULL;\n const hasLocationDefaultValue = locationDefaultValue !== undefined;\n\n if (!hasNonNullVariableDefaultValue && !hasLocationDefaultValue) {\n return false;\n }\n\n const nullableLocationType = locationType.ofType;\n return isTypeSubTypeOf(schema, varType, nullableLocationType);\n }\n\n return isTypeSubTypeOf(schema, varType, locationType);\n}\n", "// Spec Section: \"Executable Definitions\"\nimport { ExecutableDefinitionsRule } from './rules/ExecutableDefinitionsRule.mjs'; // Spec Section: \"Field Selections on Objects, Interfaces, and Unions Types\"\n\nimport { FieldsOnCorrectTypeRule } from './rules/FieldsOnCorrectTypeRule.mjs'; // Spec Section: \"Fragments on Composite Types\"\n\nimport { FragmentsOnCompositeTypesRule } from './rules/FragmentsOnCompositeTypesRule.mjs'; // Spec Section: \"Argument Names\"\n\nimport {\n KnownArgumentNamesOnDirectivesRule,\n KnownArgumentNamesRule,\n} from './rules/KnownArgumentNamesRule.mjs'; // Spec Section: \"Directives Are Defined\"\n\nimport { KnownDirectivesRule } from './rules/KnownDirectivesRule.mjs'; // Spec Section: \"Fragment spread target defined\"\n\nimport { KnownFragmentNamesRule } from './rules/KnownFragmentNamesRule.mjs'; // Spec Section: \"Fragment Spread Type Existence\"\n\nimport { KnownTypeNamesRule } from './rules/KnownTypeNamesRule.mjs'; // Spec Section: \"Lone Anonymous Operation\"\n\nimport { LoneAnonymousOperationRule } from './rules/LoneAnonymousOperationRule.mjs'; // SDL-specific validation rules\n\nimport { LoneSchemaDefinitionRule } from './rules/LoneSchemaDefinitionRule.mjs'; // Spec Section: \"Fragments must not form cycles\"\n\nimport { NoFragmentCyclesRule } from './rules/NoFragmentCyclesRule.mjs'; // Spec Section: \"All Variable Used Defined\"\n\nimport { NoUndefinedVariablesRule } from './rules/NoUndefinedVariablesRule.mjs'; // Spec Section: \"Fragments must be used\"\n\nimport { NoUnusedFragmentsRule } from './rules/NoUnusedFragmentsRule.mjs'; // Spec Section: \"All Variables Used\"\n\nimport { NoUnusedVariablesRule } from './rules/NoUnusedVariablesRule.mjs'; // Spec Section: \"Field Selection Merging\"\n\nimport { OverlappingFieldsCanBeMergedRule } from './rules/OverlappingFieldsCanBeMergedRule.mjs'; // Spec Section: \"Fragment spread is possible\"\n\nimport { PossibleFragmentSpreadsRule } from './rules/PossibleFragmentSpreadsRule.mjs';\nimport { PossibleTypeExtensionsRule } from './rules/PossibleTypeExtensionsRule.mjs'; // Spec Section: \"Argument Optionality\"\n\nimport {\n ProvidedRequiredArgumentsOnDirectivesRule,\n ProvidedRequiredArgumentsRule,\n} from './rules/ProvidedRequiredArgumentsRule.mjs'; // Spec Section: \"Leaf Field Selections\"\n\nimport { ScalarLeafsRule } from './rules/ScalarLeafsRule.mjs'; // Spec Section: \"Subscriptions with Single Root Field\"\n\nimport { SingleFieldSubscriptionsRule } from './rules/SingleFieldSubscriptionsRule.mjs';\nimport { UniqueArgumentDefinitionNamesRule } from './rules/UniqueArgumentDefinitionNamesRule.mjs'; // Spec Section: \"Argument Uniqueness\"\n\nimport { UniqueArgumentNamesRule } from './rules/UniqueArgumentNamesRule.mjs';\nimport { UniqueDirectiveNamesRule } from './rules/UniqueDirectiveNamesRule.mjs'; // Spec Section: \"Directives Are Unique Per Location\"\n\nimport { UniqueDirectivesPerLocationRule } from './rules/UniqueDirectivesPerLocationRule.mjs';\nimport { UniqueEnumValueNamesRule } from './rules/UniqueEnumValueNamesRule.mjs';\nimport { UniqueFieldDefinitionNamesRule } from './rules/UniqueFieldDefinitionNamesRule.mjs'; // Spec Section: \"Fragment Name Uniqueness\"\n\nimport { UniqueFragmentNamesRule } from './rules/UniqueFragmentNamesRule.mjs'; // Spec Section: \"Input Object Field Uniqueness\"\n\nimport { UniqueInputFieldNamesRule } from './rules/UniqueInputFieldNamesRule.mjs'; // Spec Section: \"Operation Name Uniqueness\"\n\nimport { UniqueOperationNamesRule } from './rules/UniqueOperationNamesRule.mjs';\nimport { UniqueOperationTypesRule } from './rules/UniqueOperationTypesRule.mjs';\nimport { UniqueTypeNamesRule } from './rules/UniqueTypeNamesRule.mjs'; // Spec Section: \"Variable Uniqueness\"\n\nimport { UniqueVariableNamesRule } from './rules/UniqueVariableNamesRule.mjs'; // Spec Section: \"Value Type Correctness\"\n\nimport { ValuesOfCorrectTypeRule } from './rules/ValuesOfCorrectTypeRule.mjs'; // Spec Section: \"Variables are Input Types\"\n\nimport { VariablesAreInputTypesRule } from './rules/VariablesAreInputTypesRule.mjs'; // Spec Section: \"All Variable Usages Are Allowed\"\n\nimport { VariablesInAllowedPositionRule } from './rules/VariablesInAllowedPositionRule.mjs';\n\n/**\n * This set includes all validation rules defined by the GraphQL spec.\n *\n * The order of the rules in this list has been adjusted to lead to the\n * most clear output when encountering multiple validation errors.\n */\nexport const specifiedRules = Object.freeze([\n ExecutableDefinitionsRule,\n UniqueOperationNamesRule,\n LoneAnonymousOperationRule,\n SingleFieldSubscriptionsRule,\n KnownTypeNamesRule,\n FragmentsOnCompositeTypesRule,\n VariablesAreInputTypesRule,\n ScalarLeafsRule,\n FieldsOnCorrectTypeRule,\n UniqueFragmentNamesRule,\n KnownFragmentNamesRule,\n NoUnusedFragmentsRule,\n PossibleFragmentSpreadsRule,\n NoFragmentCyclesRule,\n UniqueVariableNamesRule,\n NoUndefinedVariablesRule,\n NoUnusedVariablesRule,\n KnownDirectivesRule,\n UniqueDirectivesPerLocationRule,\n KnownArgumentNamesRule,\n UniqueArgumentNamesRule,\n ValuesOfCorrectTypeRule,\n ProvidedRequiredArgumentsRule,\n VariablesInAllowedPositionRule,\n OverlappingFieldsCanBeMergedRule,\n UniqueInputFieldNamesRule,\n]);\n/**\n * @internal\n */\n\nexport const specifiedSDLRules = Object.freeze([\n LoneSchemaDefinitionRule,\n UniqueOperationTypesRule,\n UniqueTypeNamesRule,\n UniqueEnumValueNamesRule,\n UniqueFieldDefinitionNamesRule,\n UniqueArgumentDefinitionNamesRule,\n UniqueDirectiveNamesRule,\n KnownTypeNamesRule,\n KnownDirectivesRule,\n UniqueDirectivesPerLocationRule,\n PossibleTypeExtensionsRule,\n KnownArgumentNamesOnDirectivesRule,\n UniqueArgumentNamesRule,\n UniqueInputFieldNamesRule,\n ProvidedRequiredArgumentsOnDirectivesRule,\n]);\n", "import { Kind } from '../language/kinds.mjs';\nimport { visit } from '../language/visitor.mjs';\nimport { TypeInfo, visitWithTypeInfo } from '../utilities/TypeInfo.mjs';\n\n/**\n * An instance of this class is passed as the \"this\" context to all validators,\n * allowing access to commonly useful contextual information from within a\n * validation rule.\n */\nexport class ASTValidationContext {\n constructor(ast, onError) {\n this._ast = ast;\n this._fragments = undefined;\n this._fragmentSpreads = new Map();\n this._recursivelyReferencedFragments = new Map();\n this._onError = onError;\n }\n\n get [Symbol.toStringTag]() {\n return 'ASTValidationContext';\n }\n\n reportError(error) {\n this._onError(error);\n }\n\n getDocument() {\n return this._ast;\n }\n\n getFragment(name) {\n let fragments;\n\n if (this._fragments) {\n fragments = this._fragments;\n } else {\n fragments = Object.create(null);\n\n for (const defNode of this.getDocument().definitions) {\n if (defNode.kind === Kind.FRAGMENT_DEFINITION) {\n fragments[defNode.name.value] = defNode;\n }\n }\n\n this._fragments = fragments;\n }\n\n return fragments[name];\n }\n\n getFragmentSpreads(node) {\n let spreads = this._fragmentSpreads.get(node);\n\n if (!spreads) {\n spreads = [];\n const setsToVisit = [node];\n let set;\n\n while ((set = setsToVisit.pop())) {\n for (const selection of set.selections) {\n if (selection.kind === Kind.FRAGMENT_SPREAD) {\n spreads.push(selection);\n } else if (selection.selectionSet) {\n setsToVisit.push(selection.selectionSet);\n }\n }\n }\n\n this._fragmentSpreads.set(node, spreads);\n }\n\n return spreads;\n }\n\n getRecursivelyReferencedFragments(operation) {\n let fragments = this._recursivelyReferencedFragments.get(operation);\n\n if (!fragments) {\n fragments = [];\n const collectedNames = Object.create(null);\n const nodesToVisit = [operation.selectionSet];\n let node;\n\n while ((node = nodesToVisit.pop())) {\n for (const spread of this.getFragmentSpreads(node)) {\n const fragName = spread.name.value;\n\n if (collectedNames[fragName] !== true) {\n collectedNames[fragName] = true;\n const fragment = this.getFragment(fragName);\n\n if (fragment) {\n fragments.push(fragment);\n nodesToVisit.push(fragment.selectionSet);\n }\n }\n }\n }\n\n this._recursivelyReferencedFragments.set(operation, fragments);\n }\n\n return fragments;\n }\n}\nexport class SDLValidationContext extends ASTValidationContext {\n constructor(ast, schema, onError) {\n super(ast, onError);\n this._schema = schema;\n }\n\n get [Symbol.toStringTag]() {\n return 'SDLValidationContext';\n }\n\n getSchema() {\n return this._schema;\n }\n}\nexport class ValidationContext extends ASTValidationContext {\n constructor(schema, ast, typeInfo, onError) {\n super(ast, onError);\n this._schema = schema;\n this._typeInfo = typeInfo;\n this._variableUsages = new Map();\n this._recursiveVariableUsages = new Map();\n }\n\n get [Symbol.toStringTag]() {\n return 'ValidationContext';\n }\n\n getSchema() {\n return this._schema;\n }\n\n getVariableUsages(node) {\n let usages = this._variableUsages.get(node);\n\n if (!usages) {\n const newUsages = [];\n const typeInfo = new TypeInfo(this._schema);\n visit(\n node,\n visitWithTypeInfo(typeInfo, {\n VariableDefinition: () => false,\n\n Variable(variable) {\n newUsages.push({\n node: variable,\n type: typeInfo.getInputType(),\n defaultValue: typeInfo.getDefaultValue(),\n });\n },\n }),\n );\n usages = newUsages;\n\n this._variableUsages.set(node, usages);\n }\n\n return usages;\n }\n\n getRecursiveVariableUsages(operation) {\n let usages = this._recursiveVariableUsages.get(operation);\n\n if (!usages) {\n usages = this.getVariableUsages(operation);\n\n for (const frag of this.getRecursivelyReferencedFragments(operation)) {\n usages = usages.concat(this.getVariableUsages(frag));\n }\n\n this._recursiveVariableUsages.set(operation, usages);\n }\n\n return usages;\n }\n\n getType() {\n return this._typeInfo.getType();\n }\n\n getParentType() {\n return this._typeInfo.getParentType();\n }\n\n getInputType() {\n return this._typeInfo.getInputType();\n }\n\n getParentInputType() {\n return this._typeInfo.getParentInputType();\n }\n\n getFieldDef() {\n return this._typeInfo.getFieldDef();\n }\n\n getDirective() {\n return this._typeInfo.getDirective();\n }\n\n getArgument() {\n return this._typeInfo.getArgument();\n }\n\n getEnumValue() {\n return this._typeInfo.getEnumValue();\n }\n}\n", "import { devAssert } from '../jsutils/devAssert.mjs';\nimport { GraphQLError } from '../error/GraphQLError.mjs';\nimport { visit, visitInParallel } from '../language/visitor.mjs';\nimport { assertValidSchema } from '../type/validate.mjs';\nimport { TypeInfo, visitWithTypeInfo } from '../utilities/TypeInfo.mjs';\nimport { specifiedRules, specifiedSDLRules } from './specifiedRules.mjs';\nimport {\n SDLValidationContext,\n ValidationContext,\n} from './ValidationContext.mjs';\n/**\n * Implements the \"Validation\" section of the spec.\n *\n * Validation runs synchronously, returning an array of encountered errors, or\n * an empty array if no errors were encountered and the document is valid.\n *\n * A list of specific validation rules may be provided. If not provided, the\n * default list of rules defined by the GraphQL specification will be used.\n *\n * Each validation rules is a function which returns a visitor\n * (see the language/visitor API). Visitor methods are expected to return\n * GraphQLErrors, or Arrays of GraphQLErrors when invalid.\n *\n * Validate will stop validation after a `maxErrors` limit has been reached.\n * Attackers can send pathologically invalid queries to induce a DoS attack,\n * so by default `maxErrors` set to 100 errors.\n *\n * Optionally a custom TypeInfo instance may be provided. If not provided, one\n * will be created from the provided schema.\n */\n\nexport function validate(\n schema,\n documentAST,\n rules = specifiedRules,\n options,\n /** @deprecated will be removed in 17.0.0 */\n typeInfo = new TypeInfo(schema),\n) {\n var _options$maxErrors;\n\n const maxErrors =\n (_options$maxErrors =\n options === null || options === void 0 ? void 0 : options.maxErrors) !==\n null && _options$maxErrors !== void 0\n ? _options$maxErrors\n : 100;\n documentAST || devAssert(false, 'Must provide document.'); // If the schema used for validation is invalid, throw an error.\n\n assertValidSchema(schema);\n const abortObj = Object.freeze({});\n const errors = [];\n const context = new ValidationContext(\n schema,\n documentAST,\n typeInfo,\n (error) => {\n if (errors.length >= maxErrors) {\n errors.push(\n new GraphQLError(\n 'Too many validation errors, error limit reached. Validation aborted.',\n ),\n ); // eslint-disable-next-line @typescript-eslint/no-throw-literal\n\n throw abortObj;\n }\n\n errors.push(error);\n },\n ); // This uses a specialized visitor which runs multiple visitors in parallel,\n // while maintaining the visitor skip and break API.\n\n const visitor = visitInParallel(rules.map((rule) => rule(context))); // Visit the whole document with each instance of all provided rules.\n\n try {\n visit(documentAST, visitWithTypeInfo(typeInfo, visitor));\n } catch (e) {\n if (e !== abortObj) {\n throw e;\n }\n }\n\n return errors;\n}\n/**\n * @internal\n */\n\nexport function validateSDL(\n documentAST,\n schemaToExtend,\n rules = specifiedSDLRules,\n) {\n const errors = [];\n const context = new SDLValidationContext(\n documentAST,\n schemaToExtend,\n (error) => {\n errors.push(error);\n },\n );\n const visitors = rules.map((rule) => rule(context));\n visit(documentAST, visitInParallel(visitors));\n return errors;\n}\n/**\n * Utility function which asserts a SDL document is valid by throwing an error\n * if it is invalid.\n *\n * @internal\n */\n\nexport function assertValidSDL(documentAST) {\n const errors = validateSDL(documentAST);\n\n if (errors.length !== 0) {\n throw new Error(errors.map((error) => error.message).join('\\n\\n'));\n }\n}\n/**\n * Utility function which asserts a SDL document is valid by throwing an error\n * if it is invalid.\n *\n * @internal\n */\n\nexport function assertValidSDLExtension(documentAST, schema) {\n const errors = validateSDL(documentAST, schema);\n\n if (errors.length !== 0) {\n throw new Error(errors.map((error) => error.message).join('\\n\\n'));\n }\n}\n", "/**\n * Memoizes the provided three-argument function.\n */\nexport function memoize3(fn) {\n let cache0;\n return function memoized(a1, a2, a3) {\n if (cache0 === undefined) {\n cache0 = new WeakMap();\n }\n\n let cache1 = cache0.get(a1);\n\n if (cache1 === undefined) {\n cache1 = new WeakMap();\n cache0.set(a1, cache1);\n }\n\n let cache2 = cache1.get(a2);\n\n if (cache2 === undefined) {\n cache2 = new WeakMap();\n cache1.set(a2, cache2);\n }\n\n let fnResult = cache2.get(a3);\n\n if (fnResult === undefined) {\n fnResult = fn(a1, a2, a3);\n cache2.set(a3, fnResult);\n }\n\n return fnResult;\n };\n}\n", "/**\n * This function transforms a JS object `ObjMap>` into\n * a `Promise>`\n *\n * This is akin to bluebird's `Promise.props`, but implemented only using\n * `Promise.all` so it will work with any implementation of ES6 promises.\n */\nexport function promiseForObject(object) {\n return Promise.all(Object.values(object)).then((resolvedValues) => {\n const resolvedObject = Object.create(null);\n\n for (const [i, key] of Object.keys(object).entries()) {\n resolvedObject[key] = resolvedValues[i];\n }\n\n return resolvedObject;\n });\n}\n", "import { isPromise } from './isPromise.mjs';\n\n/**\n * Similar to Array.prototype.reduce(), however the reducing callback may return\n * a Promise, in which case reduction will continue after each promise resolves.\n *\n * If the callback does not return a Promise, then this function will also not\n * return a Promise.\n */\nexport function promiseReduce(values, callbackFn, initialValue) {\n let accumulator = initialValue;\n\n for (const value of values) {\n accumulator = isPromise(accumulator)\n ? accumulator.then((resolved) => callbackFn(resolved, value))\n : callbackFn(accumulator, value);\n }\n\n return accumulator;\n}\n", "import { inspect } from './inspect.mjs';\n/**\n * Sometimes a non-error is thrown, wrap it as an Error instance to ensure a consistent Error interface.\n */\n\nexport function toError(thrownValue) {\n return thrownValue instanceof Error\n ? thrownValue\n : new NonErrorThrown(thrownValue);\n}\n\nclass NonErrorThrown extends Error {\n constructor(thrownValue) {\n super('Unexpected error value: ' + inspect(thrownValue));\n this.name = 'NonErrorThrown';\n this.thrownValue = thrownValue;\n }\n}\n", "import { toError } from '../jsutils/toError.mjs';\nimport { GraphQLError } from './GraphQLError.mjs';\n/**\n * Given an arbitrary value, presumably thrown while attempting to execute a\n * GraphQL operation, produce a new GraphQLError aware of the location in the\n * document responsible for the original Error.\n */\n\nexport function locatedError(rawOriginalError, nodes, path) {\n var _nodes;\n\n const originalError = toError(rawOriginalError); // Note: this uses a brand-check to support GraphQL errors originating from other contexts.\n\n if (isLocatedGraphQLError(originalError)) {\n return originalError;\n }\n\n return new GraphQLError(originalError.message, {\n nodes:\n (_nodes = originalError.nodes) !== null && _nodes !== void 0\n ? _nodes\n : nodes,\n source: originalError.source,\n positions: originalError.positions,\n path,\n originalError,\n });\n}\n\nfunction isLocatedGraphQLError(error) {\n return Array.isArray(error.path);\n}\n", "import { devAssert } from '../jsutils/devAssert.mjs';\nimport { inspect } from '../jsutils/inspect.mjs';\nimport { invariant } from '../jsutils/invariant.mjs';\nimport { isIterableObject } from '../jsutils/isIterableObject.mjs';\nimport { isObjectLike } from '../jsutils/isObjectLike.mjs';\nimport { isPromise } from '../jsutils/isPromise.mjs';\nimport { memoize3 } from '../jsutils/memoize3.mjs';\nimport { addPath, pathToArray } from '../jsutils/Path.mjs';\nimport { promiseForObject } from '../jsutils/promiseForObject.mjs';\nimport { promiseReduce } from '../jsutils/promiseReduce.mjs';\nimport { GraphQLError } from '../error/GraphQLError.mjs';\nimport { locatedError } from '../error/locatedError.mjs';\nimport { OperationTypeNode } from '../language/ast.mjs';\nimport { Kind } from '../language/kinds.mjs';\nimport {\n isAbstractType,\n isLeafType,\n isListType,\n isNonNullType,\n isObjectType,\n} from '../type/definition.mjs';\nimport {\n SchemaMetaFieldDef,\n TypeMetaFieldDef,\n TypeNameMetaFieldDef,\n} from '../type/introspection.mjs';\nimport { assertValidSchema } from '../type/validate.mjs';\nimport {\n collectFields,\n collectSubfields as _collectSubfields,\n} from './collectFields.mjs';\nimport { getArgumentValues, getVariableValues } from './values.mjs';\n/**\n * A memoized collection of relevant subfields with regard to the return\n * type. Memoizing ensures the subfields are not repeatedly calculated, which\n * saves overhead when resolving lists of values.\n */\n\nconst collectSubfields = memoize3((exeContext, returnType, fieldNodes) =>\n _collectSubfields(\n exeContext.schema,\n exeContext.fragments,\n exeContext.variableValues,\n returnType,\n fieldNodes,\n ),\n);\n/**\n * Terminology\n *\n * \"Definitions\" are the generic name for top-level statements in the document.\n * Examples of this include:\n * 1) Operations (such as a query)\n * 2) Fragments\n *\n * \"Operations\" are a generic name for requests in the document.\n * Examples of this include:\n * 1) query,\n * 2) mutation\n *\n * \"Selections\" are the definitions that can appear legally and at\n * single level of the query. These include:\n * 1) field references e.g `a`\n * 2) fragment \"spreads\" e.g. `...c`\n * 3) inline fragment \"spreads\" e.g. `...on Type { a }`\n */\n\n/**\n * Data that must be available at all points during query execution.\n *\n * Namely, schema of the type system that is currently executing,\n * and the fragments defined in the query document\n */\n\n/**\n * Implements the \"Executing requests\" section of the GraphQL specification.\n *\n * Returns either a synchronous ExecutionResult (if all encountered resolvers\n * are synchronous), or a Promise of an ExecutionResult that will eventually be\n * resolved and never rejected.\n *\n * If the arguments to this function do not result in a legal execution context,\n * a GraphQLError will be thrown immediately explaining the invalid input.\n */\nexport function execute(args) {\n // Temporary for v15 to v16 migration. Remove in v17\n arguments.length < 2 ||\n devAssert(\n false,\n 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.',\n );\n const { schema, document, variableValues, rootValue } = args; // If arguments are missing or incorrect, throw an error.\n\n assertValidExecutionArguments(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments,\n // a \"Response\" with only errors is returned.\n\n const exeContext = buildExecutionContext(args); // Return early errors if execution context failed.\n\n if (!('schema' in exeContext)) {\n return {\n errors: exeContext,\n };\n } // Return a Promise that will eventually resolve to the data described by\n // The \"Response\" section of the GraphQL specification.\n //\n // If errors are encountered while executing a GraphQL field, only that\n // field and its descendants will be omitted, and sibling fields will still\n // be executed. An execution which encounters errors will still result in a\n // resolved Promise.\n //\n // Errors from sub-fields of a NonNull type may propagate to the top level,\n // at which point we still log the error and null the parent field, which\n // in this case is the entire response.\n\n try {\n const { operation } = exeContext;\n const result = executeOperation(exeContext, operation, rootValue);\n\n if (isPromise(result)) {\n return result.then(\n (data) => buildResponse(data, exeContext.errors),\n (error) => {\n exeContext.errors.push(error);\n return buildResponse(null, exeContext.errors);\n },\n );\n }\n\n return buildResponse(result, exeContext.errors);\n } catch (error) {\n exeContext.errors.push(error);\n return buildResponse(null, exeContext.errors);\n }\n}\n/**\n * Also implements the \"Executing requests\" section of the GraphQL specification.\n * However, it guarantees to complete synchronously (or throw an error) assuming\n * that all field resolvers are also synchronous.\n */\n\nexport function executeSync(args) {\n const result = execute(args); // Assert that the execution was synchronous.\n\n if (isPromise(result)) {\n throw new Error('GraphQL execution failed to complete synchronously.');\n }\n\n return result;\n}\n/**\n * Given a completed execution context and data, build the `{ errors, data }`\n * response defined by the \"Response\" section of the GraphQL specification.\n */\n\nfunction buildResponse(data, errors) {\n return errors.length === 0\n ? {\n data,\n }\n : {\n errors,\n data,\n };\n}\n/**\n * Essential assertions before executing to provide developer feedback for\n * improper use of the GraphQL library.\n *\n * @internal\n */\n\nexport function assertValidExecutionArguments(\n schema,\n document,\n rawVariableValues,\n) {\n document || devAssert(false, 'Must provide document.'); // If the schema used for execution is invalid, throw an error.\n\n assertValidSchema(schema); // Variables, if provided, must be an object.\n\n rawVariableValues == null ||\n isObjectLike(rawVariableValues) ||\n devAssert(\n false,\n 'Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.',\n );\n}\n/**\n * Constructs a ExecutionContext object from the arguments passed to\n * execute, which we will pass throughout the other execution methods.\n *\n * Throws a GraphQLError if a valid execution context cannot be created.\n *\n * @internal\n */\n\nexport function buildExecutionContext(args) {\n var _definition$name, _operation$variableDe;\n\n const {\n schema,\n document,\n rootValue,\n contextValue,\n variableValues: rawVariableValues,\n operationName,\n fieldResolver,\n typeResolver,\n subscribeFieldResolver,\n } = args;\n let operation;\n const fragments = Object.create(null);\n\n for (const definition of document.definitions) {\n switch (definition.kind) {\n case Kind.OPERATION_DEFINITION:\n if (operationName == null) {\n if (operation !== undefined) {\n return [\n new GraphQLError(\n 'Must provide operation name if query contains multiple operations.',\n ),\n ];\n }\n\n operation = definition;\n } else if (\n ((_definition$name = definition.name) === null ||\n _definition$name === void 0\n ? void 0\n : _definition$name.value) === operationName\n ) {\n operation = definition;\n }\n\n break;\n\n case Kind.FRAGMENT_DEFINITION:\n fragments[definition.name.value] = definition;\n break;\n\n default: // ignore non-executable definitions\n }\n }\n\n if (!operation) {\n if (operationName != null) {\n return [new GraphQLError(`Unknown operation named \"${operationName}\".`)];\n }\n\n return [new GraphQLError('Must provide an operation.')];\n } // FIXME: https://github.com/graphql/graphql-js/issues/2203\n\n /* c8 ignore next */\n\n const variableDefinitions =\n (_operation$variableDe = operation.variableDefinitions) !== null &&\n _operation$variableDe !== void 0\n ? _operation$variableDe\n : [];\n const coercedVariableValues = getVariableValues(\n schema,\n variableDefinitions,\n rawVariableValues !== null && rawVariableValues !== void 0\n ? rawVariableValues\n : {},\n {\n maxErrors: 50,\n },\n );\n\n if (coercedVariableValues.errors) {\n return coercedVariableValues.errors;\n }\n\n return {\n schema,\n fragments,\n rootValue,\n contextValue,\n operation,\n variableValues: coercedVariableValues.coerced,\n fieldResolver:\n fieldResolver !== null && fieldResolver !== void 0\n ? fieldResolver\n : defaultFieldResolver,\n typeResolver:\n typeResolver !== null && typeResolver !== void 0\n ? typeResolver\n : defaultTypeResolver,\n subscribeFieldResolver:\n subscribeFieldResolver !== null && subscribeFieldResolver !== void 0\n ? subscribeFieldResolver\n : defaultFieldResolver,\n errors: [],\n };\n}\n/**\n * Implements the \"Executing operations\" section of the spec.\n */\n\nfunction executeOperation(exeContext, operation, rootValue) {\n const rootType = exeContext.schema.getRootType(operation.operation);\n\n if (rootType == null) {\n throw new GraphQLError(\n `Schema is not configured to execute ${operation.operation} operation.`,\n {\n nodes: operation,\n },\n );\n }\n\n const rootFields = collectFields(\n exeContext.schema,\n exeContext.fragments,\n exeContext.variableValues,\n rootType,\n operation.selectionSet,\n );\n const path = undefined;\n\n switch (operation.operation) {\n case OperationTypeNode.QUERY:\n return executeFields(exeContext, rootType, rootValue, path, rootFields);\n\n case OperationTypeNode.MUTATION:\n return executeFieldsSerially(\n exeContext,\n rootType,\n rootValue,\n path,\n rootFields,\n );\n\n case OperationTypeNode.SUBSCRIPTION:\n // TODO: deprecate `subscribe` and move all logic here\n // Temporary solution until we finish merging execute and subscribe together\n return executeFields(exeContext, rootType, rootValue, path, rootFields);\n }\n}\n/**\n * Implements the \"Executing selection sets\" section of the spec\n * for fields that must be executed serially.\n */\n\nfunction executeFieldsSerially(\n exeContext,\n parentType,\n sourceValue,\n path,\n fields,\n) {\n return promiseReduce(\n fields.entries(),\n (results, [responseName, fieldNodes]) => {\n const fieldPath = addPath(path, responseName, parentType.name);\n const result = executeField(\n exeContext,\n parentType,\n sourceValue,\n fieldNodes,\n fieldPath,\n );\n\n if (result === undefined) {\n return results;\n }\n\n if (isPromise(result)) {\n return result.then((resolvedResult) => {\n results[responseName] = resolvedResult;\n return results;\n });\n }\n\n results[responseName] = result;\n return results;\n },\n Object.create(null),\n );\n}\n/**\n * Implements the \"Executing selection sets\" section of the spec\n * for fields that may be executed in parallel.\n */\n\nfunction executeFields(exeContext, parentType, sourceValue, path, fields) {\n const results = Object.create(null);\n let containsPromise = false;\n\n try {\n for (const [responseName, fieldNodes] of fields.entries()) {\n const fieldPath = addPath(path, responseName, parentType.name);\n const result = executeField(\n exeContext,\n parentType,\n sourceValue,\n fieldNodes,\n fieldPath,\n );\n\n if (result !== undefined) {\n results[responseName] = result;\n\n if (isPromise(result)) {\n containsPromise = true;\n }\n }\n }\n } catch (error) {\n if (containsPromise) {\n // Ensure that any promises returned by other fields are handled, as they may also reject.\n return promiseForObject(results).finally(() => {\n throw error;\n });\n }\n\n throw error;\n } // If there are no promises, we can just return the object\n\n if (!containsPromise) {\n return results;\n } // Otherwise, results is a map from field name to the result of resolving that\n // field, which is possibly a promise. Return a promise that will return this\n // same map, but with any promises replaced with the values they resolved to.\n\n return promiseForObject(results);\n}\n/**\n * Implements the \"Executing fields\" section of the spec\n * In particular, this function figures out the value that the field returns by\n * calling its resolve function, then calls completeValue to complete promises,\n * serialize scalars, or execute the sub-selection-set for objects.\n */\n\nfunction executeField(exeContext, parentType, source, fieldNodes, path) {\n var _fieldDef$resolve;\n\n const fieldDef = getFieldDef(exeContext.schema, parentType, fieldNodes[0]);\n\n if (!fieldDef) {\n return;\n }\n\n const returnType = fieldDef.type;\n const resolveFn =\n (_fieldDef$resolve = fieldDef.resolve) !== null &&\n _fieldDef$resolve !== void 0\n ? _fieldDef$resolve\n : exeContext.fieldResolver;\n const info = buildResolveInfo(\n exeContext,\n fieldDef,\n fieldNodes,\n parentType,\n path,\n ); // Get the resolve function, regardless of if its result is normal or abrupt (error).\n\n try {\n // Build a JS object of arguments from the field.arguments AST, using the\n // variables scope to fulfill any variable references.\n // TODO: find a way to memoize, in case this field is within a List type.\n const args = getArgumentValues(\n fieldDef,\n fieldNodes[0],\n exeContext.variableValues,\n ); // The resolve function's optional third argument is a context value that\n // is provided to every resolve function within an execution. It is commonly\n // used to represent an authenticated user, or request-specific caches.\n\n const contextValue = exeContext.contextValue;\n const result = resolveFn(source, args, contextValue, info);\n let completed;\n\n if (isPromise(result)) {\n completed = result.then((resolved) =>\n completeValue(exeContext, returnType, fieldNodes, info, path, resolved),\n );\n } else {\n completed = completeValue(\n exeContext,\n returnType,\n fieldNodes,\n info,\n path,\n result,\n );\n }\n\n if (isPromise(completed)) {\n // Note: we don't rely on a `catch` method, but we do expect \"thenable\"\n // to take a second callback for the error case.\n return completed.then(undefined, (rawError) => {\n const error = locatedError(rawError, fieldNodes, pathToArray(path));\n return handleFieldError(error, returnType, exeContext);\n });\n }\n\n return completed;\n } catch (rawError) {\n const error = locatedError(rawError, fieldNodes, pathToArray(path));\n return handleFieldError(error, returnType, exeContext);\n }\n}\n/**\n * @internal\n */\n\nexport function buildResolveInfo(\n exeContext,\n fieldDef,\n fieldNodes,\n parentType,\n path,\n) {\n // The resolve function's optional fourth argument is a collection of\n // information about the current execution state.\n return {\n fieldName: fieldDef.name,\n fieldNodes,\n returnType: fieldDef.type,\n parentType,\n path,\n schema: exeContext.schema,\n fragments: exeContext.fragments,\n rootValue: exeContext.rootValue,\n operation: exeContext.operation,\n variableValues: exeContext.variableValues,\n };\n}\n\nfunction handleFieldError(error, returnType, exeContext) {\n // If the field type is non-nullable, then it is resolved without any\n // protection from errors, however it still properly locates the error.\n if (isNonNullType(returnType)) {\n throw error;\n } // Otherwise, error protection is applied, logging the error and resolving\n // a null value for this field if one is encountered.\n\n exeContext.errors.push(error);\n return null;\n}\n/**\n * Implements the instructions for completeValue as defined in the\n * \"Value Completion\" section of the spec.\n *\n * If the field type is Non-Null, then this recursively completes the value\n * for the inner type. It throws a field error if that completion returns null,\n * as per the \"Nullability\" section of the spec.\n *\n * If the field type is a List, then this recursively completes the value\n * for the inner type on each item in the list.\n *\n * If the field type is a Scalar or Enum, ensures the completed value is a legal\n * value of the type by calling the `serialize` method of GraphQL type\n * definition.\n *\n * If the field is an abstract type, determine the runtime type of the value\n * and then complete based on that type\n *\n * Otherwise, the field type expects a sub-selection set, and will complete the\n * value by executing all sub-selections.\n */\n\nfunction completeValue(exeContext, returnType, fieldNodes, info, path, result) {\n // If result is an Error, throw a located error.\n if (result instanceof Error) {\n throw result;\n } // If field type is NonNull, complete for inner type, and throw field error\n // if result is null.\n\n if (isNonNullType(returnType)) {\n const completed = completeValue(\n exeContext,\n returnType.ofType,\n fieldNodes,\n info,\n path,\n result,\n );\n\n if (completed === null) {\n throw new Error(\n `Cannot return null for non-nullable field ${info.parentType.name}.${info.fieldName}.`,\n );\n }\n\n return completed;\n } // If result value is null or undefined then return null.\n\n if (result == null) {\n return null;\n } // If field type is List, complete each item in the list with the inner type\n\n if (isListType(returnType)) {\n return completeListValue(\n exeContext,\n returnType,\n fieldNodes,\n info,\n path,\n result,\n );\n } // If field type is a leaf type, Scalar or Enum, serialize to a valid value,\n // returning null if serialization is not possible.\n\n if (isLeafType(returnType)) {\n return completeLeafValue(returnType, result);\n } // If field type is an abstract type, Interface or Union, determine the\n // runtime Object type and complete for that type.\n\n if (isAbstractType(returnType)) {\n return completeAbstractValue(\n exeContext,\n returnType,\n fieldNodes,\n info,\n path,\n result,\n );\n } // If field type is Object, execute and complete all sub-selections.\n\n if (isObjectType(returnType)) {\n return completeObjectValue(\n exeContext,\n returnType,\n fieldNodes,\n info,\n path,\n result,\n );\n }\n /* c8 ignore next 6 */\n // Not reachable, all possible output types have been considered.\n\n false ||\n invariant(\n false,\n 'Cannot complete value of unexpected output type: ' + inspect(returnType),\n );\n}\n/**\n * Complete a list value by completing each item in the list with the\n * inner type\n */\n\nfunction completeListValue(\n exeContext,\n returnType,\n fieldNodes,\n info,\n path,\n result,\n) {\n if (!isIterableObject(result)) {\n throw new GraphQLError(\n `Expected Iterable, but did not find one for field \"${info.parentType.name}.${info.fieldName}\".`,\n );\n } // This is specified as a simple map, however we're optimizing the path\n // where the list contains no Promises by avoiding creating another Promise.\n\n const itemType = returnType.ofType;\n let containsPromise = false;\n const completedResults = Array.from(result, (item, index) => {\n // No need to modify the info object containing the path,\n // since from here on it is not ever accessed by resolver functions.\n const itemPath = addPath(path, index, undefined);\n\n try {\n let completedItem;\n\n if (isPromise(item)) {\n completedItem = item.then((resolved) =>\n completeValue(\n exeContext,\n itemType,\n fieldNodes,\n info,\n itemPath,\n resolved,\n ),\n );\n } else {\n completedItem = completeValue(\n exeContext,\n itemType,\n fieldNodes,\n info,\n itemPath,\n item,\n );\n }\n\n if (isPromise(completedItem)) {\n containsPromise = true; // Note: we don't rely on a `catch` method, but we do expect \"thenable\"\n // to take a second callback for the error case.\n\n return completedItem.then(undefined, (rawError) => {\n const error = locatedError(\n rawError,\n fieldNodes,\n pathToArray(itemPath),\n );\n return handleFieldError(error, itemType, exeContext);\n });\n }\n\n return completedItem;\n } catch (rawError) {\n const error = locatedError(rawError, fieldNodes, pathToArray(itemPath));\n return handleFieldError(error, itemType, exeContext);\n }\n });\n return containsPromise ? Promise.all(completedResults) : completedResults;\n}\n/**\n * Complete a Scalar or Enum by serializing to a valid value, returning\n * null if serialization is not possible.\n */\n\nfunction completeLeafValue(returnType, result) {\n const serializedResult = returnType.serialize(result);\n\n if (serializedResult == null) {\n throw new Error(\n `Expected \\`${inspect(returnType)}.serialize(${inspect(result)})\\` to ` +\n `return non-nullable value, returned: ${inspect(serializedResult)}`,\n );\n }\n\n return serializedResult;\n}\n/**\n * Complete a value of an abstract type by determining the runtime object type\n * of that value, then complete the value for that type.\n */\n\nfunction completeAbstractValue(\n exeContext,\n returnType,\n fieldNodes,\n info,\n path,\n result,\n) {\n var _returnType$resolveTy;\n\n const resolveTypeFn =\n (_returnType$resolveTy = returnType.resolveType) !== null &&\n _returnType$resolveTy !== void 0\n ? _returnType$resolveTy\n : exeContext.typeResolver;\n const contextValue = exeContext.contextValue;\n const runtimeType = resolveTypeFn(result, contextValue, info, returnType);\n\n if (isPromise(runtimeType)) {\n return runtimeType.then((resolvedRuntimeType) =>\n completeObjectValue(\n exeContext,\n ensureValidRuntimeType(\n resolvedRuntimeType,\n exeContext,\n returnType,\n fieldNodes,\n info,\n result,\n ),\n fieldNodes,\n info,\n path,\n result,\n ),\n );\n }\n\n return completeObjectValue(\n exeContext,\n ensureValidRuntimeType(\n runtimeType,\n exeContext,\n returnType,\n fieldNodes,\n info,\n result,\n ),\n fieldNodes,\n info,\n path,\n result,\n );\n}\n\nfunction ensureValidRuntimeType(\n runtimeTypeName,\n exeContext,\n returnType,\n fieldNodes,\n info,\n result,\n) {\n if (runtimeTypeName == null) {\n throw new GraphQLError(\n `Abstract type \"${returnType.name}\" must resolve to an Object type at runtime for field \"${info.parentType.name}.${info.fieldName}\". Either the \"${returnType.name}\" type should provide a \"resolveType\" function or each possible type should provide an \"isTypeOf\" function.`,\n fieldNodes,\n );\n } // releases before 16.0.0 supported returning `GraphQLObjectType` from `resolveType`\n // TODO: remove in 17.0.0 release\n\n if (isObjectType(runtimeTypeName)) {\n throw new GraphQLError(\n 'Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.',\n );\n }\n\n if (typeof runtimeTypeName !== 'string') {\n throw new GraphQLError(\n `Abstract type \"${returnType.name}\" must resolve to an Object type at runtime for field \"${info.parentType.name}.${info.fieldName}\" with ` +\n `value ${inspect(result)}, received \"${inspect(runtimeTypeName)}\".`,\n );\n }\n\n const runtimeType = exeContext.schema.getType(runtimeTypeName);\n\n if (runtimeType == null) {\n throw new GraphQLError(\n `Abstract type \"${returnType.name}\" was resolved to a type \"${runtimeTypeName}\" that does not exist inside the schema.`,\n {\n nodes: fieldNodes,\n },\n );\n }\n\n if (!isObjectType(runtimeType)) {\n throw new GraphQLError(\n `Abstract type \"${returnType.name}\" was resolved to a non-object type \"${runtimeTypeName}\".`,\n {\n nodes: fieldNodes,\n },\n );\n }\n\n if (!exeContext.schema.isSubType(returnType, runtimeType)) {\n throw new GraphQLError(\n `Runtime Object type \"${runtimeType.name}\" is not a possible type for \"${returnType.name}\".`,\n {\n nodes: fieldNodes,\n },\n );\n }\n\n return runtimeType;\n}\n/**\n * Complete an Object value by executing all sub-selections.\n */\n\nfunction completeObjectValue(\n exeContext,\n returnType,\n fieldNodes,\n info,\n path,\n result,\n) {\n // Collect sub-fields to execute to complete this value.\n const subFieldNodes = collectSubfields(exeContext, returnType, fieldNodes); // If there is an isTypeOf predicate function, call it with the\n // current result. If isTypeOf returns false, then raise an error rather\n // than continuing execution.\n\n if (returnType.isTypeOf) {\n const isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info);\n\n if (isPromise(isTypeOf)) {\n return isTypeOf.then((resolvedIsTypeOf) => {\n if (!resolvedIsTypeOf) {\n throw invalidReturnTypeError(returnType, result, fieldNodes);\n }\n\n return executeFields(\n exeContext,\n returnType,\n result,\n path,\n subFieldNodes,\n );\n });\n }\n\n if (!isTypeOf) {\n throw invalidReturnTypeError(returnType, result, fieldNodes);\n }\n }\n\n return executeFields(exeContext, returnType, result, path, subFieldNodes);\n}\n\nfunction invalidReturnTypeError(returnType, result, fieldNodes) {\n return new GraphQLError(\n `Expected value of type \"${returnType.name}\" but got: ${inspect(result)}.`,\n {\n nodes: fieldNodes,\n },\n );\n}\n/**\n * If a resolveType function is not given, then a default resolve behavior is\n * used which attempts two strategies:\n *\n * First, See if the provided value has a `__typename` field defined, if so, use\n * that value as name of the resolved type.\n *\n * Otherwise, test each possible type for the abstract type by calling\n * isTypeOf for the object being coerced, returning the first type that matches.\n */\n\nexport const defaultTypeResolver = function (\n value,\n contextValue,\n info,\n abstractType,\n) {\n // First, look for `__typename`.\n if (isObjectLike(value) && typeof value.__typename === 'string') {\n return value.__typename;\n } // Otherwise, test each possible type.\n\n const possibleTypes = info.schema.getPossibleTypes(abstractType);\n const promisedIsTypeOfResults = [];\n\n for (let i = 0; i < possibleTypes.length; i++) {\n const type = possibleTypes[i];\n\n if (type.isTypeOf) {\n const isTypeOfResult = type.isTypeOf(value, contextValue, info);\n\n if (isPromise(isTypeOfResult)) {\n promisedIsTypeOfResults[i] = isTypeOfResult;\n } else if (isTypeOfResult) {\n return type.name;\n }\n }\n }\n\n if (promisedIsTypeOfResults.length) {\n return Promise.all(promisedIsTypeOfResults).then((isTypeOfResults) => {\n for (let i = 0; i < isTypeOfResults.length; i++) {\n if (isTypeOfResults[i]) {\n return possibleTypes[i].name;\n }\n }\n });\n }\n};\n/**\n * If a resolve function is not given, then a default resolve behavior is used\n * which takes the property of the source object of the same name as the field\n * and returns it as the result, or if it's a function, returns the result\n * of calling that function while passing along args and context value.\n */\n\nexport const defaultFieldResolver = function (\n source,\n args,\n contextValue,\n info,\n) {\n // ensure source is a value for which property access is acceptable.\n if (isObjectLike(source) || typeof source === 'function') {\n const property = source[info.fieldName];\n\n if (typeof property === 'function') {\n return source[info.fieldName](args, contextValue, info);\n }\n\n return property;\n }\n};\n/**\n * This method looks up the field on the given type definition.\n * It has special casing for the three introspection fields,\n * __schema, __type and __typename. __typename is special because\n * it can always be queried as a field, even in situations where no\n * other fields are allowed, like on a Union. __schema and __type\n * could get automatically added to the query type, but that would\n * require mutating type definitions, which would cause issues.\n *\n * @internal\n */\n\nexport function getFieldDef(schema, parentType, fieldNode) {\n const fieldName = fieldNode.name.value;\n\n if (\n fieldName === SchemaMetaFieldDef.name &&\n schema.getQueryType() === parentType\n ) {\n return SchemaMetaFieldDef;\n } else if (\n fieldName === TypeMetaFieldDef.name &&\n schema.getQueryType() === parentType\n ) {\n return TypeMetaFieldDef;\n } else if (fieldName === TypeNameMetaFieldDef.name) {\n return TypeNameMetaFieldDef;\n }\n\n return parentType.getFields()[fieldName];\n}\n", "import { devAssert } from './jsutils/devAssert.mjs';\nimport { isPromise } from './jsutils/isPromise.mjs';\nimport { parse } from './language/parser.mjs';\nimport { validateSchema } from './type/validate.mjs';\nimport { validate } from './validation/validate.mjs';\nimport { execute } from './execution/execute.mjs';\n/**\n * This is the primary entry point function for fulfilling GraphQL operations\n * by parsing, validating, and executing a GraphQL document along side a\n * GraphQL schema.\n *\n * More sophisticated GraphQL servers, such as those which persist queries,\n * may wish to separate the validation and execution phases to a static time\n * tooling step, and a server runtime step.\n *\n * Accepts either an object with named arguments, or individual arguments:\n *\n * schema:\n * The GraphQL type system to use when validating and executing a query.\n * source:\n * A GraphQL language formatted string representing the requested operation.\n * rootValue:\n * The value provided as the first argument to resolver functions on the top\n * level type (e.g. the query object type).\n * contextValue:\n * The context value is provided as an argument to resolver functions after\n * field arguments. It is used to pass shared information useful at any point\n * during executing this query, for example the currently logged in user and\n * connections to databases or other services.\n * variableValues:\n * A mapping of variable name to runtime value to use for all variables\n * defined in the requestString.\n * operationName:\n * The name of the operation to use if requestString contains multiple\n * possible operations. Can be omitted if requestString contains only\n * one operation.\n * fieldResolver:\n * A resolver function to use when one is not provided by the schema.\n * If not provided, the default field resolver is used (which looks for a\n * value or method on the source value with the field's name).\n * typeResolver:\n * A type resolver function to use when none is provided by the schema.\n * If not provided, the default type resolver is used (which looks for a\n * `__typename` field or alternatively calls the `isTypeOf` method).\n */\n\nexport function graphql(args) {\n // Always return a Promise for a consistent API.\n return new Promise((resolve) => resolve(graphqlImpl(args)));\n}\n/**\n * The graphqlSync function also fulfills GraphQL operations by parsing,\n * validating, and executing a GraphQL document along side a GraphQL schema.\n * However, it guarantees to complete synchronously (or throw an error) assuming\n * that all field resolvers are also synchronous.\n */\n\nexport function graphqlSync(args) {\n const result = graphqlImpl(args); // Assert that the execution was synchronous.\n\n if (isPromise(result)) {\n throw new Error('GraphQL execution failed to complete synchronously.');\n }\n\n return result;\n}\n\nfunction graphqlImpl(args) {\n // Temporary for v15 to v16 migration. Remove in v17\n arguments.length < 2 ||\n devAssert(\n false,\n 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.',\n );\n const {\n schema,\n source,\n rootValue,\n contextValue,\n variableValues,\n operationName,\n fieldResolver,\n typeResolver,\n } = args; // Validate Schema\n\n const schemaValidationErrors = validateSchema(schema);\n\n if (schemaValidationErrors.length > 0) {\n return {\n errors: schemaValidationErrors,\n };\n } // Parse\n\n let document;\n\n try {\n document = parse(source);\n } catch (syntaxError) {\n return {\n errors: [syntaxError],\n };\n } // Validate\n\n const validationErrors = validate(schema, document);\n\n if (validationErrors.length > 0) {\n return {\n errors: validationErrors,\n };\n } // Execute\n\n return execute({\n schema,\n document,\n rootValue,\n contextValue,\n variableValues,\n operationName,\n fieldResolver,\n typeResolver,\n });\n}\n", "/**\n * Returns true if the provided object implements the AsyncIterator protocol via\n * implementing a `Symbol.asyncIterator` method.\n */\nexport function isAsyncIterable(maybeAsyncIterable) {\n return (\n typeof (maybeAsyncIterable === null || maybeAsyncIterable === void 0\n ? void 0\n : maybeAsyncIterable[Symbol.asyncIterator]) === 'function'\n );\n}\n", "/**\n * Given an AsyncIterable and a callback function, return an AsyncIterator\n * which produces values mapped via calling the callback function.\n */\nexport function mapAsyncIterator(iterable, callback) {\n const iterator = iterable[Symbol.asyncIterator]();\n\n async function mapResult(result) {\n if (result.done) {\n return result;\n }\n\n try {\n return {\n value: await callback(result.value),\n done: false,\n };\n } catch (error) {\n /* c8 ignore start */\n // FIXME: add test case\n if (typeof iterator.return === 'function') {\n try {\n await iterator.return();\n } catch (_e) {\n /* ignore error */\n }\n }\n\n throw error;\n /* c8 ignore stop */\n }\n }\n\n return {\n async next() {\n return mapResult(await iterator.next());\n },\n\n async return() {\n // If iterator.return() does not exist, then type R must be undefined.\n return typeof iterator.return === 'function'\n ? mapResult(await iterator.return())\n : {\n value: undefined,\n done: true,\n };\n },\n\n async throw(error) {\n if (typeof iterator.throw === 'function') {\n return mapResult(await iterator.throw(error));\n }\n\n throw error;\n },\n\n [Symbol.asyncIterator]() {\n return this;\n },\n };\n}\n", "import { devAssert } from '../jsutils/devAssert.mjs';\nimport { inspect } from '../jsutils/inspect.mjs';\nimport { isAsyncIterable } from '../jsutils/isAsyncIterable.mjs';\nimport { addPath, pathToArray } from '../jsutils/Path.mjs';\nimport { GraphQLError } from '../error/GraphQLError.mjs';\nimport { locatedError } from '../error/locatedError.mjs';\nimport { collectFields } from './collectFields.mjs';\nimport {\n assertValidExecutionArguments,\n buildExecutionContext,\n buildResolveInfo,\n execute,\n getFieldDef,\n} from './execute.mjs';\nimport { mapAsyncIterator } from './mapAsyncIterator.mjs';\nimport { getArgumentValues } from './values.mjs';\n/**\n * Implements the \"Subscribe\" algorithm described in the GraphQL specification.\n *\n * Returns a Promise which resolves to either an AsyncIterator (if successful)\n * or an ExecutionResult (error). The promise will be rejected if the schema or\n * other arguments to this function are invalid, or if the resolved event stream\n * is not an async iterable.\n *\n * If the client-provided arguments to this function do not result in a\n * compliant subscription, a GraphQL Response (ExecutionResult) with\n * descriptive errors and no data will be returned.\n *\n * If the source stream could not be created due to faulty subscription\n * resolver logic or underlying systems, the promise will resolve to a single\n * ExecutionResult containing `errors` and no `data`.\n *\n * If the operation succeeded, the promise resolves to an AsyncIterator, which\n * yields a stream of ExecutionResults representing the response stream.\n *\n * Accepts either an object with named arguments, or individual arguments.\n */\n\nexport async function subscribe(args) {\n // Temporary for v15 to v16 migration. Remove in v17\n arguments.length < 2 ||\n devAssert(\n false,\n 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.',\n );\n const resultOrStream = await createSourceEventStream(args);\n\n if (!isAsyncIterable(resultOrStream)) {\n return resultOrStream;\n } // For each payload yielded from a subscription, map it over the normal\n // GraphQL `execute` function, with `payload` as the rootValue.\n // This implements the \"MapSourceToResponseEvent\" algorithm described in\n // the GraphQL specification. The `execute` function provides the\n // \"ExecuteSubscriptionEvent\" algorithm, as it is nearly identical to the\n // \"ExecuteQuery\" algorithm, for which `execute` is also used.\n\n const mapSourceToResponse = (payload) =>\n execute({ ...args, rootValue: payload }); // Map every source value to a ExecutionResult value as described above.\n\n return mapAsyncIterator(resultOrStream, mapSourceToResponse);\n}\n\nfunction toNormalizedArgs(args) {\n const firstArg = args[0];\n\n if (firstArg && 'document' in firstArg) {\n return firstArg;\n }\n\n return {\n schema: firstArg,\n // FIXME: when underlying TS bug fixed, see https://github.com/microsoft/TypeScript/issues/31613\n document: args[1],\n rootValue: args[2],\n contextValue: args[3],\n variableValues: args[4],\n operationName: args[5],\n subscribeFieldResolver: args[6],\n };\n}\n/**\n * Implements the \"CreateSourceEventStream\" algorithm described in the\n * GraphQL specification, resolving the subscription source event stream.\n *\n * Returns a Promise which resolves to either an AsyncIterable (if successful)\n * or an ExecutionResult (error). The promise will be rejected if the schema or\n * other arguments to this function are invalid, or if the resolved event stream\n * is not an async iterable.\n *\n * If the client-provided arguments to this function do not result in a\n * compliant subscription, a GraphQL Response (ExecutionResult) with\n * descriptive errors and no data will be returned.\n *\n * If the the source stream could not be created due to faulty subscription\n * resolver logic or underlying systems, the promise will resolve to a single\n * ExecutionResult containing `errors` and no `data`.\n *\n * If the operation succeeded, the promise resolves to the AsyncIterable for the\n * event stream returned by the resolver.\n *\n * A Source Event Stream represents a sequence of events, each of which triggers\n * a GraphQL execution for that event.\n *\n * This may be useful when hosting the stateful subscription service in a\n * different process or machine than the stateless GraphQL execution engine,\n * or otherwise separating these two steps. For more on this, see the\n * \"Supporting Subscriptions at Scale\" information in the GraphQL specification.\n */\n\nexport async function createSourceEventStream(...rawArgs) {\n const args = toNormalizedArgs(rawArgs);\n const { schema, document, variableValues } = args; // If arguments are missing or incorrectly typed, this is an internal\n // developer mistake which should throw an early error.\n\n assertValidExecutionArguments(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments,\n // a \"Response\" with only errors is returned.\n\n const exeContext = buildExecutionContext(args); // Return early errors if execution context failed.\n\n if (!('schema' in exeContext)) {\n return {\n errors: exeContext,\n };\n }\n\n try {\n const eventStream = await executeSubscription(exeContext); // Assert field returned an event stream, otherwise yield an error.\n\n if (!isAsyncIterable(eventStream)) {\n throw new Error(\n 'Subscription field must return Async Iterable. ' +\n `Received: ${inspect(eventStream)}.`,\n );\n }\n\n return eventStream;\n } catch (error) {\n // If it GraphQLError, report it as an ExecutionResult, containing only errors and no data.\n // Otherwise treat the error as a system-class error and re-throw it.\n if (error instanceof GraphQLError) {\n return {\n errors: [error],\n };\n }\n\n throw error;\n }\n}\n\nasync function executeSubscription(exeContext) {\n const { schema, fragments, operation, variableValues, rootValue } =\n exeContext;\n const rootType = schema.getSubscriptionType();\n\n if (rootType == null) {\n throw new GraphQLError(\n 'Schema is not configured to execute subscription operation.',\n {\n nodes: operation,\n },\n );\n }\n\n const rootFields = collectFields(\n schema,\n fragments,\n variableValues,\n rootType,\n operation.selectionSet,\n );\n const [responseName, fieldNodes] = [...rootFields.entries()][0];\n const fieldDef = getFieldDef(schema, rootType, fieldNodes[0]);\n\n if (!fieldDef) {\n const fieldName = fieldNodes[0].name.value;\n throw new GraphQLError(\n `The subscription field \"${fieldName}\" is not defined.`,\n {\n nodes: fieldNodes,\n },\n );\n }\n\n const path = addPath(undefined, responseName, rootType.name);\n const info = buildResolveInfo(\n exeContext,\n fieldDef,\n fieldNodes,\n rootType,\n path,\n );\n\n try {\n var _fieldDef$subscribe;\n\n // Implements the \"ResolveFieldEventStream\" algorithm from GraphQL specification.\n // It differs from \"ResolveFieldValue\" due to providing a different `resolveFn`.\n // Build a JS object of arguments from the field.arguments AST, using the\n // variables scope to fulfill any variable references.\n const args = getArgumentValues(fieldDef, fieldNodes[0], variableValues); // The resolve function's optional third argument is a context value that\n // is provided to every resolve function within an execution. It is commonly\n // used to represent an authenticated user, or request-specific caches.\n\n const contextValue = exeContext.contextValue; // Call the `subscribe()` resolver or the default resolver to produce an\n // AsyncIterable yielding raw payloads.\n\n const resolveFn =\n (_fieldDef$subscribe = fieldDef.subscribe) !== null &&\n _fieldDef$subscribe !== void 0\n ? _fieldDef$subscribe\n : exeContext.subscribeFieldResolver;\n const eventStream = await resolveFn(rootValue, args, contextValue, info);\n\n if (eventStream instanceof Error) {\n throw eventStream;\n }\n\n return eventStream;\n } catch (error) {\n throw locatedError(error, fieldNodes, pathToArray(path));\n }\n}\n", "import { invariant } from '../../../jsutils/invariant.mjs';\nimport { GraphQLError } from '../../../error/GraphQLError.mjs';\nimport { getNamedType, isInputObjectType } from '../../../type/definition.mjs';\n\n/**\n * No deprecated\n *\n * A GraphQL document is only valid if all selected fields and all used enum values have not been\n * deprecated.\n *\n * Note: This rule is optional and is not part of the Validation section of the GraphQL\n * Specification. The main purpose of this rule is detection of deprecated usages and not\n * necessarily to forbid their use when querying a service.\n */\nexport function NoDeprecatedCustomRule(context) {\n return {\n Field(node) {\n const fieldDef = context.getFieldDef();\n const deprecationReason =\n fieldDef === null || fieldDef === void 0\n ? void 0\n : fieldDef.deprecationReason;\n\n if (fieldDef && deprecationReason != null) {\n const parentType = context.getParentType();\n parentType != null || invariant(false);\n context.reportError(\n new GraphQLError(\n `The field ${parentType.name}.${fieldDef.name} is deprecated. ${deprecationReason}`,\n {\n nodes: node,\n },\n ),\n );\n }\n },\n\n Argument(node) {\n const argDef = context.getArgument();\n const deprecationReason =\n argDef === null || argDef === void 0\n ? void 0\n : argDef.deprecationReason;\n\n if (argDef && deprecationReason != null) {\n const directiveDef = context.getDirective();\n\n if (directiveDef != null) {\n context.reportError(\n new GraphQLError(\n `Directive \"@${directiveDef.name}\" argument \"${argDef.name}\" is deprecated. ${deprecationReason}`,\n {\n nodes: node,\n },\n ),\n );\n } else {\n const parentType = context.getParentType();\n const fieldDef = context.getFieldDef();\n (parentType != null && fieldDef != null) || invariant(false);\n context.reportError(\n new GraphQLError(\n `Field \"${parentType.name}.${fieldDef.name}\" argument \"${argDef.name}\" is deprecated. ${deprecationReason}`,\n {\n nodes: node,\n },\n ),\n );\n }\n }\n },\n\n ObjectField(node) {\n const inputObjectDef = getNamedType(context.getParentInputType());\n\n if (isInputObjectType(inputObjectDef)) {\n const inputFieldDef = inputObjectDef.getFields()[node.name.value];\n const deprecationReason =\n inputFieldDef === null || inputFieldDef === void 0\n ? void 0\n : inputFieldDef.deprecationReason;\n\n if (deprecationReason != null) {\n context.reportError(\n new GraphQLError(\n `The input field ${inputObjectDef.name}.${inputFieldDef.name} is deprecated. ${deprecationReason}`,\n {\n nodes: node,\n },\n ),\n );\n }\n }\n },\n\n EnumValue(node) {\n const enumValueDef = context.getEnumValue();\n const deprecationReason =\n enumValueDef === null || enumValueDef === void 0\n ? void 0\n : enumValueDef.deprecationReason;\n\n if (enumValueDef && deprecationReason != null) {\n const enumTypeDef = getNamedType(context.getInputType());\n enumTypeDef != null || invariant(false);\n context.reportError(\n new GraphQLError(\n `The enum value \"${enumTypeDef.name}.${enumValueDef.name}\" is deprecated. ${deprecationReason}`,\n {\n nodes: node,\n },\n ),\n );\n }\n },\n };\n}\n", "import { GraphQLError } from '../../../error/GraphQLError.mjs';\nimport { getNamedType } from '../../../type/definition.mjs';\nimport { isIntrospectionType } from '../../../type/introspection.mjs';\n\n/**\n * Prohibit introspection queries\n *\n * A GraphQL document is only valid if all fields selected are not fields that\n * return an introspection type.\n *\n * Note: This rule is optional and is not part of the Validation section of the\n * GraphQL Specification. This rule effectively disables introspection, which\n * does not reflect best practices and should only be done if absolutely necessary.\n */\nexport function NoSchemaIntrospectionCustomRule(context) {\n return {\n Field(node) {\n const type = getNamedType(context.getType());\n\n if (type && isIntrospectionType(type)) {\n context.reportError(\n new GraphQLError(\n `GraphQL introspection has been disabled, but the requested query contained the field \"${node.name.value}\".`,\n {\n nodes: node,\n },\n ),\n );\n }\n },\n };\n}\n", "/**\n * Produce the GraphQL query recommended for a full schema introspection.\n * Accepts optional IntrospectionOptions.\n */\nexport function getIntrospectionQuery(options) {\n const optionsWithDefault = {\n descriptions: true,\n specifiedByUrl: false,\n directiveIsRepeatable: false,\n schemaDescription: false,\n inputValueDeprecation: false,\n ...options,\n };\n const descriptions = optionsWithDefault.descriptions ? 'description' : '';\n const specifiedByUrl = optionsWithDefault.specifiedByUrl\n ? 'specifiedByURL'\n : '';\n const directiveIsRepeatable = optionsWithDefault.directiveIsRepeatable\n ? 'isRepeatable'\n : '';\n const schemaDescription = optionsWithDefault.schemaDescription\n ? descriptions\n : '';\n\n function inputDeprecation(str) {\n return optionsWithDefault.inputValueDeprecation ? str : '';\n }\n\n return `\n query IntrospectionQuery {\n __schema {\n ${schemaDescription}\n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n ${descriptions}\n ${directiveIsRepeatable}\n locations\n args${inputDeprecation('(includeDeprecated: true)')} {\n ...InputValue\n }\n }\n }\n }\n\n fragment FullType on __Type {\n kind\n name\n ${descriptions}\n ${specifiedByUrl}\n fields(includeDeprecated: true) {\n name\n ${descriptions}\n args${inputDeprecation('(includeDeprecated: true)')} {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields${inputDeprecation('(includeDeprecated: true)')} {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n ${descriptions}\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n }\n\n fragment InputValue on __InputValue {\n name\n ${descriptions}\n type { ...TypeRef }\n defaultValue\n ${inputDeprecation('isDeprecated')}\n ${inputDeprecation('deprecationReason')}\n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n `;\n}\n", "import { Kind } from '../language/kinds.mjs';\n/**\n * Returns an operation AST given a document AST and optionally an operation\n * name. If a name is not provided, an operation is only returned if only one is\n * provided in the document.\n */\n\nexport function getOperationAST(documentAST, operationName) {\n let operation = null;\n\n for (const definition of documentAST.definitions) {\n if (definition.kind === Kind.OPERATION_DEFINITION) {\n var _definition$name;\n\n if (operationName == null) {\n // If no operation name was provided, only return an Operation if there\n // is one defined in the document. Upon encountering the second, return\n // null.\n if (operation) {\n return null;\n }\n\n operation = definition;\n } else if (\n ((_definition$name = definition.name) === null ||\n _definition$name === void 0\n ? void 0\n : _definition$name.value) === operationName\n ) {\n return definition;\n }\n }\n }\n\n return operation;\n}\n", "import { GraphQLError } from '../error/GraphQLError.mjs';\n\n/**\n * Extracts the root type of the operation from the schema.\n *\n * @deprecated Please use `GraphQLSchema.getRootType` instead. Will be removed in v17\n */\nexport function getOperationRootType(schema, operation) {\n if (operation.operation === 'query') {\n const queryType = schema.getQueryType();\n\n if (!queryType) {\n throw new GraphQLError(\n 'Schema does not define the required query root type.',\n {\n nodes: operation,\n },\n );\n }\n\n return queryType;\n }\n\n if (operation.operation === 'mutation') {\n const mutationType = schema.getMutationType();\n\n if (!mutationType) {\n throw new GraphQLError('Schema is not configured for mutations.', {\n nodes: operation,\n });\n }\n\n return mutationType;\n }\n\n if (operation.operation === 'subscription') {\n const subscriptionType = schema.getSubscriptionType();\n\n if (!subscriptionType) {\n throw new GraphQLError('Schema is not configured for subscriptions.', {\n nodes: operation,\n });\n }\n\n return subscriptionType;\n }\n\n throw new GraphQLError(\n 'Can only have query, mutation and subscription operations.',\n {\n nodes: operation,\n },\n );\n}\n", "import { invariant } from '../jsutils/invariant.mjs';\nimport { parse } from '../language/parser.mjs';\nimport { executeSync } from '../execution/execute.mjs';\nimport { getIntrospectionQuery } from './getIntrospectionQuery.mjs';\n/**\n * Build an IntrospectionQuery from a GraphQLSchema\n *\n * IntrospectionQuery is useful for utilities that care about type and field\n * relationships, but do not need to traverse through those relationships.\n *\n * This is the inverse of buildClientSchema. The primary use case is outside\n * of the server context, for instance when doing schema comparisons.\n */\n\nexport function introspectionFromSchema(schema, options) {\n const optionsWithDefaults = {\n specifiedByUrl: true,\n directiveIsRepeatable: true,\n schemaDescription: true,\n inputValueDeprecation: true,\n ...options,\n };\n const document = parse(getIntrospectionQuery(optionsWithDefaults));\n const result = executeSync({\n schema,\n document,\n });\n (!result.errors && result.data) || invariant(false);\n return result.data;\n}\n", "import { devAssert } from '../jsutils/devAssert.mjs';\nimport { inspect } from '../jsutils/inspect.mjs';\nimport { isObjectLike } from '../jsutils/isObjectLike.mjs';\nimport { keyValMap } from '../jsutils/keyValMap.mjs';\nimport { parseValue } from '../language/parser.mjs';\nimport {\n assertInterfaceType,\n assertNullableType,\n assertObjectType,\n GraphQLEnumType,\n GraphQLInputObjectType,\n GraphQLInterfaceType,\n GraphQLList,\n GraphQLNonNull,\n GraphQLObjectType,\n GraphQLScalarType,\n GraphQLUnionType,\n isInputType,\n isOutputType,\n} from '../type/definition.mjs';\nimport { GraphQLDirective } from '../type/directives.mjs';\nimport { introspectionTypes, TypeKind } from '../type/introspection.mjs';\nimport { specifiedScalarTypes } from '../type/scalars.mjs';\nimport { GraphQLSchema } from '../type/schema.mjs';\nimport { valueFromAST } from './valueFromAST.mjs';\n/**\n * Build a GraphQLSchema for use by client tools.\n *\n * Given the result of a client running the introspection query, creates and\n * returns a GraphQLSchema instance which can be then used with all graphql-js\n * tools, but cannot be used to execute a query, as introspection does not\n * represent the \"resolver\", \"parse\" or \"serialize\" functions or any other\n * server-internal mechanisms.\n *\n * This function expects a complete introspection result. Don't forget to check\n * the \"errors\" field of a server response before calling this function.\n */\n\nexport function buildClientSchema(introspection, options) {\n (isObjectLike(introspection) && isObjectLike(introspection.__schema)) ||\n devAssert(\n false,\n `Invalid or incomplete introspection result. Ensure that you are passing \"data\" property of introspection response and no \"errors\" was returned alongside: ${inspect(\n introspection,\n )}.`,\n ); // Get the schema from the introspection result.\n\n const schemaIntrospection = introspection.__schema; // Iterate through all types, getting the type definition for each.\n\n const typeMap = keyValMap(\n schemaIntrospection.types,\n (typeIntrospection) => typeIntrospection.name,\n (typeIntrospection) => buildType(typeIntrospection),\n ); // Include standard types only if they are used.\n\n for (const stdType of [...specifiedScalarTypes, ...introspectionTypes]) {\n if (typeMap[stdType.name]) {\n typeMap[stdType.name] = stdType;\n }\n } // Get the root Query, Mutation, and Subscription types.\n\n const queryType = schemaIntrospection.queryType\n ? getObjectType(schemaIntrospection.queryType)\n : null;\n const mutationType = schemaIntrospection.mutationType\n ? getObjectType(schemaIntrospection.mutationType)\n : null;\n const subscriptionType = schemaIntrospection.subscriptionType\n ? getObjectType(schemaIntrospection.subscriptionType)\n : null; // Get the directives supported by Introspection, assuming empty-set if\n // directives were not queried for.\n\n const directives = schemaIntrospection.directives\n ? schemaIntrospection.directives.map(buildDirective)\n : []; // Then produce and return a Schema with these types.\n\n return new GraphQLSchema({\n description: schemaIntrospection.description,\n query: queryType,\n mutation: mutationType,\n subscription: subscriptionType,\n types: Object.values(typeMap),\n directives,\n assumeValid:\n options === null || options === void 0 ? void 0 : options.assumeValid,\n }); // Given a type reference in introspection, return the GraphQLType instance.\n // preferring cached instances before building new instances.\n\n function getType(typeRef) {\n if (typeRef.kind === TypeKind.LIST) {\n const itemRef = typeRef.ofType;\n\n if (!itemRef) {\n throw new Error('Decorated type deeper than introspection query.');\n }\n\n return new GraphQLList(getType(itemRef));\n }\n\n if (typeRef.kind === TypeKind.NON_NULL) {\n const nullableRef = typeRef.ofType;\n\n if (!nullableRef) {\n throw new Error('Decorated type deeper than introspection query.');\n }\n\n const nullableType = getType(nullableRef);\n return new GraphQLNonNull(assertNullableType(nullableType));\n }\n\n return getNamedType(typeRef);\n }\n\n function getNamedType(typeRef) {\n const typeName = typeRef.name;\n\n if (!typeName) {\n throw new Error(`Unknown type reference: ${inspect(typeRef)}.`);\n }\n\n const type = typeMap[typeName];\n\n if (!type) {\n throw new Error(\n `Invalid or incomplete schema, unknown type: ${typeName}. Ensure that a full introspection query is used in order to build a client schema.`,\n );\n }\n\n return type;\n }\n\n function getObjectType(typeRef) {\n return assertObjectType(getNamedType(typeRef));\n }\n\n function getInterfaceType(typeRef) {\n return assertInterfaceType(getNamedType(typeRef));\n } // Given a type's introspection result, construct the correct\n // GraphQLType instance.\n\n function buildType(type) {\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n if (type != null && type.name != null && type.kind != null) {\n // FIXME: Properly type IntrospectionType, it's a breaking change so fix in v17\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check\n switch (type.kind) {\n case TypeKind.SCALAR:\n return buildScalarDef(type);\n\n case TypeKind.OBJECT:\n return buildObjectDef(type);\n\n case TypeKind.INTERFACE:\n return buildInterfaceDef(type);\n\n case TypeKind.UNION:\n return buildUnionDef(type);\n\n case TypeKind.ENUM:\n return buildEnumDef(type);\n\n case TypeKind.INPUT_OBJECT:\n return buildInputObjectDef(type);\n }\n }\n\n const typeStr = inspect(type);\n throw new Error(\n `Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ${typeStr}.`,\n );\n }\n\n function buildScalarDef(scalarIntrospection) {\n return new GraphQLScalarType({\n name: scalarIntrospection.name,\n description: scalarIntrospection.description,\n specifiedByURL: scalarIntrospection.specifiedByURL,\n });\n }\n\n function buildImplementationsList(implementingIntrospection) {\n // TODO: Temporary workaround until GraphQL ecosystem will fully support\n // 'interfaces' on interface types.\n if (\n implementingIntrospection.interfaces === null &&\n implementingIntrospection.kind === TypeKind.INTERFACE\n ) {\n return [];\n }\n\n if (!implementingIntrospection.interfaces) {\n const implementingIntrospectionStr = inspect(implementingIntrospection);\n throw new Error(\n `Introspection result missing interfaces: ${implementingIntrospectionStr}.`,\n );\n }\n\n return implementingIntrospection.interfaces.map(getInterfaceType);\n }\n\n function buildObjectDef(objectIntrospection) {\n return new GraphQLObjectType({\n name: objectIntrospection.name,\n description: objectIntrospection.description,\n interfaces: () => buildImplementationsList(objectIntrospection),\n fields: () => buildFieldDefMap(objectIntrospection),\n });\n }\n\n function buildInterfaceDef(interfaceIntrospection) {\n return new GraphQLInterfaceType({\n name: interfaceIntrospection.name,\n description: interfaceIntrospection.description,\n interfaces: () => buildImplementationsList(interfaceIntrospection),\n fields: () => buildFieldDefMap(interfaceIntrospection),\n });\n }\n\n function buildUnionDef(unionIntrospection) {\n if (!unionIntrospection.possibleTypes) {\n const unionIntrospectionStr = inspect(unionIntrospection);\n throw new Error(\n `Introspection result missing possibleTypes: ${unionIntrospectionStr}.`,\n );\n }\n\n return new GraphQLUnionType({\n name: unionIntrospection.name,\n description: unionIntrospection.description,\n types: () => unionIntrospection.possibleTypes.map(getObjectType),\n });\n }\n\n function buildEnumDef(enumIntrospection) {\n if (!enumIntrospection.enumValues) {\n const enumIntrospectionStr = inspect(enumIntrospection);\n throw new Error(\n `Introspection result missing enumValues: ${enumIntrospectionStr}.`,\n );\n }\n\n return new GraphQLEnumType({\n name: enumIntrospection.name,\n description: enumIntrospection.description,\n values: keyValMap(\n enumIntrospection.enumValues,\n (valueIntrospection) => valueIntrospection.name,\n (valueIntrospection) => ({\n description: valueIntrospection.description,\n deprecationReason: valueIntrospection.deprecationReason,\n }),\n ),\n });\n }\n\n function buildInputObjectDef(inputObjectIntrospection) {\n if (!inputObjectIntrospection.inputFields) {\n const inputObjectIntrospectionStr = inspect(inputObjectIntrospection);\n throw new Error(\n `Introspection result missing inputFields: ${inputObjectIntrospectionStr}.`,\n );\n }\n\n return new GraphQLInputObjectType({\n name: inputObjectIntrospection.name,\n description: inputObjectIntrospection.description,\n fields: () => buildInputValueDefMap(inputObjectIntrospection.inputFields),\n });\n }\n\n function buildFieldDefMap(typeIntrospection) {\n if (!typeIntrospection.fields) {\n throw new Error(\n `Introspection result missing fields: ${inspect(typeIntrospection)}.`,\n );\n }\n\n return keyValMap(\n typeIntrospection.fields,\n (fieldIntrospection) => fieldIntrospection.name,\n buildField,\n );\n }\n\n function buildField(fieldIntrospection) {\n const type = getType(fieldIntrospection.type);\n\n if (!isOutputType(type)) {\n const typeStr = inspect(type);\n throw new Error(\n `Introspection must provide output type for fields, but received: ${typeStr}.`,\n );\n }\n\n if (!fieldIntrospection.args) {\n const fieldIntrospectionStr = inspect(fieldIntrospection);\n throw new Error(\n `Introspection result missing field args: ${fieldIntrospectionStr}.`,\n );\n }\n\n return {\n description: fieldIntrospection.description,\n deprecationReason: fieldIntrospection.deprecationReason,\n type,\n args: buildInputValueDefMap(fieldIntrospection.args),\n };\n }\n\n function buildInputValueDefMap(inputValueIntrospections) {\n return keyValMap(\n inputValueIntrospections,\n (inputValue) => inputValue.name,\n buildInputValue,\n );\n }\n\n function buildInputValue(inputValueIntrospection) {\n const type = getType(inputValueIntrospection.type);\n\n if (!isInputType(type)) {\n const typeStr = inspect(type);\n throw new Error(\n `Introspection must provide input type for arguments, but received: ${typeStr}.`,\n );\n }\n\n const defaultValue =\n inputValueIntrospection.defaultValue != null\n ? valueFromAST(parseValue(inputValueIntrospection.defaultValue), type)\n : undefined;\n return {\n description: inputValueIntrospection.description,\n type,\n defaultValue,\n deprecationReason: inputValueIntrospection.deprecationReason,\n };\n }\n\n function buildDirective(directiveIntrospection) {\n if (!directiveIntrospection.args) {\n const directiveIntrospectionStr = inspect(directiveIntrospection);\n throw new Error(\n `Introspection result missing directive args: ${directiveIntrospectionStr}.`,\n );\n }\n\n if (!directiveIntrospection.locations) {\n const directiveIntrospectionStr = inspect(directiveIntrospection);\n throw new Error(\n `Introspection result missing directive locations: ${directiveIntrospectionStr}.`,\n );\n }\n\n return new GraphQLDirective({\n name: directiveIntrospection.name,\n description: directiveIntrospection.description,\n isRepeatable: directiveIntrospection.isRepeatable,\n locations: directiveIntrospection.locations.slice(),\n args: buildInputValueDefMap(directiveIntrospection.args),\n });\n }\n}\n", "import { devAssert } from '../jsutils/devAssert.mjs';\nimport { inspect } from '../jsutils/inspect.mjs';\nimport { invariant } from '../jsutils/invariant.mjs';\nimport { keyMap } from '../jsutils/keyMap.mjs';\nimport { mapValue } from '../jsutils/mapValue.mjs';\nimport { Kind } from '../language/kinds.mjs';\nimport {\n isTypeDefinitionNode,\n isTypeExtensionNode,\n} from '../language/predicates.mjs';\nimport {\n GraphQLEnumType,\n GraphQLInputObjectType,\n GraphQLInterfaceType,\n GraphQLList,\n GraphQLNonNull,\n GraphQLObjectType,\n GraphQLScalarType,\n GraphQLUnionType,\n isEnumType,\n isInputObjectType,\n isInterfaceType,\n isListType,\n isNonNullType,\n isObjectType,\n isScalarType,\n isUnionType,\n} from '../type/definition.mjs';\nimport {\n GraphQLDeprecatedDirective,\n GraphQLDirective,\n GraphQLSpecifiedByDirective,\n} from '../type/directives.mjs';\nimport {\n introspectionTypes,\n isIntrospectionType,\n} from '../type/introspection.mjs';\nimport {\n isSpecifiedScalarType,\n specifiedScalarTypes,\n} from '../type/scalars.mjs';\nimport { assertSchema, GraphQLSchema } from '../type/schema.mjs';\nimport { assertValidSDLExtension } from '../validation/validate.mjs';\nimport { getDirectiveValues } from '../execution/values.mjs';\nimport { valueFromAST } from './valueFromAST.mjs';\n\n/**\n * Produces a new schema given an existing schema and a document which may\n * contain GraphQL type extensions and definitions. The original schema will\n * remain unaltered.\n *\n * Because a schema represents a graph of references, a schema cannot be\n * extended without effectively making an entire copy. We do not know until it's\n * too late if subgraphs remain unchanged.\n *\n * This algorithm copies the provided schema, applying extensions while\n * producing the copy. The original schema remains unaltered.\n */\nexport function extendSchema(schema, documentAST, options) {\n assertSchema(schema);\n (documentAST != null && documentAST.kind === Kind.DOCUMENT) ||\n devAssert(false, 'Must provide valid Document AST.');\n\n if (\n (options === null || options === void 0 ? void 0 : options.assumeValid) !==\n true &&\n (options === null || options === void 0\n ? void 0\n : options.assumeValidSDL) !== true\n ) {\n assertValidSDLExtension(documentAST, schema);\n }\n\n const schemaConfig = schema.toConfig();\n const extendedConfig = extendSchemaImpl(schemaConfig, documentAST, options);\n return schemaConfig === extendedConfig\n ? schema\n : new GraphQLSchema(extendedConfig);\n}\n/**\n * @internal\n */\n\nexport function extendSchemaImpl(schemaConfig, documentAST, options) {\n var _schemaDef, _schemaDef$descriptio, _schemaDef2, _options$assumeValid;\n\n // Collect the type definitions and extensions found in the document.\n const typeDefs = [];\n const typeExtensionsMap = Object.create(null); // New directives and types are separate because a directives and types can\n // have the same name. For example, a type named \"skip\".\n\n const directiveDefs = [];\n let schemaDef; // Schema extensions are collected which may add additional operation types.\n\n const schemaExtensions = [];\n\n for (const def of documentAST.definitions) {\n if (def.kind === Kind.SCHEMA_DEFINITION) {\n schemaDef = def;\n } else if (def.kind === Kind.SCHEMA_EXTENSION) {\n schemaExtensions.push(def);\n } else if (isTypeDefinitionNode(def)) {\n typeDefs.push(def);\n } else if (isTypeExtensionNode(def)) {\n const extendedTypeName = def.name.value;\n const existingTypeExtensions = typeExtensionsMap[extendedTypeName];\n typeExtensionsMap[extendedTypeName] = existingTypeExtensions\n ? existingTypeExtensions.concat([def])\n : [def];\n } else if (def.kind === Kind.DIRECTIVE_DEFINITION) {\n directiveDefs.push(def);\n }\n } // If this document contains no new types, extensions, or directives then\n // return the same unmodified GraphQLSchema instance.\n\n if (\n Object.keys(typeExtensionsMap).length === 0 &&\n typeDefs.length === 0 &&\n directiveDefs.length === 0 &&\n schemaExtensions.length === 0 &&\n schemaDef == null\n ) {\n return schemaConfig;\n }\n\n const typeMap = Object.create(null);\n\n for (const existingType of schemaConfig.types) {\n typeMap[existingType.name] = extendNamedType(existingType);\n }\n\n for (const typeNode of typeDefs) {\n var _stdTypeMap$name;\n\n const name = typeNode.name.value;\n typeMap[name] =\n (_stdTypeMap$name = stdTypeMap[name]) !== null &&\n _stdTypeMap$name !== void 0\n ? _stdTypeMap$name\n : buildType(typeNode);\n }\n\n const operationTypes = {\n // Get the extended root operation types.\n query: schemaConfig.query && replaceNamedType(schemaConfig.query),\n mutation: schemaConfig.mutation && replaceNamedType(schemaConfig.mutation),\n subscription:\n schemaConfig.subscription && replaceNamedType(schemaConfig.subscription),\n // Then, incorporate schema definition and all schema extensions.\n ...(schemaDef && getOperationTypes([schemaDef])),\n ...getOperationTypes(schemaExtensions),\n }; // Then produce and return a Schema config with these types.\n\n return {\n description:\n (_schemaDef = schemaDef) === null || _schemaDef === void 0\n ? void 0\n : (_schemaDef$descriptio = _schemaDef.description) === null ||\n _schemaDef$descriptio === void 0\n ? void 0\n : _schemaDef$descriptio.value,\n ...operationTypes,\n types: Object.values(typeMap),\n directives: [\n ...schemaConfig.directives.map(replaceDirective),\n ...directiveDefs.map(buildDirective),\n ],\n extensions: Object.create(null),\n astNode:\n (_schemaDef2 = schemaDef) !== null && _schemaDef2 !== void 0\n ? _schemaDef2\n : schemaConfig.astNode,\n extensionASTNodes: schemaConfig.extensionASTNodes.concat(schemaExtensions),\n assumeValid:\n (_options$assumeValid =\n options === null || options === void 0\n ? void 0\n : options.assumeValid) !== null && _options$assumeValid !== void 0\n ? _options$assumeValid\n : false,\n }; // Below are functions used for producing this schema that have closed over\n // this scope and have access to the schema, cache, and newly defined types.\n\n function replaceType(type) {\n if (isListType(type)) {\n // @ts-expect-error\n return new GraphQLList(replaceType(type.ofType));\n }\n\n if (isNonNullType(type)) {\n // @ts-expect-error\n return new GraphQLNonNull(replaceType(type.ofType));\n } // @ts-expect-error FIXME\n\n return replaceNamedType(type);\n }\n\n function replaceNamedType(type) {\n // Note: While this could make early assertions to get the correctly\n // typed values, that would throw immediately while type system\n // validation with validateSchema() will produce more actionable results.\n return typeMap[type.name];\n }\n\n function replaceDirective(directive) {\n const config = directive.toConfig();\n return new GraphQLDirective({\n ...config,\n args: mapValue(config.args, extendArg),\n });\n }\n\n function extendNamedType(type) {\n if (isIntrospectionType(type) || isSpecifiedScalarType(type)) {\n // Builtin types are not extended.\n return type;\n }\n\n if (isScalarType(type)) {\n return extendScalarType(type);\n }\n\n if (isObjectType(type)) {\n return extendObjectType(type);\n }\n\n if (isInterfaceType(type)) {\n return extendInterfaceType(type);\n }\n\n if (isUnionType(type)) {\n return extendUnionType(type);\n }\n\n if (isEnumType(type)) {\n return extendEnumType(type);\n }\n\n if (isInputObjectType(type)) {\n return extendInputObjectType(type);\n }\n /* c8 ignore next 3 */\n // Not reachable, all possible type definition nodes have been considered.\n\n false || invariant(false, 'Unexpected type: ' + inspect(type));\n }\n\n function extendInputObjectType(type) {\n var _typeExtensionsMap$co;\n\n const config = type.toConfig();\n const extensions =\n (_typeExtensionsMap$co = typeExtensionsMap[config.name]) !== null &&\n _typeExtensionsMap$co !== void 0\n ? _typeExtensionsMap$co\n : [];\n return new GraphQLInputObjectType({\n ...config,\n fields: () => ({\n ...mapValue(config.fields, (field) => ({\n ...field,\n type: replaceType(field.type),\n })),\n ...buildInputFieldMap(extensions),\n }),\n extensionASTNodes: config.extensionASTNodes.concat(extensions),\n });\n }\n\n function extendEnumType(type) {\n var _typeExtensionsMap$ty;\n\n const config = type.toConfig();\n const extensions =\n (_typeExtensionsMap$ty = typeExtensionsMap[type.name]) !== null &&\n _typeExtensionsMap$ty !== void 0\n ? _typeExtensionsMap$ty\n : [];\n return new GraphQLEnumType({\n ...config,\n values: { ...config.values, ...buildEnumValueMap(extensions) },\n extensionASTNodes: config.extensionASTNodes.concat(extensions),\n });\n }\n\n function extendScalarType(type) {\n var _typeExtensionsMap$co2;\n\n const config = type.toConfig();\n const extensions =\n (_typeExtensionsMap$co2 = typeExtensionsMap[config.name]) !== null &&\n _typeExtensionsMap$co2 !== void 0\n ? _typeExtensionsMap$co2\n : [];\n let specifiedByURL = config.specifiedByURL;\n\n for (const extensionNode of extensions) {\n var _getSpecifiedByURL;\n\n specifiedByURL =\n (_getSpecifiedByURL = getSpecifiedByURL(extensionNode)) !== null &&\n _getSpecifiedByURL !== void 0\n ? _getSpecifiedByURL\n : specifiedByURL;\n }\n\n return new GraphQLScalarType({\n ...config,\n specifiedByURL,\n extensionASTNodes: config.extensionASTNodes.concat(extensions),\n });\n }\n\n function extendObjectType(type) {\n var _typeExtensionsMap$co3;\n\n const config = type.toConfig();\n const extensions =\n (_typeExtensionsMap$co3 = typeExtensionsMap[config.name]) !== null &&\n _typeExtensionsMap$co3 !== void 0\n ? _typeExtensionsMap$co3\n : [];\n return new GraphQLObjectType({\n ...config,\n interfaces: () => [\n ...type.getInterfaces().map(replaceNamedType),\n ...buildInterfaces(extensions),\n ],\n fields: () => ({\n ...mapValue(config.fields, extendField),\n ...buildFieldMap(extensions),\n }),\n extensionASTNodes: config.extensionASTNodes.concat(extensions),\n });\n }\n\n function extendInterfaceType(type) {\n var _typeExtensionsMap$co4;\n\n const config = type.toConfig();\n const extensions =\n (_typeExtensionsMap$co4 = typeExtensionsMap[config.name]) !== null &&\n _typeExtensionsMap$co4 !== void 0\n ? _typeExtensionsMap$co4\n : [];\n return new GraphQLInterfaceType({\n ...config,\n interfaces: () => [\n ...type.getInterfaces().map(replaceNamedType),\n ...buildInterfaces(extensions),\n ],\n fields: () => ({\n ...mapValue(config.fields, extendField),\n ...buildFieldMap(extensions),\n }),\n extensionASTNodes: config.extensionASTNodes.concat(extensions),\n });\n }\n\n function extendUnionType(type) {\n var _typeExtensionsMap$co5;\n\n const config = type.toConfig();\n const extensions =\n (_typeExtensionsMap$co5 = typeExtensionsMap[config.name]) !== null &&\n _typeExtensionsMap$co5 !== void 0\n ? _typeExtensionsMap$co5\n : [];\n return new GraphQLUnionType({\n ...config,\n types: () => [\n ...type.getTypes().map(replaceNamedType),\n ...buildUnionTypes(extensions),\n ],\n extensionASTNodes: config.extensionASTNodes.concat(extensions),\n });\n }\n\n function extendField(field) {\n return {\n ...field,\n type: replaceType(field.type),\n args: field.args && mapValue(field.args, extendArg),\n };\n }\n\n function extendArg(arg) {\n return { ...arg, type: replaceType(arg.type) };\n }\n\n function getOperationTypes(nodes) {\n const opTypes = {};\n\n for (const node of nodes) {\n var _node$operationTypes;\n\n // FIXME: https://github.com/graphql/graphql-js/issues/2203\n const operationTypesNodes =\n /* c8 ignore next */\n (_node$operationTypes = node.operationTypes) !== null &&\n _node$operationTypes !== void 0\n ? _node$operationTypes\n : [];\n\n for (const operationType of operationTypesNodes) {\n // Note: While this could make early assertions to get the correctly\n // typed values below, that would throw immediately while type system\n // validation with validateSchema() will produce more actionable results.\n // @ts-expect-error\n opTypes[operationType.operation] = getNamedType(operationType.type);\n }\n }\n\n return opTypes;\n }\n\n function getNamedType(node) {\n var _stdTypeMap$name2;\n\n const name = node.name.value;\n const type =\n (_stdTypeMap$name2 = stdTypeMap[name]) !== null &&\n _stdTypeMap$name2 !== void 0\n ? _stdTypeMap$name2\n : typeMap[name];\n\n if (type === undefined) {\n throw new Error(`Unknown type: \"${name}\".`);\n }\n\n return type;\n }\n\n function getWrappedType(node) {\n if (node.kind === Kind.LIST_TYPE) {\n return new GraphQLList(getWrappedType(node.type));\n }\n\n if (node.kind === Kind.NON_NULL_TYPE) {\n return new GraphQLNonNull(getWrappedType(node.type));\n }\n\n return getNamedType(node);\n }\n\n function buildDirective(node) {\n var _node$description;\n\n return new GraphQLDirective({\n name: node.name.value,\n description:\n (_node$description = node.description) === null ||\n _node$description === void 0\n ? void 0\n : _node$description.value,\n // @ts-expect-error\n locations: node.locations.map(({ value }) => value),\n isRepeatable: node.repeatable,\n args: buildArgumentMap(node.arguments),\n astNode: node,\n });\n }\n\n function buildFieldMap(nodes) {\n const fieldConfigMap = Object.create(null);\n\n for (const node of nodes) {\n var _node$fields;\n\n // FIXME: https://github.com/graphql/graphql-js/issues/2203\n const nodeFields =\n /* c8 ignore next */\n (_node$fields = node.fields) !== null && _node$fields !== void 0\n ? _node$fields\n : [];\n\n for (const field of nodeFields) {\n var _field$description;\n\n fieldConfigMap[field.name.value] = {\n // Note: While this could make assertions to get the correctly typed\n // value, that would throw immediately while type system validation\n // with validateSchema() will produce more actionable results.\n type: getWrappedType(field.type),\n description:\n (_field$description = field.description) === null ||\n _field$description === void 0\n ? void 0\n : _field$description.value,\n args: buildArgumentMap(field.arguments),\n deprecationReason: getDeprecationReason(field),\n astNode: field,\n };\n }\n }\n\n return fieldConfigMap;\n }\n\n function buildArgumentMap(args) {\n // FIXME: https://github.com/graphql/graphql-js/issues/2203\n const argsNodes =\n /* c8 ignore next */\n args !== null && args !== void 0 ? args : [];\n const argConfigMap = Object.create(null);\n\n for (const arg of argsNodes) {\n var _arg$description;\n\n // Note: While this could make assertions to get the correctly typed\n // value, that would throw immediately while type system validation\n // with validateSchema() will produce more actionable results.\n const type = getWrappedType(arg.type);\n argConfigMap[arg.name.value] = {\n type,\n description:\n (_arg$description = arg.description) === null ||\n _arg$description === void 0\n ? void 0\n : _arg$description.value,\n defaultValue: valueFromAST(arg.defaultValue, type),\n deprecationReason: getDeprecationReason(arg),\n astNode: arg,\n };\n }\n\n return argConfigMap;\n }\n\n function buildInputFieldMap(nodes) {\n const inputFieldMap = Object.create(null);\n\n for (const node of nodes) {\n var _node$fields2;\n\n // FIXME: https://github.com/graphql/graphql-js/issues/2203\n const fieldsNodes =\n /* c8 ignore next */\n (_node$fields2 = node.fields) !== null && _node$fields2 !== void 0\n ? _node$fields2\n : [];\n\n for (const field of fieldsNodes) {\n var _field$description2;\n\n // Note: While this could make assertions to get the correctly typed\n // value, that would throw immediately while type system validation\n // with validateSchema() will produce more actionable results.\n const type = getWrappedType(field.type);\n inputFieldMap[field.name.value] = {\n type,\n description:\n (_field$description2 = field.description) === null ||\n _field$description2 === void 0\n ? void 0\n : _field$description2.value,\n defaultValue: valueFromAST(field.defaultValue, type),\n deprecationReason: getDeprecationReason(field),\n astNode: field,\n };\n }\n }\n\n return inputFieldMap;\n }\n\n function buildEnumValueMap(nodes) {\n const enumValueMap = Object.create(null);\n\n for (const node of nodes) {\n var _node$values;\n\n // FIXME: https://github.com/graphql/graphql-js/issues/2203\n const valuesNodes =\n /* c8 ignore next */\n (_node$values = node.values) !== null && _node$values !== void 0\n ? _node$values\n : [];\n\n for (const value of valuesNodes) {\n var _value$description;\n\n enumValueMap[value.name.value] = {\n description:\n (_value$description = value.description) === null ||\n _value$description === void 0\n ? void 0\n : _value$description.value,\n deprecationReason: getDeprecationReason(value),\n astNode: value,\n };\n }\n }\n\n return enumValueMap;\n }\n\n function buildInterfaces(nodes) {\n // Note: While this could make assertions to get the correctly typed\n // values below, that would throw immediately while type system\n // validation with validateSchema() will produce more actionable results.\n // @ts-expect-error\n return nodes.flatMap(\n // FIXME: https://github.com/graphql/graphql-js/issues/2203\n (node) => {\n var _node$interfaces$map, _node$interfaces;\n\n return (\n /* c8 ignore next */\n (_node$interfaces$map =\n (_node$interfaces = node.interfaces) === null ||\n _node$interfaces === void 0\n ? void 0\n : _node$interfaces.map(getNamedType)) !== null &&\n _node$interfaces$map !== void 0\n ? _node$interfaces$map\n : []\n );\n },\n );\n }\n\n function buildUnionTypes(nodes) {\n // Note: While this could make assertions to get the correctly typed\n // values below, that would throw immediately while type system\n // validation with validateSchema() will produce more actionable results.\n // @ts-expect-error\n return nodes.flatMap(\n // FIXME: https://github.com/graphql/graphql-js/issues/2203\n (node) => {\n var _node$types$map, _node$types;\n\n return (\n /* c8 ignore next */\n (_node$types$map =\n (_node$types = node.types) === null || _node$types === void 0\n ? void 0\n : _node$types.map(getNamedType)) !== null &&\n _node$types$map !== void 0\n ? _node$types$map\n : []\n );\n },\n );\n }\n\n function buildType(astNode) {\n var _typeExtensionsMap$na;\n\n const name = astNode.name.value;\n const extensionASTNodes =\n (_typeExtensionsMap$na = typeExtensionsMap[name]) !== null &&\n _typeExtensionsMap$na !== void 0\n ? _typeExtensionsMap$na\n : [];\n\n switch (astNode.kind) {\n case Kind.OBJECT_TYPE_DEFINITION: {\n var _astNode$description;\n\n const allNodes = [astNode, ...extensionASTNodes];\n return new GraphQLObjectType({\n name,\n description:\n (_astNode$description = astNode.description) === null ||\n _astNode$description === void 0\n ? void 0\n : _astNode$description.value,\n interfaces: () => buildInterfaces(allNodes),\n fields: () => buildFieldMap(allNodes),\n astNode,\n extensionASTNodes,\n });\n }\n\n case Kind.INTERFACE_TYPE_DEFINITION: {\n var _astNode$description2;\n\n const allNodes = [astNode, ...extensionASTNodes];\n return new GraphQLInterfaceType({\n name,\n description:\n (_astNode$description2 = astNode.description) === null ||\n _astNode$description2 === void 0\n ? void 0\n : _astNode$description2.value,\n interfaces: () => buildInterfaces(allNodes),\n fields: () => buildFieldMap(allNodes),\n astNode,\n extensionASTNodes,\n });\n }\n\n case Kind.ENUM_TYPE_DEFINITION: {\n var _astNode$description3;\n\n const allNodes = [astNode, ...extensionASTNodes];\n return new GraphQLEnumType({\n name,\n description:\n (_astNode$description3 = astNode.description) === null ||\n _astNode$description3 === void 0\n ? void 0\n : _astNode$description3.value,\n values: buildEnumValueMap(allNodes),\n astNode,\n extensionASTNodes,\n });\n }\n\n case Kind.UNION_TYPE_DEFINITION: {\n var _astNode$description4;\n\n const allNodes = [astNode, ...extensionASTNodes];\n return new GraphQLUnionType({\n name,\n description:\n (_astNode$description4 = astNode.description) === null ||\n _astNode$description4 === void 0\n ? void 0\n : _astNode$description4.value,\n types: () => buildUnionTypes(allNodes),\n astNode,\n extensionASTNodes,\n });\n }\n\n case Kind.SCALAR_TYPE_DEFINITION: {\n var _astNode$description5;\n\n return new GraphQLScalarType({\n name,\n description:\n (_astNode$description5 = astNode.description) === null ||\n _astNode$description5 === void 0\n ? void 0\n : _astNode$description5.value,\n specifiedByURL: getSpecifiedByURL(astNode),\n astNode,\n extensionASTNodes,\n });\n }\n\n case Kind.INPUT_OBJECT_TYPE_DEFINITION: {\n var _astNode$description6;\n\n const allNodes = [astNode, ...extensionASTNodes];\n return new GraphQLInputObjectType({\n name,\n description:\n (_astNode$description6 = astNode.description) === null ||\n _astNode$description6 === void 0\n ? void 0\n : _astNode$description6.value,\n fields: () => buildInputFieldMap(allNodes),\n astNode,\n extensionASTNodes,\n });\n }\n }\n }\n}\nconst stdTypeMap = keyMap(\n [...specifiedScalarTypes, ...introspectionTypes],\n (type) => type.name,\n);\n/**\n * Given a field or enum value node, returns the string value for the\n * deprecation reason.\n */\n\nfunction getDeprecationReason(node) {\n const deprecated = getDirectiveValues(GraphQLDeprecatedDirective, node); // @ts-expect-error validated by `getDirectiveValues`\n\n return deprecated === null || deprecated === void 0\n ? void 0\n : deprecated.reason;\n}\n/**\n * Given a scalar node, returns the string value for the specifiedByURL.\n */\n\nfunction getSpecifiedByURL(node) {\n const specifiedBy = getDirectiveValues(GraphQLSpecifiedByDirective, node); // @ts-expect-error validated by `getDirectiveValues`\n\n return specifiedBy === null || specifiedBy === void 0\n ? void 0\n : specifiedBy.url;\n}\n", "import { devAssert } from '../jsutils/devAssert.mjs';\nimport { Kind } from '../language/kinds.mjs';\nimport { parse } from '../language/parser.mjs';\nimport { specifiedDirectives } from '../type/directives.mjs';\nimport { GraphQLSchema } from '../type/schema.mjs';\nimport { assertValidSDL } from '../validation/validate.mjs';\nimport { extendSchemaImpl } from './extendSchema.mjs';\n\n/**\n * This takes the ast of a schema document produced by the parse function in\n * src/language/parser.js.\n *\n * If no schema definition is provided, then it will look for types named Query,\n * Mutation and Subscription.\n *\n * Given that AST it constructs a GraphQLSchema. The resulting schema\n * has no resolve methods, so execution will use default resolvers.\n */\nexport function buildASTSchema(documentAST, options) {\n (documentAST != null && documentAST.kind === Kind.DOCUMENT) ||\n devAssert(false, 'Must provide valid Document AST.');\n\n if (\n (options === null || options === void 0 ? void 0 : options.assumeValid) !==\n true &&\n (options === null || options === void 0\n ? void 0\n : options.assumeValidSDL) !== true\n ) {\n assertValidSDL(documentAST);\n }\n\n const emptySchemaConfig = {\n description: undefined,\n types: [],\n directives: [],\n extensions: Object.create(null),\n extensionASTNodes: [],\n assumeValid: false,\n };\n const config = extendSchemaImpl(emptySchemaConfig, documentAST, options);\n\n if (config.astNode == null) {\n for (const type of config.types) {\n switch (type.name) {\n // Note: While this could make early assertions to get the correctly\n // typed values below, that would throw immediately while type system\n // validation with validateSchema() will produce more actionable results.\n case 'Query':\n // @ts-expect-error validated in `validateSchema`\n config.query = type;\n break;\n\n case 'Mutation':\n // @ts-expect-error validated in `validateSchema`\n config.mutation = type;\n break;\n\n case 'Subscription':\n // @ts-expect-error validated in `validateSchema`\n config.subscription = type;\n break;\n }\n }\n }\n\n const directives = [\n ...config.directives, // If specified directives were not explicitly declared, add them.\n ...specifiedDirectives.filter((stdDirective) =>\n config.directives.every(\n (directive) => directive.name !== stdDirective.name,\n ),\n ),\n ];\n return new GraphQLSchema({ ...config, directives });\n}\n/**\n * A helper function to build a GraphQLSchema directly from a source\n * document.\n */\n\nexport function buildSchema(source, options) {\n const document = parse(source, {\n noLocation:\n options === null || options === void 0 ? void 0 : options.noLocation,\n allowLegacyFragmentVariables:\n options === null || options === void 0\n ? void 0\n : options.allowLegacyFragmentVariables,\n });\n return buildASTSchema(document, {\n assumeValidSDL:\n options === null || options === void 0 ? void 0 : options.assumeValidSDL,\n assumeValid:\n options === null || options === void 0 ? void 0 : options.assumeValid,\n });\n}\n", "import { inspect } from '../jsutils/inspect.mjs';\nimport { invariant } from '../jsutils/invariant.mjs';\nimport { keyValMap } from '../jsutils/keyValMap.mjs';\nimport { naturalCompare } from '../jsutils/naturalCompare.mjs';\nimport {\n GraphQLEnumType,\n GraphQLInputObjectType,\n GraphQLInterfaceType,\n GraphQLList,\n GraphQLNonNull,\n GraphQLObjectType,\n GraphQLUnionType,\n isEnumType,\n isInputObjectType,\n isInterfaceType,\n isListType,\n isNonNullType,\n isObjectType,\n isScalarType,\n isUnionType,\n} from '../type/definition.mjs';\nimport { GraphQLDirective } from '../type/directives.mjs';\nimport { isIntrospectionType } from '../type/introspection.mjs';\nimport { GraphQLSchema } from '../type/schema.mjs';\n/**\n * Sort GraphQLSchema.\n *\n * This function returns a sorted copy of the given GraphQLSchema.\n */\n\nexport function lexicographicSortSchema(schema) {\n const schemaConfig = schema.toConfig();\n const typeMap = keyValMap(\n sortByName(schemaConfig.types),\n (type) => type.name,\n sortNamedType,\n );\n return new GraphQLSchema({\n ...schemaConfig,\n types: Object.values(typeMap),\n directives: sortByName(schemaConfig.directives).map(sortDirective),\n query: replaceMaybeType(schemaConfig.query),\n mutation: replaceMaybeType(schemaConfig.mutation),\n subscription: replaceMaybeType(schemaConfig.subscription),\n });\n\n function replaceType(type) {\n if (isListType(type)) {\n // @ts-expect-error\n return new GraphQLList(replaceType(type.ofType));\n } else if (isNonNullType(type)) {\n // @ts-expect-error\n return new GraphQLNonNull(replaceType(type.ofType));\n } // @ts-expect-error FIXME: TS Conversion\n\n return replaceNamedType(type);\n }\n\n function replaceNamedType(type) {\n return typeMap[type.name];\n }\n\n function replaceMaybeType(maybeType) {\n return maybeType && replaceNamedType(maybeType);\n }\n\n function sortDirective(directive) {\n const config = directive.toConfig();\n return new GraphQLDirective({\n ...config,\n locations: sortBy(config.locations, (x) => x),\n args: sortArgs(config.args),\n });\n }\n\n function sortArgs(args) {\n return sortObjMap(args, (arg) => ({ ...arg, type: replaceType(arg.type) }));\n }\n\n function sortFields(fieldsMap) {\n return sortObjMap(fieldsMap, (field) => ({\n ...field,\n type: replaceType(field.type),\n args: field.args && sortArgs(field.args),\n }));\n }\n\n function sortInputFields(fieldsMap) {\n return sortObjMap(fieldsMap, (field) => ({\n ...field,\n type: replaceType(field.type),\n }));\n }\n\n function sortTypes(array) {\n return sortByName(array).map(replaceNamedType);\n }\n\n function sortNamedType(type) {\n if (isScalarType(type) || isIntrospectionType(type)) {\n return type;\n }\n\n if (isObjectType(type)) {\n const config = type.toConfig();\n return new GraphQLObjectType({\n ...config,\n interfaces: () => sortTypes(config.interfaces),\n fields: () => sortFields(config.fields),\n });\n }\n\n if (isInterfaceType(type)) {\n const config = type.toConfig();\n return new GraphQLInterfaceType({\n ...config,\n interfaces: () => sortTypes(config.interfaces),\n fields: () => sortFields(config.fields),\n });\n }\n\n if (isUnionType(type)) {\n const config = type.toConfig();\n return new GraphQLUnionType({\n ...config,\n types: () => sortTypes(config.types),\n });\n }\n\n if (isEnumType(type)) {\n const config = type.toConfig();\n return new GraphQLEnumType({\n ...config,\n values: sortObjMap(config.values, (value) => value),\n });\n }\n\n if (isInputObjectType(type)) {\n const config = type.toConfig();\n return new GraphQLInputObjectType({\n ...config,\n fields: () => sortInputFields(config.fields),\n });\n }\n /* c8 ignore next 3 */\n // Not reachable, all possible types have been considered.\n\n false || invariant(false, 'Unexpected type: ' + inspect(type));\n }\n}\n\nfunction sortObjMap(map, sortValueFn) {\n const sortedMap = Object.create(null);\n\n for (const key of Object.keys(map).sort(naturalCompare)) {\n sortedMap[key] = sortValueFn(map[key]);\n }\n\n return sortedMap;\n}\n\nfunction sortByName(array) {\n return sortBy(array, (obj) => obj.name);\n}\n\nfunction sortBy(array, mapToKey) {\n return array.slice().sort((obj1, obj2) => {\n const key1 = mapToKey(obj1);\n const key2 = mapToKey(obj2);\n return naturalCompare(key1, key2);\n });\n}\n", "import { inspect } from '../jsutils/inspect.mjs';\nimport { invariant } from '../jsutils/invariant.mjs';\nimport { isPrintableAsBlockString } from '../language/blockString.mjs';\nimport { Kind } from '../language/kinds.mjs';\nimport { print } from '../language/printer.mjs';\nimport {\n isEnumType,\n isInputObjectType,\n isInterfaceType,\n isObjectType,\n isScalarType,\n isUnionType,\n} from '../type/definition.mjs';\nimport {\n DEFAULT_DEPRECATION_REASON,\n isSpecifiedDirective,\n} from '../type/directives.mjs';\nimport { isIntrospectionType } from '../type/introspection.mjs';\nimport { isSpecifiedScalarType } from '../type/scalars.mjs';\nimport { astFromValue } from './astFromValue.mjs';\nexport function printSchema(schema) {\n return printFilteredSchema(\n schema,\n (n) => !isSpecifiedDirective(n),\n isDefinedType,\n );\n}\nexport function printIntrospectionSchema(schema) {\n return printFilteredSchema(schema, isSpecifiedDirective, isIntrospectionType);\n}\n\nfunction isDefinedType(type) {\n return !isSpecifiedScalarType(type) && !isIntrospectionType(type);\n}\n\nfunction printFilteredSchema(schema, directiveFilter, typeFilter) {\n const directives = schema.getDirectives().filter(directiveFilter);\n const types = Object.values(schema.getTypeMap()).filter(typeFilter);\n return [\n printSchemaDefinition(schema),\n ...directives.map((directive) => printDirective(directive)),\n ...types.map((type) => printType(type)),\n ]\n .filter(Boolean)\n .join('\\n\\n');\n}\n\nfunction printSchemaDefinition(schema) {\n if (schema.description == null && isSchemaOfCommonNames(schema)) {\n return;\n }\n\n const operationTypes = [];\n const queryType = schema.getQueryType();\n\n if (queryType) {\n operationTypes.push(` query: ${queryType.name}`);\n }\n\n const mutationType = schema.getMutationType();\n\n if (mutationType) {\n operationTypes.push(` mutation: ${mutationType.name}`);\n }\n\n const subscriptionType = schema.getSubscriptionType();\n\n if (subscriptionType) {\n operationTypes.push(` subscription: ${subscriptionType.name}`);\n }\n\n return printDescription(schema) + `schema {\\n${operationTypes.join('\\n')}\\n}`;\n}\n/**\n * GraphQL schema define root types for each type of operation. These types are\n * the same as any other type and can be named in any manner, however there is\n * a common naming convention:\n *\n * ```graphql\n * schema {\n * query: Query\n * mutation: Mutation\n * subscription: Subscription\n * }\n * ```\n *\n * When using this naming convention, the schema description can be omitted.\n */\n\nfunction isSchemaOfCommonNames(schema) {\n const queryType = schema.getQueryType();\n\n if (queryType && queryType.name !== 'Query') {\n return false;\n }\n\n const mutationType = schema.getMutationType();\n\n if (mutationType && mutationType.name !== 'Mutation') {\n return false;\n }\n\n const subscriptionType = schema.getSubscriptionType();\n\n if (subscriptionType && subscriptionType.name !== 'Subscription') {\n return false;\n }\n\n return true;\n}\n\nexport function printType(type) {\n if (isScalarType(type)) {\n return printScalar(type);\n }\n\n if (isObjectType(type)) {\n return printObject(type);\n }\n\n if (isInterfaceType(type)) {\n return printInterface(type);\n }\n\n if (isUnionType(type)) {\n return printUnion(type);\n }\n\n if (isEnumType(type)) {\n return printEnum(type);\n }\n\n if (isInputObjectType(type)) {\n return printInputObject(type);\n }\n /* c8 ignore next 3 */\n // Not reachable, all possible types have been considered.\n\n false || invariant(false, 'Unexpected type: ' + inspect(type));\n}\n\nfunction printScalar(type) {\n return (\n printDescription(type) + `scalar ${type.name}` + printSpecifiedByURL(type)\n );\n}\n\nfunction printImplementedInterfaces(type) {\n const interfaces = type.getInterfaces();\n return interfaces.length\n ? ' implements ' + interfaces.map((i) => i.name).join(' & ')\n : '';\n}\n\nfunction printObject(type) {\n return (\n printDescription(type) +\n `type ${type.name}` +\n printImplementedInterfaces(type) +\n printFields(type)\n );\n}\n\nfunction printInterface(type) {\n return (\n printDescription(type) +\n `interface ${type.name}` +\n printImplementedInterfaces(type) +\n printFields(type)\n );\n}\n\nfunction printUnion(type) {\n const types = type.getTypes();\n const possibleTypes = types.length ? ' = ' + types.join(' | ') : '';\n return printDescription(type) + 'union ' + type.name + possibleTypes;\n}\n\nfunction printEnum(type) {\n const values = type\n .getValues()\n .map(\n (value, i) =>\n printDescription(value, ' ', !i) +\n ' ' +\n value.name +\n printDeprecated(value.deprecationReason),\n );\n return printDescription(type) + `enum ${type.name}` + printBlock(values);\n}\n\nfunction printInputObject(type) {\n const fields = Object.values(type.getFields()).map(\n (f, i) => printDescription(f, ' ', !i) + ' ' + printInputValue(f),\n );\n return printDescription(type) + `input ${type.name}` + printBlock(fields);\n}\n\nfunction printFields(type) {\n const fields = Object.values(type.getFields()).map(\n (f, i) =>\n printDescription(f, ' ', !i) +\n ' ' +\n f.name +\n printArgs(f.args, ' ') +\n ': ' +\n String(f.type) +\n printDeprecated(f.deprecationReason),\n );\n return printBlock(fields);\n}\n\nfunction printBlock(items) {\n return items.length !== 0 ? ' {\\n' + items.join('\\n') + '\\n}' : '';\n}\n\nfunction printArgs(args, indentation = '') {\n if (args.length === 0) {\n return '';\n } // If every arg does not have a description, print them on one line.\n\n if (args.every((arg) => !arg.description)) {\n return '(' + args.map(printInputValue).join(', ') + ')';\n }\n\n return (\n '(\\n' +\n args\n .map(\n (arg, i) =>\n printDescription(arg, ' ' + indentation, !i) +\n ' ' +\n indentation +\n printInputValue(arg),\n )\n .join('\\n') +\n '\\n' +\n indentation +\n ')'\n );\n}\n\nfunction printInputValue(arg) {\n const defaultAST = astFromValue(arg.defaultValue, arg.type);\n let argDecl = arg.name + ': ' + String(arg.type);\n\n if (defaultAST) {\n argDecl += ` = ${print(defaultAST)}`;\n }\n\n return argDecl + printDeprecated(arg.deprecationReason);\n}\n\nfunction printDirective(directive) {\n return (\n printDescription(directive) +\n 'directive @' +\n directive.name +\n printArgs(directive.args) +\n (directive.isRepeatable ? ' repeatable' : '') +\n ' on ' +\n directive.locations.join(' | ')\n );\n}\n\nfunction printDeprecated(reason) {\n if (reason == null) {\n return '';\n }\n\n if (reason !== DEFAULT_DEPRECATION_REASON) {\n const astValue = print({\n kind: Kind.STRING,\n value: reason,\n });\n return ` @deprecated(reason: ${astValue})`;\n }\n\n return ' @deprecated';\n}\n\nfunction printSpecifiedByURL(scalar) {\n if (scalar.specifiedByURL == null) {\n return '';\n }\n\n const astValue = print({\n kind: Kind.STRING,\n value: scalar.specifiedByURL,\n });\n return ` @specifiedBy(url: ${astValue})`;\n}\n\nfunction printDescription(def, indentation = '', firstInBlock = true) {\n const { description } = def;\n\n if (description == null) {\n return '';\n }\n\n const blockString = print({\n kind: Kind.STRING,\n value: description,\n block: isPrintableAsBlockString(description),\n });\n const prefix =\n indentation && !firstInBlock ? '\\n' + indentation : indentation;\n return prefix + blockString.replace(/\\n/g, '\\n' + indentation) + '\\n';\n}\n", "import { Kind } from '../language/kinds.mjs';\n/**\n * Provided a collection of ASTs, presumably each from different files,\n * concatenate the ASTs together into batched AST, useful for validating many\n * GraphQL source files which together represent one conceptual application.\n */\n\nexport function concatAST(documents) {\n const definitions = [];\n\n for (const doc of documents) {\n definitions.push(...doc.definitions);\n }\n\n return {\n kind: Kind.DOCUMENT,\n definitions,\n };\n}\n", "import { Kind } from '../language/kinds.mjs';\nimport { visit } from '../language/visitor.mjs';\n/**\n * separateOperations accepts a single AST document which may contain many\n * operations and fragments and returns a collection of AST documents each of\n * which contains a single operation as well the fragment definitions it\n * refers to.\n */\n\nexport function separateOperations(documentAST) {\n const operations = [];\n const depGraph = Object.create(null); // Populate metadata and build a dependency graph.\n\n for (const definitionNode of documentAST.definitions) {\n switch (definitionNode.kind) {\n case Kind.OPERATION_DEFINITION:\n operations.push(definitionNode);\n break;\n\n case Kind.FRAGMENT_DEFINITION:\n depGraph[definitionNode.name.value] = collectDependencies(\n definitionNode.selectionSet,\n );\n break;\n\n default: // ignore non-executable definitions\n }\n } // For each operation, produce a new synthesized AST which includes only what\n // is necessary for completing that operation.\n\n const separatedDocumentASTs = Object.create(null);\n\n for (const operation of operations) {\n const dependencies = new Set();\n\n for (const fragmentName of collectDependencies(operation.selectionSet)) {\n collectTransitiveDependencies(dependencies, depGraph, fragmentName);\n } // Provides the empty string for anonymous operations.\n\n const operationName = operation.name ? operation.name.value : ''; // The list of definition nodes to be included for this operation, sorted\n // to retain the same order as the original document.\n\n separatedDocumentASTs[operationName] = {\n kind: Kind.DOCUMENT,\n definitions: documentAST.definitions.filter(\n (node) =>\n node === operation ||\n (node.kind === Kind.FRAGMENT_DEFINITION &&\n dependencies.has(node.name.value)),\n ),\n };\n }\n\n return separatedDocumentASTs;\n}\n\n// From a dependency graph, collects a list of transitive dependencies by\n// recursing through a dependency graph.\nfunction collectTransitiveDependencies(collected, depGraph, fromName) {\n if (!collected.has(fromName)) {\n collected.add(fromName);\n const immediateDeps = depGraph[fromName];\n\n if (immediateDeps !== undefined) {\n for (const toName of immediateDeps) {\n collectTransitiveDependencies(collected, depGraph, toName);\n }\n }\n }\n}\n\nfunction collectDependencies(selectionSet) {\n const dependencies = [];\n visit(selectionSet, {\n FragmentSpread(node) {\n dependencies.push(node.name.value);\n },\n });\n return dependencies;\n}\n", "import { printBlockString } from '../language/blockString.mjs';\nimport { isPunctuatorTokenKind, Lexer } from '../language/lexer.mjs';\nimport { isSource, Source } from '../language/source.mjs';\nimport { TokenKind } from '../language/tokenKind.mjs';\n/**\n * Strips characters that are not significant to the validity or execution\n * of a GraphQL document:\n * - UnicodeBOM\n * - WhiteSpace\n * - LineTerminator\n * - Comment\n * - Comma\n * - BlockString indentation\n *\n * Note: It is required to have a delimiter character between neighboring\n * non-punctuator tokens and this function always uses single space as delimiter.\n *\n * It is guaranteed that both input and output documents if parsed would result\n * in the exact same AST except for nodes location.\n *\n * Warning: It is guaranteed that this function will always produce stable results.\n * However, it's not guaranteed that it will stay the same between different\n * releases due to bugfixes or changes in the GraphQL specification.\n *\n * Query example:\n *\n * ```graphql\n * query SomeQuery($foo: String!, $bar: String) {\n * someField(foo: $foo, bar: $bar) {\n * a\n * b {\n * c\n * d\n * }\n * }\n * }\n * ```\n *\n * Becomes:\n *\n * ```graphql\n * query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{c d}}}\n * ```\n *\n * SDL example:\n *\n * ```graphql\n * \"\"\"\n * Type description\n * \"\"\"\n * type Foo {\n * \"\"\"\n * Field description\n * \"\"\"\n * bar: String\n * }\n * ```\n *\n * Becomes:\n *\n * ```graphql\n * \"\"\"Type description\"\"\" type Foo{\"\"\"Field description\"\"\" bar:String}\n * ```\n */\n\nexport function stripIgnoredCharacters(source) {\n const sourceObj = isSource(source) ? source : new Source(source);\n const body = sourceObj.body;\n const lexer = new Lexer(sourceObj);\n let strippedBody = '';\n let wasLastAddedTokenNonPunctuator = false;\n\n while (lexer.advance().kind !== TokenKind.EOF) {\n const currentToken = lexer.token;\n const tokenKind = currentToken.kind;\n /**\n * Every two non-punctuator tokens should have space between them.\n * Also prevent case of non-punctuator token following by spread resulting\n * in invalid token (e.g. `1...` is invalid Float token).\n */\n\n const isNonPunctuator = !isPunctuatorTokenKind(currentToken.kind);\n\n if (wasLastAddedTokenNonPunctuator) {\n if (isNonPunctuator || currentToken.kind === TokenKind.SPREAD) {\n strippedBody += ' ';\n }\n }\n\n const tokenBody = body.slice(currentToken.start, currentToken.end);\n\n if (tokenKind === TokenKind.BLOCK_STRING) {\n strippedBody += printBlockString(currentToken.value, {\n minimize: true,\n });\n } else {\n strippedBody += tokenBody;\n }\n\n wasLastAddedTokenNonPunctuator = isNonPunctuator;\n }\n\n return strippedBody;\n}\n", "import { devAssert } from '../jsutils/devAssert.mjs';\nimport { GraphQLError } from '../error/GraphQLError.mjs';\nimport { assertName } from '../type/assertName.mjs';\n/* c8 ignore start */\n\n/**\n * Upholds the spec rules about naming.\n * @deprecated Please use `assertName` instead. Will be removed in v17\n */\n\nexport function assertValidName(name) {\n const error = isValidNameError(name);\n\n if (error) {\n throw error;\n }\n\n return name;\n}\n/**\n * Returns an Error if a name is invalid.\n * @deprecated Please use `assertName` instead. Will be removed in v17\n */\n\nexport function isValidNameError(name) {\n typeof name === 'string' || devAssert(false, 'Expected name to be a string.');\n\n if (name.startsWith('__')) {\n return new GraphQLError(\n `Name \"${name}\" must not begin with \"__\", which is reserved by GraphQL introspection.`,\n );\n }\n\n try {\n assertName(name);\n } catch (error) {\n return error;\n }\n}\n/* c8 ignore stop */\n", "import { inspect } from '../jsutils/inspect.mjs';\nimport { invariant } from '../jsutils/invariant.mjs';\nimport { keyMap } from '../jsutils/keyMap.mjs';\nimport { print } from '../language/printer.mjs';\nimport {\n isEnumType,\n isInputObjectType,\n isInterfaceType,\n isListType,\n isNamedType,\n isNonNullType,\n isObjectType,\n isRequiredArgument,\n isRequiredInputField,\n isScalarType,\n isUnionType,\n} from '../type/definition.mjs';\nimport { isSpecifiedScalarType } from '../type/scalars.mjs';\nimport { astFromValue } from './astFromValue.mjs';\nimport { sortValueNode } from './sortValueNode.mjs';\nvar BreakingChangeType;\n\n(function (BreakingChangeType) {\n BreakingChangeType['TYPE_REMOVED'] = 'TYPE_REMOVED';\n BreakingChangeType['TYPE_CHANGED_KIND'] = 'TYPE_CHANGED_KIND';\n BreakingChangeType['TYPE_REMOVED_FROM_UNION'] = 'TYPE_REMOVED_FROM_UNION';\n BreakingChangeType['VALUE_REMOVED_FROM_ENUM'] = 'VALUE_REMOVED_FROM_ENUM';\n BreakingChangeType['REQUIRED_INPUT_FIELD_ADDED'] =\n 'REQUIRED_INPUT_FIELD_ADDED';\n BreakingChangeType['IMPLEMENTED_INTERFACE_REMOVED'] =\n 'IMPLEMENTED_INTERFACE_REMOVED';\n BreakingChangeType['FIELD_REMOVED'] = 'FIELD_REMOVED';\n BreakingChangeType['FIELD_CHANGED_KIND'] = 'FIELD_CHANGED_KIND';\n BreakingChangeType['REQUIRED_ARG_ADDED'] = 'REQUIRED_ARG_ADDED';\n BreakingChangeType['ARG_REMOVED'] = 'ARG_REMOVED';\n BreakingChangeType['ARG_CHANGED_KIND'] = 'ARG_CHANGED_KIND';\n BreakingChangeType['DIRECTIVE_REMOVED'] = 'DIRECTIVE_REMOVED';\n BreakingChangeType['DIRECTIVE_ARG_REMOVED'] = 'DIRECTIVE_ARG_REMOVED';\n BreakingChangeType['REQUIRED_DIRECTIVE_ARG_ADDED'] =\n 'REQUIRED_DIRECTIVE_ARG_ADDED';\n BreakingChangeType['DIRECTIVE_REPEATABLE_REMOVED'] =\n 'DIRECTIVE_REPEATABLE_REMOVED';\n BreakingChangeType['DIRECTIVE_LOCATION_REMOVED'] =\n 'DIRECTIVE_LOCATION_REMOVED';\n})(BreakingChangeType || (BreakingChangeType = {}));\n\nexport { BreakingChangeType };\nvar DangerousChangeType;\n\n(function (DangerousChangeType) {\n DangerousChangeType['VALUE_ADDED_TO_ENUM'] = 'VALUE_ADDED_TO_ENUM';\n DangerousChangeType['TYPE_ADDED_TO_UNION'] = 'TYPE_ADDED_TO_UNION';\n DangerousChangeType['OPTIONAL_INPUT_FIELD_ADDED'] =\n 'OPTIONAL_INPUT_FIELD_ADDED';\n DangerousChangeType['OPTIONAL_ARG_ADDED'] = 'OPTIONAL_ARG_ADDED';\n DangerousChangeType['IMPLEMENTED_INTERFACE_ADDED'] =\n 'IMPLEMENTED_INTERFACE_ADDED';\n DangerousChangeType['ARG_DEFAULT_VALUE_CHANGE'] = 'ARG_DEFAULT_VALUE_CHANGE';\n})(DangerousChangeType || (DangerousChangeType = {}));\n\nexport { DangerousChangeType };\n\n/**\n * Given two schemas, returns an Array containing descriptions of all the types\n * of breaking changes covered by the other functions down below.\n */\nexport function findBreakingChanges(oldSchema, newSchema) {\n // @ts-expect-error\n return findSchemaChanges(oldSchema, newSchema).filter(\n (change) => change.type in BreakingChangeType,\n );\n}\n/**\n * Given two schemas, returns an Array containing descriptions of all the types\n * of potentially dangerous changes covered by the other functions down below.\n */\n\nexport function findDangerousChanges(oldSchema, newSchema) {\n // @ts-expect-error\n return findSchemaChanges(oldSchema, newSchema).filter(\n (change) => change.type in DangerousChangeType,\n );\n}\n\nfunction findSchemaChanges(oldSchema, newSchema) {\n return [\n ...findTypeChanges(oldSchema, newSchema),\n ...findDirectiveChanges(oldSchema, newSchema),\n ];\n}\n\nfunction findDirectiveChanges(oldSchema, newSchema) {\n const schemaChanges = [];\n const directivesDiff = diff(\n oldSchema.getDirectives(),\n newSchema.getDirectives(),\n );\n\n for (const oldDirective of directivesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_REMOVED,\n description: `${oldDirective.name} was removed.`,\n });\n }\n\n for (const [oldDirective, newDirective] of directivesDiff.persisted) {\n const argsDiff = diff(oldDirective.args, newDirective.args);\n\n for (const newArg of argsDiff.added) {\n if (isRequiredArgument(newArg)) {\n schemaChanges.push({\n type: BreakingChangeType.REQUIRED_DIRECTIVE_ARG_ADDED,\n description: `A required arg ${newArg.name} on directive ${oldDirective.name} was added.`,\n });\n }\n }\n\n for (const oldArg of argsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_ARG_REMOVED,\n description: `${oldArg.name} was removed from ${oldDirective.name}.`,\n });\n }\n\n if (oldDirective.isRepeatable && !newDirective.isRepeatable) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_REPEATABLE_REMOVED,\n description: `Repeatable flag was removed from ${oldDirective.name}.`,\n });\n }\n\n for (const location of oldDirective.locations) {\n if (!newDirective.locations.includes(location)) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_LOCATION_REMOVED,\n description: `${location} was removed from ${oldDirective.name}.`,\n });\n }\n }\n }\n\n return schemaChanges;\n}\n\nfunction findTypeChanges(oldSchema, newSchema) {\n const schemaChanges = [];\n const typesDiff = diff(\n Object.values(oldSchema.getTypeMap()),\n Object.values(newSchema.getTypeMap()),\n );\n\n for (const oldType of typesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: isSpecifiedScalarType(oldType)\n ? `Standard scalar ${oldType.name} was removed because it is not referenced anymore.`\n : `${oldType.name} was removed.`,\n });\n }\n\n for (const [oldType, newType] of typesDiff.persisted) {\n if (isEnumType(oldType) && isEnumType(newType)) {\n schemaChanges.push(...findEnumTypeChanges(oldType, newType));\n } else if (isUnionType(oldType) && isUnionType(newType)) {\n schemaChanges.push(...findUnionTypeChanges(oldType, newType));\n } else if (isInputObjectType(oldType) && isInputObjectType(newType)) {\n schemaChanges.push(...findInputObjectTypeChanges(oldType, newType));\n } else if (isObjectType(oldType) && isObjectType(newType)) {\n schemaChanges.push(\n ...findFieldChanges(oldType, newType),\n ...findImplementedInterfacesChanges(oldType, newType),\n );\n } else if (isInterfaceType(oldType) && isInterfaceType(newType)) {\n schemaChanges.push(\n ...findFieldChanges(oldType, newType),\n ...findImplementedInterfacesChanges(oldType, newType),\n );\n } else if (oldType.constructor !== newType.constructor) {\n schemaChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description:\n `${oldType.name} changed from ` +\n `${typeKindName(oldType)} to ${typeKindName(newType)}.`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction findInputObjectTypeChanges(oldType, newType) {\n const schemaChanges = [];\n const fieldsDiff = diff(\n Object.values(oldType.getFields()),\n Object.values(newType.getFields()),\n );\n\n for (const newField of fieldsDiff.added) {\n if (isRequiredInputField(newField)) {\n schemaChanges.push({\n type: BreakingChangeType.REQUIRED_INPUT_FIELD_ADDED,\n description: `A required field ${newField.name} on input type ${oldType.name} was added.`,\n });\n } else {\n schemaChanges.push({\n type: DangerousChangeType.OPTIONAL_INPUT_FIELD_ADDED,\n description: `An optional field ${newField.name} on input type ${oldType.name} was added.`,\n });\n }\n }\n\n for (const oldField of fieldsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_REMOVED,\n description: `${oldType.name}.${oldField.name} was removed.`,\n });\n }\n\n for (const [oldField, newField] of fieldsDiff.persisted) {\n const isSafe = isChangeSafeForInputObjectFieldOrFieldArg(\n oldField.type,\n newField.type,\n );\n\n if (!isSafe) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_CHANGED_KIND,\n description:\n `${oldType.name}.${oldField.name} changed type from ` +\n `${String(oldField.type)} to ${String(newField.type)}.`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction findUnionTypeChanges(oldType, newType) {\n const schemaChanges = [];\n const possibleTypesDiff = diff(oldType.getTypes(), newType.getTypes());\n\n for (const newPossibleType of possibleTypesDiff.added) {\n schemaChanges.push({\n type: DangerousChangeType.TYPE_ADDED_TO_UNION,\n description: `${newPossibleType.name} was added to union type ${oldType.name}.`,\n });\n }\n\n for (const oldPossibleType of possibleTypesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: `${oldPossibleType.name} was removed from union type ${oldType.name}.`,\n });\n }\n\n return schemaChanges;\n}\n\nfunction findEnumTypeChanges(oldType, newType) {\n const schemaChanges = [];\n const valuesDiff = diff(oldType.getValues(), newType.getValues());\n\n for (const newValue of valuesDiff.added) {\n schemaChanges.push({\n type: DangerousChangeType.VALUE_ADDED_TO_ENUM,\n description: `${newValue.name} was added to enum type ${oldType.name}.`,\n });\n }\n\n for (const oldValue of valuesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n description: `${oldValue.name} was removed from enum type ${oldType.name}.`,\n });\n }\n\n return schemaChanges;\n}\n\nfunction findImplementedInterfacesChanges(oldType, newType) {\n const schemaChanges = [];\n const interfacesDiff = diff(oldType.getInterfaces(), newType.getInterfaces());\n\n for (const newInterface of interfacesDiff.added) {\n schemaChanges.push({\n type: DangerousChangeType.IMPLEMENTED_INTERFACE_ADDED,\n description: `${newInterface.name} added to interfaces implemented by ${oldType.name}.`,\n });\n }\n\n for (const oldInterface of interfacesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.IMPLEMENTED_INTERFACE_REMOVED,\n description: `${oldType.name} no longer implements interface ${oldInterface.name}.`,\n });\n }\n\n return schemaChanges;\n}\n\nfunction findFieldChanges(oldType, newType) {\n const schemaChanges = [];\n const fieldsDiff = diff(\n Object.values(oldType.getFields()),\n Object.values(newType.getFields()),\n );\n\n for (const oldField of fieldsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_REMOVED,\n description: `${oldType.name}.${oldField.name} was removed.`,\n });\n }\n\n for (const [oldField, newField] of fieldsDiff.persisted) {\n schemaChanges.push(...findArgChanges(oldType, oldField, newField));\n const isSafe = isChangeSafeForObjectOrInterfaceField(\n oldField.type,\n newField.type,\n );\n\n if (!isSafe) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_CHANGED_KIND,\n description:\n `${oldType.name}.${oldField.name} changed type from ` +\n `${String(oldField.type)} to ${String(newField.type)}.`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction findArgChanges(oldType, oldField, newField) {\n const schemaChanges = [];\n const argsDiff = diff(oldField.args, newField.args);\n\n for (const oldArg of argsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: `${oldType.name}.${oldField.name} arg ${oldArg.name} was removed.`,\n });\n }\n\n for (const [oldArg, newArg] of argsDiff.persisted) {\n const isSafe = isChangeSafeForInputObjectFieldOrFieldArg(\n oldArg.type,\n newArg.type,\n );\n\n if (!isSafe) {\n schemaChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description:\n `${oldType.name}.${oldField.name} arg ${oldArg.name} has changed type from ` +\n `${String(oldArg.type)} to ${String(newArg.type)}.`,\n });\n } else if (oldArg.defaultValue !== undefined) {\n if (newArg.defaultValue === undefined) {\n schemaChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: `${oldType.name}.${oldField.name} arg ${oldArg.name} defaultValue was removed.`,\n });\n } else {\n // Since we looking only for client's observable changes we should\n // compare default values in the same representation as they are\n // represented inside introspection.\n const oldValueStr = stringifyValue(oldArg.defaultValue, oldArg.type);\n const newValueStr = stringifyValue(newArg.defaultValue, newArg.type);\n\n if (oldValueStr !== newValueStr) {\n schemaChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: `${oldType.name}.${oldField.name} arg ${oldArg.name} has changed defaultValue from ${oldValueStr} to ${newValueStr}.`,\n });\n }\n }\n }\n }\n\n for (const newArg of argsDiff.added) {\n if (isRequiredArgument(newArg)) {\n schemaChanges.push({\n type: BreakingChangeType.REQUIRED_ARG_ADDED,\n description: `A required arg ${newArg.name} on ${oldType.name}.${oldField.name} was added.`,\n });\n } else {\n schemaChanges.push({\n type: DangerousChangeType.OPTIONAL_ARG_ADDED,\n description: `An optional arg ${newArg.name} on ${oldType.name}.${oldField.name} was added.`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction isChangeSafeForObjectOrInterfaceField(oldType, newType) {\n if (isListType(oldType)) {\n return (\n // if they're both lists, make sure the underlying types are compatible\n (isListType(newType) &&\n isChangeSafeForObjectOrInterfaceField(\n oldType.ofType,\n newType.ofType,\n )) || // moving from nullable to non-null of the same underlying type is safe\n (isNonNullType(newType) &&\n isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType))\n );\n }\n\n if (isNonNullType(oldType)) {\n // if they're both non-null, make sure the underlying types are compatible\n return (\n isNonNullType(newType) &&\n isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType)\n );\n }\n\n return (\n // if they're both named types, see if their names are equivalent\n (isNamedType(newType) && oldType.name === newType.name) || // moving from nullable to non-null of the same underlying type is safe\n (isNonNullType(newType) &&\n isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType))\n );\n}\n\nfunction isChangeSafeForInputObjectFieldOrFieldArg(oldType, newType) {\n if (isListType(oldType)) {\n // if they're both lists, make sure the underlying types are compatible\n return (\n isListType(newType) &&\n isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType)\n );\n }\n\n if (isNonNullType(oldType)) {\n return (\n // if they're both non-null, make sure the underlying types are\n // compatible\n (isNonNullType(newType) &&\n isChangeSafeForInputObjectFieldOrFieldArg(\n oldType.ofType,\n newType.ofType,\n )) || // moving from non-null to nullable of the same underlying type is safe\n (!isNonNullType(newType) &&\n isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType))\n );\n } // if they're both named types, see if their names are equivalent\n\n return isNamedType(newType) && oldType.name === newType.name;\n}\n\nfunction typeKindName(type) {\n if (isScalarType(type)) {\n return 'a Scalar type';\n }\n\n if (isObjectType(type)) {\n return 'an Object type';\n }\n\n if (isInterfaceType(type)) {\n return 'an Interface type';\n }\n\n if (isUnionType(type)) {\n return 'a Union type';\n }\n\n if (isEnumType(type)) {\n return 'an Enum type';\n }\n\n if (isInputObjectType(type)) {\n return 'an Input type';\n }\n /* c8 ignore next 3 */\n // Not reachable, all possible types have been considered.\n\n false || invariant(false, 'Unexpected type: ' + inspect(type));\n}\n\nfunction stringifyValue(value, type) {\n const ast = astFromValue(value, type);\n ast != null || invariant(false);\n return print(sortValueNode(ast));\n}\n\nfunction diff(oldArray, newArray) {\n const added = [];\n const removed = [];\n const persisted = [];\n const oldMap = keyMap(oldArray, ({ name }) => name);\n const newMap = keyMap(newArray, ({ name }) => name);\n\n for (const oldItem of oldArray) {\n const newItem = newMap[oldItem.name];\n\n if (newItem === undefined) {\n removed.push(oldItem);\n } else {\n persisted.push([oldItem, newItem]);\n }\n }\n\n for (const newItem of newArray) {\n if (oldMap[newItem.name] === undefined) {\n added.push(newItem);\n }\n }\n\n return {\n added,\n persisted,\n removed,\n };\n}\n"], - "mappings": ";;;AAMO,IAAM,UAAU;AAKhB,IAAM,cAAc,OAAO,OAAO;AAAA,EACvC,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,eAAe;AACjB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it", "parseValue", "TypeKind", "collectSubfields", "getFieldDef", "syntaxError", "getFieldDef", "getNamedType", "getNamedType", "sortFields", "BreakingChangeType", "DangerousChangeType", "stringifyValue"] -} diff --git a/node_modules/.vite/deps/package.json b/node_modules/.vite/deps/package.json deleted file mode 100644 index 3dbc1ca5..00000000 --- a/node_modules/.vite/deps/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "module" -} diff --git a/node_modules/.vite/deps/three.js b/node_modules/.vite/deps/three.js deleted file mode 100644 index 763657f1..00000000 --- a/node_modules/.vite/deps/three.js +++ /dev/null @@ -1,834 +0,0 @@ -import { - ACESFilmicToneMapping, - AddEquation, - AddOperation, - AdditiveAnimationBlendMode, - AdditiveBlending, - AlphaFormat, - AlwaysCompare, - AlwaysDepth, - AlwaysStencilFunc, - AmbientLight, - AnimationAction, - AnimationClip, - AnimationLoader, - AnimationMixer, - AnimationObjectGroup, - AnimationUtils, - ArcCurve, - ArrayCamera, - ArrowHelper, - AttachedBindMode, - Audio, - AudioAnalyser, - AudioContext, - AudioListener, - AudioLoader, - AxesHelper, - BackSide, - BasicDepthPacking, - BasicShadowMap, - Bone, - BooleanKeyframeTrack, - Box2, - Box3, - Box3Helper, - BoxGeometry, - BoxHelper, - BufferAttribute, - BufferGeometry, - BufferGeometryLoader, - ByteType, - Cache, - Camera, - CameraHelper, - CanvasTexture, - CapsuleGeometry, - CatmullRomCurve3, - CineonToneMapping, - CircleGeometry, - ClampToEdgeWrapping, - Clock, - Color, - ColorKeyframeTrack, - ColorManagement, - CompressedArrayTexture, - CompressedCubeTexture, - CompressedTexture, - CompressedTextureLoader, - ConeGeometry, - ConstantAlphaFactor, - ConstantColorFactor, - CubeCamera, - CubeReflectionMapping, - CubeRefractionMapping, - CubeTexture, - CubeTextureLoader, - CubeUVReflectionMapping, - CubicBezierCurve, - CubicBezierCurve3, - CubicInterpolant, - CullFaceBack, - CullFaceFront, - CullFaceFrontBack, - CullFaceNone, - Curve, - CurvePath, - CustomBlending, - CustomToneMapping, - CylinderGeometry, - Cylindrical, - Data3DTexture, - DataArrayTexture, - DataTexture, - DataTextureLoader, - DataUtils, - DecrementStencilOp, - DecrementWrapStencilOp, - DefaultLoadingManager, - DepthFormat, - DepthStencilFormat, - DepthTexture, - DetachedBindMode, - DirectionalLight, - DirectionalLightHelper, - DiscreteInterpolant, - DisplayP3ColorSpace, - DodecahedronGeometry, - DoubleSide, - DstAlphaFactor, - DstColorFactor, - DynamicCopyUsage, - DynamicDrawUsage, - DynamicReadUsage, - EdgesGeometry, - EllipseCurve, - EqualCompare, - EqualDepth, - EqualStencilFunc, - EquirectangularReflectionMapping, - EquirectangularRefractionMapping, - Euler, - EventDispatcher, - ExtrudeGeometry, - FileLoader, - Float16BufferAttribute, - Float32BufferAttribute, - Float64BufferAttribute, - FloatType, - Fog, - FogExp2, - FramebufferTexture, - FrontSide, - Frustum, - GLBufferAttribute, - GLSL1, - GLSL3, - GreaterCompare, - GreaterDepth, - GreaterEqualCompare, - GreaterEqualDepth, - GreaterEqualStencilFunc, - GreaterStencilFunc, - GridHelper, - Group, - HalfFloatType, - HemisphereLight, - HemisphereLightHelper, - IcosahedronGeometry, - ImageBitmapLoader, - ImageLoader, - ImageUtils, - IncrementStencilOp, - IncrementWrapStencilOp, - InstancedBufferAttribute, - InstancedBufferGeometry, - InstancedInterleavedBuffer, - InstancedMesh, - Int16BufferAttribute, - Int32BufferAttribute, - Int8BufferAttribute, - IntType, - InterleavedBuffer, - InterleavedBufferAttribute, - Interpolant, - InterpolateDiscrete, - InterpolateLinear, - InterpolateSmooth, - InvertStencilOp, - KeepStencilOp, - KeyframeTrack, - LOD, - LatheGeometry, - Layers, - LessCompare, - LessDepth, - LessEqualCompare, - LessEqualDepth, - LessEqualStencilFunc, - LessStencilFunc, - Light, - LightProbe, - Line, - Line3, - LineBasicMaterial, - LineCurve, - LineCurve3, - LineDashedMaterial, - LineLoop, - LineSegments, - LinearDisplayP3ColorSpace, - LinearEncoding, - LinearFilter, - LinearInterpolant, - LinearMipMapLinearFilter, - LinearMipMapNearestFilter, - LinearMipmapLinearFilter, - LinearMipmapNearestFilter, - LinearSRGBColorSpace, - LinearToneMapping, - LinearTransfer, - Loader, - LoaderUtils, - LoadingManager, - LoopOnce, - LoopPingPong, - LoopRepeat, - LuminanceAlphaFormat, - LuminanceFormat, - MOUSE, - Material, - MaterialLoader, - MathUtils, - Matrix3, - Matrix4, - MaxEquation, - Mesh, - MeshBasicMaterial, - MeshDepthMaterial, - MeshDistanceMaterial, - MeshLambertMaterial, - MeshMatcapMaterial, - MeshNormalMaterial, - MeshPhongMaterial, - MeshPhysicalMaterial, - MeshStandardMaterial, - MeshToonMaterial, - MinEquation, - MirroredRepeatWrapping, - MixOperation, - MultiplyBlending, - MultiplyOperation, - NearestFilter, - NearestMipMapLinearFilter, - NearestMipMapNearestFilter, - NearestMipmapLinearFilter, - NearestMipmapNearestFilter, - NeverCompare, - NeverDepth, - NeverStencilFunc, - NoBlending, - NoColorSpace, - NoToneMapping, - NormalAnimationBlendMode, - NormalBlending, - NotEqualCompare, - NotEqualDepth, - NotEqualStencilFunc, - NumberKeyframeTrack, - Object3D, - ObjectLoader, - ObjectSpaceNormalMap, - OctahedronGeometry, - OneFactor, - OneMinusConstantAlphaFactor, - OneMinusConstantColorFactor, - OneMinusDstAlphaFactor, - OneMinusDstColorFactor, - OneMinusSrcAlphaFactor, - OneMinusSrcColorFactor, - OrthographicCamera, - P3Primaries, - PCFShadowMap, - PCFSoftShadowMap, - PMREMGenerator, - Path, - PerspectiveCamera, - Plane, - PlaneGeometry, - PlaneHelper, - PointLight, - PointLightHelper, - Points, - PointsMaterial, - PolarGridHelper, - PolyhedronGeometry, - PositionalAudio, - PropertyBinding, - PropertyMixer, - QuadraticBezierCurve, - QuadraticBezierCurve3, - Quaternion, - QuaternionKeyframeTrack, - QuaternionLinearInterpolant, - RED_GREEN_RGTC2_Format, - RED_RGTC1_Format, - REVISION, - RGBADepthPacking, - RGBAFormat, - RGBAIntegerFormat, - RGBA_ASTC_10x10_Format, - RGBA_ASTC_10x5_Format, - RGBA_ASTC_10x6_Format, - RGBA_ASTC_10x8_Format, - RGBA_ASTC_12x10_Format, - RGBA_ASTC_12x12_Format, - RGBA_ASTC_4x4_Format, - RGBA_ASTC_5x4_Format, - RGBA_ASTC_5x5_Format, - RGBA_ASTC_6x5_Format, - RGBA_ASTC_6x6_Format, - RGBA_ASTC_8x5_Format, - RGBA_ASTC_8x6_Format, - RGBA_ASTC_8x8_Format, - RGBA_BPTC_Format, - RGBA_ETC2_EAC_Format, - RGBA_PVRTC_2BPPV1_Format, - RGBA_PVRTC_4BPPV1_Format, - RGBA_S3TC_DXT1_Format, - RGBA_S3TC_DXT3_Format, - RGBA_S3TC_DXT5_Format, - RGB_BPTC_SIGNED_Format, - RGB_BPTC_UNSIGNED_Format, - RGB_ETC1_Format, - RGB_ETC2_Format, - RGB_PVRTC_2BPPV1_Format, - RGB_PVRTC_4BPPV1_Format, - RGB_S3TC_DXT1_Format, - RGFormat, - RGIntegerFormat, - RawShaderMaterial, - Ray, - Raycaster, - Rec709Primaries, - RectAreaLight, - RedFormat, - RedIntegerFormat, - ReinhardToneMapping, - RenderTarget, - RepeatWrapping, - ReplaceStencilOp, - ReverseSubtractEquation, - RingGeometry, - SIGNED_RED_GREEN_RGTC2_Format, - SIGNED_RED_RGTC1_Format, - SRGBColorSpace, - SRGBTransfer, - Scene, - ShaderChunk, - ShaderLib, - ShaderMaterial, - ShadowMaterial, - Shape, - ShapeGeometry, - ShapePath, - ShapeUtils, - ShortType, - Skeleton, - SkeletonHelper, - SkinnedMesh, - Source, - Sphere, - SphereGeometry, - Spherical, - SphericalHarmonics3, - SplineCurve, - SpotLight, - SpotLightHelper, - Sprite, - SpriteMaterial, - SrcAlphaFactor, - SrcAlphaSaturateFactor, - SrcColorFactor, - StaticCopyUsage, - StaticDrawUsage, - StaticReadUsage, - StereoCamera, - StreamCopyUsage, - StreamDrawUsage, - StreamReadUsage, - StringKeyframeTrack, - SubtractEquation, - SubtractiveBlending, - TOUCH, - TangentSpaceNormalMap, - TetrahedronGeometry, - Texture, - TextureLoader, - TorusGeometry, - TorusKnotGeometry, - Triangle, - TriangleFanDrawMode, - TriangleStripDrawMode, - TrianglesDrawMode, - TubeGeometry, - TwoPassDoubleSide, - UVMapping, - Uint16BufferAttribute, - Uint32BufferAttribute, - Uint8BufferAttribute, - Uint8ClampedBufferAttribute, - Uniform, - UniformsGroup, - UniformsLib, - UniformsUtils, - UnsignedByteType, - UnsignedInt248Type, - UnsignedIntType, - UnsignedShort4444Type, - UnsignedShort5551Type, - UnsignedShortType, - VSMShadowMap, - Vector2, - Vector3, - Vector4, - VectorKeyframeTrack, - VideoTexture, - WebGL1Renderer, - WebGL3DRenderTarget, - WebGLArrayRenderTarget, - WebGLCoordinateSystem, - WebGLCubeRenderTarget, - WebGLMultipleRenderTargets, - WebGLRenderTarget, - WebGLRenderer, - WebGLUtils, - WebGPUCoordinateSystem, - WireframeGeometry, - WrapAroundEnding, - ZeroCurvatureEnding, - ZeroFactor, - ZeroSlopeEnding, - ZeroStencilOp, - _SRGBAFormat, - createCanvasElement, - sRGBEncoding -} from "./chunk-6P5T4EWA.js"; -import "./chunk-TXPGJST7.js"; -export { - ACESFilmicToneMapping, - AddEquation, - AddOperation, - AdditiveAnimationBlendMode, - AdditiveBlending, - AlphaFormat, - AlwaysCompare, - AlwaysDepth, - AlwaysStencilFunc, - AmbientLight, - AnimationAction, - AnimationClip, - AnimationLoader, - AnimationMixer, - AnimationObjectGroup, - AnimationUtils, - ArcCurve, - ArrayCamera, - ArrowHelper, - AttachedBindMode, - Audio, - AudioAnalyser, - AudioContext, - AudioListener, - AudioLoader, - AxesHelper, - BackSide, - BasicDepthPacking, - BasicShadowMap, - Bone, - BooleanKeyframeTrack, - Box2, - Box3, - Box3Helper, - BoxGeometry, - BoxHelper, - BufferAttribute, - BufferGeometry, - BufferGeometryLoader, - ByteType, - Cache, - Camera, - CameraHelper, - CanvasTexture, - CapsuleGeometry, - CatmullRomCurve3, - CineonToneMapping, - CircleGeometry, - ClampToEdgeWrapping, - Clock, - Color, - ColorKeyframeTrack, - ColorManagement, - CompressedArrayTexture, - CompressedCubeTexture, - CompressedTexture, - CompressedTextureLoader, - ConeGeometry, - ConstantAlphaFactor, - ConstantColorFactor, - CubeCamera, - CubeReflectionMapping, - CubeRefractionMapping, - CubeTexture, - CubeTextureLoader, - CubeUVReflectionMapping, - CubicBezierCurve, - CubicBezierCurve3, - CubicInterpolant, - CullFaceBack, - CullFaceFront, - CullFaceFrontBack, - CullFaceNone, - Curve, - CurvePath, - CustomBlending, - CustomToneMapping, - CylinderGeometry, - Cylindrical, - Data3DTexture, - DataArrayTexture, - DataTexture, - DataTextureLoader, - DataUtils, - DecrementStencilOp, - DecrementWrapStencilOp, - DefaultLoadingManager, - DepthFormat, - DepthStencilFormat, - DepthTexture, - DetachedBindMode, - DirectionalLight, - DirectionalLightHelper, - DiscreteInterpolant, - DisplayP3ColorSpace, - DodecahedronGeometry, - DoubleSide, - DstAlphaFactor, - DstColorFactor, - DynamicCopyUsage, - DynamicDrawUsage, - DynamicReadUsage, - EdgesGeometry, - EllipseCurve, - EqualCompare, - EqualDepth, - EqualStencilFunc, - EquirectangularReflectionMapping, - EquirectangularRefractionMapping, - Euler, - EventDispatcher, - ExtrudeGeometry, - FileLoader, - Float16BufferAttribute, - Float32BufferAttribute, - Float64BufferAttribute, - FloatType, - Fog, - FogExp2, - FramebufferTexture, - FrontSide, - Frustum, - GLBufferAttribute, - GLSL1, - GLSL3, - GreaterCompare, - GreaterDepth, - GreaterEqualCompare, - GreaterEqualDepth, - GreaterEqualStencilFunc, - GreaterStencilFunc, - GridHelper, - Group, - HalfFloatType, - HemisphereLight, - HemisphereLightHelper, - IcosahedronGeometry, - ImageBitmapLoader, - ImageLoader, - ImageUtils, - IncrementStencilOp, - IncrementWrapStencilOp, - InstancedBufferAttribute, - InstancedBufferGeometry, - InstancedInterleavedBuffer, - InstancedMesh, - Int16BufferAttribute, - Int32BufferAttribute, - Int8BufferAttribute, - IntType, - InterleavedBuffer, - InterleavedBufferAttribute, - Interpolant, - InterpolateDiscrete, - InterpolateLinear, - InterpolateSmooth, - InvertStencilOp, - KeepStencilOp, - KeyframeTrack, - LOD, - LatheGeometry, - Layers, - LessCompare, - LessDepth, - LessEqualCompare, - LessEqualDepth, - LessEqualStencilFunc, - LessStencilFunc, - Light, - LightProbe, - Line, - Line3, - LineBasicMaterial, - LineCurve, - LineCurve3, - LineDashedMaterial, - LineLoop, - LineSegments, - LinearDisplayP3ColorSpace, - LinearEncoding, - LinearFilter, - LinearInterpolant, - LinearMipMapLinearFilter, - LinearMipMapNearestFilter, - LinearMipmapLinearFilter, - LinearMipmapNearestFilter, - LinearSRGBColorSpace, - LinearToneMapping, - LinearTransfer, - Loader, - LoaderUtils, - LoadingManager, - LoopOnce, - LoopPingPong, - LoopRepeat, - LuminanceAlphaFormat, - LuminanceFormat, - MOUSE, - Material, - MaterialLoader, - MathUtils, - Matrix3, - Matrix4, - MaxEquation, - Mesh, - MeshBasicMaterial, - MeshDepthMaterial, - MeshDistanceMaterial, - MeshLambertMaterial, - MeshMatcapMaterial, - MeshNormalMaterial, - MeshPhongMaterial, - MeshPhysicalMaterial, - MeshStandardMaterial, - MeshToonMaterial, - MinEquation, - MirroredRepeatWrapping, - MixOperation, - MultiplyBlending, - MultiplyOperation, - NearestFilter, - NearestMipMapLinearFilter, - NearestMipMapNearestFilter, - NearestMipmapLinearFilter, - NearestMipmapNearestFilter, - NeverCompare, - NeverDepth, - NeverStencilFunc, - NoBlending, - NoColorSpace, - NoToneMapping, - NormalAnimationBlendMode, - NormalBlending, - NotEqualCompare, - NotEqualDepth, - NotEqualStencilFunc, - NumberKeyframeTrack, - Object3D, - ObjectLoader, - ObjectSpaceNormalMap, - OctahedronGeometry, - OneFactor, - OneMinusConstantAlphaFactor, - OneMinusConstantColorFactor, - OneMinusDstAlphaFactor, - OneMinusDstColorFactor, - OneMinusSrcAlphaFactor, - OneMinusSrcColorFactor, - OrthographicCamera, - P3Primaries, - PCFShadowMap, - PCFSoftShadowMap, - PMREMGenerator, - Path, - PerspectiveCamera, - Plane, - PlaneGeometry, - PlaneHelper, - PointLight, - PointLightHelper, - Points, - PointsMaterial, - PolarGridHelper, - PolyhedronGeometry, - PositionalAudio, - PropertyBinding, - PropertyMixer, - QuadraticBezierCurve, - QuadraticBezierCurve3, - Quaternion, - QuaternionKeyframeTrack, - QuaternionLinearInterpolant, - RED_GREEN_RGTC2_Format, - RED_RGTC1_Format, - REVISION, - RGBADepthPacking, - RGBAFormat, - RGBAIntegerFormat, - RGBA_ASTC_10x10_Format, - RGBA_ASTC_10x5_Format, - RGBA_ASTC_10x6_Format, - RGBA_ASTC_10x8_Format, - RGBA_ASTC_12x10_Format, - RGBA_ASTC_12x12_Format, - RGBA_ASTC_4x4_Format, - RGBA_ASTC_5x4_Format, - RGBA_ASTC_5x5_Format, - RGBA_ASTC_6x5_Format, - RGBA_ASTC_6x6_Format, - RGBA_ASTC_8x5_Format, - RGBA_ASTC_8x6_Format, - RGBA_ASTC_8x8_Format, - RGBA_BPTC_Format, - RGBA_ETC2_EAC_Format, - RGBA_PVRTC_2BPPV1_Format, - RGBA_PVRTC_4BPPV1_Format, - RGBA_S3TC_DXT1_Format, - RGBA_S3TC_DXT3_Format, - RGBA_S3TC_DXT5_Format, - RGB_BPTC_SIGNED_Format, - RGB_BPTC_UNSIGNED_Format, - RGB_ETC1_Format, - RGB_ETC2_Format, - RGB_PVRTC_2BPPV1_Format, - RGB_PVRTC_4BPPV1_Format, - RGB_S3TC_DXT1_Format, - RGFormat, - RGIntegerFormat, - RawShaderMaterial, - Ray, - Raycaster, - Rec709Primaries, - RectAreaLight, - RedFormat, - RedIntegerFormat, - ReinhardToneMapping, - RenderTarget, - RepeatWrapping, - ReplaceStencilOp, - ReverseSubtractEquation, - RingGeometry, - SIGNED_RED_GREEN_RGTC2_Format, - SIGNED_RED_RGTC1_Format, - SRGBColorSpace, - SRGBTransfer, - Scene, - ShaderChunk, - ShaderLib, - ShaderMaterial, - ShadowMaterial, - Shape, - ShapeGeometry, - ShapePath, - ShapeUtils, - ShortType, - Skeleton, - SkeletonHelper, - SkinnedMesh, - Source, - Sphere, - SphereGeometry, - Spherical, - SphericalHarmonics3, - SplineCurve, - SpotLight, - SpotLightHelper, - Sprite, - SpriteMaterial, - SrcAlphaFactor, - SrcAlphaSaturateFactor, - SrcColorFactor, - StaticCopyUsage, - StaticDrawUsage, - StaticReadUsage, - StereoCamera, - StreamCopyUsage, - StreamDrawUsage, - StreamReadUsage, - StringKeyframeTrack, - SubtractEquation, - SubtractiveBlending, - TOUCH, - TangentSpaceNormalMap, - TetrahedronGeometry, - Texture, - TextureLoader, - TorusGeometry, - TorusKnotGeometry, - Triangle, - TriangleFanDrawMode, - TriangleStripDrawMode, - TrianglesDrawMode, - TubeGeometry, - TwoPassDoubleSide, - UVMapping, - Uint16BufferAttribute, - Uint32BufferAttribute, - Uint8BufferAttribute, - Uint8ClampedBufferAttribute, - Uniform, - UniformsGroup, - UniformsLib, - UniformsUtils, - UnsignedByteType, - UnsignedInt248Type, - UnsignedIntType, - UnsignedShort4444Type, - UnsignedShort5551Type, - UnsignedShortType, - VSMShadowMap, - Vector2, - Vector3, - Vector4, - VectorKeyframeTrack, - VideoTexture, - WebGL1Renderer, - WebGL3DRenderTarget, - WebGLArrayRenderTarget, - WebGLCoordinateSystem, - WebGLCubeRenderTarget, - WebGLMultipleRenderTargets, - WebGLRenderTarget, - WebGLRenderer, - WebGLUtils, - WebGPUCoordinateSystem, - WireframeGeometry, - WrapAroundEnding, - ZeroCurvatureEnding, - ZeroFactor, - ZeroSlopeEnding, - ZeroStencilOp, - _SRGBAFormat, - createCanvasElement, - sRGBEncoding -}; -//# sourceMappingURL=three.js.map diff --git a/node_modules/.vite/deps/three.js.map b/node_modules/.vite/deps/three.js.map deleted file mode 100644 index 98652118..00000000 --- a/node_modules/.vite/deps/three.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": [], - "sourcesContent": [], - "mappings": "", - "names": [] -} diff --git a/node_modules/.vite/deps/three_addons_geometries_TextGeometry__js.js b/node_modules/.vite/deps/three_addons_geometries_TextGeometry__js.js deleted file mode 100644 index 1f7cb9fc..00000000 --- a/node_modules/.vite/deps/three_addons_geometries_TextGeometry__js.js +++ /dev/null @@ -1,29 +0,0 @@ -import { - ExtrudeGeometry -} from "./chunk-6P5T4EWA.js"; -import "./chunk-TXPGJST7.js"; - -// node_modules/three/examples/jsm/geometries/TextGeometry.js -var TextGeometry = class extends ExtrudeGeometry { - constructor(text, parameters = {}) { - const font = parameters.font; - if (font === void 0) { - super(); - } else { - const shapes = font.generateShapes(text, parameters.size); - parameters.depth = parameters.height !== void 0 ? parameters.height : 50; - if (parameters.bevelThickness === void 0) - parameters.bevelThickness = 10; - if (parameters.bevelSize === void 0) - parameters.bevelSize = 8; - if (parameters.bevelEnabled === void 0) - parameters.bevelEnabled = false; - super(shapes, parameters); - } - this.type = "TextGeometry"; - } -}; -export { - TextGeometry -}; -//# sourceMappingURL=three_addons_geometries_TextGeometry__js.js.map diff --git a/node_modules/.vite/deps/three_addons_geometries_TextGeometry__js.js.map b/node_modules/.vite/deps/three_addons_geometries_TextGeometry__js.js.map deleted file mode 100644 index 6e8025ef..00000000 --- a/node_modules/.vite/deps/three_addons_geometries_TextGeometry__js.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../../three/examples/jsm/geometries/TextGeometry.js"], - "sourcesContent": ["/**\n * Text = 3D Text\n *\n * parameters = {\n * font: , // font\n *\n * size: , // size of the text\n * height: , // thickness to extrude text\n * curveSegments: , // number of points on the curves\n *\n * bevelEnabled: , // turn on bevel\n * bevelThickness: , // how deep into text bevel goes\n * bevelSize: , // how far from text outline (including bevelOffset) is bevel\n * bevelOffset: // how far from text outline does bevel start\n * }\n */\n\nimport {\n\tExtrudeGeometry\n} from 'three';\n\nclass TextGeometry extends ExtrudeGeometry {\n\n\tconstructor( text, parameters = {} ) {\n\n\t\tconst font = parameters.font;\n\n\t\tif ( font === undefined ) {\n\n\t\t\tsuper(); // generate default extrude geometry\n\n\t\t} else {\n\n\t\t\tconst shapes = font.generateShapes( text, parameters.size );\n\n\t\t\t// translate parameters to ExtrudeGeometry API\n\n\t\t\tparameters.depth = parameters.height !== undefined ? parameters.height : 50;\n\n\t\t\t// defaults\n\n\t\t\tif ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10;\n\t\t\tif ( parameters.bevelSize === undefined ) parameters.bevelSize = 8;\n\t\t\tif ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false;\n\n\t\t\tsuper( shapes, parameters );\n\n\t\t}\n\n\t\tthis.type = 'TextGeometry';\n\n\t}\n\n}\n\n\nexport { TextGeometry };\n"], - "mappings": ";;;;;;AAqBA,IAAM,eAAN,cAA2B,gBAAgB;AAAA,EAE1C,YAAa,MAAM,aAAa,CAAC,GAAI;AAEpC,UAAM,OAAO,WAAW;AAExB,QAAK,SAAS,QAAY;AAEzB,YAAM;AAAA,IAEP,OAAO;AAEN,YAAM,SAAS,KAAK,eAAgB,MAAM,WAAW,IAAK;AAI1D,iBAAW,QAAQ,WAAW,WAAW,SAAY,WAAW,SAAS;AAIzE,UAAK,WAAW,mBAAmB;AAAY,mBAAW,iBAAiB;AAC3E,UAAK,WAAW,cAAc;AAAY,mBAAW,YAAY;AACjE,UAAK,WAAW,iBAAiB;AAAY,mBAAW,eAAe;AAEvE,YAAO,QAAQ,UAAW;AAAA,IAE3B;AAEA,SAAK,OAAO;AAAA,EAEb;AAED;", - "names": [] -} diff --git a/node_modules/.vite/deps/three_addons_loaders_FontLoader__js.js b/node_modules/.vite/deps/three_addons_loaders_FontLoader__js.js deleted file mode 100644 index 7061b8b1..00000000 --- a/node_modules/.vite/deps/three_addons_loaders_FontLoader__js.js +++ /dev/null @@ -1,111 +0,0 @@ -import { - FileLoader, - Loader, - ShapePath -} from "./chunk-6P5T4EWA.js"; -import "./chunk-TXPGJST7.js"; - -// node_modules/three/examples/jsm/loaders/FontLoader.js -var FontLoader = class extends Loader { - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - const scope = this; - const loader = new FileLoader(this.manager); - loader.setPath(this.path); - loader.setRequestHeader(this.requestHeader); - loader.setWithCredentials(this.withCredentials); - loader.load(url, function(text) { - const font = scope.parse(JSON.parse(text)); - if (onLoad) - onLoad(font); - }, onProgress, onError); - } - parse(json) { - return new Font(json); - } -}; -var Font = class { - constructor(data) { - this.isFont = true; - this.type = "Font"; - this.data = data; - } - generateShapes(text, size = 100) { - const shapes = []; - const paths = createPaths(text, size, this.data); - for (let p = 0, pl = paths.length; p < pl; p++) { - shapes.push(...paths[p].toShapes()); - } - return shapes; - } -}; -function createPaths(text, size, data) { - const chars = Array.from(text); - const scale = size / data.resolution; - const line_height = (data.boundingBox.yMax - data.boundingBox.yMin + data.underlineThickness) * scale; - const paths = []; - let offsetX = 0, offsetY = 0; - for (let i = 0; i < chars.length; i++) { - const char = chars[i]; - if (char === "\n") { - offsetX = 0; - offsetY -= line_height; - } else { - const ret = createPath(char, scale, offsetX, offsetY, data); - offsetX += ret.offsetX; - paths.push(ret.path); - } - } - return paths; -} -function createPath(char, scale, offsetX, offsetY, data) { - const glyph = data.glyphs[char] || data.glyphs["?"]; - if (!glyph) { - console.error('THREE.Font: character "' + char + '" does not exists in font family ' + data.familyName + "."); - return; - } - const path = new ShapePath(); - let x, y, cpx, cpy, cpx1, cpy1, cpx2, cpy2; - if (glyph.o) { - const outline = glyph._cachedOutline || (glyph._cachedOutline = glyph.o.split(" ")); - for (let i = 0, l = outline.length; i < l; ) { - const action = outline[i++]; - switch (action) { - case "m": - x = outline[i++] * scale + offsetX; - y = outline[i++] * scale + offsetY; - path.moveTo(x, y); - break; - case "l": - x = outline[i++] * scale + offsetX; - y = outline[i++] * scale + offsetY; - path.lineTo(x, y); - break; - case "q": - cpx = outline[i++] * scale + offsetX; - cpy = outline[i++] * scale + offsetY; - cpx1 = outline[i++] * scale + offsetX; - cpy1 = outline[i++] * scale + offsetY; - path.quadraticCurveTo(cpx1, cpy1, cpx, cpy); - break; - case "b": - cpx = outline[i++] * scale + offsetX; - cpy = outline[i++] * scale + offsetY; - cpx1 = outline[i++] * scale + offsetX; - cpy1 = outline[i++] * scale + offsetY; - cpx2 = outline[i++] * scale + offsetX; - cpy2 = outline[i++] * scale + offsetY; - path.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, cpx, cpy); - break; - } - } - } - return { offsetX: glyph.ha * scale, path }; -} -export { - Font, - FontLoader -}; -//# sourceMappingURL=three_addons_loaders_FontLoader__js.js.map diff --git a/node_modules/.vite/deps/three_addons_loaders_FontLoader__js.js.map b/node_modules/.vite/deps/three_addons_loaders_FontLoader__js.js.map deleted file mode 100644 index b0dd79f5..00000000 --- a/node_modules/.vite/deps/three_addons_loaders_FontLoader__js.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../../three/examples/jsm/loaders/FontLoader.js"], - "sourcesContent": ["import {\n\tFileLoader,\n\tLoader,\n\tShapePath\n} from 'three';\n\nclass FontLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\tconst font = scope.parse( JSON.parse( text ) );\n\n\t\t\tif ( onLoad ) onLoad( font );\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\treturn new Font( json );\n\n\t}\n\n}\n\n//\n\nclass Font {\n\n\tconstructor( data ) {\n\n\t\tthis.isFont = true;\n\n\t\tthis.type = 'Font';\n\n\t\tthis.data = data;\n\n\t}\n\n\tgenerateShapes( text, size = 100 ) {\n\n\t\tconst shapes = [];\n\t\tconst paths = createPaths( text, size, this.data );\n\n\t\tfor ( let p = 0, pl = paths.length; p < pl; p ++ ) {\n\n\t\t\tshapes.push( ...paths[ p ].toShapes() );\n\n\t\t}\n\n\t\treturn shapes;\n\n\t}\n\n}\n\nfunction createPaths( text, size, data ) {\n\n\tconst chars = Array.from( text );\n\tconst scale = size / data.resolution;\n\tconst line_height = ( data.boundingBox.yMax - data.boundingBox.yMin + data.underlineThickness ) * scale;\n\n\tconst paths = [];\n\n\tlet offsetX = 0, offsetY = 0;\n\n\tfor ( let i = 0; i < chars.length; i ++ ) {\n\n\t\tconst char = chars[ i ];\n\n\t\tif ( char === '\\n' ) {\n\n\t\t\toffsetX = 0;\n\t\t\toffsetY -= line_height;\n\n\t\t} else {\n\n\t\t\tconst ret = createPath( char, scale, offsetX, offsetY, data );\n\t\t\toffsetX += ret.offsetX;\n\t\t\tpaths.push( ret.path );\n\n\t\t}\n\n\t}\n\n\treturn paths;\n\n}\n\nfunction createPath( char, scale, offsetX, offsetY, data ) {\n\n\tconst glyph = data.glyphs[ char ] || data.glyphs[ '?' ];\n\n\tif ( ! glyph ) {\n\n\t\tconsole.error( 'THREE.Font: character \"' + char + '\" does not exists in font family ' + data.familyName + '.' );\n\n\t\treturn;\n\n\t}\n\n\tconst path = new ShapePath();\n\n\tlet x, y, cpx, cpy, cpx1, cpy1, cpx2, cpy2;\n\n\tif ( glyph.o ) {\n\n\t\tconst outline = glyph._cachedOutline || ( glyph._cachedOutline = glyph.o.split( ' ' ) );\n\n\t\tfor ( let i = 0, l = outline.length; i < l; ) {\n\n\t\t\tconst action = outline[ i ++ ];\n\n\t\t\tswitch ( action ) {\n\n\t\t\t\tcase 'm': // moveTo\n\n\t\t\t\t\tx = outline[ i ++ ] * scale + offsetX;\n\t\t\t\t\ty = outline[ i ++ ] * scale + offsetY;\n\n\t\t\t\t\tpath.moveTo( x, y );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'l': // lineTo\n\n\t\t\t\t\tx = outline[ i ++ ] * scale + offsetX;\n\t\t\t\t\ty = outline[ i ++ ] * scale + offsetY;\n\n\t\t\t\t\tpath.lineTo( x, y );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'q': // quadraticCurveTo\n\n\t\t\t\t\tcpx = outline[ i ++ ] * scale + offsetX;\n\t\t\t\t\tcpy = outline[ i ++ ] * scale + offsetY;\n\t\t\t\t\tcpx1 = outline[ i ++ ] * scale + offsetX;\n\t\t\t\t\tcpy1 = outline[ i ++ ] * scale + offsetY;\n\n\t\t\t\t\tpath.quadraticCurveTo( cpx1, cpy1, cpx, cpy );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'b': // bezierCurveTo\n\n\t\t\t\t\tcpx = outline[ i ++ ] * scale + offsetX;\n\t\t\t\t\tcpy = outline[ i ++ ] * scale + offsetY;\n\t\t\t\t\tcpx1 = outline[ i ++ ] * scale + offsetX;\n\t\t\t\t\tcpy1 = outline[ i ++ ] * scale + offsetY;\n\t\t\t\t\tcpx2 = outline[ i ++ ] * scale + offsetX;\n\t\t\t\t\tcpy2 = outline[ i ++ ] * scale + offsetY;\n\n\t\t\t\t\tpath.bezierCurveTo( cpx1, cpy1, cpx2, cpy2, cpx, cpy );\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn { offsetX: glyph.ha * scale, path: path };\n\n}\n\nexport { FontLoader, Font };\n"], - "mappings": ";;;;;;;;AAMA,IAAM,aAAN,cAAyB,OAAO;AAAA,EAE/B,YAAa,SAAU;AAEtB,UAAO,OAAQ;AAAA,EAEhB;AAAA,EAEA,KAAM,KAAK,QAAQ,YAAY,SAAU;AAExC,UAAM,QAAQ;AAEd,UAAM,SAAS,IAAI,WAAY,KAAK,OAAQ;AAC5C,WAAO,QAAS,KAAK,IAAK;AAC1B,WAAO,iBAAkB,KAAK,aAAc;AAC5C,WAAO,mBAAoB,KAAK,eAAgB;AAChD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A,MAEF;AAAA,IAED;AAAA,EAED;AAEA,SAAO,EAAE,SAAS,MAAM,KAAK,OAAO,KAAW;AAEhD;", - "names": [] -} diff --git a/node_modules/.vite/deps/web3.js b/node_modules/.vite/deps/web3.js deleted file mode 100644 index b39a0181..00000000 --- a/node_modules/.vite/deps/web3.js +++ /dev/null @@ -1,29291 +0,0 @@ -import { - ens_normalize -} from "./chunk-MIR452EH.js"; -import { - __commonJS, - __export, - __toESM -} from "./chunk-TXPGJST7.js"; - -// node_modules/eventemitter3/index.js -var require_eventemitter3 = __commonJS({ - "node_modules/eventemitter3/index.js"(exports, module2) { - "use strict"; - var has = Object.prototype.hasOwnProperty; - var prefix = "~"; - function Events() { - } - if (Object.create) { - Events.prototype = /* @__PURE__ */ Object.create(null); - if (!new Events().__proto__) - prefix = false; - } - function EE(fn, context, once) { - this.fn = fn; - this.context = context; - this.once = once || false; - } - function addListener(emitter, event, fn, context, once) { - if (typeof fn !== "function") { - throw new TypeError("The listener must be a function"); - } - var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event; - if (!emitter._events[evt]) - emitter._events[evt] = listener, emitter._eventsCount++; - else if (!emitter._events[evt].fn) - emitter._events[evt].push(listener); - else - emitter._events[evt] = [emitter._events[evt], listener]; - return emitter; - } - function clearEvent(emitter, evt) { - if (--emitter._eventsCount === 0) - emitter._events = new Events(); - else - delete emitter._events[evt]; - } - function EventEmitter3() { - this._events = new Events(); - this._eventsCount = 0; - } - EventEmitter3.prototype.eventNames = function eventNames() { - var names = [], events, name2; - if (this._eventsCount === 0) - return names; - for (name2 in events = this._events) { - if (has.call(events, name2)) - names.push(prefix ? name2.slice(1) : name2); - } - if (Object.getOwnPropertySymbols) { - return names.concat(Object.getOwnPropertySymbols(events)); - } - return names; - }; - EventEmitter3.prototype.listeners = function listeners(event) { - var evt = prefix ? prefix + event : event, handlers = this._events[evt]; - if (!handlers) - return []; - if (handlers.fn) - return [handlers.fn]; - for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { - ee[i] = handlers[i].fn; - } - return ee; - }; - EventEmitter3.prototype.listenerCount = function listenerCount(event) { - var evt = prefix ? prefix + event : event, listeners = this._events[evt]; - if (!listeners) - return 0; - if (listeners.fn) - return 1; - return listeners.length; - }; - EventEmitter3.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { - var evt = prefix ? prefix + event : event; - if (!this._events[evt]) - return false; - var listeners = this._events[evt], len = arguments.length, args, i; - if (listeners.fn) { - if (listeners.once) - this.removeListener(event, listeners.fn, void 0, true); - switch (len) { - case 1: - return listeners.fn.call(listeners.context), true; - case 2: - return listeners.fn.call(listeners.context, a1), true; - case 3: - return listeners.fn.call(listeners.context, a1, a2), true; - case 4: - return listeners.fn.call(listeners.context, a1, a2, a3), true; - case 5: - return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; - case 6: - return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; - } - for (i = 1, args = new Array(len - 1); i < len; i++) { - args[i - 1] = arguments[i]; - } - listeners.fn.apply(listeners.context, args); - } else { - var length = listeners.length, j; - for (i = 0; i < length; i++) { - if (listeners[i].once) - this.removeListener(event, listeners[i].fn, void 0, true); - switch (len) { - case 1: - listeners[i].fn.call(listeners[i].context); - break; - case 2: - listeners[i].fn.call(listeners[i].context, a1); - break; - case 3: - listeners[i].fn.call(listeners[i].context, a1, a2); - break; - case 4: - listeners[i].fn.call(listeners[i].context, a1, a2, a3); - break; - default: - if (!args) - for (j = 1, args = new Array(len - 1); j < len; j++) { - args[j - 1] = arguments[j]; - } - listeners[i].fn.apply(listeners[i].context, args); - } - } - } - return true; - }; - EventEmitter3.prototype.on = function on(event, fn, context) { - return addListener(this, event, fn, context, false); - }; - EventEmitter3.prototype.once = function once(event, fn, context) { - return addListener(this, event, fn, context, true); - }; - EventEmitter3.prototype.removeListener = function removeListener(event, fn, context, once) { - var evt = prefix ? prefix + event : event; - if (!this._events[evt]) - return this; - if (!fn) { - clearEvent(this, evt); - return this; - } - var listeners = this._events[evt]; - if (listeners.fn) { - if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) { - clearEvent(this, evt); - } - } else { - for (var i = 0, events = [], length = listeners.length; i < length; i++) { - if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) { - events.push(listeners[i]); - } - } - if (events.length) - this._events[evt] = events.length === 1 ? events[0] : events; - else - clearEvent(this, evt); - } - return this; - }; - EventEmitter3.prototype.removeAllListeners = function removeAllListeners(event) { - var evt; - if (event) { - evt = prefix ? prefix + event : event; - if (this._events[evt]) - clearEvent(this, evt); - } else { - this._events = new Events(); - this._eventsCount = 0; - } - return this; - }; - EventEmitter3.prototype.off = EventEmitter3.prototype.removeListener; - EventEmitter3.prototype.addListener = EventEmitter3.prototype.on; - EventEmitter3.prefixed = prefix; - EventEmitter3.EventEmitter = EventEmitter3; - if ("undefined" !== typeof module2) { - module2.exports = EventEmitter3; - } - } -}); - -// node_modules/cross-fetch/dist/browser-ponyfill.js -var require_browser_ponyfill = __commonJS({ - "node_modules/cross-fetch/dist/browser-ponyfill.js"(exports, module2) { - var __global__ = typeof globalThis !== "undefined" && globalThis || typeof self !== "undefined" && self || typeof global !== "undefined" && global; - var __globalThis__ = function() { - function F() { - this.fetch = false; - this.DOMException = __global__.DOMException; - } - F.prototype = __global__; - return new F(); - }(); - (function(globalThis2) { - var irrelevant = function(exports2) { - var global2 = typeof globalThis2 !== "undefined" && globalThis2 || typeof self !== "undefined" && self || typeof global2 !== "undefined" && global2; - var support = { - searchParams: "URLSearchParams" in global2, - iterable: "Symbol" in global2 && "iterator" in Symbol, - blob: "FileReader" in global2 && "Blob" in global2 && function() { - try { - new Blob(); - return true; - } catch (e) { - return false; - } - }(), - formData: "FormData" in global2, - arrayBuffer: "ArrayBuffer" in global2 - }; - function isDataView(obj) { - return obj && DataView.prototype.isPrototypeOf(obj); - } - if (support.arrayBuffer) { - var viewClasses = [ - "[object Int8Array]", - "[object Uint8Array]", - "[object Uint8ClampedArray]", - "[object Int16Array]", - "[object Uint16Array]", - "[object Int32Array]", - "[object Uint32Array]", - "[object Float32Array]", - "[object Float64Array]" - ]; - var isArrayBufferView = ArrayBuffer.isView || function(obj) { - return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1; - }; - } - function normalizeName(name2) { - if (typeof name2 !== "string") { - name2 = String(name2); - } - if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name2) || name2 === "") { - throw new TypeError('Invalid character in header field name: "' + name2 + '"'); - } - return name2.toLowerCase(); - } - function normalizeValue(value) { - if (typeof value !== "string") { - value = String(value); - } - return value; - } - function iteratorFor(items) { - var iterator = { - next: function() { - var value = items.shift(); - return { done: value === void 0, value }; - } - }; - if (support.iterable) { - iterator[Symbol.iterator] = function() { - return iterator; - }; - } - return iterator; - } - function Headers(headers) { - this.map = {}; - if (headers instanceof Headers) { - headers.forEach(function(value, name2) { - this.append(name2, value); - }, this); - } else if (Array.isArray(headers)) { - headers.forEach(function(header) { - this.append(header[0], header[1]); - }, this); - } else if (headers) { - Object.getOwnPropertyNames(headers).forEach(function(name2) { - this.append(name2, headers[name2]); - }, this); - } - } - Headers.prototype.append = function(name2, value) { - name2 = normalizeName(name2); - value = normalizeValue(value); - var oldValue = this.map[name2]; - this.map[name2] = oldValue ? oldValue + ", " + value : value; - }; - Headers.prototype["delete"] = function(name2) { - delete this.map[normalizeName(name2)]; - }; - Headers.prototype.get = function(name2) { - name2 = normalizeName(name2); - return this.has(name2) ? this.map[name2] : null; - }; - Headers.prototype.has = function(name2) { - return this.map.hasOwnProperty(normalizeName(name2)); - }; - Headers.prototype.set = function(name2, value) { - this.map[normalizeName(name2)] = normalizeValue(value); - }; - Headers.prototype.forEach = function(callback, thisArg) { - for (var name2 in this.map) { - if (this.map.hasOwnProperty(name2)) { - callback.call(thisArg, this.map[name2], name2, this); - } - } - }; - Headers.prototype.keys = function() { - var items = []; - this.forEach(function(value, name2) { - items.push(name2); - }); - return iteratorFor(items); - }; - Headers.prototype.values = function() { - var items = []; - this.forEach(function(value) { - items.push(value); - }); - return iteratorFor(items); - }; - Headers.prototype.entries = function() { - var items = []; - this.forEach(function(value, name2) { - items.push([name2, value]); - }); - return iteratorFor(items); - }; - if (support.iterable) { - Headers.prototype[Symbol.iterator] = Headers.prototype.entries; - } - function consumed(body) { - if (body.bodyUsed) { - return Promise.reject(new TypeError("Already read")); - } - body.bodyUsed = true; - } - function fileReaderReady(reader) { - return new Promise(function(resolve, reject) { - reader.onload = function() { - resolve(reader.result); - }; - reader.onerror = function() { - reject(reader.error); - }; - }); - } - function readBlobAsArrayBuffer(blob) { - var reader = new FileReader(); - var promise = fileReaderReady(reader); - reader.readAsArrayBuffer(blob); - return promise; - } - function readBlobAsText(blob) { - var reader = new FileReader(); - var promise = fileReaderReady(reader); - reader.readAsText(blob); - return promise; - } - function readArrayBufferAsText(buf) { - var view = new Uint8Array(buf); - var chars = new Array(view.length); - for (var i = 0; i < view.length; i++) { - chars[i] = String.fromCharCode(view[i]); - } - return chars.join(""); - } - function bufferClone(buf) { - if (buf.slice) { - return buf.slice(0); - } else { - var view = new Uint8Array(buf.byteLength); - view.set(new Uint8Array(buf)); - return view.buffer; - } - } - function Body() { - this.bodyUsed = false; - this._initBody = function(body) { - this.bodyUsed = this.bodyUsed; - this._bodyInit = body; - if (!body) { - this._bodyText = ""; - } else if (typeof body === "string") { - this._bodyText = body; - } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { - this._bodyBlob = body; - } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { - this._bodyFormData = body; - } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { - this._bodyText = body.toString(); - } else if (support.arrayBuffer && support.blob && isDataView(body)) { - this._bodyArrayBuffer = bufferClone(body.buffer); - this._bodyInit = new Blob([this._bodyArrayBuffer]); - } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { - this._bodyArrayBuffer = bufferClone(body); - } else { - this._bodyText = body = Object.prototype.toString.call(body); - } - if (!this.headers.get("content-type")) { - if (typeof body === "string") { - this.headers.set("content-type", "text/plain;charset=UTF-8"); - } else if (this._bodyBlob && this._bodyBlob.type) { - this.headers.set("content-type", this._bodyBlob.type); - } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { - this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"); - } - } - }; - if (support.blob) { - this.blob = function() { - var rejected = consumed(this); - if (rejected) { - return rejected; - } - if (this._bodyBlob) { - return Promise.resolve(this._bodyBlob); - } else if (this._bodyArrayBuffer) { - return Promise.resolve(new Blob([this._bodyArrayBuffer])); - } else if (this._bodyFormData) { - throw new Error("could not read FormData body as blob"); - } else { - return Promise.resolve(new Blob([this._bodyText])); - } - }; - this.arrayBuffer = function() { - if (this._bodyArrayBuffer) { - var isConsumed = consumed(this); - if (isConsumed) { - return isConsumed; - } - if (ArrayBuffer.isView(this._bodyArrayBuffer)) { - return Promise.resolve( - this._bodyArrayBuffer.buffer.slice( - this._bodyArrayBuffer.byteOffset, - this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength - ) - ); - } else { - return Promise.resolve(this._bodyArrayBuffer); - } - } else { - return this.blob().then(readBlobAsArrayBuffer); - } - }; - } - this.text = function() { - var rejected = consumed(this); - if (rejected) { - return rejected; - } - if (this._bodyBlob) { - return readBlobAsText(this._bodyBlob); - } else if (this._bodyArrayBuffer) { - return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)); - } else if (this._bodyFormData) { - throw new Error("could not read FormData body as text"); - } else { - return Promise.resolve(this._bodyText); - } - }; - if (support.formData) { - this.formData = function() { - return this.text().then(decode); - }; - } - this.json = function() { - return this.text().then(JSON.parse); - }; - return this; - } - var methods = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"]; - function normalizeMethod(method) { - var upcased = method.toUpperCase(); - return methods.indexOf(upcased) > -1 ? upcased : method; - } - function Request(input, options) { - if (!(this instanceof Request)) { - throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.'); - } - options = options || {}; - var body = options.body; - if (input instanceof Request) { - if (input.bodyUsed) { - throw new TypeError("Already read"); - } - this.url = input.url; - this.credentials = input.credentials; - if (!options.headers) { - this.headers = new Headers(input.headers); - } - this.method = input.method; - this.mode = input.mode; - this.signal = input.signal; - if (!body && input._bodyInit != null) { - body = input._bodyInit; - input.bodyUsed = true; - } - } else { - this.url = String(input); - } - this.credentials = options.credentials || this.credentials || "same-origin"; - if (options.headers || !this.headers) { - this.headers = new Headers(options.headers); - } - this.method = normalizeMethod(options.method || this.method || "GET"); - this.mode = options.mode || this.mode || null; - this.signal = options.signal || this.signal; - this.referrer = null; - if ((this.method === "GET" || this.method === "HEAD") && body) { - throw new TypeError("Body not allowed for GET or HEAD requests"); - } - this._initBody(body); - if (this.method === "GET" || this.method === "HEAD") { - if (options.cache === "no-store" || options.cache === "no-cache") { - var reParamSearch = /([?&])_=[^&]*/; - if (reParamSearch.test(this.url)) { - this.url = this.url.replace(reParamSearch, "$1_=" + (/* @__PURE__ */ new Date()).getTime()); - } else { - var reQueryString = /\?/; - this.url += (reQueryString.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime(); - } - } - } - } - Request.prototype.clone = function() { - return new Request(this, { body: this._bodyInit }); - }; - function decode(body) { - var form = new FormData(); - body.trim().split("&").forEach(function(bytes2) { - if (bytes2) { - var split2 = bytes2.split("="); - var name2 = split2.shift().replace(/\+/g, " "); - var value = split2.join("=").replace(/\+/g, " "); - form.append(decodeURIComponent(name2), decodeURIComponent(value)); - } - }); - return form; - } - function parseHeaders(rawHeaders) { - var headers = new Headers(); - var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, " "); - preProcessedHeaders.split("\r").map(function(header) { - return header.indexOf("\n") === 0 ? header.substr(1, header.length) : header; - }).forEach(function(line) { - var parts = line.split(":"); - var key = parts.shift().trim(); - if (key) { - var value = parts.join(":").trim(); - headers.append(key, value); - } - }); - return headers; - } - Body.call(Request.prototype); - function Response(bodyInit, options) { - if (!(this instanceof Response)) { - throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.'); - } - if (!options) { - options = {}; - } - this.type = "default"; - this.status = options.status === void 0 ? 200 : options.status; - this.ok = this.status >= 200 && this.status < 300; - this.statusText = options.statusText === void 0 ? "" : "" + options.statusText; - this.headers = new Headers(options.headers); - this.url = options.url || ""; - this._initBody(bodyInit); - } - Body.call(Response.prototype); - Response.prototype.clone = function() { - return new Response(this._bodyInit, { - status: this.status, - statusText: this.statusText, - headers: new Headers(this.headers), - url: this.url - }); - }; - Response.error = function() { - var response = new Response(null, { status: 0, statusText: "" }); - response.type = "error"; - return response; - }; - var redirectStatuses = [301, 302, 303, 307, 308]; - Response.redirect = function(url, status) { - if (redirectStatuses.indexOf(status) === -1) { - throw new RangeError("Invalid status code"); - } - return new Response(null, { status, headers: { location: url } }); - }; - exports2.DOMException = global2.DOMException; - try { - new exports2.DOMException(); - } catch (err) { - exports2.DOMException = function(message, name2) { - this.message = message; - this.name = name2; - var error = Error(message); - this.stack = error.stack; - }; - exports2.DOMException.prototype = Object.create(Error.prototype); - exports2.DOMException.prototype.constructor = exports2.DOMException; - } - function fetch2(input, init) { - return new Promise(function(resolve, reject) { - var request = new Request(input, init); - if (request.signal && request.signal.aborted) { - return reject(new exports2.DOMException("Aborted", "AbortError")); - } - var xhr = new XMLHttpRequest(); - function abortXhr() { - xhr.abort(); - } - xhr.onload = function() { - var options = { - status: xhr.status, - statusText: xhr.statusText, - headers: parseHeaders(xhr.getAllResponseHeaders() || "") - }; - options.url = "responseURL" in xhr ? xhr.responseURL : options.headers.get("X-Request-URL"); - var body = "response" in xhr ? xhr.response : xhr.responseText; - setTimeout(function() { - resolve(new Response(body, options)); - }, 0); - }; - xhr.onerror = function() { - setTimeout(function() { - reject(new TypeError("Network request failed")); - }, 0); - }; - xhr.ontimeout = function() { - setTimeout(function() { - reject(new TypeError("Network request failed")); - }, 0); - }; - xhr.onabort = function() { - setTimeout(function() { - reject(new exports2.DOMException("Aborted", "AbortError")); - }, 0); - }; - function fixUrl(url) { - try { - return url === "" && global2.location.href ? global2.location.href : url; - } catch (e) { - return url; - } - } - xhr.open(request.method, fixUrl(request.url), true); - if (request.credentials === "include") { - xhr.withCredentials = true; - } else if (request.credentials === "omit") { - xhr.withCredentials = false; - } - if ("responseType" in xhr) { - if (support.blob) { - xhr.responseType = "blob"; - } else if (support.arrayBuffer && request.headers.get("Content-Type") && request.headers.get("Content-Type").indexOf("application/octet-stream") !== -1) { - xhr.responseType = "arraybuffer"; - } - } - if (init && typeof init.headers === "object" && !(init.headers instanceof Headers)) { - Object.getOwnPropertyNames(init.headers).forEach(function(name2) { - xhr.setRequestHeader(name2, normalizeValue(init.headers[name2])); - }); - } else { - request.headers.forEach(function(value, name2) { - xhr.setRequestHeader(name2, value); - }); - } - if (request.signal) { - request.signal.addEventListener("abort", abortXhr); - xhr.onreadystatechange = function() { - if (xhr.readyState === 4) { - request.signal.removeEventListener("abort", abortXhr); - } - }; - } - xhr.send(typeof request._bodyInit === "undefined" ? null : request._bodyInit); - }); - } - fetch2.polyfill = true; - if (!global2.fetch) { - global2.fetch = fetch2; - global2.Headers = Headers; - global2.Request = Request; - global2.Response = Response; - } - exports2.Headers = Headers; - exports2.Request = Request; - exports2.Response = Response; - exports2.fetch = fetch2; - return exports2; - }({}); - })(__globalThis__); - __globalThis__.fetch.ponyfill = true; - delete __globalThis__.fetch.polyfill; - var ctx = __global__.fetch ? __global__ : __globalThis__; - exports = ctx.fetch; - exports.default = ctx.fetch; - exports.fetch = ctx.fetch; - exports.Headers = ctx.Headers; - exports.Request = ctx.Request; - exports.Response = ctx.Response; - module2.exports = exports; - } -}); - -// node_modules/@ethereumjs/rlp/dist/index.js -var require_dist = __commonJS({ - "node_modules/@ethereumjs/rlp/dist/index.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.RLP = exports.utils = exports.decode = exports.encode = void 0; - function encode(input) { - if (Array.isArray(input)) { - const output2 = []; - let outputLength = 0; - for (let i = 0; i < input.length; i++) { - const encoded = encode(input[i]); - output2.push(encoded); - outputLength += encoded.length; - } - return concatBytes3(encodeLength(outputLength, 192), ...output2); - } - const inputBuf = toBytes2(input); - if (inputBuf.length === 1 && inputBuf[0] < 128) { - return inputBuf; - } - return concatBytes3(encodeLength(inputBuf.length, 128), inputBuf); - } - exports.encode = encode; - function safeSlice(input, start, end) { - if (end > input.length) { - throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds"); - } - return input.slice(start, end); - } - function decodeLength(v) { - if (v[0] === 0) { - throw new Error("invalid RLP: extra zeros"); - } - return parseHexByte(bytesToHex4(v)); - } - function encodeLength(len, offset) { - if (len < 56) { - return Uint8Array.from([len + offset]); - } - const hexLength = numberToHex3(len); - const lLength = hexLength.length / 2; - const firstByte = numberToHex3(offset + 55 + lLength); - return Uint8Array.from(hexToBytes4(firstByte + hexLength)); - } - function decode(input, stream = false) { - if (typeof input === "undefined" || input === null || input.length === 0) { - return Uint8Array.from([]); - } - const inputBytes = toBytes2(input); - const decoded = _decode(inputBytes); - if (stream) { - return decoded; - } - if (decoded.remainder.length !== 0) { - throw new Error("invalid RLP: remainder must be zero"); - } - return decoded.data; - } - exports.decode = decode; - function _decode(input) { - let length, llength, data, innerRemainder, d; - const decoded = []; - const firstByte = input[0]; - if (firstByte <= 127) { - return { - data: input.slice(0, 1), - remainder: input.slice(1) - }; - } else if (firstByte <= 183) { - length = firstByte - 127; - if (firstByte === 128) { - data = Uint8Array.from([]); - } else { - data = safeSlice(input, 1, length); - } - if (length === 2 && data[0] < 128) { - throw new Error("invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed"); - } - return { - data, - remainder: input.slice(length) - }; - } else if (firstByte <= 191) { - llength = firstByte - 182; - if (input.length - 1 < llength) { - throw new Error("invalid RLP: not enough bytes for string length"); - } - length = decodeLength(safeSlice(input, 1, llength)); - if (length <= 55) { - throw new Error("invalid RLP: expected string length to be greater than 55"); - } - data = safeSlice(input, llength, length + llength); - return { - data, - remainder: input.slice(length + llength) - }; - } else if (firstByte <= 247) { - length = firstByte - 191; - innerRemainder = safeSlice(input, 1, length); - while (innerRemainder.length) { - d = _decode(innerRemainder); - decoded.push(d.data); - innerRemainder = d.remainder; - } - return { - data: decoded, - remainder: input.slice(length) - }; - } else { - llength = firstByte - 246; - length = decodeLength(safeSlice(input, 1, llength)); - if (length < 56) { - throw new Error("invalid RLP: encoded list too short"); - } - const totalLength = llength + length; - if (totalLength > input.length) { - throw new Error("invalid RLP: total length is larger than the data"); - } - innerRemainder = safeSlice(input, llength, totalLength); - while (innerRemainder.length) { - d = _decode(innerRemainder); - decoded.push(d.data); - innerRemainder = d.remainder; - } - return { - data: decoded, - remainder: input.slice(totalLength) - }; - } - } - var cachedHexes = Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0")); - function bytesToHex4(uint8a) { - let hex = ""; - for (let i = 0; i < uint8a.length; i++) { - hex += cachedHexes[uint8a[i]]; - } - return hex; - } - function parseHexByte(hexByte) { - const byte = Number.parseInt(hexByte, 16); - if (Number.isNaN(byte)) - throw new Error("Invalid byte sequence"); - return byte; - } - function hexToBytes4(hex) { - if (typeof hex !== "string") { - throw new TypeError("hexToBytes: expected string, got " + typeof hex); - } - if (hex.length % 2) - throw new Error("hexToBytes: received invalid unpadded hex"); - const array = new Uint8Array(hex.length / 2); - for (let i = 0; i < array.length; i++) { - const j = i * 2; - array[i] = parseHexByte(hex.slice(j, j + 2)); - } - return array; - } - function concatBytes3(...arrays) { - if (arrays.length === 1) - return arrays[0]; - const length = arrays.reduce((a, arr) => a + arr.length, 0); - const result = new Uint8Array(length); - for (let i = 0, pad = 0; i < arrays.length; i++) { - const arr = arrays[i]; - result.set(arr, pad); - pad += arr.length; - } - return result; - } - function utf8ToBytes4(utf) { - return new TextEncoder().encode(utf); - } - function numberToHex3(integer) { - if (integer < 0) { - throw new Error("Invalid integer as argument, must be unsigned!"); - } - const hex = integer.toString(16); - return hex.length % 2 ? `0${hex}` : hex; - } - function padToEven2(a) { - return a.length % 2 ? `0${a}` : a; - } - function isHexPrefixed2(str) { - return str.length >= 2 && str[0] === "0" && str[1] === "x"; - } - function stripHexPrefix2(str) { - if (typeof str !== "string") { - return str; - } - return isHexPrefixed2(str) ? str.slice(2) : str; - } - function toBytes2(v) { - if (v instanceof Uint8Array) { - return v; - } - if (typeof v === "string") { - if (isHexPrefixed2(v)) { - return hexToBytes4(padToEven2(stripHexPrefix2(v))); - } - return utf8ToBytes4(v); - } - if (typeof v === "number" || typeof v === "bigint") { - if (!v) { - return Uint8Array.from([]); - } - return hexToBytes4(numberToHex3(v)); - } - if (v === null || v === void 0) { - return Uint8Array.from([]); - } - throw new Error("toBytes: received unsupported type " + typeof v); - } - exports.utils = { - bytesToHex: bytesToHex4, - concatBytes: concatBytes3, - hexToBytes: hexToBytes4, - utf8ToBytes: utf8ToBytes4 - }; - exports.RLP = { encode, decode }; - } -}); - -// node_modules/crc-32/crc32.js -var require_crc32 = __commonJS({ - "node_modules/crc-32/crc32.js"(exports) { - var CRC32; - (function(factory) { - if (typeof DO_NOT_EXPORT_CRC === "undefined") { - if ("object" === typeof exports) { - factory(exports); - } else if ("function" === typeof define && define.amd) { - define(function() { - var module3 = {}; - factory(module3); - return module3; - }); - } else { - factory(CRC32 = {}); - } - } else { - factory(CRC32 = {}); - } - })(function(CRC322) { - CRC322.version = "1.2.2"; - function signed_crc_table() { - var c = 0, table = new Array(256); - for (var n = 0; n != 256; ++n) { - c = n; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - table[n] = c; - } - return typeof Int32Array !== "undefined" ? new Int32Array(table) : table; - } - var T0 = signed_crc_table(); - function slice_by_16_tables(T) { - var c = 0, v = 0, n = 0, table = typeof Int32Array !== "undefined" ? new Int32Array(4096) : new Array(4096); - for (n = 0; n != 256; ++n) - table[n] = T[n]; - for (n = 0; n != 256; ++n) { - v = T[n]; - for (c = 256 + n; c < 4096; c += 256) - v = table[c] = v >>> 8 ^ T[v & 255]; - } - var out = []; - for (n = 1; n != 16; ++n) - out[n - 1] = typeof Int32Array !== "undefined" ? table.subarray(n * 256, n * 256 + 256) : table.slice(n * 256, n * 256 + 256); - return out; - } - var TT = slice_by_16_tables(T0); - var T1 = TT[0], T2 = TT[1], T3 = TT[2], T4 = TT[3], T5 = TT[4]; - var T6 = TT[5], T7 = TT[6], T8 = TT[7], T9 = TT[8], Ta = TT[9]; - var Tb = TT[10], Tc = TT[11], Td = TT[12], Te = TT[13], Tf = TT[14]; - function crc32_bstr(bstr, seed) { - var C = seed ^ -1; - for (var i = 0, L = bstr.length; i < L; ) - C = C >>> 8 ^ T0[(C ^ bstr.charCodeAt(i++)) & 255]; - return ~C; - } - function crc32_buf(B, seed) { - var C = seed ^ -1, L = B.length - 15, i = 0; - for (; i < L; ) - C = Tf[B[i++] ^ C & 255] ^ Te[B[i++] ^ C >> 8 & 255] ^ Td[B[i++] ^ C >> 16 & 255] ^ Tc[B[i++] ^ C >>> 24] ^ Tb[B[i++]] ^ Ta[B[i++]] ^ T9[B[i++]] ^ T8[B[i++]] ^ T7[B[i++]] ^ T6[B[i++]] ^ T5[B[i++]] ^ T4[B[i++]] ^ T3[B[i++]] ^ T2[B[i++]] ^ T1[B[i++]] ^ T0[B[i++]]; - L += 15; - while (i < L) - C = C >>> 8 ^ T0[(C ^ B[i++]) & 255]; - return ~C; - } - function crc32_str(str, seed) { - var C = seed ^ -1; - for (var i = 0, L = str.length, c = 0, d = 0; i < L; ) { - c = str.charCodeAt(i++); - if (c < 128) { - C = C >>> 8 ^ T0[(C ^ c) & 255]; - } else if (c < 2048) { - C = C >>> 8 ^ T0[(C ^ (192 | c >> 6 & 31)) & 255]; - C = C >>> 8 ^ T0[(C ^ (128 | c & 63)) & 255]; - } else if (c >= 55296 && c < 57344) { - c = (c & 1023) + 64; - d = str.charCodeAt(i++) & 1023; - C = C >>> 8 ^ T0[(C ^ (240 | c >> 8 & 7)) & 255]; - C = C >>> 8 ^ T0[(C ^ (128 | c >> 2 & 63)) & 255]; - C = C >>> 8 ^ T0[(C ^ (128 | d >> 6 & 15 | (c & 3) << 4)) & 255]; - C = C >>> 8 ^ T0[(C ^ (128 | d & 63)) & 255]; - } else { - C = C >>> 8 ^ T0[(C ^ (224 | c >> 12 & 15)) & 255]; - C = C >>> 8 ^ T0[(C ^ (128 | c >> 6 & 63)) & 255]; - C = C >>> 8 ^ T0[(C ^ (128 | c & 63)) & 255]; - } - } - return ~C; - } - CRC322.table = T0; - CRC322.bstr = crc32_bstr; - CRC322.buf = crc32_buf; - CRC322.str = crc32_str; - }); - } -}); - -// node_modules/setimmediate/setImmediate.js -var require_setImmediate = __commonJS({ - "node_modules/setimmediate/setImmediate.js"(exports) { - (function(global2, undefined2) { - "use strict"; - if (global2.setImmediate) { - return; - } - var nextHandle = 1; - var tasksByHandle = {}; - var currentlyRunningATask = false; - var doc = global2.document; - var registerImmediate; - function setImmediate2(callback) { - if (typeof callback !== "function") { - callback = new Function("" + callback); - } - var args = new Array(arguments.length - 1); - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i + 1]; - } - var task = { callback, args }; - tasksByHandle[nextHandle] = task; - registerImmediate(nextHandle); - return nextHandle++; - } - function clearImmediate(handle) { - delete tasksByHandle[handle]; - } - function run(task) { - var callback = task.callback; - var args = task.args; - switch (args.length) { - case 0: - callback(); - break; - case 1: - callback(args[0]); - break; - case 2: - callback(args[0], args[1]); - break; - case 3: - callback(args[0], args[1], args[2]); - break; - default: - callback.apply(undefined2, args); - break; - } - } - function runIfPresent(handle) { - if (currentlyRunningATask) { - setTimeout(runIfPresent, 0, handle); - } else { - var task = tasksByHandle[handle]; - if (task) { - currentlyRunningATask = true; - try { - run(task); - } finally { - clearImmediate(handle); - currentlyRunningATask = false; - } - } - } - } - function installNextTickImplementation() { - registerImmediate = function(handle) { - process.nextTick(function() { - runIfPresent(handle); - }); - }; - } - function canUsePostMessage() { - if (global2.postMessage && !global2.importScripts) { - var postMessageIsAsynchronous = true; - var oldOnMessage = global2.onmessage; - global2.onmessage = function() { - postMessageIsAsynchronous = false; - }; - global2.postMessage("", "*"); - global2.onmessage = oldOnMessage; - return postMessageIsAsynchronous; - } - } - function installPostMessageImplementation() { - var messagePrefix = "setImmediate$" + Math.random() + "$"; - var onGlobalMessage = function(event) { - if (event.source === global2 && typeof event.data === "string" && event.data.indexOf(messagePrefix) === 0) { - runIfPresent(+event.data.slice(messagePrefix.length)); - } - }; - if (global2.addEventListener) { - global2.addEventListener("message", onGlobalMessage, false); - } else { - global2.attachEvent("onmessage", onGlobalMessage); - } - registerImmediate = function(handle) { - global2.postMessage(messagePrefix + handle, "*"); - }; - } - function installMessageChannelImplementation() { - var channel = new MessageChannel(); - channel.port1.onmessage = function(event) { - var handle = event.data; - runIfPresent(handle); - }; - registerImmediate = function(handle) { - channel.port2.postMessage(handle); - }; - } - function installReadyStateChangeImplementation() { - var html = doc.documentElement; - registerImmediate = function(handle) { - var script = doc.createElement("script"); - script.onreadystatechange = function() { - runIfPresent(handle); - script.onreadystatechange = null; - html.removeChild(script); - script = null; - }; - html.appendChild(script); - }; - } - function installSetTimeoutImplementation() { - registerImmediate = function(handle) { - setTimeout(runIfPresent, 0, handle); - }; - } - var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global2); - attachTo = attachTo && attachTo.setTimeout ? attachTo : global2; - if ({}.toString.call(global2.process) === "[object process]") { - installNextTickImplementation(); - } else if (canUsePostMessage()) { - installPostMessageImplementation(); - } else if (global2.MessageChannel) { - installMessageChannelImplementation(); - } else if (doc && "onreadystatechange" in doc.createElement("script")) { - installReadyStateChangeImplementation(); - } else { - installSetTimeoutImplementation(); - } - attachTo.setImmediate = setImmediate2; - attachTo.clearImmediate = clearImmediate; - })(typeof self === "undefined" ? typeof global === "undefined" ? exports : global : self); - } -}); - -// node_modules/web3-core/lib/esm/index.js -var esm_exports9 = {}; -__export(esm_exports9, { - DEFAULT_BATCH_REQUEST_TIMEOUT: () => DEFAULT_BATCH_REQUEST_TIMEOUT, - Web3BatchRequest: () => Web3BatchRequest, - Web3Config: () => Web3Config, - Web3ConfigEvent: () => Web3ConfigEvent, - Web3Context: () => Web3Context, - Web3EthPluginBase: () => Web3EthPluginBase, - Web3EventEmitter: () => Web3EventEmitter, - Web3PluginBase: () => Web3PluginBase, - Web3PromiEvent: () => Web3PromiEvent, - Web3RequestManager: () => Web3RequestManager, - Web3RequestManagerEvent: () => Web3RequestManagerEvent, - Web3Subscription: () => Web3Subscription, - Web3SubscriptionManager: () => Web3SubscriptionManager, - formatters: () => formatters_exports, - inputAddressFormatter: () => inputAddressFormatter, - inputBlockNumberFormatter: () => inputBlockNumberFormatter, - inputCallFormatter: () => inputCallFormatter, - inputDefaultBlockNumberFormatter: () => inputDefaultBlockNumberFormatter, - inputLogFormatter: () => inputLogFormatter, - inputPostFormatter: () => inputPostFormatter, - inputSignFormatter: () => inputSignFormatter, - inputStorageKeysFormatter: () => inputStorageKeysFormatter, - inputTopicFormatter: () => inputTopicFormatter, - inputTransactionFormatter: () => inputTransactionFormatter, - isEIP1193Provider: () => isEIP1193Provider, - isLegacyRequestProvider: () => isLegacyRequestProvider, - isLegacySendAsyncProvider: () => isLegacySendAsyncProvider, - isLegacySendProvider: () => isLegacySendProvider, - isMetaMaskProvider: () => isMetaMaskProvider, - isSupportSubscriptions: () => isSupportSubscriptions, - isSupportedProvider: () => isSupportedProvider, - isWeb3Provider: () => isWeb3Provider, - outputBigIntegerFormatter: () => outputBigIntegerFormatter, - outputBlockFormatter: () => outputBlockFormatter, - outputLogFormatter: () => outputLogFormatter, - outputPostFormatter: () => outputPostFormatter, - outputProofFormatter: () => outputProofFormatter, - outputSyncingFormatter: () => outputSyncingFormatter, - outputTransactionFormatter: () => outputTransactionFormatter, - outputTransactionReceiptFormatter: () => outputTransactionReceiptFormatter, - txInputOptionsFormatter: () => txInputOptionsFormatter -}); - -// node_modules/web3-errors/lib/esm/index.js -var esm_exports = {}; -__export(esm_exports, { - AbiError: () => AbiError, - BaseWeb3Error: () => BaseWeb3Error, - ChainIdMismatchError: () => ChainIdMismatchError, - ChainMismatchError: () => ChainMismatchError, - CommonOrChainAndHardforkError: () => CommonOrChainAndHardforkError, - ConfigChainMismatchError: () => ConfigChainMismatchError, - ConfigHardforkMismatchError: () => ConfigHardforkMismatchError, - ConnectionCloseError: () => ConnectionCloseError, - ConnectionError: () => ConnectionError, - ConnectionNotOpenError: () => ConnectionNotOpenError, - ConnectionTimeoutError: () => ConnectionTimeoutError, - ContractCodeNotStoredError: () => ContractCodeNotStoredError, - ContractEventDoesNotExistError: () => ContractEventDoesNotExistError, - ContractExecutionError: () => ContractExecutionError, - ContractInstantiationError: () => ContractInstantiationError, - ContractMissingABIError: () => ContractMissingABIError, - ContractMissingDeployDataError: () => ContractMissingDeployDataError, - ContractNoAddressDefinedError: () => ContractNoAddressDefinedError, - ContractNoFromAddressDefinedError: () => ContractNoFromAddressDefinedError, - ContractOnceRequiresCallbackError: () => ContractOnceRequiresCallbackError, - ContractReservedEventError: () => ContractReservedEventError, - ContractTransactionDataAndInputError: () => ContractTransactionDataAndInputError, - EIP1193ProviderRpcError: () => EIP1193ProviderRpcError, - ENSCheckInterfaceSupportError: () => ENSCheckInterfaceSupportError, - ENSNetworkNotSyncedError: () => ENSNetworkNotSyncedError, - ENSUnsupportedNetworkError: () => ENSUnsupportedNetworkError, - ERR_ABI_ENCODING: () => ERR_ABI_ENCODING, - ERR_CONN: () => ERR_CONN, - ERR_CONN_CLOSE: () => ERR_CONN_CLOSE, - ERR_CONN_INVALID: () => ERR_CONN_INVALID, - ERR_CONN_MAX_ATTEMPTS: () => ERR_CONN_MAX_ATTEMPTS, - ERR_CONN_NOT_OPEN: () => ERR_CONN_NOT_OPEN, - ERR_CONN_PENDING_REQUESTS: () => ERR_CONN_PENDING_REQUESTS, - ERR_CONN_TIMEOUT: () => ERR_CONN_TIMEOUT, - ERR_CONTRACT: () => ERR_CONTRACT, - ERR_CONTRACT_ABI_MISSING: () => ERR_CONTRACT_ABI_MISSING, - ERR_CONTRACT_EVENT_NOT_EXISTS: () => ERR_CONTRACT_EVENT_NOT_EXISTS, - ERR_CONTRACT_EXECUTION_REVERTED: () => ERR_CONTRACT_EXECUTION_REVERTED, - ERR_CONTRACT_INSTANTIATION: () => ERR_CONTRACT_INSTANTIATION, - ERR_CONTRACT_MISSING_ADDRESS: () => ERR_CONTRACT_MISSING_ADDRESS, - ERR_CONTRACT_MISSING_DEPLOY_DATA: () => ERR_CONTRACT_MISSING_DEPLOY_DATA, - ERR_CONTRACT_MISSING_FROM_ADDRESS: () => ERR_CONTRACT_MISSING_FROM_ADDRESS, - ERR_CONTRACT_REQUIRED_CALLBACK: () => ERR_CONTRACT_REQUIRED_CALLBACK, - ERR_CONTRACT_RESERVED_EVENT: () => ERR_CONTRACT_RESERVED_EVENT, - ERR_CONTRACT_RESOLVER_MISSING: () => ERR_CONTRACT_RESOLVER_MISSING, - ERR_CONTRACT_TX_DATA_AND_INPUT: () => ERR_CONTRACT_TX_DATA_AND_INPUT, - ERR_CORE_CHAIN_MISMATCH: () => ERR_CORE_CHAIN_MISMATCH, - ERR_CORE_HARDFORK_MISMATCH: () => ERR_CORE_HARDFORK_MISMATCH, - ERR_ENS_CHECK_INTERFACE_SUPPORT: () => ERR_ENS_CHECK_INTERFACE_SUPPORT, - ERR_ENS_NETWORK_NOT_SYNCED: () => ERR_ENS_NETWORK_NOT_SYNCED, - ERR_ENS_UNSUPPORTED_NETWORK: () => ERR_ENS_UNSUPPORTED_NETWORK, - ERR_EXISTING_PLUGIN_NAMESPACE: () => ERR_EXISTING_PLUGIN_NAMESPACE, - ERR_FORMATTERS: () => ERR_FORMATTERS, - ERR_INVALID_ADDRESS: () => ERR_INVALID_ADDRESS, - ERR_INVALID_BLOCK: () => ERR_INVALID_BLOCK, - ERR_INVALID_BOOLEAN: () => ERR_INVALID_BOOLEAN, - ERR_INVALID_BYTES: () => ERR_INVALID_BYTES, - ERR_INVALID_CLIENT: () => ERR_INVALID_CLIENT, - ERR_INVALID_HEX: () => ERR_INVALID_HEX, - ERR_INVALID_KEYSTORE: () => ERR_INVALID_KEYSTORE, - ERR_INVALID_LARGE_VALUE: () => ERR_INVALID_LARGE_VALUE, - ERR_INVALID_METHOD_PARAMS: () => ERR_INVALID_METHOD_PARAMS, - ERR_INVALID_NIBBLE_WIDTH: () => ERR_INVALID_NIBBLE_WIDTH, - ERR_INVALID_NUMBER: () => ERR_INVALID_NUMBER, - ERR_INVALID_PASSWORD: () => ERR_INVALID_PASSWORD, - ERR_INVALID_PRIVATE_KEY: () => ERR_INVALID_PRIVATE_KEY, - ERR_INVALID_PROVIDER: () => ERR_INVALID_PROVIDER, - ERR_INVALID_RESPONSE: () => ERR_INVALID_RESPONSE, - ERR_INVALID_SIGNATURE: () => ERR_INVALID_SIGNATURE, - ERR_INVALID_SIZE: () => ERR_INVALID_SIZE, - ERR_INVALID_STRING: () => ERR_INVALID_STRING, - ERR_INVALID_TYPE: () => ERR_INVALID_TYPE, - ERR_INVALID_TYPE_ABI: () => ERR_INVALID_TYPE_ABI, - ERR_INVALID_UNIT: () => ERR_INVALID_UNIT, - ERR_INVALID_UNSIGNED_INTEGER: () => ERR_INVALID_UNSIGNED_INTEGER, - ERR_IV_LENGTH: () => ERR_IV_LENGTH, - ERR_KEY_DERIVATION_FAIL: () => ERR_KEY_DERIVATION_FAIL, - ERR_KEY_VERSION_UNSUPPORTED: () => ERR_KEY_VERSION_UNSUPPORTED, - ERR_METHOD_NOT_IMPLEMENTED: () => ERR_METHOD_NOT_IMPLEMENTED, - ERR_OPERATION_ABORT: () => ERR_OPERATION_ABORT, - ERR_OPERATION_TIMEOUT: () => ERR_OPERATION_TIMEOUT, - ERR_PARAM: () => ERR_PARAM, - ERR_PBKDF2_ITERATIONS: () => ERR_PBKDF2_ITERATIONS, - ERR_PRIVATE_KEY_LENGTH: () => ERR_PRIVATE_KEY_LENGTH, - ERR_PROVIDER: () => ERR_PROVIDER, - ERR_RAW_TX_UNDEFINED: () => ERR_RAW_TX_UNDEFINED, - ERR_REQ_ALREADY_SENT: () => ERR_REQ_ALREADY_SENT, - ERR_RESPONSE: () => ERR_RESPONSE, - ERR_RPC_INTERNAL_ERROR: () => ERR_RPC_INTERNAL_ERROR, - ERR_RPC_INVALID_INPUT: () => ERR_RPC_INVALID_INPUT, - ERR_RPC_INVALID_JSON: () => ERR_RPC_INVALID_JSON, - ERR_RPC_INVALID_METHOD: () => ERR_RPC_INVALID_METHOD, - ERR_RPC_INVALID_PARAMS: () => ERR_RPC_INVALID_PARAMS, - ERR_RPC_INVALID_REQUEST: () => ERR_RPC_INVALID_REQUEST, - ERR_RPC_LIMIT_EXCEEDED: () => ERR_RPC_LIMIT_EXCEEDED, - ERR_RPC_MISSING_RESOURCE: () => ERR_RPC_MISSING_RESOURCE, - ERR_RPC_NOT_SUPPORTED: () => ERR_RPC_NOT_SUPPORTED, - ERR_RPC_TRANSACTION_REJECTED: () => ERR_RPC_TRANSACTION_REJECTED, - ERR_RPC_UNAVAILABLE_RESOURCE: () => ERR_RPC_UNAVAILABLE_RESOURCE, - ERR_RPC_UNSUPPORTED_METHOD: () => ERR_RPC_UNSUPPORTED_METHOD, - ERR_SCHEMA_FORMAT: () => ERR_SCHEMA_FORMAT, - ERR_SIGNATURE_FAILED: () => ERR_SIGNATURE_FAILED, - ERR_SUBSCRIPTION: () => ERR_SUBSCRIPTION, - ERR_TX: () => ERR_TX, - ERR_TX_BLOCK_TIMEOUT: () => ERR_TX_BLOCK_TIMEOUT, - ERR_TX_CHAIN_ID_MISMATCH: () => ERR_TX_CHAIN_ID_MISMATCH, - ERR_TX_CHAIN_MISMATCH: () => ERR_TX_CHAIN_MISMATCH, - ERR_TX_CONTRACT_NOT_STORED: () => ERR_TX_CONTRACT_NOT_STORED, - ERR_TX_DATA_AND_INPUT: () => ERR_TX_DATA_AND_INPUT, - ERR_TX_GAS_MISMATCH: () => ERR_TX_GAS_MISMATCH, - ERR_TX_GAS_MISMATCH_INNER_ERROR: () => ERR_TX_GAS_MISMATCH_INNER_ERROR, - ERR_TX_HARDFORK_MISMATCH: () => ERR_TX_HARDFORK_MISMATCH, - ERR_TX_INVALID_CALL: () => ERR_TX_INVALID_CALL, - ERR_TX_INVALID_CHAIN_INFO: () => ERR_TX_INVALID_CHAIN_INFO, - ERR_TX_INVALID_FEE_MARKET_GAS: () => ERR_TX_INVALID_FEE_MARKET_GAS, - ERR_TX_INVALID_FEE_MARKET_GAS_PRICE: () => ERR_TX_INVALID_FEE_MARKET_GAS_PRICE, - ERR_TX_INVALID_LEGACY_FEE_MARKET: () => ERR_TX_INVALID_LEGACY_FEE_MARKET, - ERR_TX_INVALID_LEGACY_GAS: () => ERR_TX_INVALID_LEGACY_GAS, - ERR_TX_INVALID_NONCE_OR_CHAIN_ID: () => ERR_TX_INVALID_NONCE_OR_CHAIN_ID, - ERR_TX_INVALID_OBJECT: () => ERR_TX_INVALID_OBJECT, - ERR_TX_INVALID_PROPERTIES_FOR_TYPE: () => ERR_TX_INVALID_PROPERTIES_FOR_TYPE, - ERR_TX_INVALID_RECEIVER: () => ERR_TX_INVALID_RECEIVER, - ERR_TX_INVALID_SENDER: () => ERR_TX_INVALID_SENDER, - ERR_TX_LOCAL_WALLET_NOT_AVAILABLE: () => ERR_TX_LOCAL_WALLET_NOT_AVAILABLE, - ERR_TX_MISSING_CHAIN_INFO: () => ERR_TX_MISSING_CHAIN_INFO, - ERR_TX_MISSING_CUSTOM_CHAIN: () => ERR_TX_MISSING_CUSTOM_CHAIN, - ERR_TX_MISSING_CUSTOM_CHAIN_ID: () => ERR_TX_MISSING_CUSTOM_CHAIN_ID, - ERR_TX_MISSING_GAS: () => ERR_TX_MISSING_GAS, - ERR_TX_MISSING_GAS_INNER_ERROR: () => ERR_TX_MISSING_GAS_INNER_ERROR, - ERR_TX_NOT_FOUND: () => ERR_TX_NOT_FOUND, - ERR_TX_NO_CONTRACT_ADDRESS: () => ERR_TX_NO_CONTRACT_ADDRESS, - ERR_TX_OUT_OF_GAS: () => ERR_TX_OUT_OF_GAS, - ERR_TX_POLLING_TIMEOUT: () => ERR_TX_POLLING_TIMEOUT, - ERR_TX_RECEIPT_MISSING_BLOCK_NUMBER: () => ERR_TX_RECEIPT_MISSING_BLOCK_NUMBER, - ERR_TX_RECEIPT_MISSING_OR_BLOCKHASH_NULL: () => ERR_TX_RECEIPT_MISSING_OR_BLOCKHASH_NULL, - ERR_TX_REVERT_INSTRUCTION: () => ERR_TX_REVERT_INSTRUCTION, - ERR_TX_REVERT_TRANSACTION: () => ERR_TX_REVERT_TRANSACTION, - ERR_TX_REVERT_TRANSACTION_CUSTOM_ERROR: () => ERR_TX_REVERT_TRANSACTION_CUSTOM_ERROR, - ERR_TX_REVERT_WITHOUT_REASON: () => ERR_TX_REVERT_WITHOUT_REASON, - ERR_TX_SEND_TIMEOUT: () => ERR_TX_SEND_TIMEOUT, - ERR_TX_SIGNING: () => ERR_TX_SIGNING, - ERR_TX_UNABLE_TO_POPULATE_NONCE: () => ERR_TX_UNABLE_TO_POPULATE_NONCE, - ERR_TX_UNSUPPORTED_EIP_1559: () => ERR_TX_UNSUPPORTED_EIP_1559, - ERR_TX_UNSUPPORTED_TYPE: () => ERR_TX_UNSUPPORTED_TYPE, - ERR_UNSUPPORTED_KDF: () => ERR_UNSUPPORTED_KDF, - ERR_VALIDATION: () => ERR_VALIDATION, - ERR_WS_PROVIDER: () => ERR_WS_PROVIDER, - Eip1559GasPriceError: () => Eip1559GasPriceError, - Eip1559NotSupportedError: () => Eip1559NotSupportedError, - Eip838ExecutionError: () => Eip838ExecutionError, - ExistingPluginNamespaceError: () => ExistingPluginNamespaceError, - FormatterError: () => FormatterError, - GENESIS_BLOCK_NUMBER: () => GENESIS_BLOCK_NUMBER, - HardforkMismatchError: () => HardforkMismatchError, - HexProcessingError: () => HexProcessingError, - IVLengthError: () => IVLengthError, - InternalError: () => InternalError, - InvalidAddressError: () => InvalidAddressError, - InvalidBlockError: () => InvalidBlockError, - InvalidBooleanError: () => InvalidBooleanError, - InvalidBytesError: () => InvalidBytesError, - InvalidClientError: () => InvalidClientError, - InvalidConnectionError: () => InvalidConnectionError, - InvalidGasOrGasPrice: () => InvalidGasOrGasPrice, - InvalidInputError: () => InvalidInputError, - InvalidKdfError: () => InvalidKdfError, - InvalidLargeValueError: () => InvalidLargeValueError, - InvalidMaxPriorityFeePerGasOrMaxFeePerGas: () => InvalidMaxPriorityFeePerGasOrMaxFeePerGas, - InvalidMethodParamsError: () => InvalidMethodParamsError, - InvalidNonceOrChainIdError: () => InvalidNonceOrChainIdError, - InvalidNumberError: () => InvalidNumberError, - InvalidNumberOfParamsError: () => InvalidNumberOfParamsError, - InvalidParamsError: () => InvalidParamsError, - InvalidPasswordError: () => InvalidPasswordError, - InvalidPrivateKeyError: () => InvalidPrivateKeyError, - InvalidPropertiesForTransactionTypeError: () => InvalidPropertiesForTransactionTypeError, - InvalidProviderError: () => InvalidProviderError, - InvalidRequestError: () => InvalidRequestError, - InvalidResponseError: () => InvalidResponseError, - InvalidSignatureError: () => InvalidSignatureError, - InvalidSizeError: () => InvalidSizeError, - InvalidStringError: () => InvalidStringError, - InvalidTransactionCall: () => InvalidTransactionCall, - InvalidTransactionObjectError: () => InvalidTransactionObjectError, - InvalidTransactionWithReceiver: () => InvalidTransactionWithReceiver, - InvalidTransactionWithSender: () => InvalidTransactionWithSender, - InvalidTypeAbiInputError: () => InvalidTypeAbiInputError, - InvalidTypeError: () => InvalidTypeError, - InvalidUnitError: () => InvalidUnitError, - InvalidUnsignedIntegerError: () => InvalidUnsignedIntegerError, - InvalidValueError: () => InvalidValueError, - JSONRPC_ERR_CHAIN_DISCONNECTED: () => JSONRPC_ERR_CHAIN_DISCONNECTED, - JSONRPC_ERR_DISCONNECTED: () => JSONRPC_ERR_DISCONNECTED, - JSONRPC_ERR_REJECTED_REQUEST: () => JSONRPC_ERR_REJECTED_REQUEST, - JSONRPC_ERR_UNAUTHORIZED: () => JSONRPC_ERR_UNAUTHORIZED, - JSONRPC_ERR_UNSUPPORTED_METHOD: () => JSONRPC_ERR_UNSUPPORTED_METHOD, - KeyDerivationError: () => KeyDerivationError, - KeyStoreVersionError: () => KeyStoreVersionError, - LimitExceededError: () => LimitExceededError, - LocalWalletNotAvailableError: () => LocalWalletNotAvailableError, - MaxAttemptsReachedOnReconnectingError: () => MaxAttemptsReachedOnReconnectingError, - MethodNotFoundError: () => MethodNotFoundError, - MethodNotImplementedError: () => MethodNotImplementedError, - MethodNotSupported: () => MethodNotSupported, - MissingChainOrHardforkError: () => MissingChainOrHardforkError, - MissingCustomChainError: () => MissingCustomChainError, - MissingCustomChainIdError: () => MissingCustomChainIdError, - MissingGasError: () => MissingGasError, - MissingGasInnerError: () => MissingGasInnerError, - NibbleWidthError: () => NibbleWidthError, - NoContractAddressFoundError: () => NoContractAddressFoundError, - OperationAbortError: () => OperationAbortError, - OperationTimeoutError: () => OperationTimeoutError, - PBKDF2IterationsError: () => PBKDF2IterationsError, - ParseError: () => ParseError, - PendingRequestsOnReconnectingError: () => PendingRequestsOnReconnectingError, - PrivateKeyLengthError: () => PrivateKeyLengthError, - ProviderError: () => ProviderError, - RequestAlreadySentError: () => RequestAlreadySentError, - ResolverMethodMissingError: () => ResolverMethodMissingError, - ResourceUnavailableError: () => ResourceUnavailableError, - ResourcesNotFoundError: () => ResourcesNotFoundError, - ResponseError: () => ResponseError, - RevertInstructionError: () => RevertInstructionError, - RpcError: () => RpcError, - RpcErrorMessages: () => RpcErrorMessages, - SchemaFormatError: () => SchemaFormatError, - SignatureError: () => SignatureError, - SubscriptionError: () => SubscriptionError, - TransactionBlockTimeoutError: () => TransactionBlockTimeoutError, - TransactionDataAndInputError: () => TransactionDataAndInputError, - TransactionError: () => TransactionError, - TransactionGasMismatchError: () => TransactionGasMismatchError, - TransactionGasMismatchInnerError: () => TransactionGasMismatchInnerError, - TransactionMissingReceiptOrBlockHashError: () => TransactionMissingReceiptOrBlockHashError, - TransactionNotFound: () => TransactionNotFound, - TransactionOutOfGasError: () => TransactionOutOfGasError, - TransactionPollingTimeoutError: () => TransactionPollingTimeoutError, - TransactionReceiptMissingBlockNumberError: () => TransactionReceiptMissingBlockNumberError, - TransactionRejectedError: () => TransactionRejectedError, - TransactionRevertInstructionError: () => TransactionRevertInstructionError, - TransactionRevertWithCustomError: () => TransactionRevertWithCustomError, - TransactionRevertedWithoutReasonError: () => TransactionRevertedWithoutReasonError, - TransactionSendTimeoutError: () => TransactionSendTimeoutError, - TransactionSigningError: () => TransactionSigningError, - UnableToPopulateNonceError: () => UnableToPopulateNonceError, - UndefinedRawTransactionError: () => UndefinedRawTransactionError, - UnsupportedFeeMarketError: () => UnsupportedFeeMarketError, - UnsupportedTransactionTypeError: () => UnsupportedTransactionTypeError, - VersionNotSupportedError: () => VersionNotSupportedError, - Web3ContractError: () => Web3ContractError, - Web3WSProviderError: () => Web3WSProviderError, - genericRpcErrorMessageTemplate: () => genericRpcErrorMessageTemplate, - rpcErrorsMap: () => rpcErrorsMap -}); - -// node_modules/web3-errors/lib/esm/error_codes.js -var ERR_RESPONSE = 100; -var ERR_INVALID_RESPONSE = 101; -var ERR_PARAM = 200; -var ERR_FORMATTERS = 201; -var ERR_METHOD_NOT_IMPLEMENTED = 202; -var ERR_OPERATION_TIMEOUT = 203; -var ERR_OPERATION_ABORT = 204; -var ERR_ABI_ENCODING = 205; -var ERR_EXISTING_PLUGIN_NAMESPACE = 206; -var ERR_INVALID_METHOD_PARAMS = 207; -var ERR_CONTRACT = 300; -var ERR_CONTRACT_RESOLVER_MISSING = 301; -var ERR_CONTRACT_ABI_MISSING = 302; -var ERR_CONTRACT_REQUIRED_CALLBACK = 303; -var ERR_CONTRACT_EVENT_NOT_EXISTS = 304; -var ERR_CONTRACT_RESERVED_EVENT = 305; -var ERR_CONTRACT_MISSING_DEPLOY_DATA = 306; -var ERR_CONTRACT_MISSING_ADDRESS = 307; -var ERR_CONTRACT_MISSING_FROM_ADDRESS = 308; -var ERR_CONTRACT_INSTANTIATION = 309; -var ERR_CONTRACT_EXECUTION_REVERTED = 310; -var ERR_CONTRACT_TX_DATA_AND_INPUT = 311; -var ERR_TX = 400; -var ERR_TX_REVERT_INSTRUCTION = 401; -var ERR_TX_REVERT_TRANSACTION = 402; -var ERR_TX_NO_CONTRACT_ADDRESS = 403; -var ERR_TX_CONTRACT_NOT_STORED = 404; -var ERR_TX_REVERT_WITHOUT_REASON = 405; -var ERR_TX_OUT_OF_GAS = 406; -var ERR_RAW_TX_UNDEFINED = 407; -var ERR_TX_INVALID_SENDER = 408; -var ERR_TX_INVALID_CALL = 409; -var ERR_TX_MISSING_CUSTOM_CHAIN = 410; -var ERR_TX_MISSING_CUSTOM_CHAIN_ID = 411; -var ERR_TX_CHAIN_ID_MISMATCH = 412; -var ERR_TX_INVALID_CHAIN_INFO = 413; -var ERR_TX_MISSING_CHAIN_INFO = 414; -var ERR_TX_MISSING_GAS = 415; -var ERR_TX_INVALID_LEGACY_GAS = 416; -var ERR_TX_INVALID_FEE_MARKET_GAS = 417; -var ERR_TX_INVALID_FEE_MARKET_GAS_PRICE = 418; -var ERR_TX_INVALID_LEGACY_FEE_MARKET = 419; -var ERR_TX_INVALID_OBJECT = 420; -var ERR_TX_INVALID_NONCE_OR_CHAIN_ID = 421; -var ERR_TX_UNABLE_TO_POPULATE_NONCE = 422; -var ERR_TX_UNSUPPORTED_EIP_1559 = 423; -var ERR_TX_UNSUPPORTED_TYPE = 424; -var ERR_TX_DATA_AND_INPUT = 425; -var ERR_TX_POLLING_TIMEOUT = 426; -var ERR_TX_RECEIPT_MISSING_OR_BLOCKHASH_NULL = 427; -var ERR_TX_RECEIPT_MISSING_BLOCK_NUMBER = 428; -var ERR_TX_LOCAL_WALLET_NOT_AVAILABLE = 429; -var ERR_TX_NOT_FOUND = 430; -var ERR_TX_SEND_TIMEOUT = 431; -var ERR_TX_BLOCK_TIMEOUT = 432; -var ERR_TX_SIGNING = 433; -var ERR_TX_GAS_MISMATCH = 434; -var ERR_TX_CHAIN_MISMATCH = 435; -var ERR_TX_HARDFORK_MISMATCH = 436; -var ERR_TX_INVALID_RECEIVER = 437; -var ERR_TX_REVERT_TRANSACTION_CUSTOM_ERROR = 438; -var ERR_TX_INVALID_PROPERTIES_FOR_TYPE = 439; -var ERR_TX_MISSING_GAS_INNER_ERROR = 440; -var ERR_TX_GAS_MISMATCH_INNER_ERROR = 441; -var ERR_CONN = 500; -var ERR_CONN_INVALID = 501; -var ERR_CONN_TIMEOUT = 502; -var ERR_CONN_NOT_OPEN = 503; -var ERR_CONN_CLOSE = 504; -var ERR_CONN_MAX_ATTEMPTS = 505; -var ERR_CONN_PENDING_REQUESTS = 506; -var ERR_REQ_ALREADY_SENT = 507; -var ERR_PROVIDER = 600; -var ERR_INVALID_PROVIDER = 601; -var ERR_INVALID_CLIENT = 602; -var ERR_SUBSCRIPTION = 603; -var ERR_WS_PROVIDER = 604; -var ERR_PRIVATE_KEY_LENGTH = 701; -var ERR_INVALID_PRIVATE_KEY = 702; -var ERR_UNSUPPORTED_KDF = 703; -var ERR_KEY_DERIVATION_FAIL = 704; -var ERR_KEY_VERSION_UNSUPPORTED = 705; -var ERR_INVALID_PASSWORD = 706; -var ERR_IV_LENGTH = 707; -var ERR_INVALID_KEYSTORE = 708; -var ERR_PBKDF2_ITERATIONS = 709; -var ERR_SIGNATURE_FAILED = 801; -var ERR_INVALID_SIGNATURE = 802; -var GENESIS_BLOCK_NUMBER = "0x0"; -var JSONRPC_ERR_REJECTED_REQUEST = 4001; -var JSONRPC_ERR_UNAUTHORIZED = 4100; -var JSONRPC_ERR_UNSUPPORTED_METHOD = 4200; -var JSONRPC_ERR_DISCONNECTED = 4900; -var JSONRPC_ERR_CHAIN_DISCONNECTED = 4901; -var ERR_ENS_CHECK_INTERFACE_SUPPORT = 901; -var ERR_ENS_UNSUPPORTED_NETWORK = 902; -var ERR_ENS_NETWORK_NOT_SYNCED = 903; -var ERR_INVALID_STRING = 1001; -var ERR_INVALID_BYTES = 1002; -var ERR_INVALID_NUMBER = 1003; -var ERR_INVALID_UNIT = 1004; -var ERR_INVALID_ADDRESS = 1005; -var ERR_INVALID_HEX = 1006; -var ERR_INVALID_TYPE = 1007; -var ERR_INVALID_BOOLEAN = 1008; -var ERR_INVALID_UNSIGNED_INTEGER = 1009; -var ERR_INVALID_SIZE = 1010; -var ERR_INVALID_LARGE_VALUE = 1011; -var ERR_INVALID_BLOCK = 1012; -var ERR_INVALID_TYPE_ABI = 1013; -var ERR_INVALID_NIBBLE_WIDTH = 1014; -var ERR_VALIDATION = 1100; -var ERR_CORE_HARDFORK_MISMATCH = 1101; -var ERR_CORE_CHAIN_MISMATCH = 1102; -var ERR_SCHEMA_FORMAT = 1200; -var ERR_RPC_INVALID_JSON = -32700; -var ERR_RPC_INVALID_REQUEST = -32600; -var ERR_RPC_INVALID_METHOD = -32601; -var ERR_RPC_INVALID_PARAMS = -32602; -var ERR_RPC_INTERNAL_ERROR = -32603; -var ERR_RPC_INVALID_INPUT = -32e3; -var ERR_RPC_MISSING_RESOURCE = -32001; -var ERR_RPC_UNAVAILABLE_RESOURCE = -32002; -var ERR_RPC_TRANSACTION_REJECTED = -32003; -var ERR_RPC_UNSUPPORTED_METHOD = -32004; -var ERR_RPC_LIMIT_EXCEEDED = -32005; -var ERR_RPC_NOT_SUPPORTED = -32006; - -// node_modules/web3-errors/lib/esm/web3_error_base.js -var BaseWeb3Error = class extends Error { - constructor(msg, innerError) { - super(msg); - this.innerError = innerError; - this.name = this.constructor.name; - if (typeof Error.captureStackTrace === "function") { - Error.captureStackTrace(new.target.constructor); - } else { - this.stack = new Error().stack; - } - } - static convertToString(value, unquotValue = false) { - if (value === null || value === void 0) - return "undefined"; - const result = JSON.stringify(value, (_, v) => typeof v === "bigint" ? v.toString() : v); - return unquotValue && ["bigint", "string"].includes(typeof value) ? result.replace(/['\\"]+/g, "") : result; - } - toJSON() { - return { - name: this.name, - code: this.code, - message: this.message, - innerError: this.innerError - }; - } -}; -var InvalidValueError = class extends BaseWeb3Error { - constructor(value, msg) { - super(`Invalid value given "${BaseWeb3Error.convertToString(value, true)}". Error: ${msg}.`); - this.name = this.constructor.name; - } -}; - -// node_modules/web3-errors/lib/esm/errors/account_errors.js -var PrivateKeyLengthError = class extends BaseWeb3Error { - constructor() { - super(`Private key must be 32 bytes.`); - this.code = ERR_PRIVATE_KEY_LENGTH; - } -}; -var InvalidPrivateKeyError = class extends BaseWeb3Error { - constructor() { - super(`Invalid Private Key, Not a valid string or uint8Array`); - this.code = ERR_INVALID_PRIVATE_KEY; - } -}; -var InvalidSignatureError = class extends BaseWeb3Error { - constructor(errorDetails) { - super(`"${errorDetails}"`); - this.code = ERR_INVALID_SIGNATURE; - } -}; -var InvalidKdfError = class extends BaseWeb3Error { - constructor() { - super(`Invalid key derivation function`); - this.code = ERR_UNSUPPORTED_KDF; - } -}; -var KeyDerivationError = class extends BaseWeb3Error { - constructor() { - super(`Key derivation failed - possibly wrong password`); - this.code = ERR_KEY_DERIVATION_FAIL; - } -}; -var KeyStoreVersionError = class extends BaseWeb3Error { - constructor() { - super("Unsupported key store version"); - this.code = ERR_KEY_VERSION_UNSUPPORTED; - } -}; -var InvalidPasswordError = class extends BaseWeb3Error { - constructor() { - super("Password cannot be empty"); - this.code = ERR_INVALID_PASSWORD; - } -}; -var IVLengthError = class extends BaseWeb3Error { - constructor() { - super("Initialization vector must be 16 bytes"); - this.code = ERR_IV_LENGTH; - } -}; -var PBKDF2IterationsError = class extends BaseWeb3Error { - constructor() { - super("c > 1000, pbkdf2 is less secure with less iterations"); - this.code = ERR_PBKDF2_ITERATIONS; - } -}; - -// node_modules/web3-errors/lib/esm/errors/connection_errors.js -var ConnectionError = class extends BaseWeb3Error { - constructor(message, event) { - super(message); - this.code = ERR_CONN; - if (event) { - this.errorCode = event.code; - this.errorReason = event.reason; - } - } - toJSON() { - return Object.assign(Object.assign({}, super.toJSON()), { errorCode: this.errorCode, errorReason: this.errorReason }); - } -}; -var InvalidConnectionError = class extends ConnectionError { - constructor(host, event) { - super(`CONNECTION ERROR: Couldn't connect to node ${host}.`, event); - this.host = host; - this.code = ERR_CONN_INVALID; - } - toJSON() { - return Object.assign(Object.assign({}, super.toJSON()), { host: this.host }); - } -}; -var ConnectionTimeoutError = class extends ConnectionError { - constructor(duration) { - super(`CONNECTION TIMEOUT: timeout of ${duration}ms achieved`); - this.duration = duration; - this.code = ERR_CONN_TIMEOUT; - } - toJSON() { - return Object.assign(Object.assign({}, super.toJSON()), { duration: this.duration }); - } -}; -var ConnectionNotOpenError = class extends ConnectionError { - constructor(event) { - super("Connection not open", event); - this.code = ERR_CONN_NOT_OPEN; - } -}; -var ConnectionCloseError = class extends ConnectionError { - constructor(event) { - var _a4, _b; - super(`CONNECTION ERROR: The connection got closed with the close code ${(_a4 = event === null || event === void 0 ? void 0 : event.code) !== null && _a4 !== void 0 ? _a4 : ""} and the following reason string ${(_b = event === null || event === void 0 ? void 0 : event.reason) !== null && _b !== void 0 ? _b : ""}`, event); - this.code = ERR_CONN_CLOSE; - } -}; -var MaxAttemptsReachedOnReconnectingError = class extends ConnectionError { - constructor(numberOfAttempts) { - super(`Maximum number of reconnect attempts reached! (${numberOfAttempts})`); - this.code = ERR_CONN_MAX_ATTEMPTS; - } -}; -var PendingRequestsOnReconnectingError = class extends ConnectionError { - constructor() { - super("CONNECTION ERROR: Provider started to reconnect before the response got received!"); - this.code = ERR_CONN_PENDING_REQUESTS; - } -}; -var RequestAlreadySentError = class extends ConnectionError { - constructor(id) { - super(`Request already sent with following id: ${id}`); - this.code = ERR_REQ_ALREADY_SENT; - } -}; - -// node_modules/web3-errors/lib/esm/errors/contract_errors.js -var Web3ContractError = class extends BaseWeb3Error { - constructor(message, receipt) { - super(message); - this.code = ERR_CONTRACT; - this.receipt = receipt; - } -}; -var ResolverMethodMissingError = class extends BaseWeb3Error { - constructor(address, name2) { - super(`The resolver at ${address} does not implement requested method: "${name2}".`); - this.address = address; - this.name = name2; - this.code = ERR_CONTRACT_RESOLVER_MISSING; - } - toJSON() { - return Object.assign(Object.assign({}, super.toJSON()), { address: this.address, name: this.name }); - } -}; -var ContractMissingABIError = class extends BaseWeb3Error { - constructor() { - super("You must provide the json interface of the contract when instantiating a contract object."); - this.code = ERR_CONTRACT_ABI_MISSING; - } -}; -var ContractOnceRequiresCallbackError = class extends BaseWeb3Error { - constructor() { - super("Once requires a callback as the second parameter."); - this.code = ERR_CONTRACT_REQUIRED_CALLBACK; - } -}; -var ContractEventDoesNotExistError = class extends BaseWeb3Error { - constructor(eventName) { - super(`Event "${eventName}" doesn't exist in this contract.`); - this.eventName = eventName; - this.code = ERR_CONTRACT_EVENT_NOT_EXISTS; - } - toJSON() { - return Object.assign(Object.assign({}, super.toJSON()), { eventName: this.eventName }); - } -}; -var ContractReservedEventError = class extends BaseWeb3Error { - constructor(type) { - super(`Event "${type}" doesn't exist in this contract.`); - this.type = type; - this.code = ERR_CONTRACT_RESERVED_EVENT; - } - toJSON() { - return Object.assign(Object.assign({}, super.toJSON()), { type: this.type }); - } -}; -var ContractMissingDeployDataError = class extends BaseWeb3Error { - constructor() { - super(`No "data" specified in neither the given options, nor the default options.`); - this.code = ERR_CONTRACT_MISSING_DEPLOY_DATA; - } -}; -var ContractNoAddressDefinedError = class extends BaseWeb3Error { - constructor() { - super("This contract object doesn't have address set yet, please set an address first."); - this.code = ERR_CONTRACT_MISSING_ADDRESS; - } -}; -var ContractNoFromAddressDefinedError = class extends BaseWeb3Error { - constructor() { - super('No "from" address specified in neither the given options, nor the default options.'); - this.code = ERR_CONTRACT_MISSING_FROM_ADDRESS; - } -}; -var ContractInstantiationError = class extends BaseWeb3Error { - constructor() { - super(...arguments); - this.code = ERR_CONTRACT_INSTANTIATION; - } -}; -var Eip838ExecutionError = class _Eip838ExecutionError extends Web3ContractError { - constructor(error) { - super(error.message || "Error"); - this.name = "name" in error && error.name || this.constructor.name; - this.stack = "stack" in error && error.stack || void 0; - this.code = error.code; - if (typeof error.data === "object") { - let originalError; - if ("originalError" in error.data) { - originalError = error.data.originalError; - } else { - originalError = error.data; - } - this.data = originalError.data; - this.innerError = new _Eip838ExecutionError(originalError); - } else { - this.data = error.data; - } - } - setDecodedProperties(errorName, errorSignature, errorArgs) { - this.errorName = errorName; - this.errorSignature = errorSignature; - this.errorArgs = errorArgs; - } - toJSON() { - let json = Object.assign(Object.assign({}, super.toJSON()), { data: this.data }); - if (this.errorName) { - json = Object.assign(Object.assign({}, json), { errorName: this.errorName, errorSignature: this.errorSignature, errorArgs: this.errorArgs }); - } - return json; - } -}; -var ContractExecutionError = class extends Web3ContractError { - constructor(rpcError) { - super("Error happened while trying to execute a function inside a smart contract"); - this.code = ERR_CONTRACT_EXECUTION_REVERTED; - this.innerError = new Eip838ExecutionError(rpcError); - } -}; -var ContractTransactionDataAndInputError = class extends InvalidValueError { - constructor(value) { - var _a4, _b; - super(`data: ${(_a4 = value.data) !== null && _a4 !== void 0 ? _a4 : "undefined"}, input: ${(_b = value.input) !== null && _b !== void 0 ? _b : "undefined"}`, `You can't have "data" and "input" as properties of a contract at the same time, please use either "data" or "input" instead.`); - this.code = ERR_CONTRACT_TX_DATA_AND_INPUT; - } -}; - -// node_modules/web3-errors/lib/esm/errors/ens_errors.js -var ENSCheckInterfaceSupportError = class extends BaseWeb3Error { - constructor(errorDetails) { - super(`ENS resolver check interface support error. "${errorDetails}"`); - this.code = ERR_ENS_CHECK_INTERFACE_SUPPORT; - } -}; -var ENSUnsupportedNetworkError = class extends BaseWeb3Error { - constructor(networkType) { - super(`ENS is not supported on network ${networkType}`); - this.code = ERR_ENS_UNSUPPORTED_NETWORK; - } -}; -var ENSNetworkNotSyncedError = class extends BaseWeb3Error { - constructor() { - super(`Network not synced`); - this.code = ERR_ENS_NETWORK_NOT_SYNCED; - } -}; - -// node_modules/web3-errors/lib/esm/errors/generic_errors.js -var InvalidNumberOfParamsError = class extends BaseWeb3Error { - constructor(got, expected, method) { - super(`Invalid number of parameters for "${method}". Got "${got}" expected "${expected}"!`); - this.got = got; - this.expected = expected; - this.method = method; - this.code = ERR_PARAM; - } - toJSON() { - return Object.assign(Object.assign({}, super.toJSON()), { got: this.got, expected: this.expected, method: this.method }); - } -}; -var InvalidMethodParamsError = class extends BaseWeb3Error { - constructor(hint) { - super(`Invalid parameters passed. "${typeof hint !== "undefined" ? hint : ""}"`); - this.hint = hint; - this.code = ERR_INVALID_METHOD_PARAMS; - } - toJSON() { - return Object.assign(Object.assign({}, super.toJSON()), { hint: this.hint }); - } -}; -var FormatterError = class extends BaseWeb3Error { - constructor() { - super(...arguments); - this.code = ERR_FORMATTERS; - } -}; -var MethodNotImplementedError = class extends BaseWeb3Error { - constructor() { - super("The method you're trying to call is not implemented."); - this.code = ERR_METHOD_NOT_IMPLEMENTED; - } -}; -var OperationTimeoutError = class extends BaseWeb3Error { - constructor() { - super(...arguments); - this.code = ERR_OPERATION_TIMEOUT; - } -}; -var OperationAbortError = class extends BaseWeb3Error { - constructor() { - super(...arguments); - this.code = ERR_OPERATION_ABORT; - } -}; -var AbiError = class extends BaseWeb3Error { - constructor(message, props) { - super(message); - this.code = ERR_ABI_ENCODING; - this.props = props !== null && props !== void 0 ? props : {}; - } -}; -var ExistingPluginNamespaceError = class extends BaseWeb3Error { - constructor(pluginNamespace) { - super(`A plugin with the namespace: ${pluginNamespace} has already been registered.`); - this.code = ERR_EXISTING_PLUGIN_NAMESPACE; - } -}; - -// node_modules/web3-errors/lib/esm/errors/provider_errors.js -var ProviderError = class extends BaseWeb3Error { - constructor() { - super(...arguments); - this.code = ERR_PROVIDER; - } -}; -var InvalidProviderError = class extends BaseWeb3Error { - constructor(clientUrl) { - super(`Provider with url "${clientUrl}" is not set or invalid`); - this.clientUrl = clientUrl; - this.code = ERR_INVALID_PROVIDER; - } -}; -var InvalidClientError = class extends BaseWeb3Error { - constructor(clientUrl) { - super(`Client URL "${clientUrl}" is invalid.`); - this.code = ERR_INVALID_CLIENT; - } -}; -var SubscriptionError = class extends BaseWeb3Error { - constructor() { - super(...arguments); - this.code = ERR_SUBSCRIPTION; - } -}; -var Web3WSProviderError = class extends BaseWeb3Error { - constructor() { - super(...arguments); - this.code = ERR_WS_PROVIDER; - } -}; - -// node_modules/web3-errors/lib/esm/errors/signature_errors.js -var SignatureError = class extends InvalidValueError { - constructor() { - super(...arguments); - this.code = ERR_SIGNATURE_FAILED; - } -}; - -// node_modules/web3-errors/lib/esm/errors/transaction_errors.js -var TransactionError = class extends BaseWeb3Error { - constructor(message, receipt) { - super(message); - this.receipt = receipt; - this.code = ERR_TX; - } - toJSON() { - return Object.assign(Object.assign({}, super.toJSON()), { receipt: this.receipt }); - } -}; -var RevertInstructionError = class extends BaseWeb3Error { - constructor(reason, signature) { - super(`Your request got reverted with the following reason string: ${reason}`); - this.reason = reason; - this.signature = signature; - this.code = ERR_TX_REVERT_INSTRUCTION; - } - toJSON() { - return Object.assign(Object.assign({}, super.toJSON()), { reason: this.reason, signature: this.signature }); - } -}; -var TransactionRevertInstructionError = class extends BaseWeb3Error { - constructor(reason, signature, receipt, data) { - super(`Transaction has been reverted by the EVM${receipt === void 0 ? "" : `: - ${BaseWeb3Error.convertToString(receipt)}`}`); - this.reason = reason; - this.signature = signature; - this.receipt = receipt; - this.data = data; - this.code = ERR_TX_REVERT_TRANSACTION; - } - toJSON() { - return Object.assign(Object.assign({}, super.toJSON()), { reason: this.reason, signature: this.signature, receipt: this.receipt, data: this.data }); - } -}; -var TransactionRevertWithCustomError = class extends TransactionRevertInstructionError { - constructor(reason, customErrorName, customErrorDecodedSignature, customErrorArguments, signature, receipt, data) { - super(reason); - this.reason = reason; - this.customErrorName = customErrorName; - this.customErrorDecodedSignature = customErrorDecodedSignature; - this.customErrorArguments = customErrorArguments; - this.signature = signature; - this.receipt = receipt; - this.data = data; - this.code = ERR_TX_REVERT_TRANSACTION_CUSTOM_ERROR; - } - toJSON() { - return Object.assign(Object.assign({}, super.toJSON()), { reason: this.reason, customErrorName: this.customErrorName, customErrorDecodedSignature: this.customErrorDecodedSignature, customErrorArguments: this.customErrorArguments, signature: this.signature, receipt: this.receipt, data: this.data }); - } -}; -var NoContractAddressFoundError = class extends TransactionError { - constructor(receipt) { - super("The transaction receipt didn't contain a contract address.", receipt); - this.code = ERR_TX_NO_CONTRACT_ADDRESS; - } - toJSON() { - return Object.assign(Object.assign({}, super.toJSON()), { receipt: this.receipt }); - } -}; -var ContractCodeNotStoredError = class extends TransactionError { - constructor(receipt) { - super("The contract code couldn't be stored, please check your gas limit.", receipt); - this.code = ERR_TX_CONTRACT_NOT_STORED; - } -}; -var TransactionRevertedWithoutReasonError = class extends TransactionError { - constructor(receipt) { - super(`Transaction has been reverted by the EVM${receipt === void 0 ? "" : `: - ${BaseWeb3Error.convertToString(receipt)}`}`, receipt); - this.code = ERR_TX_REVERT_WITHOUT_REASON; - } -}; -var TransactionOutOfGasError = class extends TransactionError { - constructor(receipt) { - super(`Transaction ran out of gas. Please provide more gas: - ${JSON.stringify(receipt, void 0, 2)}`, receipt); - this.code = ERR_TX_OUT_OF_GAS; - } -}; -var UndefinedRawTransactionError = class extends TransactionError { - constructor() { - super(`Raw transaction undefined`); - this.code = ERR_RAW_TX_UNDEFINED; - } -}; -var TransactionNotFound = class extends TransactionError { - constructor() { - super("Transaction not found"); - this.code = ERR_TX_NOT_FOUND; - } -}; -var InvalidTransactionWithSender = class extends InvalidValueError { - constructor(value) { - super(value, "invalid transaction with invalid sender"); - this.code = ERR_TX_INVALID_SENDER; - } -}; -var InvalidTransactionWithReceiver = class extends InvalidValueError { - constructor(value) { - super(value, "invalid transaction with invalid receiver"); - this.code = ERR_TX_INVALID_RECEIVER; - } -}; -var InvalidTransactionCall = class extends InvalidValueError { - constructor(value) { - super(value, "invalid transaction call"); - this.code = ERR_TX_INVALID_CALL; - } -}; -var MissingCustomChainError = class extends InvalidValueError { - constructor() { - super("MissingCustomChainError", "If tx.common is provided it must have tx.common.customChain"); - this.code = ERR_TX_MISSING_CUSTOM_CHAIN; - } -}; -var MissingCustomChainIdError = class extends InvalidValueError { - constructor() { - super("MissingCustomChainIdError", "If tx.common is provided it must have tx.common.customChain and tx.common.customChain.chainId"); - this.code = ERR_TX_MISSING_CUSTOM_CHAIN_ID; - } -}; -var ChainIdMismatchError = class extends InvalidValueError { - constructor(value) { - super( - JSON.stringify(value), - // https://github.com/ChainSafe/web3.js/blob/8783f4d64e424456bdc53b34ef1142d0a7cee4d7/packages/web3-eth-accounts/src/index.js#L176 - "Chain Id doesnt match in tx.chainId tx.common.customChain.chainId" - ); - this.code = ERR_TX_CHAIN_ID_MISMATCH; - } -}; -var ChainMismatchError = class extends InvalidValueError { - constructor(value) { - super(JSON.stringify(value), "Chain doesnt match in tx.chain tx.common.basechain"); - this.code = ERR_TX_CHAIN_MISMATCH; - } -}; -var HardforkMismatchError = class extends InvalidValueError { - constructor(value) { - super(JSON.stringify(value), "hardfork doesnt match in tx.hardfork tx.common.hardfork"); - this.code = ERR_TX_HARDFORK_MISMATCH; - } -}; -var CommonOrChainAndHardforkError = class extends InvalidValueError { - constructor() { - super("CommonOrChainAndHardforkError", "Please provide the common object or the chain and hardfork property but not all together."); - this.code = ERR_TX_INVALID_CHAIN_INFO; - } -}; -var MissingChainOrHardforkError = class extends InvalidValueError { - constructor(value) { - var _a4, _b; - super("MissingChainOrHardforkError", `When specifying chain and hardfork, both values must be defined. Received "chain": ${(_a4 = value.chain) !== null && _a4 !== void 0 ? _a4 : "undefined"}, "hardfork": ${(_b = value.hardfork) !== null && _b !== void 0 ? _b : "undefined"}`); - this.code = ERR_TX_MISSING_CHAIN_INFO; - } -}; -var MissingGasInnerError = class extends BaseWeb3Error { - constructor() { - super('Missing properties in transaction, either define "gas" and "gasPrice" for type 0 transactions or "gas", "maxPriorityFeePerGas" and "maxFeePerGas" for type 2 transactions'); - this.code = ERR_TX_MISSING_GAS_INNER_ERROR; - } -}; -var MissingGasError = class extends InvalidValueError { - constructor(value) { - var _a4, _b, _c, _d; - super(`gas: ${(_a4 = value.gas) !== null && _a4 !== void 0 ? _a4 : "undefined"}, gasPrice: ${(_b = value.gasPrice) !== null && _b !== void 0 ? _b : "undefined"}, maxPriorityFeePerGas: ${(_c = value.maxPriorityFeePerGas) !== null && _c !== void 0 ? _c : "undefined"}, maxFeePerGas: ${(_d = value.maxFeePerGas) !== null && _d !== void 0 ? _d : "undefined"}`, '"gas" is missing'); - this.code = ERR_TX_MISSING_GAS; - this.innerError = new MissingGasInnerError(); - } -}; -var TransactionGasMismatchInnerError = class extends BaseWeb3Error { - constructor() { - super('Missing properties in transaction, either define "gas" and "gasPrice" for type 0 transactions or "gas", "maxPriorityFeePerGas" and "maxFeePerGas" for type 2 transactions, not both'); - this.code = ERR_TX_GAS_MISMATCH_INNER_ERROR; - } -}; -var TransactionGasMismatchError = class extends InvalidValueError { - constructor(value) { - var _a4, _b, _c, _d; - super(`gas: ${(_a4 = value.gas) !== null && _a4 !== void 0 ? _a4 : "undefined"}, gasPrice: ${(_b = value.gasPrice) !== null && _b !== void 0 ? _b : "undefined"}, maxPriorityFeePerGas: ${(_c = value.maxPriorityFeePerGas) !== null && _c !== void 0 ? _c : "undefined"}, maxFeePerGas: ${(_d = value.maxFeePerGas) !== null && _d !== void 0 ? _d : "undefined"}`, "transaction must specify legacy or fee market gas properties, not both"); - this.code = ERR_TX_GAS_MISMATCH; - this.innerError = new TransactionGasMismatchInnerError(); - } -}; -var InvalidGasOrGasPrice = class extends InvalidValueError { - constructor(value) { - var _a4, _b; - super(`gas: ${(_a4 = value.gas) !== null && _a4 !== void 0 ? _a4 : "undefined"}, gasPrice: ${(_b = value.gasPrice) !== null && _b !== void 0 ? _b : "undefined"}`, "Gas or gasPrice is lower than 0"); - this.code = ERR_TX_INVALID_LEGACY_GAS; - } -}; -var InvalidMaxPriorityFeePerGasOrMaxFeePerGas = class extends InvalidValueError { - constructor(value) { - var _a4, _b; - super(`maxPriorityFeePerGas: ${(_a4 = value.maxPriorityFeePerGas) !== null && _a4 !== void 0 ? _a4 : "undefined"}, maxFeePerGas: ${(_b = value.maxFeePerGas) !== null && _b !== void 0 ? _b : "undefined"}`, "maxPriorityFeePerGas or maxFeePerGas is lower than 0"); - this.code = ERR_TX_INVALID_FEE_MARKET_GAS; - } -}; -var Eip1559GasPriceError = class extends InvalidValueError { - constructor(value) { - super(value, "eip-1559 transactions don't support gasPrice"); - this.code = ERR_TX_INVALID_FEE_MARKET_GAS_PRICE; - } -}; -var UnsupportedFeeMarketError = class extends InvalidValueError { - constructor(value) { - var _a4, _b; - super(`maxPriorityFeePerGas: ${(_a4 = value.maxPriorityFeePerGas) !== null && _a4 !== void 0 ? _a4 : "undefined"}, maxFeePerGas: ${(_b = value.maxFeePerGas) !== null && _b !== void 0 ? _b : "undefined"}`, "pre-eip-1559 transaction don't support maxFeePerGas/maxPriorityFeePerGas"); - this.code = ERR_TX_INVALID_LEGACY_FEE_MARKET; - } -}; -var InvalidTransactionObjectError = class extends InvalidValueError { - constructor(value) { - super(value, "invalid transaction object"); - this.code = ERR_TX_INVALID_OBJECT; - } -}; -var InvalidNonceOrChainIdError = class extends InvalidValueError { - constructor(value) { - var _a4, _b; - super(`nonce: ${(_a4 = value.nonce) !== null && _a4 !== void 0 ? _a4 : "undefined"}, chainId: ${(_b = value.chainId) !== null && _b !== void 0 ? _b : "undefined"}`, "Nonce or chainId is lower than 0"); - this.code = ERR_TX_INVALID_NONCE_OR_CHAIN_ID; - } -}; -var UnableToPopulateNonceError = class extends InvalidValueError { - constructor() { - super("UnableToPopulateNonceError", "unable to populate nonce, no from address available"); - this.code = ERR_TX_UNABLE_TO_POPULATE_NONCE; - } -}; -var Eip1559NotSupportedError = class extends InvalidValueError { - constructor() { - super("Eip1559NotSupportedError", "Network doesn't support eip-1559"); - this.code = ERR_TX_UNSUPPORTED_EIP_1559; - } -}; -var UnsupportedTransactionTypeError = class extends InvalidValueError { - constructor(value) { - super(value, "unsupported transaction type"); - this.code = ERR_TX_UNSUPPORTED_TYPE; - } -}; -var TransactionDataAndInputError = class extends InvalidValueError { - constructor(value) { - var _a4, _b; - super(`data: ${(_a4 = value.data) !== null && _a4 !== void 0 ? _a4 : "undefined"}, input: ${(_b = value.input) !== null && _b !== void 0 ? _b : "undefined"}`, `You can't have "data" and "input" as properties of transactions at the same time, please use either "data" or "input" instead.`); - this.code = ERR_TX_DATA_AND_INPUT; - } -}; -var TransactionSendTimeoutError = class extends BaseWeb3Error { - constructor(value) { - super(`The connected Ethereum Node did not respond within ${value.numberOfSeconds} seconds, please make sure your transaction was properly sent and you are connected to a healthy Node. Be aware that transaction might still be pending or mined! - Transaction Hash: ${value.transactionHash ? value.transactionHash.toString() : "not available"}`); - this.code = ERR_TX_SEND_TIMEOUT; - } -}; -function transactionTimeoutHint(transactionHash) { - return `Please make sure your transaction was properly sent and there are no previous pending transaction for the same account. However, be aware that it might still be mined! - Transaction Hash: ${transactionHash ? transactionHash.toString() : "not available"}`; -} -var TransactionPollingTimeoutError = class extends BaseWeb3Error { - constructor(value) { - super(`Transaction was not mined within ${value.numberOfSeconds} seconds. ${transactionTimeoutHint(value.transactionHash)}`); - this.code = ERR_TX_POLLING_TIMEOUT; - } -}; -var TransactionBlockTimeoutError = class extends BaseWeb3Error { - constructor(value) { - super(`Transaction started at ${value.starterBlockNumber} but was not mined within ${value.numberOfBlocks} blocks. ${transactionTimeoutHint(value.transactionHash)}`); - this.code = ERR_TX_BLOCK_TIMEOUT; - } -}; -var TransactionMissingReceiptOrBlockHashError = class extends InvalidValueError { - constructor(value) { - var _a4, _b; - super(`receipt: ${JSON.stringify(value.receipt)}, blockHash: ${(_a4 = value.blockHash) === null || _a4 === void 0 ? void 0 : _a4.toString()}, transactionHash: ${(_b = value.transactionHash) === null || _b === void 0 ? void 0 : _b.toString()}`, `Receipt missing or blockHash null`); - this.code = ERR_TX_RECEIPT_MISSING_OR_BLOCKHASH_NULL; - } -}; -var TransactionReceiptMissingBlockNumberError = class extends InvalidValueError { - constructor(value) { - super(`receipt: ${JSON.stringify(value.receipt)}`, `Receipt missing block number`); - this.code = ERR_TX_RECEIPT_MISSING_BLOCK_NUMBER; - } -}; -var TransactionSigningError = class extends BaseWeb3Error { - constructor(errorDetails) { - super(`Invalid signature. "${errorDetails}"`); - this.code = ERR_TX_SIGNING; - } -}; -var LocalWalletNotAvailableError = class extends InvalidValueError { - constructor() { - super("LocalWalletNotAvailableError", `Attempted to index account in local wallet, but no wallet is available`); - this.code = ERR_TX_LOCAL_WALLET_NOT_AVAILABLE; - } -}; -var InvalidPropertiesForTransactionTypeError = class extends BaseWeb3Error { - constructor(validationError, txType) { - const invalidPropertyNames = []; - validationError.forEach((error) => invalidPropertyNames.push(error.keyword)); - super(`The following properties are invalid for the transaction type ${txType}: ${invalidPropertyNames.join(", ")}`); - this.code = ERR_TX_INVALID_PROPERTIES_FOR_TYPE; - } -}; - -// node_modules/web3-errors/lib/esm/errors/utils_errors.js -var InvalidBytesError = class extends InvalidValueError { - constructor(value) { - super(value, "can not parse as byte data"); - this.code = ERR_INVALID_BYTES; - } -}; -var InvalidNumberError = class extends InvalidValueError { - constructor(value) { - super(value, "can not parse as number data"); - this.code = ERR_INVALID_NUMBER; - } -}; -var InvalidAddressError = class extends InvalidValueError { - constructor(value) { - super(value, "invalid ethereum address"); - this.code = ERR_INVALID_ADDRESS; - } -}; -var InvalidStringError = class extends InvalidValueError { - constructor(value) { - super(value, "not a valid string"); - this.code = ERR_INVALID_STRING; - } -}; -var InvalidUnitError = class extends InvalidValueError { - constructor(value) { - super(value, "invalid unit"); - this.code = ERR_INVALID_UNIT; - } -}; -var HexProcessingError = class extends InvalidValueError { - constructor(value) { - super(value, "can not be converted to hex"); - this.code = ERR_INVALID_HEX; - } -}; -var NibbleWidthError = class extends InvalidValueError { - constructor(value) { - super(value, "value greater than the nibble width"); - this.code = ERR_INVALID_NIBBLE_WIDTH; - } -}; -var InvalidTypeError = class extends InvalidValueError { - constructor(value) { - super(value, "invalid type, type not supported"); - this.code = ERR_INVALID_TYPE; - } -}; -var InvalidBooleanError = class extends InvalidValueError { - constructor(value) { - super(value, "not a valid boolean."); - this.code = ERR_INVALID_BOOLEAN; - } -}; -var InvalidUnsignedIntegerError = class extends InvalidValueError { - constructor(value) { - super(value, "not a valid unsigned integer."); - this.code = ERR_INVALID_UNSIGNED_INTEGER; - } -}; -var InvalidSizeError = class extends InvalidValueError { - constructor(value) { - super(value, "invalid size given."); - this.code = ERR_INVALID_SIZE; - } -}; -var InvalidLargeValueError = class extends InvalidValueError { - constructor(value) { - super(value, "value is larger than size."); - this.code = ERR_INVALID_LARGE_VALUE; - } -}; -var InvalidBlockError = class extends InvalidValueError { - constructor(value) { - super(value, "invalid string given"); - this.code = ERR_INVALID_BLOCK; - } -}; -var InvalidTypeAbiInputError = class extends InvalidValueError { - constructor(value) { - super(value, "components found but type is not tuple"); - this.code = ERR_INVALID_TYPE_ABI; - } -}; - -// node_modules/web3-errors/lib/esm/errors/response_errors.js -var isResponseWithError = (response) => !Array.isArray(response) && response.jsonrpc === "2.0" && !!response && // eslint-disable-next-line no-null/no-null -(response.result === void 0 || response.result === null) && // JSON RPC consider "null" as valid response -"error" in response && (typeof response.id === "number" || typeof response.id === "string"); -var buildErrorMessage = (response) => isResponseWithError(response) ? response.error.message : ""; -var ResponseError = class extends BaseWeb3Error { - constructor(response, message, request) { - var _a4; - super(message !== null && message !== void 0 ? message : `Returned error: ${Array.isArray(response) ? response.map((r) => buildErrorMessage(r)).join(",") : buildErrorMessage(response)}`); - this.code = ERR_RESPONSE; - if (!message) { - this.data = Array.isArray(response) ? response.map((r) => { - var _a5; - return (_a5 = r.error) === null || _a5 === void 0 ? void 0 : _a5.data; - }) : (_a4 = response === null || response === void 0 ? void 0 : response.error) === null || _a4 === void 0 ? void 0 : _a4.data; - } - this.request = request; - let errorOrErrors; - if (`error` in response) { - errorOrErrors = response.error; - } else if (response instanceof Array) { - errorOrErrors = response.map((r) => r.error); - } - this.innerError = errorOrErrors; - } - toJSON() { - return Object.assign(Object.assign({}, super.toJSON()), { data: this.data, request: this.request }); - } -}; -var InvalidResponseError = class extends ResponseError { - constructor(result, request) { - super(result, void 0, request); - this.code = ERR_INVALID_RESPONSE; - let errorOrErrors; - if (`error` in result) { - errorOrErrors = result.error; - } else if (result instanceof Array) { - errorOrErrors = result.map((r) => r.error); - } - this.innerError = errorOrErrors; - } -}; - -// node_modules/web3-errors/lib/esm/errors/core_errors.js -var ConfigHardforkMismatchError = class extends BaseWeb3Error { - constructor(defaultHardfork, commonHardFork) { - super(`Web3Config hardfork doesnt match in defaultHardfork ${defaultHardfork} and common.hardfork ${commonHardFork}`); - this.code = ERR_CORE_HARDFORK_MISMATCH; - } -}; -var ConfigChainMismatchError = class extends BaseWeb3Error { - constructor(defaultHardfork, commonHardFork) { - super(`Web3Config chain doesnt match in defaultHardfork ${defaultHardfork} and common.hardfork ${commonHardFork}`); - this.code = ERR_CORE_HARDFORK_MISMATCH; - } -}; - -// node_modules/web3-errors/lib/esm/errors/rpc_error_messages.js -var genericRpcErrorMessageTemplate = "An Rpc error has occured with a code of *code*"; -var RpcErrorMessages = { - // EIP-1474 & JSON RPC 2.0 - // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md - [ERR_RPC_INVALID_JSON]: { - message: "Parse error", - description: "Invalid JSON" - }, - [ERR_RPC_INVALID_REQUEST]: { - message: "Invalid request", - description: "JSON is not a valid request object " - }, - [ERR_RPC_INVALID_METHOD]: { - message: "Method not found", - description: "Method does not exist " - }, - [ERR_RPC_INVALID_PARAMS]: { - message: "Invalid params", - description: "Invalid method parameters" - }, - [ERR_RPC_INTERNAL_ERROR]: { - message: "Internal error", - description: "Internal JSON-RPC error" - }, - [ERR_RPC_INVALID_INPUT]: { - message: "Invalid input", - description: "Missing or invalid parameters" - }, - [ERR_RPC_MISSING_RESOURCE]: { - message: "Resource not found", - description: "Requested resource not found" - }, - [ERR_RPC_UNAVAILABLE_RESOURCE]: { - message: "Resource unavailable", - description: "Requested resource not available" - }, - [ERR_RPC_TRANSACTION_REJECTED]: { - message: "Transaction rejected", - description: "Transaction creation failed" - }, - [ERR_RPC_UNSUPPORTED_METHOD]: { - message: "Method not supported", - description: "Method is not implemented" - }, - [ERR_RPC_LIMIT_EXCEEDED]: { - message: "Limit exceeded", - description: "Request exceeds defined limit" - }, - [ERR_RPC_NOT_SUPPORTED]: { - message: "JSON-RPC version not supported", - description: "Version of JSON-RPC protocol is not supported" - }, - // EIP-1193 - // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#provider-errors - [JSONRPC_ERR_REJECTED_REQUEST]: { - name: "User Rejected Request", - message: "The user rejected the request." - }, - [JSONRPC_ERR_UNAUTHORIZED]: { - name: "Unauthorized", - message: "The requested method and/or account has not been authorized by the user." - }, - [JSONRPC_ERR_UNSUPPORTED_METHOD]: { - name: "Unsupported Method", - message: "The Provider does not support the requested method." - }, - [JSONRPC_ERR_DISCONNECTED]: { - name: "Disconnected", - message: "The Provider is disconnected from all chains." - }, - [JSONRPC_ERR_CHAIN_DISCONNECTED]: { - name: "Chain Disconnected", - message: "The Provider is not connected to the requested chain." - }, - // EIP-1193 - CloseEvent - // https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code - "0-999": { - name: "", - message: "Not used." - }, - 1e3: { - name: "Normal Closure", - message: "The connection successfully completed the purpose for which it was created." - }, - 1001: { - name: "Going Away", - message: "The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection." - }, - 1002: { - name: "Protocol error", - message: "The endpoint is terminating the connection due to a protocol error." - }, - 1003: { - name: "Unsupported Data", - message: "The connection is being terminated because the endpoint received data of a type it cannot accept. (For example, a text-only endpoint received binary data.)" - }, - 1004: { - name: "Reserved", - message: "Reserved. A meaning might be defined in the future." - }, - 1005: { - name: "No Status Rcvd", - message: "Reserved. Indicates that no status code was provided even though one was expected." - }, - 1006: { - name: "Abnormal Closure", - message: "Reserved. Indicates that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected." - }, - 1007: { - name: "Invalid frame payload data", - message: "The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message)." - }, - 1008: { - name: "Policy Violation", - message: "The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable." - }, - 1009: { - name: "Message Too Big", - message: "The endpoint is terminating the connection because a data frame was received that is too large." - }, - 1010: { - name: "Mandatory Ext.", - message: "The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't." - }, - 1011: { - name: "Internal Error", - message: "The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request." - }, - 1012: { - name: "Service Restart", - message: "The server is terminating the connection because it is restarting." - }, - 1013: { - name: "Try Again Later", - message: "The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients." - }, - 1014: { - name: "Bad Gateway", - message: "The server was acting as a gateway or proxy and received an invalid response from the upstream server. This is similar to 502 HTTP Status Code." - }, - 1015: { - name: "TLS handshake", - message: "Reserved. Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)." - }, - "1016-2999": { - name: "", - message: "For definition by future revisions of the WebSocket Protocol specification, and for definition by extension specifications." - }, - "3000-3999": { - name: "", - message: "For use by libraries, frameworks, and applications. These status codes are registered directly with IANA. The interpretation of these codes is undefined by the WebSocket protocol." - }, - "4000-4999": { - name: "", - message: "For private use, and thus can't be registered. Such codes can be used by prior agreements between WebSocket applications. The interpretation of these codes is undefined by the WebSocket protocol." - } -}; - -// node_modules/web3-errors/lib/esm/errors/rpc_errors.js -var RpcError = class extends BaseWeb3Error { - constructor(rpcError, message) { - super(message !== null && message !== void 0 ? message : genericRpcErrorMessageTemplate.replace("*code*", rpcError.error.code.toString())); - this.code = rpcError.error.code; - this.id = rpcError.id; - this.jsonrpc = rpcError.jsonrpc; - this.jsonRpcError = rpcError.error; - } - toJSON() { - return Object.assign(Object.assign({}, super.toJSON()), { error: this.jsonRpcError, id: this.id, jsonRpc: this.jsonrpc }); - } -}; -var EIP1193ProviderRpcError = class extends BaseWeb3Error { - constructor(code, data) { - var _a4, _b, _c, _d; - if (!code) { - super(); - } else if ((_a4 = RpcErrorMessages[code]) === null || _a4 === void 0 ? void 0 : _a4.message) { - super(RpcErrorMessages[code].message); - } else { - const statusCodeRange = Object.keys(RpcErrorMessages).find((statusCode) => typeof statusCode === "string" && code >= parseInt(statusCode.split("-")[0], 10) && code <= parseInt(statusCode.split("-")[1], 10)); - super((_c = (_b = RpcErrorMessages[statusCodeRange !== null && statusCodeRange !== void 0 ? statusCodeRange : ""]) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : genericRpcErrorMessageTemplate.replace("*code*", (_d = code === null || code === void 0 ? void 0 : code.toString()) !== null && _d !== void 0 ? _d : '""')); - } - this.code = code; - this.data = data; - } -}; -var ParseError = class extends RpcError { - constructor(rpcError) { - super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_JSON].message); - this.code = ERR_RPC_INVALID_JSON; - } -}; -var InvalidRequestError = class extends RpcError { - constructor(rpcError) { - super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_REQUEST].message); - this.code = ERR_RPC_INVALID_REQUEST; - } -}; -var MethodNotFoundError = class extends RpcError { - constructor(rpcError) { - super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_METHOD].message); - this.code = ERR_RPC_INVALID_METHOD; - } -}; -var InvalidParamsError = class extends RpcError { - constructor(rpcError) { - super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_PARAMS].message); - this.code = ERR_RPC_INVALID_PARAMS; - } -}; -var InternalError = class extends RpcError { - constructor(rpcError) { - super(rpcError, RpcErrorMessages[ERR_RPC_INTERNAL_ERROR].message); - this.code = ERR_RPC_INTERNAL_ERROR; - } -}; -var InvalidInputError = class extends RpcError { - constructor(rpcError) { - super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_INPUT].message); - this.code = ERR_RPC_INVALID_INPUT; - } -}; -var MethodNotSupported = class extends RpcError { - constructor(rpcError) { - super(rpcError, RpcErrorMessages[ERR_RPC_UNSUPPORTED_METHOD].message); - this.code = ERR_RPC_UNSUPPORTED_METHOD; - } -}; -var ResourceUnavailableError = class extends RpcError { - constructor(rpcError) { - super(rpcError, RpcErrorMessages[ERR_RPC_UNAVAILABLE_RESOURCE].message); - this.code = ERR_RPC_UNAVAILABLE_RESOURCE; - } -}; -var ResourcesNotFoundError = class extends RpcError { - constructor(rpcError) { - super(rpcError, RpcErrorMessages[ERR_RPC_MISSING_RESOURCE].message); - this.code = ERR_RPC_MISSING_RESOURCE; - } -}; -var VersionNotSupportedError = class extends RpcError { - constructor(rpcError) { - super(rpcError, RpcErrorMessages[ERR_RPC_NOT_SUPPORTED].message); - this.code = ERR_RPC_NOT_SUPPORTED; - } -}; -var TransactionRejectedError = class extends RpcError { - constructor(rpcError) { - super(rpcError, RpcErrorMessages[ERR_RPC_TRANSACTION_REJECTED].message); - this.code = ERR_RPC_TRANSACTION_REJECTED; - } -}; -var LimitExceededError = class extends RpcError { - constructor(rpcError) { - super(rpcError, RpcErrorMessages[ERR_RPC_LIMIT_EXCEEDED].message); - this.code = ERR_RPC_LIMIT_EXCEEDED; - } -}; -var rpcErrorsMap = /* @__PURE__ */ new Map(); -rpcErrorsMap.set(ERR_RPC_INVALID_JSON, { error: ParseError }); -rpcErrorsMap.set(ERR_RPC_INVALID_REQUEST, { - error: InvalidRequestError -}); -rpcErrorsMap.set(ERR_RPC_INVALID_METHOD, { - error: MethodNotFoundError -}); -rpcErrorsMap.set(ERR_RPC_INVALID_PARAMS, { error: InvalidParamsError }); -rpcErrorsMap.set(ERR_RPC_INTERNAL_ERROR, { error: InternalError }); -rpcErrorsMap.set(ERR_RPC_INVALID_INPUT, { error: InvalidInputError }); -rpcErrorsMap.set(ERR_RPC_UNSUPPORTED_METHOD, { - error: MethodNotSupported -}); -rpcErrorsMap.set(ERR_RPC_UNAVAILABLE_RESOURCE, { - error: ResourceUnavailableError -}); -rpcErrorsMap.set(ERR_RPC_TRANSACTION_REJECTED, { - error: TransactionRejectedError -}); -rpcErrorsMap.set(ERR_RPC_MISSING_RESOURCE, { - error: ResourcesNotFoundError -}); -rpcErrorsMap.set(ERR_RPC_NOT_SUPPORTED, { - error: VersionNotSupportedError -}); -rpcErrorsMap.set(ERR_RPC_LIMIT_EXCEEDED, { error: LimitExceededError }); - -// node_modules/web3-errors/lib/esm/errors/schema_errors.js -var SchemaFormatError = class extends BaseWeb3Error { - constructor(type) { - super(`Format for the type ${type} is unsupported`); - this.type = type; - this.code = ERR_SCHEMA_FORMAT; - } - toJSON() { - return Object.assign(Object.assign({}, super.toJSON()), { type: this.type }); - } -}; - -// node_modules/web3-utils/lib/esm/index.js -var esm_exports4 = {}; -__export(esm_exports4, { - ChunkResponseParser: () => ChunkResponseParser, - Eip1193Provider: () => Eip1193Provider, - EventEmitter: () => EventEmitter2, - SocketProvider: () => SocketProvider, - Web3DeferredPromise: () => Web3DeferredPromise, - asciiToHex: () => asciiToHex, - bytesToHex: () => bytesToHex2, - bytesToUint8Array: () => bytesToUint8Array, - checkAddressCheckSum: () => checkAddressCheckSum2, - compareBlockNumbers: () => compareBlockNumbers, - convert: () => convert, - convertScalarValue: () => convertScalarValue, - encodePacked: () => encodePacked, - ethUnitMap: () => ethUnitMap, - format: () => format, - fromAscii: () => fromAscii, - fromDecimal: () => fromDecimal, - fromTwosComplement: () => fromTwosComplement, - fromUtf8: () => fromUtf8, - fromWei: () => fromWei, - getStorageSlotNumForLongString: () => getStorageSlotNumForLongString, - hexToAscii: () => hexToAscii, - hexToBytes: () => hexToBytes2, - hexToNumber: () => hexToNumber2, - hexToNumberString: () => hexToNumberString, - hexToString: () => hexToString, - hexToUtf8: () => hexToUtf8, - isAddress: () => isAddress2, - isBatchRequest: () => isBatchRequest, - isBatchResponse: () => isBatchResponse, - isBloom: () => isBloom2, - isContractAddressInBloom: () => isContractAddressInBloom2, - isContractInitOptions: () => isContractInitOptions, - isDataFormat: () => isDataFormat, - isHex: () => isHex2, - isHexStrict: () => isHexStrict2, - isInBloom: () => isInBloom2, - isNullish: () => isNullish2, - isPromise: () => isPromise, - isResponseRpcError: () => isResponseRpcError, - isResponseWithError: () => isResponseWithError2, - isResponseWithNotification: () => isResponseWithNotification, - isResponseWithResult: () => isResponseWithResult, - isSubscriptionResult: () => isSubscriptionResult, - isTopic: () => isTopic2, - isTopicInBloom: () => isTopicInBloom2, - isUint8Array: () => isUint8Array2, - isUserEthereumAddressInBloom: () => isUserEthereumAddressInBloom2, - isValidResponse: () => isValidResponse, - jsonRpc: () => json_rpc_exports, - keccak256: () => keccak256Wrapper, - keccak256Wrapper: () => keccak256Wrapper, - leftPad: () => leftPad, - mergeDeep: () => mergeDeep, - numberToHex: () => numberToHex2, - padLeft: () => padLeft2, - padRight: () => padRight, - pollTillDefined: () => pollTillDefined, - pollTillDefinedAndReturnIntervalId: () => pollTillDefinedAndReturnIntervalId, - processSolidityEncodePackedArgs: () => processSolidityEncodePackedArgs, - randomBytes: () => randomBytes2, - randomHex: () => randomHex, - rejectIfConditionAtInterval: () => rejectIfConditionAtInterval, - rejectIfTimeout: () => rejectIfTimeout, - rightPad: () => rightPad, - setRequestIdStart: () => setRequestIdStart, - sha3: () => sha3, - sha3Raw: () => sha3Raw, - soliditySha3: () => soliditySha3, - soliditySha3Raw: () => soliditySha3Raw, - stringToHex: () => stringToHex, - toAscii: () => toAscii, - toBatchPayload: () => toBatchPayload, - toBigInt: () => toBigInt, - toBool: () => toBool, - toChecksumAddress: () => toChecksumAddress, - toDecimal: () => toDecimal, - toHex: () => toHex, - toNumber: () => toNumber, - toPayload: () => toPayload, - toTwosComplement: () => toTwosComplement, - toUtf8: () => toUtf8, - toWei: () => toWei, - uint8ArrayConcat: () => uint8ArrayConcat, - uint8ArrayEquals: () => uint8ArrayEquals, - utf8ToBytes: () => utf8ToBytes2, - utf8ToHex: () => utf8ToHex, - uuidV4: () => uuidV4, - validateResponse: () => validateResponse, - waitWithTimeout: () => waitWithTimeout -}); - -// node_modules/@noble/hashes/esm/_assert.js -function number(n) { - if (!Number.isSafeInteger(n) || n < 0) - throw new Error(`Wrong positive integer: ${n}`); -} -function bool(b) { - if (typeof b !== "boolean") - throw new Error(`Expected boolean, not ${b}`); -} -function isBytes(a) { - return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array"; -} -function bytes(b, ...lengths) { - if (!isBytes(b)) - throw new Error("Expected Uint8Array"); - if (lengths.length > 0 && !lengths.includes(b.length)) - throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); -} -function hash(hash2) { - if (typeof hash2 !== "function" || typeof hash2.create !== "function") - throw new Error("Hash should be wrapped by utils.wrapConstructor"); - number(hash2.outputLen); - number(hash2.blockLen); -} -function exists(instance, checkFinished = true) { - if (instance.destroyed) - throw new Error("Hash instance has been destroyed"); - if (checkFinished && instance.finished) - throw new Error("Hash#digest() has already been called"); -} -function output(out, instance) { - bytes(out); - const min = instance.outputLen; - if (out.length < min) { - throw new Error(`digestInto() expects output buffer of length at least ${min}`); - } -} -var assert = { number, bool, bytes, hash, exists, output }; -var assert_default = assert; - -// node_modules/@noble/hashes/esm/_u64.js -var U32_MASK64 = BigInt(2 ** 32 - 1); -var _32n = BigInt(32); -function fromBig(n, le = false) { - if (le) - return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) }; - return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 }; -} -function split(lst, le = false) { - let Ah = new Uint32Array(lst.length); - let Al = new Uint32Array(lst.length); - for (let i = 0; i < lst.length; i++) { - const { h, l } = fromBig(lst[i], le); - [Ah[i], Al[i]] = [h, l]; - } - return [Ah, Al]; -} -var toBig = (h, l) => BigInt(h >>> 0) << _32n | BigInt(l >>> 0); -var shrSH = (h, _l, s) => h >>> s; -var shrSL = (h, l, s) => h << 32 - s | l >>> s; -var rotrSH = (h, l, s) => h >>> s | l << 32 - s; -var rotrSL = (h, l, s) => h << 32 - s | l >>> s; -var rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32; -var rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s; -var rotr32H = (_h, l) => l; -var rotr32L = (h, _l) => h; -var rotlSH = (h, l, s) => h << s | l >>> 32 - s; -var rotlSL = (h, l, s) => l << s | h >>> 32 - s; -var rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s; -var rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s; -function add(Ah, Al, Bh, Bl) { - const l = (Al >>> 0) + (Bl >>> 0); - return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 }; -} -var add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0); -var add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0; -var add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0); -var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0; -var add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0); -var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0; -var u64 = { - fromBig, - split, - toBig, - shrSH, - shrSL, - rotrSH, - rotrSL, - rotrBH, - rotrBL, - rotr32H, - rotr32L, - rotlSH, - rotlSL, - rotlBH, - rotlBL, - add, - add3L, - add3H, - add4L, - add4H, - add5H, - add5L -}; -var u64_default = u64; - -// node_modules/@noble/hashes/esm/crypto.js -var crypto = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : void 0; - -// node_modules/@noble/hashes/esm/utils.js -var u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); -function isBytes2(a) { - return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array"; -} -var createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); -var rotr = (word, shift) => word << 32 - shift | word >>> shift; -var isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68; -if (!isLE) - throw new Error("Non little-endian hardware is not supported"); -var hexes = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0")); -function utf8ToBytes(str) { - if (typeof str !== "string") - throw new Error(`utf8ToBytes expected string, got ${typeof str}`); - return new Uint8Array(new TextEncoder().encode(str)); -} -function toBytes(data) { - if (typeof data === "string") - data = utf8ToBytes(data); - if (!isBytes2(data)) - throw new Error(`expected Uint8Array, got ${typeof data}`); - return data; -} -function concatBytes(...arrays) { - let sum = 0; - for (let i = 0; i < arrays.length; i++) { - const a = arrays[i]; - if (!isBytes2(a)) - throw new Error("Uint8Array expected"); - sum += a.length; - } - const res = new Uint8Array(sum); - for (let i = 0, pad = 0; i < arrays.length; i++) { - const a = arrays[i]; - res.set(a, pad); - pad += a.length; - } - return res; -} -var Hash = class { - // Safe version that clones internal state - clone() { - return this._cloneInto(); - } -}; -var toStr = {}.toString; -function checkOpts(defaults, opts) { - if (opts !== void 0 && toStr.call(opts) !== "[object Object]") - throw new Error("Options should be object or undefined"); - const merged = Object.assign(defaults, opts); - return merged; -} -function wrapConstructor(hashCons) { - const hashC = (msg) => hashCons().update(toBytes(msg)).digest(); - const tmp = hashCons(); - hashC.outputLen = tmp.outputLen; - hashC.blockLen = tmp.blockLen; - hashC.create = () => hashCons(); - return hashC; -} -function wrapXOFConstructorWithOpts(hashCons) { - const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest(); - const tmp = hashCons({}); - hashC.outputLen = tmp.outputLen; - hashC.blockLen = tmp.blockLen; - hashC.create = (opts) => hashCons(opts); - return hashC; -} -function randomBytes(bytesLength = 32) { - if (crypto && typeof crypto.getRandomValues === "function") { - return crypto.getRandomValues(new Uint8Array(bytesLength)); - } - throw new Error("crypto.getRandomValues must be defined"); -} - -// node_modules/@noble/hashes/esm/sha3.js -var [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []]; -var _0n = BigInt(0); -var _1n = BigInt(1); -var _2n = BigInt(2); -var _7n = BigInt(7); -var _256n = BigInt(256); -var _0x71n = BigInt(113); -for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) { - [x, y] = [y, (2 * x + 3 * y) % 5]; - SHA3_PI.push(2 * (5 * y + x)); - SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64); - let t = _0n; - for (let j = 0; j < 7; j++) { - R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n; - if (R & _2n) - t ^= _1n << (_1n << BigInt(j)) - _1n; - } - _SHA3_IOTA.push(t); -} -var [SHA3_IOTA_H, SHA3_IOTA_L] = split(_SHA3_IOTA, true); -var rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s); -var rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s); -function keccakP(s, rounds = 24) { - const B = new Uint32Array(5 * 2); - for (let round = 24 - rounds; round < 24; round++) { - for (let x = 0; x < 10; x++) - B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40]; - for (let x = 0; x < 10; x += 2) { - const idx1 = (x + 8) % 10; - const idx0 = (x + 2) % 10; - const B0 = B[idx0]; - const B1 = B[idx0 + 1]; - const Th = rotlH(B0, B1, 1) ^ B[idx1]; - const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1]; - for (let y = 0; y < 50; y += 10) { - s[x + y] ^= Th; - s[x + y + 1] ^= Tl; - } - } - let curH = s[2]; - let curL = s[3]; - for (let t = 0; t < 24; t++) { - const shift = SHA3_ROTL[t]; - const Th = rotlH(curH, curL, shift); - const Tl = rotlL(curH, curL, shift); - const PI = SHA3_PI[t]; - curH = s[PI]; - curL = s[PI + 1]; - s[PI] = Th; - s[PI + 1] = Tl; - } - for (let y = 0; y < 50; y += 10) { - for (let x = 0; x < 10; x++) - B[x] = s[y + x]; - for (let x = 0; x < 10; x++) - s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10]; - } - s[0] ^= SHA3_IOTA_H[round]; - s[1] ^= SHA3_IOTA_L[round]; - } - B.fill(0); -} -var Keccak = class _Keccak extends Hash { - // NOTE: we accept arguments in bytes instead of bits here. - constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) { - super(); - this.blockLen = blockLen; - this.suffix = suffix; - this.outputLen = outputLen; - this.enableXOF = enableXOF; - this.rounds = rounds; - this.pos = 0; - this.posOut = 0; - this.finished = false; - this.destroyed = false; - number(outputLen); - if (0 >= this.blockLen || this.blockLen >= 200) - throw new Error("Sha3 supports only keccak-f1600 function"); - this.state = new Uint8Array(200); - this.state32 = u32(this.state); - } - keccak() { - keccakP(this.state32, this.rounds); - this.posOut = 0; - this.pos = 0; - } - update(data) { - exists(this); - const { blockLen, state } = this; - data = toBytes(data); - const len = data.length; - for (let pos = 0; pos < len; ) { - const take = Math.min(blockLen - this.pos, len - pos); - for (let i = 0; i < take; i++) - state[this.pos++] ^= data[pos++]; - if (this.pos === blockLen) - this.keccak(); - } - return this; - } - finish() { - if (this.finished) - return; - this.finished = true; - const { state, suffix, pos, blockLen } = this; - state[pos] ^= suffix; - if ((suffix & 128) !== 0 && pos === blockLen - 1) - this.keccak(); - state[blockLen - 1] ^= 128; - this.keccak(); - } - writeInto(out) { - exists(this, false); - bytes(out); - this.finish(); - const bufferOut = this.state; - const { blockLen } = this; - for (let pos = 0, len = out.length; pos < len; ) { - if (this.posOut >= blockLen) - this.keccak(); - const take = Math.min(blockLen - this.posOut, len - pos); - out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); - this.posOut += take; - pos += take; - } - return out; - } - xofInto(out) { - if (!this.enableXOF) - throw new Error("XOF is not possible for this instance"); - return this.writeInto(out); - } - xof(bytes2) { - number(bytes2); - return this.xofInto(new Uint8Array(bytes2)); - } - digestInto(out) { - output(out, this); - if (this.finished) - throw new Error("digest() was already called"); - this.writeInto(out); - this.destroy(); - return out; - } - digest() { - return this.digestInto(new Uint8Array(this.outputLen)); - } - destroy() { - this.destroyed = true; - this.state.fill(0); - } - _cloneInto(to) { - const { blockLen, suffix, outputLen, rounds, enableXOF } = this; - to || (to = new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds)); - to.state32.set(this.state32); - to.pos = this.pos; - to.posOut = this.posOut; - to.finished = this.finished; - to.rounds = rounds; - to.suffix = suffix; - to.outputLen = outputLen; - to.enableXOF = enableXOF; - to.destroyed = this.destroyed; - return to; - } -}; -var gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen)); -var sha3_224 = gen(6, 144, 224 / 8); -var sha3_256 = gen(6, 136, 256 / 8); -var sha3_384 = gen(6, 104, 384 / 8); -var sha3_512 = gen(6, 72, 512 / 8); -var keccak_224 = gen(1, 144, 224 / 8); -var keccak_256 = gen(1, 136, 256 / 8); -var keccak_384 = gen(1, 104, 384 / 8); -var keccak_512 = gen(1, 72, 512 / 8); -var genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true)); -var shake128 = genShake(31, 168, 128 / 8); -var shake256 = genShake(31, 136, 256 / 8); - -// node_modules/ethereum-cryptography/esm/utils.js -var assertBool = assert_default.bool; -var assertBytes = assert_default.bytes; -function bytesToUtf8(data) { - if (!(data instanceof Uint8Array)) { - throw new TypeError(`bytesToUtf8 expected Uint8Array, got ${typeof data}`); - } - return new TextDecoder().decode(data); -} -function equalsBytes(a, b) { - if (a.length !== b.length) { - return false; - } - for (let i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - return true; -} -function wrapHash(hash2) { - return (msg) => { - assert_default.bytes(msg); - return hash2(msg); - }; -} -var crypto2 = (() => { - const webCrypto = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : void 0; - const nodeRequire = typeof module !== "undefined" && typeof module.require === "function" && module.require.bind(module); - return { - node: nodeRequire && !webCrypto ? nodeRequire("crypto") : void 0, - web: webCrypto - }; -})(); - -// node_modules/ethereum-cryptography/esm/keccak.js -var keccak224 = wrapHash(keccak_224); -var keccak256 = (() => { - const k = wrapHash(keccak_256); - k.create = keccak_256.create; - return k; -})(); -var keccak384 = wrapHash(keccak_384); -var keccak512 = wrapHash(keccak_512); - -// node_modules/web3-validator/lib/esm/index.js -var esm_exports3 = {}; -__export(esm_exports3, { - VALID_ETH_BASE_TYPES: () => VALID_ETH_BASE_TYPES, - Web3Validator: () => Web3Validator, - Web3ValidatorError: () => Web3ValidatorError, - bigintPower: () => bigintPower, - checkAddressCheckSum: () => checkAddressCheckSum, - isAddress: () => isAddress, - isBigInt: () => isBigInt, - isBlockNumber: () => isBlockNumber, - isBlockNumberOrTag: () => isBlockNumberOrTag, - isBlockTag: () => isBlockTag, - isBloom: () => isBloom, - isBoolean: () => isBoolean, - isBytes: () => isBytes3, - isContractAddressInBloom: () => isContractAddressInBloom, - isFilterObject: () => isFilterObject, - isHex: () => isHex, - isHexPrefixed: () => isHexPrefixed, - isHexStrict: () => isHexStrict, - isHexString: () => isHexString, - isHexString32Bytes: () => isHexString32Bytes, - isHexString8Bytes: () => isHexString8Bytes, - isInBloom: () => isInBloom, - isInt: () => isInt, - isNullish: () => isNullish, - isNumber: () => isNumber, - isObject: () => isObject, - isString: () => isString, - isTopic: () => isTopic, - isTopicInBloom: () => isTopicInBloom, - isUInt: () => isUInt, - isUint8Array: () => isUint8Array, - isUserEthereumAddressInBloom: () => isUserEthereumAddressInBloom, - isValidEthBaseType: () => isValidEthBaseType, - utils: () => utils_exports, - validateNoLeadingZeroes: () => validateNoLeadingZeroes, - validator: () => validator -}); - -// node_modules/zod/lib/index.mjs -var util; -(function(util2) { - util2.assertEqual = (val) => val; - function assertIs(_arg) { - } - util2.assertIs = assertIs; - function assertNever(_x) { - throw new Error(); - } - util2.assertNever = assertNever; - util2.arrayToEnum = (items) => { - const obj = {}; - for (const item of items) { - obj[item] = item; - } - return obj; - }; - util2.getValidEnumValues = (obj) => { - const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number"); - const filtered = {}; - for (const k of validKeys) { - filtered[k] = obj[k]; - } - return util2.objectValues(filtered); - }; - util2.objectValues = (obj) => { - return util2.objectKeys(obj).map(function(e) { - return obj[e]; - }); - }; - util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => { - const keys = []; - for (const key in object) { - if (Object.prototype.hasOwnProperty.call(object, key)) { - keys.push(key); - } - } - return keys; - }; - util2.find = (arr, checker) => { - for (const item of arr) { - if (checker(item)) - return item; - } - return void 0; - }; - util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val; - function joinValues(array, separator = " | ") { - return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator); - } - util2.joinValues = joinValues; - util2.jsonStringifyReplacer = (_, value) => { - if (typeof value === "bigint") { - return value.toString(); - } - return value; - }; -})(util || (util = {})); -var objectUtil; -(function(objectUtil2) { - objectUtil2.mergeShapes = (first, second) => { - return { - ...first, - ...second - // second overwrites first - }; - }; -})(objectUtil || (objectUtil = {})); -var ZodParsedType = util.arrayToEnum([ - "string", - "nan", - "number", - "integer", - "float", - "boolean", - "date", - "bigint", - "symbol", - "function", - "undefined", - "null", - "array", - "object", - "unknown", - "promise", - "void", - "never", - "map", - "set" -]); -var getParsedType = (data) => { - const t = typeof data; - switch (t) { - case "undefined": - return ZodParsedType.undefined; - case "string": - return ZodParsedType.string; - case "number": - return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number; - case "boolean": - return ZodParsedType.boolean; - case "function": - return ZodParsedType.function; - case "bigint": - return ZodParsedType.bigint; - case "symbol": - return ZodParsedType.symbol; - case "object": - if (Array.isArray(data)) { - return ZodParsedType.array; - } - if (data === null) { - return ZodParsedType.null; - } - if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") { - return ZodParsedType.promise; - } - if (typeof Map !== "undefined" && data instanceof Map) { - return ZodParsedType.map; - } - if (typeof Set !== "undefined" && data instanceof Set) { - return ZodParsedType.set; - } - if (typeof Date !== "undefined" && data instanceof Date) { - return ZodParsedType.date; - } - return ZodParsedType.object; - default: - return ZodParsedType.unknown; - } -}; -var ZodIssueCode = util.arrayToEnum([ - "invalid_type", - "invalid_literal", - "custom", - "invalid_union", - "invalid_union_discriminator", - "invalid_enum_value", - "unrecognized_keys", - "invalid_arguments", - "invalid_return_type", - "invalid_date", - "invalid_string", - "too_small", - "too_big", - "invalid_intersection_types", - "not_multiple_of", - "not_finite" -]); -var quotelessJson = (obj) => { - const json = JSON.stringify(obj, null, 2); - return json.replace(/"([^"]+)":/g, "$1:"); -}; -var ZodError = class _ZodError extends Error { - constructor(issues) { - super(); - this.issues = []; - this.addIssue = (sub) => { - this.issues = [...this.issues, sub]; - }; - this.addIssues = (subs = []) => { - this.issues = [...this.issues, ...subs]; - }; - const actualProto = new.target.prototype; - if (Object.setPrototypeOf) { - Object.setPrototypeOf(this, actualProto); - } else { - this.__proto__ = actualProto; - } - this.name = "ZodError"; - this.issues = issues; - } - get errors() { - return this.issues; - } - format(_mapper) { - const mapper = _mapper || function(issue) { - return issue.message; - }; - const fieldErrors = { _errors: [] }; - const processError = (error) => { - for (const issue of error.issues) { - if (issue.code === "invalid_union") { - issue.unionErrors.map(processError); - } else if (issue.code === "invalid_return_type") { - processError(issue.returnTypeError); - } else if (issue.code === "invalid_arguments") { - processError(issue.argumentsError); - } else if (issue.path.length === 0) { - fieldErrors._errors.push(mapper(issue)); - } else { - let curr = fieldErrors; - let i = 0; - while (i < issue.path.length) { - const el = issue.path[i]; - const terminal = i === issue.path.length - 1; - if (!terminal) { - curr[el] = curr[el] || { _errors: [] }; - } else { - curr[el] = curr[el] || { _errors: [] }; - curr[el]._errors.push(mapper(issue)); - } - curr = curr[el]; - i++; - } - } - } - }; - processError(this); - return fieldErrors; - } - static assert(value) { - if (!(value instanceof _ZodError)) { - throw new Error(`Not a ZodError: ${value}`); - } - } - toString() { - return this.message; - } - get message() { - return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2); - } - get isEmpty() { - return this.issues.length === 0; - } - flatten(mapper = (issue) => issue.message) { - const fieldErrors = {}; - const formErrors = []; - for (const sub of this.issues) { - if (sub.path.length > 0) { - fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || []; - fieldErrors[sub.path[0]].push(mapper(sub)); - } else { - formErrors.push(mapper(sub)); - } - } - return { formErrors, fieldErrors }; - } - get formErrors() { - return this.flatten(); - } -}; -ZodError.create = (issues) => { - const error = new ZodError(issues); - return error; -}; -var errorMap = (issue, _ctx) => { - let message; - switch (issue.code) { - case ZodIssueCode.invalid_type: - if (issue.received === ZodParsedType.undefined) { - message = "Required"; - } else { - message = `Expected ${issue.expected}, received ${issue.received}`; - } - break; - case ZodIssueCode.invalid_literal: - message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`; - break; - case ZodIssueCode.unrecognized_keys: - message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`; - break; - case ZodIssueCode.invalid_union: - message = `Invalid input`; - break; - case ZodIssueCode.invalid_union_discriminator: - message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`; - break; - case ZodIssueCode.invalid_enum_value: - message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`; - break; - case ZodIssueCode.invalid_arguments: - message = `Invalid function arguments`; - break; - case ZodIssueCode.invalid_return_type: - message = `Invalid function return type`; - break; - case ZodIssueCode.invalid_date: - message = `Invalid date`; - break; - case ZodIssueCode.invalid_string: - if (typeof issue.validation === "object") { - if ("includes" in issue.validation) { - message = `Invalid input: must include "${issue.validation.includes}"`; - if (typeof issue.validation.position === "number") { - message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`; - } - } else if ("startsWith" in issue.validation) { - message = `Invalid input: must start with "${issue.validation.startsWith}"`; - } else if ("endsWith" in issue.validation) { - message = `Invalid input: must end with "${issue.validation.endsWith}"`; - } else { - util.assertNever(issue.validation); - } - } else if (issue.validation !== "regex") { - message = `Invalid ${issue.validation}`; - } else { - message = "Invalid"; - } - break; - case ZodIssueCode.too_small: - if (issue.type === "array") - message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`; - else if (issue.type === "string") - message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`; - else if (issue.type === "number") - message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`; - else if (issue.type === "date") - message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`; - else - message = "Invalid input"; - break; - case ZodIssueCode.too_big: - if (issue.type === "array") - message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`; - else if (issue.type === "string") - message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`; - else if (issue.type === "number") - message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`; - else if (issue.type === "bigint") - message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`; - else if (issue.type === "date") - message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`; - else - message = "Invalid input"; - break; - case ZodIssueCode.custom: - message = `Invalid input`; - break; - case ZodIssueCode.invalid_intersection_types: - message = `Intersection results could not be merged`; - break; - case ZodIssueCode.not_multiple_of: - message = `Number must be a multiple of ${issue.multipleOf}`; - break; - case ZodIssueCode.not_finite: - message = "Number must be finite"; - break; - default: - message = _ctx.defaultError; - util.assertNever(issue); - } - return { message }; -}; -var overrideErrorMap = errorMap; -function setErrorMap(map) { - overrideErrorMap = map; -} -function getErrorMap() { - return overrideErrorMap; -} -var makeIssue = (params) => { - const { data, path, errorMaps, issueData } = params; - const fullPath = [...path, ...issueData.path || []]; - const fullIssue = { - ...issueData, - path: fullPath - }; - if (issueData.message !== void 0) { - return { - ...issueData, - path: fullPath, - message: issueData.message - }; - } - let errorMessage = ""; - const maps = errorMaps.filter((m) => !!m).slice().reverse(); - for (const map of maps) { - errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message; - } - return { - ...issueData, - path: fullPath, - message: errorMessage - }; -}; -var EMPTY_PATH = []; -function addIssueToContext(ctx, issueData) { - const overrideMap = getErrorMap(); - const issue = makeIssue({ - issueData, - data: ctx.data, - path: ctx.path, - errorMaps: [ - ctx.common.contextualErrorMap, - ctx.schemaErrorMap, - overrideMap, - overrideMap === errorMap ? void 0 : errorMap - // then global default map - ].filter((x) => !!x) - }); - ctx.common.issues.push(issue); -} -var ParseStatus = class _ParseStatus { - constructor() { - this.value = "valid"; - } - dirty() { - if (this.value === "valid") - this.value = "dirty"; - } - abort() { - if (this.value !== "aborted") - this.value = "aborted"; - } - static mergeArray(status, results) { - const arrayValue = []; - for (const s of results) { - if (s.status === "aborted") - return INVALID; - if (s.status === "dirty") - status.dirty(); - arrayValue.push(s.value); - } - return { status: status.value, value: arrayValue }; - } - static async mergeObjectAsync(status, pairs) { - const syncPairs = []; - for (const pair of pairs) { - const key = await pair.key; - const value = await pair.value; - syncPairs.push({ - key, - value - }); - } - return _ParseStatus.mergeObjectSync(status, syncPairs); - } - static mergeObjectSync(status, pairs) { - const finalObject = {}; - for (const pair of pairs) { - const { key, value } = pair; - if (key.status === "aborted") - return INVALID; - if (value.status === "aborted") - return INVALID; - if (key.status === "dirty") - status.dirty(); - if (value.status === "dirty") - status.dirty(); - if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) { - finalObject[key.value] = value.value; - } - } - return { status: status.value, value: finalObject }; - } -}; -var INVALID = Object.freeze({ - status: "aborted" -}); -var DIRTY = (value) => ({ status: "dirty", value }); -var OK = (value) => ({ status: "valid", value }); -var isAborted = (x) => x.status === "aborted"; -var isDirty = (x) => x.status === "dirty"; -var isValid = (x) => x.status === "valid"; -var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise; -function __classPrivateFieldGet(receiver, state, kind, f) { - if (kind === "a" && !f) - throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) - throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -} -function __classPrivateFieldSet(receiver, state, value, kind, f) { - if (kind === "m") - throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) - throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) - throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value; -} -var errorUtil; -(function(errorUtil2) { - errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {}; - errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message; -})(errorUtil || (errorUtil = {})); -var _ZodEnum_cache; -var _ZodNativeEnum_cache; -var ParseInputLazyPath = class { - constructor(parent, value, path, key) { - this._cachedPath = []; - this.parent = parent; - this.data = value; - this._path = path; - this._key = key; - } - get path() { - if (!this._cachedPath.length) { - if (this._key instanceof Array) { - this._cachedPath.push(...this._path, ...this._key); - } else { - this._cachedPath.push(...this._path, this._key); - } - } - return this._cachedPath; - } -}; -var handleResult = (ctx, result) => { - if (isValid(result)) { - return { success: true, data: result.value }; - } else { - if (!ctx.common.issues.length) { - throw new Error("Validation failed but no issues detected."); - } - return { - success: false, - get error() { - if (this._error) - return this._error; - const error = new ZodError(ctx.common.issues); - this._error = error; - return this._error; - } - }; - } -}; -function processCreateParams(params) { - if (!params) - return {}; - const { errorMap: errorMap2, invalid_type_error, required_error, description } = params; - if (errorMap2 && (invalid_type_error || required_error)) { - throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`); - } - if (errorMap2) - return { errorMap: errorMap2, description }; - const customMap = (iss, ctx) => { - var _a4, _b; - const { message } = params; - if (iss.code === "invalid_enum_value") { - return { message: message !== null && message !== void 0 ? message : ctx.defaultError }; - } - if (typeof ctx.data === "undefined") { - return { message: (_a4 = message !== null && message !== void 0 ? message : required_error) !== null && _a4 !== void 0 ? _a4 : ctx.defaultError }; - } - if (iss.code !== "invalid_type") - return { message: ctx.defaultError }; - return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError }; - }; - return { errorMap: customMap, description }; -} -var ZodType = class { - constructor(def) { - this.spa = this.safeParseAsync; - this._def = def; - this.parse = this.parse.bind(this); - this.safeParse = this.safeParse.bind(this); - this.parseAsync = this.parseAsync.bind(this); - this.safeParseAsync = this.safeParseAsync.bind(this); - this.spa = this.spa.bind(this); - this.refine = this.refine.bind(this); - this.refinement = this.refinement.bind(this); - this.superRefine = this.superRefine.bind(this); - this.optional = this.optional.bind(this); - this.nullable = this.nullable.bind(this); - this.nullish = this.nullish.bind(this); - this.array = this.array.bind(this); - this.promise = this.promise.bind(this); - this.or = this.or.bind(this); - this.and = this.and.bind(this); - this.transform = this.transform.bind(this); - this.brand = this.brand.bind(this); - this.default = this.default.bind(this); - this.catch = this.catch.bind(this); - this.describe = this.describe.bind(this); - this.pipe = this.pipe.bind(this); - this.readonly = this.readonly.bind(this); - this.isNullable = this.isNullable.bind(this); - this.isOptional = this.isOptional.bind(this); - } - get description() { - return this._def.description; - } - _getType(input) { - return getParsedType(input.data); - } - _getOrReturnCtx(input, ctx) { - return ctx || { - common: input.parent.common, - data: input.data, - parsedType: getParsedType(input.data), - schemaErrorMap: this._def.errorMap, - path: input.path, - parent: input.parent - }; - } - _processInputParams(input) { - return { - status: new ParseStatus(), - ctx: { - common: input.parent.common, - data: input.data, - parsedType: getParsedType(input.data), - schemaErrorMap: this._def.errorMap, - path: input.path, - parent: input.parent - } - }; - } - _parseSync(input) { - const result = this._parse(input); - if (isAsync(result)) { - throw new Error("Synchronous parse encountered promise."); - } - return result; - } - _parseAsync(input) { - const result = this._parse(input); - return Promise.resolve(result); - } - parse(data, params) { - const result = this.safeParse(data, params); - if (result.success) - return result.data; - throw result.error; - } - safeParse(data, params) { - var _a4; - const ctx = { - common: { - issues: [], - async: (_a4 = params === null || params === void 0 ? void 0 : params.async) !== null && _a4 !== void 0 ? _a4 : false, - contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap - }, - path: (params === null || params === void 0 ? void 0 : params.path) || [], - schemaErrorMap: this._def.errorMap, - parent: null, - data, - parsedType: getParsedType(data) - }; - const result = this._parseSync({ data, path: ctx.path, parent: ctx }); - return handleResult(ctx, result); - } - async parseAsync(data, params) { - const result = await this.safeParseAsync(data, params); - if (result.success) - return result.data; - throw result.error; - } - async safeParseAsync(data, params) { - const ctx = { - common: { - issues: [], - contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap, - async: true - }, - path: (params === null || params === void 0 ? void 0 : params.path) || [], - schemaErrorMap: this._def.errorMap, - parent: null, - data, - parsedType: getParsedType(data) - }; - const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx }); - const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult)); - return handleResult(ctx, result); - } - refine(check, message) { - const getIssueProperties = (val) => { - if (typeof message === "string" || typeof message === "undefined") { - return { message }; - } else if (typeof message === "function") { - return message(val); - } else { - return message; - } - }; - return this._refinement((val, ctx) => { - const result = check(val); - const setError = () => ctx.addIssue({ - code: ZodIssueCode.custom, - ...getIssueProperties(val) - }); - if (typeof Promise !== "undefined" && result instanceof Promise) { - return result.then((data) => { - if (!data) { - setError(); - return false; - } else { - return true; - } - }); - } - if (!result) { - setError(); - return false; - } else { - return true; - } - }); - } - refinement(check, refinementData) { - return this._refinement((val, ctx) => { - if (!check(val)) { - ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData); - return false; - } else { - return true; - } - }); - } - _refinement(refinement) { - return new ZodEffects({ - schema: this, - typeName: ZodFirstPartyTypeKind.ZodEffects, - effect: { type: "refinement", refinement } - }); - } - superRefine(refinement) { - return this._refinement(refinement); - } - optional() { - return ZodOptional.create(this, this._def); - } - nullable() { - return ZodNullable.create(this, this._def); - } - nullish() { - return this.nullable().optional(); - } - array() { - return ZodArray.create(this, this._def); - } - promise() { - return ZodPromise.create(this, this._def); - } - or(option) { - return ZodUnion.create([this, option], this._def); - } - and(incoming) { - return ZodIntersection.create(this, incoming, this._def); - } - transform(transform) { - return new ZodEffects({ - ...processCreateParams(this._def), - schema: this, - typeName: ZodFirstPartyTypeKind.ZodEffects, - effect: { type: "transform", transform } - }); - } - default(def) { - const defaultValueFunc = typeof def === "function" ? def : () => def; - return new ZodDefault({ - ...processCreateParams(this._def), - innerType: this, - defaultValue: defaultValueFunc, - typeName: ZodFirstPartyTypeKind.ZodDefault - }); - } - brand() { - return new ZodBranded({ - typeName: ZodFirstPartyTypeKind.ZodBranded, - type: this, - ...processCreateParams(this._def) - }); - } - catch(def) { - const catchValueFunc = typeof def === "function" ? def : () => def; - return new ZodCatch({ - ...processCreateParams(this._def), - innerType: this, - catchValue: catchValueFunc, - typeName: ZodFirstPartyTypeKind.ZodCatch - }); - } - describe(description) { - const This = this.constructor; - return new This({ - ...this._def, - description - }); - } - pipe(target) { - return ZodPipeline.create(this, target); - } - readonly() { - return ZodReadonly.create(this); - } - isOptional() { - return this.safeParse(void 0).success; - } - isNullable() { - return this.safeParse(null).success; - } -}; -var cuidRegex = /^c[^\s-]{8,}$/i; -var cuid2Regex = /^[0-9a-z]+$/; -var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/; -var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i; -var nanoidRegex = /^[a-z0-9_-]{21}$/i; -var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/; -var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i; -var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`; -var emojiRegex; -var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/; -var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/; -var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/; -var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`; -var dateRegex = new RegExp(`^${dateRegexSource}$`); -function timeRegexSource(args) { - let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`; - if (args.precision) { - regex = `${regex}\\.\\d{${args.precision}}`; - } else if (args.precision == null) { - regex = `${regex}(\\.\\d+)?`; - } - return regex; -} -function timeRegex(args) { - return new RegExp(`^${timeRegexSource(args)}$`); -} -function datetimeRegex(args) { - let regex = `${dateRegexSource}T${timeRegexSource(args)}`; - const opts = []; - opts.push(args.local ? `Z?` : `Z`); - if (args.offset) - opts.push(`([+-]\\d{2}:?\\d{2})`); - regex = `${regex}(${opts.join("|")})`; - return new RegExp(`^${regex}$`); -} -function isValidIP(ip, version2) { - if ((version2 === "v4" || !version2) && ipv4Regex.test(ip)) { - return true; - } - if ((version2 === "v6" || !version2) && ipv6Regex.test(ip)) { - return true; - } - return false; -} -var ZodString = class _ZodString extends ZodType { - _parse(input) { - if (this._def.coerce) { - input.data = String(input.data); - } - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.string) { - const ctx2 = this._getOrReturnCtx(input); - addIssueToContext(ctx2, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.string, - received: ctx2.parsedType - }); - return INVALID; - } - const status = new ParseStatus(); - let ctx = void 0; - for (const check of this._def.checks) { - if (check.kind === "min") { - if (input.data.length < check.value) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - minimum: check.value, - type: "string", - inclusive: true, - exact: false, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "max") { - if (input.data.length > check.value) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - maximum: check.value, - type: "string", - inclusive: true, - exact: false, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "length") { - const tooBig = input.data.length > check.value; - const tooSmall = input.data.length < check.value; - if (tooBig || tooSmall) { - ctx = this._getOrReturnCtx(input, ctx); - if (tooBig) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - maximum: check.value, - type: "string", - inclusive: true, - exact: true, - message: check.message - }); - } else if (tooSmall) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - minimum: check.value, - type: "string", - inclusive: true, - exact: true, - message: check.message - }); - } - status.dirty(); - } - } else if (check.kind === "email") { - if (!emailRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "email", - code: ZodIssueCode.invalid_string, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "emoji") { - if (!emojiRegex) { - emojiRegex = new RegExp(_emojiRegex, "u"); - } - if (!emojiRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "emoji", - code: ZodIssueCode.invalid_string, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "uuid") { - if (!uuidRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "uuid", - code: ZodIssueCode.invalid_string, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "nanoid") { - if (!nanoidRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "nanoid", - code: ZodIssueCode.invalid_string, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "cuid") { - if (!cuidRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "cuid", - code: ZodIssueCode.invalid_string, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "cuid2") { - if (!cuid2Regex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "cuid2", - code: ZodIssueCode.invalid_string, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "ulid") { - if (!ulidRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "ulid", - code: ZodIssueCode.invalid_string, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "url") { - try { - new URL(input.data); - } catch (_a4) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "url", - code: ZodIssueCode.invalid_string, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "regex") { - check.regex.lastIndex = 0; - const testResult = check.regex.test(input.data); - if (!testResult) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "regex", - code: ZodIssueCode.invalid_string, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "trim") { - input.data = input.data.trim(); - } else if (check.kind === "includes") { - if (!input.data.includes(check.value, check.position)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_string, - validation: { includes: check.value, position: check.position }, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "toLowerCase") { - input.data = input.data.toLowerCase(); - } else if (check.kind === "toUpperCase") { - input.data = input.data.toUpperCase(); - } else if (check.kind === "startsWith") { - if (!input.data.startsWith(check.value)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_string, - validation: { startsWith: check.value }, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "endsWith") { - if (!input.data.endsWith(check.value)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_string, - validation: { endsWith: check.value }, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "datetime") { - const regex = datetimeRegex(check); - if (!regex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_string, - validation: "datetime", - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "date") { - const regex = dateRegex; - if (!regex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_string, - validation: "date", - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "time") { - const regex = timeRegex(check); - if (!regex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_string, - validation: "time", - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "duration") { - if (!durationRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "duration", - code: ZodIssueCode.invalid_string, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "ip") { - if (!isValidIP(input.data, check.version)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "ip", - code: ZodIssueCode.invalid_string, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "base64") { - if (!base64Regex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - validation: "base64", - code: ZodIssueCode.invalid_string, - message: check.message - }); - status.dirty(); - } - } else { - util.assertNever(check); - } - } - return { status: status.value, value: input.data }; - } - _regex(regex, validation, message) { - return this.refinement((data) => regex.test(data), { - validation, - code: ZodIssueCode.invalid_string, - ...errorUtil.errToObj(message) - }); - } - _addCheck(check) { - return new _ZodString({ - ...this._def, - checks: [...this._def.checks, check] - }); - } - email(message) { - return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) }); - } - url(message) { - return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) }); - } - emoji(message) { - return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) }); - } - uuid(message) { - return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) }); - } - nanoid(message) { - return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) }); - } - cuid(message) { - return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) }); - } - cuid2(message) { - return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) }); - } - ulid(message) { - return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) }); - } - base64(message) { - return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) }); - } - ip(options) { - return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) }); - } - datetime(options) { - var _a4, _b; - if (typeof options === "string") { - return this._addCheck({ - kind: "datetime", - precision: null, - offset: false, - local: false, - message: options - }); - } - return this._addCheck({ - kind: "datetime", - precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision, - offset: (_a4 = options === null || options === void 0 ? void 0 : options.offset) !== null && _a4 !== void 0 ? _a4 : false, - local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false, - ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message) - }); - } - date(message) { - return this._addCheck({ kind: "date", message }); - } - time(options) { - if (typeof options === "string") { - return this._addCheck({ - kind: "time", - precision: null, - message: options - }); - } - return this._addCheck({ - kind: "time", - precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision, - ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message) - }); - } - duration(message) { - return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) }); - } - regex(regex, message) { - return this._addCheck({ - kind: "regex", - regex, - ...errorUtil.errToObj(message) - }); - } - includes(value, options) { - return this._addCheck({ - kind: "includes", - value, - position: options === null || options === void 0 ? void 0 : options.position, - ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message) - }); - } - startsWith(value, message) { - return this._addCheck({ - kind: "startsWith", - value, - ...errorUtil.errToObj(message) - }); - } - endsWith(value, message) { - return this._addCheck({ - kind: "endsWith", - value, - ...errorUtil.errToObj(message) - }); - } - min(minLength, message) { - return this._addCheck({ - kind: "min", - value: minLength, - ...errorUtil.errToObj(message) - }); - } - max(maxLength, message) { - return this._addCheck({ - kind: "max", - value: maxLength, - ...errorUtil.errToObj(message) - }); - } - length(len, message) { - return this._addCheck({ - kind: "length", - value: len, - ...errorUtil.errToObj(message) - }); - } - /** - * @deprecated Use z.string().min(1) instead. - * @see {@link ZodString.min} - */ - nonempty(message) { - return this.min(1, errorUtil.errToObj(message)); - } - trim() { - return new _ZodString({ - ...this._def, - checks: [...this._def.checks, { kind: "trim" }] - }); - } - toLowerCase() { - return new _ZodString({ - ...this._def, - checks: [...this._def.checks, { kind: "toLowerCase" }] - }); - } - toUpperCase() { - return new _ZodString({ - ...this._def, - checks: [...this._def.checks, { kind: "toUpperCase" }] - }); - } - get isDatetime() { - return !!this._def.checks.find((ch) => ch.kind === "datetime"); - } - get isDate() { - return !!this._def.checks.find((ch) => ch.kind === "date"); - } - get isTime() { - return !!this._def.checks.find((ch) => ch.kind === "time"); - } - get isDuration() { - return !!this._def.checks.find((ch) => ch.kind === "duration"); - } - get isEmail() { - return !!this._def.checks.find((ch) => ch.kind === "email"); - } - get isURL() { - return !!this._def.checks.find((ch) => ch.kind === "url"); - } - get isEmoji() { - return !!this._def.checks.find((ch) => ch.kind === "emoji"); - } - get isUUID() { - return !!this._def.checks.find((ch) => ch.kind === "uuid"); - } - get isNANOID() { - return !!this._def.checks.find((ch) => ch.kind === "nanoid"); - } - get isCUID() { - return !!this._def.checks.find((ch) => ch.kind === "cuid"); - } - get isCUID2() { - return !!this._def.checks.find((ch) => ch.kind === "cuid2"); - } - get isULID() { - return !!this._def.checks.find((ch) => ch.kind === "ulid"); - } - get isIP() { - return !!this._def.checks.find((ch) => ch.kind === "ip"); - } - get isBase64() { - return !!this._def.checks.find((ch) => ch.kind === "base64"); - } - get minLength() { - let min = null; - for (const ch of this._def.checks) { - if (ch.kind === "min") { - if (min === null || ch.value > min) - min = ch.value; - } - } - return min; - } - get maxLength() { - let max = null; - for (const ch of this._def.checks) { - if (ch.kind === "max") { - if (max === null || ch.value < max) - max = ch.value; - } - } - return max; - } -}; -ZodString.create = (params) => { - var _a4; - return new ZodString({ - checks: [], - typeName: ZodFirstPartyTypeKind.ZodString, - coerce: (_a4 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a4 !== void 0 ? _a4 : false, - ...processCreateParams(params) - }); -}; -function floatSafeRemainder(val, step) { - const valDecCount = (val.toString().split(".")[1] || "").length; - const stepDecCount = (step.toString().split(".")[1] || "").length; - const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount; - const valInt = parseInt(val.toFixed(decCount).replace(".", "")); - const stepInt = parseInt(step.toFixed(decCount).replace(".", "")); - return valInt % stepInt / Math.pow(10, decCount); -} -var ZodNumber = class _ZodNumber extends ZodType { - constructor() { - super(...arguments); - this.min = this.gte; - this.max = this.lte; - this.step = this.multipleOf; - } - _parse(input) { - if (this._def.coerce) { - input.data = Number(input.data); - } - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.number) { - const ctx2 = this._getOrReturnCtx(input); - addIssueToContext(ctx2, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.number, - received: ctx2.parsedType - }); - return INVALID; - } - let ctx = void 0; - const status = new ParseStatus(); - for (const check of this._def.checks) { - if (check.kind === "int") { - if (!util.isInteger(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: "integer", - received: "float", - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "min") { - const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value; - if (tooSmall) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - minimum: check.value, - type: "number", - inclusive: check.inclusive, - exact: false, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "max") { - const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value; - if (tooBig) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - maximum: check.value, - type: "number", - inclusive: check.inclusive, - exact: false, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "multipleOf") { - if (floatSafeRemainder(input.data, check.value) !== 0) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.not_multiple_of, - multipleOf: check.value, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "finite") { - if (!Number.isFinite(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.not_finite, - message: check.message - }); - status.dirty(); - } - } else { - util.assertNever(check); - } - } - return { status: status.value, value: input.data }; - } - gte(value, message) { - return this.setLimit("min", value, true, errorUtil.toString(message)); - } - gt(value, message) { - return this.setLimit("min", value, false, errorUtil.toString(message)); - } - lte(value, message) { - return this.setLimit("max", value, true, errorUtil.toString(message)); - } - lt(value, message) { - return this.setLimit("max", value, false, errorUtil.toString(message)); - } - setLimit(kind, value, inclusive, message) { - return new _ZodNumber({ - ...this._def, - checks: [ - ...this._def.checks, - { - kind, - value, - inclusive, - message: errorUtil.toString(message) - } - ] - }); - } - _addCheck(check) { - return new _ZodNumber({ - ...this._def, - checks: [...this._def.checks, check] - }); - } - int(message) { - return this._addCheck({ - kind: "int", - message: errorUtil.toString(message) - }); - } - positive(message) { - return this._addCheck({ - kind: "min", - value: 0, - inclusive: false, - message: errorUtil.toString(message) - }); - } - negative(message) { - return this._addCheck({ - kind: "max", - value: 0, - inclusive: false, - message: errorUtil.toString(message) - }); - } - nonpositive(message) { - return this._addCheck({ - kind: "max", - value: 0, - inclusive: true, - message: errorUtil.toString(message) - }); - } - nonnegative(message) { - return this._addCheck({ - kind: "min", - value: 0, - inclusive: true, - message: errorUtil.toString(message) - }); - } - multipleOf(value, message) { - return this._addCheck({ - kind: "multipleOf", - value, - message: errorUtil.toString(message) - }); - } - finite(message) { - return this._addCheck({ - kind: "finite", - message: errorUtil.toString(message) - }); - } - safe(message) { - return this._addCheck({ - kind: "min", - inclusive: true, - value: Number.MIN_SAFE_INTEGER, - message: errorUtil.toString(message) - })._addCheck({ - kind: "max", - inclusive: true, - value: Number.MAX_SAFE_INTEGER, - message: errorUtil.toString(message) - }); - } - get minValue() { - let min = null; - for (const ch of this._def.checks) { - if (ch.kind === "min") { - if (min === null || ch.value > min) - min = ch.value; - } - } - return min; - } - get maxValue() { - let max = null; - for (const ch of this._def.checks) { - if (ch.kind === "max") { - if (max === null || ch.value < max) - max = ch.value; - } - } - return max; - } - get isInt() { - return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value)); - } - get isFinite() { - let max = null, min = null; - for (const ch of this._def.checks) { - if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") { - return true; - } else if (ch.kind === "min") { - if (min === null || ch.value > min) - min = ch.value; - } else if (ch.kind === "max") { - if (max === null || ch.value < max) - max = ch.value; - } - } - return Number.isFinite(min) && Number.isFinite(max); - } -}; -ZodNumber.create = (params) => { - return new ZodNumber({ - checks: [], - typeName: ZodFirstPartyTypeKind.ZodNumber, - coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false, - ...processCreateParams(params) - }); -}; -var ZodBigInt = class _ZodBigInt extends ZodType { - constructor() { - super(...arguments); - this.min = this.gte; - this.max = this.lte; - } - _parse(input) { - if (this._def.coerce) { - input.data = BigInt(input.data); - } - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.bigint) { - const ctx2 = this._getOrReturnCtx(input); - addIssueToContext(ctx2, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.bigint, - received: ctx2.parsedType - }); - return INVALID; - } - let ctx = void 0; - const status = new ParseStatus(); - for (const check of this._def.checks) { - if (check.kind === "min") { - const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value; - if (tooSmall) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - type: "bigint", - minimum: check.value, - inclusive: check.inclusive, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "max") { - const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value; - if (tooBig) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - type: "bigint", - maximum: check.value, - inclusive: check.inclusive, - message: check.message - }); - status.dirty(); - } - } else if (check.kind === "multipleOf") { - if (input.data % check.value !== BigInt(0)) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.not_multiple_of, - multipleOf: check.value, - message: check.message - }); - status.dirty(); - } - } else { - util.assertNever(check); - } - } - return { status: status.value, value: input.data }; - } - gte(value, message) { - return this.setLimit("min", value, true, errorUtil.toString(message)); - } - gt(value, message) { - return this.setLimit("min", value, false, errorUtil.toString(message)); - } - lte(value, message) { - return this.setLimit("max", value, true, errorUtil.toString(message)); - } - lt(value, message) { - return this.setLimit("max", value, false, errorUtil.toString(message)); - } - setLimit(kind, value, inclusive, message) { - return new _ZodBigInt({ - ...this._def, - checks: [ - ...this._def.checks, - { - kind, - value, - inclusive, - message: errorUtil.toString(message) - } - ] - }); - } - _addCheck(check) { - return new _ZodBigInt({ - ...this._def, - checks: [...this._def.checks, check] - }); - } - positive(message) { - return this._addCheck({ - kind: "min", - value: BigInt(0), - inclusive: false, - message: errorUtil.toString(message) - }); - } - negative(message) { - return this._addCheck({ - kind: "max", - value: BigInt(0), - inclusive: false, - message: errorUtil.toString(message) - }); - } - nonpositive(message) { - return this._addCheck({ - kind: "max", - value: BigInt(0), - inclusive: true, - message: errorUtil.toString(message) - }); - } - nonnegative(message) { - return this._addCheck({ - kind: "min", - value: BigInt(0), - inclusive: true, - message: errorUtil.toString(message) - }); - } - multipleOf(value, message) { - return this._addCheck({ - kind: "multipleOf", - value, - message: errorUtil.toString(message) - }); - } - get minValue() { - let min = null; - for (const ch of this._def.checks) { - if (ch.kind === "min") { - if (min === null || ch.value > min) - min = ch.value; - } - } - return min; - } - get maxValue() { - let max = null; - for (const ch of this._def.checks) { - if (ch.kind === "max") { - if (max === null || ch.value < max) - max = ch.value; - } - } - return max; - } -}; -ZodBigInt.create = (params) => { - var _a4; - return new ZodBigInt({ - checks: [], - typeName: ZodFirstPartyTypeKind.ZodBigInt, - coerce: (_a4 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a4 !== void 0 ? _a4 : false, - ...processCreateParams(params) - }); -}; -var ZodBoolean = class extends ZodType { - _parse(input) { - if (this._def.coerce) { - input.data = Boolean(input.data); - } - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.boolean) { - const ctx = this._getOrReturnCtx(input); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.boolean, - received: ctx.parsedType - }); - return INVALID; - } - return OK(input.data); - } -}; -ZodBoolean.create = (params) => { - return new ZodBoolean({ - typeName: ZodFirstPartyTypeKind.ZodBoolean, - coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false, - ...processCreateParams(params) - }); -}; -var ZodDate = class _ZodDate extends ZodType { - _parse(input) { - if (this._def.coerce) { - input.data = new Date(input.data); - } - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.date) { - const ctx2 = this._getOrReturnCtx(input); - addIssueToContext(ctx2, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.date, - received: ctx2.parsedType - }); - return INVALID; - } - if (isNaN(input.data.getTime())) { - const ctx2 = this._getOrReturnCtx(input); - addIssueToContext(ctx2, { - code: ZodIssueCode.invalid_date - }); - return INVALID; - } - const status = new ParseStatus(); - let ctx = void 0; - for (const check of this._def.checks) { - if (check.kind === "min") { - if (input.data.getTime() < check.value) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - message: check.message, - inclusive: true, - exact: false, - minimum: check.value, - type: "date" - }); - status.dirty(); - } - } else if (check.kind === "max") { - if (input.data.getTime() > check.value) { - ctx = this._getOrReturnCtx(input, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - message: check.message, - inclusive: true, - exact: false, - maximum: check.value, - type: "date" - }); - status.dirty(); - } - } else { - util.assertNever(check); - } - } - return { - status: status.value, - value: new Date(input.data.getTime()) - }; - } - _addCheck(check) { - return new _ZodDate({ - ...this._def, - checks: [...this._def.checks, check] - }); - } - min(minDate, message) { - return this._addCheck({ - kind: "min", - value: minDate.getTime(), - message: errorUtil.toString(message) - }); - } - max(maxDate, message) { - return this._addCheck({ - kind: "max", - value: maxDate.getTime(), - message: errorUtil.toString(message) - }); - } - get minDate() { - let min = null; - for (const ch of this._def.checks) { - if (ch.kind === "min") { - if (min === null || ch.value > min) - min = ch.value; - } - } - return min != null ? new Date(min) : null; - } - get maxDate() { - let max = null; - for (const ch of this._def.checks) { - if (ch.kind === "max") { - if (max === null || ch.value < max) - max = ch.value; - } - } - return max != null ? new Date(max) : null; - } -}; -ZodDate.create = (params) => { - return new ZodDate({ - checks: [], - coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false, - typeName: ZodFirstPartyTypeKind.ZodDate, - ...processCreateParams(params) - }); -}; -var ZodSymbol = class extends ZodType { - _parse(input) { - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.symbol) { - const ctx = this._getOrReturnCtx(input); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.symbol, - received: ctx.parsedType - }); - return INVALID; - } - return OK(input.data); - } -}; -ZodSymbol.create = (params) => { - return new ZodSymbol({ - typeName: ZodFirstPartyTypeKind.ZodSymbol, - ...processCreateParams(params) - }); -}; -var ZodUndefined = class extends ZodType { - _parse(input) { - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.undefined) { - const ctx = this._getOrReturnCtx(input); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.undefined, - received: ctx.parsedType - }); - return INVALID; - } - return OK(input.data); - } -}; -ZodUndefined.create = (params) => { - return new ZodUndefined({ - typeName: ZodFirstPartyTypeKind.ZodUndefined, - ...processCreateParams(params) - }); -}; -var ZodNull = class extends ZodType { - _parse(input) { - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.null) { - const ctx = this._getOrReturnCtx(input); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.null, - received: ctx.parsedType - }); - return INVALID; - } - return OK(input.data); - } -}; -ZodNull.create = (params) => { - return new ZodNull({ - typeName: ZodFirstPartyTypeKind.ZodNull, - ...processCreateParams(params) - }); -}; -var ZodAny = class extends ZodType { - constructor() { - super(...arguments); - this._any = true; - } - _parse(input) { - return OK(input.data); - } -}; -ZodAny.create = (params) => { - return new ZodAny({ - typeName: ZodFirstPartyTypeKind.ZodAny, - ...processCreateParams(params) - }); -}; -var ZodUnknown = class extends ZodType { - constructor() { - super(...arguments); - this._unknown = true; - } - _parse(input) { - return OK(input.data); - } -}; -ZodUnknown.create = (params) => { - return new ZodUnknown({ - typeName: ZodFirstPartyTypeKind.ZodUnknown, - ...processCreateParams(params) - }); -}; -var ZodNever = class extends ZodType { - _parse(input) { - const ctx = this._getOrReturnCtx(input); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.never, - received: ctx.parsedType - }); - return INVALID; - } -}; -ZodNever.create = (params) => { - return new ZodNever({ - typeName: ZodFirstPartyTypeKind.ZodNever, - ...processCreateParams(params) - }); -}; -var ZodVoid = class extends ZodType { - _parse(input) { - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.undefined) { - const ctx = this._getOrReturnCtx(input); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.void, - received: ctx.parsedType - }); - return INVALID; - } - return OK(input.data); - } -}; -ZodVoid.create = (params) => { - return new ZodVoid({ - typeName: ZodFirstPartyTypeKind.ZodVoid, - ...processCreateParams(params) - }); -}; -var ZodArray = class _ZodArray extends ZodType { - _parse(input) { - const { ctx, status } = this._processInputParams(input); - const def = this._def; - if (ctx.parsedType !== ZodParsedType.array) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.array, - received: ctx.parsedType - }); - return INVALID; - } - if (def.exactLength !== null) { - const tooBig = ctx.data.length > def.exactLength.value; - const tooSmall = ctx.data.length < def.exactLength.value; - if (tooBig || tooSmall) { - addIssueToContext(ctx, { - code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small, - minimum: tooSmall ? def.exactLength.value : void 0, - maximum: tooBig ? def.exactLength.value : void 0, - type: "array", - inclusive: true, - exact: true, - message: def.exactLength.message - }); - status.dirty(); - } - } - if (def.minLength !== null) { - if (ctx.data.length < def.minLength.value) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - minimum: def.minLength.value, - type: "array", - inclusive: true, - exact: false, - message: def.minLength.message - }); - status.dirty(); - } - } - if (def.maxLength !== null) { - if (ctx.data.length > def.maxLength.value) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - maximum: def.maxLength.value, - type: "array", - inclusive: true, - exact: false, - message: def.maxLength.message - }); - status.dirty(); - } - } - if (ctx.common.async) { - return Promise.all([...ctx.data].map((item, i) => { - return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i)); - })).then((result2) => { - return ParseStatus.mergeArray(status, result2); - }); - } - const result = [...ctx.data].map((item, i) => { - return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i)); - }); - return ParseStatus.mergeArray(status, result); - } - get element() { - return this._def.type; - } - min(minLength, message) { - return new _ZodArray({ - ...this._def, - minLength: { value: minLength, message: errorUtil.toString(message) } - }); - } - max(maxLength, message) { - return new _ZodArray({ - ...this._def, - maxLength: { value: maxLength, message: errorUtil.toString(message) } - }); - } - length(len, message) { - return new _ZodArray({ - ...this._def, - exactLength: { value: len, message: errorUtil.toString(message) } - }); - } - nonempty(message) { - return this.min(1, message); - } -}; -ZodArray.create = (schema, params) => { - return new ZodArray({ - type: schema, - minLength: null, - maxLength: null, - exactLength: null, - typeName: ZodFirstPartyTypeKind.ZodArray, - ...processCreateParams(params) - }); -}; -function deepPartialify(schema) { - if (schema instanceof ZodObject) { - const newShape = {}; - for (const key in schema.shape) { - const fieldSchema = schema.shape[key]; - newShape[key] = ZodOptional.create(deepPartialify(fieldSchema)); - } - return new ZodObject({ - ...schema._def, - shape: () => newShape - }); - } else if (schema instanceof ZodArray) { - return new ZodArray({ - ...schema._def, - type: deepPartialify(schema.element) - }); - } else if (schema instanceof ZodOptional) { - return ZodOptional.create(deepPartialify(schema.unwrap())); - } else if (schema instanceof ZodNullable) { - return ZodNullable.create(deepPartialify(schema.unwrap())); - } else if (schema instanceof ZodTuple) { - return ZodTuple.create(schema.items.map((item) => deepPartialify(item))); - } else { - return schema; - } -} -var ZodObject = class _ZodObject extends ZodType { - constructor() { - super(...arguments); - this._cached = null; - this.nonstrict = this.passthrough; - this.augment = this.extend; - } - _getCached() { - if (this._cached !== null) - return this._cached; - const shape = this._def.shape(); - const keys = util.objectKeys(shape); - return this._cached = { shape, keys }; - } - _parse(input) { - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.object) { - const ctx2 = this._getOrReturnCtx(input); - addIssueToContext(ctx2, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.object, - received: ctx2.parsedType - }); - return INVALID; - } - const { status, ctx } = this._processInputParams(input); - const { shape, keys: shapeKeys } = this._getCached(); - const extraKeys = []; - if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) { - for (const key in ctx.data) { - if (!shapeKeys.includes(key)) { - extraKeys.push(key); - } - } - } - const pairs = []; - for (const key of shapeKeys) { - const keyValidator = shape[key]; - const value = ctx.data[key]; - pairs.push({ - key: { status: "valid", value: key }, - value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)), - alwaysSet: key in ctx.data - }); - } - if (this._def.catchall instanceof ZodNever) { - const unknownKeys = this._def.unknownKeys; - if (unknownKeys === "passthrough") { - for (const key of extraKeys) { - pairs.push({ - key: { status: "valid", value: key }, - value: { status: "valid", value: ctx.data[key] } - }); - } - } else if (unknownKeys === "strict") { - if (extraKeys.length > 0) { - addIssueToContext(ctx, { - code: ZodIssueCode.unrecognized_keys, - keys: extraKeys - }); - status.dirty(); - } - } else if (unknownKeys === "strip") - ; - else { - throw new Error(`Internal ZodObject error: invalid unknownKeys value.`); - } - } else { - const catchall = this._def.catchall; - for (const key of extraKeys) { - const value = ctx.data[key]; - pairs.push({ - key: { status: "valid", value: key }, - value: catchall._parse( - new ParseInputLazyPath(ctx, value, ctx.path, key) - //, ctx.child(key), value, getParsedType(value) - ), - alwaysSet: key in ctx.data - }); - } - } - if (ctx.common.async) { - return Promise.resolve().then(async () => { - const syncPairs = []; - for (const pair of pairs) { - const key = await pair.key; - const value = await pair.value; - syncPairs.push({ - key, - value, - alwaysSet: pair.alwaysSet - }); - } - return syncPairs; - }).then((syncPairs) => { - return ParseStatus.mergeObjectSync(status, syncPairs); - }); - } else { - return ParseStatus.mergeObjectSync(status, pairs); - } - } - get shape() { - return this._def.shape(); - } - strict(message) { - errorUtil.errToObj; - return new _ZodObject({ - ...this._def, - unknownKeys: "strict", - ...message !== void 0 ? { - errorMap: (issue, ctx) => { - var _a4, _b, _c, _d; - const defaultError = (_c = (_b = (_a4 = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a4, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError; - if (issue.code === "unrecognized_keys") - return { - message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError - }; - return { - message: defaultError - }; - } - } : {} - }); - } - strip() { - return new _ZodObject({ - ...this._def, - unknownKeys: "strip" - }); - } - passthrough() { - return new _ZodObject({ - ...this._def, - unknownKeys: "passthrough" - }); - } - // const AugmentFactory = - // (def: Def) => - // ( - // augmentation: Augmentation - // ): ZodObject< - // extendShape, Augmentation>, - // Def["unknownKeys"], - // Def["catchall"] - // > => { - // return new ZodObject({ - // ...def, - // shape: () => ({ - // ...def.shape(), - // ...augmentation, - // }), - // }) as any; - // }; - extend(augmentation) { - return new _ZodObject({ - ...this._def, - shape: () => ({ - ...this._def.shape(), - ...augmentation - }) - }); - } - /** - * Prior to zod@1.0.12 there was a bug in the - * inferred type of merged objects. Please - * upgrade if you are experiencing issues. - */ - merge(merging) { - const merged = new _ZodObject({ - unknownKeys: merging._def.unknownKeys, - catchall: merging._def.catchall, - shape: () => ({ - ...this._def.shape(), - ...merging._def.shape() - }), - typeName: ZodFirstPartyTypeKind.ZodObject - }); - return merged; - } - // merge< - // Incoming extends AnyZodObject, - // Augmentation extends Incoming["shape"], - // NewOutput extends { - // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation - // ? Augmentation[k]["_output"] - // : k extends keyof Output - // ? Output[k] - // : never; - // }, - // NewInput extends { - // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation - // ? Augmentation[k]["_input"] - // : k extends keyof Input - // ? Input[k] - // : never; - // } - // >( - // merging: Incoming - // ): ZodObject< - // extendShape>, - // Incoming["_def"]["unknownKeys"], - // Incoming["_def"]["catchall"], - // NewOutput, - // NewInput - // > { - // const merged: any = new ZodObject({ - // unknownKeys: merging._def.unknownKeys, - // catchall: merging._def.catchall, - // shape: () => - // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()), - // typeName: ZodFirstPartyTypeKind.ZodObject, - // }) as any; - // return merged; - // } - setKey(key, schema) { - return this.augment({ [key]: schema }); - } - // merge( - // merging: Incoming - // ): //ZodObject = (merging) => { - // ZodObject< - // extendShape>, - // Incoming["_def"]["unknownKeys"], - // Incoming["_def"]["catchall"] - // > { - // // const mergedShape = objectUtil.mergeShapes( - // // this._def.shape(), - // // merging._def.shape() - // // ); - // const merged: any = new ZodObject({ - // unknownKeys: merging._def.unknownKeys, - // catchall: merging._def.catchall, - // shape: () => - // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()), - // typeName: ZodFirstPartyTypeKind.ZodObject, - // }) as any; - // return merged; - // } - catchall(index) { - return new _ZodObject({ - ...this._def, - catchall: index - }); - } - pick(mask2) { - const shape = {}; - util.objectKeys(mask2).forEach((key) => { - if (mask2[key] && this.shape[key]) { - shape[key] = this.shape[key]; - } - }); - return new _ZodObject({ - ...this._def, - shape: () => shape - }); - } - omit(mask2) { - const shape = {}; - util.objectKeys(this.shape).forEach((key) => { - if (!mask2[key]) { - shape[key] = this.shape[key]; - } - }); - return new _ZodObject({ - ...this._def, - shape: () => shape - }); - } - /** - * @deprecated - */ - deepPartial() { - return deepPartialify(this); - } - partial(mask2) { - const newShape = {}; - util.objectKeys(this.shape).forEach((key) => { - const fieldSchema = this.shape[key]; - if (mask2 && !mask2[key]) { - newShape[key] = fieldSchema; - } else { - newShape[key] = fieldSchema.optional(); - } - }); - return new _ZodObject({ - ...this._def, - shape: () => newShape - }); - } - required(mask2) { - const newShape = {}; - util.objectKeys(this.shape).forEach((key) => { - if (mask2 && !mask2[key]) { - newShape[key] = this.shape[key]; - } else { - const fieldSchema = this.shape[key]; - let newField = fieldSchema; - while (newField instanceof ZodOptional) { - newField = newField._def.innerType; - } - newShape[key] = newField; - } - }); - return new _ZodObject({ - ...this._def, - shape: () => newShape - }); - } - keyof() { - return createZodEnum(util.objectKeys(this.shape)); - } -}; -ZodObject.create = (shape, params) => { - return new ZodObject({ - shape: () => shape, - unknownKeys: "strip", - catchall: ZodNever.create(), - typeName: ZodFirstPartyTypeKind.ZodObject, - ...processCreateParams(params) - }); -}; -ZodObject.strictCreate = (shape, params) => { - return new ZodObject({ - shape: () => shape, - unknownKeys: "strict", - catchall: ZodNever.create(), - typeName: ZodFirstPartyTypeKind.ZodObject, - ...processCreateParams(params) - }); -}; -ZodObject.lazycreate = (shape, params) => { - return new ZodObject({ - shape, - unknownKeys: "strip", - catchall: ZodNever.create(), - typeName: ZodFirstPartyTypeKind.ZodObject, - ...processCreateParams(params) - }); -}; -var ZodUnion = class extends ZodType { - _parse(input) { - const { ctx } = this._processInputParams(input); - const options = this._def.options; - function handleResults(results) { - for (const result of results) { - if (result.result.status === "valid") { - return result.result; - } - } - for (const result of results) { - if (result.result.status === "dirty") { - ctx.common.issues.push(...result.ctx.common.issues); - return result.result; - } - } - const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues)); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_union, - unionErrors - }); - return INVALID; - } - if (ctx.common.async) { - return Promise.all(options.map(async (option) => { - const childCtx = { - ...ctx, - common: { - ...ctx.common, - issues: [] - }, - parent: null - }; - return { - result: await option._parseAsync({ - data: ctx.data, - path: ctx.path, - parent: childCtx - }), - ctx: childCtx - }; - })).then(handleResults); - } else { - let dirty = void 0; - const issues = []; - for (const option of options) { - const childCtx = { - ...ctx, - common: { - ...ctx.common, - issues: [] - }, - parent: null - }; - const result = option._parseSync({ - data: ctx.data, - path: ctx.path, - parent: childCtx - }); - if (result.status === "valid") { - return result; - } else if (result.status === "dirty" && !dirty) { - dirty = { result, ctx: childCtx }; - } - if (childCtx.common.issues.length) { - issues.push(childCtx.common.issues); - } - } - if (dirty) { - ctx.common.issues.push(...dirty.ctx.common.issues); - return dirty.result; - } - const unionErrors = issues.map((issues2) => new ZodError(issues2)); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_union, - unionErrors - }); - return INVALID; - } - } - get options() { - return this._def.options; - } -}; -ZodUnion.create = (types, params) => { - return new ZodUnion({ - options: types, - typeName: ZodFirstPartyTypeKind.ZodUnion, - ...processCreateParams(params) - }); -}; -var getDiscriminator = (type) => { - if (type instanceof ZodLazy) { - return getDiscriminator(type.schema); - } else if (type instanceof ZodEffects) { - return getDiscriminator(type.innerType()); - } else if (type instanceof ZodLiteral) { - return [type.value]; - } else if (type instanceof ZodEnum) { - return type.options; - } else if (type instanceof ZodNativeEnum) { - return util.objectValues(type.enum); - } else if (type instanceof ZodDefault) { - return getDiscriminator(type._def.innerType); - } else if (type instanceof ZodUndefined) { - return [void 0]; - } else if (type instanceof ZodNull) { - return [null]; - } else if (type instanceof ZodOptional) { - return [void 0, ...getDiscriminator(type.unwrap())]; - } else if (type instanceof ZodNullable) { - return [null, ...getDiscriminator(type.unwrap())]; - } else if (type instanceof ZodBranded) { - return getDiscriminator(type.unwrap()); - } else if (type instanceof ZodReadonly) { - return getDiscriminator(type.unwrap()); - } else if (type instanceof ZodCatch) { - return getDiscriminator(type._def.innerType); - } else { - return []; - } -}; -var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType { - _parse(input) { - const { ctx } = this._processInputParams(input); - if (ctx.parsedType !== ZodParsedType.object) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.object, - received: ctx.parsedType - }); - return INVALID; - } - const discriminator = this.discriminator; - const discriminatorValue = ctx.data[discriminator]; - const option = this.optionsMap.get(discriminatorValue); - if (!option) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_union_discriminator, - options: Array.from(this.optionsMap.keys()), - path: [discriminator] - }); - return INVALID; - } - if (ctx.common.async) { - return option._parseAsync({ - data: ctx.data, - path: ctx.path, - parent: ctx - }); - } else { - return option._parseSync({ - data: ctx.data, - path: ctx.path, - parent: ctx - }); - } - } - get discriminator() { - return this._def.discriminator; - } - get options() { - return this._def.options; - } - get optionsMap() { - return this._def.optionsMap; - } - /** - * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor. - * However, it only allows a union of objects, all of which need to share a discriminator property. This property must - * have a different value for each object in the union. - * @param discriminator the name of the discriminator property - * @param types an array of object schemas - * @param params - */ - static create(discriminator, options, params) { - const optionsMap = /* @__PURE__ */ new Map(); - for (const type of options) { - const discriminatorValues = getDiscriminator(type.shape[discriminator]); - if (!discriminatorValues.length) { - throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`); - } - for (const value of discriminatorValues) { - if (optionsMap.has(value)) { - throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`); - } - optionsMap.set(value, type); - } - } - return new _ZodDiscriminatedUnion({ - typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion, - discriminator, - options, - optionsMap, - ...processCreateParams(params) - }); - } -}; -function mergeValues(a, b) { - const aType = getParsedType(a); - const bType = getParsedType(b); - if (a === b) { - return { valid: true, data: a }; - } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) { - const bKeys = util.objectKeys(b); - const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1); - const newObj = { ...a, ...b }; - for (const key of sharedKeys) { - const sharedValue = mergeValues(a[key], b[key]); - if (!sharedValue.valid) { - return { valid: false }; - } - newObj[key] = sharedValue.data; - } - return { valid: true, data: newObj }; - } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) { - if (a.length !== b.length) { - return { valid: false }; - } - const newArray = []; - for (let index = 0; index < a.length; index++) { - const itemA = a[index]; - const itemB = b[index]; - const sharedValue = mergeValues(itemA, itemB); - if (!sharedValue.valid) { - return { valid: false }; - } - newArray.push(sharedValue.data); - } - return { valid: true, data: newArray }; - } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) { - return { valid: true, data: a }; - } else { - return { valid: false }; - } -} -var ZodIntersection = class extends ZodType { - _parse(input) { - const { status, ctx } = this._processInputParams(input); - const handleParsed = (parsedLeft, parsedRight) => { - if (isAborted(parsedLeft) || isAborted(parsedRight)) { - return INVALID; - } - const merged = mergeValues(parsedLeft.value, parsedRight.value); - if (!merged.valid) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_intersection_types - }); - return INVALID; - } - if (isDirty(parsedLeft) || isDirty(parsedRight)) { - status.dirty(); - } - return { status: status.value, value: merged.data }; - }; - if (ctx.common.async) { - return Promise.all([ - this._def.left._parseAsync({ - data: ctx.data, - path: ctx.path, - parent: ctx - }), - this._def.right._parseAsync({ - data: ctx.data, - path: ctx.path, - parent: ctx - }) - ]).then(([left, right]) => handleParsed(left, right)); - } else { - return handleParsed(this._def.left._parseSync({ - data: ctx.data, - path: ctx.path, - parent: ctx - }), this._def.right._parseSync({ - data: ctx.data, - path: ctx.path, - parent: ctx - })); - } - } -}; -ZodIntersection.create = (left, right, params) => { - return new ZodIntersection({ - left, - right, - typeName: ZodFirstPartyTypeKind.ZodIntersection, - ...processCreateParams(params) - }); -}; -var ZodTuple = class _ZodTuple extends ZodType { - _parse(input) { - const { status, ctx } = this._processInputParams(input); - if (ctx.parsedType !== ZodParsedType.array) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.array, - received: ctx.parsedType - }); - return INVALID; - } - if (ctx.data.length < this._def.items.length) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - minimum: this._def.items.length, - inclusive: true, - exact: false, - type: "array" - }); - return INVALID; - } - const rest = this._def.rest; - if (!rest && ctx.data.length > this._def.items.length) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - maximum: this._def.items.length, - inclusive: true, - exact: false, - type: "array" - }); - status.dirty(); - } - const items = [...ctx.data].map((item, itemIndex) => { - const schema = this._def.items[itemIndex] || this._def.rest; - if (!schema) - return null; - return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex)); - }).filter((x) => !!x); - if (ctx.common.async) { - return Promise.all(items).then((results) => { - return ParseStatus.mergeArray(status, results); - }); - } else { - return ParseStatus.mergeArray(status, items); - } - } - get items() { - return this._def.items; - } - rest(rest) { - return new _ZodTuple({ - ...this._def, - rest - }); - } -}; -ZodTuple.create = (schemas, params) => { - if (!Array.isArray(schemas)) { - throw new Error("You must pass an array of schemas to z.tuple([ ... ])"); - } - return new ZodTuple({ - items: schemas, - typeName: ZodFirstPartyTypeKind.ZodTuple, - rest: null, - ...processCreateParams(params) - }); -}; -var ZodRecord = class _ZodRecord extends ZodType { - get keySchema() { - return this._def.keyType; - } - get valueSchema() { - return this._def.valueType; - } - _parse(input) { - const { status, ctx } = this._processInputParams(input); - if (ctx.parsedType !== ZodParsedType.object) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.object, - received: ctx.parsedType - }); - return INVALID; - } - const pairs = []; - const keyType = this._def.keyType; - const valueType = this._def.valueType; - for (const key in ctx.data) { - pairs.push({ - key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)), - value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)), - alwaysSet: key in ctx.data - }); - } - if (ctx.common.async) { - return ParseStatus.mergeObjectAsync(status, pairs); - } else { - return ParseStatus.mergeObjectSync(status, pairs); - } - } - get element() { - return this._def.valueType; - } - static create(first, second, third) { - if (second instanceof ZodType) { - return new _ZodRecord({ - keyType: first, - valueType: second, - typeName: ZodFirstPartyTypeKind.ZodRecord, - ...processCreateParams(third) - }); - } - return new _ZodRecord({ - keyType: ZodString.create(), - valueType: first, - typeName: ZodFirstPartyTypeKind.ZodRecord, - ...processCreateParams(second) - }); - } -}; -var ZodMap = class extends ZodType { - get keySchema() { - return this._def.keyType; - } - get valueSchema() { - return this._def.valueType; - } - _parse(input) { - const { status, ctx } = this._processInputParams(input); - if (ctx.parsedType !== ZodParsedType.map) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.map, - received: ctx.parsedType - }); - return INVALID; - } - const keyType = this._def.keyType; - const valueType = this._def.valueType; - const pairs = [...ctx.data.entries()].map(([key, value], index) => { - return { - key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])), - value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"])) - }; - }); - if (ctx.common.async) { - const finalMap = /* @__PURE__ */ new Map(); - return Promise.resolve().then(async () => { - for (const pair of pairs) { - const key = await pair.key; - const value = await pair.value; - if (key.status === "aborted" || value.status === "aborted") { - return INVALID; - } - if (key.status === "dirty" || value.status === "dirty") { - status.dirty(); - } - finalMap.set(key.value, value.value); - } - return { status: status.value, value: finalMap }; - }); - } else { - const finalMap = /* @__PURE__ */ new Map(); - for (const pair of pairs) { - const key = pair.key; - const value = pair.value; - if (key.status === "aborted" || value.status === "aborted") { - return INVALID; - } - if (key.status === "dirty" || value.status === "dirty") { - status.dirty(); - } - finalMap.set(key.value, value.value); - } - return { status: status.value, value: finalMap }; - } - } -}; -ZodMap.create = (keyType, valueType, params) => { - return new ZodMap({ - valueType, - keyType, - typeName: ZodFirstPartyTypeKind.ZodMap, - ...processCreateParams(params) - }); -}; -var ZodSet = class _ZodSet extends ZodType { - _parse(input) { - const { status, ctx } = this._processInputParams(input); - if (ctx.parsedType !== ZodParsedType.set) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.set, - received: ctx.parsedType - }); - return INVALID; - } - const def = this._def; - if (def.minSize !== null) { - if (ctx.data.size < def.minSize.value) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - minimum: def.minSize.value, - type: "set", - inclusive: true, - exact: false, - message: def.minSize.message - }); - status.dirty(); - } - } - if (def.maxSize !== null) { - if (ctx.data.size > def.maxSize.value) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - maximum: def.maxSize.value, - type: "set", - inclusive: true, - exact: false, - message: def.maxSize.message - }); - status.dirty(); - } - } - const valueType = this._def.valueType; - function finalizeSet(elements2) { - const parsedSet = /* @__PURE__ */ new Set(); - for (const element of elements2) { - if (element.status === "aborted") - return INVALID; - if (element.status === "dirty") - status.dirty(); - parsedSet.add(element.value); - } - return { status: status.value, value: parsedSet }; - } - const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i))); - if (ctx.common.async) { - return Promise.all(elements).then((elements2) => finalizeSet(elements2)); - } else { - return finalizeSet(elements); - } - } - min(minSize, message) { - return new _ZodSet({ - ...this._def, - minSize: { value: minSize, message: errorUtil.toString(message) } - }); - } - max(maxSize, message) { - return new _ZodSet({ - ...this._def, - maxSize: { value: maxSize, message: errorUtil.toString(message) } - }); - } - size(size, message) { - return this.min(size, message).max(size, message); - } - nonempty(message) { - return this.min(1, message); - } -}; -ZodSet.create = (valueType, params) => { - return new ZodSet({ - valueType, - minSize: null, - maxSize: null, - typeName: ZodFirstPartyTypeKind.ZodSet, - ...processCreateParams(params) - }); -}; -var ZodFunction = class _ZodFunction extends ZodType { - constructor() { - super(...arguments); - this.validate = this.implement; - } - _parse(input) { - const { ctx } = this._processInputParams(input); - if (ctx.parsedType !== ZodParsedType.function) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.function, - received: ctx.parsedType - }); - return INVALID; - } - function makeArgsIssue(args, error) { - return makeIssue({ - data: args, - path: ctx.path, - errorMaps: [ - ctx.common.contextualErrorMap, - ctx.schemaErrorMap, - getErrorMap(), - errorMap - ].filter((x) => !!x), - issueData: { - code: ZodIssueCode.invalid_arguments, - argumentsError: error - } - }); - } - function makeReturnsIssue(returns, error) { - return makeIssue({ - data: returns, - path: ctx.path, - errorMaps: [ - ctx.common.contextualErrorMap, - ctx.schemaErrorMap, - getErrorMap(), - errorMap - ].filter((x) => !!x), - issueData: { - code: ZodIssueCode.invalid_return_type, - returnTypeError: error - } - }); - } - const params = { errorMap: ctx.common.contextualErrorMap }; - const fn = ctx.data; - if (this._def.returns instanceof ZodPromise) { - const me = this; - return OK(async function(...args) { - const error = new ZodError([]); - const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => { - error.addIssue(makeArgsIssue(args, e)); - throw error; - }); - const result = await Reflect.apply(fn, this, parsedArgs); - const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => { - error.addIssue(makeReturnsIssue(result, e)); - throw error; - }); - return parsedReturns; - }); - } else { - const me = this; - return OK(function(...args) { - const parsedArgs = me._def.args.safeParse(args, params); - if (!parsedArgs.success) { - throw new ZodError([makeArgsIssue(args, parsedArgs.error)]); - } - const result = Reflect.apply(fn, this, parsedArgs.data); - const parsedReturns = me._def.returns.safeParse(result, params); - if (!parsedReturns.success) { - throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]); - } - return parsedReturns.data; - }); - } - } - parameters() { - return this._def.args; - } - returnType() { - return this._def.returns; - } - args(...items) { - return new _ZodFunction({ - ...this._def, - args: ZodTuple.create(items).rest(ZodUnknown.create()) - }); - } - returns(returnType) { - return new _ZodFunction({ - ...this._def, - returns: returnType - }); - } - implement(func) { - const validatedFunc = this.parse(func); - return validatedFunc; - } - strictImplement(func) { - const validatedFunc = this.parse(func); - return validatedFunc; - } - static create(args, returns, params) { - return new _ZodFunction({ - args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()), - returns: returns || ZodUnknown.create(), - typeName: ZodFirstPartyTypeKind.ZodFunction, - ...processCreateParams(params) - }); - } -}; -var ZodLazy = class extends ZodType { - get schema() { - return this._def.getter(); - } - _parse(input) { - const { ctx } = this._processInputParams(input); - const lazySchema = this._def.getter(); - return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx }); - } -}; -ZodLazy.create = (getter, params) => { - return new ZodLazy({ - getter, - typeName: ZodFirstPartyTypeKind.ZodLazy, - ...processCreateParams(params) - }); -}; -var ZodLiteral = class extends ZodType { - _parse(input) { - if (input.data !== this._def.value) { - const ctx = this._getOrReturnCtx(input); - addIssueToContext(ctx, { - received: ctx.data, - code: ZodIssueCode.invalid_literal, - expected: this._def.value - }); - return INVALID; - } - return { status: "valid", value: input.data }; - } - get value() { - return this._def.value; - } -}; -ZodLiteral.create = (value, params) => { - return new ZodLiteral({ - value, - typeName: ZodFirstPartyTypeKind.ZodLiteral, - ...processCreateParams(params) - }); -}; -function createZodEnum(values, params) { - return new ZodEnum({ - values, - typeName: ZodFirstPartyTypeKind.ZodEnum, - ...processCreateParams(params) - }); -} -var ZodEnum = class _ZodEnum extends ZodType { - constructor() { - super(...arguments); - _ZodEnum_cache.set(this, void 0); - } - _parse(input) { - if (typeof input.data !== "string") { - const ctx = this._getOrReturnCtx(input); - const expectedValues = this._def.values; - addIssueToContext(ctx, { - expected: util.joinValues(expectedValues), - received: ctx.parsedType, - code: ZodIssueCode.invalid_type - }); - return INVALID; - } - if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) { - __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f"); - } - if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) { - const ctx = this._getOrReturnCtx(input); - const expectedValues = this._def.values; - addIssueToContext(ctx, { - received: ctx.data, - code: ZodIssueCode.invalid_enum_value, - options: expectedValues - }); - return INVALID; - } - return OK(input.data); - } - get options() { - return this._def.values; - } - get enum() { - const enumValues = {}; - for (const val of this._def.values) { - enumValues[val] = val; - } - return enumValues; - } - get Values() { - const enumValues = {}; - for (const val of this._def.values) { - enumValues[val] = val; - } - return enumValues; - } - get Enum() { - const enumValues = {}; - for (const val of this._def.values) { - enumValues[val] = val; - } - return enumValues; - } - extract(values, newDef = this._def) { - return _ZodEnum.create(values, { - ...this._def, - ...newDef - }); - } - exclude(values, newDef = this._def) { - return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), { - ...this._def, - ...newDef - }); - } -}; -_ZodEnum_cache = /* @__PURE__ */ new WeakMap(); -ZodEnum.create = createZodEnum; -var ZodNativeEnum = class extends ZodType { - constructor() { - super(...arguments); - _ZodNativeEnum_cache.set(this, void 0); - } - _parse(input) { - const nativeEnumValues = util.getValidEnumValues(this._def.values); - const ctx = this._getOrReturnCtx(input); - if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) { - const expectedValues = util.objectValues(nativeEnumValues); - addIssueToContext(ctx, { - expected: util.joinValues(expectedValues), - received: ctx.parsedType, - code: ZodIssueCode.invalid_type - }); - return INVALID; - } - if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) { - __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f"); - } - if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) { - const expectedValues = util.objectValues(nativeEnumValues); - addIssueToContext(ctx, { - received: ctx.data, - code: ZodIssueCode.invalid_enum_value, - options: expectedValues - }); - return INVALID; - } - return OK(input.data); - } - get enum() { - return this._def.values; - } -}; -_ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap(); -ZodNativeEnum.create = (values, params) => { - return new ZodNativeEnum({ - values, - typeName: ZodFirstPartyTypeKind.ZodNativeEnum, - ...processCreateParams(params) - }); -}; -var ZodPromise = class extends ZodType { - unwrap() { - return this._def.type; - } - _parse(input) { - const { ctx } = this._processInputParams(input); - if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.promise, - received: ctx.parsedType - }); - return INVALID; - } - const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data); - return OK(promisified.then((data) => { - return this._def.type.parseAsync(data, { - path: ctx.path, - errorMap: ctx.common.contextualErrorMap - }); - })); - } -}; -ZodPromise.create = (schema, params) => { - return new ZodPromise({ - type: schema, - typeName: ZodFirstPartyTypeKind.ZodPromise, - ...processCreateParams(params) - }); -}; -var ZodEffects = class extends ZodType { - innerType() { - return this._def.schema; - } - sourceType() { - return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema; - } - _parse(input) { - const { status, ctx } = this._processInputParams(input); - const effect = this._def.effect || null; - const checkCtx = { - addIssue: (arg) => { - addIssueToContext(ctx, arg); - if (arg.fatal) { - status.abort(); - } else { - status.dirty(); - } - }, - get path() { - return ctx.path; - } - }; - checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx); - if (effect.type === "preprocess") { - const processed = effect.transform(ctx.data, checkCtx); - if (ctx.common.async) { - return Promise.resolve(processed).then(async (processed2) => { - if (status.value === "aborted") - return INVALID; - const result = await this._def.schema._parseAsync({ - data: processed2, - path: ctx.path, - parent: ctx - }); - if (result.status === "aborted") - return INVALID; - if (result.status === "dirty") - return DIRTY(result.value); - if (status.value === "dirty") - return DIRTY(result.value); - return result; - }); - } else { - if (status.value === "aborted") - return INVALID; - const result = this._def.schema._parseSync({ - data: processed, - path: ctx.path, - parent: ctx - }); - if (result.status === "aborted") - return INVALID; - if (result.status === "dirty") - return DIRTY(result.value); - if (status.value === "dirty") - return DIRTY(result.value); - return result; - } - } - if (effect.type === "refinement") { - const executeRefinement = (acc) => { - const result = effect.refinement(acc, checkCtx); - if (ctx.common.async) { - return Promise.resolve(result); - } - if (result instanceof Promise) { - throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead."); - } - return acc; - }; - if (ctx.common.async === false) { - const inner = this._def.schema._parseSync({ - data: ctx.data, - path: ctx.path, - parent: ctx - }); - if (inner.status === "aborted") - return INVALID; - if (inner.status === "dirty") - status.dirty(); - executeRefinement(inner.value); - return { status: status.value, value: inner.value }; - } else { - return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => { - if (inner.status === "aborted") - return INVALID; - if (inner.status === "dirty") - status.dirty(); - return executeRefinement(inner.value).then(() => { - return { status: status.value, value: inner.value }; - }); - }); - } - } - if (effect.type === "transform") { - if (ctx.common.async === false) { - const base2 = this._def.schema._parseSync({ - data: ctx.data, - path: ctx.path, - parent: ctx - }); - if (!isValid(base2)) - return base2; - const result = effect.transform(base2.value, checkCtx); - if (result instanceof Promise) { - throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`); - } - return { status: status.value, value: result }; - } else { - return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base2) => { - if (!isValid(base2)) - return base2; - return Promise.resolve(effect.transform(base2.value, checkCtx)).then((result) => ({ status: status.value, value: result })); - }); - } - } - util.assertNever(effect); - } -}; -ZodEffects.create = (schema, effect, params) => { - return new ZodEffects({ - schema, - typeName: ZodFirstPartyTypeKind.ZodEffects, - effect, - ...processCreateParams(params) - }); -}; -ZodEffects.createWithPreprocess = (preprocess, schema, params) => { - return new ZodEffects({ - schema, - effect: { type: "preprocess", transform: preprocess }, - typeName: ZodFirstPartyTypeKind.ZodEffects, - ...processCreateParams(params) - }); -}; -var ZodOptional = class extends ZodType { - _parse(input) { - const parsedType = this._getType(input); - if (parsedType === ZodParsedType.undefined) { - return OK(void 0); - } - return this._def.innerType._parse(input); - } - unwrap() { - return this._def.innerType; - } -}; -ZodOptional.create = (type, params) => { - return new ZodOptional({ - innerType: type, - typeName: ZodFirstPartyTypeKind.ZodOptional, - ...processCreateParams(params) - }); -}; -var ZodNullable = class extends ZodType { - _parse(input) { - const parsedType = this._getType(input); - if (parsedType === ZodParsedType.null) { - return OK(null); - } - return this._def.innerType._parse(input); - } - unwrap() { - return this._def.innerType; - } -}; -ZodNullable.create = (type, params) => { - return new ZodNullable({ - innerType: type, - typeName: ZodFirstPartyTypeKind.ZodNullable, - ...processCreateParams(params) - }); -}; -var ZodDefault = class extends ZodType { - _parse(input) { - const { ctx } = this._processInputParams(input); - let data = ctx.data; - if (ctx.parsedType === ZodParsedType.undefined) { - data = this._def.defaultValue(); - } - return this._def.innerType._parse({ - data, - path: ctx.path, - parent: ctx - }); - } - removeDefault() { - return this._def.innerType; - } -}; -ZodDefault.create = (type, params) => { - return new ZodDefault({ - innerType: type, - typeName: ZodFirstPartyTypeKind.ZodDefault, - defaultValue: typeof params.default === "function" ? params.default : () => params.default, - ...processCreateParams(params) - }); -}; -var ZodCatch = class extends ZodType { - _parse(input) { - const { ctx } = this._processInputParams(input); - const newCtx = { - ...ctx, - common: { - ...ctx.common, - issues: [] - } - }; - const result = this._def.innerType._parse({ - data: newCtx.data, - path: newCtx.path, - parent: { - ...newCtx - } - }); - if (isAsync(result)) { - return result.then((result2) => { - return { - status: "valid", - value: result2.status === "valid" ? result2.value : this._def.catchValue({ - get error() { - return new ZodError(newCtx.common.issues); - }, - input: newCtx.data - }) - }; - }); - } else { - return { - status: "valid", - value: result.status === "valid" ? result.value : this._def.catchValue({ - get error() { - return new ZodError(newCtx.common.issues); - }, - input: newCtx.data - }) - }; - } - } - removeCatch() { - return this._def.innerType; - } -}; -ZodCatch.create = (type, params) => { - return new ZodCatch({ - innerType: type, - typeName: ZodFirstPartyTypeKind.ZodCatch, - catchValue: typeof params.catch === "function" ? params.catch : () => params.catch, - ...processCreateParams(params) - }); -}; -var ZodNaN = class extends ZodType { - _parse(input) { - const parsedType = this._getType(input); - if (parsedType !== ZodParsedType.nan) { - const ctx = this._getOrReturnCtx(input); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.nan, - received: ctx.parsedType - }); - return INVALID; - } - return { status: "valid", value: input.data }; - } -}; -ZodNaN.create = (params) => { - return new ZodNaN({ - typeName: ZodFirstPartyTypeKind.ZodNaN, - ...processCreateParams(params) - }); -}; -var BRAND = Symbol("zod_brand"); -var ZodBranded = class extends ZodType { - _parse(input) { - const { ctx } = this._processInputParams(input); - const data = ctx.data; - return this._def.type._parse({ - data, - path: ctx.path, - parent: ctx - }); - } - unwrap() { - return this._def.type; - } -}; -var ZodPipeline = class _ZodPipeline extends ZodType { - _parse(input) { - const { status, ctx } = this._processInputParams(input); - if (ctx.common.async) { - const handleAsync = async () => { - const inResult = await this._def.in._parseAsync({ - data: ctx.data, - path: ctx.path, - parent: ctx - }); - if (inResult.status === "aborted") - return INVALID; - if (inResult.status === "dirty") { - status.dirty(); - return DIRTY(inResult.value); - } else { - return this._def.out._parseAsync({ - data: inResult.value, - path: ctx.path, - parent: ctx - }); - } - }; - return handleAsync(); - } else { - const inResult = this._def.in._parseSync({ - data: ctx.data, - path: ctx.path, - parent: ctx - }); - if (inResult.status === "aborted") - return INVALID; - if (inResult.status === "dirty") { - status.dirty(); - return { - status: "dirty", - value: inResult.value - }; - } else { - return this._def.out._parseSync({ - data: inResult.value, - path: ctx.path, - parent: ctx - }); - } - } - } - static create(a, b) { - return new _ZodPipeline({ - in: a, - out: b, - typeName: ZodFirstPartyTypeKind.ZodPipeline - }); - } -}; -var ZodReadonly = class extends ZodType { - _parse(input) { - const result = this._def.innerType._parse(input); - const freeze = (data) => { - if (isValid(data)) { - data.value = Object.freeze(data.value); - } - return data; - }; - return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result); - } - unwrap() { - return this._def.innerType; - } -}; -ZodReadonly.create = (type, params) => { - return new ZodReadonly({ - innerType: type, - typeName: ZodFirstPartyTypeKind.ZodReadonly, - ...processCreateParams(params) - }); -}; -function custom(check, params = {}, fatal) { - if (check) - return ZodAny.create().superRefine((data, ctx) => { - var _a4, _b; - if (!check(data)) { - const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params; - const _fatal = (_b = (_a4 = p.fatal) !== null && _a4 !== void 0 ? _a4 : fatal) !== null && _b !== void 0 ? _b : true; - const p2 = typeof p === "string" ? { message: p } : p; - ctx.addIssue({ code: "custom", ...p2, fatal: _fatal }); - } - }); - return ZodAny.create(); -} -var late = { - object: ZodObject.lazycreate -}; -var ZodFirstPartyTypeKind; -(function(ZodFirstPartyTypeKind2) { - ZodFirstPartyTypeKind2["ZodString"] = "ZodString"; - ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber"; - ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN"; - ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt"; - ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean"; - ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate"; - ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol"; - ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined"; - ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull"; - ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny"; - ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown"; - ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever"; - ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid"; - ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray"; - ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject"; - ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion"; - ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion"; - ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection"; - ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple"; - ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord"; - ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap"; - ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet"; - ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction"; - ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy"; - ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral"; - ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum"; - ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects"; - ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum"; - ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional"; - ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable"; - ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault"; - ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch"; - ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise"; - ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded"; - ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline"; - ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly"; -})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {})); -var instanceOfType = (cls, params = { - message: `Input not instance of ${cls.name}` -}) => custom((data) => data instanceof cls, params); -var stringType = ZodString.create; -var numberType = ZodNumber.create; -var nanType = ZodNaN.create; -var bigIntType = ZodBigInt.create; -var booleanType = ZodBoolean.create; -var dateType = ZodDate.create; -var symbolType = ZodSymbol.create; -var undefinedType = ZodUndefined.create; -var nullType = ZodNull.create; -var anyType = ZodAny.create; -var unknownType = ZodUnknown.create; -var neverType = ZodNever.create; -var voidType = ZodVoid.create; -var arrayType = ZodArray.create; -var objectType = ZodObject.create; -var strictObjectType = ZodObject.strictCreate; -var unionType = ZodUnion.create; -var discriminatedUnionType = ZodDiscriminatedUnion.create; -var intersectionType = ZodIntersection.create; -var tupleType = ZodTuple.create; -var recordType = ZodRecord.create; -var mapType = ZodMap.create; -var setType = ZodSet.create; -var functionType = ZodFunction.create; -var lazyType = ZodLazy.create; -var literalType = ZodLiteral.create; -var enumType = ZodEnum.create; -var nativeEnumType = ZodNativeEnum.create; -var promiseType = ZodPromise.create; -var effectsType = ZodEffects.create; -var optionalType = ZodOptional.create; -var nullableType = ZodNullable.create; -var preprocessType = ZodEffects.createWithPreprocess; -var pipelineType = ZodPipeline.create; -var ostring = () => stringType().optional(); -var onumber = () => numberType().optional(); -var oboolean = () => booleanType().optional(); -var coerce = { - string: (arg) => ZodString.create({ ...arg, coerce: true }), - number: (arg) => ZodNumber.create({ ...arg, coerce: true }), - boolean: (arg) => ZodBoolean.create({ - ...arg, - coerce: true - }), - bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }), - date: (arg) => ZodDate.create({ ...arg, coerce: true }) -}; -var NEVER = INVALID; -var z = Object.freeze({ - __proto__: null, - defaultErrorMap: errorMap, - setErrorMap, - getErrorMap, - makeIssue, - EMPTY_PATH, - addIssueToContext, - ParseStatus, - INVALID, - DIRTY, - OK, - isAborted, - isDirty, - isValid, - isAsync, - get util() { - return util; - }, - get objectUtil() { - return objectUtil; - }, - ZodParsedType, - getParsedType, - ZodType, - datetimeRegex, - ZodString, - ZodNumber, - ZodBigInt, - ZodBoolean, - ZodDate, - ZodSymbol, - ZodUndefined, - ZodNull, - ZodAny, - ZodUnknown, - ZodNever, - ZodVoid, - ZodArray, - ZodObject, - ZodUnion, - ZodDiscriminatedUnion, - ZodIntersection, - ZodTuple, - ZodRecord, - ZodMap, - ZodSet, - ZodFunction, - ZodLazy, - ZodLiteral, - ZodEnum, - ZodNativeEnum, - ZodPromise, - ZodEffects, - ZodTransformer: ZodEffects, - ZodOptional, - ZodNullable, - ZodDefault, - ZodCatch, - ZodNaN, - BRAND, - ZodBranded, - ZodPipeline, - ZodReadonly, - custom, - Schema: ZodType, - ZodSchema: ZodType, - late, - get ZodFirstPartyTypeKind() { - return ZodFirstPartyTypeKind; - }, - coerce, - any: anyType, - array: arrayType, - bigint: bigIntType, - boolean: booleanType, - date: dateType, - discriminatedUnion: discriminatedUnionType, - effect: effectsType, - "enum": enumType, - "function": functionType, - "instanceof": instanceOfType, - intersection: intersectionType, - lazy: lazyType, - literal: literalType, - map: mapType, - nan: nanType, - nativeEnum: nativeEnumType, - never: neverType, - "null": nullType, - nullable: nullableType, - number: numberType, - object: objectType, - oboolean, - onumber, - optional: optionalType, - ostring, - pipeline: pipelineType, - preprocess: preprocessType, - promise: promiseType, - record: recordType, - set: setType, - strictObject: strictObjectType, - string: stringType, - symbol: symbolType, - transformer: effectsType, - tuple: tupleType, - "undefined": undefinedType, - union: unionType, - unknown: unknownType, - "void": voidType, - NEVER, - ZodIssueCode, - quotelessJson, - ZodError -}); - -// node_modules/web3-validator/lib/esm/errors.js -var errorFormatter = (error) => { - if (error.message) { - return error.message; - } - return "unspecified error"; -}; -var Web3ValidatorError = class extends BaseWeb3Error { - constructor(errors) { - super(); - this.code = ERR_VALIDATION; - this.errors = errors; - super.message = `Web3 validator found ${errors.length} error[s]: -${this._compileErrors().join("\n")}`; - } - _compileErrors() { - return this.errors.map(errorFormatter); - } -}; - -// node_modules/web3-validator/lib/esm/utils.js -var utils_exports = {}; -__export(utils_exports, { - abiSchemaToJsonSchema: () => abiSchemaToJsonSchema, - codePointToInt: () => codePointToInt, - ensureIfUint8Array: () => ensureIfUint8Array, - ethAbiToJsonSchema: () => ethAbiToJsonSchema, - fetchArrayElement: () => fetchArrayElement, - hexToNumber: () => hexToNumber, - hexToUint8Array: () => hexToUint8Array, - numberToHex: () => numberToHex, - padLeft: () => padLeft, - parseBaseType: () => parseBaseType, - transformJsonDataToAbiFormat: () => transformJsonDataToAbiFormat, - uint8ArrayToHexString: () => uint8ArrayToHexString -}); - -// node_modules/web3-validator/lib/esm/constants.js -var VALID_ETH_BASE_TYPES = ["bool", "int", "uint", "bytes", "string", "address", "tuple"]; - -// node_modules/web3-validator/lib/esm/validation/abi.js -var isAbiParameterSchema = (schema) => typeof schema === "object" && "type" in schema && "name" in schema; - -// node_modules/web3-validator/lib/esm/validation/string.js -var isString = (value) => typeof value === "string"; -var isHexStrict = (hex) => typeof hex === "string" && /^((-)?0x[0-9a-f]+|(0x))$/i.test(hex); -function isHexString(value, length) { - if (typeof value !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) - return false; - if (typeof length !== "undefined" && length > 0 && value.length !== 2 + 2 * length) - return false; - return true; -} -var isHex = (hex) => typeof hex === "number" || typeof hex === "bigint" || typeof hex === "string" && /^((-0x|0x|-)?[0-9a-f]+|(0x))$/i.test(hex); -var isHexString8Bytes = (value, prefixed = true) => prefixed ? isHexStrict(value) && value.length === 18 : isHex(value) && value.length === 16; -var isHexString32Bytes = (value, prefixed = true) => prefixed ? isHexStrict(value) && value.length === 66 : isHex(value) && value.length === 64; -function isHexPrefixed(str) { - if (typeof str !== "string") { - throw new Error(`[isHexPrefixed] input must be type 'string', received type ${typeof str}`); - } - return str.startsWith("0x"); -} -var validateNoLeadingZeroes = function(values) { - for (const [k, v] of Object.entries(values)) { - if (v !== void 0 && v.length > 0 && v[0] === 0) { - throw new Error(`${k} cannot have leading zeroes, received: ${v.toString()}`); - } - } -}; - -// node_modules/web3-validator/lib/esm/utils.js -var extraTypes = ["hex", "number", "blockNumber", "blockNumberOrTag", "filter", "bloom"]; -var parseBaseType = (type) => { - let strippedType = type.replace(/ /, ""); - let baseTypeSize; - let isArray = false; - let arraySizes = []; - if (type.includes("[")) { - strippedType = strippedType.slice(0, strippedType.indexOf("[")); - arraySizes = [...type.matchAll(/(?:\[(\d*)\])/g)].map((match) => parseInt(match[1], 10)).map((size) => Number.isNaN(size) ? -1 : size); - isArray = arraySizes.length > 0; - } - if (VALID_ETH_BASE_TYPES.includes(strippedType)) { - return { baseType: strippedType, isArray, baseTypeSize, arraySizes }; - } - if (strippedType.startsWith("int")) { - baseTypeSize = parseInt(strippedType.substring(3), 10); - strippedType = "int"; - } else if (strippedType.startsWith("uint")) { - baseTypeSize = parseInt(type.substring(4), 10); - strippedType = "uint"; - } else if (strippedType.startsWith("bytes")) { - baseTypeSize = parseInt(strippedType.substring(5), 10); - strippedType = "bytes"; - } else { - return { baseType: void 0, isArray: false, baseTypeSize: void 0, arraySizes }; - } - return { baseType: strippedType, isArray, baseTypeSize, arraySizes }; -}; -var convertEthType = (type, parentSchema = {}) => { - const typePropertyPresent = Object.keys(parentSchema).includes("type"); - if (typePropertyPresent) { - throw new Web3ValidatorError([ - { - keyword: "eth", - message: 'Either "eth" or "type" can be presented in schema', - params: { eth: type }, - instancePath: "", - schemaPath: "" - } - ]); - } - const { baseType, baseTypeSize } = parseBaseType(type); - if (!baseType && !extraTypes.includes(type)) { - throw new Web3ValidatorError([ - { - keyword: "eth", - message: `Eth data type "${type}" is not valid`, - params: { eth: type }, - instancePath: "", - schemaPath: "" - } - ]); - } - if (baseType) { - if (baseType === "tuple") { - throw new Error('"tuple" type is not implemented directly.'); - } - return { format: `${baseType}${baseTypeSize !== null && baseTypeSize !== void 0 ? baseTypeSize : ""}`, required: true }; - } - if (type) { - return { format: type, required: true }; - } - return {}; -}; -var abiSchemaToJsonSchema = (abis, level = "/0") => { - const schema = { - type: "array", - items: [], - maxItems: abis.length, - minItems: abis.length - }; - for (const [index, abi] of abis.entries()) { - let abiType; - let abiName; - let abiComponents = []; - if (isAbiParameterSchema(abi)) { - abiType = abi.type; - abiName = abi.name; - abiComponents = abi.components; - } else if (typeof abi === "string") { - abiType = abi; - abiName = `${level}/${index}`; - } else if (Array.isArray(abi)) { - if (abi[0] && typeof abi[0] === "string" && abi[0].startsWith("tuple") && !Array.isArray(abi[0]) && abi[1] && Array.isArray(abi[1])) { - abiType = abi[0]; - abiName = `${level}/${index}`; - abiComponents = abi[1]; - } else { - abiType = "tuple"; - abiName = `${level}/${index}`; - abiComponents = abi; - } - } - const { baseType, isArray, arraySizes } = parseBaseType(abiType); - let childSchema; - let lastSchema = schema; - for (let i = arraySizes.length - 1; i > 0; i -= 1) { - childSchema = { - type: "array", - $id: abiName, - items: [], - maxItems: arraySizes[i], - minItems: arraySizes[i] - }; - if (arraySizes[i] < 0) { - delete childSchema.maxItems; - delete childSchema.minItems; - } - if (!Array.isArray(lastSchema.items)) { - lastSchema.items = [lastSchema.items, childSchema]; - } else if (lastSchema.items.length === 0) { - lastSchema.items = [childSchema]; - } else { - lastSchema.items.push(childSchema); - } - lastSchema = childSchema; - } - if (baseType === "tuple" && !isArray) { - const nestedTuple = abiSchemaToJsonSchema(abiComponents, abiName); - nestedTuple.$id = abiName; - lastSchema.items.push(nestedTuple); - } else if (baseType === "tuple" && isArray) { - const arraySize = arraySizes[0]; - const item = Object.assign({ type: "array", $id: abiName, items: abiSchemaToJsonSchema(abiComponents, abiName) }, arraySize >= 0 && { minItems: arraySize, maxItems: arraySize }); - lastSchema.items.push(item); - } else if (isArray) { - const arraySize = arraySizes[0]; - const item = Object.assign({ type: "array", $id: abiName, items: convertEthType(abiType) }, arraySize >= 0 && { minItems: arraySize, maxItems: arraySize }); - lastSchema.items.push(item); - } else if (Array.isArray(lastSchema.items)) { - lastSchema.items.push(Object.assign({ $id: abiName }, convertEthType(abiType))); - } else { - lastSchema.items.push(Object.assign({ $id: abiName }, convertEthType(abiType))); - } - lastSchema = schema; - } - return schema; -}; -var ethAbiToJsonSchema = (abis) => abiSchemaToJsonSchema(abis); -var fetchArrayElement = (data, level) => { - if (level === 1) { - return data; - } - return fetchArrayElement(data[0], level - 1); -}; -var transformJsonDataToAbiFormat = (abis, data, transformedData) => { - const newData = []; - for (const [index, abi] of abis.entries()) { - let abiType; - let abiName; - let abiComponents = []; - if (isAbiParameterSchema(abi)) { - abiType = abi.type; - abiName = abi.name; - abiComponents = abi.components; - } else if (typeof abi === "string") { - abiType = abi; - } else if (Array.isArray(abi)) { - if (abi[1] && Array.isArray(abi[1])) { - abiType = abi[0]; - abiComponents = abi[1]; - } else { - abiType = "tuple"; - abiComponents = abi; - } - } - const { baseType, isArray, arraySizes } = parseBaseType(abiType); - const dataItem = Array.isArray(data) ? data[index] : data[abiName]; - if (baseType === "tuple" && !isArray) { - newData.push(transformJsonDataToAbiFormat(abiComponents, dataItem, transformedData)); - } else if (baseType === "tuple" && isArray) { - const tupleData = []; - for (const tupleItem of dataItem) { - if (arraySizes.length > 1) { - const nestedItems = fetchArrayElement(tupleItem, arraySizes.length - 1); - const nestedData = []; - for (const nestedItem of nestedItems) { - nestedData.push(transformJsonDataToAbiFormat(abiComponents, nestedItem, transformedData)); - } - tupleData.push(nestedData); - } else { - tupleData.push(transformJsonDataToAbiFormat(abiComponents, tupleItem, transformedData)); - } - } - newData.push(tupleData); - } else { - newData.push(dataItem); - } - } - transformedData = transformedData !== null && transformedData !== void 0 ? transformedData : []; - transformedData.push(...newData); - return transformedData; -}; -var codePointToInt = (codePoint) => { - if (codePoint >= 48 && codePoint <= 57) { - return codePoint - 48; - } - if (codePoint >= 65 && codePoint <= 70) { - return codePoint - 55; - } - if (codePoint >= 97 && codePoint <= 102) { - return codePoint - 87; - } - throw new Error(`Invalid code point: ${codePoint}`); -}; -var hexToNumber = (value) => { - if (!isHexStrict(value)) { - throw new Error("Invalid hex string"); - } - const [negative, hexValue] = value.startsWith("-") ? [true, value.slice(1)] : [false, value]; - const num = BigInt(hexValue); - if (num > Number.MAX_SAFE_INTEGER) { - return negative ? -num : num; - } - if (num < Number.MIN_SAFE_INTEGER) { - return num; - } - return negative ? -1 * Number(num) : Number(num); -}; -var numberToHex = (value) => { - if ((typeof value === "number" || typeof value === "bigint") && value < 0) { - return `-0x${value.toString(16).slice(1)}`; - } - if ((typeof value === "number" || typeof value === "bigint") && value >= 0) { - return `0x${value.toString(16)}`; - } - if (typeof value === "string" && isHexStrict(value)) { - const [negative, hex] = value.startsWith("-") ? [true, value.slice(1)] : [false, value]; - const hexValue = hex.split(/^(-)?0(x|X)/).slice(-1)[0]; - return `${negative ? "-" : ""}0x${hexValue.replace(/^0+/, "").toLowerCase()}`; - } - if (typeof value === "string" && !isHexStrict(value)) { - return numberToHex(BigInt(value)); - } - throw new InvalidNumberError(value); -}; -var padLeft = (value, characterAmount, sign6 = "0") => { - if (typeof value === "string" && !isHexStrict(value)) { - return value.padStart(characterAmount, sign6); - } - const hex = typeof value === "string" && isHexStrict(value) ? value : numberToHex(value); - const [prefix, hexValue] = hex.startsWith("-") ? ["-0x", hex.slice(3)] : ["0x", hex.slice(2)]; - return `${prefix}${hexValue.padStart(characterAmount, sign6)}`; -}; -function uint8ArrayToHexString(uint8Array) { - let hexString = "0x"; - for (const e of uint8Array) { - const hex = e.toString(16); - hexString += hex.length === 1 ? `0${hex}` : hex; - } - return hexString; -} -var charCodeMap = { - zero: 48, - nine: 57, - A: 65, - F: 70, - a: 97, - f: 102 -}; -function charCodeToBase16(char) { - if (char >= charCodeMap.zero && char <= charCodeMap.nine) - return char - charCodeMap.zero; - if (char >= charCodeMap.A && char <= charCodeMap.F) - return char - (charCodeMap.A - 10); - if (char >= charCodeMap.a && char <= charCodeMap.f) - return char - (charCodeMap.a - 10); - return void 0; -} -function hexToUint8Array(hex) { - let offset = 0; - if (hex.startsWith("0") && (hex[1] === "x" || hex[1] === "X")) { - offset = 2; - } - if (hex.length % 2 !== 0) { - throw new InvalidBytesError(`hex string has odd length: ${hex}`); - } - const length = (hex.length - offset) / 2; - const bytes2 = new Uint8Array(length); - for (let index = 0, j = offset; index < length; index += 1) { - const nibbleLeft = charCodeToBase16(hex.charCodeAt(j++)); - const nibbleRight = charCodeToBase16(hex.charCodeAt(j++)); - if (nibbleLeft === void 0 || nibbleRight === void 0) { - throw new InvalidBytesError(`Invalid byte sequence ("${hex[j - 2]}${hex[j - 1]}" in "${hex}").`); - } - bytes2[index] = nibbleLeft * 16 + nibbleRight; - } - return bytes2; -} -function ensureIfUint8Array(data) { - var _a4; - if (!(data instanceof Uint8Array) && ((_a4 = data === null || data === void 0 ? void 0 : data.constructor) === null || _a4 === void 0 ? void 0 : _a4.name) === "Uint8Array") { - return Uint8Array.from(data); - } - return data; -} - -// node_modules/web3-validator/lib/esm/validation/bytes.js -var isUint8Array = (data) => { - var _a4; - return data instanceof Uint8Array || ((_a4 = data === null || data === void 0 ? void 0 : data.constructor) === null || _a4 === void 0 ? void 0 : _a4.name) === "Uint8Array"; -}; -var isBytes3 = (value, options = { - abiType: "bytes" -}) => { - if (typeof value !== "string" && !Array.isArray(value) && !isUint8Array(value)) { - return false; - } - if (typeof value === "string" && isHexStrict(value) && value.startsWith("-")) { - return false; - } - if (typeof value === "string" && !isHexStrict(value)) { - return false; - } - let valueToCheck; - if (typeof value === "string") { - if (value.length % 2 !== 0) { - return false; - } - valueToCheck = hexToUint8Array(value); - } else if (Array.isArray(value)) { - if (value.some((d) => d < 0 || d > 255 || !Number.isInteger(d))) { - return false; - } - valueToCheck = new Uint8Array(value); - } else { - valueToCheck = value; - } - if (options === null || options === void 0 ? void 0 : options.abiType) { - const { baseTypeSize } = parseBaseType(options.abiType); - return baseTypeSize ? valueToCheck.length === baseTypeSize : true; - } - if (options === null || options === void 0 ? void 0 : options.size) { - return valueToCheck.length === (options === null || options === void 0 ? void 0 : options.size); - } - return true; -}; - -// node_modules/web3-validator/lib/esm/validation/address.js -var checkAddressCheckSum = (data) => { - if (!/^(0x)?[0-9a-f]{40}$/i.test(data)) - return false; - const address = data.slice(2); - const updatedData = utf8ToBytes(address.toLowerCase()); - const addressHash = uint8ArrayToHexString(keccak256(ensureIfUint8Array(updatedData))).slice(2); - for (let i = 0; i < 40; i += 1) { - if (parseInt(addressHash[i], 16) > 7 && address[i].toUpperCase() !== address[i] || parseInt(addressHash[i], 16) <= 7 && address[i].toLowerCase() !== address[i]) { - return false; - } - } - return true; -}; -var isAddress = (value, checkChecksum = true) => { - if (typeof value !== "string" && !isUint8Array(value)) { - return false; - } - let valueToCheck; - if (isUint8Array(value)) { - valueToCheck = uint8ArrayToHexString(value); - } else if (typeof value === "string" && !isHexStrict(value)) { - valueToCheck = value.toLowerCase().startsWith("0x") ? value : `0x${value}`; - } else { - valueToCheck = value; - } - if (!/^(0x)?[0-9a-f]{40}$/i.test(valueToCheck)) { - return false; - } - if (/^(0x|0X)?[0-9a-f]{40}$/.test(valueToCheck) || /^(0x|0X)?[0-9A-F]{40}$/.test(valueToCheck)) { - return true; - } - return checkChecksum ? checkAddressCheckSum(valueToCheck) : true; -}; - -// node_modules/web3-types/lib/esm/index.js -var esm_exports2 = {}; -__export(esm_exports2, { - BlockTags: () => BlockTags, - DEFAULT_RETURN_FORMAT: () => DEFAULT_RETURN_FORMAT, - ETH_DATA_FORMAT: () => ETH_DATA_FORMAT, - FMT_BYTES: () => FMT_BYTES, - FMT_NUMBER: () => FMT_NUMBER, - HardforksOrdered: () => HardforksOrdered, - TypedArray: () => TypedArray, - Web3BaseProvider: () => Web3BaseProvider, - Web3BaseWallet: () => Web3BaseWallet -}); - -// node_modules/web3-types/lib/esm/data_format_types.js -var FMT_NUMBER; -(function(FMT_NUMBER2) { - FMT_NUMBER2["NUMBER"] = "NUMBER_NUMBER"; - FMT_NUMBER2["HEX"] = "NUMBER_HEX"; - FMT_NUMBER2["STR"] = "NUMBER_STR"; - FMT_NUMBER2["BIGINT"] = "NUMBER_BIGINT"; -})(FMT_NUMBER || (FMT_NUMBER = {})); -var FMT_BYTES; -(function(FMT_BYTES2) { - FMT_BYTES2["HEX"] = "BYTES_HEX"; - FMT_BYTES2["UINT8ARRAY"] = "BYTES_UINT8ARRAY"; -})(FMT_BYTES || (FMT_BYTES = {})); -var DEFAULT_RETURN_FORMAT = { number: FMT_NUMBER.BIGINT, bytes: FMT_BYTES.HEX }; -var ETH_DATA_FORMAT = { number: FMT_NUMBER.HEX, bytes: FMT_BYTES.HEX }; - -// node_modules/web3-types/lib/esm/eth_types.js -var BlockTags; -(function(BlockTags2) { - BlockTags2["EARLIEST"] = "earliest"; - BlockTags2["LATEST"] = "latest"; - BlockTags2["PENDING"] = "pending"; - BlockTags2["SAFE"] = "safe"; - BlockTags2["FINALIZED"] = "finalized"; -})(BlockTags || (BlockTags = {})); -var HardforksOrdered; -(function(HardforksOrdered2) { - HardforksOrdered2["chainstart"] = "chainstart"; - HardforksOrdered2["frontier"] = "frontier"; - HardforksOrdered2["homestead"] = "homestead"; - HardforksOrdered2["dao"] = "dao"; - HardforksOrdered2["tangerineWhistle"] = "tangerineWhistle"; - HardforksOrdered2["spuriousDragon"] = "spuriousDragon"; - HardforksOrdered2["byzantium"] = "byzantium"; - HardforksOrdered2["constantinople"] = "constantinople"; - HardforksOrdered2["petersburg"] = "petersburg"; - HardforksOrdered2["istanbul"] = "istanbul"; - HardforksOrdered2["muirGlacier"] = "muirGlacier"; - HardforksOrdered2["berlin"] = "berlin"; - HardforksOrdered2["london"] = "london"; - HardforksOrdered2["altair"] = "altair"; - HardforksOrdered2["arrowGlacier"] = "arrowGlacier"; - HardforksOrdered2["grayGlacier"] = "grayGlacier"; - HardforksOrdered2["bellatrix"] = "bellatrix"; - HardforksOrdered2["merge"] = "merge"; - HardforksOrdered2["capella"] = "capella"; - HardforksOrdered2["shanghai"] = "shanghai"; -})(HardforksOrdered || (HardforksOrdered = {})); - -// node_modules/web3-types/lib/esm/primitives_types.js -var TypedArray = Object.getPrototypeOf(Uint8Array); - -// node_modules/web3-types/lib/esm/web3_base_provider.js -var __awaiter = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var symbol = Symbol.for("web3/base-provider"); -var Web3BaseProvider = class _Web3BaseProvider { - static isWeb3Provider(provider) { - return provider instanceof _Web3BaseProvider || Boolean(provider && provider[symbol]); - } - // To match an object "instanceof" does not work if - // matcher class and object is using different package versions - // to overcome this bottleneck used this approach. - // The symbol value for one string will always remain same regardless of package versions - // eslint-disable-next-line class-methods-use-this - get [symbol]() { - return true; - } - /** - * @deprecated Please use `.request` instead. - * @param payload - Request Payload - * @param callback - Callback - */ - send(payload, callback) { - this.request(payload).then((response) => { - callback(null, response); - }).catch((err) => { - callback(err); - }); - } - /** - * @deprecated Please use `.request` instead. - * @param payload - Request Payload - */ - sendAsync(payload) { - return __awaiter(this, void 0, void 0, function* () { - return this.request(payload); - }); - } - /** - * Modify the return type of the request method to be fully compatible with EIP-1193 - * - * [deprecated] In the future major releases (\>= v5) all providers are supposed to be fully compatible with EIP-1193. - * So this method will not be needed and would not be available in the future. - * - * @returns A new instance of the provider with the request method fully compatible with EIP-1193 - * - * @example - * ```ts - * const provider = new Web3HttpProvider('http://localhost:8545'); - * const fullyCompatibleProvider = provider.asEIP1193Provider(); - * const result = await fullyCompatibleProvider.request({ method: 'eth_getBalance' }); - * console.log(result); // '0x0234c8a3397aab58' or something like that - * ``` - */ - asEIP1193Provider() { - const newObj = Object.create(this); - const originalRequest = newObj.request; - newObj.request = function request(args) { - return __awaiter(this, void 0, void 0, function* () { - const response = yield originalRequest(args); - return response.result; - }); - }; - newObj.asEIP1193Provider = void 0; - return newObj; - } -}; - -// node_modules/web3-types/lib/esm/web3_base_wallet.js -var Web3BaseWallet = class extends Array { - constructor(accountProvider) { - super(); - this._accountProvider = accountProvider; - } -}; - -// node_modules/web3-validator/lib/esm/validation/numbers.js -var isBigInt = (value) => typeof value === "bigint"; -var bigintPower = (base2, expo) => { - let res = base2; - for (let index = 1; index < expo; index += 1) { - res *= base2; - } - return res; -}; -var isUInt = (value, options = { - abiType: "uint" -}) => { - if (!["number", "string", "bigint"].includes(typeof value) || typeof value === "string" && value.length === 0) { - return false; - } - let size; - if (options === null || options === void 0 ? void 0 : options.abiType) { - const { baseTypeSize } = parseBaseType(options.abiType); - if (baseTypeSize) { - size = baseTypeSize; - } - } else if (options.bitSize) { - size = options.bitSize; - } - const maxSize = bigintPower(BigInt(2), BigInt(size !== null && size !== void 0 ? size : 256)) - BigInt(1); - try { - const valueToCheck = typeof value === "string" && isHexStrict(value) ? BigInt(hexToNumber(value)) : BigInt(value); - return valueToCheck >= 0 && valueToCheck <= maxSize; - } catch (error) { - return false; - } -}; -var isInt = (value, options = { - abiType: "int" -}) => { - if (!["number", "string", "bigint"].includes(typeof value)) { - return false; - } - if (typeof value === "number" && value > Number.MAX_SAFE_INTEGER) { - return false; - } - let size; - if (options === null || options === void 0 ? void 0 : options.abiType) { - const { baseTypeSize, baseType } = parseBaseType(options.abiType); - if (baseType !== "int") { - return false; - } - if (baseTypeSize) { - size = baseTypeSize; - } - } else if (options.bitSize) { - size = options.bitSize; - } - const maxSize = bigintPower(BigInt(2), BigInt((size !== null && size !== void 0 ? size : 256) - 1)); - const minSize = BigInt(-1) * bigintPower(BigInt(2), BigInt((size !== null && size !== void 0 ? size : 256) - 1)); - try { - const valueToCheck = typeof value === "string" && isHexStrict(value) ? BigInt(hexToNumber(value)) : BigInt(value); - return valueToCheck >= minSize && valueToCheck <= maxSize; - } catch (error) { - return false; - } -}; -var isNumber = (value) => { - if (isInt(value)) { - return true; - } - if (typeof value === "string" && /[0-9.]/.test(value) && value.indexOf(".") === value.lastIndexOf(".")) { - return true; - } - if (typeof value === "number") { - return true; - } - return false; -}; - -// node_modules/web3-validator/lib/esm/validation/block.js -var isBlockNumber = (value) => isUInt(value); -var isBlockTag = (value) => Object.values(BlockTags).includes(value); -var isBlockNumberOrTag = (value) => isBlockTag(value) || isBlockNumber(value); - -// node_modules/web3-validator/lib/esm/validation/bloom.js -var isBloom = (bloom) => { - if (typeof bloom !== "string") { - return false; - } - if (!/^(0x)?[0-9a-f]{512}$/i.test(bloom)) { - return false; - } - if (/^(0x)?[0-9a-f]{512}$/.test(bloom) || /^(0x)?[0-9A-F]{512}$/.test(bloom)) { - return true; - } - return false; -}; -var isInBloom = (bloom, value) => { - if (typeof value === "string" && !isHexStrict(value)) { - return false; - } - if (!isBloom(bloom)) { - return false; - } - const uint8Array = typeof value === "string" ? hexToUint8Array(value) : value; - const hash2 = uint8ArrayToHexString(keccak256(uint8Array)).slice(2); - for (let i = 0; i < 12; i += 4) { - const bitpos = ( - // eslint-disable-next-line no-bitwise - (parseInt(hash2.slice(i, i + 2), 16) << 8) + parseInt(hash2.slice(i + 2, i + 4), 16) & 2047 - ); - const code = codePointToInt(bloom.charCodeAt(bloom.length - 1 - Math.floor(bitpos / 4))); - const offset = 1 << bitpos % 4; - if ((code & offset) !== offset) { - return false; - } - } - return true; -}; -var isUserEthereumAddressInBloom = (bloom, ethereumAddress) => { - if (!isBloom(bloom)) { - return false; - } - if (!isAddress(ethereumAddress)) { - return false; - } - const address = padLeft(ethereumAddress, 64); - return isInBloom(bloom, address); -}; -var isContractAddressInBloom = (bloom, contractAddress) => { - if (!isBloom(bloom)) { - return false; - } - if (!isAddress(contractAddress)) { - return false; - } - return isInBloom(bloom, contractAddress); -}; - -// node_modules/web3-validator/lib/esm/validation/boolean.js -var isBoolean = (value) => { - if (!["number", "string", "boolean"].includes(typeof value)) { - return false; - } - if (typeof value === "boolean") { - return true; - } - if (typeof value === "string" && !isHexStrict(value)) { - return value === "1" || value === "0"; - } - if (typeof value === "string" && isHexStrict(value)) { - return value === "0x1" || value === "0x0"; - } - return value === 1 || value === 0; -}; - -// node_modules/web3-validator/lib/esm/validation/object.js -var isNullish = (item) => ( - // Using "null" value intentionally for validation - // eslint-disable-next-line no-null/no-null - item === void 0 || item === null -); -var isObject = (item) => typeof item === "object" && !isNullish(item) && !Array.isArray(item) && !(item instanceof TypedArray); - -// node_modules/web3-validator/lib/esm/validation/topic.js -var isTopic = (topic) => { - if (typeof topic !== "string") { - return false; - } - if (!/^(0x)?[0-9a-f]{64}$/i.test(topic)) { - return false; - } - if (/^(0x)?[0-9a-f]{64}$/.test(topic) || /^(0x)?[0-9A-F]{64}$/.test(topic)) { - return true; - } - return false; -}; -var isTopicInBloom = (bloom, topic) => { - if (!isBloom(bloom)) { - return false; - } - if (!isTopic(topic)) { - return false; - } - return isInBloom(bloom, topic); -}; - -// node_modules/web3-validator/lib/esm/validation/filter.js -var isFilterObject = (value) => { - const expectedFilterProperties = [ - "fromBlock", - "toBlock", - "address", - "topics", - "blockHash" - ]; - if (isNullish(value) || typeof value !== "object") - return false; - if (!Object.keys(value).every((property) => expectedFilterProperties.includes(property))) - return false; - if (!isNullish(value.fromBlock) && !isBlockNumberOrTag(value.fromBlock) || !isNullish(value.toBlock) && !isBlockNumberOrTag(value.toBlock)) - return false; - if (!isNullish(value.address)) { - if (Array.isArray(value.address)) { - if (!value.address.every((address) => isAddress(address))) - return false; - } else if (!isAddress(value.address)) - return false; - } - if (!isNullish(value.topics)) { - if (!value.topics.every((topic) => { - if (isNullish(topic)) - return true; - if (Array.isArray(topic)) { - return topic.every((nestedTopic) => isTopic(nestedTopic)); - } - if (isTopic(topic)) - return true; - return false; - })) - return false; - } - return true; -}; - -// node_modules/web3-validator/lib/esm/formats.js -var formats = { - address: (data) => isAddress(data), - bloom: (data) => isBloom(data), - blockNumber: (data) => isBlockNumber(data), - blockTag: (data) => isBlockTag(data), - blockNumberOrTag: (data) => isBlockNumberOrTag(data), - bool: (data) => isBoolean(data), - bytes: (data) => isBytes3(data), - filter: (data) => isFilterObject(data), - hex: (data) => isHexStrict(data), - uint: (data) => isUInt(data), - int: (data) => isInt(data), - number: (data) => isNumber(data), - string: (data) => isString(data) -}; -for (let bitSize = 8; bitSize <= 256; bitSize += 8) { - formats[`int${bitSize}`] = (data) => isInt(data, { bitSize }); - formats[`uint${bitSize}`] = (data) => isUInt(data, { bitSize }); -} -for (let size = 1; size <= 32; size += 1) { - formats[`bytes${size}`] = (data) => isBytes3(data, { size }); -} -formats.bytes256 = formats.bytes; -var formats_default = formats; - -// node_modules/web3-validator/lib/esm/validator.js -var convertToZod = (schema) => { - if ((!(schema === null || schema === void 0 ? void 0 : schema.type) || (schema === null || schema === void 0 ? void 0 : schema.type) === "object") && (schema === null || schema === void 0 ? void 0 : schema.properties)) { - const obj = {}; - for (const name2 of Object.keys(schema.properties)) { - const zItem = convertToZod(schema.properties[name2]); - if (zItem) { - obj[name2] = zItem; - } - } - if (Array.isArray(schema.required)) { - return z.object(obj).partial().required(schema.required.reduce((acc, v) => Object.assign(Object.assign({}, acc), { [v]: true }), {})); - } - return z.object(obj).partial(); - } - if ((schema === null || schema === void 0 ? void 0 : schema.type) === "array" && (schema === null || schema === void 0 ? void 0 : schema.items)) { - if (Array.isArray(schema.items) && schema.items.length > 1 && schema.maxItems !== void 0 && new Set(schema.items.map((item) => item.$id)).size === schema.items.length) { - const arr = []; - for (const item of schema.items) { - const zItem = convertToZod(item); - if (zItem) { - arr.push(zItem); - } - } - return z.tuple(arr); - } - const nextSchema = Array.isArray(schema.items) ? schema.items[0] : schema.items; - let zodArraySchema = z.array(convertToZod(nextSchema)); - zodArraySchema = schema.minItems !== void 0 ? zodArraySchema.min(schema.minItems) : zodArraySchema; - zodArraySchema = schema.maxItems !== void 0 ? zodArraySchema.max(schema.maxItems) : zodArraySchema; - return zodArraySchema; - } - if (schema.oneOf && Array.isArray(schema.oneOf)) { - return z.union(schema.oneOf.map((oneOfSchema) => convertToZod(oneOfSchema))); - } - if (schema === null || schema === void 0 ? void 0 : schema.format) { - if (!formats_default[schema.format]) { - throw new SchemaFormatError(schema.format); - } - return z.any().refine(formats_default[schema.format], (value) => ({ - params: { value, format: schema.format } - })); - } - if ((schema === null || schema === void 0 ? void 0 : schema.type) && (schema === null || schema === void 0 ? void 0 : schema.type) !== "object" && typeof z[String(schema.type)] === "function") { - return z[String(schema.type)](); - } - return z.object({ data: z.any() }).partial(); -}; -var Validator = class _Validator { - // eslint-disable-next-line no-useless-constructor, @typescript-eslint/no-empty-function - static factory() { - if (!_Validator.validatorInstance) { - _Validator.validatorInstance = new _Validator(); - } - return _Validator.validatorInstance; - } - validate(schema, data, options) { - var _a4, _b; - const zod = convertToZod(schema); - const result = zod.safeParse(data); - if (!result.success) { - const errors = this.convertErrors((_b = (_a4 = result.error) === null || _a4 === void 0 ? void 0 : _a4.issues) !== null && _b !== void 0 ? _b : []); - if (errors) { - if (options === null || options === void 0 ? void 0 : options.silent) { - return errors; - } - throw new Web3ValidatorError(errors); - } - } - return void 0; - } - // eslint-disable-next-line class-methods-use-this - convertErrors(errors) { - if (errors && Array.isArray(errors) && errors.length > 0) { - return errors.map((error) => { - var _a4; - let message; - let keyword; - let params; - let schemaPath; - schemaPath = error.path.join("/"); - const field = String(error.path[error.path.length - 1]); - const instancePath = error.path.join("/"); - if (error.code === ZodIssueCode.too_big) { - keyword = "maxItems"; - schemaPath = `${instancePath}/maxItems`; - params = { limit: error.maximum }; - message = `must NOT have more than ${error.maximum} items`; - } else if (error.code === ZodIssueCode.too_small) { - keyword = "minItems"; - schemaPath = `${instancePath}/minItems`; - params = { limit: error.minimum }; - message = `must NOT have fewer than ${error.minimum} items`; - } else if (error.code === ZodIssueCode.custom) { - const { value, format: format2 } = (_a4 = error.params) !== null && _a4 !== void 0 ? _a4 : {}; - if (typeof value === "undefined") { - message = `value at "/${schemaPath}" is required`; - } else { - message = `value "${// eslint-disable-next-line @typescript-eslint/restrict-template-expressions - typeof value === "object" ? JSON.stringify(value) : value}" at "/${schemaPath}" must pass "${format2}" validation`; - } - params = { value }; - } - return { - keyword: keyword !== null && keyword !== void 0 ? keyword : field, - instancePath: instancePath ? `/${instancePath}` : "", - schemaPath: schemaPath ? `#${schemaPath}` : "#", - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - params: params !== null && params !== void 0 ? params : { value: error.message }, - message: message !== null && message !== void 0 ? message : error.message - }; - }); - } - return void 0; - } -}; - -// node_modules/web3-validator/lib/esm/web3_validator.js -var Web3Validator = class { - constructor() { - this._validator = Validator.factory(); - } - validateJSONSchema(schema, data, options) { - return this._validator.validate(schema, data, options); - } - validate(schema, data, options = { silent: false }) { - var _a4, _b; - const jsonSchema = ethAbiToJsonSchema(schema); - if (Array.isArray(jsonSchema.items) && ((_a4 = jsonSchema.items) === null || _a4 === void 0 ? void 0 : _a4.length) === 0 && data.length === 0) { - return void 0; - } - if (Array.isArray(jsonSchema.items) && ((_b = jsonSchema.items) === null || _b === void 0 ? void 0 : _b.length) === 0 && data.length !== 0) { - throw new Web3ValidatorError([ - { - instancePath: "/0", - schemaPath: "/", - keyword: "required", - message: "empty schema against data can not be validated", - params: data - } - ]); - } - return this._validator.validate(jsonSchema, data, options); - } -}; - -// node_modules/web3-validator/lib/esm/default_validator.js -var validator = new Web3Validator(); - -// node_modules/web3-validator/lib/esm/validation/eth.js -var isValidEthBaseType = (type) => { - const { baseType, baseTypeSize } = parseBaseType(type); - if (!baseType) { - return false; - } - if (baseType === type) { - return true; - } - if ((baseType === "int" || baseType === "uint") && baseTypeSize) { - if (!(baseTypeSize <= 256 && baseTypeSize % 8 === 0)) { - return false; - } - } - if (baseType === "bytes" && baseTypeSize) { - if (!(baseTypeSize >= 1 && baseTypeSize <= 32)) { - return false; - } - } - return true; -}; - -// node_modules/web3-utils/lib/esm/uint8array.js -function isUint8Array2(data) { - var _a4; - return data instanceof Uint8Array || ((_a4 = data === null || data === void 0 ? void 0 : data.constructor) === null || _a4 === void 0 ? void 0 : _a4.name) === "Uint8Array"; -} -function uint8ArrayConcat(...parts) { - const length = parts.reduce((prev, part) => { - const agg = prev + part.length; - return agg; - }, 0); - const result = new Uint8Array(length); - let offset = 0; - for (const part of parts) { - result.set(part, offset); - offset += part.length; - } - return result; -} -function uint8ArrayEquals(a, b) { - if (a === b) { - return true; - } - if (a.byteLength !== b.byteLength) { - return false; - } - for (let i = 0; i < a.byteLength; i += 1) { - if (a[i] !== b[i]) { - return false; - } - } - return true; -} - -// node_modules/web3-utils/lib/esm/converters.js -var ethUnitMap = { - noether: BigInt(0), - wei: BigInt(1), - kwei: BigInt(1e3), - Kwei: BigInt(1e3), - babbage: BigInt(1e3), - femtoether: BigInt(1e3), - mwei: BigInt(1e6), - Mwei: BigInt(1e6), - lovelace: BigInt(1e6), - picoether: BigInt(1e6), - gwei: BigInt(1e9), - Gwei: BigInt(1e9), - shannon: BigInt(1e9), - nanoether: BigInt(1e9), - nano: BigInt(1e9), - szabo: BigInt(1e12), - microether: BigInt(1e12), - micro: BigInt(1e12), - finney: BigInt(1e15), - milliether: BigInt(1e15), - milli: BigInt(1e15), - ether: BigInt("1000000000000000000"), - kether: BigInt("1000000000000000000000"), - grand: BigInt("1000000000000000000000"), - mether: BigInt("1000000000000000000000000"), - gether: BigInt("1000000000000000000000000000"), - tether: BigInt("1000000000000000000000000000000") -}; -var bytesToUint8Array = (data) => { - validator.validate(["bytes"], [data]); - if (isUint8Array2(data)) { - return data; - } - if (Array.isArray(data)) { - return new Uint8Array(data); - } - if (typeof data === "string") { - return utils_exports.hexToUint8Array(data); - } - throw new InvalidBytesError(data); -}; -var { uint8ArrayToHexString: uint8ArrayToHexString2 } = utils_exports; -var bytesToHex2 = (bytes2) => uint8ArrayToHexString2(bytesToUint8Array(bytes2)); -var hexToBytes2 = (bytes2) => { - if (typeof bytes2 === "string" && bytes2.slice(0, 2).toLowerCase() !== "0x") { - return bytesToUint8Array(`0x${bytes2}`); - } - return bytesToUint8Array(bytes2); -}; -var hexToNumber2 = (value) => { - validator.validate(["hex"], [value]); - return utils_exports.hexToNumber(value); -}; -var toDecimal = hexToNumber2; -var numberToHex2 = (value, hexstrict) => { - if (typeof value !== "bigint") - validator.validate(["int"], [value]); - let updatedValue = utils_exports.numberToHex(value); - if (hexstrict) { - if (!updatedValue.startsWith("-") && updatedValue.length % 2 === 1) { - updatedValue = "0x0".concat(updatedValue.slice(2)); - } else if (updatedValue.length % 2 === 0 && updatedValue.startsWith("-")) - updatedValue = "-0x0".concat(updatedValue.slice(3)); - } - return updatedValue; -}; -var fromDecimal = numberToHex2; -var hexToNumberString = (data) => hexToNumber2(data).toString(); -var utf8ToHex = (str) => { - validator.validate(["string"], [str]); - let strWithoutNullCharacter = str.replace(/^(?:\u0000)/, ""); - strWithoutNullCharacter = strWithoutNullCharacter.replace(/(?:\u0000)$/, ""); - return bytesToHex2(new TextEncoder().encode(strWithoutNullCharacter)); -}; -var fromUtf8 = utf8ToHex; -var stringToHex = utf8ToHex; -var hexToUtf8 = (str) => bytesToUtf8(hexToBytes2(str)); -var toUtf8 = (input) => { - if (typeof input === "string") { - return hexToUtf8(input); - } - validator.validate(["bytes"], [input]); - return bytesToUtf8(input); -}; -var utf8ToBytes2 = utf8ToBytes; -var hexToString = hexToUtf8; -var asciiToHex = (str) => { - validator.validate(["string"], [str]); - let hexString = ""; - for (let i = 0; i < str.length; i += 1) { - const hexCharCode = str.charCodeAt(i).toString(16); - hexString += hexCharCode.length % 2 !== 0 ? `0${hexCharCode}` : hexCharCode; - } - return `0x${hexString}`; -}; -var fromAscii = asciiToHex; -var hexToAscii = (str) => { - const decoder = new TextDecoder("ascii"); - return decoder.decode(hexToBytes2(str)); -}; -var toAscii = hexToAscii; -var toHex = (value, returnType) => { - if (typeof value === "string" && isAddress(value)) { - return returnType ? "address" : `0x${value.toLowerCase().replace(/^0x/i, "")}`; - } - if (typeof value === "boolean") { - return returnType ? "bool" : value ? "0x01" : "0x00"; - } - if (typeof value === "number") { - return returnType ? value < 0 ? "int256" : "uint256" : numberToHex2(value); - } - if (typeof value === "bigint") { - return returnType ? "bigint" : numberToHex2(value); - } - if (typeof value === "object" && !!value) { - return returnType ? "string" : utf8ToHex(JSON.stringify(value)); - } - if (typeof value === "string") { - if (value.startsWith("-0x") || value.startsWith("-0X")) { - return returnType ? "int256" : numberToHex2(value); - } - if (isHexStrict(value)) { - return returnType ? "bytes" : value; - } - if (isHex(value) && !isInt(value) && !isUInt(value)) { - return returnType ? "bytes" : `0x${value}`; - } - if (isHex(value) && !isInt(value) && isUInt(value)) { - return returnType ? "uint" : numberToHex2(value); - } - if (!Number.isFinite(value)) { - return returnType ? "string" : utf8ToHex(value); - } - } - throw new HexProcessingError(value); -}; -var toNumber = (value) => { - if (typeof value === "number") { - if (value > 1e20) { - return BigInt(value); - } - return value; - } - if (typeof value === "bigint") { - return value >= Number.MIN_SAFE_INTEGER && value <= Number.MAX_SAFE_INTEGER ? Number(value) : value; - } - if (typeof value === "string" && isHexStrict(value)) { - return hexToNumber2(value); - } - try { - return toNumber(BigInt(value)); - } catch (_a4) { - throw new InvalidNumberError(value); - } -}; -var toBigInt = (value) => { - if (typeof value === "number") { - return BigInt(value); - } - if (typeof value === "bigint") { - return value; - } - if (typeof value === "string" && isHex(value)) { - if (value.startsWith("-")) { - return -BigInt(value.substring(1)); - } - return BigInt(value); - } - throw new InvalidNumberError(value); -}; -var fromWei = (number2, unit) => { - const denomination = ethUnitMap[unit]; - if (!denomination) { - throw new InvalidUnitError(unit); - } - const value = String(toNumber(number2)); - const numberOfZerosInDenomination = denomination.toString().length - 1; - if (numberOfZerosInDenomination <= 0) { - return value.toString(); - } - const zeroPaddedValue = value.padStart(numberOfZerosInDenomination, "0"); - const integer = zeroPaddedValue.slice(0, -numberOfZerosInDenomination); - const fraction = zeroPaddedValue.slice(-numberOfZerosInDenomination).replace(/\.?0+$/, ""); - if (integer === "") { - return `0.${fraction}`; - } - if (fraction === "") { - return integer; - } - return `${integer}.${fraction}`; -}; -var toWei = (number2, unit) => { - validator.validate(["number"], [number2]); - const denomination = ethUnitMap[unit]; - if (!denomination) { - throw new InvalidUnitError(unit); - } - const [integer, fraction] = String(typeof number2 === "string" && !isHexStrict(number2) ? number2 : toNumber(number2)).split(".").concat(""); - const value = BigInt(`${integer}${fraction}`); - const updatedValue = value * denomination; - const numberOfZerosInDenomination = denomination.toString().length - 1; - const decimals = Math.min(fraction.length, numberOfZerosInDenomination); - if (decimals === 0) { - return updatedValue.toString(); - } - return updatedValue.toString().padStart(decimals, "0").slice(0, -decimals); -}; -var toChecksumAddress = (address) => { - if (!isAddress(address, false)) { - throw new InvalidAddressError(address); - } - const lowerCaseAddress = address.toLowerCase().replace(/^0x/i, ""); - const hash2 = utils_exports.uint8ArrayToHexString(keccak256(utils_exports.ensureIfUint8Array(utf8ToBytes2(lowerCaseAddress)))); - if (isNullish(hash2) || hash2 === "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470") - return ""; - let checksumAddress = "0x"; - const addressHash = hash2.replace(/^0x/i, ""); - for (let i = 0; i < lowerCaseAddress.length; i += 1) { - if (parseInt(addressHash[i], 16) > 7) { - checksumAddress += lowerCaseAddress[i].toUpperCase(); - } else { - checksumAddress += lowerCaseAddress[i]; - } - } - return checksumAddress; -}; -var toBool = (value) => { - if (typeof value === "boolean") { - return value; - } - if (typeof value === "number" && (value === 0 || value === 1)) { - return Boolean(value); - } - if (typeof value === "bigint" && (value === BigInt(0) || value === BigInt(1))) { - return Boolean(value); - } - if (typeof value === "string" && !isHexStrict(value) && (value === "1" || value === "0" || value === "false" || value === "true")) { - if (value === "true") { - return true; - } - if (value === "false") { - return false; - } - return Boolean(Number(value)); - } - if (typeof value === "string" && isHexStrict(value) && (value === "0x1" || value === "0x0")) { - return Boolean(toNumber(value)); - } - throw new InvalidBooleanError(value); -}; - -// node_modules/eventemitter3/index.mjs -var import_index = __toESM(require_eventemitter3(), 1); -var eventemitter3_default = import_index.default; - -// node_modules/web3-utils/lib/esm/event_emitter.js -var EventEmitter2 = class extends eventemitter3_default { - constructor() { - super(...arguments); - this.maxListeners = Number.MAX_SAFE_INTEGER; - } - setMaxListeners(maxListeners) { - this.maxListeners = maxListeners; - return this; - } - getMaxListeners() { - return this.maxListeners; - } -}; - -// node_modules/web3-utils/lib/esm/validation.js -var isHexStrict2 = isHexStrict; -var isHex2 = isHex; -var checkAddressCheckSum2 = checkAddressCheckSum; -var isAddress2 = isAddress; -var isBloom2 = isBloom; -var isInBloom2 = isInBloom; -var isUserEthereumAddressInBloom2 = isUserEthereumAddressInBloom; -var isContractAddressInBloom2 = isContractAddressInBloom; -var isTopic2 = isTopic; -var isTopicInBloom2 = isTopicInBloom; -var compareBlockNumbers = (blockA, blockB) => { - const isABlockTag = typeof blockA === "string" && isBlockTag(blockA); - const isBBlockTag = typeof blockB === "string" && isBlockTag(blockB); - if (blockA === blockB || (blockA === "earliest" || blockA === 0) && (blockB === "earliest" || blockB === 0)) { - return 0; - } - if (blockA === "earliest" && blockB > 0) { - return -1; - } - if (blockB === "earliest" && blockA > 0) { - return 1; - } - if (isABlockTag && isBBlockTag) { - const tagsOrder = { - [BlockTags.EARLIEST]: 1, - [BlockTags.FINALIZED]: 2, - [BlockTags.SAFE]: 3, - [BlockTags.LATEST]: 4, - [BlockTags.PENDING]: 5 - }; - if (tagsOrder[blockA] < tagsOrder[blockB]) { - return -1; - } - return 1; - } - if (isABlockTag && !isBBlockTag || !isABlockTag && isBBlockTag) { - throw new InvalidBlockError("Cannot compare blocktag with provided non-blocktag input."); - } - const bigIntA = BigInt(blockA); - const bigIntB = BigInt(blockB); - if (bigIntA < bigIntB) { - return -1; - } - if (bigIntA === bigIntB) { - return 0; - } - return 1; -}; -var isContractInitOptions = (options) => typeof options === "object" && !isNullish(options) && Object.keys(options).length !== 0 && [ - "input", - "data", - "from", - "gas", - "gasPrice", - "gasLimit", - "address", - "jsonInterface", - "syncWithContext", - "dataInputFill" -].some((key) => key in options); -var isNullish2 = isNullish; - -// node_modules/web3-utils/lib/esm/objects.js -var isIterable = (item) => typeof item === "object" && !isNullish(item) && !Array.isArray(item) && !(item instanceof TypedArray); -var mergeDeep = (destination, ...sources) => { - if (!isIterable(destination)) { - return destination; - } - const result = Object.assign({}, destination); - for (const src of sources) { - for (const key in src) { - if (isIterable(src[key])) { - if (!result[key]) { - result[key] = {}; - } - result[key] = mergeDeep(result[key], src[key]); - } else if (!isNullish(src[key]) && Object.hasOwnProperty.call(src, key)) { - if (Array.isArray(src[key]) || src[key] instanceof TypedArray) { - result[key] = src[key].slice(0); - } else { - result[key] = src[key]; - } - } - } - } - return result; -}; - -// node_modules/web3-utils/lib/esm/string_manipulation.js -var padLeft2 = (value, characterAmount, sign6 = "0") => { - if (typeof value === "string") { - if (!isHexStrict(value)) { - return value.padStart(characterAmount, sign6); - } - return utils_exports.padLeft(value, characterAmount, sign6); - } - validator.validate(["int"], [value]); - return utils_exports.padLeft(value, characterAmount, sign6); -}; -var padRight = (value, characterAmount, sign6 = "0") => { - if (typeof value === "string" && !isHexStrict(value)) { - return value.padEnd(characterAmount, sign6); - } - validator.validate(["int"], [value]); - const hexString = typeof value === "string" && isHexStrict(value) ? value : numberToHex2(value); - const prefixLength = hexString.startsWith("-") ? 3 : 2; - return hexString.padEnd(characterAmount + prefixLength, sign6); -}; -var rightPad = padRight; -var leftPad = padLeft2; -var toTwosComplement = (value, nibbleWidth = 64) => { - validator.validate(["int"], [value]); - const val = toNumber(value); - if (val >= 0) - return padLeft2(toHex(val), nibbleWidth); - const largestBit = bigintPower(BigInt(2), BigInt(nibbleWidth * 4)); - if (-val >= largestBit) { - throw new NibbleWidthError(`value: ${value}, nibbleWidth: ${nibbleWidth}`); - } - const updatedVal = BigInt(val); - const complement = updatedVal + largestBit; - return padLeft2(numberToHex2(complement), nibbleWidth); -}; -var fromTwosComplement = (value, nibbleWidth = 64) => { - validator.validate(["int"], [value]); - const val = toNumber(value); - if (val < 0) - return val; - const largestBit = Math.ceil(Math.log(Number(val)) / Math.log(2)); - if (largestBit > nibbleWidth * 4) - throw new NibbleWidthError(`value: "${value}", nibbleWidth: "${nibbleWidth}"`); - if (nibbleWidth * 4 !== largestBit) - return val; - const complement = bigintPower(BigInt(2), BigInt(nibbleWidth) * BigInt(4)); - return toNumber(BigInt(val) - complement); -}; - -// node_modules/web3-utils/lib/esm/formatter.js -var { parseBaseType: parseBaseType2 } = utils_exports; -var isDataFormat = (dataFormat) => typeof dataFormat === "object" && !isNullish(dataFormat) && "number" in dataFormat && "bytes" in dataFormat; -var findSchemaByDataPath = (schema, dataPath, oneOfPath = []) => { - let result = Object.assign({}, schema); - let previousDataPath; - for (const dataPart of dataPath) { - if (result.oneOf && previousDataPath) { - const path = oneOfPath.find(function(element) { - return this === element[0]; - }, previousDataPath !== null && previousDataPath !== void 0 ? previousDataPath : ""); - if (path && path[0] === previousDataPath) { - result = result.oneOf[path[1]]; - } - } - if (!result.properties && !result.items) { - return void 0; - } - if (result.properties) { - result = result.properties[dataPart]; - } else if (result.items && result.items.properties) { - const node = result.items.properties; - if (!node) { - return void 0; - } - result = node[dataPart]; - } else if (result.items && isObject(result.items)) { - result = result.items; - } else if (result.items && Array.isArray(result.items)) { - result = result.items[parseInt(dataPart, 10)]; - } - if (result && dataPart) - previousDataPath = dataPart; - } - return result; -}; -var convertScalarValue = (value, ethType, format2) => { - try { - const { baseType, baseTypeSize } = parseBaseType2(ethType); - if (baseType === "int" || baseType === "uint") { - switch (format2.number) { - case FMT_NUMBER.NUMBER: - return Number(toBigInt(value)); - case FMT_NUMBER.HEX: - return numberToHex2(toBigInt(value)); - case FMT_NUMBER.STR: - return toBigInt(value).toString(); - case FMT_NUMBER.BIGINT: - return toBigInt(value); - default: - throw new FormatterError(`Invalid format: ${String(format2.number)}`); - } - } - if (baseType === "bytes") { - let paddedValue; - if (baseTypeSize) { - if (typeof value === "string") - paddedValue = padLeft2(value, baseTypeSize * 2); - else if (isUint8Array2(value)) { - paddedValue = uint8ArrayConcat(new Uint8Array(baseTypeSize - value.length), value); - } - } else { - paddedValue = value; - } - switch (format2.bytes) { - case FMT_BYTES.HEX: - return bytesToHex2(bytesToUint8Array(paddedValue)); - case FMT_BYTES.UINT8ARRAY: - return bytesToUint8Array(paddedValue); - default: - throw new FormatterError(`Invalid format: ${String(format2.bytes)}`); - } - } - } catch (error) { - return value; - } - return value; -}; -var convert = (data, schema, dataPath, format2, oneOfPath = []) => { - var _a4, _b; - if (!isObject(data) && !Array.isArray(data)) { - return convertScalarValue(data, schema === null || schema === void 0 ? void 0 : schema.format, format2); - } - const object = data; - for (const [key, value] of Object.entries(object)) { - dataPath.push(key); - const schemaProp = findSchemaByDataPath(schema, dataPath, oneOfPath); - if (isNullish(schemaProp)) { - delete object[key]; - dataPath.pop(); - continue; - } - if (isObject(value)) { - convert(value, schema, dataPath, format2); - dataPath.pop(); - continue; - } - if (Array.isArray(value)) { - let _schemaProp = schemaProp; - if ((schemaProp === null || schemaProp === void 0 ? void 0 : schemaProp.oneOf) !== void 0) { - schemaProp.oneOf.forEach((oneOfSchemaProp, index) => { - var _a5, _b2; - if (!Array.isArray(schemaProp === null || schemaProp === void 0 ? void 0 : schemaProp.items) && (typeof value[0] === "object" && ((_a5 = oneOfSchemaProp === null || oneOfSchemaProp === void 0 ? void 0 : oneOfSchemaProp.items) === null || _a5 === void 0 ? void 0 : _a5.type) === "object" || typeof value[0] === "string" && ((_b2 = oneOfSchemaProp === null || oneOfSchemaProp === void 0 ? void 0 : oneOfSchemaProp.items) === null || _b2 === void 0 ? void 0 : _b2.type) !== "object")) { - _schemaProp = oneOfSchemaProp; - oneOfPath.push([key, index]); - } - }); - } - if (isNullish(_schemaProp === null || _schemaProp === void 0 ? void 0 : _schemaProp.items)) { - delete object[key]; - dataPath.pop(); - continue; - } - if (isObject(_schemaProp.items) && !isNullish(_schemaProp.items.format)) { - for (let i = 0; i < value.length; i += 1) { - object[key][i] = convertScalarValue( - value[i], - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - (_a4 = _schemaProp === null || _schemaProp === void 0 ? void 0 : _schemaProp.items) === null || _a4 === void 0 ? void 0 : _a4.format, - format2 - ); - } - dataPath.pop(); - continue; - } - if (!Array.isArray(_schemaProp === null || _schemaProp === void 0 ? void 0 : _schemaProp.items) && ((_b = _schemaProp === null || _schemaProp === void 0 ? void 0 : _schemaProp.items) === null || _b === void 0 ? void 0 : _b.type) === "object") { - for (const arrObject of value) { - convert(arrObject, schema, dataPath, format2, oneOfPath); - } - dataPath.pop(); - continue; - } - if (Array.isArray(_schemaProp === null || _schemaProp === void 0 ? void 0 : _schemaProp.items)) { - for (let i = 0; i < value.length; i += 1) { - object[key][i] = convertScalarValue(value[i], _schemaProp.items[i].format, format2); - } - dataPath.pop(); - continue; - } - } - object[key] = convertScalarValue(value, schemaProp.format, format2); - dataPath.pop(); - } - return object; -}; -var format = (schema, data, returnFormat) => { - let dataToParse; - if (isObject(data)) { - dataToParse = mergeDeep({}, data); - } else if (Array.isArray(data)) { - dataToParse = [...data]; - } else { - dataToParse = data; - } - const jsonSchema = isObject(schema) ? schema : utils_exports.ethAbiToJsonSchema(schema); - if (!jsonSchema.properties && !jsonSchema.items && !jsonSchema.format) { - throw new FormatterError("Invalid json schema for formatting"); - } - return convert(dataToParse, jsonSchema, [], returnFormat); -}; - -// node_modules/web3-utils/lib/esm/hash.js -var SHA3_EMPTY_BYTES = "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"; -var sha3 = (data) => { - let updatedData; - if (typeof data === "string") { - if (data.startsWith("0x") && isHexStrict(data)) { - updatedData = hexToBytes2(data); - } else { - updatedData = utf8ToBytes(data); - } - } else { - updatedData = data; - } - const hash2 = bytesToHex2(keccak256(utils_exports.ensureIfUint8Array(updatedData))); - return hash2 === SHA3_EMPTY_BYTES ? void 0 : hash2; -}; -var sha3Raw = (data) => { - const hash2 = sha3(data); - if (isNullish(hash2)) { - return SHA3_EMPTY_BYTES; - } - return hash2; -}; -var keccak256Wrapper = (data) => { - let processedData; - if (typeof data === "bigint" || typeof data === "number") { - processedData = utf8ToBytes(data.toString()); - } else if (Array.isArray(data)) { - processedData = new Uint8Array(data); - } else if (typeof data === "string" && !isHexStrict(data)) { - processedData = utf8ToBytes(data); - } else { - processedData = bytesToUint8Array(data); - } - return bytesToHex2(keccak256(utils_exports.ensureIfUint8Array(processedData))); -}; -var getType = (arg) => { - if (Array.isArray(arg)) { - throw new Error("Autodetection of array types is not supported."); - } - let type; - let value; - if (typeof arg === "object" && ("t" in arg || "type" in arg) && ("v" in arg || "value" in arg)) { - type = "t" in arg ? arg.t : arg.type; - value = "v" in arg ? arg.v : arg.value; - type = type.toLowerCase() === "bigint" ? "int" : type; - } else if (typeof arg === "bigint") { - return ["int", arg]; - } else { - type = toHex(arg, true); - value = toHex(arg); - if (!type.startsWith("int") && !type.startsWith("uint")) { - type = "bytes"; - } - } - if ((type.startsWith("int") || type.startsWith("uint")) && typeof value === "string" && !/^(-)?0x/i.test(value)) { - value = toBigInt(value); - } - return [type, value]; -}; -var elementaryName = (name2) => { - if (name2.startsWith("int[")) { - return `int256${name2.slice(3)}`; - } - if (name2 === "int") { - return "int256"; - } - if (name2.startsWith("uint[")) { - return `uint256'${name2.slice(4)}`; - } - if (name2 === "uint") { - return "uint256"; - } - return name2; -}; -var parseTypeN = (value, typeLength) => { - const typesize = /^(\d+).*$/.exec(value.slice(typeLength)); - return typesize ? parseInt(typesize[1], 10) : 0; -}; -var bitLength = (value) => { - const updatedVal = value.toString(2); - return updatedVal.length; -}; -var solidityPack = (type, val) => { - const value = val.toString(); - if (type === "string") { - if (typeof val === "string") - return utf8ToHex(val); - throw new InvalidStringError(val); - } - if (type === "bool" || type === "boolean") { - if (typeof val === "boolean") - return val ? "01" : "00"; - throw new InvalidBooleanError(val); - } - if (type === "address") { - if (!isAddress(value)) { - throw new InvalidAddressError(value); - } - return value; - } - const name2 = elementaryName(type); - if (type.startsWith("uint")) { - const size = parseTypeN(name2, "uint".length); - if (size % 8 || size < 8 || size > 256) { - throw new InvalidSizeError(value); - } - const num = toNumber(value); - if (bitLength(num) > size) { - throw new InvalidLargeValueError(value); - } - if (num < BigInt(0)) { - throw new InvalidUnsignedIntegerError(value); - } - return size ? leftPad(num.toString(16), size / 8 * 2) : num.toString(16); - } - if (type.startsWith("int")) { - const size = parseTypeN(name2, "int".length); - if (size % 8 || size < 8 || size > 256) { - throw new InvalidSizeError(type); - } - const num = toNumber(value); - if (bitLength(num) > size) { - throw new InvalidLargeValueError(value); - } - if (num < BigInt(0)) { - return toTwosComplement(num.toString(), size / 8 * 2); - } - return size ? leftPad(num.toString(16), size / 4) : num.toString(16); - } - if (name2 === "bytes") { - if (value.replace(/^0x/i, "").length % 2 !== 0) { - throw new InvalidBytesError(value); - } - return value; - } - if (type.startsWith("bytes")) { - if (value.replace(/^0x/i, "").length % 2 !== 0) { - throw new InvalidBytesError(value); - } - const size = parseTypeN(type, "bytes".length); - if (!size || size < 1 || size > 64 || size < value.replace(/^0x/i, "").length / 2) { - throw new InvalidBytesError(value); - } - return rightPad(value, size * 2); - } - return ""; -}; -var processSolidityEncodePackedArgs = (arg) => { - const [type, val] = getType(arg); - if (Array.isArray(val)) { - const hexArg2 = val.map((v) => solidityPack(type, v).replace("0x", "")); - return hexArg2.join(""); - } - const hexArg = solidityPack(type, val); - return hexArg.replace("0x", ""); -}; -var encodePacked = (...values) => { - const hexArgs = values.map(processSolidityEncodePackedArgs); - return `0x${hexArgs.join("").toLowerCase()}`; -}; -var soliditySha3 = (...values) => sha3(encodePacked(...values)); -var soliditySha3Raw = (...values) => sha3Raw(encodePacked(...values)); -var getStorageSlotNumForLongString = (mainSlotNumber) => sha3(`0x${(typeof mainSlotNumber === "number" ? mainSlotNumber.toString() : mainSlotNumber).padStart(64, "0")}`); - -// node_modules/ethereum-cryptography/esm/random.js -function getRandomBytesSync(bytes2) { - return randomBytes(bytes2); -} - -// node_modules/web3-utils/lib/esm/random.js -var randomBytes2 = (size) => getRandomBytesSync(size); -var randomHex = (byteSize) => bytesToHex2(randomBytes2(byteSize)); - -// node_modules/web3-utils/lib/esm/promise_helpers.js -var __awaiter2 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -function isPromise(object) { - return (typeof object === "object" || typeof object === "function") && // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - typeof object.then === "function"; -} -function waitWithTimeout(awaitable, timeout, error) { - return __awaiter2(this, void 0, void 0, function* () { - let timeoutId; - const result = yield Promise.race([ - awaitable instanceof Promise ? awaitable : awaitable(), - new Promise((resolve, reject) => { - timeoutId = setTimeout(() => error ? reject(error) : resolve(void 0), timeout); - }) - ]); - if (timeoutId) { - clearTimeout(timeoutId); - } - if (result instanceof Error) { - throw result; - } - return result; - }); -} -function pollTillDefinedAndReturnIntervalId(func, interval) { - let intervalId; - const polledRes = new Promise((resolve, reject) => { - intervalId = setInterval( - function intervalCallbackFunc() { - (() => __awaiter2(this, void 0, void 0, function* () { - try { - const res = yield waitWithTimeout(func, interval); - if (!isNullish(res)) { - clearInterval(intervalId); - resolve(res); - } - } catch (error) { - clearInterval(intervalId); - reject(error); - } - }))(); - return intervalCallbackFunc; - }(), - interval - ); - }); - return [polledRes, intervalId]; -} -function pollTillDefined(func, interval) { - return __awaiter2(this, void 0, void 0, function* () { - return pollTillDefinedAndReturnIntervalId(func, interval)[0]; - }); -} -function rejectIfTimeout(timeout, error) { - let timeoutId; - const rejectOnTimeout = new Promise((_, reject) => { - timeoutId = setTimeout(() => { - reject(error); - }, timeout); - }); - return [timeoutId, rejectOnTimeout]; -} -function rejectIfConditionAtInterval(cond, interval) { - let intervalId; - const rejectIfCondition = new Promise((_, reject) => { - intervalId = setInterval(() => { - (() => __awaiter2(this, void 0, void 0, function* () { - const error = yield cond(); - if (error) { - clearInterval(intervalId); - reject(error); - } - }))(); - }, interval); - }); - return [intervalId, rejectIfCondition]; -} - -// node_modules/web3-utils/lib/esm/json_rpc.js -var json_rpc_exports = {}; -__export(json_rpc_exports, { - isBatchRequest: () => isBatchRequest, - isBatchResponse: () => isBatchResponse, - isResponseRpcError: () => isResponseRpcError, - isResponseWithError: () => isResponseWithError2, - isResponseWithNotification: () => isResponseWithNotification, - isResponseWithResult: () => isResponseWithResult, - isSubscriptionResult: () => isSubscriptionResult, - isValidResponse: () => isValidResponse, - setRequestIdStart: () => setRequestIdStart, - toBatchPayload: () => toBatchPayload, - toPayload: () => toPayload, - validateResponse: () => validateResponse -}); - -// node_modules/web3-utils/lib/esm/uuid.js -var uuidV4 = () => { - const bytes2 = randomBytes2(16); - bytes2[6] = bytes2[6] & 15 | 64; - bytes2[8] = bytes2[8] & 63 | 128; - const hexString = bytesToHex2(bytes2); - return [ - hexString.substring(2, 10), - hexString.substring(10, 14), - hexString.substring(14, 18), - hexString.substring(18, 22), - hexString.substring(22, 34) - ].join("-"); -}; - -// node_modules/web3-utils/lib/esm/json_rpc.js -var isResponseRpcError = (rpcError) => { - const errorCode = rpcError.error.code; - return rpcErrorsMap.has(errorCode) || errorCode >= -32099 && errorCode <= -32e3; -}; -var isResponseWithResult = (response) => !Array.isArray(response) && !!response && response.jsonrpc === "2.0" && // JSON RPC consider "null" as valid response -"result" in response && isNullish(response.error) && (typeof response.id === "number" || typeof response.id === "string"); -var isResponseWithError2 = (response) => !Array.isArray(response) && response.jsonrpc === "2.0" && !!response && isNullish(response.result) && // JSON RPC consider "null" as valid response -"error" in response && (typeof response.id === "number" || typeof response.id === "string"); -var isResponseWithNotification = (response) => !Array.isArray(response) && !!response && response.jsonrpc === "2.0" && !isNullish(response.params) && !isNullish(response.method); -var isSubscriptionResult = (response) => !Array.isArray(response) && !!response && response.jsonrpc === "2.0" && "id" in response && // JSON RPC consider "null" as valid response -"result" in response; -var validateResponse = (response) => isResponseWithResult(response) || isResponseWithError2(response); -var isValidResponse = (response) => Array.isArray(response) ? response.every(validateResponse) : validateResponse(response); -var isBatchResponse = (response) => Array.isArray(response) && response.length > 0 && isValidResponse(response); -var requestIdSeed; -var setRequestIdStart = (start) => { - requestIdSeed = start; -}; -var toPayload = (request) => { - var _a4, _b, _c, _d; - if (typeof requestIdSeed !== "undefined") { - requestIdSeed += 1; - } - return { - jsonrpc: (_a4 = request.jsonrpc) !== null && _a4 !== void 0 ? _a4 : "2.0", - id: (_c = (_b = request.id) !== null && _b !== void 0 ? _b : requestIdSeed) !== null && _c !== void 0 ? _c : uuidV4(), - method: request.method, - params: (_d = request.params) !== null && _d !== void 0 ? _d : void 0 - }; -}; -var toBatchPayload = (requests) => requests.map((request) => toPayload(request)); -var isBatchRequest = (request) => Array.isArray(request) && request.length > 0; - -// node_modules/web3-utils/lib/esm/web3_deferred_promise.js -var __awaiter3 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var _a; -var Web3DeferredPromise = class { - /** - * - * @param timeout - (optional) The timeout in milliseconds. - * @param eagerStart - (optional) If true, the timer starts as soon as the promise is created. - * @param timeoutMessage - (optional) The message to include in the timeout erro that is thrown when the promise times out. - */ - constructor({ timeout, eagerStart, timeoutMessage } = { - timeout: 0, - eagerStart: false, - timeoutMessage: "DeferredPromise timed out" - }) { - this[_a] = "Promise"; - this._state = "pending"; - this._promise = new Promise((resolve, reject) => { - this._resolve = resolve; - this._reject = reject; - }); - this._timeoutMessage = timeoutMessage; - this._timeoutInterval = timeout; - if (eagerStart) { - this.startTimer(); - } - } - /** - * Returns the current state of the promise. - * @returns 'pending' | 'fulfilled' | 'rejected' - */ - get state() { - return this._state; - } - /** - * - * @param onfulfilled - (optional) The callback to execute when the promise is fulfilled. - * @param onrejected - (optional) The callback to execute when the promise is rejected. - * @returns - */ - then(onfulfilled, onrejected) { - return __awaiter3(this, void 0, void 0, function* () { - return this._promise.then(onfulfilled, onrejected); - }); - } - /** - * - * @param onrejected - (optional) The callback to execute when the promise is rejected. - * @returns - */ - catch(onrejected) { - return __awaiter3(this, void 0, void 0, function* () { - return this._promise.catch(onrejected); - }); - } - /** - * - * @param onfinally - (optional) The callback to execute when the promise is settled (fulfilled or rejected). - * @returns - */ - finally(onfinally) { - return __awaiter3(this, void 0, void 0, function* () { - return this._promise.finally(onfinally); - }); - } - /** - * Resolves the current promise. - * @param value - The value to resolve the promise with. - */ - resolve(value) { - this._resolve(value); - this._state = "fulfilled"; - this._clearTimeout(); - } - /** - * Rejects the current promise. - * @param reason - The reason to reject the promise with. - */ - reject(reason) { - this._reject(reason); - this._state = "rejected"; - this._clearTimeout(); - } - /** - * Starts the timeout timer for the promise. - */ - startTimer() { - if (this._timeoutInterval && this._timeoutInterval > 0) { - this._timeoutId = setTimeout(this._checkTimeout.bind(this), this._timeoutInterval); - } - } - _checkTimeout() { - if (this._state === "pending" && this._timeoutId) { - this.reject(new OperationTimeoutError(this._timeoutMessage)); - } - } - _clearTimeout() { - if (this._timeoutId) { - clearTimeout(this._timeoutId); - } - } -}; -_a = Symbol.toStringTag; - -// node_modules/web3-utils/lib/esm/chunk_response_parser.js -var ChunkResponseParser = class { - constructor(eventEmitter, autoReconnect) { - this.eventEmitter = eventEmitter; - this.autoReconnect = autoReconnect; - this.chunkTimeout = 1e3 * 15; - } - clearQueues() { - if (typeof this._clearQueues === "function") { - this._clearQueues(); - } - } - onError(clearQueues) { - this._clearQueues = clearQueues; - } - parseResponse(data) { - const returnValues = []; - const dechunkedData = data.replace(/\}[\n\r]?\{/g, "}|--|{").replace(/\}\][\n\r]?\[\{/g, "}]|--|[{").replace(/\}[\n\r]?\[\{/g, "}|--|[{").replace(/\}\][\n\r]?\{/g, "}]|--|{").split("|--|"); - dechunkedData.forEach((_chunkData) => { - let chunkData = _chunkData; - if (this.lastChunk) { - chunkData = this.lastChunk + chunkData; - } - let result; - try { - result = JSON.parse(chunkData); - } catch (e) { - this.lastChunk = chunkData; - if (this.lastChunkTimeout) { - clearTimeout(this.lastChunkTimeout); - } - this.lastChunkTimeout = setTimeout(() => { - if (this.autoReconnect) - return; - this.clearQueues(); - this.eventEmitter.emit("error", new InvalidResponseError({ - id: 1, - jsonrpc: "2.0", - error: { code: 2, message: "Chunk timeout" } - })); - }, this.chunkTimeout); - return; - } - clearTimeout(this.lastChunkTimeout); - this.lastChunk = void 0; - if (result) - returnValues.push(result); - }); - return returnValues; - } -}; - -// node_modules/web3-utils/lib/esm/web3_eip1193_provider.js -var __awaiter4 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var Eip1193Provider = class extends Web3BaseProvider { - constructor() { - super(...arguments); - this._eventEmitter = new import_index.default(); - this._chainId = ""; - this._accounts = []; - } - _getChainId() { - var _a4; - return __awaiter4(this, void 0, void 0, function* () { - const data = yield this.request(toPayload({ - method: "eth_chainId", - params: [] - })); - return (_a4 = data === null || data === void 0 ? void 0 : data.result) !== null && _a4 !== void 0 ? _a4 : ""; - }); - } - _getAccounts() { - var _a4; - return __awaiter4(this, void 0, void 0, function* () { - const data = yield this.request(toPayload({ - method: "eth_accounts", - params: [] - })); - return (_a4 = data === null || data === void 0 ? void 0 : data.result) !== null && _a4 !== void 0 ? _a4 : []; - }); - } - _onConnect() { - Promise.all([ - this._getChainId().then((chainId) => { - if (chainId !== this._chainId) { - this._chainId = chainId; - this._eventEmitter.emit("chainChanged", this._chainId); - } - }).catch((err) => { - console.error(err); - }), - this._getAccounts().then((accounts) => { - if (!(this._accounts.length === accounts.length && accounts.every((v) => accounts.includes(v)))) { - this._accounts = accounts; - this._onAccountsChanged(); - } - }).catch((err) => { - console.error(err); - }) - ]).then(() => this._eventEmitter.emit("connect", { - chainId: this._chainId - })).catch((err) => { - console.error(err); - }); - } - // todo this must be ProvideRpcError with a message too - _onDisconnect(code, data) { - this._eventEmitter.emit("disconnect", new EIP1193ProviderRpcError(code, data)); - } - _onAccountsChanged() { - this._eventEmitter.emit("accountsChanged", this._accounts); - } -}; - -// node_modules/web3-utils/lib/esm/socket_provider.js -var __awaiter5 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var DEFAULT_RECONNECTION_OPTIONS = { - autoReconnect: true, - delay: 5e3, - maxAttempts: 5 -}; -var NORMAL_CLOSE_CODE = 1e3; -var SocketProvider = class extends Eip1193Provider { - /** - * This is an abstract class for implementing a socket provider (e.g. WebSocket, IPC). It extends the EIP-1193 provider {@link EIP1193Provider}. - * @param socketPath - The path to the socket (e.g. /ipc/path or ws://localhost:8546) - * @param socketOptions - The options for the socket connection. Its type is supposed to be specified in the inherited classes. - * @param reconnectOptions - The options for the socket reconnection {@link ReconnectOptions} - */ - constructor(socketPath, socketOptions, reconnectOptions) { - super(); - this._connectionStatus = "connecting"; - this._onMessageHandler = this._onMessage.bind(this); - this._onOpenHandler = this._onConnect.bind(this); - this._onCloseHandler = this._onCloseEvent.bind(this); - this._onErrorHandler = this._onError.bind(this); - if (!this._validateProviderPath(socketPath)) - throw new InvalidClientError(socketPath); - this._socketPath = socketPath; - this._socketOptions = socketOptions; - this._reconnectOptions = Object.assign(Object.assign({}, DEFAULT_RECONNECTION_OPTIONS), reconnectOptions !== null && reconnectOptions !== void 0 ? reconnectOptions : {}); - this._pendingRequestsQueue = /* @__PURE__ */ new Map(); - this._sentRequestsQueue = /* @__PURE__ */ new Map(); - this._init(); - this.connect(); - this.chunkResponseParser = new ChunkResponseParser(this._eventEmitter, this._reconnectOptions.autoReconnect); - this.chunkResponseParser.onError(() => { - this._clearQueues(); - }); - this.isReconnecting = false; - } - get SocketConnection() { - return this._socketConnection; - } - _init() { - this._reconnectAttempts = 0; - } - /** - * Try to establish a connection to the socket - */ - connect() { - try { - this._openSocketConnection(); - this._connectionStatus = "connecting"; - this._addSocketListeners(); - } catch (e) { - if (!this.isReconnecting) { - this._connectionStatus = "disconnected"; - if (e && e.message) { - throw new ConnectionError(`Error while connecting to ${this._socketPath}. Reason: ${e.message}`); - } else { - throw new InvalidClientError(this._socketPath); - } - } else { - setImmediate(() => { - this._reconnect(); - }); - } - } - } - // eslint-disable-next-line class-methods-use-this - _validateProviderPath(path) { - return !!path; - } - /** - * - * @returns the pendingRequestQueue size - */ - // eslint-disable-next-line class-methods-use-this - getPendingRequestQueueSize() { - return this._pendingRequestsQueue.size; - } - /** - * - * @returns the sendPendingRequests size - */ - // eslint-disable-next-line class-methods-use-this - getSentRequestsQueueSize() { - return this._sentRequestsQueue.size; - } - /** - * - * @returns `true` if the socket supports subscriptions - */ - // eslint-disable-next-line class-methods-use-this - supportsSubscriptions() { - return true; - } - on(type, listener) { - this._eventEmitter.on(type, listener); - } - once(type, listener) { - this._eventEmitter.once(type, listener); - } - removeListener(type, listener) { - this._eventEmitter.removeListener(type, listener); - } - _onDisconnect(code, data) { - this._connectionStatus = "disconnected"; - super._onDisconnect(code, data); - } - /** - * Disconnects the socket - * @param code - The code to be sent to the server - * @param data - The data to be sent to the server - */ - disconnect(code, data) { - const disconnectCode = code !== null && code !== void 0 ? code : NORMAL_CLOSE_CODE; - this._removeSocketListeners(); - if (this.getStatus() !== "disconnected") { - this._closeSocketConnection(disconnectCode, data); - } - this._onDisconnect(disconnectCode, data); - } - /** - * Safely disconnects the socket, async and waits for request size to be 0 before disconnecting - * @param forceDisconnect - If true, will clear queue after 5 attempts of waiting for both pending and sent queue to be 0 - * @param ms - Determines the ms of setInterval - * @param code - The code to be sent to the server - * @param data - The data to be sent to the server - */ - safeDisconnect(code, data, forceDisconnect = false, ms = 1e3) { - return __awaiter5(this, void 0, void 0, function* () { - let retryAttempt = 0; - const checkQueue = () => __awaiter5(this, void 0, void 0, function* () { - return new Promise((resolve) => { - const interval = setInterval(() => { - if (forceDisconnect && retryAttempt === 5) { - this.clearQueues(); - } - if (this.getPendingRequestQueueSize() === 0 && this.getSentRequestsQueueSize() === 0) { - clearInterval(interval); - resolve(true); - } - retryAttempt += 1; - }, ms); - }); - }); - yield checkQueue(); - this.disconnect(code, data); - }); - } - /** - * Removes all listeners for the specified event type. - * @param type - The event type to remove the listeners for - */ - removeAllListeners(type) { - this._eventEmitter.removeAllListeners(type); - } - _onError(event) { - if (this.isReconnecting) { - this._reconnect(); - } else { - this._eventEmitter.emit("error", event); - } - } - /** - * Resets the socket, removing all listeners and pending requests - */ - reset() { - this._sentRequestsQueue.clear(); - this._pendingRequestsQueue.clear(); - this._init(); - this._removeSocketListeners(); - this._addSocketListeners(); - } - _reconnect() { - if (this.isReconnecting) { - return; - } - this.isReconnecting = true; - if (this._sentRequestsQueue.size > 0) { - this._sentRequestsQueue.forEach((request, key) => { - request.deferredPromise.reject(new PendingRequestsOnReconnectingError()); - this._sentRequestsQueue.delete(key); - }); - } - if (this._reconnectAttempts < this._reconnectOptions.maxAttempts) { - this._reconnectAttempts += 1; - setTimeout(() => { - this._removeSocketListeners(); - this.connect(); - this.isReconnecting = false; - }, this._reconnectOptions.delay); - } else { - this.isReconnecting = false; - this._clearQueues(); - this._removeSocketListeners(); - this._eventEmitter.emit("error", new MaxAttemptsReachedOnReconnectingError(this._reconnectOptions.maxAttempts)); - } - } - /** - * Creates a request object to be sent to the server - */ - request(request) { - return __awaiter5(this, void 0, void 0, function* () { - if (isNullish2(this._socketConnection)) { - throw new Error("Connection is undefined"); - } - if (this.getStatus() === "disconnected") { - this.connect(); - } - const requestId = isBatchRequest(request) ? request[0].id : request.id; - if (!requestId) { - throw new Web3WSProviderError("Request Id not defined"); - } - if (this._sentRequestsQueue.has(requestId)) { - throw new RequestAlreadySentError(requestId); - } - const deferredPromise = new Web3DeferredPromise(); - deferredPromise.catch((error) => { - this._eventEmitter.emit("error", error); - }); - const reqItem = { - payload: request, - deferredPromise - }; - if (this.getStatus() === "connecting") { - this._pendingRequestsQueue.set(requestId, reqItem); - return reqItem.deferredPromise; - } - this._sentRequestsQueue.set(requestId, reqItem); - try { - this._sendToSocket(reqItem.payload); - } catch (error) { - this._sentRequestsQueue.delete(requestId); - this._eventEmitter.emit("error", error); - } - return deferredPromise; - }); - } - _onConnect() { - this._connectionStatus = "connected"; - this._reconnectAttempts = 0; - super._onConnect(); - this._sendPendingRequests(); - } - _sendPendingRequests() { - for (const [id, value] of this._pendingRequestsQueue.entries()) { - this._sendToSocket(value.payload); - this._pendingRequestsQueue.delete(id); - this._sentRequestsQueue.set(id, value); - } - } - _onMessage(event) { - const responses = this._parseResponses(event); - if (isNullish2(responses) || responses.length === 0) { - return; - } - for (const response of responses) { - if (isResponseWithNotification(response) && response.method.endsWith("_subscription")) { - this._eventEmitter.emit("message", response); - return; - } - const requestId = isBatchResponse(response) ? response[0].id : response.id; - const requestItem = this._sentRequestsQueue.get(requestId); - if (!requestItem) { - return; - } - if (isBatchResponse(response) || isResponseWithResult(response) || isResponseWithError2(response)) { - this._eventEmitter.emit("message", response); - requestItem.deferredPromise.resolve(response); - } - this._sentRequestsQueue.delete(requestId); - } - } - clearQueues(event) { - this._clearQueues(event); - } - _clearQueues(event) { - if (this._pendingRequestsQueue.size > 0) { - this._pendingRequestsQueue.forEach((request, key) => { - request.deferredPromise.reject(new ConnectionNotOpenError(event)); - this._pendingRequestsQueue.delete(key); - }); - } - if (this._sentRequestsQueue.size > 0) { - this._sentRequestsQueue.forEach((request, key) => { - request.deferredPromise.reject(new ConnectionNotOpenError(event)); - this._sentRequestsQueue.delete(key); - }); - } - this._removeSocketListeners(); - } -}; - -// node_modules/web3-core/lib/esm/web3_event_emitter.js -var Web3EventEmitter = class { - constructor() { - this._emitter = new EventEmitter2(); - } - on(eventName, fn) { - this._emitter.on(eventName, fn); - } - once(eventName, fn) { - this._emitter.once(eventName, fn); - } - off(eventName, fn) { - this._emitter.off(eventName, fn); - } - emit(eventName, params) { - this._emitter.emit(eventName, params); - } - listenerCount(eventName) { - return this._emitter.listenerCount(eventName); - } - listeners(eventName) { - return this._emitter.listeners(eventName); - } - eventNames() { - return this._emitter.eventNames(); - } - removeAllListeners() { - return this._emitter.removeAllListeners(); - } - setMaxListenerWarningThreshold(maxListenersWarningThreshold) { - this._emitter.setMaxListeners(maxListenersWarningThreshold); - } - getMaxListeners() { - return this._emitter.getMaxListeners(); - } -}; - -// node_modules/web3-core/lib/esm/web3_config.js -var Web3ConfigEvent; -(function(Web3ConfigEvent2) { - Web3ConfigEvent2["CONFIG_CHANGE"] = "CONFIG_CHANGE"; -})(Web3ConfigEvent || (Web3ConfigEvent = {})); -var Web3Config = class extends Web3EventEmitter { - constructor(options) { - super(); - this.config = { - handleRevert: false, - defaultAccount: void 0, - defaultBlock: "latest", - transactionBlockTimeout: 50, - transactionConfirmationBlocks: 24, - transactionPollingInterval: 1e3, - transactionPollingTimeout: 750 * 1e3, - transactionReceiptPollingInterval: void 0, - transactionSendTimeout: 750 * 1e3, - transactionConfirmationPollingInterval: void 0, - blockHeaderTimeout: 10, - maxListenersWarningThreshold: 100, - contractDataInputFill: "data", - defaultNetworkId: void 0, - defaultChain: "mainnet", - defaultHardfork: "london", - // TODO - Check if there is a default Common - defaultCommon: void 0, - defaultTransactionType: "0x2", - defaultMaxPriorityFeePerGas: toHex(25e8), - enableExperimentalFeatures: { - useSubscriptionWhenCheckingBlockTimeout: false, - useRpcCallSpecification: false - }, - transactionBuilder: void 0, - transactionTypeParser: void 0 - }; - this.setConfig(options !== null && options !== void 0 ? options : {}); - } - setConfig(options) { - const keys = Object.keys(options); - for (const key of keys) { - this._triggerConfigChange(key, options[key]); - } - Object.assign(this.config, options); - } - /** - * The `handleRevert` options property returns the revert reason string if enabled for the following methods: - * - web3.eth.sendTransaction() - * - web3.eth.call() - * - myContract.methods.myMethod().call() - * - myContract.methods.myMethod().send() - * Default is `false`. - * - * `Note`: At the moment `handleRevert` is only supported for `sendTransaction` and not for `sendSignedTransaction` - */ - get handleRevert() { - return this.config.handleRevert; - } - /** - * Will set the handleRevert - */ - set handleRevert(val) { - this._triggerConfigChange("handleRevert", val); - this.config.handleRevert = val; - } - /** - * The `contractDataInputFill` options property will allow you to set the hash of the method signature and encoded parameters to the property - * either `data`, `input` or both within your contract. - * This will affect the contracts send, call and estimateGas methods - * Default is `input`. - */ - get contractDataInputFill() { - return this.config.contractDataInputFill; - } - /** - * Will set the contractDataInputFill - */ - set contractDataInputFill(val) { - this._triggerConfigChange("contractDataInputFill", val); - this.config.contractDataInputFill = val; - } - /** - * This default address is used as the default `from` property, if no `from` property is specified in for the following methods: - * - web3.eth.sendTransaction() - * - web3.eth.call() - * - myContract.methods.myMethod().call() - * - myContract.methods.myMethod().send() - */ - get defaultAccount() { - return this.config.defaultAccount; - } - /** - * Will set the default account. - */ - set defaultAccount(val) { - this._triggerConfigChange("defaultAccount", val); - this.config.defaultAccount = val; - } - /** - * The default block is used for certain methods. You can override it by passing in the defaultBlock as last parameter. The default value is `"latest"`. - * - web3.eth.getBalance() - * - web3.eth.getCode() - * - web3.eth.getTransactionCount() - * - web3.eth.getStorageAt() - * - web3.eth.call() - * - myContract.methods.myMethod().call() - */ - get defaultBlock() { - return this.config.defaultBlock; - } - /** - * Will set the default block. - * - * - A block number - * - `"earliest"` - String: The genesis block - * - `"latest"` - String: The latest block (current head of the blockchain) - * - `"pending"` - String: The currently mined block (including pending transactions) - * - `"finalized"` - String: (For POS networks) The finalized block is one which has been accepted as canonical by greater than 2/3 of validators - * - `"safe"` - String: (For POS networks) The safe head block is one which under normal network conditions, is expected to be included in the canonical chain. Under normal network conditions the safe head and the actual tip of the chain will be equivalent (with safe head trailing only by a few seconds). Safe heads will be less likely to be reorged than the proof of work network`s latest blocks. - */ - set defaultBlock(val) { - this._triggerConfigChange("defaultBlock", val); - this.config.defaultBlock = val; - } - /** - * The time used to wait for Ethereum Node to return the sent transaction result. - * Note: If the RPC call stuck at the Node and therefor timed-out, the transaction may still be pending or even mined by the Network. We recommend checking the pending transactions in such a case. - * Default is `750` seconds (12.5 minutes). - */ - get transactionSendTimeout() { - return this.config.transactionSendTimeout; - } - /** - * Will set the transactionSendTimeout. - */ - set transactionSendTimeout(val) { - this._triggerConfigChange("transactionSendTimeout", val); - this.config.transactionSendTimeout = val; - } - /** - * The `transactionBlockTimeout` is used over socket-based connections. This option defines the amount of new blocks it should wait until the first confirmation happens, otherwise the PromiEvent rejects with a timeout error. - * Default is `50`. - */ - get transactionBlockTimeout() { - return this.config.transactionBlockTimeout; - } - /** - * Will set the transactionBlockTimeout. - */ - set transactionBlockTimeout(val) { - this._triggerConfigChange("transactionBlockTimeout", val); - this.config.transactionBlockTimeout = val; - } - /** - * This defines the number of blocks it requires until a transaction is considered confirmed. - * Default is `24`. - */ - get transactionConfirmationBlocks() { - return this.config.transactionConfirmationBlocks; - } - /** - * Will set the transactionConfirmationBlocks. - */ - set transactionConfirmationBlocks(val) { - this._triggerConfigChange("transactionConfirmationBlocks", val); - this.config.transactionConfirmationBlocks = val; - } - /** - * Used over HTTP connections. This option defines the number of seconds between Web3 calls for a receipt which confirms that a transaction was mined by the network. - * Default is `1000` ms. - */ - get transactionPollingInterval() { - return this.config.transactionPollingInterval; - } - /** - * Will set the transactionPollingInterval. - */ - set transactionPollingInterval(val) { - this._triggerConfigChange("transactionPollingInterval", val); - this.config.transactionPollingInterval = val; - this.transactionReceiptPollingInterval = val; - this.transactionConfirmationPollingInterval = val; - } - /** - * Used over HTTP connections. This option defines the number of seconds Web3 will wait for a receipt which confirms that a transaction was mined by the network. Note: If this method times out, the transaction may still be pending. - * Default is `750` seconds (12.5 minutes). - */ - get transactionPollingTimeout() { - return this.config.transactionPollingTimeout; - } - /** - * Will set the transactionPollingTimeout. - */ - set transactionPollingTimeout(val) { - this._triggerConfigChange("transactionPollingTimeout", val); - this.config.transactionPollingTimeout = val; - } - /** - * The `transactionPollingInterval` is used over HTTP connections. This option defines the number of seconds between Web3 calls for a receipt which confirms that a transaction was mined by the network. - * Default is `undefined` - */ - get transactionReceiptPollingInterval() { - return this.config.transactionReceiptPollingInterval; - } - /** - * Will set the transactionReceiptPollingInterval - */ - set transactionReceiptPollingInterval(val) { - this._triggerConfigChange("transactionReceiptPollingInterval", val); - this.config.transactionReceiptPollingInterval = val; - } - get transactionConfirmationPollingInterval() { - return this.config.transactionConfirmationPollingInterval; - } - set transactionConfirmationPollingInterval(val) { - this._triggerConfigChange("transactionConfirmationPollingInterval", val); - this.config.transactionConfirmationPollingInterval = val; - } - /** - * The blockHeaderTimeout is used over socket-based connections. This option defines the amount seconds it should wait for `'newBlockHeaders'` event before falling back to polling to fetch transaction receipt. - * Default is `10` seconds. - */ - get blockHeaderTimeout() { - return this.config.blockHeaderTimeout; - } - /** - * Will set the blockHeaderTimeout - */ - set blockHeaderTimeout(val) { - this._triggerConfigChange("blockHeaderTimeout", val); - this.config.blockHeaderTimeout = val; - } - /** - * The enableExperimentalFeatures is used to enable trying new experimental features that are still not fully implemented or not fully tested or still have some related issues. - * Default is `false` for every feature. - */ - get enableExperimentalFeatures() { - return this.config.enableExperimentalFeatures; - } - /** - * Will set the enableExperimentalFeatures - */ - set enableExperimentalFeatures(val) { - this._triggerConfigChange("enableExperimentalFeatures", val); - this.config.enableExperimentalFeatures = val; - } - get maxListenersWarningThreshold() { - return this.config.maxListenersWarningThreshold; - } - set maxListenersWarningThreshold(val) { - this._triggerConfigChange("maxListenersWarningThreshold", val); - this.setMaxListenerWarningThreshold(val); - this.config.maxListenersWarningThreshold = val; - } - get defaultNetworkId() { - return this.config.defaultNetworkId; - } - set defaultNetworkId(val) { - this._triggerConfigChange("defaultNetworkId", val); - this.config.defaultNetworkId = val; - } - get defaultChain() { - return this.config.defaultChain; - } - set defaultChain(val) { - if (!isNullish2(this.config.defaultCommon) && !isNullish2(this.config.defaultCommon.baseChain) && val !== this.config.defaultCommon.baseChain) - throw new ConfigChainMismatchError(this.config.defaultChain, val); - this._triggerConfigChange("defaultChain", val); - this.config.defaultChain = val; - } - /** - * Will return the default hardfork. Default is `london` - * The default hardfork property can be one of the following: - * - `chainstart` - * - `homestead` - * - `dao` - * - `tangerineWhistle` - * - `spuriousDragon` - * - `byzantium` - * - `constantinople` - * - `petersburg` - * - `istanbul` - * - `berlin` - * - `london` - * - 'arrowGlacier', - * - 'tangerineWhistle', - * - 'muirGlacier' - * - */ - get defaultHardfork() { - return this.config.defaultHardfork; - } - /** - * Will set the default hardfork. - * - */ - set defaultHardfork(val) { - if (!isNullish2(this.config.defaultCommon) && !isNullish2(this.config.defaultCommon.hardfork) && val !== this.config.defaultCommon.hardfork) - throw new ConfigHardforkMismatchError(this.config.defaultCommon.hardfork, val); - this._triggerConfigChange("defaultHardfork", val); - this.config.defaultHardfork = val; - } - /** - * - * Will get the default common property - * The default common property does contain the following Common object: - * - `customChain` - `Object`: The custom chain properties - * - `name` - `string`: (optional) The name of the chain - * - `networkId` - `number`: Network ID of the custom chain - * - `chainId` - `number`: Chain ID of the custom chain - * - `baseChain` - `string`: (optional) mainnet, goerli, kovan, rinkeby, or ropsten - * - `hardfork` - `string`: (optional) chainstart, homestead, dao, tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg, istanbul, berlin, or london - * Default is `undefined`. - * - */ - get defaultCommon() { - return this.config.defaultCommon; - } - /** - * Will set the default common property - * - */ - set defaultCommon(val) { - if (!isNullish2(this.config.defaultHardfork) && !isNullish2(val) && !isNullish2(val.hardfork) && this.config.defaultHardfork !== val.hardfork) - throw new ConfigHardforkMismatchError(this.config.defaultHardfork, val.hardfork); - if (!isNullish2(this.config.defaultChain) && !isNullish2(val) && !isNullish2(val.baseChain) && this.config.defaultChain !== val.baseChain) - throw new ConfigChainMismatchError(this.config.defaultChain, val.baseChain); - this._triggerConfigChange("defaultCommon", val); - this.config.defaultCommon = val; - } - get defaultTransactionType() { - return this.config.defaultTransactionType; - } - set defaultTransactionType(val) { - this._triggerConfigChange("defaultTransactionType", val); - this.config.defaultTransactionType = val; - } - get defaultMaxPriorityFeePerGas() { - return this.config.defaultMaxPriorityFeePerGas; - } - set defaultMaxPriorityFeePerGas(val) { - this._triggerConfigChange("defaultMaxPriorityFeePerGas", val); - this.config.defaultMaxPriorityFeePerGas = val; - } - get transactionBuilder() { - return this.config.transactionBuilder; - } - set transactionBuilder(val) { - this._triggerConfigChange("transactionBuilder", val); - this.config.transactionBuilder = val; - } - get transactionTypeParser() { - return this.config.transactionTypeParser; - } - set transactionTypeParser(val) { - this._triggerConfigChange("transactionTypeParser", val); - this.config.transactionTypeParser = val; - } - _triggerConfigChange(config, newValue) { - this.emit(Web3ConfigEvent.CONFIG_CHANGE, { - name: config, - oldValue: this.config[config], - newValue - }); - } -}; - -// node_modules/web3-providers-http/lib/esm/index.js -var esm_exports5 = {}; -__export(esm_exports5, { - HttpProvider: () => HttpProvider, - default: () => HttpProvider -}); -var import_cross_fetch = __toESM(require_browser_ponyfill()); -var __awaiter6 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var HttpProvider = class _HttpProvider extends Web3BaseProvider { - constructor(clientUrl, httpProviderOptions) { - super(); - if (!_HttpProvider.validateClientUrl(clientUrl)) - throw new InvalidClientError(clientUrl); - this.clientUrl = clientUrl; - this.httpProviderOptions = httpProviderOptions; - } - static validateClientUrl(clientUrl) { - return typeof clientUrl === "string" ? /^http(s)?:\/\//i.test(clientUrl) : false; - } - /* eslint-disable class-methods-use-this */ - getStatus() { - throw new MethodNotImplementedError(); - } - /* eslint-disable class-methods-use-this */ - supportsSubscriptions() { - return false; - } - request(payload, requestOptions) { - var _a4; - return __awaiter6(this, void 0, void 0, function* () { - const providerOptionsCombined = Object.assign(Object.assign({}, (_a4 = this.httpProviderOptions) === null || _a4 === void 0 ? void 0 : _a4.providerOptions), requestOptions); - const response = yield (0, import_cross_fetch.default)(this.clientUrl, Object.assign(Object.assign({}, providerOptionsCombined), { method: "POST", headers: Object.assign(Object.assign({}, providerOptionsCombined.headers), { "Content-Type": "application/json" }), body: JSON.stringify(payload) })); - if (!response.ok) - throw new ResponseError(yield response.json()); - return yield response.json(); - }); - } - /* eslint-disable class-methods-use-this */ - on() { - throw new MethodNotImplementedError(); - } - /* eslint-disable class-methods-use-this */ - removeListener() { - throw new MethodNotImplementedError(); - } - /* eslint-disable class-methods-use-this */ - once() { - throw new MethodNotImplementedError(); - } - /* eslint-disable class-methods-use-this */ - removeAllListeners() { - throw new MethodNotImplementedError(); - } - /* eslint-disable class-methods-use-this */ - connect() { - throw new MethodNotImplementedError(); - } - /* eslint-disable class-methods-use-this */ - disconnect() { - throw new MethodNotImplementedError(); - } - /* eslint-disable class-methods-use-this */ - reset() { - throw new MethodNotImplementedError(); - } - /* eslint-disable class-methods-use-this */ - reconnect() { - throw new MethodNotImplementedError(); - } -}; - -// node_modules/web3-providers-ws/lib/esm/index.js -var esm_exports6 = {}; -__export(esm_exports6, { - WebSocketProvider: () => WebSocketProvider, - default: () => WebSocketProvider -}); - -// node_modules/isomorphic-ws/browser.js -var ws = null; -if (typeof WebSocket !== "undefined") { - ws = WebSocket; -} else if (typeof MozWebSocket !== "undefined") { - ws = MozWebSocket; -} else if (typeof global !== "undefined") { - ws = global.WebSocket || global.MozWebSocket; -} else if (typeof window !== "undefined") { - ws = window.WebSocket || window.MozWebSocket; -} else if (typeof self !== "undefined") { - ws = self.WebSocket || self.MozWebSocket; -} -var browser_default = ws; - -// node_modules/web3-providers-ws/lib/esm/index.js -var WebSocketProvider = class extends SocketProvider { - /** - * This is a class used for Web Socket connections. It extends the abstract class SocketProvider {@link SocketProvider} that extends the EIP-1193 provider {@link EIP1193Provider}. - * @param socketPath - The path to the Web Socket. - * @param socketOptions - The options for the Web Socket client. - * @param reconnectOptions - The options for the socket reconnection {@link ReconnectOptions} - */ - // this constructor is to specify the type for `socketOptions` for a better intellisense. - // eslint-disable-next-line no-useless-constructor - constructor(socketPath, socketOptions, reconnectOptions) { - super(socketPath, socketOptions, reconnectOptions); - } - // eslint-disable-next-line class-methods-use-this - _validateProviderPath(providerUrl) { - return typeof providerUrl === "string" ? /^ws(s)?:\/\//i.test(providerUrl) : false; - } - getStatus() { - if (this._socketConnection && !isNullish2(this._socketConnection)) { - switch (this._socketConnection.readyState) { - case this._socketConnection.CONNECTING: { - return "connecting"; - } - case this._socketConnection.OPEN: { - return "connected"; - } - default: { - return "disconnected"; - } - } - } - return "disconnected"; - } - _openSocketConnection() { - this._socketConnection = new browser_default(this._socketPath, void 0, this._socketOptions && Object.keys(this._socketOptions).length === 0 ? void 0 : this._socketOptions); - } - _closeSocketConnection(code, data) { - var _a4; - (_a4 = this._socketConnection) === null || _a4 === void 0 ? void 0 : _a4.close(code, data); - } - _sendToSocket(payload) { - var _a4; - if (this.getStatus() === "disconnected") { - throw new ConnectionNotOpenError(); - } - (_a4 = this._socketConnection) === null || _a4 === void 0 ? void 0 : _a4.send(JSON.stringify(payload)); - } - _parseResponses(event) { - return this.chunkResponseParser.parseResponse(event.data); - } - _addSocketListeners() { - var _a4, _b, _c, _d; - (_a4 = this._socketConnection) === null || _a4 === void 0 ? void 0 : _a4.addEventListener("open", this._onOpenHandler); - (_b = this._socketConnection) === null || _b === void 0 ? void 0 : _b.addEventListener("message", this._onMessageHandler); - (_c = this._socketConnection) === null || _c === void 0 ? void 0 : _c.addEventListener("close", (e) => this._onCloseHandler(e)); - (_d = this._socketConnection) === null || _d === void 0 ? void 0 : _d.addEventListener("error", this._onErrorHandler); - } - _removeSocketListeners() { - var _a4, _b, _c; - (_a4 = this._socketConnection) === null || _a4 === void 0 ? void 0 : _a4.removeEventListener("message", this._onMessageHandler); - (_b = this._socketConnection) === null || _b === void 0 ? void 0 : _b.removeEventListener("open", this._onOpenHandler); - (_c = this._socketConnection) === null || _c === void 0 ? void 0 : _c.removeEventListener("close", this._onCloseHandler); - } - _onCloseEvent(event) { - var _a4; - if (this._reconnectOptions.autoReconnect && (![1e3, 1001].includes(event.code) || !event.wasClean)) { - this._reconnect(); - return; - } - this._clearQueues(event); - this._removeSocketListeners(); - this._onDisconnect(event.code, event.reason); - (_a4 = this._socketConnection) === null || _a4 === void 0 ? void 0 : _a4.removeEventListener("error", this._onErrorHandler); - } -}; - -// node_modules/web3-core/lib/esm/utils.js -var isWeb3Provider = (provider) => Web3BaseProvider.isWeb3Provider(provider); -var isMetaMaskProvider = (provider) => typeof provider !== "string" && "request" in provider && provider.request.constructor.name === "AsyncFunction" && "isMetaMask" in provider && provider.isMetaMask; -var isLegacyRequestProvider = (provider) => typeof provider !== "string" && "request" in provider && provider.request.constructor.name === "Function"; -var isEIP1193Provider = (provider) => typeof provider !== "string" && "request" in provider && provider.request.constructor.name === "AsyncFunction"; -var isLegacySendProvider = (provider) => typeof provider !== "string" && "send" in provider; -var isLegacySendAsyncProvider = (provider) => typeof provider !== "string" && "sendAsync" in provider; -var isSupportedProvider = (provider) => provider && (isWeb3Provider(provider) || isEIP1193Provider(provider) || isLegacyRequestProvider(provider) || isLegacySendAsyncProvider(provider) || isLegacySendProvider(provider)); -var isSupportSubscriptions = (provider) => { - if (provider && "supportsSubscriptions" in provider) { - return provider.supportsSubscriptions(); - } - if (provider && typeof provider !== "string" && "on" in provider) { - return true; - } - return false; -}; - -// node_modules/web3-core/lib/esm/web3_request_manager.js -var __awaiter7 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var Web3RequestManagerEvent; -(function(Web3RequestManagerEvent2) { - Web3RequestManagerEvent2["PROVIDER_CHANGED"] = "PROVIDER_CHANGED"; - Web3RequestManagerEvent2["BEFORE_PROVIDER_CHANGE"] = "BEFORE_PROVIDER_CHANGE"; -})(Web3RequestManagerEvent || (Web3RequestManagerEvent = {})); -var availableProviders = { - HttpProvider, - WebsocketProvider: WebSocketProvider -}; -var Web3RequestManager = class _Web3RequestManager extends Web3EventEmitter { - constructor(provider, useRpcCallSpecification) { - super(); - if (!isNullish2(provider)) { - this.setProvider(provider); - } - this.useRpcCallSpecification = useRpcCallSpecification; - } - /** - * Will return all available providers - */ - static get providers() { - return availableProviders; - } - /** - * Will return the current provider. - * - * @returns Returns the current provider - */ - get provider() { - return this._provider; - } - /** - * Will return all available providers - */ - // eslint-disable-next-line class-methods-use-this - get providers() { - return availableProviders; - } - /** - * Use to set provider. Provider can be a provider instance or a string. - * - * @param provider - The provider to set - */ - setProvider(provider) { - let newProvider; - if (provider && typeof provider === "string" && this.providers) { - if (/^http(s)?:\/\//i.test(provider)) { - newProvider = new this.providers.HttpProvider(provider); - } else if (/^ws(s)?:\/\//i.test(provider)) { - newProvider = new this.providers.WebsocketProvider(provider); - } else { - throw new ProviderError(`Can't autodetect provider for "${provider}"`); - } - } else if (isNullish2(provider)) { - newProvider = void 0; - } else { - newProvider = provider; - } - this.emit(Web3RequestManagerEvent.BEFORE_PROVIDER_CHANGE, this._provider); - this._provider = newProvider; - this.emit(Web3RequestManagerEvent.PROVIDER_CHANGED, this._provider); - return true; - } - /** - * - * Will execute a request - * - * @param request - {@link Web3APIRequest} The request to send - * - * @returns The response of the request {@link ResponseType}. If there is error - * in the response, will throw an error - */ - send(request) { - return __awaiter7(this, void 0, void 0, function* () { - const response = yield this._sendRequest(request); - if (json_rpc_exports.isResponseWithResult(response)) { - return response.result; - } - throw new ResponseError(response); - }); - } - /** - * Same as send, but, will execute a batch of requests - * - * @param request {@link JsonRpcBatchRequest} The batch request to send - */ - sendBatch(request) { - return __awaiter7(this, void 0, void 0, function* () { - const response = yield this._sendRequest(request); - return response; - }); - } - _sendRequest(request) { - return __awaiter7(this, void 0, void 0, function* () { - const { provider } = this; - if (isNullish2(provider)) { - throw new ProviderError("Provider not available. Use `.setProvider` or `.provider=` to initialize the provider."); - } - const payload = json_rpc_exports.isBatchRequest(request) ? json_rpc_exports.toBatchPayload(request) : json_rpc_exports.toPayload(request); - if (isWeb3Provider(provider)) { - let response; - try { - response = yield provider.request(payload); - } catch (error) { - response = error; - } - return this._processJsonRpcResponse(payload, response, { legacy: false, error: false }); - } - if (isEIP1193Provider(provider)) { - return provider.request(payload).then((res) => this._processJsonRpcResponse(payload, res, { - legacy: true, - error: false - })).catch((error) => this._processJsonRpcResponse(payload, error, { legacy: true, error: true })); - } - if (isLegacyRequestProvider(provider)) { - return new Promise((resolve, reject) => { - const rejectWithError = (err) => reject(this._processJsonRpcResponse(payload, err, { - legacy: true, - error: true - })); - const resolveWithResponse = (response) => resolve(this._processJsonRpcResponse(payload, response, { - legacy: true, - error: false - })); - const result = provider.request( - payload, - // a callback that is expected to be called after getting the response: - (err, response) => { - if (err) { - return rejectWithError(err); - } - return resolveWithResponse(response); - } - ); - if (isPromise(result)) { - const responsePromise = result; - responsePromise.then(resolveWithResponse).catch(rejectWithError); - } - }); - } - if (isLegacySendProvider(provider)) { - return new Promise((resolve, reject) => { - provider.send(payload, (err, response) => { - if (err) { - return reject(this._processJsonRpcResponse(payload, err, { - legacy: true, - error: true - })); - } - if (isNullish2(response)) { - throw new ResponseError("", 'Got a "nullish" response from provider.'); - } - return resolve(this._processJsonRpcResponse(payload, response, { - legacy: true, - error: false - })); - }); - }); - } - if (isLegacySendAsyncProvider(provider)) { - return provider.sendAsync(payload).then((response) => this._processJsonRpcResponse(payload, response, { legacy: true, error: false })).catch((error) => this._processJsonRpcResponse(payload, error, { - legacy: true, - error: true - })); - } - throw new ProviderError("Provider does not have a request or send method to use."); - }); - } - // eslint-disable-next-line class-methods-use-this - _processJsonRpcResponse(payload, response, { legacy, error }) { - if (isNullish2(response)) { - return this._buildResponse( - payload, - // Some providers uses "null" as valid empty response - // eslint-disable-next-line no-null/no-null - null, - error - ); - } - if (json_rpc_exports.isResponseWithError(response)) { - if (this.useRpcCallSpecification && isResponseRpcError(response)) { - const rpcErrorResponse = response; - if (rpcErrorsMap.get(rpcErrorResponse.error.code)) { - const Err = rpcErrorsMap.get(rpcErrorResponse.error.code).error; - throw new Err(rpcErrorResponse); - } else { - throw new RpcError(rpcErrorResponse); - } - } else if (!_Web3RequestManager._isReverted(response)) { - throw new InvalidResponseError(response, payload); - } - } - if (json_rpc_exports.isResponseWithResult(response)) { - return response; - } - if (response instanceof Error) { - _Web3RequestManager._isReverted(response); - throw response; - } - if (!legacy && json_rpc_exports.isBatchRequest(payload) && json_rpc_exports.isBatchResponse(response)) { - return response; - } - if (legacy && !error && json_rpc_exports.isBatchRequest(payload)) { - return response; - } - if (legacy && error && json_rpc_exports.isBatchRequest(payload)) { - throw response; - } - if (legacy && !json_rpc_exports.isResponseWithError(response) && !json_rpc_exports.isResponseWithResult(response)) { - return this._buildResponse(payload, response, error); - } - if (json_rpc_exports.isBatchRequest(payload) && !Array.isArray(response)) { - throw new ResponseError(response, "Got normal response for a batch request."); - } - if (!json_rpc_exports.isBatchRequest(payload) && Array.isArray(response)) { - throw new ResponseError(response, "Got batch response for a normal request."); - } - if ((json_rpc_exports.isResponseWithError(response) || json_rpc_exports.isResponseWithResult(response)) && !json_rpc_exports.isBatchRequest(payload)) { - if (response.id && payload.id !== response.id) { - throw new InvalidResponseError(response); - } - } - throw new ResponseError(response, "Invalid response"); - } - static _isReverted(response) { - let error; - if (json_rpc_exports.isResponseWithError(response)) { - error = response.error; - } else if (response instanceof Error) { - error = response; - } - if (error === null || error === void 0 ? void 0 : error.message.includes("revert")) - throw new ContractExecutionError(error); - return false; - } - // Need to use same types as _processJsonRpcResponse so have to declare as instance method - // eslint-disable-next-line class-methods-use-this - _buildResponse(payload, response, error) { - const res = { - jsonrpc: "2.0", - // eslint-disable-next-line no-nested-ternary - id: json_rpc_exports.isBatchRequest(payload) ? payload[0].id : "id" in payload ? payload.id : ( - // Have to use the null here explicitly - // eslint-disable-next-line no-null/no-null - null - ) - }; - if (error) { - return Object.assign(Object.assign({}, res), { error: response }); - } - return Object.assign(Object.assign({}, res), { result: response }); - } -}; - -// node_modules/web3-core/lib/esm/web3_subscription_manager.js -var __awaiter8 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var Web3SubscriptionManager = class { - constructor(requestManager, registeredSubscriptions2, tolerateUnlinkedSubscription = false) { - this.requestManager = requestManager; - this.registeredSubscriptions = registeredSubscriptions2; - this.tolerateUnlinkedSubscription = tolerateUnlinkedSubscription; - this._subscriptions = /* @__PURE__ */ new Map(); - this.requestManager.on(Web3RequestManagerEvent.BEFORE_PROVIDER_CHANGE, () => __awaiter8(this, void 0, void 0, function* () { - yield this.unsubscribe(); - })); - this.requestManager.on(Web3RequestManagerEvent.PROVIDER_CHANGED, () => { - this.clear(); - this.listenToProviderEvents(); - }); - this.listenToProviderEvents(); - } - listenToProviderEvents() { - const providerAsWebProvider = this.requestManager.provider; - if (!this.requestManager.provider || typeof (providerAsWebProvider === null || providerAsWebProvider === void 0 ? void 0 : providerAsWebProvider.supportsSubscriptions) === "function" && !(providerAsWebProvider === null || providerAsWebProvider === void 0 ? void 0 : providerAsWebProvider.supportsSubscriptions())) { - return; - } - if (typeof this.requestManager.provider.on === "function") { - if (typeof this.requestManager.provider.request === "function") { - this.requestManager.provider.on( - "message", - // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument - (message) => this.messageListener(message) - ); - } else { - providerAsWebProvider.on("data", (data) => this.messageListener(data)); - } - } - } - messageListener(data) { - var _a4, _b, _c; - if (!data) { - throw new SubscriptionError("Should not call messageListener with no data. Type was"); - } - const subscriptionId = ((_a4 = data.params) === null || _a4 === void 0 ? void 0 : _a4.subscription) || ((_b = data.data) === null || _b === void 0 ? void 0 : _b.subscription) || ((_c = data.id) === null || _c === void 0 ? void 0 : _c.toString(16)); - if (subscriptionId) { - const sub = this._subscriptions.get(subscriptionId); - sub === null || sub === void 0 ? void 0 : sub.processSubscriptionData(data); - } - } - /** - * Will create a new subscription - * - * @param name - The subscription you want to subscribe to - * @param args - Optional additional parameters, depending on the subscription type - * @param returnFormat- ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) - Specifies how the return data from the call should be formatted. - * - * Will subscribe to a specific topic (note: name) - * @returns The subscription object - */ - subscribe(name2, args, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter8(this, void 0, void 0, function* () { - const Klass = this.registeredSubscriptions[name2]; - if (!Klass) { - throw new SubscriptionError("Invalid subscription type"); - } - const subscription = new Klass(args !== null && args !== void 0 ? args : void 0, { - subscriptionManager: this, - returnFormat - }); - yield this.addSubscription(subscription); - return subscription; - }); - } - /** - * Will returns all subscriptions. - */ - get subscriptions() { - return this._subscriptions; - } - /** - * - * Adds an instance of {@link Web3Subscription} and subscribes to it - * - * @param sub - A {@link Web3Subscription} object - */ - addSubscription(sub) { - return __awaiter8(this, void 0, void 0, function* () { - if (!this.requestManager.provider) { - throw new ProviderError("Provider not available"); - } - if (!this.supportsSubscriptions()) { - throw new SubscriptionError("The current provider does not support subscriptions"); - } - if (sub.id && this._subscriptions.has(sub.id)) { - throw new SubscriptionError(`Subscription with id "${sub.id}" already exists`); - } - yield sub.sendSubscriptionRequest(); - if (isNullish2(sub.id)) { - throw new SubscriptionError("Subscription is not subscribed yet."); - } - this._subscriptions.set(sub.id, sub); - return sub.id; - }); - } - /** - * Will clear a subscription - * - * @param id - The subscription of type {@link Web3Subscription} to remove - */ - removeSubscription(sub) { - return __awaiter8(this, void 0, void 0, function* () { - const { id } = sub; - if (isNullish2(id)) { - throw new SubscriptionError("Subscription is not subscribed yet. Or, had already been unsubscribed but not through the Subscription Manager."); - } - if (!this._subscriptions.has(id) && !this.tolerateUnlinkedSubscription) { - throw new SubscriptionError(`Subscription with id "${id.toString()}" does not exists`); - } - yield sub.sendUnsubscribeRequest(); - this._subscriptions.delete(id); - return id; - }); - } - /** - * Will unsubscribe all subscriptions that fulfill the condition - * - * @param condition - A function that access and `id` and a `subscription` and return `true` or `false` - * @returns An array of all the un-subscribed subscriptions - */ - unsubscribe(condition) { - return __awaiter8(this, void 0, void 0, function* () { - const result = []; - for (const [id, sub] of this.subscriptions.entries()) { - if (!condition || typeof condition === "function" && condition({ id, sub })) { - result.push(this.removeSubscription(sub)); - } - } - return Promise.all(result); - }); - } - /** - * Clears all subscriptions - */ - clear() { - this._subscriptions.clear(); - } - /** - * Check whether the current provider supports subscriptions. - * - * @returns `true` or `false` depending on if the current provider supports subscriptions - */ - supportsSubscriptions() { - return isNullish2(this.requestManager.provider) ? false : isSupportSubscriptions(this.requestManager.provider); - } -}; - -// node_modules/web3-core/lib/esm/web3_subscriptions.js -var __awaiter9 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var Web3Subscription = class extends Web3EventEmitter { - constructor(args, options) { - var _a4; - super(); - this.args = args; - const { requestManager } = options; - const { subscriptionManager } = options; - if (requestManager && subscriptionManager) { - throw new SubscriptionError("Only requestManager or subscriptionManager should be provided at Subscription constructor"); - } - if (!requestManager && !subscriptionManager) { - throw new SubscriptionError("Either requestManager or subscriptionManager should be provided at Subscription constructor"); - } - if (requestManager) { - this._subscriptionManager = new Web3SubscriptionManager(requestManager, {}, true); - } else { - this._subscriptionManager = subscriptionManager; - } - this._returnFormat = (_a4 = options === null || options === void 0 ? void 0 : options.returnFormat) !== null && _a4 !== void 0 ? _a4 : DEFAULT_RETURN_FORMAT; - } - get id() { - return this._id; - } - get lastBlock() { - return this._lastBlock; - } - subscribe() { - return __awaiter9(this, void 0, void 0, function* () { - return this._subscriptionManager.addSubscription(this); - }); - } - processSubscriptionData(data) { - var _a4, _b; - if (data === null || data === void 0 ? void 0 : data.data) { - this._processSubscriptionResult((_b = (_a4 = data === null || data === void 0 ? void 0 : data.data) === null || _a4 === void 0 ? void 0 : _a4.result) !== null && _b !== void 0 ? _b : data === null || data === void 0 ? void 0 : data.data); - } else if (data && json_rpc_exports.isResponseWithNotification(data)) { - this._processSubscriptionResult(data === null || data === void 0 ? void 0 : data.params.result); - } - } - sendSubscriptionRequest() { - return __awaiter9(this, void 0, void 0, function* () { - this._id = yield this._subscriptionManager.requestManager.send({ - method: "eth_subscribe", - params: this._buildSubscriptionParams() - }); - this.emit("connected", this._id); - return this._id; - }); - } - get returnFormat() { - return this._returnFormat; - } - get subscriptionManager() { - return this._subscriptionManager; - } - resubscribe() { - return __awaiter9(this, void 0, void 0, function* () { - yield this.unsubscribe(); - yield this.subscribe(); - }); - } - unsubscribe() { - return __awaiter9(this, void 0, void 0, function* () { - if (!this.id) { - return; - } - yield this._subscriptionManager.removeSubscription(this); - }); - } - sendUnsubscribeRequest() { - return __awaiter9(this, void 0, void 0, function* () { - yield this._subscriptionManager.requestManager.send({ - method: "eth_unsubscribe", - params: [this.id] - }); - this._id = void 0; - }); - } - // eslint-disable-next-line class-methods-use-this - formatSubscriptionResult(data) { - return data; - } - _processSubscriptionResult(data) { - this.emit("data", this.formatSubscriptionResult(data)); - } - _processSubscriptionError(error) { - this.emit("error", error); - } - // eslint-disable-next-line class-methods-use-this - _buildSubscriptionParams() { - throw new Error("Implement in the child class"); - } -}; - -// node_modules/web3-eth-accounts/lib/esm/index.js -var esm_exports7 = {}; -__export(esm_exports7, { - AccessListEIP2930Transaction: () => AccessListEIP2930Transaction, - BaseTransaction: () => BaseTransaction, - Capability: () => Capability, - Chain: () => Chain, - Common: () => Common, - ConsensusAlgorithm: () => ConsensusAlgorithm, - ConsensusType: () => ConsensusType, - CustomChain: () => CustomChain, - FeeMarketEIP1559Transaction: () => FeeMarketEIP1559Transaction, - Hardfork: () => Hardfork, - Transaction: () => Transaction, - TransactionFactory: () => TransactionFactory, - TypeOutput: () => TypeOutput, - Wallet: () => Wallet, - assertIsUint8Array: () => assertIsUint8Array, - bigIntToHex: () => bigIntToHex, - bigIntToUint8Array: () => bigIntToUint8Array, - bigIntToUnpaddedUint8Array: () => bigIntToUnpaddedUint8Array, - create: () => create, - decrypt: () => decrypt2, - ecrecover: () => ecrecover, - encrypt: () => encrypt2, - hashMessage: () => hashMessage, - intToUint8Array: () => intToUint8Array, - isAccessList: () => isAccessList, - isAccessListUint8Array: () => isAccessListUint8Array, - keyStoreSchema: () => keyStoreSchema, - padToEven: () => padToEven, - parseAndValidatePrivateKey: () => parseAndValidatePrivateKey, - parseGethGenesis: () => parseGethGenesis, - privateKeyToAccount: () => privateKeyToAccount, - privateKeyToAddress: () => privateKeyToAddress, - privateKeyToPublicKey: () => privateKeyToPublicKey, - recover: () => recover, - recoverTransaction: () => recoverTransaction, - setLengthLeft: () => setLengthLeft, - sign: () => sign, - signTransaction: () => signTransaction, - stripHexPrefix: () => stripHexPrefix, - stripZeros: () => stripZeros, - toType: () => toType, - toUint8Array: () => toUint8Array, - txUtils: () => utils_exports3, - uint8ArrayToBigInt: () => uint8ArrayToBigInt, - unpadUint8Array: () => unpadUint8Array, - zeros: () => zeros -}); - -// node_modules/web3-eth-accounts/lib/esm/wallet.js -var __awaiter10 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var Wallet = class _Wallet extends Web3BaseWallet { - constructor() { - super(...arguments); - this._addressMap = /* @__PURE__ */ new Map(); - this._defaultKeyName = "web3js_wallet"; - } - /** - * Get the storage object of the browser - * - * @returns the storage - */ - static getStorage() { - let storage; - try { - storage = window.localStorage; - const x = "__storage_test__"; - storage.setItem(x, x); - storage.removeItem(x); - return storage; - } catch (e) { - return e && // everything except Firefox - (e.code === 22 || // Firefox - e.code === 1014 || // test name field too, because code might not be present - // everything except Firefox - e.name === "QuotaExceededError" || // Firefox - e.name === "NS_ERROR_DOM_QUOTA_REACHED") && // acknowledge QuotaExceededError only if there's something already stored - !isNullish(storage) && storage.length !== 0 ? storage : void 0; - } - } - /** - * Generates one or more accounts in the wallet. If wallets already exist they will not be overridden. - * - * @param numberOfAccounts - Number of accounts to create. Leave empty to create an empty wallet. - * @returns The wallet - * ```ts - * web3.eth.accounts.wallet.create(2) - * > Wallet(2) [ - * { - * address: '0xde38310a42B751AE57d30cFFF4a0A3c52A442fCE', - * privateKey: '0x6422c9d28efdcbee93c1d32a5fc6fd6fa081b985487885296cf8c9bbb5872600', - * signTransaction: [Function: signTransaction], - * sign: [Function: sign], - * encrypt: [Function: encrypt] - * }, - * { - * address: '0x766BF755246d924B1d017Fdb5390f38a60166691', - * privateKey: '0x756530f13c0eb636ebdda655335f5dea9921e3362e2e588b0ad59e556f7751f0', - * signTransaction: [Function: signTransaction], - * sign: [Function: sign], - * encrypt: [Function: encrypt] - * }, - * _accountProvider: { - * create: [Function: create], - * privateKeyToAccount: [Function: privateKeyToAccount], - * decrypt: [Function: decrypt] - * }, - * _addressMap: Map(2) { - * '0xde38310a42b751ae57d30cfff4a0a3c52a442fce' => 0, - * '0x766bf755246d924b1d017fdb5390f38a60166691' => 1 - * }, - * _defaultKeyName: 'web3js_wallet' - * ] - * - * ``` - */ - create(numberOfAccounts) { - for (let i = 0; i < numberOfAccounts; i += 1) { - this.add(this._accountProvider.create()); - } - return this; - } - /** - * Adds an account using a private key or account object to the wallet. - * - * @param account - A private key or account object - * @returns The wallet - * - * ```ts - * web3.eth.accounts.wallet.add('0xbce9b59981303e76c4878b1a6d7b088ec6b9dd5c966b7d5f54d7a749ff683387'); - * > Wallet(1) [ - * { - * address: '0x85D70633b90e03e0276B98880286D0D055685ed7', - * privateKey: '0xbce9b59981303e76c4878b1a6d7b088ec6b9dd5c966b7d5f54d7a749ff683387', - * signTransaction: [Function: signTransaction], - * sign: [Function: sign], - * encrypt: [Function: encrypt] - * }, - * _accountProvider: { - * create: [Function: create], - * privateKeyToAccount: [Function: privateKeyToAccount], - * decrypt: [Function: decrypt] - * }, - * _addressMap: Map(1) { '0x85d70633b90e03e0276b98880286d0d055685ed7' => 0 }, - * _defaultKeyName: 'web3js_wallet' - * ] - * ``` - */ - add(account) { - var _a4; - if (typeof account === "string") { - return this.add(this._accountProvider.privateKeyToAccount(account)); - } - let index = this.length; - const existAccount = this.get(account.address); - if (existAccount) { - console.warn(`Account ${account.address.toLowerCase()} already exists.`); - index = (_a4 = this._addressMap.get(account.address.toLowerCase())) !== null && _a4 !== void 0 ? _a4 : index; - } - this._addressMap.set(account.address.toLowerCase(), index); - this[index] = account; - return this; - } - /** - * Get the account of the wallet with either the index or public address. - * - * @param addressOrIndex - A string of the address or number index within the wallet. - * @returns The account object or undefined if the account doesn't exist - */ - get(addressOrIndex) { - if (typeof addressOrIndex === "string") { - const index = this._addressMap.get(addressOrIndex.toLowerCase()); - if (!isNullish(index)) { - return this[index]; - } - return void 0; - } - return this[addressOrIndex]; - } - /** - * Removes an account from the wallet. - * - * @param addressOrIndex - The account address, or index in the wallet. - * @returns true if the wallet was removed. false if it couldn't be found. - * ```ts - * web3.eth.accounts.wallet.add('0xbce9b59981303e76c4878b1a6d7b088ec6b9dd5c966b7d5f54d7a749ff683387'); - * - * web3.eth.accounts.wallet.remove('0x85D70633b90e03e0276B98880286D0D055685ed7'); - * > true - * web3.eth.accounts.wallet - * > Wallet(0) [ - * _accountProvider: { - * create: [Function: create], - * privateKeyToAccount: [Function: privateKeyToAccount], - * decrypt: [Function: decrypt] - * }, - * _addressMap: Map(0) {}, - * _defaultKeyName: 'web3js_wallet' - * ] - * ``` - */ - remove(addressOrIndex) { - if (typeof addressOrIndex === "string") { - const index = this._addressMap.get(addressOrIndex.toLowerCase()); - if (isNullish(index)) { - return false; - } - this._addressMap.delete(addressOrIndex.toLowerCase()); - this.splice(index, 1); - return true; - } - if (this[addressOrIndex]) { - this.splice(addressOrIndex, 1); - return true; - } - return false; - } - /** - * Securely empties the wallet and removes all its accounts. - * Use this with *caution as it will remove all accounts stored in local wallet. - * - * @returns The wallet object - * ```ts - * - * web3.eth.accounts.wallet.clear(); - * > Wallet(0) [ - * _accountProvider: { - * create: [Function: create], - * privateKeyToAccount: [Function: privateKeyToAccount], - * decrypt: [Function: decrypt] - * }, - * _addressMap: Map(0) {}, - * _defaultKeyName: 'web3js_wallet' - * ] - * ``` - */ - clear() { - this._addressMap.clear(); - this.length = 0; - return this; - } - /** - * Encrypts all wallet accounts to an array of encrypted keystore v3 objects. - * - * @param password - The password which will be used for encryption - * @param options - encryption options - * @returns An array of the encrypted keystore v3. - * - * ```ts - * web3.eth.accounts.wallet.create(1) - * web3.eth.accounts.wallet.encrypt("abc").then(console.log); - * > [ - * '{"version":3,"id":"fa46e213-a7c3-4844-b903-dd14d39cc7db", - * "address":"fa3e41a401609103c241431cbdee8623ae2a321a","crypto": - * {"ciphertext":"8d179a911d6146ad2924e86bf493ed89b8ff3596ffec0816e761c542016ab13c", - * "cipherparams":{"iv":"acc888c6cf4a19b86846cef0185a7164"},"cipher":"aes-128-ctr", - * "kdf":"scrypt","kdfparams":{"n":8192,"r":8,"p":1,"dklen":32,"salt":"6a743c9b367d15f4758e4f3f3378ff0fd443708d1c64854e07588ea5331823ae"}, - * "mac":"410544c8307e3691fda305eb3722d82c3431f212a87daa119a21587d96698b57"}}' - * ] - * ``` - */ - encrypt(password, options) { - return __awaiter10(this, void 0, void 0, function* () { - return Promise.all(this.map((account) => __awaiter10(this, void 0, void 0, function* () { - return account.encrypt(password, options); - }))); - }); - } - /** - * Decrypts keystore v3 objects. - * - * @param encryptedWallets - An array of encrypted keystore v3 objects to decrypt - * @param password - The password to encrypt with - * @param options - decrypt options for the wallets - * @returns The decrypted wallet object - * - * ```ts - * web3.eth.accounts.wallet.decrypt([ - * { version: 3, - * id: '83191a81-aaca-451f-b63d-0c5f3b849289', - * address: '06f702337909c06c82b09b7a22f0a2f0855d1f68', - * crypto: - * { ciphertext: '7d34deae112841fba86e3e6cf08f5398dda323a8e4d29332621534e2c4069e8d', - * cipherparams: { iv: '497f4d26997a84d570778eae874b2333' }, - * cipher: 'aes-128-ctr', - * kdf: 'scrypt', - * kdfparams: - * { dklen: 32, - * salt: '208dd732a27aa4803bb760228dff18515d5313fd085bbce60594a3919ae2d88d', - * n: 262144, - * r: 8, - * p: 1 }, - * mac: '0062a853de302513c57bfe3108ab493733034bf3cb313326f42cf26ea2619cf9' } }, - * { version: 3, - * id: '7d6b91fa-3611-407b-b16b-396efb28f97e', - * address: 'b5d89661b59a9af0b34f58d19138baa2de48baaf', - * crypto: - * { ciphertext: 'cb9712d1982ff89f571fa5dbef447f14b7e5f142232bd2a913aac833730eeb43', - * cipherparams: { iv: '8cccb91cb84e435437f7282ec2ffd2db' }, - * cipher: 'aes-128-ctr', - * kdf: 'scrypt', - * kdfparams: - * { dklen: 32, - * salt: '08ba6736363c5586434cd5b895e6fe41ea7db4785bd9b901dedce77a1514e8b8', - * n: 262144, - * r: 8, - * p: 1 }, - * mac: 'd2eb068b37e2df55f56fa97a2bf4f55e072bef0dd703bfd917717d9dc54510f0' } } - * ], 'test').then(console.log) - * > Wallet { - * _accountProvider: { - * create: [Function: create], - * privateKeyToAccount: [Function: privateKeyToAccount], - * decrypt: [Function: decrypt] - * }, - * _defaultKeyName: 'web3js_wallet', - * _accounts: { - * '0x85d70633b90e03e0276b98880286d0d055685ed7': { - * address: '0x85D70633b90e03e0276B98880286D0D055685ed7', - * privateKey: '0xbce9b59981303e76c4878b1a6d7b088ec6b9dd5c966b7d5f54d7a749ff683387', - * signTransaction: [Function: signTransaction], - * sign: [Function: sign], - * encrypt: [Function: encrypt] - * }, - * '0x06f702337909c06c82b09b7a22f0a2f0855d1f68': { - * address: '0x06F702337909C06C82B09B7A22F0a2f0855d1F68', - * privateKey: '87a51da18900da7398b3bab03996833138f269f8f66dd1237b98df6b9ce14573', - * signTransaction: [Function: signTransaction], - * sign: [Function: sign], - * encrypt: [Function: encrypt] - * }, - * '0xb5d89661b59a9af0b34f58d19138baa2de48baaf': { - * address: '0xB5d89661B59a9aF0b34f58D19138bAa2de48BAaf', - * privateKey: '7ee61c5282979aae9dd795bb6a54e8bdc2bfe009acb64eb9a67322eec3b3da6e', - * signTransaction: [Function: signTransaction], - * sign: [Function: sign], - * encrypt: [Function: encrypt] - * } - * } - * } - * ``` - */ - decrypt(encryptedWallets, password, options) { - return __awaiter10(this, void 0, void 0, function* () { - const results = yield Promise.all(encryptedWallets.map((wallet) => __awaiter10(this, void 0, void 0, function* () { - return this._accountProvider.decrypt(wallet, password, options); - }))); - for (const res of results) { - this.add(res); - } - return this; - }); - } - /** - * Stores the wallet encrypted and as string in local storage. - * **__NOTE:__** Browser only - * - * @param password - The password to encrypt the wallet - * @param keyName - (optional) The key used for the local storage position, defaults to `"web3js_wallet"`. - * @returns Will return boolean value true if saved properly - * ```ts - * web3.eth.accounts.wallet.save('test#!$'); - * >true - * ``` - */ - save(password, keyName) { - return __awaiter10(this, void 0, void 0, function* () { - const storage = _Wallet.getStorage(); - if (!storage) { - throw new Error("Local storage not available."); - } - storage.setItem(keyName !== null && keyName !== void 0 ? keyName : this._defaultKeyName, JSON.stringify(yield this.encrypt(password))); - return true; - }); - } - /** - * Loads a wallet from local storage and decrypts it. - * **__NOTE:__** Browser only - * - * @param password - The password to decrypt the wallet. - * @param keyName - (optional)The key used for local storage position, defaults to `web3js_wallet"` - * @returns Returns the wallet object - * - * ```ts - * web3.eth.accounts.wallet.save('test#!$'); - * > true - * web3.eth.accounts.wallet.load('test#!$'); - * { defaultKeyName: "web3js_wallet", - * length: 0, - * _accounts: Accounts {_requestManager: RequestManager, givenProvider: Proxy, providers: {…}, _provider: WebsocketProvider, …}, - * [[Prototype]]: Object - * } - * ``` - */ - load(password, keyName) { - return __awaiter10(this, void 0, void 0, function* () { - const storage = _Wallet.getStorage(); - if (!storage) { - throw new Error("Local storage not available."); - } - const keystore = storage.getItem(keyName !== null && keyName !== void 0 ? keyName : this._defaultKeyName); - if (keystore) { - yield this.decrypt(JSON.parse(keystore) || [], password); - } - return this; - }); - } -}; - -// node_modules/ethereum-cryptography/esm/aes.js -var crypto3 = { web: crypto }; -function validateOpt(key, iv, mode) { - if (!mode.startsWith("aes-")) { - throw new Error(`AES submodule doesn't support mode ${mode}`); - } - if (iv.length !== 16) { - throw new Error("AES: wrong IV length"); - } - if (mode.startsWith("aes-128") && key.length !== 16 || mode.startsWith("aes-256") && key.length !== 32) { - throw new Error("AES: wrong key length"); - } -} -async function getBrowserKey(mode, key, iv) { - if (!crypto3.web) { - throw new Error("Browser crypto not available."); - } - let keyMode; - if (["aes-128-cbc", "aes-256-cbc"].includes(mode)) { - keyMode = "cbc"; - } - if (["aes-128-ctr", "aes-256-ctr"].includes(mode)) { - keyMode = "ctr"; - } - if (!keyMode) { - throw new Error("AES: unsupported mode"); - } - const wKey = await crypto3.web.subtle.importKey("raw", key, { name: `AES-${keyMode.toUpperCase()}`, length: key.length * 8 }, true, ["encrypt", "decrypt"]); - return [wKey, { name: `aes-${keyMode}`, iv, counter: iv, length: 128 }]; -} -async function encrypt(msg, key, iv, mode = "aes-128-ctr", pkcs7PaddingEnabled = true) { - validateOpt(key, iv, mode); - if (crypto3.web) { - const [wKey, wOpt] = await getBrowserKey(mode, key, iv); - const cipher = await crypto3.web.subtle.encrypt(wOpt, wKey, msg); - let res = new Uint8Array(cipher); - if (!pkcs7PaddingEnabled && wOpt.name === "aes-cbc" && !(msg.length % 16)) { - res = res.slice(0, -16); - } - return res; - } else if (crypto3.node) { - const cipher = crypto3.node.createCipheriv(mode, key, iv); - cipher.setAutoPadding(pkcs7PaddingEnabled); - return concatBytes(cipher.update(msg), cipher.final()); - } else { - throw new Error("The environment doesn't have AES module"); - } -} -async function getPadding(cypherText, key, iv, mode) { - const lastBlock = cypherText.slice(-16); - for (let i = 0; i < 16; i++) { - lastBlock[i] ^= iv[i] ^ 16; - } - const res = await encrypt(lastBlock, key, iv, mode); - return res.slice(0, 16); -} -async function decrypt(cypherText, key, iv, mode = "aes-128-ctr", pkcs7PaddingEnabled = true) { - validateOpt(key, iv, mode); - if (crypto3.web) { - const [wKey, wOpt] = await getBrowserKey(mode, key, iv); - if (!pkcs7PaddingEnabled && wOpt.name === "aes-cbc") { - const padding = await getPadding(cypherText, key, iv, mode); - cypherText = concatBytes(cypherText, padding); - } - const msg = await crypto3.web.subtle.decrypt(wOpt, wKey, cypherText); - const msgBytes = new Uint8Array(msg); - if (wOpt.name === "aes-cbc") { - const encrypted = await encrypt(msgBytes, key, iv, mode); - if (!equalsBytes(encrypted, cypherText)) { - throw new Error("AES: wrong padding"); - } - } - return msgBytes; - } else if (crypto3.node) { - const decipher = crypto3.node.createDecipheriv(mode, key, iv); - decipher.setAutoPadding(pkcs7PaddingEnabled); - return concatBytes(decipher.update(cypherText), decipher.final()); - } else { - throw new Error("The environment doesn't have AES module"); - } -} - -// node_modules/@noble/hashes/esm/hmac.js -var HMAC = class extends Hash { - constructor(hash2, _key) { - super(); - this.finished = false; - this.destroyed = false; - hash(hash2); - const key = toBytes(_key); - this.iHash = hash2.create(); - if (typeof this.iHash.update !== "function") - throw new Error("Expected instance of class which extends utils.Hash"); - this.blockLen = this.iHash.blockLen; - this.outputLen = this.iHash.outputLen; - const blockLen = this.blockLen; - const pad = new Uint8Array(blockLen); - pad.set(key.length > blockLen ? hash2.create().update(key).digest() : key); - for (let i = 0; i < pad.length; i++) - pad[i] ^= 54; - this.iHash.update(pad); - this.oHash = hash2.create(); - for (let i = 0; i < pad.length; i++) - pad[i] ^= 54 ^ 92; - this.oHash.update(pad); - pad.fill(0); - } - update(buf) { - exists(this); - this.iHash.update(buf); - return this; - } - digestInto(out) { - exists(this); - bytes(out, this.outputLen); - this.finished = true; - this.iHash.digestInto(out); - this.oHash.update(out); - this.oHash.digestInto(out); - this.destroy(); - } - digest() { - const out = new Uint8Array(this.oHash.outputLen); - this.digestInto(out); - return out; - } - _cloneInto(to) { - to || (to = Object.create(Object.getPrototypeOf(this), {})); - const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this; - to = to; - to.finished = finished; - to.destroyed = destroyed; - to.blockLen = blockLen; - to.outputLen = outputLen; - to.oHash = oHash._cloneInto(to.oHash); - to.iHash = iHash._cloneInto(to.iHash); - return to; - } - destroy() { - this.destroyed = true; - this.oHash.destroy(); - this.iHash.destroy(); - } -}; -var hmac = (hash2, key, message) => new HMAC(hash2, key).update(message).digest(); -hmac.create = (hash2, key) => new HMAC(hash2, key); - -// node_modules/@noble/hashes/esm/pbkdf2.js -function pbkdf2Init(hash2, _password, _salt, _opts) { - hash(hash2); - const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts); - const { c, dkLen, asyncTick } = opts; - number(c); - number(dkLen); - number(asyncTick); - if (c < 1) - throw new Error("PBKDF2: iterations (c) should be >= 1"); - const password = toBytes(_password); - const salt = toBytes(_salt); - const DK = new Uint8Array(dkLen); - const PRF = hmac.create(hash2, password); - const PRFSalt = PRF._cloneInto().update(salt); - return { c, dkLen, asyncTick, DK, PRF, PRFSalt }; -} -function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) { - PRF.destroy(); - PRFSalt.destroy(); - if (prfW) - prfW.destroy(); - u.fill(0); - return DK; -} -function pbkdf2(hash2, password, salt, opts) { - const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash2, password, salt, opts); - let prfW; - const arr = new Uint8Array(4); - const view = createView(arr); - const u = new Uint8Array(PRF.outputLen); - for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { - const Ti = DK.subarray(pos, pos + PRF.outputLen); - view.setInt32(0, ti, false); - (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); - Ti.set(u.subarray(0, Ti.length)); - for (let ui = 1; ui < c; ui++) { - PRF._cloneInto(prfW).update(u).digestInto(u); - for (let i = 0; i < Ti.length; i++) - Ti[i] ^= u[i]; - } - } - return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); -} - -// node_modules/@noble/hashes/esm/_sha2.js -function setBigUint64(view, byteOffset, value, isLE2) { - if (typeof view.setBigUint64 === "function") - return view.setBigUint64(byteOffset, value, isLE2); - const _32n2 = BigInt(32); - const _u32_max = BigInt(4294967295); - const wh = Number(value >> _32n2 & _u32_max); - const wl = Number(value & _u32_max); - const h = isLE2 ? 4 : 0; - const l = isLE2 ? 0 : 4; - view.setUint32(byteOffset + h, wh, isLE2); - view.setUint32(byteOffset + l, wl, isLE2); -} -var SHA2 = class extends Hash { - constructor(blockLen, outputLen, padOffset, isLE2) { - super(); - this.blockLen = blockLen; - this.outputLen = outputLen; - this.padOffset = padOffset; - this.isLE = isLE2; - this.finished = false; - this.length = 0; - this.pos = 0; - this.destroyed = false; - this.buffer = new Uint8Array(blockLen); - this.view = createView(this.buffer); - } - update(data) { - exists(this); - const { view, buffer, blockLen } = this; - data = toBytes(data); - const len = data.length; - for (let pos = 0; pos < len; ) { - const take = Math.min(blockLen - this.pos, len - pos); - if (take === blockLen) { - const dataView = createView(data); - for (; blockLen <= len - pos; pos += blockLen) - this.process(dataView, pos); - continue; - } - buffer.set(data.subarray(pos, pos + take), this.pos); - this.pos += take; - pos += take; - if (this.pos === blockLen) { - this.process(view, 0); - this.pos = 0; - } - } - this.length += data.length; - this.roundClean(); - return this; - } - digestInto(out) { - exists(this); - output(out, this); - this.finished = true; - const { buffer, view, blockLen, isLE: isLE2 } = this; - let { pos } = this; - buffer[pos++] = 128; - this.buffer.subarray(pos).fill(0); - if (this.padOffset > blockLen - pos) { - this.process(view, 0); - pos = 0; - } - for (let i = pos; i < blockLen; i++) - buffer[i] = 0; - setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2); - this.process(view, 0); - const oview = createView(out); - const len = this.outputLen; - if (len % 4) - throw new Error("_sha2: outputLen should be aligned to 32bit"); - const outLen = len / 4; - const state = this.get(); - if (outLen > state.length) - throw new Error("_sha2: outputLen bigger than state"); - for (let i = 0; i < outLen; i++) - oview.setUint32(4 * i, state[i], isLE2); - } - digest() { - const { buffer, outputLen } = this; - this.digestInto(buffer); - const res = buffer.slice(0, outputLen); - this.destroy(); - return res; - } - _cloneInto(to) { - to || (to = new this.constructor()); - to.set(...this.get()); - const { blockLen, buffer, length, finished, destroyed, pos } = this; - to.length = length; - to.pos = pos; - to.finished = finished; - to.destroyed = destroyed; - if (length % blockLen) - to.buffer.set(buffer); - return to; - } -}; - -// node_modules/@noble/hashes/esm/sha256.js -var Chi = (a, b, c) => a & b ^ ~a & c; -var Maj = (a, b, c) => a & b ^ a & c ^ b & c; -var SHA256_K = new Uint32Array([ - 1116352408, - 1899447441, - 3049323471, - 3921009573, - 961987163, - 1508970993, - 2453635748, - 2870763221, - 3624381080, - 310598401, - 607225278, - 1426881987, - 1925078388, - 2162078206, - 2614888103, - 3248222580, - 3835390401, - 4022224774, - 264347078, - 604807628, - 770255983, - 1249150122, - 1555081692, - 1996064986, - 2554220882, - 2821834349, - 2952996808, - 3210313671, - 3336571891, - 3584528711, - 113926993, - 338241895, - 666307205, - 773529912, - 1294757372, - 1396182291, - 1695183700, - 1986661051, - 2177026350, - 2456956037, - 2730485921, - 2820302411, - 3259730800, - 3345764771, - 3516065817, - 3600352804, - 4094571909, - 275423344, - 430227734, - 506948616, - 659060556, - 883997877, - 958139571, - 1322822218, - 1537002063, - 1747873779, - 1955562222, - 2024104815, - 2227730452, - 2361852424, - 2428436474, - 2756734187, - 3204031479, - 3329325298 -]); -var IV = new Uint32Array([ - 1779033703, - 3144134277, - 1013904242, - 2773480762, - 1359893119, - 2600822924, - 528734635, - 1541459225 -]); -var SHA256_W = new Uint32Array(64); -var SHA256 = class extends SHA2 { - constructor() { - super(64, 32, 8, false); - this.A = IV[0] | 0; - this.B = IV[1] | 0; - this.C = IV[2] | 0; - this.D = IV[3] | 0; - this.E = IV[4] | 0; - this.F = IV[5] | 0; - this.G = IV[6] | 0; - this.H = IV[7] | 0; - } - get() { - const { A, B, C, D, E, F, G, H } = this; - return [A, B, C, D, E, F, G, H]; - } - // prettier-ignore - set(A, B, C, D, E, F, G, H) { - this.A = A | 0; - this.B = B | 0; - this.C = C | 0; - this.D = D | 0; - this.E = E | 0; - this.F = F | 0; - this.G = G | 0; - this.H = H | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) - SHA256_W[i] = view.getUint32(offset, false); - for (let i = 16; i < 64; i++) { - const W15 = SHA256_W[i - 15]; - const W2 = SHA256_W[i - 2]; - const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3; - const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10; - SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0; - } - let { A, B, C, D, E, F, G, H } = this; - for (let i = 0; i < 64; i++) { - const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25); - const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0; - const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22); - const T2 = sigma0 + Maj(A, B, C) | 0; - H = G; - G = F; - F = E; - E = D + T1 | 0; - D = C; - C = B; - B = A; - A = T1 + T2 | 0; - } - A = A + this.A | 0; - B = B + this.B | 0; - C = C + this.C | 0; - D = D + this.D | 0; - E = E + this.E | 0; - F = F + this.F | 0; - G = G + this.G | 0; - H = H + this.H | 0; - this.set(A, B, C, D, E, F, G, H); - } - roundClean() { - SHA256_W.fill(0); - } - destroy() { - this.set(0, 0, 0, 0, 0, 0, 0, 0); - this.buffer.fill(0); - } -}; -var SHA224 = class extends SHA256 { - constructor() { - super(); - this.A = 3238371032 | 0; - this.B = 914150663 | 0; - this.C = 812702999 | 0; - this.D = 4144912697 | 0; - this.E = 4290775857 | 0; - this.F = 1750603025 | 0; - this.G = 1694076839 | 0; - this.H = 3204075428 | 0; - this.outputLen = 28; - } -}; -var sha256 = wrapConstructor(() => new SHA256()); -var sha224 = wrapConstructor(() => new SHA224()); - -// node_modules/@noble/hashes/esm/sha512.js -var [SHA512_Kh, SHA512_Kl] = (() => u64_default.split([ - "0x428a2f98d728ae22", - "0x7137449123ef65cd", - "0xb5c0fbcfec4d3b2f", - "0xe9b5dba58189dbbc", - "0x3956c25bf348b538", - "0x59f111f1b605d019", - "0x923f82a4af194f9b", - "0xab1c5ed5da6d8118", - "0xd807aa98a3030242", - "0x12835b0145706fbe", - "0x243185be4ee4b28c", - "0x550c7dc3d5ffb4e2", - "0x72be5d74f27b896f", - "0x80deb1fe3b1696b1", - "0x9bdc06a725c71235", - "0xc19bf174cf692694", - "0xe49b69c19ef14ad2", - "0xefbe4786384f25e3", - "0x0fc19dc68b8cd5b5", - "0x240ca1cc77ac9c65", - "0x2de92c6f592b0275", - "0x4a7484aa6ea6e483", - "0x5cb0a9dcbd41fbd4", - "0x76f988da831153b5", - "0x983e5152ee66dfab", - "0xa831c66d2db43210", - "0xb00327c898fb213f", - "0xbf597fc7beef0ee4", - "0xc6e00bf33da88fc2", - "0xd5a79147930aa725", - "0x06ca6351e003826f", - "0x142929670a0e6e70", - "0x27b70a8546d22ffc", - "0x2e1b21385c26c926", - "0x4d2c6dfc5ac42aed", - "0x53380d139d95b3df", - "0x650a73548baf63de", - "0x766a0abb3c77b2a8", - "0x81c2c92e47edaee6", - "0x92722c851482353b", - "0xa2bfe8a14cf10364", - "0xa81a664bbc423001", - "0xc24b8b70d0f89791", - "0xc76c51a30654be30", - "0xd192e819d6ef5218", - "0xd69906245565a910", - "0xf40e35855771202a", - "0x106aa07032bbd1b8", - "0x19a4c116b8d2d0c8", - "0x1e376c085141ab53", - "0x2748774cdf8eeb99", - "0x34b0bcb5e19b48a8", - "0x391c0cb3c5c95a63", - "0x4ed8aa4ae3418acb", - "0x5b9cca4f7763e373", - "0x682e6ff3d6b2b8a3", - "0x748f82ee5defb2fc", - "0x78a5636f43172f60", - "0x84c87814a1f0ab72", - "0x8cc702081a6439ec", - "0x90befffa23631e28", - "0xa4506cebde82bde9", - "0xbef9a3f7b2c67915", - "0xc67178f2e372532b", - "0xca273eceea26619c", - "0xd186b8c721c0c207", - "0xeada7dd6cde0eb1e", - "0xf57d4f7fee6ed178", - "0x06f067aa72176fba", - "0x0a637dc5a2c898a6", - "0x113f9804bef90dae", - "0x1b710b35131c471b", - "0x28db77f523047d84", - "0x32caab7b40c72493", - "0x3c9ebe0a15c9bebc", - "0x431d67c49c100d4c", - "0x4cc5d4becb3e42b6", - "0x597f299cfc657e2a", - "0x5fcb6fab3ad6faec", - "0x6c44198c4a475817" -].map((n) => BigInt(n))))(); -var SHA512_W_H = new Uint32Array(80); -var SHA512_W_L = new Uint32Array(80); -var SHA512 = class extends SHA2 { - constructor() { - super(128, 64, 16, false); - this.Ah = 1779033703 | 0; - this.Al = 4089235720 | 0; - this.Bh = 3144134277 | 0; - this.Bl = 2227873595 | 0; - this.Ch = 1013904242 | 0; - this.Cl = 4271175723 | 0; - this.Dh = 2773480762 | 0; - this.Dl = 1595750129 | 0; - this.Eh = 1359893119 | 0; - this.El = 2917565137 | 0; - this.Fh = 2600822924 | 0; - this.Fl = 725511199 | 0; - this.Gh = 528734635 | 0; - this.Gl = 4215389547 | 0; - this.Hh = 1541459225 | 0; - this.Hl = 327033209 | 0; - } - // prettier-ignore - get() { - const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl]; - } - // prettier-ignore - set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) { - this.Ah = Ah | 0; - this.Al = Al | 0; - this.Bh = Bh | 0; - this.Bl = Bl | 0; - this.Ch = Ch | 0; - this.Cl = Cl | 0; - this.Dh = Dh | 0; - this.Dl = Dl | 0; - this.Eh = Eh | 0; - this.El = El | 0; - this.Fh = Fh | 0; - this.Fl = Fl | 0; - this.Gh = Gh | 0; - this.Gl = Gl | 0; - this.Hh = Hh | 0; - this.Hl = Hl | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) { - SHA512_W_H[i] = view.getUint32(offset); - SHA512_W_L[i] = view.getUint32(offset += 4); - } - for (let i = 16; i < 80; i++) { - const W15h = SHA512_W_H[i - 15] | 0; - const W15l = SHA512_W_L[i - 15] | 0; - const s0h = u64_default.rotrSH(W15h, W15l, 1) ^ u64_default.rotrSH(W15h, W15l, 8) ^ u64_default.shrSH(W15h, W15l, 7); - const s0l = u64_default.rotrSL(W15h, W15l, 1) ^ u64_default.rotrSL(W15h, W15l, 8) ^ u64_default.shrSL(W15h, W15l, 7); - const W2h = SHA512_W_H[i - 2] | 0; - const W2l = SHA512_W_L[i - 2] | 0; - const s1h = u64_default.rotrSH(W2h, W2l, 19) ^ u64_default.rotrBH(W2h, W2l, 61) ^ u64_default.shrSH(W2h, W2l, 6); - const s1l = u64_default.rotrSL(W2h, W2l, 19) ^ u64_default.rotrBL(W2h, W2l, 61) ^ u64_default.shrSL(W2h, W2l, 6); - const SUMl = u64_default.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]); - const SUMh = u64_default.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]); - SHA512_W_H[i] = SUMh | 0; - SHA512_W_L[i] = SUMl | 0; - } - let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - for (let i = 0; i < 80; i++) { - const sigma1h = u64_default.rotrSH(Eh, El, 14) ^ u64_default.rotrSH(Eh, El, 18) ^ u64_default.rotrBH(Eh, El, 41); - const sigma1l = u64_default.rotrSL(Eh, El, 14) ^ u64_default.rotrSL(Eh, El, 18) ^ u64_default.rotrBL(Eh, El, 41); - const CHIh = Eh & Fh ^ ~Eh & Gh; - const CHIl = El & Fl ^ ~El & Gl; - const T1ll = u64_default.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]); - const T1h = u64_default.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]); - const T1l = T1ll | 0; - const sigma0h = u64_default.rotrSH(Ah, Al, 28) ^ u64_default.rotrBH(Ah, Al, 34) ^ u64_default.rotrBH(Ah, Al, 39); - const sigma0l = u64_default.rotrSL(Ah, Al, 28) ^ u64_default.rotrBL(Ah, Al, 34) ^ u64_default.rotrBL(Ah, Al, 39); - const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch; - const MAJl = Al & Bl ^ Al & Cl ^ Bl & Cl; - Hh = Gh | 0; - Hl = Gl | 0; - Gh = Fh | 0; - Gl = Fl | 0; - Fh = Eh | 0; - Fl = El | 0; - ({ h: Eh, l: El } = u64_default.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0)); - Dh = Ch | 0; - Dl = Cl | 0; - Ch = Bh | 0; - Cl = Bl | 0; - Bh = Ah | 0; - Bl = Al | 0; - const All = u64_default.add3L(T1l, sigma0l, MAJl); - Ah = u64_default.add3H(All, T1h, sigma0h, MAJh); - Al = All | 0; - } - ({ h: Ah, l: Al } = u64_default.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0)); - ({ h: Bh, l: Bl } = u64_default.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0)); - ({ h: Ch, l: Cl } = u64_default.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0)); - ({ h: Dh, l: Dl } = u64_default.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0)); - ({ h: Eh, l: El } = u64_default.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0)); - ({ h: Fh, l: Fl } = u64_default.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0)); - ({ h: Gh, l: Gl } = u64_default.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0)); - ({ h: Hh, l: Hl } = u64_default.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0)); - this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl); - } - roundClean() { - SHA512_W_H.fill(0); - SHA512_W_L.fill(0); - } - destroy() { - this.buffer.fill(0); - this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - } -}; -var SHA512_224 = class extends SHA512 { - constructor() { - super(); - this.Ah = 2352822216 | 0; - this.Al = 424955298 | 0; - this.Bh = 1944164710 | 0; - this.Bl = 2312950998 | 0; - this.Ch = 502970286 | 0; - this.Cl = 855612546 | 0; - this.Dh = 1738396948 | 0; - this.Dl = 1479516111 | 0; - this.Eh = 258812777 | 0; - this.El = 2077511080 | 0; - this.Fh = 2011393907 | 0; - this.Fl = 79989058 | 0; - this.Gh = 1067287976 | 0; - this.Gl = 1780299464 | 0; - this.Hh = 286451373 | 0; - this.Hl = 2446758561 | 0; - this.outputLen = 28; - } -}; -var SHA512_256 = class extends SHA512 { - constructor() { - super(); - this.Ah = 573645204 | 0; - this.Al = 4230739756 | 0; - this.Bh = 2673172387 | 0; - this.Bl = 3360449730 | 0; - this.Ch = 596883563 | 0; - this.Cl = 1867755857 | 0; - this.Dh = 2520282905 | 0; - this.Dl = 1497426621 | 0; - this.Eh = 2519219938 | 0; - this.El = 2827943907 | 0; - this.Fh = 3193839141 | 0; - this.Fl = 1401305490 | 0; - this.Gh = 721525244 | 0; - this.Gl = 746961066 | 0; - this.Hh = 246885852 | 0; - this.Hl = 2177182882 | 0; - this.outputLen = 32; - } -}; -var SHA384 = class extends SHA512 { - constructor() { - super(); - this.Ah = 3418070365 | 0; - this.Al = 3238371032 | 0; - this.Bh = 1654270250 | 0; - this.Bl = 914150663 | 0; - this.Ch = 2438529370 | 0; - this.Cl = 812702999 | 0; - this.Dh = 355462360 | 0; - this.Dl = 4144912697 | 0; - this.Eh = 1731405415 | 0; - this.El = 4290775857 | 0; - this.Fh = 2394180231 | 0; - this.Fl = 1750603025 | 0; - this.Gh = 3675008525 | 0; - this.Gl = 1694076839 | 0; - this.Hh = 1203062813 | 0; - this.Hl = 3204075428 | 0; - this.outputLen = 48; - } -}; -var sha512 = wrapConstructor(() => new SHA512()); -var sha512_224 = wrapConstructor(() => new SHA512_224()); -var sha512_256 = wrapConstructor(() => new SHA512_256()); -var sha384 = wrapConstructor(() => new SHA384()); - -// node_modules/ethereum-cryptography/esm/pbkdf2.js -function pbkdf2Sync(password, salt, iterations, keylen, digest) { - if (!["sha256", "sha512"].includes(digest)) { - throw new Error("Only sha256 and sha512 are supported"); - } - assertBytes(password); - assertBytes(salt); - return pbkdf2(digest === "sha256" ? sha256 : sha512, password, salt, { - c: iterations, - dkLen: keylen - }); -} - -// node_modules/@noble/hashes/esm/scrypt.js -var rotl = (a, b) => a << b | a >>> 32 - b; -function XorAndSalsa(prev, pi, input, ii, out, oi) { - let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++]; - let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++]; - let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++]; - let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++]; - let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++]; - let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++]; - let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++]; - let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++]; - let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15; - for (let i = 0; i < 8; i += 2) { - x04 ^= rotl(x00 + x12 | 0, 7); - x08 ^= rotl(x04 + x00 | 0, 9); - x12 ^= rotl(x08 + x04 | 0, 13); - x00 ^= rotl(x12 + x08 | 0, 18); - x09 ^= rotl(x05 + x01 | 0, 7); - x13 ^= rotl(x09 + x05 | 0, 9); - x01 ^= rotl(x13 + x09 | 0, 13); - x05 ^= rotl(x01 + x13 | 0, 18); - x14 ^= rotl(x10 + x06 | 0, 7); - x02 ^= rotl(x14 + x10 | 0, 9); - x06 ^= rotl(x02 + x14 | 0, 13); - x10 ^= rotl(x06 + x02 | 0, 18); - x03 ^= rotl(x15 + x11 | 0, 7); - x07 ^= rotl(x03 + x15 | 0, 9); - x11 ^= rotl(x07 + x03 | 0, 13); - x15 ^= rotl(x11 + x07 | 0, 18); - x01 ^= rotl(x00 + x03 | 0, 7); - x02 ^= rotl(x01 + x00 | 0, 9); - x03 ^= rotl(x02 + x01 | 0, 13); - x00 ^= rotl(x03 + x02 | 0, 18); - x06 ^= rotl(x05 + x04 | 0, 7); - x07 ^= rotl(x06 + x05 | 0, 9); - x04 ^= rotl(x07 + x06 | 0, 13); - x05 ^= rotl(x04 + x07 | 0, 18); - x11 ^= rotl(x10 + x09 | 0, 7); - x08 ^= rotl(x11 + x10 | 0, 9); - x09 ^= rotl(x08 + x11 | 0, 13); - x10 ^= rotl(x09 + x08 | 0, 18); - x12 ^= rotl(x15 + x14 | 0, 7); - x13 ^= rotl(x12 + x15 | 0, 9); - x14 ^= rotl(x13 + x12 | 0, 13); - x15 ^= rotl(x14 + x13 | 0, 18); - } - out[oi++] = y00 + x00 | 0; - out[oi++] = y01 + x01 | 0; - out[oi++] = y02 + x02 | 0; - out[oi++] = y03 + x03 | 0; - out[oi++] = y04 + x04 | 0; - out[oi++] = y05 + x05 | 0; - out[oi++] = y06 + x06 | 0; - out[oi++] = y07 + x07 | 0; - out[oi++] = y08 + x08 | 0; - out[oi++] = y09 + x09 | 0; - out[oi++] = y10 + x10 | 0; - out[oi++] = y11 + x11 | 0; - out[oi++] = y12 + x12 | 0; - out[oi++] = y13 + x13 | 0; - out[oi++] = y14 + x14 | 0; - out[oi++] = y15 + x15 | 0; -} -function BlockMix(input, ii, out, oi, r) { - let head = oi + 0; - let tail = oi + 16 * r; - for (let i = 0; i < 16; i++) - out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; - for (let i = 0; i < r; i++, head += 16, ii += 16) { - XorAndSalsa(out, tail, input, ii, out, head); - if (i > 0) - tail += 16; - XorAndSalsa(out, head, input, ii += 16, out, tail); - } -} -function scryptInit(password, salt, _opts) { - const opts = checkOpts({ - dkLen: 32, - asyncTick: 10, - maxmem: 1024 ** 3 + 1024 - }, _opts); - const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts; - number(N); - number(r); - number(p); - number(dkLen); - number(asyncTick); - number(maxmem); - if (onProgress !== void 0 && typeof onProgress !== "function") - throw new Error("progressCb should be function"); - const blockSize = 128 * r; - const blockSize32 = blockSize / 4; - if (N <= 1 || (N & N - 1) !== 0 || N >= 2 ** (blockSize / 8) || N > 2 ** 32) { - throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32"); - } - if (p < 0 || p > (2 ** 32 - 1) * 32 / blockSize) { - throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)"); - } - if (dkLen < 0 || dkLen > (2 ** 32 - 1) * 32) { - throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32"); - } - const memUsed = blockSize * (N + p); - if (memUsed > maxmem) { - throw new Error(`Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)`); - } - const B = pbkdf2(sha256, password, salt, { c: 1, dkLen: blockSize * p }); - const B32 = u32(B); - const V = u32(new Uint8Array(blockSize * N)); - const tmp = u32(new Uint8Array(blockSize)); - let blockMixCb = () => { - }; - if (onProgress) { - const totalBlockMix = 2 * N * p; - const callbackPer = Math.max(Math.floor(totalBlockMix / 1e4), 1); - let blockMixCnt = 0; - blockMixCb = () => { - blockMixCnt++; - if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix)) - onProgress(blockMixCnt / totalBlockMix); - }; - } - return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick }; -} -function scryptOutput(password, dkLen, B, V, tmp) { - const res = pbkdf2(sha256, password, B, { c: 1, dkLen }); - B.fill(0); - V.fill(0); - tmp.fill(0); - return res; -} -function scrypt(password, salt, opts) { - const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(password, salt, opts); - for (let pi = 0; pi < p; pi++) { - const Pi = blockSize32 * pi; - for (let i = 0; i < blockSize32; i++) - V[i] = B32[Pi + i]; - for (let i = 0, pos = 0; i < N - 1; i++) { - BlockMix(V, pos, V, pos += blockSize32, r); - blockMixCb(); - } - BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); - blockMixCb(); - for (let i = 0; i < N; i++) { - const j = B32[Pi + blockSize32 - 16] % N; - for (let k = 0; k < blockSize32; k++) - tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; - BlockMix(tmp, 0, B32, Pi, r); - blockMixCb(); - } - } - return scryptOutput(password, dkLen, B, V, tmp); -} - -// node_modules/ethereum-cryptography/esm/scrypt.js -function scryptSync(password, salt, n, p, r, dkLen, onProgress) { - assertBytes(password); - assertBytes(salt); - return scrypt(password, salt, { N: n, r, p, dkLen, onProgress }); -} - -// node_modules/ethereum-cryptography/esm/secp256k1.js -var secp256k1_exports = {}; -__export(secp256k1_exports, { - secp256k1: () => secp256k1 -}); - -// node_modules/@noble/curves/esm/abstract/utils.js -var utils_exports2 = {}; -__export(utils_exports2, { - bitGet: () => bitGet, - bitLen: () => bitLen, - bitMask: () => bitMask, - bitSet: () => bitSet, - bytesToHex: () => bytesToHex3, - bytesToNumberBE: () => bytesToNumberBE, - bytesToNumberLE: () => bytesToNumberLE, - concatBytes: () => concatBytes2, - createHmacDrbg: () => createHmacDrbg, - ensureBytes: () => ensureBytes, - equalBytes: () => equalBytes, - hexToBytes: () => hexToBytes3, - hexToNumber: () => hexToNumber3, - isBytes: () => isBytes4, - numberToBytesBE: () => numberToBytesBE, - numberToBytesLE: () => numberToBytesLE, - numberToHexUnpadded: () => numberToHexUnpadded, - numberToVarBytesBE: () => numberToVarBytesBE, - utf8ToBytes: () => utf8ToBytes3, - validateObject: () => validateObject -}); -var _0n2 = BigInt(0); -var _1n2 = BigInt(1); -var _2n2 = BigInt(2); -function isBytes4(a) { - return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array"; -} -var hexes2 = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0")); -function bytesToHex3(bytes2) { - if (!isBytes4(bytes2)) - throw new Error("Uint8Array expected"); - let hex = ""; - for (let i = 0; i < bytes2.length; i++) { - hex += hexes2[bytes2[i]]; - } - return hex; -} -function numberToHexUnpadded(num) { - const hex = num.toString(16); - return hex.length & 1 ? `0${hex}` : hex; -} -function hexToNumber3(hex) { - if (typeof hex !== "string") - throw new Error("hex string expected, got " + typeof hex); - return BigInt(hex === "" ? "0" : `0x${hex}`); -} -var asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 }; -function asciiToBase16(char) { - if (char >= asciis._0 && char <= asciis._9) - return char - asciis._0; - if (char >= asciis._A && char <= asciis._F) - return char - (asciis._A - 10); - if (char >= asciis._a && char <= asciis._f) - return char - (asciis._a - 10); - return; -} -function hexToBytes3(hex) { - if (typeof hex !== "string") - throw new Error("hex string expected, got " + typeof hex); - const hl = hex.length; - const al = hl / 2; - if (hl % 2) - throw new Error("padded hex string expected, got unpadded hex of length " + hl); - const array = new Uint8Array(al); - for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) { - const n1 = asciiToBase16(hex.charCodeAt(hi)); - const n2 = asciiToBase16(hex.charCodeAt(hi + 1)); - if (n1 === void 0 || n2 === void 0) { - const char = hex[hi] + hex[hi + 1]; - throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi); - } - array[ai] = n1 * 16 + n2; - } - return array; -} -function bytesToNumberBE(bytes2) { - return hexToNumber3(bytesToHex3(bytes2)); -} -function bytesToNumberLE(bytes2) { - if (!isBytes4(bytes2)) - throw new Error("Uint8Array expected"); - return hexToNumber3(bytesToHex3(Uint8Array.from(bytes2).reverse())); -} -function numberToBytesBE(n, len) { - return hexToBytes3(n.toString(16).padStart(len * 2, "0")); -} -function numberToBytesLE(n, len) { - return numberToBytesBE(n, len).reverse(); -} -function numberToVarBytesBE(n) { - return hexToBytes3(numberToHexUnpadded(n)); -} -function ensureBytes(title, hex, expectedLength) { - let res; - if (typeof hex === "string") { - try { - res = hexToBytes3(hex); - } catch (e) { - throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`); - } - } else if (isBytes4(hex)) { - res = Uint8Array.from(hex); - } else { - throw new Error(`${title} must be hex string or Uint8Array`); - } - const len = res.length; - if (typeof expectedLength === "number" && len !== expectedLength) - throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`); - return res; -} -function concatBytes2(...arrays) { - let sum = 0; - for (let i = 0; i < arrays.length; i++) { - const a = arrays[i]; - if (!isBytes4(a)) - throw new Error("Uint8Array expected"); - sum += a.length; - } - let res = new Uint8Array(sum); - let pad = 0; - for (let i = 0; i < arrays.length; i++) { - const a = arrays[i]; - res.set(a, pad); - pad += a.length; - } - return res; -} -function equalBytes(a, b) { - if (a.length !== b.length) - return false; - let diff = 0; - for (let i = 0; i < a.length; i++) - diff |= a[i] ^ b[i]; - return diff === 0; -} -function utf8ToBytes3(str) { - if (typeof str !== "string") - throw new Error(`utf8ToBytes expected string, got ${typeof str}`); - return new Uint8Array(new TextEncoder().encode(str)); -} -function bitLen(n) { - let len; - for (len = 0; n > _0n2; n >>= _1n2, len += 1) - ; - return len; -} -function bitGet(n, pos) { - return n >> BigInt(pos) & _1n2; -} -var bitSet = (n, pos, value) => { - return n | (value ? _1n2 : _0n2) << BigInt(pos); -}; -var bitMask = (n) => (_2n2 << BigInt(n - 1)) - _1n2; -var u8n = (data) => new Uint8Array(data); -var u8fr = (arr) => Uint8Array.from(arr); -function createHmacDrbg(hashLen, qByteLen, hmacFn) { - if (typeof hashLen !== "number" || hashLen < 2) - throw new Error("hashLen must be a number"); - if (typeof qByteLen !== "number" || qByteLen < 2) - throw new Error("qByteLen must be a number"); - if (typeof hmacFn !== "function") - throw new Error("hmacFn must be a function"); - let v = u8n(hashLen); - let k = u8n(hashLen); - let i = 0; - const reset = () => { - v.fill(1); - k.fill(0); - i = 0; - }; - const h = (...b) => hmacFn(k, v, ...b); - const reseed = (seed = u8n()) => { - k = h(u8fr([0]), seed); - v = h(); - if (seed.length === 0) - return; - k = h(u8fr([1]), seed); - v = h(); - }; - const gen2 = () => { - if (i++ >= 1e3) - throw new Error("drbg: tried 1000 values"); - let len = 0; - const out = []; - while (len < qByteLen) { - v = h(); - const sl = v.slice(); - out.push(sl); - len += v.length; - } - return concatBytes2(...out); - }; - const genUntil = (seed, pred) => { - reset(); - reseed(seed); - let res = void 0; - while (!(res = pred(gen2()))) - reseed(); - reset(); - return res; - }; - return genUntil; -} -var validatorFns = { - bigint: (val) => typeof val === "bigint", - function: (val) => typeof val === "function", - boolean: (val) => typeof val === "boolean", - string: (val) => typeof val === "string", - stringOrUint8Array: (val) => typeof val === "string" || isBytes4(val), - isSafeInteger: (val) => Number.isSafeInteger(val), - array: (val) => Array.isArray(val), - field: (val, object) => object.Fp.isValid(val), - hash: (val) => typeof val === "function" && Number.isSafeInteger(val.outputLen) -}; -function validateObject(object, validators, optValidators = {}) { - const checkField = (fieldName, type, isOptional) => { - const checkVal = validatorFns[type]; - if (typeof checkVal !== "function") - throw new Error(`Invalid validator "${type}", expected function`); - const val = object[fieldName]; - if (isOptional && val === void 0) - return; - if (!checkVal(val, object)) { - throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`); - } - }; - for (const [fieldName, type] of Object.entries(validators)) - checkField(fieldName, type, false); - for (const [fieldName, type] of Object.entries(optValidators)) - checkField(fieldName, type, true); - return object; -} - -// node_modules/@noble/curves/esm/abstract/modular.js -var _0n3 = BigInt(0); -var _1n3 = BigInt(1); -var _2n3 = BigInt(2); -var _3n = BigInt(3); -var _4n = BigInt(4); -var _5n = BigInt(5); -var _8n = BigInt(8); -var _9n = BigInt(9); -var _16n = BigInt(16); -function mod(a, b) { - const result = a % b; - return result >= _0n3 ? result : b + result; -} -function pow(num, power, modulo) { - if (modulo <= _0n3 || power < _0n3) - throw new Error("Expected power/modulo > 0"); - if (modulo === _1n3) - return _0n3; - let res = _1n3; - while (power > _0n3) { - if (power & _1n3) - res = res * num % modulo; - num = num * num % modulo; - power >>= _1n3; - } - return res; -} -function pow2(x, power, modulo) { - let res = x; - while (power-- > _0n3) { - res *= res; - res %= modulo; - } - return res; -} -function invert(number2, modulo) { - if (number2 === _0n3 || modulo <= _0n3) { - throw new Error(`invert: expected positive integers, got n=${number2} mod=${modulo}`); - } - let a = mod(number2, modulo); - let b = modulo; - let x = _0n3, y = _1n3, u = _1n3, v = _0n3; - while (a !== _0n3) { - const q = b / a; - const r = b % a; - const m = x - u * q; - const n = y - v * q; - b = a, a = r, x = u, y = v, u = m, v = n; - } - const gcd = b; - if (gcd !== _1n3) - throw new Error("invert: does not exist"); - return mod(x, modulo); -} -function tonelliShanks(P) { - const legendreC = (P - _1n3) / _2n3; - let Q, S, Z; - for (Q = P - _1n3, S = 0; Q % _2n3 === _0n3; Q /= _2n3, S++) - ; - for (Z = _2n3; Z < P && pow(Z, legendreC, P) !== P - _1n3; Z++) - ; - if (S === 1) { - const p1div4 = (P + _1n3) / _4n; - return function tonelliFast(Fp2, n) { - const root = Fp2.pow(n, p1div4); - if (!Fp2.eql(Fp2.sqr(root), n)) - throw new Error("Cannot find square root"); - return root; - }; - } - const Q1div2 = (Q + _1n3) / _2n3; - return function tonelliSlow(Fp2, n) { - if (Fp2.pow(n, legendreC) === Fp2.neg(Fp2.ONE)) - throw new Error("Cannot find square root"); - let r = S; - let g = Fp2.pow(Fp2.mul(Fp2.ONE, Z), Q); - let x = Fp2.pow(n, Q1div2); - let b = Fp2.pow(n, Q); - while (!Fp2.eql(b, Fp2.ONE)) { - if (Fp2.eql(b, Fp2.ZERO)) - return Fp2.ZERO; - let m = 1; - for (let t2 = Fp2.sqr(b); m < r; m++) { - if (Fp2.eql(t2, Fp2.ONE)) - break; - t2 = Fp2.sqr(t2); - } - const ge2 = Fp2.pow(g, _1n3 << BigInt(r - m - 1)); - g = Fp2.sqr(ge2); - x = Fp2.mul(x, ge2); - b = Fp2.mul(b, g); - r = m; - } - return x; - }; -} -function FpSqrt(P) { - if (P % _4n === _3n) { - const p1div4 = (P + _1n3) / _4n; - return function sqrt3mod4(Fp2, n) { - const root = Fp2.pow(n, p1div4); - if (!Fp2.eql(Fp2.sqr(root), n)) - throw new Error("Cannot find square root"); - return root; - }; - } - if (P % _8n === _5n) { - const c1 = (P - _5n) / _8n; - return function sqrt5mod8(Fp2, n) { - const n2 = Fp2.mul(n, _2n3); - const v = Fp2.pow(n2, c1); - const nv = Fp2.mul(n, v); - const i = Fp2.mul(Fp2.mul(nv, _2n3), v); - const root = Fp2.mul(nv, Fp2.sub(i, Fp2.ONE)); - if (!Fp2.eql(Fp2.sqr(root), n)) - throw new Error("Cannot find square root"); - return root; - }; - } - if (P % _16n === _9n) { - } - return tonelliShanks(P); -} -var FIELD_FIELDS = [ - "create", - "isValid", - "is0", - "neg", - "inv", - "sqrt", - "sqr", - "eql", - "add", - "sub", - "mul", - "pow", - "div", - "addN", - "subN", - "mulN", - "sqrN" -]; -function validateField(field) { - const initial = { - ORDER: "bigint", - MASK: "bigint", - BYTES: "isSafeInteger", - BITS: "isSafeInteger" - }; - const opts = FIELD_FIELDS.reduce((map, val) => { - map[val] = "function"; - return map; - }, initial); - return validateObject(field, opts); -} -function FpPow(f, num, power) { - if (power < _0n3) - throw new Error("Expected power > 0"); - if (power === _0n3) - return f.ONE; - if (power === _1n3) - return num; - let p = f.ONE; - let d = num; - while (power > _0n3) { - if (power & _1n3) - p = f.mul(p, d); - d = f.sqr(d); - power >>= _1n3; - } - return p; -} -function FpInvertBatch(f, nums) { - const tmp = new Array(nums.length); - const lastMultiplied = nums.reduce((acc, num, i) => { - if (f.is0(num)) - return acc; - tmp[i] = acc; - return f.mul(acc, num); - }, f.ONE); - const inverted = f.inv(lastMultiplied); - nums.reduceRight((acc, num, i) => { - if (f.is0(num)) - return acc; - tmp[i] = f.mul(acc, tmp[i]); - return f.mul(acc, num); - }, inverted); - return tmp; -} -function nLength(n, nBitLength) { - const _nBitLength = nBitLength !== void 0 ? nBitLength : n.toString(2).length; - const nByteLength = Math.ceil(_nBitLength / 8); - return { nBitLength: _nBitLength, nByteLength }; -} -function Field(ORDER, bitLen2, isLE2 = false, redef = {}) { - if (ORDER <= _0n3) - throw new Error(`Expected Field ORDER > 0, got ${ORDER}`); - const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen2); - if (BYTES > 2048) - throw new Error("Field lengths over 2048 bytes are not supported"); - const sqrtP = FpSqrt(ORDER); - const f = Object.freeze({ - ORDER, - BITS, - BYTES, - MASK: bitMask(BITS), - ZERO: _0n3, - ONE: _1n3, - create: (num) => mod(num, ORDER), - isValid: (num) => { - if (typeof num !== "bigint") - throw new Error(`Invalid field element: expected bigint, got ${typeof num}`); - return _0n3 <= num && num < ORDER; - }, - is0: (num) => num === _0n3, - isOdd: (num) => (num & _1n3) === _1n3, - neg: (num) => mod(-num, ORDER), - eql: (lhs, rhs) => lhs === rhs, - sqr: (num) => mod(num * num, ORDER), - add: (lhs, rhs) => mod(lhs + rhs, ORDER), - sub: (lhs, rhs) => mod(lhs - rhs, ORDER), - mul: (lhs, rhs) => mod(lhs * rhs, ORDER), - pow: (num, power) => FpPow(f, num, power), - div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER), - // Same as above, but doesn't normalize - sqrN: (num) => num * num, - addN: (lhs, rhs) => lhs + rhs, - subN: (lhs, rhs) => lhs - rhs, - mulN: (lhs, rhs) => lhs * rhs, - inv: (num) => invert(num, ORDER), - sqrt: redef.sqrt || ((n) => sqrtP(f, n)), - invertBatch: (lst) => FpInvertBatch(f, lst), - // TODO: do we really need constant cmov? - // We don't have const-time bigints anyway, so probably will be not very useful - cmov: (a, b, c) => c ? b : a, - toBytes: (num) => isLE2 ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES), - fromBytes: (bytes2) => { - if (bytes2.length !== BYTES) - throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes2.length}`); - return isLE2 ? bytesToNumberLE(bytes2) : bytesToNumberBE(bytes2); - } - }); - return Object.freeze(f); -} -function getFieldBytesLength(fieldOrder) { - if (typeof fieldOrder !== "bigint") - throw new Error("field order must be bigint"); - const bitLength2 = fieldOrder.toString(2).length; - return Math.ceil(bitLength2 / 8); -} -function getMinHashLength(fieldOrder) { - const length = getFieldBytesLength(fieldOrder); - return length + Math.ceil(length / 2); -} -function mapHashToField(key, fieldOrder, isLE2 = false) { - const len = key.length; - const fieldLen = getFieldBytesLength(fieldOrder); - const minLen = getMinHashLength(fieldOrder); - if (len < 16 || len < minLen || len > 1024) - throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`); - const num = isLE2 ? bytesToNumberBE(key) : bytesToNumberLE(key); - const reduced = mod(num, fieldOrder - _1n3) + _1n3; - return isLE2 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen); -} - -// node_modules/@noble/curves/esm/abstract/curve.js -var _0n4 = BigInt(0); -var _1n4 = BigInt(1); -function wNAF(c, bits) { - const constTimeNegate = (condition, item) => { - const neg = item.negate(); - return condition ? neg : item; - }; - const opts = (W) => { - const windows = Math.ceil(bits / W) + 1; - const windowSize = 2 ** (W - 1); - return { windows, windowSize }; - }; - return { - constTimeNegate, - // non-const time multiplication ladder - unsafeLadder(elm, n) { - let p = c.ZERO; - let d = elm; - while (n > _0n4) { - if (n & _1n4) - p = p.add(d); - d = d.double(); - n >>= _1n4; - } - return p; - }, - /** - * Creates a wNAF precomputation window. Used for caching. - * Default window size is set by `utils.precompute()` and is equal to 8. - * Number of precomputed points depends on the curve size: - * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: - * - 𝑊 is the window size - * - 𝑛 is the bitlength of the curve order. - * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. - * @returns precomputed point tables flattened to a single array - */ - precomputeWindow(elm, W) { - const { windows, windowSize } = opts(W); - const points = []; - let p = elm; - let base2 = p; - for (let window2 = 0; window2 < windows; window2++) { - base2 = p; - points.push(base2); - for (let i = 1; i < windowSize; i++) { - base2 = base2.add(p); - points.push(base2); - } - p = base2.double(); - } - return points; - }, - /** - * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. - * @param W window size - * @param precomputes precomputed tables - * @param n scalar (we don't check here, but should be less than curve order) - * @returns real and fake (for const-time) points - */ - wNAF(W, precomputes, n) { - const { windows, windowSize } = opts(W); - let p = c.ZERO; - let f = c.BASE; - const mask2 = BigInt(2 ** W - 1); - const maxNumber = 2 ** W; - const shiftBy = BigInt(W); - for (let window2 = 0; window2 < windows; window2++) { - const offset = window2 * windowSize; - let wbits = Number(n & mask2); - n >>= shiftBy; - if (wbits > windowSize) { - wbits -= maxNumber; - n += _1n4; - } - const offset1 = offset; - const offset2 = offset + Math.abs(wbits) - 1; - const cond1 = window2 % 2 !== 0; - const cond2 = wbits < 0; - if (wbits === 0) { - f = f.add(constTimeNegate(cond1, precomputes[offset1])); - } else { - p = p.add(constTimeNegate(cond2, precomputes[offset2])); - } - } - return { p, f }; - }, - wNAFCached(P, precomputesMap, n, transform) { - const W = P._WINDOW_SIZE || 1; - let comp = precomputesMap.get(P); - if (!comp) { - comp = this.precomputeWindow(P, W); - if (W !== 1) { - precomputesMap.set(P, transform(comp)); - } - } - return this.wNAF(W, comp, n); - } - }; -} -function validateBasic(curve) { - validateField(curve.Fp); - validateObject(curve, { - n: "bigint", - h: "bigint", - Gx: "field", - Gy: "field" - }, { - nBitLength: "isSafeInteger", - nByteLength: "isSafeInteger" - }); - return Object.freeze({ - ...nLength(curve.n, curve.nBitLength), - ...curve, - ...{ p: curve.Fp.ORDER } - }); -} - -// node_modules/@noble/curves/esm/abstract/weierstrass.js -function validatePointOpts(curve) { - const opts = validateBasic(curve); - validateObject(opts, { - a: "field", - b: "field" - }, { - allowedPrivateKeyLengths: "array", - wrapPrivateKey: "boolean", - isTorsionFree: "function", - clearCofactor: "function", - allowInfinityPoint: "boolean", - fromBytes: "function", - toBytes: "function" - }); - const { endo, Fp: Fp2, a } = opts; - if (endo) { - if (!Fp2.eql(a, Fp2.ZERO)) { - throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0"); - } - if (typeof endo !== "object" || typeof endo.beta !== "bigint" || typeof endo.splitScalar !== "function") { - throw new Error("Expected endomorphism with beta: bigint and splitScalar: function"); - } - } - return Object.freeze({ ...opts }); -} -var { bytesToNumberBE: b2n, hexToBytes: h2b } = utils_exports2; -var DER = { - // asn.1 DER encoding utils - Err: class DERErr extends Error { - constructor(m = "") { - super(m); - } - }, - _parseInt(data) { - const { Err: E } = DER; - if (data.length < 2 || data[0] !== 2) - throw new E("Invalid signature integer tag"); - const len = data[1]; - const res = data.subarray(2, len + 2); - if (!len || res.length !== len) - throw new E("Invalid signature integer: wrong length"); - if (res[0] & 128) - throw new E("Invalid signature integer: negative"); - if (res[0] === 0 && !(res[1] & 128)) - throw new E("Invalid signature integer: unnecessary leading zero"); - return { d: b2n(res), l: data.subarray(len + 2) }; - }, - toSig(hex) { - const { Err: E } = DER; - const data = typeof hex === "string" ? h2b(hex) : hex; - if (!isBytes4(data)) - throw new Error("ui8a expected"); - let l = data.length; - if (l < 2 || data[0] != 48) - throw new E("Invalid signature tag"); - if (data[1] !== l - 2) - throw new E("Invalid signature: incorrect length"); - const { d: r, l: sBytes } = DER._parseInt(data.subarray(2)); - const { d: s, l: rBytesLeft } = DER._parseInt(sBytes); - if (rBytesLeft.length) - throw new E("Invalid signature: left bytes after parsing"); - return { r, s }; - }, - hexFromSig(sig) { - const slice = (s2) => Number.parseInt(s2[0], 16) & 8 ? "00" + s2 : s2; - const h = (num) => { - const hex = num.toString(16); - return hex.length & 1 ? `0${hex}` : hex; - }; - const s = slice(h(sig.s)); - const r = slice(h(sig.r)); - const shl = s.length / 2; - const rhl = r.length / 2; - const sl = h(shl); - const rl = h(rhl); - return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`; - } -}; -var _0n5 = BigInt(0); -var _1n5 = BigInt(1); -var _2n4 = BigInt(2); -var _3n2 = BigInt(3); -var _4n2 = BigInt(4); -function weierstrassPoints(opts) { - const CURVE = validatePointOpts(opts); - const { Fp: Fp2 } = CURVE; - const toBytes2 = CURVE.toBytes || ((_c, point, _isCompressed) => { - const a = point.toAffine(); - return concatBytes2(Uint8Array.from([4]), Fp2.toBytes(a.x), Fp2.toBytes(a.y)); - }); - const fromBytes = CURVE.fromBytes || ((bytes2) => { - const tail = bytes2.subarray(1); - const x = Fp2.fromBytes(tail.subarray(0, Fp2.BYTES)); - const y = Fp2.fromBytes(tail.subarray(Fp2.BYTES, 2 * Fp2.BYTES)); - return { x, y }; - }); - function weierstrassEquation(x) { - const { a, b } = CURVE; - const x2 = Fp2.sqr(x); - const x3 = Fp2.mul(x2, x); - return Fp2.add(Fp2.add(x3, Fp2.mul(x, a)), b); - } - if (!Fp2.eql(Fp2.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx))) - throw new Error("bad generator point: equation left != right"); - function isWithinCurveOrder(num) { - return typeof num === "bigint" && _0n5 < num && num < CURVE.n; - } - function assertGE(num) { - if (!isWithinCurveOrder(num)) - throw new Error("Expected valid bigint: 0 < bigint < curve.n"); - } - function normPrivateKeyToScalar(key) { - const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE; - if (lengths && typeof key !== "bigint") { - if (isBytes4(key)) - key = bytesToHex3(key); - if (typeof key !== "string" || !lengths.includes(key.length)) - throw new Error("Invalid key"); - key = key.padStart(nByteLength * 2, "0"); - } - let num; - try { - num = typeof key === "bigint" ? key : bytesToNumberBE(ensureBytes("private key", key, nByteLength)); - } catch (error) { - throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`); - } - if (wrapPrivateKey) - num = mod(num, n); - assertGE(num); - return num; - } - const pointPrecomputes = /* @__PURE__ */ new Map(); - function assertPrjPoint(other) { - if (!(other instanceof Point2)) - throw new Error("ProjectivePoint expected"); - } - class Point2 { - constructor(px, py, pz) { - this.px = px; - this.py = py; - this.pz = pz; - if (px == null || !Fp2.isValid(px)) - throw new Error("x required"); - if (py == null || !Fp2.isValid(py)) - throw new Error("y required"); - if (pz == null || !Fp2.isValid(pz)) - throw new Error("z required"); - } - // Does not validate if the point is on-curve. - // Use fromHex instead, or call assertValidity() later. - static fromAffine(p) { - const { x, y } = p || {}; - if (!p || !Fp2.isValid(x) || !Fp2.isValid(y)) - throw new Error("invalid affine point"); - if (p instanceof Point2) - throw new Error("projective point not allowed"); - const is0 = (i) => Fp2.eql(i, Fp2.ZERO); - if (is0(x) && is0(y)) - return Point2.ZERO; - return new Point2(x, y, Fp2.ONE); - } - get x() { - return this.toAffine().x; - } - get y() { - return this.toAffine().y; - } - /** - * Takes a bunch of Projective Points but executes only one - * inversion on all of them. Inversion is very slow operation, - * so this improves performance massively. - * Optimization: converts a list of projective points to a list of identical points with Z=1. - */ - static normalizeZ(points) { - const toInv = Fp2.invertBatch(points.map((p) => p.pz)); - return points.map((p, i) => p.toAffine(toInv[i])).map(Point2.fromAffine); - } - /** - * Converts hash string or Uint8Array to Point. - * @param hex short/long ECDSA hex - */ - static fromHex(hex) { - const P = Point2.fromAffine(fromBytes(ensureBytes("pointHex", hex))); - P.assertValidity(); - return P; - } - // Multiplies generator point by privateKey. - static fromPrivateKey(privateKey) { - return Point2.BASE.multiply(normPrivateKeyToScalar(privateKey)); - } - // "Private method", don't use it directly - _setWindowSize(windowSize) { - this._WINDOW_SIZE = windowSize; - pointPrecomputes.delete(this); - } - // A point on curve is valid if it conforms to equation. - assertValidity() { - if (this.is0()) { - if (CURVE.allowInfinityPoint && !Fp2.is0(this.py)) - return; - throw new Error("bad point: ZERO"); - } - const { x, y } = this.toAffine(); - if (!Fp2.isValid(x) || !Fp2.isValid(y)) - throw new Error("bad point: x or y not FE"); - const left = Fp2.sqr(y); - const right = weierstrassEquation(x); - if (!Fp2.eql(left, right)) - throw new Error("bad point: equation left != right"); - if (!this.isTorsionFree()) - throw new Error("bad point: not in prime-order subgroup"); - } - hasEvenY() { - const { y } = this.toAffine(); - if (Fp2.isOdd) - return !Fp2.isOdd(y); - throw new Error("Field doesn't support isOdd"); - } - /** - * Compare one point to another. - */ - equals(other) { - assertPrjPoint(other); - const { px: X1, py: Y1, pz: Z1 } = this; - const { px: X2, py: Y2, pz: Z2 } = other; - const U1 = Fp2.eql(Fp2.mul(X1, Z2), Fp2.mul(X2, Z1)); - const U2 = Fp2.eql(Fp2.mul(Y1, Z2), Fp2.mul(Y2, Z1)); - return U1 && U2; - } - /** - * Flips point to one corresponding to (x, -y) in Affine coordinates. - */ - negate() { - return new Point2(this.px, Fp2.neg(this.py), this.pz); - } - // Renes-Costello-Batina exception-free doubling formula. - // There is 30% faster Jacobian formula, but it is not complete. - // https://eprint.iacr.org/2015/1060, algorithm 3 - // Cost: 8M + 3S + 3*a + 2*b3 + 15add. - double() { - const { a, b } = CURVE; - const b3 = Fp2.mul(b, _3n2); - const { px: X1, py: Y1, pz: Z1 } = this; - let X3 = Fp2.ZERO, Y3 = Fp2.ZERO, Z3 = Fp2.ZERO; - let t0 = Fp2.mul(X1, X1); - let t1 = Fp2.mul(Y1, Y1); - let t2 = Fp2.mul(Z1, Z1); - let t3 = Fp2.mul(X1, Y1); - t3 = Fp2.add(t3, t3); - Z3 = Fp2.mul(X1, Z1); - Z3 = Fp2.add(Z3, Z3); - X3 = Fp2.mul(a, Z3); - Y3 = Fp2.mul(b3, t2); - Y3 = Fp2.add(X3, Y3); - X3 = Fp2.sub(t1, Y3); - Y3 = Fp2.add(t1, Y3); - Y3 = Fp2.mul(X3, Y3); - X3 = Fp2.mul(t3, X3); - Z3 = Fp2.mul(b3, Z3); - t2 = Fp2.mul(a, t2); - t3 = Fp2.sub(t0, t2); - t3 = Fp2.mul(a, t3); - t3 = Fp2.add(t3, Z3); - Z3 = Fp2.add(t0, t0); - t0 = Fp2.add(Z3, t0); - t0 = Fp2.add(t0, t2); - t0 = Fp2.mul(t0, t3); - Y3 = Fp2.add(Y3, t0); - t2 = Fp2.mul(Y1, Z1); - t2 = Fp2.add(t2, t2); - t0 = Fp2.mul(t2, t3); - X3 = Fp2.sub(X3, t0); - Z3 = Fp2.mul(t2, t1); - Z3 = Fp2.add(Z3, Z3); - Z3 = Fp2.add(Z3, Z3); - return new Point2(X3, Y3, Z3); - } - // Renes-Costello-Batina exception-free addition formula. - // There is 30% faster Jacobian formula, but it is not complete. - // https://eprint.iacr.org/2015/1060, algorithm 1 - // Cost: 12M + 0S + 3*a + 3*b3 + 23add. - add(other) { - assertPrjPoint(other); - const { px: X1, py: Y1, pz: Z1 } = this; - const { px: X2, py: Y2, pz: Z2 } = other; - let X3 = Fp2.ZERO, Y3 = Fp2.ZERO, Z3 = Fp2.ZERO; - const a = CURVE.a; - const b3 = Fp2.mul(CURVE.b, _3n2); - let t0 = Fp2.mul(X1, X2); - let t1 = Fp2.mul(Y1, Y2); - let t2 = Fp2.mul(Z1, Z2); - let t3 = Fp2.add(X1, Y1); - let t4 = Fp2.add(X2, Y2); - t3 = Fp2.mul(t3, t4); - t4 = Fp2.add(t0, t1); - t3 = Fp2.sub(t3, t4); - t4 = Fp2.add(X1, Z1); - let t5 = Fp2.add(X2, Z2); - t4 = Fp2.mul(t4, t5); - t5 = Fp2.add(t0, t2); - t4 = Fp2.sub(t4, t5); - t5 = Fp2.add(Y1, Z1); - X3 = Fp2.add(Y2, Z2); - t5 = Fp2.mul(t5, X3); - X3 = Fp2.add(t1, t2); - t5 = Fp2.sub(t5, X3); - Z3 = Fp2.mul(a, t4); - X3 = Fp2.mul(b3, t2); - Z3 = Fp2.add(X3, Z3); - X3 = Fp2.sub(t1, Z3); - Z3 = Fp2.add(t1, Z3); - Y3 = Fp2.mul(X3, Z3); - t1 = Fp2.add(t0, t0); - t1 = Fp2.add(t1, t0); - t2 = Fp2.mul(a, t2); - t4 = Fp2.mul(b3, t4); - t1 = Fp2.add(t1, t2); - t2 = Fp2.sub(t0, t2); - t2 = Fp2.mul(a, t2); - t4 = Fp2.add(t4, t2); - t0 = Fp2.mul(t1, t4); - Y3 = Fp2.add(Y3, t0); - t0 = Fp2.mul(t5, t4); - X3 = Fp2.mul(t3, X3); - X3 = Fp2.sub(X3, t0); - t0 = Fp2.mul(t3, t1); - Z3 = Fp2.mul(t5, Z3); - Z3 = Fp2.add(Z3, t0); - return new Point2(X3, Y3, Z3); - } - subtract(other) { - return this.add(other.negate()); - } - is0() { - return this.equals(Point2.ZERO); - } - wNAF(n) { - return wnaf.wNAFCached(this, pointPrecomputes, n, (comp) => { - const toInv = Fp2.invertBatch(comp.map((p) => p.pz)); - return comp.map((p, i) => p.toAffine(toInv[i])).map(Point2.fromAffine); - }); - } - /** - * Non-constant-time multiplication. Uses double-and-add algorithm. - * It's faster, but should only be used when you don't care about - * an exposed private key e.g. sig verification, which works over *public* keys. - */ - multiplyUnsafe(n) { - const I = Point2.ZERO; - if (n === _0n5) - return I; - assertGE(n); - if (n === _1n5) - return this; - const { endo } = CURVE; - if (!endo) - return wnaf.unsafeLadder(this, n); - let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); - let k1p = I; - let k2p = I; - let d = this; - while (k1 > _0n5 || k2 > _0n5) { - if (k1 & _1n5) - k1p = k1p.add(d); - if (k2 & _1n5) - k2p = k2p.add(d); - d = d.double(); - k1 >>= _1n5; - k2 >>= _1n5; - } - if (k1neg) - k1p = k1p.negate(); - if (k2neg) - k2p = k2p.negate(); - k2p = new Point2(Fp2.mul(k2p.px, endo.beta), k2p.py, k2p.pz); - return k1p.add(k2p); - } - /** - * Constant time multiplication. - * Uses wNAF method. Windowed method may be 10% faster, - * but takes 2x longer to generate and consumes 2x memory. - * Uses precomputes when available. - * Uses endomorphism for Koblitz curves. - * @param scalar by which the point would be multiplied - * @returns New point - */ - multiply(scalar) { - assertGE(scalar); - let n = scalar; - let point, fake; - const { endo } = CURVE; - if (endo) { - const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n); - let { p: k1p, f: f1p } = this.wNAF(k1); - let { p: k2p, f: f2p } = this.wNAF(k2); - k1p = wnaf.constTimeNegate(k1neg, k1p); - k2p = wnaf.constTimeNegate(k2neg, k2p); - k2p = new Point2(Fp2.mul(k2p.px, endo.beta), k2p.py, k2p.pz); - point = k1p.add(k2p); - fake = f1p.add(f2p); - } else { - const { p, f } = this.wNAF(n); - point = p; - fake = f; - } - return Point2.normalizeZ([point, fake])[0]; - } - /** - * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly. - * Not using Strauss-Shamir trick: precomputation tables are faster. - * The trick could be useful if both P and Q are not G (not in our case). - * @returns non-zero affine point - */ - multiplyAndAddUnsafe(Q, a, b) { - const G = Point2.BASE; - const mul = (P, a2) => a2 === _0n5 || a2 === _1n5 || !P.equals(G) ? P.multiplyUnsafe(a2) : P.multiply(a2); - const sum = mul(this, a).add(mul(Q, b)); - return sum.is0() ? void 0 : sum; - } - // Converts Projective point to affine (x, y) coordinates. - // Can accept precomputed Z^-1 - for example, from invertBatch. - // (x, y, z) ∋ (x=x/z, y=y/z) - toAffine(iz) { - const { px: x, py: y, pz: z2 } = this; - const is0 = this.is0(); - if (iz == null) - iz = is0 ? Fp2.ONE : Fp2.inv(z2); - const ax = Fp2.mul(x, iz); - const ay = Fp2.mul(y, iz); - const zz = Fp2.mul(z2, iz); - if (is0) - return { x: Fp2.ZERO, y: Fp2.ZERO }; - if (!Fp2.eql(zz, Fp2.ONE)) - throw new Error("invZ was invalid"); - return { x: ax, y: ay }; - } - isTorsionFree() { - const { h: cofactor, isTorsionFree } = CURVE; - if (cofactor === _1n5) - return true; - if (isTorsionFree) - return isTorsionFree(Point2, this); - throw new Error("isTorsionFree() has not been declared for the elliptic curve"); - } - clearCofactor() { - const { h: cofactor, clearCofactor } = CURVE; - if (cofactor === _1n5) - return this; - if (clearCofactor) - return clearCofactor(Point2, this); - return this.multiplyUnsafe(CURVE.h); - } - toRawBytes(isCompressed = true) { - this.assertValidity(); - return toBytes2(Point2, this, isCompressed); - } - toHex(isCompressed = true) { - return bytesToHex3(this.toRawBytes(isCompressed)); - } - } - Point2.BASE = new Point2(CURVE.Gx, CURVE.Gy, Fp2.ONE); - Point2.ZERO = new Point2(Fp2.ZERO, Fp2.ONE, Fp2.ZERO); - const _bits = CURVE.nBitLength; - const wnaf = wNAF(Point2, CURVE.endo ? Math.ceil(_bits / 2) : _bits); - return { - CURVE, - ProjectivePoint: Point2, - normPrivateKeyToScalar, - weierstrassEquation, - isWithinCurveOrder - }; -} -function validateOpts(curve) { - const opts = validateBasic(curve); - validateObject(opts, { - hash: "hash", - hmac: "function", - randomBytes: "function" - }, { - bits2int: "function", - bits2int_modN: "function", - lowS: "boolean" - }); - return Object.freeze({ lowS: true, ...opts }); -} -function weierstrass(curveDef) { - const CURVE = validateOpts(curveDef); - const { Fp: Fp2, n: CURVE_ORDER } = CURVE; - const compressedLen = Fp2.BYTES + 1; - const uncompressedLen = 2 * Fp2.BYTES + 1; - function isValidFieldElement(num) { - return _0n5 < num && num < Fp2.ORDER; - } - function modN2(a) { - return mod(a, CURVE_ORDER); - } - function invN(a) { - return invert(a, CURVE_ORDER); - } - const { ProjectivePoint: Point2, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder } = weierstrassPoints({ - ...CURVE, - toBytes(_c, point, isCompressed) { - const a = point.toAffine(); - const x = Fp2.toBytes(a.x); - const cat = concatBytes2; - if (isCompressed) { - return cat(Uint8Array.from([point.hasEvenY() ? 2 : 3]), x); - } else { - return cat(Uint8Array.from([4]), x, Fp2.toBytes(a.y)); - } - }, - fromBytes(bytes2) { - const len = bytes2.length; - const head = bytes2[0]; - const tail = bytes2.subarray(1); - if (len === compressedLen && (head === 2 || head === 3)) { - const x = bytesToNumberBE(tail); - if (!isValidFieldElement(x)) - throw new Error("Point is not on curve"); - const y2 = weierstrassEquation(x); - let y = Fp2.sqrt(y2); - const isYOdd = (y & _1n5) === _1n5; - const isHeadOdd = (head & 1) === 1; - if (isHeadOdd !== isYOdd) - y = Fp2.neg(y); - return { x, y }; - } else if (len === uncompressedLen && head === 4) { - const x = Fp2.fromBytes(tail.subarray(0, Fp2.BYTES)); - const y = Fp2.fromBytes(tail.subarray(Fp2.BYTES, 2 * Fp2.BYTES)); - return { x, y }; - } else { - throw new Error(`Point of length ${len} was invalid. Expected ${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes`); - } - } - }); - const numToNByteStr = (num) => bytesToHex3(numberToBytesBE(num, CURVE.nByteLength)); - function isBiggerThanHalfOrder(number2) { - const HALF = CURVE_ORDER >> _1n5; - return number2 > HALF; - } - function normalizeS(s) { - return isBiggerThanHalfOrder(s) ? modN2(-s) : s; - } - const slcNum = (b, from, to) => bytesToNumberBE(b.slice(from, to)); - class Signature { - constructor(r, s, recovery) { - this.r = r; - this.s = s; - this.recovery = recovery; - this.assertValidity(); - } - // pair (bytes of r, bytes of s) - static fromCompact(hex) { - const l = CURVE.nByteLength; - hex = ensureBytes("compactSignature", hex, l * 2); - return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l)); - } - // DER encoded ECDSA signature - // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script - static fromDER(hex) { - const { r, s } = DER.toSig(ensureBytes("DER", hex)); - return new Signature(r, s); - } - assertValidity() { - if (!isWithinCurveOrder(this.r)) - throw new Error("r must be 0 < r < CURVE.n"); - if (!isWithinCurveOrder(this.s)) - throw new Error("s must be 0 < s < CURVE.n"); - } - addRecoveryBit(recovery) { - return new Signature(this.r, this.s, recovery); - } - recoverPublicKey(msgHash) { - const { r, s, recovery: rec } = this; - const h = bits2int_modN(ensureBytes("msgHash", msgHash)); - if (rec == null || ![0, 1, 2, 3].includes(rec)) - throw new Error("recovery id invalid"); - const radj = rec === 2 || rec === 3 ? r + CURVE.n : r; - if (radj >= Fp2.ORDER) - throw new Error("recovery id 2 or 3 invalid"); - const prefix = (rec & 1) === 0 ? "02" : "03"; - const R = Point2.fromHex(prefix + numToNByteStr(radj)); - const ir = invN(radj); - const u1 = modN2(-h * ir); - const u2 = modN2(s * ir); - const Q = Point2.BASE.multiplyAndAddUnsafe(R, u1, u2); - if (!Q) - throw new Error("point at infinify"); - Q.assertValidity(); - return Q; - } - // Signatures should be low-s, to prevent malleability. - hasHighS() { - return isBiggerThanHalfOrder(this.s); - } - normalizeS() { - return this.hasHighS() ? new Signature(this.r, modN2(-this.s), this.recovery) : this; - } - // DER-encoded - toDERRawBytes() { - return hexToBytes3(this.toDERHex()); - } - toDERHex() { - return DER.hexFromSig({ r: this.r, s: this.s }); - } - // padded bytes of r, then padded bytes of s - toCompactRawBytes() { - return hexToBytes3(this.toCompactHex()); - } - toCompactHex() { - return numToNByteStr(this.r) + numToNByteStr(this.s); - } - } - const utils = { - isValidPrivateKey(privateKey) { - try { - normPrivateKeyToScalar(privateKey); - return true; - } catch (error) { - return false; - } - }, - normPrivateKeyToScalar, - /** - * Produces cryptographically secure private key from random of size - * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible. - */ - randomPrivateKey: () => { - const length = getMinHashLength(CURVE.n); - return mapHashToField(CURVE.randomBytes(length), CURVE.n); - }, - /** - * Creates precompute table for an arbitrary EC point. Makes point "cached". - * Allows to massively speed-up `point.multiply(scalar)`. - * @returns cached point - * @example - * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey)); - * fast.multiply(privKey); // much faster ECDH now - */ - precompute(windowSize = 8, point = Point2.BASE) { - point._setWindowSize(windowSize); - point.multiply(BigInt(3)); - return point; - } - }; - function getPublicKey(privateKey, isCompressed = true) { - return Point2.fromPrivateKey(privateKey).toRawBytes(isCompressed); - } - function isProbPub(item) { - const arr = isBytes4(item); - const str = typeof item === "string"; - const len = (arr || str) && item.length; - if (arr) - return len === compressedLen || len === uncompressedLen; - if (str) - return len === 2 * compressedLen || len === 2 * uncompressedLen; - if (item instanceof Point2) - return true; - return false; - } - function getSharedSecret(privateA, publicB, isCompressed = true) { - if (isProbPub(privateA)) - throw new Error("first arg must be private key"); - if (!isProbPub(publicB)) - throw new Error("second arg must be public key"); - const b = Point2.fromHex(publicB); - return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed); - } - const bits2int = CURVE.bits2int || function(bytes2) { - const num = bytesToNumberBE(bytes2); - const delta = bytes2.length * 8 - CURVE.nBitLength; - return delta > 0 ? num >> BigInt(delta) : num; - }; - const bits2int_modN = CURVE.bits2int_modN || function(bytes2) { - return modN2(bits2int(bytes2)); - }; - const ORDER_MASK = bitMask(CURVE.nBitLength); - function int2octets(num) { - if (typeof num !== "bigint") - throw new Error("bigint expected"); - if (!(_0n5 <= num && num < ORDER_MASK)) - throw new Error(`bigint expected < 2^${CURVE.nBitLength}`); - return numberToBytesBE(num, CURVE.nByteLength); - } - function prepSig(msgHash, privateKey, opts = defaultSigOpts) { - if (["recovered", "canonical"].some((k) => k in opts)) - throw new Error("sign() legacy options not supported"); - const { hash: hash2, randomBytes: randomBytes3 } = CURVE; - let { lowS, prehash, extraEntropy: ent } = opts; - if (lowS == null) - lowS = true; - msgHash = ensureBytes("msgHash", msgHash); - if (prehash) - msgHash = ensureBytes("prehashed msgHash", hash2(msgHash)); - const h1int = bits2int_modN(msgHash); - const d = normPrivateKeyToScalar(privateKey); - const seedArgs = [int2octets(d), int2octets(h1int)]; - if (ent != null) { - const e = ent === true ? randomBytes3(Fp2.BYTES) : ent; - seedArgs.push(ensureBytes("extraEntropy", e)); - } - const seed = concatBytes2(...seedArgs); - const m = h1int; - function k2sig(kBytes) { - const k = bits2int(kBytes); - if (!isWithinCurveOrder(k)) - return; - const ik = invN(k); - const q = Point2.BASE.multiply(k).toAffine(); - const r = modN2(q.x); - if (r === _0n5) - return; - const s = modN2(ik * modN2(m + r * d)); - if (s === _0n5) - return; - let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n5); - let normS = s; - if (lowS && isBiggerThanHalfOrder(s)) { - normS = normalizeS(s); - recovery ^= 1; - } - return new Signature(r, normS, recovery); - } - return { seed, k2sig }; - } - const defaultSigOpts = { lowS: CURVE.lowS, prehash: false }; - const defaultVerOpts = { lowS: CURVE.lowS, prehash: false }; - function sign6(msgHash, privKey, opts = defaultSigOpts) { - const { seed, k2sig } = prepSig(msgHash, privKey, opts); - const C = CURVE; - const drbg = createHmacDrbg(C.hash.outputLen, C.nByteLength, C.hmac); - return drbg(seed, k2sig); - } - Point2.BASE._setWindowSize(8); - function verify(signature, msgHash, publicKey, opts = defaultVerOpts) { - var _a4; - const sg = signature; - msgHash = ensureBytes("msgHash", msgHash); - publicKey = ensureBytes("publicKey", publicKey); - if ("strict" in opts) - throw new Error("options.strict was renamed to lowS"); - const { lowS, prehash } = opts; - let _sig = void 0; - let P; - try { - if (typeof sg === "string" || isBytes4(sg)) { - try { - _sig = Signature.fromDER(sg); - } catch (derError) { - if (!(derError instanceof DER.Err)) - throw derError; - _sig = Signature.fromCompact(sg); - } - } else if (typeof sg === "object" && typeof sg.r === "bigint" && typeof sg.s === "bigint") { - const { r: r2, s: s2 } = sg; - _sig = new Signature(r2, s2); - } else { - throw new Error("PARSE"); - } - P = Point2.fromHex(publicKey); - } catch (error) { - if (error.message === "PARSE") - throw new Error(`signature must be Signature instance, Uint8Array or hex string`); - return false; - } - if (lowS && _sig.hasHighS()) - return false; - if (prehash) - msgHash = CURVE.hash(msgHash); - const { r, s } = _sig; - const h = bits2int_modN(msgHash); - const is = invN(s); - const u1 = modN2(h * is); - const u2 = modN2(r * is); - const R = (_a4 = Point2.BASE.multiplyAndAddUnsafe(P, u1, u2)) == null ? void 0 : _a4.toAffine(); - if (!R) - return false; - const v = modN2(R.x); - return v === r; - } - return { - CURVE, - getPublicKey, - getSharedSecret, - sign: sign6, - verify, - ProjectivePoint: Point2, - Signature, - utils - }; -} -function SWUFpSqrtRatio(Fp2, Z) { - const q = Fp2.ORDER; - let l = _0n5; - for (let o = q - _1n5; o % _2n4 === _0n5; o /= _2n4) - l += _1n5; - const c1 = l; - const _2n_pow_c1_1 = _2n4 << c1 - _1n5 - _1n5; - const _2n_pow_c1 = _2n_pow_c1_1 * _2n4; - const c2 = (q - _1n5) / _2n_pow_c1; - const c3 = (c2 - _1n5) / _2n4; - const c4 = _2n_pow_c1 - _1n5; - const c5 = _2n_pow_c1_1; - const c6 = Fp2.pow(Z, c2); - const c7 = Fp2.pow(Z, (c2 + _1n5) / _2n4); - let sqrtRatio = (u, v) => { - let tv1 = c6; - let tv2 = Fp2.pow(v, c4); - let tv3 = Fp2.sqr(tv2); - tv3 = Fp2.mul(tv3, v); - let tv5 = Fp2.mul(u, tv3); - tv5 = Fp2.pow(tv5, c3); - tv5 = Fp2.mul(tv5, tv2); - tv2 = Fp2.mul(tv5, v); - tv3 = Fp2.mul(tv5, u); - let tv4 = Fp2.mul(tv3, tv2); - tv5 = Fp2.pow(tv4, c5); - let isQR = Fp2.eql(tv5, Fp2.ONE); - tv2 = Fp2.mul(tv3, c7); - tv5 = Fp2.mul(tv4, tv1); - tv3 = Fp2.cmov(tv2, tv3, isQR); - tv4 = Fp2.cmov(tv5, tv4, isQR); - for (let i = c1; i > _1n5; i--) { - let tv52 = i - _2n4; - tv52 = _2n4 << tv52 - _1n5; - let tvv5 = Fp2.pow(tv4, tv52); - const e1 = Fp2.eql(tvv5, Fp2.ONE); - tv2 = Fp2.mul(tv3, tv1); - tv1 = Fp2.mul(tv1, tv1); - tvv5 = Fp2.mul(tv4, tv1); - tv3 = Fp2.cmov(tv2, tv3, e1); - tv4 = Fp2.cmov(tvv5, tv4, e1); - } - return { isValid: isQR, value: tv3 }; - }; - if (Fp2.ORDER % _4n2 === _3n2) { - const c12 = (Fp2.ORDER - _3n2) / _4n2; - const c22 = Fp2.sqrt(Fp2.neg(Z)); - sqrtRatio = (u, v) => { - let tv1 = Fp2.sqr(v); - const tv2 = Fp2.mul(u, v); - tv1 = Fp2.mul(tv1, tv2); - let y1 = Fp2.pow(tv1, c12); - y1 = Fp2.mul(y1, tv2); - const y2 = Fp2.mul(y1, c22); - const tv3 = Fp2.mul(Fp2.sqr(y1), v); - const isQR = Fp2.eql(tv3, u); - let y = Fp2.cmov(y2, y1, isQR); - return { isValid: isQR, value: y }; - }; - } - return sqrtRatio; -} -function mapToCurveSimpleSWU(Fp2, opts) { - validateField(Fp2); - if (!Fp2.isValid(opts.A) || !Fp2.isValid(opts.B) || !Fp2.isValid(opts.Z)) - throw new Error("mapToCurveSimpleSWU: invalid opts"); - const sqrtRatio = SWUFpSqrtRatio(Fp2, opts.Z); - if (!Fp2.isOdd) - throw new Error("Fp.isOdd is not implemented!"); - return (u) => { - let tv1, tv2, tv3, tv4, tv5, tv6, x, y; - tv1 = Fp2.sqr(u); - tv1 = Fp2.mul(tv1, opts.Z); - tv2 = Fp2.sqr(tv1); - tv2 = Fp2.add(tv2, tv1); - tv3 = Fp2.add(tv2, Fp2.ONE); - tv3 = Fp2.mul(tv3, opts.B); - tv4 = Fp2.cmov(opts.Z, Fp2.neg(tv2), !Fp2.eql(tv2, Fp2.ZERO)); - tv4 = Fp2.mul(tv4, opts.A); - tv2 = Fp2.sqr(tv3); - tv6 = Fp2.sqr(tv4); - tv5 = Fp2.mul(tv6, opts.A); - tv2 = Fp2.add(tv2, tv5); - tv2 = Fp2.mul(tv2, tv3); - tv6 = Fp2.mul(tv6, tv4); - tv5 = Fp2.mul(tv6, opts.B); - tv2 = Fp2.add(tv2, tv5); - x = Fp2.mul(tv1, tv3); - const { isValid: isValid2, value } = sqrtRatio(tv2, tv6); - y = Fp2.mul(tv1, u); - y = Fp2.mul(y, value); - x = Fp2.cmov(x, tv3, isValid2); - y = Fp2.cmov(y, value, isValid2); - const e1 = Fp2.isOdd(u) === Fp2.isOdd(y); - y = Fp2.cmov(Fp2.neg(y), y, e1); - x = Fp2.div(x, tv4); - return { x, y }; - }; -} - -// node_modules/@noble/curves/esm/abstract/hash-to-curve.js -function validateDST(dst) { - if (isBytes4(dst)) - return dst; - if (typeof dst === "string") - return utf8ToBytes3(dst); - throw new Error("DST must be Uint8Array or string"); -} -var os2ip = bytesToNumberBE; -function i2osp(value, length) { - if (value < 0 || value >= 1 << 8 * length) { - throw new Error(`bad I2OSP call: value=${value} length=${length}`); - } - const res = Array.from({ length }).fill(0); - for (let i = length - 1; i >= 0; i--) { - res[i] = value & 255; - value >>>= 8; - } - return new Uint8Array(res); -} -function strxor(a, b) { - const arr = new Uint8Array(a.length); - for (let i = 0; i < a.length; i++) { - arr[i] = a[i] ^ b[i]; - } - return arr; -} -function abytes(item) { - if (!isBytes4(item)) - throw new Error("Uint8Array expected"); -} -function isNum(item) { - if (!Number.isSafeInteger(item)) - throw new Error("number expected"); -} -function expand_message_xmd(msg, DST, lenInBytes, H) { - abytes(msg); - abytes(DST); - isNum(lenInBytes); - if (DST.length > 255) - DST = H(concatBytes2(utf8ToBytes3("H2C-OVERSIZE-DST-"), DST)); - const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H; - const ell = Math.ceil(lenInBytes / b_in_bytes); - if (ell > 255) - throw new Error("Invalid xmd length"); - const DST_prime = concatBytes2(DST, i2osp(DST.length, 1)); - const Z_pad = i2osp(0, r_in_bytes); - const l_i_b_str = i2osp(lenInBytes, 2); - const b = new Array(ell); - const b_0 = H(concatBytes2(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime)); - b[0] = H(concatBytes2(b_0, i2osp(1, 1), DST_prime)); - for (let i = 1; i <= ell; i++) { - const args = [strxor(b_0, b[i - 1]), i2osp(i + 1, 1), DST_prime]; - b[i] = H(concatBytes2(...args)); - } - const pseudo_random_bytes = concatBytes2(...b); - return pseudo_random_bytes.slice(0, lenInBytes); -} -function expand_message_xof(msg, DST, lenInBytes, k, H) { - abytes(msg); - abytes(DST); - isNum(lenInBytes); - if (DST.length > 255) { - const dkLen = Math.ceil(2 * k / 8); - DST = H.create({ dkLen }).update(utf8ToBytes3("H2C-OVERSIZE-DST-")).update(DST).digest(); - } - if (lenInBytes > 65535 || DST.length > 255) - throw new Error("expand_message_xof: invalid lenInBytes"); - return H.create({ dkLen: lenInBytes }).update(msg).update(i2osp(lenInBytes, 2)).update(DST).update(i2osp(DST.length, 1)).digest(); -} -function hash_to_field(msg, count, options) { - validateObject(options, { - DST: "stringOrUint8Array", - p: "bigint", - m: "isSafeInteger", - k: "isSafeInteger", - hash: "hash" - }); - const { p, k, m, hash: hash2, expand, DST: _DST } = options; - abytes(msg); - isNum(count); - const DST = validateDST(_DST); - const log2p = p.toString(2).length; - const L = Math.ceil((log2p + k) / 8); - const len_in_bytes = count * m * L; - let prb; - if (expand === "xmd") { - prb = expand_message_xmd(msg, DST, len_in_bytes, hash2); - } else if (expand === "xof") { - prb = expand_message_xof(msg, DST, len_in_bytes, k, hash2); - } else if (expand === "_internal_pass") { - prb = msg; - } else { - throw new Error('expand must be "xmd" or "xof"'); - } - const u = new Array(count); - for (let i = 0; i < count; i++) { - const e = new Array(m); - for (let j = 0; j < m; j++) { - const elm_offset = L * (j + i * m); - const tv = prb.subarray(elm_offset, elm_offset + L); - e[j] = mod(os2ip(tv), p); - } - u[i] = e; - } - return u; -} -function isogenyMap(field, map) { - const COEFF = map.map((i) => Array.from(i).reverse()); - return (x, y) => { - const [xNum, xDen, yNum, yDen] = COEFF.map((val) => val.reduce((acc, i) => field.add(field.mul(acc, x), i))); - x = field.div(xNum, xDen); - y = field.mul(y, field.div(yNum, yDen)); - return { x, y }; - }; -} -function createHasher(Point2, mapToCurve, def) { - if (typeof mapToCurve !== "function") - throw new Error("mapToCurve() must be defined"); - return { - // Encodes byte string to elliptic curve. - // hash_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 - hashToCurve(msg, options) { - const u = hash_to_field(msg, 2, { ...def, DST: def.DST, ...options }); - const u0 = Point2.fromAffine(mapToCurve(u[0])); - const u1 = Point2.fromAffine(mapToCurve(u[1])); - const P = u0.add(u1).clearCofactor(); - P.assertValidity(); - return P; - }, - // Encodes byte string to elliptic curve. - // encode_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 - encodeToCurve(msg, options) { - const u = hash_to_field(msg, 1, { ...def, DST: def.encodeDST, ...options }); - const P = Point2.fromAffine(mapToCurve(u[0])).clearCofactor(); - P.assertValidity(); - return P; - } - }; -} - -// node_modules/@noble/curves/esm/_shortw_utils.js -function getHash(hash2) { - return { - hash: hash2, - hmac: (key, ...msgs) => hmac(hash2, key, concatBytes(...msgs)), - randomBytes - }; -} -function createCurve(curveDef, defHash) { - const create2 = (hash2) => weierstrass({ ...curveDef, ...getHash(hash2) }); - return Object.freeze({ ...create2(defHash), create: create2 }); -} - -// node_modules/@noble/curves/esm/secp256k1.js -var secp256k1P = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"); -var secp256k1N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); -var _1n6 = BigInt(1); -var _2n5 = BigInt(2); -var divNearest = (a, b) => (a + b / _2n5) / b; -function sqrtMod(y) { - const P = secp256k1P; - const _3n3 = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22); - const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88); - const b2 = y * y * y % P; - const b3 = b2 * b2 * y % P; - const b6 = pow2(b3, _3n3, P) * b3 % P; - const b9 = pow2(b6, _3n3, P) * b3 % P; - const b11 = pow2(b9, _2n5, P) * b2 % P; - const b22 = pow2(b11, _11n, P) * b11 % P; - const b44 = pow2(b22, _22n, P) * b22 % P; - const b88 = pow2(b44, _44n, P) * b44 % P; - const b176 = pow2(b88, _88n, P) * b88 % P; - const b220 = pow2(b176, _44n, P) * b44 % P; - const b223 = pow2(b220, _3n3, P) * b3 % P; - const t1 = pow2(b223, _23n, P) * b22 % P; - const t2 = pow2(t1, _6n, P) * b2 % P; - const root = pow2(t2, _2n5, P); - if (!Fp.eql(Fp.sqr(root), y)) - throw new Error("Cannot find square root"); - return root; -} -var Fp = Field(secp256k1P, void 0, void 0, { sqrt: sqrtMod }); -var secp256k1 = createCurve({ - a: BigInt(0), - // equation params: a, b - b: BigInt(7), - // Seem to be rigid: bitcointalk.org/index.php?topic=289795.msg3183975#msg3183975 - Fp, - // Field's prime: 2n**256n - 2n**32n - 2n**9n - 2n**8n - 2n**7n - 2n**6n - 2n**4n - 1n - n: secp256k1N, - // Curve order, total count of valid points in the field - // Base point (x, y) aka generator point - Gx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"), - Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"), - h: BigInt(1), - // Cofactor - lowS: true, - // Allow only low-S signatures by default in sign() and verify() - /** - * secp256k1 belongs to Koblitz curves: it has efficiently computable endomorphism. - * Endomorphism uses 2x less RAM, speeds up precomputation by 2x and ECDH / key recovery by 20%. - * For precomputed wNAF it trades off 1/2 init time & 1/3 ram for 20% perf hit. - * Explanation: https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066 - */ - endo: { - beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"), - splitScalar: (k) => { - const n = secp256k1N; - const a1 = BigInt("0x3086d221a7d46bcde86c90e49284eb15"); - const b1 = -_1n6 * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"); - const a2 = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"); - const b2 = a1; - const POW_2_128 = BigInt("0x100000000000000000000000000000000"); - const c1 = divNearest(b2 * k, n); - const c2 = divNearest(-b1 * k, n); - let k1 = mod(k - c1 * a1 - c2 * a2, n); - let k2 = mod(-c1 * b1 - c2 * b2, n); - const k1neg = k1 > POW_2_128; - const k2neg = k2 > POW_2_128; - if (k1neg) - k1 = n - k1; - if (k2neg) - k2 = n - k2; - if (k1 > POW_2_128 || k2 > POW_2_128) { - throw new Error("splitScalar: Endomorphism failed, k=" + k); - } - return { k1neg, k1, k2neg, k2 }; - } - } -}, sha256); -var _0n6 = BigInt(0); -var fe = (x) => typeof x === "bigint" && _0n6 < x && x < secp256k1P; -var ge = (x) => typeof x === "bigint" && _0n6 < x && x < secp256k1N; -var TAGGED_HASH_PREFIXES = {}; -function taggedHash(tag, ...messages) { - let tagP = TAGGED_HASH_PREFIXES[tag]; - if (tagP === void 0) { - const tagH = sha256(Uint8Array.from(tag, (c) => c.charCodeAt(0))); - tagP = concatBytes2(tagH, tagH); - TAGGED_HASH_PREFIXES[tag] = tagP; - } - return sha256(concatBytes2(tagP, ...messages)); -} -var pointToBytes = (point) => point.toRawBytes(true).slice(1); -var numTo32b = (n) => numberToBytesBE(n, 32); -var modP = (x) => mod(x, secp256k1P); -var modN = (x) => mod(x, secp256k1N); -var Point = secp256k1.ProjectivePoint; -var GmulAdd = (Q, a, b) => Point.BASE.multiplyAndAddUnsafe(Q, a, b); -function schnorrGetExtPubKey(priv) { - let d_ = secp256k1.utils.normPrivateKeyToScalar(priv); - let p = Point.fromPrivateKey(d_); - const scalar = p.hasEvenY() ? d_ : modN(-d_); - return { scalar, bytes: pointToBytes(p) }; -} -function lift_x(x) { - if (!fe(x)) - throw new Error("bad x: need 0 < x < p"); - const xx = modP(x * x); - const c = modP(xx * x + BigInt(7)); - let y = sqrtMod(c); - if (y % _2n5 !== _0n6) - y = modP(-y); - const p = new Point(x, y, _1n6); - p.assertValidity(); - return p; -} -function challenge(...args) { - return modN(bytesToNumberBE(taggedHash("BIP0340/challenge", ...args))); -} -function schnorrGetPublicKey(privateKey) { - return schnorrGetExtPubKey(privateKey).bytes; -} -function schnorrSign(message, privateKey, auxRand = randomBytes(32)) { - const m = ensureBytes("message", message); - const { bytes: px, scalar: d } = schnorrGetExtPubKey(privateKey); - const a = ensureBytes("auxRand", auxRand, 32); - const t = numTo32b(d ^ bytesToNumberBE(taggedHash("BIP0340/aux", a))); - const rand = taggedHash("BIP0340/nonce", t, px, m); - const k_ = modN(bytesToNumberBE(rand)); - if (k_ === _0n6) - throw new Error("sign failed: k is zero"); - const { bytes: rx, scalar: k } = schnorrGetExtPubKey(k_); - const e = challenge(rx, px, m); - const sig = new Uint8Array(64); - sig.set(rx, 0); - sig.set(numTo32b(modN(k + e * d)), 32); - if (!schnorrVerify(sig, m, px)) - throw new Error("sign: Invalid signature produced"); - return sig; -} -function schnorrVerify(signature, message, publicKey) { - const sig = ensureBytes("signature", signature, 64); - const m = ensureBytes("message", message); - const pub = ensureBytes("publicKey", publicKey, 32); - try { - const P = lift_x(bytesToNumberBE(pub)); - const r = bytesToNumberBE(sig.subarray(0, 32)); - if (!fe(r)) - return false; - const s = bytesToNumberBE(sig.subarray(32, 64)); - if (!ge(s)) - return false; - const e = challenge(numTo32b(r), pointToBytes(P), m); - const R = GmulAdd(P, s, modN(-e)); - if (!R || !R.hasEvenY() || R.toAffine().x !== r) - return false; - return true; - } catch (error) { - return false; - } -} -var schnorr = (() => ({ - getPublicKey: schnorrGetPublicKey, - sign: schnorrSign, - verify: schnorrVerify, - utils: { - randomPrivateKey: secp256k1.utils.randomPrivateKey, - lift_x, - pointToBytes, - numberToBytesBE, - bytesToNumberBE, - taggedHash, - mod - } -}))(); -var isoMap = (() => isogenyMap(Fp, [ - // xNum - [ - "0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7", - "0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581", - "0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262", - "0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c" - ], - // xDen - [ - "0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b", - "0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14", - "0x0000000000000000000000000000000000000000000000000000000000000001" - // LAST 1 - ], - // yNum - [ - "0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c", - "0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3", - "0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931", - "0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84" - ], - // yDen - [ - "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b", - "0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573", - "0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f", - "0x0000000000000000000000000000000000000000000000000000000000000001" - // LAST 1 - ] -].map((i) => i.map((j) => BigInt(j)))))(); -var mapSWU = (() => mapToCurveSimpleSWU(Fp, { - A: BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"), - B: BigInt("1771"), - Z: Fp.create(BigInt("-11")) -}))(); -var htf = (() => createHasher(secp256k1.ProjectivePoint, (scalars) => { - const { x, y } = mapSWU(Fp.create(scalars[0])); - return isoMap(x, y); -}, { - DST: "secp256k1_XMD:SHA-256_SSWU_RO_", - encodeDST: "secp256k1_XMD:SHA-256_SSWU_NU_", - p: Fp.ORDER, - m: 1, - k: 128, - expand: "xmd", - hash: sha256 -}))(); -var hashToCurve = (() => htf.hashToCurve)(); -var encodeToCurve = (() => htf.encodeToCurve)(); - -// node_modules/web3-eth-accounts/lib/esm/tx/constants.js -var _a2; -var secp256k12 = (_a2 = secp256k1) !== null && _a2 !== void 0 ? _a2 : secp256k1_exports; -var MAX_UINT64 = BigInt("0xffffffffffffffff"); -var MAX_INTEGER = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); -var SECP256K1_ORDER = secp256k12.CURVE.n; -var SECP256K1_ORDER_DIV_2 = SECP256K1_ORDER / BigInt(2); - -// node_modules/web3-eth-accounts/lib/esm/schemas.js -var keyStoreSchema = { - type: "object", - required: ["crypto", "id", "version", "address"], - properties: { - crypto: { - type: "object", - required: ["cipher", "ciphertext", "cipherparams", "kdf", "kdfparams", "mac"], - properties: { - cipher: { type: "string" }, - ciphertext: { type: "string" }, - cipherparams: { type: "object" }, - kdf: { type: "string" }, - kdfparams: { type: "object" }, - salt: { type: "string" }, - mac: { type: "string" } - } - }, - id: { type: "string" }, - version: { type: "number" }, - address: { type: "string" } - } -}; - -// node_modules/web3-eth-accounts/lib/esm/common/enums.js -var Chain; -(function(Chain2) { - Chain2[Chain2["Mainnet"] = 1] = "Mainnet"; - Chain2[Chain2["Goerli"] = 5] = "Goerli"; - Chain2[Chain2["Sepolia"] = 11155111] = "Sepolia"; -})(Chain || (Chain = {})); -var Hardfork; -(function(Hardfork2) { - Hardfork2["Chainstart"] = "chainstart"; - Hardfork2["Homestead"] = "homestead"; - Hardfork2["Dao"] = "dao"; - Hardfork2["TangerineWhistle"] = "tangerineWhistle"; - Hardfork2["SpuriousDragon"] = "spuriousDragon"; - Hardfork2["Byzantium"] = "byzantium"; - Hardfork2["Constantinople"] = "constantinople"; - Hardfork2["Petersburg"] = "petersburg"; - Hardfork2["Istanbul"] = "istanbul"; - Hardfork2["MuirGlacier"] = "muirGlacier"; - Hardfork2["Berlin"] = "berlin"; - Hardfork2["London"] = "london"; - Hardfork2["ArrowGlacier"] = "arrowGlacier"; - Hardfork2["GrayGlacier"] = "grayGlacier"; - Hardfork2["MergeForkIdTransition"] = "mergeForkIdTransition"; - Hardfork2["Merge"] = "merge"; - Hardfork2["Shanghai"] = "shanghai"; - Hardfork2["ShardingForkDev"] = "shardingFork"; -})(Hardfork || (Hardfork = {})); -var ConsensusType; -(function(ConsensusType2) { - ConsensusType2["ProofOfStake"] = "pos"; - ConsensusType2["ProofOfWork"] = "pow"; - ConsensusType2["ProofOfAuthority"] = "poa"; -})(ConsensusType || (ConsensusType = {})); -var ConsensusAlgorithm; -(function(ConsensusAlgorithm2) { - ConsensusAlgorithm2["Ethash"] = "ethash"; - ConsensusAlgorithm2["Clique"] = "clique"; - ConsensusAlgorithm2["Casper"] = "casper"; -})(ConsensusAlgorithm || (ConsensusAlgorithm = {})); -var CustomChain; -(function(CustomChain2) { - CustomChain2["PolygonMainnet"] = "polygon-mainnet"; - CustomChain2["PolygonMumbai"] = "polygon-mumbai"; - CustomChain2["ArbitrumRinkebyTestnet"] = "arbitrum-rinkeby-testnet"; - CustomChain2["ArbitrumOne"] = "arbitrum-one"; - CustomChain2["xDaiChain"] = "x-dai-chain"; - CustomChain2["OptimisticKovan"] = "optimistic-kovan"; - CustomChain2["OptimisticEthereum"] = "optimistic-ethereum"; -})(CustomChain || (CustomChain = {})); - -// node_modules/web3-eth-accounts/lib/esm/common/types.js -var TypeOutput; -(function(TypeOutput2) { - TypeOutput2[TypeOutput2["Number"] = 0] = "Number"; - TypeOutput2[TypeOutput2["BigInt"] = 1] = "BigInt"; - TypeOutput2[TypeOutput2["Uint8Array"] = 2] = "Uint8Array"; - TypeOutput2[TypeOutput2["PrefixedHexString"] = 3] = "PrefixedHexString"; -})(TypeOutput || (TypeOutput = {})); - -// node_modules/web3-eth-accounts/lib/esm/common/utils.js -var stripHexPrefix = (str) => { - if (typeof str !== "string") - throw new Error(`[stripHexPrefix] input must be type 'string', received ${typeof str}`); - return isHexPrefixed(str) ? str.slice(2) : str; -}; -function formatNonce(nonce) { - if (!nonce || nonce === "0x0") { - return "0x0000000000000000"; - } - if (isHexPrefixed(nonce)) { - return `0x${stripHexPrefix(nonce).padStart(16, "0")}`; - } - return `0x${nonce.padStart(16, "0")}`; -} -var intToHex = function(i) { - if (!Number.isSafeInteger(i) || i < 0) { - throw new Error(`Received an invalid integer type: ${i}`); - } - return `0x${i.toString(16)}`; -}; -function parseGethParams(json, mergeForkIdPostMerge = true) { - var _a4, _b; - const { name: name2, config, difficulty, mixHash, gasLimit, coinbase, baseFeePerGas } = json; - let { extraData, timestamp, nonce } = json; - const genesisTimestamp = Number(timestamp); - const { chainId } = config; - if (extraData === "") { - extraData = "0x"; - } - if (!isHexPrefixed(timestamp)) { - timestamp = intToHex(parseInt(timestamp)); - } - if (nonce.length !== 18) { - nonce = formatNonce(nonce); - } - if (config.eip155Block !== config.eip158Block) { - throw new Error("EIP155 block number must equal EIP 158 block number since both are part of SpuriousDragon hardfork and the client only supports activating the full hardfork"); - } - const params = { - name: name2, - chainId, - networkId: chainId, - genesis: { - timestamp, - // eslint-disable-next-line radix - gasLimit: parseInt(gasLimit), - // eslint-disable-next-line radix - difficulty: parseInt(difficulty), - nonce, - extraData, - mixHash, - coinbase, - baseFeePerGas - }, - hardfork: void 0, - hardforks: [], - bootstrapNodes: [], - consensus: ( - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - config.clique !== void 0 ? { - type: "poa", - algorithm: "clique", - clique: { - // The recent geth genesis seems to be using blockperiodseconds - // and epochlength for clique specification - // see: https://hackmd.io/PqZgMpnkSWCWv5joJoFymQ - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment - period: (_a4 = config.clique.period) !== null && _a4 !== void 0 ? _a4 : config.clique.blockperiodseconds, - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment - epoch: (_b = config.clique.epoch) !== null && _b !== void 0 ? _b : config.clique.epochlength - } - } : { - type: "pow", - algorithm: "ethash", - ethash: {} - } - ) - }; - const forkMap = { - [Hardfork.Homestead]: { name: "homesteadBlock" }, - [Hardfork.Dao]: { name: "daoForkBlock" }, - [Hardfork.TangerineWhistle]: { name: "eip150Block" }, - [Hardfork.SpuriousDragon]: { name: "eip155Block" }, - [Hardfork.Byzantium]: { name: "byzantiumBlock" }, - [Hardfork.Constantinople]: { name: "constantinopleBlock" }, - [Hardfork.Petersburg]: { name: "petersburgBlock" }, - [Hardfork.Istanbul]: { name: "istanbulBlock" }, - [Hardfork.MuirGlacier]: { name: "muirGlacierBlock" }, - [Hardfork.Berlin]: { name: "berlinBlock" }, - [Hardfork.London]: { name: "londonBlock" }, - [Hardfork.MergeForkIdTransition]: { - name: "mergeForkBlock", - postMerge: mergeForkIdPostMerge - }, - [Hardfork.Shanghai]: { name: "shanghaiTime", postMerge: true, isTimestamp: true }, - [Hardfork.ShardingForkDev]: { - name: "shardingForkTime", - postMerge: true, - isTimestamp: true - } - }; - const forkMapRev = Object.keys(forkMap).reduce((acc, elem) => { - acc[forkMap[elem].name] = elem; - return acc; - }, {}); - const configHardforkNames = Object.keys(config).filter( - // eslint-disable-next-line no-null/no-null, @typescript-eslint/no-unsafe-member-access - (key) => forkMapRev[key] !== void 0 && config[key] !== void 0 && config[key] !== null - ); - params.hardforks = configHardforkNames.map((nameBlock) => ({ - name: forkMapRev[nameBlock], - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - block: ( - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - forkMap[forkMapRev[nameBlock]].isTimestamp === true || // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - typeof config[nameBlock] !== "number" ? ( - // eslint-disable-next-line no-null/no-null - null - ) : ( - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - config[nameBlock] - ) - ), - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - timestamp: ( - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - forkMap[forkMapRev[nameBlock]].isTimestamp === true && // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - typeof config[nameBlock] === "number" ? ( - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - config[nameBlock] - ) : void 0 - ) - })).filter((fork) => fork.block !== null || fork.timestamp !== void 0); - params.hardforks.sort((a, b) => { - var _a5, _b2; - return ((_a5 = a.block) !== null && _a5 !== void 0 ? _a5 : Infinity) - ((_b2 = b.block) !== null && _b2 !== void 0 ? _b2 : Infinity); - }); - params.hardforks.sort((a, b) => { - var _a5, _b2; - return ((_a5 = a.timestamp) !== null && _a5 !== void 0 ? _a5 : genesisTimestamp) - ((_b2 = b.timestamp) !== null && _b2 !== void 0 ? _b2 : genesisTimestamp); - }); - if (config.terminalTotalDifficulty !== void 0) { - const mergeConfig = { - name: Hardfork.Merge, - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment - ttd: config.terminalTotalDifficulty, - // eslint-disable-next-line no-null/no-null - block: null - }; - const postMergeIndex = params.hardforks.findIndex( - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - (hf) => { - var _a5; - return ((_a5 = forkMap[hf.name]) === null || _a5 === void 0 ? void 0 : _a5.postMerge) === true; - } - ); - if (postMergeIndex !== -1) { - params.hardforks.splice(postMergeIndex, 0, mergeConfig); - } else { - params.hardforks.push(mergeConfig); - } - } - const latestHardfork = params.hardforks.length > 0 ? params.hardforks.slice(-1)[0] : void 0; - params.hardfork = latestHardfork === null || latestHardfork === void 0 ? void 0 : latestHardfork.name; - params.hardforks.unshift({ name: Hardfork.Chainstart, block: 0 }); - return params; -} -function parseGethGenesis(json, name2, mergeForkIdPostMerge) { - try { - if (["config", "difficulty", "gasLimit", "alloc"].some((field) => !(field in json))) { - throw new Error("Invalid format, expected geth genesis fields missing"); - } - if (name2 !== void 0) { - json.name = name2; - } - return parseGethParams(json, mergeForkIdPostMerge); - } catch (e) { - throw new Error(`Error parsing parameters file: ${e.message}`); - } -} -function padToEven(value) { - let a = value; - if (typeof a !== "string") { - throw new Error(`[padToEven] value must be type 'string', received ${typeof a}`); - } - if (a.length % 2) - a = `0${a}`; - return a; -} -var intToUint8Array = function(i) { - const hex = intToHex(i); - return hexToBytes2(`0x${padToEven(hex.slice(2))}`); -}; -var toUint8Array = function(v) { - var _a4; - if (v === null || v === void 0) { - return new Uint8Array(); - } - if (v instanceof Uint8Array) { - return v; - } - if (((_a4 = v === null || v === void 0 ? void 0 : v.constructor) === null || _a4 === void 0 ? void 0 : _a4.name) === "Uint8Array") { - return Uint8Array.from(v); - } - if (Array.isArray(v)) { - return Uint8Array.from(v); - } - if (typeof v === "string") { - if (!isHexString(v)) { - throw new Error(`Cannot convert string to Uint8Array. only supports 0x-prefixed hex strings and this string was given: ${v}`); - } - return hexToBytes2(padToEven(stripHexPrefix(v))); - } - if (typeof v === "number") { - return toUint8Array(numberToHex2(v)); - } - if (typeof v === "bigint") { - if (v < BigInt(0)) { - throw new Error(`Cannot convert negative bigint to Uint8Array. Given: ${v}`); - } - let n = v.toString(16); - if (n.length % 2) - n = `0${n}`; - return toUint8Array(`0x${n}`); - } - if (v.toArray) { - return Uint8Array.from(v.toArray()); - } - throw new Error("invalid type"); -}; -function uint8ArrayToBigInt(buf) { - const hex = bytesToHex2(buf); - if (hex === "0x") { - return BigInt(0); - } - return BigInt(hex); -} -function bigIntToUint8Array(num) { - return toUint8Array(`0x${num.toString(16)}`); -} -var zeros = function(bytes2) { - return new Uint8Array(bytes2).fill(0); -}; -var setLength = function(msg, length, right) { - const buf = zeros(length); - if (right) { - if (msg.length < length) { - buf.set(msg); - return buf; - } - return msg.subarray(0, length); - } - if (msg.length < length) { - buf.set(msg, length - msg.length); - return buf; - } - return msg.subarray(-length); -}; -function assertIsUint8Array(input) { - if (!isUint8Array2(input)) { - const msg = `This method only supports Uint8Array but input was: ${input}`; - throw new Error(msg); - } -} -var setLengthLeft = function(msg, length) { - assertIsUint8Array(msg); - return setLength(msg, length, false); -}; -function stripZeros(a) { - let first = a[0]; - while (a.length > 0 && first.toString() === "0") { - a = a.slice(1); - first = a[0]; - } - return a; -} -var unpadUint8Array = function(a) { - assertIsUint8Array(a); - return stripZeros(a); -}; -var bigIntToHex = (num) => `0x${num.toString(16)}`; -function bigIntToUnpaddedUint8Array(value) { - return unpadUint8Array(bigIntToUint8Array(value)); -} -function calculateSigRecovery(v, chainId) { - if (v === BigInt(0) || v === BigInt(1)) - return v; - if (chainId === void 0) { - return v - BigInt(27); - } - return v - (chainId * BigInt(2) + BigInt(35)); -} -function isValidSigRecovery(recovery) { - return recovery === BigInt(0) || recovery === BigInt(1); -} -var ecrecover = function(msgHash, v, r, s, chainId) { - const recovery = calculateSigRecovery(v, chainId); - if (!isValidSigRecovery(recovery)) { - throw new Error("Invalid signature v value"); - } - const senderPubKey = new secp256k12.Signature(uint8ArrayToBigInt(r), uint8ArrayToBigInt(s)).addRecoveryBit(Number(recovery)).recoverPublicKey(msgHash).toRawBytes(false); - return senderPubKey.slice(1); -}; -function toType(input, outputType) { - if (input === null) { - return null; - } - if (input === void 0) { - return void 0; - } - if (typeof input === "string" && !isHexString(input)) { - throw new Error(`A string must be provided with a 0x-prefix, given: ${input}`); - } else if (typeof input === "number" && !Number.isSafeInteger(input)) { - throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)"); - } - const output2 = toUint8Array(input); - switch (outputType) { - case TypeOutput.Uint8Array: - return output2; - case TypeOutput.BigInt: - return uint8ArrayToBigInt(output2); - case TypeOutput.Number: { - const bigInt = uint8ArrayToBigInt(output2); - if (bigInt > BigInt(Number.MAX_SAFE_INTEGER)) { - throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)"); - } - return Number(bigInt); - } - case TypeOutput.PrefixedHexString: - return bytesToHex2(output2); - default: - throw new Error("unknown outputType"); - } -} - -// node_modules/web3-eth-accounts/lib/esm/tx/eip1559Transaction.js -var import_rlp = __toESM(require_dist(), 1); - -// node_modules/web3-eth-accounts/lib/esm/common/common.js -var import_crc_32 = __toESM(require_crc32(), 1); - -// node_modules/web3-eth-accounts/lib/esm/common/chains/goerli.js -var goerli_default = { - "name": "goerli", - "chainId": 5, - "networkId": 5, - "defaultHardfork": "merge", - "consensus": { - "type": "poa", - "algorithm": "clique", - "clique": { - "period": 15, - "epoch": 3e4 - } - }, - "comment": "Cross-client PoA test network", - "url": "https://github.com/goerli/testnet", - "genesis": { - "timestamp": "0x5c51a607", - "gasLimit": 10485760, - "difficulty": 1, - "nonce": "0x0000000000000000", - "extraData": "0x22466c6578692069732061207468696e6722202d204166726900000000000000e0a2bd4258d2768837baa26a28fe71dc079f84c70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" - }, - "hardforks": [ - { - "name": "chainstart", - "block": 0, - "forkHash": "0xa3f5ab08" - }, - { - "name": "homestead", - "block": 0, - "forkHash": "0xa3f5ab08" - }, - { - "name": "tangerineWhistle", - "block": 0, - "forkHash": "0xa3f5ab08" - }, - { - "name": "spuriousDragon", - "block": 0, - "forkHash": "0xa3f5ab08" - }, - { - "name": "byzantium", - "block": 0, - "forkHash": "0xa3f5ab08" - }, - { - "name": "constantinople", - "block": 0, - "forkHash": "0xa3f5ab08" - }, - { - "name": "petersburg", - "block": 0, - "forkHash": "0xa3f5ab08" - }, - { - "name": "istanbul", - "block": 1561651, - "forkHash": "0xc25efa5c" - }, - { - "name": "berlin", - "block": 4460644, - "forkHash": "0x757a1c47" - }, - { - "name": "london", - "block": 5062605, - "forkHash": "0xb8c6299d" - }, - { - "//_comment": "The forkHash will remain same as mergeForkIdTransition is post merge, terminal block: https://goerli.etherscan.io/block/7382818", - "name": "merge", - "ttd": "10790000", - "block": 7382819, - "forkHash": "0xb8c6299d" - }, - { - "name": "mergeForkIdTransition", - "block": null, - "forkHash": null - }, - { - "name": "shanghai", - "block": null, - "forkHash": null - } - ], - "bootstrapNodes": [], - "dnsNetworks": [ - "enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.goerli.ethdisco.net" - ] -}; - -// node_modules/web3-eth-accounts/lib/esm/common/chains/mainnet.js -var mainnet_default = { - "name": "mainnet", - "chainId": 1, - "networkId": 1, - "defaultHardfork": "merge", - "consensus": { - "type": "pow", - "algorithm": "ethash", - "ethash": {} - }, - "comment": "The Ethereum main chain", - "url": "https://ethstats.net/", - "genesis": { - "gasLimit": 5e3, - "difficulty": 17179869184, - "nonce": "0x0000000000000042", - "extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa" - }, - "hardforks": [ - { - "name": "chainstart", - "block": 0, - "forkHash": "0xfc64ec04" - }, - { - "name": "homestead", - "block": 115e4, - "forkHash": "0x97c2c34c" - }, - { - "name": "dao", - "block": 192e4, - "forkHash": "0x91d1f948" - }, - { - "name": "tangerineWhistle", - "block": 2463e3, - "forkHash": "0x7a64da13" - }, - { - "name": "spuriousDragon", - "block": 2675e3, - "forkHash": "0x3edd5b10" - }, - { - "name": "byzantium", - "block": 437e4, - "forkHash": "0xa00bc324" - }, - { - "name": "constantinople", - "block": 728e4, - "forkHash": "0x668db0af" - }, - { - "name": "petersburg", - "block": 728e4, - "forkHash": "0x668db0af" - }, - { - "name": "istanbul", - "block": 9069e3, - "forkHash": "0x879d6e30" - }, - { - "name": "muirGlacier", - "block": 92e5, - "forkHash": "0xe029e991" - }, - { - "name": "berlin", - "block": 12244e3, - "forkHash": "0x0eb440f6" - }, - { - "name": "london", - "block": 12965e3, - "forkHash": "0xb715077d" - }, - { - "name": "arrowGlacier", - "block": 13773e3, - "forkHash": "0x20c327fc" - }, - { - "name": "grayGlacier", - "block": 1505e4, - "forkHash": "0xf0afd0e3" - }, - { - "//_comment": "The forkHash will remain same as mergeForkIdTransition is post merge, terminal block: https://etherscan.io/block/15537393", - "name": "merge", - "ttd": "58750000000000000000000", - "block": 15537394, - "forkHash": "0xf0afd0e3" - }, - { - "name": "mergeForkIdTransition", - "block": null, - "forkHash": null - }, - { - "name": "shanghai", - "block": null, - "forkHash": null - } - ], - "bootstrapNodes": [], - "dnsNetworks": [ - "enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.mainnet.ethdisco.net" - ] -}; - -// node_modules/web3-eth-accounts/lib/esm/common/chains/sepolia.js -var sepolia_default = { - "name": "sepolia", - "chainId": 11155111, - "networkId": 11155111, - "defaultHardfork": "merge", - "consensus": { - "type": "pow", - "algorithm": "ethash", - "ethash": {} - }, - "comment": "PoW test network to replace Ropsten", - "url": "https://github.com/ethereum/go-ethereum/pull/23730", - "genesis": { - "timestamp": "0x6159af19", - "gasLimit": 3e7, - "difficulty": 131072, - "nonce": "0x0000000000000000", - "extraData": "0x5365706f6c69612c20417468656e732c204174746963612c2047726565636521" - }, - "hardforks": [ - { - "name": "chainstart", - "block": 0, - "forkHash": "0xfe3366e7" - }, - { - "name": "homestead", - "block": 0, - "forkHash": "0xfe3366e7" - }, - { - "name": "tangerineWhistle", - "block": 0, - "forkHash": "0xfe3366e7" - }, - { - "name": "spuriousDragon", - "block": 0, - "forkHash": "0xfe3366e7" - }, - { - "name": "byzantium", - "block": 0, - "forkHash": "0xfe3366e7" - }, - { - "name": "constantinople", - "block": 0, - "forkHash": "0xfe3366e7" - }, - { - "name": "petersburg", - "block": 0, - "forkHash": "0xfe3366e7" - }, - { - "name": "istanbul", - "block": 0, - "forkHash": "0xfe3366e7" - }, - { - "name": "muirGlacier", - "block": 0, - "forkHash": "0xfe3366e7" - }, - { - "name": "berlin", - "block": 0, - "forkHash": "0xfe3366e7" - }, - { - "name": "london", - "block": 0, - "forkHash": "0xfe3366e7" - }, - { - "//_comment": "The forkHash will remain same as mergeForkIdTransition is post merge, terminal block: https://sepolia.etherscan.io/block/1450408", - "name": "merge", - "ttd": "17000000000000000", - "block": 1450409, - "forkHash": "0xfe3366e7" - }, - { - "name": "mergeForkIdTransition", - "block": 1735371, - "forkHash": "0xb96cbd13" - }, - { - "name": "shanghai", - "block": null, - "timestamp": "1677557088", - "forkHash": "0xf7f9bc08" - } - ], - "bootstrapNodes": [], - "dnsNetworks": [ - "enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.sepolia.ethdisco.net" - ] -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/1153.js -var __default = { - "name": "EIP-1153", - "number": 1153, - "comment": "Transient Storage", - "url": "https://eips.ethereum.org/EIPS/eip-1153", - "status": "Review", - "minimumHardfork": "chainstart", - "requiredEIPs": [], - "gasConfig": {}, - "gasPrices": { - "tstore": { - "v": 100, - "d": "Base fee of the TSTORE opcode" - }, - "tload": { - "v": 100, - "d": "Base fee of the TLOAD opcode" - } - }, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/1559.js -var __default2 = { - "name": "EIP-1559", - "number": 1559, - "comment": "Fee market change for ETH 1.0 chain", - "url": "https://eips.ethereum.org/EIPS/eip-1559", - "status": "Final", - "minimumHardfork": "berlin", - "requiredEIPs": [2930], - "gasConfig": { - "baseFeeMaxChangeDenominator": { - "v": 8, - "d": "Maximum base fee change denominator" - }, - "elasticityMultiplier": { - "v": 2, - "d": "Maximum block gas target elasticity" - }, - "initialBaseFee": { - "v": 1e9, - "d": "Initial base fee on first EIP1559 block" - } - }, - "gasPrices": {}, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/2315.js -var __default3 = { - "name": "EIP-2315", - "number": 2315, - "comment": "Simple subroutines for the EVM", - "url": "https://eips.ethereum.org/EIPS/eip-2315", - "status": "Draft", - "minimumHardfork": "istanbul", - "gasConfig": {}, - "gasPrices": { - "beginsub": { - "v": 2, - "d": "Base fee of the BEGINSUB opcode" - }, - "returnsub": { - "v": 5, - "d": "Base fee of the RETURNSUB opcode" - }, - "jumpsub": { - "v": 10, - "d": "Base fee of the JUMPSUB opcode" - } - }, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/2537.js -var __default4 = { - "name": "EIP-2537", - "number": 2537, - "comment": "BLS12-381 precompiles", - "url": "https://eips.ethereum.org/EIPS/eip-2537", - "status": "Draft", - "minimumHardfork": "chainstart", - "gasConfig": {}, - "gasPrices": { - "Bls12381G1AddGas": { - "v": 600, - "d": "Gas cost of a single BLS12-381 G1 addition precompile-call" - }, - "Bls12381G1MulGas": { - "v": 12e3, - "d": "Gas cost of a single BLS12-381 G1 multiplication precompile-call" - }, - "Bls12381G2AddGas": { - "v": 4500, - "d": "Gas cost of a single BLS12-381 G2 addition precompile-call" - }, - "Bls12381G2MulGas": { - "v": 55e3, - "d": "Gas cost of a single BLS12-381 G2 multiplication precompile-call" - }, - "Bls12381PairingBaseGas": { - "v": 115e3, - "d": "Base gas cost of BLS12-381 pairing check" - }, - "Bls12381PairingPerPairGas": { - "v": 23e3, - "d": "Per-pair gas cost of BLS12-381 pairing check" - }, - "Bls12381MapG1Gas": { - "v": 5500, - "d": "Gas cost of BLS12-381 map field element to G1" - }, - "Bls12381MapG2Gas": { - "v": 11e4, - "d": "Gas cost of BLS12-381 map field element to G2" - }, - "Bls12381MultiExpGasDiscount": { - "v": [ - [1, 1200], - [2, 888], - [3, 764], - [4, 641], - [5, 594], - [6, 547], - [7, 500], - [8, 453], - [9, 438], - [10, 423], - [11, 408], - [12, 394], - [13, 379], - [14, 364], - [15, 349], - [16, 334], - [17, 330], - [18, 326], - [19, 322], - [20, 318], - [21, 314], - [22, 310], - [23, 306], - [24, 302], - [25, 298], - [26, 294], - [27, 289], - [28, 285], - [29, 281], - [30, 277], - [31, 273], - [32, 269], - [33, 268], - [34, 266], - [35, 265], - [36, 263], - [37, 262], - [38, 260], - [39, 259], - [40, 257], - [41, 256], - [42, 254], - [43, 253], - [44, 251], - [45, 250], - [46, 248], - [47, 247], - [48, 245], - [49, 244], - [50, 242], - [51, 241], - [52, 239], - [53, 238], - [54, 236], - [55, 235], - [56, 233], - [57, 232], - [58, 231], - [59, 229], - [60, 228], - [61, 226], - [62, 225], - [63, 223], - [64, 222], - [65, 221], - [66, 220], - [67, 219], - [68, 219], - [69, 218], - [70, 217], - [71, 216], - [72, 216], - [73, 215], - [74, 214], - [75, 213], - [76, 213], - [77, 212], - [78, 211], - [79, 211], - [80, 210], - [81, 209], - [82, 208], - [83, 208], - [84, 207], - [85, 206], - [86, 205], - [87, 205], - [88, 204], - [89, 203], - [90, 202], - [91, 202], - [92, 201], - [93, 200], - [94, 199], - [95, 199], - [96, 198], - [97, 197], - [98, 196], - [99, 196], - [100, 195], - [101, 194], - [102, 193], - [103, 193], - [104, 192], - [105, 191], - [106, 191], - [107, 190], - [108, 189], - [109, 188], - [110, 188], - [111, 187], - [112, 186], - [113, 185], - [114, 185], - [115, 184], - [116, 183], - [117, 182], - [118, 182], - [119, 181], - [120, 180], - [121, 179], - [122, 179], - [123, 178], - [124, 177], - [125, 176], - [126, 176], - [127, 175], - [128, 174] - ], - "d": "Discount gas costs of calls to the MultiExp precompiles with `k` (point, scalar) pair" - } - }, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/2565.js -var __default5 = { - "name": "EIP-2565", - "number": 2565, - "comment": "ModExp gas cost", - "url": "https://eips.ethereum.org/EIPS/eip-2565", - "status": "Final", - "minimumHardfork": "byzantium", - "gasConfig": {}, - "gasPrices": { - "modexpGquaddivisor": { - "v": 3, - "d": "Gquaddivisor from modexp precompile for gas calculation" - } - }, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/2718.js -var __default6 = { - "name": "EIP-2718", - "comment": "Typed Transaction Envelope", - "url": "https://eips.ethereum.org/EIPS/eip-2718", - "status": "Final", - "minimumHardfork": "chainstart", - "gasConfig": {}, - "gasPrices": {}, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/2929.js -var __default7 = { - "name": "EIP-2929", - "comment": "Gas cost increases for state access opcodes", - "url": "https://eips.ethereum.org/EIPS/eip-2929", - "status": "Final", - "minimumHardfork": "chainstart", - "gasConfig": {}, - "gasPrices": { - "coldsload": { - "v": 2100, - "d": "Gas cost of the first read of storage from a given location (per transaction)" - }, - "coldaccountaccess": { - "v": 2600, - "d": "Gas cost of the first read of a given address (per transaction)" - }, - "warmstorageread": { - "v": 100, - "d": "Gas cost of reading storage locations which have already loaded 'cold'" - }, - "sstoreCleanGasEIP2200": { - "v": 2900, - "d": "Once per SSTORE operation from clean non-zero to something else" - }, - "sstoreNoopGasEIP2200": { - "v": 100, - "d": "Once per SSTORE operation if the value doesn't change" - }, - "sstoreDirtyGasEIP2200": { - "v": 100, - "d": "Once per SSTORE operation if a dirty value is changed" - }, - "sstoreInitRefundEIP2200": { - "v": 19900, - "d": "Once per SSTORE operation for resetting to the original zero value" - }, - "sstoreCleanRefundEIP2200": { - "v": 4900, - "d": "Once per SSTORE operation for resetting to the original non-zero value" - }, - "call": { - "v": 0, - "d": "Base fee of the CALL opcode" - }, - "callcode": { - "v": 0, - "d": "Base fee of the CALLCODE opcode" - }, - "delegatecall": { - "v": 0, - "d": "Base fee of the DELEGATECALL opcode" - }, - "staticcall": { - "v": 0, - "d": "Base fee of the STATICCALL opcode" - }, - "balance": { - "v": 0, - "d": "Base fee of the BALANCE opcode" - }, - "extcodesize": { - "v": 0, - "d": "Base fee of the EXTCODESIZE opcode" - }, - "extcodecopy": { - "v": 0, - "d": "Base fee of the EXTCODECOPY opcode" - }, - "extcodehash": { - "v": 0, - "d": "Base fee of the EXTCODEHASH opcode" - }, - "sload": { - "v": 0, - "d": "Base fee of the SLOAD opcode" - }, - "sstore": { - "v": 0, - "d": "Base fee of the SSTORE opcode" - } - }, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/2930.js -var __default8 = { - "name": "EIP-2930", - "comment": "Optional access lists", - "url": "https://eips.ethereum.org/EIPS/eip-2930", - "status": "Final", - "minimumHardfork": "istanbul", - "requiredEIPs": [2718, 2929], - "gasConfig": {}, - "gasPrices": { - "accessListStorageKeyCost": { - "v": 1900, - "d": "Gas cost per storage key in an Access List transaction" - }, - "accessListAddressCost": { - "v": 2400, - "d": "Gas cost per storage key in an Access List transaction" - } - }, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/3198.js -var __default9 = { - "name": "EIP-3198", - "number": 3198, - "comment": "BASEFEE opcode", - "url": "https://eips.ethereum.org/EIPS/eip-3198", - "status": "Final", - "minimumHardfork": "london", - "gasConfig": {}, - "gasPrices": { - "basefee": { - "v": 2, - "d": "Gas cost of the BASEFEE opcode" - } - }, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/3529.js -var __default10 = { - "name": "EIP-3529", - "comment": "Reduction in refunds", - "url": "https://eips.ethereum.org/EIPS/eip-3529", - "status": "Final", - "minimumHardfork": "berlin", - "requiredEIPs": [2929], - "gasConfig": { - "maxRefundQuotient": { - "v": 5, - "d": "Maximum refund quotient; max tx refund is min(tx.gasUsed/maxRefundQuotient, tx.gasRefund)" - } - }, - "gasPrices": { - "selfdestructRefund": { - "v": 0, - "d": "Refunded following a selfdestruct operation" - }, - "sstoreClearRefundEIP2200": { - "v": 4800, - "d": "Once per SSTORE operation for clearing an originally existing storage slot" - } - }, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/3540.js -var __default11 = { - "name": "EIP-3540", - "number": 3540, - "comment": "EVM Object Format (EOF) v1", - "url": "https://eips.ethereum.org/EIPS/eip-3540", - "status": "Review", - "minimumHardfork": "london", - "requiredEIPs": [3541], - "gasConfig": {}, - "gasPrices": {}, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/3541.js -var __default12 = { - "name": "EIP-3541", - "comment": "Reject new contracts starting with the 0xEF byte", - "url": "https://eips.ethereum.org/EIPS/eip-3541", - "status": "Final", - "minimumHardfork": "berlin", - "requiredEIPs": [], - "gasConfig": {}, - "gasPrices": {}, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/3554.js -var __default13 = { - "name": "EIP-3554", - "comment": "Reduction in refunds", - "url": "Difficulty Bomb Delay to December 1st 2021", - "status": "Final", - "minimumHardfork": "muirGlacier", - "requiredEIPs": [], - "gasConfig": {}, - "gasPrices": {}, - "vm": {}, - "pow": { - "difficultyBombDelay": { - "v": 95e5, - "d": "the amount of blocks to delay the difficulty bomb with" - } - } -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/3607.js -var __default14 = { - "name": "EIP-3607", - "number": 3607, - "comment": "Reject transactions from senders with deployed code", - "url": "https://eips.ethereum.org/EIPS/eip-3607", - "status": "Final", - "minimumHardfork": "chainstart", - "requiredEIPs": [], - "gasConfig": {}, - "gasPrices": {}, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/3651.js -var __default15 = { - "name": "EIP-3651", - "number": 3198, - "comment": "Warm COINBASE", - "url": "https://eips.ethereum.org/EIPS/eip-3651", - "status": "Review", - "minimumHardfork": "london", - "requiredEIPs": [2929], - "gasConfig": {}, - "gasPrices": {}, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/3670.js -var __default16 = { - "name": "EIP-3670", - "number": 3670, - "comment": "EOF - Code Validation", - "url": "https://eips.ethereum.org/EIPS/eip-3670", - "status": "Review", - "minimumHardfork": "london", - "requiredEIPs": [3540], - "gasConfig": {}, - "gasPrices": {}, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/3675.js -var __default17 = { - "name": "EIP-3675", - "number": 3675, - "comment": "Upgrade consensus to Proof-of-Stake", - "url": "https://eips.ethereum.org/EIPS/eip-3675", - "status": "Final", - "minimumHardfork": "london", - "requiredEIPs": [], - "gasConfig": {}, - "gasPrices": {}, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/3855.js -var __default18 = { - "name": "EIP-3855", - "number": 3855, - "comment": "PUSH0 instruction", - "url": "https://eips.ethereum.org/EIPS/eip-3855", - "status": "Review", - "minimumHardfork": "chainstart", - "requiredEIPs": [], - "gasConfig": {}, - "gasPrices": { - "push0": { - "v": 2, - "d": "Base fee of the PUSH0 opcode" - } - }, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/3860.js -var __default19 = { - "name": "EIP-3860", - "number": 3860, - "comment": "Limit and meter initcode", - "url": "https://eips.ethereum.org/EIPS/eip-3860", - "status": "Review", - "minimumHardfork": "spuriousDragon", - "requiredEIPs": [], - "gasConfig": {}, - "gasPrices": { - "initCodeWordCost": { - "v": 2, - "d": "Gas to pay for each word (32 bytes) of initcode when creating a contract" - } - }, - "vm": { - "maxInitCodeSize": { - "v": 49152, - "d": "Maximum length of initialization code when creating a contract" - } - }, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/4345.js -var __default20 = { - "name": "EIP-4345", - "number": 4345, - "comment": "Difficulty Bomb Delay to June 2022", - "url": "https://eips.ethereum.org/EIPS/eip-4345", - "status": "Final", - "minimumHardfork": "london", - "gasConfig": {}, - "gasPrices": {}, - "vm": {}, - "pow": { - "difficultyBombDelay": { - "v": 107e5, - "d": "the amount of blocks to delay the difficulty bomb with" - } - } -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/4399.js -var __default21 = { - "name": "EIP-4399", - "number": 4399, - "comment": "Supplant DIFFICULTY opcode with PREVRANDAO", - "url": "https://eips.ethereum.org/EIPS/eip-4399", - "status": "Review", - "minimumHardfork": "london", - "requiredEIPs": [], - "gasConfig": {}, - "gasPrices": {}, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/5133.js -var __default22 = { - "name": "EIP-5133", - "number": 5133, - "comment": "Delaying Difficulty Bomb to mid-September 2022", - "url": "https://eips.ethereum.org/EIPS/eip-5133", - "status": "Draft", - "minimumHardfork": "grayGlacier", - "gasConfig": {}, - "gasPrices": {}, - "vm": {}, - "pow": { - "difficultyBombDelay": { - "v": 114e5, - "d": "the amount of blocks to delay the difficulty bomb with" - } - } -}; - -// node_modules/web3-eth-accounts/lib/esm/common/eips/index.js -var EIPs = { - 1153: __default, - 1559: __default2, - 2315: __default3, - 2537: __default4, - 2565: __default5, - 2718: __default6, - 2929: __default7, - 2930: __default8, - 3198: __default9, - 3529: __default10, - 3540: __default11, - 3541: __default12, - 3554: __default13, - 3607: __default14, - 3651: __default15, - 3670: __default16, - 3675: __default17, - 3855: __default18, - 3860: __default19, - 4345: __default20, - 4399: __default21, - 5133: __default22 -}; - -// node_modules/web3-eth-accounts/lib/esm/common/hardforks/chainstart.js -var chainstart_default = { - "name": "chainstart", - "comment": "Start of the Ethereum main chain", - "url": "", - "status": "", - "gasConfig": { - "minGasLimit": { - "v": 5e3, - "d": "Minimum the gas limit may ever be" - }, - "gasLimitBoundDivisor": { - "v": 1024, - "d": "The bound divisor of the gas limit, used in update calculations" - }, - "maxRefundQuotient": { - "v": 2, - "d": "Maximum refund quotient; max tx refund is min(tx.gasUsed/maxRefundQuotient, tx.gasRefund)" - } - }, - "gasPrices": { - "base": { - "v": 2, - "d": "Gas base cost, used e.g. for ChainID opcode (Istanbul)" - }, - "tierStep": { - "v": [0, 2, 3, 5, 8, 10, 20], - "d": "Once per operation, for a selection of them" - }, - "exp": { - "v": 10, - "d": "Base fee of the EXP opcode" - }, - "expByte": { - "v": 10, - "d": "Times ceil(log256(exponent)) for the EXP instruction" - }, - "sha3": { - "v": 30, - "d": "Base fee of the SHA3 opcode" - }, - "sha3Word": { - "v": 6, - "d": "Once per word of the SHA3 operation's data" - }, - "sload": { - "v": 50, - "d": "Base fee of the SLOAD opcode" - }, - "sstoreSet": { - "v": 2e4, - "d": "Once per SSTORE operation if the zeroness changes from zero" - }, - "sstoreReset": { - "v": 5e3, - "d": "Once per SSTORE operation if the zeroness does not change from zero" - }, - "sstoreRefund": { - "v": 15e3, - "d": "Once per SSTORE operation if the zeroness changes to zero" - }, - "jumpdest": { - "v": 1, - "d": "Base fee of the JUMPDEST opcode" - }, - "log": { - "v": 375, - "d": "Base fee of the LOG opcode" - }, - "logData": { - "v": 8, - "d": "Per byte in a LOG* operation's data" - }, - "logTopic": { - "v": 375, - "d": "Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas" - }, - "create": { - "v": 32e3, - "d": "Base fee of the CREATE opcode" - }, - "call": { - "v": 40, - "d": "Base fee of the CALL opcode" - }, - "callStipend": { - "v": 2300, - "d": "Free gas given at beginning of call" - }, - "callValueTransfer": { - "v": 9e3, - "d": "Paid for CALL when the value transfor is non-zero" - }, - "callNewAccount": { - "v": 25e3, - "d": "Paid for CALL when the destination address didn't exist prior" - }, - "selfdestructRefund": { - "v": 24e3, - "d": "Refunded following a selfdestruct operation" - }, - "memory": { - "v": 3, - "d": "Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL" - }, - "quadCoeffDiv": { - "v": 512, - "d": "Divisor for the quadratic particle of the memory cost equation" - }, - "createData": { - "v": 200, - "d": "" - }, - "tx": { - "v": 21e3, - "d": "Per transaction. NOTE: Not payable on data of calls between transactions" - }, - "txCreation": { - "v": 32e3, - "d": "The cost of creating a contract via tx" - }, - "txDataZero": { - "v": 4, - "d": "Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions" - }, - "txDataNonZero": { - "v": 68, - "d": "Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions" - }, - "copy": { - "v": 3, - "d": "Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added" - }, - "ecRecover": { - "v": 3e3, - "d": "" - }, - "sha256": { - "v": 60, - "d": "" - }, - "sha256Word": { - "v": 12, - "d": "" - }, - "ripemd160": { - "v": 600, - "d": "" - }, - "ripemd160Word": { - "v": 120, - "d": "" - }, - "identity": { - "v": 15, - "d": "" - }, - "identityWord": { - "v": 3, - "d": "" - }, - "stop": { - "v": 0, - "d": "Base fee of the STOP opcode" - }, - "add": { - "v": 3, - "d": "Base fee of the ADD opcode" - }, - "mul": { - "v": 5, - "d": "Base fee of the MUL opcode" - }, - "sub": { - "v": 3, - "d": "Base fee of the SUB opcode" - }, - "div": { - "v": 5, - "d": "Base fee of the DIV opcode" - }, - "sdiv": { - "v": 5, - "d": "Base fee of the SDIV opcode" - }, - "mod": { - "v": 5, - "d": "Base fee of the MOD opcode" - }, - "smod": { - "v": 5, - "d": "Base fee of the SMOD opcode" - }, - "addmod": { - "v": 8, - "d": "Base fee of the ADDMOD opcode" - }, - "mulmod": { - "v": 8, - "d": "Base fee of the MULMOD opcode" - }, - "signextend": { - "v": 5, - "d": "Base fee of the SIGNEXTEND opcode" - }, - "lt": { - "v": 3, - "d": "Base fee of the LT opcode" - }, - "gt": { - "v": 3, - "d": "Base fee of the GT opcode" - }, - "slt": { - "v": 3, - "d": "Base fee of the SLT opcode" - }, - "sgt": { - "v": 3, - "d": "Base fee of the SGT opcode" - }, - "eq": { - "v": 3, - "d": "Base fee of the EQ opcode" - }, - "iszero": { - "v": 3, - "d": "Base fee of the ISZERO opcode" - }, - "and": { - "v": 3, - "d": "Base fee of the AND opcode" - }, - "or": { - "v": 3, - "d": "Base fee of the OR opcode" - }, - "xor": { - "v": 3, - "d": "Base fee of the XOR opcode" - }, - "not": { - "v": 3, - "d": "Base fee of the NOT opcode" - }, - "byte": { - "v": 3, - "d": "Base fee of the BYTE opcode" - }, - "address": { - "v": 2, - "d": "Base fee of the ADDRESS opcode" - }, - "balance": { - "v": 20, - "d": "Base fee of the BALANCE opcode" - }, - "origin": { - "v": 2, - "d": "Base fee of the ORIGIN opcode" - }, - "caller": { - "v": 2, - "d": "Base fee of the CALLER opcode" - }, - "callvalue": { - "v": 2, - "d": "Base fee of the CALLVALUE opcode" - }, - "calldataload": { - "v": 3, - "d": "Base fee of the CALLDATALOAD opcode" - }, - "calldatasize": { - "v": 2, - "d": "Base fee of the CALLDATASIZE opcode" - }, - "calldatacopy": { - "v": 3, - "d": "Base fee of the CALLDATACOPY opcode" - }, - "codesize": { - "v": 2, - "d": "Base fee of the CODESIZE opcode" - }, - "codecopy": { - "v": 3, - "d": "Base fee of the CODECOPY opcode" - }, - "gasprice": { - "v": 2, - "d": "Base fee of the GASPRICE opcode" - }, - "extcodesize": { - "v": 20, - "d": "Base fee of the EXTCODESIZE opcode" - }, - "extcodecopy": { - "v": 20, - "d": "Base fee of the EXTCODECOPY opcode" - }, - "blockhash": { - "v": 20, - "d": "Base fee of the BLOCKHASH opcode" - }, - "coinbase": { - "v": 2, - "d": "Base fee of the COINBASE opcode" - }, - "timestamp": { - "v": 2, - "d": "Base fee of the TIMESTAMP opcode" - }, - "number": { - "v": 2, - "d": "Base fee of the NUMBER opcode" - }, - "difficulty": { - "v": 2, - "d": "Base fee of the DIFFICULTY opcode" - }, - "gaslimit": { - "v": 2, - "d": "Base fee of the GASLIMIT opcode" - }, - "pop": { - "v": 2, - "d": "Base fee of the POP opcode" - }, - "mload": { - "v": 3, - "d": "Base fee of the MLOAD opcode" - }, - "mstore": { - "v": 3, - "d": "Base fee of the MSTORE opcode" - }, - "mstore8": { - "v": 3, - "d": "Base fee of the MSTORE8 opcode" - }, - "sstore": { - "v": 0, - "d": "Base fee of the SSTORE opcode" - }, - "jump": { - "v": 8, - "d": "Base fee of the JUMP opcode" - }, - "jumpi": { - "v": 10, - "d": "Base fee of the JUMPI opcode" - }, - "pc": { - "v": 2, - "d": "Base fee of the PC opcode" - }, - "msize": { - "v": 2, - "d": "Base fee of the MSIZE opcode" - }, - "gas": { - "v": 2, - "d": "Base fee of the GAS opcode" - }, - "push": { - "v": 3, - "d": "Base fee of the PUSH opcode" - }, - "dup": { - "v": 3, - "d": "Base fee of the DUP opcode" - }, - "swap": { - "v": 3, - "d": "Base fee of the SWAP opcode" - }, - "callcode": { - "v": 40, - "d": "Base fee of the CALLCODE opcode" - }, - "return": { - "v": 0, - "d": "Base fee of the RETURN opcode" - }, - "invalid": { - "v": 0, - "d": "Base fee of the INVALID opcode" - }, - "selfdestruct": { - "v": 0, - "d": "Base fee of the SELFDESTRUCT opcode" - } - }, - "vm": { - "stackLimit": { - "v": 1024, - "d": "Maximum size of VM stack allowed" - }, - "callCreateDepth": { - "v": 1024, - "d": "Maximum depth of call/create stack" - }, - "maxExtraDataSize": { - "v": 32, - "d": "Maximum size extra data may be after Genesis" - } - }, - "pow": { - "minimumDifficulty": { - "v": 131072, - "d": "The minimum that the difficulty may ever be" - }, - "difficultyBoundDivisor": { - "v": 2048, - "d": "The bound divisor of the difficulty, used in the update calculations" - }, - "durationLimit": { - "v": 13, - "d": "The decision boundary on the blocktime duration used to determine whether difficulty should go up or not" - }, - "epochDuration": { - "v": 3e4, - "d": "Duration between proof-of-work epochs" - }, - "timebombPeriod": { - "v": 1e5, - "d": "Exponential difficulty timebomb period" - }, - "minerReward": { - "v": "5000000000000000000", - "d": "the amount a miner get rewarded for mining a block" - }, - "difficultyBombDelay": { - "v": 0, - "d": "the amount of blocks to delay the difficulty bomb with" - } - } -}; - -// node_modules/web3-eth-accounts/lib/esm/common/hardforks/dao.js -var dao_default = { - "name": "dao", - "comment": "DAO rescue hardfork", - "url": "https://eips.ethereum.org/EIPS/eip-779", - "status": "Final", - "gasConfig": {}, - "gasPrices": {}, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/hardforks/homestead.js -var homestead_default = { - "name": "homestead", - "comment": "Homestead hardfork with protocol and network changes", - "url": "https://eips.ethereum.org/EIPS/eip-606", - "status": "Final", - "gasConfig": {}, - "gasPrices": { - "delegatecall": { - "v": 40, - "d": "Base fee of the DELEGATECALL opcode" - } - }, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/hardforks/tangerineWhistle.js -var tangerineWhistle_default = { - "name": "tangerineWhistle", - "comment": "Hardfork with gas cost changes for IO-heavy operations", - "url": "https://eips.ethereum.org/EIPS/eip-608", - "status": "Final", - "gasConfig": {}, - "gasPrices": { - "sload": { - "v": 200, - "d": "Once per SLOAD operation" - }, - "call": { - "v": 700, - "d": "Once per CALL operation & message call transaction" - }, - "extcodesize": { - "v": 700, - "d": "Base fee of the EXTCODESIZE opcode" - }, - "extcodecopy": { - "v": 700, - "d": "Base fee of the EXTCODECOPY opcode" - }, - "balance": { - "v": 400, - "d": "Base fee of the BALANCE opcode" - }, - "delegatecall": { - "v": 700, - "d": "Base fee of the DELEGATECALL opcode" - }, - "callcode": { - "v": 700, - "d": "Base fee of the CALLCODE opcode" - }, - "selfdestruct": { - "v": 5e3, - "d": "Base fee of the SELFDESTRUCT opcode" - } - }, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/hardforks/spuriousDragon.js -var spuriousDragon_default = { - "name": "spuriousDragon", - "comment": "HF with EIPs for simple replay attack protection, EXP cost increase, state trie clearing, contract code size limit", - "url": "https://eips.ethereum.org/EIPS/eip-607", - "status": "Final", - "gasConfig": {}, - "gasPrices": { - "expByte": { - "v": 50, - "d": "Times ceil(log256(exponent)) for the EXP instruction" - } - }, - "vm": { - "maxCodeSize": { - "v": 24576, - "d": "Maximum length of contract code" - } - }, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/hardforks/byzantium.js -var byzantium_default = { - "name": "byzantium", - "comment": "Hardfork with new precompiles, instructions and other protocol changes", - "url": "https://eips.ethereum.org/EIPS/eip-609", - "status": "Final", - "gasConfig": {}, - "gasPrices": { - "modexpGquaddivisor": { - "v": 20, - "d": "Gquaddivisor from modexp precompile for gas calculation" - }, - "ecAdd": { - "v": 500, - "d": "Gas costs for curve addition precompile" - }, - "ecMul": { - "v": 4e4, - "d": "Gas costs for curve multiplication precompile" - }, - "ecPairing": { - "v": 1e5, - "d": "Base gas costs for curve pairing precompile" - }, - "ecPairingWord": { - "v": 8e4, - "d": "Gas costs regarding curve pairing precompile input length" - }, - "revert": { - "v": 0, - "d": "Base fee of the REVERT opcode" - }, - "staticcall": { - "v": 700, - "d": "Base fee of the STATICCALL opcode" - }, - "returndatasize": { - "v": 2, - "d": "Base fee of the RETURNDATASIZE opcode" - }, - "returndatacopy": { - "v": 3, - "d": "Base fee of the RETURNDATACOPY opcode" - } - }, - "vm": {}, - "pow": { - "minerReward": { - "v": "3000000000000000000", - "d": "the amount a miner get rewarded for mining a block" - }, - "difficultyBombDelay": { - "v": 3e6, - "d": "the amount of blocks to delay the difficulty bomb with" - } - } -}; - -// node_modules/web3-eth-accounts/lib/esm/common/hardforks/constantinople.js -var constantinople_default = { - "name": "constantinople", - "comment": "Postponed hardfork including EIP-1283 (SSTORE gas metering changes)", - "url": "https://eips.ethereum.org/EIPS/eip-1013", - "status": "Final", - "gasConfig": {}, - "gasPrices": { - "netSstoreNoopGas": { - "v": 200, - "d": "Once per SSTORE operation if the value doesn't change" - }, - "netSstoreInitGas": { - "v": 2e4, - "d": "Once per SSTORE operation from clean zero" - }, - "netSstoreCleanGas": { - "v": 5e3, - "d": "Once per SSTORE operation from clean non-zero" - }, - "netSstoreDirtyGas": { - "v": 200, - "d": "Once per SSTORE operation from dirty" - }, - "netSstoreClearRefund": { - "v": 15e3, - "d": "Once per SSTORE operation for clearing an originally existing storage slot" - }, - "netSstoreResetRefund": { - "v": 4800, - "d": "Once per SSTORE operation for resetting to the original non-zero value" - }, - "netSstoreResetClearRefund": { - "v": 19800, - "d": "Once per SSTORE operation for resetting to the original zero value" - }, - "shl": { - "v": 3, - "d": "Base fee of the SHL opcode" - }, - "shr": { - "v": 3, - "d": "Base fee of the SHR opcode" - }, - "sar": { - "v": 3, - "d": "Base fee of the SAR opcode" - }, - "extcodehash": { - "v": 400, - "d": "Base fee of the EXTCODEHASH opcode" - }, - "create2": { - "v": 32e3, - "d": "Base fee of the CREATE2 opcode" - } - }, - "vm": {}, - "pow": { - "minerReward": { - "v": "2000000000000000000", - "d": "The amount a miner gets rewarded for mining a block" - }, - "difficultyBombDelay": { - "v": 5e6, - "d": "the amount of blocks to delay the difficulty bomb with" - } - } -}; - -// node_modules/web3-eth-accounts/lib/esm/common/hardforks/petersburg.js -var petersburg_default = { - "name": "petersburg", - "comment": "Aka constantinopleFix, removes EIP-1283, activate together with or after constantinople", - "url": "https://eips.ethereum.org/EIPS/eip-1716", - "status": "Final", - "gasConfig": {}, - "gasPrices": { - "netSstoreNoopGas": { - "v": null, - "d": "Removed along EIP-1283" - }, - "netSstoreInitGas": { - "v": null, - "d": "Removed along EIP-1283" - }, - "netSstoreCleanGas": { - "v": null, - "d": "Removed along EIP-1283" - }, - "netSstoreDirtyGas": { - "v": null, - "d": "Removed along EIP-1283" - }, - "netSstoreClearRefund": { - "v": null, - "d": "Removed along EIP-1283" - }, - "netSstoreResetRefund": { - "v": null, - "d": "Removed along EIP-1283" - }, - "netSstoreResetClearRefund": { - "v": null, - "d": "Removed along EIP-1283" - } - }, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/hardforks/istanbul.js -var istanbul_default = { - "name": "istanbul", - "comment": "HF targeted for December 2019 following the Constantinople/Petersburg HF", - "url": "https://eips.ethereum.org/EIPS/eip-1679", - "status": "Final", - "gasConfig": {}, - "gasPrices": { - "blake2Round": { - "v": 1, - "d": "Gas cost per round for the Blake2 F precompile" - }, - "ecAdd": { - "v": 150, - "d": "Gas costs for curve addition precompile" - }, - "ecMul": { - "v": 6e3, - "d": "Gas costs for curve multiplication precompile" - }, - "ecPairing": { - "v": 45e3, - "d": "Base gas costs for curve pairing precompile" - }, - "ecPairingWord": { - "v": 34e3, - "d": "Gas costs regarding curve pairing precompile input length" - }, - "txDataNonZero": { - "v": 16, - "d": "Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions" - }, - "sstoreSentryGasEIP2200": { - "v": 2300, - "d": "Minimum gas required to be present for an SSTORE call, not consumed" - }, - "sstoreNoopGasEIP2200": { - "v": 800, - "d": "Once per SSTORE operation if the value doesn't change" - }, - "sstoreDirtyGasEIP2200": { - "v": 800, - "d": "Once per SSTORE operation if a dirty value is changed" - }, - "sstoreInitGasEIP2200": { - "v": 2e4, - "d": "Once per SSTORE operation from clean zero to non-zero" - }, - "sstoreInitRefundEIP2200": { - "v": 19200, - "d": "Once per SSTORE operation for resetting to the original zero value" - }, - "sstoreCleanGasEIP2200": { - "v": 5e3, - "d": "Once per SSTORE operation from clean non-zero to something else" - }, - "sstoreCleanRefundEIP2200": { - "v": 4200, - "d": "Once per SSTORE operation for resetting to the original non-zero value" - }, - "sstoreClearRefundEIP2200": { - "v": 15e3, - "d": "Once per SSTORE operation for clearing an originally existing storage slot" - }, - "balance": { - "v": 700, - "d": "Base fee of the BALANCE opcode" - }, - "extcodehash": { - "v": 700, - "d": "Base fee of the EXTCODEHASH opcode" - }, - "chainid": { - "v": 2, - "d": "Base fee of the CHAINID opcode" - }, - "selfbalance": { - "v": 5, - "d": "Base fee of the SELFBALANCE opcode" - }, - "sload": { - "v": 800, - "d": "Base fee of the SLOAD opcode" - } - }, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/hardforks/muirGlacier.js -var muirGlacier_default = { - "name": "muirGlacier", - "comment": "HF to delay the difficulty bomb", - "url": "https://eips.ethereum.org/EIPS/eip-2384", - "status": "Final", - "gasConfig": {}, - "gasPrices": {}, - "vm": {}, - "pow": { - "difficultyBombDelay": { - "v": 9e6, - "d": "the amount of blocks to delay the difficulty bomb with" - } - } -}; - -// node_modules/web3-eth-accounts/lib/esm/common/hardforks/berlin.js -var berlin_default = { - "name": "berlin", - "comment": "HF targeted for July 2020 following the Muir Glacier HF", - "url": "https://eips.ethereum.org/EIPS/eip-2070", - "status": "Final", - "eips": [2565, 2929, 2718, 2930] -}; - -// node_modules/web3-eth-accounts/lib/esm/common/hardforks/london.js -var london_default = { - "name": "london", - "comment": "HF targeted for July 2021 following the Berlin fork", - "url": "https://github.com/ethereum/eth1.0-specs/blob/master/network-upgrades/mainnet-upgrades/london.md", - "status": "Final", - "eips": [1559, 3198, 3529, 3541] -}; - -// node_modules/web3-eth-accounts/lib/esm/common/hardforks/shanghai.js -var shanghai_default = { - "name": "shanghai", - "comment": "Next feature hardfork after the merge hardfork having withdrawals, warm coinbase, push0, limit/meter initcode", - "url": "https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/shanghai.md", - "status": "Final", - "eips": [3651, 3855, 3860, 4895] -}; - -// node_modules/web3-eth-accounts/lib/esm/common/hardforks/arrowGlacier.js -var arrowGlacier_default = { - "name": "arrowGlacier", - "comment": "HF to delay the difficulty bomb", - "url": "https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/arrow-glacier.md", - "status": "Final", - "eips": [4345], - "gasConfig": {}, - "gasPrices": {}, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/hardforks/grayGlacier.js -var grayGlacier_default = { - "name": "grayGlacier", - "comment": "Delaying the difficulty bomb to Mid September 2022", - "url": "https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/gray-glacier.md", - "status": "Draft", - "eips": [5133], - "gasConfig": {}, - "gasPrices": {}, - "vm": {}, - "pow": {} -}; - -// node_modules/web3-eth-accounts/lib/esm/common/hardforks/mergeForkIdTransition.js -var mergeForkIdTransition_default = { - "name": "mergeForkIdTransition", - "comment": "Pre-merge hardfork to fork off non-upgraded clients", - "url": "https://eips.ethereum.org/EIPS/eip-3675", - "status": "Draft", - "eips": [] -}; - -// node_modules/web3-eth-accounts/lib/esm/common/hardforks/merge.js -var merge_default = { - "name": "merge", - "comment": "Hardfork to upgrade the consensus mechanism to Proof-of-Stake", - "url": "https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/merge.md", - "status": "Final", - "consensus": { - "type": "pos", - "algorithm": "casper", - "casper": {} - }, - "eips": [3675, 4399] -}; - -// node_modules/web3-eth-accounts/lib/esm/common/hardforks/index.js -var hardforks = { - chainstart: chainstart_default, - homestead: homestead_default, - dao: dao_default, - tangerineWhistle: tangerineWhistle_default, - spuriousDragon: spuriousDragon_default, - byzantium: byzantium_default, - constantinople: constantinople_default, - petersburg: petersburg_default, - istanbul: istanbul_default, - muirGlacier: muirGlacier_default, - berlin: berlin_default, - london: london_default, - shanghai: shanghai_default, - arrowGlacier: arrowGlacier_default, - grayGlacier: grayGlacier_default, - mergeForkIdTransition: mergeForkIdTransition_default, - merge: merge_default -}; - -// node_modules/web3-eth-accounts/lib/esm/common/common.js -var { buf: crc32Uint8Array } = import_crc_32.default; -var Common = class _Common extends EventEmitter2 { - constructor(opts) { - var _a4, _b; - super(); - this._eips = []; - this._customChains = (_a4 = opts.customChains) !== null && _a4 !== void 0 ? _a4 : []; - this._chainParams = this.setChain(opts.chain); - this.DEFAULT_HARDFORK = (_b = this._chainParams.defaultHardfork) !== null && _b !== void 0 ? _b : Hardfork.Merge; - this.HARDFORK_CHANGES = this.hardforks().map((hf) => [ - hf.name, - hardforks[hf.name] - ]); - this._hardfork = this.DEFAULT_HARDFORK; - if (opts.hardfork !== void 0) { - this.setHardfork(opts.hardfork); - } - if (opts.eips) { - this.setEIPs(opts.eips); - } - } - /** - * Creates a {@link Common} object for a custom chain, based on a standard one. - * - * It uses all the {@link Chain} parameters from the {@link baseChain} option except the ones overridden - * in a provided {@link chainParamsOrName} dictionary. Some usage example: - * - * ```javascript - * Common.custom({chainId: 123}) - * ``` - * - * There are also selected supported custom chains which can be initialized by using one of the - * {@link CustomChains} for {@link chainParamsOrName}, e.g.: - * - * ```javascript - * Common.custom(CustomChains.MaticMumbai) - * ``` - * - * Note that these supported custom chains only provide some base parameters (usually the chain and - * network ID and a name) and can only be used for selected use cases (e.g. sending a tx with - * the `web3-utils/tx` library to a Layer-2 chain). - * - * @param chainParamsOrName Custom parameter dict (`name` will default to `custom-chain`) or string with name of a supported custom chain - * @param opts Custom chain options to set the {@link CustomCommonOpts.baseChain}, selected {@link CustomCommonOpts.hardfork} and others - */ - static custom(chainParamsOrName, opts = {}) { - var _a4; - const baseChain = (_a4 = opts.baseChain) !== null && _a4 !== void 0 ? _a4 : "mainnet"; - const standardChainParams = Object.assign({}, _Common._getChainParams(baseChain)); - standardChainParams.name = "custom-chain"; - if (typeof chainParamsOrName !== "string") { - return new _Common(Object.assign({ chain: Object.assign(Object.assign({}, standardChainParams), chainParamsOrName) }, opts)); - } - if (chainParamsOrName === CustomChain.PolygonMainnet) { - return _Common.custom({ - name: CustomChain.PolygonMainnet, - chainId: 137, - networkId: 137 - }, opts); - } - if (chainParamsOrName === CustomChain.PolygonMumbai) { - return _Common.custom({ - name: CustomChain.PolygonMumbai, - chainId: 80001, - networkId: 80001 - }, opts); - } - if (chainParamsOrName === CustomChain.ArbitrumRinkebyTestnet) { - return _Common.custom({ - name: CustomChain.ArbitrumRinkebyTestnet, - chainId: 421611, - networkId: 421611 - }, opts); - } - if (chainParamsOrName === CustomChain.ArbitrumOne) { - return _Common.custom({ - name: CustomChain.ArbitrumOne, - chainId: 42161, - networkId: 42161 - }, opts); - } - if (chainParamsOrName === CustomChain.xDaiChain) { - return _Common.custom({ - name: CustomChain.xDaiChain, - chainId: 100, - networkId: 100 - }, opts); - } - if (chainParamsOrName === CustomChain.OptimisticKovan) { - return _Common.custom({ - name: CustomChain.OptimisticKovan, - chainId: 69, - networkId: 69 - }, Object.assign({ hardfork: Hardfork.Berlin }, opts)); - } - if (chainParamsOrName === CustomChain.OptimisticEthereum) { - return _Common.custom({ - name: CustomChain.OptimisticEthereum, - chainId: 10, - networkId: 10 - }, Object.assign({ hardfork: Hardfork.Berlin }, opts)); - } - throw new Error(`Custom chain ${chainParamsOrName} not supported`); - } - /** - * Static method to load and set common from a geth genesis json - * @param genesisJson json of geth configuration - * @param { chain, eips, genesisHash, hardfork, mergeForkIdPostMerge } to further configure the common instance - * @returns Common - */ - static fromGethGenesis(genesisJson, { chain, eips, genesisHash, hardfork, mergeForkIdPostMerge }) { - var _a4; - const genesisParams = parseGethGenesis(genesisJson, chain, mergeForkIdPostMerge); - const common = new _Common({ - chain: (_a4 = genesisParams.name) !== null && _a4 !== void 0 ? _a4 : "custom", - customChains: [genesisParams], - eips, - hardfork: hardfork !== null && hardfork !== void 0 ? hardfork : genesisParams.hardfork - }); - if (genesisHash !== void 0) { - common.setForkHashes(genesisHash); - } - return common; - } - /** - * Static method to determine if a {@link chainId} is supported as a standard chain - * @param chainId bigint id (`1`) of a standard chain - * @returns boolean - */ - static isSupportedChainId(chainId) { - const initializedChains = this._getInitializedChains(); - return Boolean(initializedChains.names[chainId.toString()]); - } - static _getChainParams(_chain, customChains) { - let chain = _chain; - const initializedChains = this._getInitializedChains(customChains); - if (typeof chain === "number" || typeof chain === "bigint") { - chain = chain.toString(); - if (initializedChains.names[chain]) { - const name2 = initializedChains.names[chain]; - return initializedChains[name2]; - } - throw new Error(`Chain with ID ${chain} not supported`); - } - if (initializedChains[chain] !== void 0) { - return initializedChains[chain]; - } - throw new Error(`Chain with name ${chain} not supported`); - } - /** - * Sets the chain - * @param chain String ('mainnet') or Number (1) chain representation. - * Or, a Dictionary of chain parameters for a private network. - * @returns The dictionary with parameters set as chain - */ - setChain(chain) { - if (typeof chain === "number" || typeof chain === "bigint" || typeof chain === "string") { - this._chainParams = _Common._getChainParams(chain, this._customChains); - } else if (typeof chain === "object") { - if (this._customChains.length > 0) { - throw new Error("Chain must be a string, number, or bigint when initialized with customChains passed in"); - } - const required = ["networkId", "genesis", "hardforks", "bootstrapNodes"]; - for (const param of required) { - if (!(param in chain)) { - throw new Error(`Missing required chain parameter: ${param}`); - } - } - this._chainParams = chain; - } else { - throw new Error("Wrong input format"); - } - for (const hf of this.hardforks()) { - if (hf.block === void 0) { - throw new Error(`Hardfork cannot have undefined block number`); - } - } - return this._chainParams; - } - /** - * Sets the hardfork to get params for - * @param hardfork String identifier (e.g. 'byzantium') or {@link Hardfork} enum - */ - setHardfork(hardfork) { - let existing = false; - for (const hfChanges of this.HARDFORK_CHANGES) { - if (hfChanges[0] === hardfork) { - if (this._hardfork !== hardfork) { - this._hardfork = hardfork; - this.emit("hardforkChanged", hardfork); - } - existing = true; - } - } - if (!existing) { - throw new Error(`Hardfork with name ${hardfork} not supported`); - } - } - /** - * Returns the hardfork based on the block number or an optional - * total difficulty (Merge HF) provided. - * - * An optional TD takes precedence in case the corresponding HF block - * is set to `null` or otherwise needs to match (if not an error - * will be thrown). - * - * @param blockNumber - * @param td : total difficulty of the parent block (for block hf) OR of the chain latest (for chain hf) - * @param timestamp: timestamp in seconds at which block was/is to be minted - * @returns The name of the HF - */ - getHardforkByBlockNumber(_blockNumber, _td, _timestamp) { - const blockNumber = toType(_blockNumber, TypeOutput.BigInt); - const td = toType(_td, TypeOutput.BigInt); - const timestamp = toType(_timestamp, TypeOutput.Number); - const hfs = this.hardforks().filter((hf) => ( - // eslint-disable-next-line no-null/no-null - hf.block !== null || // eslint-disable-next-line no-null/no-null - hf.ttd !== null && hf.ttd !== void 0 || hf.timestamp !== void 0 - )); - const mergeIndex = hfs.findIndex((hf) => hf.ttd !== null && hf.ttd !== void 0); - const doubleTTDHF = hfs.slice(mergeIndex + 1).findIndex((hf) => hf.ttd !== null && hf.ttd !== void 0); - if (doubleTTDHF >= 0) { - throw Error(`More than one merge hardforks found with ttd specified`); - } - let hfIndex = hfs.findIndex((hf) => ( - // eslint-disable-next-line no-null/no-null - hf.block !== null && hf.block > blockNumber || timestamp !== void 0 && Number(hf.timestamp) > timestamp - )); - if (hfIndex === -1) { - hfIndex = hfs.length; - } else if (hfIndex === 0) { - throw Error("Must have at least one hardfork at block 0"); - } - if (timestamp === void 0) { - const stepBack = hfs.slice(0, hfIndex).reverse().findIndex((hf) => hf.block !== null || hf.ttd !== void 0); - hfIndex -= stepBack; - } - hfIndex -= 1; - if (hfs[hfIndex].block === null && hfs[hfIndex].timestamp === void 0) { - if (td === void 0 || td === null || BigInt(hfs[hfIndex].ttd) > td) { - hfIndex -= 1; - } - } else if (mergeIndex >= 0 && td !== void 0 && td !== null) { - if (hfIndex >= mergeIndex && BigInt(hfs[mergeIndex].ttd) > td) { - throw Error("Maximum HF determined by total difficulty is lower than the block number HF"); - } else if (hfIndex < mergeIndex && BigInt(hfs[mergeIndex].ttd) <= td) { - throw Error("HF determined by block number is lower than the minimum total difficulty HF"); - } - } - const hfStartIndex = hfIndex; - for (; hfIndex < hfs.length - 1; hfIndex += 1) { - if (hfs[hfIndex].block !== hfs[hfIndex + 1].block || hfs[hfIndex].timestamp !== hfs[hfIndex + 1].timestamp) { - break; - } - } - if (timestamp) { - const minTimeStamp = hfs.slice(0, hfStartIndex).reduce((acc, hf) => { - var _a4; - return Math.max(Number((_a4 = hf.timestamp) !== null && _a4 !== void 0 ? _a4 : "0"), acc); - }, 0); - if (minTimeStamp > timestamp) { - throw Error(`Maximum HF determined by timestamp is lower than the block number/ttd HF`); - } - const maxTimeStamp = hfs.slice(hfIndex + 1).reduce((acc, hf) => { - var _a4; - return Math.min(Number((_a4 = hf.timestamp) !== null && _a4 !== void 0 ? _a4 : timestamp), acc); - }, timestamp); - if (maxTimeStamp < timestamp) { - throw Error(`Maximum HF determined by block number/ttd is lower than timestamp HF`); - } - } - const hardfork = hfs[hfIndex]; - return hardfork.name; - } - /** - * Sets a new hardfork based on the block number or an optional - * total difficulty (Merge HF) provided. - * - * An optional TD takes precedence in case the corresponding HF block - * is set to `null` or otherwise needs to match (if not an error - * will be thrown). - * - * @param blockNumber - * @param td - * @param timestamp - * @returns The name of the HF set - */ - setHardforkByBlockNumber(blockNumber, td, timestamp) { - const hardfork = this.getHardforkByBlockNumber(blockNumber, td, timestamp); - this.setHardfork(hardfork); - return hardfork; - } - /** - * Internal helper function, returns the params for the given hardfork for the chain set - * @param hardfork Hardfork name - * @returns Dictionary with hardfork params or null if hardfork not on chain - */ - // eslint-disable-next-line @typescript-eslint/ban-types - _getHardfork(hardfork) { - const hfs = this.hardforks(); - for (const hf of hfs) { - if (hf.name === hardfork) - return hf; - } - return null; - } - /** - * Sets the active EIPs - * @param eips - */ - setEIPs(eips = []) { - for (const eip of eips) { - if (!(eip in EIPs)) { - throw new Error(`${eip} not supported`); - } - const minHF = this.gteHardfork(EIPs[eip].minimumHardfork); - if (!minHF) { - throw new Error( - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - `${eip} cannot be activated on hardfork ${this.hardfork()}, minimumHardfork: ${minHF}` - ); - } - if (EIPs[eip].requiredEIPs !== void 0) { - for (const elem of EIPs[eip].requiredEIPs) { - if (!(eips.includes(elem) || this.isActivatedEIP(elem))) { - throw new Error( - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - `${eip} requires EIP ${elem}, but is not included in the EIP list` - ); - } - } - } - } - this._eips = eips; - } - /** - * Returns a parameter for the current chain setup - * - * If the parameter is present in an EIP, the EIP always takes precedence. - * Otherwise the parameter if taken from the latest applied HF with - * a change on the respective parameter. - * - * @param topic Parameter topic ('gasConfig', 'gasPrices', 'vm', 'pow') - * @param name Parameter name (e.g. 'minGasLimit' for 'gasConfig' topic) - * @returns The value requested or `BigInt(0)` if not found - */ - param(topic, name2) { - let value; - for (const eip of this._eips) { - value = this.paramByEIP(topic, name2, eip); - if (value !== void 0) - return value; - } - return this.paramByHardfork(topic, name2, this._hardfork); - } - /** - * Returns the parameter corresponding to a hardfork - * @param topic Parameter topic ('gasConfig', 'gasPrices', 'vm', 'pow') - * @param name Parameter name (e.g. 'minGasLimit' for 'gasConfig' topic) - * @param hardfork Hardfork name - * @returns The value requested or `BigInt(0)` if not found - */ - paramByHardfork(topic, name2, hardfork) { - let value = null; - for (const hfChanges of this.HARDFORK_CHANGES) { - if ("eips" in hfChanges[1]) { - const hfEIPs = hfChanges[1].eips; - for (const eip of hfEIPs) { - const valueEIP = this.paramByEIP(topic, name2, eip); - value = typeof valueEIP === "bigint" ? valueEIP : value; - } - } else { - if (hfChanges[1][topic] === void 0) { - throw new Error(`Topic ${topic} not defined`); - } - if (hfChanges[1][topic][name2] !== void 0) { - value = hfChanges[1][topic][name2].v; - } - } - if (hfChanges[0] === hardfork) - break; - } - return BigInt(value !== null && value !== void 0 ? value : 0); - } - /** - * Returns a parameter corresponding to an EIP - * @param topic Parameter topic ('gasConfig', 'gasPrices', 'vm', 'pow') - * @param name Parameter name (e.g. 'minGasLimit' for 'gasConfig' topic) - * @param eip Number of the EIP - * @returns The value requested or `undefined` if not found - */ - // eslint-disable-next-line class-methods-use-this - paramByEIP(topic, name2, eip) { - if (!(eip in EIPs)) { - throw new Error(`${eip} not supported`); - } - const eipParams = EIPs[eip]; - if (!(topic in eipParams)) { - throw new Error(`Topic ${topic} not defined`); - } - if (eipParams[topic][name2] === void 0) { - return void 0; - } - const value = eipParams[topic][name2].v; - return BigInt(value); - } - /** - * Returns a parameter for the hardfork active on block number or - * optional provided total difficulty (Merge HF) - * @param topic Parameter topic - * @param name Parameter name - * @param blockNumber Block number - * @param td Total difficulty - * * @returns The value requested or `BigInt(0)` if not found - */ - paramByBlock(topic, name2, blockNumber, td, timestamp) { - const hardfork = this.getHardforkByBlockNumber(blockNumber, td, timestamp); - return this.paramByHardfork(topic, name2, hardfork); - } - /** - * Checks if an EIP is activated by either being included in the EIPs - * manually passed in with the {@link CommonOpts.eips} or in a - * hardfork currently being active - * - * Note: this method only works for EIPs being supported - * by the {@link CommonOpts.eips} constructor option - * @param eip - */ - isActivatedEIP(eip) { - if (this.eips().includes(eip)) { - return true; - } - for (const hfChanges of this.HARDFORK_CHANGES) { - const hf = hfChanges[1]; - if (this.gteHardfork(hf.name) && "eips" in hf) { - if (hf.eips.includes(eip)) { - return true; - } - } - } - return false; - } - /** - * Checks if set or provided hardfork is active on block number - * @param hardfork Hardfork name or null (for HF set) - * @param blockNumber - * @returns True if HF is active on block number - */ - hardforkIsActiveOnBlock(_hardfork, _blockNumber) { - const blockNumber = toType(_blockNumber, TypeOutput.BigInt); - const hardfork = _hardfork !== null && _hardfork !== void 0 ? _hardfork : this._hardfork; - const hfBlock = this.hardforkBlock(hardfork); - if (typeof hfBlock === "bigint" && hfBlock !== BigInt(0) && blockNumber >= hfBlock) { - return true; - } - return false; - } - /** - * Alias to hardforkIsActiveOnBlock when hardfork is set - * @param blockNumber - * @returns True if HF is active on block number - */ - activeOnBlock(blockNumber) { - return this.hardforkIsActiveOnBlock(null, blockNumber); - } - /** - * Sequence based check if given or set HF1 is greater than or equal HF2 - * @param hardfork1 Hardfork name or null (if set) - * @param hardfork2 Hardfork name - * @param opts Hardfork options - * @returns True if HF1 gte HF2 - */ - hardforkGteHardfork(_hardfork1, hardfork2) { - const hardfork1 = _hardfork1 !== null && _hardfork1 !== void 0 ? _hardfork1 : this._hardfork; - const hardforks2 = this.hardforks(); - let posHf1 = -1; - let posHf2 = -1; - let index = 0; - for (const hf of hardforks2) { - if (hf.name === hardfork1) - posHf1 = index; - if (hf.name === hardfork2) - posHf2 = index; - index += 1; - } - return posHf1 >= posHf2 && posHf2 !== -1; - } - /** - * Alias to hardforkGteHardfork when hardfork is set - * @param hardfork Hardfork name - * @returns True if hardfork set is greater than hardfork provided - */ - gteHardfork(hardfork) { - return this.hardforkGteHardfork(null, hardfork); - } - /** - * Returns the hardfork change block for hardfork provided or set - * @param hardfork Hardfork name, optional if HF set - * @returns Block number or null if unscheduled - */ - // eslint-disable-next-line @typescript-eslint/ban-types - hardforkBlock(_hardfork) { - var _a4; - const hardfork = _hardfork !== null && _hardfork !== void 0 ? _hardfork : this._hardfork; - const block = (_a4 = this._getHardfork(hardfork)) === null || _a4 === void 0 ? void 0 : _a4.block; - if (block === void 0 || block === null) { - return null; - } - return BigInt(block); - } - // eslint-disable-next-line @typescript-eslint/ban-types - hardforkTimestamp(_hardfork) { - var _a4; - const hardfork = _hardfork !== null && _hardfork !== void 0 ? _hardfork : this._hardfork; - const timestamp = (_a4 = this._getHardfork(hardfork)) === null || _a4 === void 0 ? void 0 : _a4.timestamp; - if (timestamp === void 0 || timestamp === null) { - return null; - } - return BigInt(timestamp); - } - /** - * Returns the hardfork change block for eip - * @param eip EIP number - * @returns Block number or null if unscheduled - */ - // eslint-disable-next-line @typescript-eslint/ban-types - eipBlock(eip) { - for (const hfChanges of this.HARDFORK_CHANGES) { - const hf = hfChanges[1]; - if ("eips" in hf) { - if (hf.eips.includes(eip)) { - return this.hardforkBlock(typeof hfChanges[0] === "number" ? String(hfChanges[0]) : hfChanges[0]); - } - } - } - return null; - } - /** - * Returns the hardfork change total difficulty (Merge HF) for hardfork provided or set - * @param hardfork Hardfork name, optional if HF set - * @returns Total difficulty or null if no set - */ - // eslint-disable-next-line @typescript-eslint/ban-types - hardforkTTD(_hardfork) { - var _a4; - const hardfork = _hardfork !== null && _hardfork !== void 0 ? _hardfork : this._hardfork; - const ttd = (_a4 = this._getHardfork(hardfork)) === null || _a4 === void 0 ? void 0 : _a4.ttd; - if (ttd === void 0 || ttd === null) { - return null; - } - return BigInt(ttd); - } - /** - * True if block number provided is the hardfork (given or set) change block - * @param blockNumber Number of the block to check - * @param hardfork Hardfork name, optional if HF set - * @returns True if blockNumber is HF block - * @deprecated - */ - isHardforkBlock(_blockNumber, _hardfork) { - const blockNumber = toType(_blockNumber, TypeOutput.BigInt); - const hardfork = _hardfork !== null && _hardfork !== void 0 ? _hardfork : this._hardfork; - const block = this.hardforkBlock(hardfork); - return typeof block === "bigint" && block !== BigInt(0) ? block === blockNumber : false; - } - /** - * Returns the change block for the next hardfork after the hardfork provided or set - * @param hardfork Hardfork name, optional if HF set - * @returns Block timestamp, number or null if not available - */ - // eslint-disable-next-line @typescript-eslint/ban-types - nextHardforkBlockOrTimestamp(_hardfork) { - var _a4, _b; - const hardfork = _hardfork !== null && _hardfork !== void 0 ? _hardfork : this._hardfork; - const hfs = this.hardforks(); - let hfIndex = hfs.findIndex((hf) => hf.name === hardfork); - if (hardfork === Hardfork.Merge) { - hfIndex -= 1; - } - if (hfIndex < 0) { - return null; - } - let currHfTimeOrBlock = (_a4 = hfs[hfIndex].timestamp) !== null && _a4 !== void 0 ? _a4 : hfs[hfIndex].block; - currHfTimeOrBlock = // eslint-disable-next-line no-null/no-null - currHfTimeOrBlock !== null && currHfTimeOrBlock !== void 0 ? Number(currHfTimeOrBlock) : ( - // eslint-disable-next-line no-null/no-null - null - ); - const nextHf = hfs.slice(hfIndex + 1).find((hf) => { - var _a5; - let hfTimeOrBlock = (_a5 = hf.timestamp) !== null && _a5 !== void 0 ? _a5 : hf.block; - hfTimeOrBlock = // eslint-disable-next-line no-null/no-null - hfTimeOrBlock !== null && hfTimeOrBlock !== void 0 ? Number(hfTimeOrBlock) : ( - // eslint-disable-next-line no-null/no-null - null - ); - return hf.name !== Hardfork.Merge && // eslint-disable-next-line no-null/no-null - hfTimeOrBlock !== null && hfTimeOrBlock !== void 0 && hfTimeOrBlock !== currHfTimeOrBlock; - }); - if (nextHf === void 0) { - return null; - } - const nextHfBlock = (_b = nextHf.timestamp) !== null && _b !== void 0 ? _b : nextHf.block; - if (nextHfBlock === null || nextHfBlock === void 0) { - return null; - } - return BigInt(nextHfBlock); - } - /** - * Returns the change block for the next hardfork after the hardfork provided or set - * @param hardfork Hardfork name, optional if HF set - * @returns Block number or null if not available - * @deprecated - */ - // eslint-disable-next-line @typescript-eslint/ban-types - nextHardforkBlock(_hardfork) { - const hardfork = _hardfork !== null && _hardfork !== void 0 ? _hardfork : this._hardfork; - let hfBlock = this.hardforkBlock(hardfork); - if (hfBlock === null && hardfork === Hardfork.Merge) { - const hfs = this.hardforks(); - const mergeIndex = hfs.findIndex((hf) => hf.ttd !== null && hf.ttd !== void 0); - if (mergeIndex < 0) { - throw Error(`Merge hardfork should have been found`); - } - hfBlock = this.hardforkBlock(hfs[mergeIndex - 1].name); - } - if (hfBlock === null) { - return null; - } - const nextHfBlock = this.hardforks().reduce((acc, hf) => { - const block = BigInt( - // eslint-disable-next-line no-null/no-null - hf.block === null || hf.ttd !== void 0 && hf.ttd !== null ? 0 : hf.block - ); - return block > hfBlock && acc === null ? block : acc; - }, null); - return nextHfBlock; - } - /** - * True if block number provided is the hardfork change block following the hardfork given or set - * @param blockNumber Number of the block to check - * @param hardfork Hardfork name, optional if HF set - * @returns True if blockNumber is HF block - * @deprecated - */ - isNextHardforkBlock(_blockNumber, _hardfork) { - const blockNumber = toType(_blockNumber, TypeOutput.BigInt); - const hardfork = _hardfork !== null && _hardfork !== void 0 ? _hardfork : this._hardfork; - const nextHardforkBlock = this.nextHardforkBlock(hardfork); - return nextHardforkBlock === null ? false : nextHardforkBlock === blockNumber; - } - /** - * Internal helper function to calculate a fork hash - * @param hardfork Hardfork name - * @param genesisHash Genesis block hash of the chain - * @returns Fork hash as hex string - */ - _calcForkHash(hardfork, genesisHash) { - let hfUint8Array = new Uint8Array(); - let prevBlockOrTime = 0; - for (const hf of this.hardforks()) { - const { block, timestamp, name: name2 } = hf; - let blockOrTime = timestamp !== null && timestamp !== void 0 ? timestamp : block; - blockOrTime = blockOrTime !== null ? Number(blockOrTime) : null; - if (typeof blockOrTime === "number" && blockOrTime !== 0 && blockOrTime !== prevBlockOrTime && name2 !== Hardfork.Merge) { - const hfBlockUint8Array = hexToBytes2(blockOrTime.toString(16).padStart(16, "0")); - hfUint8Array = uint8ArrayConcat(hfUint8Array, hfBlockUint8Array); - prevBlockOrTime = blockOrTime; - } - if (hf.name === hardfork) - break; - } - const inputUint8Array = uint8ArrayConcat(genesisHash, hfUint8Array); - const forkhash = bytesToHex2(intToUint8Array(crc32Uint8Array(inputUint8Array) >>> 0)); - return forkhash; - } - /** - * Returns an eth/64 compliant fork hash (EIP-2124) - * @param hardfork Hardfork name, optional if HF set - * @param genesisHash Genesis block hash of the chain, optional if already defined and not needed to be calculated - */ - forkHash(_hardfork, genesisHash) { - const hardfork = _hardfork !== null && _hardfork !== void 0 ? _hardfork : this._hardfork; - const data = this._getHardfork(hardfork); - if ( - // eslint-disable-next-line no-null/no-null - data === null || // eslint-disable-next-line no-null/no-null - (data === null || data === void 0 ? void 0 : data.block) === null && (data === null || data === void 0 ? void 0 : data.timestamp) === void 0 && (data === null || data === void 0 ? void 0 : data.ttd) === void 0 - ) { - const msg = "No fork hash calculation possible for future hardfork"; - throw new Error(msg); - } - if ((data === null || data === void 0 ? void 0 : data.forkHash) !== null && (data === null || data === void 0 ? void 0 : data.forkHash) !== void 0) { - return data.forkHash; - } - if (!genesisHash) - throw new Error("genesisHash required for forkHash calculation"); - return this._calcForkHash(hardfork, genesisHash); - } - /** - * - * @param forkHash Fork hash as a hex string - * @returns Array with hardfork data (name, block, forkHash) - */ - // eslint-disable-next-line @typescript-eslint/ban-types - hardforkForForkHash(forkHash) { - const resArray = this.hardforks().filter((hf) => hf.forkHash === forkHash); - return resArray.length >= 1 ? resArray[resArray.length - 1] : null; - } - /** - * Sets any missing forkHashes on the passed-in {@link Common} instance - * @param common The {@link Common} to set the forkHashes for - * @param genesisHash The genesis block hash - */ - setForkHashes(genesisHash) { - var _a4; - for (const hf of this.hardforks()) { - const blockOrTime = (_a4 = hf.timestamp) !== null && _a4 !== void 0 ? _a4 : hf.block; - if ( - // eslint-disable-next-line no-null/no-null - (hf.forkHash === null || hf.forkHash === void 0) && // eslint-disable-next-line no-null/no-null - (blockOrTime !== null && blockOrTime !== void 0 || typeof hf.ttd !== "undefined") - ) { - hf.forkHash = this.forkHash(hf.name, genesisHash); - } - } - } - /** - * Returns the Genesis parameters of the current chain - * @returns Genesis dictionary - */ - genesis() { - return this._chainParams.genesis; - } - /** - * Returns the hardforks for current chain - * @returns {Array} Array with arrays of hardforks - */ - hardforks() { - return this._chainParams.hardforks; - } - /** - * Returns bootstrap nodes for the current chain - * @returns {Dictionary} Dict with bootstrap nodes - */ - bootstrapNodes() { - return this._chainParams.bootstrapNodes; - } - /** - * Returns DNS networks for the current chain - * @returns {String[]} Array of DNS ENR urls - */ - dnsNetworks() { - return this._chainParams.dnsNetworks; - } - /** - * Returns the hardfork set - * @returns Hardfork name - */ - hardfork() { - return this._hardfork; - } - /** - * Returns the Id of current chain - * @returns chain Id - */ - chainId() { - return BigInt(this._chainParams.chainId); - } - /** - * Returns the name of current chain - * @returns chain name (lower case) - */ - chainName() { - return this._chainParams.name; - } - /** - * Returns the Id of current network - * @returns network Id - */ - networkId() { - return BigInt(this._chainParams.networkId); - } - /** - * Returns the active EIPs - * @returns List of EIPs - */ - eips() { - return this._eips; - } - /** - * Returns the consensus type of the network - * Possible values: "pow"|"poa"|"pos" - * - * Note: This value can update along a Hardfork. - */ - consensusType() { - const hardfork = this.hardfork(); - let value; - for (const hfChanges of this.HARDFORK_CHANGES) { - if ("consensus" in hfChanges[1]) { - value = hfChanges[1].consensus.type; - } - if (hfChanges[0] === hardfork) - break; - } - return value !== null && value !== void 0 ? value : this._chainParams.consensus.type; - } - /** - * Returns the concrete consensus implementation - * algorithm or protocol for the network - * e.g. "ethash" for "pow" consensus type, - * "clique" for "poa" consensus type or - * "casper" for "pos" consensus type. - * - * Note: This value can update along a Hardfork. - */ - consensusAlgorithm() { - const hardfork = this.hardfork(); - let value; - for (const hfChanges of this.HARDFORK_CHANGES) { - if ("consensus" in hfChanges[1]) { - value = hfChanges[1].consensus.algorithm; - } - if (hfChanges[0] === hardfork) - break; - } - return value !== null && value !== void 0 ? value : this._chainParams.consensus.algorithm; - } - /** - * Returns a dictionary with consensus configuration - * parameters based on the consensus algorithm - * - * Expected returns (parameters must be present in - * the respective chain json files): - * - * ethash: empty object - * clique: period, epoch - * casper: empty object - * - * Note: This value can update along a Hardfork. - */ - consensusConfig() { - var _a4; - const hardfork = this.hardfork(); - let value; - for (const hfChanges of this.HARDFORK_CHANGES) { - if ("consensus" in hfChanges[1]) { - value = hfChanges[1].consensus[hfChanges[1].consensus.algorithm]; - } - if (hfChanges[0] === hardfork) - break; - } - return (_a4 = value !== null && value !== void 0 ? value : this._chainParams.consensus[this.consensusAlgorithm()]) !== null && _a4 !== void 0 ? _a4 : {}; - } - /** - * Returns a deep copy of this {@link Common} instance. - */ - copy() { - const copy = Object.assign(Object.create(Object.getPrototypeOf(this)), this); - copy.removeAllListeners(); - return copy; - } - static _getInitializedChains(customChains) { - const names = {}; - for (const [name2, id] of Object.entries(Chain)) { - names[id] = name2.toLowerCase(); - } - const chains = { mainnet: mainnet_default, goerli: goerli_default, sepolia: sepolia_default }; - if (customChains) { - for (const chain of customChains) { - const { name: name2 } = chain; - names[chain.chainId.toString()] = name2; - chains[name2] = chain; - } - } - chains.names = names; - return chains; - } -}; - -// node_modules/web3-eth-accounts/lib/esm/tx/types.js -var Capability; -(function(Capability2) { - Capability2[Capability2["EIP155ReplayProtection"] = 155] = "EIP155ReplayProtection"; - Capability2[Capability2["EIP1559FeeMarket"] = 1559] = "EIP1559FeeMarket"; - Capability2[Capability2["EIP2718TypedTransaction"] = 2718] = "EIP2718TypedTransaction"; - Capability2[Capability2["EIP2930AccessLists"] = 2930] = "EIP2930AccessLists"; -})(Capability || (Capability = {})); -function isAccessListUint8Array(input) { - if (input.length === 0) { - return true; - } - const firstItem = input[0]; - if (Array.isArray(firstItem)) { - return true; - } - return false; -} -function isAccessList(input) { - return !isAccessListUint8Array(input); -} - -// node_modules/web3-eth-accounts/lib/esm/tx/address.js -var Address = class _Address { - constructor(buf) { - if (buf.length !== 20) { - throw new Error("Invalid address length"); - } - this.buf = buf; - } - /** - * Returns the zero address. - */ - static zero() { - return new _Address(zeros(20)); - } - /** - * Is address equal to another. - */ - equals(address) { - return uint8ArrayEquals(this.buf, address.buf); - } - /** - * Is address zero. - */ - isZero() { - return this.equals(_Address.zero()); - } - /** - * Returns hex encoding of address. - */ - toString() { - return bytesToHex2(this.buf); - } - /** - * Returns Uint8Array representation of address. - */ - toArray() { - return this.buf; - } - /** - * Returns the ethereum address of a given public key. - * Accepts "Ethereum public keys" and SEC1 encoded keys. - * @param pubKey The two points of an uncompressed key, unless sanitize is enabled - * @param sanitize Accept public keys in other formats - */ - static publicToAddress(_pubKey, sanitize = false) { - let pubKey = _pubKey; - assertIsUint8Array(pubKey); - if (sanitize && pubKey.length !== 64) { - pubKey = secp256k12.ProjectivePoint.fromHex(pubKey).toRawBytes(false).slice(1); - } - if (pubKey.length !== 64) { - throw new Error("Expected pubKey to be of length 64"); - } - return keccak256(pubKey).slice(-20); - } -}; - -// node_modules/web3-eth-accounts/lib/esm/tx/utils.js -var utils_exports3 = {}; -__export(utils_exports3, { - checkMaxInitCodeSize: () => checkMaxInitCodeSize, - getAccessListData: () => getAccessListData, - getAccessListJSON: () => getAccessListJSON, - getDataFeeEIP2930: () => getDataFeeEIP2930, - verifyAccessList: () => verifyAccessList -}); -var checkMaxInitCodeSize = (common, length) => { - const maxInitCodeSize = common.param("vm", "maxInitCodeSize"); - if (maxInitCodeSize && BigInt(length) > maxInitCodeSize) { - throw new Error(`the initcode size of this transaction is too large: it is ${length} while the max is ${common.param("vm", "maxInitCodeSize")}`); - } -}; -var getAccessListData = (accessList) => { - let AccessListJSON; - let uint8arrayAccessList; - if (isAccessList(accessList)) { - AccessListJSON = accessList; - const newAccessList = []; - for (let i = 0; i < accessList.length; i += 1) { - const item = accessList[i]; - const addressBytes = toUint8Array(item.address); - const storageItems = []; - for (let index = 0; index < item.storageKeys.length; index += 1) { - storageItems.push(toUint8Array(item.storageKeys[index])); - } - newAccessList.push([addressBytes, storageItems]); - } - uint8arrayAccessList = newAccessList; - } else { - uint8arrayAccessList = accessList !== null && accessList !== void 0 ? accessList : []; - const json = []; - for (let i = 0; i < uint8arrayAccessList.length; i += 1) { - const data = uint8arrayAccessList[i]; - const address = bytesToHex2(data[0]); - const storageKeys = []; - for (let item = 0; item < data[1].length; item += 1) { - storageKeys.push(bytesToHex2(data[1][item])); - } - const jsonItem = { - address, - storageKeys - }; - json.push(jsonItem); - } - AccessListJSON = json; - } - return { - AccessListJSON, - accessList: uint8arrayAccessList - }; -}; -var verifyAccessList = (accessList) => { - for (let key = 0; key < accessList.length; key += 1) { - const accessListItem = accessList[key]; - const address = accessListItem[0]; - const storageSlots = accessListItem[1]; - if (accessListItem[2] !== void 0) { - throw new Error("Access list item cannot have 3 elements. It can only have an address, and an array of storage slots."); - } - if (address.length !== 20) { - throw new Error("Invalid EIP-2930 transaction: address length should be 20 bytes"); - } - for (let storageSlot = 0; storageSlot < storageSlots.length; storageSlot += 1) { - if (storageSlots[storageSlot].length !== 32) { - throw new Error("Invalid EIP-2930 transaction: storage slot length should be 32 bytes"); - } - } - } -}; -var getAccessListJSON = (accessList) => { - const accessListJSON = []; - for (let index = 0; index < accessList.length; index += 1) { - const item = accessList[index]; - const JSONItem = { - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/consistent-type-assertions - address: bytesToHex2(setLengthLeft(item[0], 20)), - storageKeys: [] - }; - const storageSlots = item && item[1]; - for (let slot = 0; slot < storageSlots.length; slot += 1) { - const storageSlot = storageSlots[slot]; - JSONItem.storageKeys.push(bytesToHex2(setLengthLeft(storageSlot, 32))); - } - accessListJSON.push(JSONItem); - } - return accessListJSON; -}; -var getDataFeeEIP2930 = (accessList, common) => { - const accessListStorageKeyCost = common.param("gasPrices", "accessListStorageKeyCost"); - const accessListAddressCost = common.param("gasPrices", "accessListAddressCost"); - let slots = 0; - for (let index = 0; index < accessList.length; index += 1) { - const item = accessList[index]; - const storageSlots = item[1]; - slots += storageSlots.length; - } - const addresses = accessList.length; - return addresses * Number(accessListAddressCost) + slots * Number(accessListStorageKeyCost); -}; - -// node_modules/web3-eth-accounts/lib/esm/tx/baseTransaction.js -var BaseTransaction = class { - constructor(txData, opts) { - var _a4, _b; - this.cache = { - hash: void 0, - dataFee: void 0 - }; - this.activeCapabilities = []; - this.DEFAULT_CHAIN = Chain.Mainnet; - this.DEFAULT_HARDFORK = Hardfork.Merge; - const { nonce, gasLimit, to, value, data, v, r, s, type } = txData; - this._type = Number(uint8ArrayToBigInt(toUint8Array(type))); - this.txOptions = opts; - const toB = toUint8Array(to === "" ? "0x" : to); - const vB = toUint8Array(v === "" ? "0x" : v); - const rB = toUint8Array(r === "" ? "0x" : r); - const sB = toUint8Array(s === "" ? "0x" : s); - this.nonce = uint8ArrayToBigInt(toUint8Array(nonce === "" ? "0x" : nonce)); - this.gasLimit = uint8ArrayToBigInt(toUint8Array(gasLimit === "" ? "0x" : gasLimit)); - this.to = toB.length > 0 ? new Address(toB) : void 0; - this.value = uint8ArrayToBigInt(toUint8Array(value === "" ? "0x" : value)); - this.data = toUint8Array(data === "" ? "0x" : data); - this.v = vB.length > 0 ? uint8ArrayToBigInt(vB) : void 0; - this.r = rB.length > 0 ? uint8ArrayToBigInt(rB) : void 0; - this.s = sB.length > 0 ? uint8ArrayToBigInt(sB) : void 0; - this._validateCannotExceedMaxInteger({ value: this.value, r: this.r, s: this.s }); - this._validateCannotExceedMaxInteger({ gasLimit: this.gasLimit }, 64); - this._validateCannotExceedMaxInteger({ nonce: this.nonce }, 64, true); - const createContract = this.to === void 0 || this.to === null; - const allowUnlimitedInitCodeSize = (_a4 = opts.allowUnlimitedInitCodeSize) !== null && _a4 !== void 0 ? _a4 : false; - const common = (_b = opts.common) !== null && _b !== void 0 ? _b : this._getCommon(); - if (createContract && common.isActivatedEIP(3860) && !allowUnlimitedInitCodeSize) { - checkMaxInitCodeSize(common, this.data.length); - } - } - /** - * Returns the transaction type. - * - * Note: legacy txs will return tx type `0`. - */ - get type() { - return this._type; - } - /** - * Checks if a tx type defining capability is active - * on a tx, for example the EIP-1559 fee market mechanism - * or the EIP-2930 access list feature. - * - * Note that this is different from the tx type itself, - * so EIP-2930 access lists can very well be active - * on an EIP-1559 tx for example. - * - * This method can be useful for feature checks if the - * tx type is unknown (e.g. when instantiated with - * the tx factory). - * - * See `Capabilites` in the `types` module for a reference - * on all supported capabilities. - */ - supports(capability) { - return this.activeCapabilities.includes(capability); - } - validate(stringError = false) { - const errors = []; - if (this.getBaseFee() > this.gasLimit) { - errors.push(`gasLimit is too low. given ${this.gasLimit}, need at least ${this.getBaseFee()}`); - } - if (this.isSigned() && !this.verifySignature()) { - errors.push("Invalid Signature"); - } - return stringError ? errors : errors.length === 0; - } - _validateYParity() { - const { v } = this; - if (v !== void 0 && v !== BigInt(0) && v !== BigInt(1)) { - const msg = this._errorMsg("The y-parity of the transaction should either be 0 or 1"); - throw new Error(msg); - } - } - /** - * EIP-2: All transaction signatures whose s-value is greater than secp256k1n/2are considered invalid. - * Reasoning: https://ethereum.stackexchange.com/a/55728 - */ - _validateHighS() { - const { s } = this; - if (this.common.gteHardfork("homestead") && s !== void 0 && s > SECP256K1_ORDER_DIV_2) { - const msg = this._errorMsg("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid"); - throw new Error(msg); - } - } - /** - * The minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee) - */ - getBaseFee() { - const txFee = this.common.param("gasPrices", "tx"); - let fee = this.getDataFee(); - if (txFee) - fee += txFee; - if (this.common.gteHardfork("homestead") && this.toCreationAddress()) { - const txCreationFee = this.common.param("gasPrices", "txCreation"); - if (txCreationFee) - fee += txCreationFee; - } - return fee; - } - /** - * The amount of gas paid for the data in this tx - */ - getDataFee() { - const txDataZero = this.common.param("gasPrices", "txDataZero"); - const txDataNonZero = this.common.param("gasPrices", "txDataNonZero"); - let cost = BigInt(0); - for (let i = 0; i < this.data.length; i += 1) { - this.data[i] === 0 ? cost += txDataZero : cost += txDataNonZero; - } - if ((this.to === void 0 || this.to === null) && this.common.isActivatedEIP(3860)) { - const dataLength = BigInt(Math.ceil(this.data.length / 32)); - const initCodeCost = this.common.param("gasPrices", "initCodeWordCost") * dataLength; - cost += initCodeCost; - } - return cost; - } - /** - * If the tx's `to` is to the creation address - */ - toCreationAddress() { - return this.to === void 0 || this.to.buf.length === 0; - } - isSigned() { - const { v, r, s } = this; - if (v === void 0 || r === void 0 || s === void 0) { - return false; - } - return true; - } - /** - * Determines if the signature is valid - */ - verifySignature() { - try { - const publicKey = this.getSenderPublicKey(); - return unpadUint8Array(publicKey).length !== 0; - } catch (e) { - return false; - } - } - /** - * Returns the sender's address - */ - getSenderAddress() { - return new Address(Address.publicToAddress(this.getSenderPublicKey())); - } - /** - * Signs a transaction. - * - * Note that the signed tx is returned as a new object, - * use as follows: - * ```javascript - * const signedTx = tx.sign(privateKey) - * ``` - */ - sign(privateKey) { - if (privateKey.length !== 32) { - const msg = this._errorMsg("Private key must be 32 bytes in length."); - throw new Error(msg); - } - let hackApplied = false; - if (this.type === 0 && this.common.gteHardfork("spuriousDragon") && !this.supports(Capability.EIP155ReplayProtection)) { - this.activeCapabilities.push(Capability.EIP155ReplayProtection); - hackApplied = true; - } - const msgHash = this.getMessageToSign(true); - const { v, r, s } = this._ecsign(msgHash, privateKey); - const tx = this._processSignature(v, r, s); - if (hackApplied) { - const index = this.activeCapabilities.indexOf(Capability.EIP155ReplayProtection); - if (index > -1) { - this.activeCapabilities.splice(index, 1); - } - } - return tx; - } - /** - * Does chain ID checks on common and returns a common - * to be used on instantiation - * @hidden - * - * @param common - {@link Common} instance from tx options - * @param chainId - Chain ID from tx options (typed txs) or signature (legacy tx) - */ - _getCommon(common, chainId) { - var _a4, _b, _c, _d; - if (chainId !== void 0) { - const chainIdBigInt = uint8ArrayToBigInt(toUint8Array(chainId)); - if (common) { - if (common.chainId() !== chainIdBigInt) { - const msg = this._errorMsg("The chain ID does not match the chain ID of Common"); - throw new Error(msg); - } - return common.copy(); - } - if (Common.isSupportedChainId(chainIdBigInt)) { - return new Common({ chain: chainIdBigInt, hardfork: this.DEFAULT_HARDFORK }); - } - return Common.custom({ - name: "custom-chain", - networkId: chainIdBigInt, - chainId: chainIdBigInt - }, { baseChain: this.DEFAULT_CHAIN, hardfork: this.DEFAULT_HARDFORK }); - } - if ((common === null || common === void 0 ? void 0 : common.copy) && typeof (common === null || common === void 0 ? void 0 : common.copy) === "function") { - return common.copy(); - } - if (common) { - const hardfork = typeof common.hardfork === "function" ? common.hardfork() : ( - // eslint-disable-next-line @typescript-eslint/unbound-method - common.hardfork - ); - return Common.custom({ - name: "custom-chain", - networkId: common.networkId ? common.networkId() : (_b = BigInt((_a4 = common.customChain) === null || _a4 === void 0 ? void 0 : _a4.networkId)) !== null && _b !== void 0 ? _b : void 0, - chainId: common.chainId ? common.chainId() : (_d = BigInt((_c = common.customChain) === null || _c === void 0 ? void 0 : _c.chainId)) !== null && _d !== void 0 ? _d : void 0 - }, { - baseChain: this.DEFAULT_CHAIN, - hardfork: hardfork || this.DEFAULT_HARDFORK - }); - } - return new Common({ chain: this.DEFAULT_CHAIN, hardfork: this.DEFAULT_HARDFORK }); - } - /** - * Validates that an object with BigInt values cannot exceed the specified bit limit. - * @param values Object containing string keys and BigInt values - * @param bits Number of bits to check (64 or 256) - * @param cannotEqual Pass true if the number also cannot equal one less the maximum value - */ - _validateCannotExceedMaxInteger(values, bits = 256, cannotEqual = false) { - for (const [key, value] of Object.entries(values)) { - switch (bits) { - case 64: - if (cannotEqual) { - if (value !== void 0 && value >= MAX_UINT64) { - const msg = this._errorMsg(`${key} cannot equal or exceed MAX_UINT64 (2^64-1), given ${value}`); - throw new Error(msg); - } - } else if (value !== void 0 && value > MAX_UINT64) { - const msg = this._errorMsg(`${key} cannot exceed MAX_UINT64 (2^64-1), given ${value}`); - throw new Error(msg); - } - break; - case 256: - if (cannotEqual) { - if (value !== void 0 && value >= MAX_INTEGER) { - const msg = this._errorMsg(`${key} cannot equal or exceed MAX_INTEGER (2^256-1), given ${value}`); - throw new Error(msg); - } - } else if (value !== void 0 && value > MAX_INTEGER) { - const msg = this._errorMsg(`${key} cannot exceed MAX_INTEGER (2^256-1), given ${value}`); - throw new Error(msg); - } - break; - default: { - const msg = this._errorMsg("unimplemented bits value"); - throw new Error(msg); - } - } - } - } - static _validateNotArray(values) { - const txDataKeys = [ - "nonce", - "gasPrice", - "gasLimit", - "to", - "value", - "data", - "v", - "r", - "s", - "type", - "baseFee", - "maxFeePerGas", - "chainId" - ]; - for (const [key, value] of Object.entries(values)) { - if (txDataKeys.includes(key)) { - if (Array.isArray(value)) { - throw new Error(`${key} cannot be an array`); - } - } - } - } - /** - * Returns the shared error postfix part for _error() method - * tx type implementations. - */ - _getSharedErrorPostfix() { - let hash2 = ""; - try { - hash2 = this.isSigned() ? bytesToHex2(this.hash()) : "not available (unsigned)"; - } catch (e) { - hash2 = "error"; - } - let isSigned = ""; - try { - isSigned = this.isSigned().toString(); - } catch (e) { - hash2 = "error"; - } - let hf = ""; - try { - hf = this.common.hardfork(); - } catch (e) { - hf = "error"; - } - let postfix = `tx type=${this.type} hash=${hash2} nonce=${this.nonce} value=${this.value} `; - postfix += `signed=${isSigned} hf=${hf}`; - return postfix; - } - // eslint-disable-next-line class-methods-use-this - _ecsign(msgHash, privateKey, chainId) { - const signature = secp256k12.sign(msgHash, privateKey); - const signatureBytes = signature.toCompactRawBytes(); - const r = signatureBytes.subarray(0, 32); - const s = signatureBytes.subarray(32, 64); - const v = chainId === void 0 ? BigInt(signature.recovery + 27) : BigInt(signature.recovery + 35) + BigInt(chainId) * BigInt(2); - return { r, s, v }; - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - static fromSerializedTx(serialized, opts = {}) { - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - static fromTxData(txData, opts = {}) { - } -}; - -// node_modules/web3-eth-accounts/lib/esm/tx/eip1559Transaction.js -var TRANSACTION_TYPE = 2; -var TRANSACTION_TYPE_UINT8ARRAY = hexToBytes2(TRANSACTION_TYPE.toString(16).padStart(2, "0")); -var FeeMarketEIP1559Transaction = class _FeeMarketEIP1559Transaction extends BaseTransaction { - /** - * This constructor takes the values, validates them, assigns them and freezes the object. - * - * It is not recommended to use this constructor directly. Instead use - * the static factory methods to assist in creating a Transaction object from - * varying data types. - */ - constructor(txData, opts = {}) { - var _a4; - super(Object.assign(Object.assign({}, txData), { type: TRANSACTION_TYPE }), opts); - this.DEFAULT_HARDFORK = "london"; - const { chainId, accessList, maxFeePerGas, maxPriorityFeePerGas } = txData; - this.common = this._getCommon(opts.common, chainId); - this.chainId = this.common.chainId(); - if (!this.common.isActivatedEIP(1559)) { - throw new Error("EIP-1559 not enabled on Common"); - } - this.activeCapabilities = this.activeCapabilities.concat([1559, 2718, 2930]); - const accessListData = getAccessListData(accessList !== null && accessList !== void 0 ? accessList : []); - this.accessList = accessListData.accessList; - this.AccessListJSON = accessListData.AccessListJSON; - verifyAccessList(this.accessList); - this.maxFeePerGas = uint8ArrayToBigInt(toUint8Array(maxFeePerGas === "" ? "0x" : maxFeePerGas)); - this.maxPriorityFeePerGas = uint8ArrayToBigInt(toUint8Array(maxPriorityFeePerGas === "" ? "0x" : maxPriorityFeePerGas)); - this._validateCannotExceedMaxInteger({ - maxFeePerGas: this.maxFeePerGas, - maxPriorityFeePerGas: this.maxPriorityFeePerGas - }); - BaseTransaction._validateNotArray(txData); - if (this.gasLimit * this.maxFeePerGas > MAX_INTEGER) { - const msg = this._errorMsg("gasLimit * maxFeePerGas cannot exceed MAX_INTEGER (2^256-1)"); - throw new Error(msg); - } - if (this.maxFeePerGas < this.maxPriorityFeePerGas) { - const msg = this._errorMsg("maxFeePerGas cannot be less than maxPriorityFeePerGas (The total must be the larger of the two)"); - throw new Error(msg); - } - this._validateYParity(); - this._validateHighS(); - const freeze = (_a4 = opts === null || opts === void 0 ? void 0 : opts.freeze) !== null && _a4 !== void 0 ? _a4 : true; - if (freeze) { - Object.freeze(this); - } - } - /** - * Instantiate a transaction from a data dictionary. - * - * Format: { chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, - * accessList, v, r, s } - * - * Notes: - * - `chainId` will be set automatically if not provided - * - All parameters are optional and have some basic default values - */ - static fromTxData(txData, opts = {}) { - return new _FeeMarketEIP1559Transaction(txData, opts); - } - /** - * Instantiate a transaction from the serialized tx. - * - * Format: `0x02 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, - * accessList, signatureYParity, signatureR, signatureS])` - */ - static fromSerializedTx(serialized, opts = {}) { - if (!uint8ArrayEquals(serialized.subarray(0, 1), TRANSACTION_TYPE_UINT8ARRAY)) { - throw new Error(`Invalid serialized tx input: not an EIP-1559 transaction (wrong tx type, expected: ${TRANSACTION_TYPE}, received: ${bytesToHex2(serialized.subarray(0, 1))}`); - } - const values = import_rlp.RLP.decode(serialized.subarray(1)); - if (!Array.isArray(values)) { - throw new Error("Invalid serialized tx input: must be array"); - } - return _FeeMarketEIP1559Transaction.fromValuesArray(values, opts); - } - /** - * Create a transaction from a values array. - * - * Format: `[chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, - * accessList, signatureYParity, signatureR, signatureS]` - */ - static fromValuesArray(values, opts = {}) { - if (values.length !== 9 && values.length !== 12) { - throw new Error("Invalid EIP-1559 transaction. Only expecting 9 values (for unsigned tx) or 12 values (for signed tx)."); - } - const [chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, accessList, v, r, s] = values; - this._validateNotArray({ chainId, v }); - validateNoLeadingZeroes({ - nonce, - maxPriorityFeePerGas, - maxFeePerGas, - gasLimit, - value, - v, - r, - s - }); - return new _FeeMarketEIP1559Transaction({ - chainId: uint8ArrayToBigInt(chainId), - nonce, - maxPriorityFeePerGas, - maxFeePerGas, - gasLimit, - to, - value, - data, - accessList: accessList !== null && accessList !== void 0 ? accessList : [], - v: v !== void 0 ? uint8ArrayToBigInt(v) : void 0, - r, - s - }, opts); - } - /** - * The amount of gas paid for the data in this tx - */ - getDataFee() { - if (this.cache.dataFee && this.cache.dataFee.hardfork === this.common.hardfork()) { - return this.cache.dataFee.value; - } - let cost = super.getDataFee(); - cost += BigInt(getDataFeeEIP2930(this.accessList, this.common)); - if (Object.isFrozen(this)) { - this.cache.dataFee = { - value: cost, - hardfork: this.common.hardfork() - }; - } - return cost; - } - /** - * The up front amount that an account must have for this transaction to be valid - * @param baseFee The base fee of the block (will be set to 0 if not provided) - */ - getUpfrontCost(baseFee = BigInt(0)) { - const prio = this.maxPriorityFeePerGas; - const maxBase = this.maxFeePerGas - baseFee; - const inclusionFeePerGas = prio < maxBase ? prio : maxBase; - const gasPrice = inclusionFeePerGas + baseFee; - return this.gasLimit * gasPrice + this.value; - } - /** - * Returns a Uint8Array Array of the raw Uint8Arrays of the EIP-1559 transaction, in order. - * - * Format: `[chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, - * accessList, signatureYParity, signatureR, signatureS]` - * - * Use {@link FeeMarketEIP1559Transaction.serialize} to add a transaction to a block - * with {@link Block.fromValuesArray}. - * - * For an unsigned tx this method uses the empty Uint8Array values for the - * signature parameters `v`, `r` and `s` for encoding. For an EIP-155 compliant - * representation for external signing use {@link FeeMarketEIP1559Transaction.getMessageToSign}. - */ - raw() { - return [ - bigIntToUnpaddedUint8Array(this.chainId), - bigIntToUnpaddedUint8Array(this.nonce), - bigIntToUnpaddedUint8Array(this.maxPriorityFeePerGas), - bigIntToUnpaddedUint8Array(this.maxFeePerGas), - bigIntToUnpaddedUint8Array(this.gasLimit), - this.to !== void 0 ? this.to.buf : Uint8Array.from([]), - bigIntToUnpaddedUint8Array(this.value), - this.data, - this.accessList, - this.v !== void 0 ? bigIntToUnpaddedUint8Array(this.v) : Uint8Array.from([]), - this.r !== void 0 ? bigIntToUnpaddedUint8Array(this.r) : Uint8Array.from([]), - this.s !== void 0 ? bigIntToUnpaddedUint8Array(this.s) : Uint8Array.from([]) - ]; - } - /** - * Returns the serialized encoding of the EIP-1559 transaction. - * - * Format: `0x02 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, - * accessList, signatureYParity, signatureR, signatureS])` - * - * Note that in contrast to the legacy tx serialization format this is not - * valid RLP any more due to the raw tx type preceding and concatenated to - * the RLP encoding of the values. - */ - serialize() { - const base2 = this.raw(); - return uint8ArrayConcat(TRANSACTION_TYPE_UINT8ARRAY, import_rlp.RLP.encode(base2)); - } - /** - * Returns the serialized unsigned tx (hashed or raw), which can be used - * to sign the transaction (e.g. for sending to a hardware wallet). - * - * Note: in contrast to the legacy tx the raw message format is already - * serialized and doesn't need to be RLP encoded any more. - * - * ```javascript - * const serializedMessage = tx.getMessageToSign(false) // use this for the HW wallet input - * ``` - * - * @param hashMessage - Return hashed message if set to true (default: true) - */ - getMessageToSign(hashMessage2 = true) { - const base2 = this.raw().slice(0, 9); - const message = uint8ArrayConcat(TRANSACTION_TYPE_UINT8ARRAY, import_rlp.RLP.encode(base2)); - if (hashMessage2) { - return keccak256(message); - } - return message; - } - /** - * Computes a sha3-256 hash of the serialized tx. - * - * This method can only be used for signed txs (it throws otherwise). - * Use {@link FeeMarketEIP1559Transaction.getMessageToSign} to get a tx hash for the purpose of signing. - */ - hash() { - if (!this.isSigned()) { - const msg = this._errorMsg("Cannot call hash method if transaction is not signed"); - throw new Error(msg); - } - if (Object.isFrozen(this)) { - if (!this.cache.hash) { - this.cache.hash = keccak256(this.serialize()); - } - return this.cache.hash; - } - return keccak256(this.serialize()); - } - /** - * Computes a sha3-256 hash which can be used to verify the signature - */ - getMessageToVerifySignature() { - return this.getMessageToSign(); - } - /** - * Returns the public key of the sender - */ - getSenderPublicKey() { - if (!this.isSigned()) { - const msg = this._errorMsg("Cannot call this method if transaction is not signed"); - throw new Error(msg); - } - const msgHash = this.getMessageToVerifySignature(); - const { v, r, s } = this; - this._validateHighS(); - try { - return ecrecover( - msgHash, - v + BigInt(27), - // Recover the 27 which was stripped from ecsign - bigIntToUnpaddedUint8Array(r), - bigIntToUnpaddedUint8Array(s) - ); - } catch (e) { - const msg = this._errorMsg("Invalid Signature"); - throw new Error(msg); - } - } - _processSignature(v, r, s) { - const opts = Object.assign(Object.assign({}, this.txOptions), { common: this.common }); - return _FeeMarketEIP1559Transaction.fromTxData({ - chainId: this.chainId, - nonce: this.nonce, - maxPriorityFeePerGas: this.maxPriorityFeePerGas, - maxFeePerGas: this.maxFeePerGas, - gasLimit: this.gasLimit, - to: this.to, - value: this.value, - data: this.data, - accessList: this.accessList, - v: v - BigInt(27), - r: uint8ArrayToBigInt(r), - s: uint8ArrayToBigInt(s) - }, opts); - } - /** - * Returns an object with the JSON representation of the transaction - */ - toJSON() { - const accessListJSON = getAccessListJSON(this.accessList); - return { - chainId: bigIntToHex(this.chainId), - nonce: bigIntToHex(this.nonce), - maxPriorityFeePerGas: bigIntToHex(this.maxPriorityFeePerGas), - maxFeePerGas: bigIntToHex(this.maxFeePerGas), - gasLimit: bigIntToHex(this.gasLimit), - to: this.to !== void 0 ? this.to.toString() : void 0, - value: bigIntToHex(this.value), - data: bytesToHex2(this.data), - accessList: accessListJSON, - v: this.v !== void 0 ? bigIntToHex(this.v) : void 0, - r: this.r !== void 0 ? bigIntToHex(this.r) : void 0, - s: this.s !== void 0 ? bigIntToHex(this.s) : void 0 - }; - } - /** - * Return a compact error string representation of the object - */ - errorStr() { - let errorStr = this._getSharedErrorPostfix(); - errorStr += ` maxFeePerGas=${this.maxFeePerGas} maxPriorityFeePerGas=${this.maxPriorityFeePerGas}`; - return errorStr; - } - /** - * Internal helper function to create an annotated error message - * - * @param msg Base error message - * @hidden - */ - _errorMsg(msg) { - return `${msg} (${this.errorStr()})`; - } -}; - -// node_modules/web3-eth-accounts/lib/esm/tx/eip2930Transaction.js -var import_rlp2 = __toESM(require_dist(), 1); -var TRANSACTION_TYPE2 = 1; -var TRANSACTION_TYPE_UINT8ARRAY2 = hexToBytes2(TRANSACTION_TYPE2.toString(16).padStart(2, "0")); -var AccessListEIP2930Transaction = class _AccessListEIP2930Transaction extends BaseTransaction { - /** - * This constructor takes the values, validates them, assigns them and freezes the object. - * - * It is not recommended to use this constructor directly. Instead use - * the static factory methods to assist in creating a Transaction object from - * varying data types. - */ - constructor(txData, opts = {}) { - var _a4; - super(Object.assign(Object.assign({}, txData), { type: TRANSACTION_TYPE2 }), opts); - this.DEFAULT_HARDFORK = "berlin"; - const { chainId, accessList, gasPrice } = txData; - this.common = this._getCommon(opts.common, chainId); - this.chainId = this.common.chainId(); - if (!this.common.isActivatedEIP(2930)) { - throw new Error("EIP-2930 not enabled on Common"); - } - this.activeCapabilities = this.activeCapabilities.concat([2718, 2930]); - const accessListData = getAccessListData(accessList !== null && accessList !== void 0 ? accessList : []); - this.accessList = accessListData.accessList; - this.AccessListJSON = accessListData.AccessListJSON; - verifyAccessList(this.accessList); - this.gasPrice = uint8ArrayToBigInt(toUint8Array(gasPrice === "" ? "0x" : gasPrice)); - this._validateCannotExceedMaxInteger({ - gasPrice: this.gasPrice - }); - BaseTransaction._validateNotArray(txData); - if (this.gasPrice * this.gasLimit > MAX_INTEGER) { - const msg = this._errorMsg("gasLimit * gasPrice cannot exceed MAX_INTEGER"); - throw new Error(msg); - } - this._validateYParity(); - this._validateHighS(); - const freeze = (_a4 = opts === null || opts === void 0 ? void 0 : opts.freeze) !== null && _a4 !== void 0 ? _a4 : true; - if (freeze) { - Object.freeze(this); - } - } - /** - * Instantiate a transaction from a data dictionary. - * - * Format: { chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, - * v, r, s } - * - * Notes: - * - `chainId` will be set automatically if not provided - * - All parameters are optional and have some basic default values - */ - static fromTxData(txData, opts = {}) { - return new _AccessListEIP2930Transaction(txData, opts); - } - /** - * Instantiate a transaction from the serialized tx. - * - * Format: `0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, - * signatureYParity (v), signatureR (r), signatureS (s)])` - */ - static fromSerializedTx(serialized, opts = {}) { - if (!uint8ArrayEquals(serialized.subarray(0, 1), TRANSACTION_TYPE_UINT8ARRAY2)) { - throw new Error(`Invalid serialized tx input: not an EIP-2930 transaction (wrong tx type, expected: ${TRANSACTION_TYPE2}, received: ${bytesToHex2(serialized.subarray(0, 1))}`); - } - const values = import_rlp2.RLP.decode(Uint8Array.from(serialized.subarray(1))); - if (!Array.isArray(values)) { - throw new Error("Invalid serialized tx input: must be array"); - } - return _AccessListEIP2930Transaction.fromValuesArray(values, opts); - } - /** - * Create a transaction from a values array. - * - * Format: `[chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, - * signatureYParity (v), signatureR (r), signatureS (s)]` - */ - static fromValuesArray(values, opts = {}) { - if (values.length !== 8 && values.length !== 11) { - throw new Error("Invalid EIP-2930 transaction. Only expecting 8 values (for unsigned tx) or 11 values (for signed tx)."); - } - const [chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, v, r, s] = values; - this._validateNotArray({ chainId, v }); - validateNoLeadingZeroes({ nonce, gasPrice, gasLimit, value, v, r, s }); - const emptyAccessList = []; - return new _AccessListEIP2930Transaction({ - chainId: uint8ArrayToBigInt(chainId), - nonce, - gasPrice, - gasLimit, - to, - value, - data, - accessList: accessList !== null && accessList !== void 0 ? accessList : emptyAccessList, - v: v !== void 0 ? uint8ArrayToBigInt(v) : void 0, - r, - s - }, opts); - } - /** - * The amount of gas paid for the data in this tx - */ - getDataFee() { - if (this.cache.dataFee && this.cache.dataFee.hardfork === this.common.hardfork()) { - return this.cache.dataFee.value; - } - let cost = super.getDataFee(); - cost += BigInt(getDataFeeEIP2930(this.accessList, this.common)); - if (Object.isFrozen(this)) { - this.cache.dataFee = { - value: cost, - hardfork: this.common.hardfork() - }; - } - return cost; - } - /** - * The up front amount that an account must have for this transaction to be valid - */ - getUpfrontCost() { - return this.gasLimit * this.gasPrice + this.value; - } - /** - * Returns a Uint8Array Array of the raw Uint8Arrays of the EIP-2930 transaction, in order. - * - * Format: `[chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, - * signatureYParity (v), signatureR (r), signatureS (s)]` - * - * Use {@link AccessListEIP2930Transaction.serialize} to add a transaction to a block - * with {@link Block.fromValuesArray}. - * - * For an unsigned tx this method uses the empty UINT8ARRAY values for the - * signature parameters `v`, `r` and `s` for encoding. For an EIP-155 compliant - * representation for external signing use {@link AccessListEIP2930Transaction.getMessageToSign}. - */ - raw() { - return [ - bigIntToUnpaddedUint8Array(this.chainId), - bigIntToUnpaddedUint8Array(this.nonce), - bigIntToUnpaddedUint8Array(this.gasPrice), - bigIntToUnpaddedUint8Array(this.gasLimit), - this.to !== void 0 ? this.to.buf : Uint8Array.from([]), - bigIntToUnpaddedUint8Array(this.value), - this.data, - this.accessList, - this.v !== void 0 ? bigIntToUnpaddedUint8Array(this.v) : Uint8Array.from([]), - this.r !== void 0 ? bigIntToUnpaddedUint8Array(this.r) : Uint8Array.from([]), - this.s !== void 0 ? bigIntToUnpaddedUint8Array(this.s) : Uint8Array.from([]) - ]; - } - /** - * Returns the serialized encoding of the EIP-2930 transaction. - * - * Format: `0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, - * signatureYParity (v), signatureR (r), signatureS (s)])` - * - * Note that in contrast to the legacy tx serialization format this is not - * valid RLP any more due to the raw tx type preceding and concatenated to - * the RLP encoding of the values. - */ - serialize() { - const base2 = this.raw(); - return uint8ArrayConcat(TRANSACTION_TYPE_UINT8ARRAY2, import_rlp2.RLP.encode(base2)); - } - /** - * Returns the serialized unsigned tx (hashed or raw), which can be used - * to sign the transaction (e.g. for sending to a hardware wallet). - * - * Note: in contrast to the legacy tx the raw message format is already - * serialized and doesn't need to be RLP encoded any more. - * - * ```javascript - * const serializedMessage = tx.getMessageToSign(false) // use this for the HW wallet input - * ``` - * - * @param hashMessage - Return hashed message if set to true (default: true) - */ - getMessageToSign(hashMessage2 = true) { - const base2 = this.raw().slice(0, 8); - const message = uint8ArrayConcat(TRANSACTION_TYPE_UINT8ARRAY2, import_rlp2.RLP.encode(base2)); - if (hashMessage2) { - return keccak256(message); - } - return message; - } - /** - * Computes a sha3-256 hash of the serialized tx. - * - * This method can only be used for signed txs (it throws otherwise). - * Use {@link AccessListEIP2930Transaction.getMessageToSign} to get a tx hash for the purpose of signing. - */ - hash() { - if (!this.isSigned()) { - const msg = this._errorMsg("Cannot call hash method if transaction is not signed"); - throw new Error(msg); - } - if (Object.isFrozen(this)) { - if (!this.cache.hash) { - this.cache.hash = keccak256(this.serialize()); - } - return this.cache.hash; - } - return keccak256(this.serialize()); - } - /** - * Computes a sha3-256 hash which can be used to verify the signature - */ - getMessageToVerifySignature() { - return this.getMessageToSign(); - } - /** - * Returns the public key of the sender - */ - getSenderPublicKey() { - if (!this.isSigned()) { - const msg = this._errorMsg("Cannot call this method if transaction is not signed"); - throw new Error(msg); - } - const msgHash = this.getMessageToVerifySignature(); - const { v, r, s } = this; - this._validateHighS(); - try { - return ecrecover( - msgHash, - v + BigInt(27), - // Recover the 27 which was stripped from ecsign - bigIntToUnpaddedUint8Array(r), - bigIntToUnpaddedUint8Array(s) - ); - } catch (e) { - const msg = this._errorMsg("Invalid Signature"); - throw new Error(msg); - } - } - _processSignature(v, r, s) { - const opts = Object.assign(Object.assign({}, this.txOptions), { common: this.common }); - return _AccessListEIP2930Transaction.fromTxData({ - chainId: this.chainId, - nonce: this.nonce, - gasPrice: this.gasPrice, - gasLimit: this.gasLimit, - to: this.to, - value: this.value, - data: this.data, - accessList: this.accessList, - v: v - BigInt(27), - r: uint8ArrayToBigInt(r), - s: uint8ArrayToBigInt(s) - }, opts); - } - /** - * Returns an object with the JSON representation of the transaction - */ - toJSON() { - const accessListJSON = getAccessListJSON(this.accessList); - return { - chainId: bigIntToHex(this.chainId), - nonce: bigIntToHex(this.nonce), - gasPrice: bigIntToHex(this.gasPrice), - gasLimit: bigIntToHex(this.gasLimit), - to: this.to !== void 0 ? this.to.toString() : void 0, - value: bigIntToHex(this.value), - data: bytesToHex2(this.data), - accessList: accessListJSON, - v: this.v !== void 0 ? bigIntToHex(this.v) : void 0, - r: this.r !== void 0 ? bigIntToHex(this.r) : void 0, - s: this.s !== void 0 ? bigIntToHex(this.s) : void 0 - }; - } - /** - * Return a compact error string representation of the object - */ - errorStr() { - var _a4, _b; - let errorStr = this._getSharedErrorPostfix(); - errorStr += ` gasPrice=${this.gasPrice} accessListCount=${(_b = (_a4 = this.accessList) === null || _a4 === void 0 ? void 0 : _a4.length) !== null && _b !== void 0 ? _b : 0}`; - return errorStr; - } - /** - * Internal helper function to create an annotated error message - * - * @param msg Base error message - * @hidden - */ - _errorMsg(msg) { - return `${msg} (${this.errorStr()})`; - } -}; - -// node_modules/web3-eth-accounts/lib/esm/tx/legacyTransaction.js -var import_rlp3 = __toESM(require_dist(), 1); -var TRANSACTION_TYPE3 = 0; -function meetsEIP155(_v, chainId) { - const v = Number(_v); - const chainIdDoubled = Number(chainId) * 2; - return v === chainIdDoubled + 35 || v === chainIdDoubled + 36; -} -var Transaction = class _Transaction extends BaseTransaction { - /** - * This constructor takes the values, validates them, assigns them and freezes the object. - * - * It is not recommended to use this constructor directly. Instead use - * the static factory methods to assist in creating a Transaction object from - * varying data types. - */ - constructor(txData, opts = {}) { - var _a4; - super(Object.assign(Object.assign({}, txData), { type: TRANSACTION_TYPE3 }), opts); - this.common = this._validateTxV(this.v, opts.common); - this.gasPrice = uint8ArrayToBigInt(toUint8Array(txData.gasPrice === "" ? "0x" : txData.gasPrice)); - if (this.gasPrice * this.gasLimit > MAX_INTEGER) { - const msg = this._errorMsg("gas limit * gasPrice cannot exceed MAX_INTEGER (2^256-1)"); - throw new Error(msg); - } - this._validateCannotExceedMaxInteger({ gasPrice: this.gasPrice }); - BaseTransaction._validateNotArray(txData); - if (this.common.gteHardfork("spuriousDragon")) { - if (!this.isSigned()) { - this.activeCapabilities.push(Capability.EIP155ReplayProtection); - } else { - if (meetsEIP155(this.v, this.common.chainId())) { - this.activeCapabilities.push(Capability.EIP155ReplayProtection); - } - } - } - const freeze = (_a4 = opts === null || opts === void 0 ? void 0 : opts.freeze) !== null && _a4 !== void 0 ? _a4 : true; - if (freeze) { - Object.freeze(this); - } - } - /** - * Instantiate a transaction from a data dictionary. - * - * Format: { nonce, gasPrice, gasLimit, to, value, data, v, r, s } - * - * Notes: - * - All parameters are optional and have some basic default values - */ - static fromTxData(txData, opts = {}) { - return new _Transaction(txData, opts); - } - /** - * Instantiate a transaction from the serialized tx. - * - * Format: `rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])` - */ - static fromSerializedTx(serialized, opts = {}) { - const values = import_rlp3.RLP.decode(serialized); - if (!Array.isArray(values)) { - throw new Error("Invalid serialized tx input. Must be array"); - } - return this.fromValuesArray(values, opts); - } - /** - * Create a transaction from a values array. - * - * Format: `[nonce, gasPrice, gasLimit, to, value, data, v, r, s]` - */ - static fromValuesArray(values, opts = {}) { - if (values.length !== 6 && values.length !== 9) { - throw new Error("Invalid transaction. Only expecting 6 values (for unsigned tx) or 9 values (for signed tx)."); - } - const [nonce, gasPrice, gasLimit, to, value, data, v, r, s] = values; - validateNoLeadingZeroes({ nonce, gasPrice, gasLimit, value, v, r, s }); - return new _Transaction({ - nonce, - gasPrice, - gasLimit, - to, - value, - data, - v, - r, - s - }, opts); - } - /** - * Returns a Uint8Array Array of the raw Uint8Arrays of the legacy transaction, in order. - * - * Format: `[nonce, gasPrice, gasLimit, to, value, data, v, r, s]` - * - * For legacy txs this is also the correct format to add transactions - * to a block with {@link Block.fromValuesArray} (use the `serialize()` method - * for typed txs). - * - * For an unsigned tx this method returns the empty Uint8Array values - * for the signature parameters `v`, `r` and `s`. For an EIP-155 compliant - * representation have a look at {@link Transaction.getMessageToSign}. - */ - raw() { - return [ - bigIntToUnpaddedUint8Array(this.nonce), - bigIntToUnpaddedUint8Array(this.gasPrice), - bigIntToUnpaddedUint8Array(this.gasLimit), - this.to !== void 0 ? this.to.buf : Uint8Array.from([]), - bigIntToUnpaddedUint8Array(this.value), - this.data, - this.v !== void 0 ? bigIntToUnpaddedUint8Array(this.v) : Uint8Array.from([]), - this.r !== void 0 ? bigIntToUnpaddedUint8Array(this.r) : Uint8Array.from([]), - this.s !== void 0 ? bigIntToUnpaddedUint8Array(this.s) : Uint8Array.from([]) - ]; - } - /** - * Returns the serialized encoding of the legacy transaction. - * - * Format: `rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])` - * - * For an unsigned tx this method uses the empty Uint8Array values for the - * signature parameters `v`, `r` and `s` for encoding. For an EIP-155 compliant - * representation for external signing use {@link Transaction.getMessageToSign}. - */ - serialize() { - return import_rlp3.RLP.encode(this.raw()); - } - _getMessageToSign() { - const values = [ - bigIntToUnpaddedUint8Array(this.nonce), - bigIntToUnpaddedUint8Array(this.gasPrice), - bigIntToUnpaddedUint8Array(this.gasLimit), - this.to !== void 0 ? this.to.buf : Uint8Array.from([]), - bigIntToUnpaddedUint8Array(this.value), - this.data - ]; - if (this.supports(Capability.EIP155ReplayProtection)) { - values.push(toUint8Array(this.common.chainId())); - values.push(unpadUint8Array(toUint8Array(0))); - values.push(unpadUint8Array(toUint8Array(0))); - } - return values; - } - getMessageToSign(hashMessage2 = true) { - const message = this._getMessageToSign(); - if (hashMessage2) { - return keccak256(import_rlp3.RLP.encode(message)); - } - return message; - } - /** - * The amount of gas paid for the data in this tx - */ - getDataFee() { - if (this.cache.dataFee && this.cache.dataFee.hardfork === this.common.hardfork()) { - return this.cache.dataFee.value; - } - if (Object.isFrozen(this)) { - this.cache.dataFee = { - value: super.getDataFee(), - hardfork: this.common.hardfork() - }; - } - return super.getDataFee(); - } - /** - * The up front amount that an account must have for this transaction to be valid - */ - getUpfrontCost() { - return this.gasLimit * this.gasPrice + this.value; - } - /** - * Computes a sha3-256 hash of the serialized tx. - * - * This method can only be used for signed txs (it throws otherwise). - * Use {@link Transaction.getMessageToSign} to get a tx hash for the purpose of signing. - */ - hash() { - if (!this.isSigned()) { - const msg = this._errorMsg("Cannot call hash method if transaction is not signed"); - throw new Error(msg); - } - if (Object.isFrozen(this)) { - if (!this.cache.hash) { - this.cache.hash = keccak256(import_rlp3.RLP.encode(this.raw())); - } - return this.cache.hash; - } - return keccak256(import_rlp3.RLP.encode(this.raw())); - } - /** - * Computes a sha3-256 hash which can be used to verify the signature - */ - getMessageToVerifySignature() { - if (!this.isSigned()) { - const msg = this._errorMsg("This transaction is not signed"); - throw new Error(msg); - } - const message = this._getMessageToSign(); - return keccak256(import_rlp3.RLP.encode(message)); - } - /** - * Returns the public key of the sender - */ - getSenderPublicKey() { - const msgHash = this.getMessageToVerifySignature(); - const { v, r, s } = this; - this._validateHighS(); - try { - return ecrecover(msgHash, v, bigIntToUnpaddedUint8Array(r), bigIntToUnpaddedUint8Array(s), this.supports(Capability.EIP155ReplayProtection) ? this.common.chainId() : void 0); - } catch (e) { - const msg = this._errorMsg("Invalid Signature"); - throw new Error(msg); - } - } - /** - * Process the v, r, s values from the `sign` method of the base transaction. - */ - _processSignature(_v, r, s) { - let v = _v; - if (this.supports(Capability.EIP155ReplayProtection)) { - v += this.common.chainId() * BigInt(2) + BigInt(8); - } - const opts = Object.assign(Object.assign({}, this.txOptions), { common: this.common }); - return _Transaction.fromTxData({ - nonce: this.nonce, - gasPrice: this.gasPrice, - gasLimit: this.gasLimit, - to: this.to, - value: this.value, - data: this.data, - v, - r: uint8ArrayToBigInt(r), - s: uint8ArrayToBigInt(s) - }, opts); - } - /** - * Returns an object with the JSON representation of the transaction. - */ - toJSON() { - return { - nonce: bigIntToHex(this.nonce), - gasPrice: bigIntToHex(this.gasPrice), - gasLimit: bigIntToHex(this.gasLimit), - to: this.to !== void 0 ? this.to.toString() : void 0, - value: bigIntToHex(this.value), - data: bytesToHex2(this.data), - v: this.v !== void 0 ? bigIntToHex(this.v) : void 0, - r: this.r !== void 0 ? bigIntToHex(this.r) : void 0, - s: this.s !== void 0 ? bigIntToHex(this.s) : void 0 - }; - } - /** - * Validates tx's `v` value - */ - _validateTxV(_v, common) { - let chainIdBigInt; - const v = _v !== void 0 ? Number(_v) : void 0; - if (v !== void 0) { - if (v < 37 && v !== 27 && v !== 28) { - throw new Error(`Legacy txs need either v = 27/28 or v >= 37 (EIP-155 replay protection), got v = ${v}`); - } - } - if (v !== void 0 && v !== 0 && (!common || common.gteHardfork("spuriousDragon")) && v !== 27 && v !== 28) { - if (common) { - if (!meetsEIP155(BigInt(v), common.chainId())) { - throw new Error(`Incompatible EIP155-based V ${v} and chain id ${common.chainId()}. See the Common parameter of the Transaction constructor to set the chain id.`); - } - } else { - let numSub; - if ((v - 35) % 2 === 0) { - numSub = 35; - } else { - numSub = 36; - } - chainIdBigInt = BigInt(v - numSub) / BigInt(2); - } - } - return this._getCommon(common, chainIdBigInt); - } - /** - * Return a compact error string representation of the object - */ - errorStr() { - let errorStr = this._getSharedErrorPostfix(); - errorStr += ` gasPrice=${this.gasPrice}`; - return errorStr; - } - /** - * Internal helper function to create an annotated error message - * - * @param msg Base error message - * @hidden - */ - _errorMsg(msg) { - return `${msg} (${this.errorStr()})`; - } -}; - -// node_modules/web3-eth-accounts/lib/esm/tx/transactionFactory.js -var extraTxTypes = /* @__PURE__ */ new Map(); -var TransactionFactory = class _TransactionFactory { - // It is not possible to instantiate a TransactionFactory object. - // eslint-disable-next-line @typescript-eslint/no-empty-function, no-useless-constructor - constructor() { - } - static typeToInt(txType) { - return Number(uint8ArrayToBigInt(toUint8Array(txType))); - } - static registerTransactionType(type, txClass) { - const txType = _TransactionFactory.typeToInt(type); - extraTxTypes.set(txType, txClass); - } - /** - * Create a transaction from a `txData` object - * - * @param txData - The transaction data. The `type` field will determine which transaction type is returned (if undefined, creates a legacy transaction) - * @param txOptions - Options to pass on to the constructor of the transaction - */ - static fromTxData(txData, txOptions = {}) { - if (!("type" in txData) || txData.type === void 0) { - return Transaction.fromTxData(txData, txOptions); - } - const txType = _TransactionFactory.typeToInt(txData.type); - if (txType === 0) { - return Transaction.fromTxData(txData, txOptions); - } - if (txType === 1) { - return AccessListEIP2930Transaction.fromTxData( - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - txData, - txOptions - ); - } - if (txType === 2) { - return FeeMarketEIP1559Transaction.fromTxData( - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions - txData, - txOptions - ); - } - const ExtraTransaction = extraTxTypes.get(txType); - if (ExtraTransaction === null || ExtraTransaction === void 0 ? void 0 : ExtraTransaction.fromTxData) { - return ExtraTransaction.fromTxData(txData, txOptions); - } - throw new Error(`Tx instantiation with type ${txType} not supported`); - } - /** - * This method tries to decode serialized data. - * - * @param data - The data Uint8Array - * @param txOptions - The transaction options - */ - static fromSerializedData(data, txOptions = {}) { - if (data[0] <= 127) { - switch (data[0]) { - case 1: - return AccessListEIP2930Transaction.fromSerializedTx(data, txOptions); - case 2: - return FeeMarketEIP1559Transaction.fromSerializedTx(data, txOptions); - default: { - const ExtraTransaction = extraTxTypes.get(Number(data[0])); - if (ExtraTransaction === null || ExtraTransaction === void 0 ? void 0 : ExtraTransaction.fromSerializedTx) { - return ExtraTransaction.fromSerializedTx(data, txOptions); - } - throw new Error(`TypedTransaction with ID ${data[0]} unknown`); - } - } - } else { - return Transaction.fromSerializedTx(data, txOptions); - } - } - /** - * When decoding a BlockBody, in the transactions field, a field is either: - * A Uint8Array (a TypedTransaction - encoded as TransactionType || rlp(TransactionPayload)) - * A Uint8Array[] (Legacy Transaction) - * This method returns the right transaction. - * - * @param data - A Uint8Array or Uint8Array[] - * @param txOptions - The transaction options - */ - static fromBlockBodyData(data, txOptions = {}) { - if (isUint8Array2(data)) { - return this.fromSerializedData(data, txOptions); - } - if (Array.isArray(data)) { - return Transaction.fromValuesArray(data, txOptions); - } - throw new Error("Cannot decode transaction: unknown type input"); - } -}; - -// node_modules/web3-eth-accounts/lib/esm/account.js -var __awaiter11 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var parseAndValidatePrivateKey = (data, ignoreLength) => { - let privateKeyUint8Array; - if (!ignoreLength && typeof data === "string" && isHexStrict(data) && data.length !== 66) { - throw new PrivateKeyLengthError(); - } - try { - privateKeyUint8Array = isUint8Array2(data) ? data : bytesToUint8Array(data); - } catch (_a4) { - throw new InvalidPrivateKeyError(); - } - if (!ignoreLength && privateKeyUint8Array.byteLength !== 32) { - throw new PrivateKeyLengthError(); - } - return privateKeyUint8Array; -}; -var hashMessage = (message) => { - const messageHex = isHexStrict(message) ? message : utf8ToHex(message); - const messageBytes = hexToBytes2(messageHex); - const preamble = hexToBytes2(fromUtf8(`Ethereum Signed Message: -${messageBytes.byteLength}`)); - const ethMessage = uint8ArrayConcat(preamble, messageBytes); - return sha3Raw(ethMessage); -}; -var sign = (data, privateKey) => { - const privateKeyUint8Array = parseAndValidatePrivateKey(privateKey); - const hash2 = hashMessage(data); - const signature = secp256k12.sign(hash2.substring(2), privateKeyUint8Array); - const signatureBytes = signature.toCompactRawBytes(); - const r = signature.r.toString(16).padStart(64, "0"); - const s = signature.s.toString(16).padStart(64, "0"); - const v = signature.recovery + 27; - return { - message: data, - messageHash: hash2, - v: numberToHex2(v), - r: `0x${r}`, - s: `0x${s}`, - signature: `${bytesToHex2(signatureBytes)}${v.toString(16)}` - }; -}; -var signTransaction = (transaction, privateKey) => __awaiter11(void 0, void 0, void 0, function* () { - const signedTx = transaction.sign(hexToBytes2(privateKey)); - if (isNullish(signedTx.v) || isNullish(signedTx.r) || isNullish(signedTx.s)) - throw new TransactionSigningError("Signer Error"); - const validationErrors = signedTx.validate(true); - if (validationErrors.length > 0) { - let errorString = "Signer Error "; - for (const validationError of validationErrors) { - errorString += `${errorString} ${validationError}.`; - } - throw new TransactionSigningError(errorString); - } - const rawTx = bytesToHex2(signedTx.serialize()); - const txHash = sha3Raw(rawTx); - return { - messageHash: bytesToHex2(signedTx.getMessageToSign(true)), - v: `0x${signedTx.v.toString(16)}`, - r: `0x${signedTx.r.toString(16).padStart(64, "0")}`, - s: `0x${signedTx.s.toString(16).padStart(64, "0")}`, - rawTransaction: rawTx, - transactionHash: bytesToHex2(txHash) - }; -}); -var recoverTransaction = (rawTransaction) => { - if (isNullish(rawTransaction)) - throw new UndefinedRawTransactionError(); - const tx = TransactionFactory.fromSerializedData(hexToBytes2(rawTransaction)); - return toChecksumAddress(tx.getSenderAddress().toString()); -}; -var recover = (data, signatureOrV, prefixedOrR, s, prefixed) => { - if (typeof data === "object") { - const signatureStr = `${data.r}${data.s.slice(2)}${data.v.slice(2)}`; - return recover(data.messageHash, signatureStr, prefixedOrR); - } - if (typeof signatureOrV === "string" && typeof prefixedOrR === "string" && !isNullish(s)) { - const signatureStr = `${prefixedOrR}${s.slice(2)}${signatureOrV.slice(2)}`; - return recover(data, signatureStr, prefixed); - } - if (isNullish(signatureOrV)) - throw new InvalidSignatureError("signature string undefined"); - const V_INDEX = 130; - const hashedMessage = prefixedOrR ? data : hashMessage(data); - let v = parseInt(signatureOrV.substring(V_INDEX), 16); - if (v > 26) { - v -= 27; - } - const ecPublicKey = secp256k12.Signature.fromCompact(signatureOrV.slice(2, V_INDEX)).addRecoveryBit(v).recoverPublicKey(hashedMessage.replace("0x", "")).toRawBytes(false); - const publicHash = sha3Raw(ecPublicKey.subarray(1)); - const address = toChecksumAddress(`0x${publicHash.slice(-40)}`); - return address; -}; -var privateKeyToAddress = (privateKey) => { - const privateKeyUint8Array = parseAndValidatePrivateKey(privateKey); - const publicKey = secp256k12.getPublicKey(privateKeyUint8Array, false); - const publicKeyHash = sha3Raw(publicKey.slice(1)); - const address = publicKeyHash.slice(-40); - return toChecksumAddress(`0x${address}`); -}; -var privateKeyToPublicKey = (privateKey, isCompressed) => { - const privateKeyUint8Array = parseAndValidatePrivateKey(privateKey); - return `0x${bytesToHex2(secp256k12.getPublicKey(privateKeyUint8Array, isCompressed)).slice(4)}`; -}; -var encrypt2 = (privateKey, password, options) => __awaiter11(void 0, void 0, void 0, function* () { - var _a4, _b, _c, _d, _e, _f, _g; - const privateKeyUint8Array = parseAndValidatePrivateKey(privateKey); - let salt; - if (options === null || options === void 0 ? void 0 : options.salt) { - salt = typeof options.salt === "string" ? hexToBytes2(options.salt) : options.salt; - } else { - salt = randomBytes2(32); - } - if (!(isString(password) || isUint8Array2(password))) { - throw new InvalidPasswordError(); - } - const uint8ArrayPassword = typeof password === "string" ? hexToBytes2(utf8ToHex(password)) : password; - let initializationVector; - if (options === null || options === void 0 ? void 0 : options.iv) { - initializationVector = typeof options.iv === "string" ? hexToBytes2(options.iv) : options.iv; - if (initializationVector.length !== 16) { - throw new IVLengthError(); - } - } else { - initializationVector = randomBytes2(16); - } - const kdf = (_a4 = options === null || options === void 0 ? void 0 : options.kdf) !== null && _a4 !== void 0 ? _a4 : "scrypt"; - let derivedKey; - let kdfparams; - if (kdf === "pbkdf2") { - kdfparams = { - dklen: (_b = options === null || options === void 0 ? void 0 : options.dklen) !== null && _b !== void 0 ? _b : 32, - salt: bytesToHex2(salt).replace("0x", ""), - c: (_c = options === null || options === void 0 ? void 0 : options.c) !== null && _c !== void 0 ? _c : 262144, - prf: "hmac-sha256" - }; - if (kdfparams.c < 1e3) { - throw new PBKDF2IterationsError(); - } - derivedKey = pbkdf2Sync(uint8ArrayPassword, salt, kdfparams.c, kdfparams.dklen, "sha256"); - } else if (kdf === "scrypt") { - kdfparams = { - n: (_d = options === null || options === void 0 ? void 0 : options.n) !== null && _d !== void 0 ? _d : 8192, - r: (_e = options === null || options === void 0 ? void 0 : options.r) !== null && _e !== void 0 ? _e : 8, - p: (_f = options === null || options === void 0 ? void 0 : options.p) !== null && _f !== void 0 ? _f : 1, - dklen: (_g = options === null || options === void 0 ? void 0 : options.dklen) !== null && _g !== void 0 ? _g : 32, - salt: bytesToHex2(salt).replace("0x", "") - }; - derivedKey = scryptSync(uint8ArrayPassword, salt, kdfparams.n, kdfparams.p, kdfparams.r, kdfparams.dklen); - } else { - throw new InvalidKdfError(); - } - const cipher = yield encrypt(privateKeyUint8Array, derivedKey.slice(0, 16), initializationVector, "aes-128-ctr"); - const ciphertext = bytesToHex2(cipher).slice(2); - const mac = sha3Raw(uint8ArrayConcat(derivedKey.slice(16, 32), cipher)).replace("0x", ""); - return { - version: 3, - id: uuidV4(), - address: privateKeyToAddress(privateKeyUint8Array).toLowerCase().replace("0x", ""), - crypto: { - ciphertext, - cipherparams: { - iv: bytesToHex2(initializationVector).replace("0x", "") - }, - cipher: "aes-128-ctr", - kdf, - kdfparams, - mac - } - }; -}); -var privateKeyToAccount = (privateKey, ignoreLength) => { - const privateKeyUint8Array = parseAndValidatePrivateKey(privateKey, ignoreLength); - return { - address: privateKeyToAddress(privateKeyUint8Array), - privateKey: bytesToHex2(privateKeyUint8Array), - // eslint-disable-next-line @typescript-eslint/no-unused-vars - signTransaction: (_tx) => { - throw new TransactionSigningError("Do not have network access to sign the transaction"); - }, - sign: (data) => sign(typeof data === "string" ? data : JSON.stringify(data), privateKeyUint8Array), - encrypt: (password, options) => __awaiter11(void 0, void 0, void 0, function* () { - return encrypt2(privateKeyUint8Array, password, options); - }) - }; -}; -var create = () => { - const privateKey = secp256k12.utils.randomPrivateKey(); - return privateKeyToAccount(`${bytesToHex2(privateKey)}`); -}; -var decrypt2 = (keystore, password, nonStrict) => __awaiter11(void 0, void 0, void 0, function* () { - const json = typeof keystore === "object" ? keystore : JSON.parse(nonStrict ? keystore.toLowerCase() : keystore); - validator.validateJSONSchema(keyStoreSchema, json); - if (json.version !== 3) - throw new KeyStoreVersionError(); - const uint8ArrayPassword = typeof password === "string" ? hexToBytes2(utf8ToHex(password)) : password; - validator.validate(["bytes"], [uint8ArrayPassword]); - let derivedKey; - if (json.crypto.kdf === "scrypt") { - const kdfparams = json.crypto.kdfparams; - const uint8ArraySalt = typeof kdfparams.salt === "string" ? hexToBytes2(kdfparams.salt) : kdfparams.salt; - derivedKey = scryptSync(uint8ArrayPassword, uint8ArraySalt, kdfparams.n, kdfparams.p, kdfparams.r, kdfparams.dklen); - } else if (json.crypto.kdf === "pbkdf2") { - const kdfparams = json.crypto.kdfparams; - const uint8ArraySalt = typeof kdfparams.salt === "string" ? hexToBytes2(kdfparams.salt) : kdfparams.salt; - derivedKey = pbkdf2Sync(uint8ArrayPassword, uint8ArraySalt, kdfparams.c, kdfparams.dklen, "sha256"); - } else { - throw new InvalidKdfError(); - } - const ciphertext = hexToBytes2(json.crypto.ciphertext); - const mac = sha3Raw(uint8ArrayConcat(derivedKey.slice(16, 32), ciphertext)).replace("0x", ""); - if (mac !== json.crypto.mac) { - throw new KeyDerivationError(); - } - const seed = yield decrypt(hexToBytes2(json.crypto.ciphertext), derivedKey.slice(0, 16), hexToBytes2(json.crypto.cipherparams.iv)); - return privateKeyToAccount(seed); -}); - -// node_modules/web3-core/lib/esm/web3_batch_request.js -var __awaiter12 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var DEFAULT_BATCH_REQUEST_TIMEOUT = 1e3; -var Web3BatchRequest = class { - constructor(requestManager) { - this._requestManager = requestManager; - this._requests = /* @__PURE__ */ new Map(); - } - get requests() { - return [...this._requests.values()].map((r) => r.payload); - } - add(request) { - const payload = json_rpc_exports.toPayload(request); - const promise = new Web3DeferredPromise(); - this._requests.set(payload.id, { payload, promise }); - return promise; - } - // eslint-disable-next-line class-methods-use-this - execute(options) { - var _a4; - return __awaiter12(this, void 0, void 0, function* () { - if (this.requests.length === 0) { - return Promise.resolve([]); - } - const request = new Web3DeferredPromise({ - timeout: (_a4 = options === null || options === void 0 ? void 0 : options.timeout) !== null && _a4 !== void 0 ? _a4 : DEFAULT_BATCH_REQUEST_TIMEOUT, - eagerStart: true, - timeoutMessage: "Batch request timeout" - }); - this._processBatchRequest(request).catch((err) => request.reject(err)); - request.catch((err) => { - if (err instanceof OperationTimeoutError) { - this._abortAllRequests("Batch request timeout"); - } - request.reject(err); - }); - return request; - }); - } - _processBatchRequest(promise) { - var _a4, _b; - return __awaiter12(this, void 0, void 0, function* () { - const response = yield this._requestManager.sendBatch([...this._requests.values()].map((r) => r.payload)); - if (response.length !== this._requests.size) { - this._abortAllRequests("Invalid batch response"); - throw new ResponseError(response, `Batch request size mismatch the results size. Requests: ${this._requests.size}, Responses: ${response.length}`); - } - const requestIds = this.requests.map((r) => r.id).map(Number).sort((a, b) => a - b); - const responseIds = response.map((r) => r.id).map(Number).sort((a, b) => a - b); - if (JSON.stringify(requestIds) !== JSON.stringify(responseIds)) { - this._abortAllRequests("Invalid batch response"); - throw new ResponseError(response, `Batch request mismatch the results. Requests: [${requestIds.join()}], Responses: [${responseIds.join()}]`); - } - for (const res of response) { - if (json_rpc_exports.isResponseWithResult(res)) { - (_a4 = this._requests.get(res.id)) === null || _a4 === void 0 ? void 0 : _a4.promise.resolve(res.result); - } else if (json_rpc_exports.isResponseWithError(res)) { - (_b = this._requests.get(res.id)) === null || _b === void 0 ? void 0 : _b.promise.reject(res.error); - } - } - promise.resolve(response); - }); - } - _abortAllRequests(msg) { - for (const { promise } of this._requests.values()) { - promise.reject(new OperationAbortError(msg)); - } - } -}; - -// node_modules/web3-core/lib/esm/web3_context.js -var __awaiter13 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var Web3Context = class _Web3Context extends Web3Config { - constructor(providerOrContext) { - var _a4; - super(); - this.providers = Web3RequestManager.providers; - if (isNullish2(providerOrContext) || typeof providerOrContext === "string" && providerOrContext.trim() !== "" || isSupportedProvider(providerOrContext)) { - this._requestManager = new Web3RequestManager(providerOrContext); - this._subscriptionManager = new Web3SubscriptionManager(this._requestManager, {}); - return; - } - const { config, provider, requestManager, subscriptionManager, registeredSubscriptions: registeredSubscriptions2, accountProvider, wallet } = providerOrContext; - this.setConfig(config !== null && config !== void 0 ? config : {}); - this._requestManager = requestManager !== null && requestManager !== void 0 ? requestManager : new Web3RequestManager(provider, (_a4 = config === null || config === void 0 ? void 0 : config.enableExperimentalFeatures) === null || _a4 === void 0 ? void 0 : _a4.useSubscriptionWhenCheckingBlockTimeout); - if (subscriptionManager) { - this._subscriptionManager = subscriptionManager; - } else { - this._subscriptionManager = new Web3SubscriptionManager(this.requestManager, registeredSubscriptions2 !== null && registeredSubscriptions2 !== void 0 ? registeredSubscriptions2 : {}); - } - if (accountProvider) { - this._accountProvider = accountProvider; - } - if (wallet) { - this._wallet = wallet; - } - } - get requestManager() { - return this._requestManager; - } - /** - * Will return the current subscriptionManager ({@link Web3SubscriptionManager}) - */ - get subscriptionManager() { - return this._subscriptionManager; - } - get wallet() { - return this._wallet; - } - get accountProvider() { - return this._accountProvider; - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - static fromContextObject(...args) { - return new this(...args.reverse()); - } - getContextObject() { - var _a4; - return { - config: this.config, - provider: this.provider, - requestManager: this.requestManager, - subscriptionManager: this.subscriptionManager, - registeredSubscriptions: (_a4 = this.subscriptionManager) === null || _a4 === void 0 ? void 0 : _a4.registeredSubscriptions, - providers: this.providers, - wallet: this.wallet, - accountProvider: this.accountProvider - }; - } - /** - * Use to create new object of any type extended by `Web3Context` - * and link it to current context. This can be used to initiate a global context object - * and then use it to create new objects of any type extended by `Web3Context`. - */ - use(ContextRef, ...args) { - const newContextChild = new ContextRef(...[...args, this.getContextObject()]); - this.on(Web3ConfigEvent.CONFIG_CHANGE, (event) => { - newContextChild.setConfig({ [event.name]: event.newValue }); - }); - return newContextChild; - } - /** - * Link current context to another context. - */ - link(parentContext) { - this.setConfig(parentContext.config); - this._requestManager = parentContext.requestManager; - this.provider = parentContext.provider; - this._subscriptionManager = parentContext.subscriptionManager; - this._wallet = parentContext.wallet; - this._accountProvider = parentContext._accountProvider; - parentContext.on(Web3ConfigEvent.CONFIG_CHANGE, (event) => { - this.setConfig({ [event.name]: event.newValue }); - }); - } - // eslint-disable-next-line no-use-before-define - registerPlugin(plugin) { - if (this[plugin.pluginNamespace] !== void 0) - throw new ExistingPluginNamespaceError(plugin.pluginNamespace); - const _pluginObject = { - [plugin.pluginNamespace]: plugin - }; - _pluginObject[plugin.pluginNamespace].link(this); - Object.assign(this, _pluginObject); - } - /** - * Will return the current provider. - * - * @returns Returns the current provider - * @example - * ```ts - * const web3 = new Web3Context("http://localhost:8545"); - * console.log(web3.provider); - * > HttpProvider { - * clientUrl: 'http://localhost:8545', - * httpProviderOptions: undefined - * } - * ``` - */ - get provider() { - return this.currentProvider; - } - /** - * Will set the current provider. - * - * @param provider - The provider to set - * - * Accepted providers are of type {@link SupportedProviders} - * @example - * ```ts - * const web3Context = new web3ContextContext("http://localhost:8545"); - * web3Context.provider = "ws://localhost:8545"; - * console.log(web3Context.provider); - * > WebSocketProvider { - * _eventEmitter: EventEmitter { - * _events: [Object: null prototype] {}, - * _eventsCount: 0, - * ... - * } - * ``` - */ - set provider(provider) { - this.requestManager.setProvider(provider); - } - /** - * Will return the current provider. (The same as `provider`) - * - * @returns Returns the current provider - * @example - * ```ts - * const web3Context = new Web3Context("http://localhost:8545"); - * console.log(web3Context.provider); - * > HttpProvider { - * clientUrl: 'http://localhost:8545', - * httpProviderOptions: undefined - * } - * ``` - */ - get currentProvider() { - return this.requestManager.provider; - } - /** - * Will set the current provider. (The same as `provider`) - * - * @param provider - {@link SupportedProviders} The provider to set - * - * @example - * ```ts - * const web3Context = new Web3Context("http://localhost:8545"); - * web3Context.currentProvider = "ws://localhost:8545"; - * console.log(web3Context.provider); - * > WebSocketProvider { - * _eventEmitter: EventEmitter { - * _events: [Object: null prototype] {}, - * _eventsCount: 0, - * ... - * } - * ``` - */ - set currentProvider(provider) { - this.requestManager.setProvider(provider); - } - /** - * Will return the givenProvider if available. - * - * When using web3.js in an Ethereum compatible browser, it will set with the current native provider by that browser. Will return the given provider by the (browser) environment, otherwise `undefined`. - */ - // eslint-disable-next-line class-methods-use-this - get givenProvider() { - return _Web3Context.givenProvider; - } - /** - * Will set the provider. - * - * @param provider - {@link SupportedProviders} The provider to set - * @returns Returns true if the provider was set - */ - setProvider(provider) { - this.provider = provider; - return true; - } - /** - * Will return the {@link Web3BatchRequest} constructor. - */ - get BatchRequest() { - return Web3BatchRequest.bind(void 0, this._requestManager); - } - /** - * This method allows extending the web3 modules. - * Note: This method is only for backward compatibility, and It is recommended to use Web3 v4 Plugin feature for extending web3.js functionality if you are developing some thing new. - */ - extend(extendObj) { - var _a4; - if (extendObj.property && !this[extendObj.property]) - this[extendObj.property] = {}; - (_a4 = extendObj.methods) === null || _a4 === void 0 ? void 0 : _a4.forEach((element) => { - const method = (...givenParams) => __awaiter13(this, void 0, void 0, function* () { - return this.requestManager.send({ - method: element.call, - params: givenParams - }); - }); - if (extendObj.property) - this[extendObj.property][element.name] = method; - else - this[element.name] = method; - }); - return this; - } -}; -Web3Context.providers = Web3RequestManager.providers; -var Web3PluginBase = class extends Web3Context { - // eslint-disable-next-line class-methods-use-this - registerNewTransactionType(type, txClass) { - TransactionFactory.registerTransactionType(type, txClass); - } -}; -var Web3EthPluginBase = class extends Web3PluginBase { -}; - -// node_modules/web3-core/lib/esm/formatters.js -var formatters_exports = {}; -__export(formatters_exports, { - inputAddressFormatter: () => inputAddressFormatter, - inputBlockNumberFormatter: () => inputBlockNumberFormatter, - inputCallFormatter: () => inputCallFormatter, - inputDefaultBlockNumberFormatter: () => inputDefaultBlockNumberFormatter, - inputLogFormatter: () => inputLogFormatter, - inputPostFormatter: () => inputPostFormatter, - inputSignFormatter: () => inputSignFormatter, - inputStorageKeysFormatter: () => inputStorageKeysFormatter, - inputTopicFormatter: () => inputTopicFormatter, - inputTransactionFormatter: () => inputTransactionFormatter, - outputBigIntegerFormatter: () => outputBigIntegerFormatter, - outputBlockFormatter: () => outputBlockFormatter, - outputLogFormatter: () => outputLogFormatter, - outputPostFormatter: () => outputPostFormatter, - outputProofFormatter: () => outputProofFormatter, - outputSyncingFormatter: () => outputSyncingFormatter, - outputTransactionFormatter: () => outputTransactionFormatter, - outputTransactionReceiptFormatter: () => outputTransactionReceiptFormatter, - txInputOptionsFormatter: () => txInputOptionsFormatter -}); - -// node_modules/web3-eth-iban/lib/esm/index.js -var esm_exports8 = {}; -__export(esm_exports8, { - Iban: () => Iban, - default: () => esm_default -}); - -// node_modules/web3-eth-iban/lib/esm/iban.js -var Iban = class _Iban { - /** - * Construct a direct or indirect IBAN that has conversion methods and validity checks. - * If the provided string was not of either the length of a direct IBAN (34 or 35), - * nor the length of an indirect IBAN (20), an Error will be thrown ('Invalid IBAN was provided'). - * - * @param iban - a Direct or an Indirect IBAN - * @returns - Iban instance - * - * @example - * ```ts - * const iban = new web3.eth.Iban("XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS"); - * > Iban { _iban: 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS' } - * ``` - */ - constructor(iban) { - this.toAddress = () => { - if (this.isDirect()) { - const base36 = this._iban.slice(4); - const parsedBigInt = _Iban._parseInt(base36, 36); - const paddedBigInt = leftPad(parsedBigInt, 40); - return toChecksumAddress(paddedBigInt); - } - throw new Error("Iban is indirect and cannot be converted. Must be length of 34 or 35"); - }; - if (_Iban.isIndirect(iban) || _Iban.isDirect(iban)) { - this._iban = iban; - } else { - throw new Error("Invalid IBAN was provided"); - } - } - /** - * A static method that checks if an IBAN is Direct. - * It actually check the length of the provided variable and, only if it is 34 or 35, it returns true. - * Note: this is also available as a method at an Iban instance. - * @param iban - an IBAN to be checked - * @returns - `true` if the provided `iban` is a Direct IBAN, and `false` otherwise. - * - * @example - * ```ts - * web3.eth.Iban.isDirect("XE81ETHXREGGAVOFYORK"); - * > false - * ``` - */ - static isDirect(iban) { - return iban.length === 34 || iban.length === 35; - } - /** - * An instance method that checks if iban number is Direct. - * It actually check the length of the provided variable and, only if it is 34 or 35, it returns true. - * Note: this is also available as a static method. - * @param iban - an IBAN to be checked - * @returns - `true` if the provided `iban` is a Direct IBAN, and `false` otherwise. - * - * @example - * ```ts - * const iban = new web3.eth.Iban("XE81ETHXREGGAVOFYORK"); - * iban.isDirect(); - * > false - * ``` - */ - isDirect() { - return _Iban.isDirect(this._iban); - } - /** - * A static method that checks if an IBAN is Indirect. - * It actually check the length of the provided variable and, only if it is 20, it returns true. - * Note: this is also available as a method at an Iban instance. - * @param iban - an IBAN to be checked - * @returns - `true` if the provided `iban` is an Indirect IBAN, and `false` otherwise. - * - * @example - * ```ts - * web3.eth.Iban.isIndirect("XE81ETHXREGGAVOFYORK"); - * > true - * ``` - */ - static isIndirect(iban) { - return iban.length === 20; - } - /** - * check if iban number if indirect - * It actually check the length of the provided variable and, only if it is 20, it returns true. - * Note: this is also available as a static method. - * @param iban - an IBAN to be checked - * @returns - `true` if the provided `iban` is an Indirect IBAN, and `false` otherwise. - * - * @example - * ```ts - * const iban = new web3.eth.Iban("XE81ETHXREGGAVOFYORK"); - * iban.isIndirect(); - * > true - * ``` - */ - isIndirect() { - return _Iban.isIndirect(this._iban); - } - /** - * This method could be used to check if a given string is valid IBAN object. - * Note: this is also available as a method at an Iban instance. - * - * @param iban - a string to be checked if it is in IBAN - * @returns - true if it is valid IBAN - * - * @example - * ```ts - * web3.eth.Iban.isValid("XE81ETHXREGGAVOFYORK"); - * > true - * - * web3.eth.Iban.isValid("XE82ETHXREGGAVOFYORK"); - * > false // because the checksum is incorrect - * ``` - */ - static isValid(iban) { - return /^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(iban) && _Iban._mod9710(_Iban._iso13616Prepare(iban)) === 1; - } - /** - * Should be called to check if the early provided IBAN is correct. - * Note: this is also available as a static method. - * - * @example - * ```ts - * const iban = new web3.eth.Iban("XE81ETHXREGGAVOFYORK"); - * iban.isValid(); - * > true - * - * const iban = new web3.eth.Iban("XE82ETHXREGGAVOFYORK"); - * iban.isValid(); - * > false // because the checksum is incorrect - * ``` - */ - isValid() { - return _Iban.isValid(this._iban); - } - /** - * Convert the passed BBAN to an IBAN for this country specification. - * Please note that "generation of the IBAN shall be the exclusive responsibility of the bank/branch servicing the account". - * This method implements the preferred algorithm described in http://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits - * - * @param bban - the BBAN to convert to IBAN - * @returns an Iban class instance that holds the equivalent IBAN - * - * @example - * ```ts - * web3.eth.Iban.fromBban('ETHXREGGAVOFYORK'); - * > Iban {_iban: "XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS"} - * ``` - */ - static fromBban(bban) { - const countryCode = "XE"; - const remainder = this._mod9710(this._iso13616Prepare(`${countryCode}00${bban}`)); - const checkDigit = `0${(98 - remainder).toString()}`.slice(-2); - return new _Iban(`${countryCode}${checkDigit}${bban}`); - } - /** - * Should be used to create IBAN object for given institution and identifier - * - * @param options - an object holds the `institution` and the `identifier` which will be composed to create an `Iban` object from. - * @returns an Iban class instance that holds the equivalent IBAN - * - * @example - * ```ts - * web3.eth.Iban.createIndirect({ - * institution: "XREG", - * identifier: "GAVOFYORK" - * }); - * > Iban {_iban: "XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS"} - * ``` - */ - static createIndirect(options) { - return _Iban.fromBban(`ETH${options.institution}${options.identifier}`); - } - /** - * This method should be used to create iban object from an Ethereum address. - * - * @param address - an Ethereum address - * @returns an Iban class instance that holds the equivalent IBAN - * - * @example - * ```ts - * web3.eth.Iban.fromAddress("0x00c5496aEe77C1bA1f0854206A26DdA82a81D6D8"); - * > Iban {_iban: "XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS"} - * ``` - */ - static fromAddress(address) { - if (!isAddress(address)) { - throw new InvalidAddressError(address); - } - const num = BigInt(hexToNumber2(address)); - const base36 = num.toString(36); - const padded = leftPad(base36, 15); - return _Iban.fromBban(padded.toUpperCase()); - } - /** - * This method should be used to create IBAN address from an Ethereum address - * - * @param address - an Ethereum address - * @return the equivalent IBAN address - * - * @example - * ```ts - * web3.eth.Iban.toIban("0x00c5496aEe77C1bA1f0854206A26DdA82a81D6D8"); - * > "XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS" - * ``` - */ - static toIban(address) { - return _Iban.fromAddress(address).toString(); - } - /** - * Should be called to get client identifier within institution - * - * @return the client of the IBAN instance. - * - * @example - * ```ts - * const iban = new web3.eth.Iban("XE81ETHXREGGAVOFYORK"); - * iban.client(); - * > 'GAVOFYORK' - * ``` - */ - client() { - return this.isIndirect() ? this._iban.slice(11) : ""; - } - /** - * Returns the IBAN checksum of the early provided IBAN - * - * @example - * ```ts - * const iban = new web3.eth.Iban("XE81ETHXREGGAVOFYORK"); - * iban.checksum(); - * > "81" - * ``` - * - */ - checksum() { - return this._iban.slice(2, 4); - } - /** - * Returns institution identifier from the early provided IBAN - * - * @example - * ```ts - * const iban = new web3.eth.Iban("XE81ETHXREGGAVOFYORK"); - * iban.institution(); - * > 'XREG' - * ``` - */ - institution() { - return this.isIndirect() ? this._iban.slice(7, 11) : ""; - } - /** - * Simply returns the early provided IBAN - * - * @example - * ```ts - * const iban = new web3.eth.Iban('XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS'); - * iban.toString(); - * > 'XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS' - * ``` - */ - toString() { - return this._iban; - } -}; -Iban._iso13616Prepare = (iban) => { - const A = "A".charCodeAt(0); - const Z = "Z".charCodeAt(0); - const upperIban = iban.toUpperCase(); - const modifiedIban = `${upperIban.slice(4)}${upperIban.slice(0, 4)}`; - return modifiedIban.split("").map((n) => { - const code = n.charCodeAt(0); - if (code >= A && code <= Z) { - return code - A + 10; - } - return n; - }).join(""); -}; -Iban._parseInt = (str, base2) => [...str].reduce((acc, curr) => BigInt(parseInt(curr, base2)) + BigInt(base2) * acc, BigInt(0)); -Iban._mod9710 = (iban) => { - let remainder = iban; - let block; - while (remainder.length > 2) { - block = remainder.slice(0, 9); - remainder = `${(parseInt(block, 10) % 97).toString()}${remainder.slice(block.length)}`; - } - return parseInt(remainder, 10) % 97; -}; -Iban.toAddress = (iban) => { - const ibanObject = new Iban(iban); - return ibanObject.toAddress(); -}; - -// node_modules/web3-eth-iban/lib/esm/index.js -var esm_default = Iban; - -// node_modules/web3-core/lib/esm/formatters.js -var inputStorageKeysFormatter = (keys) => keys.map((num) => numberToHex2(num)); -var outputProofFormatter = (proof) => ({ - address: toChecksumAddress(proof.address), - nonce: hexToNumberString(proof.nonce), - balance: hexToNumberString(proof.balance) -}); -var outputBigIntegerFormatter = (number2) => toNumber(number2); -var inputBlockNumberFormatter = (blockNumber) => { - if (isNullish(blockNumber)) { - return void 0; - } - if (typeof blockNumber === "string" && isBlockTag(blockNumber)) { - return blockNumber; - } - if (blockNumber === "genesis") { - return "0x0"; - } - if (typeof blockNumber === "string" && isHexStrict2(blockNumber)) { - return blockNumber.toLowerCase(); - } - return numberToHex2(blockNumber); -}; -var inputDefaultBlockNumberFormatter = (blockNumber, defaultBlock) => { - if (!blockNumber) { - return inputBlockNumberFormatter(defaultBlock); - } - return inputBlockNumberFormatter(blockNumber); -}; -var inputAddressFormatter = (address) => { - if (Iban.isValid(address) && Iban.isDirect(address)) { - const iban = new Iban(address); - return iban.toAddress().toLowerCase(); - } - if (isAddress2(address)) { - return `0x${address.toLowerCase().replace("0x", "")}`; - } - throw new FormatterError(`Provided address ${address} is invalid, the capitalization checksum test failed, or it's an indirect IBAN address which can't be converted.`); -}; -var txInputOptionsFormatter = (options) => { - var _a4; - const modifiedOptions = Object.assign({}, options); - if (options.to) { - modifiedOptions.to = inputAddressFormatter(options.to); - } - if (options.data && options.input) { - throw new FormatterError(`You can't have "data" and "input" as properties of transactions at the same time, please use either "data" or "input" instead.`); - } - if (!options.input && options.data) { - modifiedOptions.input = options.data; - delete modifiedOptions.data; - } - if (options.input && !options.input.startsWith("0x")) { - modifiedOptions.input = `0x${options.input}`; - } - if (modifiedOptions.input && !isHexStrict2(modifiedOptions.input)) { - throw new FormatterError("The input field must be HEX encoded data."); - } - if (options.gas || options.gasLimit) { - modifiedOptions.gas = toNumber((_a4 = options.gas) !== null && _a4 !== void 0 ? _a4 : options.gasLimit); - } - if (options.maxPriorityFeePerGas || options.maxFeePerGas) { - delete modifiedOptions.gasPrice; - } - ["gasPrice", "gas", "value", "maxPriorityFeePerGas", "maxFeePerGas", "nonce", "chainId"].filter((key) => !isNullish(modifiedOptions[key])).forEach((key) => { - modifiedOptions[key] = numberToHex2(modifiedOptions[key]); - }); - return modifiedOptions; -}; -var inputCallFormatter = (options, defaultAccount) => { - var _a4; - const opts = txInputOptionsFormatter(options); - const from = (_a4 = opts.from) !== null && _a4 !== void 0 ? _a4 : defaultAccount; - if (from) { - opts.from = inputAddressFormatter(from); - } - return opts; -}; -var inputTransactionFormatter = (options, defaultAccount) => { - var _a4; - const opts = txInputOptionsFormatter(options); - if (!(typeof opts.from === "number") && !(!!opts.from && typeof opts.from === "object")) { - opts.from = (_a4 = opts.from) !== null && _a4 !== void 0 ? _a4 : defaultAccount; - if (!options.from && !(typeof options.from === "number")) { - throw new FormatterError('The send transactions "from" field must be defined!'); - } - opts.from = inputAddressFormatter(options.from); - } - return opts; -}; -var inputSignFormatter = (data) => isHexStrict2(data) ? data : utf8ToHex(data); -var outputTransactionFormatter = (tx) => { - const modifiedTx = Object.assign({}, tx); - if (tx.blockNumber) { - modifiedTx.blockNumber = hexToNumber2(tx.blockNumber); - } - if (tx.transactionIndex) { - modifiedTx.transactionIndex = hexToNumber2(tx.transactionIndex); - } - modifiedTx.nonce = hexToNumber2(tx.nonce); - modifiedTx.gas = hexToNumber2(tx.gas); - if (tx.gasPrice) { - modifiedTx.gasPrice = outputBigIntegerFormatter(tx.gasPrice); - } - if (tx.maxFeePerGas) { - modifiedTx.maxFeePerGas = outputBigIntegerFormatter(tx.maxFeePerGas); - } - if (tx.maxPriorityFeePerGas) { - modifiedTx.maxPriorityFeePerGas = outputBigIntegerFormatter(tx.maxPriorityFeePerGas); - } - if (tx.type) { - modifiedTx.type = hexToNumber2(tx.type); - } - modifiedTx.value = outputBigIntegerFormatter(tx.value); - if (tx.to && isAddress2(tx.to)) { - modifiedTx.to = toChecksumAddress(tx.to); - } else { - modifiedTx.to = void 0; - } - if (tx.from) { - modifiedTx.from = toChecksumAddress(tx.from); - } - return modifiedTx; -}; -var inputTopicFormatter = (topic) => { - if (isNullish(topic)) - return null; - const value = String(topic); - return isHex(value) ? value : fromUtf8(value); -}; -var inputLogFormatter = (filter) => { - var _a4; - const val = isNullish(filter) ? {} : mergeDeep({}, filter); - if (isNullish(val.fromBlock)) { - val.fromBlock = BlockTags.LATEST; - } - val.fromBlock = inputBlockNumberFormatter(val.fromBlock); - if (!isNullish(val.toBlock)) { - val.toBlock = inputBlockNumberFormatter(val.toBlock); - } - val.topics = (_a4 = val.topics) !== null && _a4 !== void 0 ? _a4 : []; - val.topics = val.topics.map((topic) => Array.isArray(topic) ? topic.map(inputTopicFormatter) : inputTopicFormatter(topic)); - if (val.address) { - val.address = Array.isArray(val.address) ? val.address.map((addr) => inputAddressFormatter(addr)) : inputAddressFormatter(val.address); - } - return val; -}; -var outputLogFormatter = (log) => { - const modifiedLog = Object.assign({}, log); - const logIndex = typeof log.logIndex === "string" ? log.logIndex : numberToHex2(log.logIndex); - if (typeof log.blockHash === "string" && typeof log.transactionHash === "string") { - const shaId = sha3Raw(`${log.blockHash.replace("0x", "")}${log.transactionHash.replace("0x", "")}${logIndex.replace("0x", "")}`); - modifiedLog.id = `log_${shaId.replace("0x", "").slice(0, 8)}`; - } else if (!log.id) { - modifiedLog.id = void 0; - } - if (log.blockNumber && isHexStrict2(log.blockNumber)) { - modifiedLog.blockNumber = hexToNumber2(log.blockNumber); - } - if (log.transactionIndex && isHexStrict2(log.transactionIndex)) { - modifiedLog.transactionIndex = hexToNumber2(log.transactionIndex); - } - if (log.logIndex && isHexStrict2(log.logIndex)) { - modifiedLog.logIndex = hexToNumber2(log.logIndex); - } - if (log.address) { - modifiedLog.address = toChecksumAddress(log.address); - } - return modifiedLog; -}; -var outputTransactionReceiptFormatter = (receipt) => { - if (typeof receipt !== "object") { - throw new FormatterError(`Received receipt is invalid: ${String(receipt)}`); - } - const modifiedReceipt = Object.assign({}, receipt); - if (receipt.blockNumber) { - modifiedReceipt.blockNumber = hexToNumber2(receipt.blockNumber); - } - if (receipt.transactionIndex) { - modifiedReceipt.transactionIndex = hexToNumber2(receipt.transactionIndex); - } - modifiedReceipt.cumulativeGasUsed = hexToNumber2(receipt.cumulativeGasUsed); - modifiedReceipt.gasUsed = hexToNumber2(receipt.gasUsed); - if (receipt.logs && Array.isArray(receipt.logs)) { - modifiedReceipt.logs = receipt.logs.map(outputLogFormatter); - } - if (receipt.effectiveGasPrice) { - modifiedReceipt.effectiveGasPrice = hexToNumber2(receipt.effectiveGasPrice); - } - if (receipt.contractAddress) { - modifiedReceipt.contractAddress = toChecksumAddress(receipt.contractAddress); - } - if (receipt.status) { - modifiedReceipt.status = Boolean(parseInt(receipt.status, 10)); - } - return modifiedReceipt; -}; -var outputBlockFormatter = (block) => { - const modifiedBlock = Object.assign({}, block); - modifiedBlock.gasLimit = hexToNumber2(block.gasLimit); - modifiedBlock.gasUsed = hexToNumber2(block.gasUsed); - modifiedBlock.size = hexToNumber2(block.size); - modifiedBlock.timestamp = hexToNumber2(block.timestamp); - if (block.number) { - modifiedBlock.number = hexToNumber2(block.number); - } - if (block.difficulty) { - modifiedBlock.difficulty = outputBigIntegerFormatter(block.difficulty); - } - if (block.totalDifficulty) { - modifiedBlock.totalDifficulty = outputBigIntegerFormatter(block.totalDifficulty); - } - if (block.transactions && Array.isArray(block.transactions)) { - modifiedBlock.transactions = block.transactions.map(outputTransactionFormatter); - } - if (block.miner) { - modifiedBlock.miner = toChecksumAddress(block.miner); - } - if (block.baseFeePerGas) { - modifiedBlock.baseFeePerGas = outputBigIntegerFormatter(block.baseFeePerGas); - } - return modifiedBlock; -}; -var inputPostFormatter = (post) => { - var _a4; - const modifiedPost = Object.assign({}, post); - if (post.ttl) { - modifiedPost.ttl = numberToHex2(post.ttl); - } - if (post.workToProve) { - modifiedPost.workToProve = numberToHex2(post.workToProve); - } - if (post.priority) { - modifiedPost.priority = numberToHex2(post.priority); - } - if (post.topics && !Array.isArray(post.topics)) { - modifiedPost.topics = post.topics ? [post.topics] : []; - } - modifiedPost.topics = (_a4 = modifiedPost.topics) === null || _a4 === void 0 ? void 0 : _a4.map((topic) => topic.startsWith("0x") ? topic : fromUtf8(topic)); - return modifiedPost; -}; -var outputPostFormatter = (post) => { - var _a4; - const modifiedPost = Object.assign({}, post); - if (post.expiry) { - modifiedPost.expiry = hexToNumber2(post.expiry); - } - if (post.sent) { - modifiedPost.sent = hexToNumber2(post.sent); - } - if (post.ttl) { - modifiedPost.ttl = hexToNumber2(post.ttl); - } - if (post.workProved) { - modifiedPost.workProved = hexToNumber2(post.workProved); - } - if (!post.topics) { - modifiedPost.topics = []; - } - modifiedPost.topics = (_a4 = modifiedPost.topics) === null || _a4 === void 0 ? void 0 : _a4.map(toUtf8); - return modifiedPost; -}; -var outputSyncingFormatter = (result) => { - const modifiedResult = Object.assign({}, result); - modifiedResult.startingBlock = hexToNumber2(result.startingBlock); - modifiedResult.currentBlock = hexToNumber2(result.currentBlock); - modifiedResult.highestBlock = hexToNumber2(result.highestBlock); - if (result.knownStates) { - modifiedResult.knownStates = hexToNumber2(result.knownStates); - } - if (result.pulledStates) { - modifiedResult.pulledStates = hexToNumber2(result.pulledStates); - } - return modifiedResult; -}; - -// node_modules/web3-core/lib/esm/web3_promi_event.js -var __awaiter14 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var _a3; -var Web3PromiEvent = class extends Web3EventEmitter { - constructor(executor) { - super(); - this[_a3] = "Promise"; - this._promise = new Promise(executor); - } - then(onfulfilled, onrejected) { - return __awaiter14(this, void 0, void 0, function* () { - return this._promise.then(onfulfilled, onrejected); - }); - } - catch(onrejected) { - return __awaiter14(this, void 0, void 0, function* () { - return this._promise.catch(onrejected); - }); - } - finally(onfinally) { - return __awaiter14(this, void 0, void 0, function* () { - return this._promise.finally(onfinally); - }); - } - on(eventName, fn) { - super.on(eventName, fn); - return this; - } - once(eventName, fn) { - super.once(eventName, fn); - return this; - } -}; -_a3 = Symbol.toStringTag; - -// node_modules/web3-eth/lib/esm/index.js -var import_setimmediate = __toESM(require_setImmediate()); - -// node_modules/web3-rpc-methods/lib/esm/index.js -var esm_exports10 = {}; -__export(esm_exports10, { - ethRpcMethods: () => eth_rpc_methods_exports, - netRpcMethods: () => net_rpc_methods_exports, - personalRpcMethods: () => personal_rpc_methods_exports -}); - -// node_modules/web3-rpc-methods/lib/esm/eth_rpc_methods.js -var eth_rpc_methods_exports = {}; -__export(eth_rpc_methods_exports, { - call: () => call, - compileLLL: () => compileLLL, - compileSerpent: () => compileSerpent, - compileSolidity: () => compileSolidity, - createAccessList: () => createAccessList, - estimateGas: () => estimateGas, - getAccounts: () => getAccounts, - getBalance: () => getBalance, - getBlockByHash: () => getBlockByHash, - getBlockByNumber: () => getBlockByNumber, - getBlockNumber: () => getBlockNumber, - getBlockTransactionCountByHash: () => getBlockTransactionCountByHash, - getBlockTransactionCountByNumber: () => getBlockTransactionCountByNumber, - getChainId: () => getChainId, - getCode: () => getCode, - getCoinbase: () => getCoinbase, - getCompilers: () => getCompilers, - getFeeHistory: () => getFeeHistory, - getFilterChanges: () => getFilterChanges, - getFilterLogs: () => getFilterLogs, - getGasPrice: () => getGasPrice, - getHashRate: () => getHashRate, - getLogs: () => getLogs, - getMining: () => getMining, - getNodeInfo: () => getNodeInfo, - getPendingTransactions: () => getPendingTransactions, - getProof: () => getProof, - getProtocolVersion: () => getProtocolVersion, - getStorageAt: () => getStorageAt, - getSyncing: () => getSyncing, - getTransactionByBlockHashAndIndex: () => getTransactionByBlockHashAndIndex, - getTransactionByBlockNumberAndIndex: () => getTransactionByBlockNumberAndIndex, - getTransactionByHash: () => getTransactionByHash, - getTransactionCount: () => getTransactionCount, - getTransactionReceipt: () => getTransactionReceipt, - getUncleByBlockHashAndIndex: () => getUncleByBlockHashAndIndex, - getUncleByBlockNumberAndIndex: () => getUncleByBlockNumberAndIndex, - getUncleCountByBlockHash: () => getUncleCountByBlockHash, - getUncleCountByBlockNumber: () => getUncleCountByBlockNumber, - getWork: () => getWork, - newBlockFilter: () => newBlockFilter, - newFilter: () => newFilter, - newPendingTransactionFilter: () => newPendingTransactionFilter, - requestAccounts: () => requestAccounts, - sendRawTransaction: () => sendRawTransaction, - sendTransaction: () => sendTransaction, - sign: () => sign2, - signTransaction: () => signTransaction2, - signTypedData: () => signTypedData, - submitHashrate: () => submitHashrate, - submitWork: () => submitWork, - uninstallFilter: () => uninstallFilter -}); -var __awaiter15 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -function getProtocolVersion(requestManager) { - return __awaiter15(this, void 0, void 0, function* () { - return requestManager.send({ - method: "eth_protocolVersion", - params: [] - }); - }); -} -function getSyncing(requestManager) { - return __awaiter15(this, void 0, void 0, function* () { - return requestManager.send({ - method: "eth_syncing", - params: [] - }); - }); -} -function getCoinbase(requestManager) { - return __awaiter15(this, void 0, void 0, function* () { - return requestManager.send({ - method: "eth_coinbase", - params: [] - }); - }); -} -function getMining(requestManager) { - return __awaiter15(this, void 0, void 0, function* () { - return requestManager.send({ - method: "eth_mining", - params: [] - }); - }); -} -function getHashRate(requestManager) { - return __awaiter15(this, void 0, void 0, function* () { - return requestManager.send({ - method: "eth_hashrate", - params: [] - }); - }); -} -function getGasPrice(requestManager) { - return __awaiter15(this, void 0, void 0, function* () { - return requestManager.send({ - method: "eth_gasPrice", - params: [] - }); - }); -} -function getAccounts(requestManager) { - return __awaiter15(this, void 0, void 0, function* () { - return requestManager.send({ - method: "eth_accounts", - params: [] - }); - }); -} -function getBlockNumber(requestManager) { - return __awaiter15(this, void 0, void 0, function* () { - return requestManager.send({ - method: "eth_blockNumber", - params: [] - }); - }); -} -function getBalance(requestManager, address, blockNumber) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["address", "blockNumberOrTag"], [address, blockNumber]); - return requestManager.send({ - method: "eth_getBalance", - params: [address, blockNumber] - }); - }); -} -function getStorageAt(requestManager, address, storageSlot, blockNumber) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["address", "hex", "blockNumberOrTag"], [address, storageSlot, blockNumber]); - return requestManager.send({ - method: "eth_getStorageAt", - params: [address, storageSlot, blockNumber] - }); - }); -} -function getTransactionCount(requestManager, address, blockNumber) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["address", "blockNumberOrTag"], [address, blockNumber]); - return requestManager.send({ - method: "eth_getTransactionCount", - params: [address, blockNumber] - }); - }); -} -function getBlockTransactionCountByHash(requestManager, blockHash) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["bytes32"], [blockHash]); - return requestManager.send({ - method: "eth_getBlockTransactionCountByHash", - params: [blockHash] - }); - }); -} -function getBlockTransactionCountByNumber(requestManager, blockNumber) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["blockNumberOrTag"], [blockNumber]); - return requestManager.send({ - method: "eth_getBlockTransactionCountByNumber", - params: [blockNumber] - }); - }); -} -function getUncleCountByBlockHash(requestManager, blockHash) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["bytes32"], [blockHash]); - return requestManager.send({ - method: "eth_getUncleCountByBlockHash", - params: [blockHash] - }); - }); -} -function getUncleCountByBlockNumber(requestManager, blockNumber) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["blockNumberOrTag"], [blockNumber]); - return requestManager.send({ - method: "eth_getUncleCountByBlockNumber", - params: [blockNumber] - }); - }); -} -function getCode(requestManager, address, blockNumber) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["address", "blockNumberOrTag"], [address, blockNumber]); - return requestManager.send({ - method: "eth_getCode", - params: [address, blockNumber] - }); - }); -} -function sign2(requestManager, address, message) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["address", "hex"], [address, message]); - return requestManager.send({ - method: "eth_sign", - params: [address, message] - }); - }); -} -function signTransaction2(requestManager, transaction) { - return __awaiter15(this, void 0, void 0, function* () { - return requestManager.send({ - method: "eth_signTransaction", - params: [transaction] - }); - }); -} -function sendTransaction(requestManager, transaction) { - return __awaiter15(this, void 0, void 0, function* () { - return requestManager.send({ - method: "eth_sendTransaction", - params: [transaction] - }); - }); -} -function sendRawTransaction(requestManager, transaction) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["hex"], [transaction]); - return requestManager.send({ - method: "eth_sendRawTransaction", - params: [transaction] - }); - }); -} -function call(requestManager, transaction, blockNumber) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["blockNumberOrTag"], [blockNumber]); - return requestManager.send({ - method: "eth_call", - params: [transaction, blockNumber] - }); - }); -} -function estimateGas(requestManager, transaction, blockNumber) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["blockNumberOrTag"], [blockNumber]); - return requestManager.send({ - method: "eth_estimateGas", - params: [transaction, blockNumber] - }); - }); -} -function getBlockByHash(requestManager, blockHash, hydrated) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["bytes32", "bool"], [blockHash, hydrated]); - return requestManager.send({ - method: "eth_getBlockByHash", - params: [blockHash, hydrated] - }); - }); -} -function getBlockByNumber(requestManager, blockNumber, hydrated) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["blockNumberOrTag", "bool"], [blockNumber, hydrated]); - return requestManager.send({ - method: "eth_getBlockByNumber", - params: [blockNumber, hydrated] - }); - }); -} -function getTransactionByHash(requestManager, transactionHash) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["bytes32"], [transactionHash]); - return requestManager.send({ - method: "eth_getTransactionByHash", - params: [transactionHash] - }); - }); -} -function getTransactionByBlockHashAndIndex(requestManager, blockHash, transactionIndex) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["bytes32", "hex"], [blockHash, transactionIndex]); - return requestManager.send({ - method: "eth_getTransactionByBlockHashAndIndex", - params: [blockHash, transactionIndex] - }); - }); -} -function getTransactionByBlockNumberAndIndex(requestManager, blockNumber, transactionIndex) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["blockNumberOrTag", "hex"], [blockNumber, transactionIndex]); - return requestManager.send({ - method: "eth_getTransactionByBlockNumberAndIndex", - params: [blockNumber, transactionIndex] - }); - }); -} -function getTransactionReceipt(requestManager, transactionHash) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["bytes32"], [transactionHash]); - return requestManager.send({ - method: "eth_getTransactionReceipt", - params: [transactionHash] - }); - }); -} -function getUncleByBlockHashAndIndex(requestManager, blockHash, uncleIndex) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["bytes32", "hex"], [blockHash, uncleIndex]); - return requestManager.send({ - method: "eth_getUncleByBlockHashAndIndex", - params: [blockHash, uncleIndex] - }); - }); -} -function getUncleByBlockNumberAndIndex(requestManager, blockNumber, uncleIndex) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["blockNumberOrTag", "hex"], [blockNumber, uncleIndex]); - return requestManager.send({ - method: "eth_getUncleByBlockNumberAndIndex", - params: [blockNumber, uncleIndex] - }); - }); -} -function getCompilers(requestManager) { - return __awaiter15(this, void 0, void 0, function* () { - return requestManager.send({ - method: "eth_getCompilers", - params: [] - }); - }); -} -function compileSolidity(requestManager, code) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["string"], [code]); - return requestManager.send({ - method: "eth_compileSolidity", - params: [code] - }); - }); -} -function compileLLL(requestManager, code) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["string"], [code]); - return requestManager.send({ - method: "eth_compileLLL", - params: [code] - }); - }); -} -function compileSerpent(requestManager, code) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["string"], [code]); - return requestManager.send({ - method: "eth_compileSerpent", - params: [code] - }); - }); -} -function newFilter(requestManager, filter) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["filter"], [filter]); - return requestManager.send({ - method: "eth_newFilter", - params: [filter] - }); - }); -} -function newBlockFilter(requestManager) { - return __awaiter15(this, void 0, void 0, function* () { - return requestManager.send({ - method: "eth_newBlockFilter", - params: [] - }); - }); -} -function newPendingTransactionFilter(requestManager) { - return __awaiter15(this, void 0, void 0, function* () { - return requestManager.send({ - method: "eth_newPendingTransactionFilter", - params: [] - }); - }); -} -function uninstallFilter(requestManager, filterIdentifier) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["hex"], [filterIdentifier]); - return requestManager.send({ - method: "eth_uninstallFilter", - params: [filterIdentifier] - }); - }); -} -function getFilterChanges(requestManager, filterIdentifier) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["hex"], [filterIdentifier]); - return requestManager.send({ - method: "eth_getFilterChanges", - params: [filterIdentifier] - }); - }); -} -function getFilterLogs(requestManager, filterIdentifier) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["hex"], [filterIdentifier]); - return requestManager.send({ - method: "eth_getFilterLogs", - params: [filterIdentifier] - }); - }); -} -function getLogs(requestManager, filter) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["filter"], [filter]); - return requestManager.send({ - method: "eth_getLogs", - params: [filter] - }); - }); -} -function getWork(requestManager) { - return __awaiter15(this, void 0, void 0, function* () { - return requestManager.send({ - method: "eth_getWork", - params: [] - }); - }); -} -function submitWork(requestManager, nonce, hash2, digest) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["bytes8", "bytes32", "bytes32"], [nonce, hash2, digest]); - return requestManager.send({ - method: "eth_submitWork", - params: [nonce, hash2, digest] - }); - }); -} -function submitHashrate(requestManager, hashRate, id) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["bytes32", "bytes32"], [hashRate, id]); - return requestManager.send({ - method: "eth_submitHashrate", - params: [hashRate, id] - }); - }); -} -function getFeeHistory(requestManager, blockCount, newestBlock, rewardPercentiles) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["hex", "blockNumberOrTag"], [blockCount, newestBlock]); - for (const rewardPercentile of rewardPercentiles) { - validator.validate(["number"], [rewardPercentile]); - } - return requestManager.send({ - method: "eth_feeHistory", - params: [blockCount, newestBlock, rewardPercentiles] - }); - }); -} -function getPendingTransactions(requestManager) { - return __awaiter15(this, void 0, void 0, function* () { - return requestManager.send({ - method: "eth_pendingTransactions", - params: [] - }); - }); -} -function requestAccounts(requestManager) { - return __awaiter15(this, void 0, void 0, function* () { - return requestManager.send({ - method: "eth_requestAccounts", - params: [] - }); - }); -} -function getChainId(requestManager) { - return __awaiter15(this, void 0, void 0, function* () { - return requestManager.send({ - method: "eth_chainId", - params: [] - }); - }); -} -function getProof(requestManager, address, storageKeys, blockNumber) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["address", "bytes32[]", "blockNumberOrTag"], [address, storageKeys, blockNumber]); - return requestManager.send({ - method: "eth_getProof", - params: [address, storageKeys, blockNumber] - }); - }); -} -function getNodeInfo(requestManager) { - return __awaiter15(this, void 0, void 0, function* () { - return requestManager.send({ - method: "web3_clientVersion", - params: [] - }); - }); -} -function createAccessList(requestManager, transaction, blockNumber) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["blockNumberOrTag"], [blockNumber]); - return requestManager.send({ - method: "eth_createAccessList", - params: [transaction, blockNumber] - }); - }); -} -function signTypedData(requestManager, address, typedData, useLegacy = false) { - return __awaiter15(this, void 0, void 0, function* () { - validator.validate(["address"], [address]); - return requestManager.send({ - method: `eth_signTypedData${useLegacy ? "" : "_v4"}`, - params: [address, typedData] - }); - }); -} - -// node_modules/web3-rpc-methods/lib/esm/net_rpc_methods.js -var net_rpc_methods_exports = {}; -__export(net_rpc_methods_exports, { - getId: () => getId, - getPeerCount: () => getPeerCount, - isListening: () => isListening -}); -var __awaiter16 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -function getId(requestManager) { - return __awaiter16(this, void 0, void 0, function* () { - return requestManager.send({ - method: "net_version", - params: [] - }); - }); -} -function getPeerCount(requestManager) { - return __awaiter16(this, void 0, void 0, function* () { - return requestManager.send({ - method: "net_peerCount", - params: [] - }); - }); -} -function isListening(requestManager) { - return __awaiter16(this, void 0, void 0, function* () { - return requestManager.send({ - method: "net_listening", - params: [] - }); - }); -} - -// node_modules/web3-rpc-methods/lib/esm/personal_rpc_methods.js -var personal_rpc_methods_exports = {}; -__export(personal_rpc_methods_exports, { - ecRecover: () => ecRecover, - getAccounts: () => getAccounts2, - importRawKey: () => importRawKey, - lockAccount: () => lockAccount, - newAccount: () => newAccount, - sendTransaction: () => sendTransaction2, - sign: () => sign3, - signTransaction: () => signTransaction3, - unlockAccount: () => unlockAccount -}); -var __awaiter17 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var getAccounts2 = (requestManager) => __awaiter17(void 0, void 0, void 0, function* () { - return requestManager.send({ - method: "personal_listAccounts", - params: [] - }); -}); -var newAccount = (requestManager, password) => __awaiter17(void 0, void 0, void 0, function* () { - return requestManager.send({ - method: "personal_newAccount", - params: [password] - }); -}); -var unlockAccount = (requestManager, address, password, unlockDuration) => __awaiter17(void 0, void 0, void 0, function* () { - return requestManager.send({ - method: "personal_unlockAccount", - params: [address, password, unlockDuration] - }); -}); -var lockAccount = (requestManager, address) => __awaiter17(void 0, void 0, void 0, function* () { - return requestManager.send({ - method: "personal_lockAccount", - params: [address] - }); -}); -var importRawKey = (requestManager, keyData, passphrase) => __awaiter17(void 0, void 0, void 0, function* () { - return requestManager.send({ - method: "personal_importRawKey", - params: [keyData, passphrase] - }); -}); -var sendTransaction2 = (requestManager, tx, passphrase) => __awaiter17(void 0, void 0, void 0, function* () { - return requestManager.send({ - method: "personal_sendTransaction", - params: [tx, passphrase] - }); -}); -var signTransaction3 = (requestManager, tx, passphrase) => __awaiter17(void 0, void 0, void 0, function* () { - return requestManager.send({ - method: "personal_signTransaction", - params: [tx, passphrase] - }); -}); -var sign3 = (requestManager, data, address, passphrase) => __awaiter17(void 0, void 0, void 0, function* () { - return requestManager.send({ - method: "personal_sign", - params: [data, address, passphrase] - }); -}); -var ecRecover = (requestManager, signedData, signature) => __awaiter17(void 0, void 0, void 0, function* () { - return requestManager.send({ - method: "personal_ecRecover", - params: [signedData, signature] - }); -}); - -// node_modules/web3-eth/lib/esm/utils/detect_transaction_type.js -var transactionType0x0Schema = { - type: "object", - properties: { - accessList: { - type: "null" - }, - maxFeePerGas: { - type: "null" - }, - maxPriorityFeePerGas: { - type: "null" - } - } -}; -var transactionType0x1Schema = { - type: "object", - properties: { - maxFeePerGas: { - type: "null" - }, - maxPriorityFeePerGas: { - type: "null" - } - } -}; -var transactionType0x2Schema = { - type: "object", - properties: { - gasPrice: { - type: "null" - } - } -}; -var validateTxTypeAndHandleErrors = (txSchema, tx, txType) => { - try { - validator.validateJSONSchema(txSchema, tx); - } catch (error) { - if (error instanceof Web3ValidatorError) - throw new InvalidPropertiesForTransactionTypeError(error.errors, txType); - throw error; - } -}; -var defaultTransactionTypeParser = (transaction) => { - var _a4, _b; - const tx = transaction; - if (!isNullish(tx.type)) { - let txSchema; - switch (tx.type) { - case "0x0": - txSchema = transactionType0x0Schema; - break; - case "0x1": - txSchema = transactionType0x1Schema; - break; - case "0x2": - txSchema = transactionType0x2Schema; - break; - default: - return format({ format: "uint" }, tx.type, ETH_DATA_FORMAT); - } - validateTxTypeAndHandleErrors(txSchema, tx, tx.type); - return format({ format: "uint" }, tx.type, ETH_DATA_FORMAT); - } - if (!isNullish(tx.maxFeePerGas) || !isNullish(tx.maxPriorityFeePerGas)) { - validateTxTypeAndHandleErrors(transactionType0x2Schema, tx, "0x2"); - return "0x2"; - } - if (!isNullish(tx.accessList)) { - validateTxTypeAndHandleErrors(transactionType0x1Schema, tx, "0x1"); - return "0x1"; - } - const givenHardfork = (_a4 = tx.hardfork) !== null && _a4 !== void 0 ? _a4 : (_b = tx.common) === null || _b === void 0 ? void 0 : _b.hardfork; - if (!isNullish(givenHardfork)) { - const hardforkIndex = Object.keys(HardforksOrdered).indexOf(givenHardfork); - if (hardforkIndex >= Object.keys(HardforksOrdered).indexOf("london")) - return !isNullish(tx.gasPrice) ? "0x0" : "0x2"; - if (hardforkIndex === Object.keys(HardforksOrdered).indexOf("berlin")) - return "0x0"; - } - if (!isNullish(tx.gasPrice)) { - validateTxTypeAndHandleErrors(transactionType0x0Schema, tx, "0x0"); - return "0x0"; - } - return void 0; -}; -var detectTransactionType = (transaction, web3Context) => { - var _a4; - return ((_a4 = web3Context === null || web3Context === void 0 ? void 0 : web3Context.transactionTypeParser) !== null && _a4 !== void 0 ? _a4 : defaultTransactionTypeParser)(transaction); -}; -var detectRawTransactionType = (transaction) => transaction[0] > 127 ? "0x0" : toHex(transaction[0]); - -// node_modules/web3-eth/lib/esm/schemas.js -var accessListItemSchema = { - type: "object", - properties: { - address: { - format: "address" - }, - storageKeys: { - type: "array", - items: { - format: "bytes32" - } - } - } -}; -var accessListSchema = { - type: "array", - items: Object.assign({}, accessListItemSchema) -}; -var accessListResultSchema = { - type: "object", - properties: { - accessList: Object.assign({}, accessListSchema), - gasUsed: { - type: "string" - } - } -}; -var chainSchema = { - type: "string", - enum: ["goerli", "kovan", "mainnet", "rinkeby", "ropsten", "sepolia"] -}; -var hardforkSchema = { - type: "string", - enum: [ - "arrowGlacier", - "berlin", - "byzantium", - "chainstart", - "constantinople", - "dao", - "homestead", - "istanbul", - "london", - "merge", - "muirGlacier", - "petersburg", - "shanghai", - "spuriousDragon", - "tangerineWhistle" - ] -}; -var customChainSchema = { - type: "object", - properties: { - name: { - format: "string" - }, - networkId: { - format: "uint" - }, - chainId: { - format: "uint" - } - } -}; -var transactionSchema = { - type: "object", - properties: { - from: { - format: "address" - }, - to: { - oneOf: [{ format: "address" }, { type: "null" }] - }, - value: { - format: "uint" - }, - gas: { - format: "uint" - }, - gasPrice: { - format: "uint" - }, - effectiveGasPrice: { - format: "uint" - }, - type: { - format: "uint" - }, - maxFeePerGas: { - format: "uint" - }, - maxPriorityFeePerGas: { - format: "uint" - }, - accessList: Object.assign({}, accessListSchema), - data: { - format: "bytes" - }, - input: { - format: "bytes" - }, - nonce: { - format: "uint" - }, - chain: Object.assign({}, chainSchema), - hardfork: Object.assign({}, hardforkSchema), - chainId: { - format: "uint" - }, - networkId: { - format: "uint" - }, - common: { - type: "object", - properties: { - customChain: Object.assign({}, customChainSchema), - baseChain: Object.assign({}, chainSchema), - hardfork: Object.assign({}, hardforkSchema) - } - }, - gasLimit: { - format: "uint" - }, - v: { - format: "uint" - }, - r: { - format: "bytes32" - }, - s: { - format: "bytes32" - } - } -}; -var transactionInfoSchema = { - type: "object", - properties: Object.assign(Object.assign({}, transactionSchema.properties), { blockHash: { - format: "bytes32" - }, blockNumber: { - format: "uint" - }, hash: { - format: "bytes32" - }, transactionIndex: { - format: "uint" - }, from: { - format: "address" - }, to: { - oneOf: [{ format: "address" }, { type: "null" }] - }, value: { - format: "uint" - }, gas: { - format: "uint" - }, gasPrice: { - format: "uint" - }, effectiveGasPrice: { - format: "uint" - }, type: { - format: "uint" - }, maxFeePerGas: { - format: "uint" - }, maxPriorityFeePerGas: { - format: "uint" - }, accessList: Object.assign({}, accessListSchema), data: { - format: "bytes" - }, input: { - format: "bytes" - }, nonce: { - format: "uint" - }, gasLimit: { - format: "uint" - }, v: { - format: "uint" - }, r: { - format: "bytes32" - }, s: { - format: "bytes32" - } }) -}; -var blockSchema = { - type: "object", - properties: { - parentHash: { - format: "bytes32" - }, - sha3Uncles: { - format: "bytes32" - }, - miner: { - format: "bytes" - }, - stateRoot: { - format: "bytes32" - }, - transactionsRoot: { - format: "bytes32" - }, - receiptsRoot: { - format: "bytes32" - }, - logsBloom: { - format: "bytes256" - }, - difficulty: { - format: "uint" - }, - number: { - format: "uint" - }, - gasLimit: { - format: "uint" - }, - gasUsed: { - format: "uint" - }, - timestamp: { - format: "uint" - }, - extraData: { - format: "bytes" - }, - mixHash: { - format: "bytes32" - }, - nonce: { - format: "uint" - }, - totalDifficulty: { - format: "uint" - }, - baseFeePerGas: { - format: "uint" - }, - size: { - format: "uint" - }, - transactions: { - oneOf: [ - { - type: "array", - items: Object.assign({}, transactionInfoSchema) - }, - { - type: "array", - items: { - format: "bytes32" - } - } - ] - }, - uncles: { - type: "array", - items: { - format: "bytes32" - } - }, - hash: { - format: "bytes32" - } - } -}; -var withdrawalsSchema = { - type: "object", - properties: { - index: { - format: "uint" - }, - validatorIndex: { - format: "uint" - }, - address: { - format: "address" - }, - amount: { - format: "uint" - } - } -}; -var blockHeaderSchema = { - type: "object", - properties: { - author: { - format: "bytes32" - }, - hash: { - format: "bytes32" - }, - parentHash: { - format: "bytes32" - }, - receiptsRoot: { - format: "bytes32" - }, - miner: { - format: "bytes" - }, - stateRoot: { - format: "bytes32" - }, - transactionsRoot: { - format: "bytes32" - }, - withdrawalsRoot: { - format: "bytes32" - }, - logsBloom: { - format: "bytes256" - }, - difficulty: { - format: "uint" - }, - totalDifficulty: { - format: "uint" - }, - number: { - format: "uint" - }, - gasLimit: { - format: "uint" - }, - gasUsed: { - format: "uint" - }, - timestamp: { - format: "uint" - }, - extraData: { - format: "bytes" - }, - nonce: { - format: "uint" - }, - sha3Uncles: { - format: "bytes32" - }, - size: { - format: "uint" - }, - baseFeePerGas: { - format: "uint" - }, - excessDataGas: { - format: "uint" - }, - mixHash: { - format: "bytes32" - }, - transactions: { - type: "array", - items: { - format: "bytes32" - } - }, - uncles: { - type: "array", - items: { - format: "bytes32" - } - }, - withdrawals: { - type: "array", - items: Object.assign({}, withdrawalsSchema) - } - } -}; -var logSchema = { - type: "object", - properties: { - removed: { - format: "bool" - }, - logIndex: { - format: "uint" - }, - transactionIndex: { - format: "uint" - }, - transactionHash: { - format: "bytes32" - }, - blockHash: { - format: "bytes32" - }, - blockNumber: { - format: "uint" - }, - address: { - format: "address" - }, - data: { - format: "bytes" - }, - topics: { - type: "array", - items: { - format: "bytes32" - } - } - } -}; -var syncSchema = { - type: "object", - properties: { - startingBlock: { - format: "string" - }, - currentBlock: { - format: "string" - }, - highestBlock: { - format: "string" - }, - knownStates: { - format: "string" - }, - pulledStates: { - format: "string" - } - } -}; -var transactionReceiptSchema = { - type: "object", - properties: { - transactionHash: { - format: "bytes32" - }, - transactionIndex: { - format: "uint" - }, - blockHash: { - format: "bytes32" - }, - blockNumber: { - format: "uint" - }, - from: { - format: "address" - }, - to: { - format: "address" - }, - cumulativeGasUsed: { - format: "uint" - }, - gasUsed: { - format: "uint" - }, - effectiveGasPrice: { - format: "uint" - }, - contractAddress: { - format: "address" - }, - logs: { - type: "array", - items: Object.assign({}, logSchema) - }, - logsBloom: { - format: "bytes" - }, - root: { - format: "bytes" - }, - status: { - format: "uint" - }, - type: { - format: "uint" - } - } -}; -var SignatureObjectSchema = { - type: "object", - properties: { - messageHash: { - format: "bytes" - }, - r: { - format: "bytes32" - }, - s: { - format: "bytes32" - }, - v: { - format: "bytes" - }, - message: { - format: "bytes" - }, - signature: { - format: "bytes" - } - } -}; -var feeHistorySchema = { - type: "object", - properties: { - oldestBlock: { - format: "uint" - }, - baseFeePerGas: { - type: "array", - items: { - format: "uint" - } - }, - reward: { - type: "array", - items: { - type: "array", - items: { - format: "uint" - } - } - }, - gasUsedRatio: { - type: "array", - items: { - type: "number" - } - } - } -}; -var storageProofSchema = { - type: "object", - properties: { - key: { - format: "bytes32" - }, - value: { - format: "uint" - }, - proof: { - type: "array", - items: { - format: "bytes32" - } - } - } -}; -var accountSchema = { - type: "object", - properties: { - balance: { - format: "uint" - }, - codeHash: { - format: "bytes32" - }, - nonce: { - format: "uint" - }, - storageHash: { - format: "bytes32" - }, - accountProof: { - type: "array", - items: { - format: "bytes32" - } - }, - storageProof: { - type: "array", - items: Object.assign({}, storageProofSchema) - } - } -}; - -// node_modules/web3-eth/lib/esm/utils/format_transaction.js -function formatTransaction(transaction, returnFormat = DEFAULT_RETURN_FORMAT, options = { - transactionSchema: transactionInfoSchema, - fillInputAndData: false -}) { - var _a4, _b; - let formattedTransaction = mergeDeep({}, transaction); - if (!isNullish(transaction === null || transaction === void 0 ? void 0 : transaction.common)) { - formattedTransaction.common = Object.assign({}, transaction.common); - if (!isNullish((_a4 = transaction.common) === null || _a4 === void 0 ? void 0 : _a4.customChain)) - formattedTransaction.common.customChain = Object.assign({}, transaction.common.customChain); - } - formattedTransaction = format((_b = options.transactionSchema) !== null && _b !== void 0 ? _b : transactionInfoSchema, formattedTransaction, returnFormat); - if (!isNullish(formattedTransaction.data) && !isNullish(formattedTransaction.input) && // Converting toHex is accounting for data and input being Uint8Arrays - // since comparing Uint8Array is not as straightforward as comparing strings - toHex(formattedTransaction.data) !== toHex(formattedTransaction.input)) - throw new TransactionDataAndInputError({ - data: bytesToHex2(formattedTransaction.data), - input: bytesToHex2(formattedTransaction.input) - }); - if (options.fillInputAndData) { - if (!isNullish(formattedTransaction.data)) { - formattedTransaction.input = formattedTransaction.data; - } else if (!isNullish(formattedTransaction.input)) { - formattedTransaction.data = formattedTransaction.input; - } - } - if (!isNullish(formattedTransaction.gasLimit)) { - formattedTransaction.gas = formattedTransaction.gasLimit; - delete formattedTransaction.gasLimit; - } - return formattedTransaction; -} - -// node_modules/web3-eth/lib/esm/utils/decode_signed_transaction.js -function decodeSignedTransaction(encodedSignedTransaction, returnFormat, options = { fillInputAndData: false }) { - return { - raw: format({ format: "bytes" }, encodedSignedTransaction, returnFormat), - tx: formatTransaction(Object.assign(Object.assign({}, TransactionFactory.fromSerializedData(hexToBytes2(encodedSignedTransaction)).toJSON()), { hash: bytesToHex2(keccak256Wrapper(hexToBytes2(encodedSignedTransaction))), type: detectRawTransactionType(hexToBytes2(encodedSignedTransaction)) }), returnFormat, { fillInputAndData: options.fillInputAndData }) - }; -} - -// node_modules/web3-net/lib/esm/index.js -var esm_exports11 = {}; -__export(esm_exports11, { - Net: () => Net, - default: () => esm_default2, - getId: () => getId2, - getPeerCount: () => getPeerCount2, - isListening: () => isListening2 -}); - -// node_modules/web3-net/lib/esm/rpc_method_wrappers.js -var __awaiter18 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -function getId2(web3Context, returnFormat) { - return __awaiter18(this, void 0, void 0, function* () { - const response = yield net_rpc_methods_exports.getId(web3Context.requestManager); - return format({ format: "uint" }, response, returnFormat); - }); -} -function getPeerCount2(web3Context, returnFormat) { - return __awaiter18(this, void 0, void 0, function* () { - const response = yield net_rpc_methods_exports.getPeerCount(web3Context.requestManager); - return format({ format: "uint" }, response, returnFormat); - }); -} -var isListening2 = (web3Context) => __awaiter18(void 0, void 0, void 0, function* () { - return net_rpc_methods_exports.isListening(web3Context.requestManager); -}); - -// node_modules/web3-net/lib/esm/net.js -var __awaiter19 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var Net = class extends Web3Context { - /** - * Gets the current network ID - * - * @param returnFormat - Return format - * @returns A Promise of the network ID. - * @example - * ```ts - * const net = new Net(Net.givenProvider || 'ws://some.local-or-remote.node:8546'); - * await net.getId(); - * > 1 - * ``` - */ - getId(returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter19(this, void 0, void 0, function* () { - return getId2(this, returnFormat); - }); - } - /** - * Get the number of peers connected to. - * - * @param returnFormat - Return format - * @returns A promise of the number of the peers connected to. - * @example - * ```ts - * const net = new Net(Net.givenProvider || 'ws://some.local-or-remote.node:8546'); - * await net.getPeerCount(); - * > 0 - * ``` - */ - getPeerCount(returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter19(this, void 0, void 0, function* () { - return getPeerCount2(this, returnFormat); - }); - } - /** - * Check if the node is listening for peers - * - * @returns A promise of a boolean if the node is listening to peers - * @example - * ```ts - * const net = new Net(Net.givenProvider || 'ws://some.local-or-remote.node:8546'); - * await net.isListening(); - * > true - * ``` - */ - isListening() { - return __awaiter19(this, void 0, void 0, function* () { - return isListening2(this); - }); - } -}; - -// node_modules/web3-net/lib/esm/index.js -var esm_default2 = Net; - -// node_modules/web3-eth/lib/esm/constants.js -var ALL_EVENTS = "ALLEVENTS"; -var ALL_EVENTS_ABI = { - name: ALL_EVENTS, - signature: "", - type: "event", - inputs: [] -}; -var NUMBER_DATA_FORMAT = { bytes: FMT_BYTES.HEX, number: FMT_NUMBER.NUMBER }; - -// node_modules/web3-eth/lib/esm/utils/get_transaction_gas_pricing.js -var __awaiter20 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -function getEip1559GasPricing(transaction, web3Context, returnFormat) { - var _a4, _b, _c; - return __awaiter20(this, void 0, void 0, function* () { - const block = yield getBlock(web3Context, web3Context.defaultBlock, false, returnFormat); - if (isNullish(block.baseFeePerGas)) - throw new Eip1559NotSupportedError(); - if (!isNullish(transaction.gasPrice)) { - const convertedTransactionGasPrice = format({ format: "uint" }, transaction.gasPrice, returnFormat); - return { - maxPriorityFeePerGas: convertedTransactionGasPrice, - maxFeePerGas: convertedTransactionGasPrice - }; - } - return { - maxPriorityFeePerGas: format({ format: "uint" }, (_a4 = transaction.maxPriorityFeePerGas) !== null && _a4 !== void 0 ? _a4 : web3Context.defaultMaxPriorityFeePerGas, returnFormat), - maxFeePerGas: format({ format: "uint" }, (_b = transaction.maxFeePerGas) !== null && _b !== void 0 ? _b : BigInt(block.baseFeePerGas) * BigInt(2) + BigInt((_c = transaction.maxPriorityFeePerGas) !== null && _c !== void 0 ? _c : web3Context.defaultMaxPriorityFeePerGas), returnFormat) - }; - }); -} -function getTransactionGasPricing(transaction, web3Context, returnFormat) { - return __awaiter20(this, void 0, void 0, function* () { - const transactionType = getTransactionType(transaction, web3Context); - if (!isNullish(transactionType)) { - if (transactionType.startsWith("-")) - throw new UnsupportedTransactionTypeError(transactionType); - if (Number(transactionType) < 0 || Number(transactionType) > 127) - throw new UnsupportedTransactionTypeError(transactionType); - if (isNullish(transaction.gasPrice) && (transactionType === "0x0" || transactionType === "0x1")) - return { - gasPrice: yield getGasPrice2(web3Context, returnFormat), - maxPriorityFeePerGas: void 0, - maxFeePerGas: void 0 - }; - if (transactionType === "0x2") { - return Object.assign({ gasPrice: void 0 }, yield getEip1559GasPricing(transaction, web3Context, returnFormat)); - } - } - return void 0; - }); -} - -// node_modules/web3-eth/lib/esm/utils/transaction_builder.js -var __awaiter21 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var getTransactionFromOrToAttr = (attr, web3Context, transaction, privateKey) => { - if (transaction !== void 0 && attr in transaction && transaction[attr] !== void 0) { - if (typeof transaction[attr] === "string" && isAddress(transaction[attr])) { - return transaction[attr]; - } - if (!isHexStrict(transaction[attr]) && isNumber(transaction[attr])) { - if (web3Context.wallet) { - const account = web3Context.wallet.get(format({ format: "uint" }, transaction[attr], NUMBER_DATA_FORMAT)); - if (!isNullish(account)) { - return account.address; - } - throw new LocalWalletNotAvailableError(); - } - throw new LocalWalletNotAvailableError(); - } else { - throw attr === "from" ? new InvalidTransactionWithSender(transaction.from) : ( - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - new InvalidTransactionWithReceiver(transaction.to) - ); - } - } - if (attr === "from") { - if (!isNullish(privateKey)) - return privateKeyToAddress(privateKey); - if (!isNullish(web3Context.defaultAccount)) - return web3Context.defaultAccount; - } - return void 0; -}; -var getTransactionNonce = (web3Context, address, returnFormat = DEFAULT_RETURN_FORMAT) => __awaiter21(void 0, void 0, void 0, function* () { - if (isNullish(address)) { - throw new UnableToPopulateNonceError(); - } - return getTransactionCount2(web3Context, address, web3Context.defaultBlock, returnFormat); -}); -var getTransactionType = (transaction, web3Context) => { - const inferredType = detectTransactionType(transaction, web3Context); - if (!isNullish(inferredType)) - return inferredType; - if (!isNullish(web3Context.defaultTransactionType)) - return format({ format: "uint" }, web3Context.defaultTransactionType, ETH_DATA_FORMAT); - return void 0; -}; -function defaultTransactionBuilder(options) { - var _a4, _b; - return __awaiter21(this, void 0, void 0, function* () { - let populatedTransaction = format(transactionSchema, options.transaction, DEFAULT_RETURN_FORMAT); - if (isNullish(populatedTransaction.from)) { - populatedTransaction.from = getTransactionFromOrToAttr("from", options.web3Context, void 0, options.privateKey); - } - if (isNullish(populatedTransaction.nonce)) { - populatedTransaction.nonce = yield getTransactionNonce(options.web3Context, populatedTransaction.from, ETH_DATA_FORMAT); - } - if (isNullish(populatedTransaction.value)) { - populatedTransaction.value = "0x0"; - } - if (!isNullish(populatedTransaction.data)) { - if (!isNullish(populatedTransaction.input) && populatedTransaction.data !== populatedTransaction.input) - throw new TransactionDataAndInputError({ - data: bytesToHex2(populatedTransaction.data), - input: bytesToHex2(populatedTransaction.input) - }); - if (!populatedTransaction.data.startsWith("0x")) - populatedTransaction.data = `0x${populatedTransaction.data}`; - } else if (!isNullish(populatedTransaction.input)) { - if (!populatedTransaction.input.startsWith("0x")) - populatedTransaction.input = `0x${populatedTransaction.input}`; - } else { - populatedTransaction.input = "0x"; - } - if (isNullish(populatedTransaction.common)) { - if (options.web3Context.defaultCommon) { - const common = options.web3Context.defaultCommon; - const chainId = common.customChain.chainId; - const networkId = common.customChain.networkId; - const name2 = common.customChain.name; - populatedTransaction.common = Object.assign(Object.assign({}, common), { customChain: { chainId, networkId, name: name2 } }); - } - if (isNullish(populatedTransaction.chain)) { - populatedTransaction.chain = options.web3Context.defaultChain; - } - if (isNullish(populatedTransaction.hardfork)) { - populatedTransaction.hardfork = options.web3Context.defaultHardfork; - } - } - if (isNullish(populatedTransaction.chainId) && isNullish((_a4 = populatedTransaction.common) === null || _a4 === void 0 ? void 0 : _a4.customChain.chainId)) { - populatedTransaction.chainId = yield getChainId2(options.web3Context, ETH_DATA_FORMAT); - } - if (isNullish(populatedTransaction.networkId)) { - populatedTransaction.networkId = (_b = options.web3Context.defaultNetworkId) !== null && _b !== void 0 ? _b : yield getId2(options.web3Context, ETH_DATA_FORMAT); - } - if (isNullish(populatedTransaction.gasLimit) && !isNullish(populatedTransaction.gas)) { - populatedTransaction.gasLimit = populatedTransaction.gas; - } - populatedTransaction.type = getTransactionType(populatedTransaction, options.web3Context); - if (isNullish(populatedTransaction.accessList) && (populatedTransaction.type === "0x1" || populatedTransaction.type === "0x2")) { - populatedTransaction.accessList = []; - } - if (options.fillGasPrice) - populatedTransaction = Object.assign(Object.assign({}, populatedTransaction), yield getTransactionGasPricing(populatedTransaction, options.web3Context, ETH_DATA_FORMAT)); - if (isNullish(populatedTransaction.gas) && isNullish(populatedTransaction.gasLimit) && options.fillGasLimit) { - const fillGasLimit = yield estimateGas2(options.web3Context, populatedTransaction, "latest", ETH_DATA_FORMAT); - populatedTransaction = Object.assign(Object.assign({}, populatedTransaction), { gas: format({ format: "uint" }, fillGasLimit, ETH_DATA_FORMAT) }); - } - return populatedTransaction; - }); -} -var transactionBuilder = (options) => __awaiter21(void 0, void 0, void 0, function* () { - var _a4; - return ((_a4 = options.web3Context.transactionBuilder) !== null && _a4 !== void 0 ? _a4 : defaultTransactionBuilder)(Object.assign(Object.assign({}, options), { transaction: options.transaction })); -}); - -// node_modules/web3-eth/lib/esm/utils/reject_if_block_timeout.js -var __awaiter22 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -function resolveByPolling(web3Context, starterBlockNumber, transactionHash) { - const pollingInterval = web3Context.transactionPollingInterval; - const [intervalId, promiseToError] = rejectIfConditionAtInterval(() => __awaiter22(this, void 0, void 0, function* () { - let lastBlockNumber; - try { - lastBlockNumber = yield getBlockNumber2(web3Context, NUMBER_DATA_FORMAT); - } catch (error) { - console.warn("An error happen while trying to get the block number", error); - return void 0; - } - const numberOfBlocks = lastBlockNumber - starterBlockNumber; - if (numberOfBlocks >= web3Context.transactionBlockTimeout) { - return new TransactionBlockTimeoutError({ - starterBlockNumber, - numberOfBlocks, - transactionHash - }); - } - return void 0; - }), pollingInterval); - const clean = () => { - clearInterval(intervalId); - }; - return [promiseToError, { clean }]; -} -function resolveBySubscription(web3Context, starterBlockNumber, transactionHash) { - var _a4; - return __awaiter22(this, void 0, void 0, function* () { - let needToWatchLater = true; - let subscription; - let resourceCleaner; - function revertToPolling(reject, previousError) { - if (previousError) { - console.warn("error happened at subscription. So revert to polling...", previousError); - } - resourceCleaner.clean(); - needToWatchLater = false; - const [promiseToError2, newResourceCleaner] = resolveByPolling(web3Context, starterBlockNumber, transactionHash); - resourceCleaner.clean = newResourceCleaner.clean; - promiseToError2.catch((error) => reject(error)); - } - try { - subscription = yield (_a4 = web3Context.subscriptionManager) === null || _a4 === void 0 ? void 0 : _a4.subscribe("newHeads"); - resourceCleaner = { - clean: () => { - var _a5; - if (subscription.id) { - (_a5 = web3Context.subscriptionManager) === null || _a5 === void 0 ? void 0 : _a5.removeSubscription(subscription).then(() => { - }).catch(() => { - }); - } - } - }; - } catch (error) { - return resolveByPolling(web3Context, starterBlockNumber, transactionHash); - } - const promiseToError = new Promise((_, reject) => { - try { - subscription.on("data", (lastBlockHeader) => { - needToWatchLater = false; - if (!(lastBlockHeader === null || lastBlockHeader === void 0 ? void 0 : lastBlockHeader.number)) { - return; - } - const numberOfBlocks = Number(BigInt(lastBlockHeader.number) - BigInt(starterBlockNumber)); - if (numberOfBlocks >= web3Context.transactionBlockTimeout) { - reject(new TransactionBlockTimeoutError({ - starterBlockNumber, - numberOfBlocks, - transactionHash - })); - } - }); - subscription.on("error", (error) => { - revertToPolling(reject, error); - }); - } catch (error) { - revertToPolling(reject, error); - } - setTimeout(() => { - if (needToWatchLater) { - revertToPolling(reject); - } - }, web3Context.blockHeaderTimeout * 1e3); - }); - return [promiseToError, resourceCleaner]; - }); -} -function rejectIfBlockTimeout(web3Context, transactionHash) { - var _a4, _b; - return __awaiter22(this, void 0, void 0, function* () { - const { provider } = web3Context.requestManager; - let callingRes; - const starterBlockNumber = yield getBlockNumber2(web3Context, NUMBER_DATA_FORMAT); - if (((_b = (_a4 = provider).supportsSubscriptions) === null || _b === void 0 ? void 0 : _b.call(_a4)) && web3Context.enableExperimentalFeatures.useSubscriptionWhenCheckingBlockTimeout) { - callingRes = yield resolveBySubscription(web3Context, starterBlockNumber, transactionHash); - } else { - callingRes = resolveByPolling(web3Context, starterBlockNumber, transactionHash); - } - return callingRes; - }); -} - -// node_modules/web3-eth/lib/esm/utils/try_send_transaction.js -var __awaiter23 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -function trySendTransaction(web3Context, sendTransactionFunc, transactionHash) { - return __awaiter23(this, void 0, void 0, function* () { - const [timeoutId, rejectOnTimeout] = rejectIfTimeout(web3Context.transactionSendTimeout, new TransactionSendTimeoutError({ - numberOfSeconds: web3Context.transactionSendTimeout / 1e3, - transactionHash - })); - const [rejectOnBlockTimeout, blockTimeoutResourceCleaner] = yield rejectIfBlockTimeout(web3Context, transactionHash); - try { - return yield Promise.race([ - sendTransactionFunc(), - rejectOnTimeout, - rejectOnBlockTimeout - // this will throw an error on Transaction Block Timeout - ]); - } finally { - clearTimeout(timeoutId); - blockTimeoutResourceCleaner.clean(); - } - }); -} - -// node_modules/web3-eth/lib/esm/utils/wait_for_transaction_receipt.js -var __awaiter24 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -function waitForTransactionReceipt(web3Context, transactionHash, returnFormat) { - var _a4; - return __awaiter24(this, void 0, void 0, function* () { - const pollingInterval = (_a4 = web3Context.transactionReceiptPollingInterval) !== null && _a4 !== void 0 ? _a4 : web3Context.transactionPollingInterval; - const [awaitableTransactionReceipt, IntervalId] = pollTillDefinedAndReturnIntervalId(() => __awaiter24(this, void 0, void 0, function* () { - try { - return getTransactionReceipt2(web3Context, transactionHash, returnFormat); - } catch (error) { - console.warn("An error happen while trying to get the transaction receipt", error); - return void 0; - } - }), pollingInterval); - const [timeoutId, rejectOnTimeout] = rejectIfTimeout(web3Context.transactionPollingTimeout, new TransactionPollingTimeoutError({ - numberOfSeconds: web3Context.transactionPollingTimeout / 1e3, - transactionHash - })); - const [rejectOnBlockTimeout, blockTimeoutResourceCleaner] = yield rejectIfBlockTimeout(web3Context, transactionHash); - try { - return yield Promise.race([ - awaitableTransactionReceipt, - rejectOnTimeout, - rejectOnBlockTimeout - // this will throw an error on Transaction Block Timeout - ]); - } finally { - if (timeoutId) - clearTimeout(timeoutId); - if (IntervalId) - clearInterval(IntervalId); - blockTimeoutResourceCleaner.clean(); - } - }); -} - -// node_modules/web3-eth/lib/esm/utils/watch_transaction_by_polling.js -var __awaiter25 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var watchTransactionByPolling = ({ web3Context, transactionReceipt, transactionPromiEvent, returnFormat }) => { - var _a4; - let confirmations = 1; - const intervalId = setInterval(() => { - (() => __awaiter25(void 0, void 0, void 0, function* () { - if (confirmations >= web3Context.transactionConfirmationBlocks) - clearInterval(intervalId); - const nextBlock = yield eth_rpc_methods_exports.getBlockByNumber(web3Context.requestManager, numberToHex2(BigInt(transactionReceipt.blockNumber) + BigInt(confirmations)), false); - if (nextBlock === null || nextBlock === void 0 ? void 0 : nextBlock.hash) { - confirmations += 1; - transactionPromiEvent.emit("confirmation", { - confirmations: format({ format: "uint" }, confirmations, returnFormat), - receipt: format(transactionReceiptSchema, transactionReceipt, returnFormat), - latestBlockHash: format({ format: "bytes32" }, nextBlock.hash, returnFormat) - }); - } - }))(); - }, (_a4 = web3Context.transactionReceiptPollingInterval) !== null && _a4 !== void 0 ? _a4 : web3Context.transactionPollingInterval); -}; - -// node_modules/web3-eth/lib/esm/utils/watch_transaction_by_subscription.js -var __awaiter26 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var watchTransactionBySubscription = ({ web3Context, transactionReceipt, transactionPromiEvent, returnFormat }) => { - let needToWatchLater = true; - let lastCaughtBlockHash; - setImmediate(() => { - var _a4; - (_a4 = web3Context.subscriptionManager) === null || _a4 === void 0 ? void 0 : _a4.subscribe("newHeads").then((subscription) => { - subscription.on("data", (newBlockHeader) => __awaiter26(void 0, void 0, void 0, function* () { - var _a5; - needToWatchLater = false; - if (!(newBlockHeader === null || newBlockHeader === void 0 ? void 0 : newBlockHeader.number) || // For some cases, the on-data event is fired couple times for the same block! - // This needs investigation but seems to be because of multiple `subscription.on('data'...)` even this should not cause that. - lastCaughtBlockHash === (newBlockHeader === null || newBlockHeader === void 0 ? void 0 : newBlockHeader.parentHash)) { - return; - } - lastCaughtBlockHash = newBlockHeader === null || newBlockHeader === void 0 ? void 0 : newBlockHeader.parentHash; - const confirmations = BigInt(newBlockHeader.number) - BigInt(transactionReceipt.blockNumber) + BigInt(1); - transactionPromiEvent.emit("confirmation", { - confirmations: format({ format: "uint" }, confirmations, returnFormat), - receipt: format(transactionReceiptSchema, transactionReceipt, returnFormat), - latestBlockHash: format({ format: "bytes32" }, newBlockHeader.parentHash, returnFormat) - }); - if (confirmations >= web3Context.transactionConfirmationBlocks) { - yield (_a5 = web3Context.subscriptionManager) === null || _a5 === void 0 ? void 0 : _a5.removeSubscription(subscription); - } - })); - subscription.on("error", () => __awaiter26(void 0, void 0, void 0, function* () { - var _b; - yield (_b = web3Context.subscriptionManager) === null || _b === void 0 ? void 0 : _b.removeSubscription(subscription); - needToWatchLater = false; - watchTransactionByPolling({ - web3Context, - transactionReceipt, - transactionPromiEvent, - returnFormat - }); - })); - }).catch(() => { - needToWatchLater = false; - watchTransactionByPolling({ - web3Context, - transactionReceipt, - transactionPromiEvent, - returnFormat - }); - }); - }); - setTimeout(() => { - if (needToWatchLater) { - watchTransactionByPolling({ - web3Context, - transactionReceipt, - transactionPromiEvent, - returnFormat - }); - } - }, web3Context.blockHeaderTimeout * 1e3); -}; - -// node_modules/web3-eth/lib/esm/utils/watch_transaction_for_confirmations.js -function watchTransactionForConfirmations(web3Context, transactionPromiEvent, transactionReceipt, transactionHash, returnFormat) { - if (isNullish(transactionReceipt) || isNullish(transactionReceipt.blockHash)) - throw new TransactionMissingReceiptOrBlockHashError({ - receipt: transactionReceipt, - blockHash: format({ format: "bytes32" }, transactionReceipt === null || transactionReceipt === void 0 ? void 0 : transactionReceipt.blockHash, returnFormat), - transactionHash: format({ format: "bytes32" }, transactionHash, returnFormat) - }); - if (!transactionReceipt.blockNumber) - throw new TransactionReceiptMissingBlockNumberError({ receipt: transactionReceipt }); - transactionPromiEvent.emit("confirmation", { - confirmations: format({ format: "uint" }, 1, returnFormat), - receipt: format(transactionReceiptSchema, transactionReceipt, returnFormat), - latestBlockHash: format({ format: "bytes32" }, transactionReceipt.blockHash, returnFormat) - }); - const provider = web3Context.requestManager.provider; - if (provider && "supportsSubscriptions" in provider && provider.supportsSubscriptions()) { - watchTransactionBySubscription({ - web3Context, - transactionReceipt, - transactionPromiEvent, - returnFormat - }); - } else { - watchTransactionByPolling({ - web3Context, - transactionReceipt, - transactionPromiEvent, - returnFormat - }); - } -} - -// node_modules/web3-eth-abi/lib/esm/index.js -var esm_exports12 = {}; -__export(esm_exports12, { - decodeContractErrorData: () => decodeContractErrorData, - decodeLog: () => decodeLog, - decodeParameter: () => decodeParameter, - decodeParameters: () => decodeParameters2, - decodeParametersWith: () => decodeParametersWith, - encodeErrorSignature: () => encodeErrorSignature, - encodeEventSignature: () => encodeEventSignature, - encodeFunctionCall: () => encodeFunctionCall, - encodeFunctionSignature: () => encodeFunctionSignature, - encodeParameter: () => encodeParameter, - encodeParameters: () => encodeParameters, - flattenTypes: () => flattenTypes, - formatOddHexstrings: () => formatOddHexstrings, - formatParam: () => formatParam, - getEncodedEip712Data: () => getMessage, - inferTypesAndEncodeParameters: () => inferTypesAndEncodeParameters, - isAbiConstructorFragment: () => isAbiConstructorFragment, - isAbiErrorFragment: () => isAbiErrorFragment, - isAbiEventFragment: () => isAbiEventFragment, - isAbiFragment: () => isAbiFragment, - isAbiFunctionFragment: () => isAbiFunctionFragment, - isOddHexstring: () => isOddHexstring, - isSimplifiedStructFormat: () => isSimplifiedStructFormat, - jsonInterfaceMethodToString: () => jsonInterfaceMethodToString, - mapStructNameAndType: () => mapStructNameAndType, - mapStructToCoderFormat: () => mapStructToCoderFormat, - mapTypes: () => mapTypes -}); - -// node_modules/web3-eth-abi/lib/esm/utils.js -var isAbiFragment = (item) => !isNullish2(item) && typeof item === "object" && !isNullish2(item.type) && ["function", "event", "constructor", "error"].includes(item.type); -var isAbiErrorFragment = (item) => !isNullish2(item) && typeof item === "object" && !isNullish2(item.type) && item.type === "error"; -var isAbiEventFragment = (item) => !isNullish2(item) && typeof item === "object" && !isNullish2(item.type) && item.type === "event"; -var isAbiFunctionFragment = (item) => !isNullish2(item) && typeof item === "object" && !isNullish2(item.type) && item.type === "function"; -var isAbiConstructorFragment = (item) => !isNullish2(item) && typeof item === "object" && !isNullish2(item.type) && item.type === "constructor"; -var isSimplifiedStructFormat = (type) => typeof type === "object" && typeof type.components === "undefined" && typeof type.name === "undefined"; -var mapStructNameAndType = (structName) => structName.includes("[]") ? { type: "tuple[]", name: structName.slice(0, -2) } : { type: "tuple", name: structName }; -var mapStructToCoderFormat = (struct) => { - const components = []; - for (const key of Object.keys(struct)) { - const item = struct[key]; - if (typeof item === "object") { - components.push(Object.assign(Object.assign({}, mapStructNameAndType(key)), { components: mapStructToCoderFormat(item) })); - } else { - components.push({ - name: key, - type: struct[key] - }); - } - } - return components; -}; -var mapTypes = (types) => { - const mappedTypes = []; - for (const type of types) { - let modifiedType = type; - if (typeof type === "object") { - modifiedType = Object.assign({}, type); - } - if (typeof type === "object" && type.type === "function") { - modifiedType = Object.assign(Object.assign({}, type), { type: "bytes24" }); - } - if (isSimplifiedStructFormat(modifiedType)) { - const structName = Object.keys(modifiedType)[0]; - mappedTypes.push(Object.assign(Object.assign({}, mapStructNameAndType(structName)), { components: mapStructToCoderFormat(modifiedType[structName]) })); - } else { - mappedTypes.push(modifiedType); - } - } - return mappedTypes; -}; -var isOddHexstring = (param) => typeof param === "string" && /^(-)?0x[0-9a-f]*$/i.test(param) && param.length % 2 === 1; -var formatOddHexstrings = (param) => isOddHexstring(param) ? `0x0${param.substring(2)}` : param; -var paramTypeBytes = /^bytes([0-9]*)$/; -var paramTypeBytesArray = /^bytes([0-9]*)\[\]$/; -var paramTypeNumber = /^(u?int)([0-9]*)$/; -var paramTypeNumberArray = /^(u?int)([0-9]*)\[\]$/; -var formatParam = (type, _param) => { - const param = typeof _param === "object" && !Array.isArray(_param) ? Object.assign({}, _param) : _param; - if (param instanceof BigInt || typeof param === "bigint") { - return param.toString(10); - } - if (paramTypeBytesArray.exec(type) || paramTypeNumberArray.exec(type)) { - const paramClone = [...param]; - return paramClone.map((p) => formatParam(type.replace("[]", ""), p)); - } - let match = paramTypeNumber.exec(type); - if (match) { - const size = parseInt(match[2] ? match[2] : "256", 10); - if (size / 8 < param.length) { - return leftPad(param, size); - } - } - match = paramTypeBytes.exec(type); - if (match) { - const hexParam = isUint8Array2(param) ? toHex(param) : param; - const size = parseInt(match[1], 10); - if (size) { - let maxSize = size * 2; - if (param.startsWith("0x")) { - maxSize += 2; - } - const paddedParam = hexParam.length < maxSize ? rightPad(param, size * 2) : hexParam; - return formatOddHexstrings(paddedParam); - } - return formatOddHexstrings(hexParam); - } - return param; -}; -var flattenTypes = (includeTuple, puts) => { - const types = []; - puts.forEach((param) => { - if (typeof param.components === "object") { - if (!param.type.startsWith("tuple")) { - throw new AbiError(`Invalid value given "${param.type}". Error: components found but type is not tuple.`); - } - const arrayBracket = param.type.indexOf("["); - const suffix = arrayBracket >= 0 ? param.type.substring(arrayBracket) : ""; - const result = flattenTypes(includeTuple, param.components); - if (Array.isArray(result) && includeTuple) { - types.push(`tuple(${result.join(",")})${suffix}`); - } else if (!includeTuple) { - types.push(`(${result.join(",")})${suffix}`); - } else { - types.push(`(${result.join()})`); - } - } else { - types.push(param.type); - } - }); - return types; -}; -var jsonInterfaceMethodToString = (json) => { - var _a4, _b, _c, _d; - if (isAbiErrorFragment(json) || isAbiEventFragment(json) || isAbiFunctionFragment(json)) { - if ((_a4 = json.name) === null || _a4 === void 0 ? void 0 : _a4.includes("(")) { - return json.name; - } - return `${(_b = json.name) !== null && _b !== void 0 ? _b : ""}(${flattenTypes(false, (_c = json.inputs) !== null && _c !== void 0 ? _c : []).join(",")})`; - } - return `(${flattenTypes(false, (_d = json.inputs) !== null && _d !== void 0 ? _d : []).join(",")})`; -}; - -// node_modules/web3-eth-abi/lib/esm/api/errors_api.js -var encodeErrorSignature = (functionName) => { - if (typeof functionName !== "string" && !isAbiErrorFragment(functionName)) { - throw new AbiError("Invalid parameter value in encodeErrorSignature"); - } - let name2; - if (functionName && (typeof functionName === "function" || typeof functionName === "object")) { - name2 = jsonInterfaceMethodToString(functionName); - } else { - name2 = functionName; - } - return sha3Raw(name2); -}; - -// node_modules/web3-eth-abi/lib/esm/api/events_api.js -var encodeEventSignature = (functionName) => { - if (typeof functionName !== "string" && !isAbiEventFragment(functionName)) { - throw new AbiError("Invalid parameter value in encodeEventSignature"); - } - let name2; - if (functionName && (typeof functionName === "function" || typeof functionName === "object")) { - name2 = jsonInterfaceMethodToString(functionName); - } else { - name2 = functionName; - } - return sha3Raw(name2); -}; - -// node_modules/abitype/dist/chunk-WP7KDV47.mjs -function execTyped(regex, string) { - const match = regex.exec(string); - return match == null ? void 0 : match.groups; -} -var bytesRegex = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/; -var integerRegex = /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/; -var isTupleRegex = /^\(.+?\).*?$/; - -// node_modules/abitype/dist/chunk-NHABU752.mjs -var __defProp = Object.defineProperty; -var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __publicField = (obj, key, value) => { - __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); - return value; -}; - -// node_modules/abitype/dist/index.mjs -var name = "abitype"; -var version = "0.7.1"; -var BaseError = class extends Error { - constructor(shortMessage, args = {}) { - var _a4; - const details = args.cause instanceof BaseError ? args.cause.details : ((_a4 = args.cause) == null ? void 0 : _a4.message) ? args.cause.message : args.details; - const docsPath = args.cause instanceof BaseError ? args.cause.docsPath || args.docsPath : args.docsPath; - const message = [ - shortMessage || "An error occurred.", - "", - ...args.metaMessages ? [...args.metaMessages, ""] : [], - ...docsPath ? [`Docs: https://abitype.dev${docsPath}`] : [], - ...details ? [`Details: ${details}`] : [], - `Version: ${name}@${version}` - ].join("\n"); - super(message); - __publicField(this, "details"); - __publicField(this, "docsPath"); - __publicField(this, "metaMessages"); - __publicField(this, "shortMessage"); - __publicField(this, "name", "AbiTypeError"); - if (args.cause) - this.cause = args.cause; - this.details = details; - this.docsPath = docsPath; - this.metaMessages = args.metaMessages; - this.shortMessage = shortMessage; - } -}; -var structSignatureRegex = /^struct (?[a-zA-Z0-9_]+) \{(?.*?)\}$/; -function isStructSignature(signature) { - return structSignatureRegex.test(signature); -} -function execStructSignature(signature) { - return execTyped( - structSignatureRegex, - signature - ); -} -var modifiers = /* @__PURE__ */ new Set([ - "memory", - "indexed", - "storage", - "calldata" -]); -var functionModifiers = /* @__PURE__ */ new Set([ - "calldata", - "memory", - "storage" -]); -function getParameterCacheKey(param, type) { - if (type) - return `${type}:${param}`; - return param; -} -var parameterCache = /* @__PURE__ */ new Map([ - // Unnamed - ["address", { type: "address" }], - ["bool", { type: "bool" }], - ["bytes", { type: "bytes" }], - ["bytes32", { type: "bytes32" }], - ["int", { type: "int256" }], - ["int256", { type: "int256" }], - ["string", { type: "string" }], - ["uint", { type: "uint256" }], - ["uint8", { type: "uint8" }], - ["uint16", { type: "uint16" }], - ["uint24", { type: "uint24" }], - ["uint32", { type: "uint32" }], - ["uint64", { type: "uint64" }], - ["uint96", { type: "uint96" }], - ["uint112", { type: "uint112" }], - ["uint160", { type: "uint160" }], - ["uint192", { type: "uint192" }], - ["uint256", { type: "uint256" }], - // Named - ["address owner", { type: "address", name: "owner" }], - ["address to", { type: "address", name: "to" }], - ["bool approved", { type: "bool", name: "approved" }], - ["bytes _data", { type: "bytes", name: "_data" }], - ["bytes data", { type: "bytes", name: "data" }], - ["bytes signature", { type: "bytes", name: "signature" }], - ["bytes32 hash", { type: "bytes32", name: "hash" }], - ["bytes32 r", { type: "bytes32", name: "r" }], - ["bytes32 root", { type: "bytes32", name: "root" }], - ["bytes32 s", { type: "bytes32", name: "s" }], - ["string name", { type: "string", name: "name" }], - ["string symbol", { type: "string", name: "symbol" }], - ["string tokenURI", { type: "string", name: "tokenURI" }], - ["uint tokenId", { type: "uint256", name: "tokenId" }], - ["uint8 v", { type: "uint8", name: "v" }], - ["uint256 balance", { type: "uint256", name: "balance" }], - ["uint256 tokenId", { type: "uint256", name: "tokenId" }], - ["uint256 value", { type: "uint256", name: "value" }], - // Indexed - [ - "event:address indexed from", - { type: "address", name: "from", indexed: true } - ], - ["event:address indexed to", { type: "address", name: "to", indexed: true }], - [ - "event:uint indexed tokenId", - { type: "uint256", name: "tokenId", indexed: true } - ], - [ - "event:uint256 indexed tokenId", - { type: "uint256", name: "tokenId", indexed: true } - ] -]); -var abiParameterWithoutTupleRegex = /^(?[a-zA-Z0-9_]+?)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z0-9_]+))?$/; -var abiParameterWithTupleRegex = /^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z0-9_]+))?$/; -var dynamicIntegerRegex = /^u?int$/; -function parseAbiParameter(param, options) { - var _a4, _b; - const parameterCacheKey = getParameterCacheKey(param, options == null ? void 0 : options.type); - if (parameterCache.has(parameterCacheKey)) - return parameterCache.get(parameterCacheKey); - const isTuple = isTupleRegex.test(param); - const match = execTyped( - isTuple ? abiParameterWithTupleRegex : abiParameterWithoutTupleRegex, - param - ); - if (!match) - throw new BaseError("Invalid ABI parameter.", { - details: param - }); - if (match.name && isSolidityKeyword(match.name)) - throw new BaseError("Invalid ABI parameter.", { - details: param, - metaMessages: [ - `"${match.name}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html` - ] - }); - const name2 = match.name ? { name: match.name } : {}; - const indexed = match.modifier === "indexed" ? { indexed: true } : {}; - const structs = (options == null ? void 0 : options.structs) ?? {}; - let type; - let components = {}; - if (isTuple) { - type = "tuple"; - const params = splitParameters(match.type); - const components_ = []; - const length = params.length; - for (let i = 0; i < length; i++) { - components_.push(parseAbiParameter(params[i], { structs })); - } - components = { components: components_ }; - } else if (match.type in structs) { - type = "tuple"; - components = { components: structs[match.type] }; - } else if (dynamicIntegerRegex.test(match.type)) { - type = `${match.type}256`; - } else { - type = match.type; - if (!((options == null ? void 0 : options.type) === "struct") && !isSolidityType(type)) - throw new BaseError("Unknown type.", { - metaMessages: [`Type "${type}" is not a valid ABI type.`] - }); - } - if (match.modifier) { - if (!((_b = (_a4 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a4.has) == null ? void 0 : _b.call(_a4, match.modifier))) - throw new BaseError("Invalid ABI parameter.", { - details: param, - metaMessages: [ - `Modifier "${match.modifier}" not allowed${(options == null ? void 0 : options.type) ? ` in "${options.type}" type` : ""}.` - ] - }); - if (functionModifiers.has(match.modifier) && !isValidDataLocation(type, !!match.array)) - throw new BaseError("Invalid ABI parameter.", { - details: param, - metaMessages: [ - `Modifier "${match.modifier}" not allowed${(options == null ? void 0 : options.type) ? ` in "${options.type}" type` : ""}.`, - `Data location can only be specified for array, struct, or mapping types, but "${match.modifier}" was given.` - ] - }); - } - const abiParameter = { - type: `${type}${match.array ?? ""}`, - ...name2, - ...indexed, - ...components - }; - parameterCache.set(parameterCacheKey, abiParameter); - return abiParameter; -} -function splitParameters(params, result = [], current = "", depth = 0) { - if (params === "") { - if (current === "") - return result; - if (depth !== 0) - throw new BaseError("Unbalanced parentheses.", { - metaMessages: [ - `"${current.trim()}" has too many ${depth > 0 ? "opening" : "closing"} parentheses.` - ], - details: `Depth "${depth}"` - }); - return [...result, current.trim()]; - } - const length = params.length; - for (let i = 0; i < length; i++) { - const char = params[i]; - const tail = params.slice(i + 1); - switch (char) { - case ",": - return depth === 0 ? splitParameters(tail, [...result, current.trim()]) : splitParameters(tail, result, `${current}${char}`, depth); - case "(": - return splitParameters(tail, result, `${current}${char}`, depth + 1); - case ")": - return splitParameters(tail, result, `${current}${char}`, depth - 1); - default: - return splitParameters(tail, result, `${current}${char}`, depth); - } - } - return []; -} -function isSolidityType(type) { - return type === "address" || type === "bool" || type === "function" || type === "string" || bytesRegex.test(type) || integerRegex.test(type); -} -var protectedKeywordsRegex = /^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/; -function isSolidityKeyword(name2) { - return name2 === "address" || name2 === "bool" || name2 === "function" || name2 === "string" || name2 === "tuple" || bytesRegex.test(name2) || integerRegex.test(name2) || protectedKeywordsRegex.test(name2); -} -function isValidDataLocation(type, isArray) { - return isArray || type === "bytes" || type === "string" || type === "tuple"; -} -function parseStructs(signatures) { - const shallowStructs = {}; - const signaturesLength = signatures.length; - for (let i = 0; i < signaturesLength; i++) { - const signature = signatures[i]; - if (!isStructSignature(signature)) - continue; - const match = execStructSignature(signature); - if (!match) - throw new BaseError("Invalid struct signature.", { - details: signature - }); - const properties = match.properties.split(";"); - const components = []; - const propertiesLength = properties.length; - for (let k = 0; k < propertiesLength; k++) { - const property = properties[k]; - const trimmed = property.trim(); - if (!trimmed) - continue; - const abiParameter = parseAbiParameter(trimmed, { - type: "struct" - }); - components.push(abiParameter); - } - if (!components.length) - throw new BaseError("Invalid struct signature.", { - details: signature, - metaMessages: ["No properties exist."] - }); - shallowStructs[match.name] = components; - } - const resolvedStructs = {}; - const entries = Object.entries(shallowStructs); - const entriesLength = entries.length; - for (let i = 0; i < entriesLength; i++) { - const [name2, parameters] = entries[i]; - resolvedStructs[name2] = resolveStructs(parameters, shallowStructs); - } - return resolvedStructs; -} -var typeWithoutTupleRegex = /^(?[a-zA-Z0-9_]+?)(?(?:\[\d*?\])+?)?$/; -function resolveStructs(abiParameters, structs, ancestors = /* @__PURE__ */ new Set()) { - const components = []; - const length = abiParameters.length; - for (let i = 0; i < length; i++) { - const abiParameter = abiParameters[i]; - const isTuple = isTupleRegex.test(abiParameter.type); - if (isTuple) - components.push(abiParameter); - else { - const match = execTyped( - typeWithoutTupleRegex, - abiParameter.type - ); - if (!(match == null ? void 0 : match.type)) - throw new BaseError("Invalid ABI parameter.", { - details: JSON.stringify(abiParameter, null, 2), - metaMessages: ["ABI parameter type is invalid."] - }); - const { array, type } = match; - if (type in structs) { - if (ancestors.has(type)) - throw new BaseError("Circular reference detected.", { - metaMessages: [`Struct "${type}" is a circular reference.`] - }); - components.push({ - ...abiParameter, - type: `tuple${array ?? ""}`, - components: resolveStructs( - structs[type] ?? [], - structs, - /* @__PURE__ */ new Set([...ancestors, type]) - ) - }); - } else { - if (isSolidityType(type)) - components.push(abiParameter); - else - throw new BaseError("Unknown type.", { - metaMessages: [ - `Type "${type}" is not a valid ABI type. Perhaps you forgot to include a struct signature?` - ] - }); - } - } - } - return components; -} -function parseAbiParameter2(param) { - let abiParameter; - if (typeof param === "string") - abiParameter = parseAbiParameter(param, { - modifiers - }); - else { - const structs = parseStructs(param); - const length = param.length; - for (let i = 0; i < length; i++) { - const signature = param[i]; - if (isStructSignature(signature)) - continue; - abiParameter = parseAbiParameter(signature, { modifiers, structs }); - break; - } - } - if (!abiParameter) - throw new BaseError("Failed to parse ABI parameter.", { - details: `parseAbiParameter(${JSON.stringify(param, null, 2)})`, - docsPath: "/api/human.html#parseabiparameter-1" - }); - return abiParameter; -} - -// node_modules/web3-eth-abi/lib/esm/coders/utils.js -var WORD_SIZE = 32; -function alloc(size = 0) { - var _a4; - if (((_a4 = globalThis.Buffer) === null || _a4 === void 0 ? void 0 : _a4.alloc) !== void 0) { - const buf = globalThis.Buffer.alloc(size); - return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength); - } - return new Uint8Array(size); -} -function convertExternalAbiParameter(abiParam) { - var _a4, _b; - return Object.assign(Object.assign({}, abiParam), { name: (_a4 = abiParam.name) !== null && _a4 !== void 0 ? _a4 : "", components: (_b = abiParam.components) === null || _b === void 0 ? void 0 : _b.map((c) => convertExternalAbiParameter(c)) }); -} -function isAbiParameter(param) { - return !isNullish2(param) && typeof param === "object" && !isNullish2(param.type) && typeof param.type === "string"; -} -function toAbiParams(abi) { - return abi.map((input) => { - var _a4; - if (isAbiParameter(input)) { - return input; - } - if (typeof input === "string") { - return convertExternalAbiParameter(parseAbiParameter2(input.replace(/tuple/, ""))); - } - if (isSimplifiedStructFormat(input)) { - const structName = Object.keys(input)[0]; - const structInfo = mapStructNameAndType(structName); - structInfo.name = (_a4 = structInfo.name) !== null && _a4 !== void 0 ? _a4 : ""; - return Object.assign(Object.assign({}, structInfo), { components: mapStructToCoderFormat(input[structName]) }); - } - throw new AbiError("Invalid abi"); - }); -} -function extractArrayType(param) { - const arrayParenthesisStart = param.type.lastIndexOf("["); - const arrayParamType = param.type.substring(0, arrayParenthesisStart); - const sizeString = param.type.substring(arrayParenthesisStart); - let size = -1; - if (sizeString !== "[]") { - size = Number(sizeString.slice(1, -1)); - if (isNaN(size)) { - throw new AbiError("Invalid fixed array size", { size: sizeString }); - } - } - return { - param: { type: arrayParamType, name: "", components: param.components }, - size - }; -} -function isDynamic(param) { - var _a4, _b; - if (param.type === "string" || param.type === "bytes" || param.type.endsWith("[]")) - return true; - if (param.type === "tuple") { - return (_b = (_a4 = param.components) === null || _a4 === void 0 ? void 0 : _a4.some(isDynamic)) !== null && _b !== void 0 ? _b : false; - } - if (param.type.endsWith("]")) { - return isDynamic(extractArrayType(param).param); - } - return false; -} - -// node_modules/web3-eth-abi/lib/esm/coders/base/address.js -var ADDRESS_BYTES_COUNT = 20; -var ADDRESS_OFFSET = WORD_SIZE - ADDRESS_BYTES_COUNT; -function encodeAddress(param, input) { - if (typeof input !== "string") { - throw new AbiError("address type expects string as input type", { - value: input, - name: param.name, - type: param.type - }); - } - let address = input.toLowerCase(); - if (!address.startsWith("0x")) { - address = `0x${address}`; - } - if (!isAddress(address)) { - throw new AbiError("provided input is not valid address", { - value: input, - name: param.name, - type: param.type - }); - } - const addressBytes = utils_exports.hexToUint8Array(address); - const encoded = alloc(WORD_SIZE); - encoded.set(addressBytes, ADDRESS_OFFSET); - return { - dynamic: false, - encoded - }; -} -function decodeAddress(_param, bytes2) { - const addressBytes = bytes2.subarray(ADDRESS_OFFSET, WORD_SIZE); - if (addressBytes.length !== ADDRESS_BYTES_COUNT) { - throw new AbiError("Invalid decoding input, not enough bytes to decode address", { bytes: bytes2 }); - } - const result = utils_exports.uint8ArrayToHexString(addressBytes); - return { - result: toChecksumAddress(result), - encoded: bytes2.subarray(WORD_SIZE), - consumed: WORD_SIZE - }; -} - -// node_modules/web3-eth-abi/lib/esm/coders/base/numbersLimits.js -var numberLimits = /* @__PURE__ */ new Map(); -var base = BigInt(256); -for (let i = 8; i <= 256; i += 8) { - numberLimits.set(`uint${i}`, { - min: BigInt(0), - max: base - BigInt(1) - }); - numberLimits.set(`int${i}`, { - min: -base / BigInt(2), - max: base / BigInt(2) - BigInt(1) - }); - base *= BigInt(256); -} -numberLimits.set(`int`, numberLimits.get("int256")); -numberLimits.set(`uint`, numberLimits.get("uint256")); - -// node_modules/web3-eth-abi/lib/esm/coders/base/number.js -var mask = BigInt(1) << BigInt(256); -function bigIntToUint8Array2(value, byteLength = WORD_SIZE) { - let hexValue; - if (value < 0) { - hexValue = (mask + value).toString(16); - } else { - hexValue = value.toString(16); - } - hexValue = padLeft2(hexValue, byteLength * 2); - return utils_exports.hexToUint8Array(hexValue); -} -function uint8ArrayToBigInt2(value, max) { - const hexValue = utils_exports.uint8ArrayToHexString(value); - const result = BigInt(hexValue); - if (result <= max) - return result; - return result - mask; -} -function encodeNumber(param, input) { - let value; - try { - value = toBigInt(input); - } catch (e) { - throw new AbiError("provided input is not number value", { - type: param.type, - value: input, - name: param.name - }); - } - const limit = numberLimits.get(param.type); - if (!limit) { - throw new AbiError("provided abi contains invalid number datatype", { type: param.type }); - } - if (value < limit.min) { - throw new AbiError("provided input is less then minimum for given type", { - type: param.type, - value: input, - name: param.name, - minimum: limit.min.toString() - }); - } - if (value > limit.max) { - throw new AbiError("provided input is greater then maximum for given type", { - type: param.type, - value: input, - name: param.name, - maximum: limit.max.toString() - }); - } - return { - dynamic: false, - encoded: bigIntToUint8Array2(value) - }; -} -function decodeNumber(param, bytes2) { - if (bytes2.length < WORD_SIZE) { - throw new AbiError("Not enough bytes left to decode", { param, bytesLeft: bytes2.length }); - } - const boolBytes = bytes2.subarray(0, WORD_SIZE); - const limit = numberLimits.get(param.type); - if (!limit) { - throw new AbiError("provided abi contains invalid number datatype", { type: param.type }); - } - const numberResult = uint8ArrayToBigInt2(boolBytes, limit.max); - if (numberResult < limit.min) { - throw new AbiError("decoded value is less then minimum for given type", { - type: param.type, - value: numberResult, - name: param.name, - minimum: limit.min.toString() - }); - } - if (numberResult > limit.max) { - throw new AbiError("decoded value is greater then maximum for given type", { - type: param.type, - value: numberResult, - name: param.name, - maximum: limit.max.toString() - }); - } - return { - result: numberResult, - encoded: bytes2.subarray(WORD_SIZE), - consumed: WORD_SIZE - }; -} - -// node_modules/web3-eth-abi/lib/esm/coders/base/bool.js -function encodeBoolean(param, input) { - let value; - try { - value = toBool(input); - } catch (e) { - if (e instanceof InvalidBooleanError) { - throw new AbiError("provided input is not valid boolean value", { - type: param.type, - value: input, - name: param.name - }); - } - } - return encodeNumber({ type: "uint8", name: "" }, Number(value)); -} -function decodeBool(_param, bytes2) { - const numberResult = decodeNumber({ type: "uint8", name: "" }, bytes2); - if (numberResult.result > 1 || numberResult.result < 0) { - throw new AbiError("Invalid boolean value encoded", { - boolBytes: bytes2.subarray(0, WORD_SIZE), - numberResult - }); - } - return { - result: numberResult.result === BigInt(1), - encoded: numberResult.encoded, - consumed: WORD_SIZE - }; -} - -// node_modules/web3-eth-abi/lib/esm/coders/base/bytes.js -var MAX_STATIC_BYTES_COUNT = 32; -function encodeBytes(param, input) { - if (typeof input === "string" && input.length % 2 !== 0) { - input += "0"; - } - if (!isBytes3(input)) { - throw new AbiError("provided input is not valid bytes value", { - type: param.type, - value: input, - name: param.name - }); - } - const bytes2 = bytesToUint8Array(input); - const [, size] = param.type.split("bytes"); - if (size) { - if (Number(size) > MAX_STATIC_BYTES_COUNT || Number(size) < 1) { - throw new AbiError("invalid bytes type. Static byte type can have between 1 and 32 bytes", { - type: param.type - }); - } - if (Number(size) < bytes2.length) { - throw new AbiError("provided input size is different than type size", { - type: param.type, - value: input, - name: param.name - }); - } - const encoded2 = alloc(WORD_SIZE); - encoded2.set(bytes2); - return { - dynamic: false, - encoded: encoded2 - }; - } - const partsLength = Math.ceil(bytes2.length / WORD_SIZE); - const encoded = alloc(WORD_SIZE + partsLength * WORD_SIZE); - encoded.set(encodeNumber({ type: "uint32", name: "" }, bytes2.length).encoded); - encoded.set(bytes2, WORD_SIZE); - return { - dynamic: true, - encoded - }; -} -function decodeBytes(param, bytes2) { - const [, sizeString] = param.type.split("bytes"); - let size = Number(sizeString); - let remainingBytes = bytes2; - let partsCount = 1; - let consumed = 0; - if (!size) { - const result = decodeNumber({ type: "uint32", name: "" }, remainingBytes); - size = Number(result.result); - consumed += result.consumed; - remainingBytes = result.encoded; - partsCount = Math.ceil(size / WORD_SIZE); - } - if (size > bytes2.length) { - throw new AbiError("there is not enough data to decode", { - type: param.type, - encoded: bytes2, - size - }); - } - return { - result: bytesToHex2(remainingBytes.subarray(0, size)), - encoded: remainingBytes.subarray(partsCount * WORD_SIZE), - consumed: consumed + partsCount * WORD_SIZE - }; -} - -// node_modules/web3-eth-abi/lib/esm/coders/base/string.js -function encodeString(_param, input) { - if (typeof input !== "string") { - throw new AbiError("invalid input, should be string", { input }); - } - const bytes2 = utf8ToBytes2(input); - return encodeBytes({ type: "bytes", name: "" }, bytes2); -} -function decodeString(_param, bytes2) { - const r = decodeBytes({ type: "bytes", name: "" }, bytes2); - return { - result: hexToUtf8(r.result), - encoded: r.encoded, - consumed: r.consumed - }; -} - -// node_modules/web3-eth-abi/lib/esm/coders/base/utils.js -function encodeDynamicParams(encodedParams) { - let staticSize = 0; - let dynamicSize = 0; - const staticParams = []; - const dynamicParams = []; - for (const encodedParam of encodedParams) { - if (encodedParam.dynamic) { - staticSize += WORD_SIZE; - } else { - staticSize += encodedParam.encoded.length; - } - } - for (const encodedParam of encodedParams) { - if (encodedParam.dynamic) { - staticParams.push(encodeNumber({ type: "uint256", name: "" }, staticSize + dynamicSize)); - dynamicParams.push(encodedParam); - dynamicSize += encodedParam.encoded.length; - } else { - staticParams.push(encodedParam); - } - } - return uint8ArrayConcat(...staticParams.map((p) => p.encoded), ...dynamicParams.map((p) => p.encoded)); -} - -// node_modules/web3-eth-abi/lib/esm/coders/base/array.js -function encodeArray(param, values) { - if (!Array.isArray(values)) { - throw new AbiError("Expected value to be array", { abi: param, values }); - } - const { size, param: arrayItemParam } = extractArrayType(param); - const encodedParams = values.map((v) => encodeParamFromAbiParameter(arrayItemParam, v)); - const dynamic = size === -1; - const dynamicItems = encodedParams.length > 0 && encodedParams[0].dynamic; - if (!dynamic && values.length !== size) { - throw new AbiError("Given arguments count doesn't match array length", { - arrayLength: size, - argumentsLength: values.length - }); - } - if (dynamic || dynamicItems) { - const encodingResult = encodeDynamicParams(encodedParams); - if (dynamic) { - const encodedLength = encodeNumber({ type: "uint256", name: "" }, encodedParams.length).encoded; - return { - dynamic: true, - encoded: encodedParams.length > 0 ? uint8ArrayConcat(encodedLength, encodingResult) : encodedLength - }; - } - return { - dynamic: true, - encoded: encodingResult - }; - } - return { - dynamic: false, - encoded: uint8ArrayConcat(...encodedParams.map((p) => p.encoded)) - }; -} -function decodeArray(param, bytes2) { - let { size, param: arrayItemParam } = extractArrayType(param); - const dynamic = size === -1; - let consumed = 0; - const result = []; - let remaining = bytes2; - if (dynamic) { - const lengthResult = decodeNumber({ type: "uint32", name: "" }, bytes2); - size = Number(lengthResult.result); - consumed = lengthResult.consumed; - remaining = lengthResult.encoded; - } - const hasDynamicChild = isDynamic(arrayItemParam); - if (hasDynamicChild) { - for (let i = 0; i < size; i += 1) { - const offsetResult = decodeNumber({ type: "uint32", name: "" }, remaining.subarray(i * WORD_SIZE)); - consumed += offsetResult.consumed; - const decodedChildResult = decodeParamFromAbiParameter(arrayItemParam, remaining.subarray(Number(offsetResult.result))); - consumed += decodedChildResult.consumed; - result.push(decodedChildResult.result); - } - return { - result, - encoded: remaining.subarray(consumed), - consumed - }; - } - for (let i = 0; i < size; i += 1) { - const decodedChildResult = decodeParamFromAbiParameter(arrayItemParam, bytes2.subarray(consumed)); - consumed += decodedChildResult.consumed; - result.push(decodedChildResult.result); - } - return { - result, - encoded: bytes2.subarray(consumed), - consumed - }; -} - -// node_modules/web3-eth-abi/lib/esm/coders/base/index.js -function encodeParamFromAbiParameter(param, value) { - if (param.type === "string") { - return encodeString(param, value); - } - if (param.type === "bool") { - return encodeBoolean(param, value); - } - if (param.type === "address") { - return encodeAddress(param, value); - } - if (param.type === "tuple") { - return encodeTuple(param, value); - } - if (param.type.endsWith("]")) { - return encodeArray(param, value); - } - if (param.type.startsWith("bytes")) { - return encodeBytes(param, value); - } - if (param.type.startsWith("uint") || param.type.startsWith("int")) { - return encodeNumber(param, value); - } - throw new AbiError("Unsupported", { - param, - value - }); -} -function decodeParamFromAbiParameter(param, bytes2) { - if (param.type === "string") { - return decodeString(param, bytes2); - } - if (param.type === "bool") { - return decodeBool(param, bytes2); - } - if (param.type === "address") { - return decodeAddress(param, bytes2); - } - if (param.type === "tuple") { - return decodeTuple(param, bytes2); - } - if (param.type.endsWith("]")) { - return decodeArray(param, bytes2); - } - if (param.type.startsWith("bytes")) { - return decodeBytes(param, bytes2); - } - if (param.type.startsWith("uint") || param.type.startsWith("int")) { - return decodeNumber(param, bytes2); - } - throw new AbiError("Unsupported", { - param, - bytes: bytes2 - }); -} - -// node_modules/web3-eth-abi/lib/esm/coders/base/tuple.js -function encodeTuple(param, input) { - var _a4, _b, _c; - let dynamic = false; - if (!Array.isArray(input) && typeof input !== "object") { - throw new AbiError("param must be either Array or Object", { - param, - input - }); - } - const narrowedInput = input; - const encoded = []; - for (let i = 0; i < ((_b = (_a4 = param.components) === null || _a4 === void 0 ? void 0 : _a4.length) !== null && _b !== void 0 ? _b : 0); i += 1) { - const paramComponent = param.components[i]; - let result; - if (Array.isArray(narrowedInput)) { - if (i >= narrowedInput.length) { - throw new AbiError("input param length missmatch", { - param, - input - }); - } - result = encodeParamFromAbiParameter(paramComponent, narrowedInput[i]); - } else { - const paramInput = narrowedInput[(_c = paramComponent.name) !== null && _c !== void 0 ? _c : ""]; - if (paramInput === void 0 || paramInput === null) { - throw new AbiError("missing input defined in abi", { - param, - input, - paramName: paramComponent.name - }); - } - result = encodeParamFromAbiParameter(paramComponent, paramInput); - } - if (result.dynamic) { - dynamic = true; - } - encoded.push(result); - } - if (dynamic) { - return { - dynamic: true, - encoded: encodeDynamicParams(encoded) - }; - } - return { - dynamic: false, - encoded: uint8ArrayConcat(...encoded.map((e) => e.encoded)) - }; -} -function decodeTuple(param, bytes2) { - const result = { - __length__: 0 - }; - let consumed = 0; - if (!param.components) { - return { - result, - encoded: bytes2, - consumed - }; - } - let dynamicConsumed = 0; - for (const [index, childParam] of param.components.entries()) { - let decodedResult; - if (isDynamic(childParam)) { - const offsetResult = decodeNumber({ type: "uint32", name: "" }, bytes2.subarray(consumed)); - decodedResult = decodeParamFromAbiParameter(childParam, bytes2.subarray(Number(offsetResult.result))); - consumed += offsetResult.consumed; - dynamicConsumed += decodedResult.consumed; - } else { - decodedResult = decodeParamFromAbiParameter(childParam, bytes2.subarray(consumed)); - consumed += decodedResult.consumed; - } - result.__length__ += 1; - result[index] = decodedResult.result; - if (childParam.name && childParam.name !== "") { - result[childParam.name] = decodedResult.result; - } - } - return { - encoded: bytes2.subarray(consumed + dynamicConsumed), - result, - consumed: consumed + dynamicConsumed - }; -} - -// node_modules/web3-eth-abi/lib/esm/coders/decode.js -function decodeParameters(abis, bytes2, _loose) { - const abiParams = toAbiParams(abis); - const bytesArray = utils_exports.hexToUint8Array(bytes2); - return decodeTuple({ type: "tuple", name: "", components: abiParams }, bytesArray).result; -} - -// node_modules/web3-eth-abi/lib/esm/coders/encode.js -function inferParamsAbi(params) { - const abi = []; - params.forEach((param) => { - if (Array.isArray(param)) { - const inferredParams = inferParamsAbi(param); - abi.push({ - type: "tuple", - components: inferredParams, - name: "" - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - }); - } else { - abi.push({ type: toHex(param, true) }); - } - }); - return abi; -} -function encodeParameters(abi, params) { - if ((abi === null || abi === void 0 ? void 0 : abi.length) !== params.length) { - throw new AbiError("Invalid number of values received for given ABI", { - expected: abi === null || abi === void 0 ? void 0 : abi.length, - received: params.length - }); - } - const abiParams = toAbiParams(abi); - return utils_exports.uint8ArrayToHexString(encodeTuple({ type: "tuple", name: "", components: abiParams }, params).encoded); -} -function inferTypesAndEncodeParameters(params) { - try { - const abiParams = inferParamsAbi(params); - return utils_exports.uint8ArrayToHexString(encodeTuple({ type: "tuple", name: "", components: abiParams }, params).encoded); - } catch (e) { - throw new AbiError("Could not infer types from given params", { - params - }); - } -} - -// node_modules/web3-eth-abi/lib/esm/api/parameters_api.js -var encodeParameter = (abi, param) => encodeParameters([abi], [param]); -var decodeParametersWith = (abis, bytes2, loose) => { - try { - if (abis.length > 0 && (!bytes2 || bytes2 === "0x" || bytes2 === "0X")) { - throw new AbiError("Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced."); - } - return decodeParameters(abis, `0x${bytes2.replace(/0x/i, "")}`, loose); - } catch (err) { - throw new AbiError(`Parameter decoding error: ${err.message}`, { - internalErr: err - }); - } -}; -var decodeParameters2 = (abi, bytes2) => decodeParametersWith(abi, bytes2, false); -var decodeParameter = (abi, bytes2) => decodeParameters2([abi], bytes2)["0"]; - -// node_modules/web3-eth-abi/lib/esm/api/functions_api.js -var encodeFunctionSignature = (functionName) => { - if (typeof functionName !== "string" && !isAbiFunctionFragment(functionName)) { - throw new AbiError("Invalid parameter value in encodeFunctionSignature"); - } - let name2; - if (functionName && (typeof functionName === "function" || typeof functionName === "object")) { - name2 = jsonInterfaceMethodToString(functionName); - } else { - name2 = functionName; - } - return sha3Raw(name2).slice(0, 10); -}; -var encodeFunctionCall = (jsonInterface, params) => { - var _a4; - if (!isAbiFunctionFragment(jsonInterface)) { - throw new AbiError("Invalid parameter value in encodeFunctionCall"); - } - return `${encodeFunctionSignature(jsonInterface)}${encodeParameters((_a4 = jsonInterface.inputs) !== null && _a4 !== void 0 ? _a4 : [], params !== null && params !== void 0 ? params : []).replace("0x", "")}`; -}; - -// node_modules/web3-eth-abi/lib/esm/api/logs_api.js -var STATIC_TYPES = ["bool", "string", "int", "uint", "address", "fixed", "ufixed"]; -var _decodeParameter = (inputType, clonedTopic) => inputType === "string" ? clonedTopic : decodeParameter(inputType, clonedTopic); -var decodeLog = (inputs, data, topics) => { - const clonedTopics = Array.isArray(topics) ? topics : [topics]; - const indexedInputs = {}; - const nonIndexedInputs = {}; - for (const [i, input] of inputs.entries()) { - if (input.indexed) { - indexedInputs[i] = input; - } else { - nonIndexedInputs[i] = input; - } - } - const decodedNonIndexedInputs = data ? decodeParametersWith(Object.values(nonIndexedInputs), data, true) : { __length__: 0 }; - const offset = clonedTopics.length - Object.keys(indexedInputs).length; - const decodedIndexedInputs = Object.values(indexedInputs).map((input, index) => STATIC_TYPES.some((s) => input.type.startsWith(s)) ? _decodeParameter(input.type, clonedTopics[index + offset]) : clonedTopics[index + offset]); - const returnValues = { __length__: 0 }; - let indexedCounter = 0; - let nonIndexedCounter = 0; - for (const [i, res] of inputs.entries()) { - returnValues[i] = res.type === "string" ? "" : void 0; - if (indexedInputs[i]) { - returnValues[i] = decodedIndexedInputs[indexedCounter]; - indexedCounter += 1; - } - if (nonIndexedInputs[i]) { - returnValues[i] = decodedNonIndexedInputs[String(nonIndexedCounter)]; - nonIndexedCounter += 1; - } - if (res.name) { - returnValues[res.name] = returnValues[i]; - } - returnValues.__length__ += 1; - } - return returnValues; -}; - -// node_modules/web3-eth-abi/lib/esm/decode_contract_error_data.js -var decodeContractErrorData = (errorsAbi, error) => { - if (error === null || error === void 0 ? void 0 : error.data) { - let errorName; - let errorSignature; - let errorArgs; - try { - const errorSha = error.data.slice(0, 10); - const errorAbi = errorsAbi.find((abi) => encodeErrorSignature(abi).startsWith(errorSha)); - if (errorAbi === null || errorAbi === void 0 ? void 0 : errorAbi.inputs) { - errorName = errorAbi.name; - errorSignature = jsonInterfaceMethodToString(errorAbi); - errorArgs = decodeParameters2([...errorAbi.inputs], error.data.substring(10)); - } - } catch (err) { - console.error(err); - } - if (errorName) { - error.setDecodedProperties(errorName, errorSignature, errorArgs); - } - } -}; - -// node_modules/web3-eth-abi/lib/esm/eip_712.js -var TYPE_REGEX = /^\w+/; -var ARRAY_REGEX = /^(.*)\[([0-9]*?)]$/; -var getDependencies = (typedData, type, dependencies = []) => { - const match = type.match(TYPE_REGEX); - const actualType = match[0]; - if (dependencies.includes(actualType)) { - return dependencies; - } - if (!typedData.types[actualType]) { - return dependencies; - } - return [ - actualType, - ...typedData.types[actualType].reduce((previous, _type) => [ - ...previous, - ...getDependencies(typedData, _type.type, previous).filter((dependency) => !previous.includes(dependency)) - ], []) - ]; -}; -var encodeType = (typedData, type) => { - const [primary, ...dependencies] = getDependencies(typedData, type); - const types = [primary, ...dependencies.sort()]; - return types.map((dependency) => ( - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - `${dependency}(${typedData.types[dependency].map((_type) => `${_type.type} ${_type.name}`)})` - )).join(""); -}; -var getTypeHash = (typedData, type) => keccak256Wrapper(encodeType(typedData, type)); -var getStructHash = (typedData, type, data) => keccak256Wrapper(encodeData(typedData, type, data)); -var getMessage = (typedData, hash2) => { - const EIP_191_PREFIX = "1901"; - const message = `0x${EIP_191_PREFIX}${getStructHash(typedData, "EIP712Domain", typedData.domain).substring(2)}${getStructHash(typedData, typedData.primaryType, typedData.message).substring(2)}`; - if (hash2) { - return keccak256Wrapper(message); - } - return message; -}; -var encodeValue = (typedData, type, data) => { - const match = type.match(ARRAY_REGEX); - if (match) { - const arrayType2 = match[1]; - const length = Number(match[2]) || void 0; - if (!Array.isArray(data)) { - throw new AbiError("Cannot encode data: value is not of array type", { - data - }); - } - if (length && data.length !== length) { - throw new AbiError(`Cannot encode data: expected length of ${length}, but got ${data.length}`, { - data - }); - } - const encodedData = data.map((item) => encodeValue(typedData, arrayType2, item)); - const types = encodedData.map((item) => item[0]); - const values = encodedData.map((item) => item[1]); - return ["bytes32", keccak256Wrapper(encodeParameters(types, values))]; - } - if (typedData.types[type]) { - return ["bytes32", getStructHash(typedData, type, data)]; - } - if (type === "string") { - return ["bytes32", keccak256Wrapper(data)]; - } - if (type === "bytes") { - return ["bytes32", keccak256Wrapper(data)]; - } - return [type, data]; -}; -var encodeData = (typedData, type, data) => { - const [types, values] = typedData.types[type].reduce(([_types, _values], field) => { - if (isNullish2(data[field.name]) || isNullish2(data[field.name])) { - throw new AbiError(`Cannot encode data: missing data for '${field.name}'`, { - data, - field - }); - } - const value = data[field.name]; - const [_type, encodedValue] = encodeValue(typedData, field.type, value); - return [ - [..._types, _type], - [..._values, encodedValue] - ]; - }, [["bytes32"], [getTypeHash(typedData, type)]]); - return encodeParameters(types, values); -}; - -// node_modules/web3-eth/lib/esm/utils/get_revert_reason.js -var __awaiter27 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var parseTransactionError = (error, contractAbi) => { - var _a4, _b, _c, _d, _e; - if (error instanceof ContractExecutionError && error.cause instanceof Eip838ExecutionError) { - if (contractAbi !== void 0) { - const errorsAbi = contractAbi.filter((abi) => isAbiErrorFragment(abi)); - decodeContractErrorData(errorsAbi, error.cause); - return { - reason: error.cause.message, - signature: (_a4 = error.cause.data) === null || _a4 === void 0 ? void 0 : _a4.slice(0, 10), - data: (_b = error.cause.data) === null || _b === void 0 ? void 0 : _b.substring(10), - customErrorName: error.cause.errorName, - customErrorDecodedSignature: error.cause.errorSignature, - customErrorArguments: error.cause.errorArgs - }; - } - return { - reason: error.cause.message, - signature: (_c = error.cause.data) === null || _c === void 0 ? void 0 : _c.slice(0, 10), - data: (_d = error.cause.data) === null || _d === void 0 ? void 0 : _d.substring(10) - }; - } - if (error instanceof InvalidResponseError && !Array.isArray((_e = error.cause) === null || _e === void 0 ? void 0 : _e.errors) && error.cause !== void 0) { - return error.cause.message; - } - throw error; -}; -function getRevertReason(web3Context, transaction, contractAbi, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter27(this, void 0, void 0, function* () { - try { - yield call2(web3Context, transaction, web3Context.defaultBlock, returnFormat); - return void 0; - } catch (error) { - return parseTransactionError(error, contractAbi); - } - }); -} - -// node_modules/web3-eth/lib/esm/utils/get_transaction_error.js -var __awaiter28 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -function getTransactionError(web3Context, transactionFormatted, transactionReceiptFormatted, receivedError, contractAbi, knownReason) { - return __awaiter28(this, void 0, void 0, function* () { - let _reason = knownReason; - if (_reason === void 0) { - if (receivedError !== void 0) { - _reason = parseTransactionError(receivedError); - } else if (web3Context.handleRevert && transactionFormatted !== void 0) { - _reason = yield getRevertReason(web3Context, transactionFormatted, contractAbi); - } - } - let error; - if (_reason === void 0) { - error = new TransactionRevertedWithoutReasonError(transactionReceiptFormatted); - } else if (typeof _reason === "string") { - error = new TransactionRevertInstructionError(_reason, void 0, transactionReceiptFormatted); - } else if (_reason.customErrorName !== void 0 && _reason.customErrorDecodedSignature !== void 0 && _reason.customErrorArguments !== void 0) { - const reasonWithCustomError = _reason; - error = new TransactionRevertWithCustomError(reasonWithCustomError.reason, reasonWithCustomError.customErrorName, reasonWithCustomError.customErrorDecodedSignature, reasonWithCustomError.customErrorArguments, reasonWithCustomError.signature, transactionReceiptFormatted, reasonWithCustomError.data); - } else { - error = new TransactionRevertInstructionError(_reason.reason, _reason.signature, transactionReceiptFormatted, _reason.data); - } - return error; - }); -} - -// node_modules/web3-eth/lib/esm/utils/decoding.js -var decodeEventABI = (event, data, jsonInterface, returnFormat = DEFAULT_RETURN_FORMAT) => { - var _a4, _b, _c, _d, _e; - let modifiedEvent = Object.assign({}, event); - const result = format(logSchema, data, returnFormat); - if ([ALL_EVENTS, "allEvents"].includes(modifiedEvent.name)) { - const matchedEvent = jsonInterface.find((j) => j.signature === data.topics[0]); - if (matchedEvent) { - modifiedEvent = matchedEvent; - } else { - modifiedEvent = { anonymous: true }; - } - } - modifiedEvent.inputs = (_b = (_a4 = modifiedEvent.inputs) !== null && _a4 !== void 0 ? _a4 : event.inputs) !== null && _b !== void 0 ? _b : []; - if (!modifiedEvent.anonymous) { - let indexedInputs = 0; - ((_c = modifiedEvent.inputs) !== null && _c !== void 0 ? _c : []).forEach((input) => { - if (input.indexed) { - indexedInputs += 1; - } - }); - if (indexedInputs > 0 && (data === null || data === void 0 ? void 0 : data.topics) && (data === null || data === void 0 ? void 0 : data.topics.length) !== indexedInputs + 1) { - modifiedEvent = Object.assign(Object.assign({}, modifiedEvent), { anonymous: true, inputs: [] }); - } - } - const argTopics = modifiedEvent.anonymous ? data.topics : ((_d = data.topics) !== null && _d !== void 0 ? _d : []).slice(1); - return Object.assign(Object.assign({}, result), { returnValues: decodeLog([...(_e = modifiedEvent.inputs) !== null && _e !== void 0 ? _e : []], data.data, argTopics), event: modifiedEvent.name, signature: modifiedEvent.anonymous || !data.topics || data.topics.length === 0 || !data.topics[0] ? void 0 : data.topics[0], raw: { - data: data.data, - topics: data.topics - } }); -}; - -// node_modules/web3-eth/lib/esm/utils/send_tx_helper.js -var __awaiter29 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var SendTxHelper = class { - constructor({ options, web3Context, promiEvent, returnFormat }) { - this.options = { - checkRevertBeforeSending: true - }; - this.options = options; - this.web3Context = web3Context; - this.promiEvent = promiEvent; - this.returnFormat = returnFormat; - } - getReceiptWithEvents(data) { - var _a4, _b; - const result = Object.assign({}, data !== null && data !== void 0 ? data : {}); - if (((_a4 = this.options) === null || _a4 === void 0 ? void 0 : _a4.contractAbi) && result.logs && result.logs.length > 0) { - result.events = {}; - for (const log of result.logs) { - const event = decodeEventABI(ALL_EVENTS_ABI, log, (_b = this.options) === null || _b === void 0 ? void 0 : _b.contractAbi, this.returnFormat); - if (event.event) { - result.events[event.event] = event; - } - } - } - return result; - } - checkRevertBeforeSending(tx) { - return __awaiter29(this, void 0, void 0, function* () { - if (this.options.checkRevertBeforeSending !== false) { - const reason = yield getRevertReason(this.web3Context, tx, this.options.contractAbi); - if (reason !== void 0) { - throw yield getTransactionError(this.web3Context, tx, void 0, void 0, this.options.contractAbi, reason); - } - } - }); - } - emitSending(tx) { - if (this.promiEvent.listenerCount("sending") > 0) { - this.promiEvent.emit("sending", tx); - } - } - populateGasPrice({ transactionFormatted, transaction }) { - var _a4; - return __awaiter29(this, void 0, void 0, function* () { - let result = transactionFormatted; - if (!((_a4 = this.options) === null || _a4 === void 0 ? void 0 : _a4.ignoreGasPricing) && isNullish(transactionFormatted.gasPrice) && (isNullish(transaction.maxPriorityFeePerGas) || isNullish(transaction.maxFeePerGas))) { - result = Object.assign(Object.assign({}, transactionFormatted), yield getTransactionGasPricing(transactionFormatted, this.web3Context, ETH_DATA_FORMAT)); - } - return result; - }); - } - signAndSend({ wallet, tx }) { - return __awaiter29(this, void 0, void 0, function* () { - if (wallet) { - const signedTransaction = yield wallet.signTransaction(tx); - return trySendTransaction(this.web3Context, () => __awaiter29(this, void 0, void 0, function* () { - return eth_rpc_methods_exports.sendRawTransaction(this.web3Context.requestManager, signedTransaction.rawTransaction); - }), signedTransaction.transactionHash); - } - return trySendTransaction(this.web3Context, () => __awaiter29(this, void 0, void 0, function* () { - return eth_rpc_methods_exports.sendTransaction(this.web3Context.requestManager, tx); - })); - }); - } - emitSent(tx) { - if (this.promiEvent.listenerCount("sent") > 0) { - this.promiEvent.emit("sent", tx); - } - } - emitTransactionHash(hash2) { - if (this.promiEvent.listenerCount("transactionHash") > 0) { - this.promiEvent.emit("transactionHash", hash2); - } - } - emitReceipt(receipt) { - if (this.promiEvent.listenerCount("receipt") > 0) { - this.promiEvent.emit( - "receipt", - // @ts-expect-error unknown type fix - receipt - ); - } - } - handleError({ error, tx }) { - var _a4; - return __awaiter29(this, void 0, void 0, function* () { - let _error = error; - if (_error instanceof ContractExecutionError && this.web3Context.handleRevert) { - _error = yield getTransactionError(this.web3Context, tx, void 0, void 0, (_a4 = this.options) === null || _a4 === void 0 ? void 0 : _a4.contractAbi); - } - if ((_error instanceof InvalidResponseError || _error instanceof ContractExecutionError || _error instanceof TransactionRevertWithCustomError || _error instanceof TransactionRevertedWithoutReasonError || _error instanceof TransactionRevertInstructionError || _error instanceof TransactionPollingTimeoutError) && this.promiEvent.listenerCount("error") > 0) { - this.promiEvent.emit("error", _error); - } - return _error; - }); - } - emitConfirmation({ receipt, transactionHash }) { - if (this.promiEvent.listenerCount("confirmation") > 0) { - watchTransactionForConfirmations(this.web3Context, this.promiEvent, receipt, transactionHash, this.returnFormat); - } - } - handleResolve({ receipt, tx }) { - var _a4, _b, _c; - return __awaiter29(this, void 0, void 0, function* () { - if ((_a4 = this.options) === null || _a4 === void 0 ? void 0 : _a4.transactionResolver) { - return (_b = this.options) === null || _b === void 0 ? void 0 : _b.transactionResolver(receipt); - } - if (receipt.status === BigInt(0)) { - const error = yield getTransactionError( - this.web3Context, - tx, - // @ts-expect-error unknown type fix - receipt, - void 0, - (_c = this.options) === null || _c === void 0 ? void 0 : _c.contractAbi - ); - if (this.promiEvent.listenerCount("error") > 0) { - this.promiEvent.emit("error", error); - } - throw error; - } else { - return receipt; - } - }); - } -}; - -// node_modules/web3-eth/lib/esm/rpc_method_wrappers.js -var __awaiter30 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __rest = function(s, e) { - var t = {}; - for (var p in s) - if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; -}; -var getProtocolVersion2 = (web3Context) => __awaiter30(void 0, void 0, void 0, function* () { - return eth_rpc_methods_exports.getProtocolVersion(web3Context.requestManager); -}); -var isSyncing = (web3Context) => __awaiter30(void 0, void 0, void 0, function* () { - return eth_rpc_methods_exports.getSyncing(web3Context.requestManager); -}); -var getCoinbase2 = (web3Context) => __awaiter30(void 0, void 0, void 0, function* () { - return eth_rpc_methods_exports.getCoinbase(web3Context.requestManager); -}); -var isMining = (web3Context) => __awaiter30(void 0, void 0, void 0, function* () { - return eth_rpc_methods_exports.getMining(web3Context.requestManager); -}); -function getHashRate2(web3Context, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const response = yield eth_rpc_methods_exports.getHashRate(web3Context.requestManager); - return format({ format: "uint" }, response, returnFormat); - }); -} -function getGasPrice2(web3Context, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const response = yield eth_rpc_methods_exports.getGasPrice(web3Context.requestManager); - return format({ format: "uint" }, response, returnFormat); - }); -} -function getBlockNumber2(web3Context, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const response = yield eth_rpc_methods_exports.getBlockNumber(web3Context.requestManager); - return format({ format: "uint" }, response, returnFormat); - }); -} -function getBalance2(web3Context, address, blockNumber = web3Context.defaultBlock, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const blockNumberFormatted = isBlockTag(blockNumber) ? blockNumber : format({ format: "uint" }, blockNumber, ETH_DATA_FORMAT); - const response = yield eth_rpc_methods_exports.getBalance(web3Context.requestManager, address, blockNumberFormatted); - return format({ format: "uint" }, response, returnFormat); - }); -} -function getStorageAt2(web3Context, address, storageSlot, blockNumber = web3Context.defaultBlock, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const storageSlotFormatted = format({ format: "uint" }, storageSlot, ETH_DATA_FORMAT); - const blockNumberFormatted = isBlockTag(blockNumber) ? blockNumber : format({ format: "uint" }, blockNumber, ETH_DATA_FORMAT); - const response = yield eth_rpc_methods_exports.getStorageAt(web3Context.requestManager, address, storageSlotFormatted, blockNumberFormatted); - return format({ format: "bytes" }, response, returnFormat); - }); -} -function getCode2(web3Context, address, blockNumber = web3Context.defaultBlock, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const blockNumberFormatted = isBlockTag(blockNumber) ? blockNumber : format({ format: "uint" }, blockNumber, ETH_DATA_FORMAT); - const response = yield eth_rpc_methods_exports.getCode(web3Context.requestManager, address, blockNumberFormatted); - return format({ format: "bytes" }, response, returnFormat); - }); -} -function getBlock(web3Context, block = web3Context.defaultBlock, hydrated = false, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - let response; - if (isBytes3(block)) { - const blockHashFormatted = format({ format: "bytes32" }, block, ETH_DATA_FORMAT); - response = yield eth_rpc_methods_exports.getBlockByHash(web3Context.requestManager, blockHashFormatted, hydrated); - } else { - const blockNumberFormatted = isBlockTag(block) ? block : format({ format: "uint" }, block, ETH_DATA_FORMAT); - response = yield eth_rpc_methods_exports.getBlockByNumber(web3Context.requestManager, blockNumberFormatted, hydrated); - } - return format(blockSchema, response, returnFormat); - }); -} -function getBlockTransactionCount(web3Context, block = web3Context.defaultBlock, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - let response; - if (isBytes3(block)) { - const blockHashFormatted = format({ format: "bytes32" }, block, ETH_DATA_FORMAT); - response = yield eth_rpc_methods_exports.getBlockTransactionCountByHash(web3Context.requestManager, blockHashFormatted); - } else { - const blockNumberFormatted = isBlockTag(block) ? block : format({ format: "uint" }, block, ETH_DATA_FORMAT); - response = yield eth_rpc_methods_exports.getBlockTransactionCountByNumber(web3Context.requestManager, blockNumberFormatted); - } - return format({ format: "uint" }, response, returnFormat); - }); -} -function getBlockUncleCount(web3Context, block = web3Context.defaultBlock, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - let response; - if (isBytes3(block)) { - const blockHashFormatted = format({ format: "bytes32" }, block, ETH_DATA_FORMAT); - response = yield eth_rpc_methods_exports.getUncleCountByBlockHash(web3Context.requestManager, blockHashFormatted); - } else { - const blockNumberFormatted = isBlockTag(block) ? block : format({ format: "uint" }, block, ETH_DATA_FORMAT); - response = yield eth_rpc_methods_exports.getUncleCountByBlockNumber(web3Context.requestManager, blockNumberFormatted); - } - return format({ format: "uint" }, response, returnFormat); - }); -} -function getUncle(web3Context, block = web3Context.defaultBlock, uncleIndex, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const uncleIndexFormatted = format({ format: "uint" }, uncleIndex, ETH_DATA_FORMAT); - let response; - if (isBytes3(block)) { - const blockHashFormatted = format({ format: "bytes32" }, block, ETH_DATA_FORMAT); - response = yield eth_rpc_methods_exports.getUncleByBlockHashAndIndex(web3Context.requestManager, blockHashFormatted, uncleIndexFormatted); - } else { - const blockNumberFormatted = isBlockTag(block) ? block : format({ format: "uint" }, block, ETH_DATA_FORMAT); - response = yield eth_rpc_methods_exports.getUncleByBlockNumberAndIndex(web3Context.requestManager, blockNumberFormatted, uncleIndexFormatted); - } - return format(blockSchema, response, returnFormat); - }); -} -function getTransaction(web3Context, transactionHash, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const transactionHashFormatted = format({ format: "bytes32" }, transactionHash, DEFAULT_RETURN_FORMAT); - const response = yield eth_rpc_methods_exports.getTransactionByHash(web3Context.requestManager, transactionHashFormatted); - return isNullish(response) ? response : formatTransaction(response, returnFormat, { fillInputAndData: true }); - }); -} -function getPendingTransactions2(web3Context, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const response = yield eth_rpc_methods_exports.getPendingTransactions(web3Context.requestManager); - return response.map((transaction) => formatTransaction(transaction, returnFormat, { - fillInputAndData: true - })); - }); -} -function getTransactionFromBlock(web3Context, block = web3Context.defaultBlock, transactionIndex, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const transactionIndexFormatted = format({ format: "uint" }, transactionIndex, ETH_DATA_FORMAT); - let response; - if (isBytes3(block)) { - const blockHashFormatted = format({ format: "bytes32" }, block, ETH_DATA_FORMAT); - response = yield eth_rpc_methods_exports.getTransactionByBlockHashAndIndex(web3Context.requestManager, blockHashFormatted, transactionIndexFormatted); - } else { - const blockNumberFormatted = isBlockTag(block) ? block : format({ format: "uint" }, block, ETH_DATA_FORMAT); - response = yield eth_rpc_methods_exports.getTransactionByBlockNumberAndIndex(web3Context.requestManager, blockNumberFormatted, transactionIndexFormatted); - } - return isNullish(response) ? response : formatTransaction(response, returnFormat, { fillInputAndData: true }); - }); -} -function getTransactionReceipt2(web3Context, transactionHash, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const transactionHashFormatted = format({ format: "bytes32" }, transactionHash, DEFAULT_RETURN_FORMAT); - const response = yield eth_rpc_methods_exports.getTransactionReceipt(web3Context.requestManager, transactionHashFormatted); - return isNullish(response) ? response : format(transactionReceiptSchema, response, returnFormat); - }); -} -function getTransactionCount2(web3Context, address, blockNumber = web3Context.defaultBlock, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const blockNumberFormatted = isBlockTag(blockNumber) ? blockNumber : format({ format: "uint" }, blockNumber, ETH_DATA_FORMAT); - const response = yield eth_rpc_methods_exports.getTransactionCount(web3Context.requestManager, address, blockNumberFormatted); - return format({ format: "uint" }, response, returnFormat); - }); -} -function sendTransaction3(web3Context, transaction, returnFormat, options = { checkRevertBeforeSending: true }) { - const promiEvent = new Web3PromiEvent((resolve, reject) => { - setImmediate(() => { - (() => __awaiter30(this, void 0, void 0, function* () { - const sendTxHelper = new SendTxHelper({ - web3Context, - promiEvent, - options, - returnFormat - }); - let transactionFormatted = formatTransaction(Object.assign(Object.assign({}, transaction), { from: getTransactionFromOrToAttr("from", web3Context, transaction), to: getTransactionFromOrToAttr("to", web3Context, transaction) }), ETH_DATA_FORMAT); - try { - transactionFormatted = yield sendTxHelper.populateGasPrice({ - transaction, - transactionFormatted - }); - yield sendTxHelper.checkRevertBeforeSending(transactionFormatted); - sendTxHelper.emitSending(transactionFormatted); - let wallet; - if (web3Context.wallet && !isNullish(transactionFormatted.from)) { - wallet = web3Context.wallet.get(transactionFormatted.from); - } - const transactionHash = yield sendTxHelper.signAndSend({ - wallet, - tx: transactionFormatted - }); - const transactionHashFormatted = format({ format: "bytes32" }, transactionHash, returnFormat); - sendTxHelper.emitSent(transactionFormatted); - sendTxHelper.emitTransactionHash(transactionHashFormatted); - const transactionReceipt = yield waitForTransactionReceipt(web3Context, transactionHash, returnFormat); - const transactionReceiptFormatted = sendTxHelper.getReceiptWithEvents(format(transactionReceiptSchema, transactionReceipt, returnFormat)); - sendTxHelper.emitReceipt(transactionReceiptFormatted); - resolve(yield sendTxHelper.handleResolve({ - receipt: transactionReceiptFormatted, - tx: transactionFormatted - })); - sendTxHelper.emitConfirmation({ - receipt: transactionReceiptFormatted, - transactionHash - }); - } catch (error) { - reject(yield sendTxHelper.handleError({ - error, - tx: transactionFormatted - })); - } - }))(); - }); - }); - return promiEvent; -} -function sendSignedTransaction(web3Context, signedTransaction, returnFormat, options = { checkRevertBeforeSending: true }) { - const promiEvent = new Web3PromiEvent((resolve, reject) => { - setImmediate(() => { - (() => __awaiter30(this, void 0, void 0, function* () { - const sendTxHelper = new SendTxHelper({ - web3Context, - promiEvent, - options, - returnFormat - }); - const signedTransactionFormattedHex = format({ format: "bytes" }, signedTransaction, ETH_DATA_FORMAT); - const unSerializedTransaction = TransactionFactory.fromSerializedData(bytesToUint8Array(hexToBytes2(signedTransactionFormattedHex))); - const unSerializedTransactionWithFrom = Object.assign(Object.assign({}, unSerializedTransaction.toJSON()), { - // Some providers will default `from` to address(0) causing the error - // reported from `eth_call` to not be the reason the user's tx failed - // e.g. `eth_call` will return an Out of Gas error for a failed - // smart contract execution contract, because the sender, address(0), - // has no balance to pay for the gas of the transaction execution - from: unSerializedTransaction.getSenderAddress().toString() - }); - try { - const { v, r, s } = unSerializedTransactionWithFrom, txWithoutSigParams = __rest(unSerializedTransactionWithFrom, ["v", "r", "s"]); - yield sendTxHelper.checkRevertBeforeSending(txWithoutSigParams); - sendTxHelper.emitSending(signedTransactionFormattedHex); - const transactionHash = yield trySendTransaction(web3Context, () => __awaiter30(this, void 0, void 0, function* () { - return eth_rpc_methods_exports.sendRawTransaction(web3Context.requestManager, signedTransactionFormattedHex); - })); - sendTxHelper.emitSent(signedTransactionFormattedHex); - const transactionHashFormatted = format({ format: "bytes32" }, transactionHash, returnFormat); - sendTxHelper.emitTransactionHash(transactionHashFormatted); - const transactionReceipt = yield waitForTransactionReceipt(web3Context, transactionHash, returnFormat); - const transactionReceiptFormatted = sendTxHelper.getReceiptWithEvents(format(transactionReceiptSchema, transactionReceipt, returnFormat)); - sendTxHelper.emitReceipt(transactionReceiptFormatted); - resolve(yield sendTxHelper.handleResolve({ - receipt: transactionReceiptFormatted, - tx: unSerializedTransactionWithFrom - })); - sendTxHelper.emitConfirmation({ - receipt: transactionReceiptFormatted, - transactionHash - }); - } catch (error) { - reject(yield sendTxHelper.handleError({ - error, - tx: unSerializedTransactionWithFrom - })); - } - }))(); - }); - }); - return promiEvent; -} -function sign4(web3Context, message, addressOrIndex, returnFormat) { - var _a4; - return __awaiter30(this, void 0, void 0, function* () { - const messageFormatted = format({ format: "bytes" }, message, DEFAULT_RETURN_FORMAT); - if ((_a4 = web3Context.wallet) === null || _a4 === void 0 ? void 0 : _a4.get(addressOrIndex)) { - const wallet = web3Context.wallet.get(addressOrIndex); - const signed = wallet.sign(messageFormatted); - return format(SignatureObjectSchema, signed, returnFormat); - } - if (typeof addressOrIndex === "number") { - throw new SignatureError(message, 'RPC method "eth_sign" does not support index signatures'); - } - const response = yield eth_rpc_methods_exports.sign(web3Context.requestManager, addressOrIndex, messageFormatted); - return format({ format: "bytes" }, response, returnFormat); - }); -} -function signTransaction4(web3Context, transaction, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const response = yield eth_rpc_methods_exports.signTransaction(web3Context.requestManager, formatTransaction(transaction, ETH_DATA_FORMAT)); - return isString(response) ? decodeSignedTransaction(response, returnFormat, { - fillInputAndData: true - }) : { - raw: format({ format: "bytes" }, response.raw, returnFormat), - tx: formatTransaction(response.tx, returnFormat, { - fillInputAndData: true - }) - }; - }); -} -function call2(web3Context, transaction, blockNumber = web3Context.defaultBlock, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const blockNumberFormatted = isBlockTag(blockNumber) ? blockNumber : format({ format: "uint" }, blockNumber, ETH_DATA_FORMAT); - const response = yield eth_rpc_methods_exports.call(web3Context.requestManager, formatTransaction(transaction, ETH_DATA_FORMAT), blockNumberFormatted); - return format({ format: "bytes" }, response, returnFormat); - }); -} -function estimateGas2(web3Context, transaction, blockNumber = web3Context.defaultBlock, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const transactionFormatted = formatTransaction(transaction, ETH_DATA_FORMAT); - const blockNumberFormatted = isBlockTag(blockNumber) ? blockNumber : format({ format: "uint" }, blockNumber, ETH_DATA_FORMAT); - const response = yield eth_rpc_methods_exports.estimateGas(web3Context.requestManager, transactionFormatted, blockNumberFormatted); - return format({ format: "uint" }, response, returnFormat); - }); -} -function getLogs2(web3Context, filter, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - let { toBlock, fromBlock } = filter; - if (!isNullish(toBlock)) { - if (typeof toBlock === "number" || typeof toBlock === "bigint") { - toBlock = numberToHex2(toBlock); - } - } - if (!isNullish(fromBlock)) { - if (typeof fromBlock === "number" || typeof fromBlock === "bigint") { - fromBlock = numberToHex2(fromBlock); - } - } - const formattedFilter = Object.assign(Object.assign({}, filter), { fromBlock, toBlock }); - const response = yield eth_rpc_methods_exports.getLogs(web3Context.requestManager, formattedFilter); - const result = response.map((res) => { - if (typeof res === "string") { - return res; - } - return format(logSchema, res, returnFormat); - }); - return result; - }); -} -function getChainId2(web3Context, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const response = yield eth_rpc_methods_exports.getChainId(web3Context.requestManager); - return format( - { format: "uint" }, - // Response is number in hex formatted string - response, - returnFormat - ); - }); -} -function getProof2(web3Context, address, storageKeys, blockNumber = web3Context.defaultBlock, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const storageKeysFormatted = storageKeys.map((storageKey) => format({ format: "bytes" }, storageKey, ETH_DATA_FORMAT)); - const blockNumberFormatted = isBlockTag(blockNumber) ? blockNumber : format({ format: "uint" }, blockNumber, ETH_DATA_FORMAT); - const response = yield eth_rpc_methods_exports.getProof(web3Context.requestManager, address, storageKeysFormatted, blockNumberFormatted); - return format(accountSchema, response, returnFormat); - }); -} -function getFeeHistory2(web3Context, blockCount, newestBlock = web3Context.defaultBlock, rewardPercentiles, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const blockCountFormatted = format({ format: "uint" }, blockCount, ETH_DATA_FORMAT); - const newestBlockFormatted = isBlockTag(newestBlock) ? newestBlock : format({ format: "uint" }, newestBlock, ETH_DATA_FORMAT); - const rewardPercentilesFormatted = format({ - type: "array", - items: { - format: "uint" - } - }, rewardPercentiles, NUMBER_DATA_FORMAT); - const response = yield eth_rpc_methods_exports.getFeeHistory(web3Context.requestManager, blockCountFormatted, newestBlockFormatted, rewardPercentilesFormatted); - return format(feeHistorySchema, response, returnFormat); - }); -} -function createAccessList2(web3Context, transaction, blockNumber = web3Context.defaultBlock, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const blockNumberFormatted = isBlockTag(blockNumber) ? blockNumber : format({ format: "uint" }, blockNumber, ETH_DATA_FORMAT); - const response = yield eth_rpc_methods_exports.createAccessList(web3Context.requestManager, formatTransaction(transaction, ETH_DATA_FORMAT), blockNumberFormatted); - return format(accessListResultSchema, response, returnFormat); - }); -} -function signTypedData2(web3Context, address, typedData, useLegacy, returnFormat) { - return __awaiter30(this, void 0, void 0, function* () { - const response = yield eth_rpc_methods_exports.signTypedData(web3Context.requestManager, address, typedData, useLegacy); - return format({ format: "bytes" }, response, returnFormat); - }); -} - -// node_modules/web3-eth/lib/esm/web3_subscriptions.js -var LogsSubscription = class extends Web3Subscription { - _buildSubscriptionParams() { - return ["logs", this.args]; - } - formatSubscriptionResult(data) { - return format(logSchema, data, super.returnFormat); - } -}; -var NewPendingTransactionsSubscription = class extends Web3Subscription { - // eslint-disable-next-line - _buildSubscriptionParams() { - return ["newPendingTransactions"]; - } - formatSubscriptionResult(data) { - return format({ format: "string" }, data, super.returnFormat); - } -}; -var NewHeadsSubscription = class extends Web3Subscription { - // eslint-disable-next-line - _buildSubscriptionParams() { - return ["newHeads"]; - } - formatSubscriptionResult(data) { - return format(blockHeaderSchema, data, super.returnFormat); - } -}; -var SyncingSubscription = class extends Web3Subscription { - // eslint-disable-next-line - _buildSubscriptionParams() { - return ["syncing"]; - } - _processSubscriptionResult(data) { - if (typeof data === "boolean") { - this.emit("changed", data); - } else { - const mappedData = Object.fromEntries(Object.entries(data.status).map(([key, value]) => [ - key.charAt(0).toLowerCase() + key.substring(1), - value - ])); - this.emit("changed", data.syncing); - this.emit("data", format(syncSchema, mappedData, super.returnFormat)); - } - } -}; - -// node_modules/web3-eth/lib/esm/web3_eth.js -var __awaiter31 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var registeredSubscriptions = { - logs: LogsSubscription, - newPendingTransactions: NewPendingTransactionsSubscription, - newHeads: NewHeadsSubscription, - syncing: SyncingSubscription, - pendingTransactions: NewPendingTransactionsSubscription, - newBlockHeaders: NewHeadsSubscription - // the same as newHeads. just for support API like in version 1.x -}; -var Web3Eth = class _Web3Eth extends Web3Context { - constructor(providerOrContext) { - if (typeof providerOrContext === "string" || isSupportedProvider(providerOrContext)) { - super({ - provider: providerOrContext, - registeredSubscriptions - }); - return; - } - if (providerOrContext.registeredSubscriptions) { - super(providerOrContext); - return; - } - super(Object.assign(Object.assign({}, providerOrContext), { registeredSubscriptions })); - } - /** - * @returns Returns the ethereum protocol version of the node. - * - * ```ts - * web3.eth.getProtocolVersion().then(console.log); - * > "63" - * ``` - */ - getProtocolVersion() { - return __awaiter31(this, void 0, void 0, function* () { - return eth_rpc_methods_exports.getProtocolVersion(this.requestManager); - }); - } - // TODO Add returnFormat parameter - /** - * Checks if the node is currently syncing. - * - * @returns Either a {@link SyncingStatusAPI}, or `false`. - * - * ```ts - * web3.eth.isSyncing().then(console.log); - * > { - * startingBlock: 100, - * currentBlock: 312, - * highestBlock: 512, - * knownStates: 234566, - * pulledStates: 123455 - * } - * ``` - */ - isSyncing() { - return __awaiter31(this, void 0, void 0, function* () { - return eth_rpc_methods_exports.getSyncing(this.requestManager); - }); - } - // TODO consider adding returnFormat parameter (to format address as bytes) - /** - * @returns Returns the coinbase address to which mining rewards will go. - * - * ```ts - * web3.eth.getCoinbase().then(console.log); - * > "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe" - * ``` - */ - getCoinbase() { - return __awaiter31(this, void 0, void 0, function* () { - return eth_rpc_methods_exports.getCoinbase(this.requestManager); - }); - } - /** - * Checks whether the node is mining or not. - * - * @returns `true` if the node is mining, otherwise `false`. - * - * ```ts - * web3.eth.isMining().then(console.log); - * > true - * ``` - */ - isMining() { - return __awaiter31(this, void 0, void 0, function* () { - return eth_rpc_methods_exports.getMining(this.requestManager); - }); - } - /** - * @deprecated Will be removed in the future, please use {@link Web3Eth.getHashRate} method instead. - * - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted. - * @returns The number of hashes per second that the node is mining with. - * - * ```ts - * web3.eth.getHashrate().then(console.log); - * > 493736n - * - * web3.eth.getHashrate({ number: FMT_NUMBER.HEX , bytes: FMT_BYTES.HEX }).then(console.log); - * > "0x788a8" - * ``` - */ - getHashrate(returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return this.getHashRate(returnFormat); - }); - } - /** - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted. - * @returns The number of hashes per second that the node is mining with. - * - * ```ts - * web3.eth.getHashRate().then(console.log); - * > 493736n - * - * web3.eth.getHashRate({ number: FMT_NUMBER.HEX , bytes: FMT_BYTES.HEX }).then(console.log); - * > "0x788a8" - * ``` - */ - getHashRate(returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return getHashRate2(this, returnFormat); - }); - } - /** - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted. - * @returns The gas price determined by the last few blocks median gas price. - * - * ```ts - * web3.eth.getGasPrice().then(console.log); - * > 20000000000n - * - * web3.eth.getGasPrice({ number: FMT_NUMBER.HEX , bytes: FMT_BYTES.HEX }).then(console.log); - * > "0x4a817c800" - * ``` - */ - getGasPrice(returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return getGasPrice2(this, returnFormat); - }); - } - /** - * @returns A list of accounts the node controls (addresses are checksummed). - * - * ```ts - * web3.eth.getAccounts().then(console.log); - * > ["0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe", "0xDCc6960376d6C6dEa93647383FfB245CfCed97Cf"] - * ``` - */ - getAccounts() { - var _a4; - return __awaiter31(this, void 0, void 0, function* () { - const hexAddresses = (_a4 = yield eth_rpc_methods_exports.getAccounts(this.requestManager)) !== null && _a4 !== void 0 ? _a4 : []; - return hexAddresses.map((address) => toChecksumAddress(address)); - }); - } - /** - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted. - * @returns The current block number. - * - * ```ts - * web3.eth.getBlockNumber().then(console.log); - * > 2744n - * - * web3.eth.getBlockNumber({ number: FMT_NUMBER.HEX , bytes: FMT_BYTES.HEX }).then(console.log); - * > "0xab8" - * ``` - */ - getBlockNumber(returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return getBlockNumber2(this, returnFormat); - }); - } - /** - * Get the balance of an address at a given block. - * - * @param address The address to get the balance of. - * @param blockNumber ({@link BlockNumberOrTag} defaults to {@link Web3Eth.defaultBlock}) Specifies what block to use as the current state for the balance query. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted. - * @returns The current balance for the given address in `wei`. - * - * ```ts - * web3.eth.getBalance("0x407d73d8a49eeb85d32cf465507dd71d507100c1").then(console.log); - * > 1000000000000n - * - * web3.eth.getBalance("0x407d73d8a49eeb85d32cf465507dd71d507100c1").then(console.log); - * > "0xe8d4a51000" - * ``` - */ - getBalance(address, blockNumber = this.defaultBlock, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return getBalance2(this, address, blockNumber, returnFormat); - }); - } - /** - * Get the storage at a specific position of an address. - * - * @param address The address to get the storage from. - * @param storageSlot The index position of the storage. - * @param blockNumber ({@link BlockNumberOrTag} defaults to {@link Web3Eth.defaultBlock}) Specifies what block to use as the current state for the storage query. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted. - * @returns The value in storage at the given position. - * - * ```ts - * web3.eth.getStorageAt("0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234", 0).then(console.log); - * > "0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234" - * - * web3.eth.getStorageAt( - * "0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234", - * 0, - * undefined, - * { number: FMT_NUMBER.HEX , bytes: FMT_BYTES.UINT8ARRAY } - * ).then(console.log); - * > Uint8Array(31) [ - * 3, 52, 86, 115, 33, 35, 255, 255, - * 35, 66, 52, 45, 209, 35, 66, 67, - * 67, 36, 35, 66, 52, 253, 35, 79, - * 210, 63, 212, 242, 61, 66, 52 - * ] - * ``` - */ - getStorageAt(address, storageSlot, blockNumber = this.defaultBlock, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return getStorageAt2(this, address, storageSlot, blockNumber, returnFormat); - }); - } - /** - * Get the code at a specific address. - * - * @param address The address to get the code from. - * @param blockNumber ({@link BlockNumberOrTag} defaults to {@link Web3Eth.defaultBlock}) Specifies what block to use as the current state for the code query. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted. - * @returns The [data](https://ethereum.org/en/developers/docs/transactions/#the-data-field) at the provided `address`. - * - * ```ts - * web3.eth.getCode("0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234").then(console.log); - * > "0x600160008035811a818181146012578301005b601b6001356025565b8060005260206000f25b600060078202905091905056" - * - * web3.eth.getCode( - * "0x407d73d8a49eeb85d32cf465507dd71d507100c1", - * undefined, - * { number: FMT_NUMBER.HEX , bytes: FMT_BYTES.UINT8ARRAY } - * ).then(console.log); - * > Uint8Array(50) [ - * 96, 1, 96, 0, 128, 53, 129, 26, 129, 129, 129, - * 20, 96, 18, 87, 131, 1, 0, 91, 96, 27, 96, - * 1, 53, 96, 37, 86, 91, 128, 96, 0, 82, 96, - * 32, 96, 0, 242, 91, 96, 0, 96, 7, 130, 2, - * 144, 80, 145, 144, 80, 86 - * ] - * ``` - */ - getCode(address, blockNumber = this.defaultBlock, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return getCode2(this, address, blockNumber, returnFormat); - }); - } - /** - * Retrieves a {@link Block} matching the provided block number, block hash or block tag. - * - * @param block The {@link BlockNumberOrTag} (defaults to {@link Web3Eth.defaultBlock}) or block hash of the desired block. - * @param hydrated If specified `true`, the returned block will contain all transactions as objects. If `false` it will only contain transaction hashes. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted (does not format transaction objects or hashes). - * @returns A {@link Block} object matching the provided block number or block hash. - * - * ```ts - * web3.eth.getBlock(0).then(console.log); - * > { - * hash: '0x7dbfdc6a7a67a670cb9b0c3f81ca60c007762f1e4e598cb027a470678ff26d0d', - * parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000', - * sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', - * miner: '0x0000000000000000000000000000000000000000', - * stateRoot: '0x5ed9882897d363c4632a6e67fba6203df61bd994813dcf048da59be442a9c6c4', - * transactionsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', - * receiptsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', - * logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - * difficulty: 1n, - * number: 0n, - * gasLimit: 30000000n, - * gasUsed: 0n, - * timestamp: 1658281638n, - * extraData: '0x', - * mixHash: '0x0000000000000000000000000000000000000000000000000000000000000000', - * nonce: 0n, - * totalDifficulty: 1n, - * baseFeePerGas: 1000000000n, - * size: 514n, - * transactions: [], - * uncles: [] - * } - * - * web3.eth.getBlock( - * "0x7dbfdc6a7a67a670cb9b0c3f81ca60c007762f1e4e598cb027a470678ff26d0d", - * false, - * { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX } - * ).then(console.log); - * > { - * hash: '0x7dbfdc6a7a67a670cb9b0c3f81ca60c007762f1e4e598cb027a470678ff26d0d', - * parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000', - * sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', - * miner: '0x0000000000000000000000000000000000000000', - * stateRoot: '0x5ed9882897d363c4632a6e67fba6203df61bd994813dcf048da59be442a9c6c4', - * transactionsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', - * receiptsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', - * logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - * difficulty: 1, - * number: 0, - * gasLimit: 30000000, - * gasUsed: 0, - * timestamp: 1658281638, - * extraData: '0x', - * mixHash: '0x0000000000000000000000000000000000000000000000000000000000000000', - * nonce: 0, - * totalDifficulty: 1, - * baseFeePerGas: 1000000000, - * size: 514, - * transactions: [], - * uncles: [] - * } - * ``` - */ - getBlock(block = this.defaultBlock, hydrated = false, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return getBlock(this, block, hydrated, returnFormat); - }); - } - /** - * @param block The {@link BlockNumberOrTag} (defaults to {@link Web3Eth.defaultBlock}) or block hash of the desired block. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted. - * @returns The number of transactions in the provided block. - * - * ```ts - * web3.eth.getBlockTransactionCount("0x407d73d8a49eeb85d32cf465507dd71d507100c1").then(console.log); - * > 1n - * - * web3.eth.getBlockTransactionCount( - * "0x407d73d8a49eeb85d32cf465507dd71d507100c1", - * { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX } - * ).then(console.log); - * > 1 - * ``` - */ - getBlockTransactionCount(block = this.defaultBlock, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return getBlockTransactionCount(this, block, returnFormat); - }); - } - /** - * @param block The {@link BlockNumberOrTag} (defaults to {@link Web3Eth.defaultBlock}) or block hash of the desired block. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted. - * @returns The number of [uncles](https://ethereum.org/en/glossary/#ommer) in the provided block. - * - * ```ts - * web3.eth.getBlockUncleCount("0x407d73d8a49eeb85d32cf465507dd71d507100c1").then(console.log); - * > 1n - * - * web3.eth.getBlockUncleCount( - * "0x407d73d8a49eeb85d32cf465507dd71d507100c1", - * { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX } - * ).then(console.log); - * > 1 - * ``` - */ - getBlockUncleCount(block = this.defaultBlock, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return getBlockUncleCount(this, block, returnFormat); - }); - } - /** - * - * @param block The {@link BlockNumberOrTag} (defaults to {@link Web3Eth.defaultBlock}) or block hash of the desired block. - * @param uncleIndex The index position of the uncle. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted. - * @returns A blocks [uncle](https://ethereum.org/en/glossary/#ommer) by a given uncle index position. - * - * ```ts - * web3.eth.getUncle(0, 1).then(console.log); - * > { - * hash: '0x7dbfdc6a7a67a670cb9b0c3f81ca60c007762f1e4e598cb027a470678ff26d0d', - * parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000', - * sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', - * miner: '0x0000000000000000000000000000000000000000', - * stateRoot: '0x5ed9882897d363c4632a6e67fba6203df61bd994813dcf048da59be442a9c6c4', - * transactionsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', - * receiptsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', - * logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - * difficulty: 1n, - * number: 0n, - * gasLimit: 30000000n, - * gasUsed: 0n, - * timestamp: 1658281638n, - * extraData: '0x', - * mixHash: '0x0000000000000000000000000000000000000000000000000000000000000000', - * nonce: 0n, - * totalDifficulty: 1n, - * baseFeePerGas: 1000000000n, - * size: 514n, - * transactions: [], - * uncles: [] - * } - * - * web3.eth.getUncle( - * "0x7dbfdc6a7a67a670cb9b0c3f81ca60c007762f1e4e598cb027a470678ff26d0d", - * 1, - * { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX } - * ).then(console.log); - * > { - * hash: '0x7dbfdc6a7a67a670cb9b0c3f81ca60c007762f1e4e598cb027a470678ff26d0d', - * parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000', - * sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', - * miner: '0x0000000000000000000000000000000000000000', - * stateRoot: '0x5ed9882897d363c4632a6e67fba6203df61bd994813dcf048da59be442a9c6c4', - * transactionsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', - * receiptsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', - * logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - * difficulty: 1, - * number: 0, - * gasLimit: 30000000, - * gasUsed: 0, - * timestamp: 1658281638, - * extraData: '0x', - * mixHash: '0x0000000000000000000000000000000000000000000000000000000000000000', - * nonce: 0, - * totalDifficulty: 1, - * baseFeePerGas: 1000000000, - * size: 514, - * transactions: [], - * uncles: [] - * } - * ``` - */ - getUncle(block = this.defaultBlock, uncleIndex, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return getUncle(this, block, uncleIndex, returnFormat); - }); - } - /** - * @param transactionHash The hash of the desired transaction. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted. - * @returns The desired transaction object. - * - * ```ts - * web3.eth.getTransaction('0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc').then(console.log); - * { - * hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc', - * type: 0n, - * nonce: 0n, - * blockHash: '0x43202bd16b6bd54bea1b310736bd78bdbe93a64ad940f7586739d9eb25ad8d00', - * blockNumber: 1n, - * transactionIndex: 0n, - * from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4', - * to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c', - * value: 1n, - * gas: 90000n, - * gasPrice: 2000000000n, - * input: '0x', - * v: 2709n, - * r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c', - * s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d' - * } - * - * web3.eth.getTransaction( - * web3.utils.hexToBytes("0x30755ed65396facf86c53e6217c52b4daebe72aa4941d89635409de4c9c7f9466d4e9aaec7977f05e923889b33c0d0dd27d7226b6e6f56ce737465c5cfd04be400"), - * { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX } - * ).then(console.log); - * { - * hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc', - * type: 0, - * nonce: 0, - * blockHash: '0x43202bd16b6bd54bea1b310736bd78bdbe93a64ad940f7586739d9eb25ad8d00', - * blockNumber: 1, - * transactionIndex: 0, - * from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4', - * to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c', - * value: 1, - * gas: 90000, - * gasPrice: 2000000000, - * input: '0x', - * v: 2709, - * r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c', - * s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d' - * } - * ``` - */ - getTransaction(transactionHash, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - const response = yield getTransaction(this, transactionHash, returnFormat); - if (!response) - throw new TransactionNotFound(); - return response; - }); - } - /** - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted. - * @returns A list of pending transactions. - * - * ```ts - * web3.eth.getPendingTransactions().then(console.log); - * > [ - * { - * hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc', - * type: 0n, - * nonce: 0n, - * blockHash: '0x0000000000000000000000000000000000000000000000000000000000000000', - * blockNumber: null, - * transactionIndex: 0n, - * from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4', - * to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c', - * value: 1n, - * gas: 90000n, - * gasPrice: 2000000000n, - * input: '0x', - * v: 2709n, - * r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c', - * s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d' - * }, - * { - * hash: '0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f', - * type: 0n, - * nonce: 1n, - * blockHash: '0x0000000000000000000000000000000000000000000000000000000000000000', - * blockNumber: null, - * transactionIndex: 0n, - * from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4', - * to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c', - * value: 1n, - * gas: 90000n, - * gasPrice: 2000000000n, - * input: '0x', - * v: 2710n, - * r: '0x55ac19fade21db035a1b7ea0a8d49e265e05dbb926e75f273f836ad67ce5c96a', - * s: '0x6550036a7c3fd426d5c3d35d96a7075cd673957620b7889846a980d2d017ec08' - * } - * ] - * - * * web3.eth.getPendingTransactions({ number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }).then(console.log); - * > [ - * { - * hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc', - * type: 0, - * nonce: 0, - * blockHash: '0x0000000000000000000000000000000000000000000000000000000000000000', - * blockNumber: null, - * transactionIndex: 0, - * from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4', - * to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c', - * value: 1, - * gas: 90000, - * gasPrice: 2000000000, - * input: '0x', - * v: 2709, - * r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c', - * s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d' - * }, - * { - * hash: '0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f', - * type: 0, - * nonce: 1, - * blockHash: '0x0000000000000000000000000000000000000000000000000000000000000000', - * blockNumber: null, - * transactionIndex: 0, - * from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4', - * to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c', - * value: 1, - * gas: 90000, - * gasPrice: 2000000000, - * input: '0x', - * v: 2710, - * r: '0x55ac19fade21db035a1b7ea0a8d49e265e05dbb926e75f273f836ad67ce5c96a', - * s: '0x6550036a7c3fd426d5c3d35d96a7075cd673957620b7889846a980d2d017ec08' - * } - * ] - * ``` - */ - getPendingTransactions(returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return getPendingTransactions2(this, returnFormat); - }); - } - /** - * @param block The {@link BlockNumberOrTag} (defaults to {@link Web3Eth.defaultBlock}) or block hash of the desired block. - * @param transactionIndex The index position of the transaction. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted. - * @returns The desired transaction object. - * - * ```ts - * web3.eth.getTransactionFromBlock('0x43202bd16b6bd54bea1b310736bd78bdbe93a64ad940f7586739d9eb25ad8d00', 0).then(console.log); - * { - * hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc', - * type: 0n, - * nonce: 0n, - * blockHash: '0x43202bd16b6bd54bea1b310736bd78bdbe93a64ad940f7586739d9eb25ad8d00', - * blockNumber: 1n, - * transactionIndex: 0n, - * from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4', - * to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c', - * value: 1n, - * gas: 90000n, - * gasPrice: 2000000000n, - * input: '0x', - * v: 2709n, - * r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c', - * s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d' - * } - * - * web3.eth.getTransactionFromBlock( - * hexToBytes("0x30755ed65396facf86c53e6217c52b4daebe72aa4941d89635409de4c9c7f9466d4e9aaec7977f05e923889b33c0d0dd27d7226b6e6f56ce737465c5cfd04be400"), - * 0, - * { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX } - * ).then(console.log); - * { - * hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc', - * type: 0, - * nonce: 0, - * blockHash: '0x43202bd16b6bd54bea1b310736bd78bdbe93a64ad940f7586739d9eb25ad8d00', - * blockNumber: 1, - * transactionIndex: 0, - * from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4', - * to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c', - * value: 1, - * gas: 90000, - * gasPrice: 2000000000, - * input: '0x', - * v: 2709, - * r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c', - * s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d' - * } - * ``` - */ - getTransactionFromBlock(block = this.defaultBlock, transactionIndex, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return getTransactionFromBlock(this, block, transactionIndex, returnFormat); - }); - } - /** - * @param transactionHash Hash of the transaction to retrieve the receipt for. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted. - * @returns The desired {@link TransactionReceipt} object. - * - * ```ts - * web3.eth.getTransactionReceipt("0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f").then(console.log); - * > { - * transactionHash: '0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f', - * transactionIndex: 0n, - * blockNumber: 2n, - * blockHash: '0xeb1565a08b23429552dafa92e32409f42eb43944f7611963c63ce40e7243941a', - * from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4', - * to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c', - * cumulativeGasUsed: 21000n, - * gasUsed: 21000n, - * logs: [], - * logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - * status: 1n, - * effectiveGasPrice: 2000000000n, - * type: 0n - * } - * - * web3.eth.getTransactionReceipt( - * "0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f", - * { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX } - * ).then(console.log); - * > { - * transactionHash: '0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f', - * transactionIndex: 0, - * blockNumber: 2, - * blockHash: '0xeb1565a08b23429552dafa92e32409f42eb43944f7611963c63ce40e7243941a', - * from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4', - * to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c', - * cumulativeGasUsed: 21000, - * gasUsed: 21000, - * logs: [], - * logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - * status: 1, - * effectiveGasPrice: 2000000000, - * type: 0n - * } - * ``` - */ - getTransactionReceipt(transactionHash, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - const response = yield getTransactionReceipt2(this, transactionHash, returnFormat); - if (!response) - throw new TransactionNotFound(); - return response; - }); - } - /** - * @param address The address to get the number of transactions for. - * @param blockNumber ({@link BlockNumberOrTag} defaults to {@link Web3Eth.defaultBlock}) Specifies what block to use as the current state for the query. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted. - * @returns The number of transactions sent from the provided address. - * - * ```ts - * web3.eth.getTransactionCount("0x407d73d8a49eeb85d32cf465507dd71d507100c1").then(console.log); - * > 1n - * - * web3.eth.getTransactionCount( - * "0x407d73d8a49eeb85d32cf465507dd71d507100c1", - * undefined, - * { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX } - * ).then(console.log); - * > 1 - * ``` - */ - getTransactionCount(address, blockNumber = this.defaultBlock, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return getTransactionCount2(this, address, blockNumber, returnFormat); - }); - } - /** - * @param transaction The {@link Transaction}, {@link TransactionWithFromLocalWalletIndex}, {@link TransactionWithToLocalWalletIndex} or {@link TransactionWithFromAndToLocalWalletIndex} to send. __Note:__ In the `to` and `from` fields when hex strings are used, it is assumed they are addresses, for any other form (number, string number, etc.) it is assumed they are wallet indexes. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted. - * @param options A configuration object used to change the behavior of the `sendTransaction` method. - * @returns If `await`ed or `.then`d (i.e. the promise resolves), the transaction hash is returned. - * ```ts - * const transaction = { - * from: '0x6E599DA0bfF7A6598AC1224E4985430Bf16458a4', - * to: '0x6f1DF96865D09d21e8f3f9a7fbA3b17A11c7C53C', - * value: '0x1' - * } - * - * const transactionHash = await web3.eth.sendTransaction(transaction); - * console.log(transactionHash); - * > 0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f - * - * web3.eth.sendTransaction(transaction).then(console.log); - * > 0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f - * - * web3.eth.sendTransaction(transaction).catch(console.log); - * > - * - * // Example using options.ignoreGasPricing = true - * web3.eth.sendTransaction(transaction, undefined, { ignoreGasPricing: true }).then(console.log); - * > 0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f - * ``` - * - * - * Otherwise, a {@link Web3PromiEvent} is returned which has several events than can be listened to using the `.on` syntax, such as: - * - `sending` - * ```ts - * web3.eth.sendTransaction(transaction).on('sending', transactionToBeSent => console.log(transactionToBeSent)); - * > { - * from: '0x6E599DA0bfF7A6598AC1224E4985430Bf16458a4', - * to: '0x6f1DF96865D09d21e8f3f9a7fbA3b17A11c7C53C', - * value: '0x1', - * gasPrice: '0x77359400', - * maxPriorityFeePerGas: undefined, - * maxFeePerGas: undefined - * } - * ``` - * - `sent` - * ```ts - * web3.eth.sendTransaction(transaction).on('sent', sentTransaction => console.log(sentTransaction)); - * > { - * from: '0x6E599DA0bfF7A6598AC1224E4985430Bf16458a4', - * to: '0x6f1DF96865D09d21e8f3f9a7fbA3b17A11c7C53C', - * value: '0x1', - * gasPrice: '0x77359400', - * maxPriorityFeePerGas: undefined, - * maxFeePerGas: undefined - * } - * ``` - * - `transactionHash` - * ```ts - * web3.eth.sendTransaction(transaction).on('transactionHash', transactionHash => console.log(transactionHash)); - * > 0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f - * ``` - * - `receipt` - * ```ts - * web3.eth.sendTransaction(transaction).on('receipt', receipt => console.log(receipt)); - * > { - * transactionHash: '0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f', - * transactionIndex: 0n, - * blockNumber: 2n, - * blockHash: '0xeb1565a08b23429552dafa92e32409f42eb43944f7611963c63ce40e7243941a', - * from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4', - * to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c', - * cumulativeGasUsed: 21000n, - * gasUsed: 21000n, - * logs: [], - * logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - * status: 1n, - * effectiveGasPrice: 2000000000n, - * type: 0n - * } - * ``` - * - `confirmation` - * ```ts - * web3.eth.sendTransaction(transaction).on('confirmation', confirmation => console.log(confirmation)); - * > { - * confirmations: 1n, - * receipt: { - * transactionHash: '0xb4a3a35ae0f3e77ef0ff7be42010d948d011b21a4e341072ee18717b67e99ab8', - * transactionIndex: 0n, - * blockNumber: 5n, - * blockHash: '0xb57fbe6f145cefd86a305a9a024a4351d15d4d39607d7af53d69a319bc3b5548', - * from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4', - * to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c', - * cumulativeGasUsed: 21000n, - * gasUsed: 21000n, - * logs: [], - * logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - * status: 1n, - * effectiveGasPrice: 2000000000n, - * type: 0n - * }, - * latestBlockHash: '0xb57fbe6f145cefd86a305a9a024a4351d15d4d39607d7af53d69a319bc3b5548' - * } - * ``` - * - `error` - * ```ts - * web3.eth.sendTransaction(transaction).on('error', error => console.log); - * > - * ``` - */ - sendTransaction(transaction, returnFormat = DEFAULT_RETURN_FORMAT, options) { - return sendTransaction3(this, transaction, returnFormat, options); - } - /** - * @param transaction Signed transaction in one of the valid {@link Bytes} format. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted. - * @param options A configuration object used to change the behavior of the method - * @returns If `await`ed or `.then`d (i.e. the promise resolves), the transaction hash is returned. - * ```ts - * const signedTransaction = "0xf86580843b9aca0182520894e899f0130fd099c0b896b2ce4e5e15a25b23139a0180820a95a03a42d53ca5b71f845e1cd4c65359b05446a85d16881372d3bfaab8980935cb04a0711497bc8dd3b541152e2fed14fe650a647f1f0edab0d386ad9506f0e642410f" - * - * const transactionHash = await web3.eth.sendSignedTransaction(signedTransaction); - * console.log(transactionHash); - * > 0xed8c241ea44d57f4605dc22c63500de46254d6c7844fd65fa438b128c80cf700 - * - * web3.eth.sendSignedTransaction(signedTransaction).then(console.log); - * > 0xed8c241ea44d57f4605dc22c63500de46254d6c7844fd65fa438b128c80cf700 - * - * web3.eth.sendSignedTransaction(signedTransaction).catch(console.log); - * > - * ``` - * - * - * Otherwise, a {@link Web3PromiEvent} is returned which has several events than can be listened to using the `.on` syntax, such as: - * - `sending` - * ```ts - * web3.eth.sendSignedTransaction(signedTransaction).on('sending', transactionToBeSent => console.log(transactionToBeSent)); - * > "0xf86580843b9aca0182520894e899f0130fd099c0b896b2ce4e5e15a25b23139a0180820a95a03a42d53ca5b71f845e1cd4c65359b05446a85d16881372d3bfaab8980935cb04a0711497bc8dd3b541152e2fed14fe650a647f1f0edab0d386ad9506f0e642410f" - * ``` - * - `sent` - * ```ts - * web3.eth.sendSignedTransaction(signedTransaction).on('sent', sentTransaction => console.log(sentTransaction)); - * > "0xf86580843b9aca0182520894e899f0130fd099c0b896b2ce4e5e15a25b23139a0180820a95a03a42d53ca5b71f845e1cd4c65359b05446a85d16881372d3bfaab8980935cb04a0711497bc8dd3b541152e2fed14fe650a647f1f0edab0d386ad9506f0e642410f" - * ``` - * - `transactionHash` - * ```ts - * web3.eth.sendSignedTransaction(signedTransaction).on('transactionHash', transactionHash => console.log(transactionHash)); - * > 0xed8c241ea44d57f4605dc22c63500de46254d6c7844fd65fa438b128c80cf700 - * ``` - * - `receipt` - * ```ts - * web3.eth.sendSignedTransaction(signedTransaction).on('receipt', receipt => console.log(receipt)); - * > { - * blockHash: '0xff2b1687995d81066361bc6affe4455746120a7d4bb75fc938211a2692a50081', - * blockNumber: 1n, - * cumulativeGasUsed: 21000n, - * effectiveGasPrice: 1000000001n, - * from: '0xe899f0130fd099c0b896b2ce4e5e15a25b23139a', - * gasUsed: 21000n, - * logs: [], - * logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - * status: 1n, - * to: '0xe899f0130fd099c0b896b2ce4e5e15a25b23139a', - * transactionHash: '0xed8c241ea44d57f4605dc22c63500de46254d6c7844fd65fa438b128c80cf700', - * transactionIndex: 0n, - * type: 0n - * } - * ``` - * - `confirmation` - * ```ts - * web3.eth.sendSignedTransaction(signedTransaction).on('confirmation', confirmation => console.log(confirmation)); - * > { - * confirmations: 1n, - * receipt: { - * blockHash: '0xff2b1687995d81066361bc6affe4455746120a7d4bb75fc938211a2692a50081', - * blockNumber: 1n, - * cumulativeGasUsed: 21000n, - * effectiveGasPrice: 1000000001n, - * from: '0xe899f0130fd099c0b896b2ce4e5e15a25b23139a', - * gasUsed: 21000n, - * logs: [], - * logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - * status: 1n, - * to: '0xe899f0130fd099c0b896b2ce4e5e15a25b23139a', - * transactionHash: '0xed8c241ea44d57f4605dc22c63500de46254d6c7844fd65fa438b128c80cf700', - * transactionIndex: 0n, - * type: 0n - * }, - * latestBlockHash: '0xff2b1687995d81066361bc6affe4455746120a7d4bb75fc938211a2692a50081' - * } - * ``` - * - `error` - * ```ts - * web3.eth.sendSignedTransaction(signedTransaction).on('error', error => console.log(error)); - * > - * ``` - */ - sendSignedTransaction(transaction, returnFormat = DEFAULT_RETURN_FORMAT, options) { - return sendSignedTransaction(this, transaction, returnFormat, options); - } - /** - * @param message Data to sign in one of the valid {@link Bytes} format. - * @param address Address to sign data with, can be an address or the index of a local wallet. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted. - * @returns The signed `message`. - * - * ```ts - * // Using an unlocked account managed by connected RPC client - * web3.eth.sign("0x48656c6c6f20776f726c64", "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe").then(console.log); - * > "0x30755ed65396facf86c53e6217c52b4daebe72aa4941d89635409de4c9c7f9466d4e9aaec7977f05e923889b33c0d0dd27d7226b6e6f56ce737465c5cfd04be400" - * - * // Using an unlocked account managed by connected RPC client - * web3.eth.sign("0x48656c6c6f20776f726c64", "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe", { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.UINT8ARRAY }).then(console.log); - * > Uint8Array(65) [ - * 48, 117, 94, 214, 83, 150, 250, 207, 134, 197, 62, - * 98, 23, 197, 43, 77, 174, 190, 114, 170, 73, 65, - * 216, 150, 53, 64, 157, 228, 201, 199, 249, 70, 109, - * 78, 154, 174, 199, 151, 127, 5, 233, 35, 136, 155, - * 51, 192, 208, 221, 39, 215, 34, 107, 110, 111, 86, - * 206, 115, 116, 101, 197, 207, 208, 75, 228, 0 - * ] - * ``` - * - * // Using an indexed account managed by local Web3 wallet - * web3.eth.sign("0x48656c6c6f20776f726c64", 0).then(console.log); - * > "0x30755ed65396facf86c53e6217c52b4daebe72aa4941d89635409de4c9c7f9466d4e9aaec7977f05e923889b33c0d0dd27d7226b6e6f56ce737465c5cfd04be400" - */ - sign(message, addressOrIndex, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return sign4(this, message, addressOrIndex, returnFormat); - }); - } - /** - * @param transaction The transaction object to sign. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) Specifies how the return data should be formatted. - * @returns {@link SignedTransactionInfoAPI}, an object containing the [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/#top) encoded signed transaction (accessed via the `raw` property) and the signed transaction object (accessed via the `tx` property). - * - * ```ts - * const transaction = { - * from: '0xe899f0130FD099c0b896B2cE4E5E15A25b23139a', - * to: '0xe899f0130FD099c0b896B2cE4E5E15A25b23139a', - * value: '0x1', - * gas: '21000', - * gasPrice: await web3Eth.getGasPrice(), - * nonce: '0x1', - * type: '0x0' - * } - * - * web3.eth.signTransaction(transaction).then(console.log); - * > { - * raw: '0xf86501843b9aca0182520894e899f0130fd099c0b896b2ce4e5e15a25b23139a0180820a96a0adb3468dbb4dce89fe1785ea9182e85fb56b399b378f82b93af7a8a12a4f9679a027d37d736e9bcf00121f78b2d10e4404fa5c45856d62b746574345f5cd278097', - * tx: { - * type: 0n, - * nonce: 1n, - * gasPrice: 1000000001n, - * gas: 21000n, - * value: 1n, - * v: 2710n, - * r: '0xadb3468dbb4dce89fe1785ea9182e85fb56b399b378f82b93af7a8a12a4f9679', - * s: '0x27d37d736e9bcf00121f78b2d10e4404fa5c45856d62b746574345f5cd278097', - * to: '0xe899f0130fd099c0b896b2ce4e5e15a25b23139a', - * data: '0x' - * } - * } - * - * web3.eth.signTransaction(transaction, { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }).then(console.log); - * > { - * raw: '0xf86501843b9aca0182520894e899f0130fd099c0b896b2ce4e5e15a25b23139a0180820a96a0adb3468dbb4dce89fe1785ea9182e85fb56b399b378f82b93af7a8a12a4f9679a027d37d736e9bcf00121f78b2d10e4404fa5c45856d62b746574345f5cd278097', - * tx: { - * type: 0, - * nonce: 1, - * gasPrice: 1000000001, - * gas: 21000, - * value: 1, - * v: 2710, - * r: '0xadb3468dbb4dce89fe1785ea9182e85fb56b399b378f82b93af7a8a12a4f9679', - * s: '0x27d37d736e9bcf00121f78b2d10e4404fa5c45856d62b746574345f5cd278097', - * to: '0xe899f0130fd099c0b896b2ce4e5e15a25b23139a', - * data: '0x' - * } - * } - * ``` - */ - signTransaction(transaction, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return signTransaction4(this, transaction, returnFormat); - }); - } - // TODO Decide what to do with transaction.to - // https://github.com/ChainSafe/web3.js/pull/4525#issuecomment-982330076 - /** - * Executes a message call within the EVM without creating a transaction. - * It does not publish anything to the blockchain and does not consume any gas. - * - * @param transaction - A transaction object where all properties are optional except `to`, however it's recommended to include the `from` property or it may default to `0x0000000000000000000000000000000000000000` depending on your node or provider. - * @param blockNumber ({@link BlockNumberOrTag} defaults to {@link Web3Eth.defaultBlock}) - Specifies what block to use as the current state of the blockchain while processing the transaction. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) - Specifies how the return data from the call should be formatted. - * @returns The returned data of the call, e.g. a smart contract function's return value. - */ - call(transaction, blockNumber = this.defaultBlock, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return call2(this, transaction, blockNumber, returnFormat); - }); - } - /** - * Simulates the transaction within the EVM to estimate the amount of gas to be used by the transaction. - * The transaction will not be added to the blockchain, and actual gas usage can vary when interacting - * with a contract as a result of updating the contract's state. - * - * @param transaction The {@link Transaction} object to estimate the gas for. - * @param blockNumber ({@link BlockNumberOrTag} defaults to {@link Web3Eth.defaultBlock}) - Specifies what block to use as the current state of the blockchain while processing the gas estimation. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) - Specifies how the return data from the call should be formatted. - * @returns The used gas for the simulated transaction execution. - * - * ```ts - * const transaction = { - * from: '0xe899f0130FD099c0b896B2cE4E5E15A25b23139a', - * to: '0xe899f0130FD099c0b896B2cE4E5E15A25b23139a', - * value: '0x1', - * nonce: '0x1', - * type: '0x0' - * } - * - * web3.eth.estimateGas(transaction).then(console.log); - * > 21000n - * - * web3.eth.estimateGas(transaction, { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }).then(console.log); - * > 21000 - * ``` - */ - estimateGas(transaction, blockNumber = this.defaultBlock, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return estimateGas2(this, transaction, blockNumber, returnFormat); - }); - } - /** - * Gets past logs, matching the provided `filter`. - * - * @param filter A {@link Filter} object containing the properties for the desired logs. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) - Specifies how the return data from the call should be formatted. - * @returns {@link FilterResultsAPI}, an array of {@link Log} objects. - * - * ```ts - * web3.eth.getPastLogs({ - * address: "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe", - * topics: ["0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234"] - * }).then(console.log); - * > [{ - * data: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385', - * topics: ['0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7', '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385'] - * logIndex: 0n, - * transactionIndex: 0n, - * transactionHash: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385', - * blockHash: '0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7', - * blockNumber: 1234n, - * address: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe' - * }, - * {...}] - * - * web3.eth.getPastLogs( - * { - * address: "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe", - * topics: ["0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234"] - * }, - * { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX } - * ).then(console.log); - * > [{ - * data: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385', - * topics: ['0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7', '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385'] - * logIndex: 0, - * transactionIndex: 0, - * transactionHash: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385', - * blockHash: '0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7', - * blockNumber: 1234, - * address: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe' - * }, - * {...}] - * ``` - */ - getPastLogs(filter, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return getLogs2(this, filter, returnFormat); - }); - } - /** - * Gets work for miners to mine on. Returns the hash of the current block, the seedHash, and the boundary condition to be met ('target'). - * - * @returns The mining work as an array of strings with the following structure: - * - * String 32 Bytes - at index 0: current block header pow-hash - * String 32 Bytes - at index 1: the seed hash used for the DAG. - * String 32 Bytes - at index 2: the boundary condition ('target'), 2^256 / difficulty. - * - * ```ts - * web3.eth.getWork().then(console.log); - * > [ - * "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", - * "0x5EED00000000000000000000000000005EED0000000000000000000000000000", - * "0xd1ff1c01710000000000000000000000d1ff1c01710000000000000000000000" - * ] - * ``` - */ - getWork() { - return __awaiter31(this, void 0, void 0, function* () { - return eth_rpc_methods_exports.getWork(this.requestManager); - }); - } - /** - * Used for submitting a proof-of-work solution. - * - * @param nonce The nonce found (8 bytes). - * @param hash The header’s pow-hash (32 bytes). - * @param digest The mix digest (32 bytes). - * @returns Returns `true` if the provided solution is valid, otherwise `false`. - * - * ```ts - * web3.eth.submitWork([ - * "0x0000000000000001", - * "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", - * "0xD1FE5700000000000000000000000000D1FE5700000000000000000000000000" - * ]).then(console.log); - * > true - * ``` - */ - submitWork(nonce, hash2, digest) { - return __awaiter31(this, void 0, void 0, function* () { - return eth_rpc_methods_exports.submitWork(this.requestManager, nonce, hash2, digest); - }); - } - // TODO - Format addresses - /** - * This method will request/enable the accounts from the current environment and for supporting [EIP 1102](https://eips.ethereum.org/EIPS/eip-1102) - * This method will only work if you’re using the injected provider from a application like Metamask, Status or TrustWallet. - * It doesn’t work if you’re connected to a node with a default Web3.js provider (WebsocketProvider, HttpProvider and IpcProvider). - * For more information about the behavior of this method please read [EIP-1102](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1102.md): Opt-in account exposure. - * - * @returns An array of enabled accounts. - * - * ```ts - * web3.eth.requestAccounts().then(console.log); - * > ['0aae0B295369a9FD31d5F28D9Ec85E40f4cb692BAf', '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'] - * ``` - */ - requestAccounts() { - return __awaiter31(this, void 0, void 0, function* () { - return eth_rpc_methods_exports.requestAccounts(this.requestManager); - }); - } - /** - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) - Specifies how the return data from the call should be formatted. - * @returns The chain ID of the current connected node as described in the [EIP-695](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-695.md). - * - * ```ts - * web3.eth.getChainId().then(console.log); - * > 61n - * - * web3.eth.getChainId({ number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }).then(console.log); - * > 61 - * ``` - */ - getChainId(returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return getChainId2(this, returnFormat); - }); - } - /** - * @returns The current client version. - * - * ```ts - * web3.eth.getNodeInfo().then(console.log); - * > "Mist/v0.9.3/darwin/go1.4.1" - * ``` - */ - getNodeInfo() { - return __awaiter31(this, void 0, void 0, function* () { - return eth_rpc_methods_exports.getNodeInfo(this.requestManager); - }); - } - /** - * @param address The Address of the account or contract. - * @param storageKeys Array of storage-keys which should be proofed and included. See {@link web3.getStorageAt}. - * @param blockNumber ({@link BlockNumberOrTag} defaults to {@link Web3Eth.defaultBlock}) - Specifies what block to use as the current state of the blockchain while processing the gas estimation. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) - Specifies how the return data from the call should be formatted. - * @returns The account and storage-values of the specified account including the Merkle-proof as described in [EIP-1186](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1186.md). - * - * ```ts - * web3.eth.getProof( - * "0x1234567890123456789012345678901234567890", - * ["0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000001"], - * "latest" - * ).then(console.log); - * > { - * "address": "0x1234567890123456789012345678901234567890", - * "accountProof": [ - * "0xf90211a090dcaf88c40c7bbc95a912cbdde67c175767b31173df9ee4b0d733bfdd511c43a0babe369f6b12092f49181ae04ca173fb68d1a5456f18d20fa32cba73954052bda0473ecf8a7e36a829e75039a3b055e51b8332cbf03324ab4af2066bbd6fbf0021a0bbda34753d7aa6c38e603f360244e8f59611921d9e1f128372fec0d586d4f9e0a04e44caecff45c9891f74f6a2156735886eedf6f1a733628ebc802ec79d844648a0a5f3f2f7542148c973977c8a1e154c4300fec92f755f7846f1b734d3ab1d90e7a0e823850f50bf72baae9d1733a36a444ab65d0a6faaba404f0583ce0ca4dad92da0f7a00cbe7d4b30b11faea3ae61b7f1f2b315b61d9f6bd68bfe587ad0eeceb721a07117ef9fc932f1a88e908eaead8565c19b5645dc9e5b1b6e841c5edbdfd71681a069eb2de283f32c11f859d7bcf93da23990d3e662935ed4d6b39ce3673ec84472a0203d26456312bbc4da5cd293b75b840fc5045e493d6f904d180823ec22bfed8ea09287b5c21f2254af4e64fca76acc5cd87399c7f1ede818db4326c98ce2dc2208a06fc2d754e304c48ce6a517753c62b1a9c1d5925b89707486d7fc08919e0a94eca07b1c54f15e299bd58bdfef9741538c7828b5d7d11a489f9c20d052b3471df475a051f9dd3739a927c89e357580a4c97b40234aa01ed3d5e0390dc982a7975880a0a089d613f26159af43616fd9455bb461f4869bfede26f2130835ed067a8b967bfb80", - * "0xf90211a0395d87a95873cd98c21cf1df9421af03f7247880a2554e20738eec2c7507a494a0bcf6546339a1e7e14eb8fb572a968d217d2a0d1f3bc4257b22ef5333e9e4433ca012ae12498af8b2752c99efce07f3feef8ec910493be749acd63822c3558e6671a0dbf51303afdc36fc0c2d68a9bb05dab4f4917e7531e4a37ab0a153472d1b86e2a0ae90b50f067d9a2244e3d975233c0a0558c39ee152969f6678790abf773a9621a01d65cd682cc1be7c5e38d8da5c942e0a73eeaef10f387340a40a106699d494c3a06163b53d956c55544390c13634ea9aa75309f4fd866f312586942daf0f60fb37a058a52c1e858b1382a8893eb9c1f111f266eb9e21e6137aff0dddea243a567000a037b4b100761e02de63ea5f1fcfcf43e81a372dafb4419d126342136d329b7a7ba032472415864b08f808ba4374092003c8d7c40a9f7f9fe9cc8291f62538e1cc14a074e238ff5ec96b810364515551344100138916594d6af966170ff326a092fab0a0d31ac4eef14a79845200a496662e92186ca8b55e29ed0f9f59dbc6b521b116fea090607784fe738458b63c1942bba7c0321ae77e18df4961b2bc66727ea996464ea078f757653c1b63f72aff3dcc3f2a2e4c8cb4a9d36d1117c742833c84e20de994a0f78407de07f4b4cb4f899dfb95eedeb4049aeb5fc1635d65cf2f2f4dfd25d1d7a0862037513ba9d45354dd3e36264aceb2b862ac79d2050f14c95657e43a51b85c80", - * "0xf90171a04ad705ea7bf04339fa36b124fa221379bd5a38ffe9a6112cb2d94be3a437b879a08e45b5f72e8149c01efcb71429841d6a8879d4bbe27335604a5bff8dfdf85dcea00313d9b2f7c03733d6549ea3b810e5262ed844ea12f70993d87d3e0f04e3979ea0b59e3cdd6750fa8b15164612a5cb6567cdfb386d4e0137fccee5f35ab55d0efda0fe6db56e42f2057a071c980a778d9a0b61038f269dd74a0e90155b3f40f14364a08538587f2378a0849f9608942cf481da4120c360f8391bbcc225d811823c6432a026eac94e755534e16f9552e73025d6d9c30d1d7682a4cb5bd7741ddabfd48c50a041557da9a74ca68da793e743e81e2029b2835e1cc16e9e25bd0c1e89d4ccad6980a041dda0a40a21ade3a20fcd1a4abb2a42b74e9a32b02424ff8db4ea708a5e0fb9a09aaf8326a51f613607a8685f57458329b41e938bb761131a5747e066b81a0a16808080a022e6cef138e16d2272ef58434ddf49260dc1de1f8ad6dfca3da5d2a92aaaadc58080", - * "0xf851808080a009833150c367df138f1538689984b8a84fc55692d3d41fe4d1e5720ff5483a6980808080808080808080a0a319c1c415b271afc0adcb664e67738d103ac168e0bc0b7bd2da7966165cb9518080" - * ], - * "balance": 0n, - * "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", - * "nonce": 0n, - * "storageHash": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - * "storageProof": [ - * { - * "key": "0x0000000000000000000000000000000000000000000000000000000000000000", - * "value": 0n, - * "proof": [] - * }, - * { - * "key": "0x0000000000000000000000000000000000000000000000000000000000000001", - * "value": 0n, - * "proof": [] - * } - * ] - * } - * - * web3.eth.getProof( - * "0x1234567890123456789012345678901234567890", - * ["0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000001"], - * undefined, - * { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX } - * ).then(console.log); - * > { - * "address": "0x1234567890123456789012345678901234567890", - * "accountProof": [ - * "0xf90211a090dcaf88c40c7bbc95a912cbdde67c175767b31173df9ee4b0d733bfdd511c43a0babe369f6b12092f49181ae04ca173fb68d1a5456f18d20fa32cba73954052bda0473ecf8a7e36a829e75039a3b055e51b8332cbf03324ab4af2066bbd6fbf0021a0bbda34753d7aa6c38e603f360244e8f59611921d9e1f128372fec0d586d4f9e0a04e44caecff45c9891f74f6a2156735886eedf6f1a733628ebc802ec79d844648a0a5f3f2f7542148c973977c8a1e154c4300fec92f755f7846f1b734d3ab1d90e7a0e823850f50bf72baae9d1733a36a444ab65d0a6faaba404f0583ce0ca4dad92da0f7a00cbe7d4b30b11faea3ae61b7f1f2b315b61d9f6bd68bfe587ad0eeceb721a07117ef9fc932f1a88e908eaead8565c19b5645dc9e5b1b6e841c5edbdfd71681a069eb2de283f32c11f859d7bcf93da23990d3e662935ed4d6b39ce3673ec84472a0203d26456312bbc4da5cd293b75b840fc5045e493d6f904d180823ec22bfed8ea09287b5c21f2254af4e64fca76acc5cd87399c7f1ede818db4326c98ce2dc2208a06fc2d754e304c48ce6a517753c62b1a9c1d5925b89707486d7fc08919e0a94eca07b1c54f15e299bd58bdfef9741538c7828b5d7d11a489f9c20d052b3471df475a051f9dd3739a927c89e357580a4c97b40234aa01ed3d5e0390dc982a7975880a0a089d613f26159af43616fd9455bb461f4869bfede26f2130835ed067a8b967bfb80", - * "0xf90211a0395d87a95873cd98c21cf1df9421af03f7247880a2554e20738eec2c7507a494a0bcf6546339a1e7e14eb8fb572a968d217d2a0d1f3bc4257b22ef5333e9e4433ca012ae12498af8b2752c99efce07f3feef8ec910493be749acd63822c3558e6671a0dbf51303afdc36fc0c2d68a9bb05dab4f4917e7531e4a37ab0a153472d1b86e2a0ae90b50f067d9a2244e3d975233c0a0558c39ee152969f6678790abf773a9621a01d65cd682cc1be7c5e38d8da5c942e0a73eeaef10f387340a40a106699d494c3a06163b53d956c55544390c13634ea9aa75309f4fd866f312586942daf0f60fb37a058a52c1e858b1382a8893eb9c1f111f266eb9e21e6137aff0dddea243a567000a037b4b100761e02de63ea5f1fcfcf43e81a372dafb4419d126342136d329b7a7ba032472415864b08f808ba4374092003c8d7c40a9f7f9fe9cc8291f62538e1cc14a074e238ff5ec96b810364515551344100138916594d6af966170ff326a092fab0a0d31ac4eef14a79845200a496662e92186ca8b55e29ed0f9f59dbc6b521b116fea090607784fe738458b63c1942bba7c0321ae77e18df4961b2bc66727ea996464ea078f757653c1b63f72aff3dcc3f2a2e4c8cb4a9d36d1117c742833c84e20de994a0f78407de07f4b4cb4f899dfb95eedeb4049aeb5fc1635d65cf2f2f4dfd25d1d7a0862037513ba9d45354dd3e36264aceb2b862ac79d2050f14c95657e43a51b85c80", - * "0xf90171a04ad705ea7bf04339fa36b124fa221379bd5a38ffe9a6112cb2d94be3a437b879a08e45b5f72e8149c01efcb71429841d6a8879d4bbe27335604a5bff8dfdf85dcea00313d9b2f7c03733d6549ea3b810e5262ed844ea12f70993d87d3e0f04e3979ea0b59e3cdd6750fa8b15164612a5cb6567cdfb386d4e0137fccee5f35ab55d0efda0fe6db56e42f2057a071c980a778d9a0b61038f269dd74a0e90155b3f40f14364a08538587f2378a0849f9608942cf481da4120c360f8391bbcc225d811823c6432a026eac94e755534e16f9552e73025d6d9c30d1d7682a4cb5bd7741ddabfd48c50a041557da9a74ca68da793e743e81e2029b2835e1cc16e9e25bd0c1e89d4ccad6980a041dda0a40a21ade3a20fcd1a4abb2a42b74e9a32b02424ff8db4ea708a5e0fb9a09aaf8326a51f613607a8685f57458329b41e938bb761131a5747e066b81a0a16808080a022e6cef138e16d2272ef58434ddf49260dc1de1f8ad6dfca3da5d2a92aaaadc58080", - * "0xf851808080a009833150c367df138f1538689984b8a84fc55692d3d41fe4d1e5720ff5483a6980808080808080808080a0a319c1c415b271afc0adcb664e67738d103ac168e0bc0b7bd2da7966165cb9518080" - * ], - * "balance": 0, - * "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", - * "nonce": 0, - * "storageHash": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - * "storageProof": [ - * { - * "key": "0x0000000000000000000000000000000000000000000000000000000000000000", - * "value": 0, - * "proof": [] - * }, - * { - * "key": "0x0000000000000000000000000000000000000000000000000000000000000001", - * "value": 0, - * "proof": [] - * } - * ] - * } - * ``` - */ - getProof(address, storageKeys, blockNumber = this.defaultBlock, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return getProof2(this, address, storageKeys, blockNumber, returnFormat); - }); - } - // TODO Throwing an error with Geth, but not Infura - // TODO gasUsedRatio and reward not formatting - /** - * @param blockCount Number of blocks in the requested range. Between `1` and `1024` blocks can be requested in a single query. Less than requested may be returned if not all blocks are available. - * @param newestBlock Highest number block of the requested range. - * @param rewardPercentiles A monotonically increasing list of percentile values to sample from each block’s effective priority fees per gas in ascending order, weighted by gas used. Example: `['0', '25', '50', '75', '100']` or `['0', '0.5', '1', '1.5', '3', '80']` - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) - Specifies how the return data from the call should be formatted. - * @returns `baseFeePerGas` and transaction effective `priorityFeePerGas` history for the requested block range if available. - * The range between `headBlock - 4` and `headBlock` is guaranteed to be available while retrieving data from the `pending` block and older history are optional to support. - * For pre-EIP-1559 blocks the `gasPrice`s are returned as `rewards` and zeroes are returned for the `baseFeePerGas`. - * - * ```ts - * web3.eth.getFeeHistory(4, 'pending', [0, 25, 75, 100]).then(console.log); - * > { - * baseFeePerGas: [ - * 22983878621n, - * 21417903463n, - * 19989260230n, - * 17770954829n, - * 18850641304n - * ], - * gasUsedRatio: [ - * 0.22746546666666667, - * 0.2331871, - * 0.05610054885262125, - * 0.7430227268212117 - * ], - * oldestBlock: 15216343n, - * reward: [ - * [ '0x3b9aca00', '0x53724e00', '0x77359400', '0x1d92c03423' ], - * [ '0x3b9aca00', '0x3b9aca00', '0x3b9aca00', '0xee6b2800' ], - * [ '0x3b9aca00', '0x4f86a721', '0x77d9743a', '0x9502f900' ], - * [ '0xcc8ff9e', '0x53724e00', '0x77359400', '0x1ec9771bb3' ] - * ] - * } - * - * web3.eth.getFeeHistory(4, BlockTags.LATEST, [0, 25, 75, 100], { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }).then(console.log); - * > { - * baseFeePerGas: [ - * 22983878621, - * 21417903463, - * 19989260230, - * 17770954829, - * 18850641304 - * ], - * gasUsedRatio: [ - * 0.22746546666666667, - * 0.2331871, - * 0.05610054885262125, - * 0.7430227268212117 - * ], - * oldestBlock: 15216343, - * reward: [ - * [ '0x3b9aca00', '0x53724e00', '0x77359400', '0x1d92c03423' ], - * [ '0x3b9aca00', '0x3b9aca00', '0x3b9aca00', '0xee6b2800' ], - * [ '0x3b9aca00', '0x4f86a721', '0x77d9743a', '0x9502f900' ], - * [ '0xcc8ff9e', '0x53724e00', '0x77359400', '0x1ec9771bb3' ] - * ] - * } - * ``` - */ - getFeeHistory(blockCount, newestBlock = this.defaultBlock, rewardPercentiles, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return getFeeHistory2(this, blockCount, newestBlock, rewardPercentiles, returnFormat); - }); - } - /** - * This method generates an access list for a transaction. - * - * @param transaction - A transaction object where all properties are optional except `from`, however it's recommended to include the `to` property. - * @param blockNumber ({@link BlockNumberOrTag} defaults to {@link Web3Eth.defaultBlock}) - Specifies what block to use as the current state of the blockchain while processing the transaction. - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) - Specifies how the return data from the createAccessList should be formatted. - * @returns The returned data of the createAccessList, e.g. The generated access list for transaction. - * @example - * ```ts - * web3.eth.createAccessList({ - * from: '0xDe95305a63302C3aa4d3A9B42654659AeA72b694', - * data: '0x9a67c8b100000000000000000000000000000000000000000000000000000000000004d0', - * gasPrice: '0x3b9aca00', - * gas: '0x3d0900', - * to: '0x940b25304947ae863568B3804434EC77E2160b87' - * }) - * .then(console.log); - * - * > { - * "accessList": [ - * { - * "address": "0x15859bdf5aff2080a9968f6a410361e9598df62f", - * "storageKeys": [ - * "0x0000000000000000000000000000000000000000000000000000000000000000" - * ] - * } - * ], - * "gasUsed": "0x7671" - * } - * ``` - */ - createAccessList(transaction, blockNumber = this.defaultBlock, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return createAccessList2(this, transaction, blockNumber, returnFormat); - }); - } - /** - * This method sends EIP-712 typed data to the RPC provider to be signed. - * - * @param address The address that corresponds with the private key used to sign the typed data. - * @param typedData The EIP-712 typed data object. - * @param useLegacy A boolean flag determining whether the RPC call uses the legacy method `eth_signTypedData` or the newer method `eth_signTypedData_v4` - * @param returnFormat ({@link DataFormat} defaults to {@link DEFAULT_RETURN_FORMAT}) - Specifies how the signed typed data should be formatted. - * @returns The signed typed data. - */ - signTypedData(address, typedData, useLegacy = false, returnFormat = DEFAULT_RETURN_FORMAT) { - return __awaiter31(this, void 0, void 0, function* () { - return signTypedData2(this, address, typedData, useLegacy, returnFormat); - }); - } - /** - * Lets you subscribe to specific events in the blockchain. - * - * @param name - The subscription you want to subscribe to. - * @param args - Optional additional parameters, depending on the subscription type. - * @returns A subscription object of type {@link RegisteredSubscription}. The object contains: - * - subscription.id: The subscription id, used to identify and unsubscribing the subscription. - * - subscription.subscribe(): Can be used to re-subscribe with the same parameters. - * - subscription.unsubscribe(): Unsubscribes the subscription and returns TRUE in the callback if successful. - * - subscription.args: The subscription arguments, used when re-subscribing. - * - * - * You can use the subscription object to listen on: - * - * - on("data") - Fires on each incoming log with the log object as argument. - * - on("changed") - Fires on each log which was removed from the blockchain. The log will have the additional property "removed: true". - * - on("error") - Fires when an error in the subscription occurs. - * - on("connected") - Fires once after the subscription successfully connected. Returns the subscription id. - * - * @example **Subscribe to Smart Contract events** - * ```ts - * // Subscribe to `logs` - * const logSubscription = web3.eth.subscribe('logs', { - * address: '0x1234567890123456789012345678901234567890', - * topics: ['0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234'] - * }); - * logSubscription.on('data', (data: any) => console.log(data)); - * logSubscription.on('error', (error: any) => console.log(error)); - * - * ``` - * - * @example **Subscribe to new block headers** - * ```ts - * // Subscribe to `newBlockHeaders` - * const newBlocksSubscription = await web3.eth.subscribe('newBlockHeaders'); - * - * newBlocksSubscription.on('data', async blockhead => { - * console.log('New block header: ', blockhead); - * - * // You do not need the next line, if you like to keep notified for every new block - * await newBlocksSubscription.unsubscribe(); - * console.log('Unsubscribed from new block headers.'); - * }); - * newBlocksSubscription.on('error', error => - * console.log('Error when subscribing to New block header: ', error), - * ); - * ``` - * - * ### subscribe('pendingTransactions') - * - * Subscribes to incoming pending transactions. - * You can subscribe to pending transactions by calling web3.eth.subscribe('pendingTransactions'). - * - * ```ts - * (await web3.eth.subscribe('pendingTransactions')).on('data', console.log); - * ``` - * - * ### subscribe('newHeads') - * ( same as subscribe('newBlockHeaders')) - * Subscribes to incoming block headers. This can be used as timer to check for changes on the blockchain. - * - * The structure of a returned block header is {@link BlockHeaderOutput}: - * - * ```ts - * (await web3.eth.subscribe('newHeads')).on( // 'newBlockHeaders' would work as well - * 'data', - * console.log - * ); - * >{ - * parentHash: '0x9e746a1d906b299def98c75b06f714d62dacadd567c7515d76eeaa8c8074c738', - * sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', - * miner: '0x0000000000000000000000000000000000000000', - * stateRoot: '0xe0f04b04861ecfa95e82a9310d6a7ef7aef8d7417f5209c182582bfb98a8e307', - * transactionsRoot: '0x31ab4ea571a9e10d3a19aaed07d190595b1dfa34e03960c04293fec565dea536', - * logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', - * difficulty: 2n, - * number: 21n, - * gasLimit: 11738125n, - * gasUsed: 830006n, - * timestamp: 1678797237n, - * extraData: '0xd883010b02846765746888676f312e32302e31856c696e757800000000000000e0a6e93cf40e2e71a72e493272210c3f43738ccc7e7d7b14ffd51833797d896c09117e8dc4fbcbc969bd21b42e5af3e276a911524038c001b2109b63b8e0352601', - * nonce: 0n - * } - * ``` - * - * ### subscribe('syncing') - * Subscribe to syncing events. This will return `true` when the node is syncing and when it’s finished syncing will return `false`, for the `changed` event. - * - * ```ts - * (await web3.eth.subscribe('syncing')).on('changed', console.log); - * > `true` // when syncing - * - * (await web3.eth.subscribe('syncing')).on('data', console.log); - * > { - * startingBlock: 0, - * currentBlock: 0, - * highestBlock: 0, - * pulledStates: 0, - * knownStates: 0 - * } - * ``` - * - * ### subscribe('logs', options) - * Subscribes to incoming logs, filtered by the given options. If a valid numerical fromBlock options property is set, web3.js will retrieve logs beginning from this point, backfilling the response as necessary. - * - * options: You can subscribe to logs matching a given filter object, which can take the following parameters: - * - `fromBlock`: (optional, default: 'latest') Integer block number, or `'latest'` for the last mined block or `'pending'`, `'earliest'` for not yet mined transactions. - * - `address`: (optional) Contract address or a list of addresses from which logs should originate. - * - `topics`: (optional) Array of 32 Bytes DATA topics. Topics are order-dependent. Each topic can also be an array of DATA with `or` options. - * - * ```ts - * (await web3.eth.subscribe('logs', { - * address: '0xdac17f958d2ee523a2206206994597c13d831ec7', - * })).on('data', console.log); - * - * > { - * removed: false, - * logIndex: 119n, - * transactionIndex: 58n, - * transactionHash: '0x61533efa77937360215069d5d6cb0be09a22af9721e6dc3df59d957833ed8870', - * blockHash: '0xe32bb97084479d32247f66f8b46d00af2fbc3c2db2bc6e5843fe2e4d1ca9b099', - * blockNumber: 18771966n, - * address: '0xdac17f958d2ee523a2206206994597c13d831ec7', - * data: '0x00000000000000000000000000000000000000000000000000000000d88b2e40', - * topics: [ - * '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', - * '0x0000000000000000000000002fb2457f6ec1865dc0d4e7300c696b69c2a1b989', - * '0x00000000000000000000000027fd43babfbe83a81d14665b1a6fb8030a60c9b4' - * ] - * } - *``` - */ - subscribe(name2, args, returnFormat = DEFAULT_RETURN_FORMAT) { - var _a4; - return __awaiter31(this, void 0, void 0, function* () { - const subscription = yield (_a4 = this.subscriptionManager) === null || _a4 === void 0 ? void 0 : _a4.subscribe(name2, args, returnFormat); - if (subscription instanceof LogsSubscription && name2 === "logs" && typeof args === "object" && !isNullish2(args.fromBlock) && Number.isFinite(Number(args.fromBlock))) { - setImmediate(() => { - this.getPastLogs(args).then((logs) => { - for (const log of logs) { - subscription._processSubscriptionResult(log); - } - }).catch((e) => { - subscription._processSubscriptionError(e); - }); - }); - } - return subscription; - }); - } - static shouldClearSubscription({ sub }) { - return !(sub instanceof SyncingSubscription); - } - /** - * Resets subscriptions. - * - * @param notClearSyncing If `true` it keeps the `syncing` subscription. - * @returns A promise to an array of subscription ids that were cleared. - * - * ```ts - * web3.eth.clearSubscriptions().then(console.log); - * > [...] An array of subscription ids that were cleared - * ``` - */ - clearSubscriptions(notClearSyncing = false) { - var _a4; - return (_a4 = this.subscriptionManager) === null || _a4 === void 0 ? void 0 : _a4.unsubscribe( - // eslint-disable-next-line - notClearSyncing ? _Web3Eth.shouldClearSubscription : void 0 - ); - } -}; - -// node_modules/web3-eth/lib/esm/validation.js -function isBaseTransaction(value) { - if (!isNullish(value.to) && !isAddress(value.to)) - return false; - if (!isHexStrict(value.type) && !isNullish(value.type) && value.type.length !== 2) - return false; - if (!isHexStrict(value.nonce)) - return false; - if (!isHexStrict(value.gas)) - return false; - if (!isHexStrict(value.value)) - return false; - if (!isHexStrict(value.input)) - return false; - if (value.chainId && !isHexStrict(value.chainId)) - return false; - return true; -} -function isAccessListEntry(value) { - if (!isNullish(value.address) && !isAddress(value.address)) - return false; - if (!isNullish(value.storageKeys) && !value.storageKeys.every((storageKey) => isHexString32Bytes(storageKey))) - return false; - return true; -} -function isAccessList2(value) { - if (!Array.isArray(value) || !value.every((accessListEntry) => isAccessListEntry(accessListEntry))) - return false; - return true; -} -function isTransaction1559Unsigned(value) { - if (!isBaseTransaction(value)) - return false; - if (!isHexStrict(value.maxFeePerGas)) - return false; - if (!isHexStrict(value.maxPriorityFeePerGas)) - return false; - if (!isAccessList2(value.accessList)) - return false; - return true; -} -function isTransaction2930Unsigned(value) { - if (!isBaseTransaction(value)) - return false; - if (!isHexStrict(value.gasPrice)) - return false; - if (!isAccessList2(value.accessList)) - return false; - return true; -} -function isTransactionLegacyUnsigned(value) { - if (!isBaseTransaction(value)) - return false; - if (!isHexStrict(value.gasPrice)) - return false; - return true; -} -function isTransactionWithSender(value) { - if (!isAddress(value.from)) - return false; - if (!isBaseTransaction(value)) - return false; - if (!isTransaction1559Unsigned(value) && !isTransaction2930Unsigned(value) && !isTransactionLegacyUnsigned(value)) - return false; - return true; -} -function validateTransactionWithSender(value) { - if (!isTransactionWithSender(value)) - throw new InvalidTransactionWithSender(value); -} -function isTransactionCall(value) { - if (!isNullish(value.from) && !isAddress(value.from)) - return false; - if (!isAddress(value.to)) - return false; - if (!isNullish(value.gas) && !isHexStrict(value.gas)) - return false; - if (!isNullish(value.gasPrice) && !isHexStrict(value.gasPrice)) - return false; - if (!isNullish(value.value) && !isHexStrict(value.value)) - return false; - if (!isNullish(value.data) && !isHexStrict(value.data)) - return false; - if (!isNullish(value.input) && !isHexStrict(value.input)) - return false; - if (!isNullish(value.type)) - return false; - if (isTransaction1559Unsigned(value)) - return false; - if (isTransaction2930Unsigned(value)) - return false; - return true; -} -function validateTransactionCall(value) { - if (!isTransactionCall(value)) - throw new InvalidTransactionCall(value); -} -var validateCustomChainInfo = (transaction) => { - if (!isNullish(transaction.common)) { - if (isNullish(transaction.common.customChain)) - throw new MissingCustomChainError(); - if (isNullish(transaction.common.customChain.chainId)) - throw new MissingCustomChainIdError(); - if (!isNullish(transaction.chainId) && transaction.chainId !== transaction.common.customChain.chainId) - throw new ChainIdMismatchError({ - txChainId: transaction.chainId, - customChainId: transaction.common.customChain.chainId - }); - } -}; -var validateChainInfo = (transaction) => { - if (!isNullish(transaction.common) && !isNullish(transaction.chain) && !isNullish(transaction.hardfork)) { - throw new CommonOrChainAndHardforkError(); - } - if (!isNullish(transaction.chain) && isNullish(transaction.hardfork) || !isNullish(transaction.hardfork) && isNullish(transaction.chain)) - throw new MissingChainOrHardforkError({ - chain: transaction.chain, - hardfork: transaction.hardfork - }); -}; -var validateBaseChain = (transaction) => { - if (!isNullish(transaction.common)) { - if (!isNullish(transaction.common.baseChain)) { - if (!isNullish(transaction.chain) && transaction.chain !== transaction.common.baseChain) { - throw new ChainMismatchError({ - txChain: transaction.chain, - baseChain: transaction.common.baseChain - }); - } - } - } -}; -var validateHardfork = (transaction) => { - if (!isNullish(transaction.common)) { - if (!isNullish(transaction.common.hardfork)) { - if (!isNullish(transaction.hardfork) && transaction.hardfork !== transaction.common.hardfork) { - throw new HardforkMismatchError({ - txHardfork: transaction.hardfork, - commonHardfork: transaction.common.hardfork - }); - } - } - } -}; -var validateLegacyGas = (transaction) => { - if ( - // This check is verifying gas and gasPrice aren't less than 0. - isNullish(transaction.gas) || !isUInt(transaction.gas) || isNullish(transaction.gasPrice) || !isUInt(transaction.gasPrice) - ) - throw new InvalidGasOrGasPrice({ - gas: transaction.gas, - gasPrice: transaction.gasPrice - }); - if (!isNullish(transaction.maxFeePerGas) || !isNullish(transaction.maxPriorityFeePerGas)) - throw new UnsupportedFeeMarketError({ - maxFeePerGas: transaction.maxFeePerGas, - maxPriorityFeePerGas: transaction.maxPriorityFeePerGas - }); -}; -var validateFeeMarketGas = (transaction) => { - if (!isNullish(transaction.gasPrice) && transaction.type === "0x2") - throw new Eip1559GasPriceError(transaction.gasPrice); - if (transaction.type === "0x0" || transaction.type === "0x1") - throw new UnsupportedFeeMarketError({ - maxFeePerGas: transaction.maxFeePerGas, - maxPriorityFeePerGas: transaction.maxPriorityFeePerGas - }); - if (isNullish(transaction.maxFeePerGas) || !isUInt(transaction.maxFeePerGas) || isNullish(transaction.maxPriorityFeePerGas) || !isUInt(transaction.maxPriorityFeePerGas)) - throw new InvalidMaxPriorityFeePerGasOrMaxFeePerGas({ - maxPriorityFeePerGas: transaction.maxPriorityFeePerGas, - maxFeePerGas: transaction.maxFeePerGas - }); -}; -var validateGas = (transaction) => { - const gasPresent = !isNullish(transaction.gas) || !isNullish(transaction.gasLimit); - const legacyGasPresent = gasPresent && !isNullish(transaction.gasPrice); - const feeMarketGasPresent = gasPresent && !isNullish(transaction.maxPriorityFeePerGas) && !isNullish(transaction.maxFeePerGas); - if (!legacyGasPresent && !feeMarketGasPresent) - throw new MissingGasError({ - gas: transaction.gas, - gasPrice: transaction.gasPrice, - maxPriorityFeePerGas: transaction.maxPriorityFeePerGas, - maxFeePerGas: transaction.maxFeePerGas - }); - if (legacyGasPresent && feeMarketGasPresent) - throw new TransactionGasMismatchError({ - gas: transaction.gas, - gasPrice: transaction.gasPrice, - maxPriorityFeePerGas: transaction.maxPriorityFeePerGas, - maxFeePerGas: transaction.maxFeePerGas - }); - (legacyGasPresent ? validateLegacyGas : validateFeeMarketGas)(transaction); - (!isNullish(transaction.type) && transaction.type > "0x1" ? validateFeeMarketGas : validateLegacyGas)(transaction); -}; -var validateTransactionForSigning = (transaction, overrideMethod) => { - if (!isNullish(overrideMethod)) { - overrideMethod(transaction); - return; - } - if (typeof transaction !== "object" || isNullish(transaction)) - throw new InvalidTransactionObjectError(transaction); - validateCustomChainInfo(transaction); - validateChainInfo(transaction); - validateBaseChain(transaction); - validateHardfork(transaction); - const formattedTransaction = formatTransaction(transaction, ETH_DATA_FORMAT); - validateGas(formattedTransaction); - if (isNullish(formattedTransaction.nonce) || isNullish(formattedTransaction.chainId) || formattedTransaction.nonce.startsWith("-") || formattedTransaction.chainId.startsWith("-")) - throw new InvalidNonceOrChainIdError({ - nonce: transaction.nonce, - chainId: transaction.chainId - }); -}; - -// node_modules/web3-eth/lib/esm/utils/prepare_transaction_for_signing.js -var __awaiter32 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var getEthereumjsTxDataFromTransaction = (transaction) => { - var _a4, _b; - return { - nonce: transaction.nonce, - gasPrice: transaction.gasPrice, - gasLimit: (_a4 = transaction.gasLimit) !== null && _a4 !== void 0 ? _a4 : transaction.gas, - to: transaction.to, - value: transaction.value, - data: (_b = transaction.data) !== null && _b !== void 0 ? _b : transaction.input, - type: transaction.type, - chainId: transaction.chainId, - accessList: transaction.accessList, - maxPriorityFeePerGas: transaction.maxPriorityFeePerGas, - maxFeePerGas: transaction.maxFeePerGas - }; -}; -var getEthereumjsTransactionOptions = (transaction, web3Context) => { - var _a4, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t; - const hasTransactionSigningOptions = !isNullish(transaction.chain) && !isNullish(transaction.hardfork) || !isNullish(transaction.common); - let common; - if (!hasTransactionSigningOptions) { - if (web3Context.defaultCommon) { - common = Object.assign({}, web3Context.defaultCommon); - if (isNullish(common.hardfork)) - common.hardfork = (_a4 = transaction.hardfork) !== null && _a4 !== void 0 ? _a4 : web3Context.defaultHardfork; - if (isNullish(common.baseChain)) - common.baseChain = web3Context.defaultChain; - } else { - common = Common.custom({ - name: "custom-network", - chainId: toNumber(transaction.chainId), - networkId: !isNullish(transaction.networkId) ? toNumber(transaction.networkId) : void 0, - defaultHardfork: (_b = transaction.hardfork) !== null && _b !== void 0 ? _b : web3Context.defaultHardfork - }, { - baseChain: web3Context.defaultChain - }); - } - } else { - const name2 = (_f = (_e = (_d = (_c = transaction === null || transaction === void 0 ? void 0 : transaction.common) === null || _c === void 0 ? void 0 : _c.customChain) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : transaction.chain) !== null && _f !== void 0 ? _f : "custom-network"; - const chainId = toNumber((_j = (_h = (_g = transaction === null || transaction === void 0 ? void 0 : transaction.common) === null || _g === void 0 ? void 0 : _g.customChain) === null || _h === void 0 ? void 0 : _h.chainId) !== null && _j !== void 0 ? _j : transaction === null || transaction === void 0 ? void 0 : transaction.chainId); - const networkId = toNumber((_m = (_l = (_k = transaction === null || transaction === void 0 ? void 0 : transaction.common) === null || _k === void 0 ? void 0 : _k.customChain) === null || _l === void 0 ? void 0 : _l.networkId) !== null && _m !== void 0 ? _m : transaction === null || transaction === void 0 ? void 0 : transaction.networkId); - const defaultHardfork = (_q = (_p = (_o = transaction === null || transaction === void 0 ? void 0 : transaction.common) === null || _o === void 0 ? void 0 : _o.hardfork) !== null && _p !== void 0 ? _p : transaction === null || transaction === void 0 ? void 0 : transaction.hardfork) !== null && _q !== void 0 ? _q : web3Context.defaultHardfork; - const baseChain = (_t = (_s = (_r = transaction.common) === null || _r === void 0 ? void 0 : _r.baseChain) !== null && _s !== void 0 ? _s : transaction.chain) !== null && _t !== void 0 ? _t : web3Context.defaultChain; - if (chainId && networkId && name2) { - common = Common.custom({ - name: name2, - chainId, - networkId, - defaultHardfork - }, { - baseChain - }); - } - } - return { common }; -}; -var prepareTransactionForSigning = (transaction, web3Context, privateKey, fillGasPrice = false, fillGasLimit = true) => __awaiter32(void 0, void 0, void 0, function* () { - const populatedTransaction = yield transactionBuilder({ - transaction, - web3Context, - privateKey, - fillGasPrice, - fillGasLimit - }); - const formattedTransaction = formatTransaction(populatedTransaction, ETH_DATA_FORMAT); - validateTransactionForSigning(formattedTransaction); - return TransactionFactory.fromTxData(getEthereumjsTxDataFromTransaction(formattedTransaction), getEthereumjsTransactionOptions(formattedTransaction, web3Context)); -}); - -// node_modules/web3-eth-contract/lib/esm/index.js -var esm_exports13 = {}; -__export(esm_exports13, { - Contract: () => Contract, - LogsSubscription: () => LogsSubscription2, - decodeEventABI: () => decodeEventABI, - decodeMethodReturn: () => decodeMethodReturn, - default: () => esm_default3, - encodeEventABI: () => encodeEventABI, - encodeMethodABI: () => encodeMethodABI, - getCreateAccessListParams: () => getCreateAccessListParams, - getEstimateGasParams: () => getEstimateGasParams, - getEthTxCallParams: () => getEthTxCallParams, - getSendTxParams: () => getSendTxParams, - isWeb3ContractContext: () => isWeb3ContractContext -}); - -// node_modules/web3-eth-contract/lib/esm/encoding.js -var encodeEventABI = ({ address }, event, options) => { - var _a4, _b; - const topics = options === null || options === void 0 ? void 0 : options.topics; - const filter = (_a4 = options === null || options === void 0 ? void 0 : options.filter) !== null && _a4 !== void 0 ? _a4 : {}; - const opts = {}; - if (!isNullish2(options === null || options === void 0 ? void 0 : options.fromBlock)) { - opts.fromBlock = format(blockSchema.properties.number, options === null || options === void 0 ? void 0 : options.fromBlock, { - number: FMT_NUMBER.HEX, - bytes: FMT_BYTES.HEX - }); - } - if (!isNullish2(options === null || options === void 0 ? void 0 : options.toBlock)) { - opts.toBlock = format(blockSchema.properties.number, options === null || options === void 0 ? void 0 : options.toBlock, { - number: FMT_NUMBER.HEX, - bytes: FMT_BYTES.HEX - }); - } - if (topics && Array.isArray(topics)) { - opts.topics = [...topics]; - } else { - opts.topics = []; - if (event && !event.anonymous && ![ALL_EVENTS, "allEvents"].includes(event.name)) { - opts.topics.push((_b = event.signature) !== null && _b !== void 0 ? _b : encodeEventSignature(jsonInterfaceMethodToString(event))); - } - if (![ALL_EVENTS, "allEvents"].includes(event.name) && event.inputs) { - for (const input of event.inputs) { - if (!input.indexed) { - continue; - } - const value = filter[input.name]; - if (!value) { - opts.topics.push(null); - continue; - } - if (Array.isArray(value)) { - opts.topics.push(value.map((v) => encodeParameter(input.type, v))); - } else if (input.type === "string") { - opts.topics.push(keccak256Wrapper(value)); - } else { - opts.topics.push(encodeParameter(input.type, value)); - } - } - } - } - if (!opts.topics.length) - delete opts.topics; - if (address) { - opts.address = address.toLowerCase(); - } - return opts; -}; -var encodeMethodABI = (abi, args, deployData) => { - const inputLength = Array.isArray(abi.inputs) ? abi.inputs.length : 0; - if (abi.inputs && inputLength !== args.length) { - throw new Web3ContractError(`The number of arguments is not matching the methods required number. You need to pass ${inputLength} arguments.`); - } - let params; - if (abi.inputs) { - params = encodeParameters(Array.isArray(abi.inputs) ? abi.inputs : [], args).replace("0x", ""); - } else { - params = inferTypesAndEncodeParameters(args).replace("0x", ""); - } - if (isAbiConstructorFragment(abi)) { - if (!deployData) - throw new Web3ContractError("The contract has no contract data option set. This is necessary to append the constructor parameters."); - if (!deployData.startsWith("0x")) { - return `0x${deployData}${params}`; - } - return `${deployData}${params}`; - } - return `${encodeFunctionSignature(abi)}${params}`; -}; -var decodeMethodReturn = (abi, returnValues) => { - if (abi.type === "constructor") { - return returnValues; - } - if (!returnValues) { - return null; - } - const value = returnValues.length >= 2 ? returnValues.slice(2) : returnValues; - if (!abi.outputs) { - return null; - } - const result = decodeParameters2([...abi.outputs], value); - if (result.__length__ === 1) { - return result[0]; - } - return result; -}; - -// node_modules/web3-eth-contract/lib/esm/log_subscription.js -var LogsSubscription2 = class extends Web3Subscription { - constructor(args, options) { - super(args, options); - this.address = args.address; - this.topics = args.topics; - this.abi = args.abi; - this.jsonInterface = args.jsonInterface; - } - _buildSubscriptionParams() { - return ["logs", { address: this.address, topics: this.topics }]; - } - formatSubscriptionResult(data) { - return decodeEventABI(this.abi, data, this.jsonInterface, super.returnFormat); - } -}; - -// node_modules/web3-eth-contract/lib/esm/utils.js -var dataInputEncodeMethodHelper = (txParams, abi, params, dataInputFill) => { - var _a4, _b; - const tx = {}; - if (!isNullish2(txParams.data) || dataInputFill === "both") { - tx.data = encodeMethodABI(abi, params, (_a4 = txParams.data) !== null && _a4 !== void 0 ? _a4 : txParams.input); - } - if (!isNullish2(txParams.input) || dataInputFill === "both") { - tx.input = encodeMethodABI(abi, params, (_b = txParams.input) !== null && _b !== void 0 ? _b : txParams.data); - } - if (isNullish2(tx.input) && isNullish2(tx.data)) { - tx[dataInputFill] = encodeMethodABI(abi, params); - } - return { data: tx.data, input: tx.input }; -}; -var getSendTxParams = ({ abi, params, options, contractOptions }) => { - var _a4, _b, _c; - const deploymentCall = (_c = (_b = (_a4 = options === null || options === void 0 ? void 0 : options.input) !== null && _a4 !== void 0 ? _a4 : options === null || options === void 0 ? void 0 : options.data) !== null && _b !== void 0 ? _b : contractOptions.input) !== null && _c !== void 0 ? _c : contractOptions.data; - if (!deploymentCall && !(options === null || options === void 0 ? void 0 : options.to) && !contractOptions.address) { - throw new Web3ContractError("Contract address not specified"); - } - if (!(options === null || options === void 0 ? void 0 : options.from) && !contractOptions.from) { - throw new Web3ContractError('Contract "from" address not specified'); - } - let txParams = mergeDeep({ - to: contractOptions.address, - gas: contractOptions.gas, - gasPrice: contractOptions.gasPrice, - from: contractOptions.from, - input: contractOptions.input, - maxPriorityFeePerGas: contractOptions.maxPriorityFeePerGas, - maxFeePerGas: contractOptions.maxFeePerGas, - data: contractOptions.data - }, options); - const dataInput = dataInputEncodeMethodHelper(txParams, abi, params, options === null || options === void 0 ? void 0 : options.dataInputFill); - txParams = Object.assign(Object.assign({}, txParams), { data: dataInput.data, input: dataInput.input }); - return txParams; -}; -var getEthTxCallParams = ({ abi, params, options, contractOptions }) => { - if (!(options === null || options === void 0 ? void 0 : options.to) && !contractOptions.address) { - throw new Web3ContractError("Contract address not specified"); - } - let txParams = mergeDeep({ - to: contractOptions.address, - gas: contractOptions.gas, - gasPrice: contractOptions.gasPrice, - from: contractOptions.from, - input: contractOptions.input, - maxPriorityFeePerGas: contractOptions.maxPriorityFeePerGas, - maxFeePerGas: contractOptions.maxFeePerGas, - data: contractOptions.data - }, options); - const dataInput = dataInputEncodeMethodHelper(txParams, abi, params, options === null || options === void 0 ? void 0 : options.dataInputFill); - txParams = Object.assign(Object.assign({}, txParams), { data: dataInput.data, input: dataInput.input }); - return txParams; -}; -var getEstimateGasParams = ({ abi, params, options, contractOptions }) => { - let txParams = mergeDeep({ - to: contractOptions.address, - gas: contractOptions.gas, - gasPrice: contractOptions.gasPrice, - from: contractOptions.from, - input: contractOptions.input, - data: contractOptions.data - }, options); - const dataInput = dataInputEncodeMethodHelper(txParams, abi, params, options === null || options === void 0 ? void 0 : options.dataInputFill); - txParams = Object.assign(Object.assign({}, txParams), { data: dataInput.data, input: dataInput.input }); - return txParams; -}; -var isWeb3ContractContext = (options) => typeof options === "object" && !isNullish2(options) && Object.keys(options).length !== 0 && !isContractInitOptions(options); -var getCreateAccessListParams = ({ abi, params, options, contractOptions }) => { - if (!(options === null || options === void 0 ? void 0 : options.to) && !contractOptions.address) { - throw new Web3ContractError("Contract address not specified"); - } - if (!(options === null || options === void 0 ? void 0 : options.from) && !contractOptions.from) { - throw new Web3ContractError('Contract "from" address not specified'); - } - let txParams = mergeDeep({ - to: contractOptions.address, - gas: contractOptions.gas, - gasPrice: contractOptions.gasPrice, - from: contractOptions.from, - input: contractOptions.input, - maxPriorityFeePerGas: contractOptions.maxPriorityFeePerGas, - maxFeePerGas: contractOptions.maxFeePerGas, - data: contractOptions.data - }, options); - const dataInput = dataInputEncodeMethodHelper(txParams, abi, params, options === null || options === void 0 ? void 0 : options.dataInputFill); - txParams = Object.assign(Object.assign({}, txParams), { data: dataInput.data, input: dataInput.input }); - return txParams; -}; - -// node_modules/web3-eth-contract/lib/esm/contract.js -var __awaiter33 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var contractSubscriptions = { - logs: LogsSubscription2, - newHeads: NewHeadsSubscription, - newBlockHeaders: NewHeadsSubscription -}; -var Contract = class _Contract extends Web3Context { - constructor(jsonInterface, addressOrOptionsOrContext, optionsOrContextOrReturnFormat, contextOrReturnFormat, returnFormat) { - var _a4, _b, _c; - const options = isContractInitOptions(addressOrOptionsOrContext) ? addressOrOptionsOrContext : isContractInitOptions(optionsOrContextOrReturnFormat) ? optionsOrContextOrReturnFormat : void 0; - let contractContext; - if (isWeb3ContractContext(addressOrOptionsOrContext)) { - contractContext = addressOrOptionsOrContext; - } else if (isWeb3ContractContext(optionsOrContextOrReturnFormat)) { - contractContext = optionsOrContextOrReturnFormat; - } else { - contractContext = contextOrReturnFormat; - } - let provider; - if (typeof addressOrOptionsOrContext === "object" && "provider" in addressOrOptionsOrContext) { - provider = addressOrOptionsOrContext.provider; - } else if (typeof optionsOrContextOrReturnFormat === "object" && "provider" in optionsOrContextOrReturnFormat) { - provider = optionsOrContextOrReturnFormat.provider; - } else if (typeof contextOrReturnFormat === "object" && "provider" in contextOrReturnFormat) { - provider = contextOrReturnFormat.provider; - } else { - provider = _Contract.givenProvider; - } - super(Object.assign(Object.assign({}, contractContext), { provider, registeredSubscriptions: contractSubscriptions })); - this.syncWithContext = false; - this._functions = {}; - if (contractContext === null || contractContext === void 0 ? void 0 : contractContext.wallet) { - this._wallet = contractContext.wallet; - } - if (contractContext === null || contractContext === void 0 ? void 0 : contractContext.accountProvider) { - this._accountProvider = contractContext.accountProvider; - } - if (!isNullish(options) && !isNullish(options.data) && !isNullish(options.input) && this.config.contractDataInputFill !== "both") - throw new ContractTransactionDataAndInputError({ - data: options.data, - input: options.input - }); - this._overloadedMethodAbis = /* @__PURE__ */ new Map(); - const returnDataFormat = isDataFormat(contextOrReturnFormat) ? contextOrReturnFormat : isDataFormat(optionsOrContextOrReturnFormat) ? optionsOrContextOrReturnFormat : returnFormat !== null && returnFormat !== void 0 ? returnFormat : DEFAULT_RETURN_FORMAT; - const address = typeof addressOrOptionsOrContext === "string" ? addressOrOptionsOrContext : void 0; - this.config.contractDataInputFill = (_a4 = options === null || options === void 0 ? void 0 : options.dataInputFill) !== null && _a4 !== void 0 ? _a4 : this.config.contractDataInputFill; - this._parseAndSetJsonInterface(jsonInterface, returnDataFormat); - if (!isNullish(address)) { - this._parseAndSetAddress(address, returnDataFormat); - } - this.options = { - address, - jsonInterface: this._jsonInterface, - gas: (_b = options === null || options === void 0 ? void 0 : options.gas) !== null && _b !== void 0 ? _b : options === null || options === void 0 ? void 0 : options.gasLimit, - gasPrice: options === null || options === void 0 ? void 0 : options.gasPrice, - from: options === null || options === void 0 ? void 0 : options.from, - input: options === null || options === void 0 ? void 0 : options.input, - data: options === null || options === void 0 ? void 0 : options.data - }; - this.syncWithContext = (_c = options === null || options === void 0 ? void 0 : options.syncWithContext) !== null && _c !== void 0 ? _c : false; - if (contractContext instanceof Web3Context) { - this.subscribeToContextEvents(contractContext); - } - Object.defineProperty(this.options, "address", { - set: (value) => this._parseAndSetAddress(value, returnDataFormat), - get: () => this._address - }); - Object.defineProperty(this.options, "jsonInterface", { - set: (value) => this._parseAndSetJsonInterface(value, returnDataFormat), - get: () => this._jsonInterface - }); - if (contractContext instanceof Web3Context) { - contractContext.on(Web3ConfigEvent.CONFIG_CHANGE, (event) => { - this.setConfig({ [event.name]: event.newValue }); - }); - } - } - /** - * Subscribe to an event. - * - * ```ts - * await myContract.events.MyEvent([options]) - * ``` - * - * There is a special event `allEvents` that can be used to subscribe all events. - * - * ```ts - * await myContract.events.allEvents([options]) - * ``` - * - * @returns - When individual event is accessed will returns {@link ContractBoundEvent} object - */ - get events() { - return this._events; - } - /** - * Creates a transaction object for that method, which then can be `called`, `send`, `estimated`, `createAccessList` , or `ABI encoded`. - * - * The methods of this smart contract are available through: - * - * The name: `myContract.methods.myMethod(123)` - * The name with parameters: `myContract.methods['myMethod(uint256)'](123)` - * The signature `myContract.methods['0x58cf5f10'](123)` - * - * This allows calling functions with same name but different parameters from the JavaScript contract object. - * - * \> The method signature does not provide a type safe interface, so we recommend to use method `name` instead. - * - * ```ts - * // calling a method - * const result = await myContract.methods.myMethod(123).call({from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'}); - * - * // or sending and using a promise - * const receipt = await myContract.methods.myMethod(123).send({from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'}); - * - * // or sending and using the events - * const sendObject = myContract.methods.myMethod(123).send({from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'}); - * sendObject.on('transactionHash', function(hash){ - * ... - * }); - * sendObject.on('receipt', function(receipt){ - * ... - * }); - * sendObject.on('confirmation', function(confirmationNumber, receipt){ - * ... - * }); - * sendObject.on('error', function(error, receipt) { - * ... - * }); - * ``` - * - * @returns - Either returns {@link PayableMethodObject} or {@link NonPayableMethodObject} based on the definitions of the ABI of that contract. - */ - get methods() { - return this._methods; - } - /** - * Clones the current contract instance. This doesn't deploy contract on blockchain and only creates a local clone. - * - * @returns - The new contract instance. - * - * ```ts - * const contract1 = new web3.eth.Contract(abi, address, {gasPrice: '12345678', from: fromAddress}); - * - * const contract2 = contract1.clone(); - * contract2.options.address = '0xdAC17F958D2ee523a2206206994597C13D831ec7'; - * - * (contract1.options.address !== contract2.options.address); - * > true - * ``` - */ - clone() { - let newContract; - if (this.options.address) { - newContract = new _Contract([...this._jsonInterface, ...this._errorsInterface], this.options.address, { - gas: this.options.gas, - gasPrice: this.options.gasPrice, - from: this.options.from, - input: this.options.input, - data: this.options.data, - provider: this.currentProvider, - syncWithContext: this.syncWithContext, - dataInputFill: this.config.contractDataInputFill - }, this.getContextObject()); - } else { - newContract = new _Contract([...this._jsonInterface, ...this._errorsInterface], { - gas: this.options.gas, - gasPrice: this.options.gasPrice, - from: this.options.from, - input: this.options.input, - data: this.options.data, - provider: this.currentProvider, - syncWithContext: this.syncWithContext, - dataInputFill: this.config.contractDataInputFill - }, this.getContextObject()); - } - if (this.context) - newContract.subscribeToContextEvents(this.context); - return newContract; - } - /** - * Call this function to deploy the contract to the blockchain. After successful deployment the promise will resolve with a new contract instance. - * - * ```ts - * myContract.deploy({ - * input: '0x12345...', // data keyword can be used, too. - * arguments: [123, 'My String'] - * }) - * .send({ - * from: '0x1234567890123456789012345678901234567891', - * gas: 1500000, - * gasPrice: '30000000000000' - * }, function(error, transactionHash){ ... }) - * .on('error', function(error){ ... }) - * .on('transactionHash', function(transactionHash){ ... }) - * .on('receipt', function(receipt){ - * console.log(receipt.contractAddress) // contains the new contract address - * }) - * .on('confirmation', function(confirmationNumber, receipt){ ... }) - * .then(function(newContractInstance){ - * console.log(newContractInstance.options.address) // instance with the new contract address - * }); - * - * - * // When the data is already set as an option to the contract itself - * myContract.options.data = '0x12345...'; - * - * myContract.deploy({ - * arguments: [123, 'My String'] - * }) - * .send({ - * from: '0x1234567890123456789012345678901234567891', - * gas: 1500000, - * gasPrice: '30000000000000' - * }) - * .then(function(newContractInstance){ - * console.log(newContractInstance.options.address) // instance with the new contract address - * }); - * - * - * // Simply encoding - * myContract.deploy({ - * input: '0x12345...', - * arguments: [123, 'My String'] - * }) - * .encodeABI(); - * > '0x12345...0000012345678765432' - * - * - * // Gas estimation - * myContract.deploy({ - * input: '0x12345...', - * arguments: [123, 'My String'] - * }) - * .estimateGas(function(err, gas){ - * console.log(gas); - * }); - * ``` - * - * @returns - The transaction object - */ - deploy(deployOptions) { - var _a4, _b, _c; - let abi = this._jsonInterface.find((j) => j.type === "constructor"); - if (!abi) { - abi = { - type: "constructor", - stateMutability: "" - }; - } - const _input = format({ format: "bytes" }, (_a4 = deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.input) !== null && _a4 !== void 0 ? _a4 : this.options.input, DEFAULT_RETURN_FORMAT); - const _data = format({ format: "bytes" }, (_b = deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.data) !== null && _b !== void 0 ? _b : this.options.data, DEFAULT_RETURN_FORMAT); - if ((!_input || _input.trim() === "0x") && (!_data || _data.trim() === "0x")) { - throw new Web3ContractError("contract creation without any data provided."); - } - const args = (_c = deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.arguments) !== null && _c !== void 0 ? _c : []; - const contractOptions = Object.assign(Object.assign({}, this.options), { input: _input, data: _data }); - const deployData = _input !== null && _input !== void 0 ? _input : _data; - return { - arguments: args, - send: (options) => { - const modifiedOptions = Object.assign({}, options); - return this._contractMethodDeploySend(abi, args, modifiedOptions, contractOptions); - }, - estimateGas: (options, returnFormat = DEFAULT_RETURN_FORMAT) => __awaiter33(this, void 0, void 0, function* () { - const modifiedOptions = Object.assign({}, options); - return this._contractMethodEstimateGas({ - abi, - params: args, - returnFormat, - options: modifiedOptions, - contractOptions - }); - }), - encodeABI: () => encodeMethodABI(abi, args, format({ format: "bytes" }, deployData, DEFAULT_RETURN_FORMAT)) - }; - } - getPastEvents(param1, param2, param3) { - var _a4; - return __awaiter33(this, void 0, void 0, function* () { - const eventName = typeof param1 === "string" ? param1 : ALL_EVENTS; - const options = ( - // eslint-disable-next-line no-nested-ternary - typeof param1 !== "string" && !isDataFormat(param1) ? param1 : !isDataFormat(param2) ? param2 : {} - ); - const returnFormat = isDataFormat(param1) ? param1 : isDataFormat(param2) ? param2 : param3 !== null && param3 !== void 0 ? param3 : DEFAULT_RETURN_FORMAT; - const abi = eventName === "allEvents" || eventName === ALL_EVENTS ? ALL_EVENTS_ABI : this._jsonInterface.find((j) => "name" in j && j.name === eventName); - if (!abi) { - throw new Web3ContractError(`Event ${eventName} not found.`); - } - const { fromBlock, toBlock, topics, address } = encodeEventABI(this.options, abi, options !== null && options !== void 0 ? options : {}); - const logs = yield getLogs2(this, { fromBlock, toBlock, topics, address }, returnFormat); - const decodedLogs = logs ? logs.map((log) => typeof log === "string" ? log : decodeEventABI(abi, log, this._jsonInterface, returnFormat)) : []; - const filter = (_a4 = options === null || options === void 0 ? void 0 : options.filter) !== null && _a4 !== void 0 ? _a4 : {}; - const filterKeys = Object.keys(filter); - if (filterKeys.length > 0) { - return decodedLogs.filter((log) => { - if (typeof log === "string") - return true; - return filterKeys.every((key) => { - var _a5; - if (Array.isArray(filter[key])) { - return filter[key].some((v) => String(log.returnValues[key]).toUpperCase() === String(v).toUpperCase()); - } - const inputAbi = (_a5 = abi.inputs) === null || _a5 === void 0 ? void 0 : _a5.filter((input) => input.name === key)[0]; - if ((inputAbi === null || inputAbi === void 0 ? void 0 : inputAbi.indexed) && inputAbi.type === "string") { - const hashedIndexedString = keccak256Wrapper(filter[key]); - if (hashedIndexedString === String(log.returnValues[key])) - return true; - } - return String(log.returnValues[key]).toUpperCase() === String(filter[key]).toUpperCase(); - }); - }); - } - return decodedLogs; - }); - } - _parseAndSetAddress(value, returnFormat = DEFAULT_RETURN_FORMAT) { - this._address = value ? toChecksumAddress(format({ format: "address" }, value, returnFormat)) : value; - } - _parseAndSetJsonInterface(abis, returnFormat = DEFAULT_RETURN_FORMAT) { - var _a4, _b, _c, _d, _e; - this._functions = {}; - this._methods = {}; - this._events = {}; - let result = []; - const functionsAbi = abis.filter((abi) => abi.type !== "error"); - const errorsAbi = abis.filter((abi) => isAbiErrorFragment(abi)); - for (const a of functionsAbi) { - const abi = Object.assign(Object.assign({}, a), { signature: "" }); - if (isAbiFunctionFragment(abi)) { - const methodName = jsonInterfaceMethodToString(abi); - const methodSignature = encodeFunctionSignature(methodName); - abi.signature = methodSignature; - abi.constant = (_b = (_a4 = abi.stateMutability === "view") !== null && _a4 !== void 0 ? _a4 : abi.stateMutability === "pure") !== null && _b !== void 0 ? _b : abi.constant; - abi.payable = (_c = abi.stateMutability === "payable") !== null && _c !== void 0 ? _c : abi.payable; - this._overloadedMethodAbis.set(abi.name, [ - ...(_d = this._overloadedMethodAbis.get(abi.name)) !== null && _d !== void 0 ? _d : [], - abi - ]); - const abiFragment = (_e = this._overloadedMethodAbis.get(abi.name)) !== null && _e !== void 0 ? _e : []; - const contractMethod = this._createContractMethod(abiFragment, errorsAbi); - this._functions[methodName] = { - signature: methodSignature, - method: contractMethod - }; - this._methods[abi.name] = this._functions[methodName].method; - this._methods[methodName] = this._functions[methodName].method; - this._methods[methodSignature] = this._functions[methodName].method; - } else if (isAbiEventFragment(abi)) { - const eventName = jsonInterfaceMethodToString(abi); - const eventSignature = encodeEventSignature(eventName); - const event = this._createContractEvent(abi, returnFormat); - abi.signature = eventSignature; - if (!(eventName in this._events) || abi.name === "bound") { - this._events[eventName] = event; - } - this._events[abi.name] = event; - this._events[eventSignature] = event; - } - result = [...result, abi]; - } - this._events.allEvents = this._createContractEvent(ALL_EVENTS_ABI, returnFormat); - this._jsonInterface = [...result]; - this._errorsInterface = errorsAbi; - } - // eslint-disable-next-line class-methods-use-this - _getAbiParams(abi, params) { - var _a4; - try { - return utils_exports.transformJsonDataToAbiFormat((_a4 = abi.inputs) !== null && _a4 !== void 0 ? _a4 : [], params); - } catch (error) { - throw new Web3ContractError(`Invalid parameters for method ${abi.name}: ${error.message}`); - } - } - _createContractMethod(abiArr, errorsAbis) { - const abi = abiArr[abiArr.length - 1]; - return (...params) => { - var _a4, _b; - let abiParams; - const abis = (_a4 = this._overloadedMethodAbis.get(abi.name)) !== null && _a4 !== void 0 ? _a4 : []; - let methodAbi = abis[0]; - const internalErrorsAbis = errorsAbis; - const arrayOfAbis = abis.filter((_abi) => { - var _a5; - return ((_a5 = _abi.inputs) !== null && _a5 !== void 0 ? _a5 : []).length === params.length; - }); - if (abis.length === 1 || arrayOfAbis.length === 0) { - abiParams = this._getAbiParams(methodAbi, params); - validator.validate((_b = abi.inputs) !== null && _b !== void 0 ? _b : [], abiParams); - } else { - const errors = []; - for (const _abi of arrayOfAbis) { - try { - abiParams = this._getAbiParams(_abi, params); - validator.validate(_abi.inputs, abiParams); - methodAbi = _abi; - break; - } catch (e) { - errors.push(e); - } - } - if (errors.length === arrayOfAbis.length) { - throw new Web3ValidatorError(errors); - } - } - const methods = { - arguments: abiParams, - call: (options, block) => __awaiter33(this, void 0, void 0, function* () { - return this._contractMethodCall(methodAbi, abiParams, internalErrorsAbis, options, block); - }), - send: (options) => this._contractMethodSend(methodAbi, abiParams, internalErrorsAbis, options), - estimateGas: (options, returnFormat = DEFAULT_RETURN_FORMAT) => __awaiter33(this, void 0, void 0, function* () { - return this._contractMethodEstimateGas({ - abi: methodAbi, - params: abiParams, - returnFormat, - options - }); - }), - encodeABI: () => encodeMethodABI(methodAbi, abiParams), - createAccessList: (options, block) => __awaiter33(this, void 0, void 0, function* () { - return this._contractMethodCreateAccessList(methodAbi, abiParams, internalErrorsAbis, options, block); - }) - }; - if (methodAbi.stateMutability === "payable") { - return methods; - } - return methods; - }; - } - _contractMethodCall(abi, params, errorsAbi, options, block) { - var _a4; - return __awaiter33(this, void 0, void 0, function* () { - const tx = getEthTxCallParams({ - abi, - params, - options: Object.assign(Object.assign({}, options), { dataInputFill: this.config.contractDataInputFill }), - contractOptions: Object.assign(Object.assign({}, this.options), { from: (_a4 = this.options.from) !== null && _a4 !== void 0 ? _a4 : this.config.defaultAccount }) - }); - try { - const result = yield call2(this, tx, block, DEFAULT_RETURN_FORMAT); - return decodeMethodReturn(abi, result); - } catch (error) { - if (error instanceof ContractExecutionError) { - decodeContractErrorData(errorsAbi, error.cause); - } - throw error; - } - }); - } - _contractMethodCreateAccessList(abi, params, errorsAbi, options, block) { - var _a4; - return __awaiter33(this, void 0, void 0, function* () { - const tx = getCreateAccessListParams({ - abi, - params, - options: Object.assign(Object.assign({}, options), { dataInputFill: this.config.contractDataInputFill }), - contractOptions: Object.assign(Object.assign({}, this.options), { from: (_a4 = this.options.from) !== null && _a4 !== void 0 ? _a4 : this.config.defaultAccount }) - }); - try { - return createAccessList2(this, tx, block, DEFAULT_RETURN_FORMAT); - } catch (error) { - if (error instanceof ContractExecutionError) { - decodeContractErrorData(errorsAbi, error.cause); - } - throw error; - } - }); - } - _contractMethodSend(abi, params, errorsAbi, options, contractOptions) { - var _a4, _b; - let modifiedContractOptions = contractOptions !== null && contractOptions !== void 0 ? contractOptions : this.options; - modifiedContractOptions = Object.assign(Object.assign({}, modifiedContractOptions), { input: void 0, from: (_b = (_a4 = modifiedContractOptions.from) !== null && _a4 !== void 0 ? _a4 : this.defaultAccount) !== null && _b !== void 0 ? _b : void 0 }); - const tx = getSendTxParams({ - abi, - params, - options: Object.assign(Object.assign({}, options), { dataInputFill: this.config.contractDataInputFill }), - contractOptions: modifiedContractOptions - }); - const transactionToSend = sendTransaction3(this, tx, DEFAULT_RETURN_FORMAT, { - // TODO Should make this configurable by the user - checkRevertBeforeSending: false, - contractAbi: this._jsonInterface - }); - void transactionToSend.on("error", (error) => { - if (error instanceof ContractExecutionError) { - decodeContractErrorData(errorsAbi, error.cause); - } - }); - return transactionToSend; - } - _contractMethodDeploySend(abi, params, options, contractOptions) { - var _a4, _b; - let modifiedContractOptions = contractOptions !== null && contractOptions !== void 0 ? contractOptions : this.options; - modifiedContractOptions = Object.assign(Object.assign({}, modifiedContractOptions), { from: (_b = (_a4 = modifiedContractOptions.from) !== null && _a4 !== void 0 ? _a4 : this.defaultAccount) !== null && _b !== void 0 ? _b : void 0 }); - const tx = getSendTxParams({ - abi, - params, - options: Object.assign(Object.assign({}, options), { dataInputFill: this.config.contractDataInputFill }), - contractOptions: modifiedContractOptions - }); - return sendTransaction3(this, tx, DEFAULT_RETURN_FORMAT, { - transactionResolver: (receipt) => { - if (receipt.status === BigInt(0)) { - throw new Web3ContractError("code couldn't be stored", receipt); - } - const newContract = this.clone(); - newContract.options.address = receipt.contractAddress; - return newContract; - }, - contractAbi: this._jsonInterface, - // TODO Should make this configurable by the user - checkRevertBeforeSending: false - }); - } - _contractMethodEstimateGas({ abi, params, returnFormat, options, contractOptions }) { - return __awaiter33(this, void 0, void 0, function* () { - const tx = getEstimateGasParams({ - abi, - params, - options: Object.assign(Object.assign({}, options), { dataInputFill: this.config.contractDataInputFill }), - contractOptions: contractOptions !== null && contractOptions !== void 0 ? contractOptions : this.options - }); - return estimateGas2(this, tx, BlockTags.LATEST, returnFormat); - }); - } - // eslint-disable-next-line class-methods-use-this - _createContractEvent(abi, returnFormat = DEFAULT_RETURN_FORMAT) { - return (...params) => { - var _a4; - const { topics, fromBlock } = encodeEventABI(this.options, abi, params[0]); - const sub = new LogsSubscription2({ - address: this.options.address, - topics, - abi, - jsonInterface: this._jsonInterface - }, { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - subscriptionManager: this.subscriptionManager, - returnFormat - }); - if (!isNullish(fromBlock)) { - this.getPastEvents(abi.name, { fromBlock, topics }, returnFormat).then((logs) => { - if (logs) { - logs.forEach((log) => sub.emit("data", log)); - } - }).catch((error) => { - sub.emit("error", new SubscriptionError("Failed to get past events.", error)); - }); - } - (_a4 = this.subscriptionManager) === null || _a4 === void 0 ? void 0 : _a4.addSubscription(sub).catch((error) => { - sub.emit("error", new SubscriptionError("Failed to subscribe.", error)); - }); - return sub; - }; - } - subscribeToContextEvents(context) { - const contractThis = this; - this.context = context; - if (contractThis.syncWithContext) { - context.on(Web3ConfigEvent.CONFIG_CHANGE, (event) => { - contractThis.setConfig({ [event.name]: event.newValue }); - }); - } - } -}; - -// node_modules/web3-eth-contract/lib/esm/index.js -var esm_default3 = Contract; - -// node_modules/web3-eth-ens/lib/esm/index.js -var esm_exports14 = {}; -__export(esm_exports14, { - ENS: () => ENS, - registryAddresses: () => registryAddresses -}); - -// node_modules/web3-eth-ens/lib/esm/config.js -var interfaceIds = { - addr: "0x3b3b57de", - name: "0x691f3431", - abi: "0x2203ab56", - pubkey: "0xc8690233", - text: "0x59d1d43c", - contenthash: "0xbc1c58d1" -}; -var methodsInInterface = { - setAddr: "addr", - addr: "addr", - setPubkey: "pubkey", - pubkey: "pubkey", - setContenthash: "contenthash", - contenthash: "contenthash" -}; -var registryAddresses = { - main: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", - goerli: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" -}; -var networkIds = { - "0x1": "main", - "0x5": "goerli" -}; - -// node_modules/web3-eth-ens/lib/esm/abi/ens/ENSRegistry.js -var ENSRegistryAbi = [ - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "bytes32", - name: "node", - type: "bytes32" - }, - { - indexed: true, - internalType: "bytes32", - name: "label", - type: "bytes32" - }, - { - indexed: false, - internalType: "address", - name: "owner", - type: "address" - } - ], - name: "NewOwner", - type: "event" - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "bytes32", - name: "node", - type: "bytes32" - }, - { - indexed: false, - internalType: "address", - name: "resolver", - type: "address" - } - ], - name: "NewResolver", - type: "event" - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "bytes32", - name: "node", - type: "bytes32" - }, - { - indexed: false, - internalType: "address", - name: "owner", - type: "address" - } - ], - name: "Transfer", - type: "event" - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address" - }, - { - internalType: "address", - name: "operator", - type: "address" - } - ], - name: "isApprovedForAll", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "bytes32", - name: "node", - type: "bytes32" - } - ], - name: "owner", - outputs: [ - { - internalType: "address", - name: "", - type: "address" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "bytes32", - name: "node", - type: "bytes32" - } - ], - name: "recordExists", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "bytes32", - name: "node", - type: "bytes32" - } - ], - name: "resolver", - outputs: [ - { - internalType: "address", - name: "", - type: "address" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "bytes32", - name: "node", - type: "bytes32" - } - ], - name: "ttl", - outputs: [ - { - internalType: "uint64", - name: "", - type: "uint64" - } - ], - stateMutability: "view", - type: "function" - } -]; - -// node_modules/web3-eth-ens/lib/esm/abi/ens/PublicResolver.js -var PublicResolverAbi = [ - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "bytes32", - name: "node", - type: "bytes32" - }, - { - indexed: false, - internalType: "address", - name: "a", - type: "address" - } - ], - name: "AddrChanged", - type: "event" - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "bytes32", - name: "node", - type: "bytes32" - }, - { - indexed: false, - internalType: "uint256", - name: "coinType", - type: "uint256" - }, - { - indexed: false, - internalType: "bytes", - name: "newAddress", - type: "bytes" - } - ], - name: "AddressChanged", - type: "event" - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "owner", - type: "address" - }, - { - indexed: true, - internalType: "address", - name: "operator", - type: "address" - }, - { - indexed: false, - internalType: "bool", - name: "approved", - type: "bool" - } - ], - name: "ApprovalForAll", - type: "event" - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "bytes32", - name: "node", - type: "bytes32" - }, - { - indexed: false, - internalType: "bytes", - name: "hash", - type: "bytes" - } - ], - name: "ContenthashChanged", - type: "event" - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "bytes32", - name: "node", - type: "bytes32" - }, - { - indexed: false, - internalType: "bytes", - name: "name", - type: "bytes" - }, - { - indexed: false, - internalType: "uint16", - name: "resource", - type: "uint16" - }, - { - indexed: false, - internalType: "bytes", - name: "record", - type: "bytes" - } - ], - name: "DNSRecordChanged", - type: "event" - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "bytes32", - name: "node", - type: "bytes32" - }, - { - indexed: false, - internalType: "bytes", - name: "name", - type: "bytes" - }, - { - indexed: false, - internalType: "uint16", - name: "resource", - type: "uint16" - } - ], - name: "DNSRecordDeleted", - type: "event" - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "bytes32", - name: "node", - type: "bytes32" - } - ], - name: "DNSZoneCleared", - type: "event" - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "bytes32", - name: "node", - type: "bytes32" - }, - { - indexed: false, - internalType: "bytes", - name: "lastzonehash", - type: "bytes" - }, - { - indexed: false, - internalType: "bytes", - name: "zonehash", - type: "bytes" - } - ], - name: "DNSZonehashChanged", - type: "event" - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "bytes32", - name: "node", - type: "bytes32" - }, - { - indexed: true, - internalType: "bytes4", - name: "interfaceID", - type: "bytes4" - }, - { - indexed: false, - internalType: "address", - name: "implementer", - type: "address" - } - ], - name: "InterfaceChanged", - type: "event" - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "bytes32", - name: "node", - type: "bytes32" - }, - { - indexed: false, - internalType: "string", - name: "name", - type: "string" - } - ], - name: "NameChanged", - type: "event" - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "bytes32", - name: "node", - type: "bytes32" - }, - { - indexed: false, - internalType: "bytes32", - name: "x", - type: "bytes32" - }, - { - indexed: false, - internalType: "bytes32", - name: "y", - type: "bytes32" - } - ], - name: "PubkeyChanged", - type: "event" - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "bytes32", - name: "node", - type: "bytes32" - }, - { - indexed: true, - internalType: "string", - name: "indexedKey", - type: "string" - }, - { - indexed: false, - internalType: "string", - name: "key", - type: "string" - } - ], - name: "TextChanged", - type: "event" - }, - { - inputs: [ - { - internalType: "bytes32", - name: "node", - type: "bytes32" - }, - { - internalType: "uint256", - name: "contentTypes", - type: "uint256" - } - ], - name: "ABI", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256" - }, - { - internalType: "bytes", - name: "", - type: "bytes" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "bytes32", - name: "node", - type: "bytes32" - } - ], - name: "addr", - outputs: [ - { - internalType: "address payable", - name: "", - type: "address" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "bytes32", - name: "node", - type: "bytes32" - }, - { - internalType: "uint256", - name: "coinType", - type: "uint256" - } - ], - name: "addr", - outputs: [ - { - internalType: "bytes", - name: "", - type: "bytes" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "bytes32", - name: "node", - type: "bytes32" - } - ], - name: "contenthash", - outputs: [ - { - internalType: "bytes", - name: "", - type: "bytes" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "bytes32", - name: "node", - type: "bytes32" - }, - { - internalType: "bytes32", - name: "name", - type: "bytes32" - }, - { - internalType: "uint16", - name: "resource", - type: "uint16" - } - ], - name: "dnsRecord", - outputs: [ - { - internalType: "bytes", - name: "", - type: "bytes" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "bytes32", - name: "node", - type: "bytes32" - }, - { - internalType: "bytes32", - name: "name", - type: "bytes32" - } - ], - name: "hasDNSRecords", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "bytes32", - name: "node", - type: "bytes32" - }, - { - internalType: "bytes4", - name: "interfaceID", - type: "bytes4" - } - ], - name: "interfaceImplementer", - outputs: [ - { - internalType: "address", - name: "", - type: "address" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "address", - name: "account", - type: "address" - }, - { - internalType: "address", - name: "operator", - type: "address" - } - ], - name: "isApprovedForAll", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "bytes32", - name: "node", - type: "bytes32" - } - ], - name: "name", - outputs: [ - { - internalType: "string", - name: "", - type: "string" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "bytes32", - name: "node", - type: "bytes32" - } - ], - name: "pubkey", - outputs: [ - { - internalType: "bytes32", - name: "x", - type: "bytes32" - }, - { - internalType: "bytes32", - name: "y", - type: "bytes32" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "bytes4", - name: "interfaceID", - type: "bytes4" - } - ], - name: "supportsInterface", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "bytes32", - name: "node", - type: "bytes32" - }, - { - internalType: "string", - name: "key", - type: "string" - } - ], - name: "text", - outputs: [ - { - internalType: "string", - name: "", - type: "string" - } - ], - stateMutability: "view", - type: "function" - }, - { - inputs: [ - { - internalType: "bytes32", - name: "node", - type: "bytes32" - } - ], - name: "zonehash", - outputs: [ - { - internalType: "bytes", - name: "", - type: "bytes" - } - ], - stateMutability: "view", - type: "function" - } -]; - -// node_modules/web3-eth-ens/lib/esm/utils.js -var normalize = (name2) => ens_normalize(name2); -var namehash = (inputName) => { - let node = ""; - for (let i = 0; i < 32; i += 1) { - node += "00"; - } - if (inputName) { - const name2 = normalize(inputName); - const labels = name2.split("."); - for (let i = labels.length - 1; i >= 0; i -= 1) { - const labelSha = sha3Raw(labels[i]).slice(2); - node = sha3Raw(`0x${node}${labelSha}`).slice(2); - } - } - return `0x${node}`; -}; - -// node_modules/web3-eth-ens/lib/esm/registry.js -var __awaiter34 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var Registry = class { - constructor(context, customRegistryAddress) { - this.contract = new Contract(ENSRegistryAbi, customRegistryAddress !== null && customRegistryAddress !== void 0 ? customRegistryAddress : registryAddresses.main, context); - this.context = context; - } - getOwner(name2) { - return __awaiter34(this, void 0, void 0, function* () { - try { - const result = this.contract.methods.owner(namehash(name2)).call(); - return result; - } catch (error) { - throw new Error(); - } - }); - } - getTTL(name2) { - return __awaiter34(this, void 0, void 0, function* () { - try { - return this.contract.methods.ttl(namehash(name2)).call(); - } catch (error) { - throw new Error(); - } - }); - } - recordExists(name2) { - return __awaiter34(this, void 0, void 0, function* () { - try { - const promise = this.contract.methods.recordExists(namehash(name2)).call(); - return promise; - } catch (error) { - throw new Error(); - } - }); - } - getResolver(name2) { - return __awaiter34(this, void 0, void 0, function* () { - try { - return this.contract.methods.resolver(namehash(name2)).call().then((address) => { - if (typeof address === "string") { - const contract = new Contract(PublicResolverAbi, address, this.context); - return contract; - } - throw new Error(); - }); - } catch (error) { - throw new Error(); - } - }); - } - get events() { - return this.contract.events; - } -}; - -// node_modules/web3-eth-ens/lib/esm/resolver.js -var __awaiter35 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var Resolver = class { - constructor(registry) { - this.registry = registry; - } - getResolverContractAdapter(ENSName) { - return __awaiter35(this, void 0, void 0, function* () { - return this.registry.getResolver(ENSName); - }); - } - // https://eips.ethereum.org/EIPS/eip-165 - // eslint-disable-next-line class-methods-use-this - checkInterfaceSupport(resolverContract, methodName) { - var _a4, _b; - return __awaiter35(this, void 0, void 0, function* () { - if (isNullish2(interfaceIds[methodName])) - throw new ResolverMethodMissingError((_a4 = resolverContract.options.address) !== null && _a4 !== void 0 ? _a4 : "", methodName); - const supported = yield resolverContract.methods.supportsInterface(interfaceIds[methodName]).call(); - if (!supported) - throw new ResolverMethodMissingError((_b = resolverContract.options.address) !== null && _b !== void 0 ? _b : "", methodName); - }); - } - supportsInterface(ENSName, interfaceId) { - var _a4; - return __awaiter35(this, void 0, void 0, function* () { - const resolverContract = yield this.getResolverContractAdapter(ENSName); - let interfaceIdParam = interfaceId; - if (!isHexStrict(interfaceIdParam)) { - interfaceIdParam = (_a4 = sha3(interfaceId)) !== null && _a4 !== void 0 ? _a4 : ""; - if (interfaceId === "") - throw new Error("Invalid interface Id"); - interfaceIdParam = interfaceIdParam.slice(0, 10); - } - return resolverContract.methods.supportsInterface(interfaceIdParam).call(); - }); - } - // eslint-disable-next-line @typescript-eslint/no-inferrable-types - getAddress(ENSName, coinType = 60) { - return __awaiter35(this, void 0, void 0, function* () { - const resolverContract = yield this.getResolverContractAdapter(ENSName); - yield this.checkInterfaceSupport(resolverContract, methodsInInterface.addr); - return resolverContract.methods.addr(namehash(ENSName), coinType).call(); - }); - } - getPubkey(ENSName) { - return __awaiter35(this, void 0, void 0, function* () { - const resolverContract = yield this.getResolverContractAdapter(ENSName); - yield this.checkInterfaceSupport(resolverContract, methodsInInterface.pubkey); - return resolverContract.methods.pubkey(namehash(ENSName)).call(); - }); - } - getContenthash(ENSName) { - return __awaiter35(this, void 0, void 0, function* () { - const resolverContract = yield this.getResolverContractAdapter(ENSName); - yield this.checkInterfaceSupport(resolverContract, methodsInInterface.contenthash); - return resolverContract.methods.contenthash(namehash(ENSName)).call(); - }); - } -}; - -// node_modules/web3-eth-ens/lib/esm/ens.js -var __awaiter36 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var ENS = class extends Web3Context { - /** - * Use to create an instance of ENS - * @param registryAddr - (Optional) The address of the ENS registry (default: mainnet registry address) - * @param provider - (Optional) The provider to use for the ENS instance - * @example - * ```ts - * const ens = new ENS( - * "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", - * "http://localhost:8545" - * ); - * - * console.log( ens.defaultChain); - * > mainnet - * ``` - */ - constructor(registryAddr, provider) { - super(provider !== null && provider !== void 0 ? provider : ""); - this.registryAddress = registryAddr !== null && registryAddr !== void 0 ? registryAddr : registryAddresses.main; - this._registry = new Registry(this.getContextObject(), registryAddr); - this._resolver = new Resolver(this._registry); - } - /** - * Returns the Resolver by the given address - * @param name - The name of the ENS domain - * @returns - An contract instance of the resolver - * - * @example - * ```ts - * const resolver = await ens.getResolver('resolver'); - * - * console.log(resolver.options.address); - * > '0x1234567890123456789012345678901234567890' - * ``` - */ - getResolver(name2) { - return __awaiter36(this, void 0, void 0, function* () { - return this._registry.getResolver(name2); - }); - } - /** - * Returns true if the record exists - * @param name - The ENS name - * @returns - Returns `true` if node exists in this ENS registry. This will return `false` for records that are in the legacy ENS registry but have not yet been migrated to the new one. - * @example - * ```ts - * const exists = await web3.eth.ens.recordExists('ethereum.eth'); - * ``` - */ - recordExists(name2) { - return __awaiter36(this, void 0, void 0, function* () { - return this._registry.recordExists(name2); - }); - } - /** - * Returns the caching TTL (time-to-live) of an ENS name. - * @param name - The ENS name - * @returns - Returns the caching TTL (time-to-live) of a name. - * @example - * ```ts - * const owner = await web3.eth.ens.getTTL('ethereum.eth'); - * ``` - */ - getTTL(name2) { - return __awaiter36(this, void 0, void 0, function* () { - return this._registry.getTTL(name2); - }); - } - /** - * Returns the owner by the given name and current configured or detected Registry - * @param name - The ENS name - * @returns - Returns the address of the owner of the name. - * @example - * ```ts - * const owner = await web3.eth.ens.getOwner('ethereum.eth'); - * ``` - */ - getOwner(name2) { - return __awaiter36(this, void 0, void 0, function* () { - return this._registry.getOwner(name2); - }); - } - /** - * Resolves an ENS name to an Ethereum address. - * @param ENSName - The ENS name to resolve - * @param coinType - (Optional) The coin type, defaults to 60 (ETH) - * @returns - The Ethereum address of the given name - * ```ts - * const address = await web3.eth.ens.getAddress('ethereum.eth'); - * console.log(address); - * > '0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359' - * ``` - */ - getAddress(ENSName, coinType = 60) { - return __awaiter36(this, void 0, void 0, function* () { - return this._resolver.getAddress(ENSName, coinType); - }); - } - /** - * Returns the X and Y coordinates of the curve point for the public key. - * @param ENSName - The ENS name - * @returns - The X and Y coordinates of the curve point for the public key - * @example - * ```ts - * const key = await web3.eth.ens.getPubkey('ethereum.eth'); - * console.log(key); - * > { - * "0": "0x0000000000000000000000000000000000000000000000000000000000000000", - * "1": "0x0000000000000000000000000000000000000000000000000000000000000000", - * "x": "0x0000000000000000000000000000000000000000000000000000000000000000", - * "y": "0x0000000000000000000000000000000000000000000000000000000000000000" - * } - * ``` - */ - getPubkey(ENSName) { - return __awaiter36(this, void 0, void 0, function* () { - return this._resolver.getPubkey(ENSName); - }); - } - /** - * Returns the content hash object associated with an ENS node. - * @param ENSName - The ENS name - * @returns - The content hash object associated with an ENS node - * @example - * ```ts - * const hash = await web3.eth.ens.getContenthash('ethereum.eth'); - * console.log(hash); - * > 'QmaEBknbGT4bTQiQoe2VNgBJbRfygQGktnaW5TbuKixjYL' - * ``` - */ - getContenthash(ENSName) { - return __awaiter36(this, void 0, void 0, function* () { - return this._resolver.getContenthash(ENSName); - }); - } - /** - * Checks if the current used network is synced and looks for ENS support there. - * Throws an error if not. - * @returns - The address of the ENS registry if the network has been detected successfully - * @example - * ```ts - * console.log(await web3.eth.ens.checkNetwork()); - * > '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e' - * ``` - */ - checkNetwork() { - return __awaiter36(this, void 0, void 0, function* () { - const now = Date.now() / 1e3; - if (!this._lastSyncCheck || now - this._lastSyncCheck > 3600) { - const syncInfo = yield isSyncing(this); - if (!(typeof syncInfo === "boolean" && !syncInfo)) { - throw new ENSNetworkNotSyncedError(); - } - this._lastSyncCheck = now; - } - if (this._detectedAddress) { - return this._detectedAddress; - } - const networkType = yield getId2(this, Object.assign(Object.assign({}, DEFAULT_RETURN_FORMAT), { number: FMT_NUMBER.HEX })); - const addr = registryAddresses[networkIds[networkType]]; - if (typeof addr === "undefined") { - throw new ENSUnsupportedNetworkError(networkType); - } - this._detectedAddress = addr; - return this._detectedAddress; - }); - } - /** - * Returns true if the related Resolver does support the given signature or interfaceId. - * @param ENSName - The ENS name - * @param interfaceId - The signature of the function or the interfaceId as described in the ENS documentation - * @returns - `true` if the related Resolver does support the given signature or interfaceId. - * @example - * ```ts - * const supports = await web3.eth.ens.supportsInterface('ethereum.eth', 'addr(bytes32'); - * console.log(supports); - * > true - * ``` - */ - supportsInterface(ENSName, interfaceId) { - return __awaiter36(this, void 0, void 0, function* () { - return this._resolver.supportsInterface(ENSName, interfaceId); - }); - } - /** - * @returns - Returns all events that can be emitted by the ENS registry. - */ - get events() { - return this._registry.events; - } -}; - -// node_modules/web3-eth-personal/lib/esm/index.js -var esm_exports15 = {}; -__export(esm_exports15, { - Personal: () => Personal, - default: () => esm_default4 -}); - -// node_modules/web3-eth-personal/lib/esm/rpc_method_wrappers.js -var __awaiter37 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var getAccounts3 = (requestManager) => __awaiter37(void 0, void 0, void 0, function* () { - const result = yield personal_rpc_methods_exports.getAccounts(requestManager); - return result.map(toChecksumAddress); -}); -var newAccount2 = (requestManager, password) => __awaiter37(void 0, void 0, void 0, function* () { - validator.validate(["string"], [password]); - const result = yield personal_rpc_methods_exports.newAccount(requestManager, password); - return toChecksumAddress(result); -}); -var unlockAccount2 = (requestManager, address, password, unlockDuration) => __awaiter37(void 0, void 0, void 0, function* () { - validator.validate(["address", "string", "uint"], [address, password, unlockDuration]); - return personal_rpc_methods_exports.unlockAccount(requestManager, address, password, unlockDuration); -}); -var lockAccount2 = (requestManager, address) => __awaiter37(void 0, void 0, void 0, function* () { - validator.validate(["address"], [address]); - return personal_rpc_methods_exports.lockAccount(requestManager, address); -}); -var importRawKey2 = (requestManager, keyData, passphrase) => __awaiter37(void 0, void 0, void 0, function* () { - validator.validate(["string", "string"], [keyData, passphrase]); - return personal_rpc_methods_exports.importRawKey(requestManager, keyData, passphrase); -}); -var sendTransaction4 = (requestManager, tx, passphrase) => __awaiter37(void 0, void 0, void 0, function* () { - const formattedTx = formatTransaction(tx, ETH_DATA_FORMAT); - return personal_rpc_methods_exports.sendTransaction(requestManager, formattedTx, passphrase); -}); -var signTransaction5 = (requestManager, tx, passphrase) => __awaiter37(void 0, void 0, void 0, function* () { - const formattedTx = formatTransaction(tx, ETH_DATA_FORMAT); - return personal_rpc_methods_exports.signTransaction(requestManager, formattedTx, passphrase); -}); -var sign5 = (requestManager, data, address, passphrase) => __awaiter37(void 0, void 0, void 0, function* () { - validator.validate(["string", "address", "string"], [data, address, passphrase]); - const dataToSign = isHexStrict(data) ? data : utf8ToHex(data); - return personal_rpc_methods_exports.sign(requestManager, dataToSign, address, passphrase); -}); -var ecRecover2 = (requestManager, signedData, signature) => __awaiter37(void 0, void 0, void 0, function* () { - validator.validate(["string", "string"], [signedData, signature]); - const signedDataString = isHexStrict(signedData) ? signedData : utf8ToHex(signedData); - return personal_rpc_methods_exports.ecRecover(requestManager, signedDataString, signature); -}); - -// node_modules/web3-eth-personal/lib/esm/personal.js -var __awaiter38 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var Personal = class extends Web3Context { - /** - *Returns a list of accounts the node controls by using the provider and calling the RPC method personal_listAccounts. Using `web3.eth.accounts.create()` will not add accounts into this list. For that use `web3.eth.personal.newAccount()`. - * @returns - An array of addresses controlled by the node. - * @example - * ```ts - * const accounts = await personal.getAccounts(); - * console.log(accounts); - * > - * [ - * '0x79D7BbaC53C9aF700d0B250e9AE789E503Fcd6AE', - * '0xe2597eB05CF9a87eB1309e86750C903EC38E527e', - * '0x7eD0e85B8E1E925600B4373e6d108F34AB38a401', - * '0xE4bEEf667408b99053dC147Ed19592aDa0d77F59', - * '0x7AB80aeB6bb488B7f6c41c58e83Ef248eB39c882', - * '0x12B1D9d74d73b1C3A245B19C1C5501c653aF1af9', - * '0x1a6075A263Ee140e00Dbf8E374Fc5A443d097894', - * '0x4FEC0A51024B13030D26E70904B066C6d41157A5', - * '0x03095dc4857BB26f3a4550c5651Df8b7f6b6B1Ef', - * '0xac0B9b6e8A17991cb172B2ABAF45Fb5eb769E540' - * ] - * ``` - */ - getAccounts() { - return __awaiter38(this, void 0, void 0, function* () { - return getAccounts3(this.requestManager); - }); - } - /** - * Creates a new account and returns its address. - * **_NOTE:_** This function sends a sensitive information like password. Never call this function over a unsecured Websocket or HTTP provider, as your password will be sent in plain text! - * @param password - The password to encrypt the account with. - * @returns - The address of the new account. - * @example - * ```ts - * const addr = await web3.eth.personal.newAccount('password'); - * console.log(addr); - * > '0x1234567891011121314151617181920212223456' - * ``` - */ - newAccount(password) { - return __awaiter38(this, void 0, void 0, function* () { - return newAccount2(this.requestManager, password); - }); - } - /** - * Unlocks an account for a given duration. - * @param address - The address of the account to unlock. - * @param password - The password of the account to unlock. - * @param unlockDuration - The duration in seconds to unlock the account for. - * @example - * ```ts - * await personal.unlockAccount( - * "0x0d4aa485ecbc499c70860feb7e5aaeaf5fd8172e", - * "123456", - * 600 - * ); - * ``` - */ - unlockAccount(address, password, unlockDuration) { - return __awaiter38(this, void 0, void 0, function* () { - return unlockAccount2(this.requestManager, address, password, unlockDuration); - }); - } - /** - * Locks the given account - * @param address - The address of the account to lock. - * @returns - `true` if the account was locked, otherwise `false`. - * @example - * ```ts - * await personal.lockAccount( - * "0x0d4aa485ecbc499c70860feb7e5aaeaf5fd8172e" - * ); - */ - lockAccount(address) { - return __awaiter38(this, void 0, void 0, function* () { - return lockAccount2(this.requestManager, address); - }); - } - /** - * Imports the given private key into the key store, encrypting it with the passphrase. - * @param keyData - An unencrypted private key (hex string). - * @param passphrase - The password of the account - * @returns - The address of the new account. - * @example - * ```ts - * const accountAddress = await personal.importRawKey( - * "abe40cb08850da918ee951b237fa87946499b2d8643e4aa12b0610b050c731f6", - * "123456" - * ); - * - * console.log(unlockTx); - * > 0x8727a8b34ec833154b72b62cac05d69f86eb6556 - * ``` - */ - importRawKey(keyData, passphrase) { - return __awaiter38(this, void 0, void 0, function* () { - return importRawKey2(this.requestManager, keyData, passphrase); - }); - } - /** - * This method sends a transaction over the management API. - * **_NOTE:_** Sending your account password over an unsecured HTTP RPC connection is highly unsecure. - * @param tx - The transaction options - * @param passphrase - The passphrase of the current account - * @returns - The transaction hash - * @example - * ```ts - * const txHash = personal - * .sendTransaction({ - * from: "0x0d4aa485ecbc499c70860feb7e5aaeaf5fd8172e", - * gasPrice: "20000000000", - * gas: "21000", - * to: "0x3535353535353535353535353535353535353535", - * value: "1000000", - * data: "", - * nonce: 0, - * }, - * "123456"); - * - * console.log(txHash); - * > 0x9445325c3c5638c9fe425b003b8c32f03e9f99d409555a650a6838ba712bb51b - * ``` - */ - sendTransaction(tx, passphrase) { - return __awaiter38(this, void 0, void 0, function* () { - return sendTransaction4(this.requestManager, tx, passphrase); - }); - } - /** - * Signs a transaction. This account needs to be unlocked. - * **_NOTE:_** Sending your account password over an unsecured HTTP RPC connection is highly unsecure. - * @param tx - The transaction data to sign. See {@link sendTransaction} for more information. - * @param passphrase - The password of the `from` account, to sign the transaction with. - * @returns - The RLP encoded transaction. The `raw` property can be used to send the transaction using {@link sendSignedTransaction}. - * @example - * ```ts - * const tx = personal - * .signTransaction({ - * from: "0x0d4aa485ecbc499c70860feb7e5aaeaf5fd8172e", - * gasPrice: "20000000000", - * gas: "21000", - * to: "0x3535353535353535353535353535353535353535", - * value: "1000000000000000000", - * data: "", - * nonce: 0, - * }, - * "123456"); - * - * console.log(tx); - * - * > { - * raw: '0xf86e808504a817c800825208943535353535353535353535353535353535353535880de0b6b3a764000080820a95a0c951c03238fe930e6e69ab9d6af9f29248a514048e44884f0e60c4de40de3526a038b71399bf0c8925749ab79e91ce6cd2fc068c84c18ff6a197b48c4cbef01e00', - * tx: { - * type: '0x0', - * nonce: '0x0', - * gasPrice: '0x4a817c800', - * maxPriorityFeePerGas: null, - * maxFeePerGas: null, - * gas: '0x5208', - * value: '0xde0b6b3a7640000', - * input: '0x', - * v: '0xa95', - * r: '0xc951c03238fe930e6e69ab9d6af9f29248a514048e44884f0e60c4de40de3526', - * s: '0x38b71399bf0c8925749ab79e91ce6cd2fc068c84c18ff6a197b48c4cbef01e00', - * to: '0x3535353535353535353535353535353535353535', - * hash: '0x65e3df790ab2a32068b13cff970b26445b8995229ae4abbed61bd996f09fce69' - * } - * } - * ``` - */ - signTransaction(tx, passphrase) { - return __awaiter38(this, void 0, void 0, function* () { - return signTransaction5(this.requestManager, tx, passphrase); - }); - } - /** - * Calculates an Ethereum specific signature with: - * sign(keccak256("\x19Ethereum Signed Message:\n" + dataToSign.length + dataToSign))) - * Adding a prefix to the message makes the calculated signature recognisable as an Ethereum specific signature. - * - * If you have the original message and the signed message, you can discover the signing account address using web3.eth.personal.ecRecover - * **_NOTE:_** Sending your account password over an unsecured HTTP RPC connection is highly unsecure. - * @param data - The data to sign. - * @param address - The address to sign with. - * @param passphrase - The passphrase to decrypt the account with. - * @returns - The signature. - * @example - * ```ts - * const sig = await personal .sign("Hello world", "0x0D4Aa485ECbC499c70860fEb7e5AaeAf5fd8172E", "123456") - * console.log(sig) - * > 0x5d21d01b3198ac34d0585a9d76c4d1c8123e5e06746c8962318a1c08ffb207596e6fce4a6f377b7c0fc98c5f646cd73438c80e8a1a95cbec55a84c2889dca0301b - * ``` - */ - sign(data, address, passphrase) { - return __awaiter38(this, void 0, void 0, function* () { - return sign5(this.requestManager, data, address, passphrase); - }); - } - /** - * Recovers the account that signed the data. - * @param signedData - Data that was signed. If String it will be converted using {@link utf8ToHex} - * @param signature - The signature - * @returns - The address of the account that signed the data. - * @example - * ```ts - * const address = await personal.ecRecover( - * "Hello world", - * "0x5d21d01b3198ac34d0585a9d76c4d1c8123e5e06746c8962318a1c08ffb207596e6fce4a6f377b7c0fc98c5f646cd73438c80e8a1a95cbec55a84c2889dca0301b" - * ); - * console.log(address); - * > 0x0d4aa485ecbc499c70860feb7e5aaeaf5fd8172e - * ``` - */ - ecRecover(signedData, signature) { - return __awaiter38(this, void 0, void 0, function* () { - return ecRecover2(this.requestManager, signedData, signature); - }); - } -}; - -// node_modules/web3-eth-personal/lib/esm/index.js -var esm_default4 = Personal; - -// node_modules/web3/lib/esm/abi.js -var abi_default = { - encodeEventSignature, - encodeFunctionCall, - encodeFunctionSignature, - encodeParameter, - encodeParameters, - decodeParameter, - decodeParameters: decodeParameters2, - decodeLog -}; - -// node_modules/web3/lib/esm/accounts.js -var __awaiter39 = function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var initAccountsForContext = (context) => { - const signTransactionWithContext = (transaction, privateKey) => __awaiter39(void 0, void 0, void 0, function* () { - const tx = yield prepareTransactionForSigning(transaction, context); - const privateKeyBytes = format({ format: "bytes" }, privateKey, ETH_DATA_FORMAT); - return signTransaction(tx, privateKeyBytes); - }); - const privateKeyToAccountWithContext = (privateKey) => { - const account = privateKeyToAccount(privateKey); - return Object.assign(Object.assign({}, account), { signTransaction: (transaction) => __awaiter39(void 0, void 0, void 0, function* () { - return signTransactionWithContext(transaction, account.privateKey); - }) }); - }; - const decryptWithContext = (keystore, password, options) => __awaiter39(void 0, void 0, void 0, function* () { - var _a4; - const account = yield decrypt2(keystore, password, (_a4 = options === null || options === void 0 ? void 0 : options.nonStrict) !== null && _a4 !== void 0 ? _a4 : true); - return Object.assign(Object.assign({}, account), { signTransaction: (transaction) => __awaiter39(void 0, void 0, void 0, function* () { - return signTransactionWithContext(transaction, account.privateKey); - }) }); - }); - const createWithContext = () => { - const account = create(); - return Object.assign(Object.assign({}, account), { signTransaction: (transaction) => __awaiter39(void 0, void 0, void 0, function* () { - return signTransactionWithContext(transaction, account.privateKey); - }) }); - }; - const wallet = new Wallet({ - create: createWithContext, - privateKeyToAccount: privateKeyToAccountWithContext, - decrypt: decryptWithContext - }); - return { - signTransaction: signTransactionWithContext, - create: createWithContext, - privateKeyToAccount: privateKeyToAccountWithContext, - decrypt: decryptWithContext, - recoverTransaction, - hashMessage, - sign, - recover, - encrypt: encrypt2, - wallet, - privateKeyToAddress, - parseAndValidatePrivateKey, - privateKeyToPublicKey - }; -}; - -// node_modules/web3/lib/esm/version.js -var Web3PkgInfo = { version: "4.4.0" }; - -// node_modules/web3/lib/esm/web3.js -var Web3 = class extends Web3Context { - constructor(providerOrContext) { - var _a4; - if (isNullish2(providerOrContext) || typeof providerOrContext === "string" && providerOrContext.trim() === "" || typeof providerOrContext !== "string" && !isSupportedProvider(providerOrContext) && !providerOrContext.provider) { - console.warn("NOTE: web3.js is running without provider. You need to pass a provider in order to interact with the network!"); - } - let contextInitOptions = {}; - if (typeof providerOrContext === "string" || isSupportedProvider(providerOrContext)) { - contextInitOptions.provider = providerOrContext; - } else if (providerOrContext) { - contextInitOptions = providerOrContext; - } else { - contextInitOptions = {}; - } - contextInitOptions.registeredSubscriptions = Object.assign(Object.assign({}, registeredSubscriptions), (_a4 = contextInitOptions.registeredSubscriptions) !== null && _a4 !== void 0 ? _a4 : {}); - super(contextInitOptions); - const accounts = initAccountsForContext(this); - this._wallet = accounts.wallet; - this._accountProvider = accounts; - this.utils = esm_exports4; - const self2 = this; - class ContractBuilder extends esm_default3 { - constructor(jsonInterface, addressOrOptionsOrContext, optionsOrContextOrReturnFormat, contextOrReturnFormat, returnFormat) { - if (isContractInitOptions(addressOrOptionsOrContext) && isContractInitOptions(optionsOrContextOrReturnFormat)) { - throw new InvalidMethodParamsError("Should not provide options at both 2nd and 3rd parameters"); - } - let address; - let options = {}; - let context; - let dataFormat = DEFAULT_RETURN_FORMAT; - if (!isNullish2(addressOrOptionsOrContext) && typeof addressOrOptionsOrContext !== "object" && typeof addressOrOptionsOrContext !== "string") { - throw new InvalidMethodParamsError(); - } - if (typeof addressOrOptionsOrContext === "string") { - address = addressOrOptionsOrContext; - } - if (isContractInitOptions(addressOrOptionsOrContext)) { - options = addressOrOptionsOrContext; - } else if (isContractInitOptions(optionsOrContextOrReturnFormat)) { - options = optionsOrContextOrReturnFormat; - } else { - options = {}; - } - if (addressOrOptionsOrContext instanceof Web3Context) { - context = addressOrOptionsOrContext; - } else if (optionsOrContextOrReturnFormat instanceof Web3Context) { - context = optionsOrContextOrReturnFormat; - } else if (contextOrReturnFormat instanceof Web3Context) { - context = contextOrReturnFormat; - } else { - context = self2.getContextObject(); - } - if (returnFormat) { - dataFormat = returnFormat; - } else if (isDataFormat(optionsOrContextOrReturnFormat)) { - dataFormat = optionsOrContextOrReturnFormat; - } else if (isDataFormat(contextOrReturnFormat)) { - dataFormat = contextOrReturnFormat; - } - super(jsonInterface, address, options, context, dataFormat); - super.subscribeToContextEvents(self2); - } - } - const eth = self2.use(Web3Eth); - this.eth = Object.assign(eth, { - // ENS module - ens: self2.use(ENS, registryAddresses.main), - // Iban helpers - Iban, - net: self2.use(Net), - personal: self2.use(Personal), - // Contract helper and module - Contract: ContractBuilder, - // ABI Helpers - abi: abi_default, - // Accounts helper - accounts - }); - } -}; -Web3.version = Web3PkgInfo.version; -Web3.utils = esm_exports4; -Web3.modules = { - Web3Eth, - Iban, - Net, - ENS, - Personal -}; -var web3_default = Web3; - -// node_modules/web3/lib/esm/eth.exports.js -var eth_exports_exports = {}; -__export(eth_exports_exports, { - ALL_EVENTS: () => ALL_EVENTS, - ALL_EVENTS_ABI: () => ALL_EVENTS_ABI, - LogsSubscription: () => LogsSubscription, - NUMBER_DATA_FORMAT: () => NUMBER_DATA_FORMAT, - NewHeadsSubscription: () => NewHeadsSubscription, - NewPendingTransactionsSubscription: () => NewPendingTransactionsSubscription, - SignatureObjectSchema: () => SignatureObjectSchema, - SyncingSubscription: () => SyncingSubscription, - Web3Eth: () => Web3Eth, - abi: () => esm_exports12, - accessListItemSchema: () => accessListItemSchema, - accessListResultSchema: () => accessListResultSchema, - accessListSchema: () => accessListSchema, - accountSchema: () => accountSchema, - accounts: () => esm_exports7, - blockHeaderSchema: () => blockHeaderSchema, - blockSchema: () => blockSchema, - call: () => call2, - chainSchema: () => chainSchema, - contract: () => esm_exports13, - createAccessList: () => createAccessList2, - customChainSchema: () => customChainSchema, - decodeEventABI: () => decodeEventABI, - detectTransactionType: () => detectTransactionType, - ens: () => esm_exports14, - estimateGas: () => estimateGas2, - feeHistorySchema: () => feeHistorySchema, - formatTransaction: () => formatTransaction, - getBalance: () => getBalance2, - getBlock: () => getBlock, - getBlockNumber: () => getBlockNumber2, - getBlockTransactionCount: () => getBlockTransactionCount, - getBlockUncleCount: () => getBlockUncleCount, - getChainId: () => getChainId2, - getCode: () => getCode2, - getCoinbase: () => getCoinbase2, - getFeeHistory: () => getFeeHistory2, - getGasPrice: () => getGasPrice2, - getHashRate: () => getHashRate2, - getLogs: () => getLogs2, - getPendingTransactions: () => getPendingTransactions2, - getProof: () => getProof2, - getProtocolVersion: () => getProtocolVersion2, - getStorageAt: () => getStorageAt2, - getTransaction: () => getTransaction, - getTransactionCount: () => getTransactionCount2, - getTransactionFromBlock: () => getTransactionFromBlock, - getTransactionReceipt: () => getTransactionReceipt2, - getUncle: () => getUncle, - hardforkSchema: () => hardforkSchema, - iban: () => esm_exports8, - isAccessList: () => isAccessList2, - isAccessListEntry: () => isAccessListEntry, - isBaseTransaction: () => isBaseTransaction, - isMining: () => isMining, - isSyncing: () => isSyncing, - isTransaction1559Unsigned: () => isTransaction1559Unsigned, - isTransaction2930Unsigned: () => isTransaction2930Unsigned, - isTransactionCall: () => isTransactionCall, - isTransactionLegacyUnsigned: () => isTransactionLegacyUnsigned, - isTransactionWithSender: () => isTransactionWithSender, - logSchema: () => logSchema, - personal: () => esm_exports15, - prepareTransactionForSigning: () => prepareTransactionForSigning, - registeredSubscriptions: () => registeredSubscriptions, - sendSignedTransaction: () => sendSignedTransaction, - sendTransaction: () => sendTransaction3, - sign: () => sign4, - signTransaction: () => signTransaction4, - signTypedData: () => signTypedData2, - storageProofSchema: () => storageProofSchema, - syncSchema: () => syncSchema, - transactionBuilder: () => transactionBuilder, - transactionInfoSchema: () => transactionInfoSchema, - transactionReceiptSchema: () => transactionReceiptSchema, - transactionSchema: () => transactionSchema, - validateBaseChain: () => validateBaseChain, - validateChainInfo: () => validateChainInfo, - validateCustomChainInfo: () => validateCustomChainInfo, - validateFeeMarketGas: () => validateFeeMarketGas, - validateGas: () => validateGas, - validateHardfork: () => validateHardfork, - validateLegacyGas: () => validateLegacyGas, - validateTransactionCall: () => validateTransactionCall, - validateTransactionForSigning: () => validateTransactionForSigning, - validateTransactionWithSender: () => validateTransactionWithSender, - withdrawalsSchema: () => withdrawalsSchema -}); - -// node_modules/web3/lib/esm/providers.exports.js -var providers_exports_exports = {}; -__export(providers_exports_exports, { - Eip1193Provider: () => Eip1193Provider, - SocketProvider: () => SocketProvider, - http: () => esm_exports5, - ws: () => esm_exports6 -}); - -// node_modules/web3/lib/esm/index.js -var esm_default5 = web3_default; -export { - AbiError, - BaseWeb3Error, - BlockTags, - ChainIdMismatchError, - ChainMismatchError, - CommonOrChainAndHardforkError, - ConfigChainMismatchError, - ConfigHardforkMismatchError, - ConnectionCloseError, - ConnectionError, - ConnectionNotOpenError, - ConnectionTimeoutError, - Contract, - ContractCodeNotStoredError, - ContractEventDoesNotExistError, - ContractExecutionError, - ContractInstantiationError, - ContractMissingABIError, - ContractMissingDeployDataError, - ContractNoAddressDefinedError, - ContractNoFromAddressDefinedError, - ContractOnceRequiresCallbackError, - ContractReservedEventError, - ContractTransactionDataAndInputError, - DEFAULT_RETURN_FORMAT, - EIP1193ProviderRpcError, - ENSCheckInterfaceSupportError, - ENSNetworkNotSyncedError, - ENSUnsupportedNetworkError, - ERR_ABI_ENCODING, - ERR_CONN, - ERR_CONN_CLOSE, - ERR_CONN_INVALID, - ERR_CONN_MAX_ATTEMPTS, - ERR_CONN_NOT_OPEN, - ERR_CONN_PENDING_REQUESTS, - ERR_CONN_TIMEOUT, - ERR_CONTRACT, - ERR_CONTRACT_ABI_MISSING, - ERR_CONTRACT_EVENT_NOT_EXISTS, - ERR_CONTRACT_EXECUTION_REVERTED, - ERR_CONTRACT_INSTANTIATION, - ERR_CONTRACT_MISSING_ADDRESS, - ERR_CONTRACT_MISSING_DEPLOY_DATA, - ERR_CONTRACT_MISSING_FROM_ADDRESS, - ERR_CONTRACT_REQUIRED_CALLBACK, - ERR_CONTRACT_RESERVED_EVENT, - ERR_CONTRACT_RESOLVER_MISSING, - ERR_CONTRACT_TX_DATA_AND_INPUT, - ERR_CORE_CHAIN_MISMATCH, - ERR_CORE_HARDFORK_MISMATCH, - ERR_ENS_CHECK_INTERFACE_SUPPORT, - ERR_ENS_NETWORK_NOT_SYNCED, - ERR_ENS_UNSUPPORTED_NETWORK, - ERR_EXISTING_PLUGIN_NAMESPACE, - ERR_FORMATTERS, - ERR_INVALID_ADDRESS, - ERR_INVALID_BLOCK, - ERR_INVALID_BOOLEAN, - ERR_INVALID_BYTES, - ERR_INVALID_CLIENT, - ERR_INVALID_HEX, - ERR_INVALID_KEYSTORE, - ERR_INVALID_LARGE_VALUE, - ERR_INVALID_METHOD_PARAMS, - ERR_INVALID_NIBBLE_WIDTH, - ERR_INVALID_NUMBER, - ERR_INVALID_PASSWORD, - ERR_INVALID_PRIVATE_KEY, - ERR_INVALID_PROVIDER, - ERR_INVALID_RESPONSE, - ERR_INVALID_SIGNATURE, - ERR_INVALID_SIZE, - ERR_INVALID_STRING, - ERR_INVALID_TYPE, - ERR_INVALID_TYPE_ABI, - ERR_INVALID_UNIT, - ERR_INVALID_UNSIGNED_INTEGER, - ERR_IV_LENGTH, - ERR_KEY_DERIVATION_FAIL, - ERR_KEY_VERSION_UNSUPPORTED, - ERR_METHOD_NOT_IMPLEMENTED, - ERR_OPERATION_ABORT, - ERR_OPERATION_TIMEOUT, - ERR_PARAM, - ERR_PBKDF2_ITERATIONS, - ERR_PRIVATE_KEY_LENGTH, - ERR_PROVIDER, - ERR_RAW_TX_UNDEFINED, - ERR_REQ_ALREADY_SENT, - ERR_RESPONSE, - ERR_RPC_INTERNAL_ERROR, - ERR_RPC_INVALID_INPUT, - ERR_RPC_INVALID_JSON, - ERR_RPC_INVALID_METHOD, - ERR_RPC_INVALID_PARAMS, - ERR_RPC_INVALID_REQUEST, - ERR_RPC_LIMIT_EXCEEDED, - ERR_RPC_MISSING_RESOURCE, - ERR_RPC_NOT_SUPPORTED, - ERR_RPC_TRANSACTION_REJECTED, - ERR_RPC_UNAVAILABLE_RESOURCE, - ERR_RPC_UNSUPPORTED_METHOD, - ERR_SCHEMA_FORMAT, - ERR_SIGNATURE_FAILED, - ERR_SUBSCRIPTION, - ERR_TX, - ERR_TX_BLOCK_TIMEOUT, - ERR_TX_CHAIN_ID_MISMATCH, - ERR_TX_CHAIN_MISMATCH, - ERR_TX_CONTRACT_NOT_STORED, - ERR_TX_DATA_AND_INPUT, - ERR_TX_GAS_MISMATCH, - ERR_TX_GAS_MISMATCH_INNER_ERROR, - ERR_TX_HARDFORK_MISMATCH, - ERR_TX_INVALID_CALL, - ERR_TX_INVALID_CHAIN_INFO, - ERR_TX_INVALID_FEE_MARKET_GAS, - ERR_TX_INVALID_FEE_MARKET_GAS_PRICE, - ERR_TX_INVALID_LEGACY_FEE_MARKET, - ERR_TX_INVALID_LEGACY_GAS, - ERR_TX_INVALID_NONCE_OR_CHAIN_ID, - ERR_TX_INVALID_OBJECT, - ERR_TX_INVALID_PROPERTIES_FOR_TYPE, - ERR_TX_INVALID_RECEIVER, - ERR_TX_INVALID_SENDER, - ERR_TX_LOCAL_WALLET_NOT_AVAILABLE, - ERR_TX_MISSING_CHAIN_INFO, - ERR_TX_MISSING_CUSTOM_CHAIN, - ERR_TX_MISSING_CUSTOM_CHAIN_ID, - ERR_TX_MISSING_GAS, - ERR_TX_MISSING_GAS_INNER_ERROR, - ERR_TX_NOT_FOUND, - ERR_TX_NO_CONTRACT_ADDRESS, - ERR_TX_OUT_OF_GAS, - ERR_TX_POLLING_TIMEOUT, - ERR_TX_RECEIPT_MISSING_BLOCK_NUMBER, - ERR_TX_RECEIPT_MISSING_OR_BLOCKHASH_NULL, - ERR_TX_REVERT_INSTRUCTION, - ERR_TX_REVERT_TRANSACTION, - ERR_TX_REVERT_TRANSACTION_CUSTOM_ERROR, - ERR_TX_REVERT_WITHOUT_REASON, - ERR_TX_SEND_TIMEOUT, - ERR_TX_SIGNING, - ERR_TX_UNABLE_TO_POPULATE_NONCE, - ERR_TX_UNSUPPORTED_EIP_1559, - ERR_TX_UNSUPPORTED_TYPE, - ERR_UNSUPPORTED_KDF, - ERR_VALIDATION, - ERR_WS_PROVIDER, - ETH_DATA_FORMAT, - Eip1559GasPriceError, - Eip1559NotSupportedError, - Eip838ExecutionError, - ExistingPluginNamespaceError, - FMT_BYTES, - FMT_NUMBER, - FormatterError, - GENESIS_BLOCK_NUMBER, - HardforkMismatchError, - HardforksOrdered, - HexProcessingError, - HttpProvider, - IVLengthError, - Iban, - InternalError, - InvalidAddressError, - InvalidBlockError, - InvalidBooleanError, - InvalidBytesError, - InvalidClientError, - InvalidConnectionError, - InvalidGasOrGasPrice, - InvalidInputError, - InvalidKdfError, - InvalidLargeValueError, - InvalidMaxPriorityFeePerGasOrMaxFeePerGas, - InvalidMethodParamsError, - InvalidNonceOrChainIdError, - InvalidNumberError, - InvalidNumberOfParamsError, - InvalidParamsError, - InvalidPasswordError, - InvalidPrivateKeyError, - InvalidPropertiesForTransactionTypeError, - InvalidProviderError, - InvalidRequestError, - InvalidResponseError, - InvalidSignatureError, - InvalidSizeError, - InvalidStringError, - InvalidTransactionCall, - InvalidTransactionObjectError, - InvalidTransactionWithReceiver, - InvalidTransactionWithSender, - InvalidTypeAbiInputError, - InvalidTypeError, - InvalidUnitError, - InvalidUnsignedIntegerError, - InvalidValueError, - JSONRPC_ERR_CHAIN_DISCONNECTED, - JSONRPC_ERR_DISCONNECTED, - JSONRPC_ERR_REJECTED_REQUEST, - JSONRPC_ERR_UNAUTHORIZED, - JSONRPC_ERR_UNSUPPORTED_METHOD, - KeyDerivationError, - KeyStoreVersionError, - LimitExceededError, - LocalWalletNotAvailableError, - MaxAttemptsReachedOnReconnectingError, - MethodNotFoundError, - MethodNotImplementedError, - MethodNotSupported, - MissingChainOrHardforkError, - MissingCustomChainError, - MissingCustomChainIdError, - MissingGasError, - MissingGasInnerError, - Net, - NibbleWidthError, - NoContractAddressFoundError, - OperationAbortError, - OperationTimeoutError, - PBKDF2IterationsError, - ParseError, - PendingRequestsOnReconnectingError, - Personal, - PrivateKeyLengthError, - ProviderError, - RequestAlreadySentError, - ResolverMethodMissingError, - ResourceUnavailableError, - ResourcesNotFoundError, - ResponseError, - RevertInstructionError, - RpcError, - RpcErrorMessages, - SchemaFormatError, - SignatureError, - SubscriptionError, - TransactionBlockTimeoutError, - TransactionDataAndInputError, - TransactionError, - TransactionGasMismatchError, - TransactionGasMismatchInnerError, - TransactionMissingReceiptOrBlockHashError, - TransactionNotFound, - TransactionOutOfGasError, - TransactionPollingTimeoutError, - TransactionReceiptMissingBlockNumberError, - TransactionRejectedError, - TransactionRevertInstructionError, - TransactionRevertWithCustomError, - TransactionRevertedWithoutReasonError, - TransactionSendTimeoutError, - TransactionSigningError, - TypedArray, - UnableToPopulateNonceError, - UndefinedRawTransactionError, - UnsupportedFeeMarketError, - UnsupportedTransactionTypeError, - VersionNotSupportedError, - web3_default as Web3, - Web3BaseProvider, - Web3BaseWallet, - Web3Context, - Web3ContractError, - Web3Eth, - Web3EthPluginBase, - Web3PluginBase, - Web3Validator, - Web3WSProviderError, - WebSocketProvider, - esm_exports9 as core, - esm_default5 as default, - esm_exports as errors, - eth_exports_exports as eth, - genericRpcErrorMessageTemplate, - esm_exports11 as net, - providers_exports_exports as providers, - rpcErrorsMap, - esm_exports10 as rpcMethods, - esm_exports2 as types, - esm_exports4 as utils, - esm_exports3 as validator -}; -/*! Bundled license information: - -crc-32/crc32.js: - (*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *) - -@noble/hashes/esm/utils.js: - (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *) - -@noble/curves/esm/abstract/utils.js: - (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) - -@noble/curves/esm/abstract/modular.js: - (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) - -@noble/curves/esm/abstract/curve.js: - (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) - -@noble/curves/esm/abstract/weierstrass.js: - (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) - -@noble/curves/esm/_shortw_utils.js: - (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) - -@noble/curves/esm/secp256k1.js: - (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *) -*/ -//# sourceMappingURL=web3.js.map diff --git a/node_modules/.vite/deps/web3.js.map b/node_modules/.vite/deps/web3.js.map deleted file mode 100644 index 9c636cdd..00000000 --- a/node_modules/.vite/deps/web3.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../../eventemitter3/index.js", "../../cross-fetch/dist/browser-ponyfill.js", "../../@ethereumjs/rlp/src/index.ts", "../../crc-32/crc32.js", "../../setimmediate/setImmediate.js", "../../web3-core/src/index.ts", "../../web3-errors/src/index.ts", "../../web3-errors/src/error_codes.ts", "../../web3-errors/src/web3_error_base.ts", "../../web3-errors/src/errors/account_errors.ts", "../../web3-errors/src/errors/connection_errors.ts", "../../web3-errors/src/errors/contract_errors.ts", "../../web3-errors/src/errors/ens_errors.ts", "../../web3-errors/src/errors/generic_errors.ts", "../../web3-errors/src/errors/provider_errors.ts", "../../web3-errors/src/errors/signature_errors.ts", "../../web3-errors/src/errors/transaction_errors.ts", "../../web3-errors/src/errors/utils_errors.ts", "../../web3-errors/src/errors/response_errors.ts", "../../web3-errors/src/errors/core_errors.ts", "../../web3-errors/src/errors/rpc_error_messages.ts", "../../web3-errors/src/errors/rpc_errors.ts", "../../web3-errors/src/errors/schema_errors.ts", "../../web3-utils/src/index.ts", "../../@noble/hashes/src/_assert.ts", "../../@noble/hashes/src/_u64.ts", "../../@noble/hashes/src/crypto.ts", "../../@noble/hashes/src/utils.ts", "../../@noble/hashes/src/sha3.ts", "../../ethereum-cryptography/esm/utils.js", "../../ethereum-cryptography/esm/keccak.js", "../../web3-validator/src/index.ts", "../../zod/lib/index.mjs", "../../web3-validator/src/errors.ts", "../../web3-validator/src/utils.ts", "../../web3-validator/src/constants.ts", "../../web3-validator/src/validation/abi.ts", "../../web3-validator/src/validation/string.ts", "../../web3-validator/src/validation/bytes.ts", "../../web3-validator/src/validation/address.ts", "../../web3-types/src/index.ts", "../../web3-types/src/data_format_types.ts", "../../web3-types/src/eth_types.ts", "../../web3-types/src/primitives_types.ts", "../../web3-types/src/web3_base_provider.ts", "../../web3-types/src/web3_base_wallet.ts", "../../web3-validator/src/validation/numbers.ts", "../../web3-validator/src/validation/block.ts", "../../web3-validator/src/validation/bloom.ts", "../../web3-validator/src/validation/boolean.ts", "../../web3-validator/src/validation/object.ts", "../../web3-validator/src/validation/topic.ts", "../../web3-validator/src/validation/filter.ts", "../../web3-validator/src/formats.ts", "../../web3-validator/src/validator.ts", "../../web3-validator/src/web3_validator.ts", "../../web3-validator/src/default_validator.ts", "../../web3-validator/src/validation/eth.ts", "../../web3-utils/src/uint8array.ts", "../../web3-utils/src/converters.ts", "../../eventemitter3/index.mjs", "../../web3-utils/src/event_emitter.ts", "../../web3-utils/src/validation.ts", "../../web3-utils/src/objects.ts", "../../web3-utils/src/string_manipulation.ts", "../../web3-utils/src/formatter.ts", "../../web3-utils/src/hash.ts", "../../ethereum-cryptography/esm/random.js", "../../web3-utils/src/random.ts", "../../web3-utils/src/promise_helpers.ts", "../../web3-utils/src/json_rpc.ts", "../../web3-utils/src/uuid.ts", "../../web3-utils/src/web3_deferred_promise.ts", "../../web3-utils/src/chunk_response_parser.ts", "../../web3-utils/src/web3_eip1193_provider.ts", "../../web3-utils/src/socket_provider.ts", "../../web3-core/src/web3_event_emitter.ts", "../../web3-core/src/web3_config.ts", "../../web3-providers-http/src/index.ts", "../../web3-providers-ws/src/index.ts", "../../isomorphic-ws/browser.js", "../../web3-core/src/utils.ts", "../../web3-core/src/web3_request_manager.ts", "../../web3-core/src/web3_subscription_manager.ts", "../../web3-core/src/web3_subscriptions.ts", "../../web3-eth-accounts/src/index.ts", "../../web3-eth-accounts/src/wallet.ts", "../../ethereum-cryptography/esm/aes.js", "../../@noble/hashes/src/hmac.ts", "../../@noble/hashes/src/pbkdf2.ts", "../../@noble/hashes/src/_sha2.ts", "../../@noble/hashes/src/sha256.ts", "../../@noble/hashes/src/sha512.ts", "../../ethereum-cryptography/esm/pbkdf2.js", "../../@noble/hashes/src/scrypt.ts", "../../ethereum-cryptography/esm/scrypt.js", "../../ethereum-cryptography/esm/secp256k1.js", "../../@noble/curves/src/abstract/utils.ts", "../../@noble/curves/src/abstract/modular.ts", "../../@noble/curves/src/abstract/curve.ts", "../../@noble/curves/src/abstract/weierstrass.ts", "../../@noble/curves/src/abstract/hash-to-curve.ts", "../../@noble/curves/src/_shortw_utils.ts", "../../@noble/curves/src/secp256k1.ts", "../../web3-eth-accounts/src/tx/constants.ts", "../../web3-eth-accounts/src/schemas.ts", "../../web3-eth-accounts/src/common/enums.ts", "../../web3-eth-accounts/src/common/types.ts", "../../web3-eth-accounts/src/common/utils.ts", "../../web3-eth-accounts/src/tx/eip1559Transaction.ts", "../../web3-eth-accounts/src/common/common.ts", "../../web3-eth-accounts/src/common/chains/goerli.ts", "../../web3-eth-accounts/src/common/chains/mainnet.ts", "../../web3-eth-accounts/src/common/chains/sepolia.ts", "../../web3-eth-accounts/src/common/eips/1153.ts", "../../web3-eth-accounts/src/common/eips/1559.ts", "../../web3-eth-accounts/src/common/eips/2315.ts", "../../web3-eth-accounts/src/common/eips/2537.ts", "../../web3-eth-accounts/src/common/eips/2565.ts", "../../web3-eth-accounts/src/common/eips/2718.ts", "../../web3-eth-accounts/src/common/eips/2929.ts", "../../web3-eth-accounts/src/common/eips/2930.ts", "../../web3-eth-accounts/src/common/eips/3198.ts", "../../web3-eth-accounts/src/common/eips/3529.ts", "../../web3-eth-accounts/src/common/eips/3540.ts", "../../web3-eth-accounts/src/common/eips/3541.ts", "../../web3-eth-accounts/src/common/eips/3554.ts", "../../web3-eth-accounts/src/common/eips/3607.ts", "../../web3-eth-accounts/src/common/eips/3651.ts", "../../web3-eth-accounts/src/common/eips/3670.ts", "../../web3-eth-accounts/src/common/eips/3675.ts", "../../web3-eth-accounts/src/common/eips/3855.ts", "../../web3-eth-accounts/src/common/eips/3860.ts", "../../web3-eth-accounts/src/common/eips/4345.ts", "../../web3-eth-accounts/src/common/eips/4399.ts", "../../web3-eth-accounts/src/common/eips/5133.ts", "../../web3-eth-accounts/src/common/eips/index.ts", "../../web3-eth-accounts/src/common/hardforks/chainstart.ts", "../../web3-eth-accounts/src/common/hardforks/dao.ts", "../../web3-eth-accounts/src/common/hardforks/homestead.ts", "../../web3-eth-accounts/src/common/hardforks/tangerineWhistle.ts", "../../web3-eth-accounts/src/common/hardforks/spuriousDragon.ts", "../../web3-eth-accounts/src/common/hardforks/byzantium.ts", "../../web3-eth-accounts/src/common/hardforks/constantinople.ts", "../../web3-eth-accounts/src/common/hardforks/petersburg.ts", "../../web3-eth-accounts/src/common/hardforks/istanbul.ts", "../../web3-eth-accounts/src/common/hardforks/muirGlacier.ts", "../../web3-eth-accounts/src/common/hardforks/berlin.ts", "../../web3-eth-accounts/src/common/hardforks/london.ts", "../../web3-eth-accounts/src/common/hardforks/shanghai.ts", "../../web3-eth-accounts/src/common/hardforks/arrowGlacier.ts", "../../web3-eth-accounts/src/common/hardforks/grayGlacier.ts", "../../web3-eth-accounts/src/common/hardforks/mergeForkIdTransition.ts", "../../web3-eth-accounts/src/common/hardforks/merge.ts", "../../web3-eth-accounts/src/common/hardforks/index.ts", "../../web3-eth-accounts/src/tx/types.ts", "../../web3-eth-accounts/src/tx/address.ts", "../../web3-eth-accounts/src/tx/utils.ts", "../../web3-eth-accounts/src/tx/baseTransaction.ts", "../../web3-eth-accounts/src/tx/eip2930Transaction.ts", "../../web3-eth-accounts/src/tx/legacyTransaction.ts", "../../web3-eth-accounts/src/tx/transactionFactory.ts", "../../web3-eth-accounts/src/account.ts", "../../web3-core/src/web3_batch_request.ts", "../../web3-core/src/web3_context.ts", "../../web3-core/src/formatters.ts", "../../web3-eth-iban/src/index.ts", "../../web3-eth-iban/src/iban.ts", "../../web3-core/src/web3_promi_event.ts", "../../web3-eth/src/index.ts", "../../web3-rpc-methods/src/index.ts", "../../web3-rpc-methods/src/eth_rpc_methods.ts", "../../web3-rpc-methods/src/net_rpc_methods.ts", "../../web3-rpc-methods/src/personal_rpc_methods.ts", "../../web3-eth/src/utils/detect_transaction_type.ts", "../../web3-eth/src/schemas.ts", "../../web3-eth/src/utils/format_transaction.ts", "../../web3-eth/src/utils/decode_signed_transaction.ts", "../../web3-net/src/index.ts", "../../web3-net/src/rpc_method_wrappers.ts", "../../web3-net/src/net.ts", "../../web3-eth/src/constants.ts", "../../web3-eth/src/utils/get_transaction_gas_pricing.ts", "../../web3-eth/src/utils/transaction_builder.ts", "../../web3-eth/src/utils/reject_if_block_timeout.ts", "../../web3-eth/src/utils/try_send_transaction.ts", "../../web3-eth/src/utils/wait_for_transaction_receipt.ts", "../../web3-eth/src/utils/watch_transaction_by_polling.ts", "../../web3-eth/src/utils/watch_transaction_by_subscription.ts", "../../web3-eth/src/utils/watch_transaction_for_confirmations.ts", "../../web3-eth-abi/src/index.ts", "../../web3-eth-abi/src/utils.ts", "../../web3-eth-abi/src/api/errors_api.ts", "../../web3-eth-abi/src/api/events_api.ts", "../../abitype/dist/chunk-WP7KDV47.mjs", "../../abitype/dist/chunk-NHABU752.mjs", "../../abitype/dist/index.mjs", "../../web3-eth-abi/src/coders/utils.ts", "../../web3-eth-abi/src/coders/base/address.ts", "../../web3-eth-abi/src/coders/base/numbersLimits.ts", "../../web3-eth-abi/src/coders/base/number.ts", "../../web3-eth-abi/src/coders/base/bool.ts", "../../web3-eth-abi/src/coders/base/bytes.ts", "../../web3-eth-abi/src/coders/base/string.ts", "../../web3-eth-abi/src/coders/base/utils.ts", "../../web3-eth-abi/src/coders/base/array.ts", "../../web3-eth-abi/src/coders/base/index.ts", "../../web3-eth-abi/src/coders/base/tuple.ts", "../../web3-eth-abi/src/coders/decode.ts", "../../web3-eth-abi/src/coders/encode.ts", "../../web3-eth-abi/src/api/parameters_api.ts", "../../web3-eth-abi/src/api/functions_api.ts", "../../web3-eth-abi/src/api/logs_api.ts", "../../web3-eth-abi/src/decode_contract_error_data.ts", "../../web3-eth-abi/src/eip_712.ts", "../../web3-eth/src/utils/get_revert_reason.ts", "../../web3-eth/src/utils/get_transaction_error.ts", "../../web3-eth/src/utils/decoding.ts", "../../web3-eth/src/utils/send_tx_helper.ts", "../../web3-eth/src/rpc_method_wrappers.ts", "../../web3-eth/src/web3_subscriptions.ts", "../../web3-eth/src/web3_eth.ts", "../../web3-eth/src/validation.ts", "../../web3-eth/src/utils/prepare_transaction_for_signing.ts", "../../web3-eth-contract/src/index.ts", "../../web3-eth-contract/src/encoding.ts", "../../web3-eth-contract/src/log_subscription.ts", "../../web3-eth-contract/src/utils.ts", "../../web3-eth-contract/src/contract.ts", "../../web3-eth-ens/src/index.ts", "../../web3-eth-ens/src/config.ts", "../../web3-eth-ens/src/abi/ens/ENSRegistry.ts", "../../web3-eth-ens/src/abi/ens/PublicResolver.ts", "../../web3-eth-ens/src/utils.ts", "../../web3-eth-ens/src/registry.ts", "../../web3-eth-ens/src/resolver.ts", "../../web3-eth-ens/src/ens.ts", "../../web3-eth-personal/src/index.ts", "../../web3-eth-personal/src/rpc_method_wrappers.ts", "../../web3-eth-personal/src/personal.ts", "../../web3/src/abi.ts", "../../web3/src/accounts.ts", "../../web3/src/version.ts", "../../web3/src/web3.ts", "../../web3/src/eth.exports.ts", "../../web3/src/providers.exports.ts", "../../web3/src/index.ts"], - "sourcesContent": ["'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n", "// Save global object in a variable\nvar __global__ =\n(typeof globalThis !== 'undefined' && globalThis) ||\n(typeof self !== 'undefined' && self) ||\n(typeof global !== 'undefined' && global);\n// Create an object that extends from __global__ without the fetch function\nvar __globalThis__ = (function () {\nfunction F() {\nthis.fetch = false;\nthis.DOMException = __global__.DOMException\n}\nF.prototype = __global__; // Needed for feature detection on whatwg-fetch's code\nreturn new F();\n})();\n// Wraps whatwg-fetch with a function scope to hijack the global object\n// \"globalThis\" that's going to be patched\n(function(globalThis) {\n\nvar irrelevant = (function (exports) {\n\n var global =\n (typeof globalThis !== 'undefined' && globalThis) ||\n (typeof self !== 'undefined' && self) ||\n (typeof global !== 'undefined' && global);\n\n var support = {\n searchParams: 'URLSearchParams' in global,\n iterable: 'Symbol' in global && 'iterator' in Symbol,\n blob:\n 'FileReader' in global &&\n 'Blob' in global &&\n (function() {\n try {\n new Blob();\n return true\n } catch (e) {\n return false\n }\n })(),\n formData: 'FormData' in global,\n arrayBuffer: 'ArrayBuffer' in global\n };\n\n function isDataView(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ];\n\n var isArrayBufferView =\n ArrayBuffer.isView ||\n function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n };\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name);\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~!]/i.test(name) || name === '') {\n throw new TypeError('Invalid character in header field name: \"' + name + '\"')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value);\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value}\n }\n };\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n };\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {};\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value);\n }, this);\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1]);\n }, this);\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name]);\n }, this);\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name);\n value = normalizeValue(value);\n var oldValue = this.map[name];\n this.map[name] = oldValue ? oldValue + ', ' + value : value;\n };\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)];\n };\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name);\n return this.has(name) ? this.map[name] : null\n };\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n };\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value);\n };\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this);\n }\n }\n };\n\n Headers.prototype.keys = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push(name);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.values = function() {\n var items = [];\n this.forEach(function(value) {\n items.push(value);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.entries = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push([name, value]);\n });\n return iteratorFor(items)\n };\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true;\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result);\n };\n reader.onerror = function() {\n reject(reader.error);\n };\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsArrayBuffer(blob);\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsText(blob);\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf);\n var chars = new Array(view.length);\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i]);\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength);\n view.set(new Uint8Array(buf));\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false;\n\n this._initBody = function(body) {\n /*\n fetch-mock wraps the Response object in an ES6 Proxy to\n provide useful test harness features such as flush. However, on\n ES5 browsers without fetch or Proxy support pollyfills must be used;\n the proxy-pollyfill is unable to proxy an attribute unless it exists\n on the object before the Proxy is created. This change ensures\n Response.bodyUsed exists on the instance, while maintaining the\n semantic of setting Request.bodyUsed in the constructor before\n _initBody is called.\n */\n this.bodyUsed = this.bodyUsed;\n this._bodyInit = body;\n if (!body) {\n this._bodyText = '';\n } else if (typeof body === 'string') {\n this._bodyText = body;\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body;\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body;\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString();\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer);\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer]);\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body);\n } else {\n this._bodyText = body = Object.prototype.toString.call(body);\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8');\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type);\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n }\n };\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n };\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n var isConsumed = consumed(this);\n if (isConsumed) {\n return isConsumed\n }\n if (ArrayBuffer.isView(this._bodyArrayBuffer)) {\n return Promise.resolve(\n this._bodyArrayBuffer.buffer.slice(\n this._bodyArrayBuffer.byteOffset,\n this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength\n )\n )\n } else {\n return Promise.resolve(this._bodyArrayBuffer)\n }\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n };\n }\n\n this.text = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n };\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n };\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n };\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase();\n return methods.indexOf(upcased) > -1 ? upcased : method\n }\n\n function Request(input, options) {\n if (!(this instanceof Request)) {\n throw new TypeError('Please use the \"new\" operator, this DOM object constructor cannot be called as a function.')\n }\n\n options = options || {};\n var body = options.body;\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url;\n this.credentials = input.credentials;\n if (!options.headers) {\n this.headers = new Headers(input.headers);\n }\n this.method = input.method;\n this.mode = input.mode;\n this.signal = input.signal;\n if (!body && input._bodyInit != null) {\n body = input._bodyInit;\n input.bodyUsed = true;\n }\n } else {\n this.url = String(input);\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin';\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers);\n }\n this.method = normalizeMethod(options.method || this.method || 'GET');\n this.mode = options.mode || this.mode || null;\n this.signal = options.signal || this.signal;\n this.referrer = null;\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body);\n\n if (this.method === 'GET' || this.method === 'HEAD') {\n if (options.cache === 'no-store' || options.cache === 'no-cache') {\n // Search for a '_' parameter in the query string\n var reParamSearch = /([?&])_=[^&]*/;\n if (reParamSearch.test(this.url)) {\n // If it already exists then set the value with the current time\n this.url = this.url.replace(reParamSearch, '$1_=' + new Date().getTime());\n } else {\n // Otherwise add a new '_' parameter to the end with the current time\n var reQueryString = /\\?/;\n this.url += (reQueryString.test(this.url) ? '&' : '?') + '_=' + new Date().getTime();\n }\n }\n }\n }\n\n Request.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n };\n\n function decode(body) {\n var form = new FormData();\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=');\n var name = split.shift().replace(/\\+/g, ' ');\n var value = split.join('=').replace(/\\+/g, ' ');\n form.append(decodeURIComponent(name), decodeURIComponent(value));\n }\n });\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers();\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n // Avoiding split via regex to work around a common IE11 bug with the core-js 3.6.0 regex polyfill\n // https://github.com/github/fetch/issues/748\n // https://github.com/zloirock/core-js/issues/751\n preProcessedHeaders\n .split('\\r')\n .map(function(header) {\n return header.indexOf('\\n') === 0 ? header.substr(1, header.length) : header\n })\n .forEach(function(line) {\n var parts = line.split(':');\n var key = parts.shift().trim();\n if (key) {\n var value = parts.join(':').trim();\n headers.append(key, value);\n }\n });\n return headers\n }\n\n Body.call(Request.prototype);\n\n function Response(bodyInit, options) {\n if (!(this instanceof Response)) {\n throw new TypeError('Please use the \"new\" operator, this DOM object constructor cannot be called as a function.')\n }\n if (!options) {\n options = {};\n }\n\n this.type = 'default';\n this.status = options.status === undefined ? 200 : options.status;\n this.ok = this.status >= 200 && this.status < 300;\n this.statusText = options.statusText === undefined ? '' : '' + options.statusText;\n this.headers = new Headers(options.headers);\n this.url = options.url || '';\n this._initBody(bodyInit);\n }\n\n Body.call(Response.prototype);\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n };\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''});\n response.type = 'error';\n return response\n };\n\n var redirectStatuses = [301, 302, 303, 307, 308];\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n };\n\n exports.DOMException = global.DOMException;\n try {\n new exports.DOMException();\n } catch (err) {\n exports.DOMException = function(message, name) {\n this.message = message;\n this.name = name;\n var error = Error(message);\n this.stack = error.stack;\n };\n exports.DOMException.prototype = Object.create(Error.prototype);\n exports.DOMException.prototype.constructor = exports.DOMException;\n }\n\n function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init);\n\n if (request.signal && request.signal.aborted) {\n return reject(new exports.DOMException('Aborted', 'AbortError'))\n }\n\n var xhr = new XMLHttpRequest();\n\n function abortXhr() {\n xhr.abort();\n }\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n };\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n setTimeout(function() {\n resolve(new Response(body, options));\n }, 0);\n };\n\n xhr.onerror = function() {\n setTimeout(function() {\n reject(new TypeError('Network request failed'));\n }, 0);\n };\n\n xhr.ontimeout = function() {\n setTimeout(function() {\n reject(new TypeError('Network request failed'));\n }, 0);\n };\n\n xhr.onabort = function() {\n setTimeout(function() {\n reject(new exports.DOMException('Aborted', 'AbortError'));\n }, 0);\n };\n\n function fixUrl(url) {\n try {\n return url === '' && global.location.href ? global.location.href : url\n } catch (e) {\n return url\n }\n }\n\n xhr.open(request.method, fixUrl(request.url), true);\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true;\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false;\n }\n\n if ('responseType' in xhr) {\n if (support.blob) {\n xhr.responseType = 'blob';\n } else if (\n support.arrayBuffer &&\n request.headers.get('Content-Type') &&\n request.headers.get('Content-Type').indexOf('application/octet-stream') !== -1\n ) {\n xhr.responseType = 'arraybuffer';\n }\n }\n\n if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers)) {\n Object.getOwnPropertyNames(init.headers).forEach(function(name) {\n xhr.setRequestHeader(name, normalizeValue(init.headers[name]));\n });\n } else {\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\n });\n }\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr);\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr);\n }\n };\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n })\n }\n\n fetch.polyfill = true;\n\n if (!global.fetch) {\n global.fetch = fetch;\n global.Headers = Headers;\n global.Request = Request;\n global.Response = Response;\n }\n\n exports.Headers = Headers;\n exports.Request = Request;\n exports.Response = Response;\n exports.fetch = fetch;\n\n return exports;\n\n})({});\n})(__globalThis__);\n// This is a ponyfill, so...\n__globalThis__.fetch.ponyfill = true;\ndelete __globalThis__.fetch.polyfill;\n// Choose between native implementation (__global__) or custom implementation (__globalThis__)\nvar ctx = __global__.fetch ? __global__ : __globalThis__;\nexports = ctx.fetch // To enable: import fetch from 'cross-fetch'\nexports.default = ctx.fetch // For TypeScript consumers without esModuleInterop.\nexports.fetch = ctx.fetch // To enable: import {fetch} from 'cross-fetch'\nexports.Headers = ctx.Headers\nexports.Request = ctx.Request\nexports.Response = ctx.Response\nmodule.exports = exports\n", "export type Input = string | number | bigint | Uint8Array | Array | null | undefined\n\nexport type NestedUint8Array = Array\n\nexport interface Decoded {\n data: Uint8Array | NestedUint8Array\n remainder: Uint8Array\n}\n\n/**\n * RLP Encoding based on https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/\n * This function takes in data, converts it to Uint8Array if not,\n * and adds a length for recursion.\n * @param input Will be converted to Uint8Array\n * @returns Uint8Array of encoded data\n **/\nexport function encode(input: Input): Uint8Array {\n if (Array.isArray(input)) {\n const output: Uint8Array[] = []\n let outputLength = 0\n for (let i = 0; i < input.length; i++) {\n const encoded = encode(input[i])\n output.push(encoded)\n outputLength += encoded.length\n }\n return concatBytes(encodeLength(outputLength, 192), ...output)\n }\n const inputBuf = toBytes(input)\n if (inputBuf.length === 1 && inputBuf[0] < 128) {\n return inputBuf\n }\n return concatBytes(encodeLength(inputBuf.length, 128), inputBuf)\n}\n\n/**\n * Slices a Uint8Array, throws if the slice goes out-of-bounds of the Uint8Array.\n * E.g. `safeSlice(hexToBytes('aa'), 1, 2)` will throw.\n * @param input\n * @param start\n * @param end\n */\nfunction safeSlice(input: Uint8Array, start: number, end: number) {\n if (end > input.length) {\n throw new Error('invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds')\n }\n return input.slice(start, end)\n}\n\n/**\n * Parse integers. Check if there is no leading zeros\n * @param v The value to parse\n */\nfunction decodeLength(v: Uint8Array): number {\n if (v[0] === 0) {\n throw new Error('invalid RLP: extra zeros')\n }\n return parseHexByte(bytesToHex(v))\n}\n\nfunction encodeLength(len: number, offset: number): Uint8Array {\n if (len < 56) {\n return Uint8Array.from([len + offset])\n }\n const hexLength = numberToHex(len)\n const lLength = hexLength.length / 2\n const firstByte = numberToHex(offset + 55 + lLength)\n return Uint8Array.from(hexToBytes(firstByte + hexLength))\n}\n\n/**\n * RLP Decoding based on https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/\n * @param input Will be converted to Uint8Array\n * @param stream Is the input a stream (false by default)\n * @returns decoded Array of Uint8Arrays containing the original message\n **/\nexport function decode(input: Input, stream?: false): Uint8Array | NestedUint8Array\nexport function decode(input: Input, stream?: true): Decoded\nexport function decode(input: Input, stream = false): Uint8Array | NestedUint8Array | Decoded {\n if (typeof input === 'undefined' || input === null || (input as any).length === 0) {\n return Uint8Array.from([])\n }\n\n const inputBytes = toBytes(input)\n const decoded = _decode(inputBytes)\n\n if (stream) {\n return decoded\n }\n if (decoded.remainder.length !== 0) {\n throw new Error('invalid RLP: remainder must be zero')\n }\n\n return decoded.data\n}\n\n/** Decode an input with RLP */\nfunction _decode(input: Uint8Array): Decoded {\n let length: number, llength: number, data: Uint8Array, innerRemainder: Uint8Array, d: Decoded\n const decoded = []\n const firstByte = input[0]\n\n if (firstByte <= 0x7f) {\n // a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding.\n return {\n data: input.slice(0, 1),\n remainder: input.slice(1),\n }\n } else if (firstByte <= 0xb7) {\n // string is 0-55 bytes long. A single byte with value 0x80 plus the length of the string followed by the string\n // The range of the first byte is [0x80, 0xb7]\n length = firstByte - 0x7f\n\n // set 0x80 null to 0\n if (firstByte === 0x80) {\n data = Uint8Array.from([])\n } else {\n data = safeSlice(input, 1, length)\n }\n\n if (length === 2 && data[0] < 0x80) {\n throw new Error('invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed')\n }\n\n return {\n data,\n remainder: input.slice(length),\n }\n } else if (firstByte <= 0xbf) {\n // string is greater than 55 bytes long. A single byte with the value (0xb7 plus the length of the length),\n // followed by the length, followed by the string\n llength = firstByte - 0xb6\n if (input.length - 1 < llength) {\n throw new Error('invalid RLP: not enough bytes for string length')\n }\n length = decodeLength(safeSlice(input, 1, llength))\n if (length <= 55) {\n throw new Error('invalid RLP: expected string length to be greater than 55')\n }\n data = safeSlice(input, llength, length + llength)\n\n return {\n data,\n remainder: input.slice(length + llength),\n }\n } else if (firstByte <= 0xf7) {\n // a list between 0-55 bytes long\n length = firstByte - 0xbf\n innerRemainder = safeSlice(input, 1, length)\n while (innerRemainder.length) {\n d = _decode(innerRemainder)\n decoded.push(d.data)\n innerRemainder = d.remainder\n }\n\n return {\n data: decoded,\n remainder: input.slice(length),\n }\n } else {\n // a list over 55 bytes long\n llength = firstByte - 0xf6\n length = decodeLength(safeSlice(input, 1, llength))\n if (length < 56) {\n throw new Error('invalid RLP: encoded list too short')\n }\n const totalLength = llength + length\n if (totalLength > input.length) {\n throw new Error('invalid RLP: total length is larger than the data')\n }\n\n innerRemainder = safeSlice(input, llength, totalLength)\n\n while (innerRemainder.length) {\n d = _decode(innerRemainder)\n decoded.push(d.data)\n innerRemainder = d.remainder\n }\n\n return {\n data: decoded,\n remainder: input.slice(totalLength),\n }\n }\n}\n\nconst cachedHexes = Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, '0'))\nfunction bytesToHex(uint8a: Uint8Array): string {\n // Pre-caching chars with `cachedHexes` speeds this up 6x\n let hex = ''\n for (let i = 0; i < uint8a.length; i++) {\n hex += cachedHexes[uint8a[i]]\n }\n return hex\n}\n\nfunction parseHexByte(hexByte: string): number {\n const byte = Number.parseInt(hexByte, 16)\n if (Number.isNaN(byte)) throw new Error('Invalid byte sequence')\n return byte\n}\n\n// Caching slows it down 2-3x\nfunction hexToBytes(hex: string): Uint8Array {\n if (typeof hex !== 'string') {\n throw new TypeError('hexToBytes: expected string, got ' + typeof hex)\n }\n if (hex.length % 2) throw new Error('hexToBytes: received invalid unpadded hex')\n const array = new Uint8Array(hex.length / 2)\n for (let i = 0; i < array.length; i++) {\n const j = i * 2\n array[i] = parseHexByte(hex.slice(j, j + 2))\n }\n return array\n}\n\n/** Concatenates two Uint8Arrays into one. */\nfunction concatBytes(...arrays: Uint8Array[]): Uint8Array {\n if (arrays.length === 1) return arrays[0]\n const length = arrays.reduce((a, arr) => a + arr.length, 0)\n const result = new Uint8Array(length)\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const arr = arrays[i]\n result.set(arr, pad)\n pad += arr.length\n }\n return result\n}\n\n// Global symbols in both browsers and Node.js since v11\n// See https://github.com/microsoft/TypeScript/issues/31535\ndeclare const TextEncoder: any\ndeclare const TextDecoder: any\n\nfunction utf8ToBytes(utf: string): Uint8Array {\n return new TextEncoder().encode(utf)\n}\n\n/** Transform an integer into its hexadecimal value */\nfunction numberToHex(integer: number | bigint): string {\n if (integer < 0) {\n throw new Error('Invalid integer as argument, must be unsigned!')\n }\n const hex = integer.toString(16)\n return hex.length % 2 ? `0${hex}` : hex\n}\n\n/** Pad a string to be even */\nfunction padToEven(a: string): string {\n return a.length % 2 ? `0${a}` : a\n}\n\n/** Check if a string is prefixed by 0x */\nfunction isHexPrefixed(str: string): boolean {\n return str.length >= 2 && str[0] === '0' && str[1] === 'x'\n}\n\n/** Removes 0x from a given String */\nfunction stripHexPrefix(str: string): string {\n if (typeof str !== 'string') {\n return str\n }\n return isHexPrefixed(str) ? str.slice(2) : str\n}\n\n/** Transform anything into a Uint8Array */\nfunction toBytes(v: Input): Uint8Array {\n if (v instanceof Uint8Array) {\n return v\n }\n if (typeof v === 'string') {\n if (isHexPrefixed(v)) {\n return hexToBytes(padToEven(stripHexPrefix(v)))\n }\n return utf8ToBytes(v)\n }\n if (typeof v === 'number' || typeof v === 'bigint') {\n if (!v) {\n return Uint8Array.from([])\n }\n return hexToBytes(numberToHex(v))\n }\n if (v === null || v === undefined) {\n return Uint8Array.from([])\n }\n throw new Error('toBytes: received unsupported type ' + typeof v)\n}\n\nexport const utils = {\n bytesToHex,\n concatBytes,\n hexToBytes,\n utf8ToBytes,\n}\n\nexport const RLP = { encode, decode }\n", "/*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */\n/* vim: set ts=2: */\n/*exported CRC32 */\nvar CRC32;\n(function (factory) {\n\t/*jshint ignore:start */\n\t/*eslint-disable */\n\tif(typeof DO_NOT_EXPORT_CRC === 'undefined') {\n\t\tif('object' === typeof exports) {\n\t\t\tfactory(exports);\n\t\t} else if ('function' === typeof define && define.amd) {\n\t\t\tdefine(function () {\n\t\t\t\tvar module = {};\n\t\t\t\tfactory(module);\n\t\t\t\treturn module;\n\t\t\t});\n\t\t} else {\n\t\t\tfactory(CRC32 = {});\n\t\t}\n\t} else {\n\t\tfactory(CRC32 = {});\n\t}\n\t/*eslint-enable */\n\t/*jshint ignore:end */\n}(function(CRC32) {\nCRC32.version = '1.2.2';\n/*global Int32Array */\nfunction signed_crc_table() {\n\tvar c = 0, table = new Array(256);\n\n\tfor(var n =0; n != 256; ++n){\n\t\tc = n;\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\tc = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));\n\t\ttable[n] = c;\n\t}\n\n\treturn typeof Int32Array !== 'undefined' ? new Int32Array(table) : table;\n}\n\nvar T0 = signed_crc_table();\nfunction slice_by_16_tables(T) {\n\tvar c = 0, v = 0, n = 0, table = typeof Int32Array !== 'undefined' ? new Int32Array(4096) : new Array(4096) ;\n\n\tfor(n = 0; n != 256; ++n) table[n] = T[n];\n\tfor(n = 0; n != 256; ++n) {\n\t\tv = T[n];\n\t\tfor(c = 256 + n; c < 4096; c += 256) v = table[c] = (v >>> 8) ^ T[v & 0xFF];\n\t}\n\tvar out = [];\n\tfor(n = 1; n != 16; ++n) out[n - 1] = typeof Int32Array !== 'undefined' ? table.subarray(n * 256, n * 256 + 256) : table.slice(n * 256, n * 256 + 256);\n\treturn out;\n}\nvar TT = slice_by_16_tables(T0);\nvar T1 = TT[0], T2 = TT[1], T3 = TT[2], T4 = TT[3], T5 = TT[4];\nvar T6 = TT[5], T7 = TT[6], T8 = TT[7], T9 = TT[8], Ta = TT[9];\nvar Tb = TT[10], Tc = TT[11], Td = TT[12], Te = TT[13], Tf = TT[14];\nfunction crc32_bstr(bstr, seed) {\n\tvar C = seed ^ -1;\n\tfor(var i = 0, L = bstr.length; i < L;) C = (C>>>8) ^ T0[(C^bstr.charCodeAt(i++))&0xFF];\n\treturn ~C;\n}\n\nfunction crc32_buf(B, seed) {\n\tvar C = seed ^ -1, L = B.length - 15, i = 0;\n\tfor(; i < L;) C =\n\t\tTf[B[i++] ^ (C & 255)] ^\n\t\tTe[B[i++] ^ ((C >> 8) & 255)] ^\n\t\tTd[B[i++] ^ ((C >> 16) & 255)] ^\n\t\tTc[B[i++] ^ (C >>> 24)] ^\n\t\tTb[B[i++]] ^ Ta[B[i++]] ^ T9[B[i++]] ^ T8[B[i++]] ^\n\t\tT7[B[i++]] ^ T6[B[i++]] ^ T5[B[i++]] ^ T4[B[i++]] ^\n\t\tT3[B[i++]] ^ T2[B[i++]] ^ T1[B[i++]] ^ T0[B[i++]];\n\tL += 15;\n\twhile(i < L) C = (C>>>8) ^ T0[(C^B[i++])&0xFF];\n\treturn ~C;\n}\n\nfunction crc32_str(str, seed) {\n\tvar C = seed ^ -1;\n\tfor(var i = 0, L = str.length, c = 0, d = 0; i < L;) {\n\t\tc = str.charCodeAt(i++);\n\t\tif(c < 0x80) {\n\t\t\tC = (C>>>8) ^ T0[(C^c)&0xFF];\n\t\t} else if(c < 0x800) {\n\t\t\tC = (C>>>8) ^ T0[(C ^ (192|((c>>6)&31)))&0xFF];\n\t\t\tC = (C>>>8) ^ T0[(C ^ (128|(c&63)))&0xFF];\n\t\t} else if(c >= 0xD800 && c < 0xE000) {\n\t\t\tc = (c&1023)+64; d = str.charCodeAt(i++)&1023;\n\t\t\tC = (C>>>8) ^ T0[(C ^ (240|((c>>8)&7)))&0xFF];\n\t\t\tC = (C>>>8) ^ T0[(C ^ (128|((c>>2)&63)))&0xFF];\n\t\t\tC = (C>>>8) ^ T0[(C ^ (128|((d>>6)&15)|((c&3)<<4)))&0xFF];\n\t\t\tC = (C>>>8) ^ T0[(C ^ (128|(d&63)))&0xFF];\n\t\t} else {\n\t\t\tC = (C>>>8) ^ T0[(C ^ (224|((c>>12)&15)))&0xFF];\n\t\t\tC = (C>>>8) ^ T0[(C ^ (128|((c>>6)&63)))&0xFF];\n\t\t\tC = (C>>>8) ^ T0[(C ^ (128|(c&63)))&0xFF];\n\t\t}\n\t}\n\treturn ~C;\n}\nCRC32.table = T0;\n// $FlowIgnore\nCRC32.bstr = crc32_bstr;\n// $FlowIgnore\nCRC32.buf = crc32_buf;\n// $FlowIgnore\nCRC32.str = crc32_str;\n}));\n", "(function (global, undefined) {\n \"use strict\";\n\n if (global.setImmediate) {\n return;\n }\n\n var nextHandle = 1; // Spec says greater than zero\n var tasksByHandle = {};\n var currentlyRunningATask = false;\n var doc = global.document;\n var registerImmediate;\n\n function setImmediate(callback) {\n // Callback can either be a function or a string\n if (typeof callback !== \"function\") {\n callback = new Function(\"\" + callback);\n }\n // Copy function arguments\n var args = new Array(arguments.length - 1);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i + 1];\n }\n // Store and register the task\n var task = { callback: callback, args: args };\n tasksByHandle[nextHandle] = task;\n registerImmediate(nextHandle);\n return nextHandle++;\n }\n\n function clearImmediate(handle) {\n delete tasksByHandle[handle];\n }\n\n function run(task) {\n var callback = task.callback;\n var args = task.args;\n switch (args.length) {\n case 0:\n callback();\n break;\n case 1:\n callback(args[0]);\n break;\n case 2:\n callback(args[0], args[1]);\n break;\n case 3:\n callback(args[0], args[1], args[2]);\n break;\n default:\n callback.apply(undefined, args);\n break;\n }\n }\n\n function runIfPresent(handle) {\n // From the spec: \"Wait until any invocations of this algorithm started before this one have completed.\"\n // So if we're currently running a task, we'll need to delay this invocation.\n if (currentlyRunningATask) {\n // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a\n // \"too much recursion\" error.\n setTimeout(runIfPresent, 0, handle);\n } else {\n var task = tasksByHandle[handle];\n if (task) {\n currentlyRunningATask = true;\n try {\n run(task);\n } finally {\n clearImmediate(handle);\n currentlyRunningATask = false;\n }\n }\n }\n }\n\n function installNextTickImplementation() {\n registerImmediate = function(handle) {\n process.nextTick(function () { runIfPresent(handle); });\n };\n }\n\n function canUsePostMessage() {\n // The test against `importScripts` prevents this implementation from being installed inside a web worker,\n // where `global.postMessage` means something completely different and can't be used for this purpose.\n if (global.postMessage && !global.importScripts) {\n var postMessageIsAsynchronous = true;\n var oldOnMessage = global.onmessage;\n global.onmessage = function() {\n postMessageIsAsynchronous = false;\n };\n global.postMessage(\"\", \"*\");\n global.onmessage = oldOnMessage;\n return postMessageIsAsynchronous;\n }\n }\n\n function installPostMessageImplementation() {\n // Installs an event handler on `global` for the `message` event: see\n // * https://developer.mozilla.org/en/DOM/window.postMessage\n // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages\n\n var messagePrefix = \"setImmediate$\" + Math.random() + \"$\";\n var onGlobalMessage = function(event) {\n if (event.source === global &&\n typeof event.data === \"string\" &&\n event.data.indexOf(messagePrefix) === 0) {\n runIfPresent(+event.data.slice(messagePrefix.length));\n }\n };\n\n if (global.addEventListener) {\n global.addEventListener(\"message\", onGlobalMessage, false);\n } else {\n global.attachEvent(\"onmessage\", onGlobalMessage);\n }\n\n registerImmediate = function(handle) {\n global.postMessage(messagePrefix + handle, \"*\");\n };\n }\n\n function installMessageChannelImplementation() {\n var channel = new MessageChannel();\n channel.port1.onmessage = function(event) {\n var handle = event.data;\n runIfPresent(handle);\n };\n\n registerImmediate = function(handle) {\n channel.port2.postMessage(handle);\n };\n }\n\n function installReadyStateChangeImplementation() {\n var html = doc.documentElement;\n registerImmediate = function(handle) {\n // Create a