@ssafy-mhk/e-ver 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -4046,7 +4046,7 @@ void main() {
4046
4046
 
4047
4047
  }
4048
4048
 
4049
- }`,Xh=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new vs(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new hl({vertexShader:Jh,fragmentShader:Yh,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Ra(new Yc(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},Zh=class extends on{constructor(e,t){super();let n=this,r=null,i=1,a=null,o=`local-floor`,s=1,c=null,l=null,u=null,d=null,f=null,p=null,m=typeof XRWebGLBinding<`u`,h=new Xh,g={},_=t.getContextAttributes(),v=null,y=null,b=[],x=[],S=new B,C=null,w=new wu;w.viewport=new $n;let T=new wu;T.viewport=new $n;let E=[w,T],D=new nd,O=null,k=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=b[e];return t===void 0&&(t=new Fr,b[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=b[e];return t===void 0&&(t=new Fr,b[e]=t),t.getGripSpace()},this.getHand=function(e){let t=b[e];return t===void 0&&(t=new Fr,b[e]=t),t.getHandSpace()};function A(e){let t=x.indexOf(e.inputSource);if(t===-1)return;let n=b[t];n!==void 0&&(n.update(e.inputSource,e.frame,c||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function j(){r.removeEventListener(`select`,A),r.removeEventListener(`selectstart`,A),r.removeEventListener(`selectend`,A),r.removeEventListener(`squeeze`,A),r.removeEventListener(`squeezestart`,A),r.removeEventListener(`squeezeend`,A),r.removeEventListener(`end`,j),r.removeEventListener(`inputsourceschange`,ee);for(let e=0;e<b.length;e++){let t=x[e];t!==null&&(x[e]=null,b[e].disconnect(t))}O=null,k=null,h.reset();for(let e in g)delete g[e];e.setRenderTarget(v),f=null,d=null,u=null,r=null,y=null,le.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(S.width,S.height,!1),n.dispatchEvent({type:`sessionend`})}this.setFramebufferScaleFactor=function(e){i=e,n.isPresenting===!0&&R(`WebXRManager: Cannot change framebuffer scale while presenting.`)},this.setReferenceSpaceType=function(e){o=e,n.isPresenting===!0&&R(`WebXRManager: Cannot change reference space type while presenting.`)},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(e){c=e},this.getBaseLayer=function(){return d===null?f:d},this.getBinding=function(){return u===null&&m&&(u=new XRWebGLBinding(r,t)),u},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(l){if(r=l,r!==null){if(v=e.getRenderTarget(),r.addEventListener(`select`,A),r.addEventListener(`selectstart`,A),r.addEventListener(`selectend`,A),r.addEventListener(`squeeze`,A),r.addEventListener(`squeezestart`,A),r.addEventListener(`squeezeend`,A),r.addEventListener(`end`,j),r.addEventListener(`inputsourceschange`,ee),_.xrCompatible!==!0&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(S),m&&`createProjectionLayer`in XRWebGLBinding.prototype){let n=null,a=null,o=null;_.depth&&(o=_.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=_.stencil?_e:ge,a=_.stencil?ue:ae);let s={colorFormat:t.RGBA8,depthFormat:o,scaleFactor:i};u=this.getBinding(),d=u.createProjectionLayer(s),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),y=new tr(d.textureWidth,d.textureHeight,{format:he,type:te,depthTexture:new gs(d.textureWidth,d.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{let n={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:i};f=new XRWebGLLayer(r,t,n),r.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),y=new tr(f.framebufferWidth,f.framebufferHeight,{format:he,type:te,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}y.isXRRenderTarget=!0,this.setFoveation(s),c=null,a=await r.requestReferenceSpace(o),le.setContext(r),le.start(),n.isPresenting=!0,n.dispatchEvent({type:`sessionstart`})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return h.getDepthTexture()};function ee(e){for(let t=0;t<e.removed.length;t++){let n=e.removed[t],r=x.indexOf(n);r>=0&&(x[r]=null,b[r].disconnect(n))}for(let t=0;t<e.added.length;t++){let n=e.added[t],r=x.indexOf(n);if(r===-1){for(let e=0;e<b.length;e++)if(e>=x.length){x.push(n),r=e;break}else if(x[e]===null){x[e]=n,r=e;break}if(r===-1)break}let i=b[r];i&&i.connect(n)}}let ne=new V,M=new V;function re(e,t,n){ne.setFromMatrixPosition(t.matrixWorld),M.setFromMatrixPosition(n.matrixWorld);let r=ne.distanceTo(M),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),i[10]===-1)e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+m,n=s+m,i=f-h,a=p+(r-h),u=c*s/n*t,d=l*s/n*t;e.projectionMatrix.makePerspective(i,a,u,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function ie(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(r===null)return;let t=e.near,n=e.far;h.texture!==null&&(h.depthNear>0&&(t=h.depthNear),h.depthFar>0&&(n=h.depthFar)),D.near=T.near=w.near=t,D.far=T.far=w.far=n,(O!==D.near||k!==D.far)&&(r.updateRenderState({depthNear:D.near,depthFar:D.far}),O=D.near,k=D.far),D.layers.mask=e.layers.mask|6,w.layers.mask=D.layers.mask&-5,T.layers.mask=D.layers.mask&-3;let i=e.parent,a=D.cameras;ie(D,i);for(let e=0;e<a.length;e++)ie(a[e],i);a.length===2?re(D,w,T):D.projectionMatrix.copy(w.projectionMatrix),oe(e,D,i)};function oe(e,t,n){n===null?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld)),e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=un*2*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}this.getCamera=function(){return D},this.getFoveation=function(){if(!(d===null&&f===null))return s},this.setFoveation=function(e){s=e,d!==null&&(d.fixedFoveation=e),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=e)},this.hasDepthSensing=function(){return h.texture!==null},this.getDepthSensingMesh=function(){return h.getMesh(D)},this.getCameraTexture=function(e){return g[e]};let se=null;function ce(t,i){if(l=i.getViewerPose(c||a),p=i,l!==null){let t=l.views;f!==null&&(e.setRenderTargetFramebuffer(y,f.framebuffer),e.setRenderTarget(y));let i=!1;t.length!==D.cameras.length&&(D.cameras.length=0,i=!0);for(let n=0;n<t.length;n++){let r=t[n],a=null;if(f!==null)a=f.getViewport(r);else{let t=u.getViewSubImage(d,r);a=t.viewport,n===0&&(e.setRenderTargetTextures(y,t.colorTexture,t.depthStencilTexture),e.setRenderTarget(y))}let o=E[n];o===void 0&&(o=new wu,o.layers.enable(n),o.viewport=new $n,E[n]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(a.x,a.y,a.width,a.height),n===0&&(D.matrix.copy(o.matrix),D.matrix.decompose(D.position,D.quaternion,D.scale)),i===!0&&D.cameras.push(o)}let a=r.enabledFeatures;if(a&&a.includes(`depth-sensing`)&&r.depthUsage==`gpu-optimized`&&m){u=n.getBinding();let e=u.getDepthInformation(t[0]);e&&e.isValid&&e.texture&&h.init(e,r.renderState)}if(a&&a.includes(`camera-access`)&&m){e.state.unbindTexture(),u=n.getBinding();for(let e=0;e<t.length;e++){let n=t[e].camera;if(n){let e=g[n];e||(e=new vs,g[n]=e);let t=u.getCameraImage(n);e.sourceTexture=t}}}}for(let e=0;e<b.length;e++){let t=x[e],n=b[e];t!==null&&n!==void 0&&n.update(t,i,c||a)}se&&se(t,i),i.detectedPlanes&&n.dispatchEvent({type:`planesdetected`,data:i}),p=null}let le=new Kf;le.setAnimationLoop(ce),this.setAnimationLoop=function(e){se=e},this.dispose=function(){}}},Qh=new hr,$h=new or;function eg(e,t){function n(e,t){e.matrixAutoUpdate===!0&&e.updateMatrix(),t.value.copy(e.matrix)}function r(t,n){n.color.getRGB(t.fogColor.value,dl(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)}function i(e,t,n,r,i){t.isMeshBasicMaterial?a(e,t):t.isMeshLambertMaterial?(a(e,t),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)):t.isMeshToonMaterial?(a(e,t),d(e,t)):t.isMeshPhongMaterial?(a(e,t),u(e,t),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)):t.isMeshStandardMaterial?(a(e,t),f(e,t),t.isMeshPhysicalMaterial&&p(e,t,i)):t.isMeshMatcapMaterial?(a(e,t),m(e,t)):t.isMeshDepthMaterial?a(e,t):t.isMeshDistanceMaterial?(a(e,t),h(e,t)):t.isMeshNormalMaterial?a(e,t):t.isLineBasicMaterial?(o(e,t),t.isLineDashedMaterial&&s(e,t)):t.isPointsMaterial?c(e,t,n,r):t.isSpriteMaterial?l(e,t):t.isShadowMaterial?(e.color.value.copy(t.color),e.opacity.value=t.opacity):t.isShaderMaterial&&(t.uniformsNeedUpdate=!1)}function a(e,r){e.opacity.value=r.opacity,r.color&&e.diffuse.value.copy(r.color),r.emissive&&e.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(e.map.value=r.map,n(r.map,e.mapTransform)),r.alphaMap&&(e.alphaMap.value=r.alphaMap,n(r.alphaMap,e.alphaMapTransform)),r.bumpMap&&(e.bumpMap.value=r.bumpMap,n(r.bumpMap,e.bumpMapTransform),e.bumpScale.value=r.bumpScale,r.side===1&&(e.bumpScale.value*=-1)),r.normalMap&&(e.normalMap.value=r.normalMap,n(r.normalMap,e.normalMapTransform),e.normalScale.value.copy(r.normalScale),r.side===1&&e.normalScale.value.negate()),r.displacementMap&&(e.displacementMap.value=r.displacementMap,n(r.displacementMap,e.displacementMapTransform),e.displacementScale.value=r.displacementScale,e.displacementBias.value=r.displacementBias),r.emissiveMap&&(e.emissiveMap.value=r.emissiveMap,n(r.emissiveMap,e.emissiveMapTransform)),r.specularMap&&(e.specularMap.value=r.specularMap,n(r.specularMap,e.specularMapTransform)),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,Qh.copy(o),Qh.x*=-1,Qh.y*=-1,Qh.z*=-1,a.isCubeTexture&&a.isRenderTargetTexture===!1&&(Qh.y*=-1,Qh.z*=-1),e.envMapRotation.value.setFromMatrix4($h.makeRotationFromEuler(Qh)),e.flipEnvMap.value=a.isCubeTexture&&a.isRenderTargetTexture===!1?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}function o(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}function s(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function c(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=i*.5,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function l(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}function d(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function f(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function p(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===1&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}function m(e,t){t.matcap&&(e.matcap.value=t.matcap)}function h(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function tg(e,t,n,r){let i={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(e,t){let n=t.program;r.uniformBlockBinding(e,n)}function l(e,n){let o=i[e.id];o===void 0&&(m(e),o=u(e),i[e.id]=o,e.addEventListener(`dispose`,g));let s=n.program;r.updateUBOMapping(e,s);let c=t.render.frame;a[e.id]!==c&&(f(e),a[e.id]=c)}function u(t){let n=d();t.__bindingPointIndex=n;let r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}function d(){for(let e=0;e<s;e++)if(o.indexOf(e)===-1)return o.push(e),e;return z(`WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.`),0}function f(t){let n=i[t.id],r=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let t=0,n=r.length;t<n;t++){let n=Array.isArray(r[t])?r[t]:[r[t]];for(let r=0,i=n.length;r<i;r++){let i=n[r];if(p(i,t,r,a)===!0){let t=i.__offset,n=Array.isArray(i.value)?i.value:[i.value],r=0;for(let a=0;a<n.length;a++){let o=n[a],s=h(o);typeof o==`number`||typeof o==`boolean`?(i.__data[0]=o,e.bufferSubData(e.UNIFORM_BUFFER,t+r,i.__data)):o.isMatrix3?(i.__data[0]=o.elements[0],i.__data[1]=o.elements[1],i.__data[2]=o.elements[2],i.__data[3]=0,i.__data[4]=o.elements[3],i.__data[5]=o.elements[4],i.__data[6]=o.elements[5],i.__data[7]=0,i.__data[8]=o.elements[6],i.__data[9]=o.elements[7],i.__data[10]=o.elements[8],i.__data[11]=0):(o.toArray(i.__data,r),r+=s.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,i.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}function p(e,t,n,r){let i=e.value,a=t+`_`+n;if(r[a]===void 0)return typeof i==`number`||typeof i==`boolean`?r[a]=i:r[a]=i.clone(),!0;{let e=r[a];if(typeof i==`number`||typeof i==`boolean`){if(e!==i)return r[a]=i,!0}else if(e.equals(i)===!1)return e.copy(i),!0}return!1}function m(e){let t=e.uniforms,n=0;for(let e=0,r=t.length;e<r;e++){let r=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=r.length;e<t;e++){let t=r[e],i=Array.isArray(t.value)?t.value:[t.value];for(let e=0,r=i.length;e<r;e++){let r=i[e],a=h(r),o=n%16,s=o%a.boundary,c=o+s;n+=s,c!==0&&16-c<a.storage&&(n+=16-c),t.__data=new Float32Array(a.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=a.storage}}}let r=n%16;return r>0&&(n+=16-r),e.__size=n,e.__cache={},this}function h(e){let t={boundary:0,storage:0};return typeof e==`number`||typeof e==`boolean`?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?R(`WebGLRenderer: Texture samplers can not be part of an uniforms group.`):R(`WebGLRenderer: Unsupported uniform value type.`,e),t}function g(t){let n=t.target;n.removeEventListener(`dispose`,g);let r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}function _(){for(let t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}return{bind:c,update:l,dispose:_}}var ng=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),rg=null;function ig(){return rg===null&&(rg=new Za(ng,16,16,be,se),rg.name=`DFG_LUT`,rg.minFilter=O,rg.magFilter=O,rg.wrapS=x,rg.wrapT=x,rg.generateMipmaps=!1,rg.needsUpdate=!0),rg}var ag=class{constructor(e={}){let{canvas:t=Yt(),context:n=null,depth:r=!0,stencil:i=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:l=`default`,failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1,outputBufferType:f=te}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<`u`&&n instanceof WebGLRenderingContext)throw Error(`THREE.WebGLRenderer: WebGL 1 is not supported since r163.`);p=n.getContextAttributes().alpha}else p=a;let m=f,h=new Set([Ce,xe,ye]),g=new Set([te,ae,re,ue,ce,le]),_=new Uint32Array(4),v=new Int32Array(4),y=null,b=null,x=[],S=[],C=null;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.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let w=this,T=!1;this._outputColorSpace=_t;let E=0,D=0,O=null,k=-1,A=null,ee=new $n,ne=new $n,M=null,ie=new U(0),oe=0,de=t.width,fe=t.height,pe=1,me=null,he=null,ge=new $n(0,0,de,fe),_e=new $n(0,0,de,fe),ve=!1,be=new vo,Se=!1,we=!1,Te=new or,Ee=new V,De=new $n,Oe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},N=!1;function ke(){return O===null?pe:1}let P=n;function Ae(e,n){return t.getContext(e,n)}try{let e={alpha:!0,depth:r,stencil:i,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(`setAttribute`in t&&t.setAttribute(`data-engine`,`three.js r183`),t.addEventListener(`webglcontextlost`,et,!1),t.addEventListener(`webglcontextrestored`,tt,!1),t.addEventListener(`webglcontextcreationerror`,nt,!1),P===null){let t=`webgl2`;if(P=Ae(t,e),P===null)throw Ae(t)?Error(`Error creating WebGL context with your selected attributes.`):Error(`Error creating WebGL context.`)}}catch(e){throw z(`WebGLRenderer: `+e.message),e}let je,Me,F,Ne,I,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,We,Ge,Ke,qe,Je,Ye,Xe,Ze;function Qe(){je=new Tp(P),je.init(),Ye=new qh(P,je),Me=new np(P,je,e,Ye),F=new Gh(P,je),Me.reversedDepthBuffer&&d&&F.buffers.depth.setReversed(!0),Ne=new Op(P),I=new Th,Pe=new Kh(P,je,F,I,Me,Ye,Ne),Fe=new wp(w),Ie=new qf(P),Xe=new ep(P,Ie),Le=new Ep(P,Ie,Ne,Xe),Re=new Ap(P,Le,Ie,Xe,Ne),Ke=new kp(P,Me,Pe),Ue=new rp(I),ze=new Y(w,Fe,je,Me,Xe,Ue),Be=new eg(w,I),Ve=new kh,He=new Ih(je),Ge=new $f(w,Fe,F,Re,p,s),We=new Wh(w,Re,Me),Ze=new tg(P,Ne,Me,F),qe=new tp(P,je,Ne),Je=new Dp(P,je,Ne),Ne.programs=ze.programs,w.capabilities=Me,w.extensions=je,w.properties=I,w.renderLists=Ve,w.shadowMap=We,w.state=F,w.info=Ne}Qe(),m!==1009&&(C=new Mp(m,t.width,t.height,r,i));let $e=new Zh(w,P);this.xr=$e,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){let e=je.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){let e=je.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return pe},this.setPixelRatio=function(e){e!==void 0&&(pe=e,this.setSize(de,fe,!1))},this.getSize=function(e){return e.set(de,fe)},this.setSize=function(e,n,r=!0){if($e.isPresenting){R(`WebGLRenderer: Can't change size while VR device is presenting.`);return}de=e,fe=n,t.width=Math.floor(e*pe),t.height=Math.floor(n*pe),r===!0&&(t.style.width=e+`px`,t.style.height=n+`px`),C!==null&&C.setSize(t.width,t.height),this.setViewport(0,0,e,n)},this.getDrawingBufferSize=function(e){return e.set(de*pe,fe*pe).floor()},this.setDrawingBufferSize=function(e,n,r){de=e,fe=n,pe=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.setEffects=function(e){if(m===1009){console.error(`THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.`);return}if(e){for(let t=0;t<e.length;t++)if(e[t].isOutputPass===!0){console.warn(`THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.`);break}}C.setEffects(e||[])},this.getCurrentViewport=function(e){return e.copy(ee)},this.getViewport=function(e){return e.copy(ge)},this.setViewport=function(e,t,n,r){e.isVector4?ge.set(e.x,e.y,e.z,e.w):ge.set(e,t,n,r),F.viewport(ee.copy(ge).multiplyScalar(pe).round())},this.getScissor=function(e){return e.copy(_e)},this.setScissor=function(e,t,n,r){e.isVector4?_e.set(e.x,e.y,e.z,e.w):_e.set(e,t,n,r),F.scissor(ne.copy(_e).multiplyScalar(pe).round())},this.getScissorTest=function(){return ve},this.setScissorTest=function(e){F.setScissorTest(ve=e)},this.setOpaqueSort=function(e){me=e},this.setTransparentSort=function(e){he=e},this.getClearColor=function(e){return e.copy(Ge.getClearColor())},this.setClearColor=function(){Ge.setClearColor(...arguments)},this.getClearAlpha=function(){return Ge.getClearAlpha()},this.setClearAlpha=function(){Ge.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let r=0;if(e){let e=!1;if(O!==null){let t=O.texture.format;e=h.has(t)}if(e){let e=O.texture.type,t=g.has(e),n=Ge.getClearColor(),r=Ge.getClearAlpha(),i=n.r,a=n.g,o=n.b;t?(_[0]=i,_[1]=a,_[2]=o,_[3]=r,P.clearBufferuiv(P.COLOR,0,_)):(v[0]=i,v[1]=a,v[2]=o,v[3]=r,P.clearBufferiv(P.COLOR,0,v))}else r|=P.COLOR_BUFFER_BIT}t&&(r|=P.DEPTH_BUFFER_BIT),n&&(r|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),r!==0&&P.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener(`webglcontextlost`,et,!1),t.removeEventListener(`webglcontextrestored`,tt,!1),t.removeEventListener(`webglcontextcreationerror`,nt,!1),Ge.dispose(),Ve.dispose(),He.dispose(),I.dispose(),Fe.dispose(),Re.dispose(),Xe.dispose(),Ze.dispose(),ze.dispose(),$e.dispose(),$e.removeEventListener(`sessionstart`,lt),$e.removeEventListener(`sessionend`,ut),dt.stop()};function et(e){e.preventDefault(),en(`WebGLRenderer: Context Lost.`),T=!0}function tt(){en(`WebGLRenderer: Context Restored.`),T=!1;let e=Ne.autoReset,t=We.enabled,n=We.autoUpdate,r=We.needsUpdate,i=We.type;Qe(),Ne.autoReset=e,We.enabled=t,We.autoUpdate=n,We.needsUpdate=r,We.type=i}function nt(e){z(`WebGLRenderer: A WebGL context could not be created. Reason: `,e.statusMessage)}function rt(e){let t=e.target;t.removeEventListener(`dispose`,rt),it(t)}function it(e){at(e),I.remove(e)}function at(e){let t=I.get(e).programs;t!==void 0&&(t.forEach(function(e){ze.releaseProgram(e)}),e.isShaderMaterial&&ze.releaseShaderCache(e))}this.renderBufferDirect=function(e,t,n,r,i,a){t===null&&(t=Oe);let o=i.isMesh&&i.matrixWorld.determinant()<0,s=xt(e,t,n,r,i);F.setMaterial(r,o);let c=n.index,l=1;if(r.wireframe===!0){if(c=Le.getWireframeAttribute(n),c===void 0)return;l=2}let u=n.drawRange,d=n.attributes.position,f=u.start*l,p=(u.start+u.count)*l;a!==null&&(f=Math.max(f,a.start*l),p=Math.min(p,(a.start+a.count)*l)),c===null?d!=null&&(f=Math.max(f,0),p=Math.min(p,d.count)):(f=Math.max(f,0),p=Math.min(p,c.count));let m=p-f;if(m<0||m===1/0)return;Xe.setup(i,r,s,n,c);let h,g=qe;if(c!==null&&(h=Ie.get(c),g=Je,g.setIndex(h)),i.isMesh)r.wireframe===!0?(F.setLineWidth(r.wireframeLinewidth*ke()),g.setMode(P.LINES)):g.setMode(P.TRIANGLES);else if(i.isLine){let e=r.linewidth;e===void 0&&(e=1),F.setLineWidth(e*ke()),i.isLineSegments?g.setMode(P.LINES):i.isLineLoop?g.setMode(P.LINE_LOOP):g.setMode(P.LINE_STRIP)}else i.isPoints?g.setMode(P.POINTS):i.isSprite&&g.setMode(P.TRIANGLES);if(i.isBatchedMesh)if(i._multiDrawInstances!==null)nn(`WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.`),g.renderMultiDrawInstances(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount,i._multiDrawInstances);else if(je.get(`WEBGL_multi_draw`))g.renderMultiDraw(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount);else{let e=i._multiDrawStarts,t=i._multiDrawCounts,n=i._multiDrawCount,a=c?Ie.get(c).bytesPerElement:1,o=I.get(r).currentProgram.getUniforms();for(let r=0;r<n;r++)o.setValue(P,`_gl_DrawID`,r),g.render(e[r]/a,t[r])}else if(i.isInstancedMesh)g.renderInstances(f,m,i.count);else if(n.isInstancedBufferGeometry){let e=n._maxInstanceCount===void 0?1/0:n._maxInstanceCount,t=Math.min(n.instanceCount,e);g.renderInstances(f,m,t)}else g.render(f,m)};function ot(e,t,n){e.transparent===!0&&e.side===2&&e.forceSinglePass===!1?(e.side=1,e.needsUpdate=!0,gt(e,t,n),e.side=0,e.needsUpdate=!0,gt(e,t,n),e.side=2):gt(e,t,n)}this.compile=function(e,t,n=null){n===null&&(n=e),b=He.get(n),b.init(t),S.push(b),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(b.pushLight(e),e.castShadow&&b.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(b.pushLight(e),e.castShadow&&b.pushShadow(e))}),b.setupLights();let r=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;let t=e.material;if(t)if(Array.isArray(t))for(let i=0;i<t.length;i++){let a=t[i];ot(a,n,e),r.add(a)}else ot(t,n,e),r.add(t)}),b=S.pop(),r},this.compileAsync=function(e,t,n=null){let r=this.compile(e,t,n);return new Promise(t=>{function n(){if(r.forEach(function(e){I.get(e).currentProgram.isReady()&&r.delete(e)}),r.size===0){t(e);return}setTimeout(n,10)}je.get(`KHR_parallel_shader_compile`)===null?setTimeout(n,10):n()})};let st=null;function ct(e){st&&st(e)}function lt(){dt.stop()}function ut(){dt.start()}let dt=new Kf;dt.setAnimationLoop(ct),typeof self<`u`&&dt.setContext(self),this.setAnimationLoop=function(e){st=e,$e.setAnimationLoop(e),e===null?dt.stop():dt.start()},$e.addEventListener(`sessionstart`,lt),$e.addEventListener(`sessionend`,ut),this.render=function(e,t){if(t!==void 0&&t.isCamera!==!0){z(`WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(T===!0)return;let n=$e.enabled===!0&&$e.isPresenting===!0,r=C!==null&&(O===null||n)&&C.begin(w,O);if(e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),$e.enabled===!0&&$e.isPresenting===!0&&(C===null||C.isCompositing()===!1)&&($e.cameraAutoUpdate===!0&&$e.updateCamera(t),t=$e.getCamera()),e.isScene===!0&&e.onBeforeRender(w,e,t,O),b=He.get(e,S.length),b.init(t),S.push(b),Te.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),be.setFromProjectionMatrix(Te,Rt,t.reversedDepth),we=this.localClippingEnabled,Se=Ue.init(this.clippingPlanes,we),y=Ve.get(e,x.length),y.init(),x.push(y),$e.enabled===!0&&$e.isPresenting===!0){let e=w.xr.getDepthSensingMesh();e!==null&&ft(e,t,-1/0,w.sortObjects)}ft(e,t,0,w.sortObjects),y.finish(),w.sortObjects===!0&&y.sort(me,he),N=$e.enabled===!1||$e.isPresenting===!1||$e.hasDepthSensing()===!1,N&&Ge.addToRenderList(y,e),this.info.render.frame++,Se===!0&&Ue.beginShadows();let i=b.state.shadowsArray;if(We.render(i,e,t),Se===!0&&Ue.endShadows(),this.info.autoReset===!0&&this.info.reset(),(r&&C.hasRenderPass())===!1){let n=y.opaque,r=y.transmissive;if(b.setupLights(),t.isArrayCamera){let i=t.cameras;if(r.length>0)for(let t=0,a=i.length;t<a;t++){let a=i[t];mt(n,r,e,a)}N&&Ge.render(e);for(let t=0,n=i.length;t<n;t++){let n=i[t];pt(y,e,n,n.viewport)}}else r.length>0&&mt(n,r,e,t),N&&Ge.render(e),pt(y,e,t)}O!==null&&D===0&&(Pe.updateMultisampleRenderTarget(O),Pe.updateRenderTargetMipmap(O)),r&&C.end(w),e.isScene===!0&&e.onAfterRender(w,e,t),Xe.resetDefaultState(),k=-1,A=null,S.pop(),S.length>0?(b=S[S.length-1],Se===!0&&Ue.setGlobalState(w.clippingPlanes,b.state.camera)):b=null,x.pop(),y=x.length>0?x[x.length-1]:null};function ft(e,t,n,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)b.pushLight(e),e.castShadow&&b.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||be.intersectsSprite(e)){r&&De.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Te);let t=Re.update(e),i=e.material;i.visible&&y.push(e,t,i,n,De.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||be.intersectsObject(e))){let t=Re.update(e),i=e.material;if(r&&(e.boundingSphere===void 0?(t.boundingSphere===null&&t.computeBoundingSphere(),De.copy(t.boundingSphere.center)):(e.boundingSphere===null&&e.computeBoundingSphere(),De.copy(e.boundingSphere.center)),De.applyMatrix4(e.matrixWorld).applyMatrix4(Te)),Array.isArray(i)){let r=t.groups;for(let a=0,o=r.length;a<o;a++){let o=r[a],s=i[o.materialIndex];s&&s.visible&&y.push(e,t,s,n,De.z,o)}}else i.visible&&y.push(e,t,i,n,De.z,null)}}let i=e.children;for(let e=0,a=i.length;e<a;e++)ft(i[e],t,n,r)}function pt(e,t,n,r){let{opaque:i,transmissive:a,transparent:o}=e;b.setupLightsView(n),Se===!0&&Ue.setGlobalState(w.clippingPlanes,n),r&&F.viewport(ee.copy(r)),i.length>0&&L(i,t,n),a.length>0&&L(a,t,n),o.length>0&&L(o,t,n),F.buffers.depth.setTest(!0),F.buffers.depth.setMask(!0),F.buffers.color.setMask(!0),F.setPolygonOffset(!1)}function mt(e,t,n,r){if((n.isScene===!0?n.overrideMaterial:null)!==null)return;if(b.state.transmissionRenderTarget[r.id]===void 0){let e=je.has(`EXT_color_buffer_half_float`)||je.has(`EXT_color_buffer_float`);b.state.transmissionRenderTarget[r.id]=new tr(1,1,{generateMipmaps:!0,type:e?se:te,minFilter:j,samples:Math.max(4,Me.samples),stencilBuffer:i,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Hn.workingColorSpace})}let a=b.state.transmissionRenderTarget[r.id],o=r.viewport||ee;a.setSize(o.z*w.transmissionResolutionScale,o.w*w.transmissionResolutionScale);let s=w.getRenderTarget(),c=w.getActiveCubeFace(),l=w.getActiveMipmapLevel();w.setRenderTarget(a),w.getClearColor(ie),oe=w.getClearAlpha(),oe<1&&w.setClearColor(16777215,.5),w.clear(),N&&Ge.render(n);let u=w.toneMapping;w.toneMapping=0;let d=r.viewport;if(r.viewport!==void 0&&(r.viewport=void 0),b.setupLightsView(r),Se===!0&&Ue.setGlobalState(w.clippingPlanes,r),L(e,n,r),Pe.updateMultisampleRenderTarget(a),Pe.updateRenderTargetMipmap(a),je.has(`WEBGL_multisampled_render_to_texture`)===!1){let e=!1;for(let i=0,a=t.length;i<a;i++){let{object:a,geometry:o,material:s,group:c}=t[i];if(s.side===2&&a.layers.test(r.layers)){let t=s.side;s.side=1,s.needsUpdate=!0,ht(a,n,r,o,s,c),s.side=t,s.needsUpdate=!0,e=!0}}e===!0&&(Pe.updateMultisampleRenderTarget(a),Pe.updateRenderTargetMipmap(a))}w.setRenderTarget(s,c,l),w.setClearColor(ie,oe),d!==void 0&&(r.viewport=d),w.toneMapping=u}function L(e,t,n){let r=t.isScene===!0?t.overrideMaterial:null;for(let i=0,a=e.length;i<a;i++){let a=e[i],{object:o,geometry:s,group:c}=a,l=a.material;l.allowOverride===!0&&r!==null&&(l=r),o.layers.test(n.layers)&&ht(o,t,n,s,l,c)}}function ht(e,t,n,r,i,a){e.onBeforeRender(w,t,n,r,i,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),i.onBeforeRender(w,t,n,r,e,a),i.transparent===!0&&i.side===2&&i.forceSinglePass===!1?(i.side=1,i.needsUpdate=!0,w.renderBufferDirect(n,t,r,i,e,a),i.side=0,i.needsUpdate=!0,w.renderBufferDirect(n,t,r,i,e,a),i.side=2):w.renderBufferDirect(n,t,r,i,e,a),e.onAfterRender(w,t,n,r,i,a)}function gt(e,t,n){t.isScene!==!0&&(t=Oe);let r=I.get(e),i=b.state.lights,a=b.state.shadowsArray,o=i.state.version,s=ze.getParameters(e,i.state,a,t,n),c=ze.getProgramCacheKey(s),l=r.programs;r.environment=e.isMeshStandardMaterial||e.isMeshLambertMaterial||e.isMeshPhongMaterial?t.environment:null,r.fog=t.fog;let u=e.isMeshStandardMaterial||e.isMeshLambertMaterial&&!e.envMap||e.isMeshPhongMaterial&&!e.envMap;r.envMap=Fe.get(e.envMap||r.environment,u),r.envMapRotation=r.environment!==null&&e.envMap===null?t.environmentRotation:e.envMapRotation,l===void 0&&(e.addEventListener(`dispose`,rt),l=new Map,r.programs=l);let d=l.get(c);if(d!==void 0){if(r.currentProgram===d&&r.lightsStateVersion===o)return bt(e,s),d}else s.uniforms=ze.getUniforms(e),e.onBeforeCompile(s,w),d=ze.acquireProgram(s,c),l.set(c,d),r.uniforms=s.uniforms;let f=r.uniforms;return(!e.isShaderMaterial&&!e.isRawShaderMaterial||e.clipping===!0)&&(f.clippingPlanes=Ue.uniform),bt(e,s),r.needsLights=Ct(e),r.lightsStateVersion=o,r.needsLights&&(f.ambientLightColor.value=i.state.ambient,f.lightProbe.value=i.state.probe,f.directionalLights.value=i.state.directional,f.directionalLightShadows.value=i.state.directionalShadow,f.spotLights.value=i.state.spot,f.spotLightShadows.value=i.state.spotShadow,f.rectAreaLights.value=i.state.rectArea,f.ltc_1.value=i.state.rectAreaLTC1,f.ltc_2.value=i.state.rectAreaLTC2,f.pointLights.value=i.state.point,f.pointLightShadows.value=i.state.pointShadow,f.hemisphereLights.value=i.state.hemi,f.directionalShadowMatrix.value=i.state.directionalShadowMatrix,f.spotLightMatrix.value=i.state.spotLightMatrix,f.spotLightMap.value=i.state.spotLightMap,f.pointShadowMatrix.value=i.state.pointShadowMatrix),r.currentProgram=d,r.uniformsList=null,d}function yt(e){if(e.uniformsList===null){let t=e.currentProgram.getUniforms();e.uniformsList=zm.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function bt(e,t){let n=I.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}function xt(e,t,n,r,i){t.isScene!==!0&&(t=Oe),Pe.resetTextureUnits();let a=t.fog,o=r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial?t.environment:null,s=O===null?w.outputColorSpace:O.isXRRenderTarget===!0?O.texture.colorSpace:vt,c=r.isMeshStandardMaterial||r.isMeshLambertMaterial&&!r.envMap||r.isMeshPhongMaterial&&!r.envMap,l=Fe.get(r.envMap||o,c),u=r.vertexColors===!0&&!!n.attributes.color&&n.attributes.color.itemSize===4,d=!!n.attributes.tangent&&(!!r.normalMap||r.anisotropy>0),f=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,m=!!n.morphAttributes.color,h=0;r.toneMapped&&(O===null||O.isXRRenderTarget===!0)&&(h=w.toneMapping);let g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=g===void 0?0:g.length,v=I.get(r),y=b.state.lights;if(Se===!0&&(we===!0||e!==A)){let t=e===A&&r.id===k;Ue.setState(r,e,t)}let x=!1;r.version===v.__version?v.needsLights&&v.lightsStateVersion!==y.state.version?x=!0:v.outputColorSpace===s?i.isBatchedMesh&&v.batching===!1||!i.isBatchedMesh&&v.batching===!0||i.isBatchedMesh&&v.batchingColor===!0&&i.colorTexture===null||i.isBatchedMesh&&v.batchingColor===!1&&i.colorTexture!==null||i.isInstancedMesh&&v.instancing===!1||!i.isInstancedMesh&&v.instancing===!0||i.isSkinnedMesh&&v.skinning===!1||!i.isSkinnedMesh&&v.skinning===!0||i.isInstancedMesh&&v.instancingColor===!0&&i.instanceColor===null||i.isInstancedMesh&&v.instancingColor===!1&&i.instanceColor!==null||i.isInstancedMesh&&v.instancingMorph===!0&&i.morphTexture===null||i.isInstancedMesh&&v.instancingMorph===!1&&i.morphTexture!==null?x=!0:v.envMap===l?r.fog===!0&&v.fog!==a||v.numClippingPlanes!==void 0&&(v.numClippingPlanes!==Ue.numPlanes||v.numIntersection!==Ue.numIntersection)?x=!0:v.vertexAlphas===u&&v.vertexTangents===d&&v.morphTargets===f&&v.morphNormals===p&&v.morphColors===m&&v.toneMapping===h?v.morphTargetsCount!==_&&(x=!0):x=!0:x=!0:x=!0:(x=!0,v.__version=r.version);let S=v.currentProgram;x===!0&&(S=gt(r,t,i));let C=!1,T=!1,E=!1,D=S.getUniforms(),j=v.uniforms;if(F.useProgram(S.program)&&(C=!0,T=!0,E=!0),r.id!==k&&(k=r.id,T=!0),C||A!==e){F.buffers.depth.getReversed()&&e.reversedDepth!==!0&&(e._reversedDepth=!0,e.updateProjectionMatrix()),D.setValue(P,`projectionMatrix`,e.projectionMatrix),D.setValue(P,`viewMatrix`,e.matrixWorldInverse);let t=D.map.cameraPosition;t!==void 0&&t.setValue(P,Ee.setFromMatrixPosition(e.matrixWorld)),Me.logarithmicDepthBuffer&&D.setValue(P,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&D.setValue(P,`isOrthographic`,e.isOrthographicCamera===!0),A!==e&&(A=e,T=!0,E=!0)}if(v.needsLights&&(y.state.directionalShadowMap.length>0&&D.setValue(P,`directionalShadowMap`,y.state.directionalShadowMap,Pe),y.state.spotShadowMap.length>0&&D.setValue(P,`spotShadowMap`,y.state.spotShadowMap,Pe),y.state.pointShadowMap.length>0&&D.setValue(P,`pointShadowMap`,y.state.pointShadowMap,Pe)),i.isSkinnedMesh){D.setOptional(P,i,`bindMatrix`),D.setOptional(P,i,`bindMatrixInverse`);let e=i.skeleton;e&&(e.boneTexture===null&&e.computeBoneTexture(),D.setValue(P,`boneTexture`,e.boneTexture,Pe))}i.isBatchedMesh&&(D.setOptional(P,i,`batchingTexture`),D.setValue(P,`batchingTexture`,i._matricesTexture,Pe),D.setOptional(P,i,`batchingIdTexture`),D.setValue(P,`batchingIdTexture`,i._indirectTexture,Pe),D.setOptional(P,i,`batchingColorTexture`),i._colorsTexture!==null&&D.setValue(P,`batchingColorTexture`,i._colorsTexture,Pe));let ee=n.morphAttributes;if((ee.position!==void 0||ee.normal!==void 0||ee.color!==void 0)&&Ke.update(i,n,S),(T||v.receiveShadow!==i.receiveShadow)&&(v.receiveShadow=i.receiveShadow,D.setValue(P,`receiveShadow`,i.receiveShadow)),(r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial)&&r.envMap===null&&t.environment!==null&&(j.envMapIntensity.value=t.environmentIntensity),j.dfgLUT!==void 0&&(j.dfgLUT.value=ig()),T&&(D.setValue(P,`toneMappingExposure`,w.toneMappingExposure),v.needsLights&&St(j,E),a&&r.fog===!0&&Be.refreshFogUniforms(j,a),Be.refreshMaterialUniforms(j,r,pe,fe,b.state.transmissionRenderTarget[e.id]),zm.upload(P,yt(v),j,Pe)),r.isShaderMaterial&&r.uniformsNeedUpdate===!0&&(zm.upload(P,yt(v),j,Pe),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&D.setValue(P,`center`,i.center),D.setValue(P,`modelViewMatrix`,i.modelViewMatrix),D.setValue(P,`normalMatrix`,i.normalMatrix),D.setValue(P,`modelMatrix`,i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial){let e=r.uniformsGroups;for(let t=0,n=e.length;t<n;t++){let n=e[t];Ze.update(n,S),Ze.bind(n,S)}}return S}function St(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function Ct(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&e.lights===!0}this.getActiveCubeFace=function(){return E},this.getActiveMipmapLevel=function(){return D},this.getRenderTarget=function(){return O},this.setRenderTargetTextures=function(e,t,n){let r=I.get(e);r.__autoAllocateDepthBuffer=e.resolveDepthBuffer===!1,r.__autoAllocateDepthBuffer===!1&&(r.__useRenderToTexture=!1),I.get(e.texture).__webglTexture=t,I.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:n,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){let n=I.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=t===void 0};let wt=P.createFramebuffer();this.setRenderTarget=function(e,t=0,n=0){O=e,E=t,D=n;let r=null,i=!1,a=!1;if(e){let o=I.get(e);if(o.__useDefaultFramebuffer!==void 0){F.bindFramebuffer(P.FRAMEBUFFER,o.__webglFramebuffer),ee.copy(e.viewport),ne.copy(e.scissor),M=e.scissorTest,F.viewport(ee),F.scissor(ne),F.setScissorTest(M),k=-1;return}else if(o.__webglFramebuffer===void 0)Pe.setupRenderTarget(e);else if(o.__hasExternalTextures)Pe.rebindTextures(e,I.get(e.texture).__webglTexture,I.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let t=e.depthTexture;if(o.__boundDepthTexture!==t){if(t!==null&&I.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw Error(`WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.`);Pe.setupDepthRenderbuffer(e)}}let s=e.texture;(s.isData3DTexture||s.isDataArrayTexture||s.isCompressedArrayTexture)&&(a=!0);let c=I.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(c[t])?c[t][n]:c[t],i=!0):r=e.samples>0&&Pe.useMultisampledRTT(e)===!1?I.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,ee.copy(e.viewport),ne.copy(e.scissor),M=e.scissorTest}else ee.copy(ge).multiplyScalar(pe).floor(),ne.copy(_e).multiplyScalar(pe).floor(),M=ve;if(n!==0&&(r=wt),F.bindFramebuffer(P.FRAMEBUFFER,r)&&F.drawBuffers(e,r),F.viewport(ee),F.scissor(ne),F.setScissorTest(M),i){let r=I.get(e.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(a){let r=t;for(let t=0;t<e.textures.length;t++){let i=I.get(e.textures[t]);P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0+t,i.__webglTexture,n,r)}}else if(e!==null&&n!==0){let t=I.get(e.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,t.__webglTexture,n)}k=-1},this.readRenderTargetPixels=function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget)){z(`WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);return}let c=I.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c){F.bindFramebuffer(P.FRAMEBUFFER,c);try{let o=e.textures[s],c=o.format,l=o.type;if(e.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+s),!Me.textureFormatReadable(c)){z(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(!Me.textureTypeReadable(l)){z(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&P.readPixels(t,n,r,i,Ye.convert(c),Ye.convert(l),a)}finally{let e=O===null?null:I.get(O).__webglFramebuffer;F.bindFramebuffer(P.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget))throw Error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);let c=I.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c)if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){F.bindFramebuffer(P.FRAMEBUFFER,c);let o=e.textures[s],l=o.format,u=o.type;if(e.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+s),!Me.textureFormatReadable(l))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.`);if(!Me.textureTypeReadable(u))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.`);let d=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,d),P.bufferData(P.PIXEL_PACK_BUFFER,a.byteLength,P.STREAM_READ),P.readPixels(t,n,r,i,Ye.convert(l),Ye.convert(u),0);let f=O===null?null:I.get(O).__webglFramebuffer;F.bindFramebuffer(P.FRAMEBUFFER,f);let p=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),await rn(P,p,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,d),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,a),P.deleteBuffer(d),P.deleteSync(p),a}else throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.`)},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=2**-n,i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=t===null?0:t.x,s=t===null?0:t.y;Pe.setTexture2D(e,0),P.copyTexSubImage2D(P.TEXTURE_2D,n,0,0,o,s,i,a),F.unbindTexture()};let Tt=P.createFramebuffer(),Et=P.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=0){let o,s,c,l,u,d,f,p,m,h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(n!==null)o=n.max.x-n.min.x,s=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,l=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{let t=2**-i;o=Math.floor(h.width*t),s=Math.floor(h.height*t),c=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,l=0,u=0,d=0}r===null?(f=0,p=0,m=0):(f=r.x,p=r.y,m=r.z);let g=Ye.convert(t.format),_=Ye.convert(t.type),v;t.isData3DTexture?(Pe.setTexture3D(t,0),v=P.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(Pe.setTexture2DArray(t,0),v=P.TEXTURE_2D_ARRAY):(Pe.setTexture2D(t,0),v=P.TEXTURE_2D),P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,t.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,t.unpackAlignment);let y=P.getParameter(P.UNPACK_ROW_LENGTH),b=P.getParameter(P.UNPACK_IMAGE_HEIGHT),x=P.getParameter(P.UNPACK_SKIP_PIXELS),S=P.getParameter(P.UNPACK_SKIP_ROWS),C=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,h.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,h.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,l),P.pixelStorei(P.UNPACK_SKIP_ROWS,u),P.pixelStorei(P.UNPACK_SKIP_IMAGES,d);let w=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=I.get(e),r=I.get(t),h=I.get(n.__renderTarget),g=I.get(r.__renderTarget);F.bindFramebuffer(P.READ_FRAMEBUFFER,h.__webglFramebuffer),F.bindFramebuffer(P.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;n<c;n++)w&&(P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,I.get(e).__webglTexture,i,d+n),P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,I.get(t).__webglTexture,a,m+n)),P.blitFramebuffer(l,u,o,s,f,p,o,s,P.DEPTH_BUFFER_BIT,P.NEAREST);F.bindFramebuffer(P.READ_FRAMEBUFFER,null),F.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else if(i!==0||e.isRenderTargetTexture||I.has(e)){let n=I.get(e),r=I.get(t);F.bindFramebuffer(P.READ_FRAMEBUFFER,Tt),F.bindFramebuffer(P.DRAW_FRAMEBUFFER,Et);for(let e=0;e<c;e++)w?P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,n.__webglTexture,i,d+e):P.framebufferTexture2D(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,n.__webglTexture,i),T?P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,r.__webglTexture,a,m+e):P.framebufferTexture2D(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,r.__webglTexture,a),i===0?T?P.copyTexSubImage3D(v,a,f,p,m+e,l,u,o,s):P.copyTexSubImage2D(v,a,f,p,l,u,o,s):P.blitFramebuffer(l,u,o,s,f,p,o,s,P.COLOR_BUFFER_BIT,P.NEAREST);F.bindFramebuffer(P.READ_FRAMEBUFFER,null),F.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else T?e.isDataTexture||e.isData3DTexture?P.texSubImage3D(v,a,f,p,m,o,s,c,g,_,h.data):t.isCompressedArrayTexture?P.compressedTexSubImage3D(v,a,f,p,m,o,s,c,g,h.data):P.texSubImage3D(v,a,f,p,m,o,s,c,g,_,h):e.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,a,f,p,o,s,g,_,h.data):e.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,a,f,p,h.width,h.height,g,h.data):P.texSubImage2D(P.TEXTURE_2D,a,f,p,o,s,g,_,h);P.pixelStorei(P.UNPACK_ROW_LENGTH,y),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,b),P.pixelStorei(P.UNPACK_SKIP_PIXELS,x),P.pixelStorei(P.UNPACK_SKIP_ROWS,S),P.pixelStorei(P.UNPACK_SKIP_IMAGES,C),a===0&&t.generateMipmaps&&P.generateMipmap(v),F.unbindTexture()},this.initRenderTarget=function(e){I.get(e).__webglFramebuffer===void 0&&Pe.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?Pe.setTextureCube(e,0):e.isData3DTexture?Pe.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?Pe.setTexture2DArray(e,0):Pe.setTexture2D(e,0),F.unbindTexture()},this.resetState=function(){E=0,D=0,O=null,F.reset(),Xe.reset()},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}get coordinateSystem(){return Rt}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=Hn._getDrawingBufferColorSpace(e),t.unpackColorSpace=Hn._getUnpackColorSpace()}},og=(0,n.createContext)(void 0),sg=()=>{let e=(0,n.useContext)(og);if(!e)throw Error(`useEver must be used within an EverProvider`);return e},cg=({children:e})=>{let t=(0,n.useRef)(null),[i,a]=(0,n.useState)(null),o={videoRef:t,avatarBones:i,setAvatarBones:(0,n.useCallback)(e=>{a(e)},[]),isProviderReady:!0};return(0,r.jsx)(og.Provider,{value:o,children:e})},lg=e=>typeof e==`object`&&typeof e.then==`function`,ug=[];function dg(e,t,n=(e,t)=>e===t){if(e===t)return!0;if(!e||!t)return!1;let r=e.length;if(t.length!==r)return!1;for(let i=0;i<r;i++)if(!n(e[i],t[i]))return!1;return!0}function fg(e,t=null,n=!1,r={}){t===null&&(t=[e]);for(let e of ug)if(dg(t,e.keys,e.equal)){if(n)return;if(Object.prototype.hasOwnProperty.call(e,`error`))throw e.error;if(Object.prototype.hasOwnProperty.call(e,`response`))return r.lifespan&&r.lifespan>0&&(e.timeout&&clearTimeout(e.timeout),e.timeout=setTimeout(e.remove,r.lifespan)),e.response;if(!n)throw e.promise}let i={keys:t,equal:r.equal,remove:()=>{let e=ug.indexOf(i);e!==-1&&ug.splice(e,1)},promise:(lg(e)?e:e(...t)).then(e=>{i.response=e,r.lifespan&&r.lifespan>0&&(i.timeout=setTimeout(i.remove,r.lifespan))}).catch(e=>i.error=e)};if(ug.push(i),!n)throw i.promise}var pg=(e,t,n)=>fg(e,t,!1,n),mg=(e,t,n)=>void fg(e,t,!0,n),hg=e=>{if(e===void 0||e.length===0)ug.splice(0,ug.length);else{let t=ug.find(t=>dg(e,t.keys,t.equal));t&&t.remove()}},gg=d((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),_g=d((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(){if(x=!1,T){var t=e.unstable_now();O=t;var n=!0;try{a:{y=!1,b&&(b=!1,C(E),E=-1),v=!0;var a=_;try{b:{for(o(t),g=r(p);g!==null&&!(g.expirationTime>t&&c());){var u=g.callback;if(typeof u==`function`){g.callback=null,_=g.priorityLevel;var d=u(g.expirationTime<=t);if(t=e.unstable_now(),typeof d==`function`){g.callback=d,o(t),n=!0;break b}g===r(p)&&i(p),o(t)}else i(p);g=r(p)}if(g!==null)n=!0;else{var f=r(m);f!==null&&l(s,f.startTime-t),n=!1}}break a}finally{g=null,_=a,v=!1}n=void 0}}finally{n?k():T=!1}}}function n(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,i=e[r];if(0<a(i,t))e[r]=t,e[n]=i,n=r;else break a}}function r(e){return e.length===0?null:e[0]}function i(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,i=e.length,o=i>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>a(c,n))l<i&&0>a(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<i&&0>a(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}function o(e){for(var t=r(m);t!==null;){if(t.callback===null)i(m);else if(t.startTime<=e)i(m),t.sortIndex=t.expirationTime,n(p,t);else break;t=r(m)}}function s(e){if(b=!1,o(e),!y)if(r(p)!==null)y=!0,T||(T=!0,k());else{var t=r(m);t!==null&&l(s,t.startTime-e)}}function c(){return x?!0:!(e.unstable_now()-O<D)}function l(t,n){E=S(function(){t(e.unstable_now())},n)}if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==`function`&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var u=performance;e.unstable_now=function(){return u.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var p=[],m=[],h=1,g=null,_=3,v=!1,y=!1,b=!1,x=!1,S=typeof setTimeout==`function`?setTimeout:null,C=typeof clearTimeout==`function`?clearTimeout:null,w=typeof setImmediate<`u`?setImmediate:null,T=!1,E=-1,D=5,O=-1;if(typeof w==`function`)var k=function(){w(t)};else if(typeof MessageChannel<`u`){var A=new MessageChannel,j=A.port2;A.port1.onmessage=t,k=function(){j.postMessage(null)}}else k=function(){S(t,0)};e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):D=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return _},e.unstable_next=function(e){switch(_){case 1:case 2:case 3:var t=3;break;default:t=_}var n=_;_=t;try{return e()}finally{_=n}},e.unstable_requestPaint=function(){x=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=_;_=e;try{return t()}finally{_=n}},e.unstable_scheduleCallback=function(t,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,t){case 1:var c=-1;break;case 2:c=250;break;case 5:c=1073741823;break;case 4:c=1e4;break;default:c=5e3}return c=a+c,t={id:h++,callback:i,priorityLevel:t,startTime:a,expirationTime:c,sortIndex:-1},a>o?(t.sortIndex=a,n(m,t),r(p)===null&&t===r(m)&&(b?(C(E),E=-1):b=!0,l(s,a-o))):(t.sortIndex=c,n(p,t),y||v||(y=!0,T||(T=!0,k()))),t},e.unstable_shouldYield=c,e.unstable_wrapCallback=function(e){var t=_;return function(){var n=_;_=t;try{return e.apply(this,arguments)}finally{_=n}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==`function`&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()})),vg=m(d(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=gg():t.exports=_g()}))());typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`)?n.useLayoutEffect:n.useEffect;function yg(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){let e=yg(r,t,n);if(e)return e;r=t?null:r.sibling}}function bg(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}var xg=bg(n.createContext(null)),Sg=class extends n.Component{render(){return n.createElement(xg.Provider,{value:this._reactInternals},this.props.children)}};function Cg(){let e=n.useContext(xg);if(e===null)throw Error(`its-fine: useFiber must be called within a <FiberProvider />!`);let t=n.useId();return n.useMemo(()=>{for(let n of[e,e?.alternate]){if(!n)continue;let e=yg(n,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}});if(e)return e}},[e,t])}var wg=Symbol.for(`react.context`),Tg=e=>typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===wg;function Eg(){let e=Cg(),[t]=n.useState(()=>new Map);t.clear();let r=e;for(;r;){let e=r.type;Tg(e)&&e!==xg&&!t.has(e)&&t.set(e,n.use(bg(e))),r=r.return}return t}function Dg(){let e=Eg();return n.useMemo(()=>Array.from(e.keys()).reduce((t,r)=>i=>n.createElement(t,null,n.createElement(r.Provider,{...i,value:e.get(r)})),e=>n.createElement(Sg,{...e})),[e])}function Og(e){let t=e.root;for(;t.getState().previousRoot;)t=t.getState().previousRoot;return t}n.act;var kg=e=>e&&e.isOrthographicCamera,Ag=e=>e&&e.hasOwnProperty(`current`),jg=e=>e!=null&&(typeof e==`string`||typeof e==`number`||e.isColor),Mg=((e,t)=>typeof window<`u`&&((e=window.document)?.createElement||(t=window.navigator)?.product===`ReactNative`))()?n.useLayoutEffect:n.useEffect;function Ng(e){let t=n.useRef(e);return Mg(()=>void(t.current=e),[e]),t}function Pg(){let e=Cg(),t=Dg();return n.useMemo(()=>({children:i})=>(0,r.jsx)(yg(e,!0,e=>e.type===n.StrictMode)?n.StrictMode:n.Fragment,{children:(0,r.jsx)(t,{children:i})}),[e,t])}function Fg({set:e}){return Mg(()=>(e(new Promise(()=>null)),()=>e(!1)),[e]),null}var Ig=(e=>(e=class extends n.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}},e.getDerivedStateFromError=()=>({error:!0}),e))();function Lg(e){let t=typeof window<`u`?window.devicePixelRatio??2:1;return Array.isArray(e)?Math.min(Math.max(e[0],t),e[1]):e}function Rg(e){return e.__r3f?.root.getState()}var zg={obj:e=>e===Object(e)&&!zg.arr(e)&&typeof e!=`function`,fun:e=>typeof e==`function`,str:e=>typeof e==`string`,num:e=>typeof e==`number`,boo:e=>typeof e==`boolean`,und:e=>e===void 0,nul:e=>e===null,arr:e=>Array.isArray(e),equ(e,t,{arrays:n=`shallow`,objects:r=`reference`,strict:i=!0}={}){if(typeof e!=typeof t||!!e!=!!t)return!1;if(zg.str(e)||zg.num(e)||zg.boo(e))return e===t;let a=zg.obj(e);if(a&&r===`reference`)return e===t;let o=zg.arr(e);if(o&&n===`reference`)return e===t;if((o||a)&&e===t)return!0;let s;for(s in e)if(!(s in t))return!1;if(a&&n===`shallow`&&r===`shallow`){for(s in i?t:e)if(!zg.equ(e[s],t[s],{strict:i,objects:`reference`}))return!1}else for(s in i?t:e)if(e[s]!==t[s])return!1;if(zg.und(s)){if(o&&e.length===0&&t.length===0||a&&Object.keys(e).length===0&&Object.keys(t).length===0)return!0;if(e!==t)return!1}return!0}};function Bg(e){let t={nodes:{},materials:{},meshes:{}};return e&&e.traverse(e=>{e.name&&(t.nodes[e.name]=e),e.material&&!t.materials[e.material.name]&&(t.materials[e.material.name]=e.material),e.isMesh&&!t.meshes[e.name]&&(t.meshes[e.name]=e)}),t}function Vg(e){e.type!==`Scene`&&(e.dispose==null||e.dispose());for(let t in e){let n=e[t];n?.type!==`Scene`&&(n==null||n.dispose==null||n.dispose())}}var Hg=[`children`,`key`,`ref`];function Ug(e){let t={};for(let n in e)Hg.includes(n)||(t[n]=e[n]);return t}function Wg(e,t,n,r){let i=e,a=i?.__r3f;return a||(a={root:t,type:n,parent:null,children:[],props:Ug(r),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=a)),a}function Gg(e,t){if(!t.includes(`-`)||t in e)return{root:e,key:t,target:e[t]};let n=e,r=t.split(`-`);for(let i of r){if(typeof n!=`object`||!n){if(n!==void 0){let e=r.slice(r.indexOf(i)).join(`-`);return{root:n,key:e,target:void 0}}return{root:e,key:t,target:void 0}}t=i,e=n,n=n[t]}return{root:e,key:t,target:n}}var Kg=/-\d+$/;function qg(e,t){if(zg.str(t.props.attach)){if(Kg.test(t.props.attach)){let n=t.props.attach.replace(Kg,``),{root:r,key:i}=Gg(e.object,n);Array.isArray(r[i])||(r[i]=[])}let{root:n,key:r}=Gg(e.object,t.props.attach);t.previousAttach=n[r],n[r]=t.object}else zg.fun(t.props.attach)&&(t.previousAttach=t.props.attach(e.object,t.object))}function Jg(e,t){if(zg.str(t.props.attach)){let{root:n,key:r}=Gg(e.object,t.props.attach),i=t.previousAttach;i===void 0?delete n[r]:n[r]=i}else t.previousAttach==null||t.previousAttach(e.object,t.object);delete t.previousAttach}var Yg=[...Hg,`args`,`dispose`,`attach`,`object`,`onUpdate`,`dispose`],Xg=new Map;function Zg(e){let t=Xg.get(e.constructor);try{t||(t=new e.constructor,Xg.set(e.constructor,t))}catch{}return t}function Qg(e,t){let n={};for(let r in t)if(!Yg.includes(r)&&!zg.equ(t[r],e.props[r])){n[r]=t[r];for(let e in t)e.startsWith(`${r}-`)&&(n[e]=t[e])}for(let r in e.props){if(Yg.includes(r)||t.hasOwnProperty(r))continue;let{root:i,key:a}=Gg(e.object,r);if(i.constructor&&i.constructor.length===0){let e=Zg(i);zg.und(e)||(n[a]=e[a])}else n[a]=0}return n}var $g=[`map`,`emissiveMap`,`sheenColorMap`,`specularColorMap`,`envMap`],e_=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function t_(e,t){var n;let r=e.__r3f,i=r&&Og(r).getState(),a=r?.eventCount;for(let n in t){let a=t[n];if(Yg.includes(n))continue;if(r&&e_.test(n)){typeof a==`function`?r.handlers[n]=a:delete r.handlers[n],r.eventCount=Object.keys(r.handlers).length;continue}if(a===void 0)continue;let{root:s,key:c,target:l}=Gg(e,n);if(l===void 0&&(typeof s!=`object`||!s))throw Error(`R3F: Cannot set "${n}". Ensure it is an object before setting "${c}".`);if(l instanceof gr&&a instanceof gr)l.mask=a.mask;else if(l instanceof U&&jg(a))l.set(a);else if(typeof l==`object`&&l&&typeof l.set==`function`&&typeof l.copy==`function`&&a!=null&&a.constructor&&l.constructor===a.constructor)l.copy(a);else if(typeof l==`object`&&l&&typeof l.set==`function`&&Array.isArray(a))typeof l.fromArray==`function`?l.fromArray(a):l.set(...a);else if(typeof l==`object`&&l&&typeof l.set==`function`&&typeof a==`number`)typeof l.setScalar==`function`?l.setScalar(a):l.set(a);else{var o;s[c]=a,i&&!i.linear&&$g.includes(c)&&(o=s[c])!=null&&o.isTexture&&s[c].format===1023&&s[c].type===1009&&(s[c].colorSpace=_t)}}if(r!=null&&r.parent&&i!=null&&i.internal&&(n=r.object)!=null&&n.isObject3D&&a!==r.eventCount){let e=r.object,t=i.internal.interaction.indexOf(e);t>-1&&i.internal.interaction.splice(t,1),r.eventCount&&e.raycast!==null&&i.internal.interaction.push(e)}return r&&r.props.attach===void 0&&(r.object.isBufferGeometry?r.props.attach=`geometry`:r.object.isMaterial&&(r.props.attach=`material`)),r&&n_(r),e}function n_(e){var t;if(!e.parent)return;e.props.onUpdate==null||e.props.onUpdate(e.object);let n=(t=e.root)==null||t.getState==null?void 0:t.getState();n&&n.internal.frames===0&&n.invalidate()}function r_(e,t){e.manual||(kg(e)?(e.left=t.width/-2,e.right=t.width/2,e.top=t.height/2,e.bottom=t.height/-2):e.aspect=t.width/t.height,e.updateProjectionMatrix())}var i_=e=>e?.isObject3D;function a_(e){return(e.eventObject||e.object).uuid+`/`+e.index+e.instanceId}function o_(e,t,n,r){let i=n.get(t);i&&(n.delete(t),n.size===0&&(e.delete(r),i.target.releasePointerCapture(r)))}function s_(e,t){let{internal:n}=e.getState();n.interaction=n.interaction.filter(e=>e!==t),n.initialHits=n.initialHits.filter(e=>e!==t),n.hovered.forEach((e,r)=>{(e.eventObject===t||e.object===t)&&n.hovered.delete(r)}),n.capturedMap.forEach((e,r)=>{o_(n.capturedMap,t,e,r)})}function c_(e){function t(t){let{internal:n}=e.getState(),r=t.offsetX-n.initialClick[0],i=t.offsetY-n.initialClick[1];return Math.round(Math.sqrt(r*r+i*i))}function n(e){return e.filter(e=>[`Move`,`Over`,`Enter`,`Out`,`Leave`].some(t=>e.__r3f?.handlers[`onPointer`+t]))}function r(t,n){let r=e.getState(),i=new Set,a=[],o=n?n(r.internal.interaction):r.internal.interaction;for(let e=0;e<o.length;e++){let t=Rg(o[e]);t&&(t.raycaster.camera=void 0)}r.previousRoot||r.events.compute==null||r.events.compute(t,r);function s(e){let n=Rg(e);return!n||!n.events.enabled||n.raycaster.camera===null?[]:(n.raycaster.camera===void 0&&(n.events.compute==null||n.events.compute(t,n,n.previousRoot?.getState()),n.raycaster.camera===void 0&&(n.raycaster.camera=null)),n.raycaster.camera?n.raycaster.intersectObject(e,!0):[])}let c=o.flatMap(s).sort((e,t)=>{let n=Rg(e.object),r=Rg(t.object);return!n||!r?e.distance-t.distance:r.events.priority-n.events.priority||e.distance-t.distance}).filter(e=>{let t=a_(e);return i.has(t)?!1:(i.add(t),!0)});r.events.filter&&(c=r.events.filter(c,r));for(let e of c){let t=e.object;for(;t;){var l;(l=t.__r3f)!=null&&l.eventCount&&a.push({...e,eventObject:t}),t=t.parent}}if(`pointerId`in t&&r.internal.capturedMap.has(t.pointerId))for(let e of r.internal.capturedMap.get(t.pointerId).values())i.has(a_(e.intersection))||a.push(e.intersection);return a}function i(e,t,n,r){if(e.length){let i={stopped:!1};for(let o of e){let s=Rg(o.object);if(s||o.object.traverseAncestors(e=>{let t=Rg(e);if(t)return s=t,!1}),s){let{raycaster:c,pointer:l,camera:u,internal:d}=s,f=new V(l.x,l.y,0).unproject(u),p=e=>d.capturedMap.get(e)?.has(o.eventObject)??!1,m=e=>{let n={intersection:o,target:t.target};d.capturedMap.has(e)?d.capturedMap.get(e).set(o.eventObject,n):d.capturedMap.set(e,new Map([[o.eventObject,n]])),t.target.setPointerCapture(e)},h=e=>{let t=d.capturedMap.get(e);t&&o_(d.capturedMap,o.eventObject,t,e)},g={};for(let e in t){let n=t[e];typeof n!=`function`&&(g[e]=n)}let _={...o,...g,pointer:l,intersections:e,stopped:i.stopped,delta:n,unprojectedPoint:f,ray:c.ray,camera:u,stopPropagation(){let n=`pointerId`in t&&d.capturedMap.get(t.pointerId);(!n||n.has(o.eventObject))&&(_.stopped=i.stopped=!0,d.hovered.size&&Array.from(d.hovered.values()).find(e=>e.eventObject===o.eventObject)&&a([...e.slice(0,e.indexOf(o)),o]))},target:{hasPointerCapture:p,setPointerCapture:m,releasePointerCapture:h},currentTarget:{hasPointerCapture:p,setPointerCapture:m,releasePointerCapture:h},nativeEvent:t};if(r(_),i.stopped===!0)break}}}return e}function a(t){let{internal:n}=e.getState();for(let e of n.hovered.values())if(!t.length||!t.find(t=>t.object===e.object&&t.index===e.index&&t.instanceId===e.instanceId)){let r=e.eventObject.__r3f;if(n.hovered.delete(a_(e)),r!=null&&r.eventCount){let n=r.handlers,i={...e,intersections:t};n.onPointerOut==null||n.onPointerOut(i),n.onPointerLeave==null||n.onPointerLeave(i)}}}function o(e,t){for(let n=0;n<t.length;n++){let r=t[n].__r3f;r==null||r.handlers.onPointerMissed==null||r.handlers.onPointerMissed(e)}}function s(s){switch(s){case`onPointerLeave`:case`onPointerCancel`:return()=>a([]);case`onLostPointerCapture`:return t=>{let{internal:n}=e.getState();`pointerId`in t&&n.capturedMap.has(t.pointerId)&&requestAnimationFrame(()=>{n.capturedMap.has(t.pointerId)&&(n.capturedMap.delete(t.pointerId),a([]))})}}return function(c){let{onPointerMissed:l,internal:u}=e.getState();u.lastEvent.current=c;let d=s===`onPointerMove`,f=s===`onClick`||s===`onContextMenu`||s===`onDoubleClick`,p=r(c,d?n:void 0),m=f?t(c):0;s===`onPointerDown`&&(u.initialClick=[c.offsetX,c.offsetY],u.initialHits=p.map(e=>e.eventObject)),f&&!p.length&&m<=2&&(o(c,u.interaction),l&&l(c)),d&&a(p);function h(e){let t=e.eventObject,n=t.__r3f;if(!(n!=null&&n.eventCount))return;let r=n.handlers;if(d){if(r.onPointerOver||r.onPointerEnter||r.onPointerOut||r.onPointerLeave){let t=a_(e),n=u.hovered.get(t);n?n.stopped&&e.stopPropagation():(u.hovered.set(t,e),r.onPointerOver==null||r.onPointerOver(e),r.onPointerEnter==null||r.onPointerEnter(e))}r.onPointerMove==null||r.onPointerMove(e)}else{let n=r[s];n?(!f||u.initialHits.includes(t))&&(o(c,u.interaction.filter(e=>!u.initialHits.includes(e))),n(e)):f&&u.initialHits.includes(t)&&o(c,u.interaction.filter(e=>!u.initialHits.includes(e)))}}i(p,c,m,h)}}return{handlePointer:s}}var l_=e=>!!(e!=null&&e.render),u_=n.createContext(null),d_=(e,t)=>{let r=(0,i.createWithEqualityFn)((r,i)=>{let a=new V,o=new V,s=new V;function c(e=i().camera,t=o,n=i().size){let{width:r,height:c,top:l,left:u}=n,d=r/c;t.isVector3?s.copy(t):s.set(...t);let f=e.getWorldPosition(a).distanceTo(s);if(kg(e))return{width:r/e.zoom,height:c/e.zoom,top:l,left:u,factor:1,distance:f,aspect:d};{let t=e.fov*Math.PI/180,n=2*Math.tan(t/2)*f,i=r/c*n;return{width:i,height:n,top:l,left:u,factor:r/i,distance:f,aspect:d}}}let l,u=e=>r(t=>({performance:{...t.performance,current:e}})),d=new B;return{set:r,get:i,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(t=1)=>e(i(),t),advance:(e,n)=>t(e,n,i()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new Gd,pointer:d,mouse:d,frameloop:`always`,onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{let e=i();l&&clearTimeout(l),e.performance.current!==e.performance.min&&u(e.performance.min),l=setTimeout(()=>u(i().performance.max),e.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:c},setEvents:e=>r(t=>({...t,events:{...t.events,...e}})),setSize:(e,t,n=0,a=0)=>{let s=i().camera,l={width:e,height:t,top:n,left:a};r(e=>({size:l,viewport:{...e.viewport,...c(s,o,l)}}))},setDpr:e=>r(t=>{let n=Lg(e);return{viewport:{...t.viewport,dpr:n,initialDpr:t.viewport.initialDpr||n}}}),setFrameloop:(e=`always`)=>{let t=i().clock;t.stop(),t.elapsedTime=0,e!==`never`&&(t.start(),t.elapsedTime=0),r(()=>({frameloop:e}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:n.createRef(),active:!1,frames:0,priority:0,subscribe:(e,t,n)=>{let r=i().internal;return r.priority+=t>0?1:0,r.subscribers.push({ref:e,priority:t,store:n}),r.subscribers=r.subscribers.sort((e,t)=>e.priority-t.priority),()=>{let n=i().internal;n!=null&&n.subscribers&&(n.priority-=t>0?1:0,n.subscribers=n.subscribers.filter(t=>t.ref!==e))}}}}}),a=r.getState(),o=a.size,s=a.viewport.dpr,c=a.camera;return r.subscribe(()=>{let{camera:e,size:t,viewport:n,gl:i,set:a}=r.getState();if(t.width!==o.width||t.height!==o.height||n.dpr!==s){o=t,s=n.dpr,r_(e,t),n.dpr>0&&i.setPixelRatio(n.dpr);let r=typeof HTMLCanvasElement<`u`&&i.domElement instanceof HTMLCanvasElement;i.setSize(t.width,t.height,r)}e!==c&&(c=e,a(t=>({viewport:{...t.viewport,...t.viewport.getCurrentViewport(e)}})))}),r.subscribe(t=>e(t)),r};function f_(){let e=n.useContext(u_);if(!e)throw Error(`R3F: Hooks can only be used within the Canvas component!`);return e}function p_(e=e=>e,t){return f_()(e,t)}function m_(e,t=0){let n=f_(),r=n.getState().internal.subscribe,i=Ng(e);return Mg(()=>r(i,t,n),[t,r,n]),null}var h_=new WeakMap,g_=e=>typeof e==`function`&&e?.prototype?.constructor===e;function __(e,t){return function(n,...r){let i;return g_(n)?(i=h_.get(n),i||(i=new n,h_.set(n,i))):i=n,e&&e(i),Promise.all(r.map(e=>new Promise((n,r)=>i.load(e,e=>{i_(e?.scene)&&Object.assign(e,Bg(e.scene)),n(e)},t,t=>r(Error(`Could not load ${e}: ${t?.message}`))))))}}function v_(e,t,n,r){let i=Array.isArray(t)?t:[t],a=pg(__(n,r),[e,...i],{equal:zg.equ});return Array.isArray(t)?a:a[0]}v_.preload=function(e,t,n){let r=Array.isArray(t)?t:[t];return mg(__(n),[e,...r])},v_.clear=function(e,t){return hg([e,...Array.isArray(t)?t:[t]])};var y_=1,b_=8,x_=32,S_=2,C_={name:`@react-three/fiber`,version:`9.5.0`,description:`A React renderer for Threejs`,keywords:[`react`,`renderer`,`fiber`,`three`,`threejs`],author:`Paul Henschel (https://github.com/drcmda)`,license:`MIT`,maintainers:[`Josh Ellis (https://github.com/joshuaellis)`,`Cody Bennett (https://github.com/codyjasonbennett)`,`Kris Baumgarter (https://github.com/krispya)`],bugs:{url:`https://github.com/pmndrs/react-three-fiber/issues`},homepage:`https://github.com/pmndrs/react-three-fiber#readme`,repository:{type:`git`,url:`git+https://github.com/pmndrs/react-three-fiber.git`},collective:{type:`opencollective`,url:`https://opencollective.com/react-three-fiber`},main:`dist/react-three-fiber.cjs.js`,module:`dist/react-three-fiber.esm.js`,types:`dist/react-three-fiber.cjs.d.ts`,"react-native":`native/dist/react-three-fiber-native.cjs.js`,sideEffects:!1,preconstruct:{entrypoints:[`index.tsx`,`native.tsx`]},scripts:{prebuild:`cp ../../readme.md readme.md`},devDependencies:{"@types/react-reconciler":`^0.32.3`,"react-reconciler":`^0.33.0`},dependencies:{"@babel/runtime":`^7.17.8`,"@types/webxr":`*`,"base64-js":`^1.5.1`,buffer:`^6.0.3`,"its-fine":`^2.0.0`,"react-use-measure":`^2.1.7`,scheduler:`^0.27.0`,"suspend-react":`^0.1.3`,"use-sync-external-store":`^1.4.0`,zustand:`^5.0.3`},peerDependencies:{expo:`>=43.0`,"expo-asset":`>=8.4`,"expo-file-system":`>=11.0`,"expo-gl":`>=11.0`,react:`>=19 <19.3`,"react-dom":`>=19 <19.3`,"react-native":`>=0.78`,three:`>=0.156`},peerDependenciesMeta:{"react-dom":{optional:!0},"react-native":{optional:!0},expo:{optional:!0},"expo-asset":{optional:!0},"expo-file-system":{optional:!0},"expo-gl":{optional:!0}}};function w_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var T_={exports:{}},E_={exports:{}};E_.exports;var D_;function O_(){return D_||(D_=1,function(e){e.exports=function(e){function t(e,t,n,r){return new ua(e,t,n,r)}function r(){}function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function o(e){if(a(e)!==e)throw Error(i(188))}function s(e){var t=e.alternate;if(!t){if(t=a(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var c=s.alternate;if(c===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===c.child){for(c=s.child;c;){if(c===n)return o(s),e;if(c===r)return o(s),t;c=c.sibling}throw Error(i(188))}if(n.return!==r.return)n=s,r=c;else{for(var l=!1,u=s.child;u;){if(u===n){l=!0,n=s,r=c;break}if(u===r){l=!0,r=s,n=c;break}u=u.sibling}if(!l){for(u=c.child;u;){if(u===n){l=!0,n=c,r=s;break}if(u===r){l=!0,r=c,n=s;break}u=u.sibling}if(!l)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function c(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=c(e),t!==null)return t;e=e.sibling}return null}function l(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(e.tag!==4&&(t=l(e),t!==null))return t;e=e.sibling}return null}function u(e){return typeof e!=`object`||!e?null:(e=Ga&&e[Ga]||e[`@@iterator`],typeof e==`function`?e:null)}function d(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===Ka?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case Na:return`Fragment`;case Fa:return`Profiler`;case Pa:return`StrictMode`;case za:return`Suspense`;case Ba:return`SuspenseList`;case Ua:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case Ma:return`Portal`;case La:return e.displayName||`Context`;case Ia:return(e._context.displayName||`Context`)+`.Consumer`;case Ra:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case Va:return t=e.displayName||null,t===null?d(e.type)||`Memo`:t;case Ha:t=e._payload,e=e._init;try{return d(e(t))}catch{}}return null}function f(e){return{current:e}}function p(e){0>pc||(e.current=fc[pc],fc[pc]=null,pc--)}function m(e,t){pc++,fc[pc]=e.current,e.current=t}function h(e){return e>>>=0,e===0?32:31-(gc(e)/_c|0)|0}function g(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function _(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=g(n))):i=g(o):i=g(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=g(n))):i=g(o)):i=g(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function v(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function y(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function b(){var e=bc;return bc<<=1,!(bc&62914560)&&(bc=4194304),e}function x(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function S(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function C(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-hc(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&w(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function w(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-hc(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function T(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-hc(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function E(e,t){var n=t&-t;return n=n&42?1:D(n),(n&(e.suspendedLanes|t))===0?n:0}function D(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function O(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function k(e){if(typeof Ac==`function`&&jc(e),Nc&&typeof Nc.setStrictMode==`function`)try{Nc.setStrictMode(Mc,e)}catch{}}function A(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}function j(e){if(Lc===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Lc=t&&t[1]||``,Rc=-1<e.stack.indexOf(`
4049
+ }`,Xh=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new vs(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new hl({vertexShader:Jh,fragmentShader:Yh,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Ra(new Yc(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},Zh=class extends on{constructor(e,t){super();let n=this,r=null,i=1,a=null,o=`local-floor`,s=1,c=null,l=null,u=null,d=null,f=null,p=null,m=typeof XRWebGLBinding<`u`,h=new Xh,g={},_=t.getContextAttributes(),v=null,y=null,b=[],x=[],S=new B,C=null,w=new wu;w.viewport=new $n;let T=new wu;T.viewport=new $n;let E=[w,T],D=new nd,O=null,k=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=b[e];return t===void 0&&(t=new Fr,b[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=b[e];return t===void 0&&(t=new Fr,b[e]=t),t.getGripSpace()},this.getHand=function(e){let t=b[e];return t===void 0&&(t=new Fr,b[e]=t),t.getHandSpace()};function A(e){let t=x.indexOf(e.inputSource);if(t===-1)return;let n=b[t];n!==void 0&&(n.update(e.inputSource,e.frame,c||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function j(){r.removeEventListener(`select`,A),r.removeEventListener(`selectstart`,A),r.removeEventListener(`selectend`,A),r.removeEventListener(`squeeze`,A),r.removeEventListener(`squeezestart`,A),r.removeEventListener(`squeezeend`,A),r.removeEventListener(`end`,j),r.removeEventListener(`inputsourceschange`,ee);for(let e=0;e<b.length;e++){let t=x[e];t!==null&&(x[e]=null,b[e].disconnect(t))}O=null,k=null,h.reset();for(let e in g)delete g[e];e.setRenderTarget(v),f=null,d=null,u=null,r=null,y=null,le.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(S.width,S.height,!1),n.dispatchEvent({type:`sessionend`})}this.setFramebufferScaleFactor=function(e){i=e,n.isPresenting===!0&&R(`WebXRManager: Cannot change framebuffer scale while presenting.`)},this.setReferenceSpaceType=function(e){o=e,n.isPresenting===!0&&R(`WebXRManager: Cannot change reference space type while presenting.`)},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(e){c=e},this.getBaseLayer=function(){return d===null?f:d},this.getBinding=function(){return u===null&&m&&(u=new XRWebGLBinding(r,t)),u},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(l){if(r=l,r!==null){if(v=e.getRenderTarget(),r.addEventListener(`select`,A),r.addEventListener(`selectstart`,A),r.addEventListener(`selectend`,A),r.addEventListener(`squeeze`,A),r.addEventListener(`squeezestart`,A),r.addEventListener(`squeezeend`,A),r.addEventListener(`end`,j),r.addEventListener(`inputsourceschange`,ee),_.xrCompatible!==!0&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(S),m&&`createProjectionLayer`in XRWebGLBinding.prototype){let n=null,a=null,o=null;_.depth&&(o=_.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=_.stencil?_e:ge,a=_.stencil?ue:ae);let s={colorFormat:t.RGBA8,depthFormat:o,scaleFactor:i};u=this.getBinding(),d=u.createProjectionLayer(s),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),y=new tr(d.textureWidth,d.textureHeight,{format:he,type:te,depthTexture:new gs(d.textureWidth,d.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{let n={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:i};f=new XRWebGLLayer(r,t,n),r.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),y=new tr(f.framebufferWidth,f.framebufferHeight,{format:he,type:te,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}y.isXRRenderTarget=!0,this.setFoveation(s),c=null,a=await r.requestReferenceSpace(o),le.setContext(r),le.start(),n.isPresenting=!0,n.dispatchEvent({type:`sessionstart`})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return h.getDepthTexture()};function ee(e){for(let t=0;t<e.removed.length;t++){let n=e.removed[t],r=x.indexOf(n);r>=0&&(x[r]=null,b[r].disconnect(n))}for(let t=0;t<e.added.length;t++){let n=e.added[t],r=x.indexOf(n);if(r===-1){for(let e=0;e<b.length;e++)if(e>=x.length){x.push(n),r=e;break}else if(x[e]===null){x[e]=n,r=e;break}if(r===-1)break}let i=b[r];i&&i.connect(n)}}let ne=new V,M=new V;function re(e,t,n){ne.setFromMatrixPosition(t.matrixWorld),M.setFromMatrixPosition(n.matrixWorld);let r=ne.distanceTo(M),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),i[10]===-1)e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+m,n=s+m,i=f-h,a=p+(r-h),u=c*s/n*t,d=l*s/n*t;e.projectionMatrix.makePerspective(i,a,u,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function ie(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(r===null)return;let t=e.near,n=e.far;h.texture!==null&&(h.depthNear>0&&(t=h.depthNear),h.depthFar>0&&(n=h.depthFar)),D.near=T.near=w.near=t,D.far=T.far=w.far=n,(O!==D.near||k!==D.far)&&(r.updateRenderState({depthNear:D.near,depthFar:D.far}),O=D.near,k=D.far),D.layers.mask=e.layers.mask|6,w.layers.mask=D.layers.mask&-5,T.layers.mask=D.layers.mask&-3;let i=e.parent,a=D.cameras;ie(D,i);for(let e=0;e<a.length;e++)ie(a[e],i);a.length===2?re(D,w,T):D.projectionMatrix.copy(w.projectionMatrix),oe(e,D,i)};function oe(e,t,n){n===null?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld)),e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=un*2*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}this.getCamera=function(){return D},this.getFoveation=function(){if(!(d===null&&f===null))return s},this.setFoveation=function(e){s=e,d!==null&&(d.fixedFoveation=e),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=e)},this.hasDepthSensing=function(){return h.texture!==null},this.getDepthSensingMesh=function(){return h.getMesh(D)},this.getCameraTexture=function(e){return g[e]};let se=null;function ce(t,i){if(l=i.getViewerPose(c||a),p=i,l!==null){let t=l.views;f!==null&&(e.setRenderTargetFramebuffer(y,f.framebuffer),e.setRenderTarget(y));let i=!1;t.length!==D.cameras.length&&(D.cameras.length=0,i=!0);for(let n=0;n<t.length;n++){let r=t[n],a=null;if(f!==null)a=f.getViewport(r);else{let t=u.getViewSubImage(d,r);a=t.viewport,n===0&&(e.setRenderTargetTextures(y,t.colorTexture,t.depthStencilTexture),e.setRenderTarget(y))}let o=E[n];o===void 0&&(o=new wu,o.layers.enable(n),o.viewport=new $n,E[n]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(a.x,a.y,a.width,a.height),n===0&&(D.matrix.copy(o.matrix),D.matrix.decompose(D.position,D.quaternion,D.scale)),i===!0&&D.cameras.push(o)}let a=r.enabledFeatures;if(a&&a.includes(`depth-sensing`)&&r.depthUsage==`gpu-optimized`&&m){u=n.getBinding();let e=u.getDepthInformation(t[0]);e&&e.isValid&&e.texture&&h.init(e,r.renderState)}if(a&&a.includes(`camera-access`)&&m){e.state.unbindTexture(),u=n.getBinding();for(let e=0;e<t.length;e++){let n=t[e].camera;if(n){let e=g[n];e||(e=new vs,g[n]=e);let t=u.getCameraImage(n);e.sourceTexture=t}}}}for(let e=0;e<b.length;e++){let t=x[e],n=b[e];t!==null&&n!==void 0&&n.update(t,i,c||a)}se&&se(t,i),i.detectedPlanes&&n.dispatchEvent({type:`planesdetected`,data:i}),p=null}let le=new Kf;le.setAnimationLoop(ce),this.setAnimationLoop=function(e){se=e},this.dispose=function(){}}},Qh=new hr,$h=new or;function eg(e,t){function n(e,t){e.matrixAutoUpdate===!0&&e.updateMatrix(),t.value.copy(e.matrix)}function r(t,n){n.color.getRGB(t.fogColor.value,dl(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)}function i(e,t,n,r,i){t.isMeshBasicMaterial?a(e,t):t.isMeshLambertMaterial?(a(e,t),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)):t.isMeshToonMaterial?(a(e,t),d(e,t)):t.isMeshPhongMaterial?(a(e,t),u(e,t),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)):t.isMeshStandardMaterial?(a(e,t),f(e,t),t.isMeshPhysicalMaterial&&p(e,t,i)):t.isMeshMatcapMaterial?(a(e,t),m(e,t)):t.isMeshDepthMaterial?a(e,t):t.isMeshDistanceMaterial?(a(e,t),h(e,t)):t.isMeshNormalMaterial?a(e,t):t.isLineBasicMaterial?(o(e,t),t.isLineDashedMaterial&&s(e,t)):t.isPointsMaterial?c(e,t,n,r):t.isSpriteMaterial?l(e,t):t.isShadowMaterial?(e.color.value.copy(t.color),e.opacity.value=t.opacity):t.isShaderMaterial&&(t.uniformsNeedUpdate=!1)}function a(e,r){e.opacity.value=r.opacity,r.color&&e.diffuse.value.copy(r.color),r.emissive&&e.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(e.map.value=r.map,n(r.map,e.mapTransform)),r.alphaMap&&(e.alphaMap.value=r.alphaMap,n(r.alphaMap,e.alphaMapTransform)),r.bumpMap&&(e.bumpMap.value=r.bumpMap,n(r.bumpMap,e.bumpMapTransform),e.bumpScale.value=r.bumpScale,r.side===1&&(e.bumpScale.value*=-1)),r.normalMap&&(e.normalMap.value=r.normalMap,n(r.normalMap,e.normalMapTransform),e.normalScale.value.copy(r.normalScale),r.side===1&&e.normalScale.value.negate()),r.displacementMap&&(e.displacementMap.value=r.displacementMap,n(r.displacementMap,e.displacementMapTransform),e.displacementScale.value=r.displacementScale,e.displacementBias.value=r.displacementBias),r.emissiveMap&&(e.emissiveMap.value=r.emissiveMap,n(r.emissiveMap,e.emissiveMapTransform)),r.specularMap&&(e.specularMap.value=r.specularMap,n(r.specularMap,e.specularMapTransform)),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,Qh.copy(o),Qh.x*=-1,Qh.y*=-1,Qh.z*=-1,a.isCubeTexture&&a.isRenderTargetTexture===!1&&(Qh.y*=-1,Qh.z*=-1),e.envMapRotation.value.setFromMatrix4($h.makeRotationFromEuler(Qh)),e.flipEnvMap.value=a.isCubeTexture&&a.isRenderTargetTexture===!1?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}function o(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}function s(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function c(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=i*.5,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function l(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}function d(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function f(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function p(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===1&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}function m(e,t){t.matcap&&(e.matcap.value=t.matcap)}function h(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function tg(e,t,n,r){let i={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(e,t){let n=t.program;r.uniformBlockBinding(e,n)}function l(e,n){let o=i[e.id];o===void 0&&(m(e),o=u(e),i[e.id]=o,e.addEventListener(`dispose`,g));let s=n.program;r.updateUBOMapping(e,s);let c=t.render.frame;a[e.id]!==c&&(f(e),a[e.id]=c)}function u(t){let n=d();t.__bindingPointIndex=n;let r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}function d(){for(let e=0;e<s;e++)if(o.indexOf(e)===-1)return o.push(e),e;return z(`WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.`),0}function f(t){let n=i[t.id],r=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let t=0,n=r.length;t<n;t++){let n=Array.isArray(r[t])?r[t]:[r[t]];for(let r=0,i=n.length;r<i;r++){let i=n[r];if(p(i,t,r,a)===!0){let t=i.__offset,n=Array.isArray(i.value)?i.value:[i.value],r=0;for(let a=0;a<n.length;a++){let o=n[a],s=h(o);typeof o==`number`||typeof o==`boolean`?(i.__data[0]=o,e.bufferSubData(e.UNIFORM_BUFFER,t+r,i.__data)):o.isMatrix3?(i.__data[0]=o.elements[0],i.__data[1]=o.elements[1],i.__data[2]=o.elements[2],i.__data[3]=0,i.__data[4]=o.elements[3],i.__data[5]=o.elements[4],i.__data[6]=o.elements[5],i.__data[7]=0,i.__data[8]=o.elements[6],i.__data[9]=o.elements[7],i.__data[10]=o.elements[8],i.__data[11]=0):(o.toArray(i.__data,r),r+=s.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,i.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}function p(e,t,n,r){let i=e.value,a=t+`_`+n;if(r[a]===void 0)return typeof i==`number`||typeof i==`boolean`?r[a]=i:r[a]=i.clone(),!0;{let e=r[a];if(typeof i==`number`||typeof i==`boolean`){if(e!==i)return r[a]=i,!0}else if(e.equals(i)===!1)return e.copy(i),!0}return!1}function m(e){let t=e.uniforms,n=0;for(let e=0,r=t.length;e<r;e++){let r=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=r.length;e<t;e++){let t=r[e],i=Array.isArray(t.value)?t.value:[t.value];for(let e=0,r=i.length;e<r;e++){let r=i[e],a=h(r),o=n%16,s=o%a.boundary,c=o+s;n+=s,c!==0&&16-c<a.storage&&(n+=16-c),t.__data=new Float32Array(a.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=a.storage}}}let r=n%16;return r>0&&(n+=16-r),e.__size=n,e.__cache={},this}function h(e){let t={boundary:0,storage:0};return typeof e==`number`||typeof e==`boolean`?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?R(`WebGLRenderer: Texture samplers can not be part of an uniforms group.`):R(`WebGLRenderer: Unsupported uniform value type.`,e),t}function g(t){let n=t.target;n.removeEventListener(`dispose`,g);let r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}function _(){for(let t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}return{bind:c,update:l,dispose:_}}var ng=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),rg=null;function ig(){return rg===null&&(rg=new Za(ng,16,16,be,se),rg.name=`DFG_LUT`,rg.minFilter=O,rg.magFilter=O,rg.wrapS=x,rg.wrapT=x,rg.generateMipmaps=!1,rg.needsUpdate=!0),rg}var ag=class{constructor(e={}){let{canvas:t=Yt(),context:n=null,depth:r=!0,stencil:i=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:l=`default`,failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1,outputBufferType:f=te}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<`u`&&n instanceof WebGLRenderingContext)throw Error(`THREE.WebGLRenderer: WebGL 1 is not supported since r163.`);p=n.getContextAttributes().alpha}else p=a;let m=f,h=new Set([Ce,xe,ye]),g=new Set([te,ae,re,ue,ce,le]),_=new Uint32Array(4),v=new Int32Array(4),y=null,b=null,x=[],S=[],C=null;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.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let w=this,T=!1;this._outputColorSpace=_t;let E=0,D=0,O=null,k=-1,A=null,ee=new $n,ne=new $n,M=null,ie=new U(0),oe=0,de=t.width,fe=t.height,pe=1,me=null,he=null,ge=new $n(0,0,de,fe),_e=new $n(0,0,de,fe),ve=!1,be=new vo,Se=!1,we=!1,Te=new or,Ee=new V,De=new $n,Oe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},N=!1;function ke(){return O===null?pe:1}let P=n;function Ae(e,n){return t.getContext(e,n)}try{let e={alpha:!0,depth:r,stencil:i,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(`setAttribute`in t&&t.setAttribute(`data-engine`,`three.js r183`),t.addEventListener(`webglcontextlost`,et,!1),t.addEventListener(`webglcontextrestored`,tt,!1),t.addEventListener(`webglcontextcreationerror`,nt,!1),P===null){let t=`webgl2`;if(P=Ae(t,e),P===null)throw Ae(t)?Error(`Error creating WebGL context with your selected attributes.`):Error(`Error creating WebGL context.`)}}catch(e){throw z(`WebGLRenderer: `+e.message),e}let je,Me,F,Ne,I,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,We,Ge,Ke,qe,Je,Ye,Xe,Ze;function Qe(){je=new Tp(P),je.init(),Ye=new qh(P,je),Me=new np(P,je,e,Ye),F=new Gh(P,je),Me.reversedDepthBuffer&&d&&F.buffers.depth.setReversed(!0),Ne=new Op(P),I=new Th,Pe=new Kh(P,je,F,I,Me,Ye,Ne),Fe=new wp(w),Ie=new qf(P),Xe=new ep(P,Ie),Le=new Ep(P,Ie,Ne,Xe),Re=new Ap(P,Le,Ie,Xe,Ne),Ke=new kp(P,Me,Pe),Ue=new rp(I),ze=new Y(w,Fe,je,Me,Xe,Ue),Be=new eg(w,I),Ve=new kh,He=new Ih(je),Ge=new $f(w,Fe,F,Re,p,s),We=new Wh(w,Re,Me),Ze=new tg(P,Ne,Me,F),qe=new tp(P,je,Ne),Je=new Dp(P,je,Ne),Ne.programs=ze.programs,w.capabilities=Me,w.extensions=je,w.properties=I,w.renderLists=Ve,w.shadowMap=We,w.state=F,w.info=Ne}Qe(),m!==1009&&(C=new Mp(m,t.width,t.height,r,i));let $e=new Zh(w,P);this.xr=$e,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){let e=je.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){let e=je.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return pe},this.setPixelRatio=function(e){e!==void 0&&(pe=e,this.setSize(de,fe,!1))},this.getSize=function(e){return e.set(de,fe)},this.setSize=function(e,n,r=!0){if($e.isPresenting){R(`WebGLRenderer: Can't change size while VR device is presenting.`);return}de=e,fe=n,t.width=Math.floor(e*pe),t.height=Math.floor(n*pe),r===!0&&(t.style.width=e+`px`,t.style.height=n+`px`),C!==null&&C.setSize(t.width,t.height),this.setViewport(0,0,e,n)},this.getDrawingBufferSize=function(e){return e.set(de*pe,fe*pe).floor()},this.setDrawingBufferSize=function(e,n,r){de=e,fe=n,pe=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.setEffects=function(e){if(m===1009){console.error(`THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.`);return}if(e){for(let t=0;t<e.length;t++)if(e[t].isOutputPass===!0){console.warn(`THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.`);break}}C.setEffects(e||[])},this.getCurrentViewport=function(e){return e.copy(ee)},this.getViewport=function(e){return e.copy(ge)},this.setViewport=function(e,t,n,r){e.isVector4?ge.set(e.x,e.y,e.z,e.w):ge.set(e,t,n,r),F.viewport(ee.copy(ge).multiplyScalar(pe).round())},this.getScissor=function(e){return e.copy(_e)},this.setScissor=function(e,t,n,r){e.isVector4?_e.set(e.x,e.y,e.z,e.w):_e.set(e,t,n,r),F.scissor(ne.copy(_e).multiplyScalar(pe).round())},this.getScissorTest=function(){return ve},this.setScissorTest=function(e){F.setScissorTest(ve=e)},this.setOpaqueSort=function(e){me=e},this.setTransparentSort=function(e){he=e},this.getClearColor=function(e){return e.copy(Ge.getClearColor())},this.setClearColor=function(){Ge.setClearColor(...arguments)},this.getClearAlpha=function(){return Ge.getClearAlpha()},this.setClearAlpha=function(){Ge.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let r=0;if(e){let e=!1;if(O!==null){let t=O.texture.format;e=h.has(t)}if(e){let e=O.texture.type,t=g.has(e),n=Ge.getClearColor(),r=Ge.getClearAlpha(),i=n.r,a=n.g,o=n.b;t?(_[0]=i,_[1]=a,_[2]=o,_[3]=r,P.clearBufferuiv(P.COLOR,0,_)):(v[0]=i,v[1]=a,v[2]=o,v[3]=r,P.clearBufferiv(P.COLOR,0,v))}else r|=P.COLOR_BUFFER_BIT}t&&(r|=P.DEPTH_BUFFER_BIT),n&&(r|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),r!==0&&P.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener(`webglcontextlost`,et,!1),t.removeEventListener(`webglcontextrestored`,tt,!1),t.removeEventListener(`webglcontextcreationerror`,nt,!1),Ge.dispose(),Ve.dispose(),He.dispose(),I.dispose(),Fe.dispose(),Re.dispose(),Xe.dispose(),Ze.dispose(),ze.dispose(),$e.dispose(),$e.removeEventListener(`sessionstart`,lt),$e.removeEventListener(`sessionend`,ut),dt.stop()};function et(e){e.preventDefault(),en(`WebGLRenderer: Context Lost.`),T=!0}function tt(){en(`WebGLRenderer: Context Restored.`),T=!1;let e=Ne.autoReset,t=We.enabled,n=We.autoUpdate,r=We.needsUpdate,i=We.type;Qe(),Ne.autoReset=e,We.enabled=t,We.autoUpdate=n,We.needsUpdate=r,We.type=i}function nt(e){z(`WebGLRenderer: A WebGL context could not be created. Reason: `,e.statusMessage)}function rt(e){let t=e.target;t.removeEventListener(`dispose`,rt),it(t)}function it(e){at(e),I.remove(e)}function at(e){let t=I.get(e).programs;t!==void 0&&(t.forEach(function(e){ze.releaseProgram(e)}),e.isShaderMaterial&&ze.releaseShaderCache(e))}this.renderBufferDirect=function(e,t,n,r,i,a){t===null&&(t=Oe);let o=i.isMesh&&i.matrixWorld.determinant()<0,s=xt(e,t,n,r,i);F.setMaterial(r,o);let c=n.index,l=1;if(r.wireframe===!0){if(c=Le.getWireframeAttribute(n),c===void 0)return;l=2}let u=n.drawRange,d=n.attributes.position,f=u.start*l,p=(u.start+u.count)*l;a!==null&&(f=Math.max(f,a.start*l),p=Math.min(p,(a.start+a.count)*l)),c===null?d!=null&&(f=Math.max(f,0),p=Math.min(p,d.count)):(f=Math.max(f,0),p=Math.min(p,c.count));let m=p-f;if(m<0||m===1/0)return;Xe.setup(i,r,s,n,c);let h,g=qe;if(c!==null&&(h=Ie.get(c),g=Je,g.setIndex(h)),i.isMesh)r.wireframe===!0?(F.setLineWidth(r.wireframeLinewidth*ke()),g.setMode(P.LINES)):g.setMode(P.TRIANGLES);else if(i.isLine){let e=r.linewidth;e===void 0&&(e=1),F.setLineWidth(e*ke()),i.isLineSegments?g.setMode(P.LINES):i.isLineLoop?g.setMode(P.LINE_LOOP):g.setMode(P.LINE_STRIP)}else i.isPoints?g.setMode(P.POINTS):i.isSprite&&g.setMode(P.TRIANGLES);if(i.isBatchedMesh)if(i._multiDrawInstances!==null)nn(`WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.`),g.renderMultiDrawInstances(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount,i._multiDrawInstances);else if(je.get(`WEBGL_multi_draw`))g.renderMultiDraw(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount);else{let e=i._multiDrawStarts,t=i._multiDrawCounts,n=i._multiDrawCount,a=c?Ie.get(c).bytesPerElement:1,o=I.get(r).currentProgram.getUniforms();for(let r=0;r<n;r++)o.setValue(P,`_gl_DrawID`,r),g.render(e[r]/a,t[r])}else if(i.isInstancedMesh)g.renderInstances(f,m,i.count);else if(n.isInstancedBufferGeometry){let e=n._maxInstanceCount===void 0?1/0:n._maxInstanceCount,t=Math.min(n.instanceCount,e);g.renderInstances(f,m,t)}else g.render(f,m)};function ot(e,t,n){e.transparent===!0&&e.side===2&&e.forceSinglePass===!1?(e.side=1,e.needsUpdate=!0,gt(e,t,n),e.side=0,e.needsUpdate=!0,gt(e,t,n),e.side=2):gt(e,t,n)}this.compile=function(e,t,n=null){n===null&&(n=e),b=He.get(n),b.init(t),S.push(b),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(b.pushLight(e),e.castShadow&&b.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(b.pushLight(e),e.castShadow&&b.pushShadow(e))}),b.setupLights();let r=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;let t=e.material;if(t)if(Array.isArray(t))for(let i=0;i<t.length;i++){let a=t[i];ot(a,n,e),r.add(a)}else ot(t,n,e),r.add(t)}),b=S.pop(),r},this.compileAsync=function(e,t,n=null){let r=this.compile(e,t,n);return new Promise(t=>{function n(){if(r.forEach(function(e){I.get(e).currentProgram.isReady()&&r.delete(e)}),r.size===0){t(e);return}setTimeout(n,10)}je.get(`KHR_parallel_shader_compile`)===null?setTimeout(n,10):n()})};let st=null;function ct(e){st&&st(e)}function lt(){dt.stop()}function ut(){dt.start()}let dt=new Kf;dt.setAnimationLoop(ct),typeof self<`u`&&dt.setContext(self),this.setAnimationLoop=function(e){st=e,$e.setAnimationLoop(e),e===null?dt.stop():dt.start()},$e.addEventListener(`sessionstart`,lt),$e.addEventListener(`sessionend`,ut),this.render=function(e,t){if(t!==void 0&&t.isCamera!==!0){z(`WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(T===!0)return;let n=$e.enabled===!0&&$e.isPresenting===!0,r=C!==null&&(O===null||n)&&C.begin(w,O);if(e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),$e.enabled===!0&&$e.isPresenting===!0&&(C===null||C.isCompositing()===!1)&&($e.cameraAutoUpdate===!0&&$e.updateCamera(t),t=$e.getCamera()),e.isScene===!0&&e.onBeforeRender(w,e,t,O),b=He.get(e,S.length),b.init(t),S.push(b),Te.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),be.setFromProjectionMatrix(Te,Rt,t.reversedDepth),we=this.localClippingEnabled,Se=Ue.init(this.clippingPlanes,we),y=Ve.get(e,x.length),y.init(),x.push(y),$e.enabled===!0&&$e.isPresenting===!0){let e=w.xr.getDepthSensingMesh();e!==null&&ft(e,t,-1/0,w.sortObjects)}ft(e,t,0,w.sortObjects),y.finish(),w.sortObjects===!0&&y.sort(me,he),N=$e.enabled===!1||$e.isPresenting===!1||$e.hasDepthSensing()===!1,N&&Ge.addToRenderList(y,e),this.info.render.frame++,Se===!0&&Ue.beginShadows();let i=b.state.shadowsArray;if(We.render(i,e,t),Se===!0&&Ue.endShadows(),this.info.autoReset===!0&&this.info.reset(),(r&&C.hasRenderPass())===!1){let n=y.opaque,r=y.transmissive;if(b.setupLights(),t.isArrayCamera){let i=t.cameras;if(r.length>0)for(let t=0,a=i.length;t<a;t++){let a=i[t];mt(n,r,e,a)}N&&Ge.render(e);for(let t=0,n=i.length;t<n;t++){let n=i[t];pt(y,e,n,n.viewport)}}else r.length>0&&mt(n,r,e,t),N&&Ge.render(e),pt(y,e,t)}O!==null&&D===0&&(Pe.updateMultisampleRenderTarget(O),Pe.updateRenderTargetMipmap(O)),r&&C.end(w),e.isScene===!0&&e.onAfterRender(w,e,t),Xe.resetDefaultState(),k=-1,A=null,S.pop(),S.length>0?(b=S[S.length-1],Se===!0&&Ue.setGlobalState(w.clippingPlanes,b.state.camera)):b=null,x.pop(),y=x.length>0?x[x.length-1]:null};function ft(e,t,n,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)b.pushLight(e),e.castShadow&&b.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||be.intersectsSprite(e)){r&&De.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Te);let t=Re.update(e),i=e.material;i.visible&&y.push(e,t,i,n,De.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||be.intersectsObject(e))){let t=Re.update(e),i=e.material;if(r&&(e.boundingSphere===void 0?(t.boundingSphere===null&&t.computeBoundingSphere(),De.copy(t.boundingSphere.center)):(e.boundingSphere===null&&e.computeBoundingSphere(),De.copy(e.boundingSphere.center)),De.applyMatrix4(e.matrixWorld).applyMatrix4(Te)),Array.isArray(i)){let r=t.groups;for(let a=0,o=r.length;a<o;a++){let o=r[a],s=i[o.materialIndex];s&&s.visible&&y.push(e,t,s,n,De.z,o)}}else i.visible&&y.push(e,t,i,n,De.z,null)}}let i=e.children;for(let e=0,a=i.length;e<a;e++)ft(i[e],t,n,r)}function pt(e,t,n,r){let{opaque:i,transmissive:a,transparent:o}=e;b.setupLightsView(n),Se===!0&&Ue.setGlobalState(w.clippingPlanes,n),r&&F.viewport(ee.copy(r)),i.length>0&&L(i,t,n),a.length>0&&L(a,t,n),o.length>0&&L(o,t,n),F.buffers.depth.setTest(!0),F.buffers.depth.setMask(!0),F.buffers.color.setMask(!0),F.setPolygonOffset(!1)}function mt(e,t,n,r){if((n.isScene===!0?n.overrideMaterial:null)!==null)return;if(b.state.transmissionRenderTarget[r.id]===void 0){let e=je.has(`EXT_color_buffer_half_float`)||je.has(`EXT_color_buffer_float`);b.state.transmissionRenderTarget[r.id]=new tr(1,1,{generateMipmaps:!0,type:e?se:te,minFilter:j,samples:Math.max(4,Me.samples),stencilBuffer:i,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Hn.workingColorSpace})}let a=b.state.transmissionRenderTarget[r.id],o=r.viewport||ee;a.setSize(o.z*w.transmissionResolutionScale,o.w*w.transmissionResolutionScale);let s=w.getRenderTarget(),c=w.getActiveCubeFace(),l=w.getActiveMipmapLevel();w.setRenderTarget(a),w.getClearColor(ie),oe=w.getClearAlpha(),oe<1&&w.setClearColor(16777215,.5),w.clear(),N&&Ge.render(n);let u=w.toneMapping;w.toneMapping=0;let d=r.viewport;if(r.viewport!==void 0&&(r.viewport=void 0),b.setupLightsView(r),Se===!0&&Ue.setGlobalState(w.clippingPlanes,r),L(e,n,r),Pe.updateMultisampleRenderTarget(a),Pe.updateRenderTargetMipmap(a),je.has(`WEBGL_multisampled_render_to_texture`)===!1){let e=!1;for(let i=0,a=t.length;i<a;i++){let{object:a,geometry:o,material:s,group:c}=t[i];if(s.side===2&&a.layers.test(r.layers)){let t=s.side;s.side=1,s.needsUpdate=!0,ht(a,n,r,o,s,c),s.side=t,s.needsUpdate=!0,e=!0}}e===!0&&(Pe.updateMultisampleRenderTarget(a),Pe.updateRenderTargetMipmap(a))}w.setRenderTarget(s,c,l),w.setClearColor(ie,oe),d!==void 0&&(r.viewport=d),w.toneMapping=u}function L(e,t,n){let r=t.isScene===!0?t.overrideMaterial:null;for(let i=0,a=e.length;i<a;i++){let a=e[i],{object:o,geometry:s,group:c}=a,l=a.material;l.allowOverride===!0&&r!==null&&(l=r),o.layers.test(n.layers)&&ht(o,t,n,s,l,c)}}function ht(e,t,n,r,i,a){e.onBeforeRender(w,t,n,r,i,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),i.onBeforeRender(w,t,n,r,e,a),i.transparent===!0&&i.side===2&&i.forceSinglePass===!1?(i.side=1,i.needsUpdate=!0,w.renderBufferDirect(n,t,r,i,e,a),i.side=0,i.needsUpdate=!0,w.renderBufferDirect(n,t,r,i,e,a),i.side=2):w.renderBufferDirect(n,t,r,i,e,a),e.onAfterRender(w,t,n,r,i,a)}function gt(e,t,n){t.isScene!==!0&&(t=Oe);let r=I.get(e),i=b.state.lights,a=b.state.shadowsArray,o=i.state.version,s=ze.getParameters(e,i.state,a,t,n),c=ze.getProgramCacheKey(s),l=r.programs;r.environment=e.isMeshStandardMaterial||e.isMeshLambertMaterial||e.isMeshPhongMaterial?t.environment:null,r.fog=t.fog;let u=e.isMeshStandardMaterial||e.isMeshLambertMaterial&&!e.envMap||e.isMeshPhongMaterial&&!e.envMap;r.envMap=Fe.get(e.envMap||r.environment,u),r.envMapRotation=r.environment!==null&&e.envMap===null?t.environmentRotation:e.envMapRotation,l===void 0&&(e.addEventListener(`dispose`,rt),l=new Map,r.programs=l);let d=l.get(c);if(d!==void 0){if(r.currentProgram===d&&r.lightsStateVersion===o)return bt(e,s),d}else s.uniforms=ze.getUniforms(e),e.onBeforeCompile(s,w),d=ze.acquireProgram(s,c),l.set(c,d),r.uniforms=s.uniforms;let f=r.uniforms;return(!e.isShaderMaterial&&!e.isRawShaderMaterial||e.clipping===!0)&&(f.clippingPlanes=Ue.uniform),bt(e,s),r.needsLights=Ct(e),r.lightsStateVersion=o,r.needsLights&&(f.ambientLightColor.value=i.state.ambient,f.lightProbe.value=i.state.probe,f.directionalLights.value=i.state.directional,f.directionalLightShadows.value=i.state.directionalShadow,f.spotLights.value=i.state.spot,f.spotLightShadows.value=i.state.spotShadow,f.rectAreaLights.value=i.state.rectArea,f.ltc_1.value=i.state.rectAreaLTC1,f.ltc_2.value=i.state.rectAreaLTC2,f.pointLights.value=i.state.point,f.pointLightShadows.value=i.state.pointShadow,f.hemisphereLights.value=i.state.hemi,f.directionalShadowMatrix.value=i.state.directionalShadowMatrix,f.spotLightMatrix.value=i.state.spotLightMatrix,f.spotLightMap.value=i.state.spotLightMap,f.pointShadowMatrix.value=i.state.pointShadowMatrix),r.currentProgram=d,r.uniformsList=null,d}function yt(e){if(e.uniformsList===null){let t=e.currentProgram.getUniforms();e.uniformsList=zm.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function bt(e,t){let n=I.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}function xt(e,t,n,r,i){t.isScene!==!0&&(t=Oe),Pe.resetTextureUnits();let a=t.fog,o=r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial?t.environment:null,s=O===null?w.outputColorSpace:O.isXRRenderTarget===!0?O.texture.colorSpace:vt,c=r.isMeshStandardMaterial||r.isMeshLambertMaterial&&!r.envMap||r.isMeshPhongMaterial&&!r.envMap,l=Fe.get(r.envMap||o,c),u=r.vertexColors===!0&&!!n.attributes.color&&n.attributes.color.itemSize===4,d=!!n.attributes.tangent&&(!!r.normalMap||r.anisotropy>0),f=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,m=!!n.morphAttributes.color,h=0;r.toneMapped&&(O===null||O.isXRRenderTarget===!0)&&(h=w.toneMapping);let g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=g===void 0?0:g.length,v=I.get(r),y=b.state.lights;if(Se===!0&&(we===!0||e!==A)){let t=e===A&&r.id===k;Ue.setState(r,e,t)}let x=!1;r.version===v.__version?v.needsLights&&v.lightsStateVersion!==y.state.version?x=!0:v.outputColorSpace===s?i.isBatchedMesh&&v.batching===!1||!i.isBatchedMesh&&v.batching===!0||i.isBatchedMesh&&v.batchingColor===!0&&i.colorTexture===null||i.isBatchedMesh&&v.batchingColor===!1&&i.colorTexture!==null||i.isInstancedMesh&&v.instancing===!1||!i.isInstancedMesh&&v.instancing===!0||i.isSkinnedMesh&&v.skinning===!1||!i.isSkinnedMesh&&v.skinning===!0||i.isInstancedMesh&&v.instancingColor===!0&&i.instanceColor===null||i.isInstancedMesh&&v.instancingColor===!1&&i.instanceColor!==null||i.isInstancedMesh&&v.instancingMorph===!0&&i.morphTexture===null||i.isInstancedMesh&&v.instancingMorph===!1&&i.morphTexture!==null?x=!0:v.envMap===l?r.fog===!0&&v.fog!==a||v.numClippingPlanes!==void 0&&(v.numClippingPlanes!==Ue.numPlanes||v.numIntersection!==Ue.numIntersection)?x=!0:v.vertexAlphas===u&&v.vertexTangents===d&&v.morphTargets===f&&v.morphNormals===p&&v.morphColors===m&&v.toneMapping===h?v.morphTargetsCount!==_&&(x=!0):x=!0:x=!0:x=!0:(x=!0,v.__version=r.version);let S=v.currentProgram;x===!0&&(S=gt(r,t,i));let C=!1,T=!1,E=!1,D=S.getUniforms(),j=v.uniforms;if(F.useProgram(S.program)&&(C=!0,T=!0,E=!0),r.id!==k&&(k=r.id,T=!0),C||A!==e){F.buffers.depth.getReversed()&&e.reversedDepth!==!0&&(e._reversedDepth=!0,e.updateProjectionMatrix()),D.setValue(P,`projectionMatrix`,e.projectionMatrix),D.setValue(P,`viewMatrix`,e.matrixWorldInverse);let t=D.map.cameraPosition;t!==void 0&&t.setValue(P,Ee.setFromMatrixPosition(e.matrixWorld)),Me.logarithmicDepthBuffer&&D.setValue(P,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&D.setValue(P,`isOrthographic`,e.isOrthographicCamera===!0),A!==e&&(A=e,T=!0,E=!0)}if(v.needsLights&&(y.state.directionalShadowMap.length>0&&D.setValue(P,`directionalShadowMap`,y.state.directionalShadowMap,Pe),y.state.spotShadowMap.length>0&&D.setValue(P,`spotShadowMap`,y.state.spotShadowMap,Pe),y.state.pointShadowMap.length>0&&D.setValue(P,`pointShadowMap`,y.state.pointShadowMap,Pe)),i.isSkinnedMesh){D.setOptional(P,i,`bindMatrix`),D.setOptional(P,i,`bindMatrixInverse`);let e=i.skeleton;e&&(e.boneTexture===null&&e.computeBoneTexture(),D.setValue(P,`boneTexture`,e.boneTexture,Pe))}i.isBatchedMesh&&(D.setOptional(P,i,`batchingTexture`),D.setValue(P,`batchingTexture`,i._matricesTexture,Pe),D.setOptional(P,i,`batchingIdTexture`),D.setValue(P,`batchingIdTexture`,i._indirectTexture,Pe),D.setOptional(P,i,`batchingColorTexture`),i._colorsTexture!==null&&D.setValue(P,`batchingColorTexture`,i._colorsTexture,Pe));let ee=n.morphAttributes;if((ee.position!==void 0||ee.normal!==void 0||ee.color!==void 0)&&Ke.update(i,n,S),(T||v.receiveShadow!==i.receiveShadow)&&(v.receiveShadow=i.receiveShadow,D.setValue(P,`receiveShadow`,i.receiveShadow)),(r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial)&&r.envMap===null&&t.environment!==null&&(j.envMapIntensity.value=t.environmentIntensity),j.dfgLUT!==void 0&&(j.dfgLUT.value=ig()),T&&(D.setValue(P,`toneMappingExposure`,w.toneMappingExposure),v.needsLights&&St(j,E),a&&r.fog===!0&&Be.refreshFogUniforms(j,a),Be.refreshMaterialUniforms(j,r,pe,fe,b.state.transmissionRenderTarget[e.id]),zm.upload(P,yt(v),j,Pe)),r.isShaderMaterial&&r.uniformsNeedUpdate===!0&&(zm.upload(P,yt(v),j,Pe),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&D.setValue(P,`center`,i.center),D.setValue(P,`modelViewMatrix`,i.modelViewMatrix),D.setValue(P,`normalMatrix`,i.normalMatrix),D.setValue(P,`modelMatrix`,i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial){let e=r.uniformsGroups;for(let t=0,n=e.length;t<n;t++){let n=e[t];Ze.update(n,S),Ze.bind(n,S)}}return S}function St(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function Ct(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&e.lights===!0}this.getActiveCubeFace=function(){return E},this.getActiveMipmapLevel=function(){return D},this.getRenderTarget=function(){return O},this.setRenderTargetTextures=function(e,t,n){let r=I.get(e);r.__autoAllocateDepthBuffer=e.resolveDepthBuffer===!1,r.__autoAllocateDepthBuffer===!1&&(r.__useRenderToTexture=!1),I.get(e.texture).__webglTexture=t,I.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:n,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){let n=I.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=t===void 0};let wt=P.createFramebuffer();this.setRenderTarget=function(e,t=0,n=0){O=e,E=t,D=n;let r=null,i=!1,a=!1;if(e){let o=I.get(e);if(o.__useDefaultFramebuffer!==void 0){F.bindFramebuffer(P.FRAMEBUFFER,o.__webglFramebuffer),ee.copy(e.viewport),ne.copy(e.scissor),M=e.scissorTest,F.viewport(ee),F.scissor(ne),F.setScissorTest(M),k=-1;return}else if(o.__webglFramebuffer===void 0)Pe.setupRenderTarget(e);else if(o.__hasExternalTextures)Pe.rebindTextures(e,I.get(e.texture).__webglTexture,I.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let t=e.depthTexture;if(o.__boundDepthTexture!==t){if(t!==null&&I.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw Error(`WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.`);Pe.setupDepthRenderbuffer(e)}}let s=e.texture;(s.isData3DTexture||s.isDataArrayTexture||s.isCompressedArrayTexture)&&(a=!0);let c=I.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(c[t])?c[t][n]:c[t],i=!0):r=e.samples>0&&Pe.useMultisampledRTT(e)===!1?I.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,ee.copy(e.viewport),ne.copy(e.scissor),M=e.scissorTest}else ee.copy(ge).multiplyScalar(pe).floor(),ne.copy(_e).multiplyScalar(pe).floor(),M=ve;if(n!==0&&(r=wt),F.bindFramebuffer(P.FRAMEBUFFER,r)&&F.drawBuffers(e,r),F.viewport(ee),F.scissor(ne),F.setScissorTest(M),i){let r=I.get(e.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(a){let r=t;for(let t=0;t<e.textures.length;t++){let i=I.get(e.textures[t]);P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0+t,i.__webglTexture,n,r)}}else if(e!==null&&n!==0){let t=I.get(e.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,t.__webglTexture,n)}k=-1},this.readRenderTargetPixels=function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget)){z(`WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);return}let c=I.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c){F.bindFramebuffer(P.FRAMEBUFFER,c);try{let o=e.textures[s],c=o.format,l=o.type;if(e.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+s),!Me.textureFormatReadable(c)){z(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(!Me.textureTypeReadable(l)){z(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&P.readPixels(t,n,r,i,Ye.convert(c),Ye.convert(l),a)}finally{let e=O===null?null:I.get(O).__webglFramebuffer;F.bindFramebuffer(P.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget))throw Error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);let c=I.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c)if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){F.bindFramebuffer(P.FRAMEBUFFER,c);let o=e.textures[s],l=o.format,u=o.type;if(e.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+s),!Me.textureFormatReadable(l))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.`);if(!Me.textureTypeReadable(u))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.`);let d=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,d),P.bufferData(P.PIXEL_PACK_BUFFER,a.byteLength,P.STREAM_READ),P.readPixels(t,n,r,i,Ye.convert(l),Ye.convert(u),0);let f=O===null?null:I.get(O).__webglFramebuffer;F.bindFramebuffer(P.FRAMEBUFFER,f);let p=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),await rn(P,p,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,d),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,a),P.deleteBuffer(d),P.deleteSync(p),a}else throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.`)},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=2**-n,i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=t===null?0:t.x,s=t===null?0:t.y;Pe.setTexture2D(e,0),P.copyTexSubImage2D(P.TEXTURE_2D,n,0,0,o,s,i,a),F.unbindTexture()};let Tt=P.createFramebuffer(),Et=P.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=0){let o,s,c,l,u,d,f,p,m,h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(n!==null)o=n.max.x-n.min.x,s=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,l=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{let t=2**-i;o=Math.floor(h.width*t),s=Math.floor(h.height*t),c=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,l=0,u=0,d=0}r===null?(f=0,p=0,m=0):(f=r.x,p=r.y,m=r.z);let g=Ye.convert(t.format),_=Ye.convert(t.type),v;t.isData3DTexture?(Pe.setTexture3D(t,0),v=P.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(Pe.setTexture2DArray(t,0),v=P.TEXTURE_2D_ARRAY):(Pe.setTexture2D(t,0),v=P.TEXTURE_2D),P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,t.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,t.unpackAlignment);let y=P.getParameter(P.UNPACK_ROW_LENGTH),b=P.getParameter(P.UNPACK_IMAGE_HEIGHT),x=P.getParameter(P.UNPACK_SKIP_PIXELS),S=P.getParameter(P.UNPACK_SKIP_ROWS),C=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,h.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,h.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,l),P.pixelStorei(P.UNPACK_SKIP_ROWS,u),P.pixelStorei(P.UNPACK_SKIP_IMAGES,d);let w=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=I.get(e),r=I.get(t),h=I.get(n.__renderTarget),g=I.get(r.__renderTarget);F.bindFramebuffer(P.READ_FRAMEBUFFER,h.__webglFramebuffer),F.bindFramebuffer(P.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;n<c;n++)w&&(P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,I.get(e).__webglTexture,i,d+n),P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,I.get(t).__webglTexture,a,m+n)),P.blitFramebuffer(l,u,o,s,f,p,o,s,P.DEPTH_BUFFER_BIT,P.NEAREST);F.bindFramebuffer(P.READ_FRAMEBUFFER,null),F.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else if(i!==0||e.isRenderTargetTexture||I.has(e)){let n=I.get(e),r=I.get(t);F.bindFramebuffer(P.READ_FRAMEBUFFER,Tt),F.bindFramebuffer(P.DRAW_FRAMEBUFFER,Et);for(let e=0;e<c;e++)w?P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,n.__webglTexture,i,d+e):P.framebufferTexture2D(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,n.__webglTexture,i),T?P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,r.__webglTexture,a,m+e):P.framebufferTexture2D(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,r.__webglTexture,a),i===0?T?P.copyTexSubImage3D(v,a,f,p,m+e,l,u,o,s):P.copyTexSubImage2D(v,a,f,p,l,u,o,s):P.blitFramebuffer(l,u,o,s,f,p,o,s,P.COLOR_BUFFER_BIT,P.NEAREST);F.bindFramebuffer(P.READ_FRAMEBUFFER,null),F.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else T?e.isDataTexture||e.isData3DTexture?P.texSubImage3D(v,a,f,p,m,o,s,c,g,_,h.data):t.isCompressedArrayTexture?P.compressedTexSubImage3D(v,a,f,p,m,o,s,c,g,h.data):P.texSubImage3D(v,a,f,p,m,o,s,c,g,_,h):e.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,a,f,p,o,s,g,_,h.data):e.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,a,f,p,h.width,h.height,g,h.data):P.texSubImage2D(P.TEXTURE_2D,a,f,p,o,s,g,_,h);P.pixelStorei(P.UNPACK_ROW_LENGTH,y),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,b),P.pixelStorei(P.UNPACK_SKIP_PIXELS,x),P.pixelStorei(P.UNPACK_SKIP_ROWS,S),P.pixelStorei(P.UNPACK_SKIP_IMAGES,C),a===0&&t.generateMipmaps&&P.generateMipmap(v),F.unbindTexture()},this.initRenderTarget=function(e){I.get(e).__webglFramebuffer===void 0&&Pe.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?Pe.setTextureCube(e,0):e.isData3DTexture?Pe.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?Pe.setTexture2DArray(e,0):Pe.setTexture2D(e,0),F.unbindTexture()},this.resetState=function(){E=0,D=0,O=null,F.reset(),Xe.reset()},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}get coordinateSystem(){return Rt}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=Hn._getDrawingBufferColorSpace(e),t.unpackColorSpace=Hn._getUnpackColorSpace()}},og=(0,n.createContext)(void 0);function sg(){let e=(0,n.useContext)(og);if(!e)throw Error(`useEver must be used within an EverProvider`);return e}var cg=({children:e})=>{let t=(0,n.useRef)(null),[i,a]=(0,n.useState)(null),o={videoRef:t,avatarBones:i,setAvatarBones:(0,n.useCallback)(e=>{a(e)},[]),isProviderReady:!0};return(0,r.jsx)(og.Provider,{value:o,children:e})},lg=e=>typeof e==`object`&&typeof e.then==`function`,ug=[];function dg(e,t,n=(e,t)=>e===t){if(e===t)return!0;if(!e||!t)return!1;let r=e.length;if(t.length!==r)return!1;for(let i=0;i<r;i++)if(!n(e[i],t[i]))return!1;return!0}function fg(e,t=null,n=!1,r={}){t===null&&(t=[e]);for(let e of ug)if(dg(t,e.keys,e.equal)){if(n)return;if(Object.prototype.hasOwnProperty.call(e,`error`))throw e.error;if(Object.prototype.hasOwnProperty.call(e,`response`))return r.lifespan&&r.lifespan>0&&(e.timeout&&clearTimeout(e.timeout),e.timeout=setTimeout(e.remove,r.lifespan)),e.response;if(!n)throw e.promise}let i={keys:t,equal:r.equal,remove:()=>{let e=ug.indexOf(i);e!==-1&&ug.splice(e,1)},promise:(lg(e)?e:e(...t)).then(e=>{i.response=e,r.lifespan&&r.lifespan>0&&(i.timeout=setTimeout(i.remove,r.lifespan))}).catch(e=>i.error=e)};if(ug.push(i),!n)throw i.promise}var pg=(e,t,n)=>fg(e,t,!1,n),mg=(e,t,n)=>void fg(e,t,!0,n),hg=e=>{if(e===void 0||e.length===0)ug.splice(0,ug.length);else{let t=ug.find(t=>dg(e,t.keys,t.equal));t&&t.remove()}},gg=d((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),_g=d((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(){if(x=!1,T){var t=e.unstable_now();O=t;var n=!0;try{a:{y=!1,b&&(b=!1,C(E),E=-1),v=!0;var a=_;try{b:{for(o(t),g=r(p);g!==null&&!(g.expirationTime>t&&c());){var u=g.callback;if(typeof u==`function`){g.callback=null,_=g.priorityLevel;var d=u(g.expirationTime<=t);if(t=e.unstable_now(),typeof d==`function`){g.callback=d,o(t),n=!0;break b}g===r(p)&&i(p),o(t)}else i(p);g=r(p)}if(g!==null)n=!0;else{var f=r(m);f!==null&&l(s,f.startTime-t),n=!1}}break a}finally{g=null,_=a,v=!1}n=void 0}}finally{n?k():T=!1}}}function n(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,i=e[r];if(0<a(i,t))e[r]=t,e[n]=i,n=r;else break a}}function r(e){return e.length===0?null:e[0]}function i(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,i=e.length,o=i>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>a(c,n))l<i&&0>a(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<i&&0>a(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}function o(e){for(var t=r(m);t!==null;){if(t.callback===null)i(m);else if(t.startTime<=e)i(m),t.sortIndex=t.expirationTime,n(p,t);else break;t=r(m)}}function s(e){if(b=!1,o(e),!y)if(r(p)!==null)y=!0,T||(T=!0,k());else{var t=r(m);t!==null&&l(s,t.startTime-e)}}function c(){return x?!0:!(e.unstable_now()-O<D)}function l(t,n){E=S(function(){t(e.unstable_now())},n)}if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==`function`&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var u=performance;e.unstable_now=function(){return u.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var p=[],m=[],h=1,g=null,_=3,v=!1,y=!1,b=!1,x=!1,S=typeof setTimeout==`function`?setTimeout:null,C=typeof clearTimeout==`function`?clearTimeout:null,w=typeof setImmediate<`u`?setImmediate:null,T=!1,E=-1,D=5,O=-1;if(typeof w==`function`)var k=function(){w(t)};else if(typeof MessageChannel<`u`){var A=new MessageChannel,j=A.port2;A.port1.onmessage=t,k=function(){j.postMessage(null)}}else k=function(){S(t,0)};e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):D=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return _},e.unstable_next=function(e){switch(_){case 1:case 2:case 3:var t=3;break;default:t=_}var n=_;_=t;try{return e()}finally{_=n}},e.unstable_requestPaint=function(){x=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=_;_=e;try{return t()}finally{_=n}},e.unstable_scheduleCallback=function(t,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,t){case 1:var c=-1;break;case 2:c=250;break;case 5:c=1073741823;break;case 4:c=1e4;break;default:c=5e3}return c=a+c,t={id:h++,callback:i,priorityLevel:t,startTime:a,expirationTime:c,sortIndex:-1},a>o?(t.sortIndex=a,n(m,t),r(p)===null&&t===r(m)&&(b?(C(E),E=-1):b=!0,l(s,a-o))):(t.sortIndex=c,n(p,t),y||v||(y=!0,T||(T=!0,k()))),t},e.unstable_shouldYield=c,e.unstable_wrapCallback=function(e){var t=_;return function(){var n=_;_=t;try{return e.apply(this,arguments)}finally{_=n}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==`function`&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()})),vg=m(d(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=gg():t.exports=_g()}))());typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`)?n.useLayoutEffect:n.useEffect;function yg(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){let e=yg(r,t,n);if(e)return e;r=t?null:r.sibling}}function bg(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}var xg=bg(n.createContext(null)),Sg=class extends n.Component{render(){return n.createElement(xg.Provider,{value:this._reactInternals},this.props.children)}};function Cg(){let e=n.useContext(xg);if(e===null)throw Error(`its-fine: useFiber must be called within a <FiberProvider />!`);let t=n.useId();return n.useMemo(()=>{for(let n of[e,e?.alternate]){if(!n)continue;let e=yg(n,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}});if(e)return e}},[e,t])}var wg=Symbol.for(`react.context`),Tg=e=>typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===wg;function Eg(){let e=Cg(),[t]=n.useState(()=>new Map);t.clear();let r=e;for(;r;){let e=r.type;Tg(e)&&e!==xg&&!t.has(e)&&t.set(e,n.use(bg(e))),r=r.return}return t}function Dg(){let e=Eg();return n.useMemo(()=>Array.from(e.keys()).reduce((t,r)=>i=>n.createElement(t,null,n.createElement(r.Provider,{...i,value:e.get(r)})),e=>n.createElement(Sg,{...e})),[e])}function Og(e){let t=e.root;for(;t.getState().previousRoot;)t=t.getState().previousRoot;return t}n.act;var kg=e=>e&&e.isOrthographicCamera,Ag=e=>e&&e.hasOwnProperty(`current`),jg=e=>e!=null&&(typeof e==`string`||typeof e==`number`||e.isColor),Mg=((e,t)=>typeof window<`u`&&((e=window.document)?.createElement||(t=window.navigator)?.product===`ReactNative`))()?n.useLayoutEffect:n.useEffect;function Ng(e){let t=n.useRef(e);return Mg(()=>void(t.current=e),[e]),t}function Pg(){let e=Cg(),t=Dg();return n.useMemo(()=>({children:i})=>(0,r.jsx)(yg(e,!0,e=>e.type===n.StrictMode)?n.StrictMode:n.Fragment,{children:(0,r.jsx)(t,{children:i})}),[e,t])}function Fg({set:e}){return Mg(()=>(e(new Promise(()=>null)),()=>e(!1)),[e]),null}var Ig=(e=>(e=class extends n.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}},e.getDerivedStateFromError=()=>({error:!0}),e))();function Lg(e){let t=typeof window<`u`?window.devicePixelRatio??2:1;return Array.isArray(e)?Math.min(Math.max(e[0],t),e[1]):e}function Rg(e){return e.__r3f?.root.getState()}var zg={obj:e=>e===Object(e)&&!zg.arr(e)&&typeof e!=`function`,fun:e=>typeof e==`function`,str:e=>typeof e==`string`,num:e=>typeof e==`number`,boo:e=>typeof e==`boolean`,und:e=>e===void 0,nul:e=>e===null,arr:e=>Array.isArray(e),equ(e,t,{arrays:n=`shallow`,objects:r=`reference`,strict:i=!0}={}){if(typeof e!=typeof t||!!e!=!!t)return!1;if(zg.str(e)||zg.num(e)||zg.boo(e))return e===t;let a=zg.obj(e);if(a&&r===`reference`)return e===t;let o=zg.arr(e);if(o&&n===`reference`)return e===t;if((o||a)&&e===t)return!0;let s;for(s in e)if(!(s in t))return!1;if(a&&n===`shallow`&&r===`shallow`){for(s in i?t:e)if(!zg.equ(e[s],t[s],{strict:i,objects:`reference`}))return!1}else for(s in i?t:e)if(e[s]!==t[s])return!1;if(zg.und(s)){if(o&&e.length===0&&t.length===0||a&&Object.keys(e).length===0&&Object.keys(t).length===0)return!0;if(e!==t)return!1}return!0}};function Bg(e){let t={nodes:{},materials:{},meshes:{}};return e&&e.traverse(e=>{e.name&&(t.nodes[e.name]=e),e.material&&!t.materials[e.material.name]&&(t.materials[e.material.name]=e.material),e.isMesh&&!t.meshes[e.name]&&(t.meshes[e.name]=e)}),t}function Vg(e){e.type!==`Scene`&&(e.dispose==null||e.dispose());for(let t in e){let n=e[t];n?.type!==`Scene`&&(n==null||n.dispose==null||n.dispose())}}var Hg=[`children`,`key`,`ref`];function Ug(e){let t={};for(let n in e)Hg.includes(n)||(t[n]=e[n]);return t}function Wg(e,t,n,r){let i=e,a=i?.__r3f;return a||(a={root:t,type:n,parent:null,children:[],props:Ug(r),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=a)),a}function Gg(e,t){if(!t.includes(`-`)||t in e)return{root:e,key:t,target:e[t]};let n=e,r=t.split(`-`);for(let i of r){if(typeof n!=`object`||!n){if(n!==void 0){let e=r.slice(r.indexOf(i)).join(`-`);return{root:n,key:e,target:void 0}}return{root:e,key:t,target:void 0}}t=i,e=n,n=n[t]}return{root:e,key:t,target:n}}var Kg=/-\d+$/;function qg(e,t){if(zg.str(t.props.attach)){if(Kg.test(t.props.attach)){let n=t.props.attach.replace(Kg,``),{root:r,key:i}=Gg(e.object,n);Array.isArray(r[i])||(r[i]=[])}let{root:n,key:r}=Gg(e.object,t.props.attach);t.previousAttach=n[r],n[r]=t.object}else zg.fun(t.props.attach)&&(t.previousAttach=t.props.attach(e.object,t.object))}function Jg(e,t){if(zg.str(t.props.attach)){let{root:n,key:r}=Gg(e.object,t.props.attach),i=t.previousAttach;i===void 0?delete n[r]:n[r]=i}else t.previousAttach==null||t.previousAttach(e.object,t.object);delete t.previousAttach}var Yg=[...Hg,`args`,`dispose`,`attach`,`object`,`onUpdate`,`dispose`],Xg=new Map;function Zg(e){let t=Xg.get(e.constructor);try{t||(t=new e.constructor,Xg.set(e.constructor,t))}catch{}return t}function Qg(e,t){let n={};for(let r in t)if(!Yg.includes(r)&&!zg.equ(t[r],e.props[r])){n[r]=t[r];for(let e in t)e.startsWith(`${r}-`)&&(n[e]=t[e])}for(let r in e.props){if(Yg.includes(r)||t.hasOwnProperty(r))continue;let{root:i,key:a}=Gg(e.object,r);if(i.constructor&&i.constructor.length===0){let e=Zg(i);zg.und(e)||(n[a]=e[a])}else n[a]=0}return n}var $g=[`map`,`emissiveMap`,`sheenColorMap`,`specularColorMap`,`envMap`],e_=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function t_(e,t){var n;let r=e.__r3f,i=r&&Og(r).getState(),a=r?.eventCount;for(let n in t){let a=t[n];if(Yg.includes(n))continue;if(r&&e_.test(n)){typeof a==`function`?r.handlers[n]=a:delete r.handlers[n],r.eventCount=Object.keys(r.handlers).length;continue}if(a===void 0)continue;let{root:s,key:c,target:l}=Gg(e,n);if(l===void 0&&(typeof s!=`object`||!s))throw Error(`R3F: Cannot set "${n}". Ensure it is an object before setting "${c}".`);if(l instanceof gr&&a instanceof gr)l.mask=a.mask;else if(l instanceof U&&jg(a))l.set(a);else if(typeof l==`object`&&l&&typeof l.set==`function`&&typeof l.copy==`function`&&a!=null&&a.constructor&&l.constructor===a.constructor)l.copy(a);else if(typeof l==`object`&&l&&typeof l.set==`function`&&Array.isArray(a))typeof l.fromArray==`function`?l.fromArray(a):l.set(...a);else if(typeof l==`object`&&l&&typeof l.set==`function`&&typeof a==`number`)typeof l.setScalar==`function`?l.setScalar(a):l.set(a);else{var o;s[c]=a,i&&!i.linear&&$g.includes(c)&&(o=s[c])!=null&&o.isTexture&&s[c].format===1023&&s[c].type===1009&&(s[c].colorSpace=_t)}}if(r!=null&&r.parent&&i!=null&&i.internal&&(n=r.object)!=null&&n.isObject3D&&a!==r.eventCount){let e=r.object,t=i.internal.interaction.indexOf(e);t>-1&&i.internal.interaction.splice(t,1),r.eventCount&&e.raycast!==null&&i.internal.interaction.push(e)}return r&&r.props.attach===void 0&&(r.object.isBufferGeometry?r.props.attach=`geometry`:r.object.isMaterial&&(r.props.attach=`material`)),r&&n_(r),e}function n_(e){var t;if(!e.parent)return;e.props.onUpdate==null||e.props.onUpdate(e.object);let n=(t=e.root)==null||t.getState==null?void 0:t.getState();n&&n.internal.frames===0&&n.invalidate()}function r_(e,t){e.manual||(kg(e)?(e.left=t.width/-2,e.right=t.width/2,e.top=t.height/2,e.bottom=t.height/-2):e.aspect=t.width/t.height,e.updateProjectionMatrix())}var i_=e=>e?.isObject3D;function a_(e){return(e.eventObject||e.object).uuid+`/`+e.index+e.instanceId}function o_(e,t,n,r){let i=n.get(t);i&&(n.delete(t),n.size===0&&(e.delete(r),i.target.releasePointerCapture(r)))}function s_(e,t){let{internal:n}=e.getState();n.interaction=n.interaction.filter(e=>e!==t),n.initialHits=n.initialHits.filter(e=>e!==t),n.hovered.forEach((e,r)=>{(e.eventObject===t||e.object===t)&&n.hovered.delete(r)}),n.capturedMap.forEach((e,r)=>{o_(n.capturedMap,t,e,r)})}function c_(e){function t(t){let{internal:n}=e.getState(),r=t.offsetX-n.initialClick[0],i=t.offsetY-n.initialClick[1];return Math.round(Math.sqrt(r*r+i*i))}function n(e){return e.filter(e=>[`Move`,`Over`,`Enter`,`Out`,`Leave`].some(t=>e.__r3f?.handlers[`onPointer`+t]))}function r(t,n){let r=e.getState(),i=new Set,a=[],o=n?n(r.internal.interaction):r.internal.interaction;for(let e=0;e<o.length;e++){let t=Rg(o[e]);t&&(t.raycaster.camera=void 0)}r.previousRoot||r.events.compute==null||r.events.compute(t,r);function s(e){let n=Rg(e);return!n||!n.events.enabled||n.raycaster.camera===null?[]:(n.raycaster.camera===void 0&&(n.events.compute==null||n.events.compute(t,n,n.previousRoot?.getState()),n.raycaster.camera===void 0&&(n.raycaster.camera=null)),n.raycaster.camera?n.raycaster.intersectObject(e,!0):[])}let c=o.flatMap(s).sort((e,t)=>{let n=Rg(e.object),r=Rg(t.object);return!n||!r?e.distance-t.distance:r.events.priority-n.events.priority||e.distance-t.distance}).filter(e=>{let t=a_(e);return i.has(t)?!1:(i.add(t),!0)});r.events.filter&&(c=r.events.filter(c,r));for(let e of c){let t=e.object;for(;t;){var l;(l=t.__r3f)!=null&&l.eventCount&&a.push({...e,eventObject:t}),t=t.parent}}if(`pointerId`in t&&r.internal.capturedMap.has(t.pointerId))for(let e of r.internal.capturedMap.get(t.pointerId).values())i.has(a_(e.intersection))||a.push(e.intersection);return a}function i(e,t,n,r){if(e.length){let i={stopped:!1};for(let o of e){let s=Rg(o.object);if(s||o.object.traverseAncestors(e=>{let t=Rg(e);if(t)return s=t,!1}),s){let{raycaster:c,pointer:l,camera:u,internal:d}=s,f=new V(l.x,l.y,0).unproject(u),p=e=>d.capturedMap.get(e)?.has(o.eventObject)??!1,m=e=>{let n={intersection:o,target:t.target};d.capturedMap.has(e)?d.capturedMap.get(e).set(o.eventObject,n):d.capturedMap.set(e,new Map([[o.eventObject,n]])),t.target.setPointerCapture(e)},h=e=>{let t=d.capturedMap.get(e);t&&o_(d.capturedMap,o.eventObject,t,e)},g={};for(let e in t){let n=t[e];typeof n!=`function`&&(g[e]=n)}let _={...o,...g,pointer:l,intersections:e,stopped:i.stopped,delta:n,unprojectedPoint:f,ray:c.ray,camera:u,stopPropagation(){let n=`pointerId`in t&&d.capturedMap.get(t.pointerId);(!n||n.has(o.eventObject))&&(_.stopped=i.stopped=!0,d.hovered.size&&Array.from(d.hovered.values()).find(e=>e.eventObject===o.eventObject)&&a([...e.slice(0,e.indexOf(o)),o]))},target:{hasPointerCapture:p,setPointerCapture:m,releasePointerCapture:h},currentTarget:{hasPointerCapture:p,setPointerCapture:m,releasePointerCapture:h},nativeEvent:t};if(r(_),i.stopped===!0)break}}}return e}function a(t){let{internal:n}=e.getState();for(let e of n.hovered.values())if(!t.length||!t.find(t=>t.object===e.object&&t.index===e.index&&t.instanceId===e.instanceId)){let r=e.eventObject.__r3f;if(n.hovered.delete(a_(e)),r!=null&&r.eventCount){let n=r.handlers,i={...e,intersections:t};n.onPointerOut==null||n.onPointerOut(i),n.onPointerLeave==null||n.onPointerLeave(i)}}}function o(e,t){for(let n=0;n<t.length;n++){let r=t[n].__r3f;r==null||r.handlers.onPointerMissed==null||r.handlers.onPointerMissed(e)}}function s(s){switch(s){case`onPointerLeave`:case`onPointerCancel`:return()=>a([]);case`onLostPointerCapture`:return t=>{let{internal:n}=e.getState();`pointerId`in t&&n.capturedMap.has(t.pointerId)&&requestAnimationFrame(()=>{n.capturedMap.has(t.pointerId)&&(n.capturedMap.delete(t.pointerId),a([]))})}}return function(c){let{onPointerMissed:l,internal:u}=e.getState();u.lastEvent.current=c;let d=s===`onPointerMove`,f=s===`onClick`||s===`onContextMenu`||s===`onDoubleClick`,p=r(c,d?n:void 0),m=f?t(c):0;s===`onPointerDown`&&(u.initialClick=[c.offsetX,c.offsetY],u.initialHits=p.map(e=>e.eventObject)),f&&!p.length&&m<=2&&(o(c,u.interaction),l&&l(c)),d&&a(p);function h(e){let t=e.eventObject,n=t.__r3f;if(!(n!=null&&n.eventCount))return;let r=n.handlers;if(d){if(r.onPointerOver||r.onPointerEnter||r.onPointerOut||r.onPointerLeave){let t=a_(e),n=u.hovered.get(t);n?n.stopped&&e.stopPropagation():(u.hovered.set(t,e),r.onPointerOver==null||r.onPointerOver(e),r.onPointerEnter==null||r.onPointerEnter(e))}r.onPointerMove==null||r.onPointerMove(e)}else{let n=r[s];n?(!f||u.initialHits.includes(t))&&(o(c,u.interaction.filter(e=>!u.initialHits.includes(e))),n(e)):f&&u.initialHits.includes(t)&&o(c,u.interaction.filter(e=>!u.initialHits.includes(e)))}}i(p,c,m,h)}}return{handlePointer:s}}var l_=e=>!!(e!=null&&e.render),u_=n.createContext(null),d_=(e,t)=>{let r=(0,i.createWithEqualityFn)((r,i)=>{let a=new V,o=new V,s=new V;function c(e=i().camera,t=o,n=i().size){let{width:r,height:c,top:l,left:u}=n,d=r/c;t.isVector3?s.copy(t):s.set(...t);let f=e.getWorldPosition(a).distanceTo(s);if(kg(e))return{width:r/e.zoom,height:c/e.zoom,top:l,left:u,factor:1,distance:f,aspect:d};{let t=e.fov*Math.PI/180,n=2*Math.tan(t/2)*f,i=r/c*n;return{width:i,height:n,top:l,left:u,factor:r/i,distance:f,aspect:d}}}let l,u=e=>r(t=>({performance:{...t.performance,current:e}})),d=new B;return{set:r,get:i,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(t=1)=>e(i(),t),advance:(e,n)=>t(e,n,i()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new Gd,pointer:d,mouse:d,frameloop:`always`,onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{let e=i();l&&clearTimeout(l),e.performance.current!==e.performance.min&&u(e.performance.min),l=setTimeout(()=>u(i().performance.max),e.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:c},setEvents:e=>r(t=>({...t,events:{...t.events,...e}})),setSize:(e,t,n=0,a=0)=>{let s=i().camera,l={width:e,height:t,top:n,left:a};r(e=>({size:l,viewport:{...e.viewport,...c(s,o,l)}}))},setDpr:e=>r(t=>{let n=Lg(e);return{viewport:{...t.viewport,dpr:n,initialDpr:t.viewport.initialDpr||n}}}),setFrameloop:(e=`always`)=>{let t=i().clock;t.stop(),t.elapsedTime=0,e!==`never`&&(t.start(),t.elapsedTime=0),r(()=>({frameloop:e}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:n.createRef(),active:!1,frames:0,priority:0,subscribe:(e,t,n)=>{let r=i().internal;return r.priority+=t>0?1:0,r.subscribers.push({ref:e,priority:t,store:n}),r.subscribers=r.subscribers.sort((e,t)=>e.priority-t.priority),()=>{let n=i().internal;n!=null&&n.subscribers&&(n.priority-=t>0?1:0,n.subscribers=n.subscribers.filter(t=>t.ref!==e))}}}}}),a=r.getState(),o=a.size,s=a.viewport.dpr,c=a.camera;return r.subscribe(()=>{let{camera:e,size:t,viewport:n,gl:i,set:a}=r.getState();if(t.width!==o.width||t.height!==o.height||n.dpr!==s){o=t,s=n.dpr,r_(e,t),n.dpr>0&&i.setPixelRatio(n.dpr);let r=typeof HTMLCanvasElement<`u`&&i.domElement instanceof HTMLCanvasElement;i.setSize(t.width,t.height,r)}e!==c&&(c=e,a(t=>({viewport:{...t.viewport,...t.viewport.getCurrentViewport(e)}})))}),r.subscribe(t=>e(t)),r};function f_(){let e=n.useContext(u_);if(!e)throw Error(`R3F: Hooks can only be used within the Canvas component!`);return e}function p_(e=e=>e,t){return f_()(e,t)}function m_(e,t=0){let n=f_(),r=n.getState().internal.subscribe,i=Ng(e);return Mg(()=>r(i,t,n),[t,r,n]),null}var h_=new WeakMap,g_=e=>typeof e==`function`&&e?.prototype?.constructor===e;function __(e,t){return function(n,...r){let i;return g_(n)?(i=h_.get(n),i||(i=new n,h_.set(n,i))):i=n,e&&e(i),Promise.all(r.map(e=>new Promise((n,r)=>i.load(e,e=>{i_(e?.scene)&&Object.assign(e,Bg(e.scene)),n(e)},t,t=>r(Error(`Could not load ${e}: ${t?.message}`))))))}}function v_(e,t,n,r){let i=Array.isArray(t)?t:[t],a=pg(__(n,r),[e,...i],{equal:zg.equ});return Array.isArray(t)?a:a[0]}v_.preload=function(e,t,n){let r=Array.isArray(t)?t:[t];return mg(__(n),[e,...r])},v_.clear=function(e,t){return hg([e,...Array.isArray(t)?t:[t]])};var y_=1,b_=8,x_=32,S_=2,C_={name:`@react-three/fiber`,version:`9.5.0`,description:`A React renderer for Threejs`,keywords:[`react`,`renderer`,`fiber`,`three`,`threejs`],author:`Paul Henschel (https://github.com/drcmda)`,license:`MIT`,maintainers:[`Josh Ellis (https://github.com/joshuaellis)`,`Cody Bennett (https://github.com/codyjasonbennett)`,`Kris Baumgarter (https://github.com/krispya)`],bugs:{url:`https://github.com/pmndrs/react-three-fiber/issues`},homepage:`https://github.com/pmndrs/react-three-fiber#readme`,repository:{type:`git`,url:`git+https://github.com/pmndrs/react-three-fiber.git`},collective:{type:`opencollective`,url:`https://opencollective.com/react-three-fiber`},main:`dist/react-three-fiber.cjs.js`,module:`dist/react-three-fiber.esm.js`,types:`dist/react-three-fiber.cjs.d.ts`,"react-native":`native/dist/react-three-fiber-native.cjs.js`,sideEffects:!1,preconstruct:{entrypoints:[`index.tsx`,`native.tsx`]},scripts:{prebuild:`cp ../../readme.md readme.md`},devDependencies:{"@types/react-reconciler":`^0.32.3`,"react-reconciler":`^0.33.0`},dependencies:{"@babel/runtime":`^7.17.8`,"@types/webxr":`*`,"base64-js":`^1.5.1`,buffer:`^6.0.3`,"its-fine":`^2.0.0`,"react-use-measure":`^2.1.7`,scheduler:`^0.27.0`,"suspend-react":`^0.1.3`,"use-sync-external-store":`^1.4.0`,zustand:`^5.0.3`},peerDependencies:{expo:`>=43.0`,"expo-asset":`>=8.4`,"expo-file-system":`>=11.0`,"expo-gl":`>=11.0`,react:`>=19 <19.3`,"react-dom":`>=19 <19.3`,"react-native":`>=0.78`,three:`>=0.156`},peerDependenciesMeta:{"react-dom":{optional:!0},"react-native":{optional:!0},expo:{optional:!0},"expo-asset":{optional:!0},"expo-file-system":{optional:!0},"expo-gl":{optional:!0}}};function w_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var T_={exports:{}},E_={exports:{}};E_.exports;var D_;function O_(){return D_||(D_=1,function(e){e.exports=function(e){function t(e,t,n,r){return new ua(e,t,n,r)}function r(){}function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function o(e){if(a(e)!==e)throw Error(i(188))}function s(e){var t=e.alternate;if(!t){if(t=a(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var c=s.alternate;if(c===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===c.child){for(c=s.child;c;){if(c===n)return o(s),e;if(c===r)return o(s),t;c=c.sibling}throw Error(i(188))}if(n.return!==r.return)n=s,r=c;else{for(var l=!1,u=s.child;u;){if(u===n){l=!0,n=s,r=c;break}if(u===r){l=!0,r=s,n=c;break}u=u.sibling}if(!l){for(u=c.child;u;){if(u===n){l=!0,n=c,r=s;break}if(u===r){l=!0,r=c,n=s;break}u=u.sibling}if(!l)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function c(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=c(e),t!==null)return t;e=e.sibling}return null}function l(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(e.tag!==4&&(t=l(e),t!==null))return t;e=e.sibling}return null}function u(e){return typeof e!=`object`||!e?null:(e=Ga&&e[Ga]||e[`@@iterator`],typeof e==`function`?e:null)}function d(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===Ka?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case Na:return`Fragment`;case Fa:return`Profiler`;case Pa:return`StrictMode`;case za:return`Suspense`;case Ba:return`SuspenseList`;case Ua:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case Ma:return`Portal`;case La:return e.displayName||`Context`;case Ia:return(e._context.displayName||`Context`)+`.Consumer`;case Ra:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case Va:return t=e.displayName||null,t===null?d(e.type)||`Memo`:t;case Ha:t=e._payload,e=e._init;try{return d(e(t))}catch{}}return null}function f(e){return{current:e}}function p(e){0>pc||(e.current=fc[pc],fc[pc]=null,pc--)}function m(e,t){pc++,fc[pc]=e.current,e.current=t}function h(e){return e>>>=0,e===0?32:31-(gc(e)/_c|0)|0}function g(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function _(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=g(n))):i=g(o):i=g(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=g(n))):i=g(o)):i=g(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function v(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function y(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function b(){var e=bc;return bc<<=1,!(bc&62914560)&&(bc=4194304),e}function x(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function S(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function C(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-hc(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&w(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function w(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-hc(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function T(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-hc(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function E(e,t){var n=t&-t;return n=n&42?1:D(n),(n&(e.suspendedLanes|t))===0?n:0}function D(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function O(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function k(e){if(typeof Ac==`function`&&jc(e),Nc&&typeof Nc.setStrictMode==`function`)try{Nc.setStrictMode(Mc,e)}catch{}}function A(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}function j(e){if(Lc===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Lc=t&&t[1]||``,Rc=-1<e.stack.indexOf(`
4050
4050
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4051
4051
  `+Lc+e+Rc}function ee(e,t){if(!e||zc)return``;zc=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
4052
4052
  `),l=s.split(`
@@ -4372,7 +4372,7 @@ void main() {
4372
4372
  vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));
4373
4373
  gl_FragColor = vec4( clampedHdrColor , 1.0 );
4374
4374
  }
4375
- `,fx=class extends hl{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:n,gainMapMin:r,gainMapMax:i,maxDisplayBoost:a,hdrCapacityMin:o,hdrCapacityMax:s,sdr:c,gainMap:l}){super({name:`GainMapDecoderMaterial`,vertexShader:ux,fragmentShader:dx,uniforms:{sdr:{value:c},gainMap:{value:l},gamma:{value:new V(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new V().fromArray(t)},offsetSdr:{value:new V().fromArray(n)},gainMapMin:{value:new V().fromArray(r)},gainMapMax:{value:new V().fromArray(i)},weightFactor:{value:(Math.log2(a)-o)/(s-o)}},blending:0,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=a,this._hdrCapacityMin=o,this._hdrCapacityMax=s,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){let e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){let t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){let e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}},px=class extends lx{constructor(e,t){super({renderer:e,createMaterial:e=>new fx(e),createQuadRenderer:e=>new tx(e)},t)}async render(e,t,n,r){let{sdrImage:i,gainMapImage:a,needsFlip:o}=await this.processImages(n,r,`flipY`),{gainMap:s,sdr:c}=this.createTextures(i,a,o);this.updateQuadRenderer(e,i,s,c,t),e.render()}},mx=class extends px{load([e,t,n],r,i,a){let o=this.prepareQuadRenderer(),s,c,l,u=async()=>{if(s&&c&&l){try{await this.render(o,l,s,c)}catch(r){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(n),typeof a==`function`&&a(r),o.disposeOnDemandRenderer();return}typeof r==`function`&&r(o),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(n),o.disposeOnDemandRenderer()}},d=!0,f=0,p=0,m=!0,h=0,g=0,_=!0,v=0,y=0,b=()=>{if(typeof i==`function`){let e=f+h+v,t=p+g+y,n=d&&m&&_;i(new ProgressEvent(`progress`,{lengthComputable:n,loaded:t,total:e}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(n);let x=new ru(this._internalLoadingManager);x.setResponseType(`arraybuffer`),x.setRequestHeader(this.requestHeader),x.setPath(this.path),x.setWithCredentials(this.withCredentials),x.load(e,async e=>{if(typeof e==`string`)throw Error(`Invalid sdr buffer`);s=e,await u()},e=>{d=e.lengthComputable,p=e.loaded,f=e.total,b()},t=>{this.manager.itemError(e),typeof a==`function`&&a(t)});let S=new ru(this._internalLoadingManager);S.setResponseType(`arraybuffer`),S.setRequestHeader(this.requestHeader),S.setPath(this.path),S.setWithCredentials(this.withCredentials),S.load(t,async e=>{if(typeof e==`string`)throw Error(`Invalid gainmap buffer`);c=e,await u()},e=>{m=e.lengthComputable,g=e.loaded,h=e.total,b()},e=>{this.manager.itemError(t),typeof a==`function`&&a(e)});let C=new ru(this._internalLoadingManager);return C.setRequestHeader(this.requestHeader),C.setPath(this.path),C.setWithCredentials(this.withCredentials),C.load(n,async e=>{if(typeof e!=`string`)throw Error(`Invalid metadata string`);l=JSON.parse(e),await u()},e=>{_=e.lengthComputable,y=e.loaded,v=e.total,b()},e=>{this.manager.itemError(n),typeof a==`function`&&a(e)}),o}},hx=class extends px{load(e,t,n,r){let i=this.prepareQuadRenderer(),a=new ru(this._internalLoadingManager);return a.setResponseType(`arraybuffer`),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(this.withCredentials),this.manager.itemStart(e),a.load(e,async n=>{if(typeof n==`string`)throw Error(`Invalid buffer, received [string], was expecting [ArrayBuffer]`);let a=new Uint8Array(n),o,s,c;try{let e=await sx(a);o=e.sdr,s=e.gainMap,c=e.metadata}catch(t){if(t instanceof rx||t instanceof nx)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),c={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},o=a;else throw t}try{await this.render(i,c,o.buffer,s?.buffer)}catch(t){this.manager.itemError(e),typeof r==`function`&&r(t),i.disposeOnDemandRenderer();return}typeof t==`function`&&t(i),this.manager.itemEnd(e),i.disposeOnDemandRenderer()},n,t=>{this.manager.itemError(e),typeof r==`function`&&r(t)}),i}},gx={apartment:`lebombo_1k.hdr`,city:`potsdamer_platz_1k.hdr`,dawn:`kiara_1_dawn_1k.hdr`,forest:`forest_slope_1k.hdr`,lobby:`st_fagans_interior_1k.hdr`,night:`dikhololo_night_1k.hdr`,park:`rooitou_park_1k.hdr`,studio:`studio_small_03_1k.hdr`,sunset:`venice_sunset_1k.hdr`,warehouse:`empty_warehouse_01_1k.hdr`},_x=`https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/`,vx=e=>Array.isArray(e),yx=[`/px.png`,`/nx.png`,`/py.png`,`/ny.png`,`/pz.png`,`/nz.png`];function bx({files:e=yx,path:t=``,preset:r=void 0,colorSpace:i=void 0,extensions:a}={}){r&&(Cx(r),e=gx[r],t=_x);let o=vx(e),{extension:s,isCubemap:c}=wx(e),l=Tx(s);if(!l)throw Error(`useEnvironment: Unrecognized file extension: `+e);let u=p_(e=>e.gl);(0,n.useLayoutEffect)(()=>{if(s!==`webp`&&s!==`jpg`&&s!==`jpeg`)return;function t(){v_.clear(l,o?[e]:e)}u.domElement.addEventListener(`webglcontextlost`,t,{once:!0})},[e,u.domElement]);let d=v_(l,o?[e]:e,e=>{(s===`webp`||s===`jpg`||s===`jpeg`)&&e.setRenderer(u),e.setPath==null||e.setPath(t),a&&a(e)}),f=o?d[0]:d;return(s===`jpg`||s===`jpeg`||s===`webp`)&&(f=f.renderTarget?.texture),f.mapping=c?301:303,f.colorSpace=i??(c?`srgb`:`srgb-linear`),f}var xx={files:yx,path:``,preset:void 0,extensions:void 0};bx.preload=e=>{let t={...xx,...e},{files:n,path:r=``}=t,{preset:i,extensions:a}=t;i&&(Cx(i),n=gx[i],r=_x);let{extension:o}=wx(n);if(o===`webp`||o===`jpg`||o===`jpeg`)throw Error(`useEnvironment: Preloading gainmaps is not supported`);let s=Tx(o);if(!s)throw Error(`useEnvironment: Unrecognized file extension: `+n);v_.preload(s,vx(n)?[n]:n,e=>{e.setPath==null||e.setPath(r),a&&a(e)})};var Sx={files:yx,preset:void 0};bx.clear=e=>{let t={...Sx,...e},{files:n}=t,{preset:r}=t;r&&(Cx(r),n=gx[r]);let{extension:i}=wx(n),a=Tx(i);if(!a)throw Error(`useEnvironment: Unrecognized file extension: `+n);v_.clear(a,vx(n)?[n]:n)};function Cx(e){if(!(e in gx))throw Error(`Preset must be one of: `+Object.keys(gx).join(`, `))}function wx(e){var t;let n=vx(e)&&e.length===6,r=vx(e)&&e.length===3&&e.some(e=>e.endsWith(`json`)),i=vx(e)?e[0]:e;return{extension:n?`cube`:r?`webp`:i.startsWith(`data:application/exr`)?`exr`:i.startsWith(`data:application/hdr`)?`hdr`:i.startsWith(`data:image/jpeg`)?`jpg`:(t=i.split(`.`).pop())==null||(t=t.split(`?`))==null||(t=t.shift())==null?void 0:t.toLowerCase(),isCubemap:n,isGainmap:r}}function Tx(e){return e===`cube`?cu:e===`hdr`?zb:e===`exr`?Vb:e===`jpg`||e===`jpeg`?hx:e===`webp`?mx:null}var Ex=e=>e.current&&e.current.isScene,Dx=e=>Ex(e)?e.current:e;function Ox(e,t,n,r,i={}){var a,o;i={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...i};let s=Dx(t||n),c=s.background,l=s.environment,u={backgroundBlurriness:s.backgroundBlurriness,backgroundIntensity:s.backgroundIntensity,backgroundRotation:((a=s.backgroundRotation)==null||a.clone==null?void 0:a.clone())??[0,0,0],environmentIntensity:s.environmentIntensity,environmentRotation:((o=s.environmentRotation)==null||o.clone==null?void 0:o.clone())??[0,0,0]};return e!==`only`&&(s.environment=r),e&&(s.background=r),t_(s,i),()=>{e!==`only`&&(s.environment=l),e&&(s.background=c),t_(s,u)}}function kx({scene:e,background:t=!1,map:r,...i}){let a=p_(e=>e.scene);return n.useLayoutEffect(()=>{if(r)return Ox(t,e,a,r,i)}),null}function Ax({background:e=!1,scene:t,blur:r,backgroundBlurriness:i,backgroundIntensity:a,backgroundRotation:o,environmentIntensity:s,environmentRotation:c,...l}){let u=bx(l),d=p_(e=>e.scene);return n.useLayoutEffect(()=>Ox(e,t,d,u,{backgroundBlurriness:r??i,backgroundIntensity:a,backgroundRotation:o,environmentIntensity:s,environmentRotation:c})),n.useEffect(()=>()=>{u.dispose()},[u]),null}function jx({children:e,near:t=.1,far:r=1e3,resolution:i=256,frames:a=1,map:o,background:s=!1,blur:c,backgroundBlurriness:l,backgroundIntensity:u,backgroundRotation:d,environmentIntensity:f,environmentRotation:p,scene:m,files:h,path:g,preset:_=void 0,extensions:v}){let y=p_(e=>e.gl),b=p_(e=>e.scene),x=n.useRef(null),[S]=n.useState(()=>new Ur),C=n.useMemo(()=>{let e=new Cp(i);return e.texture.type=se,e},[i]);n.useEffect(()=>()=>{C.dispose()},[C]),n.useLayoutEffect(()=>{if(a===1){let e=y.autoClear;y.autoClear=!0,x.current.update(y,S),y.autoClear=e}return Ox(s,m,b,C.texture,{backgroundBlurriness:c??l,backgroundIntensity:u,backgroundRotation:d,environmentIntensity:f,environmentRotation:p})},[e,S,C.texture,m,b,s,a,y]);let w=1;return m_(()=>{if(a===1/0||w<a){let e=y.autoClear;y.autoClear=!0,x.current.update(y,S),y.autoClear=e,w++}}),n.createElement(n.Fragment,null,pv(n.createElement(n.Fragment,null,e,n.createElement(`cubeCamera`,{ref:x,args:[t,r,C]}),h||_?n.createElement(Ax,{background:!0,files:h,preset:_,path:g,extensions:v}):o?n.createElement(kx,{background:!0,map:o,extensions:v}):null),S))}function Mx(e){let t=bx(e),r=e.map||t;n.useMemo(()=>H_({GroundProjectedEnvImpl:Sy}),[]),n.useEffect(()=>()=>{t.dispose()},[t]);let i=n.useMemo(()=>[r],[r]),a=e.ground?.height,o=e.ground?.radius,s=e.ground?.scale??1e3;return n.createElement(n.Fragment,null,n.createElement(kx,Hv({},e,{map:r})),n.createElement(`groundProjectedEnvImpl`,{args:i,scale:s,height:a,radius:o}))}function Nx(e){return e.ground?n.createElement(Mx,e):e.map?n.createElement(kx,e):e.children?n.createElement(jx,e):n.createElement(Ax,e)}var Px=({children:e,showEnvironment:t=!0})=>(0,r.jsx)(cg,{children:(0,r.jsx)(Vv,{camera:{position:[0,1.5,3],fov:45},style:{width:`100%`,height:`100%`,position:`absolute`,top:0,left:0},gl:{alpha:!0,antialias:!0,preserveDrawingBuffer:!0},children:(0,r.jsxs)(n.Suspense,{fallback:null,children:[(0,r.jsx)(`ambientLight`,{intensity:.7}),(0,r.jsx)(`directionalLight`,{position:[2,5,2],intensity:1.5,castShadow:!0}),(0,r.jsx)(`directionalLight`,{position:[-2,5,-2],intensity:.5}),t&&(0,r.jsx)(Nx,{preset:`city`}),e,(0,r.jsx)(Zb,{enablePan:!1,minPolarAngle:Math.PI/4,maxPolarAngle:Math.PI/1.5,minDistance:1,maxDistance:5})]})})}),Fx=({className:e,style:t})=>{let{videoRef:i}=sg(),{isWebcamActive:a}=h();return(0,n.useEffect)(()=>{a&&i.current},[a,i]),(0,r.jsx)(`div`,{className:`camera-view-container ${e||``}`,style:{position:`absolute`,inset:0,zIndex:0,...t},children:(0,r.jsx)(`video`,{ref:i,autoPlay:!0,playsInline:!0,muted:!0,className:`w-full h-full object-cover`,style:{display:a?`block`:`none`}})})},Ix=({url:e,onBonesReady:t})=>e?(0,r.jsx)(Lx,{url:e,onBonesReady:t}):null,Lx=({url:e,onBonesReady:t})=>{let{scene:i}=Xb(e),a=(0,n.useRef)(null),{setAvatarBones:o}=sg();return(0,n.useEffect)(()=>{if(!i)return;let e={};return i.traverse(t=>{t.isBone&&(e[t.name]=t)}),o(e),t&&t(e),()=>o(null)},[i,t,o]),(0,r.jsx)(`group`,{ref:a,dispose:null,children:(0,r.jsx)(`primitive`,{object:i})})},Rx=({url:e,targetAvatarBones:t})=>e?(0,r.jsx)(zx,{url:e,targetAvatarBones:t}):null,zx=({url:e,targetAvatarBones:t})=>{let{scene:i}=Xb(e),a=(0,n.useRef)(null),{avatarBones:o}=sg(),s=t||o;return(0,n.useEffect)(()=>{!i||!s||i.traverse(e=>{if(e.isSkinnedMesh){let t=e,n=[];t.skeleton.bones.forEach(e=>{s[e.name]?n.push(s[e.name]):n.push(e)}),t.bind(new eo(n),t.bindMatrix)}})},[i,s]),(0,r.jsx)(`group`,{ref:a,dispose:null,children:(0,r.jsx)(`primitive`,{object:i})})},Bx=typeof self<`u`?self:{};function Vx(e,t){t:{for(var n=[`CLOSURE_FLAGS`],r=Bx,i=0;i<n.length;i++)if((r=r[n[i]])==null){n=null;break t}n=r}return(e=n&&n[e])??t}function Hx(){throw Error(`Invalid UTF8`)}function Ux(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var Wx,Gx,Kx=typeof TextDecoder<`u`,qx,Jx=typeof TextEncoder<`u`;function Yx(e){if(Jx)e=(qx||=new TextEncoder).encode(e);else{let n=0,r=new Uint8Array(3*e.length);for(let i=0;i<e.length;i++){var t=e.charCodeAt(i);if(t<128)r[n++]=t;else{if(t<2048)r[n++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&i<e.length){let a=e.charCodeAt(++i);if(a>=56320&&a<=57343){t=1024*(t-55296)+a-56320+65536,r[n++]=t>>18|240,r[n++]=t>>12&63|128,r[n++]=t>>6&63|128,r[n++]=63&t|128;continue}i--}t=65533}r[n++]=t>>12|224,r[n++]=t>>6&63|128}r[n++]=63&t|128}}e=n===r.length?r:r.subarray(0,n)}return e}function Xx(e){Bx.setTimeout((()=>{throw e}),0)}var Zx,Qx=Vx(610401301,!1),$x=Vx(748402147,!0),eS=Vx(824648567,!0),tS=Vx(824656860,Vx(1,!0));function nS(){var e=Bx.navigator;return(e&&=e.userAgent)?e:``}var rS=Bx.navigator;function iS(e){return iS[` `](e),e}Zx=rS&&rS.userAgentData||null,iS[` `]=function(){};var aS={},oS=null;function sS(e){let t=e.length,n=3*t/4;n%3?n=Math.floor(n):`=.`.indexOf(e[t-1])!=-1&&(n=`=.`.indexOf(e[t-2])==-1?n-1:n-2);let r=new Uint8Array(n),i=0;return function(e,t){function n(t){for(;r<e.length;){let t=e.charAt(r++),n=oS[t];if(n!=null)return n;if(!/^[\s\xa0]*$/.test(t))throw Error(`Unknown base64 encoding at char: `+t)}return t}cS();let r=0;for(;;){let e=n(-1),r=n(0),i=n(64),a=n(64);if(a===64&&e===-1)break;t(e<<2|r>>4),i!=64&&(t(r<<4&240|i>>2),a!=64&&t(i<<6&192|a))}}(e,(function(e){r[i++]=e})),i===n?r:r.subarray(0,i)}function cS(){if(!oS){oS={};var e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`.split(``),t=[`+/=`,`+/`,`-_=`,`-_.`,`-_`];for(let n=0;n<5;n++){let r=e.concat(t[n].split(``));aS[n]=r;for(let e=0;e<r.length;e++){let t=r[e];oS[t]===void 0&&(oS[t]=e)}}}}var lS=typeof Uint8Array<`u`,uS=!(!(Qx&&Zx&&Zx.brands.length>0)&&(nS().indexOf(`Trident`)!=-1||nS().indexOf(`MSIE`)!=-1))&&typeof btoa==`function`,dS=/[-_.]/g,fS={"-":`+`,_:`/`,".":`=`};function pS(e){return fS[e]||``}function mS(e){if(!uS)return sS(e);e=dS.test(e)?e.replace(dS,pS):e,e=atob(e);let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function hS(e){return lS&&e!=null&&e instanceof Uint8Array}var gS={};function _S(){return bS||=new yS(null,gS)}function vS(e){SS(gS);var t=e.g;return(t=t==null||hS(t)?t:typeof t==`string`?mS(t):null)==null?t:e.g=t}var yS=class{h(){return new Uint8Array(vS(this)||0)}constructor(e,t){if(SS(t),this.g=e,e!=null&&e.length===0)throw Error(`ByteString should be constructed with non-empty values`)}},bS,xS;function SS(e){if(e!==gS)throw Error(`illegal external caller`)}function CS(e,t){e.__closure__error__context__984382||={},e.__closure__error__context__984382.severity=t}function wS(e){return CS(e=Error(e),`warning`),e}function TS(e,t){if(e!=null){var n=xS??={},r=n[e]||0;r>=t||(n[e]=r+1,CS(e=Error(),`incident`),Xx(e))}}function ES(){return typeof BigInt==`function`}var DS=typeof Symbol==`function`&&typeof Symbol()==`symbol`;function OS(e,t,n=!1){return typeof Symbol==`function`&&typeof Symbol()==`symbol`?n&&Symbol.for&&e?Symbol.for(e):e==null?Symbol():Symbol(e):t}var kS=OS(`jas`,void 0,!0),AS=OS(void 0,`0di`),jS=OS(void 0,`1oa`),MS=OS(void 0,Symbol()),NS=OS(void 0,`0ub`),PS=OS(void 0,`0ubs`),FS=OS(void 0,`0ubsb`),IS=OS(void 0,`0actk`),LS=OS(`m_m`,`Pa`,!0),RS=OS(),zS={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},BS=Object.defineProperties,X=DS?kS:`Ga`,VS,HS=[];function US(e,t){DS||X in e||BS(e,zS),e[X]|=t}function WS(e,t){DS||X in e||BS(e,zS),e[X]=t}function GS(e){return US(e,34),e}function KS(e){return US(e,8192),e}WS(HS,7),VS=Object.freeze(HS);var qS={};function JS(e,t){return t===void 0?e.h!==YS&&!!(2&(0|e.v[X])):!!(2&t)&&e.h!==YS}var YS={};function XS(e,t){if(e!=null){if(typeof e==`string`)e=e?new yS(e,gS):_S();else if(e.constructor!==yS)if(hS(e))e=e.length?new yS(new Uint8Array(e),gS):_S();else{if(!t)throw Error();e=void 0}}return e}var ZS=class{constructor(e,t,n){this.g=e,this.h=t,this.l=n}next(){let e=this.g.next();return e.done||(e.value=this.h.call(this.l,e.value)),e}[Symbol.iterator](){return this}},QS=Object.freeze({});function $S(e,t,n){let r=128&t?0:-1,i=e.length;var a;(a=!!i)&&(a=(a=e[i-1])!=null&&typeof a==`object`&&a.constructor===Object);let o=i+(a?-1:0);for(t=128&t?1:0;t<o;t++)n(t-r,e[t]);if(a){e=e[i-1];for(let t in e)!isNaN(t)&&n(+t,e[t])}}var eC={};function tC(e){return 128&e?eC:void 0}function nC(e){return e.Na=!0,e}var rC=nC((e=>typeof e==`number`)),iC=nC((e=>typeof e==`string`)),aC=nC((e=>typeof e==`boolean`)),oC=typeof Bx.BigInt==`function`&&typeof Bx.BigInt(0)==`bigint`;function sC(e){var t=e;if(iC(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(rC(t)&&!Number.isSafeInteger(t))throw Error(String(t));return oC?BigInt(e):e=aC(e)?e?`1`:`0`:iC(e)?e.trim()||`0`:String(e)}var cC=nC((e=>oC?e>=uC&&e<=fC:e[0]===`-`?pC(e,lC):pC(e,dC))),lC=(-(2**53-1)).toString(),uC=oC?BigInt(-(2**53-1)):void 0,dC=(2**53-1).toString(),fC=oC?BigInt(2**53-1):void 0;function pC(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r>i)return!1;if(r<i)return!0}}var mC=typeof Uint8Array.prototype.slice==`function`,hC,gC=0,_C=0;function vC(e){let t=e>>>0;gC=t,_C=(e-t)/4294967296>>>0}function yC(e){if(e<0){vC(-e);let[t,n]=kC(gC,_C);gC=t>>>0,_C=n>>>0}else vC(e)}function bC(e){let t=hC||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),_C=0,gC=t.getUint32(0,!0)}function xC(e,t){let n=4294967296*t+(e>>>0);return Number.isSafeInteger(n)?n:TC(e,t)}function SC(e,t){return sC(ES()?BigInt.asUintN(64,(BigInt(t>>>0)<<BigInt(32))+BigInt(e>>>0)):TC(e,t))}function CC(e,t){let n=2147483648&t;return n&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=xC(e,t))==`number`?n?-e:e:n?`-`+e:e}function wC(e,t){return ES()?sC(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(t))<<BigInt(32))+BigInt.asUintN(32,BigInt(e)))):sC(DC(e,t))}function TC(e,t){if(e>>>=0,(t>>>=0)<=2097151)var n=``+(4294967296*t+e);else ES()?n=``+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(n=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),n+=8147497*t,t*=2,e>=1e7&&(n+=e/1e7>>>0,e%=1e7),n>=1e7&&(t+=n/1e7>>>0,n%=1e7),n=t+EC(n)+EC(e));return n}function EC(e){return e=String(e),`0000000`.slice(e.length)+e}function DC(e,t){if(2147483648&t)if(ES())e=``+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[n,r]=kC(e,t);e=`-`+TC(n,r)}else e=TC(e,t);return e}function OC(e){if(e.length<16)yC(Number(e));else if(ES())e=BigInt(e),gC=Number(e&BigInt(4294967295))>>>0,_C=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]===`-`);_C=gC=0;let n=e.length;for(let r=t,i=(n-t)%6+t;i<=n;r=i,i+=6){let t=Number(e.slice(r,i));_C*=1e6,gC=1e6*gC+t,gC>=4294967296&&(_C+=Math.trunc(gC/4294967296),_C>>>=0,gC>>>=0)}if(t){let[e,t]=kC(gC,_C);gC=e,_C=t}}}function kC(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function AC(e){return Array.prototype.slice.call(e)}var jC=typeof BigInt==`function`?BigInt.asIntN:void 0,MC=typeof BigInt==`function`?BigInt.asUintN:void 0,NC=Number.isSafeInteger,PC=Number.isFinite,FC=Math.trunc,IC=sC(0);function LC(e){if(e!=null&&typeof e!=`number`)throw Error(`Value of float/double field must be a number, found ${typeof e}: ${e}`);return e}function RC(e){return e==null||typeof e==`number`?e:e===`NaN`||e===`Infinity`||e===`-Infinity`?Number(e):void 0}function zC(e){if(e!=null&&typeof e!=`boolean`){var t=typeof e;throw Error(`Expected boolean but got ${t==`object`?e?Array.isArray(e)?`array`:t:`null`:t}: ${e}`)}return e}function BC(e){return e==null||typeof e==`boolean`?e:typeof e==`number`?!!e:void 0}var VC=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function HC(e){switch(typeof e){case`bigint`:return!0;case`number`:return PC(e);case`string`:return VC.test(e);default:return!1}}function UC(e){if(e==null)return e;if(typeof e==`string`&&e)e=+e;else if(typeof e!=`number`)return;return PC(e)?0|e:void 0}function WC(e){if(e==null)return e;if(typeof e==`string`&&e)e=+e;else if(typeof e!=`number`)return;return PC(e)?e>>>0:void 0}function GC(e){let t=e.length;return(e[0]===`-`?t<20||t===20&&e<=`-9223372036854775808`:t<19||t===19&&e<=`9223372036854775807`)?e:(OC(e),DC(gC,_C))}function KC(e){return e=FC(e),NC(e)||(yC(e),e=CC(gC,_C)),e}function qC(e){var t=FC(Number(e));return NC(t)?String(t):((t=e.indexOf(`.`))!==-1&&(e=e.substring(0,t)),GC(e))}function JC(e){var t=FC(Number(e));return NC(t)?sC(t):((t=e.indexOf(`.`))!==-1&&(e=e.substring(0,t)),ES()?sC(jC(64,BigInt(e))):sC(GC(e)))}function YC(e){return NC(e)?e=sC(KC(e)):(e=FC(e),NC(e)?e=String(e):(yC(e),e=DC(gC,_C)),e=sC(e)),e}function XC(e){return e==null?e:typeof e==`bigint`?(cC(e)?e=Number(e):(e=jC(64,e),e=cC(e)?Number(e):String(e)),e):HC(e)?typeof e==`number`?KC(e):qC(e):void 0}function ZC(e){let t=typeof e;return e==null?e:t===`bigint`?sC(jC(64,e)):HC(e)?t===`string`?JC(e):YC(e):void 0}function QC(e){if(typeof e!=`string`)throw Error();return e}function $C(e){if(e!=null&&typeof e!=`string`)throw Error();return e}function ew(e){return e==null||typeof e==`string`?e:void 0}function tw(e,t,n,r){return e!=null&&e[LS]===qS?e:Array.isArray(e)?((r=(n=0|e[X])|32&r|2&r)!==n&&WS(e,r),new t(e)):(n?2&r?((e=t[AS])||(GS((e=new t).v),e=t[AS]=e),t=e):t=new t:t=void 0,t)}function nw(e,t,n){if(t)t:{if(!HC(t=e))throw wS(`int64`);switch(typeof t){case`string`:t=JC(t);break t;case`bigint`:t=sC(jC(64,t));break t;default:t=YC(t)}}else t=ZC(e);return(e=t)??(n?IC:void 0)}var rw={},iw=function(){try{return iS(new class extends Map{constructor(){super()}}),!1}catch{return!0}}(),aw=class{constructor(){this.g=new Map}get(e){return this.g.get(e)}set(e,t){return this.g.set(e,t),this.size=this.g.size,this}delete(e){return e=this.g.delete(e),this.size=this.g.size,e}clear(){this.g.clear(),this.size=this.g.size}has(e){return this.g.has(e)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(e,t){return this.g.forEach(e,t)}[Symbol.iterator](){return this.entries()}},ow=iw?(Object.setPrototypeOf(aw.prototype,Map.prototype),Object.defineProperties(aw.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),aw):class extends Map{constructor(){super()}};function sw(e){return e}function cw(e){if(2&e.J)throw Error(`Cannot mutate an immutable Map`)}var lw=class extends ow{constructor(e,t,n=sw,r=sw){super(),this.J=0|e[X],this.K=t,this.S=n,this.fa=this.K?uw:r;for(let i=0;i<e.length;i++){let a=e[i],o=n(a[0],!1,!0),s=a[1];t?s===void 0&&(s=null):s=r(a[1],!1,!0,void 0,void 0,this.J),super.set(o,s)}}V(e){return KS(Array.from(super.entries(),e))}clear(){cw(this),super.clear()}delete(e){return cw(this),super.delete(this.S(e,!0,!1))}entries(){if(this.K){var e=super.keys();e=new ZS(e,dw,this)}else e=super.entries();return e}values(){if(this.K){var e=super.keys();e=new ZS(e,lw.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.K?super.forEach(((n,r,i)=>{e.call(t,i.get(r),r,i)})):super.forEach(e,t)}set(e,t){return cw(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.fa(t,!0,!0,this.K,!1,this.J))}Ma(e){let t=this.S(e[0],!1,!0);e=e[1],e=this.K?e===void 0?null:e:this.fa(e,!1,!0,void 0,!1,this.J),super.set(t,e)}has(e){return super.has(this.S(e,!1,!1))}get(e){e=this.S(e,!1,!1);let t=super.get(e);if(t!==void 0){var n=this.K;return n?((n=this.fa(t,!1,!0,n,this.ra,this.J))!==t&&super.set(e,n),n):t}}[Symbol.iterator](){return this.entries()}};function uw(e,t,n,r,i,a){return e=tw(e,r,n,a),i&&(e=Mw(e)),e}function dw(e){return[e,this.get(e)]}var fw;function pw(){return fw||=new lw(GS([]),void 0,void 0,void 0,rw)}function mw(e){return MS?e[MS]:void 0}function hw(e,t){for(let n in e)!isNaN(n)&&t(e,+n,e[n])}lw.prototype.toJSON=void 0;var gw=class{},_w={Ka:!0};function vw(e,t){t<100||TS(PS,1)}function yw(e,t,n,r){let i=r!==void 0;r=!!r;var a,o=MS;!i&&DS&&o&&(a=e[o])&&hw(a,vw),o=[];var s=e.length;let c;a=4294967295;let l=!1,u=!!(64&t),d=u?128&t?0:-1:void 0;1&t||(c=s&&e[s-1],typeof c==`object`&&c&&c.constructor===Object?a=--s:c=void 0,!u||128&t||i||(l=!0,a=a-d+d)),t=void 0;for(var f=0;f<s;f++){let i=e[f];if(i!=null&&(i=n(i,r))!=null)if(u&&f>=a){let e=f-d;(t??={})[e]=i}else o[f]=i}if(c)for(let e in c){if((s=c[e])==null||(s=n(s,r))==null)continue;let i;f=+e,u&&!Number.isNaN(f)&&(i=f+d)<a?o[i]=s:(t??={})[e]=s}return t&&(l?o.push(t):o[a]=t),i&&MS&&(e=mw(e))&&e instanceof gw&&(o[MS]=function(e){let t=new gw;return hw(e,((e,n,r)=>{t[n]=AC(r)})),t.da=e.da,t}(e)),o}function bw(e){return e[0]=xw(e[0]),e[1]=xw(e[1]),e}function xw(e){switch(typeof e){case`number`:return Number.isFinite(e)?e:``+e;case`bigint`:return cC(e)?Number(e):``+e;case`boolean`:return e?1:0;case`object`:if(Array.isArray(e)){var t=0|e[X];return e.length===0&&1&t?void 0:yw(e,t,xw)}if(e!=null&&e[LS]===qS)return Sw(e);if(e instanceof yS){if((t=e.g)==null)e=``;else if(typeof t==`string`)e=t;else{if(uS){for(var n=``,r=0,i=t.length-10240;r<i;)n+=String.fromCharCode.apply(null,t.subarray(r,r+=10240));n+=String.fromCharCode.apply(null,r?t.subarray(r):t),t=btoa(n)}else{n===void 0&&(n=0),cS(),n=aS[n],r=Array(Math.floor(t.length/3)),i=n[64]||``;let e=0,l=0;for(;e<t.length-2;e+=3){var a=t[e],o=t[e+1],s=t[e+2],c=n[a>>2];a=n[(3&a)<<4|o>>4],o=n[(15&o)<<2|s>>6],s=n[63&s],r[l++]=c+a+o+s}switch(c=0,s=i,t.length-e){case 2:s=n[(15&(c=t[e+1]))<<2]||i;case 1:t=t[e],r[l]=n[t>>2]+n[(3&t)<<4|c>>4]+s+i}t=r.join(``)}e=e.g=t}return e}return e instanceof lw?e=e.size===0?void 0:e.V(bw):void 0}return e}function Sw(e){return yw(e=e.v,0|e[X],xw)}var Cw,ww;function Tw(e,t){return Ew(e,t[0],t[1])}function Ew(e,t,n,r=0){if(e==null){var i=32;n?(e=[n],i|=128):e=[],t&&(i=-16760833&i|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error(`narr`);if(i=0|e[X],$x&&1&i)throw Error(`rfarr`);if(2048&i&&!(2&i)&&function(){if($x)throw Error(`carr`);TS(IS,5)}(),256&i)throw Error(`farr`);if(64&i)return(i|r)!==i&&WS(e,i|r),e;if(n&&(i|=128,n!==e[0]))throw Error(`mid`);t:{i|=64;var a=(n=e).length;if(a){var o=a-1;let e=n[o];if(typeof e==`object`&&e&&e.constructor===Object){if((o-=t=128&i?0:-1)>=1024)throw Error(`pvtlmt`);for(var s in e)(a=+s)<o&&(n[a+t]=e[s],delete e[s]);i=-16760833&i|(1023&o)<<14;break t}}if(t){if((s=Math.max(t,a-(128&i?0:-1)))>1024)throw Error(`spvt`);i=-16760833&i|(1023&s)<<14}}}return WS(e,64|i|r),e}function Dw(e,t){if(typeof e!=`object`)return e;if(Array.isArray(e)){var n=0|e[X];return e.length===0&&1&n?void 0:Ow(e,n,t)}if(e!=null&&e[LS]===qS)return Aw(e);if(e instanceof lw){if(2&(t=e.J))return e;if(!e.size)return;if(n=GS(e.V()),e.K)for(e=0;e<n.length;e++){let r=n[e],i=r[1];i=typeof i!=`object`||!i?void 0:i!=null&&i[LS]===qS?Aw(i):Array.isArray(i)?Ow(i,0|i[X],!!(32&t)):void 0,r[1]=i}return n}return e instanceof yS?e:void 0}function Ow(e,t,n){return 2&t||(!n||4096&t||16&t?e=jw(e,t,!1,n&&!(16&t)):(US(e,34),4&t&&Object.freeze(e))),e}function kw(e,t,n){return e=new e.constructor(t),n&&(e.h=YS),e.m=YS,e}function Aw(e){let t=e.v,n=0|t[X];return JS(e,n)?e:Iw(e,t,n)?kw(e,t):jw(t,n)}function jw(e,t,n,r){return r??=!!(34&t),e=yw(e,t,Dw,r),r=32,n&&(r|=2),WS(e,t=16769217&t|r),e}function Mw(e){let t=e.v,n=0|t[X];return JS(e,n)?Iw(e,t,n)?kw(e,t,!0):new e.constructor(jw(t,n,!1)):e}function Nw(e){if(e.h!==YS)return!1;var t=e.v;return US(t=jw(t,0|t[X]),2048),e.v=t,e.h=void 0,e.m=void 0,!0}function Pw(e){if(!Nw(e)&&JS(e,0|e.v[X]))throw Error()}function Fw(e,t){t===void 0&&(t=0|e[X]),32&t&&!(4096&t)&&WS(e,4096|t)}function Iw(e,t,n){return!!(2&n)||!(!(32&n)||4096&n)&&(WS(t,2|n),e.h=YS,!0)}var Lw=sC(0),Rw={};function zw(e,t,n,r,i){if((t=Bw(e.v,t,n,i))!==null||r&&e.m!==YS)return t}function Bw(e,t,n,r){if(t===-1)return null;let i=t+(n?0:-1),a=e.length-1,o,s;if(!(a<1+(n?0:-1))){if(i>=a)if(o=e[a],typeof o==`object`&&o&&o.constructor===Object)n=o[t],s=!0;else{if(i!==a)return;n=o}else n=e[i];if(r&&n!=null){if((r=r(n))==null)return r;if(!Object.is(r,n))return s?o[t]=r:e[i]=r,r}return n}}function Vw(e,t,n,r){Pw(e),Hw(e=e.v,0|e[X],t,n,r)}function Hw(e,t,n,r,i){let a=n+(i?0:-1);var o=e.length-1;if(o>=1+(i?0:-1)&&a>=o){let i=e[o];if(typeof i==`object`&&i&&i.constructor===Object)return i[n]=r,t}return a<=o?(e[a]=r,t):(r!==void 0&&(n>=(o=(t??=0|e[X])>>14&1023||536870912)?r!=null&&(e[o+(i?0:-1)]={[n]:r}):e[a]=r),t)}function Uw(){return QS===void 0?2:4}function Ww(e,t,n,r,i){let a=e.v,o=0|a[X];r=JS(e,o)?1:r,i=!!i||r===3,r===2&&Nw(e)&&(a=e.v,o=0|a[X]);let s=(e=Kw(a,t))===VS?7:0|e[X],c=qw(s,o);var l=!(4&c);if(l){4&c&&(e=AC(e),s=0,c=dT(c,o),o=Hw(a,o,t,e));let r=0,i=0;for(;r<e.length;r++){let t=n(e[r]);t!=null&&(e[i++]=t)}i<r&&(e.length=i),n=-513&(4|c),c=n&=-1025,c&=-4097}return c!==s&&(WS(e,c),2&c&&Object.freeze(e)),Gw(e,c,a,o,t,r,l,i)}function Gw(e,t,n,r,i,a,o,s){let c=t;return a===1||a===4&&(2&t||!(16&t)&&32&r)?Jw(t)||((t|=!e.length||o&&!(4096&t)||32&r&&!(4096&t||16&t)?2:256)!==c&&WS(e,t),Object.freeze(e)):(a===2&&Jw(t)&&(e=AC(e),c=0,t=dT(t,r),r=Hw(n,r,i,e)),Jw(t)||(s||(t|=16),t!==c&&WS(e,t))),2&t||!(4096&t||16&t)||Fw(n,r),e}function Kw(e,t,n){return e=Bw(e,t,n),Array.isArray(e)?e:VS}function qw(e,t){return 2&t&&(e|=2),1|e}function Jw(e){return!!(2&e)&&!!(4&e)||!!(256&e)}function Yw(e){return XS(e,!0)}function Xw(e){e=AC(e);for(let t=0;t<e.length;t++){let n=e[t]=AC(e[t]);Array.isArray(n[1])&&(n[1]=GS(n[1]))}return KS(e)}function Zw(e,t,n,r){Pw(e),Hw(e=e.v,0|e[X],t,(r===`0`?Number(n)===0:n===r)?void 0:n)}function Qw(e,t,n){if(2&t)throw Error();let r=tC(t),i=Kw(e,n,r),a=i===VS?7:0|i[X],o=qw(a,t);return(2&o||Jw(o)||16&o)&&(o===a||Jw(o)||WS(i,o),i=AC(i),a=0,o=dT(o,t),Hw(e,t,n,i,r)),o&=-13,o!==a&&WS(i,o),i}function $w(e,t){var n=xO;return nT(eT(e=e.v),e,void 0,n)===t?t:-1}function eT(e){if(DS)return e[jS]??(e[jS]=new Map);if(jS in e)return e[jS];let t=new Map;return Object.defineProperty(e,jS,{value:t}),t}function tT(e,t,n,r,i){let a=eT(e),o=nT(a,e,t,n,i);return o!==r&&(o&&(t=Hw(e,t,o,void 0,i)),a.set(n,r)),t}function nT(e,t,n,r,i){let a=e.get(r);if(a!=null)return a;a=0;for(let e=0;e<r.length;e++){let o=r[e];Bw(t,o,i)!=null&&(a!==0&&(n=Hw(t,n,a,void 0,i)),a=o)}return e.set(r,a),a}function rT(e,t,n){let r=0|e[X],i=tC(r),a=Bw(e,n,i),o;if(a!=null&&a[LS]===qS){if(!JS(a))return Nw(a),a.v;o=a.v}else Array.isArray(a)&&(o=a);if(o){let e=0|o[X];2&e&&(o=jw(o,e))}return o=Tw(o,t),o!==a&&Hw(e,r,n,o,i),o}function iT(e,t,n,r,i){let a=!1;if((r=Bw(e,r,i,(e=>{let r=tw(e,n,!1,t);return a=r!==e&&r!=null,r})))!=null)return a&&!JS(r)&&Fw(e,t),r}function aT(e,t,n,r){let i=e.v,a=0|i[X];if((t=iT(i,a,t,n,r))==null)return t;if(a=0|i[X],!JS(e,a)){let o=Mw(t);o!==t&&(Nw(e)&&(i=e.v,a=0|i[X]),a=Hw(i,a,n,t=o,r),Fw(i,a))}return t}function oT(e,t,n,r,i,a,o,s){var c=JS(e,n);a=c?1:a,o=!!o||a===3,c=s&&!c,(a===2||c)&&Nw(e)&&(n=0|(t=e.v)[X]);var l=(e=Kw(t,i))===VS?7:0|e[X],u=qw(l,n);if(s=!(4&u)){var d=e,f=n;let t=!!(2&u);t&&(f|=2);let i=!t,a=!0,o=0,s=0;for(;o<d.length;o++){let e=tw(d[o],r,!1,f);if(e instanceof r){if(!t){let t=JS(e);i&&=!t,a&&=t}d[s++]=e}}s<o&&(d.length=s),u|=4,u=a?-4097&u:4096|u,u=i?8|u:-9&u}if(u!==l&&(WS(e,u),2&u&&Object.freeze(e)),c&&!(8&u||!e.length&&(a===1||a===4&&(2&u||!(16&u)&&32&n)))){for(Jw(u)&&(e=AC(e),u=dT(u,n),n=Hw(t,n,i,e)),r=e,c=u,l=0;l<r.length;l++)(d=r[l])!==(u=Mw(d))&&(r[l]=u);c|=8,WS(e,u=c=r.length?4096|c:-4097&c)}return Gw(e,u,t,n,i,a,s,o)}function sT(e,t,n){let r=e.v;return oT(e,r,0|r[X],t,n,Uw(),!1,!0)}function cT(e){return e??=void 0,e}function lT(e,t,n,r,i){return Vw(e,n,r=cT(r),i),r&&!JS(r)&&Fw(e.v),e}function uT(e,t,n,r){t:{var i=r=cT(r);Pw(e);let a=e.v,o=0|a[X];if(i==null){let e=eT(a);if(nT(e,a,o,n)!==t)break t;e.set(n,0)}else o=tT(a,o,n,t);Hw(a,o,t,i)}r&&!JS(r)&&Fw(e.v)}function dT(e,t){return-273&(2&t?2|e:-3&e)}function fT(e,t,n,r){var i=r;Pw(e),e=oT(e,r=e.v,0|r[X],n,t,2,!0),i??=new n,e.push(i),t=n=e===VS?7:0|e[X],(i=JS(i))?(n&=-9,e.length===1&&(n&=-4097)):n|=4096,n!==t&&WS(e,n),i||Fw(r)}function pT(e,t,n){return UC(zw(e,t,void 0,n))}function mT(e){return(tS?zw(e,2,void 0,void 0,ZC):ZC(zw(e,2)))??Lw}function hT(e,t){return zw(e,t,void 0,void 0,RC)??0}function gT(e,t,n){if(n!=null){if(typeof n!=`number`||!PC(n))throw wS(`int32`);n|=0}Vw(e,t,n)}function _T(e,t,n){Vw(e,t,LC(n))}function vT(e,t,n){Zw(e,t,$C(n),``)}function yT(e,t,n){{Pw(e);let o=e.v,s=0|o[X];if(n==null)Hw(o,s,t);else{var r=e=n===VS?7:0|n[X],i=Jw(e),a=i||Object.isFrozen(n);for(i||(e=0),a||=(n=AC(n),r=0,e=dT(e,s),!1),e|=5,e|=(4&e?512&e?512:1024&e?1024:0:void 0)??(tS?1024:0),i=0;i<n.length;i++){let t=n[i],o=QC(t);Object.is(t,o)||(a&&=(n=AC(n),r=0,e=dT(e,s),!1),n[i]=o)}e!==r&&(a&&(n=AC(n),e=dT(e,s)),WS(n,e)),Hw(o,s,t,n)}}}function bT(e,t,n){Pw(e),Ww(e,t,ew,2,!0).push(QC(n))}var xT=class{constructor(e,t,n){if(this.buffer=e,n&&!t)throw Error();this.g=t}};function ST(e,t){if(typeof e==`string`)return new xT(mS(e),t);if(Array.isArray(e))return new xT(new Uint8Array(e),t);if(e.constructor===Uint8Array)return new xT(e,!1);if(e.constructor===ArrayBuffer)return e=new Uint8Array(e),new xT(e,!1);if(e.constructor===yS)return t=vS(e)||new Uint8Array,new xT(t,!0,e);if(e instanceof Uint8Array)return e=e.constructor===Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new xT(e,!1);throw Error()}function CT(e,t){let n,r=0,i=0,a=0,o=e.h,s=e.g;do n=o[s++],r|=(127&n)<<a,a+=7;while(a<32&&128&n);if(a>32)for(i|=(127&n)>>4,a=3;a<32&&128&n;a+=7)n=o[s++],i|=(127&n)<<a;if(kT(e,s),!(128&n))return t(r>>>0,i>>>0);throw Error()}function wT(e){let t=0,n=e.g,r=n+10,i=e.h;for(;n<r;){let r=i[n++];if(t|=r,!(128&r))return kT(e,n),!!(127&t)}throw Error()}function TT(e){let t=e.h,n=e.g,r=t[n++],i=127&r;if(128&r&&(r=t[n++],i|=(127&r)<<7,128&r&&(r=t[n++],i|=(127&r)<<14,128&r&&(r=t[n++],i|=(127&r)<<21,128&r&&(r=t[n++],i|=r<<28,128&r&&128&t[n++]&&128&t[n++]&&128&t[n++]&&128&t[n++]&&128&t[n++])))))throw Error();return kT(e,n),i}function ET(e){return TT(e)>>>0}function DT(e){var t=e.h;let n=e.g;var r=t[n],i=t[n+1];let a=t[n+2];return t=t[n+3],kT(e,e.g+4),e=2*((i=(r<<0|i<<8|a<<16|t<<24)>>>0)>>31)+1,r=i>>>23&255,i&=8388607,r==255?i?NaN:e*(1/0):r==0?1401298464324817e-60*e*i:e*2**(r-150)*(i+8388608)}function OT(e){return TT(e)}function kT(e,t){if(e.g=t,t>e.l)throw Error()}function AT(e,t){if(t<0)throw Error();let n=e.g;if((t=n+t)>e.l)throw Error();return e.g=t,n}function jT(e,t){if(t==0)return _S();var n=AT(e,t);return e.Y&&e.j?n=e.h.subarray(n,n+t):(e=e.h,n=n===(t=n+t)?new Uint8Array:mC?e.slice(n,t):new Uint8Array(e.subarray(n,t))),n.length==0?_S():new yS(n,gS)}var MT=[];function NT(e,t,n,r){if(HT.length){let i=HT.pop();return i.o(r),i.g.init(e,t,n,r),i}return new VT(e,t,n,r)}function PT(e){e.g.clear(),e.l=-1,e.h=-1,HT.length<100&&HT.push(e)}function FT(e){var t=e.g;if(t.g==t.l)return!1;e.m=e.g.g;var n=ET(e.g);if(t=n>>>3,!((n&=7)>=0&&n<=5)||t<1)throw Error();return e.l=t,e.h=n,!0}function IT(e){switch(e.h){case 0:e.h==0?wT(e.g):IT(e);break;case 1:kT(e=e.g,e.g+8);break;case 2:if(e.h!=2)IT(e);else{var t=ET(e.g);kT(e=e.g,e.g+t)}break;case 5:kT(e=e.g,e.g+4);break;case 3:for(t=e.l;;){if(!FT(e))throw Error();if(e.h==4){if(e.l!=t)throw Error();break}IT(e)}break;default:throw Error()}}function LT(e,t,n){let r=e.g.l;var i=ET(e.g);let a=(i=e.g.g+i)-r;if(a<=0&&(e.g.l=i,n(t,e,void 0,void 0,void 0),a=i-e.g.g),a)throw Error();return e.g.g=i,e.g.l=r,t}function RT(e){var t=ET(e.g),n=AT(e=e.g,t);if(e=e.h,Kx){var r,i=e;(r=Gx)||(r=Gx=new TextDecoder(`utf-8`,{fatal:!0})),t=n+t,i=n===0&&t===i.length?i:i.subarray(n,t);try{var a=r.decode(i)}catch(e){if(Wx===void 0){try{r.decode(new Uint8Array([128]))}catch{}try{r.decode(new Uint8Array([97])),Wx=!0}catch{Wx=!1}}throw!Wx&&(Gx=void 0),e}}else{t=(a=n)+t,n=[];let s,c=null;for(;a<t;){var o=e[a++];o<128?n.push(o):o<224?a>=t?Hx():(s=e[a++],o<194||(192&s)!=128?(a--,Hx()):n.push((31&o)<<6|63&s)):o<240?a>=t-1?Hx():(s=e[a++],(192&s)!=128||o===224&&s<160||o===237&&s>=160||(192&(r=e[a++]))!=128?(a--,Hx()):n.push((15&o)<<12|(63&s)<<6|63&r)):o<=244?a>=t-2?Hx():(s=e[a++],(192&s)!=128||s-144+(o<<28)>>30||(192&(r=e[a++]))!=128||(192&(i=e[a++]))!=128?(a--,Hx()):(o=(7&o)<<18|(63&s)<<12|(63&r)<<6|63&i,o-=65536,n.push(55296+(o>>10&1023),56320+(1023&o)))):Hx(),n.length>=8192&&(c=Ux(c,n),n.length=0)}a=Ux(c,n)}return a}function zT(e){let t=ET(e.g);return jT(e.g,t)}function BT(e,t,n){var r=ET(e.g);for(r=e.g.g+r;e.g.g<r;)n.push(t(e.g))}var VT=class{constructor(e,t,n,r){if(MT.length){let i=MT.pop();i.init(e,t,n,r),e=i}else e=new class{constructor(e,t,n,r){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.init(e,t,n,r)}init(e,t,n,{Y:r=!1,ea:i=!1}={}){this.Y=r,this.ea=i,e&&(e=ST(e,this.ea),this.h=e.buffer,this.j=e.g,this.m=t||0,this.l=n===void 0?this.h.length:this.m+n,this.g=this.m)}clear(){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.Y=!1}}(e,t,n,r);this.g=e,this.m=this.g.g,this.h=this.l=-1,this.o(r)}o({ha:e=!1}={}){this.ha=e}},HT=[];function UT(e){return e?/^\d+$/.test(e)?(OC(e),new WT(gC,_C)):null:GT||=new WT(0,0)}var WT=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},GT;function KT(e){return e?/^-?\d+$/.test(e)?(OC(e),new qT(gC,_C)):null:JT||=new qT(0,0)}var qT=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},JT;function YT(e,t,n){for(;n>0||t>127;)e.g.push(127&t|128),t=(t>>>7|n<<25)>>>0,n>>>=7;e.g.push(t)}function XT(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function ZT(e,t){if(t>=0)XT(e,t);else{for(let n=0;n<9;n++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function QT(e){var t=gC;e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function $T(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function eE(e,t,n){XT(e.g,8*t+n)}function tE(e,t){return eE(e,t,2),t=e.g.end(),$T(e,t),t.push(e.h),t}function nE(e,t){var n=t.pop();for(n=e.h+e.g.length()-n;n>127;)t.push(127&n|128),n>>>=7,e.h++;t.push(n),e.h++}function rE(e,t,n){eE(e,t,2),XT(e.g,n.length),$T(e,e.g.end()),$T(e,n)}function iE(e,t,n,r){n!=null&&(t=tE(e,t),r(n,e),nE(e,t))}function aE(){let e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var oE=aE(),sE=aE(),cE=aE(),lE=aE(),uE=aE(),dE=aE(),fE=aE(),pE=aE(),mE=aE(),hE=aE();function gE(e,t,n){var r=e.v;MS&&MS in r&&(r=r[MS])&&delete r[t.g],t.h?t.j(e,t.h,t.g,n,t.l):t.j(e,t.g,n,t.l)}var Z=class{constructor(e,t){this.v=Ew(e,t,void 0,2048)}toJSON(){return Sw(this)}j(){var e=pk,t=this.v,n=e.g,r=MS;if(DS&&r&&t[r]?.[n]!=null&&TS(NS,3),t=e.g,RS&&MS&&RS===void 0&&(r=(n=this.v)[MS])&&(r=r.da))try{r(n,t,_w)}catch(e){Xx(e)}return e.h?e.m(this,e.h,e.g,e.l):e.m(this,e.g,e.defaultValue,e.l)}clone(){let e=this.v,t=0|e[X];return Iw(this,e,t)?kw(this,e,!0):new this.constructor(jw(e,t,!1))}};Z.prototype[LS]=qS,Z.prototype.toString=function(){return this.v.toString()};var _E=class{constructor(e,t,n){this.g=e,this.h=t,e=oE,this.l=!!e&&n===e||!1}};function vE(e,t){return new _E(e,t,oE)}function yE(e,t,n,r,i){iE(e,n,jE(t,r),i)}var bE=vE((function(e,t,n,r,i){return e.h===2&&(LT(e,rT(t,r,n),i),!0)}),yE),xE=vE((function(e,t,n,r,i){return e.h===2&&(LT(e,rT(t,r,n),i),!0)}),yE),SE=Symbol(),CE=Symbol(),wE=Symbol(),TE=Symbol(),EE=Symbol(),DE,OE;function kE(e,t,n,r){var i=r[e];if(i)return i;(i={}).qa=r,i.T=function(e){switch(typeof e){case`boolean`:return Cw||=[0,void 0,!0];case`number`:return e>0?void 0:e===0?ww||=[0,void 0]:[-e,void 0];case`string`:return[0,e];case`object`:return e}}(r[0]);var a=r[1];let o=1;a&&a.constructor===Object&&(i.ba=a,typeof(a=r[++o])==`function`&&(i.ma=!0,DE??=a,OE??=r[o+1],a=r[o+=2]));let s={};for(;a&&Array.isArray(a)&&a.length&&typeof a[0]==`number`&&a[0]>0;){for(var c=0;c<a.length;c++)s[a[c]]=a;a=r[++o]}for(c=1;a!==void 0;){let e;typeof a==`number`&&(c+=a,a=r[++o]);var l=void 0;if(a instanceof _E?e=a:(e=bE,o--),e?.l){a=r[++o],l=r;var u=o;typeof a==`function`&&(a=a(),l[u]=a),l=a}for(u=c+1,typeof(a=r[++o])==`number`&&a<0&&(u-=a,a=r[++o]);c<u;c++){let r=s[c];l?n(i,c,e,l,r):t(i,c,e,r)}}return r[e]=i}function AE(e){return Array.isArray(e)?e[0]instanceof _E?e:[xE,e]:[e,void 0]}function jE(e,t){return e instanceof Z?e.v:Array.isArray(e)?Tw(e,t):void 0}function ME(e,t,n,r){let i=n.g;e[t]=r?(e,t,n)=>i(e,t,n,r):i}function NE(e,t,n,r,i){let a=n.g,o,s;e[t]=(e,t,n)=>a(e,t,n,s||=kE(CE,ME,NE,r).T,o||=PE(r),i)}function PE(e){let t=e[wE];if(t!=null)return t;let n=kE(CE,ME,NE,e);return t=n.ma?(e,t)=>DE(e,t,n):(e,t)=>{for(;FT(t)&&t.h!=4;){var r=t.l,i=n[r];if(i==null){var a=n.ba;(a&&=a[r])&&(a=IE(a))!=null&&(i=n[r]=a)}if(i==null||!i(t,e,r)){if(i=(a=t).m,IT(a),a.ha)var o=void 0;else o=a.g.g-i,a.g.g=i,o=jT(a.g,o);i=void 0,a=e,o&&((i=a[MS]??(a[MS]=new gw))[r]??(i[r]=[])).push(o)}}return(e=mw(e))&&(e.da=n.qa[EE]),!0},e[wE]=t,e[EE]=FE.bind(e),t}function FE(e,t,n,r){var i=this[CE];let a=this[wE],o=Tw(void 0,i.T),s=mw(e);if(s){var c=!1,l=i.ba;if(l){if(i=(t,n,i)=>{if(i.length!==0)if(l[n])for(let e of i){t=NT(e);try{c=!0,a(o,t)}finally{PT(t)}}else r?.(e,n,i)},t==null)hw(s,i);else if(s!=null){let e=s[t];e&&i(s,t,e)}if(c){let r=0|e[X];if(2&r&&2048&r&&!n?.Ka)throw Error();let i=tC(r),a=(t,a)=>{if(Bw(e,t,i)!=null){if(n?.Qa===1)return;throw Error()}a!=null&&(r=Hw(e,r,t,a,i)),delete s[t]};t==null?$S(o,0|o[X],((e,t)=>{a(e,t)})):a(t,Bw(o,t,i))}}}}function IE(e){let t=(e=AE(e))[0].g;if(e=e[1]){let n=PE(e),r=kE(CE,ME,NE,e).T;return(e,i,a)=>t(e,i,a,r,n)}return t}function LE(e,t,n){e[t]=n.h}function RE(e,t,n,r){let i,a,o=n.h;e[t]=(e,t,n)=>o(e,t,n,a||=kE(SE,LE,RE,r).T,i||=zE(r))}function zE(e){let t=e[TE];if(!t){let n=kE(SE,LE,RE,e);t=(e,t)=>BE(e,t,n),e[TE]=t}return t}function BE(e,t,n){$S(e,0|e[X],((e,r)=>{if(r!=null){var i=function(e,t){var n=e[t];if(n)return n;if((n=e.ba)&&(n=n[t])){var r=(n=AE(n))[0].h;if(n=n[1]){let t=zE(n),i=kE(SE,LE,RE,n).T;n=e.ma?OE(i,t):(e,n,a)=>r(e,n,a,i,t)}else n=r;return e[t]=n}}(n,e);i?i(t,r,e):e<500||TS(FS,3)}})),(e=mw(e))&&hw(e,((e,n,r)=>{for($T(t,t.g.end()),e=0;e<r.length;e++)$T(t,vS(r[e])||new Uint8Array)}))}var VE=sC(0);function HE(e,t){if(Array.isArray(t)){var n=0|t[X];if(4&n)return t;for(var r=0,i=0;r<t.length;r++){let n=e(t[r]);n!=null&&(t[i++]=n)}return i<r&&(t.length=i),(e=-1537&(5|n))!==n&&WS(t,e),2&e&&Object.freeze(t),t}}function UE(e,t,n){return new _E(e,t,n)}function WE(e,t,n){return new _E(e,t,n)}function GE(e,t,n){Hw(e,0|e[X],t,n,tC(0|e[X]))}var KE=vE((function(e,t,n,r,i){if(e.h!==2)return!1;if(e=AC(e=LT(e,Tw([void 0,void 0],r),i)),i=tC(r=0|t[X]),2&r)throw Error();let a=Bw(t,n,i);if(a instanceof lw)2&a.J?(a=a.V(),a.push(e),Hw(t,r,n,a,i)):a.Ma(e);else if(Array.isArray(a)){var o=0|a[X];8192&o||WS(a,o|=8192),2&o&&(a=Xw(a),Hw(t,r,n,a,i)),a.push(e)}else Hw(t,r,n,KS([e]),i);return!0}),(function(e,t,n,r,i){if(t instanceof lw)t.forEach(((t,a)=>{iE(e,n,Tw([a,t],r),i)}));else if(Array.isArray(t)){for(let a=0;a<t.length;a++){let o=t[a];Array.isArray(o)&&iE(e,n,Tw(o,r),i)}KS(t)}}));function qE(e,t,n){(t=RC(t))!=null&&(eE(e,n,5),e=e.g,bC(t),QT(e))}function JE(e,t,n){if(t=function(e){if(e==null)return e;let t=typeof e;if(t===`bigint`)return String(jC(64,e));if(HC(e)){if(t===`string`)return qC(e);if(t===`number`)return KC(e)}}(t),t!=null&&(typeof t==`string`&&KT(t),t!=null))switch(eE(e,n,0),typeof t){case`number`:e=e.g,yC(t),YT(e,gC,_C);break;case`bigint`:n=BigInt.asUintN(64,t),n=new qT(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),YT(e.g,n.h,n.g);break;default:n=KT(t),YT(e.g,n.h,n.g)}}function YE(e,t,n){(t=UC(t))!=null&&t!=null&&(eE(e,n,0),ZT(e.g,t))}function XE(e,t,n){(t=BC(t))!=null&&(eE(e,n,0),e.g.g.push(t?1:0))}function ZE(e,t,n){(t=ew(t))!=null&&rE(e,n,Yx(t))}function QE(e,t,n,r,i){iE(e,n,jE(t,r),i)}function $E(e,t,n){(t=t==null||typeof t==`string`||t instanceof yS?t:void 0)!=null&&rE(e,n,ST(t,!0).buffer)}function eD(e,t,n){return(e.h===5||e.h===2)&&(t=Qw(t,0|t[X],n),e.h==2?BT(e,DT,t):t.push(DT(e.g)),!0)}var tD=UE((function(e,t,n){return e.h===5&&(GE(t,n,DT(e.g)),!0)}),qE,pE),nD=WE(eD,(function(e,t,n){if((t=HE(RC,t))!=null)for(let o=0;o<t.length;o++){var r=e,i=n,a=t[o];a!=null&&(eE(r,i,5),r=r.g,bC(a),QT(r))}}),pE),rD=WE(eD,(function(e,t,n){if((t=HE(RC,t))!=null&&t.length){eE(e,n,2),XT(e.g,4*t.length);for(let r=0;r<t.length;r++)n=e.g,bC(t[r]),QT(n)}}),pE),iD=UE((function(e,t,n){return e.h===5&&(GE(t,n,(e=DT(e.g))===0?void 0:e),!0)}),qE,pE),aD=UE((function(e,t,n){return eS?(e.h===0?(GE(t,n,CT(e.g,wC)),e=!0):e=!1,e):e.h===0&&(GE(t,n,CT(e.g,CC)),!0)}),JE,dE),oD=UE((function(e,t,n){return eS?(e.h===0?(GE(t,n,(e=CT(e.g,wC))===VE?void 0:e),t=!0):t=!1,t):e.h===0&&(GE(t,n,(e=CT(e.g,CC))===0?void 0:e),!0)}),JE,dE),sD=UE((function(e,t,n){return eS?(e.h===0?(GE(t,n,CT(e.g,SC)),e=!0):e=!1,e):e.h===0&&(GE(t,n,CT(e.g,xC)),!0)}),(function(e,t,n){if(t=function(e){if(e==null)return e;var t=typeof e;if(t===`bigint`)return String(MC(64,e));if(HC(e)){if(t===`string`)return t=FC(Number(e)),NC(t)&&t>=0?e=String(t):((t=e.indexOf(`.`))!==-1&&(e=e.substring(0,t)),(t=e[0]!==`-`&&((t=e.length)<20||t===20&&e<=`18446744073709551615`))||(OC(e),e=TC(gC,_C))),e;if(t===`number`)return(e=FC(e))>=0&&NC(e)||(yC(e),e=xC(gC,_C)),e}}(t),t!=null&&(typeof t==`string`&&UT(t),t!=null))switch(eE(e,n,0),typeof t){case`number`:e=e.g,yC(t),YT(e,gC,_C);break;case`bigint`:n=BigInt.asUintN(64,t),n=new WT(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),YT(e.g,n.h,n.g);break;default:n=UT(t),YT(e.g,n.h,n.g)}}),fE),cD=UE((function(e,t,n){return e.h===0&&(GE(t,n,TT(e.g)),!0)}),YE,lE),lD=WE((function(e,t,n){return(e.h===0||e.h===2)&&(t=Qw(t,0|t[X],n),e.h==2?BT(e,TT,t):t.push(TT(e.g)),!0)}),(function(e,t,n){if((t=HE(UC,t))!=null&&t.length){n=tE(e,n);for(let n=0;n<t.length;n++)ZT(e.g,t[n]);nE(e,n)}}),lE),uD=UE((function(e,t,n){return e.h===0&&(GE(t,n,(e=TT(e.g))===0?void 0:e),!0)}),YE,lE),dD=UE((function(e,t,n){return e.h===0&&(GE(t,n,wT(e.g)),!0)}),XE,sE),fD=UE((function(e,t,n){return e.h===0&&(GE(t,n,!1===(e=wT(e.g))?void 0:e),!0)}),XE,sE),pD=WE((function(e,t,n){return e.h===2&&(e=RT(e),Qw(t,0|t[X],n).push(e),!0)}),(function(e,t,n){if((t=HE(ew,t))!=null)for(let o=0;o<t.length;o++){var r=e,i=n,a=t[o];a!=null&&rE(r,i,Yx(a))}}),cE),mD=UE((function(e,t,n){return e.h===2&&(GE(t,n,(e=RT(e))===``?void 0:e),!0)}),ZE,cE),hD=UE((function(e,t,n){return e.h===2&&(GE(t,n,RT(e)),!0)}),ZE,cE),gD=function(e,t,n=oE){return new _E(e,t,n)}((function(e,t,n,r,i){return e.h===2&&(r=Tw(void 0,r),Qw(t,0|t[X],n).push(r),LT(e,r,i),!0)}),(function(e,t,n,r,i){if(Array.isArray(t)){for(let a=0;a<t.length;a++)QE(e,t[a],n,r,i);1&(e=0|t[X])||WS(t,1|e)}})),_D=vE((function(e,t,n,r,i,a){if(e.h!==2)return!1;let o=0|t[X];return tT(t,o,a,n,tC(o)),LT(e,t=rT(t,r,n),i),!0}),QE),vD=UE((function(e,t,n){return e.h===2&&(GE(t,n,zT(e)),!0)}),$E,mE),yD=WE((function(e,t,n){return(e.h===0||e.h===2)&&(t=Qw(t,0|t[X],n),e.h==2?BT(e,ET,t):t.push(ET(e.g)),!0)}),(function(e,t,n){if((t=HE(WC,t))!=null)for(let o=0;o<t.length;o++){var r=e,i=n,a=t[o];a!=null&&(eE(r,i,0),XT(r.g,a))}}),uE),bD=UE((function(e,t,n){return e.h===0&&(GE(t,n,(e=ET(e.g))===0?void 0:e),!0)}),(function(e,t,n){(t=WC(t))!=null&&t!=null&&(eE(e,n,0),XT(e.g,t))}),uE),xD=UE((function(e,t,n){return e.h===0&&(GE(t,n,TT(e.g)),!0)}),(function(e,t,n){(t=UC(t))!=null&&(t=parseInt(t,10),eE(e,n,0),ZT(e.g,t))}),hE),SD=class{constructor(e,t){var n=BD;this.g=e,this.h=t,this.m=aT,this.j=lT,this.defaultValue=void 0,this.l=n.Oa==null?void 0:eC}register(){iS(this)}};function CD(e,t){return new SD(e,t)}function wD(e,t){return(n,r)=>{{let a={ea:!0};r&&Object.assign(a,r),n=NT(n,void 0,void 0,a);try{let r=new e,a=r.v;PE(t)(a,n);var i=r}finally{PT(n)}}return i}}function TD(e){return function(){let t=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){let e=this.g;return this.g=[],e}}}};BE(this.v,t,kE(SE,LE,RE,e)),$T(t,t.g.end());let n=new Uint8Array(t.h),r=t.l,i=r.length,a=0;for(let e=0;e<i;e++){let t=r[e];n.set(t,a),a+=t.length}return t.l=[n],n}}var ED=class extends Z{constructor(e){super(e)}},DD=[0,mD,UE((function(e,t,n){return e.h===2&&(GE(t,n,(e=zT(e))===_S()?void 0:e),!0)}),(function(e,t,n){if(t!=null){if(t instanceof Z){let r=t.Ra;r?(t=r(t),t!=null&&rE(e,n,ST(t,!0).buffer)):TS(FS,3);return}if(Array.isArray(t))return void TS(FS,3)}$E(e,t,n)}),mE)],OD,kD=globalThis.trustedTypes;function AD(e){var t;return OD===void 0&&(OD=function(){let e=null;if(!kD)return e;try{let t=e=>e;e=kD.createPolicy(`goog#html`,{createHTML:t,createScript:t,createScriptURL:t})}catch{}return e}()),e=(t=OD)?t.createScriptURL(e):e,new class{constructor(e){this.g=e}toString(){return this.g+``}}(e)}function jD(e,...t){if(t.length===0)return AD(e[0]);let n=e[0];for(let r=0;r<t.length;r++)n+=encodeURIComponent(t[r])+e[r+1];return AD(n)}var MD=[0,cD,xD,dD,-1,lD,xD,-1,dD],ND=class extends Z{constructor(e){super(e)}},PD=[0,dD,hD,dD,xD,-1,WE((function(e,t,n){return(e.h===0||e.h===2)&&(t=Qw(t,0|t[X],n),e.h==2?BT(e,OT,t):t.push(TT(e.g)),!0)}),(function(e,t,n){if((t=HE(UC,t))!=null&&t.length){n=tE(e,n);for(let n=0;n<t.length;n++)ZT(e.g,t[n]);nE(e,n)}}),hE),hD,-1,[0,dD,-1],xD,dD,-1],FD=[0,3,dD,-1,2,[0,cD],[0,xD,dD],[0,hD,-1],[0]],ID=[0,hD,-2],LD=class extends Z{constructor(e){super(e)}},RD=[0],zD=[0,cD,dD,1,dD,-4],BD=class extends Z{constructor(e){super(e,2)}},VD={};VD[336783863]=[0,hD,dD,-1,cD,[0,[1,2,3,4,5,6,7,8,9],_D,RD,_D,PD,_D,ID,_D,zD,_D,MD,_D,[0,hD,-2],_D,[0,hD,xD],_D,FD,_D,[0,xD,-1,dD]],[0,hD],dD,[0,[1,3],[2,4],_D,[0,lD],-1,_D,[0,pD],-1,gD,[0,hD,-1]],hD];var HD=[0,oD,-1,fD,-3,oD,lD,mD,uD,oD,-1,fD,uD,fD,-2,mD];function UD(e,t){bT(e,3,t)}function WD(e,t){bT(e,4,t)}var GD=class extends Z{constructor(e){super(e,500)}o(e){return lT(this,0,7,e)}},KD=[-1,{}],qD=[0,hD,1,KD],JD=[0,hD,pD,KD];function YD(e,t){fT(e,1,GD,t)}function XD(e,t){bT(e,10,t)}function ZD(e,t){bT(e,15,t)}var QD=class extends Z{constructor(e){super(e,500)}o(e){return lT(this,0,1001,e)}},$D=[-500,gD,[-500,mD,-1,pD,-3,[-2,VD,dD],gD,DD,uD,-1,qD,JD,gD,[0,mD,fD],mD,HD,uD,pD,987,pD],4,gD,[-500,hD,-1,[-1,{}],998,hD],gD,[-500,hD,pD,-1,[-2,{},dD],997,pD,-1],uD,gD,[-500,hD,pD,KD,998,pD],pD,uD,qD,JD,gD,[0,mD,-1,KD],pD,-2,HD,mD,-1,fD,[0,fD,bD],978,KD,gD,DD];QD.prototype.g=TD($D);var eO=wD(QD,$D),tO=class extends Z{constructor(e){super(e)}},nO=class extends Z{constructor(e){super(e)}g(){return sT(this,tO,1)}},rO=[0,gD,[0,cD,tD,hD,-1]],iO=wD(nO,rO),aO=class extends Z{constructor(e){super(e)}},oO=class extends Z{constructor(e){super(e)}},sO=class extends Z{constructor(e){super(e)}l(){return aT(this,aO,2)}g(){return sT(this,oO,5)}},cO=wD(class extends Z{constructor(e){super(e)}},[0,pD,lD,rD,[0,xD,[0,cD,-3],[0,tD,-3],[0,cD,-1,[0,gD,[0,cD,-2]]],gD,[0,tD,-1,hD,tD]],hD,-1,aD,gD,[0,cD,tD],pD,aD]),lO=class extends Z{constructor(e){super(e)}},uO=wD(class extends Z{constructor(e){super(e)}},[0,gD,[0,tD,-4]]),dO=class extends Z{constructor(e){super(e)}},fO=wD(class extends Z{constructor(e){super(e)}},[0,gD,[0,tD,-4]]),pO=class extends Z{constructor(e){super(e)}},mO=[0,cD,-1,rD,xD],hO=class extends Z{constructor(e){super(e)}};hO.prototype.g=TD([0,tD,-4,aD]);var gO=class extends Z{constructor(e){super(e)}},_O=wD(class extends Z{constructor(e){super(e)}},[0,gD,[0,1,cD,hD,rO],aD]),vO=class extends Z{constructor(e){super(e)}},yO=class extends Z{constructor(e){super(e)}na(){return zw(this,1,void 0,void 0,Yw)??_S()}},bO=class extends Z{constructor(e){super(e)}},xO=[1,2],SO=wD(class extends Z{constructor(e){super(e)}},[0,gD,[0,xO,_D,[0,rD],_D,[0,vD],cD,hD],aD]),CO=class extends Z{constructor(e){super(e)}},wO=[0,hD,cD,tD,pD,-1],TO=class extends Z{constructor(e){super(e)}},EO=[0,dD,-1],DO=class extends Z{constructor(e){super(e)}},OO=[1,2,3,4,5,6],kO=class extends Z{constructor(e){super(e)}g(){return zw(this,1,void 0,void 0,Yw)!=null}l(){return ew(zw(this,2))!=null}},AO=class extends Z{constructor(e){super(e)}g(){return BC(zw(this,2))??!1}},jO=[0,vD,hD,[0,cD,aD,-1],[0,sD,aD]],MO=[0,jO,dD,[0,OO,_D,zD,_D,PD,_D,MD,_D,RD,_D,ID,_D,FD],xD],NO=class extends Z{constructor(e){super(e)}},PO=[0,MO,tD,-1,cD],FO=CD(502141897,NO);VD[502141897]=PO;var IO=wD(class extends Z{constructor(e){super(e)}},[0,[0,xD,-1,nD,yD],mO]),LO=class extends Z{constructor(e){super(e)}},RO=class extends Z{constructor(e){super(e)}},zO=[0,MO,tD,[0,MO],dD],BO=CD(508968150,RO);VD[508968150]=[0,MO,PO,zO,tD,[0,[0,jO]]],VD[508968149]=zO;var VO=class extends Z{constructor(e){super(e)}l(){return aT(this,CO,2)}g(){Vw(this,2)}},HO=[0,MO,wO];VD[478825465]=HO;var UO=class extends Z{constructor(e){super(e)}},WO=class extends Z{constructor(e){super(e)}},GO=class extends Z{constructor(e){super(e)}},KO=class extends Z{constructor(e){super(e)}},qO=class extends Z{constructor(e){super(e)}},JO=[0,MO,[0,MO],HO,-1],YO=[0,MO,tD,cD],XO=[0,MO,tD],ZO=[0,MO,YO,XO,tD],QO=CD(479097054,qO);VD[479097054]=[0,MO,ZO,JO],VD[463370452]=JO,VD[464864288]=YO;var $O=CD(462713202,KO);VD[462713202]=ZO,VD[474472470]=XO;var ek=class extends Z{constructor(e){super(e)}},tk=class extends Z{constructor(e){super(e)}},nk=class extends Z{constructor(e){super(e)}},rk=class extends Z{constructor(e){super(e)}},ik=[0,MO,tD,-1,cD],ak=[0,MO,tD,dD];rk.prototype.g=TD([0,MO,XO,[0,MO],PO,zO,ik,ak]);var ok=class extends Z{constructor(e){super(e)}},sk=CD(456383383,ok);VD[456383383]=[0,MO,wO];var ck=class extends Z{constructor(e){super(e)}},lk=CD(476348187,ck);VD[476348187]=[0,MO,EO];var uk=class extends Z{constructor(e){super(e)}},dk=class extends Z{constructor(e){super(e)}},fk=[0,xD,-1],pk=CD(458105876,class extends Z{constructor(e){super(e)}g(){let e;var t=this.v;let n=0|t[X];return e=JS(this,n),t=function(e,t,n,r){var i=dk;!r&&Nw(e)&&(n=0|(t=e.v)[X]);var a=Bw(t,2);if(e=!1,a==null){if(r)return pw();a=[]}else if(a.constructor===lw){if(!(2&a.J)||r)return a;a=a.V()}else Array.isArray(a)?e=!!(2&(0|a[X])):a=[];if(r){if(!a.length)return pw();e||(e=!0,GS(a))}else e&&(e=!1,KS(a),a=Xw(a));return!e&&32&n&&US(a,32),n=Hw(t,n,2,r=new lw(a,i,nw,void 0)),e||Fw(t,n),r}(this,t,n,e),!e&&dk&&(t.ra=!0),t}});VD[458105876]=[0,fk,KE,[!0,aD,[0,hD,-1,pD]],[0,lD,dD,xD]];var mk=class extends Z{constructor(e){super(e)}},hk=CD(458105758,mk);VD[458105758]=[0,MO,hD,fk];var gk=class extends Z{constructor(e){super(e)}},_k=[0,iD,-1,fD],vk=class extends Z{constructor(e){super(e)}},yk=class extends Z{constructor(e){super(e)}},bk=[1,2];yk.prototype.g=TD([0,bk,_D,_k,_D,[0,gD,_k]]);var xk=class extends Z{constructor(e){super(e)}},Sk=CD(443442058,xk);VD[443442058]=[0,MO,hD,cD,tD,pD,-1,dD,tD],VD[514774813]=ik;var Ck=class extends Z{constructor(e){super(e)}},wk=CD(516587230,Ck);function Tk(e,t){return t=t?t.clone():new CO,e.displayNamesLocale===void 0?e.displayNamesLocale===void 0&&Vw(t,1):Vw(t,1,$C(e.displayNamesLocale)),e.maxResults===void 0?`maxResults`in e&&Vw(t,2):gT(t,2,e.maxResults),e.scoreThreshold===void 0?`scoreThreshold`in e&&Vw(t,3):_T(t,3,e.scoreThreshold),e.categoryAllowlist===void 0?`categoryAllowlist`in e&&Vw(t,4):yT(t,4,e.categoryAllowlist),e.categoryDenylist===void 0?`categoryDenylist`in e&&Vw(t,5):yT(t,5,e.categoryDenylist),t}function Ek(e){let t=Number(e);return Number.isSafeInteger(t)?t:String(e)}function Dk(e,t=-1,n=``){return{categories:e.map((e=>({index:pT(e,1)??0??-1,score:hT(e,2)??0,categoryName:ew(zw(e,3))??``??``,displayName:ew(zw(e,4))??``??``}))),headIndex:t,headName:n}}function Ok(e){let t={classifications:sT(e,gO,1).map((e=>Dk(aT(e,nO,4)?.g()??[],pT(e,2)??0,ew(zw(e,3))??``)))};return function(e){return XC(tS?zw(e,2,void 0,void 0,ZC):zw(e,2))}(e)!=null&&(t.timestampMs=Ek(mT(e))),t}function kk(e){var t=Ww(e,3,RC,Uw()),n=Ww(e,2,UC,Uw()),r=Ww(e,1,ew,Uw()),i=Ww(e,9,ew,Uw());let a={categories:[],keypoints:[]};for(let e=0;e<t.length;e++)a.categories.push({score:t[e],index:n[e]??-1,categoryName:r[e]??``,displayName:i[e]??``});if((t=aT(e,sO,4)?.l())&&(a.boundingBox={originX:pT(t,1,Rw)??0,originY:pT(t,2,Rw)??0,width:pT(t,3,Rw)??0,height:pT(t,4,Rw)??0,angle:0}),aT(e,sO,4)?.g().length)for(let t of aT(e,sO,4).g())a.keypoints.push({x:zw(t,1,void 0,Rw,RC)??0,y:zw(t,2,void 0,Rw,RC)??0,score:zw(t,4,void 0,Rw,RC)??0,label:ew(zw(t,3,void 0,Rw))??``});return a}function Ak(e){let t=[];for(let n of sT(e,dO,1))t.push({x:hT(n,1)??0,y:hT(n,2)??0,z:hT(n,3)??0,visibility:hT(n,4)??0});return t}function jk(e){let t=[];for(let n of sT(e,lO,1))t.push({x:hT(n,1)??0,y:hT(n,2)??0,z:hT(n,3)??0,visibility:hT(n,4)??0});return t}function Mk(e){return Array.from(e,(e=>e>127?e-256:e))}function Nk(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let n=0,r=0,i=0;for(let a=0;a<e.length;a++)n+=e[a]*t[a],r+=e[a]*e[a],i+=t[a]*t[a];if(r<=0||i<=0)throw Error(`Cannot compute cosine similarity on embedding with 0 norm.`);return n/Math.sqrt(r*i)}var Pk;VD[516587230]=[0,MO,ik,ak,tD],VD[518928384]=ak;var Fk=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function Ik(){if(Pk===void 0)try{await WebAssembly.instantiate(Fk),Pk=!0}catch{Pk=!1}return Pk}async function Lk(e,t=jD``){let n=await Ik()?`wasm_internal`:`wasm_nosimd_internal`;return{wasmLoaderPath:`${t}/${e}_${n}.js`,wasmBinaryPath:`${t}/${e}_${n}.wasm`}}var Rk=class{};function zk(){var e=navigator;return typeof OffscreenCanvas<`u`&&(!function(e=navigator){return(e=e.userAgent).includes(`Safari`)&&!e.includes(`Chrome`)}(e)||!!((e=e.userAgent.match(/Version\/([\d]+).*Safari/))&&e.length>=1&&Number(e[1])>=17))}async function Bk(e){if(typeof importScripts!=`function`){let t=document.createElement(`script`);return t.src=e.toString(),t.crossOrigin=`anonymous`,new Promise(((e,n)=>{t.addEventListener(`load`,(()=>{e()}),!1),t.addEventListener(`error`,(e=>{n(e)}),!1),document.body.appendChild(t)}))}try{importScripts(e.toString())}catch(t){if(!(t instanceof TypeError))throw t;await self.import(e.toString())}}function Vk(e){return e.videoWidth===void 0?e.naturalWidth===void 0?e.displayWidth===void 0?[e.width,e.height]:[e.displayWidth,e.displayHeight]:[e.naturalWidth,e.naturalHeight]:[e.videoWidth,e.videoHeight]}function Q(e,t,n){e.m||console.error(`No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target`),n(t=e.i.stringToNewUTF8(t)),e.i._free(t)}function Hk(e,t,n){if(!e.i.canvas)throw Error(`No OpenGL canvas configured.`);if(n?e.i._bindTextureToStream(n):e.i._bindTextureToCanvas(),!(n=e.i.canvas.getContext(`webgl2`)||e.i.canvas.getContext(`webgl`)))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");e.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t),e.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1);let[r,i]=Vk(t);return!e.l||r===e.i.canvas.width&&i===e.i.canvas.height||(e.i.canvas.width=r,e.i.canvas.height=i),[r,i]}function Uk(e,t,n){e.m||console.error(`No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target`);let r=new Uint32Array(t.length);for(let n=0;n<t.length;n++)r[n]=e.i.stringToNewUTF8(t[n]);t=e.i._malloc(4*r.length),e.i.HEAPU32.set(r,t>>2),n(t);for(let t of r)e.i._free(t);e.i._free(t)}function Wk(e,t,n){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=n}function Gk(e,t,n){let r=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(e,t,i)=>{t?(n(r,i),r=[]):r.push(e)}}Rk.forVisionTasks=function(e){return Lk(`vision`,e)},Rk.forTextTasks=function(e){return Lk(`text`,e)},Rk.forGenAiExperimentalTasks=function(e){return Lk(`genai_experimental`,e)},Rk.forGenAiTasks=function(e){return Lk(`genai`,e)},Rk.forAudioTasks=function(e){return Lk(`audio`,e)},Rk.isSimdSupported=function(){return Ik()};async function Kk(e,t,n,r){return e=await(async(e,t,n,r,i)=>{if(t&&await Bk(t),!self.ModuleFactory||n&&(await Bk(n),!self.ModuleFactory))throw Error(`ModuleFactory not set.`);return self.Module&&i&&((t=self.Module).locateFile=i.locateFile,i.mainScriptUrlOrBlob&&(t.mainScriptUrlOrBlob=i.mainScriptUrlOrBlob)),i=await self.ModuleFactory(self.Module||i),self.ModuleFactory=self.Module=void 0,new e(i,r)})(e,n.wasmLoaderPath,n.assetLoaderPath,t,{locateFile:e=>e.endsWith(`.wasm`)?n.wasmBinaryPath.toString():n.assetBinaryPath&&e.endsWith(`.data`)?n.assetBinaryPath.toString():e}),await e.o(r),e}function qk(e,t){let n=aT(e.baseOptions,kO,1)||new kO;typeof t==`string`?(Vw(n,2,$C(t)),Vw(n,1)):t instanceof Uint8Array&&(Vw(n,1,XS(t,!1)),Vw(n,2)),lT(e.baseOptions,0,1,n)}function Jk(e){try{let t=e.H.length;if(t===1)throw Error(e.H[0].message);if(t>1)throw Error(`Encountered multiple errors: `+e.H.map((e=>e.message)).join(`, `))}finally{e.H=[]}}function $(e,t){e.C=Math.max(e.C,t)}function Yk(e,t){e.B=new GD,vT(e.B,2,`PassThroughCalculator`),UD(e.B,`free_memory`),WD(e.B,`free_memory_unused_out`),XD(t,`free_memory`),YD(t,e.B)}function Xk(e,t){UD(e.B,t),WD(e.B,t+`_unused_out`)}function Zk(e){e.g.addBoolToStream(!0,`free_memory`,e.C)}var Qk=class{constructor(e){this.g=e,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){if(t){let t=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error(`Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer`);if(!(aT(this.baseOptions,kO,1)?.g()||aT(this.baseOptions,kO,1)?.l()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error(`Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set`);if(function(e,t){let n=aT(e.baseOptions,DO,3);if(!n){var r=n=new DO,i=new LD;uT(r,4,OO,i)}`delegate`in t&&(t.delegate===`GPU`?(t=n,r=new ND,uT(t,2,OO,r)):(t=n,r=new LD,uT(t,4,OO,r))),lT(e.baseOptions,0,3,n)}(this,t),t.modelAssetPath)return fetch(t.modelAssetPath.toString()).then((e=>{if(e.ok)return e.arrayBuffer();throw Error(`Failed to fetch model: ${t.modelAssetPath} (${e.status})`)})).then((e=>{try{this.g.i.FS_unlink(`/model.dat`)}catch{}this.g.i.FS_createDataFile(`/`,`model.dat`,new Uint8Array(e),!0,!1,!1),qk(this,`/model.dat`),this.m(),this.L()}));if(t.modelAssetBuffer instanceof Uint8Array)qk(this,t.modelAssetBuffer);else if(t.modelAssetBuffer)return async function(e){let t=[];for(var n=0;;){let{done:r,value:i}=await e.read();if(r)break;t.push(i),n+=i.length}if(t.length===0)return new Uint8Array;if(t.length===1)return t[0];e=new Uint8Array(n),n=0;for(let r of t)e.set(r,n),n+=r.length;return e}(t.modelAssetBuffer).then((e=>{qk(this,e),this.m(),this.L()}))}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let e;if(this.g.ca((t=>{e=eO(t)})),!e)throw Error(`Failed to retrieve CalculatorGraphConfig`);return e}setGraph(e,t){this.g.attachErrorListener(((e,t)=>{this.H.push(Error(t))})),this.g.Ja(),this.g.setGraph(e,t),this.B=void 0,Jk(this)}finishProcessing(){this.g.finishProcessing(),Jk(this)}close(){this.B=void 0,this.g.closeGraph()}};function $k(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Qk.prototype.close=Qk.prototype.close;var eA=class{constructor(e,t,n,r){this.g=e,this.h=t,this.m=n,this.l=r}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}};function tA(e,t,n){let r=e.g;if(n=$k(r.createShader(n),`Failed to create WebGL shader`),r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${r.getShaderInfoLog(n)}`);return r.attachShader(e.h,n),n}function nA(e,t){let n=e.g,r=$k(n.createVertexArray(),`Failed to create vertex array`);n.bindVertexArray(r);let i=$k(n.createBuffer(),`Failed to create buffer`);n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(e.O),n.vertexAttribPointer(e.O,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),n.STATIC_DRAW);let a=$k(n.createBuffer(),`Failed to create buffer`);return n.bindBuffer(n.ARRAY_BUFFER,a),n.enableVertexAttribArray(e.L),n.vertexAttribPointer(e.L,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array(t?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindVertexArray(null),new eA(n,r,i,a)}function rA(e,t){if(e.g){if(t!==e.g)throw Error(`Cannot change GL context once initialized`)}else e.g=t}function iA(e,t,n,r){return rA(e,t),e.h||(e.m(),e.D()),n?(e.u||=nA(e,!0),n=e.u):(e.A||=nA(e,!1),n=e.A),t.useProgram(e.h),n.bind(),e.l(),e=r(),n.g.bindVertexArray(null),e}function aA(e,t,n){return rA(e,t),e=$k(t.createTexture(),`Failed to create texture`),t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n??t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n??t.LINEAR),t.bindTexture(t.TEXTURE_2D,null),e}function oA(e,t,n){rA(e,t),e.B||=$k(t.createFramebuffer(),`Failed to create framebuffe.`),t.bindFramebuffer(t.FRAMEBUFFER,e.B),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0)}function sA(e){e.g?.bindFramebuffer(e.g.FRAMEBUFFER,null)}var cA=class{H(){return`
4375
+ `,fx=class extends hl{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:n,gainMapMin:r,gainMapMax:i,maxDisplayBoost:a,hdrCapacityMin:o,hdrCapacityMax:s,sdr:c,gainMap:l}){super({name:`GainMapDecoderMaterial`,vertexShader:ux,fragmentShader:dx,uniforms:{sdr:{value:c},gainMap:{value:l},gamma:{value:new V(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new V().fromArray(t)},offsetSdr:{value:new V().fromArray(n)},gainMapMin:{value:new V().fromArray(r)},gainMapMax:{value:new V().fromArray(i)},weightFactor:{value:(Math.log2(a)-o)/(s-o)}},blending:0,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=a,this._hdrCapacityMin=o,this._hdrCapacityMax=s,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){let e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){let t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){let e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}},px=class extends lx{constructor(e,t){super({renderer:e,createMaterial:e=>new fx(e),createQuadRenderer:e=>new tx(e)},t)}async render(e,t,n,r){let{sdrImage:i,gainMapImage:a,needsFlip:o}=await this.processImages(n,r,`flipY`),{gainMap:s,sdr:c}=this.createTextures(i,a,o);this.updateQuadRenderer(e,i,s,c,t),e.render()}},mx=class extends px{load([e,t,n],r,i,a){let o=this.prepareQuadRenderer(),s,c,l,u=async()=>{if(s&&c&&l){try{await this.render(o,l,s,c)}catch(r){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(n),typeof a==`function`&&a(r),o.disposeOnDemandRenderer();return}typeof r==`function`&&r(o),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(n),o.disposeOnDemandRenderer()}},d=!0,f=0,p=0,m=!0,h=0,g=0,_=!0,v=0,y=0,b=()=>{if(typeof i==`function`){let e=f+h+v,t=p+g+y,n=d&&m&&_;i(new ProgressEvent(`progress`,{lengthComputable:n,loaded:t,total:e}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(n);let x=new ru(this._internalLoadingManager);x.setResponseType(`arraybuffer`),x.setRequestHeader(this.requestHeader),x.setPath(this.path),x.setWithCredentials(this.withCredentials),x.load(e,async e=>{if(typeof e==`string`)throw Error(`Invalid sdr buffer`);s=e,await u()},e=>{d=e.lengthComputable,p=e.loaded,f=e.total,b()},t=>{this.manager.itemError(e),typeof a==`function`&&a(t)});let S=new ru(this._internalLoadingManager);S.setResponseType(`arraybuffer`),S.setRequestHeader(this.requestHeader),S.setPath(this.path),S.setWithCredentials(this.withCredentials),S.load(t,async e=>{if(typeof e==`string`)throw Error(`Invalid gainmap buffer`);c=e,await u()},e=>{m=e.lengthComputable,g=e.loaded,h=e.total,b()},e=>{this.manager.itemError(t),typeof a==`function`&&a(e)});let C=new ru(this._internalLoadingManager);return C.setRequestHeader(this.requestHeader),C.setPath(this.path),C.setWithCredentials(this.withCredentials),C.load(n,async e=>{if(typeof e!=`string`)throw Error(`Invalid metadata string`);l=JSON.parse(e),await u()},e=>{_=e.lengthComputable,y=e.loaded,v=e.total,b()},e=>{this.manager.itemError(n),typeof a==`function`&&a(e)}),o}},hx=class extends px{load(e,t,n,r){let i=this.prepareQuadRenderer(),a=new ru(this._internalLoadingManager);return a.setResponseType(`arraybuffer`),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(this.withCredentials),this.manager.itemStart(e),a.load(e,async n=>{if(typeof n==`string`)throw Error(`Invalid buffer, received [string], was expecting [ArrayBuffer]`);let a=new Uint8Array(n),o,s,c;try{let e=await sx(a);o=e.sdr,s=e.gainMap,c=e.metadata}catch(t){if(t instanceof rx||t instanceof nx)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),c={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},o=a;else throw t}try{await this.render(i,c,o.buffer,s?.buffer)}catch(t){this.manager.itemError(e),typeof r==`function`&&r(t),i.disposeOnDemandRenderer();return}typeof t==`function`&&t(i),this.manager.itemEnd(e),i.disposeOnDemandRenderer()},n,t=>{this.manager.itemError(e),typeof r==`function`&&r(t)}),i}},gx={apartment:`lebombo_1k.hdr`,city:`potsdamer_platz_1k.hdr`,dawn:`kiara_1_dawn_1k.hdr`,forest:`forest_slope_1k.hdr`,lobby:`st_fagans_interior_1k.hdr`,night:`dikhololo_night_1k.hdr`,park:`rooitou_park_1k.hdr`,studio:`studio_small_03_1k.hdr`,sunset:`venice_sunset_1k.hdr`,warehouse:`empty_warehouse_01_1k.hdr`},_x=`https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/`,vx=e=>Array.isArray(e),yx=[`/px.png`,`/nx.png`,`/py.png`,`/ny.png`,`/pz.png`,`/nz.png`];function bx({files:e=yx,path:t=``,preset:r=void 0,colorSpace:i=void 0,extensions:a}={}){r&&(Cx(r),e=gx[r],t=_x);let o=vx(e),{extension:s,isCubemap:c}=wx(e),l=Tx(s);if(!l)throw Error(`useEnvironment: Unrecognized file extension: `+e);let u=p_(e=>e.gl);(0,n.useLayoutEffect)(()=>{if(s!==`webp`&&s!==`jpg`&&s!==`jpeg`)return;function t(){v_.clear(l,o?[e]:e)}u.domElement.addEventListener(`webglcontextlost`,t,{once:!0})},[e,u.domElement]);let d=v_(l,o?[e]:e,e=>{(s===`webp`||s===`jpg`||s===`jpeg`)&&e.setRenderer(u),e.setPath==null||e.setPath(t),a&&a(e)}),f=o?d[0]:d;return(s===`jpg`||s===`jpeg`||s===`webp`)&&(f=f.renderTarget?.texture),f.mapping=c?301:303,f.colorSpace=i??(c?`srgb`:`srgb-linear`),f}var xx={files:yx,path:``,preset:void 0,extensions:void 0};bx.preload=e=>{let t={...xx,...e},{files:n,path:r=``}=t,{preset:i,extensions:a}=t;i&&(Cx(i),n=gx[i],r=_x);let{extension:o}=wx(n);if(o===`webp`||o===`jpg`||o===`jpeg`)throw Error(`useEnvironment: Preloading gainmaps is not supported`);let s=Tx(o);if(!s)throw Error(`useEnvironment: Unrecognized file extension: `+n);v_.preload(s,vx(n)?[n]:n,e=>{e.setPath==null||e.setPath(r),a&&a(e)})};var Sx={files:yx,preset:void 0};bx.clear=e=>{let t={...Sx,...e},{files:n}=t,{preset:r}=t;r&&(Cx(r),n=gx[r]);let{extension:i}=wx(n),a=Tx(i);if(!a)throw Error(`useEnvironment: Unrecognized file extension: `+n);v_.clear(a,vx(n)?[n]:n)};function Cx(e){if(!(e in gx))throw Error(`Preset must be one of: `+Object.keys(gx).join(`, `))}function wx(e){var t;let n=vx(e)&&e.length===6,r=vx(e)&&e.length===3&&e.some(e=>e.endsWith(`json`)),i=vx(e)?e[0]:e;return{extension:n?`cube`:r?`webp`:i.startsWith(`data:application/exr`)?`exr`:i.startsWith(`data:application/hdr`)?`hdr`:i.startsWith(`data:image/jpeg`)?`jpg`:(t=i.split(`.`).pop())==null||(t=t.split(`?`))==null||(t=t.shift())==null?void 0:t.toLowerCase(),isCubemap:n,isGainmap:r}}function Tx(e){return e===`cube`?cu:e===`hdr`?zb:e===`exr`?Vb:e===`jpg`||e===`jpeg`?hx:e===`webp`?mx:null}var Ex=e=>e.current&&e.current.isScene,Dx=e=>Ex(e)?e.current:e;function Ox(e,t,n,r,i={}){var a,o;i={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...i};let s=Dx(t||n),c=s.background,l=s.environment,u={backgroundBlurriness:s.backgroundBlurriness,backgroundIntensity:s.backgroundIntensity,backgroundRotation:((a=s.backgroundRotation)==null||a.clone==null?void 0:a.clone())??[0,0,0],environmentIntensity:s.environmentIntensity,environmentRotation:((o=s.environmentRotation)==null||o.clone==null?void 0:o.clone())??[0,0,0]};return e!==`only`&&(s.environment=r),e&&(s.background=r),t_(s,i),()=>{e!==`only`&&(s.environment=l),e&&(s.background=c),t_(s,u)}}function kx({scene:e,background:t=!1,map:r,...i}){let a=p_(e=>e.scene);return n.useLayoutEffect(()=>{if(r)return Ox(t,e,a,r,i)}),null}function Ax({background:e=!1,scene:t,blur:r,backgroundBlurriness:i,backgroundIntensity:a,backgroundRotation:o,environmentIntensity:s,environmentRotation:c,...l}){let u=bx(l),d=p_(e=>e.scene);return n.useLayoutEffect(()=>Ox(e,t,d,u,{backgroundBlurriness:r??i,backgroundIntensity:a,backgroundRotation:o,environmentIntensity:s,environmentRotation:c})),n.useEffect(()=>()=>{u.dispose()},[u]),null}function jx({children:e,near:t=.1,far:r=1e3,resolution:i=256,frames:a=1,map:o,background:s=!1,blur:c,backgroundBlurriness:l,backgroundIntensity:u,backgroundRotation:d,environmentIntensity:f,environmentRotation:p,scene:m,files:h,path:g,preset:_=void 0,extensions:v}){let y=p_(e=>e.gl),b=p_(e=>e.scene),x=n.useRef(null),[S]=n.useState(()=>new Ur),C=n.useMemo(()=>{let e=new Cp(i);return e.texture.type=se,e},[i]);n.useEffect(()=>()=>{C.dispose()},[C]),n.useLayoutEffect(()=>{if(a===1){let e=y.autoClear;y.autoClear=!0,x.current.update(y,S),y.autoClear=e}return Ox(s,m,b,C.texture,{backgroundBlurriness:c??l,backgroundIntensity:u,backgroundRotation:d,environmentIntensity:f,environmentRotation:p})},[e,S,C.texture,m,b,s,a,y]);let w=1;return m_(()=>{if(a===1/0||w<a){let e=y.autoClear;y.autoClear=!0,x.current.update(y,S),y.autoClear=e,w++}}),n.createElement(n.Fragment,null,pv(n.createElement(n.Fragment,null,e,n.createElement(`cubeCamera`,{ref:x,args:[t,r,C]}),h||_?n.createElement(Ax,{background:!0,files:h,preset:_,path:g,extensions:v}):o?n.createElement(kx,{background:!0,map:o,extensions:v}):null),S))}function Mx(e){let t=bx(e),r=e.map||t;n.useMemo(()=>H_({GroundProjectedEnvImpl:Sy}),[]),n.useEffect(()=>()=>{t.dispose()},[t]);let i=n.useMemo(()=>[r],[r]),a=e.ground?.height,o=e.ground?.radius,s=e.ground?.scale??1e3;return n.createElement(n.Fragment,null,n.createElement(kx,Hv({},e,{map:r})),n.createElement(`groundProjectedEnvImpl`,{args:i,scale:s,height:a,radius:o}))}function Nx(e){return e.ground?n.createElement(Mx,e):e.map?n.createElement(kx,e):e.children?n.createElement(jx,e):n.createElement(Ax,e)}var Px=({children:e,showEnvironment:t=!0})=>(0,r.jsx)(cg,{children:(0,r.jsx)(Vv,{camera:{position:[0,1.5,3],fov:45},style:{width:`100%`,height:`100%`,position:`absolute`,top:0,left:0},gl:{alpha:!0,antialias:!0,preserveDrawingBuffer:!0},children:(0,r.jsxs)(n.Suspense,{fallback:null,children:[(0,r.jsx)(`ambientLight`,{intensity:.7}),(0,r.jsx)(`directionalLight`,{position:[2,5,2],intensity:1.5,castShadow:!0}),(0,r.jsx)(`directionalLight`,{position:[-2,5,-2],intensity:.5}),t&&(0,r.jsx)(Nx,{preset:`city`}),e,(0,r.jsx)(Zb,{enablePan:!1,minPolarAngle:Math.PI/4,maxPolarAngle:Math.PI/1.5,minDistance:1,maxDistance:5})]})})}),Fx=({className:e,style:t})=>{let{videoRef:i}=sg(),{isWebcamActive:a}=h();return(0,n.useEffect)(()=>{a&&i.current},[a,i]),(0,r.jsx)(`div`,{className:`camera-view-container ${e||``}`,style:{position:`absolute`,inset:0,zIndex:0,...t},children:(0,r.jsx)(`video`,{ref:i,autoPlay:!0,playsInline:!0,muted:!0,className:`w-full h-full object-cover`,style:{display:a?`block`:`none`}})})},Ix=({url:e,onBonesReady:t})=>e?(0,r.jsx)(Lx,{url:e,onBonesReady:t}):null,Lx=({url:e,onBonesReady:t})=>{let{scene:i}=Xb(e),a=(0,n.useRef)(null),{setAvatarBones:o}=sg();return(0,n.useEffect)(()=>{if(!i)return;let e={};return i.traverse(t=>{t instanceof Xa&&(e[t.name]=t)}),o(e),t&&t(e),()=>o(null)},[i,t,o]),(0,r.jsx)(`group`,{ref:a,dispose:null,children:(0,r.jsx)(`primitive`,{object:i})})},Rx=({url:e,targetAvatarBones:t})=>e?(0,r.jsx)(zx,{url:e,targetAvatarBones:t}):null,zx=({url:e,targetAvatarBones:t})=>{let{scene:i}=Xb(e),a=(0,n.useRef)(null),{avatarBones:o}=sg(),s=t||o;return(0,n.useEffect)(()=>{!i||!s||i.traverse(e=>{if(e instanceof Ya){let t=e,n=[];t.skeleton.bones.forEach(e=>{s[e.name]?n.push(s[e.name]):n.push(e)}),t.bind(new eo(n),t.bindMatrix)}})},[i,s]),(0,r.jsx)(`group`,{ref:a,dispose:null,children:(0,r.jsx)(`primitive`,{object:i})})},Bx=typeof self<`u`?self:{};function Vx(e,t){t:{for(var n=[`CLOSURE_FLAGS`],r=Bx,i=0;i<n.length;i++)if((r=r[n[i]])==null){n=null;break t}n=r}return(e=n&&n[e])??t}function Hx(){throw Error(`Invalid UTF8`)}function Ux(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var Wx,Gx,Kx=typeof TextDecoder<`u`,qx,Jx=typeof TextEncoder<`u`;function Yx(e){if(Jx)e=(qx||=new TextEncoder).encode(e);else{let n=0,r=new Uint8Array(3*e.length);for(let i=0;i<e.length;i++){var t=e.charCodeAt(i);if(t<128)r[n++]=t;else{if(t<2048)r[n++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&i<e.length){let a=e.charCodeAt(++i);if(a>=56320&&a<=57343){t=1024*(t-55296)+a-56320+65536,r[n++]=t>>18|240,r[n++]=t>>12&63|128,r[n++]=t>>6&63|128,r[n++]=63&t|128;continue}i--}t=65533}r[n++]=t>>12|224,r[n++]=t>>6&63|128}r[n++]=63&t|128}}e=n===r.length?r:r.subarray(0,n)}return e}function Xx(e){Bx.setTimeout((()=>{throw e}),0)}var Zx,Qx=Vx(610401301,!1),$x=Vx(748402147,!0),eS=Vx(824648567,!0),tS=Vx(824656860,Vx(1,!0));function nS(){var e=Bx.navigator;return(e&&=e.userAgent)?e:``}var rS=Bx.navigator;function iS(e){return iS[` `](e),e}Zx=rS&&rS.userAgentData||null,iS[` `]=function(){};var aS={},oS=null;function sS(e){let t=e.length,n=3*t/4;n%3?n=Math.floor(n):`=.`.indexOf(e[t-1])!=-1&&(n=`=.`.indexOf(e[t-2])==-1?n-1:n-2);let r=new Uint8Array(n),i=0;return function(e,t){function n(t){for(;r<e.length;){let t=e.charAt(r++),n=oS[t];if(n!=null)return n;if(!/^[\s\xa0]*$/.test(t))throw Error(`Unknown base64 encoding at char: `+t)}return t}cS();let r=0;for(;;){let e=n(-1),r=n(0),i=n(64),a=n(64);if(a===64&&e===-1)break;t(e<<2|r>>4),i!=64&&(t(r<<4&240|i>>2),a!=64&&t(i<<6&192|a))}}(e,(function(e){r[i++]=e})),i===n?r:r.subarray(0,i)}function cS(){if(!oS){oS={};var e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`.split(``),t=[`+/=`,`+/`,`-_=`,`-_.`,`-_`];for(let n=0;n<5;n++){let r=e.concat(t[n].split(``));aS[n]=r;for(let e=0;e<r.length;e++){let t=r[e];oS[t]===void 0&&(oS[t]=e)}}}}var lS=typeof Uint8Array<`u`,uS=!(!(Qx&&Zx&&Zx.brands.length>0)&&(nS().indexOf(`Trident`)!=-1||nS().indexOf(`MSIE`)!=-1))&&typeof btoa==`function`,dS=/[-_.]/g,fS={"-":`+`,_:`/`,".":`=`};function pS(e){return fS[e]||``}function mS(e){if(!uS)return sS(e);e=dS.test(e)?e.replace(dS,pS):e,e=atob(e);let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function hS(e){return lS&&e!=null&&e instanceof Uint8Array}var gS={};function _S(){return bS||=new yS(null,gS)}function vS(e){SS(gS);var t=e.g;return(t=t==null||hS(t)?t:typeof t==`string`?mS(t):null)==null?t:e.g=t}var yS=class{h(){return new Uint8Array(vS(this)||0)}constructor(e,t){if(SS(t),this.g=e,e!=null&&e.length===0)throw Error(`ByteString should be constructed with non-empty values`)}},bS,xS;function SS(e){if(e!==gS)throw Error(`illegal external caller`)}function CS(e,t){e.__closure__error__context__984382||={},e.__closure__error__context__984382.severity=t}function wS(e){return CS(e=Error(e),`warning`),e}function TS(e,t){if(e!=null){var n=xS??={},r=n[e]||0;r>=t||(n[e]=r+1,CS(e=Error(),`incident`),Xx(e))}}function ES(){return typeof BigInt==`function`}var DS=typeof Symbol==`function`&&typeof Symbol()==`symbol`;function OS(e,t,n=!1){return typeof Symbol==`function`&&typeof Symbol()==`symbol`?n&&Symbol.for&&e?Symbol.for(e):e==null?Symbol():Symbol(e):t}var kS=OS(`jas`,void 0,!0),AS=OS(void 0,`0di`),jS=OS(void 0,`1oa`),MS=OS(void 0,Symbol()),NS=OS(void 0,`0ub`),PS=OS(void 0,`0ubs`),FS=OS(void 0,`0ubsb`),IS=OS(void 0,`0actk`),LS=OS(`m_m`,`Pa`,!0),RS=OS(),zS={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},BS=Object.defineProperties,X=DS?kS:`Ga`,VS,HS=[];function US(e,t){DS||X in e||BS(e,zS),e[X]|=t}function WS(e,t){DS||X in e||BS(e,zS),e[X]=t}function GS(e){return US(e,34),e}function KS(e){return US(e,8192),e}WS(HS,7),VS=Object.freeze(HS);var qS={};function JS(e,t){return t===void 0?e.h!==YS&&!!(2&(0|e.v[X])):!!(2&t)&&e.h!==YS}var YS={};function XS(e,t){if(e!=null){if(typeof e==`string`)e=e?new yS(e,gS):_S();else if(e.constructor!==yS)if(hS(e))e=e.length?new yS(new Uint8Array(e),gS):_S();else{if(!t)throw Error();e=void 0}}return e}var ZS=class{constructor(e,t,n){this.g=e,this.h=t,this.l=n}next(){let e=this.g.next();return e.done||(e.value=this.h.call(this.l,e.value)),e}[Symbol.iterator](){return this}},QS=Object.freeze({});function $S(e,t,n){let r=128&t?0:-1,i=e.length;var a;(a=!!i)&&(a=(a=e[i-1])!=null&&typeof a==`object`&&a.constructor===Object);let o=i+(a?-1:0);for(t=128&t?1:0;t<o;t++)n(t-r,e[t]);if(a){e=e[i-1];for(let t in e)!isNaN(t)&&n(+t,e[t])}}var eC={};function tC(e){return 128&e?eC:void 0}function nC(e){return e.Na=!0,e}var rC=nC((e=>typeof e==`number`)),iC=nC((e=>typeof e==`string`)),aC=nC((e=>typeof e==`boolean`)),oC=typeof Bx.BigInt==`function`&&typeof Bx.BigInt(0)==`bigint`;function sC(e){var t=e;if(iC(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(rC(t)&&!Number.isSafeInteger(t))throw Error(String(t));return oC?BigInt(e):e=aC(e)?e?`1`:`0`:iC(e)?e.trim()||`0`:String(e)}var cC=nC((e=>oC?e>=uC&&e<=fC:e[0]===`-`?pC(e,lC):pC(e,dC))),lC=(-(2**53-1)).toString(),uC=oC?BigInt(-(2**53-1)):void 0,dC=(2**53-1).toString(),fC=oC?BigInt(2**53-1):void 0;function pC(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r>i)return!1;if(r<i)return!0}}var mC=typeof Uint8Array.prototype.slice==`function`,hC,gC=0,_C=0;function vC(e){let t=e>>>0;gC=t,_C=(e-t)/4294967296>>>0}function yC(e){if(e<0){vC(-e);let[t,n]=kC(gC,_C);gC=t>>>0,_C=n>>>0}else vC(e)}function bC(e){let t=hC||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),_C=0,gC=t.getUint32(0,!0)}function xC(e,t){let n=4294967296*t+(e>>>0);return Number.isSafeInteger(n)?n:TC(e,t)}function SC(e,t){return sC(ES()?BigInt.asUintN(64,(BigInt(t>>>0)<<BigInt(32))+BigInt(e>>>0)):TC(e,t))}function CC(e,t){let n=2147483648&t;return n&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=xC(e,t))==`number`?n?-e:e:n?`-`+e:e}function wC(e,t){return ES()?sC(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(t))<<BigInt(32))+BigInt.asUintN(32,BigInt(e)))):sC(DC(e,t))}function TC(e,t){if(e>>>=0,(t>>>=0)<=2097151)var n=``+(4294967296*t+e);else ES()?n=``+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(n=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),n+=8147497*t,t*=2,e>=1e7&&(n+=e/1e7>>>0,e%=1e7),n>=1e7&&(t+=n/1e7>>>0,n%=1e7),n=t+EC(n)+EC(e));return n}function EC(e){return e=String(e),`0000000`.slice(e.length)+e}function DC(e,t){if(2147483648&t)if(ES())e=``+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[n,r]=kC(e,t);e=`-`+TC(n,r)}else e=TC(e,t);return e}function OC(e){if(e.length<16)yC(Number(e));else if(ES())e=BigInt(e),gC=Number(e&BigInt(4294967295))>>>0,_C=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]===`-`);_C=gC=0;let n=e.length;for(let r=t,i=(n-t)%6+t;i<=n;r=i,i+=6){let t=Number(e.slice(r,i));_C*=1e6,gC=1e6*gC+t,gC>=4294967296&&(_C+=Math.trunc(gC/4294967296),_C>>>=0,gC>>>=0)}if(t){let[e,t]=kC(gC,_C);gC=e,_C=t}}}function kC(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function AC(e){return Array.prototype.slice.call(e)}var jC=typeof BigInt==`function`?BigInt.asIntN:void 0,MC=typeof BigInt==`function`?BigInt.asUintN:void 0,NC=Number.isSafeInteger,PC=Number.isFinite,FC=Math.trunc,IC=sC(0);function LC(e){if(e!=null&&typeof e!=`number`)throw Error(`Value of float/double field must be a number, found ${typeof e}: ${e}`);return e}function RC(e){return e==null||typeof e==`number`?e:e===`NaN`||e===`Infinity`||e===`-Infinity`?Number(e):void 0}function zC(e){if(e!=null&&typeof e!=`boolean`){var t=typeof e;throw Error(`Expected boolean but got ${t==`object`?e?Array.isArray(e)?`array`:t:`null`:t}: ${e}`)}return e}function BC(e){return e==null||typeof e==`boolean`?e:typeof e==`number`?!!e:void 0}var VC=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function HC(e){switch(typeof e){case`bigint`:return!0;case`number`:return PC(e);case`string`:return VC.test(e);default:return!1}}function UC(e){if(e==null)return e;if(typeof e==`string`&&e)e=+e;else if(typeof e!=`number`)return;return PC(e)?0|e:void 0}function WC(e){if(e==null)return e;if(typeof e==`string`&&e)e=+e;else if(typeof e!=`number`)return;return PC(e)?e>>>0:void 0}function GC(e){let t=e.length;return(e[0]===`-`?t<20||t===20&&e<=`-9223372036854775808`:t<19||t===19&&e<=`9223372036854775807`)?e:(OC(e),DC(gC,_C))}function KC(e){return e=FC(e),NC(e)||(yC(e),e=CC(gC,_C)),e}function qC(e){var t=FC(Number(e));return NC(t)?String(t):((t=e.indexOf(`.`))!==-1&&(e=e.substring(0,t)),GC(e))}function JC(e){var t=FC(Number(e));return NC(t)?sC(t):((t=e.indexOf(`.`))!==-1&&(e=e.substring(0,t)),ES()?sC(jC(64,BigInt(e))):sC(GC(e)))}function YC(e){return NC(e)?e=sC(KC(e)):(e=FC(e),NC(e)?e=String(e):(yC(e),e=DC(gC,_C)),e=sC(e)),e}function XC(e){return e==null?e:typeof e==`bigint`?(cC(e)?e=Number(e):(e=jC(64,e),e=cC(e)?Number(e):String(e)),e):HC(e)?typeof e==`number`?KC(e):qC(e):void 0}function ZC(e){let t=typeof e;return e==null?e:t===`bigint`?sC(jC(64,e)):HC(e)?t===`string`?JC(e):YC(e):void 0}function QC(e){if(typeof e!=`string`)throw Error();return e}function $C(e){if(e!=null&&typeof e!=`string`)throw Error();return e}function ew(e){return e==null||typeof e==`string`?e:void 0}function tw(e,t,n,r){return e!=null&&e[LS]===qS?e:Array.isArray(e)?((r=(n=0|e[X])|32&r|2&r)!==n&&WS(e,r),new t(e)):(n?2&r?((e=t[AS])||(GS((e=new t).v),e=t[AS]=e),t=e):t=new t:t=void 0,t)}function nw(e,t,n){if(t)t:{if(!HC(t=e))throw wS(`int64`);switch(typeof t){case`string`:t=JC(t);break t;case`bigint`:t=sC(jC(64,t));break t;default:t=YC(t)}}else t=ZC(e);return(e=t)??(n?IC:void 0)}var rw={},iw=function(){try{return iS(new class extends Map{constructor(){super()}}),!1}catch{return!0}}(),aw=class{constructor(){this.g=new Map}get(e){return this.g.get(e)}set(e,t){return this.g.set(e,t),this.size=this.g.size,this}delete(e){return e=this.g.delete(e),this.size=this.g.size,e}clear(){this.g.clear(),this.size=this.g.size}has(e){return this.g.has(e)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(e,t){return this.g.forEach(e,t)}[Symbol.iterator](){return this.entries()}},ow=iw?(Object.setPrototypeOf(aw.prototype,Map.prototype),Object.defineProperties(aw.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),aw):class extends Map{constructor(){super()}};function sw(e){return e}function cw(e){if(2&e.J)throw Error(`Cannot mutate an immutable Map`)}var lw=class extends ow{constructor(e,t,n=sw,r=sw){super(),this.J=0|e[X],this.K=t,this.S=n,this.fa=this.K?uw:r;for(let i=0;i<e.length;i++){let a=e[i],o=n(a[0],!1,!0),s=a[1];t?s===void 0&&(s=null):s=r(a[1],!1,!0,void 0,void 0,this.J),super.set(o,s)}}V(e){return KS(Array.from(super.entries(),e))}clear(){cw(this),super.clear()}delete(e){return cw(this),super.delete(this.S(e,!0,!1))}entries(){if(this.K){var e=super.keys();e=new ZS(e,dw,this)}else e=super.entries();return e}values(){if(this.K){var e=super.keys();e=new ZS(e,lw.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.K?super.forEach(((n,r,i)=>{e.call(t,i.get(r),r,i)})):super.forEach(e,t)}set(e,t){return cw(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.fa(t,!0,!0,this.K,!1,this.J))}Ma(e){let t=this.S(e[0],!1,!0);e=e[1],e=this.K?e===void 0?null:e:this.fa(e,!1,!0,void 0,!1,this.J),super.set(t,e)}has(e){return super.has(this.S(e,!1,!1))}get(e){e=this.S(e,!1,!1);let t=super.get(e);if(t!==void 0){var n=this.K;return n?((n=this.fa(t,!1,!0,n,this.ra,this.J))!==t&&super.set(e,n),n):t}}[Symbol.iterator](){return this.entries()}};function uw(e,t,n,r,i,a){return e=tw(e,r,n,a),i&&(e=Mw(e)),e}function dw(e){return[e,this.get(e)]}var fw;function pw(){return fw||=new lw(GS([]),void 0,void 0,void 0,rw)}function mw(e){return MS?e[MS]:void 0}function hw(e,t){for(let n in e)!isNaN(n)&&t(e,+n,e[n])}lw.prototype.toJSON=void 0;var gw=class{},_w={Ka:!0};function vw(e,t){t<100||TS(PS,1)}function yw(e,t,n,r){let i=r!==void 0;r=!!r;var a,o=MS;!i&&DS&&o&&(a=e[o])&&hw(a,vw),o=[];var s=e.length;let c;a=4294967295;let l=!1,u=!!(64&t),d=u?128&t?0:-1:void 0;1&t||(c=s&&e[s-1],typeof c==`object`&&c&&c.constructor===Object?a=--s:c=void 0,!u||128&t||i||(l=!0,a=a-d+d)),t=void 0;for(var f=0;f<s;f++){let i=e[f];if(i!=null&&(i=n(i,r))!=null)if(u&&f>=a){let e=f-d;(t??={})[e]=i}else o[f]=i}if(c)for(let e in c){if((s=c[e])==null||(s=n(s,r))==null)continue;let i;f=+e,u&&!Number.isNaN(f)&&(i=f+d)<a?o[i]=s:(t??={})[e]=s}return t&&(l?o.push(t):o[a]=t),i&&MS&&(e=mw(e))&&e instanceof gw&&(o[MS]=function(e){let t=new gw;return hw(e,((e,n,r)=>{t[n]=AC(r)})),t.da=e.da,t}(e)),o}function bw(e){return e[0]=xw(e[0]),e[1]=xw(e[1]),e}function xw(e){switch(typeof e){case`number`:return Number.isFinite(e)?e:``+e;case`bigint`:return cC(e)?Number(e):``+e;case`boolean`:return e?1:0;case`object`:if(Array.isArray(e)){var t=0|e[X];return e.length===0&&1&t?void 0:yw(e,t,xw)}if(e!=null&&e[LS]===qS)return Sw(e);if(e instanceof yS){if((t=e.g)==null)e=``;else if(typeof t==`string`)e=t;else{if(uS){for(var n=``,r=0,i=t.length-10240;r<i;)n+=String.fromCharCode.apply(null,t.subarray(r,r+=10240));n+=String.fromCharCode.apply(null,r?t.subarray(r):t),t=btoa(n)}else{n===void 0&&(n=0),cS(),n=aS[n],r=Array(Math.floor(t.length/3)),i=n[64]||``;let e=0,l=0;for(;e<t.length-2;e+=3){var a=t[e],o=t[e+1],s=t[e+2],c=n[a>>2];a=n[(3&a)<<4|o>>4],o=n[(15&o)<<2|s>>6],s=n[63&s],r[l++]=c+a+o+s}switch(c=0,s=i,t.length-e){case 2:s=n[(15&(c=t[e+1]))<<2]||i;case 1:t=t[e],r[l]=n[t>>2]+n[(3&t)<<4|c>>4]+s+i}t=r.join(``)}e=e.g=t}return e}return e instanceof lw?e=e.size===0?void 0:e.V(bw):void 0}return e}function Sw(e){return yw(e=e.v,0|e[X],xw)}var Cw,ww;function Tw(e,t){return Ew(e,t[0],t[1])}function Ew(e,t,n,r=0){if(e==null){var i=32;n?(e=[n],i|=128):e=[],t&&(i=-16760833&i|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error(`narr`);if(i=0|e[X],$x&&1&i)throw Error(`rfarr`);if(2048&i&&!(2&i)&&function(){if($x)throw Error(`carr`);TS(IS,5)}(),256&i)throw Error(`farr`);if(64&i)return(i|r)!==i&&WS(e,i|r),e;if(n&&(i|=128,n!==e[0]))throw Error(`mid`);t:{i|=64;var a=(n=e).length;if(a){var o=a-1;let e=n[o];if(typeof e==`object`&&e&&e.constructor===Object){if((o-=t=128&i?0:-1)>=1024)throw Error(`pvtlmt`);for(var s in e)(a=+s)<o&&(n[a+t]=e[s],delete e[s]);i=-16760833&i|(1023&o)<<14;break t}}if(t){if((s=Math.max(t,a-(128&i?0:-1)))>1024)throw Error(`spvt`);i=-16760833&i|(1023&s)<<14}}}return WS(e,64|i|r),e}function Dw(e,t){if(typeof e!=`object`)return e;if(Array.isArray(e)){var n=0|e[X];return e.length===0&&1&n?void 0:Ow(e,n,t)}if(e!=null&&e[LS]===qS)return Aw(e);if(e instanceof lw){if(2&(t=e.J))return e;if(!e.size)return;if(n=GS(e.V()),e.K)for(e=0;e<n.length;e++){let r=n[e],i=r[1];i=typeof i!=`object`||!i?void 0:i!=null&&i[LS]===qS?Aw(i):Array.isArray(i)?Ow(i,0|i[X],!!(32&t)):void 0,r[1]=i}return n}return e instanceof yS?e:void 0}function Ow(e,t,n){return 2&t||(!n||4096&t||16&t?e=jw(e,t,!1,n&&!(16&t)):(US(e,34),4&t&&Object.freeze(e))),e}function kw(e,t,n){return e=new e.constructor(t),n&&(e.h=YS),e.m=YS,e}function Aw(e){let t=e.v,n=0|t[X];return JS(e,n)?e:Iw(e,t,n)?kw(e,t):jw(t,n)}function jw(e,t,n,r){return r??=!!(34&t),e=yw(e,t,Dw,r),r=32,n&&(r|=2),WS(e,t=16769217&t|r),e}function Mw(e){let t=e.v,n=0|t[X];return JS(e,n)?Iw(e,t,n)?kw(e,t,!0):new e.constructor(jw(t,n,!1)):e}function Nw(e){if(e.h!==YS)return!1;var t=e.v;return US(t=jw(t,0|t[X]),2048),e.v=t,e.h=void 0,e.m=void 0,!0}function Pw(e){if(!Nw(e)&&JS(e,0|e.v[X]))throw Error()}function Fw(e,t){t===void 0&&(t=0|e[X]),32&t&&!(4096&t)&&WS(e,4096|t)}function Iw(e,t,n){return!!(2&n)||!(!(32&n)||4096&n)&&(WS(t,2|n),e.h=YS,!0)}var Lw=sC(0),Rw={};function zw(e,t,n,r,i){if((t=Bw(e.v,t,n,i))!==null||r&&e.m!==YS)return t}function Bw(e,t,n,r){if(t===-1)return null;let i=t+(n?0:-1),a=e.length-1,o,s;if(!(a<1+(n?0:-1))){if(i>=a)if(o=e[a],typeof o==`object`&&o&&o.constructor===Object)n=o[t],s=!0;else{if(i!==a)return;n=o}else n=e[i];if(r&&n!=null){if((r=r(n))==null)return r;if(!Object.is(r,n))return s?o[t]=r:e[i]=r,r}return n}}function Vw(e,t,n,r){Pw(e),Hw(e=e.v,0|e[X],t,n,r)}function Hw(e,t,n,r,i){let a=n+(i?0:-1);var o=e.length-1;if(o>=1+(i?0:-1)&&a>=o){let i=e[o];if(typeof i==`object`&&i&&i.constructor===Object)return i[n]=r,t}return a<=o?(e[a]=r,t):(r!==void 0&&(n>=(o=(t??=0|e[X])>>14&1023||536870912)?r!=null&&(e[o+(i?0:-1)]={[n]:r}):e[a]=r),t)}function Uw(){return QS===void 0?2:4}function Ww(e,t,n,r,i){let a=e.v,o=0|a[X];r=JS(e,o)?1:r,i=!!i||r===3,r===2&&Nw(e)&&(a=e.v,o=0|a[X]);let s=(e=Kw(a,t))===VS?7:0|e[X],c=qw(s,o);var l=!(4&c);if(l){4&c&&(e=AC(e),s=0,c=dT(c,o),o=Hw(a,o,t,e));let r=0,i=0;for(;r<e.length;r++){let t=n(e[r]);t!=null&&(e[i++]=t)}i<r&&(e.length=i),n=-513&(4|c),c=n&=-1025,c&=-4097}return c!==s&&(WS(e,c),2&c&&Object.freeze(e)),Gw(e,c,a,o,t,r,l,i)}function Gw(e,t,n,r,i,a,o,s){let c=t;return a===1||a===4&&(2&t||!(16&t)&&32&r)?Jw(t)||((t|=!e.length||o&&!(4096&t)||32&r&&!(4096&t||16&t)?2:256)!==c&&WS(e,t),Object.freeze(e)):(a===2&&Jw(t)&&(e=AC(e),c=0,t=dT(t,r),r=Hw(n,r,i,e)),Jw(t)||(s||(t|=16),t!==c&&WS(e,t))),2&t||!(4096&t||16&t)||Fw(n,r),e}function Kw(e,t,n){return e=Bw(e,t,n),Array.isArray(e)?e:VS}function qw(e,t){return 2&t&&(e|=2),1|e}function Jw(e){return!!(2&e)&&!!(4&e)||!!(256&e)}function Yw(e){return XS(e,!0)}function Xw(e){e=AC(e);for(let t=0;t<e.length;t++){let n=e[t]=AC(e[t]);Array.isArray(n[1])&&(n[1]=GS(n[1]))}return KS(e)}function Zw(e,t,n,r){Pw(e),Hw(e=e.v,0|e[X],t,(r===`0`?Number(n)===0:n===r)?void 0:n)}function Qw(e,t,n){if(2&t)throw Error();let r=tC(t),i=Kw(e,n,r),a=i===VS?7:0|i[X],o=qw(a,t);return(2&o||Jw(o)||16&o)&&(o===a||Jw(o)||WS(i,o),i=AC(i),a=0,o=dT(o,t),Hw(e,t,n,i,r)),o&=-13,o!==a&&WS(i,o),i}function $w(e,t){var n=xO;return nT(eT(e=e.v),e,void 0,n)===t?t:-1}function eT(e){if(DS)return e[jS]??(e[jS]=new Map);if(jS in e)return e[jS];let t=new Map;return Object.defineProperty(e,jS,{value:t}),t}function tT(e,t,n,r,i){let a=eT(e),o=nT(a,e,t,n,i);return o!==r&&(o&&(t=Hw(e,t,o,void 0,i)),a.set(n,r)),t}function nT(e,t,n,r,i){let a=e.get(r);if(a!=null)return a;a=0;for(let e=0;e<r.length;e++){let o=r[e];Bw(t,o,i)!=null&&(a!==0&&(n=Hw(t,n,a,void 0,i)),a=o)}return e.set(r,a),a}function rT(e,t,n){let r=0|e[X],i=tC(r),a=Bw(e,n,i),o;if(a!=null&&a[LS]===qS){if(!JS(a))return Nw(a),a.v;o=a.v}else Array.isArray(a)&&(o=a);if(o){let e=0|o[X];2&e&&(o=jw(o,e))}return o=Tw(o,t),o!==a&&Hw(e,r,n,o,i),o}function iT(e,t,n,r,i){let a=!1;if((r=Bw(e,r,i,(e=>{let r=tw(e,n,!1,t);return a=r!==e&&r!=null,r})))!=null)return a&&!JS(r)&&Fw(e,t),r}function aT(e,t,n,r){let i=e.v,a=0|i[X];if((t=iT(i,a,t,n,r))==null)return t;if(a=0|i[X],!JS(e,a)){let o=Mw(t);o!==t&&(Nw(e)&&(i=e.v,a=0|i[X]),a=Hw(i,a,n,t=o,r),Fw(i,a))}return t}function oT(e,t,n,r,i,a,o,s){var c=JS(e,n);a=c?1:a,o=!!o||a===3,c=s&&!c,(a===2||c)&&Nw(e)&&(n=0|(t=e.v)[X]);var l=(e=Kw(t,i))===VS?7:0|e[X],u=qw(l,n);if(s=!(4&u)){var d=e,f=n;let t=!!(2&u);t&&(f|=2);let i=!t,a=!0,o=0,s=0;for(;o<d.length;o++){let e=tw(d[o],r,!1,f);if(e instanceof r){if(!t){let t=JS(e);i&&=!t,a&&=t}d[s++]=e}}s<o&&(d.length=s),u|=4,u=a?-4097&u:4096|u,u=i?8|u:-9&u}if(u!==l&&(WS(e,u),2&u&&Object.freeze(e)),c&&!(8&u||!e.length&&(a===1||a===4&&(2&u||!(16&u)&&32&n)))){for(Jw(u)&&(e=AC(e),u=dT(u,n),n=Hw(t,n,i,e)),r=e,c=u,l=0;l<r.length;l++)(d=r[l])!==(u=Mw(d))&&(r[l]=u);c|=8,WS(e,u=c=r.length?4096|c:-4097&c)}return Gw(e,u,t,n,i,a,s,o)}function sT(e,t,n){let r=e.v;return oT(e,r,0|r[X],t,n,Uw(),!1,!0)}function cT(e){return e??=void 0,e}function lT(e,t,n,r,i){return Vw(e,n,r=cT(r),i),r&&!JS(r)&&Fw(e.v),e}function uT(e,t,n,r){t:{var i=r=cT(r);Pw(e);let a=e.v,o=0|a[X];if(i==null){let e=eT(a);if(nT(e,a,o,n)!==t)break t;e.set(n,0)}else o=tT(a,o,n,t);Hw(a,o,t,i)}r&&!JS(r)&&Fw(e.v)}function dT(e,t){return-273&(2&t?2|e:-3&e)}function fT(e,t,n,r){var i=r;Pw(e),e=oT(e,r=e.v,0|r[X],n,t,2,!0),i??=new n,e.push(i),t=n=e===VS?7:0|e[X],(i=JS(i))?(n&=-9,e.length===1&&(n&=-4097)):n|=4096,n!==t&&WS(e,n),i||Fw(r)}function pT(e,t,n){return UC(zw(e,t,void 0,n))}function mT(e){return(tS?zw(e,2,void 0,void 0,ZC):ZC(zw(e,2)))??Lw}function hT(e,t){return zw(e,t,void 0,void 0,RC)??0}function gT(e,t,n){if(n!=null){if(typeof n!=`number`||!PC(n))throw wS(`int32`);n|=0}Vw(e,t,n)}function _T(e,t,n){Vw(e,t,LC(n))}function vT(e,t,n){Zw(e,t,$C(n),``)}function yT(e,t,n){{Pw(e);let o=e.v,s=0|o[X];if(n==null)Hw(o,s,t);else{var r=e=n===VS?7:0|n[X],i=Jw(e),a=i||Object.isFrozen(n);for(i||(e=0),a||=(n=AC(n),r=0,e=dT(e,s),!1),e|=5,e|=(4&e?512&e?512:1024&e?1024:0:void 0)??(tS?1024:0),i=0;i<n.length;i++){let t=n[i],o=QC(t);Object.is(t,o)||(a&&=(n=AC(n),r=0,e=dT(e,s),!1),n[i]=o)}e!==r&&(a&&(n=AC(n),e=dT(e,s)),WS(n,e)),Hw(o,s,t,n)}}}function bT(e,t,n){Pw(e),Ww(e,t,ew,2,!0).push(QC(n))}var xT=class{constructor(e,t,n){if(this.buffer=e,n&&!t)throw Error();this.g=t}};function ST(e,t){if(typeof e==`string`)return new xT(mS(e),t);if(Array.isArray(e))return new xT(new Uint8Array(e),t);if(e.constructor===Uint8Array)return new xT(e,!1);if(e.constructor===ArrayBuffer)return e=new Uint8Array(e),new xT(e,!1);if(e.constructor===yS)return t=vS(e)||new Uint8Array,new xT(t,!0,e);if(e instanceof Uint8Array)return e=e.constructor===Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new xT(e,!1);throw Error()}function CT(e,t){let n,r=0,i=0,a=0,o=e.h,s=e.g;do n=o[s++],r|=(127&n)<<a,a+=7;while(a<32&&128&n);if(a>32)for(i|=(127&n)>>4,a=3;a<32&&128&n;a+=7)n=o[s++],i|=(127&n)<<a;if(kT(e,s),!(128&n))return t(r>>>0,i>>>0);throw Error()}function wT(e){let t=0,n=e.g,r=n+10,i=e.h;for(;n<r;){let r=i[n++];if(t|=r,!(128&r))return kT(e,n),!!(127&t)}throw Error()}function TT(e){let t=e.h,n=e.g,r=t[n++],i=127&r;if(128&r&&(r=t[n++],i|=(127&r)<<7,128&r&&(r=t[n++],i|=(127&r)<<14,128&r&&(r=t[n++],i|=(127&r)<<21,128&r&&(r=t[n++],i|=r<<28,128&r&&128&t[n++]&&128&t[n++]&&128&t[n++]&&128&t[n++]&&128&t[n++])))))throw Error();return kT(e,n),i}function ET(e){return TT(e)>>>0}function DT(e){var t=e.h;let n=e.g;var r=t[n],i=t[n+1];let a=t[n+2];return t=t[n+3],kT(e,e.g+4),e=2*((i=(r<<0|i<<8|a<<16|t<<24)>>>0)>>31)+1,r=i>>>23&255,i&=8388607,r==255?i?NaN:e*(1/0):r==0?1401298464324817e-60*e*i:e*2**(r-150)*(i+8388608)}function OT(e){return TT(e)}function kT(e,t){if(e.g=t,t>e.l)throw Error()}function AT(e,t){if(t<0)throw Error();let n=e.g;if((t=n+t)>e.l)throw Error();return e.g=t,n}function jT(e,t){if(t==0)return _S();var n=AT(e,t);return e.Y&&e.j?n=e.h.subarray(n,n+t):(e=e.h,n=n===(t=n+t)?new Uint8Array:mC?e.slice(n,t):new Uint8Array(e.subarray(n,t))),n.length==0?_S():new yS(n,gS)}var MT=[];function NT(e,t,n,r){if(HT.length){let i=HT.pop();return i.o(r),i.g.init(e,t,n,r),i}return new VT(e,t,n,r)}function PT(e){e.g.clear(),e.l=-1,e.h=-1,HT.length<100&&HT.push(e)}function FT(e){var t=e.g;if(t.g==t.l)return!1;e.m=e.g.g;var n=ET(e.g);if(t=n>>>3,!((n&=7)>=0&&n<=5)||t<1)throw Error();return e.l=t,e.h=n,!0}function IT(e){switch(e.h){case 0:e.h==0?wT(e.g):IT(e);break;case 1:kT(e=e.g,e.g+8);break;case 2:if(e.h!=2)IT(e);else{var t=ET(e.g);kT(e=e.g,e.g+t)}break;case 5:kT(e=e.g,e.g+4);break;case 3:for(t=e.l;;){if(!FT(e))throw Error();if(e.h==4){if(e.l!=t)throw Error();break}IT(e)}break;default:throw Error()}}function LT(e,t,n){let r=e.g.l;var i=ET(e.g);let a=(i=e.g.g+i)-r;if(a<=0&&(e.g.l=i,n(t,e,void 0,void 0,void 0),a=i-e.g.g),a)throw Error();return e.g.g=i,e.g.l=r,t}function RT(e){var t=ET(e.g),n=AT(e=e.g,t);if(e=e.h,Kx){var r,i=e;(r=Gx)||(r=Gx=new TextDecoder(`utf-8`,{fatal:!0})),t=n+t,i=n===0&&t===i.length?i:i.subarray(n,t);try{var a=r.decode(i)}catch(e){if(Wx===void 0){try{r.decode(new Uint8Array([128]))}catch{}try{r.decode(new Uint8Array([97])),Wx=!0}catch{Wx=!1}}throw!Wx&&(Gx=void 0),e}}else{t=(a=n)+t,n=[];let s,c=null;for(;a<t;){var o=e[a++];o<128?n.push(o):o<224?a>=t?Hx():(s=e[a++],o<194||(192&s)!=128?(a--,Hx()):n.push((31&o)<<6|63&s)):o<240?a>=t-1?Hx():(s=e[a++],(192&s)!=128||o===224&&s<160||o===237&&s>=160||(192&(r=e[a++]))!=128?(a--,Hx()):n.push((15&o)<<12|(63&s)<<6|63&r)):o<=244?a>=t-2?Hx():(s=e[a++],(192&s)!=128||s-144+(o<<28)>>30||(192&(r=e[a++]))!=128||(192&(i=e[a++]))!=128?(a--,Hx()):(o=(7&o)<<18|(63&s)<<12|(63&r)<<6|63&i,o-=65536,n.push(55296+(o>>10&1023),56320+(1023&o)))):Hx(),n.length>=8192&&(c=Ux(c,n),n.length=0)}a=Ux(c,n)}return a}function zT(e){let t=ET(e.g);return jT(e.g,t)}function BT(e,t,n){var r=ET(e.g);for(r=e.g.g+r;e.g.g<r;)n.push(t(e.g))}var VT=class{constructor(e,t,n,r){if(MT.length){let i=MT.pop();i.init(e,t,n,r),e=i}else e=new class{constructor(e,t,n,r){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.init(e,t,n,r)}init(e,t,n,{Y:r=!1,ea:i=!1}={}){this.Y=r,this.ea=i,e&&(e=ST(e,this.ea),this.h=e.buffer,this.j=e.g,this.m=t||0,this.l=n===void 0?this.h.length:this.m+n,this.g=this.m)}clear(){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.Y=!1}}(e,t,n,r);this.g=e,this.m=this.g.g,this.h=this.l=-1,this.o(r)}o({ha:e=!1}={}){this.ha=e}},HT=[];function UT(e){return e?/^\d+$/.test(e)?(OC(e),new WT(gC,_C)):null:GT||=new WT(0,0)}var WT=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},GT;function KT(e){return e?/^-?\d+$/.test(e)?(OC(e),new qT(gC,_C)):null:JT||=new qT(0,0)}var qT=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},JT;function YT(e,t,n){for(;n>0||t>127;)e.g.push(127&t|128),t=(t>>>7|n<<25)>>>0,n>>>=7;e.g.push(t)}function XT(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function ZT(e,t){if(t>=0)XT(e,t);else{for(let n=0;n<9;n++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function QT(e){var t=gC;e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function $T(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function eE(e,t,n){XT(e.g,8*t+n)}function tE(e,t){return eE(e,t,2),t=e.g.end(),$T(e,t),t.push(e.h),t}function nE(e,t){var n=t.pop();for(n=e.h+e.g.length()-n;n>127;)t.push(127&n|128),n>>>=7,e.h++;t.push(n),e.h++}function rE(e,t,n){eE(e,t,2),XT(e.g,n.length),$T(e,e.g.end()),$T(e,n)}function iE(e,t,n,r){n!=null&&(t=tE(e,t),r(n,e),nE(e,t))}function aE(){let e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var oE=aE(),sE=aE(),cE=aE(),lE=aE(),uE=aE(),dE=aE(),fE=aE(),pE=aE(),mE=aE(),hE=aE();function gE(e,t,n){var r=e.v;MS&&MS in r&&(r=r[MS])&&delete r[t.g],t.h?t.j(e,t.h,t.g,n,t.l):t.j(e,t.g,n,t.l)}var Z=class{constructor(e,t){this.v=Ew(e,t,void 0,2048)}toJSON(){return Sw(this)}j(){var e=pk,t=this.v,n=e.g,r=MS;if(DS&&r&&t[r]?.[n]!=null&&TS(NS,3),t=e.g,RS&&MS&&RS===void 0&&(r=(n=this.v)[MS])&&(r=r.da))try{r(n,t,_w)}catch(e){Xx(e)}return e.h?e.m(this,e.h,e.g,e.l):e.m(this,e.g,e.defaultValue,e.l)}clone(){let e=this.v,t=0|e[X];return Iw(this,e,t)?kw(this,e,!0):new this.constructor(jw(e,t,!1))}};Z.prototype[LS]=qS,Z.prototype.toString=function(){return this.v.toString()};var _E=class{constructor(e,t,n){this.g=e,this.h=t,e=oE,this.l=!!e&&n===e||!1}};function vE(e,t){return new _E(e,t,oE)}function yE(e,t,n,r,i){iE(e,n,jE(t,r),i)}var bE=vE((function(e,t,n,r,i){return e.h===2&&(LT(e,rT(t,r,n),i),!0)}),yE),xE=vE((function(e,t,n,r,i){return e.h===2&&(LT(e,rT(t,r,n),i),!0)}),yE),SE=Symbol(),CE=Symbol(),wE=Symbol(),TE=Symbol(),EE=Symbol(),DE,OE;function kE(e,t,n,r){var i=r[e];if(i)return i;(i={}).qa=r,i.T=function(e){switch(typeof e){case`boolean`:return Cw||=[0,void 0,!0];case`number`:return e>0?void 0:e===0?ww||=[0,void 0]:[-e,void 0];case`string`:return[0,e];case`object`:return e}}(r[0]);var a=r[1];let o=1;a&&a.constructor===Object&&(i.ba=a,typeof(a=r[++o])==`function`&&(i.ma=!0,DE??=a,OE??=r[o+1],a=r[o+=2]));let s={};for(;a&&Array.isArray(a)&&a.length&&typeof a[0]==`number`&&a[0]>0;){for(var c=0;c<a.length;c++)s[a[c]]=a;a=r[++o]}for(c=1;a!==void 0;){let e;typeof a==`number`&&(c+=a,a=r[++o]);var l=void 0;if(a instanceof _E?e=a:(e=bE,o--),e?.l){a=r[++o],l=r;var u=o;typeof a==`function`&&(a=a(),l[u]=a),l=a}for(u=c+1,typeof(a=r[++o])==`number`&&a<0&&(u-=a,a=r[++o]);c<u;c++){let r=s[c];l?n(i,c,e,l,r):t(i,c,e,r)}}return r[e]=i}function AE(e){return Array.isArray(e)?e[0]instanceof _E?e:[xE,e]:[e,void 0]}function jE(e,t){return e instanceof Z?e.v:Array.isArray(e)?Tw(e,t):void 0}function ME(e,t,n,r){let i=n.g;e[t]=r?(e,t,n)=>i(e,t,n,r):i}function NE(e,t,n,r,i){let a=n.g,o,s;e[t]=(e,t,n)=>a(e,t,n,s||=kE(CE,ME,NE,r).T,o||=PE(r),i)}function PE(e){let t=e[wE];if(t!=null)return t;let n=kE(CE,ME,NE,e);return t=n.ma?(e,t)=>DE(e,t,n):(e,t)=>{for(;FT(t)&&t.h!=4;){var r=t.l,i=n[r];if(i==null){var a=n.ba;(a&&=a[r])&&(a=IE(a))!=null&&(i=n[r]=a)}if(i==null||!i(t,e,r)){if(i=(a=t).m,IT(a),a.ha)var o=void 0;else o=a.g.g-i,a.g.g=i,o=jT(a.g,o);i=void 0,a=e,o&&((i=a[MS]??(a[MS]=new gw))[r]??(i[r]=[])).push(o)}}return(e=mw(e))&&(e.da=n.qa[EE]),!0},e[wE]=t,e[EE]=FE.bind(e),t}function FE(e,t,n,r){var i=this[CE];let a=this[wE],o=Tw(void 0,i.T),s=mw(e);if(s){var c=!1,l=i.ba;if(l){if(i=(t,n,i)=>{if(i.length!==0)if(l[n])for(let e of i){t=NT(e);try{c=!0,a(o,t)}finally{PT(t)}}else r?.(e,n,i)},t==null)hw(s,i);else if(s!=null){let e=s[t];e&&i(s,t,e)}if(c){let r=0|e[X];if(2&r&&2048&r&&!n?.Ka)throw Error();let i=tC(r),a=(t,a)=>{if(Bw(e,t,i)!=null){if(n?.Qa===1)return;throw Error()}a!=null&&(r=Hw(e,r,t,a,i)),delete s[t]};t==null?$S(o,0|o[X],((e,t)=>{a(e,t)})):a(t,Bw(o,t,i))}}}}function IE(e){let t=(e=AE(e))[0].g;if(e=e[1]){let n=PE(e),r=kE(CE,ME,NE,e).T;return(e,i,a)=>t(e,i,a,r,n)}return t}function LE(e,t,n){e[t]=n.h}function RE(e,t,n,r){let i,a,o=n.h;e[t]=(e,t,n)=>o(e,t,n,a||=kE(SE,LE,RE,r).T,i||=zE(r))}function zE(e){let t=e[TE];if(!t){let n=kE(SE,LE,RE,e);t=(e,t)=>BE(e,t,n),e[TE]=t}return t}function BE(e,t,n){$S(e,0|e[X],((e,r)=>{if(r!=null){var i=function(e,t){var n=e[t];if(n)return n;if((n=e.ba)&&(n=n[t])){var r=(n=AE(n))[0].h;if(n=n[1]){let t=zE(n),i=kE(SE,LE,RE,n).T;n=e.ma?OE(i,t):(e,n,a)=>r(e,n,a,i,t)}else n=r;return e[t]=n}}(n,e);i?i(t,r,e):e<500||TS(FS,3)}})),(e=mw(e))&&hw(e,((e,n,r)=>{for($T(t,t.g.end()),e=0;e<r.length;e++)$T(t,vS(r[e])||new Uint8Array)}))}var VE=sC(0);function HE(e,t){if(Array.isArray(t)){var n=0|t[X];if(4&n)return t;for(var r=0,i=0;r<t.length;r++){let n=e(t[r]);n!=null&&(t[i++]=n)}return i<r&&(t.length=i),(e=-1537&(5|n))!==n&&WS(t,e),2&e&&Object.freeze(t),t}}function UE(e,t,n){return new _E(e,t,n)}function WE(e,t,n){return new _E(e,t,n)}function GE(e,t,n){Hw(e,0|e[X],t,n,tC(0|e[X]))}var KE=vE((function(e,t,n,r,i){if(e.h!==2)return!1;if(e=AC(e=LT(e,Tw([void 0,void 0],r),i)),i=tC(r=0|t[X]),2&r)throw Error();let a=Bw(t,n,i);if(a instanceof lw)2&a.J?(a=a.V(),a.push(e),Hw(t,r,n,a,i)):a.Ma(e);else if(Array.isArray(a)){var o=0|a[X];8192&o||WS(a,o|=8192),2&o&&(a=Xw(a),Hw(t,r,n,a,i)),a.push(e)}else Hw(t,r,n,KS([e]),i);return!0}),(function(e,t,n,r,i){if(t instanceof lw)t.forEach(((t,a)=>{iE(e,n,Tw([a,t],r),i)}));else if(Array.isArray(t)){for(let a=0;a<t.length;a++){let o=t[a];Array.isArray(o)&&iE(e,n,Tw(o,r),i)}KS(t)}}));function qE(e,t,n){(t=RC(t))!=null&&(eE(e,n,5),e=e.g,bC(t),QT(e))}function JE(e,t,n){if(t=function(e){if(e==null)return e;let t=typeof e;if(t===`bigint`)return String(jC(64,e));if(HC(e)){if(t===`string`)return qC(e);if(t===`number`)return KC(e)}}(t),t!=null&&(typeof t==`string`&&KT(t),t!=null))switch(eE(e,n,0),typeof t){case`number`:e=e.g,yC(t),YT(e,gC,_C);break;case`bigint`:n=BigInt.asUintN(64,t),n=new qT(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),YT(e.g,n.h,n.g);break;default:n=KT(t),YT(e.g,n.h,n.g)}}function YE(e,t,n){(t=UC(t))!=null&&t!=null&&(eE(e,n,0),ZT(e.g,t))}function XE(e,t,n){(t=BC(t))!=null&&(eE(e,n,0),e.g.g.push(t?1:0))}function ZE(e,t,n){(t=ew(t))!=null&&rE(e,n,Yx(t))}function QE(e,t,n,r,i){iE(e,n,jE(t,r),i)}function $E(e,t,n){(t=t==null||typeof t==`string`||t instanceof yS?t:void 0)!=null&&rE(e,n,ST(t,!0).buffer)}function eD(e,t,n){return(e.h===5||e.h===2)&&(t=Qw(t,0|t[X],n),e.h==2?BT(e,DT,t):t.push(DT(e.g)),!0)}var tD=UE((function(e,t,n){return e.h===5&&(GE(t,n,DT(e.g)),!0)}),qE,pE),nD=WE(eD,(function(e,t,n){if((t=HE(RC,t))!=null)for(let o=0;o<t.length;o++){var r=e,i=n,a=t[o];a!=null&&(eE(r,i,5),r=r.g,bC(a),QT(r))}}),pE),rD=WE(eD,(function(e,t,n){if((t=HE(RC,t))!=null&&t.length){eE(e,n,2),XT(e.g,4*t.length);for(let r=0;r<t.length;r++)n=e.g,bC(t[r]),QT(n)}}),pE),iD=UE((function(e,t,n){return e.h===5&&(GE(t,n,(e=DT(e.g))===0?void 0:e),!0)}),qE,pE),aD=UE((function(e,t,n){return eS?(e.h===0?(GE(t,n,CT(e.g,wC)),e=!0):e=!1,e):e.h===0&&(GE(t,n,CT(e.g,CC)),!0)}),JE,dE),oD=UE((function(e,t,n){return eS?(e.h===0?(GE(t,n,(e=CT(e.g,wC))===VE?void 0:e),t=!0):t=!1,t):e.h===0&&(GE(t,n,(e=CT(e.g,CC))===0?void 0:e),!0)}),JE,dE),sD=UE((function(e,t,n){return eS?(e.h===0?(GE(t,n,CT(e.g,SC)),e=!0):e=!1,e):e.h===0&&(GE(t,n,CT(e.g,xC)),!0)}),(function(e,t,n){if(t=function(e){if(e==null)return e;var t=typeof e;if(t===`bigint`)return String(MC(64,e));if(HC(e)){if(t===`string`)return t=FC(Number(e)),NC(t)&&t>=0?e=String(t):((t=e.indexOf(`.`))!==-1&&(e=e.substring(0,t)),(t=e[0]!==`-`&&((t=e.length)<20||t===20&&e<=`18446744073709551615`))||(OC(e),e=TC(gC,_C))),e;if(t===`number`)return(e=FC(e))>=0&&NC(e)||(yC(e),e=xC(gC,_C)),e}}(t),t!=null&&(typeof t==`string`&&UT(t),t!=null))switch(eE(e,n,0),typeof t){case`number`:e=e.g,yC(t),YT(e,gC,_C);break;case`bigint`:n=BigInt.asUintN(64,t),n=new WT(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),YT(e.g,n.h,n.g);break;default:n=UT(t),YT(e.g,n.h,n.g)}}),fE),cD=UE((function(e,t,n){return e.h===0&&(GE(t,n,TT(e.g)),!0)}),YE,lE),lD=WE((function(e,t,n){return(e.h===0||e.h===2)&&(t=Qw(t,0|t[X],n),e.h==2?BT(e,TT,t):t.push(TT(e.g)),!0)}),(function(e,t,n){if((t=HE(UC,t))!=null&&t.length){n=tE(e,n);for(let n=0;n<t.length;n++)ZT(e.g,t[n]);nE(e,n)}}),lE),uD=UE((function(e,t,n){return e.h===0&&(GE(t,n,(e=TT(e.g))===0?void 0:e),!0)}),YE,lE),dD=UE((function(e,t,n){return e.h===0&&(GE(t,n,wT(e.g)),!0)}),XE,sE),fD=UE((function(e,t,n){return e.h===0&&(GE(t,n,!1===(e=wT(e.g))?void 0:e),!0)}),XE,sE),pD=WE((function(e,t,n){return e.h===2&&(e=RT(e),Qw(t,0|t[X],n).push(e),!0)}),(function(e,t,n){if((t=HE(ew,t))!=null)for(let o=0;o<t.length;o++){var r=e,i=n,a=t[o];a!=null&&rE(r,i,Yx(a))}}),cE),mD=UE((function(e,t,n){return e.h===2&&(GE(t,n,(e=RT(e))===``?void 0:e),!0)}),ZE,cE),hD=UE((function(e,t,n){return e.h===2&&(GE(t,n,RT(e)),!0)}),ZE,cE),gD=function(e,t,n=oE){return new _E(e,t,n)}((function(e,t,n,r,i){return e.h===2&&(r=Tw(void 0,r),Qw(t,0|t[X],n).push(r),LT(e,r,i),!0)}),(function(e,t,n,r,i){if(Array.isArray(t)){for(let a=0;a<t.length;a++)QE(e,t[a],n,r,i);1&(e=0|t[X])||WS(t,1|e)}})),_D=vE((function(e,t,n,r,i,a){if(e.h!==2)return!1;let o=0|t[X];return tT(t,o,a,n,tC(o)),LT(e,t=rT(t,r,n),i),!0}),QE),vD=UE((function(e,t,n){return e.h===2&&(GE(t,n,zT(e)),!0)}),$E,mE),yD=WE((function(e,t,n){return(e.h===0||e.h===2)&&(t=Qw(t,0|t[X],n),e.h==2?BT(e,ET,t):t.push(ET(e.g)),!0)}),(function(e,t,n){if((t=HE(WC,t))!=null)for(let o=0;o<t.length;o++){var r=e,i=n,a=t[o];a!=null&&(eE(r,i,0),XT(r.g,a))}}),uE),bD=UE((function(e,t,n){return e.h===0&&(GE(t,n,(e=ET(e.g))===0?void 0:e),!0)}),(function(e,t,n){(t=WC(t))!=null&&t!=null&&(eE(e,n,0),XT(e.g,t))}),uE),xD=UE((function(e,t,n){return e.h===0&&(GE(t,n,TT(e.g)),!0)}),(function(e,t,n){(t=UC(t))!=null&&(t=parseInt(t,10),eE(e,n,0),ZT(e.g,t))}),hE),SD=class{constructor(e,t){var n=BD;this.g=e,this.h=t,this.m=aT,this.j=lT,this.defaultValue=void 0,this.l=n.Oa==null?void 0:eC}register(){iS(this)}};function CD(e,t){return new SD(e,t)}function wD(e,t){return(n,r)=>{{let a={ea:!0};r&&Object.assign(a,r),n=NT(n,void 0,void 0,a);try{let r=new e,a=r.v;PE(t)(a,n);var i=r}finally{PT(n)}}return i}}function TD(e){return function(){let t=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){let e=this.g;return this.g=[],e}}}};BE(this.v,t,kE(SE,LE,RE,e)),$T(t,t.g.end());let n=new Uint8Array(t.h),r=t.l,i=r.length,a=0;for(let e=0;e<i;e++){let t=r[e];n.set(t,a),a+=t.length}return t.l=[n],n}}var ED=class extends Z{constructor(e){super(e)}},DD=[0,mD,UE((function(e,t,n){return e.h===2&&(GE(t,n,(e=zT(e))===_S()?void 0:e),!0)}),(function(e,t,n){if(t!=null){if(t instanceof Z){let r=t.Ra;r?(t=r(t),t!=null&&rE(e,n,ST(t,!0).buffer)):TS(FS,3);return}if(Array.isArray(t))return void TS(FS,3)}$E(e,t,n)}),mE)],OD,kD=globalThis.trustedTypes;function AD(e){var t;return OD===void 0&&(OD=function(){let e=null;if(!kD)return e;try{let t=e=>e;e=kD.createPolicy(`goog#html`,{createHTML:t,createScript:t,createScriptURL:t})}catch{}return e}()),e=(t=OD)?t.createScriptURL(e):e,new class{constructor(e){this.g=e}toString(){return this.g+``}}(e)}function jD(e,...t){if(t.length===0)return AD(e[0]);let n=e[0];for(let r=0;r<t.length;r++)n+=encodeURIComponent(t[r])+e[r+1];return AD(n)}var MD=[0,cD,xD,dD,-1,lD,xD,-1,dD],ND=class extends Z{constructor(e){super(e)}},PD=[0,dD,hD,dD,xD,-1,WE((function(e,t,n){return(e.h===0||e.h===2)&&(t=Qw(t,0|t[X],n),e.h==2?BT(e,OT,t):t.push(TT(e.g)),!0)}),(function(e,t,n){if((t=HE(UC,t))!=null&&t.length){n=tE(e,n);for(let n=0;n<t.length;n++)ZT(e.g,t[n]);nE(e,n)}}),hE),hD,-1,[0,dD,-1],xD,dD,-1],FD=[0,3,dD,-1,2,[0,cD],[0,xD,dD],[0,hD,-1],[0]],ID=[0,hD,-2],LD=class extends Z{constructor(e){super(e)}},RD=[0],zD=[0,cD,dD,1,dD,-4],BD=class extends Z{constructor(e){super(e,2)}},VD={};VD[336783863]=[0,hD,dD,-1,cD,[0,[1,2,3,4,5,6,7,8,9],_D,RD,_D,PD,_D,ID,_D,zD,_D,MD,_D,[0,hD,-2],_D,[0,hD,xD],_D,FD,_D,[0,xD,-1,dD]],[0,hD],dD,[0,[1,3],[2,4],_D,[0,lD],-1,_D,[0,pD],-1,gD,[0,hD,-1]],hD];var HD=[0,oD,-1,fD,-3,oD,lD,mD,uD,oD,-1,fD,uD,fD,-2,mD];function UD(e,t){bT(e,3,t)}function WD(e,t){bT(e,4,t)}var GD=class extends Z{constructor(e){super(e,500)}o(e){return lT(this,0,7,e)}},KD=[-1,{}],qD=[0,hD,1,KD],JD=[0,hD,pD,KD];function YD(e,t){fT(e,1,GD,t)}function XD(e,t){bT(e,10,t)}function ZD(e,t){bT(e,15,t)}var QD=class extends Z{constructor(e){super(e,500)}o(e){return lT(this,0,1001,e)}},$D=[-500,gD,[-500,mD,-1,pD,-3,[-2,VD,dD],gD,DD,uD,-1,qD,JD,gD,[0,mD,fD],mD,HD,uD,pD,987,pD],4,gD,[-500,hD,-1,[-1,{}],998,hD],gD,[-500,hD,pD,-1,[-2,{},dD],997,pD,-1],uD,gD,[-500,hD,pD,KD,998,pD],pD,uD,qD,JD,gD,[0,mD,-1,KD],pD,-2,HD,mD,-1,fD,[0,fD,bD],978,KD,gD,DD];QD.prototype.g=TD($D);var eO=wD(QD,$D),tO=class extends Z{constructor(e){super(e)}},nO=class extends Z{constructor(e){super(e)}g(){return sT(this,tO,1)}},rO=[0,gD,[0,cD,tD,hD,-1]],iO=wD(nO,rO),aO=class extends Z{constructor(e){super(e)}},oO=class extends Z{constructor(e){super(e)}},sO=class extends Z{constructor(e){super(e)}l(){return aT(this,aO,2)}g(){return sT(this,oO,5)}},cO=wD(class extends Z{constructor(e){super(e)}},[0,pD,lD,rD,[0,xD,[0,cD,-3],[0,tD,-3],[0,cD,-1,[0,gD,[0,cD,-2]]],gD,[0,tD,-1,hD,tD]],hD,-1,aD,gD,[0,cD,tD],pD,aD]),lO=class extends Z{constructor(e){super(e)}},uO=wD(class extends Z{constructor(e){super(e)}},[0,gD,[0,tD,-4]]),dO=class extends Z{constructor(e){super(e)}},fO=wD(class extends Z{constructor(e){super(e)}},[0,gD,[0,tD,-4]]),pO=class extends Z{constructor(e){super(e)}},mO=[0,cD,-1,rD,xD],hO=class extends Z{constructor(e){super(e)}};hO.prototype.g=TD([0,tD,-4,aD]);var gO=class extends Z{constructor(e){super(e)}},_O=wD(class extends Z{constructor(e){super(e)}},[0,gD,[0,1,cD,hD,rO],aD]),vO=class extends Z{constructor(e){super(e)}},yO=class extends Z{constructor(e){super(e)}na(){return zw(this,1,void 0,void 0,Yw)??_S()}},bO=class extends Z{constructor(e){super(e)}},xO=[1,2],SO=wD(class extends Z{constructor(e){super(e)}},[0,gD,[0,xO,_D,[0,rD],_D,[0,vD],cD,hD],aD]),CO=class extends Z{constructor(e){super(e)}},wO=[0,hD,cD,tD,pD,-1],TO=class extends Z{constructor(e){super(e)}},EO=[0,dD,-1],DO=class extends Z{constructor(e){super(e)}},OO=[1,2,3,4,5,6],kO=class extends Z{constructor(e){super(e)}g(){return zw(this,1,void 0,void 0,Yw)!=null}l(){return ew(zw(this,2))!=null}},AO=class extends Z{constructor(e){super(e)}g(){return BC(zw(this,2))??!1}},jO=[0,vD,hD,[0,cD,aD,-1],[0,sD,aD]],MO=[0,jO,dD,[0,OO,_D,zD,_D,PD,_D,MD,_D,RD,_D,ID,_D,FD],xD],NO=class extends Z{constructor(e){super(e)}},PO=[0,MO,tD,-1,cD],FO=CD(502141897,NO);VD[502141897]=PO;var IO=wD(class extends Z{constructor(e){super(e)}},[0,[0,xD,-1,nD,yD],mO]),LO=class extends Z{constructor(e){super(e)}},RO=class extends Z{constructor(e){super(e)}},zO=[0,MO,tD,[0,MO],dD],BO=CD(508968150,RO);VD[508968150]=[0,MO,PO,zO,tD,[0,[0,jO]]],VD[508968149]=zO;var VO=class extends Z{constructor(e){super(e)}l(){return aT(this,CO,2)}g(){Vw(this,2)}},HO=[0,MO,wO];VD[478825465]=HO;var UO=class extends Z{constructor(e){super(e)}},WO=class extends Z{constructor(e){super(e)}},GO=class extends Z{constructor(e){super(e)}},KO=class extends Z{constructor(e){super(e)}},qO=class extends Z{constructor(e){super(e)}},JO=[0,MO,[0,MO],HO,-1],YO=[0,MO,tD,cD],XO=[0,MO,tD],ZO=[0,MO,YO,XO,tD],QO=CD(479097054,qO);VD[479097054]=[0,MO,ZO,JO],VD[463370452]=JO,VD[464864288]=YO;var $O=CD(462713202,KO);VD[462713202]=ZO,VD[474472470]=XO;var ek=class extends Z{constructor(e){super(e)}},tk=class extends Z{constructor(e){super(e)}},nk=class extends Z{constructor(e){super(e)}},rk=class extends Z{constructor(e){super(e)}},ik=[0,MO,tD,-1,cD],ak=[0,MO,tD,dD];rk.prototype.g=TD([0,MO,XO,[0,MO],PO,zO,ik,ak]);var ok=class extends Z{constructor(e){super(e)}},sk=CD(456383383,ok);VD[456383383]=[0,MO,wO];var ck=class extends Z{constructor(e){super(e)}},lk=CD(476348187,ck);VD[476348187]=[0,MO,EO];var uk=class extends Z{constructor(e){super(e)}},dk=class extends Z{constructor(e){super(e)}},fk=[0,xD,-1],pk=CD(458105876,class extends Z{constructor(e){super(e)}g(){let e;var t=this.v;let n=0|t[X];return e=JS(this,n),t=function(e,t,n,r){var i=dk;!r&&Nw(e)&&(n=0|(t=e.v)[X]);var a=Bw(t,2);if(e=!1,a==null){if(r)return pw();a=[]}else if(a.constructor===lw){if(!(2&a.J)||r)return a;a=a.V()}else Array.isArray(a)?e=!!(2&(0|a[X])):a=[];if(r){if(!a.length)return pw();e||(e=!0,GS(a))}else e&&(e=!1,KS(a),a=Xw(a));return!e&&32&n&&US(a,32),n=Hw(t,n,2,r=new lw(a,i,nw,void 0)),e||Fw(t,n),r}(this,t,n,e),!e&&dk&&(t.ra=!0),t}});VD[458105876]=[0,fk,KE,[!0,aD,[0,hD,-1,pD]],[0,lD,dD,xD]];var mk=class extends Z{constructor(e){super(e)}},hk=CD(458105758,mk);VD[458105758]=[0,MO,hD,fk];var gk=class extends Z{constructor(e){super(e)}},_k=[0,iD,-1,fD],vk=class extends Z{constructor(e){super(e)}},yk=class extends Z{constructor(e){super(e)}},bk=[1,2];yk.prototype.g=TD([0,bk,_D,_k,_D,[0,gD,_k]]);var xk=class extends Z{constructor(e){super(e)}},Sk=CD(443442058,xk);VD[443442058]=[0,MO,hD,cD,tD,pD,-1,dD,tD],VD[514774813]=ik;var Ck=class extends Z{constructor(e){super(e)}},wk=CD(516587230,Ck);function Tk(e,t){return t=t?t.clone():new CO,e.displayNamesLocale===void 0?e.displayNamesLocale===void 0&&Vw(t,1):Vw(t,1,$C(e.displayNamesLocale)),e.maxResults===void 0?`maxResults`in e&&Vw(t,2):gT(t,2,e.maxResults),e.scoreThreshold===void 0?`scoreThreshold`in e&&Vw(t,3):_T(t,3,e.scoreThreshold),e.categoryAllowlist===void 0?`categoryAllowlist`in e&&Vw(t,4):yT(t,4,e.categoryAllowlist),e.categoryDenylist===void 0?`categoryDenylist`in e&&Vw(t,5):yT(t,5,e.categoryDenylist),t}function Ek(e){let t=Number(e);return Number.isSafeInteger(t)?t:String(e)}function Dk(e,t=-1,n=``){return{categories:e.map((e=>({index:pT(e,1)??0??-1,score:hT(e,2)??0,categoryName:ew(zw(e,3))??``??``,displayName:ew(zw(e,4))??``??``}))),headIndex:t,headName:n}}function Ok(e){let t={classifications:sT(e,gO,1).map((e=>Dk(aT(e,nO,4)?.g()??[],pT(e,2)??0,ew(zw(e,3))??``)))};return function(e){return XC(tS?zw(e,2,void 0,void 0,ZC):zw(e,2))}(e)!=null&&(t.timestampMs=Ek(mT(e))),t}function kk(e){var t=Ww(e,3,RC,Uw()),n=Ww(e,2,UC,Uw()),r=Ww(e,1,ew,Uw()),i=Ww(e,9,ew,Uw());let a={categories:[],keypoints:[]};for(let e=0;e<t.length;e++)a.categories.push({score:t[e],index:n[e]??-1,categoryName:r[e]??``,displayName:i[e]??``});if((t=aT(e,sO,4)?.l())&&(a.boundingBox={originX:pT(t,1,Rw)??0,originY:pT(t,2,Rw)??0,width:pT(t,3,Rw)??0,height:pT(t,4,Rw)??0,angle:0}),aT(e,sO,4)?.g().length)for(let t of aT(e,sO,4).g())a.keypoints.push({x:zw(t,1,void 0,Rw,RC)??0,y:zw(t,2,void 0,Rw,RC)??0,score:zw(t,4,void 0,Rw,RC)??0,label:ew(zw(t,3,void 0,Rw))??``});return a}function Ak(e){let t=[];for(let n of sT(e,dO,1))t.push({x:hT(n,1)??0,y:hT(n,2)??0,z:hT(n,3)??0,visibility:hT(n,4)??0});return t}function jk(e){let t=[];for(let n of sT(e,lO,1))t.push({x:hT(n,1)??0,y:hT(n,2)??0,z:hT(n,3)??0,visibility:hT(n,4)??0});return t}function Mk(e){return Array.from(e,(e=>e>127?e-256:e))}function Nk(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let n=0,r=0,i=0;for(let a=0;a<e.length;a++)n+=e[a]*t[a],r+=e[a]*e[a],i+=t[a]*t[a];if(r<=0||i<=0)throw Error(`Cannot compute cosine similarity on embedding with 0 norm.`);return n/Math.sqrt(r*i)}var Pk;VD[516587230]=[0,MO,ik,ak,tD],VD[518928384]=ak;var Fk=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function Ik(){if(Pk===void 0)try{await WebAssembly.instantiate(Fk),Pk=!0}catch{Pk=!1}return Pk}async function Lk(e,t=jD``){let n=await Ik()?`wasm_internal`:`wasm_nosimd_internal`;return{wasmLoaderPath:`${t}/${e}_${n}.js`,wasmBinaryPath:`${t}/${e}_${n}.wasm`}}var Rk=class{};function zk(){var e=navigator;return typeof OffscreenCanvas<`u`&&(!function(e=navigator){return(e=e.userAgent).includes(`Safari`)&&!e.includes(`Chrome`)}(e)||!!((e=e.userAgent.match(/Version\/([\d]+).*Safari/))&&e.length>=1&&Number(e[1])>=17))}async function Bk(e){if(typeof importScripts!=`function`){let t=document.createElement(`script`);return t.src=e.toString(),t.crossOrigin=`anonymous`,new Promise(((e,n)=>{t.addEventListener(`load`,(()=>{e()}),!1),t.addEventListener(`error`,(e=>{n(e)}),!1),document.body.appendChild(t)}))}try{importScripts(e.toString())}catch(t){if(!(t instanceof TypeError))throw t;await self.import(e.toString())}}function Vk(e){return e.videoWidth===void 0?e.naturalWidth===void 0?e.displayWidth===void 0?[e.width,e.height]:[e.displayWidth,e.displayHeight]:[e.naturalWidth,e.naturalHeight]:[e.videoWidth,e.videoHeight]}function Q(e,t,n){e.m||console.error(`No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target`),n(t=e.i.stringToNewUTF8(t)),e.i._free(t)}function Hk(e,t,n){if(!e.i.canvas)throw Error(`No OpenGL canvas configured.`);if(n?e.i._bindTextureToStream(n):e.i._bindTextureToCanvas(),!(n=e.i.canvas.getContext(`webgl2`)||e.i.canvas.getContext(`webgl`)))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");e.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t),e.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1);let[r,i]=Vk(t);return!e.l||r===e.i.canvas.width&&i===e.i.canvas.height||(e.i.canvas.width=r,e.i.canvas.height=i),[r,i]}function Uk(e,t,n){e.m||console.error(`No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target`);let r=new Uint32Array(t.length);for(let n=0;n<t.length;n++)r[n]=e.i.stringToNewUTF8(t[n]);t=e.i._malloc(4*r.length),e.i.HEAPU32.set(r,t>>2),n(t);for(let t of r)e.i._free(t);e.i._free(t)}function Wk(e,t,n){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=n}function Gk(e,t,n){let r=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(e,t,i)=>{t?(n(r,i),r=[]):r.push(e)}}Rk.forVisionTasks=function(e){return Lk(`vision`,e)},Rk.forTextTasks=function(e){return Lk(`text`,e)},Rk.forGenAiExperimentalTasks=function(e){return Lk(`genai_experimental`,e)},Rk.forGenAiTasks=function(e){return Lk(`genai`,e)},Rk.forAudioTasks=function(e){return Lk(`audio`,e)},Rk.isSimdSupported=function(){return Ik()};async function Kk(e,t,n,r){return e=await(async(e,t,n,r,i)=>{if(t&&await Bk(t),!self.ModuleFactory||n&&(await Bk(n),!self.ModuleFactory))throw Error(`ModuleFactory not set.`);return self.Module&&i&&((t=self.Module).locateFile=i.locateFile,i.mainScriptUrlOrBlob&&(t.mainScriptUrlOrBlob=i.mainScriptUrlOrBlob)),i=await self.ModuleFactory(self.Module||i),self.ModuleFactory=self.Module=void 0,new e(i,r)})(e,n.wasmLoaderPath,n.assetLoaderPath,t,{locateFile:e=>e.endsWith(`.wasm`)?n.wasmBinaryPath.toString():n.assetBinaryPath&&e.endsWith(`.data`)?n.assetBinaryPath.toString():e}),await e.o(r),e}function qk(e,t){let n=aT(e.baseOptions,kO,1)||new kO;typeof t==`string`?(Vw(n,2,$C(t)),Vw(n,1)):t instanceof Uint8Array&&(Vw(n,1,XS(t,!1)),Vw(n,2)),lT(e.baseOptions,0,1,n)}function Jk(e){try{let t=e.H.length;if(t===1)throw Error(e.H[0].message);if(t>1)throw Error(`Encountered multiple errors: `+e.H.map((e=>e.message)).join(`, `))}finally{e.H=[]}}function $(e,t){e.C=Math.max(e.C,t)}function Yk(e,t){e.B=new GD,vT(e.B,2,`PassThroughCalculator`),UD(e.B,`free_memory`),WD(e.B,`free_memory_unused_out`),XD(t,`free_memory`),YD(t,e.B)}function Xk(e,t){UD(e.B,t),WD(e.B,t+`_unused_out`)}function Zk(e){e.g.addBoolToStream(!0,`free_memory`,e.C)}var Qk=class{constructor(e){this.g=e,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){if(t){let t=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error(`Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer`);if(!(aT(this.baseOptions,kO,1)?.g()||aT(this.baseOptions,kO,1)?.l()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error(`Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set`);if(function(e,t){let n=aT(e.baseOptions,DO,3);if(!n){var r=n=new DO,i=new LD;uT(r,4,OO,i)}`delegate`in t&&(t.delegate===`GPU`?(t=n,r=new ND,uT(t,2,OO,r)):(t=n,r=new LD,uT(t,4,OO,r))),lT(e.baseOptions,0,3,n)}(this,t),t.modelAssetPath)return fetch(t.modelAssetPath.toString()).then((e=>{if(e.ok)return e.arrayBuffer();throw Error(`Failed to fetch model: ${t.modelAssetPath} (${e.status})`)})).then((e=>{try{this.g.i.FS_unlink(`/model.dat`)}catch{}this.g.i.FS_createDataFile(`/`,`model.dat`,new Uint8Array(e),!0,!1,!1),qk(this,`/model.dat`),this.m(),this.L()}));if(t.modelAssetBuffer instanceof Uint8Array)qk(this,t.modelAssetBuffer);else if(t.modelAssetBuffer)return async function(e){let t=[];for(var n=0;;){let{done:r,value:i}=await e.read();if(r)break;t.push(i),n+=i.length}if(t.length===0)return new Uint8Array;if(t.length===1)return t[0];e=new Uint8Array(n),n=0;for(let r of t)e.set(r,n),n+=r.length;return e}(t.modelAssetBuffer).then((e=>{qk(this,e),this.m(),this.L()}))}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let e;if(this.g.ca((t=>{e=eO(t)})),!e)throw Error(`Failed to retrieve CalculatorGraphConfig`);return e}setGraph(e,t){this.g.attachErrorListener(((e,t)=>{this.H.push(Error(t))})),this.g.Ja(),this.g.setGraph(e,t),this.B=void 0,Jk(this)}finishProcessing(){this.g.finishProcessing(),Jk(this)}close(){this.B=void 0,this.g.closeGraph()}};function $k(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Qk.prototype.close=Qk.prototype.close;var eA=class{constructor(e,t,n,r){this.g=e,this.h=t,this.m=n,this.l=r}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}};function tA(e,t,n){let r=e.g;if(n=$k(r.createShader(n),`Failed to create WebGL shader`),r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${r.getShaderInfoLog(n)}`);return r.attachShader(e.h,n),n}function nA(e,t){let n=e.g,r=$k(n.createVertexArray(),`Failed to create vertex array`);n.bindVertexArray(r);let i=$k(n.createBuffer(),`Failed to create buffer`);n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(e.O),n.vertexAttribPointer(e.O,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),n.STATIC_DRAW);let a=$k(n.createBuffer(),`Failed to create buffer`);return n.bindBuffer(n.ARRAY_BUFFER,a),n.enableVertexAttribArray(e.L),n.vertexAttribPointer(e.L,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array(t?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindVertexArray(null),new eA(n,r,i,a)}function rA(e,t){if(e.g){if(t!==e.g)throw Error(`Cannot change GL context once initialized`)}else e.g=t}function iA(e,t,n,r){return rA(e,t),e.h||(e.m(),e.D()),n?(e.u||=nA(e,!0),n=e.u):(e.A||=nA(e,!1),n=e.A),t.useProgram(e.h),n.bind(),e.l(),e=r(),n.g.bindVertexArray(null),e}function aA(e,t,n){return rA(e,t),e=$k(t.createTexture(),`Failed to create texture`),t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n??t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n??t.LINEAR),t.bindTexture(t.TEXTURE_2D,null),e}function oA(e,t,n){rA(e,t),e.B||=$k(t.createFramebuffer(),`Failed to create framebuffe.`),t.bindFramebuffer(t.FRAMEBUFFER,e.B),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0)}function sA(e){e.g?.bindFramebuffer(e.g.FRAMEBUFFER,null)}var cA=class{H(){return`
4376
4376
  precision mediump float;
4377
4377
  varying vec2 vTex;
4378
4378
  uniform sampler2D inputTexture;
@@ -4412,4 +4412,4 @@ void main() {
4412
4412
  overlayColor = mix(defaultColor, overlayColor, overlayColor.a);
4413
4413
  gl_FragColor = mix(defaultColor, overlayColor, confidence);
4414
4414
  }
4415
- `}D(){let e=this.g;e.activeTexture(e.TEXTURE1),this.j=aA(this,e),e.activeTexture(e.TEXTURE2),this.C=aA(this,e)}m(){super.m();let e=this.g;this.M=$k(e.getUniformLocation(this.h,`defaultTexture`),`Uniform location`),this.P=$k(e.getUniformLocation(this.h,`overlayTexture`),`Uniform location`),this.I=$k(e.getUniformLocation(this.h,`maskTexture`),`Uniform location`)}l(){super.l();let e=this.g;e.uniform1i(this.I,0),e.uniform1i(this.M,1),e.uniform1i(this.P,2)}close(){this.j&&this.g.deleteTexture(this.j),this.C&&this.g.deleteTexture(this.C),super.close()}};function dA(e,t){switch(t){case 0:return e.g.find((e=>e instanceof Uint8Array));case 1:return e.g.find((e=>e instanceof Float32Array));case 2:return e.g.find((e=>typeof WebGLTexture<`u`&&e instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function fA(e){var t=dA(e,1);if(!t){if(t=dA(e,0))t=new Float32Array(t).map((e=>e/255));else{t=new Float32Array(e.width*e.height);let r=mA(e);var n=gA(e);if(oA(n,r,pA(e)),`iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod`.split(`;`).includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`document`in self&&`ontouchend`in self.document){n=new Float32Array(e.width*e.height*4),r.readPixels(0,0,e.width,e.height,r.RGBA,r.FLOAT,n);for(let e=0,r=0;e<t.length;++e,r+=4)t[e]=n[r]}else r.readPixels(0,0,e.width,e.height,r.RED,r.FLOAT,t)}e.g.push(t)}return t}function pA(e){let t=dA(e,2);if(!t){let n=mA(e);t=_A(e);let r=fA(e),i=hA(e);n.texImage2D(n.TEXTURE_2D,0,i,e.width,e.height,0,n.RED,n.FLOAT,r),vA(e)}return t}function mA(e){if(!e.canvas)throw Error(`Conversion to different image formats require that a canvas is passed when initializing the image.`);return e.h||=$k(e.canvas.getContext(`webgl2`),`You cannot use a canvas that is already bound to a different type of rendering context.`),e.h}function hA(e){if(e=mA(e),!yA)if(e.getExtension(`EXT_color_buffer_float`)&&e.getExtension(`OES_texture_float_linear`)&&e.getExtension(`EXT_float_blend`))yA=e.R32F;else{if(!e.getExtension(`EXT_color_buffer_half_float`))throw Error(`GPU does not fully support 4-channel float32 or float16 formats`);yA=e.R16F}return yA}function gA(e){return e.l||=new cA,e.l}function _A(e){let t=mA(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let n=dA(e,2);return n||(n=aA(gA(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(n),e.j=!0),t.bindTexture(t.TEXTURE_2D,n),n}function vA(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var yA,bA=class{constructor(e,t,n,r,i,a,o){this.g=e,this.m=t,this.j=n,this.canvas=r,this.l=i,this.width=a,this.height=o,this.j&&--xA===0&&console.error(`You seem to be creating MPMask instances without invoking .close(). This leaks resources.`)}Fa(){return!!dA(this,0)}ka(){return!!dA(this,1)}R(){return!!dA(this,2)}ja(){return(t=dA(e=this,0))||(t=fA(e),t=new Uint8Array(t.map((e=>Math.round(255*e)))),e.g.push(t)),t;var e,t}ia(){return fA(this)}N(){return pA(this)}clone(){let e=[];for(let t of this.g){let n;if(t instanceof Uint8Array)n=new Uint8Array(t);else if(t instanceof Float32Array)n=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{let e=mA(this),t=gA(this);e.activeTexture(e.TEXTURE1),n=aA(t,e,this.m?e.LINEAR:e.NEAREST),e.bindTexture(e.TEXTURE_2D,n);let r=hA(this);e.texImage2D(e.TEXTURE_2D,0,r,this.width,this.height,0,e.RED,e.FLOAT,null),e.bindTexture(e.TEXTURE_2D,null),oA(t,e,n),iA(t,e,!1,(()=>{_A(this),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),vA(this)})),sA(t),vA(this)}}e.push(n)}return new bA(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&mA(this).deleteTexture(dA(this,2)),xA=-1}};bA.prototype.close=bA.prototype.close,bA.prototype.clone=bA.prototype.clone,bA.prototype.getAsWebGLTexture=bA.prototype.N,bA.prototype.getAsFloat32Array=bA.prototype.ia,bA.prototype.getAsUint8Array=bA.prototype.ja,bA.prototype.hasWebGLTexture=bA.prototype.R,bA.prototype.hasFloat32Array=bA.prototype.ka,bA.prototype.hasUint8Array=bA.prototype.Fa;var xA=250,SA={color:`white`,lineWidth:4,radius:6};function CA(e){return{...SA,fillColor:(e||={}).color,...e}}function wA(e,t){return e instanceof Function?e(t):e}function TA(e,t,n){return Math.max(Math.min(t,n),Math.min(Math.max(t,n),e))}function EA(e){if(!e.l)throw Error(`CPU rendering requested but CanvasRenderingContext2D not provided.`);return e.l}function DA(e){if(!e.j)throw Error(`GPU rendering requested but WebGL2RenderingContext not provided.`);return e.j}function OA(e,t,n){if(t.R())n(t.N());else{let r=t.ka()?t.ia():t.ja();e.m=e.m??new cA;let i=DA(e);n((e=new bA([r],t.m,!1,i.canvas,e.m,t.width,t.height)).N()),e.close()}}function kA(e,t,n,r){let i=function(e){return e.g||=new lA,e.g}(e),a=DA(e),o=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n;iA(i,a,!0,(()=>{(function(e,t,n,r){let i=e.g;if(i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,t),i.activeTexture(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,e.C),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,n),e.I&&function(e,t){if(e!==t)return!1;e=e.entries(),t=t.entries();for(let[r,i]of e){e=r;let a=i;var n=t.next();if(n.done)return!1;let[o,s]=n.value;if(n=s,e!==o||a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])return!1}return!!t.next().done}(e.I,r))i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,e.j);else{e.I=r;let t=Array(1024).fill(0);r.forEach(((e,n)=>{if(e.length!==4)throw Error(`Color at index ${n} is not a four-channel value.`);t[4*n]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]})),i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,e.j),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,256,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array(t))}})(i,t,o,r),a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT),a.drawArrays(a.TRIANGLE_FAN,0,4);let e=i.g;e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,null)}))}function AA(e,t,n,r){let i=DA(e),a=function(e){return e.h||=new uA,e.h}(e),o=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n,s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;iA(a,i,!0,(()=>{var e=a.g;e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,a.j),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,o),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,a.C),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,s),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),i.bindTexture(i.TEXTURE_2D,null),(e=a.g).activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,null)}))}var jA=class{constructor(e,t){typeof CanvasRenderingContext2D<`u`&&e instanceof CanvasRenderingContext2D||e instanceof OffscreenCanvasRenderingContext2D?(this.l=e,this.j=t):this.j=e}ya(e,t){if(e){var n=EA(this);t=CA(t),n.save();var r=n.canvas,i=0;for(let a of e)n.fillStyle=wA(t.fillColor,{index:i,from:a}),n.strokeStyle=wA(t.color,{index:i,from:a}),n.lineWidth=wA(t.lineWidth,{index:i,from:a}),(e=new Path2D).arc(a.x*r.width,a.y*r.height,wA(t.radius,{index:i,from:a}),0,2*Math.PI),n.fill(e),n.stroke(e),++i;n.restore()}}xa(e,t,n){if(e&&t){var r=EA(this);n=CA(n),r.save();var i=r.canvas,a=0;for(let o of t){r.beginPath(),t=e[o.start];let s=e[o.end];t&&s&&(r.strokeStyle=wA(n.color,{index:a,from:t,to:s}),r.lineWidth=wA(n.lineWidth,{index:a,from:t,to:s}),r.moveTo(t.x*i.width,t.y*i.height),r.lineTo(s.x*i.width,s.y*i.height)),++a,r.stroke()}r.restore()}}ua(e,t){let n=EA(this);t=CA(t),n.save(),n.beginPath(),n.lineWidth=wA(t.lineWidth,{}),n.strokeStyle=wA(t.color,{}),n.fillStyle=wA(t.fillColor,{}),n.moveTo(e.originX,e.originY),n.lineTo(e.originX+e.width,e.originY),n.lineTo(e.originX+e.width,e.originY+e.height),n.lineTo(e.originX,e.originY+e.height),n.lineTo(e.originX,e.originY),n.stroke(),n.fill(),n.restore()}va(e,t,n=[0,0,0,255]){this.l?function(e,t,n,r){let i=DA(e);OA(e,t,(t=>{kA(e,t,n,r),(t=EA(e)).drawImage(i.canvas,0,0,t.canvas.width,t.canvas.height)}))}(this,e,n,t):kA(this,e.N(),n,t)}wa(e,t,n){this.l?function(e,t,n,r){let i=DA(e);OA(e,t,(t=>{AA(e,t,n,r),(t=EA(e)).drawImage(i.canvas,0,0,t.canvas.width,t.canvas.height)}))}(this,e,t,n):AA(this,e.N(),t,n)}close(){this.g?.close(),this.g=void 0,this.h?.close(),this.h=void 0,this.m?.close(),this.m=void 0}};function MA(e,t){switch(t){case 0:return e.g.find((e=>e instanceof ImageData));case 1:return e.g.find((e=>typeof ImageBitmap<`u`&&e instanceof ImageBitmap));case 2:return e.g.find((e=>typeof WebGLTexture<`u`&&e instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function NA(e){var t=MA(e,0);if(!t){t=FA(e);let n=IA(e),r=new Uint8Array(e.width*e.height*4);oA(n,t,PA(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,r),sA(n),t=new ImageData(new Uint8ClampedArray(r.buffer),e.width,e.height),e.g.push(t)}return t}function PA(e){let t=MA(e,2);if(!t){let n=FA(e);t=LA(e);let r=MA(e,1)||NA(e);n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,r),RA(e)}return t}function FA(e){if(!e.canvas)throw Error(`Conversion to different image formats require that a canvas is passed when initializing the image.`);return e.h||=$k(e.canvas.getContext(`webgl2`),`You cannot use a canvas that is already bound to a different type of rendering context.`),e.h}function IA(e){return e.l||=new cA,e.l}function LA(e){let t=FA(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let n=MA(e,2);return n||(n=aA(IA(e),t),e.g.push(n),e.m=!0),t.bindTexture(t.TEXTURE_2D,n),n}function RA(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function zA(e){let t=FA(e);return iA(IA(e),t,!0,(()=>function(e,t){let n=e.canvas;if(n.width===e.width&&n.height===e.height)return t();let r=n.width,i=n.height;return n.width=e.width,n.height=e.height,e=t(),n.width=r,n.height=i,e}(e,(()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error(`Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas`);return e.canvas.transferToImageBitmap()}))))}jA.prototype.close=jA.prototype.close,jA.prototype.drawConfidenceMask=jA.prototype.wa,jA.prototype.drawCategoryMask=jA.prototype.va,jA.prototype.drawBoundingBox=jA.prototype.ua,jA.prototype.drawConnectors=jA.prototype.xa,jA.prototype.drawLandmarks=jA.prototype.ya,jA.lerp=function(e,t,n,r,i){return TA(r*(1-(e-t)/(n-t))+i*(1-(n-e)/(n-t)),r,i)},jA.clamp=TA;var BA=class{constructor(e,t,n,r,i,a,o){this.g=e,this.j=t,this.m=n,this.canvas=r,this.l=i,this.width=a,this.height=o,(this.j||this.m)&&--VA===0&&console.error(`You seem to be creating MPImage instances without invoking .close(). This leaks resources.`)}Ea(){return!!MA(this,0)}la(){return!!MA(this,1)}R(){return!!MA(this,2)}Ca(){return NA(this)}Ba(){var e=MA(this,1);return e||(PA(this),LA(this),e=zA(this),RA(this),this.g.push(e),this.j=!0),e}N(){return PA(this)}clone(){let e=[];for(let t of this.g){let n;if(t instanceof ImageData)n=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){let e=FA(this),t=IA(this);e.activeTexture(e.TEXTURE1),n=aA(t,e),e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.width,this.height,0,e.RGBA,e.UNSIGNED_BYTE,null),e.bindTexture(e.TEXTURE_2D,null),oA(t,e,n),iA(t,e,!1,(()=>{LA(this),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),RA(this)})),sA(t),RA(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);PA(this),LA(this),n=zA(this),RA(this)}e.push(n)}return new BA(e,this.la(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&MA(this,1).close(),this.m&&FA(this).deleteTexture(MA(this,2)),VA=-1}};BA.prototype.close=BA.prototype.close,BA.prototype.clone=BA.prototype.clone,BA.prototype.getAsWebGLTexture=BA.prototype.N,BA.prototype.getAsImageBitmap=BA.prototype.Ba,BA.prototype.getAsImageData=BA.prototype.Ca,BA.prototype.hasWebGLTexture=BA.prototype.R,BA.prototype.hasImageBitmap=BA.prototype.la,BA.prototype.hasImageData=BA.prototype.Ea;var VA=250;function HA(...e){return e.map((([e,t])=>({start:e,end:t})))}var UA=function(e){return class extends e{Ja(){this.i._registerModelResourcesGraphService()}}}((WA=class{constructor(e,t){this.l=!0,this.i=e,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream==`function`,t===void 0?zk()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn(`OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas.`),this.i.canvas=document.createElement(`canvas`)):this.i.canvas=t}async initializeGraph(e){let t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(`.pbtxt`)||e.endsWith(`.textproto`)),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){let n=e.length,r=this.i._malloc(n);this.i.HEAPU8.set(e,r),t?this.i._changeBinaryGraph(n,r):this.i._changeTextGraph(n,r),this.i._free(r)}configureAudio(e,t,n,r,i){this.i._configureAudio||console.warn(`Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?`),Q(this,r||`input_audio`,(r=>{Q(this,i||=`audio_header`,(i=>{this.i._configureAudio(r,i,e,t??0,n)}))}))}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}ca(e){Wk(this,`__graph_config__`,(t=>{e(t)})),Q(this,`__graph_config__`,(e=>{this.i._getGraphConfig(e,void 0)})),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,n){this.addAudioToStreamWithShape(e,0,0,t,n)}addAudioToStreamWithShape(e,t,n,r,i){let a=4*e.length;this.h!==a&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(a),this.h=a),this.i.HEAPF32.set(e,this.g/4),Q(this,r,(e=>{this.i._addAudioToInputStream(this.g,t,n,e,i)}))}addGpuBufferToStream(e,t,n){Q(this,t,(t=>{let[r,i]=Hk(this,e,t);this.i._addBoundTextureToStream(t,r,i,n)}))}addBoolToStream(e,t,n){Q(this,t,(t=>{this.i._addBoolToInputStream(e,t,n)}))}addDoubleToStream(e,t,n){Q(this,t,(t=>{this.i._addDoubleToInputStream(e,t,n)}))}addFloatToStream(e,t,n){Q(this,t,(t=>{this.i._addFloatToInputStream(e,t,n)}))}addIntToStream(e,t,n){Q(this,t,(t=>{this.i._addIntToInputStream(e,t,n)}))}addUintToStream(e,t,n){Q(this,t,(t=>{this.i._addUintToInputStream(e,t,n)}))}addStringToStream(e,t,n){Q(this,t,(t=>{Q(this,e,(e=>{this.i._addStringToInputStream(e,t,n)}))}))}addStringRecordToStream(e,t,n){Q(this,t,(t=>{Uk(this,Object.keys(e),(r=>{Uk(this,Object.values(e),(i=>{this.i._addFlatHashMapToInputStream(r,i,Object.keys(e).length,t,n)}))}))}))}addProtoToStream(e,t,n,r){Q(this,n,(n=>{Q(this,t,(t=>{let i=this.i._malloc(e.length);this.i.HEAPU8.set(e,i),this.i._addProtoToInputStream(i,e.length,t,n,r),this.i._free(i)}))}))}addEmptyPacketToStream(e,t){Q(this,e,(e=>{this.i._addEmptyPacketToInputStream(e,t)}))}addBoolVectorToStream(e,t,n){Q(this,t,(t=>{let r=this.i._allocateBoolVector(e.length);if(!r)throw Error(`Unable to allocate new bool vector on heap.`);for(let t of e)this.i._addBoolVectorEntry(r,t);this.i._addBoolVectorToInputStream(r,t,n)}))}addDoubleVectorToStream(e,t,n){Q(this,t,(t=>{let r=this.i._allocateDoubleVector(e.length);if(!r)throw Error(`Unable to allocate new double vector on heap.`);for(let t of e)this.i._addDoubleVectorEntry(r,t);this.i._addDoubleVectorToInputStream(r,t,n)}))}addFloatVectorToStream(e,t,n){Q(this,t,(t=>{let r=this.i._allocateFloatVector(e.length);if(!r)throw Error(`Unable to allocate new float vector on heap.`);for(let t of e)this.i._addFloatVectorEntry(r,t);this.i._addFloatVectorToInputStream(r,t,n)}))}addIntVectorToStream(e,t,n){Q(this,t,(t=>{let r=this.i._allocateIntVector(e.length);if(!r)throw Error(`Unable to allocate new int vector on heap.`);for(let t of e)this.i._addIntVectorEntry(r,t);this.i._addIntVectorToInputStream(r,t,n)}))}addUintVectorToStream(e,t,n){Q(this,t,(t=>{let r=this.i._allocateUintVector(e.length);if(!r)throw Error(`Unable to allocate new unsigned int vector on heap.`);for(let t of e)this.i._addUintVectorEntry(r,t);this.i._addUintVectorToInputStream(r,t,n)}))}addStringVectorToStream(e,t,n){Q(this,t,(t=>{let r=this.i._allocateStringVector(e.length);if(!r)throw Error(`Unable to allocate new string vector on heap.`);for(let t of e)Q(this,t,(e=>{this.i._addStringVectorEntry(r,e)}));this.i._addStringVectorToInputStream(r,t,n)}))}addBoolToInputSidePacket(e,t){Q(this,t,(t=>{this.i._addBoolToInputSidePacket(e,t)}))}addDoubleToInputSidePacket(e,t){Q(this,t,(t=>{this.i._addDoubleToInputSidePacket(e,t)}))}addFloatToInputSidePacket(e,t){Q(this,t,(t=>{this.i._addFloatToInputSidePacket(e,t)}))}addIntToInputSidePacket(e,t){Q(this,t,(t=>{this.i._addIntToInputSidePacket(e,t)}))}addUintToInputSidePacket(e,t){Q(this,t,(t=>{this.i._addUintToInputSidePacket(e,t)}))}addStringToInputSidePacket(e,t){Q(this,t,(t=>{Q(this,e,(e=>{this.i._addStringToInputSidePacket(e,t)}))}))}addProtoToInputSidePacket(e,t,n){Q(this,n,(n=>{Q(this,t,(t=>{let r=this.i._malloc(e.length);this.i.HEAPU8.set(e,r),this.i._addProtoToInputSidePacket(r,e.length,t,n),this.i._free(r)}))}))}addBoolVectorToInputSidePacket(e,t){Q(this,t,(t=>{let n=this.i._allocateBoolVector(e.length);if(!n)throw Error(`Unable to allocate new bool vector on heap.`);for(let t of e)this.i._addBoolVectorEntry(n,t);this.i._addBoolVectorToInputSidePacket(n,t)}))}addDoubleVectorToInputSidePacket(e,t){Q(this,t,(t=>{let n=this.i._allocateDoubleVector(e.length);if(!n)throw Error(`Unable to allocate new double vector on heap.`);for(let t of e)this.i._addDoubleVectorEntry(n,t);this.i._addDoubleVectorToInputSidePacket(n,t)}))}addFloatVectorToInputSidePacket(e,t){Q(this,t,(t=>{let n=this.i._allocateFloatVector(e.length);if(!n)throw Error(`Unable to allocate new float vector on heap.`);for(let t of e)this.i._addFloatVectorEntry(n,t);this.i._addFloatVectorToInputSidePacket(n,t)}))}addIntVectorToInputSidePacket(e,t){Q(this,t,(t=>{let n=this.i._allocateIntVector(e.length);if(!n)throw Error(`Unable to allocate new int vector on heap.`);for(let t of e)this.i._addIntVectorEntry(n,t);this.i._addIntVectorToInputSidePacket(n,t)}))}addUintVectorToInputSidePacket(e,t){Q(this,t,(t=>{let n=this.i._allocateUintVector(e.length);if(!n)throw Error(`Unable to allocate new unsigned int vector on heap.`);for(let t of e)this.i._addUintVectorEntry(n,t);this.i._addUintVectorToInputSidePacket(n,t)}))}addStringVectorToInputSidePacket(e,t){Q(this,t,(t=>{let n=this.i._allocateStringVector(e.length);if(!n)throw Error(`Unable to allocate new string vector on heap.`);for(let t of e)Q(this,t,(e=>{this.i._addStringVectorEntry(n,e)}));this.i._addStringVectorToInputSidePacket(n,t)}))}attachBoolListener(e,t){Wk(this,e,t),Q(this,e,(e=>{this.i._attachBoolListener(e)}))}attachBoolVectorListener(e,t){Gk(this,e,t),Q(this,e,(e=>{this.i._attachBoolVectorListener(e)}))}attachIntListener(e,t){Wk(this,e,t),Q(this,e,(e=>{this.i._attachIntListener(e)}))}attachIntVectorListener(e,t){Gk(this,e,t),Q(this,e,(e=>{this.i._attachIntVectorListener(e)}))}attachUintListener(e,t){Wk(this,e,t),Q(this,e,(e=>{this.i._attachUintListener(e)}))}attachUintVectorListener(e,t){Gk(this,e,t),Q(this,e,(e=>{this.i._attachUintVectorListener(e)}))}attachDoubleListener(e,t){Wk(this,e,t),Q(this,e,(e=>{this.i._attachDoubleListener(e)}))}attachDoubleVectorListener(e,t){Gk(this,e,t),Q(this,e,(e=>{this.i._attachDoubleVectorListener(e)}))}attachFloatListener(e,t){Wk(this,e,t),Q(this,e,(e=>{this.i._attachFloatListener(e)}))}attachFloatVectorListener(e,t){Gk(this,e,t),Q(this,e,(e=>{this.i._attachFloatVectorListener(e)}))}attachStringListener(e,t){Wk(this,e,t),Q(this,e,(e=>{this.i._attachStringListener(e)}))}attachStringVectorListener(e,t){Gk(this,e,t),Q(this,e,(e=>{this.i._attachStringVectorListener(e)}))}attachProtoListener(e,t,n){Wk(this,e,t),Q(this,e,(e=>{this.i._attachProtoListener(e,n||!1)}))}attachProtoVectorListener(e,t,n){Gk(this,e,t),Q(this,e,(e=>{this.i._attachProtoVectorListener(e,n||!1)}))}attachAudioListener(e,t,n){this.i._attachAudioListener||console.warn(`Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?`),Wk(this,e,((e,n)=>{e=new Float32Array(e.buffer,e.byteOffset,e.length/4),t(e,n)})),Q(this,e,(e=>{this.i._attachAudioListener(e,n||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends WA{get ga(){return this.i}pa(e,t,n){Q(this,t,(t=>{let[r,i]=Hk(this,e,t);this.ga._addBoundTextureAsImageToStream(t,r,i,n)}))}Z(e,t){Wk(this,e,t),Q(this,e,(e=>{this.ga._attachImageListener(e)}))}aa(e,t){Gk(this,e,t),Q(this,e,(e=>{this.ga._attachImageVectorListener(e)}))}})),WA,GA=class extends UA{};async function KA(e,t,n){return async function(e,t,n,r){return Kk(e,t,n,r)}(e,n.canvas??(zk()?void 0:document.createElement(`canvas`)),t,n)}function qA(e,t,n,r){if(e.U){let a=new hO;if(n?.regionOfInterest){if(!e.oa)throw Error(`This task doesn't support region-of-interest.`);var i=n.regionOfInterest;if(i.left>=i.right||i.top>=i.bottom)throw Error(`Expected RectF with left < right and top < bottom.`);if(i.left<0||i.top<0||i.right>1||i.bottom>1)throw Error(`Expected RectF values to be in [0,1].`);_T(a,1,(i.left+i.right)/2),_T(a,2,(i.top+i.bottom)/2),_T(a,4,i.right-i.left),_T(a,3,i.bottom-i.top)}else _T(a,1,.5),_T(a,2,.5),_T(a,4,1),_T(a,3,1);if(n?.rotationDegrees){if(n?.rotationDegrees%90!=0)throw Error(`Expected rotation to be a multiple of 90°.`);if(_T(a,5,-Math.PI*n.rotationDegrees/180),n?.rotationDegrees%180!=0){let[e,r]=Vk(t);n=hT(a,3)*r/e,i=hT(a,4)*e/r,_T(a,4,n),_T(a,3,i)}}e.g.addProtoToStream(a.g(),`mediapipe.NormalizedRect`,e.U,r)}e.g.pa(t,e.X,r??performance.now()),e.finishProcessing()}function JA(e,t,n){if(e.baseOptions?.g())throw Error(`Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.`);qA(e,t,n,e.C+1)}function YA(e,t,n,r){if(!e.baseOptions?.g())throw Error(`Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.`);qA(e,t,n,r)}function XA(e,t,n,r){var i=t.data;let a=t.width,o=a*(t=t.height);if((i instanceof Uint8Array||i instanceof Float32Array)&&i.length!==o)throw Error(`Unsupported channel count: `+i.length/o);return e=new bA([i],n,!1,e.g.i.canvas,e.P,a,t),r?e.clone():e}var ZA=class extends Qk{constructor(e,t,n,r){super(e),this.g=e,this.X=t,this.U=n,this.oa=r,this.P=new cA}l(e,t=!0){if(`runningMode`in e&&Vw(this.baseOptions,2,zC(!!e.runningMode&&e.runningMode!==`IMAGE`)),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error(`You must create a new task to reset the canvas.`);return super.l(e,t)}close(){this.P.close(),super.close()}};ZA.prototype.close=ZA.prototype.close;var QA=class extends ZA{constructor(e,t){super(new GA(e,t),`image_in`,`norm_rect_in`,!1),this.j={detections:[]},lT(e=this.h=new NO,0,1,t=new AO),_T(this.h,2,.5),_T(this.h,3,.3)}get baseOptions(){return aT(this.h,AO,1)}set baseOptions(e){lT(this.h,0,1,e)}o(e){return`minDetectionConfidence`in e&&_T(this.h,2,e.minDetectionConfidence??.5),`minSuppressionThreshold`in e&&_T(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},JA(this,e,t),this.j}G(e,t,n){return this.j={detections:[]},YA(this,e,n,t),this.j}m(){var e=new QD;XD(e,`image_in`),XD(e,`norm_rect_in`),ZD(e,`detections`);let t=new BD;gE(t,FO,this.h);let n=new GD;vT(n,2,`mediapipe.tasks.vision.face_detector.FaceDetectorGraph`),UD(n,`IMAGE:image_in`),UD(n,`NORM_RECT:norm_rect_in`),WD(n,`DETECTIONS:detections`),n.o(t),YD(e,n),this.g.attachProtoVectorListener(`detections`,((e,t)=>{for(let t of e)e=cO(t),this.j.detections.push(kk(e));$(this,t)})),this.g.attachEmptyPacketListener(`detections`,(e=>{$(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};QA.prototype.detectForVideo=QA.prototype.G,QA.prototype.detect=QA.prototype.F,QA.prototype.setOptions=QA.prototype.o,QA.createFromModelPath=async function(e,t){return KA(QA,e,{baseOptions:{modelAssetPath:t}})},QA.createFromModelBuffer=function(e,t){return KA(QA,e,{baseOptions:{modelAssetBuffer:t}})},QA.createFromOptions=function(e,t){return KA(QA,e,t)};var $A=HA([61,146],[146,91],[91,181],[181,84],[84,17],[17,314],[314,405],[405,321],[321,375],[375,291],[61,185],[185,40],[40,39],[39,37],[37,0],[0,267],[267,269],[269,270],[270,409],[409,291],[78,95],[95,88],[88,178],[178,87],[87,14],[14,317],[317,402],[402,318],[318,324],[324,308],[78,191],[191,80],[80,81],[81,82],[82,13],[13,312],[312,311],[311,310],[310,415],[415,308]),ej=HA([263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],[386,385],[385,384],[384,398],[398,362]),tj=HA([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),nj=HA([474,475],[475,476],[476,477],[477,474]),rj=HA([33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]),ij=HA([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),aj=HA([469,470],[470,471],[471,472],[472,469]),oj=HA([10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]),sj=[...$A,...ej,...tj,...rj,...ij,...oj],cj=HA([127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]);function lj(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var uj=class extends ZA{constructor(e,t){super(new GA(e,t),`image_in`,`norm_rect`,!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,lT(e=this.h=new RO,0,1,t=new AO),this.A=new LO,lT(this.h,0,3,this.A),this.u=new NO,lT(this.h,0,2,this.u),gT(this.u,4,1),_T(this.u,2,.5),_T(this.A,2,.5),_T(this.h,4,.5)}get baseOptions(){return aT(this.h,AO,1)}set baseOptions(e){lT(this.h,0,1,e)}o(e){return`numFaces`in e&&gT(this.u,4,e.numFaces??1),`minFaceDetectionConfidence`in e&&_T(this.u,2,e.minFaceDetectionConfidence??.5),`minTrackingConfidence`in e&&_T(this.h,4,e.minTrackingConfidence??.5),`minFacePresenceConfidence`in e&&_T(this.A,2,e.minFacePresenceConfidence??.5),`outputFaceBlendshapes`in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),`outputFacialTransformationMatrixes`in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}F(e,t){return lj(this),JA(this,e,t),this.j}G(e,t,n){return lj(this),YA(this,e,n,t),this.j}m(){var e=new QD;XD(e,`image_in`),XD(e,`norm_rect`),ZD(e,`face_landmarks`);let t=new BD;gE(t,BO,this.h);let n=new GD;vT(n,2,`mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph`),UD(n,`IMAGE:image_in`),UD(n,`NORM_RECT:norm_rect`),WD(n,`NORM_LANDMARKS:face_landmarks`),n.o(t),YD(e,n),this.g.attachProtoVectorListener(`face_landmarks`,((e,t)=>{for(let t of e)e=fO(t),this.j.faceLandmarks.push(Ak(e));$(this,t)})),this.g.attachEmptyPacketListener(`face_landmarks`,(e=>{$(this,e)})),this.outputFaceBlendshapes&&(ZD(e,`blendshapes`),WD(n,`BLENDSHAPES:blendshapes`),this.g.attachProtoVectorListener(`blendshapes`,((e,t)=>{if(this.outputFaceBlendshapes)for(let t of e)e=iO(t),this.j.faceBlendshapes.push(Dk(e.g()??[]));$(this,t)})),this.g.attachEmptyPacketListener(`blendshapes`,(e=>{$(this,e)}))),this.outputFacialTransformationMatrixes&&(ZD(e,`face_geometry`),WD(n,`FACE_GEOMETRY:face_geometry`),this.g.attachProtoVectorListener(`face_geometry`,((e,t)=>{if(this.outputFacialTransformationMatrixes)for(let t of e)(e=aT(e=IO(t),pO,2))&&this.j.facialTransformationMatrixes.push({rows:pT(e,1)??0??0,columns:pT(e,2)??0??0,data:Ww(e,3,RC,Uw()).slice()??[]});$(this,t)})),this.g.attachEmptyPacketListener(`face_geometry`,(e=>{$(this,e)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};uj.prototype.detectForVideo=uj.prototype.G,uj.prototype.detect=uj.prototype.F,uj.prototype.setOptions=uj.prototype.o,uj.createFromModelPath=function(e,t){return KA(uj,e,{baseOptions:{modelAssetPath:t}})},uj.createFromModelBuffer=function(e,t){return KA(uj,e,{baseOptions:{modelAssetBuffer:t}})},uj.createFromOptions=function(e,t){return KA(uj,e,t)},uj.FACE_LANDMARKS_LIPS=$A,uj.FACE_LANDMARKS_LEFT_EYE=ej,uj.FACE_LANDMARKS_LEFT_EYEBROW=tj,uj.FACE_LANDMARKS_LEFT_IRIS=nj,uj.FACE_LANDMARKS_RIGHT_EYE=rj,uj.FACE_LANDMARKS_RIGHT_EYEBROW=ij,uj.FACE_LANDMARKS_RIGHT_IRIS=aj,uj.FACE_LANDMARKS_FACE_OVAL=oj,uj.FACE_LANDMARKS_CONTOURS=sj,uj.FACE_LANDMARKS_TESSELATION=cj;var dj=HA([0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]);function fj(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function pj(e){return e.gestures.length===0?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:e.gestures,landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handedness:e.handedness,handednesses:e.handedness}}function mj(e,t=!0){let n=[];for(let i of e){var r=iO(i);e=[];for(let n of r.g())r=t&&pT(n,1)!=null?pT(n,1)??0:-1,e.push({score:hT(n,2)??0,index:r,categoryName:ew(zw(n,3))??``??``,displayName:ew(zw(n,4))??``??``});n.push(e)}return n}var hj=class extends ZA{constructor(e,t){super(new GA(e,t),`image_in`,`norm_rect`,!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],lT(e=this.j=new qO,0,1,t=new AO),this.u=new KO,lT(this.j,0,2,this.u),this.D=new GO,lT(this.u,0,3,this.D),this.A=new WO,lT(this.u,0,2,this.A),this.h=new UO,lT(this.j,0,3,this.h),_T(this.A,2,.5),_T(this.u,4,.5),_T(this.D,2,.5)}get baseOptions(){return aT(this.j,AO,1)}set baseOptions(e){lT(this.j,0,1,e)}o(e){if(gT(this.A,3,e.numHands??1),`minHandDetectionConfidence`in e&&_T(this.A,2,e.minHandDetectionConfidence??.5),`minTrackingConfidence`in e&&_T(this.u,4,e.minTrackingConfidence??.5),`minHandPresenceConfidence`in e&&_T(this.D,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new VO,n=t,r=Tk(e.cannedGesturesClassifierOptions,aT(this.h,VO,3)?.l());lT(n,0,2,r),lT(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&aT(this.h,VO,3)?.g();return e.customGesturesClassifierOptions?(lT(n=t=new VO,0,2,r=Tk(e.customGesturesClassifierOptions,aT(this.h,VO,4)?.l())),lT(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&aT(this.h,VO,4)?.g(),this.l(e)}Ha(e,t){return fj(this),JA(this,e,t),pj(this)}Ia(e,t,n){return fj(this),YA(this,e,n,t),pj(this)}m(){var e=new QD;XD(e,`image_in`),XD(e,`norm_rect`),ZD(e,`hand_gestures`),ZD(e,`hand_landmarks`),ZD(e,`world_hand_landmarks`),ZD(e,`handedness`);let t=new BD;gE(t,QO,this.j);let n=new GD;vT(n,2,`mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph`),UD(n,`IMAGE:image_in`),UD(n,`NORM_RECT:norm_rect`),WD(n,`HAND_GESTURES:hand_gestures`),WD(n,`LANDMARKS:hand_landmarks`),WD(n,`WORLD_LANDMARKS:world_hand_landmarks`),WD(n,`HANDEDNESS:handedness`),n.o(t),YD(e,n),this.g.attachProtoVectorListener(`hand_landmarks`,((e,t)=>{for(let t of e){e=fO(t);let n=[];for(let t of sT(e,dO,1))n.push({x:hT(t,1)??0,y:hT(t,2)??0,z:hT(t,3)??0,visibility:hT(t,4)??0});this.landmarks.push(n)}$(this,t)})),this.g.attachEmptyPacketListener(`hand_landmarks`,(e=>{$(this,e)})),this.g.attachProtoVectorListener(`world_hand_landmarks`,((e,t)=>{for(let t of e){e=uO(t);let n=[];for(let t of sT(e,lO,1))n.push({x:hT(t,1)??0,y:hT(t,2)??0,z:hT(t,3)??0,visibility:hT(t,4)??0});this.worldLandmarks.push(n)}$(this,t)})),this.g.attachEmptyPacketListener(`world_hand_landmarks`,(e=>{$(this,e)})),this.g.attachProtoVectorListener(`hand_gestures`,((e,t)=>{this.gestures.push(...mj(e,!1)),$(this,t)})),this.g.attachEmptyPacketListener(`hand_gestures`,(e=>{$(this,e)})),this.g.attachProtoVectorListener(`handedness`,((e,t)=>{this.handedness.push(...mj(e)),$(this,t)})),this.g.attachEmptyPacketListener(`handedness`,(e=>{$(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function gj(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}hj.prototype.recognizeForVideo=hj.prototype.Ia,hj.prototype.recognize=hj.prototype.Ha,hj.prototype.setOptions=hj.prototype.o,hj.createFromModelPath=function(e,t){return KA(hj,e,{baseOptions:{modelAssetPath:t}})},hj.createFromModelBuffer=function(e,t){return KA(hj,e,{baseOptions:{modelAssetBuffer:t}})},hj.createFromOptions=function(e,t){return KA(hj,e,t)},hj.HAND_CONNECTIONS=dj;var _j=class extends ZA{constructor(e,t){super(new GA(e,t),`image_in`,`norm_rect`,!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],lT(e=this.h=new KO,0,1,t=new AO),this.u=new GO,lT(this.h,0,3,this.u),this.j=new WO,lT(this.h,0,2,this.j),gT(this.j,3,1),_T(this.j,2,.5),_T(this.u,2,.5),_T(this.h,4,.5)}get baseOptions(){return aT(this.h,AO,1)}set baseOptions(e){lT(this.h,0,1,e)}o(e){return`numHands`in e&&gT(this.j,3,e.numHands??1),`minHandDetectionConfidence`in e&&_T(this.j,2,e.minHandDetectionConfidence??.5),`minTrackingConfidence`in e&&_T(this.h,4,e.minTrackingConfidence??.5),`minHandPresenceConfidence`in e&&_T(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],JA(this,e,t),gj(this)}G(e,t,n){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],YA(this,e,n,t),gj(this)}m(){var e=new QD;XD(e,`image_in`),XD(e,`norm_rect`),ZD(e,`hand_landmarks`),ZD(e,`world_hand_landmarks`),ZD(e,`handedness`);let t=new BD;gE(t,$O,this.h);let n=new GD;vT(n,2,`mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph`),UD(n,`IMAGE:image_in`),UD(n,`NORM_RECT:norm_rect`),WD(n,`LANDMARKS:hand_landmarks`),WD(n,`WORLD_LANDMARKS:world_hand_landmarks`),WD(n,`HANDEDNESS:handedness`),n.o(t),YD(e,n),this.g.attachProtoVectorListener(`hand_landmarks`,((e,t)=>{for(let t of e)e=fO(t),this.landmarks.push(Ak(e));$(this,t)})),this.g.attachEmptyPacketListener(`hand_landmarks`,(e=>{$(this,e)})),this.g.attachProtoVectorListener(`world_hand_landmarks`,((e,t)=>{for(let t of e)e=uO(t),this.worldLandmarks.push(jk(e));$(this,t)})),this.g.attachEmptyPacketListener(`world_hand_landmarks`,(e=>{$(this,e)})),this.g.attachProtoVectorListener(`handedness`,((e,t)=>{var n=this.handedness,r=n.push;let i=[];for(let t of e){e=iO(t);let n=[];for(let t of e.g())n.push({score:hT(t,2)??0,index:pT(t,1)??0??-1,categoryName:ew(zw(t,3))??``??``,displayName:ew(zw(t,4))??``??``});i.push(n)}r.call(n,...i),$(this,t)})),this.g.attachEmptyPacketListener(`handedness`,(e=>{$(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};_j.prototype.detectForVideo=_j.prototype.G,_j.prototype.detect=_j.prototype.F,_j.prototype.setOptions=_j.prototype.o,_j.createFromModelPath=function(e,t){return KA(_j,e,{baseOptions:{modelAssetPath:t}})},_j.createFromModelBuffer=function(e,t){return KA(_j,e,{baseOptions:{modelAssetBuffer:t}})},_j.createFromOptions=function(e,t){return KA(_j,e,t)},_j.HAND_CONNECTIONS=dj;var vj=HA([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);function yj(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function bj(e){try{if(!e.D)return e.h;e.D(e.h)}finally{Zk(e)}}function xj(e,t){e=fO(e),t.push(Ak(e))}var Sj=class extends ZA{constructor(e,t){super(new GA(e,t),`input_frames_image`,null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,lT(e=this.j=new rk,0,1,t=new AO),this.I=new GO,lT(this.j,0,2,this.I),this.W=new ek,lT(this.j,0,3,this.W),this.u=new NO,lT(this.j,0,4,this.u),this.O=new LO,lT(this.j,0,5,this.O),this.A=new tk,lT(this.j,0,6,this.A),this.M=new nk,lT(this.j,0,7,this.M),_T(this.u,2,.5),_T(this.u,3,.3),_T(this.O,2,.5),_T(this.A,2,.5),_T(this.A,3,.3),_T(this.M,2,.5),_T(this.I,2,.5)}get baseOptions(){return aT(this.j,AO,1)}set baseOptions(e){lT(this.j,0,1,e)}o(e){return`minFaceDetectionConfidence`in e&&_T(this.u,2,e.minFaceDetectionConfidence??.5),`minFaceSuppressionThreshold`in e&&_T(this.u,3,e.minFaceSuppressionThreshold??.3),`minFacePresenceConfidence`in e&&_T(this.O,2,e.minFacePresenceConfidence??.5),`outputFaceBlendshapes`in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),`minPoseDetectionConfidence`in e&&_T(this.A,2,e.minPoseDetectionConfidence??.5),`minPoseSuppressionThreshold`in e&&_T(this.A,3,e.minPoseSuppressionThreshold??.3),`minPosePresenceConfidence`in e&&_T(this.M,2,e.minPosePresenceConfidence??.5),`outputPoseSegmentationMasks`in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),`minHandLandmarksConfidence`in e&&_T(this.I,2,e.minHandLandmarksConfidence??.5),this.l(e)}F(e,t,n){let r=typeof t==`function`?{}:t;return this.D=typeof t==`function`?t:n,yj(this),JA(this,e,r),bj(this)}G(e,t,n,r){let i=typeof n==`function`?{}:n;return this.D=typeof n==`function`?n:r,yj(this),YA(this,e,i,t),bj(this)}m(){var e=new QD;XD(e,`input_frames_image`),ZD(e,`pose_landmarks`),ZD(e,`pose_world_landmarks`),ZD(e,`face_landmarks`),ZD(e,`left_hand_landmarks`),ZD(e,`left_hand_world_landmarks`),ZD(e,`right_hand_landmarks`),ZD(e,`right_hand_world_landmarks`);let t=new BD,n=new ED;vT(n,1,`type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions`),function(e,t){if(t!=null)if(Array.isArray(t))Vw(e,2,yw(t,0,xw));else{if(!(typeof t==`string`||t instanceof yS||hS(t)))throw Error(`invalid value in Any.value field: `+t+` expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array`);Zw(e,2,XS(t,!1),_S())}}(n,this.j.g());let r=new GD;vT(r,2,`mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph`),fT(r,8,ED,n),UD(r,`IMAGE:input_frames_image`),WD(r,`POSE_LANDMARKS:pose_landmarks`),WD(r,`POSE_WORLD_LANDMARKS:pose_world_landmarks`),WD(r,`FACE_LANDMARKS:face_landmarks`),WD(r,`LEFT_HAND_LANDMARKS:left_hand_landmarks`),WD(r,`LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks`),WD(r,`RIGHT_HAND_LANDMARKS:right_hand_landmarks`),WD(r,`RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks`),r.o(t),YD(e,r),Yk(this,e),this.g.attachProtoListener(`pose_landmarks`,((e,t)=>{xj(e,this.h.poseLandmarks),$(this,t)})),this.g.attachEmptyPacketListener(`pose_landmarks`,(e=>{$(this,e)})),this.g.attachProtoListener(`pose_world_landmarks`,((e,t)=>{var n=this.h.poseWorldLandmarks;e=uO(e),n.push(jk(e)),$(this,t)})),this.g.attachEmptyPacketListener(`pose_world_landmarks`,(e=>{$(this,e)})),this.outputPoseSegmentationMasks&&(WD(r,`POSE_SEGMENTATION_MASK:pose_segmentation_mask`),Xk(this,`pose_segmentation_mask`),this.g.Z(`pose_segmentation_mask`,((e,t)=>{this.h.poseSegmentationMasks=[XA(this,e,!0,!this.D)],$(this,t)})),this.g.attachEmptyPacketListener(`pose_segmentation_mask`,(e=>{this.h.poseSegmentationMasks=[],$(this,e)}))),this.g.attachProtoListener(`face_landmarks`,((e,t)=>{xj(e,this.h.faceLandmarks),$(this,t)})),this.g.attachEmptyPacketListener(`face_landmarks`,(e=>{$(this,e)})),this.outputFaceBlendshapes&&(ZD(e,`extra_blendshapes`),WD(r,`FACE_BLENDSHAPES:extra_blendshapes`),this.g.attachProtoListener(`extra_blendshapes`,((e,t)=>{var n=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(e=iO(e),n.push(Dk(e.g()??[]))),$(this,t)})),this.g.attachEmptyPacketListener(`extra_blendshapes`,(e=>{$(this,e)}))),this.g.attachProtoListener(`left_hand_landmarks`,((e,t)=>{xj(e,this.h.leftHandLandmarks),$(this,t)})),this.g.attachEmptyPacketListener(`left_hand_landmarks`,(e=>{$(this,e)})),this.g.attachProtoListener(`left_hand_world_landmarks`,((e,t)=>{var n=this.h.leftHandWorldLandmarks;e=uO(e),n.push(jk(e)),$(this,t)})),this.g.attachEmptyPacketListener(`left_hand_world_landmarks`,(e=>{$(this,e)})),this.g.attachProtoListener(`right_hand_landmarks`,((e,t)=>{xj(e,this.h.rightHandLandmarks),$(this,t)})),this.g.attachEmptyPacketListener(`right_hand_landmarks`,(e=>{$(this,e)})),this.g.attachProtoListener(`right_hand_world_landmarks`,((e,t)=>{var n=this.h.rightHandWorldLandmarks;e=uO(e),n.push(jk(e)),$(this,t)})),this.g.attachEmptyPacketListener(`right_hand_world_landmarks`,(e=>{$(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Sj.prototype.detectForVideo=Sj.prototype.G,Sj.prototype.detect=Sj.prototype.F,Sj.prototype.setOptions=Sj.prototype.o,Sj.createFromModelPath=function(e,t){return KA(Sj,e,{baseOptions:{modelAssetPath:t}})},Sj.createFromModelBuffer=function(e,t){return KA(Sj,e,{baseOptions:{modelAssetBuffer:t}})},Sj.createFromOptions=function(e,t){return KA(Sj,e,t)},Sj.HAND_CONNECTIONS=dj,Sj.POSE_CONNECTIONS=vj,Sj.FACE_LANDMARKS_LIPS=$A,Sj.FACE_LANDMARKS_LEFT_EYE=ej,Sj.FACE_LANDMARKS_LEFT_EYEBROW=tj,Sj.FACE_LANDMARKS_LEFT_IRIS=nj,Sj.FACE_LANDMARKS_RIGHT_EYE=rj,Sj.FACE_LANDMARKS_RIGHT_EYEBROW=ij,Sj.FACE_LANDMARKS_RIGHT_IRIS=aj,Sj.FACE_LANDMARKS_FACE_OVAL=oj,Sj.FACE_LANDMARKS_CONTOURS=sj,Sj.FACE_LANDMARKS_TESSELATION=cj;var Cj=class extends ZA{constructor(e,t){super(new GA(e,t),`input_image`,`norm_rect`,!0),this.j={classifications:[]},lT(e=this.h=new ok,0,1,t=new AO)}get baseOptions(){return aT(this.h,AO,1)}set baseOptions(e){lT(this.h,0,1,e)}o(e){return lT(this.h,0,2,Tk(e,aT(this.h,CO,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},JA(this,e,t),this.j}ta(e,t,n){return this.j={classifications:[]},YA(this,e,n,t),this.j}m(){var e=new QD;XD(e,`input_image`),XD(e,`norm_rect`),ZD(e,`classifications`);let t=new BD;gE(t,sk,this.h);let n=new GD;vT(n,2,`mediapipe.tasks.vision.image_classifier.ImageClassifierGraph`),UD(n,`IMAGE:input_image`),UD(n,`NORM_RECT:norm_rect`),WD(n,`CLASSIFICATIONS:classifications`),n.o(t),YD(e,n),this.g.attachProtoListener(`classifications`,((e,t)=>{this.j=Ok(_O(e)),$(this,t)})),this.g.attachEmptyPacketListener(`classifications`,(e=>{$(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Cj.prototype.classifyForVideo=Cj.prototype.ta,Cj.prototype.classify=Cj.prototype.sa,Cj.prototype.setOptions=Cj.prototype.o,Cj.createFromModelPath=function(e,t){return KA(Cj,e,{baseOptions:{modelAssetPath:t}})},Cj.createFromModelBuffer=function(e,t){return KA(Cj,e,{baseOptions:{modelAssetBuffer:t}})},Cj.createFromOptions=function(e,t){return KA(Cj,e,t)};var wj=class extends ZA{constructor(e,t){super(new GA(e,t),`image_in`,`norm_rect`,!0),this.h=new ck,this.embeddings={embeddings:[]},lT(e=this.h,0,1,t=new AO)}get baseOptions(){return aT(this.h,AO,1)}set baseOptions(e){lT(this.h,0,1,e)}o(e){var t=this.h,n=aT(this.h,TO,2);return n=n?n.clone():new TO,e.l2Normalize===void 0?`l2Normalize`in e&&Vw(n,1):Vw(n,1,zC(e.l2Normalize)),e.quantize===void 0?`quantize`in e&&Vw(n,2):Vw(n,2,zC(e.quantize)),lT(t,0,2,n),this.l(e)}za(e,t){return JA(this,e,t),this.embeddings}Aa(e,t,n){return YA(this,e,n,t),this.embeddings}m(){var e=new QD;XD(e,`image_in`),XD(e,`norm_rect`),ZD(e,`embeddings_out`);let t=new BD;gE(t,lk,this.h);let n=new GD;vT(n,2,`mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph`),UD(n,`IMAGE:image_in`),UD(n,`NORM_RECT:norm_rect`),WD(n,`EMBEDDINGS:embeddings_out`),n.o(t),YD(e,n),this.g.attachProtoListener(`embeddings_out`,((e,t)=>{e=SO(e),this.embeddings=function(e){return{embeddings:sT(e,bO,1).map((e=>{let t={headIndex:pT(e,3)??0??-1,headName:ew(zw(e,4))??``??``};var n=e.v;return iT(n,0|n[X],vO,$w(e,1))===void 0?(n=new Uint8Array,t.quantizedEmbedding=aT(e,yO,$w(e,2),void 0)?.na()?.h()??n):(e=Ww(e=aT(e,vO,$w(e,1),void 0),1,RC,Uw()),t.floatEmbedding=e.slice()),t})),timestampMs:Ek(mT(e))}}(e),$(this,t)})),this.g.attachEmptyPacketListener(`embeddings_out`,(e=>{$(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};wj.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Nk(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error(`Cannot compute cosine similarity between quantized and float embeddings.`);e=Nk(Mk(e.quantizedEmbedding),Mk(t.quantizedEmbedding))}return e},wj.prototype.embedForVideo=wj.prototype.Aa,wj.prototype.embed=wj.prototype.za,wj.prototype.setOptions=wj.prototype.o,wj.createFromModelPath=function(e,t){return KA(wj,e,{baseOptions:{modelAssetPath:t}})},wj.createFromModelBuffer=function(e,t){return KA(wj,e,{baseOptions:{modelAssetBuffer:t}})},wj.createFromOptions=function(e,t){return KA(wj,e,t)};var Tj=class{constructor(e,t,n){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=n}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};function Ej(e){let t=function(e){return sT(e,GD,1)}(e.ca()).filter((e=>(ew(zw(e,1))??``).includes(`mediapipe.tasks.TensorsToSegmentationCalculator`)));if(e.u=[],t.length>1)throw Error(`The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.`);t.length===1&&(aT(t[0],BD,7)?.j()?.g()??new Map).forEach(((t,n)=>{e.u[Number(n)]=ew(zw(t,1))??``}))}function Dj(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function Oj(e){try{let t=new Tj(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{Zk(e)}}Tj.prototype.close=Tj.prototype.close;var kj=class extends ZA{constructor(e,t){super(new GA(e,t),`image_in`,`norm_rect`,!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new mk,this.A=new uk,lT(this.h,0,3,this.A),lT(e=this.h,0,1,t=new AO)}get baseOptions(){return aT(this.h,AO,1)}set baseOptions(e){lT(this.h,0,1,e)}o(e){return e.displayNamesLocale===void 0?`displayNamesLocale`in e&&Vw(this.h,2):Vw(this.h,2,$C(e.displayNamesLocale)),`outputCategoryMask`in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),`outputConfidenceMasks`in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){Ej(this)}segment(e,t,n){let r=typeof t==`function`?{}:t;return this.j=typeof t==`function`?t:n,Dj(this),JA(this,e,r),Oj(this)}La(e,t,n,r){let i=typeof n==`function`?{}:n;return this.j=typeof n==`function`?n:r,Dj(this),YA(this,e,i,t),Oj(this)}Da(){return this.u}m(){var e=new QD;XD(e,`image_in`),XD(e,`norm_rect`);let t=new BD;gE(t,hk,this.h);let n=new GD;vT(n,2,`mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph`),UD(n,`IMAGE:image_in`),UD(n,`NORM_RECT:norm_rect`),n.o(t),YD(e,n),Yk(this,e),this.outputConfidenceMasks&&(ZD(e,`confidence_masks`),WD(n,`CONFIDENCE_MASKS:confidence_masks`),Xk(this,`confidence_masks`),this.g.aa(`confidence_masks`,((e,t)=>{this.confidenceMasks=e.map((e=>XA(this,e,!0,!this.j))),$(this,t)})),this.g.attachEmptyPacketListener(`confidence_masks`,(e=>{this.confidenceMasks=[],$(this,e)}))),this.outputCategoryMask&&(ZD(e,`category_mask`),WD(n,`CATEGORY_MASK:category_mask`),Xk(this,`category_mask`),this.g.Z(`category_mask`,((e,t)=>{this.categoryMask=XA(this,e,!1,!this.j),$(this,t)})),this.g.attachEmptyPacketListener(`category_mask`,(e=>{this.categoryMask=void 0,$(this,e)}))),ZD(e,`quality_scores`),WD(n,`QUALITY_SCORES:quality_scores`),this.g.attachFloatVectorListener(`quality_scores`,((e,t)=>{this.qualityScores=e,$(this,t)})),this.g.attachEmptyPacketListener(`quality_scores`,(e=>{this.categoryMask=void 0,$(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};kj.prototype.getLabels=kj.prototype.Da,kj.prototype.segmentForVideo=kj.prototype.La,kj.prototype.segment=kj.prototype.segment,kj.prototype.setOptions=kj.prototype.o,kj.createFromModelPath=function(e,t){return KA(kj,e,{baseOptions:{modelAssetPath:t}})},kj.createFromModelBuffer=function(e,t){return KA(kj,e,{baseOptions:{modelAssetBuffer:t}})},kj.createFromOptions=function(e,t){return KA(kj,e,t)};var Aj=class{constructor(e,t,n){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=n}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};Aj.prototype.close=Aj.prototype.close;var jj=class extends ZA{constructor(e,t){super(new GA(e,t),`image_in`,`norm_rect_in`,!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new mk,this.u=new uk,lT(this.h,0,3,this.u),lT(e=this.h,0,1,t=new AO)}get baseOptions(){return aT(this.h,AO,1)}set baseOptions(e){lT(this.h,0,1,e)}o(e){return`outputCategoryMask`in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),`outputConfidenceMasks`in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}segment(e,t,n,r){let i=typeof n==`function`?{}:n;if(this.j=typeof n==`function`?n:r,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,n=this.C+1,r=new yk,t.keypoint&&t.scribble)throw Error(`Cannot provide both keypoint and scribble.`);if(t.keypoint){var a=new gk;Zw(a,3,zC(!0),!1),Zw(a,1,LC(t.keypoint.x),0),Zw(a,2,LC(t.keypoint.y),0),uT(r,1,bk,a)}else{if(!t.scribble)throw Error(`Must provide either a keypoint or a scribble.`);{let e=new vk;for(a of t.scribble)Zw(t=new gk,3,zC(!0),!1),Zw(t,1,LC(a.x),0),Zw(t,2,LC(a.y),0),fT(e,1,gk,t);uT(r,2,bk,e)}}this.g.addProtoToStream(r.g(),`mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest`,`roi_in`,n),JA(this,e,i);t:{try{let e=new Aj(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=e;break t}this.j(e)}finally{Zk(this)}o=void 0}return o}m(){var e=new QD;XD(e,`image_in`),XD(e,`roi_in`),XD(e,`norm_rect_in`);let t=new BD;gE(t,hk,this.h);let n=new GD;vT(n,2,`mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2`),UD(n,`IMAGE:image_in`),UD(n,`ROI:roi_in`),UD(n,`NORM_RECT:norm_rect_in`),n.o(t),YD(e,n),Yk(this,e),this.outputConfidenceMasks&&(ZD(e,`confidence_masks`),WD(n,`CONFIDENCE_MASKS:confidence_masks`),Xk(this,`confidence_masks`),this.g.aa(`confidence_masks`,((e,t)=>{this.confidenceMasks=e.map((e=>XA(this,e,!0,!this.j))),$(this,t)})),this.g.attachEmptyPacketListener(`confidence_masks`,(e=>{this.confidenceMasks=[],$(this,e)}))),this.outputCategoryMask&&(ZD(e,`category_mask`),WD(n,`CATEGORY_MASK:category_mask`),Xk(this,`category_mask`),this.g.Z(`category_mask`,((e,t)=>{this.categoryMask=XA(this,e,!1,!this.j),$(this,t)})),this.g.attachEmptyPacketListener(`category_mask`,(e=>{this.categoryMask=void 0,$(this,e)}))),ZD(e,`quality_scores`),WD(n,`QUALITY_SCORES:quality_scores`),this.g.attachFloatVectorListener(`quality_scores`,((e,t)=>{this.qualityScores=e,$(this,t)})),this.g.attachEmptyPacketListener(`quality_scores`,(e=>{this.categoryMask=void 0,$(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};jj.prototype.segment=jj.prototype.segment,jj.prototype.setOptions=jj.prototype.o,jj.createFromModelPath=function(e,t){return KA(jj,e,{baseOptions:{modelAssetPath:t}})},jj.createFromModelBuffer=function(e,t){return KA(jj,e,{baseOptions:{modelAssetBuffer:t}})},jj.createFromOptions=function(e,t){return KA(jj,e,t)};var Mj=class extends ZA{constructor(e,t){super(new GA(e,t),`input_frame_gpu`,`norm_rect`,!1),this.j={detections:[]},lT(e=this.h=new xk,0,1,t=new AO)}get baseOptions(){return aT(this.h,AO,1)}set baseOptions(e){lT(this.h,0,1,e)}o(e){return e.displayNamesLocale===void 0?`displayNamesLocale`in e&&Vw(this.h,2):Vw(this.h,2,$C(e.displayNamesLocale)),e.maxResults===void 0?`maxResults`in e&&Vw(this.h,3):gT(this.h,3,e.maxResults),e.scoreThreshold===void 0?`scoreThreshold`in e&&Vw(this.h,4):_T(this.h,4,e.scoreThreshold),e.categoryAllowlist===void 0?`categoryAllowlist`in e&&Vw(this.h,5):yT(this.h,5,e.categoryAllowlist),e.categoryDenylist===void 0?`categoryDenylist`in e&&Vw(this.h,6):yT(this.h,6,e.categoryDenylist),this.l(e)}F(e,t){return this.j={detections:[]},JA(this,e,t),this.j}G(e,t,n){return this.j={detections:[]},YA(this,e,n,t),this.j}m(){var e=new QD;XD(e,`input_frame_gpu`),XD(e,`norm_rect`),ZD(e,`detections`);let t=new BD;gE(t,Sk,this.h);let n=new GD;vT(n,2,`mediapipe.tasks.vision.ObjectDetectorGraph`),UD(n,`IMAGE:input_frame_gpu`),UD(n,`NORM_RECT:norm_rect`),WD(n,`DETECTIONS:detections`),n.o(t),YD(e,n),this.g.attachProtoVectorListener(`detections`,((e,t)=>{for(let t of e)e=cO(t),this.j.detections.push(kk(e));$(this,t)})),this.g.attachEmptyPacketListener(`detections`,(e=>{$(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Mj.prototype.detectForVideo=Mj.prototype.G,Mj.prototype.detect=Mj.prototype.F,Mj.prototype.setOptions=Mj.prototype.o,Mj.createFromModelPath=async function(e,t){return KA(Mj,e,{baseOptions:{modelAssetPath:t}})},Mj.createFromModelBuffer=function(e,t){return KA(Mj,e,{baseOptions:{modelAssetBuffer:t}})},Mj.createFromOptions=function(e,t){return KA(Mj,e,t)};var Nj=class{constructor(e,t,n){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=n}close(){this.segmentationMasks?.forEach((e=>{e.close()}))}};function Pj(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function Fj(e){try{let t=new Nj(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.u)return t;e.u(t)}finally{Zk(e)}}Nj.prototype.close=Nj.prototype.close;var Ij=class extends ZA{constructor(e,t){super(new GA(e,t),`image_in`,`norm_rect`,!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,lT(e=this.h=new Ck,0,1,t=new AO),this.A=new nk,lT(this.h,0,3,this.A),this.j=new tk,lT(this.h,0,2,this.j),gT(this.j,4,1),_T(this.j,2,.5),_T(this.A,2,.5),_T(this.h,4,.5)}get baseOptions(){return aT(this.h,AO,1)}set baseOptions(e){lT(this.h,0,1,e)}o(e){return`numPoses`in e&&gT(this.j,4,e.numPoses??1),`minPoseDetectionConfidence`in e&&_T(this.j,2,e.minPoseDetectionConfidence??.5),`minTrackingConfidence`in e&&_T(this.h,4,e.minTrackingConfidence??.5),`minPosePresenceConfidence`in e&&_T(this.A,2,e.minPosePresenceConfidence??.5),`outputSegmentationMasks`in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}F(e,t,n){let r=typeof t==`function`?{}:t;return this.u=typeof t==`function`?t:n,Pj(this),JA(this,e,r),Fj(this)}G(e,t,n,r){let i=typeof n==`function`?{}:n;return this.u=typeof n==`function`?n:r,Pj(this),YA(this,e,i,t),Fj(this)}m(){var e=new QD;XD(e,`image_in`),XD(e,`norm_rect`),ZD(e,`normalized_landmarks`),ZD(e,`world_landmarks`),ZD(e,`segmentation_masks`);let t=new BD;gE(t,wk,this.h);let n=new GD;vT(n,2,`mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph`),UD(n,`IMAGE:image_in`),UD(n,`NORM_RECT:norm_rect`),WD(n,`NORM_LANDMARKS:normalized_landmarks`),WD(n,`WORLD_LANDMARKS:world_landmarks`),n.o(t),YD(e,n),Yk(this,e),this.g.attachProtoVectorListener(`normalized_landmarks`,((e,t)=>{this.landmarks=[];for(let t of e)e=fO(t),this.landmarks.push(Ak(e));$(this,t)})),this.g.attachEmptyPacketListener(`normalized_landmarks`,(e=>{this.landmarks=[],$(this,e)})),this.g.attachProtoVectorListener(`world_landmarks`,((e,t)=>{this.worldLandmarks=[];for(let t of e)e=uO(t),this.worldLandmarks.push(jk(e));$(this,t)})),this.g.attachEmptyPacketListener(`world_landmarks`,(e=>{this.worldLandmarks=[],$(this,e)})),this.outputSegmentationMasks&&(WD(n,`SEGMENTATION_MASK:segmentation_masks`),Xk(this,`segmentation_masks`),this.g.aa(`segmentation_masks`,((e,t)=>{this.segmentationMasks=e.map((e=>XA(this,e,!0,!this.u))),$(this,t)})),this.g.attachEmptyPacketListener(`segmentation_masks`,(e=>{this.segmentationMasks=[],$(this,e)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ij.prototype.detectForVideo=Ij.prototype.G,Ij.prototype.detect=Ij.prototype.F,Ij.prototype.setOptions=Ij.prototype.o,Ij.createFromModelPath=function(e,t){return KA(Ij,e,{baseOptions:{modelAssetPath:t}})},Ij.createFromModelBuffer=function(e,t){return KA(Ij,e,{baseOptions:{modelAssetBuffer:t}})},Ij.createFromOptions=function(e,t){return KA(Ij,e,t)},Ij.POSE_CONNECTIONS=vj;var Lj=`https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.32/wasm`,Rj=`https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/1/pose_landmarker_lite.task`,zj=e=>{let[t,r]=(0,n.useState)(!1),{isWebcamActive:i,setLandmarks:a}=h(),o=(0,n.useRef)(null);return(0,n.useEffect)(()=>((async()=>{try{let e=await Rk.forVisionTasks(Lj);o.current=await Ij.createFromOptions(e,{baseOptions:{modelAssetPath:Rj,delegate:`GPU`},runningMode:`VIDEO`,numPoses:1}),r(!0)}catch(e){console.error(`Failed to initialize MediaPipe Pose Landmarker:`,e)}})(),()=>{o.current&&o.current.close()}),[]),(0,n.useEffect)(()=>{if(!t||!i||!e.current||!o.current)return;let n,r=()=>{if(e.current&&e.current.readyState>=2){let t=performance.now(),n=o.current.detectForVideo(e.current,t);n.landmarks&&n.landmarks.length>0&&a(n.landmarks[0],n.worldLandmarks[0])}n=requestAnimationFrame(r)};return r(),()=>{cancelAnimationFrame(n)}},[t,i,e,a]),{isTrackerReady:t}},Bj=()=>({mapPoseToBones:(0,n.useCallback)((e,t)=>{if(!e||e.length===0||!t)return;let n=(e,t,n=new V(1,0,0))=>{let r=new V(t.x-e.x,-(t.y-e.y),t.z-e.z).normalize();return new Pn().setFromUnitVectors(n,r)},r=new V((e[23].x+e[24].x)/2,-(e[23].y+e[24].y)/2,(e[23].z+e[24].z)/2);t.Hips&&t.Hips.position.set(r.x,r.y+1,r.z),t.LeftUpperArm&&t.LeftUpperArm.quaternion.copy(n(e[11],e[13])),t.RightUpperArm&&t.RightUpperArm.quaternion.copy(n(e[12],e[14])),t.LeftUpperLeg&&t.LeftUpperLeg.quaternion.copy(n(e[23],e[25],new V(0,-1,0))),t.RightUpperLeg&&t.RightUpperLeg.quaternion.copy(n(e[24],e[26],new V(0,-1,0)))},[])}),Vj=()=>{let[e,t]=(0,n.useState)(null),{setFitResult:r}=h();return(0,n.useEffect)(()=>{let e=setInterval(()=>{t({shoulder:45,chest:100,waist:80}),r({type:`regular`,suitability:85})},1e3);return()=>clearInterval(e)},[r]),{dimensions:e}};function Hj(e){return e.replace(/\/+$/,``)}function Uj(e){try{return new URL(e).origin}catch{return``}}var Wj=class{baseUrl;apiOrigin;constructor(e=`/api/v1`){let t=Hj(e);this.baseUrl=t,this.apiOrigin=Uj(t)}resolveAssetUrl(e){return e?e.startsWith(`http://`)||e.startsWith(`https://`)?e:e.startsWith(`/`)?this.apiOrigin?`${this.apiOrigin}${e}`:e:this.apiOrigin?`${this.apiOrigin}/${e}`:`/${e}`:null}async listBodyPresets(e){return(await this.request(`body-presets/`,{params:e?{gender:e}:void 0})).map(e=>this.normalizeBodyPreset(e))}async matchBodyPreset(e){let t=await this.request(`body-presets/match`,{method:`POST`,body:e});return this.normalizeBodyPreset(t)}async listGarments(e){let t=await this.request(`garment/`,{params:e});return{...t,items:t.items.map(e=>this.normalizeGarmentSummary(e))}}async getGarment(e){let t=await this.request(`garment/${e}`);return this.normalizeGarmentDetail(t)}async getPipelineStatus(e){return this.request(`pipeline/${e}`)}async createGarment(e){let t=await this.request(`garment/`,{method:`POST`,body:e});return this.normalizeGarmentSummary(t)}async uploadGarmentImage(e,t,n){let r=new FormData;return r.append(`files`,t,`${n}_image.png`),r.append(`image_type`,n),(await this.request(`garment/${e}/images`,{method:`POST`,body:r})).map(e=>({...e,image_url:this.resolveAssetUrl(e.image_url)??e.image_url}))}async generateGarment3D(e,t){return this.request(`garment/${e}/generate-3d`,{method:`POST`,body:{include_measurements:t?.include_measurements??!1,target_fit_types:t?.target_fit_types??[`regular`]}})}async waitForGarmentModel(e,t){let n=t?.intervalMs??2e3,r=t?.timeoutMs??12e4,i=Date.now();for(;Date.now()-i<=r;){let t=await this.getGarment(e);if(this.pickGarmentModelUrl(t))return t;if(t.asset_status===`rigging_failed`)throw Error(`Garment 3D generation failed on backend.`);await new Promise(e=>globalThis.setTimeout(e,n))}throw Error(`Timed out while waiting for garment 3D model.`)}pickGarmentModelUrl(e){if(e.model_url)return e.model_url;let t=e.variants.find(e=>e.is_default&&e.model_url);return t?.model_url?t.model_url:e.variants.find(e=>e.model_url)?.model_url??null}normalizeBodyPreset(e){return{...e,model_url:this.resolveAssetUrl(e.model_url)}}normalizeGarmentSummary(e){return{...e,thumbnail_url:this.resolveAssetUrl(e.thumbnail_url),model_url:this.resolveAssetUrl(e.model_url)}}normalizeGarmentDetail(e){return{...this.normalizeGarmentSummary(e),brand:e.brand?{...e.brand,logo_url:this.resolveAssetUrl(e.brand.logo_url)}:null,images:e.images.map(e=>({...e,image_url:this.resolveAssetUrl(e.image_url)??e.image_url})),sizes:e.sizes,variants:e.variants.map(e=>({...e,model_url:this.resolveAssetUrl(e.model_url)}))}}async request(e,t){let n=this.buildUrl(e,t?.params),r=new Headers,i;t?.body instanceof FormData?i=t.body:t?.body!==void 0&&(r.set(`Content-Type`,`application/json`),i=JSON.stringify(t.body));let a=await fetch(n.toString(),{method:t?.method??`GET`,body:i,headers:r,credentials:`include`});if(!a.ok)throw Error(await this.getResponseErrorMessage(a));if(a.status!==204)return await a.json()}buildUrl(e,t){let n=this.baseUrl.startsWith(`http://`)||this.baseUrl.startsWith(`https://`)?`${this.baseUrl}/`:typeof window<`u`?new URL(`${this.baseUrl}/`,window.location.origin).toString():`http://localhost${this.baseUrl}/`,r=new URL(e.replace(/^\/+/,``),n);return t&&Object.entries(t).forEach(([e,t])=>{t!==void 0&&r.searchParams.set(e,String(t))}),r}async getResponseErrorMessage(e){try{let t=await e.json();return t.detail||t.message||t.error||`Request failed with status ${e.status}`}catch{return`Request failed with status ${e.status}`}}},Gj={gender:`female`};function Kj(e,t){return e instanceof Error&&e.message?e.message:t}function qj(e){let t=(0,n.useMemo)(()=>new Wj(e??`/api/v1`),[e]),[r,i]=(0,n.useState)(`idle`),[a,o]=(0,n.useState)(null),[s,c]=(0,n.useState)(null);return{status:r,resultUrl:a,error:s,generateAvatar:(0,n.useCallback)(async(e=Gj)=>{i(`processing`),c(null);try{let n=e instanceof Blob?Gj:e,r=await t.matchBodyPreset(n);if(!r.model_url)throw Error(`Matched body preset does not have a 3D model URL.`);return o(r.model_url),i(`ready`),r.model_url}catch(e){throw c(Kj(e,`Failed to load avatar model`)),i(`error`),e}},[t]),createGarment:(0,n.useCallback)(async(e,n,r,a)=>{i(`uploading`),c(null);try{let s=await t.createGarment(e);await t.uploadGarmentImage(s.id,n,`front`),r&&await t.uploadGarmentImage(s.id,r,`back`),i(`processing`),await t.generateGarment3D(s.id,{include_measurements:!!a,target_fit_types:[`regular`]});let c=await t.waitForGarmentModel(s.id),l=t.pickGarmentModelUrl(c);if(!l)throw Error(`Backend did not return a garment 3D model URL.`);return o(l),i(`ready`),l}catch(e){throw c(Kj(e,`Failed to generate garment`)),i(`error`),e}},[t]),reset:()=>{i(`idle`),o(null),c(null)}}}e.AvatarModel=Ix,e.CameraView=Fx,e.EverCanvas=Px,e.EverClient=Wj,e.EverProvider=cg,e.GarmentModel=Rx,e.useBodyMeasurer=Vj,e.useEver=sg,e.useEverGeneration=qj,e.useEverStore=h,e.usePoseMapper=Bj,e.usePoseTracker=zj});
4415
+ `}D(){let e=this.g;e.activeTexture(e.TEXTURE1),this.j=aA(this,e),e.activeTexture(e.TEXTURE2),this.C=aA(this,e)}m(){super.m();let e=this.g;this.M=$k(e.getUniformLocation(this.h,`defaultTexture`),`Uniform location`),this.P=$k(e.getUniformLocation(this.h,`overlayTexture`),`Uniform location`),this.I=$k(e.getUniformLocation(this.h,`maskTexture`),`Uniform location`)}l(){super.l();let e=this.g;e.uniform1i(this.I,0),e.uniform1i(this.M,1),e.uniform1i(this.P,2)}close(){this.j&&this.g.deleteTexture(this.j),this.C&&this.g.deleteTexture(this.C),super.close()}};function dA(e,t){switch(t){case 0:return e.g.find((e=>e instanceof Uint8Array));case 1:return e.g.find((e=>e instanceof Float32Array));case 2:return e.g.find((e=>typeof WebGLTexture<`u`&&e instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function fA(e){var t=dA(e,1);if(!t){if(t=dA(e,0))t=new Float32Array(t).map((e=>e/255));else{t=new Float32Array(e.width*e.height);let r=mA(e);var n=gA(e);if(oA(n,r,pA(e)),`iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod`.split(`;`).includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`document`in self&&`ontouchend`in self.document){n=new Float32Array(e.width*e.height*4),r.readPixels(0,0,e.width,e.height,r.RGBA,r.FLOAT,n);for(let e=0,r=0;e<t.length;++e,r+=4)t[e]=n[r]}else r.readPixels(0,0,e.width,e.height,r.RED,r.FLOAT,t)}e.g.push(t)}return t}function pA(e){let t=dA(e,2);if(!t){let n=mA(e);t=_A(e);let r=fA(e),i=hA(e);n.texImage2D(n.TEXTURE_2D,0,i,e.width,e.height,0,n.RED,n.FLOAT,r),vA(e)}return t}function mA(e){if(!e.canvas)throw Error(`Conversion to different image formats require that a canvas is passed when initializing the image.`);return e.h||=$k(e.canvas.getContext(`webgl2`),`You cannot use a canvas that is already bound to a different type of rendering context.`),e.h}function hA(e){if(e=mA(e),!yA)if(e.getExtension(`EXT_color_buffer_float`)&&e.getExtension(`OES_texture_float_linear`)&&e.getExtension(`EXT_float_blend`))yA=e.R32F;else{if(!e.getExtension(`EXT_color_buffer_half_float`))throw Error(`GPU does not fully support 4-channel float32 or float16 formats`);yA=e.R16F}return yA}function gA(e){return e.l||=new cA,e.l}function _A(e){let t=mA(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let n=dA(e,2);return n||(n=aA(gA(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(n),e.j=!0),t.bindTexture(t.TEXTURE_2D,n),n}function vA(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var yA,bA=class{constructor(e,t,n,r,i,a,o){this.g=e,this.m=t,this.j=n,this.canvas=r,this.l=i,this.width=a,this.height=o,this.j&&--xA===0&&console.error(`You seem to be creating MPMask instances without invoking .close(). This leaks resources.`)}Fa(){return!!dA(this,0)}ka(){return!!dA(this,1)}R(){return!!dA(this,2)}ja(){return(t=dA(e=this,0))||(t=fA(e),t=new Uint8Array(t.map((e=>Math.round(255*e)))),e.g.push(t)),t;var e,t}ia(){return fA(this)}N(){return pA(this)}clone(){let e=[];for(let t of this.g){let n;if(t instanceof Uint8Array)n=new Uint8Array(t);else if(t instanceof Float32Array)n=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{let e=mA(this),t=gA(this);e.activeTexture(e.TEXTURE1),n=aA(t,e,this.m?e.LINEAR:e.NEAREST),e.bindTexture(e.TEXTURE_2D,n);let r=hA(this);e.texImage2D(e.TEXTURE_2D,0,r,this.width,this.height,0,e.RED,e.FLOAT,null),e.bindTexture(e.TEXTURE_2D,null),oA(t,e,n),iA(t,e,!1,(()=>{_A(this),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),vA(this)})),sA(t),vA(this)}}e.push(n)}return new bA(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&mA(this).deleteTexture(dA(this,2)),xA=-1}};bA.prototype.close=bA.prototype.close,bA.prototype.clone=bA.prototype.clone,bA.prototype.getAsWebGLTexture=bA.prototype.N,bA.prototype.getAsFloat32Array=bA.prototype.ia,bA.prototype.getAsUint8Array=bA.prototype.ja,bA.prototype.hasWebGLTexture=bA.prototype.R,bA.prototype.hasFloat32Array=bA.prototype.ka,bA.prototype.hasUint8Array=bA.prototype.Fa;var xA=250,SA={color:`white`,lineWidth:4,radius:6};function CA(e){return{...SA,fillColor:(e||={}).color,...e}}function wA(e,t){return e instanceof Function?e(t):e}function TA(e,t,n){return Math.max(Math.min(t,n),Math.min(Math.max(t,n),e))}function EA(e){if(!e.l)throw Error(`CPU rendering requested but CanvasRenderingContext2D not provided.`);return e.l}function DA(e){if(!e.j)throw Error(`GPU rendering requested but WebGL2RenderingContext not provided.`);return e.j}function OA(e,t,n){if(t.R())n(t.N());else{let r=t.ka()?t.ia():t.ja();e.m=e.m??new cA;let i=DA(e);n((e=new bA([r],t.m,!1,i.canvas,e.m,t.width,t.height)).N()),e.close()}}function kA(e,t,n,r){let i=function(e){return e.g||=new lA,e.g}(e),a=DA(e),o=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n;iA(i,a,!0,(()=>{(function(e,t,n,r){let i=e.g;if(i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,t),i.activeTexture(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,e.C),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,n),e.I&&function(e,t){if(e!==t)return!1;e=e.entries(),t=t.entries();for(let[r,i]of e){e=r;let a=i;var n=t.next();if(n.done)return!1;let[o,s]=n.value;if(n=s,e!==o||a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])return!1}return!!t.next().done}(e.I,r))i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,e.j);else{e.I=r;let t=Array(1024).fill(0);r.forEach(((e,n)=>{if(e.length!==4)throw Error(`Color at index ${n} is not a four-channel value.`);t[4*n]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]})),i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,e.j),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,256,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array(t))}})(i,t,o,r),a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT),a.drawArrays(a.TRIANGLE_FAN,0,4);let e=i.g;e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,null)}))}function AA(e,t,n,r){let i=DA(e),a=function(e){return e.h||=new uA,e.h}(e),o=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n,s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;iA(a,i,!0,(()=>{var e=a.g;e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,a.j),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,o),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,a.C),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,s),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),i.bindTexture(i.TEXTURE_2D,null),(e=a.g).activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,null)}))}var jA=class{constructor(e,t){typeof CanvasRenderingContext2D<`u`&&e instanceof CanvasRenderingContext2D||e instanceof OffscreenCanvasRenderingContext2D?(this.l=e,this.j=t):this.j=e}ya(e,t){if(e){var n=EA(this);t=CA(t),n.save();var r=n.canvas,i=0;for(let a of e)n.fillStyle=wA(t.fillColor,{index:i,from:a}),n.strokeStyle=wA(t.color,{index:i,from:a}),n.lineWidth=wA(t.lineWidth,{index:i,from:a}),(e=new Path2D).arc(a.x*r.width,a.y*r.height,wA(t.radius,{index:i,from:a}),0,2*Math.PI),n.fill(e),n.stroke(e),++i;n.restore()}}xa(e,t,n){if(e&&t){var r=EA(this);n=CA(n),r.save();var i=r.canvas,a=0;for(let o of t){r.beginPath(),t=e[o.start];let s=e[o.end];t&&s&&(r.strokeStyle=wA(n.color,{index:a,from:t,to:s}),r.lineWidth=wA(n.lineWidth,{index:a,from:t,to:s}),r.moveTo(t.x*i.width,t.y*i.height),r.lineTo(s.x*i.width,s.y*i.height)),++a,r.stroke()}r.restore()}}ua(e,t){let n=EA(this);t=CA(t),n.save(),n.beginPath(),n.lineWidth=wA(t.lineWidth,{}),n.strokeStyle=wA(t.color,{}),n.fillStyle=wA(t.fillColor,{}),n.moveTo(e.originX,e.originY),n.lineTo(e.originX+e.width,e.originY),n.lineTo(e.originX+e.width,e.originY+e.height),n.lineTo(e.originX,e.originY+e.height),n.lineTo(e.originX,e.originY),n.stroke(),n.fill(),n.restore()}va(e,t,n=[0,0,0,255]){this.l?function(e,t,n,r){let i=DA(e);OA(e,t,(t=>{kA(e,t,n,r),(t=EA(e)).drawImage(i.canvas,0,0,t.canvas.width,t.canvas.height)}))}(this,e,n,t):kA(this,e.N(),n,t)}wa(e,t,n){this.l?function(e,t,n,r){let i=DA(e);OA(e,t,(t=>{AA(e,t,n,r),(t=EA(e)).drawImage(i.canvas,0,0,t.canvas.width,t.canvas.height)}))}(this,e,t,n):AA(this,e.N(),t,n)}close(){this.g?.close(),this.g=void 0,this.h?.close(),this.h=void 0,this.m?.close(),this.m=void 0}};function MA(e,t){switch(t){case 0:return e.g.find((e=>e instanceof ImageData));case 1:return e.g.find((e=>typeof ImageBitmap<`u`&&e instanceof ImageBitmap));case 2:return e.g.find((e=>typeof WebGLTexture<`u`&&e instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function NA(e){var t=MA(e,0);if(!t){t=FA(e);let n=IA(e),r=new Uint8Array(e.width*e.height*4);oA(n,t,PA(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,r),sA(n),t=new ImageData(new Uint8ClampedArray(r.buffer),e.width,e.height),e.g.push(t)}return t}function PA(e){let t=MA(e,2);if(!t){let n=FA(e);t=LA(e);let r=MA(e,1)||NA(e);n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,r),RA(e)}return t}function FA(e){if(!e.canvas)throw Error(`Conversion to different image formats require that a canvas is passed when initializing the image.`);return e.h||=$k(e.canvas.getContext(`webgl2`),`You cannot use a canvas that is already bound to a different type of rendering context.`),e.h}function IA(e){return e.l||=new cA,e.l}function LA(e){let t=FA(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let n=MA(e,2);return n||(n=aA(IA(e),t),e.g.push(n),e.m=!0),t.bindTexture(t.TEXTURE_2D,n),n}function RA(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function zA(e){let t=FA(e);return iA(IA(e),t,!0,(()=>function(e,t){let n=e.canvas;if(n.width===e.width&&n.height===e.height)return t();let r=n.width,i=n.height;return n.width=e.width,n.height=e.height,e=t(),n.width=r,n.height=i,e}(e,(()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error(`Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas`);return e.canvas.transferToImageBitmap()}))))}jA.prototype.close=jA.prototype.close,jA.prototype.drawConfidenceMask=jA.prototype.wa,jA.prototype.drawCategoryMask=jA.prototype.va,jA.prototype.drawBoundingBox=jA.prototype.ua,jA.prototype.drawConnectors=jA.prototype.xa,jA.prototype.drawLandmarks=jA.prototype.ya,jA.lerp=function(e,t,n,r,i){return TA(r*(1-(e-t)/(n-t))+i*(1-(n-e)/(n-t)),r,i)},jA.clamp=TA;var BA=class{constructor(e,t,n,r,i,a,o){this.g=e,this.j=t,this.m=n,this.canvas=r,this.l=i,this.width=a,this.height=o,(this.j||this.m)&&--VA===0&&console.error(`You seem to be creating MPImage instances without invoking .close(). This leaks resources.`)}Ea(){return!!MA(this,0)}la(){return!!MA(this,1)}R(){return!!MA(this,2)}Ca(){return NA(this)}Ba(){var e=MA(this,1);return e||(PA(this),LA(this),e=zA(this),RA(this),this.g.push(e),this.j=!0),e}N(){return PA(this)}clone(){let e=[];for(let t of this.g){let n;if(t instanceof ImageData)n=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){let e=FA(this),t=IA(this);e.activeTexture(e.TEXTURE1),n=aA(t,e),e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.width,this.height,0,e.RGBA,e.UNSIGNED_BYTE,null),e.bindTexture(e.TEXTURE_2D,null),oA(t,e,n),iA(t,e,!1,(()=>{LA(this),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),RA(this)})),sA(t),RA(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);PA(this),LA(this),n=zA(this),RA(this)}e.push(n)}return new BA(e,this.la(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&MA(this,1).close(),this.m&&FA(this).deleteTexture(MA(this,2)),VA=-1}};BA.prototype.close=BA.prototype.close,BA.prototype.clone=BA.prototype.clone,BA.prototype.getAsWebGLTexture=BA.prototype.N,BA.prototype.getAsImageBitmap=BA.prototype.Ba,BA.prototype.getAsImageData=BA.prototype.Ca,BA.prototype.hasWebGLTexture=BA.prototype.R,BA.prototype.hasImageBitmap=BA.prototype.la,BA.prototype.hasImageData=BA.prototype.Ea;var VA=250;function HA(...e){return e.map((([e,t])=>({start:e,end:t})))}var UA=function(e){return class extends e{Ja(){this.i._registerModelResourcesGraphService()}}}((WA=class{constructor(e,t){this.l=!0,this.i=e,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream==`function`,t===void 0?zk()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn(`OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas.`),this.i.canvas=document.createElement(`canvas`)):this.i.canvas=t}async initializeGraph(e){let t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(`.pbtxt`)||e.endsWith(`.textproto`)),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){let n=e.length,r=this.i._malloc(n);this.i.HEAPU8.set(e,r),t?this.i._changeBinaryGraph(n,r):this.i._changeTextGraph(n,r),this.i._free(r)}configureAudio(e,t,n,r,i){this.i._configureAudio||console.warn(`Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?`),Q(this,r||`input_audio`,(r=>{Q(this,i||=`audio_header`,(i=>{this.i._configureAudio(r,i,e,t??0,n)}))}))}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}ca(e){Wk(this,`__graph_config__`,(t=>{e(t)})),Q(this,`__graph_config__`,(e=>{this.i._getGraphConfig(e,void 0)})),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,n){this.addAudioToStreamWithShape(e,0,0,t,n)}addAudioToStreamWithShape(e,t,n,r,i){let a=4*e.length;this.h!==a&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(a),this.h=a),this.i.HEAPF32.set(e,this.g/4),Q(this,r,(e=>{this.i._addAudioToInputStream(this.g,t,n,e,i)}))}addGpuBufferToStream(e,t,n){Q(this,t,(t=>{let[r,i]=Hk(this,e,t);this.i._addBoundTextureToStream(t,r,i,n)}))}addBoolToStream(e,t,n){Q(this,t,(t=>{this.i._addBoolToInputStream(e,t,n)}))}addDoubleToStream(e,t,n){Q(this,t,(t=>{this.i._addDoubleToInputStream(e,t,n)}))}addFloatToStream(e,t,n){Q(this,t,(t=>{this.i._addFloatToInputStream(e,t,n)}))}addIntToStream(e,t,n){Q(this,t,(t=>{this.i._addIntToInputStream(e,t,n)}))}addUintToStream(e,t,n){Q(this,t,(t=>{this.i._addUintToInputStream(e,t,n)}))}addStringToStream(e,t,n){Q(this,t,(t=>{Q(this,e,(e=>{this.i._addStringToInputStream(e,t,n)}))}))}addStringRecordToStream(e,t,n){Q(this,t,(t=>{Uk(this,Object.keys(e),(r=>{Uk(this,Object.values(e),(i=>{this.i._addFlatHashMapToInputStream(r,i,Object.keys(e).length,t,n)}))}))}))}addProtoToStream(e,t,n,r){Q(this,n,(n=>{Q(this,t,(t=>{let i=this.i._malloc(e.length);this.i.HEAPU8.set(e,i),this.i._addProtoToInputStream(i,e.length,t,n,r),this.i._free(i)}))}))}addEmptyPacketToStream(e,t){Q(this,e,(e=>{this.i._addEmptyPacketToInputStream(e,t)}))}addBoolVectorToStream(e,t,n){Q(this,t,(t=>{let r=this.i._allocateBoolVector(e.length);if(!r)throw Error(`Unable to allocate new bool vector on heap.`);for(let t of e)this.i._addBoolVectorEntry(r,t);this.i._addBoolVectorToInputStream(r,t,n)}))}addDoubleVectorToStream(e,t,n){Q(this,t,(t=>{let r=this.i._allocateDoubleVector(e.length);if(!r)throw Error(`Unable to allocate new double vector on heap.`);for(let t of e)this.i._addDoubleVectorEntry(r,t);this.i._addDoubleVectorToInputStream(r,t,n)}))}addFloatVectorToStream(e,t,n){Q(this,t,(t=>{let r=this.i._allocateFloatVector(e.length);if(!r)throw Error(`Unable to allocate new float vector on heap.`);for(let t of e)this.i._addFloatVectorEntry(r,t);this.i._addFloatVectorToInputStream(r,t,n)}))}addIntVectorToStream(e,t,n){Q(this,t,(t=>{let r=this.i._allocateIntVector(e.length);if(!r)throw Error(`Unable to allocate new int vector on heap.`);for(let t of e)this.i._addIntVectorEntry(r,t);this.i._addIntVectorToInputStream(r,t,n)}))}addUintVectorToStream(e,t,n){Q(this,t,(t=>{let r=this.i._allocateUintVector(e.length);if(!r)throw Error(`Unable to allocate new unsigned int vector on heap.`);for(let t of e)this.i._addUintVectorEntry(r,t);this.i._addUintVectorToInputStream(r,t,n)}))}addStringVectorToStream(e,t,n){Q(this,t,(t=>{let r=this.i._allocateStringVector(e.length);if(!r)throw Error(`Unable to allocate new string vector on heap.`);for(let t of e)Q(this,t,(e=>{this.i._addStringVectorEntry(r,e)}));this.i._addStringVectorToInputStream(r,t,n)}))}addBoolToInputSidePacket(e,t){Q(this,t,(t=>{this.i._addBoolToInputSidePacket(e,t)}))}addDoubleToInputSidePacket(e,t){Q(this,t,(t=>{this.i._addDoubleToInputSidePacket(e,t)}))}addFloatToInputSidePacket(e,t){Q(this,t,(t=>{this.i._addFloatToInputSidePacket(e,t)}))}addIntToInputSidePacket(e,t){Q(this,t,(t=>{this.i._addIntToInputSidePacket(e,t)}))}addUintToInputSidePacket(e,t){Q(this,t,(t=>{this.i._addUintToInputSidePacket(e,t)}))}addStringToInputSidePacket(e,t){Q(this,t,(t=>{Q(this,e,(e=>{this.i._addStringToInputSidePacket(e,t)}))}))}addProtoToInputSidePacket(e,t,n){Q(this,n,(n=>{Q(this,t,(t=>{let r=this.i._malloc(e.length);this.i.HEAPU8.set(e,r),this.i._addProtoToInputSidePacket(r,e.length,t,n),this.i._free(r)}))}))}addBoolVectorToInputSidePacket(e,t){Q(this,t,(t=>{let n=this.i._allocateBoolVector(e.length);if(!n)throw Error(`Unable to allocate new bool vector on heap.`);for(let t of e)this.i._addBoolVectorEntry(n,t);this.i._addBoolVectorToInputSidePacket(n,t)}))}addDoubleVectorToInputSidePacket(e,t){Q(this,t,(t=>{let n=this.i._allocateDoubleVector(e.length);if(!n)throw Error(`Unable to allocate new double vector on heap.`);for(let t of e)this.i._addDoubleVectorEntry(n,t);this.i._addDoubleVectorToInputSidePacket(n,t)}))}addFloatVectorToInputSidePacket(e,t){Q(this,t,(t=>{let n=this.i._allocateFloatVector(e.length);if(!n)throw Error(`Unable to allocate new float vector on heap.`);for(let t of e)this.i._addFloatVectorEntry(n,t);this.i._addFloatVectorToInputSidePacket(n,t)}))}addIntVectorToInputSidePacket(e,t){Q(this,t,(t=>{let n=this.i._allocateIntVector(e.length);if(!n)throw Error(`Unable to allocate new int vector on heap.`);for(let t of e)this.i._addIntVectorEntry(n,t);this.i._addIntVectorToInputSidePacket(n,t)}))}addUintVectorToInputSidePacket(e,t){Q(this,t,(t=>{let n=this.i._allocateUintVector(e.length);if(!n)throw Error(`Unable to allocate new unsigned int vector on heap.`);for(let t of e)this.i._addUintVectorEntry(n,t);this.i._addUintVectorToInputSidePacket(n,t)}))}addStringVectorToInputSidePacket(e,t){Q(this,t,(t=>{let n=this.i._allocateStringVector(e.length);if(!n)throw Error(`Unable to allocate new string vector on heap.`);for(let t of e)Q(this,t,(e=>{this.i._addStringVectorEntry(n,e)}));this.i._addStringVectorToInputSidePacket(n,t)}))}attachBoolListener(e,t){Wk(this,e,t),Q(this,e,(e=>{this.i._attachBoolListener(e)}))}attachBoolVectorListener(e,t){Gk(this,e,t),Q(this,e,(e=>{this.i._attachBoolVectorListener(e)}))}attachIntListener(e,t){Wk(this,e,t),Q(this,e,(e=>{this.i._attachIntListener(e)}))}attachIntVectorListener(e,t){Gk(this,e,t),Q(this,e,(e=>{this.i._attachIntVectorListener(e)}))}attachUintListener(e,t){Wk(this,e,t),Q(this,e,(e=>{this.i._attachUintListener(e)}))}attachUintVectorListener(e,t){Gk(this,e,t),Q(this,e,(e=>{this.i._attachUintVectorListener(e)}))}attachDoubleListener(e,t){Wk(this,e,t),Q(this,e,(e=>{this.i._attachDoubleListener(e)}))}attachDoubleVectorListener(e,t){Gk(this,e,t),Q(this,e,(e=>{this.i._attachDoubleVectorListener(e)}))}attachFloatListener(e,t){Wk(this,e,t),Q(this,e,(e=>{this.i._attachFloatListener(e)}))}attachFloatVectorListener(e,t){Gk(this,e,t),Q(this,e,(e=>{this.i._attachFloatVectorListener(e)}))}attachStringListener(e,t){Wk(this,e,t),Q(this,e,(e=>{this.i._attachStringListener(e)}))}attachStringVectorListener(e,t){Gk(this,e,t),Q(this,e,(e=>{this.i._attachStringVectorListener(e)}))}attachProtoListener(e,t,n){Wk(this,e,t),Q(this,e,(e=>{this.i._attachProtoListener(e,n||!1)}))}attachProtoVectorListener(e,t,n){Gk(this,e,t),Q(this,e,(e=>{this.i._attachProtoVectorListener(e,n||!1)}))}attachAudioListener(e,t,n){this.i._attachAudioListener||console.warn(`Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?`),Wk(this,e,((e,n)=>{e=new Float32Array(e.buffer,e.byteOffset,e.length/4),t(e,n)})),Q(this,e,(e=>{this.i._attachAudioListener(e,n||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends WA{get ga(){return this.i}pa(e,t,n){Q(this,t,(t=>{let[r,i]=Hk(this,e,t);this.ga._addBoundTextureAsImageToStream(t,r,i,n)}))}Z(e,t){Wk(this,e,t),Q(this,e,(e=>{this.ga._attachImageListener(e)}))}aa(e,t){Gk(this,e,t),Q(this,e,(e=>{this.ga._attachImageVectorListener(e)}))}})),WA,GA=class extends UA{};async function KA(e,t,n){return async function(e,t,n,r){return Kk(e,t,n,r)}(e,n.canvas??(zk()?void 0:document.createElement(`canvas`)),t,n)}function qA(e,t,n,r){if(e.U){let a=new hO;if(n?.regionOfInterest){if(!e.oa)throw Error(`This task doesn't support region-of-interest.`);var i=n.regionOfInterest;if(i.left>=i.right||i.top>=i.bottom)throw Error(`Expected RectF with left < right and top < bottom.`);if(i.left<0||i.top<0||i.right>1||i.bottom>1)throw Error(`Expected RectF values to be in [0,1].`);_T(a,1,(i.left+i.right)/2),_T(a,2,(i.top+i.bottom)/2),_T(a,4,i.right-i.left),_T(a,3,i.bottom-i.top)}else _T(a,1,.5),_T(a,2,.5),_T(a,4,1),_T(a,3,1);if(n?.rotationDegrees){if(n?.rotationDegrees%90!=0)throw Error(`Expected rotation to be a multiple of 90°.`);if(_T(a,5,-Math.PI*n.rotationDegrees/180),n?.rotationDegrees%180!=0){let[e,r]=Vk(t);n=hT(a,3)*r/e,i=hT(a,4)*e/r,_T(a,4,n),_T(a,3,i)}}e.g.addProtoToStream(a.g(),`mediapipe.NormalizedRect`,e.U,r)}e.g.pa(t,e.X,r??performance.now()),e.finishProcessing()}function JA(e,t,n){if(e.baseOptions?.g())throw Error(`Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.`);qA(e,t,n,e.C+1)}function YA(e,t,n,r){if(!e.baseOptions?.g())throw Error(`Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.`);qA(e,t,n,r)}function XA(e,t,n,r){var i=t.data;let a=t.width,o=a*(t=t.height);if((i instanceof Uint8Array||i instanceof Float32Array)&&i.length!==o)throw Error(`Unsupported channel count: `+i.length/o);return e=new bA([i],n,!1,e.g.i.canvas,e.P,a,t),r?e.clone():e}var ZA=class extends Qk{constructor(e,t,n,r){super(e),this.g=e,this.X=t,this.U=n,this.oa=r,this.P=new cA}l(e,t=!0){if(`runningMode`in e&&Vw(this.baseOptions,2,zC(!!e.runningMode&&e.runningMode!==`IMAGE`)),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error(`You must create a new task to reset the canvas.`);return super.l(e,t)}close(){this.P.close(),super.close()}};ZA.prototype.close=ZA.prototype.close;var QA=class extends ZA{constructor(e,t){super(new GA(e,t),`image_in`,`norm_rect_in`,!1),this.j={detections:[]},lT(e=this.h=new NO,0,1,t=new AO),_T(this.h,2,.5),_T(this.h,3,.3)}get baseOptions(){return aT(this.h,AO,1)}set baseOptions(e){lT(this.h,0,1,e)}o(e){return`minDetectionConfidence`in e&&_T(this.h,2,e.minDetectionConfidence??.5),`minSuppressionThreshold`in e&&_T(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},JA(this,e,t),this.j}G(e,t,n){return this.j={detections:[]},YA(this,e,n,t),this.j}m(){var e=new QD;XD(e,`image_in`),XD(e,`norm_rect_in`),ZD(e,`detections`);let t=new BD;gE(t,FO,this.h);let n=new GD;vT(n,2,`mediapipe.tasks.vision.face_detector.FaceDetectorGraph`),UD(n,`IMAGE:image_in`),UD(n,`NORM_RECT:norm_rect_in`),WD(n,`DETECTIONS:detections`),n.o(t),YD(e,n),this.g.attachProtoVectorListener(`detections`,((e,t)=>{for(let t of e)e=cO(t),this.j.detections.push(kk(e));$(this,t)})),this.g.attachEmptyPacketListener(`detections`,(e=>{$(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};QA.prototype.detectForVideo=QA.prototype.G,QA.prototype.detect=QA.prototype.F,QA.prototype.setOptions=QA.prototype.o,QA.createFromModelPath=async function(e,t){return KA(QA,e,{baseOptions:{modelAssetPath:t}})},QA.createFromModelBuffer=function(e,t){return KA(QA,e,{baseOptions:{modelAssetBuffer:t}})},QA.createFromOptions=function(e,t){return KA(QA,e,t)};var $A=HA([61,146],[146,91],[91,181],[181,84],[84,17],[17,314],[314,405],[405,321],[321,375],[375,291],[61,185],[185,40],[40,39],[39,37],[37,0],[0,267],[267,269],[269,270],[270,409],[409,291],[78,95],[95,88],[88,178],[178,87],[87,14],[14,317],[317,402],[402,318],[318,324],[324,308],[78,191],[191,80],[80,81],[81,82],[82,13],[13,312],[312,311],[311,310],[310,415],[415,308]),ej=HA([263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],[386,385],[385,384],[384,398],[398,362]),tj=HA([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),nj=HA([474,475],[475,476],[476,477],[477,474]),rj=HA([33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]),ij=HA([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),aj=HA([469,470],[470,471],[471,472],[472,469]),oj=HA([10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]),sj=[...$A,...ej,...tj,...rj,...ij,...oj],cj=HA([127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]);function lj(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var uj=class extends ZA{constructor(e,t){super(new GA(e,t),`image_in`,`norm_rect`,!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,lT(e=this.h=new RO,0,1,t=new AO),this.A=new LO,lT(this.h,0,3,this.A),this.u=new NO,lT(this.h,0,2,this.u),gT(this.u,4,1),_T(this.u,2,.5),_T(this.A,2,.5),_T(this.h,4,.5)}get baseOptions(){return aT(this.h,AO,1)}set baseOptions(e){lT(this.h,0,1,e)}o(e){return`numFaces`in e&&gT(this.u,4,e.numFaces??1),`minFaceDetectionConfidence`in e&&_T(this.u,2,e.minFaceDetectionConfidence??.5),`minTrackingConfidence`in e&&_T(this.h,4,e.minTrackingConfidence??.5),`minFacePresenceConfidence`in e&&_T(this.A,2,e.minFacePresenceConfidence??.5),`outputFaceBlendshapes`in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),`outputFacialTransformationMatrixes`in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}F(e,t){return lj(this),JA(this,e,t),this.j}G(e,t,n){return lj(this),YA(this,e,n,t),this.j}m(){var e=new QD;XD(e,`image_in`),XD(e,`norm_rect`),ZD(e,`face_landmarks`);let t=new BD;gE(t,BO,this.h);let n=new GD;vT(n,2,`mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph`),UD(n,`IMAGE:image_in`),UD(n,`NORM_RECT:norm_rect`),WD(n,`NORM_LANDMARKS:face_landmarks`),n.o(t),YD(e,n),this.g.attachProtoVectorListener(`face_landmarks`,((e,t)=>{for(let t of e)e=fO(t),this.j.faceLandmarks.push(Ak(e));$(this,t)})),this.g.attachEmptyPacketListener(`face_landmarks`,(e=>{$(this,e)})),this.outputFaceBlendshapes&&(ZD(e,`blendshapes`),WD(n,`BLENDSHAPES:blendshapes`),this.g.attachProtoVectorListener(`blendshapes`,((e,t)=>{if(this.outputFaceBlendshapes)for(let t of e)e=iO(t),this.j.faceBlendshapes.push(Dk(e.g()??[]));$(this,t)})),this.g.attachEmptyPacketListener(`blendshapes`,(e=>{$(this,e)}))),this.outputFacialTransformationMatrixes&&(ZD(e,`face_geometry`),WD(n,`FACE_GEOMETRY:face_geometry`),this.g.attachProtoVectorListener(`face_geometry`,((e,t)=>{if(this.outputFacialTransformationMatrixes)for(let t of e)(e=aT(e=IO(t),pO,2))&&this.j.facialTransformationMatrixes.push({rows:pT(e,1)??0??0,columns:pT(e,2)??0??0,data:Ww(e,3,RC,Uw()).slice()??[]});$(this,t)})),this.g.attachEmptyPacketListener(`face_geometry`,(e=>{$(this,e)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};uj.prototype.detectForVideo=uj.prototype.G,uj.prototype.detect=uj.prototype.F,uj.prototype.setOptions=uj.prototype.o,uj.createFromModelPath=function(e,t){return KA(uj,e,{baseOptions:{modelAssetPath:t}})},uj.createFromModelBuffer=function(e,t){return KA(uj,e,{baseOptions:{modelAssetBuffer:t}})},uj.createFromOptions=function(e,t){return KA(uj,e,t)},uj.FACE_LANDMARKS_LIPS=$A,uj.FACE_LANDMARKS_LEFT_EYE=ej,uj.FACE_LANDMARKS_LEFT_EYEBROW=tj,uj.FACE_LANDMARKS_LEFT_IRIS=nj,uj.FACE_LANDMARKS_RIGHT_EYE=rj,uj.FACE_LANDMARKS_RIGHT_EYEBROW=ij,uj.FACE_LANDMARKS_RIGHT_IRIS=aj,uj.FACE_LANDMARKS_FACE_OVAL=oj,uj.FACE_LANDMARKS_CONTOURS=sj,uj.FACE_LANDMARKS_TESSELATION=cj;var dj=HA([0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]);function fj(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function pj(e){return e.gestures.length===0?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:e.gestures,landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handedness:e.handedness,handednesses:e.handedness}}function mj(e,t=!0){let n=[];for(let i of e){var r=iO(i);e=[];for(let n of r.g())r=t&&pT(n,1)!=null?pT(n,1)??0:-1,e.push({score:hT(n,2)??0,index:r,categoryName:ew(zw(n,3))??``??``,displayName:ew(zw(n,4))??``??``});n.push(e)}return n}var hj=class extends ZA{constructor(e,t){super(new GA(e,t),`image_in`,`norm_rect`,!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],lT(e=this.j=new qO,0,1,t=new AO),this.u=new KO,lT(this.j,0,2,this.u),this.D=new GO,lT(this.u,0,3,this.D),this.A=new WO,lT(this.u,0,2,this.A),this.h=new UO,lT(this.j,0,3,this.h),_T(this.A,2,.5),_T(this.u,4,.5),_T(this.D,2,.5)}get baseOptions(){return aT(this.j,AO,1)}set baseOptions(e){lT(this.j,0,1,e)}o(e){if(gT(this.A,3,e.numHands??1),`minHandDetectionConfidence`in e&&_T(this.A,2,e.minHandDetectionConfidence??.5),`minTrackingConfidence`in e&&_T(this.u,4,e.minTrackingConfidence??.5),`minHandPresenceConfidence`in e&&_T(this.D,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new VO,n=t,r=Tk(e.cannedGesturesClassifierOptions,aT(this.h,VO,3)?.l());lT(n,0,2,r),lT(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&aT(this.h,VO,3)?.g();return e.customGesturesClassifierOptions?(lT(n=t=new VO,0,2,r=Tk(e.customGesturesClassifierOptions,aT(this.h,VO,4)?.l())),lT(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&aT(this.h,VO,4)?.g(),this.l(e)}Ha(e,t){return fj(this),JA(this,e,t),pj(this)}Ia(e,t,n){return fj(this),YA(this,e,n,t),pj(this)}m(){var e=new QD;XD(e,`image_in`),XD(e,`norm_rect`),ZD(e,`hand_gestures`),ZD(e,`hand_landmarks`),ZD(e,`world_hand_landmarks`),ZD(e,`handedness`);let t=new BD;gE(t,QO,this.j);let n=new GD;vT(n,2,`mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph`),UD(n,`IMAGE:image_in`),UD(n,`NORM_RECT:norm_rect`),WD(n,`HAND_GESTURES:hand_gestures`),WD(n,`LANDMARKS:hand_landmarks`),WD(n,`WORLD_LANDMARKS:world_hand_landmarks`),WD(n,`HANDEDNESS:handedness`),n.o(t),YD(e,n),this.g.attachProtoVectorListener(`hand_landmarks`,((e,t)=>{for(let t of e){e=fO(t);let n=[];for(let t of sT(e,dO,1))n.push({x:hT(t,1)??0,y:hT(t,2)??0,z:hT(t,3)??0,visibility:hT(t,4)??0});this.landmarks.push(n)}$(this,t)})),this.g.attachEmptyPacketListener(`hand_landmarks`,(e=>{$(this,e)})),this.g.attachProtoVectorListener(`world_hand_landmarks`,((e,t)=>{for(let t of e){e=uO(t);let n=[];for(let t of sT(e,lO,1))n.push({x:hT(t,1)??0,y:hT(t,2)??0,z:hT(t,3)??0,visibility:hT(t,4)??0});this.worldLandmarks.push(n)}$(this,t)})),this.g.attachEmptyPacketListener(`world_hand_landmarks`,(e=>{$(this,e)})),this.g.attachProtoVectorListener(`hand_gestures`,((e,t)=>{this.gestures.push(...mj(e,!1)),$(this,t)})),this.g.attachEmptyPacketListener(`hand_gestures`,(e=>{$(this,e)})),this.g.attachProtoVectorListener(`handedness`,((e,t)=>{this.handedness.push(...mj(e)),$(this,t)})),this.g.attachEmptyPacketListener(`handedness`,(e=>{$(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function gj(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}hj.prototype.recognizeForVideo=hj.prototype.Ia,hj.prototype.recognize=hj.prototype.Ha,hj.prototype.setOptions=hj.prototype.o,hj.createFromModelPath=function(e,t){return KA(hj,e,{baseOptions:{modelAssetPath:t}})},hj.createFromModelBuffer=function(e,t){return KA(hj,e,{baseOptions:{modelAssetBuffer:t}})},hj.createFromOptions=function(e,t){return KA(hj,e,t)},hj.HAND_CONNECTIONS=dj;var _j=class extends ZA{constructor(e,t){super(new GA(e,t),`image_in`,`norm_rect`,!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],lT(e=this.h=new KO,0,1,t=new AO),this.u=new GO,lT(this.h,0,3,this.u),this.j=new WO,lT(this.h,0,2,this.j),gT(this.j,3,1),_T(this.j,2,.5),_T(this.u,2,.5),_T(this.h,4,.5)}get baseOptions(){return aT(this.h,AO,1)}set baseOptions(e){lT(this.h,0,1,e)}o(e){return`numHands`in e&&gT(this.j,3,e.numHands??1),`minHandDetectionConfidence`in e&&_T(this.j,2,e.minHandDetectionConfidence??.5),`minTrackingConfidence`in e&&_T(this.h,4,e.minTrackingConfidence??.5),`minHandPresenceConfidence`in e&&_T(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],JA(this,e,t),gj(this)}G(e,t,n){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],YA(this,e,n,t),gj(this)}m(){var e=new QD;XD(e,`image_in`),XD(e,`norm_rect`),ZD(e,`hand_landmarks`),ZD(e,`world_hand_landmarks`),ZD(e,`handedness`);let t=new BD;gE(t,$O,this.h);let n=new GD;vT(n,2,`mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph`),UD(n,`IMAGE:image_in`),UD(n,`NORM_RECT:norm_rect`),WD(n,`LANDMARKS:hand_landmarks`),WD(n,`WORLD_LANDMARKS:world_hand_landmarks`),WD(n,`HANDEDNESS:handedness`),n.o(t),YD(e,n),this.g.attachProtoVectorListener(`hand_landmarks`,((e,t)=>{for(let t of e)e=fO(t),this.landmarks.push(Ak(e));$(this,t)})),this.g.attachEmptyPacketListener(`hand_landmarks`,(e=>{$(this,e)})),this.g.attachProtoVectorListener(`world_hand_landmarks`,((e,t)=>{for(let t of e)e=uO(t),this.worldLandmarks.push(jk(e));$(this,t)})),this.g.attachEmptyPacketListener(`world_hand_landmarks`,(e=>{$(this,e)})),this.g.attachProtoVectorListener(`handedness`,((e,t)=>{var n=this.handedness,r=n.push;let i=[];for(let t of e){e=iO(t);let n=[];for(let t of e.g())n.push({score:hT(t,2)??0,index:pT(t,1)??0??-1,categoryName:ew(zw(t,3))??``??``,displayName:ew(zw(t,4))??``??``});i.push(n)}r.call(n,...i),$(this,t)})),this.g.attachEmptyPacketListener(`handedness`,(e=>{$(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};_j.prototype.detectForVideo=_j.prototype.G,_j.prototype.detect=_j.prototype.F,_j.prototype.setOptions=_j.prototype.o,_j.createFromModelPath=function(e,t){return KA(_j,e,{baseOptions:{modelAssetPath:t}})},_j.createFromModelBuffer=function(e,t){return KA(_j,e,{baseOptions:{modelAssetBuffer:t}})},_j.createFromOptions=function(e,t){return KA(_j,e,t)},_j.HAND_CONNECTIONS=dj;var vj=HA([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);function yj(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function bj(e){try{if(!e.D)return e.h;e.D(e.h)}finally{Zk(e)}}function xj(e,t){e=fO(e),t.push(Ak(e))}var Sj=class extends ZA{constructor(e,t){super(new GA(e,t),`input_frames_image`,null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,lT(e=this.j=new rk,0,1,t=new AO),this.I=new GO,lT(this.j,0,2,this.I),this.W=new ek,lT(this.j,0,3,this.W),this.u=new NO,lT(this.j,0,4,this.u),this.O=new LO,lT(this.j,0,5,this.O),this.A=new tk,lT(this.j,0,6,this.A),this.M=new nk,lT(this.j,0,7,this.M),_T(this.u,2,.5),_T(this.u,3,.3),_T(this.O,2,.5),_T(this.A,2,.5),_T(this.A,3,.3),_T(this.M,2,.5),_T(this.I,2,.5)}get baseOptions(){return aT(this.j,AO,1)}set baseOptions(e){lT(this.j,0,1,e)}o(e){return`minFaceDetectionConfidence`in e&&_T(this.u,2,e.minFaceDetectionConfidence??.5),`minFaceSuppressionThreshold`in e&&_T(this.u,3,e.minFaceSuppressionThreshold??.3),`minFacePresenceConfidence`in e&&_T(this.O,2,e.minFacePresenceConfidence??.5),`outputFaceBlendshapes`in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),`minPoseDetectionConfidence`in e&&_T(this.A,2,e.minPoseDetectionConfidence??.5),`minPoseSuppressionThreshold`in e&&_T(this.A,3,e.minPoseSuppressionThreshold??.3),`minPosePresenceConfidence`in e&&_T(this.M,2,e.minPosePresenceConfidence??.5),`outputPoseSegmentationMasks`in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),`minHandLandmarksConfidence`in e&&_T(this.I,2,e.minHandLandmarksConfidence??.5),this.l(e)}F(e,t,n){let r=typeof t==`function`?{}:t;return this.D=typeof t==`function`?t:n,yj(this),JA(this,e,r),bj(this)}G(e,t,n,r){let i=typeof n==`function`?{}:n;return this.D=typeof n==`function`?n:r,yj(this),YA(this,e,i,t),bj(this)}m(){var e=new QD;XD(e,`input_frames_image`),ZD(e,`pose_landmarks`),ZD(e,`pose_world_landmarks`),ZD(e,`face_landmarks`),ZD(e,`left_hand_landmarks`),ZD(e,`left_hand_world_landmarks`),ZD(e,`right_hand_landmarks`),ZD(e,`right_hand_world_landmarks`);let t=new BD,n=new ED;vT(n,1,`type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions`),function(e,t){if(t!=null)if(Array.isArray(t))Vw(e,2,yw(t,0,xw));else{if(!(typeof t==`string`||t instanceof yS||hS(t)))throw Error(`invalid value in Any.value field: `+t+` expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array`);Zw(e,2,XS(t,!1),_S())}}(n,this.j.g());let r=new GD;vT(r,2,`mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph`),fT(r,8,ED,n),UD(r,`IMAGE:input_frames_image`),WD(r,`POSE_LANDMARKS:pose_landmarks`),WD(r,`POSE_WORLD_LANDMARKS:pose_world_landmarks`),WD(r,`FACE_LANDMARKS:face_landmarks`),WD(r,`LEFT_HAND_LANDMARKS:left_hand_landmarks`),WD(r,`LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks`),WD(r,`RIGHT_HAND_LANDMARKS:right_hand_landmarks`),WD(r,`RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks`),r.o(t),YD(e,r),Yk(this,e),this.g.attachProtoListener(`pose_landmarks`,((e,t)=>{xj(e,this.h.poseLandmarks),$(this,t)})),this.g.attachEmptyPacketListener(`pose_landmarks`,(e=>{$(this,e)})),this.g.attachProtoListener(`pose_world_landmarks`,((e,t)=>{var n=this.h.poseWorldLandmarks;e=uO(e),n.push(jk(e)),$(this,t)})),this.g.attachEmptyPacketListener(`pose_world_landmarks`,(e=>{$(this,e)})),this.outputPoseSegmentationMasks&&(WD(r,`POSE_SEGMENTATION_MASK:pose_segmentation_mask`),Xk(this,`pose_segmentation_mask`),this.g.Z(`pose_segmentation_mask`,((e,t)=>{this.h.poseSegmentationMasks=[XA(this,e,!0,!this.D)],$(this,t)})),this.g.attachEmptyPacketListener(`pose_segmentation_mask`,(e=>{this.h.poseSegmentationMasks=[],$(this,e)}))),this.g.attachProtoListener(`face_landmarks`,((e,t)=>{xj(e,this.h.faceLandmarks),$(this,t)})),this.g.attachEmptyPacketListener(`face_landmarks`,(e=>{$(this,e)})),this.outputFaceBlendshapes&&(ZD(e,`extra_blendshapes`),WD(r,`FACE_BLENDSHAPES:extra_blendshapes`),this.g.attachProtoListener(`extra_blendshapes`,((e,t)=>{var n=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(e=iO(e),n.push(Dk(e.g()??[]))),$(this,t)})),this.g.attachEmptyPacketListener(`extra_blendshapes`,(e=>{$(this,e)}))),this.g.attachProtoListener(`left_hand_landmarks`,((e,t)=>{xj(e,this.h.leftHandLandmarks),$(this,t)})),this.g.attachEmptyPacketListener(`left_hand_landmarks`,(e=>{$(this,e)})),this.g.attachProtoListener(`left_hand_world_landmarks`,((e,t)=>{var n=this.h.leftHandWorldLandmarks;e=uO(e),n.push(jk(e)),$(this,t)})),this.g.attachEmptyPacketListener(`left_hand_world_landmarks`,(e=>{$(this,e)})),this.g.attachProtoListener(`right_hand_landmarks`,((e,t)=>{xj(e,this.h.rightHandLandmarks),$(this,t)})),this.g.attachEmptyPacketListener(`right_hand_landmarks`,(e=>{$(this,e)})),this.g.attachProtoListener(`right_hand_world_landmarks`,((e,t)=>{var n=this.h.rightHandWorldLandmarks;e=uO(e),n.push(jk(e)),$(this,t)})),this.g.attachEmptyPacketListener(`right_hand_world_landmarks`,(e=>{$(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Sj.prototype.detectForVideo=Sj.prototype.G,Sj.prototype.detect=Sj.prototype.F,Sj.prototype.setOptions=Sj.prototype.o,Sj.createFromModelPath=function(e,t){return KA(Sj,e,{baseOptions:{modelAssetPath:t}})},Sj.createFromModelBuffer=function(e,t){return KA(Sj,e,{baseOptions:{modelAssetBuffer:t}})},Sj.createFromOptions=function(e,t){return KA(Sj,e,t)},Sj.HAND_CONNECTIONS=dj,Sj.POSE_CONNECTIONS=vj,Sj.FACE_LANDMARKS_LIPS=$A,Sj.FACE_LANDMARKS_LEFT_EYE=ej,Sj.FACE_LANDMARKS_LEFT_EYEBROW=tj,Sj.FACE_LANDMARKS_LEFT_IRIS=nj,Sj.FACE_LANDMARKS_RIGHT_EYE=rj,Sj.FACE_LANDMARKS_RIGHT_EYEBROW=ij,Sj.FACE_LANDMARKS_RIGHT_IRIS=aj,Sj.FACE_LANDMARKS_FACE_OVAL=oj,Sj.FACE_LANDMARKS_CONTOURS=sj,Sj.FACE_LANDMARKS_TESSELATION=cj;var Cj=class extends ZA{constructor(e,t){super(new GA(e,t),`input_image`,`norm_rect`,!0),this.j={classifications:[]},lT(e=this.h=new ok,0,1,t=new AO)}get baseOptions(){return aT(this.h,AO,1)}set baseOptions(e){lT(this.h,0,1,e)}o(e){return lT(this.h,0,2,Tk(e,aT(this.h,CO,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},JA(this,e,t),this.j}ta(e,t,n){return this.j={classifications:[]},YA(this,e,n,t),this.j}m(){var e=new QD;XD(e,`input_image`),XD(e,`norm_rect`),ZD(e,`classifications`);let t=new BD;gE(t,sk,this.h);let n=new GD;vT(n,2,`mediapipe.tasks.vision.image_classifier.ImageClassifierGraph`),UD(n,`IMAGE:input_image`),UD(n,`NORM_RECT:norm_rect`),WD(n,`CLASSIFICATIONS:classifications`),n.o(t),YD(e,n),this.g.attachProtoListener(`classifications`,((e,t)=>{this.j=Ok(_O(e)),$(this,t)})),this.g.attachEmptyPacketListener(`classifications`,(e=>{$(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Cj.prototype.classifyForVideo=Cj.prototype.ta,Cj.prototype.classify=Cj.prototype.sa,Cj.prototype.setOptions=Cj.prototype.o,Cj.createFromModelPath=function(e,t){return KA(Cj,e,{baseOptions:{modelAssetPath:t}})},Cj.createFromModelBuffer=function(e,t){return KA(Cj,e,{baseOptions:{modelAssetBuffer:t}})},Cj.createFromOptions=function(e,t){return KA(Cj,e,t)};var wj=class extends ZA{constructor(e,t){super(new GA(e,t),`image_in`,`norm_rect`,!0),this.h=new ck,this.embeddings={embeddings:[]},lT(e=this.h,0,1,t=new AO)}get baseOptions(){return aT(this.h,AO,1)}set baseOptions(e){lT(this.h,0,1,e)}o(e){var t=this.h,n=aT(this.h,TO,2);return n=n?n.clone():new TO,e.l2Normalize===void 0?`l2Normalize`in e&&Vw(n,1):Vw(n,1,zC(e.l2Normalize)),e.quantize===void 0?`quantize`in e&&Vw(n,2):Vw(n,2,zC(e.quantize)),lT(t,0,2,n),this.l(e)}za(e,t){return JA(this,e,t),this.embeddings}Aa(e,t,n){return YA(this,e,n,t),this.embeddings}m(){var e=new QD;XD(e,`image_in`),XD(e,`norm_rect`),ZD(e,`embeddings_out`);let t=new BD;gE(t,lk,this.h);let n=new GD;vT(n,2,`mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph`),UD(n,`IMAGE:image_in`),UD(n,`NORM_RECT:norm_rect`),WD(n,`EMBEDDINGS:embeddings_out`),n.o(t),YD(e,n),this.g.attachProtoListener(`embeddings_out`,((e,t)=>{e=SO(e),this.embeddings=function(e){return{embeddings:sT(e,bO,1).map((e=>{let t={headIndex:pT(e,3)??0??-1,headName:ew(zw(e,4))??``??``};var n=e.v;return iT(n,0|n[X],vO,$w(e,1))===void 0?(n=new Uint8Array,t.quantizedEmbedding=aT(e,yO,$w(e,2),void 0)?.na()?.h()??n):(e=Ww(e=aT(e,vO,$w(e,1),void 0),1,RC,Uw()),t.floatEmbedding=e.slice()),t})),timestampMs:Ek(mT(e))}}(e),$(this,t)})),this.g.attachEmptyPacketListener(`embeddings_out`,(e=>{$(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};wj.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Nk(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error(`Cannot compute cosine similarity between quantized and float embeddings.`);e=Nk(Mk(e.quantizedEmbedding),Mk(t.quantizedEmbedding))}return e},wj.prototype.embedForVideo=wj.prototype.Aa,wj.prototype.embed=wj.prototype.za,wj.prototype.setOptions=wj.prototype.o,wj.createFromModelPath=function(e,t){return KA(wj,e,{baseOptions:{modelAssetPath:t}})},wj.createFromModelBuffer=function(e,t){return KA(wj,e,{baseOptions:{modelAssetBuffer:t}})},wj.createFromOptions=function(e,t){return KA(wj,e,t)};var Tj=class{constructor(e,t,n){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=n}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};function Ej(e){let t=function(e){return sT(e,GD,1)}(e.ca()).filter((e=>(ew(zw(e,1))??``).includes(`mediapipe.tasks.TensorsToSegmentationCalculator`)));if(e.u=[],t.length>1)throw Error(`The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.`);t.length===1&&(aT(t[0],BD,7)?.j()?.g()??new Map).forEach(((t,n)=>{e.u[Number(n)]=ew(zw(t,1))??``}))}function Dj(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function Oj(e){try{let t=new Tj(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{Zk(e)}}Tj.prototype.close=Tj.prototype.close;var kj=class extends ZA{constructor(e,t){super(new GA(e,t),`image_in`,`norm_rect`,!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new mk,this.A=new uk,lT(this.h,0,3,this.A),lT(e=this.h,0,1,t=new AO)}get baseOptions(){return aT(this.h,AO,1)}set baseOptions(e){lT(this.h,0,1,e)}o(e){return e.displayNamesLocale===void 0?`displayNamesLocale`in e&&Vw(this.h,2):Vw(this.h,2,$C(e.displayNamesLocale)),`outputCategoryMask`in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),`outputConfidenceMasks`in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){Ej(this)}segment(e,t,n){let r=typeof t==`function`?{}:t;return this.j=typeof t==`function`?t:n,Dj(this),JA(this,e,r),Oj(this)}La(e,t,n,r){let i=typeof n==`function`?{}:n;return this.j=typeof n==`function`?n:r,Dj(this),YA(this,e,i,t),Oj(this)}Da(){return this.u}m(){var e=new QD;XD(e,`image_in`),XD(e,`norm_rect`);let t=new BD;gE(t,hk,this.h);let n=new GD;vT(n,2,`mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph`),UD(n,`IMAGE:image_in`),UD(n,`NORM_RECT:norm_rect`),n.o(t),YD(e,n),Yk(this,e),this.outputConfidenceMasks&&(ZD(e,`confidence_masks`),WD(n,`CONFIDENCE_MASKS:confidence_masks`),Xk(this,`confidence_masks`),this.g.aa(`confidence_masks`,((e,t)=>{this.confidenceMasks=e.map((e=>XA(this,e,!0,!this.j))),$(this,t)})),this.g.attachEmptyPacketListener(`confidence_masks`,(e=>{this.confidenceMasks=[],$(this,e)}))),this.outputCategoryMask&&(ZD(e,`category_mask`),WD(n,`CATEGORY_MASK:category_mask`),Xk(this,`category_mask`),this.g.Z(`category_mask`,((e,t)=>{this.categoryMask=XA(this,e,!1,!this.j),$(this,t)})),this.g.attachEmptyPacketListener(`category_mask`,(e=>{this.categoryMask=void 0,$(this,e)}))),ZD(e,`quality_scores`),WD(n,`QUALITY_SCORES:quality_scores`),this.g.attachFloatVectorListener(`quality_scores`,((e,t)=>{this.qualityScores=e,$(this,t)})),this.g.attachEmptyPacketListener(`quality_scores`,(e=>{this.categoryMask=void 0,$(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};kj.prototype.getLabels=kj.prototype.Da,kj.prototype.segmentForVideo=kj.prototype.La,kj.prototype.segment=kj.prototype.segment,kj.prototype.setOptions=kj.prototype.o,kj.createFromModelPath=function(e,t){return KA(kj,e,{baseOptions:{modelAssetPath:t}})},kj.createFromModelBuffer=function(e,t){return KA(kj,e,{baseOptions:{modelAssetBuffer:t}})},kj.createFromOptions=function(e,t){return KA(kj,e,t)};var Aj=class{constructor(e,t,n){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=n}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};Aj.prototype.close=Aj.prototype.close;var jj=class extends ZA{constructor(e,t){super(new GA(e,t),`image_in`,`norm_rect_in`,!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new mk,this.u=new uk,lT(this.h,0,3,this.u),lT(e=this.h,0,1,t=new AO)}get baseOptions(){return aT(this.h,AO,1)}set baseOptions(e){lT(this.h,0,1,e)}o(e){return`outputCategoryMask`in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),`outputConfidenceMasks`in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}segment(e,t,n,r){let i=typeof n==`function`?{}:n;if(this.j=typeof n==`function`?n:r,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,n=this.C+1,r=new yk,t.keypoint&&t.scribble)throw Error(`Cannot provide both keypoint and scribble.`);if(t.keypoint){var a=new gk;Zw(a,3,zC(!0),!1),Zw(a,1,LC(t.keypoint.x),0),Zw(a,2,LC(t.keypoint.y),0),uT(r,1,bk,a)}else{if(!t.scribble)throw Error(`Must provide either a keypoint or a scribble.`);{let e=new vk;for(a of t.scribble)Zw(t=new gk,3,zC(!0),!1),Zw(t,1,LC(a.x),0),Zw(t,2,LC(a.y),0),fT(e,1,gk,t);uT(r,2,bk,e)}}this.g.addProtoToStream(r.g(),`mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest`,`roi_in`,n),JA(this,e,i);t:{try{let e=new Aj(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=e;break t}this.j(e)}finally{Zk(this)}o=void 0}return o}m(){var e=new QD;XD(e,`image_in`),XD(e,`roi_in`),XD(e,`norm_rect_in`);let t=new BD;gE(t,hk,this.h);let n=new GD;vT(n,2,`mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2`),UD(n,`IMAGE:image_in`),UD(n,`ROI:roi_in`),UD(n,`NORM_RECT:norm_rect_in`),n.o(t),YD(e,n),Yk(this,e),this.outputConfidenceMasks&&(ZD(e,`confidence_masks`),WD(n,`CONFIDENCE_MASKS:confidence_masks`),Xk(this,`confidence_masks`),this.g.aa(`confidence_masks`,((e,t)=>{this.confidenceMasks=e.map((e=>XA(this,e,!0,!this.j))),$(this,t)})),this.g.attachEmptyPacketListener(`confidence_masks`,(e=>{this.confidenceMasks=[],$(this,e)}))),this.outputCategoryMask&&(ZD(e,`category_mask`),WD(n,`CATEGORY_MASK:category_mask`),Xk(this,`category_mask`),this.g.Z(`category_mask`,((e,t)=>{this.categoryMask=XA(this,e,!1,!this.j),$(this,t)})),this.g.attachEmptyPacketListener(`category_mask`,(e=>{this.categoryMask=void 0,$(this,e)}))),ZD(e,`quality_scores`),WD(n,`QUALITY_SCORES:quality_scores`),this.g.attachFloatVectorListener(`quality_scores`,((e,t)=>{this.qualityScores=e,$(this,t)})),this.g.attachEmptyPacketListener(`quality_scores`,(e=>{this.categoryMask=void 0,$(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};jj.prototype.segment=jj.prototype.segment,jj.prototype.setOptions=jj.prototype.o,jj.createFromModelPath=function(e,t){return KA(jj,e,{baseOptions:{modelAssetPath:t}})},jj.createFromModelBuffer=function(e,t){return KA(jj,e,{baseOptions:{modelAssetBuffer:t}})},jj.createFromOptions=function(e,t){return KA(jj,e,t)};var Mj=class extends ZA{constructor(e,t){super(new GA(e,t),`input_frame_gpu`,`norm_rect`,!1),this.j={detections:[]},lT(e=this.h=new xk,0,1,t=new AO)}get baseOptions(){return aT(this.h,AO,1)}set baseOptions(e){lT(this.h,0,1,e)}o(e){return e.displayNamesLocale===void 0?`displayNamesLocale`in e&&Vw(this.h,2):Vw(this.h,2,$C(e.displayNamesLocale)),e.maxResults===void 0?`maxResults`in e&&Vw(this.h,3):gT(this.h,3,e.maxResults),e.scoreThreshold===void 0?`scoreThreshold`in e&&Vw(this.h,4):_T(this.h,4,e.scoreThreshold),e.categoryAllowlist===void 0?`categoryAllowlist`in e&&Vw(this.h,5):yT(this.h,5,e.categoryAllowlist),e.categoryDenylist===void 0?`categoryDenylist`in e&&Vw(this.h,6):yT(this.h,6,e.categoryDenylist),this.l(e)}F(e,t){return this.j={detections:[]},JA(this,e,t),this.j}G(e,t,n){return this.j={detections:[]},YA(this,e,n,t),this.j}m(){var e=new QD;XD(e,`input_frame_gpu`),XD(e,`norm_rect`),ZD(e,`detections`);let t=new BD;gE(t,Sk,this.h);let n=new GD;vT(n,2,`mediapipe.tasks.vision.ObjectDetectorGraph`),UD(n,`IMAGE:input_frame_gpu`),UD(n,`NORM_RECT:norm_rect`),WD(n,`DETECTIONS:detections`),n.o(t),YD(e,n),this.g.attachProtoVectorListener(`detections`,((e,t)=>{for(let t of e)e=cO(t),this.j.detections.push(kk(e));$(this,t)})),this.g.attachEmptyPacketListener(`detections`,(e=>{$(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Mj.prototype.detectForVideo=Mj.prototype.G,Mj.prototype.detect=Mj.prototype.F,Mj.prototype.setOptions=Mj.prototype.o,Mj.createFromModelPath=async function(e,t){return KA(Mj,e,{baseOptions:{modelAssetPath:t}})},Mj.createFromModelBuffer=function(e,t){return KA(Mj,e,{baseOptions:{modelAssetBuffer:t}})},Mj.createFromOptions=function(e,t){return KA(Mj,e,t)};var Nj=class{constructor(e,t,n){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=n}close(){this.segmentationMasks?.forEach((e=>{e.close()}))}};function Pj(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function Fj(e){try{let t=new Nj(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.u)return t;e.u(t)}finally{Zk(e)}}Nj.prototype.close=Nj.prototype.close;var Ij=class extends ZA{constructor(e,t){super(new GA(e,t),`image_in`,`norm_rect`,!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,lT(e=this.h=new Ck,0,1,t=new AO),this.A=new nk,lT(this.h,0,3,this.A),this.j=new tk,lT(this.h,0,2,this.j),gT(this.j,4,1),_T(this.j,2,.5),_T(this.A,2,.5),_T(this.h,4,.5)}get baseOptions(){return aT(this.h,AO,1)}set baseOptions(e){lT(this.h,0,1,e)}o(e){return`numPoses`in e&&gT(this.j,4,e.numPoses??1),`minPoseDetectionConfidence`in e&&_T(this.j,2,e.minPoseDetectionConfidence??.5),`minTrackingConfidence`in e&&_T(this.h,4,e.minTrackingConfidence??.5),`minPosePresenceConfidence`in e&&_T(this.A,2,e.minPosePresenceConfidence??.5),`outputSegmentationMasks`in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}F(e,t,n){let r=typeof t==`function`?{}:t;return this.u=typeof t==`function`?t:n,Pj(this),JA(this,e,r),Fj(this)}G(e,t,n,r){let i=typeof n==`function`?{}:n;return this.u=typeof n==`function`?n:r,Pj(this),YA(this,e,i,t),Fj(this)}m(){var e=new QD;XD(e,`image_in`),XD(e,`norm_rect`),ZD(e,`normalized_landmarks`),ZD(e,`world_landmarks`),ZD(e,`segmentation_masks`);let t=new BD;gE(t,wk,this.h);let n=new GD;vT(n,2,`mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph`),UD(n,`IMAGE:image_in`),UD(n,`NORM_RECT:norm_rect`),WD(n,`NORM_LANDMARKS:normalized_landmarks`),WD(n,`WORLD_LANDMARKS:world_landmarks`),n.o(t),YD(e,n),Yk(this,e),this.g.attachProtoVectorListener(`normalized_landmarks`,((e,t)=>{this.landmarks=[];for(let t of e)e=fO(t),this.landmarks.push(Ak(e));$(this,t)})),this.g.attachEmptyPacketListener(`normalized_landmarks`,(e=>{this.landmarks=[],$(this,e)})),this.g.attachProtoVectorListener(`world_landmarks`,((e,t)=>{this.worldLandmarks=[];for(let t of e)e=uO(t),this.worldLandmarks.push(jk(e));$(this,t)})),this.g.attachEmptyPacketListener(`world_landmarks`,(e=>{this.worldLandmarks=[],$(this,e)})),this.outputSegmentationMasks&&(WD(n,`SEGMENTATION_MASK:segmentation_masks`),Xk(this,`segmentation_masks`),this.g.aa(`segmentation_masks`,((e,t)=>{this.segmentationMasks=e.map((e=>XA(this,e,!0,!this.u))),$(this,t)})),this.g.attachEmptyPacketListener(`segmentation_masks`,(e=>{this.segmentationMasks=[],$(this,e)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ij.prototype.detectForVideo=Ij.prototype.G,Ij.prototype.detect=Ij.prototype.F,Ij.prototype.setOptions=Ij.prototype.o,Ij.createFromModelPath=function(e,t){return KA(Ij,e,{baseOptions:{modelAssetPath:t}})},Ij.createFromModelBuffer=function(e,t){return KA(Ij,e,{baseOptions:{modelAssetBuffer:t}})},Ij.createFromOptions=function(e,t){return KA(Ij,e,t)},Ij.POSE_CONNECTIONS=vj;var Lj=`https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.32/wasm`,Rj=`https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/1/pose_landmarker_lite.task`,zj=e=>{let[t,r]=(0,n.useState)(!1),{isWebcamActive:i,setLandmarks:a}=h(),o=(0,n.useRef)(null);return(0,n.useEffect)(()=>((async()=>{try{let e=await Rk.forVisionTasks(Lj);o.current=await Ij.createFromOptions(e,{baseOptions:{modelAssetPath:Rj,delegate:`GPU`},runningMode:`VIDEO`,numPoses:1}),r(!0)}catch(e){console.error(`Failed to initialize MediaPipe Pose Landmarker:`,e)}})(),()=>{o.current&&o.current.close()}),[]),(0,n.useEffect)(()=>{if(!t||!i||!e.current||!o.current)return;let n,r=()=>{if(e.current&&e.current.readyState>=2){let t=performance.now(),n=o.current.detectForVideo(e.current,t);n.landmarks&&n.landmarks.length>0&&a(n.landmarks[0],n.worldLandmarks[0])}n=requestAnimationFrame(r)};return r(),()=>{cancelAnimationFrame(n)}},[t,i,e,a]),{isTrackerReady:t}},Bj=()=>({mapPoseToBones:(0,n.useCallback)((e,t)=>{if(!e||e.length===0||!t)return;let n=(e,t,n=new V(1,0,0))=>{let r=new V(t.x-e.x,-(t.y-e.y),t.z-e.z).normalize();return new Pn().setFromUnitVectors(n,r)},r=new V((e[23].x+e[24].x)/2,-(e[23].y+e[24].y)/2,(e[23].z+e[24].z)/2);t.Hips&&t.Hips.position.set(r.x,r.y+1,r.z),t.LeftUpperArm&&t.LeftUpperArm.quaternion.copy(n(e[11],e[13])),t.RightUpperArm&&t.RightUpperArm.quaternion.copy(n(e[12],e[14])),t.LeftUpperLeg&&t.LeftUpperLeg.quaternion.copy(n(e[23],e[25],new V(0,-1,0))),t.RightUpperLeg&&t.RightUpperLeg.quaternion.copy(n(e[24],e[26],new V(0,-1,0)))},[])}),Vj=()=>{let[e,t]=(0,n.useState)(null),{setFitResult:r}=h();return(0,n.useEffect)(()=>{let e=setInterval(()=>{t({shoulder:45,chest:100,waist:80}),r({type:`regular`,suitability:85})},1e3);return()=>clearInterval(e)},[r]),{dimensions:e}};function Hj(e){return e.replace(/\/+$/,``)}function Uj(e){try{return new URL(e).origin}catch{return``}}var Wj=class{baseUrl;apiOrigin;constructor(e=`/api/v1`){let t=Hj(e);this.baseUrl=t,this.apiOrigin=Uj(t)}resolveAssetUrl(e){return e?e.startsWith(`http://`)||e.startsWith(`https://`)?e:e.startsWith(`/`)?this.apiOrigin?`${this.apiOrigin}${e}`:e:this.apiOrigin?`${this.apiOrigin}/${e}`:`/${e}`:null}async listBodyPresets(e){return(await this.request(`body-presets/`,{params:e?{gender:e}:void 0})).map(e=>this.normalizeBodyPreset(e))}async matchBodyPreset(e){let t=await this.request(`body-presets/match`,{method:`POST`,body:e});return this.normalizeBodyPreset(t)}async listGarments(e){let t=await this.request(`garment/`,{params:e});return{...t,items:t.items.map(e=>this.normalizeGarmentSummary(e))}}async getGarment(e){let t=await this.request(`garment/${e}`);return this.normalizeGarmentDetail(t)}async getPipelineStatus(e){return this.request(`pipeline/${e}`)}async createGarment(e){let t=await this.request(`garment/`,{method:`POST`,body:e});return this.normalizeGarmentSummary(t)}async uploadGarmentImage(e,t,n){let r=new FormData;return r.append(`files`,t,`${n}_image.png`),r.append(`image_type`,n),(await this.request(`garment/${e}/images`,{method:`POST`,body:r})).map(e=>({...e,image_url:this.resolveAssetUrl(e.image_url)??e.image_url}))}async generateGarment3D(e,t){return this.request(`garment/${e}/generate-3d`,{method:`POST`,body:{include_measurements:t?.include_measurements??!1,target_fit_types:t?.target_fit_types??[`regular`]}})}async waitForGarmentModel(e,t){let n=t?.intervalMs??2e3,r=t?.timeoutMs??12e4,i=Date.now();for(;Date.now()-i<=r;){let t=await this.getGarment(e);if(this.pickGarmentModelUrl(t))return t;if(t.asset_status===`rigging_failed`)throw Error(`Garment 3D generation failed on backend.`);await new Promise(e=>globalThis.setTimeout(e,n))}throw Error(`Timed out while waiting for garment 3D model.`)}pickGarmentModelUrl(e){if(e.model_url)return e.model_url;let t=e.variants.find(e=>e.is_default&&e.model_url);return t?.model_url?t.model_url:e.variants.find(e=>e.model_url)?.model_url??null}normalizeBodyPreset(e){return{...e,model_url:this.resolveAssetUrl(e.model_url)}}normalizeGarmentSummary(e){return{...e,thumbnail_url:this.resolveAssetUrl(e.thumbnail_url),model_url:this.resolveAssetUrl(e.model_url)}}normalizeGarmentDetail(e){return{...this.normalizeGarmentSummary(e),brand:e.brand?{...e.brand,logo_url:this.resolveAssetUrl(e.brand.logo_url)}:null,images:e.images.map(e=>({...e,image_url:this.resolveAssetUrl(e.image_url)??e.image_url})),sizes:e.sizes,variants:e.variants.map(e=>({...e,model_url:this.resolveAssetUrl(e.model_url)}))}}async request(e,t){let n=this.buildUrl(e,t?.params),r=new Headers,i;t?.body instanceof FormData?i=t.body:t?.body!==void 0&&(r.set(`Content-Type`,`application/json`),i=JSON.stringify(t.body));let a=await fetch(n.toString(),{method:t?.method??`GET`,body:i,headers:r,credentials:`include`});if(!a.ok)throw Error(await this.getResponseErrorMessage(a));if(a.status!==204)return await a.json()}buildUrl(e,t){let n=this.baseUrl.startsWith(`http://`)||this.baseUrl.startsWith(`https://`)?`${this.baseUrl}/`:typeof window<`u`?new URL(`${this.baseUrl}/`,window.location.origin).toString():`http://localhost${this.baseUrl}/`,r=new URL(e.replace(/^\/+/,``),n);return t&&Object.entries(t).forEach(([e,t])=>{t!==void 0&&r.searchParams.set(e,String(t))}),r}async getResponseErrorMessage(e){try{let t=await e.json();return t.detail||t.message||t.error||`Request failed with status ${e.status}`}catch{return`Request failed with status ${e.status}`}}},Gj={gender:`female`};function Kj(e,t){return e instanceof Error&&e.message?e.message:t}function qj(e){let t=(0,n.useMemo)(()=>new Wj(e??`/api/v1`),[e]),[r,i]=(0,n.useState)(`idle`),[a,o]=(0,n.useState)(null),[s,c]=(0,n.useState)(null);return{status:r,resultUrl:a,error:s,generateAvatar:(0,n.useCallback)(async(e=Gj)=>{i(`processing`),c(null);try{let n=e instanceof Blob?Gj:e,r=await t.matchBodyPreset(n);if(!r.model_url)throw Error(`Matched body preset does not have a 3D model URL.`);return o(r.model_url),i(`ready`),r.model_url}catch(e){throw c(Kj(e,`Failed to load avatar model`)),i(`error`),e}},[t]),createGarment:(0,n.useCallback)(async(e,n,r,a)=>{i(`uploading`),c(null);try{let s=await t.createGarment(e);await t.uploadGarmentImage(s.id,n,`front`),r&&await t.uploadGarmentImage(s.id,r,`back`),i(`processing`),await t.generateGarment3D(s.id,{include_measurements:!!a,target_fit_types:[`regular`]});let c=await t.waitForGarmentModel(s.id),l=t.pickGarmentModelUrl(c);if(!l)throw Error(`Backend did not return a garment 3D model URL.`);return o(l),i(`ready`),l}catch(e){throw c(Kj(e,`Failed to generate garment`)),i(`error`),e}},[t]),reset:()=>{i(`idle`),o(null),c(null)}}}e.AvatarModel=Ix,e.CameraView=Fx,e.EverCanvas=Px,e.EverClient=Wj,e.EverContext=og,e.EverProvider=cg,e.GarmentModel=Rx,e.useBodyMeasurer=Vj,e.useEver=sg,e.useEverGeneration=qj,e.useEverStore=h,e.usePoseMapper=Bj,e.usePoseTracker=zj});