@dcl/wearable-preview 2.7.0 → 2.7.1
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/assets/{babylon.inspector.bundle.max-C8nfncc3.js → babylon.inspector.bundle.max-DLoRMI18.js} +1 -1
- package/assets/{index-vdrrIPus.js → index-COHTSOeg.js} +3 -3
- package/index.html +3 -3
- package/package.json +3 -3
- package/static-local/assets/{babylon.inspector.bundle.max-D7-l4NJm.js → babylon.inspector.bundle.max-BeSzUjE_.js} +1 -1
- package/static-local/assets/{index-BgMCTSPE.js → index-BS_QmslQ.js} +2 -2
- package/static-local/index.html +1 -1
- package/static-local/package.json +1 -1
- package/static-local/unity/Build/aang-renderer.data.br +0 -0
- package/static-local/unity/Build/aang-renderer.loader.js +1 -1
- package/static-local/unity/Build/aang-renderer.symbols.json.br +0 -0
- package/static-local/unity/Build/aang-renderer.wasm.br +0 -0
- package/unity/Build/aang-renderer.data.br +0 -0
- package/unity/Build/aang-renderer.loader.js +1 -1
- package/unity/Build/aang-renderer.symbols.json.br +0 -0
- package/unity/Build/aang-renderer.wasm.br +0 -0
|
@@ -16063,7 +16063,7 @@ vReflectionMapTexCoord.z=worldPos.w;
|
|
|
16063
16063
|
#endif
|
|
16064
16064
|
#include<logDepthVertex>
|
|
16065
16065
|
}
|
|
16066
|
-
`;ce.ShadersStore[J6]=eK;var tK=function(n){j(t,n);function t(){var e=n.call(this)||this;return e.BUMP=!1,e.REFLECTION=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.POINTSIZE=!1,e.FOG=!1,e.NORMAL=!1,e.UV1=!1,e.UV2=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.SPECULARTERM=!1,e.LOGARITHMICDEPTH=!1,e.FRESNELSEPARATE=!1,e.BUMPSUPERIMPOSE=!1,e.BUMPAFFECTSREFLECTION=!1,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.EXPOSURE=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.rebuild(),e}return t}(Er),iK=function(n){j(t,n);function t(e,i,r){r===void 0&&(r=new Ie(512,512));var o=n.call(this,e,i)||this;return o.renderTargetSize=r,o.diffuseColor=new _e(1,1,1),o.specularColor=new _e(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o.windForce=6,o.windDirection=new Ie(0,1),o.waveHeight=.4,o.bumpHeight=.4,o._bumpSuperimpose=!1,o._fresnelSeparate=!1,o._bumpAffectsReflection=!1,o.waterColor=new _e(.1,.1,.6),o.colorBlendFactor=.2,o.waterColor2=new _e(.1,.1,.6),o.colorBlendFactor2=.2,o.waveLength=.1,o.waveSpeed=1,o.waveCount=20,o.disableClipPlane=!1,o._renderTargets=new yr(16),o._mesh=null,o._reflectionTransform=te.Zero(),o._lastTime=0,o._lastDeltaTime=0,o._createRenderTargets(i,r),o.getRenderTargetTextures=function(){return o._renderTargets.reset(),o._renderTargets.push(o._reflectionRTT),o._renderTargets.push(o._refractionRTT),o._renderTargets},o._imageProcessingConfiguration=o.getScene().imageProcessingConfiguration,o._imageProcessingConfiguration&&(o._imageProcessingObserver=o._imageProcessingConfiguration.onUpdateParameters.add(function(){o._markAllSubMeshesAsImageProcessingDirty()})),o}return Object.defineProperty(t.prototype,"hasRenderTargetTextures",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported,this._markAllSubMeshesAsMiscDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refractionTexture",{get:function(){return this._refractionRTT},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"reflectionTexture",{get:function(){return this._reflectionRTT},enumerable:!1,configurable:!0}),t.prototype.addToRenderList=function(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)},t.prototype.enableRenderTargets=function(e){var i=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=i),this._reflectionRTT&&(this._reflectionRTT.refreshRate=i)},t.prototype.getRenderList=function(){return this._refractionRTT?this._refractionRTT.renderList:[]},Object.defineProperty(t.prototype,"renderTargetsEnabled",{get:function(){return!(this._refractionRTT&&this._refractionRTT.refreshRate===0)},enumerable:!1,configurable:!0}),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,i,r){if(this.isFrozen&&i.effect&&i.effect._wasPreviouslyReady)return!0;i._materialDefines||(i._materialDefines=new tK);var o=i._materialDefines,a=this.getScene();if(this._isReadyForSubMesh(i))return!0;var s=a.getEngine();if(o._areTexturesDirty&&(o._needUVs=!1,a.texturesEnabled)){if(this.bumpTexture&&ke.BumpTextureEnabled)if(this.bumpTexture.isReady())o._needUVs=!0,o.BUMP=!0;else return!1;ke.ReflectionTextureEnabled&&(o.REFLECTION=!0)}if(oe.PrepareDefinesForFrameBoundValues(a,s,o,!!r),oe.PrepareDefinesForMisc(e,a,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),o),o._areMiscDirty&&(this._fresnelSeparate&&(o.FRESNELSEPARATE=!0),this._bumpSuperimpose&&(o.BUMPSUPERIMPOSE=!0),this._bumpAffectsReflection&&(o.BUMPAFFECTSREFLECTION=!0)),o._needNormals=oe.PrepareDefinesForLights(a,e,o,!0,this._maxSimultaneousLights,this._disableLighting),o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o),o.IS_REFLECTION_LINEAR=this.reflectionTexture!=null&&!this.reflectionTexture.gammaSpace,o.IS_REFRACTION_LINEAR=this.refractionTexture!=null&&!this.refractionTexture.gammaSpace}if(oe.PrepareDefinesForAttributes(e,o,!0,!0),this._mesh=e,this._waitingRenderList){for(var l=0;l<this._waitingRenderList.length;l++)this.addToRenderList(a.getNodeByID(this._waitingRenderList[l]));this._waitingRenderList=null}if(o.isDirty){o.markAsProcessed(),a.resetCachedMaterial();var u=new Tr;o.FOG&&u.addFallback(1,"FOG"),o.LOGARITHMICDEPTH&&u.addFallback(0,"LOGARITHMICDEPTH"),oe.HandleFallbacksForShadows(o,u,this.maxSimultaneousLights),o.NUM_BONE_INFLUENCERS>0&&u.addCPUSkinningFallback(0,e);var f=[I.PositionKind];o.NORMAL&&f.push(I.NormalKind),o.UV1&&f.push(I.UVKind),o.UV2&&f.push(I.UV2Kind),o.VERTEXCOLOR&&f.push(I.ColorKind),oe.PrepareAttributesForBones(f,e,o,u),oe.PrepareAttributesForInstances(f,o);var c="water",h=o.toString(),p=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vNormalInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","normalMatrix","logarithmicDepthConstant","worldReflectionViewProjection","windDirection","waveLength","time","windForce","cameraPosition","bumpHeight","waveHeight","waterColor","waterColor2","colorBlendFactor","colorBlendFactor2","waveSpeed","waveCount"],_=["normalSampler","refractionSampler","reflectionSampler"],g=new Array;Hi&&(Hi.PrepareUniforms(p,o),Hi.PrepareSamplers(_,o)),oe.PrepareUniformsAndSamplersList({uniformsNames:p,uniformBuffersNames:g,samplers:_,defines:o,maxSimultaneousLights:this.maxSimultaneousLights}),i.setEffect(a.getEngine().createEffect(c,{attributes:f,uniformsNames:p,uniformBuffersNames:g,samplers:_,defines:h,fallbacks:u,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},s),o)}return!i.effect||!i.effect.isReady()?!1:(o._renderId=a.getRenderId(),i.effect._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,i,r){var o=this.getScene(),a=r._materialDefines;if(a){var s=r.effect;if(!(!s||!this._mesh)){this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),oe.BindBonesParameters(i,this._activeEffect),this._mustRebind(o,s)&&(this.bumpTexture&&ke.BumpTextureEnabled&&(this._activeEffect.setTexture("normalSampler",this.bumpTexture),this._activeEffect.setFloat2("vNormalInfos",this.bumpTexture.coordinatesIndex,this.bumpTexture.level),this._activeEffect.setMatrix("normalMatrix",this.bumpTexture.getTextureMatrix())),oe.BindClipPlane(this._activeEffect,o),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),oe.BindEyePosition(s,o)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*i.visibility),a.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),o.lightsEnabled&&!this.disableLighting&&oe.BindLights(o,i,this._activeEffect,a,this.maxSimultaneousLights),o.fogEnabled&&i.applyFog&&o.fogMode!==Ke.FOGMODE_NONE&&this._activeEffect.setMatrix("view",o.getViewMatrix()),oe.BindFogParameters(o,i,this._activeEffect),oe.BindLogDepth(a,this._activeEffect,o),ke.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));var l=this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(o.getProjectionMatrix()),u=o.getEngine().getDeltaTime();u!==this._lastDeltaTime&&(this._lastDeltaTime=u,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("worldReflectionViewProjection",l),this._activeEffect.setVector2("windDirection",this.windDirection),this._activeEffect.setFloat("waveLength",this.waveLength),this._activeEffect.setFloat("time",this._lastTime/1e5),this._activeEffect.setFloat("windForce",this.windForce),this._activeEffect.setFloat("waveHeight",this.waveHeight),this._activeEffect.setFloat("bumpHeight",this.bumpHeight),this._activeEffect.setColor4("waterColor",this.waterColor,1),this._activeEffect.setFloat("colorBlendFactor",this.colorBlendFactor),this._activeEffect.setColor4("waterColor2",this.waterColor2,1),this._activeEffect.setFloat("colorBlendFactor2",this.colorBlendFactor2),this._activeEffect.setFloat("waveSpeed",this.waveSpeed),this._activeEffect.setFloat("waveCount",this.waveCount),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect),this._afterBind(i,this._activeEffect)}}},t.prototype._createRenderTargets=function(e,i){var r=this;this._refractionRTT=new ji(name+"_refraction",{width:i.x,height:i.y},e,!1,!0),this._refractionRTT.wrapU=To.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=To.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0,this._reflectionRTT=new ji(name+"_reflection",{width:i.x,height:i.y},e,!1,!0),this._reflectionRTT.wrapU=To.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=To.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;var o,a=null,s,l=te.Zero();this._refractionRTT.onBeforeRender=function(){if(r._mesh&&(o=r._mesh.isVisible,r._mesh.isVisible=!1),!r.disableClipPlane){a=e.clipPlane;var u=r._mesh?r._mesh.position.y:0;e.clipPlane=zo.FromPositionAndNormal(new y(0,u+.05,0),new y(0,1,0))}},this._refractionRTT.onAfterRender=function(){r._mesh&&(r._mesh.isVisible=o),r.disableClipPlane||(e.clipPlane=a)},this._reflectionRTT.onBeforeRender=function(){if(r._mesh&&(o=r._mesh.isVisible,r._mesh.isVisible=!1),!r.disableClipPlane){a=e.clipPlane;var u=r._mesh?r._mesh.position.y:0;e.clipPlane=zo.FromPositionAndNormal(new y(0,u-.05,0),new y(0,-1,0)),te.ReflectionToRef(e.clipPlane,l)}s=e.getViewMatrix(),l.multiplyToRef(s,r._reflectionTransform),e.setTransformMatrix(r._reflectionTransform,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!1,e._mirroredCameraPosition=y.TransformCoordinates(e.activeCamera.position,l)},this._reflectionRTT.onAfterRender=function(){r._mesh&&(r._mesh.isVisible=o),e.clipPlane=a,e.setTransformMatrix(s,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!0,e._mirroredCameraPosition=null}},t.prototype.getAnimatables=function(){var e=[];return this.bumpTexture&&this.bumpTexture.animations&&this.bumpTexture.animations.length>0&&e.push(this.bumpTexture),this._reflectionRTT&&this._reflectionRTT.animations&&this._reflectionRTT.animations.length>0&&e.push(this._reflectionRTT),this._refractionRTT&&this._refractionRTT.animations&&this._refractionRTT.animations.length>0&&e.push(this._refractionRTT),e},t.prototype.getActiveTextures=function(){var e=n.prototype.getActiveTextures.call(this);return this._bumpTexture&&e.push(this._bumpTexture),e},t.prototype.hasTexture=function(e){return!!(n.prototype.hasTexture.call(this,e)||this._bumpTexture===e)},t.prototype.dispose=function(e){this.bumpTexture&&this.bumpTexture.dispose();var i=this.getScene().customRenderTargets.indexOf(this._refractionRTT);i!=-1&&this.getScene().customRenderTargets.splice(i,1),i=-1,i=this.getScene().customRenderTargets.indexOf(this._reflectionRTT),i!=-1&&this.getScene().customRenderTargets.splice(i,1),this._reflectionRTT&&this._reflectionRTT.dispose(),this._refractionRTT&&this._refractionRTT.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),n.prototype.dispose.call(this,e)},t.prototype.clone=function(e){var i=this;return Be.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=Be.Serialize(this);if(e.customType="BABYLON.WaterMaterial",e.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(var i=0;i<this._refractionRTT.renderList.length;i++)e.renderList.push(this._refractionRTT.renderList[i].id);return e},t.prototype.getClassName=function(){return"WaterMaterial"},t.Parse=function(e,i,r){var o=Be.Parse(function(){return new t(e.name,i)},e,i,r);return o._waitingRenderList=e.renderList,o},t.CreateDefaultMesh=function(e,i){var r=ne.CreateGround(e,512,512,32,i,!1);return r},R([at("bumpTexture")],t.prototype,"_bumpTexture",void 0),R([ye("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),R([Vt()],t.prototype,"diffuseColor",void 0),R([Vt()],t.prototype,"specularColor",void 0),R([w()],t.prototype,"specularPower",void 0),R([w("disableLighting")],t.prototype,"_disableLighting",void 0),R([ye("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),R([w("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),R([ye("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),R([w()],t.prototype,"windForce",void 0),R([Pb()],t.prototype,"windDirection",void 0),R([w()],t.prototype,"waveHeight",void 0),R([w()],t.prototype,"bumpHeight",void 0),R([w("bumpSuperimpose")],t.prototype,"_bumpSuperimpose",void 0),R([ye("_markAllSubMeshesAsMiscDirty")],t.prototype,"bumpSuperimpose",void 0),R([w("fresnelSeparate")],t.prototype,"_fresnelSeparate",void 0),R([ye("_markAllSubMeshesAsMiscDirty")],t.prototype,"fresnelSeparate",void 0),R([w("bumpAffectsReflection")],t.prototype,"_bumpAffectsReflection",void 0),R([ye("_markAllSubMeshesAsMiscDirty")],t.prototype,"bumpAffectsReflection",void 0),R([Vt()],t.prototype,"waterColor",void 0),R([w()],t.prototype,"colorBlendFactor",void 0),R([Vt()],t.prototype,"waterColor2",void 0),R([w()],t.prototype,"colorBlendFactor2",void 0),R([w()],t.prototype,"waveLength",void 0),R([w()],t.prototype,"waveSpeed",void 0),R([w()],t.prototype,"waveCount",void 0),R([w()],t.prototype,"disableClipPlane",void 0),R([w()],t.prototype,"useLogarithmicDepth",null),t}(wr);Ae.RegisteredTypes["BABYLON.WaterMaterial"]=iK;function rK(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)}const nK=["data:EnvironmentBRDFTexture0","GlowLayerBlurRTT","GlowLayerBlurRTT2","HighlightLayerMainRTT"];function oK(n,t,e){async function i(u,f){return Ee.CreateScreenshotUsingRenderTargetAsync(n,e,{width:u,height:f},void 0,void 0,!0)}async function r(u){e.inertialRadiusOffset=e.inertialRadiusOffset+u}async function o(u){const{x:f,y:c,z:h}=u;e.target.x=f||0,e.target.y=c||0,e.target.z=h||0}async function a(u){const{alpha:f,beta:c,radius:h}=u;f&&(e.alpha=e.alpha+f),c&&(e.beta=e.beta+c),h&&(e.radius=e.radius+h)}async function s(){const u=t.meshes.filter(p=>!p.name.toLowerCase().includes("collider")).reduce((p,_)=>p+Math.floor(_.getTotalIndices()/3),0),f=t.materials.length,c=t.meshes.length,h=t.textures.filter(p=>p.name&&!nK.includes(p.name)).length;return{triangles:u,materials:f,meshes:c,textures:h,bodies:c,entities:1}}async function l(){}return{getScreenshot:i,getMetrics:s,panCamera:o,changeZoom:r,changeCameraPosition:a,cleanup:l}}var aK={};const aD=aK.VITE_REACT_APP_DEBUG;let tM=!1;const sK=async()=>{aD&&!tM&&(await pX(()=>import("./babylon.inspector.bundle.max-D7-l4NJm.js").then(n=>n.b),[],import.meta.url),tM=!0)};function lK(n){const t=n.getChildren().filter(e=>e.id!=="__root__");if(t.length>0){const e=t[0];let i=e.getBoundingInfo(),r=i.boundingBox.minimumWorld.add(e.position),o=i.boundingBox.maximumWorld.add(e.position);for(let a=1;a<t.length;a++){const s=t[a];i=s.getBoundingInfo();const l=i.boundingBox.minimumWorld.add(s.position),u=i.boundingBox.maximumWorld.add(s.position);r=y.Minimize(r,l),o=y.Maximize(o,u)}n.setBoundingInfo(new hr(r,o))}}let Ul;async function uK(n,t){Ul&&Ul.dispose(),Ul=new Me(n,!0,{preserveDrawingBuffer:!0,stencil:!0,antialias:!0});const e=new Ke(Ul);if(e.autoClear=!0,e.clearColor=t.background.transparent?new Je(0,0,0,0):Fy(t.background.color).toColor4(),e.ambientColor=new _e(1,1,1),e.preventDefaultOnPointerDown=!1,t.showSceneBoundaries){const s=Vv.CreateGround("ground",{width:6,height:6},e),l=Vv.CreateGround("ground",{width:6,height:6},e);l.rotate(Mi.Z,Math.PI),l.position.y=-.05;const u=new oD("groundMaterial",e);u.mainColor=new _e(1,1,1),u.lineColor=new _e(0,0,0),u.majorUnitFrequency=0,s.material=u,l.material=u;const f=Vv.CreateCylinder("boundaries",{diameter:2,height:3}),c=new Mt("boundariesMaterial",e);c.alpha=.3,c.diffuseColor=new _e(1,45/255,85/255),f.material=c,f.position.y=1.51}if(t.showThumbnailBoundaries){const s=Jb.CreateFullscreenUI("UI"),l=new so;l.width=.5,l.height=1,l.color="#736E7D",l.thickness=2,s.addControl(l)}const i=new tl("camera",0,0,0,new y(0,0,0),e);switch(i.position=new y(t.cameraX,t.cameraY,t.cameraZ),i.minZ=.1,t.projection){case Ce.PreviewProjection.PERSPECTIVE:{i.mode=dt.PERSPECTIVE_CAMERA;break}case Ce.PreviewProjection.ORTHOGRAPHIC:{i.mode=dt.ORTHOGRAPHIC_CAMERA,i.orthoTop=1,i.orthoBottom=-1,i.orthoLeft=-1,i.orthoRight=1;break}}t.type===Ce.PreviewType.WEARABLE&&qI(i,t),t.camera===Ce.PreviewCamera.INTERACTIVE&&i.attachControl(n,!0);const r=new y(t.offsetX,t.offsetY,t.offsetZ);if(i.position.addInPlace(r),i.setTarget(r),i.lowerRadiusLimit=i.radius/t.zoom,i.upperRadiusLimit=i.lowerRadiusLimit*t.wheelZoom,i.radius=i.lowerRadiusLimit+(i.upperRadiusLimit-i.lowerRadiusLimit)*t.wheelStart/100,i.wheelPrecision=t.wheelPrecision,t.panning||(i.panningSensibility=0),t.lockBeta&&(i.lowerBetaLimit=i.beta,i.upperBetaLimit=i.beta),t.lockAlpha&&(i.lowerAlphaLimit=i.alpha,i.upperAlphaLimit=i.alpha),t.lockRadius&&(i.lowerRadiusLimit=i.radius,i.upperRadiusLimit=i.radius),t.type===Ce.PreviewType.WEARABLE){const s=new pu("directional",new y(0,0,1),e);s.intensity=1;const l=new _u("spot",new y(-2,2,2),new y(2,-2,-2),Math.PI/2,1e3,e);l.intensity=1}const o=new jo("top",new y(0,-1,0),e);o.intensity=1;const a=new jo("bottom",new y(0,1,0),e);if(a.intensity=1,!rK()){const s=new pp("glow",e);s.intensity=2}return Ul.runRenderLoop(()=>{e.render()}),aD&&(await sK(),e.debugLayer.show({showExplorer:!0,embedMode:!0})),[e,oK(Ul,e,i)]}async function fK(n,t,e){const i=t.id,o=mu(t,e).contents.find(a=>a.key.toLowerCase().endsWith("_mask.png"));return o?new Promise((a,s)=>{const l=new Xb(i,o.url,!0,!1);l.onError=()=>s(l.errorObject),l.onSuccess=()=>{a(l.texture)},l.run(n,()=>a(l.texture),s)}):null}async function cK(n,t,e){const i=t.id,o=mu(t,e).contents.find(a=>a.key.toLowerCase().endsWith(".png")&&!a.key.toLowerCase().endsWith("_mask.png"));return o?new Promise((a,s)=>{const l=new Xb(i,o.url,!0,!1);l.onError=()=>s(l.errorObject),l.onSuccess=()=>{a(l.texture)},l.run(n,()=>a(l.texture),s)}):null}function hK(n,t,e){return new Promise((i,r)=>{var u;const o=(u=t.contents.find(f=>e!==null?e?f.key.toLowerCase().endsWith(e.toLowerCase()):null:f.key.toLowerCase().endsWith(".mp3")||f.key.toLowerCase().endsWith("ogg")))==null?void 0:u.url;if(!o)return i(null);const a=new LI("Sound task",o),s=()=>i(new iu("music",a.data,n,null,{spatialSound:!0})),l=f=>r(f);a.run(n,s,l)})}async function sD(n,t){const e=async(i,r)=>$t.LoadAssetContainerAsync(i,"",n,null,r);try{return await e(t,".glb")}catch{return await e(t,".gltf")}}function dK(n){const t=new ne("parent",n);for(const a of n.meshes)a!==t&&a.setParent(t);lK(t);const i=t.getBoundingInfo().boundingBox.extendSize.length(),r=new y(1/i,1/i,1/i);t.scaling=r;const o=t.getBoundingInfo().boundingBox.center.multiply(r);t.position.subtractInPlace(o)}const pK=[Ce.PreviewEmote.IDLE,Ce.PreviewEmote.MONEY,Ce.PreviewEmote.CLAP,Ce.PreviewEmote.WALK,Ce.PreviewEmote.RUN,Ce.PreviewEmote.JUMP];let Cd;function _K(n){return pK.includes(n)}function mK(n){let t="";t.endsWith("/")||(t+="/");const e=`./emotes/${n}.glb`;return t.startsWith("http")?new URL(e,t).href:e}async function lD(n,t){const e=await sD(n,t);if(e.animationGroups.length===0)throw new Error(`No animation groups found for emote with url=${t}`);return e}async function gK(n,t,e){const i=Kb(t,e.bodyShape),r=i.contents.find(o=>o.key===i.mainFile);if(!r)throw new Error(`Could not find a valid content in representation for emote=${t.id} and bodyShape=${e.bodyShape}`);return lD(n,r.url)}function vK(n,t,e){const i=Kb(t,e.bodyShape),r=e.socialEmote?e.socialEmote.audio:null;return hK(n,i,r)}async function yK(n,t,e,i){var u,f,c;let r,o=!!e.emote&&_K(e.emote),a=null;if(e.item&&ko(e.item))try{r=await gK(n,e.item,e),o=e.socialEmote?e.socialEmote.loop:e.item.emoteDataADR74.loop,a=await vK(n,e.item,e)}catch{console.warn(`Could not load emote=${e.item.id}`)}if(!r&&e.emote){const h=mK(e.emote);r=await lD(n,h)}r&&r.animationGroups.length>1&&(r.addAllToScene(),n.stopAllAnimations());const s=new Rb("emote",n);function l(){if(e.camera!==Ce.PreviewCamera.STATIC){const h=n.cameras[0];qI(h,e)}}try{for(const p of t){const _=new Map,g=[...p.container.transformNodes,...p.container.meshes];for(const v of g){const E=v.name.replace(/\.\d+$/,""),T=_.get(E)||[];T.push(v),_.set(E,T)}if(r&&r.animationGroups.length>0){for(const v of r.animationGroups)if(!(e.socialEmote&&!nX(v,e.socialEmote)))for(const E of v.targetedAnimations){const T=E.animation.clone(),S=E.target,C=E.animation.getKeys();if(T.setKeys([...C]),e.socialEmote){const O=((u=e.socialEmote.Armature)==null?void 0:u.animation)&&v.name.toLowerCase().startsWith(e.socialEmote.Armature.animation.toLowerCase()),A=((f=e.socialEmote.Armature_Other)==null?void 0:f.animation)&&v.name.toLowerCase().startsWith(e.socialEmote.Armature_Other.animation.toLowerCase()),M=((c=e.socialEmote.Armature_Prop)==null?void 0:c.animation)&&v.name.toLowerCase().startsWith(e.socialEmote.Armature_Prop.animation.toLowerCase());if(O&&!A&&!M){const D=S.name.replace(/\.\d+$/,""),U=_.get(D)||[];if(U.length>0)for(const V of U){const B=T.clone();B.setKeys([...C]),s.addTargetedAnimation(B,V)}else console.warn("No matching bone found for",S.name)}else if(A){const D=S.name.replace(/\.\d+$/,""),U=_.get(D)||[];if(U.length>0)for(const V of U){const B=i==null?void 0:i.get(V);if(!B)continue;const z=T.clone();z.setKeys([...C]),s.addTargetedAnimation(z,B)}else console.warn("No matching bone found for",S.name)}else M&&s.addTargetedAnimation(T,S)}else if(r.animationGroups.length===1||v.name.toLowerCase().includes("avatar")||S.name.startsWith("Avatar_")){const A=S.name.replace(/\.\d+$/,""),M=_.get(A)||[];if(M.length>0)for(const D of M){const U=T.clone();U.setKeys([...C]),s.addTargetedAnimation(U,D)}else console.warn("No matching bone found for",S.name)}else s.addTargetedAnimation(T,S)}}}s.onAnimationGroupEndObservable.addOnce(l);const h=bK(s,o,a,e.item);return e.camera===Ce.PreviewCamera.STATIC&&h.stop(),h}catch(h){console.warn(`Could not play emote=${e.emote}`,h)}}function bK(n,t,e,i){Me.audioEngine.useCustomUnlockedButton=!0,Me.audioEngine.setGlobalVolume(0);let r,o=!1;async function a(){return Math.max(n.to,0)}async function s(){return n.isPlaying}async function l(){return!!e}async function u(C){o=!0;const O=await s();O&&n.pause(),n.stop(),n.start(!1,1,C,C,!1),r=C,o=!0,O&&f()}async function f(){await s()||(r?(n.start(t,1,r,await a(),!1),e&&(e.stop(),e._startOffset=r,e.play()),r=0):(n.play(t),e==null||e.play()))}async function c(){await s()&&(n.pause(),e==null||e.pause())}async function h(){n.goToFrame(0),n.stop(),e==null||e.stop()}async function p(){e&&(Me.audioEngine.unlock(),Me.audioEngine.setGlobalVolume(1),n.isPlaying&&!e.isPlaying&&e.play(void 0,n.targetedAnimations[0].animation.runtimeAnimations[0].currentFrame))}async function _(){e&&Me.audioEngine.setGlobalVolume(0)}async function g(){return i&&i.emoteDataADR74&&!!i.emoteDataADR74.startAnimation&&!!i.emoteDataADR74.outcomes&&i.emoteDataADR74.outcomes.length>0}async function v(){return await g()?[{title:"Start Animation",...i.emoteDataADR74.startAnimation},...i.emoteDataADR74.outcomes.map(C=>({title:C.title,loop:C.loop,audio:C.audio,...C.clips}))]:null}const E=Sb(),T=()=>(Cd&&clearInterval(Cd),window.setInterval(async()=>{var C;if(await s()&&n.animatables[0].masterFrame>0)return E.emit(Ce.PreviewEmoteEventType.ANIMATION_PLAYING,{length:(C=n.animatables[0])==null?void 0:C.masterFrame})},10)),S=()=>{clearInterval(Cd),o||E.emit(Ce.PreviewEmoteEventType.ANIMATION_PLAYING,{length:n.to})};return n.onAnimationGroupPlayObservable.add(()=>(Cd=T(),E.emit(Ce.PreviewEmoteEventType.ANIMATION_PLAY))),n.onAnimationGroupPauseObservable.add(()=>{E.emit(Ce.PreviewEmoteEventType.ANIMATION_PAUSE)}),n.onAnimationGroupLoopObservable.add(()=>(e==null||e.stop(),e==null||e.play(),o&&(h(),f(),o=!1),E.emit(Ce.PreviewEmoteEventType.ANIMATION_LOOP))),n.onAnimationGroupEndObservable.add(()=>(S(),t||(o=!1),E.emit(Ce.PreviewEmoteEventType.ANIMATION_END))),{getLength:a,isPlaying:s,goTo:u,play:f,pause:c,stop:h,enableSound:p,disableSound:_,hasSound:l,events:E,emote:i,isSocialEmote:g,getSocialEmoteAnimations:v}}function EK(n,t,e){return async i=>{const r=t.find(eX(i));return r?Promise.all([cK(n,r,e),fK(n,r,e)]):[null,null]}}async function TK(n,t,e){const i=EK(n,t,e),[r,o,a]=await Promise.all([i(Ce.WearableCategory.EYES),i(Ce.WearableCategory.EYEBROWS),i(Ce.WearableCategory.MOUTH)]);return{eyes:r,eyebrows:o,mouth:a}}async function SK(n,t,e,i,r,o){for(const a of t.container.meshes){if(a.name.toLowerCase().endsWith("mask_eyes")){const[s,l]=e;s?fy(n,"eyes",a,s,o.eyes,l,"#ffffff"):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_eyebrows")){const[s,l]=i;s?fy(n,"eyebrows",a,s,o.hair,l,o.hair):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_mouth")){const[s,l]=r;s?fy(n,"mouth",a,s,o.skin,l,o.skin):a.setEnabled(!1)}}}function fy(n,t,e,i,r,o,a){const s=new Mt(`${t}_standard_material`,n);s.alphaMode=Ci.PBRMATERIAL_ALPHABLEND,s.backFaceCulling=!0,s.specularColor=_e.Black(),i.hasAlpha=!0,s.sideOrientation=qs.CW,s.diffuseTexture=i,s.diffuseColor=o?_e.Black():Fy(a),o&&(s.emissiveTexture=o,s.diffuseColor=Fy(r)),e.material=s}function CK(n,t,e=Ce.BodyShape.MALE){const i={};for(const r of n)try{const o=mu(r,e);for(const a of o.contents)i[a.key]=a.url}catch{console.warn(`Skipping generation of mappings for wearable="${r.id}" since it lacks a representation for bodyShape="${e}"`);continue}if(t){const r=Kb(t,e);for(const o of r.contents)i[o.key]=o.url}return i}function PK(n){const t=as(n.item)?[n.item,...n.wearables]:n.wearables,e=ko(n.item)?n.item:void 0,i=CK(t,e,n.bodyShape);$t.OnPluginActivatedObservable.add(r=>{if(r.name==="gltf"){const o=r;o.preprocessUrlAsync=async a=>{const l=a.split("/").pop();if(!l)return a;const f=Object.keys(i).find(c=>c.endsWith(l));return i[f]||a}}})}const AK=`float angleY = 3.14 / 2.0;
|
|
16066
|
+
`;ce.ShadersStore[J6]=eK;var tK=function(n){j(t,n);function t(){var e=n.call(this)||this;return e.BUMP=!1,e.REFLECTION=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.POINTSIZE=!1,e.FOG=!1,e.NORMAL=!1,e.UV1=!1,e.UV2=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.SPECULARTERM=!1,e.LOGARITHMICDEPTH=!1,e.FRESNELSEPARATE=!1,e.BUMPSUPERIMPOSE=!1,e.BUMPAFFECTSREFLECTION=!1,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.EXPOSURE=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.rebuild(),e}return t}(Er),iK=function(n){j(t,n);function t(e,i,r){r===void 0&&(r=new Ie(512,512));var o=n.call(this,e,i)||this;return o.renderTargetSize=r,o.diffuseColor=new _e(1,1,1),o.specularColor=new _e(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o.windForce=6,o.windDirection=new Ie(0,1),o.waveHeight=.4,o.bumpHeight=.4,o._bumpSuperimpose=!1,o._fresnelSeparate=!1,o._bumpAffectsReflection=!1,o.waterColor=new _e(.1,.1,.6),o.colorBlendFactor=.2,o.waterColor2=new _e(.1,.1,.6),o.colorBlendFactor2=.2,o.waveLength=.1,o.waveSpeed=1,o.waveCount=20,o.disableClipPlane=!1,o._renderTargets=new yr(16),o._mesh=null,o._reflectionTransform=te.Zero(),o._lastTime=0,o._lastDeltaTime=0,o._createRenderTargets(i,r),o.getRenderTargetTextures=function(){return o._renderTargets.reset(),o._renderTargets.push(o._reflectionRTT),o._renderTargets.push(o._refractionRTT),o._renderTargets},o._imageProcessingConfiguration=o.getScene().imageProcessingConfiguration,o._imageProcessingConfiguration&&(o._imageProcessingObserver=o._imageProcessingConfiguration.onUpdateParameters.add(function(){o._markAllSubMeshesAsImageProcessingDirty()})),o}return Object.defineProperty(t.prototype,"hasRenderTargetTextures",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported,this._markAllSubMeshesAsMiscDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refractionTexture",{get:function(){return this._refractionRTT},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"reflectionTexture",{get:function(){return this._reflectionRTT},enumerable:!1,configurable:!0}),t.prototype.addToRenderList=function(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)},t.prototype.enableRenderTargets=function(e){var i=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=i),this._reflectionRTT&&(this._reflectionRTT.refreshRate=i)},t.prototype.getRenderList=function(){return this._refractionRTT?this._refractionRTT.renderList:[]},Object.defineProperty(t.prototype,"renderTargetsEnabled",{get:function(){return!(this._refractionRTT&&this._refractionRTT.refreshRate===0)},enumerable:!1,configurable:!0}),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,i,r){if(this.isFrozen&&i.effect&&i.effect._wasPreviouslyReady)return!0;i._materialDefines||(i._materialDefines=new tK);var o=i._materialDefines,a=this.getScene();if(this._isReadyForSubMesh(i))return!0;var s=a.getEngine();if(o._areTexturesDirty&&(o._needUVs=!1,a.texturesEnabled)){if(this.bumpTexture&&ke.BumpTextureEnabled)if(this.bumpTexture.isReady())o._needUVs=!0,o.BUMP=!0;else return!1;ke.ReflectionTextureEnabled&&(o.REFLECTION=!0)}if(oe.PrepareDefinesForFrameBoundValues(a,s,o,!!r),oe.PrepareDefinesForMisc(e,a,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),o),o._areMiscDirty&&(this._fresnelSeparate&&(o.FRESNELSEPARATE=!0),this._bumpSuperimpose&&(o.BUMPSUPERIMPOSE=!0),this._bumpAffectsReflection&&(o.BUMPAFFECTSREFLECTION=!0)),o._needNormals=oe.PrepareDefinesForLights(a,e,o,!0,this._maxSimultaneousLights,this._disableLighting),o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o),o.IS_REFLECTION_LINEAR=this.reflectionTexture!=null&&!this.reflectionTexture.gammaSpace,o.IS_REFRACTION_LINEAR=this.refractionTexture!=null&&!this.refractionTexture.gammaSpace}if(oe.PrepareDefinesForAttributes(e,o,!0,!0),this._mesh=e,this._waitingRenderList){for(var l=0;l<this._waitingRenderList.length;l++)this.addToRenderList(a.getNodeByID(this._waitingRenderList[l]));this._waitingRenderList=null}if(o.isDirty){o.markAsProcessed(),a.resetCachedMaterial();var u=new Tr;o.FOG&&u.addFallback(1,"FOG"),o.LOGARITHMICDEPTH&&u.addFallback(0,"LOGARITHMICDEPTH"),oe.HandleFallbacksForShadows(o,u,this.maxSimultaneousLights),o.NUM_BONE_INFLUENCERS>0&&u.addCPUSkinningFallback(0,e);var f=[I.PositionKind];o.NORMAL&&f.push(I.NormalKind),o.UV1&&f.push(I.UVKind),o.UV2&&f.push(I.UV2Kind),o.VERTEXCOLOR&&f.push(I.ColorKind),oe.PrepareAttributesForBones(f,e,o,u),oe.PrepareAttributesForInstances(f,o);var c="water",h=o.toString(),p=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vNormalInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","normalMatrix","logarithmicDepthConstant","worldReflectionViewProjection","windDirection","waveLength","time","windForce","cameraPosition","bumpHeight","waveHeight","waterColor","waterColor2","colorBlendFactor","colorBlendFactor2","waveSpeed","waveCount"],_=["normalSampler","refractionSampler","reflectionSampler"],g=new Array;Hi&&(Hi.PrepareUniforms(p,o),Hi.PrepareSamplers(_,o)),oe.PrepareUniformsAndSamplersList({uniformsNames:p,uniformBuffersNames:g,samplers:_,defines:o,maxSimultaneousLights:this.maxSimultaneousLights}),i.setEffect(a.getEngine().createEffect(c,{attributes:f,uniformsNames:p,uniformBuffersNames:g,samplers:_,defines:h,fallbacks:u,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},s),o)}return!i.effect||!i.effect.isReady()?!1:(o._renderId=a.getRenderId(),i.effect._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,i,r){var o=this.getScene(),a=r._materialDefines;if(a){var s=r.effect;if(!(!s||!this._mesh)){this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),oe.BindBonesParameters(i,this._activeEffect),this._mustRebind(o,s)&&(this.bumpTexture&&ke.BumpTextureEnabled&&(this._activeEffect.setTexture("normalSampler",this.bumpTexture),this._activeEffect.setFloat2("vNormalInfos",this.bumpTexture.coordinatesIndex,this.bumpTexture.level),this._activeEffect.setMatrix("normalMatrix",this.bumpTexture.getTextureMatrix())),oe.BindClipPlane(this._activeEffect,o),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),oe.BindEyePosition(s,o)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*i.visibility),a.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),o.lightsEnabled&&!this.disableLighting&&oe.BindLights(o,i,this._activeEffect,a,this.maxSimultaneousLights),o.fogEnabled&&i.applyFog&&o.fogMode!==Ke.FOGMODE_NONE&&this._activeEffect.setMatrix("view",o.getViewMatrix()),oe.BindFogParameters(o,i,this._activeEffect),oe.BindLogDepth(a,this._activeEffect,o),ke.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));var l=this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(o.getProjectionMatrix()),u=o.getEngine().getDeltaTime();u!==this._lastDeltaTime&&(this._lastDeltaTime=u,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("worldReflectionViewProjection",l),this._activeEffect.setVector2("windDirection",this.windDirection),this._activeEffect.setFloat("waveLength",this.waveLength),this._activeEffect.setFloat("time",this._lastTime/1e5),this._activeEffect.setFloat("windForce",this.windForce),this._activeEffect.setFloat("waveHeight",this.waveHeight),this._activeEffect.setFloat("bumpHeight",this.bumpHeight),this._activeEffect.setColor4("waterColor",this.waterColor,1),this._activeEffect.setFloat("colorBlendFactor",this.colorBlendFactor),this._activeEffect.setColor4("waterColor2",this.waterColor2,1),this._activeEffect.setFloat("colorBlendFactor2",this.colorBlendFactor2),this._activeEffect.setFloat("waveSpeed",this.waveSpeed),this._activeEffect.setFloat("waveCount",this.waveCount),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect),this._afterBind(i,this._activeEffect)}}},t.prototype._createRenderTargets=function(e,i){var r=this;this._refractionRTT=new ji(name+"_refraction",{width:i.x,height:i.y},e,!1,!0),this._refractionRTT.wrapU=To.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=To.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0,this._reflectionRTT=new ji(name+"_reflection",{width:i.x,height:i.y},e,!1,!0),this._reflectionRTT.wrapU=To.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=To.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;var o,a=null,s,l=te.Zero();this._refractionRTT.onBeforeRender=function(){if(r._mesh&&(o=r._mesh.isVisible,r._mesh.isVisible=!1),!r.disableClipPlane){a=e.clipPlane;var u=r._mesh?r._mesh.position.y:0;e.clipPlane=zo.FromPositionAndNormal(new y(0,u+.05,0),new y(0,1,0))}},this._refractionRTT.onAfterRender=function(){r._mesh&&(r._mesh.isVisible=o),r.disableClipPlane||(e.clipPlane=a)},this._reflectionRTT.onBeforeRender=function(){if(r._mesh&&(o=r._mesh.isVisible,r._mesh.isVisible=!1),!r.disableClipPlane){a=e.clipPlane;var u=r._mesh?r._mesh.position.y:0;e.clipPlane=zo.FromPositionAndNormal(new y(0,u-.05,0),new y(0,-1,0)),te.ReflectionToRef(e.clipPlane,l)}s=e.getViewMatrix(),l.multiplyToRef(s,r._reflectionTransform),e.setTransformMatrix(r._reflectionTransform,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!1,e._mirroredCameraPosition=y.TransformCoordinates(e.activeCamera.position,l)},this._reflectionRTT.onAfterRender=function(){r._mesh&&(r._mesh.isVisible=o),e.clipPlane=a,e.setTransformMatrix(s,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!0,e._mirroredCameraPosition=null}},t.prototype.getAnimatables=function(){var e=[];return this.bumpTexture&&this.bumpTexture.animations&&this.bumpTexture.animations.length>0&&e.push(this.bumpTexture),this._reflectionRTT&&this._reflectionRTT.animations&&this._reflectionRTT.animations.length>0&&e.push(this._reflectionRTT),this._refractionRTT&&this._refractionRTT.animations&&this._refractionRTT.animations.length>0&&e.push(this._refractionRTT),e},t.prototype.getActiveTextures=function(){var e=n.prototype.getActiveTextures.call(this);return this._bumpTexture&&e.push(this._bumpTexture),e},t.prototype.hasTexture=function(e){return!!(n.prototype.hasTexture.call(this,e)||this._bumpTexture===e)},t.prototype.dispose=function(e){this.bumpTexture&&this.bumpTexture.dispose();var i=this.getScene().customRenderTargets.indexOf(this._refractionRTT);i!=-1&&this.getScene().customRenderTargets.splice(i,1),i=-1,i=this.getScene().customRenderTargets.indexOf(this._reflectionRTT),i!=-1&&this.getScene().customRenderTargets.splice(i,1),this._reflectionRTT&&this._reflectionRTT.dispose(),this._refractionRTT&&this._refractionRTT.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),n.prototype.dispose.call(this,e)},t.prototype.clone=function(e){var i=this;return Be.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=Be.Serialize(this);if(e.customType="BABYLON.WaterMaterial",e.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(var i=0;i<this._refractionRTT.renderList.length;i++)e.renderList.push(this._refractionRTT.renderList[i].id);return e},t.prototype.getClassName=function(){return"WaterMaterial"},t.Parse=function(e,i,r){var o=Be.Parse(function(){return new t(e.name,i)},e,i,r);return o._waitingRenderList=e.renderList,o},t.CreateDefaultMesh=function(e,i){var r=ne.CreateGround(e,512,512,32,i,!1);return r},R([at("bumpTexture")],t.prototype,"_bumpTexture",void 0),R([ye("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),R([Vt()],t.prototype,"diffuseColor",void 0),R([Vt()],t.prototype,"specularColor",void 0),R([w()],t.prototype,"specularPower",void 0),R([w("disableLighting")],t.prototype,"_disableLighting",void 0),R([ye("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),R([w("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),R([ye("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),R([w()],t.prototype,"windForce",void 0),R([Pb()],t.prototype,"windDirection",void 0),R([w()],t.prototype,"waveHeight",void 0),R([w()],t.prototype,"bumpHeight",void 0),R([w("bumpSuperimpose")],t.prototype,"_bumpSuperimpose",void 0),R([ye("_markAllSubMeshesAsMiscDirty")],t.prototype,"bumpSuperimpose",void 0),R([w("fresnelSeparate")],t.prototype,"_fresnelSeparate",void 0),R([ye("_markAllSubMeshesAsMiscDirty")],t.prototype,"fresnelSeparate",void 0),R([w("bumpAffectsReflection")],t.prototype,"_bumpAffectsReflection",void 0),R([ye("_markAllSubMeshesAsMiscDirty")],t.prototype,"bumpAffectsReflection",void 0),R([Vt()],t.prototype,"waterColor",void 0),R([w()],t.prototype,"colorBlendFactor",void 0),R([Vt()],t.prototype,"waterColor2",void 0),R([w()],t.prototype,"colorBlendFactor2",void 0),R([w()],t.prototype,"waveLength",void 0),R([w()],t.prototype,"waveSpeed",void 0),R([w()],t.prototype,"waveCount",void 0),R([w()],t.prototype,"disableClipPlane",void 0),R([w()],t.prototype,"useLogarithmicDepth",null),t}(wr);Ae.RegisteredTypes["BABYLON.WaterMaterial"]=iK;function rK(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)}const nK=["data:EnvironmentBRDFTexture0","GlowLayerBlurRTT","GlowLayerBlurRTT2","HighlightLayerMainRTT"];function oK(n,t,e){async function i(u,f){return Ee.CreateScreenshotUsingRenderTargetAsync(n,e,{width:u,height:f},void 0,void 0,!0)}async function r(u){e.inertialRadiusOffset=e.inertialRadiusOffset+u}async function o(u){const{x:f,y:c,z:h}=u;e.target.x=f||0,e.target.y=c||0,e.target.z=h||0}async function a(u){const{alpha:f,beta:c,radius:h}=u;f&&(e.alpha=e.alpha+f),c&&(e.beta=e.beta+c),h&&(e.radius=e.radius+h)}async function s(){const u=t.meshes.filter(p=>!p.name.toLowerCase().includes("collider")).reduce((p,_)=>p+Math.floor(_.getTotalIndices()/3),0),f=t.materials.length,c=t.meshes.length,h=t.textures.filter(p=>p.name&&!nK.includes(p.name)).length;return{triangles:u,materials:f,meshes:c,textures:h,bodies:c,entities:1}}async function l(){}return{getScreenshot:i,getMetrics:s,panCamera:o,changeZoom:r,changeCameraPosition:a,cleanup:l}}var aK={};const aD=aK.VITE_REACT_APP_DEBUG;let tM=!1;const sK=async()=>{aD&&!tM&&(await pX(()=>import("./babylon.inspector.bundle.max-BeSzUjE_.js").then(n=>n.b),[],import.meta.url),tM=!0)};function lK(n){const t=n.getChildren().filter(e=>e.id!=="__root__");if(t.length>0){const e=t[0];let i=e.getBoundingInfo(),r=i.boundingBox.minimumWorld.add(e.position),o=i.boundingBox.maximumWorld.add(e.position);for(let a=1;a<t.length;a++){const s=t[a];i=s.getBoundingInfo();const l=i.boundingBox.minimumWorld.add(s.position),u=i.boundingBox.maximumWorld.add(s.position);r=y.Minimize(r,l),o=y.Maximize(o,u)}n.setBoundingInfo(new hr(r,o))}}let Ul;async function uK(n,t){Ul&&Ul.dispose(),Ul=new Me(n,!0,{preserveDrawingBuffer:!0,stencil:!0,antialias:!0});const e=new Ke(Ul);if(e.autoClear=!0,e.clearColor=t.background.transparent?new Je(0,0,0,0):Fy(t.background.color).toColor4(),e.ambientColor=new _e(1,1,1),e.preventDefaultOnPointerDown=!1,t.showSceneBoundaries){const s=Vv.CreateGround("ground",{width:6,height:6},e),l=Vv.CreateGround("ground",{width:6,height:6},e);l.rotate(Mi.Z,Math.PI),l.position.y=-.05;const u=new oD("groundMaterial",e);u.mainColor=new _e(1,1,1),u.lineColor=new _e(0,0,0),u.majorUnitFrequency=0,s.material=u,l.material=u;const f=Vv.CreateCylinder("boundaries",{diameter:2,height:3}),c=new Mt("boundariesMaterial",e);c.alpha=.3,c.diffuseColor=new _e(1,45/255,85/255),f.material=c,f.position.y=1.51}if(t.showThumbnailBoundaries){const s=Jb.CreateFullscreenUI("UI"),l=new so;l.width=.5,l.height=1,l.color="#736E7D",l.thickness=2,s.addControl(l)}const i=new tl("camera",0,0,0,new y(0,0,0),e);switch(i.position=new y(t.cameraX,t.cameraY,t.cameraZ),i.minZ=.1,t.projection){case Ce.PreviewProjection.PERSPECTIVE:{i.mode=dt.PERSPECTIVE_CAMERA;break}case Ce.PreviewProjection.ORTHOGRAPHIC:{i.mode=dt.ORTHOGRAPHIC_CAMERA,i.orthoTop=1,i.orthoBottom=-1,i.orthoLeft=-1,i.orthoRight=1;break}}t.type===Ce.PreviewType.WEARABLE&&qI(i,t),t.camera===Ce.PreviewCamera.INTERACTIVE&&i.attachControl(n,!0);const r=new y(t.offsetX,t.offsetY,t.offsetZ);if(i.position.addInPlace(r),i.setTarget(r),i.lowerRadiusLimit=i.radius/t.zoom,i.upperRadiusLimit=i.lowerRadiusLimit*t.wheelZoom,i.radius=i.lowerRadiusLimit+(i.upperRadiusLimit-i.lowerRadiusLimit)*t.wheelStart/100,i.wheelPrecision=t.wheelPrecision,t.panning||(i.panningSensibility=0),t.lockBeta&&(i.lowerBetaLimit=i.beta,i.upperBetaLimit=i.beta),t.lockAlpha&&(i.lowerAlphaLimit=i.alpha,i.upperAlphaLimit=i.alpha),t.lockRadius&&(i.lowerRadiusLimit=i.radius,i.upperRadiusLimit=i.radius),t.type===Ce.PreviewType.WEARABLE){const s=new pu("directional",new y(0,0,1),e);s.intensity=1;const l=new _u("spot",new y(-2,2,2),new y(2,-2,-2),Math.PI/2,1e3,e);l.intensity=1}const o=new jo("top",new y(0,-1,0),e);o.intensity=1;const a=new jo("bottom",new y(0,1,0),e);if(a.intensity=1,!rK()){const s=new pp("glow",e);s.intensity=2}return Ul.runRenderLoop(()=>{e.render()}),aD&&(await sK(),e.debugLayer.show({showExplorer:!0,embedMode:!0})),[e,oK(Ul,e,i)]}async function fK(n,t,e){const i=t.id,o=mu(t,e).contents.find(a=>a.key.toLowerCase().endsWith("_mask.png"));return o?new Promise((a,s)=>{const l=new Xb(i,o.url,!0,!1);l.onError=()=>s(l.errorObject),l.onSuccess=()=>{a(l.texture)},l.run(n,()=>a(l.texture),s)}):null}async function cK(n,t,e){const i=t.id,o=mu(t,e).contents.find(a=>a.key.toLowerCase().endsWith(".png")&&!a.key.toLowerCase().endsWith("_mask.png"));return o?new Promise((a,s)=>{const l=new Xb(i,o.url,!0,!1);l.onError=()=>s(l.errorObject),l.onSuccess=()=>{a(l.texture)},l.run(n,()=>a(l.texture),s)}):null}function hK(n,t,e){return new Promise((i,r)=>{var u;const o=(u=t.contents.find(f=>e!==null?e?f.key.toLowerCase().endsWith(e.toLowerCase()):null:f.key.toLowerCase().endsWith(".mp3")||f.key.toLowerCase().endsWith("ogg")))==null?void 0:u.url;if(!o)return i(null);const a=new LI("Sound task",o),s=()=>i(new iu("music",a.data,n,null,{spatialSound:!0})),l=f=>r(f);a.run(n,s,l)})}async function sD(n,t){const e=async(i,r)=>$t.LoadAssetContainerAsync(i,"",n,null,r);try{return await e(t,".glb")}catch{return await e(t,".gltf")}}function dK(n){const t=new ne("parent",n);for(const a of n.meshes)a!==t&&a.setParent(t);lK(t);const i=t.getBoundingInfo().boundingBox.extendSize.length(),r=new y(1/i,1/i,1/i);t.scaling=r;const o=t.getBoundingInfo().boundingBox.center.multiply(r);t.position.subtractInPlace(o)}const pK=[Ce.PreviewEmote.IDLE,Ce.PreviewEmote.MONEY,Ce.PreviewEmote.CLAP,Ce.PreviewEmote.WALK,Ce.PreviewEmote.RUN,Ce.PreviewEmote.JUMP];let Cd;function _K(n){return pK.includes(n)}function mK(n){let t="";t.endsWith("/")||(t+="/");const e=`./emotes/${n}.glb`;return t.startsWith("http")?new URL(e,t).href:e}async function lD(n,t){const e=await sD(n,t);if(e.animationGroups.length===0)throw new Error(`No animation groups found for emote with url=${t}`);return e}async function gK(n,t,e){const i=Kb(t,e.bodyShape),r=i.contents.find(o=>o.key===i.mainFile);if(!r)throw new Error(`Could not find a valid content in representation for emote=${t.id} and bodyShape=${e.bodyShape}`);return lD(n,r.url)}function vK(n,t,e){const i=Kb(t,e.bodyShape),r=e.socialEmote?e.socialEmote.audio:null;return hK(n,i,r)}async function yK(n,t,e,i){var u,f,c;let r,o=!!e.emote&&_K(e.emote),a=null;if(e.item&&ko(e.item))try{r=await gK(n,e.item,e),o=e.socialEmote?e.socialEmote.loop:e.item.emoteDataADR74.loop,a=await vK(n,e.item,e)}catch{console.warn(`Could not load emote=${e.item.id}`)}if(!r&&e.emote){const h=mK(e.emote);r=await lD(n,h)}r&&r.animationGroups.length>1&&(r.addAllToScene(),n.stopAllAnimations());const s=new Rb("emote",n);function l(){if(e.camera!==Ce.PreviewCamera.STATIC){const h=n.cameras[0];qI(h,e)}}try{for(const p of t){const _=new Map,g=[...p.container.transformNodes,...p.container.meshes];for(const v of g){const E=v.name.replace(/\.\d+$/,""),T=_.get(E)||[];T.push(v),_.set(E,T)}if(r&&r.animationGroups.length>0){for(const v of r.animationGroups)if(!(e.socialEmote&&!nX(v,e.socialEmote)))for(const E of v.targetedAnimations){const T=E.animation.clone(),S=E.target,C=E.animation.getKeys();if(T.setKeys([...C]),e.socialEmote){const O=((u=e.socialEmote.Armature)==null?void 0:u.animation)&&v.name.toLowerCase().startsWith(e.socialEmote.Armature.animation.toLowerCase()),A=((f=e.socialEmote.Armature_Other)==null?void 0:f.animation)&&v.name.toLowerCase().startsWith(e.socialEmote.Armature_Other.animation.toLowerCase()),M=((c=e.socialEmote.Armature_Prop)==null?void 0:c.animation)&&v.name.toLowerCase().startsWith(e.socialEmote.Armature_Prop.animation.toLowerCase());if(O&&!A&&!M){const D=S.name.replace(/\.\d+$/,""),U=_.get(D)||[];if(U.length>0)for(const V of U){const B=T.clone();B.setKeys([...C]),s.addTargetedAnimation(B,V)}else console.warn("No matching bone found for",S.name)}else if(A){const D=S.name.replace(/\.\d+$/,""),U=_.get(D)||[];if(U.length>0)for(const V of U){const B=i==null?void 0:i.get(V);if(!B)continue;const z=T.clone();z.setKeys([...C]),s.addTargetedAnimation(z,B)}else console.warn("No matching bone found for",S.name)}else M&&s.addTargetedAnimation(T,S)}else if(r.animationGroups.length===1||v.name.toLowerCase().includes("avatar")||S.name.startsWith("Avatar_")){const A=S.name.replace(/\.\d+$/,""),M=_.get(A)||[];if(M.length>0)for(const D of M){const U=T.clone();U.setKeys([...C]),s.addTargetedAnimation(U,D)}else console.warn("No matching bone found for",S.name)}else s.addTargetedAnimation(T,S)}}}s.onAnimationGroupEndObservable.addOnce(l);const h=bK(s,o,a,e.item);return e.camera===Ce.PreviewCamera.STATIC&&h.stop(),h}catch(h){console.warn(`Could not play emote=${e.emote}`,h)}}function bK(n,t,e,i){Me.audioEngine.useCustomUnlockedButton=!0,Me.audioEngine.setGlobalVolume(0);let r,o=!1;async function a(){return Math.max(n.to,0)}async function s(){return n.isPlaying}async function l(){return!!e}async function u(C){o=!0;const O=await s();O&&n.pause(),n.stop(),n.start(!1,1,C,C,!1),r=C,o=!0,O&&f()}async function f(){await s()||(r?(n.start(t,1,r,await a(),!1),e&&(e.stop(),e._startOffset=r,e.play()),r=0):(n.play(t),e==null||e.play()))}async function c(){await s()&&(n.pause(),e==null||e.pause())}async function h(){n.goToFrame(0),n.stop(),e==null||e.stop()}async function p(){e&&(Me.audioEngine.unlock(),Me.audioEngine.setGlobalVolume(1),n.isPlaying&&!e.isPlaying&&e.play(void 0,n.targetedAnimations[0].animation.runtimeAnimations[0].currentFrame))}async function _(){e&&Me.audioEngine.setGlobalVolume(0)}async function g(){return i&&i.emoteDataADR74&&!!i.emoteDataADR74.startAnimation&&!!i.emoteDataADR74.outcomes&&i.emoteDataADR74.outcomes.length>0}async function v(){return await g()?[{title:"Start Animation",...i.emoteDataADR74.startAnimation},...i.emoteDataADR74.outcomes.map(C=>({title:C.title,loop:C.loop,audio:C.audio,...C.clips}))]:null}const E=Sb(),T=()=>(Cd&&clearInterval(Cd),window.setInterval(async()=>{var C;if(await s()&&n.animatables[0].masterFrame>0)return E.emit(Ce.PreviewEmoteEventType.ANIMATION_PLAYING,{length:(C=n.animatables[0])==null?void 0:C.masterFrame})},10)),S=()=>{clearInterval(Cd),o||E.emit(Ce.PreviewEmoteEventType.ANIMATION_PLAYING,{length:n.to})};return n.onAnimationGroupPlayObservable.add(()=>(Cd=T(),E.emit(Ce.PreviewEmoteEventType.ANIMATION_PLAY))),n.onAnimationGroupPauseObservable.add(()=>{E.emit(Ce.PreviewEmoteEventType.ANIMATION_PAUSE)}),n.onAnimationGroupLoopObservable.add(()=>(e==null||e.stop(),e==null||e.play(),o&&(h(),f(),o=!1),E.emit(Ce.PreviewEmoteEventType.ANIMATION_LOOP))),n.onAnimationGroupEndObservable.add(()=>(S(),t||(o=!1),E.emit(Ce.PreviewEmoteEventType.ANIMATION_END))),{getLength:a,isPlaying:s,goTo:u,play:f,pause:c,stop:h,enableSound:p,disableSound:_,hasSound:l,events:E,emote:i,isSocialEmote:g,getSocialEmoteAnimations:v}}function EK(n,t,e){return async i=>{const r=t.find(eX(i));return r?Promise.all([cK(n,r,e),fK(n,r,e)]):[null,null]}}async function TK(n,t,e){const i=EK(n,t,e),[r,o,a]=await Promise.all([i(Ce.WearableCategory.EYES),i(Ce.WearableCategory.EYEBROWS),i(Ce.WearableCategory.MOUTH)]);return{eyes:r,eyebrows:o,mouth:a}}async function SK(n,t,e,i,r,o){for(const a of t.container.meshes){if(a.name.toLowerCase().endsWith("mask_eyes")){const[s,l]=e;s?fy(n,"eyes",a,s,o.eyes,l,"#ffffff"):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_eyebrows")){const[s,l]=i;s?fy(n,"eyebrows",a,s,o.hair,l,o.hair):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_mouth")){const[s,l]=r;s?fy(n,"mouth",a,s,o.skin,l,o.skin):a.setEnabled(!1)}}}function fy(n,t,e,i,r,o,a){const s=new Mt(`${t}_standard_material`,n);s.alphaMode=Ci.PBRMATERIAL_ALPHABLEND,s.backFaceCulling=!0,s.specularColor=_e.Black(),i.hasAlpha=!0,s.sideOrientation=qs.CW,s.diffuseTexture=i,s.diffuseColor=o?_e.Black():Fy(a),o&&(s.emissiveTexture=o,s.diffuseColor=Fy(r)),e.material=s}function CK(n,t,e=Ce.BodyShape.MALE){const i={};for(const r of n)try{const o=mu(r,e);for(const a of o.contents)i[a.key]=a.url}catch{console.warn(`Skipping generation of mappings for wearable="${r.id}" since it lacks a representation for bodyShape="${e}"`);continue}if(t){const r=Kb(t,e);for(const o of r.contents)i[o.key]=o.url}return i}function PK(n){const t=as(n.item)?[n.item,...n.wearables]:n.wearables,e=ko(n.item)?n.item:void 0,i=CK(t,e,n.bodyShape);$t.OnPluginActivatedObservable.add(r=>{if(r.name==="gltf"){const o=r;o.preprocessUrlAsync=async a=>{const l=a.split("/").pop();if(!l)return a;const f=Object.keys(i).find(c=>c.endsWith(l));return i[f]||a}}})}const AK=`float angleY = 3.14 / 2.0;
|
|
16067
16067
|
|
|
16068
16068
|
mat3 rotateY = mat3(
|
|
16069
16069
|
cos(angleY), 0, sin(angleY),
|
|
@@ -16105,4 +16105,4 @@ else
|
|
|
16105
16105
|
}
|
|
16106
16106
|
`,cy="#include<pbrBlockFinalColorComposition>",iM="#include<customToonShading>";if(ce.ShadersStore.pbrPixelShader.includes(cy))ce.ShadersStore.pbrPixelShader.includes(iM)||(ce.ShadersStore.pbrPixelShader=ce.ShadersStore.pbrPixelShader.replace(cy,cy+`
|
|
16107
16107
|
`+iM+`
|
|
16108
|
-
`));else throw new Error("could not patch the pbrPixelShader");ce.IncludesShadersStore.customToonShading=AK;async function hy(n,t,e=Ce.BodyShape.MALE,i,r){const o=mu(t,e);if(yp(o))throw new Error(`The wearable="${t.id}" is a texture`);const a=x5(o),s=await sD(n,a);for(const l of s.meshes)l.name.toLowerCase().includes("collider")&&(l.isVisible=!1,n.removeMesh(l));for(const l of s.materials)if(l instanceof Ci){const u=l;u.specularIntensity=0,u.metallic&&(u.metallic=0,u.metallicF0Factor=0),u.name.toLowerCase().includes("hair")&&(r?(u.albedoColor=_e.FromHexString(r).toLinearSpace(),u.specularIntensity=0,u.alpha=1):(u.alpha=0,n.removeMaterial(u))),u.name.toLowerCase().includes("skin")&&(i?(u.albedoColor=_e.FromHexString(i).toLinearSpace(),u.specularIntensity=0,u.alpha=1):(u.alpha=0,n.removeMaterial(u)))}for(const l of s.animationGroups)l.stop(),l.reset(),l.dispose();return{container:s,wearable:t}}async function RK(n,t){const[e,i]=await uK(n,t);try{PK(t);let r;const o=[];if(t.type===Ce.PreviewType.AVATAR){const s=cX(t),l=Array.from(s.values());for(const p of l.filter(YI)){const _=hy(e,p,t.bodyShape,t.skin,t.hair).catch(g=>{console.warn(g.message)});o.push(_)}let u=null;t.socialEmote&&t.socialEmote.Armature_Other&&(u=new ne("parent_other",e));const f=new Map,c=(await Promise.all(o)).filter(iX);for(const p of c)if(p.container.addAllToScene(),u){const _=p.container.instantiateModelsToScene(S=>`${S}_Other`),v=_e.FromHexString("#c9c9c9").toLinearSpace(),E=_.rootNodes;for(const S of E)S.setParent(u);sX(E,v);const T=aX(p.container,E);for(const[S,C]of T)f.set(S,C)}const h=lX(c);if(h){const p=l.filter(rX),{eyes:_,eyebrows:g,mouth:v}=await TK(e,p,t.bodyShape);SK(e,h,_,g,v,t)}r=await yK(e,c,t,f)||CR()}else{const s=t.item;if(s&&!ko(s))try{(await hy(e,s,t.bodyShape,t.skin,t.hair)).container.addAllToScene()}catch{(await hy(e,s,t.bodyShape===Ce.BodyShape.MALE?Ce.BodyShape.FEMALE:Ce.BodyShape.MALE,t.skin,t.hair)).container.addAllToScene()}r=CR()}return t.centerBoundingBox&&dK(e),{scene:i,emote:r}}catch(r){throw e.clearColor=new Je(0,0,0,0),r}}function OK(n){const t=()=>{Ce.sendMessage(cn(),Ce.PreviewMessageType.EMOTE_EVENT,{type:Ce.PreviewEmoteEventType.ANIMATION_PLAY,payload:void 0})},e=()=>{Ce.sendMessage(cn(),Ce.PreviewMessageType.EMOTE_EVENT,{type:Ce.PreviewEmoteEventType.ANIMATION_PAUSE,payload:void 0})},i=()=>{Ce.sendMessage(cn(),Ce.PreviewMessageType.EMOTE_EVENT,{type:Ce.PreviewEmoteEventType.ANIMATION_LOOP,payload:void 0})},r=()=>{Ce.sendMessage(cn(),Ce.PreviewMessageType.EMOTE_EVENT,{type:Ce.PreviewEmoteEventType.ANIMATION_END,payload:void 0})},o=a=>{Ce.sendMessage(cn(),Ce.PreviewMessageType.EMOTE_EVENT,{type:Ce.PreviewEmoteEventType.ANIMATION_PLAYING,payload:a})};return n.emote.events.on(Ce.PreviewEmoteEventType.ANIMATION_PLAY,t),n.emote.events.on(Ce.PreviewEmoteEventType.ANIMATION_PAUSE,e),n.emote.events.on(Ce.PreviewEmoteEventType.ANIMATION_LOOP,i),n.emote.events.on(Ce.PreviewEmoteEventType.ANIMATION_END,r),n.emote.events.on(Ce.PreviewEmoteEventType.ANIMATION_PLAYING,o),()=>{n.emote.events.off(Ce.PreviewEmoteEventType.ANIMATION_PLAY,t),n.emote.events.off(Ce.PreviewEmoteEventType.ANIMATION_PAUSE,e),n.emote.events.off(Ce.PreviewEmoteEventType.ANIMATION_LOOP,i),n.emote.events.off(Ce.PreviewEmoteEventType.ANIMATION_END,r),n.emote.events.off(Ce.PreviewEmoteEventType.ANIMATION_PLAYING,o)}}const MK=()=>{const[n,t]=Ct.useState(""),{width:e,height:i}=WM(),[r,o]=Ct.useState({}),[a,s]=Ct.useState(!1),[l,u]=Ct.useState(!0),[f,c]=Ct.useState(!1),h=Ct.useRef(null),p=XI(),[_,g,v]=Z5(),[E,T]=Ct.useState(""),[S,C]=Ct.useState(!0),[O,A]=Ct.useState(!1),M=n||v,D=(l||g)&&!M,U=!!E&&!S&&!D,V=S&&!D;return Ct.useEffect(()=>{let B=()=>{};if(h.current&&_){let z={opacity:1};_.background.image&&(T(_.background.image),z.opacity=1,!_.background.transparent&&_.type===Ce.PreviewType.TEXTURE&&(z.backgroundColor=_.background.color)),o(z),_.type===Ce.PreviewType.TEXTURE?(C(!1),u(!1),c(!0)):RK(h.current,_).then(J=>{p.current=J,B=OK(p.current)}).catch(J=>t(J.message)).finally(()=>{u(!1),c(!0)})}return()=>{B()}},[h.current,_]),Ct.useEffect(()=>{var B;O||(f?(Ce.sendMessage(cn(),Ce.PreviewMessageType.LOAD,{renderer:Ce.PreviewRenderer.BABYLON}),A(!0),((_==null?void 0:_.type)===Ce.PreviewType.AVATAR||_!=null&&_.emote&&_.emote!==Ce.PreviewEmote.IDLE)&&((B=p.current)==null||B.emote.play())):M&&(Ce.sendMessage(cn(),Ce.PreviewMessageType.ERROR,{message:M}),A(!0)))},[f,M,O,p,_==null?void 0:_.type,_==null?void 0:_.emote]),Ct.useEffect(()=>{if(g){let B=!1;l||(u(!0),B=!0),O&&(A(!1),B=!0),B&&f&&c(!1)}},[g,l,O,f]),jI(),On.jsxs("div",{className:Zl("Preview",{"is-dragging":a,"is-loading":D,"is-loaded":f,"is-3d":S&&(_==null?void 0:_.camera)===Ce.PreviewCamera.INTERACTIVE,"has-error":!!M,"no-fade-effect":_&&!_.fadeEffect}),style:r,children:[On.jsx("img",{src:E,className:Zl("thumbnail",{"is-visible":U}),alt:"preview"}),On.jsx("canvas",{id:"wearable-preview",className:Zl({"is-visible":V}),width:e,height:i,ref:h,onMouseDown:()=>s(S&&!M),onMouseUp:()=>s(!1)}),M&&On.jsx("div",{className:"error",children:M})]})},xK=aM.memo(MK);var uD=(n=>(n.SET_MODE="SetMode",n.SET_PROFILE="SetProfile",n.SET_EMOTE="SetEmote",n.SET_URNS="SetUrns",n.SET_BACKGROUND="SetBackground",n.SET_SKIN_COLOR="SetSkinColor",n.SET_HAIR_COLOR="SetHairColor",n.SET_EYE_COLOR="SetEyeColor",n.SET_BODY_SHAPE="SetBodyShape",n.SET_SHOW_ANIMATION_REFERENCE="SetShowAnimationReference",n.SET_PROJECTION="SetProjection",n.ADD_BASE64="AddBase64",n.CLEAR_BASE64="ClearBase64",n.SET_CONTRACT="SetContract",n.SET_ITEM_ID="SetItemID",n.SET_TOKEN_ID="SetTokenID",n.SET_DISABLE_LOADER="SetDisableLoader",n.RELOAD="Reload",n.CLEANUP="Cleanup",n))(uD||{});const IK={unityMode:"SetMode",profile:"SetProfile",emote:"SetEmote",urns:"SetUrns",background:"SetBackground",skin:"SetSkinColor",hair:"SetHairColor",eyes:"SetEyeColor",bodyShape:"SetBodyShape",showAnimationReference:"SetShowAnimationReference",projection:"SetProjection",base64s:"AddBase64",contractAddress:"SetContract",itemId:"SetItemID",tokenId:"SetTokenID",disableLoader:"SetDisableLoader"},DK={unityMode:n=>String(n),profile:n=>String(n),emote:n=>String(n),urns:n=>Array.isArray(n)?n.join(","):String(n),background:n=>typeof n=="string"?n.replace("#",""):String(n),skin:n=>typeof n=="string"?n.replace("#",""):String(n),hair:n=>typeof n=="string"?n.replace("#",""):String(n),eyes:n=>typeof n=="string"?n.replace("#",""):String(n),bodyShape:n=>String(n),showAnimationReference:n=>String(n),projection:n=>String(n),contractAddress:n=>String(n),itemId:n=>String(n),tokenId:n=>String(n),disableLoader:n=>String(n)},Pd=(n,t,e)=>{if(n)try{const i=String(t);Object.values(uD).includes(i)||console.warn(`Unknown Unity method: ${i}. Sending anyway...`),e!==void 0?n.SendMessage("JSBridge",i,e):n.SendMessage("JSBridge",i)}catch(i){console.error(`Failed to send Unity message ${t}:`,i)}else console.warn(`Unity instance not ready, cannot send message: ${t}`)},wK=(n,t,e)=>{if(!n){console.warn("Unity instance not available, cannot send override messages");return}let i=0;t.base64s!==void 0&&e.base64s&&(Pd(n,"ClearBase64"),i++,Array.isArray(t.base64s)&&t.base64s.length>0&&t.base64s.forEach(r=>{Pd(n,"AddBase64",r),i++})),Object.entries(t).forEach(([r,o])=>{if(r!=="base64s"&&e[r]&&o!==void 0){const a=IK[r];if(a){const s=DK[r],l=s?s(o):String(o);Pd(n,a,l),i++}else console.warn(`No Unity method mapping found for property: ${r}`)}}),i>0&&Pd(n,"Reload")};var LK={VITE_BASE_URL:""};const dy=new Map,kl=(n,t)=>t;function NK(n){if(dy.has(n))return dy.get(n);const t=new Promise((e,i)=>{const r=document.querySelector(`script[src="${n}"]`);if(r){r.addEventListener("load",()=>e(r)),r.addEventListener("error",a=>i(a));return}const o=document.createElement("script");o.src=n,o.async=!0,o.onload=()=>e(o),o.onerror=a=>i(a),document.body.appendChild(o)});return dy.set(n,t),t}const FK=async(n,t,e,i,r,o,a,s,l,u,f,c)=>{try{const h=LK.VITE_BASE_URL||"";return await NK(kl(h,t)),await createUnityInstance(n,{dataUrl:kl(h,e),frameworkUrl:kl(h,i),codeUrl:kl(h,r),streamingAssetsUrl:kl(h,a),symbolUrl:kl(h,o),companyName:s,productName:l,productVersion:u,matchWebGLToCanvasSize:f,arguments:c})}catch(h){throw console.error("❌ Failed to load Unity instance:",h),h}};function BK(n){return{getScreenshot:()=>new Promise(t=>{if(!n){t("");return}n.SendMessage("JSBridge","TakeScreenshot",""),window.addEventListener("message",function e(i){if(i.data.type==="unity-renderer"){const{type:r,payload:o}=i.data.payload;r==="screenshot"&&(window.removeEventListener("message",e),t(o))}})}),getMetrics:()=>new Promise(t=>{if(!n){t({triangles:0,materials:0,textures:0,meshes:0,bodies:0,entities:0});return}n.SendMessage("JSBridge","GetMetrics",""),window.addEventListener("message",function e(i){if(i.data.type==="unity-renderer"){const{type:r,payload:o}=i.data.payload;r==="metrics"&&(window.removeEventListener("message",e),t(o))}})}),changeZoom:async t=>{n&&n.SendMessage("JSBridge","SetZoom",t.toString())},panCamera:async t=>{if(!n)return;const e=t.x??0,i=t.y??0,r=t.z??0;n.SendMessage("JSBridge","SetOffset",`${e},${i},${r}`)},changeCameraPosition:async t=>{if(!n)return;const e=t.alpha??0,i=t.beta??0,r=t.radius??0;n.SendMessage("JSBridge","SetCameraPosition",`${e},${i},${r}`)},setUsername:async t=>{n&&n.SendMessage("JSBridge","SetUsername",t)},cleanup:async()=>{n&&n.SendMessage("JSBridge","Cleanup","")}}}function VK(n){const t=Sb();return{getLength:async()=>new Promise(e=>{if(!n){e(0);return}n.SendMessage("JSBridge","GetEmoteLength",""),window.addEventListener("message",function i(r){if(r.data.type==="unity-renderer"){const{type:o,payload:a}=r.data.payload;o==="emoteLength"&&(window.removeEventListener("message",i),e(a))}})}),isPlaying:async()=>new Promise(e=>{if(!n){e(!1);return}n.SendMessage("JSBridge","IsEmotePlaying",""),window.addEventListener("message",function i(r){if(r.data.type==="unity-renderer"){const{type:o,payload:a}=r.data.payload;o==="isEmotePlaying"&&(window.removeEventListener("message",i),e(a))}})}),goTo:async e=>{n&&(n.SendMessage("JSBridge","GoToEmote",e.toString()),t.emit(Ce.PreviewEmoteEventType.ANIMATION_PLAYING,{length:e}))},play:async()=>{n&&(n.SendMessage("JSBridge","PlayEmote",""),t.emit(Ce.PreviewEmoteEventType.ANIMATION_PLAY))},pause:async()=>{n&&(n.SendMessage("JSBridge","PauseEmote",""),t.emit(Ce.PreviewEmoteEventType.ANIMATION_PAUSE))},stop:async()=>{n&&(n.SendMessage("JSBridge","StopEmote",""),t.emit(Ce.PreviewEmoteEventType.ANIMATION_END))},enableSound:async()=>{n&&n.SendMessage("JSBridge","EnableSound","")},disableSound:async()=>{n&&n.SendMessage("JSBridge","DisableSound","")},hasSound:async()=>new Promise(e=>{if(!n){e(!1);return}n.SendMessage("JSBridge","HasSound",""),window.addEventListener("message",function i(r){if(r.data.type==="unity-renderer"){const{type:o,payload:a}=r.data.payload;o==="hasSound"&&(window.removeEventListener("message",i),e(a))}})}),events:t}}async function UK(n){let t=null;try{if(t=await FK(n,"/unity/Build/aang-renderer.loader.js","/unity/Build/aang-renderer.data.br","/unity/Build/aang-renderer.framework.js.br","/unity/Build/aang-renderer.wasm.br","/unity/Build/aang-renderer.symbols.json.br","/emotes","Decentraland","AangRenderer","2.0.3",!0,[]),!t)throw new Error("Failed to load Unity instance");const e=BK(t),i=VK(t);return{scene:e,emote:i,unity:t}}catch(e){if(console.error("Unity render failed:",e),t!=null&&t.Quit)try{t.Quit()}catch(i){console.error("Error quitting Unity instance:",i)}throw e}}const kK=()=>Math.floor(Math.random()*159)+1,fD=()=>`default${kK()}`,zK=(n,t)=>{var e,i,r,o,a,s;return{eyes:ou(t.eyes||((i=(e=n==null?void 0:n.avatar)==null?void 0:e.eyes)==null?void 0:i.color)&&au(n.avatar.eyes.color)||"#000000"),hair:ou(t.hair||((o=(r=n==null?void 0:n.avatar)==null?void 0:r.hair)==null?void 0:o.color)&&au(n.avatar.hair.color)||"#000000"),skin:ou(t.skin||((s=(a=n==null?void 0:n.avatar)==null?void 0:a.skin)==null?void 0:s.color)&&au(n.avatar.skin.color)||"#cc9b76")}},ff=n=>n||"",rM=n=>n||[],Ad=n=>n.replace("#","");function nM(n){const t=new URL(window.location.href);Object.entries(n).forEach(([e,i])=>{t.searchParams.delete(e),Array.isArray(i)?i.forEach(r=>{r!==""&&t.searchParams.append(e,r)}):i!==""&&t.searchParams.set(e,i)}),window.history.replaceState({},"",t.toString())}function GK(){const{options:n,overrideSources:t}=$b(),[e,i]=Ct.useState(null),[r,o]=Ct.useState(!0),[a,s]=Ct.useState(null),l=Ct.useRef(null),u=Ct.useRef(n),f=Ct.useRef(!0);return Ct.useEffect(()=>{const c=JSON.stringify(n),h=JSON.stringify(u.current);if(!f.current&&c===h)return;f.current=!1,u.current=n,(async()=>{var _,g;try{o(!0),s(null);const v=n.peerUrl||Wf.get("PEER_URL"),E=n.nftServerUrl||Wf.get("NFT_SERVER_URL");let T=Ce.PreviewType.WEARABLE,S={color:n.background||"#4b4852",transparent:n.disableBackground===!0};const C=UI(n.profile);let O=C==null?void 0:C.value;O==="default"&&(O=fD());const A=O&&C?C.type==="address"?await zI(O,v):await GI(O,v):null,M=n.bodyShape||((_=A==null?void 0:A.avatar)==null?void 0:_.bodyShape)||Ce.BodyShape.MALE;let D=null;if(n.contractAddress&&(D=await WI({contractAddress:n.contractAddress,tokenId:n.tokenId,itemId:n.itemId,peerUrl:v,nftServerUrl:E}),D&&as(D))){S={...S,image:D.thumbnail};const Z=qb(D);yp(Z)&&(T=Ce.PreviewType.TEXTURE)}const{eyes:U,hair:V,skin:B}=zK(A,{eyes:n.eyes,hair:n.hair,skin:n.skin}),z=n.unityMode||null,J=n.camera&&Object.values(Ce.PreviewCamera).includes(n.camera)?n.camera:Ce.PreviewCamera.INTERACTIVE,X=n.projection&&Object.values(Ce.PreviewProjection).includes(n.projection)?n.projection:Ce.PreviewProjection.PERSPECTIVE,re=n.disableDefaultEmotes?null:n.emote&&Object.values(Ce.PreviewEmote).includes(n.emote)?n.emote:Ce.PreviewEmote.IDLE,ae={background:S,bodyShape:M,mode:z,projection:X,type:T,base64:((g=n.base64s)==null?void 0:g[0])||null,contract:n.contractAddress||null,disableLoader:n.disableLoader||!1,emote:(re==null?void 0:re.toString())||null,eyeColor:U.replace("#",""),hairColor:V.replace("#",""),item:n.itemId||null,profile:O||null,skinColor:B.replace("#",""),token:n.tokenId||null,urn:n.urns||null,showAnimationReference:null},se=JSON.stringify(ae),H=JSON.stringify(l.current);if(se!==H){if(l.current=ae,Object.keys(t).length===0){const Z=rM(n.urns),q=rM(n.base64s);if(z===Ce.PreviewUnityMode.CONFIG){const N={mode:ff(z||"")};nM(N)}else{const N={background:S.transparent?"":Ad(S.color),disableLoader:n.disableLoader?"true":"",profile:ff(O||""),bodyShape:ff(M||""),eyeColor:Ad(U||""),hairColor:Ad(V||""),skinColor:Ad(B||""),mode:ff(z||""),camera:J,projection:X,emote:ff((re==null?void 0:re.toString())||""),urn:Z.length>0?Z:[""],base64:q.length>0?q:[""]};nM(N)}}i(ae)}o(!1)}catch(v){console.error("[useUnityConfig] Failed to load config:",v),s(v instanceof Error?v.message:"Failed to load config"),o(!1)}})()},[n,t]),[e,r,a]}const WK="unity-renderer",HK="unity-canvas",oM=1,jK="Failed to load Unity",XK=(n,t,e,i)=>{const[r,o]=Ct.useState({isLoaded:!1,isInitialized:!1,error:null}),a=Ct.useCallback(l=>{if(l.data.type===WK){const{type:u,payload:f}=l.data.payload;u==="loaded"&&(f===!0||f==="true")?(o(c=>({...c,isLoaded:!0,isInitialized:!0})),Ce.sendMessage(cn(),Ce.PreviewMessageType.LOAD,{renderer:Ce.PreviewRenderer.UNITY})):u==="customization-done"?Ce.sendMessage(cn(),Ce.PreviewMessageType.CONTROLLER_RESPONSE,{id:"customization-done",ok:!0,result:JSON.parse(l.data.payload.payload)}):u==="error"&&(o(c=>({...c,error:f})),Ce.sendMessage(cn(),Ce.PreviewMessageType.ERROR,{message:"Error loading the wearable. Please try again."}))}},[]),s=Ct.useCallback(async()=>{if(!(!n.canvas.current||n.isInitializing.current||n.unityInstance.current)){n.isInitializing.current=!0,o(l=>({...l,isLoaded:!1,error:null}));try{const{unity:l,scene:u,emote:f}=await UK(n.canvas.current);n.unityInstance.current=l,t.current={scene:u,emote:f},o(c=>({...c,isLoaded:!0,isInitialized:!0})),Ce.sendMessage(cn(),Ce.PreviewMessageType.LOAD,{renderer:Ce.PreviewRenderer.UNITY})}catch(l){const u=l instanceof Error?l.message:jK;console.error("Unity init failed:",l),o(f=>({...f,error:u})),Ce.sendMessage(cn(),Ce.PreviewMessageType.ERROR,{message:u})}finally{n.isInitializing.current=!1}}},[n,t]);return Ct.useEffect(()=>{r.isInitialized||i||!e||s()},[e,i,r.isInitialized,s]),Ct.useEffect(()=>{if(e)return window.addEventListener("message",a,!1),()=>{window.removeEventListener("message",a,!1)}},[e,a]),r},YK=n=>{const[t,e]=Ct.useState({pixelRatio:window.devicePixelRatio||oM,is3D:!0,backgroundImage:""});return Ct.useEffect(()=>{const i=()=>{e(o=>({...o,pixelRatio:window.devicePixelRatio||oM}))},r=window.matchMedia(`(resolution: ${t.pixelRatio}dppx)`);return r.addEventListener("change",i),()=>{r.removeEventListener("change",i)}},[t.pixelRatio]),Ct.useEffect(()=>{n&&e(i=>({...i,backgroundImage:n.background.image||"",is3D:n.type!==Ce.PreviewType.TEXTURE}))},[n]),t},KK=(n,t,e,i,r)=>{const o=Ct.useMemo(()=>{const a={};for(const s of Object.keys(r))r[s]&&i[s]!==void 0&&(a[s]=i[s]);return a},[r,i]);Ct.useEffect(()=>{if(!(!e.isInitialized||!e.isLoaded||!n.current)){if(o.profile==="default"){const a=t.current.profile;o.profile=a!=null&&a.match(/^default\d+$/)?a:fD()}Object.keys(o).length>0&&(wK(n.current,o,r),t.current=o)}},[e.isInitialized,e.isLoaded,o,r,n,t])},qK=()=>{const{width:n=window.innerWidth,height:t=window.innerHeight}=WM(),e=Ct.useRef(null),i=Ct.useRef(null),r=Ct.useRef(!1),o=Ct.useRef({}),a=XI(),[s,l,u]=GK(),{options:f,overrideSources:c}=$b(),h=Ct.useMemo(()=>({canvas:e,unityInstance:i,isInitializing:r,lastSentOverrides:o}),[]),p=XK(h,a,s,l),_=YK(s);KK(h.unityInstance,h.lastSentOverrides,p,f,c),jI();const g=Ct.useMemo(()=>{const A=p.error||u,M=!p.isLoaded&&!A,D=!!_.backgroundImage&&!_.is3D&&!M,U=_.is3D&&!M;return{error:A,isLoading:M,showImage:D,showCanvas:U}},[p.error,p.isLoaded,u,_.backgroundImage,_.is3D]),v=Ct.useMemo(()=>({opacity:1,backgroundColor:!(s!=null&&s.background.transparent)&&(s==null?void 0:s.type)===Ce.PreviewType.TEXTURE?s.background.color:void 0}),[s]),E=Ct.useMemo(()=>({width:`${n}px`,height:`${t}px`}),[n,t]),T=Ct.useMemo(()=>({width:Math.round(n*_.pixelRatio),height:Math.round(t*_.pixelRatio)}),[n,t,_.pixelRatio]),S=Ct.useMemo(()=>Zl("Preview",{"is-loading":g.isLoading,"is-loaded":p.isLoaded,"is-3d":_.is3D,"has-error":!!g.error}),[g.isLoading,p.isLoaded,_.is3D,g.error]),C=Ct.useMemo(()=>Zl("thumbnail",{"is-visible":g.showImage}),[g.showImage]),O=Ct.useMemo(()=>Zl({"is-visible":g.showCanvas}),[g.showCanvas]);return On.jsxs("div",{className:S,style:v,children:[On.jsx("img",{src:_.backgroundImage,className:C,alt:"preview"}),On.jsx("canvas",{ref:h.canvas,id:HK,className:O,width:T.width,height:T.height,style:E}),g.error&&On.jsx("div",{className:"error",children:g.error})]})},QK=aM.memo(qK),cD=Ct.createContext(null),$K=({children:n,value:t})=>{const e={webGPUSupport:t,isSupported:t.isSupported,isAvailable:t.isAvailable};return On.jsx(cD.Provider,{value:e,children:n})},ZK=()=>{const n=Ct.useContext(cD);if(!n)throw new Error("useWebGPUContext must be used within a WebGPUProvider");return n},JK=()=>ZK(),eq=()=>{const n=navigator.userAgent.toLowerCase();let t="Unknown",e="Unknown",i="Unknown";if(/android/.test(n)){t="Android";const r=n.match(/android\s*([0-9.]+)/);r&&(i=r[1])}else if(/iphone|ipad|ipod/.test(n)){t="iOS";const r=n.match(/os\s*([0-9_]+)/);r&&(i=r[1].replace(/_/g,"."))}else if(/macintosh|mac os x/.test(n)){t="macOS";const r=n.match(/mac os x\s*([0-9_]+)/);r&&(i=r[1].replace(/_/g,"."))}else if(/windows/.test(n)){t="Windows";const r=n.match(/windows nt\s*([0-9.]+)/);r&&(i=r[1])}else if(/linux/.test(n)){t="Linux";const r=n.match(/\(([^)]+)\)/);r&&(i=r[1])}if(/chrome|crios/.test(n)){e="Chrome";const r=n.match(/(?:chrome|crios)\/([0-9.]+)/);r&&(i=r[1])}else if(/firefox|fxios/.test(n)){e="Firefox";const r=n.match(/(?:firefox|fxios)\/([0-9.]+)/);r&&(i=r[1])}else if(/safari/.test(n)&&!/chrome|crios|android/.test(n)){e="Safari";const r=n.match(/version\/([0-9.]+)/);r&&(i=r[1])}else if(/edg/.test(n)){e="Edge";const r=n.match(/edg\/([0-9.]+)/);r&&(i=r[1])}return{platform:t,browser:e,version:i}},tq=async()=>{const{platform:n,browser:t,version:e}=eq();if(!navigator.gpu)return console.warn("❌ navigator.gpu is not available"),{isSupported:!1,isAvailable:!1,error:"WebGPU is not supported in this browser. Please use a compatible browser.",platform:n,browser:t,platformVersion:e,browserVersion:e};try{const i=await navigator.gpu.requestAdapter();return i?await i.requestDevice()?{isSupported:!0,isAvailable:!0,platform:n,browser:t,platformVersion:e,browserVersion:e}:(console.warn("❌ Failed to create WebGPU device"),{isSupported:!0,isAvailable:!1,error:"WebGPU adapter found but failed to create device. This might be due to hardware limitations or driver issues.",platform:n,browser:t,platformVersion:e,browserVersion:e}):(console.warn("❌ No WebGPU adapter available"),{isSupported:!0,isAvailable:!1,error:"WebGPU is supported but no adapter is available. This might be due to hardware limitations or driver issues.",platform:n,browser:t,platformVersion:e,browserVersion:e})}catch(i){return console.error("❌ WebGPU detection error:",i),{isSupported:!0,isAvailable:!1,error:`WebGPU is supported but failed to initialize: ${i instanceof Error?i.message:"Unknown error"}`,platform:n,browser:t,platformVersion:e,browserVersion:e}}},iq=()=>{const t=new URLSearchParams(window.location.search).get("unity")==="true",{isAvailable:e}=JK();return t&&e?On.jsx(QK,{}):On.jsx(xK,{})},rq=async()=>{const n=await tq();tL.createRoot(document.getElementById("root")).render(On.jsx(Ct.StrictMode,{children:On.jsx($K,{value:n,children:On.jsx(iq,{})})}))};rq();export{Xd as $,ut as A,qB as B,S2 as C,tl as D,ux as E,Ob as F,fx as G,cx as H,dx as I,px as J,H4 as K,up as L,ya as M,O8 as N,u5 as O,pa as P,Eq as Q,l2 as R,Wo as S,c2 as T,zU as U,Mi as V,ga as W,yd as X,Bb as Y,wv as Z,ZB as _,zl as a,Yo as a$,Yd as a0,jn as a1,bd as a2,i8 as a3,KB as a4,yq as a5,LI as a6,ZW as a7,wO as a8,CI as a9,$B as aA,AI as aB,A4 as aC,xy as aD,Sa as aE,Pv as aF,jW as aG,VU as aH,_e as aI,PW as aJ,Je as aK,uH as aL,Md as aM,yI as aN,KG as aO,x4 as aP,nI as aQ,lq as aR,Hf as aS,Jx as aT,To as aU,f5 as aV,hH as aW,js as aX,g2 as aY,R4 as aZ,Nb as a_,Ur as aa,ss as ab,Mq as ac,Sq as ad,Cq as ae,u4 as af,hq as ag,h2 as ah,kd as ai,sk as aj,Aj as ak,hr as al,yy as am,Xo as an,Uf as ao,Hn as ap,f8 as aq,dt as ar,jq as as,Ir as at,fp as au,Hx as av,Ks as aw,gI as ax,EO as ay,PI as az,Ra as b,NG as b$,p5 as b0,dq as b1,Kx as b2,QB as b3,g5 as b4,sf as b5,n8 as b6,Xn as b7,eI as b8,zb as b9,YU as bA,Mb as bB,KU as bC,Fq as bD,Ri as bE,pu as bF,jb as bG,_4 as bH,vH as bI,U4 as bJ,xq as bK,w4 as bL,XM as bM,O4 as bN,OO as bO,no as bP,Hl as bQ,UR as bR,P2 as bS,Co as bT,jr as bU,II as bV,ce as bW,Tr as bX,dp as bY,Bz as bZ,LG as b_,Ws as ba,Bf as bb,Td as bc,L8 as bd,CW as be,jR as bf,GU as bg,FR as bh,mI as bi,rn as bj,UU as bk,DG as bl,YH as bm,Nf as bn,AB as bo,Ly as bp,LO as bq,nu as br,_H as bs,y8 as bt,MG as bu,Vb as bv,Rj as bw,WW as bx,g4 as by,nW as bz,Ht as c,Sn as c$,pq as c0,Me as c1,Zq as c2,pt as c3,Uq as c4,qR as c5,os as c6,Zt as c7,qG as c8,m5 as c9,cp as cA,bx as cB,Ex as cC,Tx as cD,Sx as cE,Ax as cF,F4 as cG,jG as cH,m4 as cI,Yf as cJ,gp as cK,ql as cL,xr as cM,xb as cN,A2 as cO,R2 as cP,XR as cQ,Sy as cR,v2 as cS,Rn as cT,Vo as cU,BH as cV,wn as cW,Gq as cX,pp as cY,Q4 as cZ,Fv as c_,KF as ca,rB as cb,JB as cc,SI as cd,bI as ce,p2 as cf,Zi as cg,x8 as ch,Gl as ci,EH as cj,Aq as ck,b2 as cl,_x as cm,mx as cn,b4 as co,T2 as cp,E2 as cq,gx as cr,vx as cs,yx as ct,v4 as cu,Lf as cv,d2 as cw,xn as cx,Cx as cy,Px as cz,Ji as d,ke as d$,RI as d0,Qs as d1,Ty as d2,Ub as d3,_5 as d4,kG as d5,wG as d6,NO as d7,Py as d8,jo as d9,a2 as dA,$s as dB,Ey as dC,xR as dD,Dv as dE,dO as dF,dI as dG,qz as dH,Hz as dI,k4 as dJ,Qz as dK,zx as dL,tG as dM,Hv as dN,E8 as dO,D4 as dP,Wr as dQ,E4 as dR,Wq as dS,h4 as dT,wj as dU,Ui as dV,Hd as dW,gy as dX,de as dY,gt as dZ,Er as d_,tI as da,kx as db,b8 as dc,Dq as dd,Iq as de,t8 as df,V8 as dg,_I as dh,d5 as di,d4 as dj,Hi as dk,WB as dl,wb as dm,eB as dn,Gt as dp,UO as dq,Bx as dr,Fx as ds,f4 as dt,s2 as du,Xi as dv,jt as dw,hB as dx,by as dy,rr as dz,di as e,YG as e$,oe as e0,te as e1,B4 as e2,Xv as e3,ne as e4,c5 as e5,Vv as e6,M8 as e7,t2 as e8,l4 as e9,en as eA,Ed as eB,An as eC,l8 as eD,Rt as eE,n4 as eF,eW as eG,M4 as eH,Bq as eI,qU as eJ,ie as eK,qF as eL,Wd as eM,kU as eN,Lx as eO,YR as eP,zG as eQ,Oq as eR,aI as eS,qs as eT,Yj as eU,Rr as eV,Xx as eW,Ci as eX,QR as eY,aW as eZ,XG as e_,V4 as ea,OG as eb,Vx as ec,sW as ed,IO as ee,Wx as ef,_p as eg,c4 as eh,OI as ei,Nx as ej,Go as ek,aq as el,Tq as em,Yx as en,My as eo,$4 as ep,kq as eq,z4 as er,oi as es,Wb as et,ct as eu,Vr as ev,k as ew,ue as ex,Ry as ey,Eo as ez,Wi as f,XH as f$,Gx as f0,AW as f1,$x as f2,_8 as f3,Qx as f4,vr as f5,Uv as f6,qx as f7,jv as f8,Rq as f9,uq as fA,$r as fB,hc as fC,iI as fD,Ta as fE,He as fF,Ja as fG,JM as fH,XB as fI,VR as fJ,g8 as fK,kv as fL,h8 as fM,Kd as fN,_W as fO,jd as fP,qf as fQ,il as fR,Ho as fS,uk as fT,Hq as fU,KR as fV,_t as fW,zd as fX,Jt as fY,dc as fZ,jH as f_,rl as fa,ix as fb,rx as fc,Or as fd,Qa as fe,BB as ff,p4 as fg,Xq as fh,Zf as fi,XW as fj,v8 as fk,It as fl,Ni as fm,kf as fn,Qd as fo,EI as fp,ec as fq,wq as fr,TI as fs,hn as ft,Zr as fu,zo as fv,Kf as fw,Rv as fx,Av as fy,tB as fz,RR as g,Oa as g$,Wv as g0,K4 as g1,G4 as g2,_q as g3,DI as g4,Lj as g5,lo as g6,QF as g7,mp as g8,JG as g9,GH as gA,s8 as gB,Zx as gC,ji as gD,FO as gE,HB as gF,jB as gG,Gd as gH,Y4 as gI,DB as gJ,yB as gK,fu as gL,VB as gM,tW as gN,lk as gO,vB as gP,rj as gQ,T8 as gR,Ue as gS,P4 as gT,fk as gU,Ke as gV,rt as gW,Jq as gX,$t as gY,$a as gZ,Fo as g_,FB as ga,ii as gb,wr as gc,mq as gd,EW as ge,gq as gf,Re as gg,vq as gh,Fk as gi,W4 as gj,o4 as gk,Bo as gl,o8 as gm,a8 as gn,bi as go,Lq as gp,wB as gq,SW as gr,p8 as gs,X4 as gt,iW as gu,fI as gv,WG as gw,S4 as gx,rW as gy,cI as gz,C4 as h,S8 as h$,I8 as h0,BO as h1,N8 as h2,VO as h3,y4 as h4,Pj as h5,xI as h6,vp as h7,Be as h8,YM as h9,m8 as hA,HW as hB,iu as hC,u2 as hD,St as hE,tn as hF,rI as hG,Gb as hH,Lb as hI,fc as hJ,_u as hK,qj as hL,n5 as hM,A8 as hN,R8 as hO,Qj as hP,cr as hQ,Mt as hR,IU as hS,cj as hT,$F as hU,RB as hV,N4 as hW,k2 as hX,z2 as hY,G2 as hZ,C8 as h_,ZF as ha,JF as hb,GR as hc,Ca as hd,u8 as he,zn as hf,IG as hg,Fb as hh,Gv as hi,cu as hj,MI as hk,lI as hl,J4 as hm,TW as hn,gW as ho,d8 as hp,qd as hq,nx as hr,_2 as hs,lu as ht,du as hu,Nq as hv,yr as hw,Hs as hx,j4 as hy,xO as hz,Kq as i,y as i$,W2 as i0,Pq as i1,iB as i2,KM as i3,vy as i4,Oi as i5,Ld as i6,Jf as i7,Wn as i8,Iy as i9,Ea as iA,P8 as iB,Ql as iC,Ee as iD,Qf as iE,hI as iF,Rx as iG,c8 as iH,F8 as iI,B8 as iJ,Oy as iK,nr as iL,oI as iM,$i as iN,pI as iO,lp as iP,lc as iQ,Dr as iR,uc as iS,q2 as iT,Ib as iU,Q2 as iV,wR as iW,FU as iX,Mx as iY,jM as iZ,Ie as i_,Gj as ia,L4 as ib,sq as ic,zR as id,Ay as ie,mi as ig,el as ih,YB as ii,h5 as ij,he as ik,Xb as il,T4 as im,zv as io,r8 as ip,CO as iq,D8 as ir,At as is,xx as it,dW as iu,mW as iv,Xs as iw,qt as ix,me as iy,Uo as iz,OB as j,zq as j$,ni as j0,wd as j1,I4 as j2,I as j3,ze as j4,Dd as j5,$q as j6,w8 as j7,Dz as j8,sI as j9,Sz as jA,Ko as jB,Jv as jC,Oo as jD,pO as jE,P5 as jF,E5 as jG,ey as jH,Zv as jI,Yv as jJ,Oz as jK,Rz as jL,LU as jM,Ix as jN,T5 as jO,Gn as jP,Id as jQ,FI as jR,qv as jS,Pz as jT,Dx as jU,Mr as jV,jl as jW,f2 as jX,Cy as jY,Ux as jZ,Z4 as j_,Dn as ja,DR as jb,H2 as jc,ok as jd,Tj as je,q4 as jf,Kl as jg,$M as jh,jf as ji,xB as jj,Hr as jk,nl as jl,Db as jm,qo as jn,cc as jo,Kv as jp,Qv as jq,Tz as jr,$f as js,$v as jt,xd as ju,Iz as jv,qq as jw,xz as jx,Mz as jy,Yq as jz,GG as k,ma as k$,Pn as k0,Wl as k1,C2 as k2,kR as k3,e8 as k4,ZG as k5,ox as k6,vz as k7,yz as k8,fq as k9,dr as kA,_O as kB,AX as kC,Jb as kD,j8 as kE,bp as kF,_a as kG,eD as kH,QI as kI,U8 as kJ,_X as kK,ao as kL,br as kM,ot as kN,JI as kO,Y8 as kP,SX as kQ,mX as kR,Vy as kS,IX as kT,e7 as kU,un as kV,K8 as kW,Za as kX,CX as kY,YO as kZ,gX as k_,r2 as ka,Ez as kb,UB as kc,$U as kd,QG as ke,QU as kf,Ae as kg,Qq as kh,Vq as ki,cq as kj,ui as kk,ye as kl,ZM as km,kB as kn,w as ko,fB as kp,Vt as kq,ap as kr,lB as ks,nf as kt,qM as ku,QM as kv,op as kw,uB as kx,at as ky,Pb as kz,F2 as l,pY as l$,W8 as l0,vX as l1,ay as l2,Jr as l3,q8 as l4,yX as l5,jO as l6,Q8 as l7,$I as l8,k8 as l9,ky as lA,So as lB,KO as lC,zf as lD,$X as lE,rc as lF,va as lG,ba as lH,ZX as lI,In as lJ,Tt as lK,JX as lL,eY as lM,tY as lN,EY as lO,Nt as lP,iY as lQ,rY as lR,aY as lS,uY as lT,nY as lU,sY as lV,lY as lW,dY as lX,hY as lY,oY as lZ,fY as l_,so as la,$8 as lb,XO as lc,EX as ld,G8 as le,Zb as lf,ZI as lg,z8 as lh,Z8 as li,Pa as lj,J8 as lk,PX as ll,Mn as lm,By as ln,$l as lo,zt as lp,oy as lq,sy as lr,TX as ls,Ep as lt,X8 as lu,H8 as lv,Li as lw,rs as lx,zy as ly,fn as lz,B2 as m,_Y as m0,mY as m1,gY as m2,vY as m3,yY as m4,bY as m5,is as m6,su as m7,tc as m8,Cn as m9,ub as mA,wX as ma,uy as mb,TY as mc,SY as md,MY as me,IY as mf,t7 as mg,UY as mh,jY as mi,$Y as mj,oD as mk,l6 as ml,p6 as mm,b6 as mn,wY as mo,DY as mp,xY as mq,A6 as mr,D6 as ms,V6 as mt,H6 as mu,Q6 as mv,iK as mw,oq as mx,HM as my,nq as mz,V2 as n,Ox as o,U2 as p,bq as q,oB as r,vd as s,tx as t,Ys as u,e2 as v,Rb as w,Vd as x,Ud as y,uI as z};
|
|
16108
|
+
`));else throw new Error("could not patch the pbrPixelShader");ce.IncludesShadersStore.customToonShading=AK;async function hy(n,t,e=Ce.BodyShape.MALE,i,r){const o=mu(t,e);if(yp(o))throw new Error(`The wearable="${t.id}" is a texture`);const a=x5(o),s=await sD(n,a);for(const l of s.meshes)l.name.toLowerCase().includes("collider")&&(l.isVisible=!1,n.removeMesh(l));for(const l of s.materials)if(l instanceof Ci){const u=l;u.specularIntensity=0,u.metallic&&(u.metallic=0,u.metallicF0Factor=0),u.name.toLowerCase().includes("hair")&&(r?(u.albedoColor=_e.FromHexString(r).toLinearSpace(),u.specularIntensity=0,u.alpha=1):(u.alpha=0,n.removeMaterial(u))),u.name.toLowerCase().includes("skin")&&(i?(u.albedoColor=_e.FromHexString(i).toLinearSpace(),u.specularIntensity=0,u.alpha=1):(u.alpha=0,n.removeMaterial(u)))}for(const l of s.animationGroups)l.stop(),l.reset(),l.dispose();return{container:s,wearable:t}}async function RK(n,t){const[e,i]=await uK(n,t);try{PK(t);let r;const o=[];if(t.type===Ce.PreviewType.AVATAR){const s=cX(t),l=Array.from(s.values());for(const p of l.filter(YI)){const _=hy(e,p,t.bodyShape,t.skin,t.hair).catch(g=>{console.warn(g.message)});o.push(_)}let u=null;t.socialEmote&&t.socialEmote.Armature_Other&&(u=new ne("parent_other",e));const f=new Map,c=(await Promise.all(o)).filter(iX);for(const p of c)if(p.container.addAllToScene(),u){const _=p.container.instantiateModelsToScene(S=>`${S}_Other`),v=_e.FromHexString("#c9c9c9").toLinearSpace(),E=_.rootNodes;for(const S of E)S.setParent(u);sX(E,v);const T=aX(p.container,E);for(const[S,C]of T)f.set(S,C)}const h=lX(c);if(h){const p=l.filter(rX),{eyes:_,eyebrows:g,mouth:v}=await TK(e,p,t.bodyShape);SK(e,h,_,g,v,t)}r=await yK(e,c,t,f)||CR()}else{const s=t.item;if(s&&!ko(s))try{(await hy(e,s,t.bodyShape,t.skin,t.hair)).container.addAllToScene()}catch{(await hy(e,s,t.bodyShape===Ce.BodyShape.MALE?Ce.BodyShape.FEMALE:Ce.BodyShape.MALE,t.skin,t.hair)).container.addAllToScene()}r=CR()}return t.centerBoundingBox&&dK(e),{scene:i,emote:r}}catch(r){throw e.clearColor=new Je(0,0,0,0),r}}function OK(n){const t=()=>{Ce.sendMessage(cn(),Ce.PreviewMessageType.EMOTE_EVENT,{type:Ce.PreviewEmoteEventType.ANIMATION_PLAY,payload:void 0})},e=()=>{Ce.sendMessage(cn(),Ce.PreviewMessageType.EMOTE_EVENT,{type:Ce.PreviewEmoteEventType.ANIMATION_PAUSE,payload:void 0})},i=()=>{Ce.sendMessage(cn(),Ce.PreviewMessageType.EMOTE_EVENT,{type:Ce.PreviewEmoteEventType.ANIMATION_LOOP,payload:void 0})},r=()=>{Ce.sendMessage(cn(),Ce.PreviewMessageType.EMOTE_EVENT,{type:Ce.PreviewEmoteEventType.ANIMATION_END,payload:void 0})},o=a=>{Ce.sendMessage(cn(),Ce.PreviewMessageType.EMOTE_EVENT,{type:Ce.PreviewEmoteEventType.ANIMATION_PLAYING,payload:a})};return n.emote.events.on(Ce.PreviewEmoteEventType.ANIMATION_PLAY,t),n.emote.events.on(Ce.PreviewEmoteEventType.ANIMATION_PAUSE,e),n.emote.events.on(Ce.PreviewEmoteEventType.ANIMATION_LOOP,i),n.emote.events.on(Ce.PreviewEmoteEventType.ANIMATION_END,r),n.emote.events.on(Ce.PreviewEmoteEventType.ANIMATION_PLAYING,o),()=>{n.emote.events.off(Ce.PreviewEmoteEventType.ANIMATION_PLAY,t),n.emote.events.off(Ce.PreviewEmoteEventType.ANIMATION_PAUSE,e),n.emote.events.off(Ce.PreviewEmoteEventType.ANIMATION_LOOP,i),n.emote.events.off(Ce.PreviewEmoteEventType.ANIMATION_END,r),n.emote.events.off(Ce.PreviewEmoteEventType.ANIMATION_PLAYING,o)}}const MK=()=>{const[n,t]=Ct.useState(""),{width:e,height:i}=WM(),[r,o]=Ct.useState({}),[a,s]=Ct.useState(!1),[l,u]=Ct.useState(!0),[f,c]=Ct.useState(!1),h=Ct.useRef(null),p=XI(),[_,g,v]=Z5(),[E,T]=Ct.useState(""),[S,C]=Ct.useState(!0),[O,A]=Ct.useState(!1),M=n||v,D=(l||g)&&!M,U=!!E&&!S&&!D,V=S&&!D;return Ct.useEffect(()=>{let B=()=>{};if(h.current&&_){let z={opacity:1};_.background.image&&(T(_.background.image),z.opacity=1,!_.background.transparent&&_.type===Ce.PreviewType.TEXTURE&&(z.backgroundColor=_.background.color)),o(z),_.type===Ce.PreviewType.TEXTURE?(C(!1),u(!1),c(!0)):RK(h.current,_).then(J=>{p.current=J,B=OK(p.current)}).catch(J=>t(J.message)).finally(()=>{u(!1),c(!0)})}return()=>{B()}},[h.current,_]),Ct.useEffect(()=>{var B;O||(f?(Ce.sendMessage(cn(),Ce.PreviewMessageType.LOAD,{renderer:Ce.PreviewRenderer.BABYLON}),A(!0),((_==null?void 0:_.type)===Ce.PreviewType.AVATAR||_!=null&&_.emote&&_.emote!==Ce.PreviewEmote.IDLE)&&((B=p.current)==null||B.emote.play())):M&&(Ce.sendMessage(cn(),Ce.PreviewMessageType.ERROR,{message:M}),A(!0)))},[f,M,O,p,_==null?void 0:_.type,_==null?void 0:_.emote]),Ct.useEffect(()=>{if(g){let B=!1;l||(u(!0),B=!0),O&&(A(!1),B=!0),B&&f&&c(!1)}},[g,l,O,f]),jI(),On.jsxs("div",{className:Zl("Preview",{"is-dragging":a,"is-loading":D,"is-loaded":f,"is-3d":S&&(_==null?void 0:_.camera)===Ce.PreviewCamera.INTERACTIVE,"has-error":!!M,"no-fade-effect":_&&!_.fadeEffect}),style:r,children:[On.jsx("img",{src:E,className:Zl("thumbnail",{"is-visible":U}),alt:"preview"}),On.jsx("canvas",{id:"wearable-preview",className:Zl({"is-visible":V}),width:e,height:i,ref:h,onMouseDown:()=>s(S&&!M),onMouseUp:()=>s(!1)}),M&&On.jsx("div",{className:"error",children:M})]})},xK=aM.memo(MK);var uD=(n=>(n.SET_MODE="SetMode",n.SET_PROFILE="SetProfile",n.SET_EMOTE="SetEmote",n.SET_URNS="SetUrns",n.SET_BACKGROUND="SetBackground",n.SET_SKIN_COLOR="SetSkinColor",n.SET_HAIR_COLOR="SetHairColor",n.SET_EYE_COLOR="SetEyeColor",n.SET_BODY_SHAPE="SetBodyShape",n.SET_SHOW_ANIMATION_REFERENCE="SetShowAnimationReference",n.SET_PROJECTION="SetProjection",n.ADD_BASE64="AddBase64",n.CLEAR_BASE64="ClearBase64",n.SET_CONTRACT="SetContract",n.SET_ITEM_ID="SetItemID",n.SET_TOKEN_ID="SetTokenID",n.SET_DISABLE_LOADER="SetDisableLoader",n.RELOAD="Reload",n.CLEANUP="Cleanup",n))(uD||{});const IK={unityMode:"SetMode",profile:"SetProfile",emote:"SetEmote",urns:"SetUrns",background:"SetBackground",skin:"SetSkinColor",hair:"SetHairColor",eyes:"SetEyeColor",bodyShape:"SetBodyShape",showAnimationReference:"SetShowAnimationReference",projection:"SetProjection",base64s:"AddBase64",contractAddress:"SetContract",itemId:"SetItemID",tokenId:"SetTokenID",disableLoader:"SetDisableLoader"},DK={unityMode:n=>String(n),profile:n=>String(n),emote:n=>String(n),urns:n=>Array.isArray(n)?n.join(","):String(n),background:n=>typeof n=="string"?n.replace("#",""):String(n),skin:n=>typeof n=="string"?n.replace("#",""):String(n),hair:n=>typeof n=="string"?n.replace("#",""):String(n),eyes:n=>typeof n=="string"?n.replace("#",""):String(n),bodyShape:n=>String(n),showAnimationReference:n=>String(n),projection:n=>String(n),contractAddress:n=>String(n),itemId:n=>String(n),tokenId:n=>String(n),disableLoader:n=>String(n)},Pd=(n,t,e)=>{if(n)try{const i=String(t);Object.values(uD).includes(i)||console.warn(`Unknown Unity method: ${i}. Sending anyway...`),e!==void 0?n.SendMessage("JSBridge",i,e):n.SendMessage("JSBridge",i)}catch(i){console.error(`Failed to send Unity message ${t}:`,i)}else console.warn(`Unity instance not ready, cannot send message: ${t}`)},wK=(n,t,e)=>{if(!n){console.warn("Unity instance not available, cannot send override messages");return}let i=0;t.base64s!==void 0&&e.base64s&&(Pd(n,"ClearBase64"),i++,Array.isArray(t.base64s)&&t.base64s.length>0&&t.base64s.forEach(r=>{Pd(n,"AddBase64",r),i++})),Object.entries(t).forEach(([r,o])=>{if(r!=="base64s"&&e[r]&&o!==void 0){const a=IK[r];if(a){const s=DK[r],l=s?s(o):String(o);Pd(n,a,l),i++}else console.warn(`No Unity method mapping found for property: ${r}`)}}),i>0&&Pd(n,"Reload")};var LK={VITE_BASE_URL:""};const dy=new Map,kl=(n,t)=>t;function NK(n){if(dy.has(n))return dy.get(n);const t=new Promise((e,i)=>{const r=document.querySelector(`script[src="${n}"]`);if(r){r.addEventListener("load",()=>e(r)),r.addEventListener("error",a=>i(a));return}const o=document.createElement("script");o.src=n,o.async=!0,o.onload=()=>e(o),o.onerror=a=>i(a),document.body.appendChild(o)});return dy.set(n,t),t}const FK=async(n,t,e,i,r,o,a,s,l,u,f,c)=>{try{const h=LK.VITE_BASE_URL||"";return await NK(kl(h,t)),await createUnityInstance(n,{dataUrl:kl(h,e),frameworkUrl:kl(h,i),codeUrl:kl(h,r),streamingAssetsUrl:kl(h,a),symbolUrl:kl(h,o),companyName:s,productName:l,productVersion:u,matchWebGLToCanvasSize:f,arguments:c})}catch(h){throw console.error("❌ Failed to load Unity instance:",h),h}};function BK(n){return{getScreenshot:()=>new Promise(t=>{if(!n){t("");return}n.SendMessage("JSBridge","TakeScreenshot",""),window.addEventListener("message",function e(i){if(i.data.type==="unity-renderer"){const{type:r,payload:o}=i.data.payload;r==="screenshot"&&(window.removeEventListener("message",e),t(o))}})}),getMetrics:()=>new Promise(t=>{if(!n){t({triangles:0,materials:0,textures:0,meshes:0,bodies:0,entities:0});return}n.SendMessage("JSBridge","GetMetrics",""),window.addEventListener("message",function e(i){if(i.data.type==="unity-renderer"){const{type:r,payload:o}=i.data.payload;r==="metrics"&&(window.removeEventListener("message",e),t(o))}})}),changeZoom:async t=>{n&&n.SendMessage("JSBridge","SetZoom",t.toString())},panCamera:async t=>{if(!n)return;const e=t.x??0,i=t.y??0,r=t.z??0;n.SendMessage("JSBridge","SetOffset",`${e},${i},${r}`)},changeCameraPosition:async t=>{if(!n)return;const e=t.alpha??0,i=t.beta??0,r=t.radius??0;n.SendMessage("JSBridge","SetCameraPosition",`${e},${i},${r}`)},setUsername:async t=>{n&&n.SendMessage("JSBridge","SetUsername",t)},cleanup:async()=>{n&&n.SendMessage("JSBridge","Cleanup","")}}}function VK(n){const t=Sb();return{getLength:async()=>new Promise(e=>{if(!n){e(0);return}n.SendMessage("JSBridge","GetEmoteLength",""),window.addEventListener("message",function i(r){if(r.data.type==="unity-renderer"){const{type:o,payload:a}=r.data.payload;o==="emoteLength"&&(window.removeEventListener("message",i),e(a))}})}),isPlaying:async()=>new Promise(e=>{if(!n){e(!1);return}n.SendMessage("JSBridge","IsEmotePlaying",""),window.addEventListener("message",function i(r){if(r.data.type==="unity-renderer"){const{type:o,payload:a}=r.data.payload;o==="isEmotePlaying"&&(window.removeEventListener("message",i),e(a))}})}),goTo:async e=>{n&&(n.SendMessage("JSBridge","GoToEmote",e.toString()),t.emit(Ce.PreviewEmoteEventType.ANIMATION_PLAYING,{length:e}))},play:async()=>{n&&(n.SendMessage("JSBridge","PlayEmote",""),t.emit(Ce.PreviewEmoteEventType.ANIMATION_PLAY))},pause:async()=>{n&&(n.SendMessage("JSBridge","PauseEmote",""),t.emit(Ce.PreviewEmoteEventType.ANIMATION_PAUSE))},stop:async()=>{n&&(n.SendMessage("JSBridge","StopEmote",""),t.emit(Ce.PreviewEmoteEventType.ANIMATION_END))},enableSound:async()=>{n&&n.SendMessage("JSBridge","EnableSound","")},disableSound:async()=>{n&&n.SendMessage("JSBridge","DisableSound","")},hasSound:async()=>new Promise(e=>{if(!n){e(!1);return}n.SendMessage("JSBridge","HasSound",""),window.addEventListener("message",function i(r){if(r.data.type==="unity-renderer"){const{type:o,payload:a}=r.data.payload;o==="hasSound"&&(window.removeEventListener("message",i),e(a))}})}),events:t}}async function UK(n){let t=null;try{if(t=await FK(n,"/unity/Build/aang-renderer.loader.js","/unity/Build/aang-renderer.data.br","/unity/Build/aang-renderer.framework.js.br","/unity/Build/aang-renderer.wasm.br","/unity/Build/aang-renderer.symbols.json.br","/emotes","Decentraland","AangRenderer","2.2.1",!0,[]),!t)throw new Error("Failed to load Unity instance");const e=BK(t),i=VK(t);return{scene:e,emote:i,unity:t}}catch(e){if(console.error("Unity render failed:",e),t!=null&&t.Quit)try{t.Quit()}catch(i){console.error("Error quitting Unity instance:",i)}throw e}}const kK=()=>Math.floor(Math.random()*159)+1,fD=()=>`default${kK()}`,zK=(n,t)=>{var e,i,r,o,a,s;return{eyes:ou(t.eyes||((i=(e=n==null?void 0:n.avatar)==null?void 0:e.eyes)==null?void 0:i.color)&&au(n.avatar.eyes.color)||"#000000"),hair:ou(t.hair||((o=(r=n==null?void 0:n.avatar)==null?void 0:r.hair)==null?void 0:o.color)&&au(n.avatar.hair.color)||"#000000"),skin:ou(t.skin||((s=(a=n==null?void 0:n.avatar)==null?void 0:a.skin)==null?void 0:s.color)&&au(n.avatar.skin.color)||"#cc9b76")}},ff=n=>n||"",rM=n=>n||[],Ad=n=>n.replace("#","");function nM(n){const t=new URL(window.location.href);Object.entries(n).forEach(([e,i])=>{t.searchParams.delete(e),Array.isArray(i)?i.forEach(r=>{r!==""&&t.searchParams.append(e,r)}):i!==""&&t.searchParams.set(e,i)}),window.history.replaceState({},"",t.toString())}function GK(){const{options:n,overrideSources:t}=$b(),[e,i]=Ct.useState(null),[r,o]=Ct.useState(!0),[a,s]=Ct.useState(null),l=Ct.useRef(null),u=Ct.useRef(n),f=Ct.useRef(!0);return Ct.useEffect(()=>{const c=JSON.stringify(n),h=JSON.stringify(u.current);if(!f.current&&c===h)return;f.current=!1,u.current=n,(async()=>{var _,g;try{o(!0),s(null);const v=n.peerUrl||Wf.get("PEER_URL"),E=n.nftServerUrl||Wf.get("NFT_SERVER_URL");let T=Ce.PreviewType.WEARABLE,S={color:n.background||"#4b4852",transparent:n.disableBackground===!0};const C=UI(n.profile);let O=C==null?void 0:C.value;O==="default"&&(O=fD());const A=O&&C?C.type==="address"?await zI(O,v):await GI(O,v):null,M=n.bodyShape||((_=A==null?void 0:A.avatar)==null?void 0:_.bodyShape)||Ce.BodyShape.MALE;let D=null;if(n.contractAddress&&(D=await WI({contractAddress:n.contractAddress,tokenId:n.tokenId,itemId:n.itemId,peerUrl:v,nftServerUrl:E}),D&&as(D))){S={...S,image:D.thumbnail};const Z=qb(D);yp(Z)&&(T=Ce.PreviewType.TEXTURE)}const{eyes:U,hair:V,skin:B}=zK(A,{eyes:n.eyes,hair:n.hair,skin:n.skin}),z=n.unityMode||null,J=n.camera&&Object.values(Ce.PreviewCamera).includes(n.camera)?n.camera:Ce.PreviewCamera.INTERACTIVE,X=n.projection&&Object.values(Ce.PreviewProjection).includes(n.projection)?n.projection:Ce.PreviewProjection.PERSPECTIVE,re=n.disableDefaultEmotes?null:n.emote&&Object.values(Ce.PreviewEmote).includes(n.emote)?n.emote:Ce.PreviewEmote.IDLE,ae={background:S,bodyShape:M,mode:z,projection:X,type:T,base64:((g=n.base64s)==null?void 0:g[0])||null,contract:n.contractAddress||null,disableLoader:n.disableLoader||!1,emote:(re==null?void 0:re.toString())||null,eyeColor:U.replace("#",""),hairColor:V.replace("#",""),item:n.itemId||null,profile:O||null,skinColor:B.replace("#",""),token:n.tokenId||null,urn:n.urns||null,showAnimationReference:null},se=JSON.stringify(ae),H=JSON.stringify(l.current);if(se!==H){if(l.current=ae,Object.keys(t).length===0){const Z=rM(n.urns),q=rM(n.base64s);if(z===Ce.PreviewUnityMode.CONFIG){const N={mode:ff(z||"")};nM(N)}else{const N={background:S.transparent?"":Ad(S.color),disableLoader:n.disableLoader?"true":"",profile:ff(O||""),bodyShape:ff(M||""),eyeColor:Ad(U||""),hairColor:Ad(V||""),skinColor:Ad(B||""),mode:ff(z||""),camera:J,projection:X,emote:ff((re==null?void 0:re.toString())||""),urn:Z.length>0?Z:[""],base64:q.length>0?q:[""]};nM(N)}}i(ae)}o(!1)}catch(v){console.error("[useUnityConfig] Failed to load config:",v),s(v instanceof Error?v.message:"Failed to load config"),o(!1)}})()},[n,t]),[e,r,a]}const WK="unity-renderer",HK="unity-canvas",oM=1,jK="Failed to load Unity",XK=(n,t,e,i)=>{const[r,o]=Ct.useState({isLoaded:!1,isInitialized:!1,error:null}),a=Ct.useCallback(l=>{if(l.data.type===WK){const{type:u,payload:f}=l.data.payload;u==="loaded"&&(f===!0||f==="true")?(o(c=>({...c,isLoaded:!0,isInitialized:!0})),Ce.sendMessage(cn(),Ce.PreviewMessageType.LOAD,{renderer:Ce.PreviewRenderer.UNITY})):u==="customization-done"?Ce.sendMessage(cn(),Ce.PreviewMessageType.CONTROLLER_RESPONSE,{id:"customization-done",ok:!0,result:JSON.parse(l.data.payload.payload)}):u==="error"&&(o(c=>({...c,error:f})),Ce.sendMessage(cn(),Ce.PreviewMessageType.ERROR,{message:"Error loading the wearable. Please try again."}))}},[]),s=Ct.useCallback(async()=>{if(!(!n.canvas.current||n.isInitializing.current||n.unityInstance.current)){n.isInitializing.current=!0,o(l=>({...l,isLoaded:!1,error:null}));try{const{unity:l,scene:u,emote:f}=await UK(n.canvas.current);n.unityInstance.current=l,t.current={scene:u,emote:f},o(c=>({...c,isLoaded:!0,isInitialized:!0})),Ce.sendMessage(cn(),Ce.PreviewMessageType.LOAD,{renderer:Ce.PreviewRenderer.UNITY})}catch(l){const u=l instanceof Error?l.message:jK;console.error("Unity init failed:",l),o(f=>({...f,error:u})),Ce.sendMessage(cn(),Ce.PreviewMessageType.ERROR,{message:u})}finally{n.isInitializing.current=!1}}},[n,t]);return Ct.useEffect(()=>{r.isInitialized||i||!e||s()},[e,i,r.isInitialized,s]),Ct.useEffect(()=>{if(e)return window.addEventListener("message",a,!1),()=>{window.removeEventListener("message",a,!1)}},[e,a]),r},YK=n=>{const[t,e]=Ct.useState({pixelRatio:window.devicePixelRatio||oM,is3D:!0,backgroundImage:""});return Ct.useEffect(()=>{const i=()=>{e(o=>({...o,pixelRatio:window.devicePixelRatio||oM}))},r=window.matchMedia(`(resolution: ${t.pixelRatio}dppx)`);return r.addEventListener("change",i),()=>{r.removeEventListener("change",i)}},[t.pixelRatio]),Ct.useEffect(()=>{n&&e(i=>({...i,backgroundImage:n.background.image||"",is3D:n.type!==Ce.PreviewType.TEXTURE}))},[n]),t},KK=(n,t,e,i,r)=>{const o=Ct.useMemo(()=>{const a={};for(const s of Object.keys(r))r[s]&&i[s]!==void 0&&(a[s]=i[s]);return a},[r,i]);Ct.useEffect(()=>{if(!(!e.isInitialized||!e.isLoaded||!n.current)){if(o.profile==="default"){const a=t.current.profile;o.profile=a!=null&&a.match(/^default\d+$/)?a:fD()}Object.keys(o).length>0&&(wK(n.current,o,r),t.current=o)}},[e.isInitialized,e.isLoaded,o,r,n,t])},qK=()=>{const{width:n=window.innerWidth,height:t=window.innerHeight}=WM(),e=Ct.useRef(null),i=Ct.useRef(null),r=Ct.useRef(!1),o=Ct.useRef({}),a=XI(),[s,l,u]=GK(),{options:f,overrideSources:c}=$b(),h=Ct.useMemo(()=>({canvas:e,unityInstance:i,isInitializing:r,lastSentOverrides:o}),[]),p=XK(h,a,s,l),_=YK(s);KK(h.unityInstance,h.lastSentOverrides,p,f,c),jI();const g=Ct.useMemo(()=>{const A=p.error||u,M=!p.isLoaded&&!A,D=!!_.backgroundImage&&!_.is3D&&!M,U=_.is3D&&!M;return{error:A,isLoading:M,showImage:D,showCanvas:U}},[p.error,p.isLoaded,u,_.backgroundImage,_.is3D]),v=Ct.useMemo(()=>({opacity:1,backgroundColor:!(s!=null&&s.background.transparent)&&(s==null?void 0:s.type)===Ce.PreviewType.TEXTURE?s.background.color:void 0}),[s]),E=Ct.useMemo(()=>({width:`${n}px`,height:`${t}px`}),[n,t]),T=Ct.useMemo(()=>({width:Math.round(n*_.pixelRatio),height:Math.round(t*_.pixelRatio)}),[n,t,_.pixelRatio]),S=Ct.useMemo(()=>Zl("Preview",{"is-loading":g.isLoading,"is-loaded":p.isLoaded,"is-3d":_.is3D,"has-error":!!g.error}),[g.isLoading,p.isLoaded,_.is3D,g.error]),C=Ct.useMemo(()=>Zl("thumbnail",{"is-visible":g.showImage}),[g.showImage]),O=Ct.useMemo(()=>Zl({"is-visible":g.showCanvas}),[g.showCanvas]);return On.jsxs("div",{className:S,style:v,children:[On.jsx("img",{src:_.backgroundImage,className:C,alt:"preview"}),On.jsx("canvas",{ref:h.canvas,id:HK,className:O,width:T.width,height:T.height,style:E}),g.error&&On.jsx("div",{className:"error",children:g.error})]})},QK=aM.memo(qK),cD=Ct.createContext(null),$K=({children:n,value:t})=>{const e={webGPUSupport:t,isSupported:t.isSupported,isAvailable:t.isAvailable};return On.jsx(cD.Provider,{value:e,children:n})},ZK=()=>{const n=Ct.useContext(cD);if(!n)throw new Error("useWebGPUContext must be used within a WebGPUProvider");return n},JK=()=>ZK(),eq=()=>{const n=navigator.userAgent.toLowerCase();let t="Unknown",e="Unknown",i="Unknown";if(/android/.test(n)){t="Android";const r=n.match(/android\s*([0-9.]+)/);r&&(i=r[1])}else if(/iphone|ipad|ipod/.test(n)){t="iOS";const r=n.match(/os\s*([0-9_]+)/);r&&(i=r[1].replace(/_/g,"."))}else if(/macintosh|mac os x/.test(n)){t="macOS";const r=n.match(/mac os x\s*([0-9_]+)/);r&&(i=r[1].replace(/_/g,"."))}else if(/windows/.test(n)){t="Windows";const r=n.match(/windows nt\s*([0-9.]+)/);r&&(i=r[1])}else if(/linux/.test(n)){t="Linux";const r=n.match(/\(([^)]+)\)/);r&&(i=r[1])}if(/chrome|crios/.test(n)){e="Chrome";const r=n.match(/(?:chrome|crios)\/([0-9.]+)/);r&&(i=r[1])}else if(/firefox|fxios/.test(n)){e="Firefox";const r=n.match(/(?:firefox|fxios)\/([0-9.]+)/);r&&(i=r[1])}else if(/safari/.test(n)&&!/chrome|crios|android/.test(n)){e="Safari";const r=n.match(/version\/([0-9.]+)/);r&&(i=r[1])}else if(/edg/.test(n)){e="Edge";const r=n.match(/edg\/([0-9.]+)/);r&&(i=r[1])}return{platform:t,browser:e,version:i}},tq=async()=>{const{platform:n,browser:t,version:e}=eq();if(!navigator.gpu)return console.warn("❌ navigator.gpu is not available"),{isSupported:!1,isAvailable:!1,error:"WebGPU is not supported in this browser. Please use a compatible browser.",platform:n,browser:t,platformVersion:e,browserVersion:e};try{const i=await navigator.gpu.requestAdapter();return i?await i.requestDevice()?{isSupported:!0,isAvailable:!0,platform:n,browser:t,platformVersion:e,browserVersion:e}:(console.warn("❌ Failed to create WebGPU device"),{isSupported:!0,isAvailable:!1,error:"WebGPU adapter found but failed to create device. This might be due to hardware limitations or driver issues.",platform:n,browser:t,platformVersion:e,browserVersion:e}):(console.warn("❌ No WebGPU adapter available"),{isSupported:!0,isAvailable:!1,error:"WebGPU is supported but no adapter is available. This might be due to hardware limitations or driver issues.",platform:n,browser:t,platformVersion:e,browserVersion:e})}catch(i){return console.error("❌ WebGPU detection error:",i),{isSupported:!0,isAvailable:!1,error:`WebGPU is supported but failed to initialize: ${i instanceof Error?i.message:"Unknown error"}`,platform:n,browser:t,platformVersion:e,browserVersion:e}}},iq=()=>{const t=new URLSearchParams(window.location.search).get("unity")==="true",{isAvailable:e}=JK();return t&&e?On.jsx(QK,{}):On.jsx(xK,{})},rq=async()=>{const n=await tq();tL.createRoot(document.getElementById("root")).render(On.jsx(Ct.StrictMode,{children:On.jsx($K,{value:n,children:On.jsx(iq,{})})}))};rq();export{Xd as $,ut as A,qB as B,S2 as C,tl as D,ux as E,Ob as F,fx as G,cx as H,dx as I,px as J,H4 as K,up as L,ya as M,O8 as N,u5 as O,pa as P,Eq as Q,l2 as R,Wo as S,c2 as T,zU as U,Mi as V,ga as W,yd as X,Bb as Y,wv as Z,ZB as _,zl as a,Yo as a$,Yd as a0,jn as a1,bd as a2,i8 as a3,KB as a4,yq as a5,LI as a6,ZW as a7,wO as a8,CI as a9,$B as aA,AI as aB,A4 as aC,xy as aD,Sa as aE,Pv as aF,jW as aG,VU as aH,_e as aI,PW as aJ,Je as aK,uH as aL,Md as aM,yI as aN,KG as aO,x4 as aP,nI as aQ,lq as aR,Hf as aS,Jx as aT,To as aU,f5 as aV,hH as aW,js as aX,g2 as aY,R4 as aZ,Nb as a_,Ur as aa,ss as ab,Mq as ac,Sq as ad,Cq as ae,u4 as af,hq as ag,h2 as ah,kd as ai,sk as aj,Aj as ak,hr as al,yy as am,Xo as an,Uf as ao,Hn as ap,f8 as aq,dt as ar,jq as as,Ir as at,fp as au,Hx as av,Ks as aw,gI as ax,EO as ay,PI as az,Ra as b,NG as b$,p5 as b0,dq as b1,Kx as b2,QB as b3,g5 as b4,sf as b5,n8 as b6,Xn as b7,eI as b8,zb as b9,YU as bA,Mb as bB,KU as bC,Fq as bD,Ri as bE,pu as bF,jb as bG,_4 as bH,vH as bI,U4 as bJ,xq as bK,w4 as bL,XM as bM,O4 as bN,OO as bO,no as bP,Hl as bQ,UR as bR,P2 as bS,Co as bT,jr as bU,II as bV,ce as bW,Tr as bX,dp as bY,Bz as bZ,LG as b_,Ws as ba,Bf as bb,Td as bc,L8 as bd,CW as be,jR as bf,GU as bg,FR as bh,mI as bi,rn as bj,UU as bk,DG as bl,YH as bm,Nf as bn,AB as bo,Ly as bp,LO as bq,nu as br,_H as bs,y8 as bt,MG as bu,Vb as bv,Rj as bw,WW as bx,g4 as by,nW as bz,Ht as c,Sn as c$,pq as c0,Me as c1,Zq as c2,pt as c3,Uq as c4,qR as c5,os as c6,Zt as c7,qG as c8,m5 as c9,cp as cA,bx as cB,Ex as cC,Tx as cD,Sx as cE,Ax as cF,F4 as cG,jG as cH,m4 as cI,Yf as cJ,gp as cK,ql as cL,xr as cM,xb as cN,A2 as cO,R2 as cP,XR as cQ,Sy as cR,v2 as cS,Rn as cT,Vo as cU,BH as cV,wn as cW,Gq as cX,pp as cY,Q4 as cZ,Fv as c_,KF as ca,rB as cb,JB as cc,SI as cd,bI as ce,p2 as cf,Zi as cg,x8 as ch,Gl as ci,EH as cj,Aq as ck,b2 as cl,_x as cm,mx as cn,b4 as co,T2 as cp,E2 as cq,gx as cr,vx as cs,yx as ct,v4 as cu,Lf as cv,d2 as cw,xn as cx,Cx as cy,Px as cz,Ji as d,ke as d$,RI as d0,Qs as d1,Ty as d2,Ub as d3,_5 as d4,kG as d5,wG as d6,NO as d7,Py as d8,jo as d9,a2 as dA,$s as dB,Ey as dC,xR as dD,Dv as dE,dO as dF,dI as dG,qz as dH,Hz as dI,k4 as dJ,Qz as dK,zx as dL,tG as dM,Hv as dN,E8 as dO,D4 as dP,Wr as dQ,E4 as dR,Wq as dS,h4 as dT,wj as dU,Ui as dV,Hd as dW,gy as dX,de as dY,gt as dZ,Er as d_,tI as da,kx as db,b8 as dc,Dq as dd,Iq as de,t8 as df,V8 as dg,_I as dh,d5 as di,d4 as dj,Hi as dk,WB as dl,wb as dm,eB as dn,Gt as dp,UO as dq,Bx as dr,Fx as ds,f4 as dt,s2 as du,Xi as dv,jt as dw,hB as dx,by as dy,rr as dz,di as e,YG as e$,oe as e0,te as e1,B4 as e2,Xv as e3,ne as e4,c5 as e5,Vv as e6,M8 as e7,t2 as e8,l4 as e9,en as eA,Ed as eB,An as eC,l8 as eD,Rt as eE,n4 as eF,eW as eG,M4 as eH,Bq as eI,qU as eJ,ie as eK,qF as eL,Wd as eM,kU as eN,Lx as eO,YR as eP,zG as eQ,Oq as eR,aI as eS,qs as eT,Yj as eU,Rr as eV,Xx as eW,Ci as eX,QR as eY,aW as eZ,XG as e_,V4 as ea,OG as eb,Vx as ec,sW as ed,IO as ee,Wx as ef,_p as eg,c4 as eh,OI as ei,Nx as ej,Go as ek,aq as el,Tq as em,Yx as en,My as eo,$4 as ep,kq as eq,z4 as er,oi as es,Wb as et,ct as eu,Vr as ev,k as ew,ue as ex,Ry as ey,Eo as ez,Wi as f,XH as f$,Gx as f0,AW as f1,$x as f2,_8 as f3,Qx as f4,vr as f5,Uv as f6,qx as f7,jv as f8,Rq as f9,uq as fA,$r as fB,hc as fC,iI as fD,Ta as fE,He as fF,Ja as fG,JM as fH,XB as fI,VR as fJ,g8 as fK,kv as fL,h8 as fM,Kd as fN,_W as fO,jd as fP,qf as fQ,il as fR,Ho as fS,uk as fT,Hq as fU,KR as fV,_t as fW,zd as fX,Jt as fY,dc as fZ,jH as f_,rl as fa,ix as fb,rx as fc,Or as fd,Qa as fe,BB as ff,p4 as fg,Xq as fh,Zf as fi,XW as fj,v8 as fk,It as fl,Ni as fm,kf as fn,Qd as fo,EI as fp,ec as fq,wq as fr,TI as fs,hn as ft,Zr as fu,zo as fv,Kf as fw,Rv as fx,Av as fy,tB as fz,RR as g,Oa as g$,Wv as g0,K4 as g1,G4 as g2,_q as g3,DI as g4,Lj as g5,lo as g6,QF as g7,mp as g8,JG as g9,GH as gA,s8 as gB,Zx as gC,ji as gD,FO as gE,HB as gF,jB as gG,Gd as gH,Y4 as gI,DB as gJ,yB as gK,fu as gL,VB as gM,tW as gN,lk as gO,vB as gP,rj as gQ,T8 as gR,Ue as gS,P4 as gT,fk as gU,Ke as gV,rt as gW,Jq as gX,$t as gY,$a as gZ,Fo as g_,FB as ga,ii as gb,wr as gc,mq as gd,EW as ge,gq as gf,Re as gg,vq as gh,Fk as gi,W4 as gj,o4 as gk,Bo as gl,o8 as gm,a8 as gn,bi as go,Lq as gp,wB as gq,SW as gr,p8 as gs,X4 as gt,iW as gu,fI as gv,WG as gw,S4 as gx,rW as gy,cI as gz,C4 as h,S8 as h$,I8 as h0,BO as h1,N8 as h2,VO as h3,y4 as h4,Pj as h5,xI as h6,vp as h7,Be as h8,YM as h9,m8 as hA,HW as hB,iu as hC,u2 as hD,St as hE,tn as hF,rI as hG,Gb as hH,Lb as hI,fc as hJ,_u as hK,qj as hL,n5 as hM,A8 as hN,R8 as hO,Qj as hP,cr as hQ,Mt as hR,IU as hS,cj as hT,$F as hU,RB as hV,N4 as hW,k2 as hX,z2 as hY,G2 as hZ,C8 as h_,ZF as ha,JF as hb,GR as hc,Ca as hd,u8 as he,zn as hf,IG as hg,Fb as hh,Gv as hi,cu as hj,MI as hk,lI as hl,J4 as hm,TW as hn,gW as ho,d8 as hp,qd as hq,nx as hr,_2 as hs,lu as ht,du as hu,Nq as hv,yr as hw,Hs as hx,j4 as hy,xO as hz,Kq as i,y as i$,W2 as i0,Pq as i1,iB as i2,KM as i3,vy as i4,Oi as i5,Ld as i6,Jf as i7,Wn as i8,Iy as i9,Ea as iA,P8 as iB,Ql as iC,Ee as iD,Qf as iE,hI as iF,Rx as iG,c8 as iH,F8 as iI,B8 as iJ,Oy as iK,nr as iL,oI as iM,$i as iN,pI as iO,lp as iP,lc as iQ,Dr as iR,uc as iS,q2 as iT,Ib as iU,Q2 as iV,wR as iW,FU as iX,Mx as iY,jM as iZ,Ie as i_,Gj as ia,L4 as ib,sq as ic,zR as id,Ay as ie,mi as ig,el as ih,YB as ii,h5 as ij,he as ik,Xb as il,T4 as im,zv as io,r8 as ip,CO as iq,D8 as ir,At as is,xx as it,dW as iu,mW as iv,Xs as iw,qt as ix,me as iy,Uo as iz,OB as j,zq as j$,ni as j0,wd as j1,I4 as j2,I as j3,ze as j4,Dd as j5,$q as j6,w8 as j7,Dz as j8,sI as j9,Sz as jA,Ko as jB,Jv as jC,Oo as jD,pO as jE,P5 as jF,E5 as jG,ey as jH,Zv as jI,Yv as jJ,Oz as jK,Rz as jL,LU as jM,Ix as jN,T5 as jO,Gn as jP,Id as jQ,FI as jR,qv as jS,Pz as jT,Dx as jU,Mr as jV,jl as jW,f2 as jX,Cy as jY,Ux as jZ,Z4 as j_,Dn as ja,DR as jb,H2 as jc,ok as jd,Tj as je,q4 as jf,Kl as jg,$M as jh,jf as ji,xB as jj,Hr as jk,nl as jl,Db as jm,qo as jn,cc as jo,Kv as jp,Qv as jq,Tz as jr,$f as js,$v as jt,xd as ju,Iz as jv,qq as jw,xz as jx,Mz as jy,Yq as jz,GG as k,ma as k$,Pn as k0,Wl as k1,C2 as k2,kR as k3,e8 as k4,ZG as k5,ox as k6,vz as k7,yz as k8,fq as k9,dr as kA,_O as kB,AX as kC,Jb as kD,j8 as kE,bp as kF,_a as kG,eD as kH,QI as kI,U8 as kJ,_X as kK,ao as kL,br as kM,ot as kN,JI as kO,Y8 as kP,SX as kQ,mX as kR,Vy as kS,IX as kT,e7 as kU,un as kV,K8 as kW,Za as kX,CX as kY,YO as kZ,gX as k_,r2 as ka,Ez as kb,UB as kc,$U as kd,QG as ke,QU as kf,Ae as kg,Qq as kh,Vq as ki,cq as kj,ui as kk,ye as kl,ZM as km,kB as kn,w as ko,fB as kp,Vt as kq,ap as kr,lB as ks,nf as kt,qM as ku,QM as kv,op as kw,uB as kx,at as ky,Pb as kz,F2 as l,pY as l$,W8 as l0,vX as l1,ay as l2,Jr as l3,q8 as l4,yX as l5,jO as l6,Q8 as l7,$I as l8,k8 as l9,ky as lA,So as lB,KO as lC,zf as lD,$X as lE,rc as lF,va as lG,ba as lH,ZX as lI,In as lJ,Tt as lK,JX as lL,eY as lM,tY as lN,EY as lO,Nt as lP,iY as lQ,rY as lR,aY as lS,uY as lT,nY as lU,sY as lV,lY as lW,dY as lX,hY as lY,oY as lZ,fY as l_,so as la,$8 as lb,XO as lc,EX as ld,G8 as le,Zb as lf,ZI as lg,z8 as lh,Z8 as li,Pa as lj,J8 as lk,PX as ll,Mn as lm,By as ln,$l as lo,zt as lp,oy as lq,sy as lr,TX as ls,Ep as lt,X8 as lu,H8 as lv,Li as lw,rs as lx,zy as ly,fn as lz,B2 as m,_Y as m0,mY as m1,gY as m2,vY as m3,yY as m4,bY as m5,is as m6,su as m7,tc as m8,Cn as m9,ub as mA,wX as ma,uy as mb,TY as mc,SY as md,MY as me,IY as mf,t7 as mg,UY as mh,jY as mi,$Y as mj,oD as mk,l6 as ml,p6 as mm,b6 as mn,wY as mo,DY as mp,xY as mq,A6 as mr,D6 as ms,V6 as mt,H6 as mu,Q6 as mv,iK as mw,oq as mx,HM as my,nq as mz,V2 as n,Ox as o,U2 as p,bq as q,oB as r,vd as s,tx as t,Ys as u,e2 as v,Rb as w,Vd as x,Ud as y,uI as z};
|
package/static-local/index.html
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<link rel="apple-touch-icon" href="/logo192.png" />
|
|
10
10
|
<link rel="manifest" href="./manifest.json" />
|
|
11
11
|
<title>Decentraland | Wearable Preview</title>
|
|
12
|
-
<script type="module" crossorigin src="./assets/index-
|
|
12
|
+
<script type="module" crossorigin src="./assets/index-BS_QmslQ.js"></script>
|
|
13
13
|
<link rel="stylesheet" crossorigin href="./assets/index-DrFxbJ99.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function createUnityInstance(t,n,d){function c(e,t){if(!c.aborted&&n.showBanner)return"error"==t&&(c.aborted=!0),n.showBanner(e,t);switch(t){case"error":console.error(e);break;case"warning":console.warn(e);break;default:console.log(e)}}function r(e){var t=e.reason||e.error,n=t?t.toString():e.message||e.reason||"",r=t&&t.stack?t.stack.toString():"";(n+="\n"+(r=r.startsWith(n)?r.substring(n.length):r).trim())&&m.stackTraceRegExp&&m.stackTraceRegExp.test(n)&&E(n,e.filename||t&&(t.fileName||t.sourceURL)||"",e.lineno||t&&(t.lineNumber||t.line)||0)}function e(e,t,n){var r=e[t];void 0!==r&&r||(console.warn('Config option "'+t+'" is missing or empty. Falling back to default value: "'+n+'". Consider updating your WebGL template to include the missing config option.'),e[t]=n)}d=d||function(){};var o,m={canvas:t,webglContextAttributes:{preserveDrawingBuffer:!1,powerPreference:2},wasmFileSize:48967926,cacheControl:function(e){return e==m.dataUrl||e.match(/\.bundle/)?"must-revalidate":"no-store"},streamingAssetsUrl:"StreamingAssets",downloadProgress:{},deinitializers:[],intervals:{},setInterval:function(e,t){e=window.setInterval(e,t);return this.intervals[e]=!0,e},clearInterval:function(e){delete this.intervals[e],window.clearInterval(e)},preRun:[],postRun:[],print:function(e){console.log(e)},printErr:function(e){console.error(e),"string"==typeof e&&-1!=e.indexOf("wasm streaming compile failed")&&(-1!=e.toLowerCase().indexOf("mime")?c('HTTP Response Header "Content-Type" configured incorrectly on the server for file '+m.codeUrl+' , should be "application/wasm". Startup time performance will suffer.',"warning"):c('WebAssembly streaming compilation failed! This can happen for example if "Content-Encoding" HTTP header is incorrectly enabled on the server for file '+m.codeUrl+", but the file is not pre-compressed on disk (or vice versa). Check the Network tab in browser Devtools to debug server header configuration.","warning"))},locateFile:function(e){return"build.wasm"==e?this.codeUrl:e},disabledCanvasEvents:["contextmenu","dragstart"]};for(o in e(n,"companyName","Unity"),e(n,"productName","WebGL Player"),e(n,"productVersion","1.0"),n)m[o]=n[o];m.streamingAssetsUrl=new URL(m.streamingAssetsUrl,document.URL).href;var a=m.disabledCanvasEvents.slice();function i(e){e.preventDefault()}a.forEach(function(e){t.addEventListener(e,i)}),window.addEventListener("error",r),window.addEventListener("unhandledrejection",r);var s="",l="";function u(e){document.webkitCurrentFullScreenElement===t?t.style.width&&(s=t.style.width,l=t.style.height,t.style.width="100%",t.style.height="100%"):s&&(t.style.width=s,t.style.height=l,l=s="")}document.addEventListener("webkitfullscreenchange",u),m.deinitializers.push(function(){for(var e in m.disableAccessToMediaDevices(),a.forEach(function(e){t.removeEventListener(e,i)}),window.removeEventListener("error",r),window.removeEventListener("unhandledrejection",r),document.removeEventListener("webkitfullscreenchange",u),m.intervals)window.clearInterval(e);m.intervals={}}),m.QuitCleanup=function(){for(var e=0;e<m.deinitializers.length;e++)m.deinitializers[e]();m.deinitializers=[],"function"==typeof m.onQuit&&m.onQuit()};var h,f,p,g,b,w,y,v,S,C={Module:m,SetFullscreen:function(){if(m.SetFullscreen)return m.SetFullscreen.apply(m,arguments);m.print("Failed to set Fullscreen mode: Player not loaded yet.")},SendMessage:function(){if(m.SendMessage)return m.SendMessage.apply(m,arguments);m.print("Failed to execute SendMessage: Player not loaded yet.")},Quit:function(){return new Promise(function(e,t){m.shouldQuit=!0,m.onQuit=e})},GetMetricsInfo:function(){var e=Number(m._getMetricsInfo())>>>0,t=4+e,n=4+t,r=8+n,o=8+r,a=4+o,i=4+a,s=8+i,d=8+s,c=4+d,l=4+c,u=4+l;return{totalWASMHeapSize:m.HEAPU32[e>>2],usedWASMHeapSize:m.HEAPU32[t>>2],totalJSHeapSize:m.HEAPF64[n>>3],usedJSHeapSize:m.HEAPF64[r>>3],pageLoadTime:m.HEAPU32[o>>2],pageLoadTimeToFrame1:m.HEAPU32[a>>2],fps:m.HEAPF64[i>>3],movingAverageFps:m.HEAPF64[s>>3],assetLoadTime:m.HEAPU32[d>>2],webAssemblyStartupTime:m.HEAPU32[c>>2]-(m.webAssemblyTimeStart||0),codeDownloadTime:m.HEAPU32[l>>2],gameStartupTime:m.HEAPU32[u>>2],numJankedFrames:m.HEAPU32[4+u>>2]}}};function P(e,t,n){-1==e.indexOf("fullscreen error")&&(m.startupErrorHandler?m.startupErrorHandler(e,t,n):m.errorHandler&&m.errorHandler(e,t,n)||(console.log("Invoking error handler due to\n"+e),"function"==typeof dump&&dump("Invoking error handler due to\n"+e),P.didShowErrorMessage||(-1!=(e="An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:\n"+e).indexOf("DISABLE_EXCEPTION_CATCHING")?e="An exception has occurred, but exception handling has been disabled in this build. If you are the developer of this content, enable exceptions in your project WebGL player settings to be able to catch the exception or see the stack trace.":-1!=e.indexOf("Cannot enlarge memory arrays")?e="Out of memory. If you are the developer of this content, try allocating more memory to your WebGL build in the WebGL player settings.":-1==e.indexOf("Invalid array buffer length")&&-1==e.indexOf("Invalid typed array length")&&-1==e.indexOf("out of memory")&&-1==e.indexOf("could not allocate memory")||(e="The browser could not allocate enough memory for the WebGL content. If you are the developer of this content, try allocating less memory to your WebGL build in the WebGL player settings."),alert(e),P.didShowErrorMessage=!0)))}function T(e,t){var n="(wasm-function\\[)(\\d+)(\\])",r=new RegExp(n);return e.replace(new RegExp(n,"g"),function(e){e=e.match(r);return e[1]+(t[e[2]]?t[e[2]]+"@":"")+e[2]+e[3]})}function E(r,o,a){m.symbols?P(T(r,m.symbols),o,a):m.symbolsUrl?W("symbolsUrl").then(function(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);m.symbols=JSON.parse(t),P(T(r,m.symbols),o,a)}).catch(function(e){P(r,o,a)}):P(r,o,a)}function U(e,t){if("symbolsUrl"!=e){var n=m.downloadProgress[e],r=(n=n||(m.downloadProgress[e]={started:!1,finished:!1,lengthComputable:!1,total:0,loaded:0}),"object"!=typeof t||"progress"!=t.type&&"load"!=t.type||(n.started||(n.started=!0,n.lengthComputable=t.lengthComputable),n.total=t.total,n.loaded=t.loaded,"load"==t.type&&(n.finished=!0)),0),o=0,a=0,i=0,s=0;for(e in m.downloadProgress){if(!(n=m.downloadProgress[e]).started)return;a++,n.lengthComputable?(r+=n.loaded,o+=n.total,i++):n.finished||s++}d(.9*(a?(a-s-(o?i*(o-r)/o:0))/a:0))}}function k(){var e=this;this.isConnected=this.connect().then(function(){return e.cleanUpCache()}),this.isConnected.catch(function(e){e="Error when initializing cache: "+e,console.log("[UnityCache] "+e)})}function A(e){console.log("[UnityCache] "+e)}function D(e){return D.link=D.link||document.createElement("a"),D.link.href=e,D.link.href}m.SystemInfo=function(){var e,t,n,r,o,a=navigator.userAgent+" ",i=[["Firefox","Firefox"],["OPR","Opera"],["Edg","Edge"],["SamsungBrowser","Samsung Browser"],["Trident","Internet Explorer"],["MSIE","Internet Explorer"],["Chrome","Chrome"],["CriOS","Chrome on iOS Safari"],["FxiOS","Firefox on iOS Safari"],["Safari","Safari"]];function s(e,t,n){return(e=RegExp(e,"i").exec(t))&&e[n]}for(var d=0;d<i.length;++d)if(t=s(i[d][0]+"[/ ](.*?)[ \\)]",a,1)){e=i[d][1];break}"Safari"==e&&(t=s("Version/(.*?) ",a,1)),"Internet Explorer"==e&&(t=s("rv:(.*?)\\)? ",a,1)||t);for(var c=[["Windows (.*?)[;)]","Windows"],["Android ([0-9_.]+)","Android"],["iPhone OS ([0-9_.]+)","iPhoneOS"],["iPad.*? OS ([0-9_.]+)","iPadOS"],["FreeBSD( )","FreeBSD"],["OpenBSD( )","OpenBSD"],["Linux|X11()","Linux"],["Mac OS X ([0-9_\\.]+)","MacOS"],["bot|google|baidu|bing|msn|teoma|slurp|yandex","Search Bot"]],l=0;l<c.length;++l)if(r=s(c[l][0],a,1)){n=c[l][1],r=r.replace(/_/g,".");break}var u;function h(){try{return window.WebAssembly?WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,13,1,11,0,65,0,65,0,65,1,252,11,0,11]))?WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,11,1,9,1,1,125,32,0,252,0,26,11]))?WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,10,1,8,1,1,126,32,0,194,26,11]))?WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11]))?!!WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,10,1,8,0,6,64,1,25,1,11,11]))||"wasm-exceptions":"wasm-simd128":"sign-extend":"non-trapping fp-to-int":"bulk-memory":"WebAssembly"}catch(e){return"Exception: "+e}}r={"NT 5.0":"2000","NT 5.1":"XP","NT 5.2":"Server 2003","NT 6.0":"Vista","NT 6.1":"7","NT 6.2":"8","NT 6.3":"8.1","NT 10.0":"10"}[r]||r,webgpuVersion=0,(f=document.createElement("canvas"))&&(u=(p=f.getContext("webgl2"))?2:0,p||(p=f&&f.getContext("webgl"))&&(u=1),p&&(o=p.getExtension("WEBGL_debug_renderer_info")&&p.getParameter(37446)||p.getParameter(7937)),webgpuVersion=navigator.gpu?1:0);var f="undefined"!=typeof SharedArrayBuffer,p="object"==typeof WebAssembly&&"function"==typeof WebAssembly.compile,m=p&&!0===h();return{width:screen.width,height:screen.height,userAgent:a.trim(),browser:e||"Unknown browser",browserVersion:t||"Unknown version",mobile:/Mobile|Android|iP(ad|hone)/.test(navigator.appVersion),os:n||"Unknown OS",osVersion:r||"Unknown OS Version",gpu:o||"Unknown GPU",language:navigator.userLanguage||navigator.language,hasWebGL:u,hasWebGPU:webgpuVersion,hasCursorLock:!!document.body.requestPointerLock,hasFullscreen:!!document.body.requestFullscreen||!!document.body.webkitRequestFullscreen,hasThreads:f,hasWasm:p,hasWasm2023:m,missingWasm2023Feature:m?null:h(),hasWasmThreads:!1}}(),m.abortHandler=function(e){return E(e,"",0),!0},Error.stackTraceLimit=Math.max(Error.stackTraceLimit||0,50),m.readBodyWithProgress=function(a,i,s){var e=a.body?a.body.getReader():void 0,d=void 0!==a.headers.get("Content-Length"),c=function(e,t){if(!t)return 0;var t=e.headers.get("Content-Encoding"),n=parseInt(e.headers.get("Content-Length")),r=536870912;switch(t){case"br":return Math.min(Math.round(2*n),r);case"gzip":return Math.min(Math.round(1.6*n),r);default:return n}}(a,d),l=new Uint8Array(c),u=[],h=0,f=0;return d||console.warn("[UnityCache] Response is served without Content-Length header. Please reconfigure server to include valid Content-Length for better download performance."),function o(){return void 0===e?a.arrayBuffer().then(function(e){var t=new Uint8Array(e);return i({type:"progress",response:a,total:e.length,loaded:0,lengthComputable:d,chunk:s?t:null}),t}):e.read().then(function(e){if(e.done){if(h===c)return l;if(h<c)return l.slice(0,h);for(var t=new Uint8Array(h),n=(t.set(l,0),f),r=0;r<u.length;++r)t.set(u[r],n),n+=u[r].length;return t}return h+e.value.length<=l.length?(l.set(e.value,h),f=h+e.value.length):u.push(e.value),h+=e.value.length,i({type:"progress",response:a,total:Math.max(c,h),loaded:h,lengthComputable:d,chunk:s?e.value:null}),o()})}().then(function(e){return i({type:"load",response:a,total:e.length,loaded:e.length,lengthComputable:d,chunk:null}),a.parsedBody=e,a})},m.fetchWithProgress=function(e,t){var n=function(){};return t&&t.onProgress&&(n=t.onProgress),fetch(e,t).then(function(e){return m.readBodyWithProgress(e,n,t.enableStreamingDownload)})},m.UnityCache=(h={name:"UnityCache",version:4},f={name:"RequestMetaDataStore",version:1},p="RequestStore",g="WebAssembly",b=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,w=null,k.getInstance=function(){return w=w||new k},k.destroyInstance=function(){return w?w.close().then(function(){w=null}):Promise.resolve()},k.prototype.clearCache=function(){var r=this;return this.isConnected.then(function(){return r.execute(f.name,"clear",[])}).then(function(){return r.cache.keys()}).then(function e(t){var n;return 0===t.length?Promise.resolve():(n=t.pop(),r.cache.delete(n).then(function(){return e(t)}))})},k.UnityCacheDatabase=h,k.RequestMetaDataStore=f,k.MaximumCacheSize=1073741824,k.prototype.loadRequest=function(e){var t=this;return t.isConnected.then(function(){return Promise.all([t.cache.match(e),t.loadRequestMetaData(e)])}).then(function(e){if(void 0!==e[0]&&void 0!==e[1])return{response:e[0],metaData:e[1]}})},k.prototype.loadRequestMetaData=function(e){e="string"==typeof e?e:e.url;return this.execute(f.name,"get",[e])},k.prototype.updateRequestMetaData=function(e){return this.execute(f.name,"put",[e])},k.prototype.storeRequest=function(e,t){var n=this;return n.isConnected.then(function(){return n.cache.put(e,t)})},k.prototype.close=function(){return this.isConnected.then(function(){this.database&&(this.database.close(),this.database=null),this.cache&&(this.cache=null)}.bind(this))},k.prototype.connect=function(){var o=this;return void 0===b?Promise.reject(new Error("Could not connect to cache: IndexedDB is not supported.")):void 0===window.caches?Promise.reject(new Error("Could not connect to cache: Cache API is not supported.")):new Promise(function(t,n){try{function r(){o.openDBTimeout&&(clearTimeout(o.openDBTimeout),o.openDBTimeout=null)}o.openDBTimeout=setTimeout(function(){void 0===o.database&&n(new Error("Could not connect to cache: Database timeout."))},2e4);var e=b.open(h.name,h.version);e.onupgradeneeded=o.upgradeDatabase.bind(o),e.onsuccess=function(e){r(),o.database=e.target.result,t()},e.onerror=function(e){r(),o.database=null,n(new Error("Could not connect to database."))}}catch(e){r(),o.database=null,o.cache=null,n(new Error("Could not connect to cache: Could not connect to database."))}}).then(function(){var e=h.name+"_"+m.companyName+"_"+m.productName;return caches.open(e)}).then(function(e){o.cache=e})},k.prototype.upgradeDatabase=function(e){var t,e=e.target.result;e.objectStoreNames.contains(f.name)||(t=e.createObjectStore(f.name,{keyPath:"url"}),["accessedAt","updatedAt"].forEach(function(e){t.createIndex(e,e)})),e.objectStoreNames.contains(p)&&e.deleteObjectStore(p),e.objectStoreNames.contains(g)&&e.deleteObjectStore(g)},k.prototype.execute=function(a,i,s){return this.isConnected.then(function(){return new Promise(function(t,n){try{var e,r,o;null===this.database?n(new Error("indexedDB access denied")):(e=-1!=["put","delete","clear"].indexOf(i)?"readwrite":"readonly",r=this.database.transaction([a],e).objectStore(a),"openKeyCursor"==i&&(r=r.index(s[0]),s=s.slice(1)),(o=r[i].apply(r,s)).onsuccess=function(e){t(e.target.result)},o.onerror=function(e){n(e)})}catch(e){n(e)}}.bind(this))}.bind(this))},k.prototype.getMetaDataEntries=function(){var r=this,o=0,a=[];return new Promise(function(t,n){var e=r.database.transaction([f.name],"readonly").objectStore(f.name).openCursor();e.onsuccess=function(e){e=e.target.result;e?(o+=e.value.size,a.push(e.value),e.continue()):t({metaDataEntries:a,cacheSize:o})},e.onerror=function(e){n(e)}})},k.prototype.cleanUpCache=function(){var i=this;return this.getMetaDataEntries().then(function(e){for(var t=e.metaDataEntries,n=e.cacheSize,r=[],o=[],a=0;a<t.length;++a)t[a].version==m.productVersion?o.push(t[a]):(r.push(t[a]),n-=t[a].size);o.sort(function(e,t){return e.accessedAt-t.accessedAt});for(a=0;a<o.length&&!(n<k.MaximumCacheSize);++a)r.push(o[a]),n-=o[a].size;return function e(){var t;return 0===r.length?Promise.resolve():(t=r.pop(),i.cache.delete(t.url).then(function(e){if(e)return r=t.url,new Promise(function(e,t){var n=i.database.transaction([f.name],"readwrite");n.objectStore(f.name).delete(r),n.oncomplete=e,n.onerror=t});var r}).then(e))}()})},k),m.cachedFetch=(y=m.UnityCache,v=m.fetchWithProgress,S=m.readBodyWithProgress,function(o,a){var e,t,i=y.getInstance(),s=D("string"==typeof o?o:o.url),d={enabled:(e=s,(!(t=a)||!t.method||"GET"===t.method)&&((!t||-1!=["must-revalidate","immutable"].indexOf(t.control))&&!!e.match("^https?://")))};function c(n,r){return fetch(n,r).then(function(e){var t;return!d.enabled||d.revalidated?e:304===e.status?(d.revalidated=!0,i.updateRequestMetaData(d.metaData).then(function(){A("'"+d.metaData.url+"' successfully revalidated and served from the browser cache")}).catch(function(e){A("'"+d.metaData.url+"' successfully revalidated but not stored in the browser cache due to the error: "+e)}),S(d.response,r.onProgress,r.enableStreamingDownload)):200==e.status?(d.response=e,d.metaData.updatedAt=d.metaData.accessedAt,d.revalidated=!0,t=e.clone(),S(e,r.onProgress,r.enableStreamingDownload).then(function(e){return d.metaData.size=e.parsedBody.length,Promise.all([i.storeRequest(n,t),i.updateRequestMetaData(d.metaData)]).then(function(){A("'"+s+"' successfully downloaded and stored in the browser cache")}).catch(function(e){A("'"+s+"' successfully downloaded but not stored in the browser cache due to the error: "+e)}),e})):(A("'"+s+"' request failed with status: "+e.status+" "+e.statusText),S(e,r.onProgress,r.enableStreamingDownload))})}return a&&(d.control=a.control,d.companyName=a.companyName,d.productName=a.productName,d.productVersion=a.productVersion),d.revalidated=!1,d.metaData={url:s,accessedAt:Date.now(),version:d.productVersion},d.response=null,d.enabled?i.loadRequest(s).then(function(e){var n,r,t;return e?(n=e.response,r=e.metaData,d.response=n,d.metaData.size=r.size,d.metaData.updatedAt=r.updatedAt,"immutable"==d.control?(d.revalidated=!0,i.updateRequestMetaData(r).then(function(){A("'"+d.metaData.url+"' served from the browser cache without revalidation")}),S(n,a.onProgress,a.enableStreamingDownload)):(e=s,(t=window.location.href.match(/^[a-z]+:\/\/[^\/]+/))&&!e.lastIndexOf(t[0],0)||!n.headers.get("Last-Modified")&&!n.headers.get("ETag")?(e=(a=a||{}).headers||{},a.headers=e,n.headers.get("Last-Modified")?(e["If-Modified-Since"]=n.headers.get("Last-Modified"),e["Cache-Control"]="no-cache"):n.headers.get("ETag")&&(e["If-None-Match"]=n.headers.get("ETag"),e["Cache-Control"]="no-cache"),c(o,a)):fetch(s,{method:"HEAD"}).then(function(t){return d.revalidated=["Last-Modified","ETag"].every(function(e){return!n.headers.get(e)||n.headers.get(e)==t.headers.get(e)}),d.revalidated?(i.updateRequestMetaData(r).then(function(){A("'"+d.metaData.url+"' successfully revalidated and served from the browser cache")}),S(d.response,a.onProgress,a.enableStreamingDownload)):c(o,a)}))):c(o,a)}).catch(function(e){return A("Failed to load '"+d.metaData.url+"' from browser cache due to the error: "+e),v(o,a)}):v(o,a)});var x={gzip:{hasUnityMarker:function(e){var t=10,n="UnityWeb Compressed Content (gzip)";if(t>e.length||31!=e[0]||139!=e[1])return!1;var r=e[3];if(4&r){if(t+2>e.length)return!1;if((t+=2+e[t]+(e[t+1]<<8))>e.length)return!1}if(8&r){for(;t<e.length&&e[t];)t++;if(t+1>e.length)return!1;t++}return 16&r&&String.fromCharCode.apply(null,e.subarray(t,t+n.length+1))==n+"\0"}},br:{hasUnityMarker:function(e){var t="UnityWeb Compressed Content (brotli)";if(!e.length)return!1;var n=1&e[0]?14&e[0]?4:7:1,r=e[0]&(1<<n)-1,o=1+(Math.log(t.length-1)/Math.log(2)>>3);if(commentOffset=1+n+2+1+2+(o<<3)+7>>3,17==r||commentOffset>e.length)return!1;for(var a=r+(6+(o<<4)+(t.length-1<<6)<<n),i=0;i<commentOffset;i++,a>>>=8)if(e[i]!=(255&a))return!1;return String.fromCharCode.apply(null,e.subarray(commentOffset,commentOffset+t.length))==t}}};function W(t){U(t);var e=m.cacheControl(m[t]),n=m.companyName&&m.productName?m.cachedFetch:m.fetchWithProgress,s=m[t],r=/file:\/\//.exec(s)?"same-origin":void 0;return n(m[t],{method:"GET",companyName:m.companyName,productName:m.productName,productVersion:m.productVersion,control:e,mode:r,onProgress:function(e){U(t,e)}}).then(function(e){var t,n,r,o,a,i;return x.gzip.hasUnityMarker(e.parsedBody)&&(t=["gzip","gzip"]),(t=x.br.hasUnityMarker(e.parsedBody)?["brotli","br"]:t)&&(n=e.headers.get("Content-Type"),r=e.headers.get("Content-Encoding"),a=0<(o=e.headers.get("Content-Length"))&&e.parsedBody.length!=o,i=0<o&&e.parsedBody.length==o,r!=t[1]?c("Failed to parse binary data file "+s+' (with "Content-Type: '+n+'"), because it is still '+t[0]+'-compressed. It should have been uncompressed by the browser, but it was unable to do so since the web server provided the compressed content without specifying the HTTP Response Header "Content-Encoding: '+t[1]+'" that would have informed the browser that decompression is needed. Please verify your web server hosting configuration to add the missing "Content-Encoding: '+t[1]+'" HTTP Response Header.',"error"):c(a?"Web server configuration error: it looks like the web server has been misconfigured to double-compress the data file "+s+"! That is, it looks like the web browser has decompressed the file, but it is still in compressed form, suggesting that an already compressed file was compressed a second time. (Content-Length: "+o+", obtained length: "+e.parsedBody.length+")":i?/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&"gzip"==r&&"application/octet-stream"==n?"Unable to load content due to Apple Safari bug https://bugs.webkit.org/show_bug.cgi?id=247421 . To work around this issue, please reconfigure your web server to serve "+s+" with Content-Type: application/gzip instead of Content-Type: application/octet-stream":"Malformed binary data? Received compressed data file "+s+', with "Content-Type: '+n+'", "Content-Encoding: '+t[1]+'", "Content-Length: '+o+'", which the web browser should have decompressed, but it seemingly did not (received file size is the same as compressed file size was). Double check that the integrity of the file is intact.':"Malformed binary data URL "+s+'. No "Content-Length" HTTP Response header present. Check browser console for more information.',"error"),console.error("Malformed data? Downloaded binary data file "+s+" (ArrayBuffer size: "+e.parsedBody.length+") and browser should have decompressed it, but it might have not. Dumping raw HTTP Response Headers if it might help debug:"),e.headers.forEach(function(e,t){console.error(t+": "+e)})),e.parsedBody}).catch(function(e){var t="Failed to download file "+s;"file:"==location.protocol?c(t+". Loading web pages via a file:// URL without a web server is not supported by this browser. Please use a local development web server to host Unity content, or use the Unity Build and Run option.","error"):console.error(t)})}function M(){var t=performance.now(),p=(new Promise(function(a,e){var i=document.createElement("script");i.src=m.frameworkUrl,i.onload=function(){if("undefined"==typeof unityFramework||!unityFramework){var e,t=[["br","br"],["gz","gzip"]];for(e in t){var n,r=t[e];if(m.frameworkUrl.endsWith("."+r[0]))return n="Unable to parse "+m.frameworkUrl+"!","file:"==location.protocol?void c(n+" Loading pre-compressed (brotli or gzip) content via a file:// URL without a web server is not supported by this browser. Please use a local development web server to host compressed Unity content, or use the Unity Build and Run option.","error"):(n+=' This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header "Content-Encoding: '+r[1]+'" present. Check browser Console and Devtools Network tab to debug.',"br"==r[0]&&"http:"==location.protocol&&(r=-1!=["localhost","127.0.0.1"].indexOf(location.hostname)?"":"Migrate your server to use HTTPS.",n=/Firefox/.test(navigator.userAgent)?"Unable to parse "+m.frameworkUrl+'!<br>If using custom web server, verify that web server is sending .br files with HTTP Response Header "Content-Encoding: br". Brotli compression may not be supported in Firefox over HTTP connections. '+r+' See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1670675">https://bugzilla.mozilla.org/show_bug.cgi?id=1670675</a> for more information.':"Unable to parse "+m.frameworkUrl+'!<br>If using custom web server, verify that web server is sending .br files with HTTP Response Header "Content-Encoding: br". Brotli compression may not be supported over HTTP connections. Migrate your server to use HTTPS.'),void c(n,"error"))}c("Unable to parse "+m.frameworkUrl+"! The file is corrupt, or compression was misconfigured? (check Content-Encoding HTTP Response Header on web server)","error")}var o=unityFramework;unityFramework=null,i.onload=null,a(o)},i.onerror=function(e){c("Unable to load file "+m.frameworkUrl+"! Check that the file exists on the remote server. (also check browser Console and Devtools Network tab to debug)","error")},document.body.appendChild(i),m.deinitializers.push(function(){document.body.removeChild(i)})}).then(function(e){m.webAssemblyTimeStart=performance.now(),e(m),m.codeDownloadTimeEnd=performance.now()-t}),performance.now()),e=W("dataUrl");m.preRun.push(function(){m.addRunDependency("dataUrl"),e.then(function(t){var e=new TextDecoder("utf-8"),n=0;function r(){var e=(t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24)>>>0;return n+=4,e}function o(e){if(x.gzip.hasUnityMarker(t))throw e+'. Failed to parse binary data file, because it is still gzip-compressed and should have been uncompressed by the browser. Web server has likely provided gzip-compressed data without specifying the HTTP Response Header "Content-Encoding: gzip" with it to instruct the browser to decompress it. Please verify your web server hosting configuration.';if(x.br.hasUnityMarker(t))throw e+'. Failed to parse binary data file, because it is still brotli-compressed and should have been uncompressed by the browser. Web server has likely provided brotli-compressed data without specifying the HTTP Response Header "Content-Encoding: br" with it to instruct the browser to decompress it. Please verify your web server hosting configuration.';throw e}var a="UnityWebData1.0\0",i=e.decode(t.subarray(0,a.length)),s=(i!=a&&o('Unknown data format (id="'+i+'")'),n+=a.length,r());for(n+s>t.length&&o("Invalid binary data file header! (pos="+n+", headerSize="+s+", file length="+t.length+")");n<s;){var d=r(),c=r(),l=(d+c>t.length&&o("Invalid binary data file size! (offset="+d+", size="+c+", file length="+t.length+")"),r()),u=(n+l>t.length&&o("Invalid binary data file path name! (pos="+n+", length="+l+", file length="+t.length+")"),e.decode(t.subarray(n,n+l)));n+=l;for(var h=0,f=u.indexOf("/",h)+1;0<f;h=f,f=u.indexOf("/",h)+1)m.FS_createPath(u.substring(0,h),u.substring(h,f-1),!0,!0);m.FS_createDataFile(u,null,t.subarray(d,d+c),!0,!0,!0)}m.removeRunDependency("dataUrl"),m.dataUrlLoadEndTime=performance.now()-p})})}return new Promise(function(e,t){var n;m.SystemInfo.hasWebGL?1==m.SystemInfo.hasWebGL?(n='Your browser does not support graphics API "WebGL 2" which is required for this content.',"Safari"==m.SystemInfo.browser&&parseInt(m.SystemInfo.browserVersion)<15&&(m.SystemInfo.mobile||1<navigator.maxTouchPoints?n+="\nUpgrade to iOS 15 or later.":n+="\nUpgrade to Safari 15 or later."),t(n)):m.SystemInfo.hasWasm?m.SystemInfo.hasWasm2023?(m.startupErrorHandler=t,d(0),m.postRun.push(function(){d(1),m.WebPlayer.WaitForInitialization().then(function(){delete m.startupErrorHandler,e(C),m.pageStartupTime=performance.now()})}),new Promise(function(t,e){navigator.gpu?navigator.gpu.requestAdapter().then(function(e){m.SystemInfo.hasWebGPU=!!e,t(m.SystemInfo.hasWebGPU)}):t(!1)}).then(function(){M()})):t("Your browser does not support WebAssembly 2023. Please update to Chrome \u2265 91 (May 2021), Firefox \u2265 89 (June 2021) or Safari \u2265 16.4 (March 2023). (failed "+m.SystemInfo.missingWasm2023Feature+")"):t("Your browser does not support WebAssembly."):t("Your browser does not support WebGL.")})}
|
|
1
|
+
function createUnityInstance(t,n,d){function c(e,t){if(!c.aborted&&n.showBanner)return"error"==t&&(c.aborted=!0),n.showBanner(e,t);switch(t){case"error":console.error(e);break;case"warning":console.warn(e);break;default:console.log(e)}}function r(e){var t=e.reason||e.error,n=t?t.toString():e.message||e.reason||"",r=t&&t.stack?t.stack.toString():"";(n+="\n"+(r=r.startsWith(n)?r.substring(n.length):r).trim())&&m.stackTraceRegExp&&m.stackTraceRegExp.test(n)&&E(n,e.filename||t&&(t.fileName||t.sourceURL)||"",e.lineno||t&&(t.lineNumber||t.line)||0)}function e(e,t,n){var r=e[t];void 0!==r&&r||(console.warn('Config option "'+t+'" is missing or empty. Falling back to default value: "'+n+'". Consider updating your WebGL template to include the missing config option.'),e[t]=n)}d=d||function(){};var o,m={canvas:t,webglContextAttributes:{preserveDrawingBuffer:!1,powerPreference:2},wasmFileSize:48973692,cacheControl:function(e){return e==m.dataUrl||e.match(/\.bundle/)?"must-revalidate":"no-store"},streamingAssetsUrl:"StreamingAssets",downloadProgress:{},deinitializers:[],intervals:{},setInterval:function(e,t){e=window.setInterval(e,t);return this.intervals[e]=!0,e},clearInterval:function(e){delete this.intervals[e],window.clearInterval(e)},preRun:[],postRun:[],print:function(e){console.log(e)},printErr:function(e){console.error(e),"string"==typeof e&&-1!=e.indexOf("wasm streaming compile failed")&&(-1!=e.toLowerCase().indexOf("mime")?c('HTTP Response Header "Content-Type" configured incorrectly on the server for file '+m.codeUrl+' , should be "application/wasm". Startup time performance will suffer.',"warning"):c('WebAssembly streaming compilation failed! This can happen for example if "Content-Encoding" HTTP header is incorrectly enabled on the server for file '+m.codeUrl+", but the file is not pre-compressed on disk (or vice versa). Check the Network tab in browser Devtools to debug server header configuration.","warning"))},locateFile:function(e){return"build.wasm"==e?this.codeUrl:e},disabledCanvasEvents:["contextmenu","dragstart"]};for(o in e(n,"companyName","Unity"),e(n,"productName","WebGL Player"),e(n,"productVersion","1.0"),n)m[o]=n[o];m.streamingAssetsUrl=new URL(m.streamingAssetsUrl,document.URL).href;var a=m.disabledCanvasEvents.slice();function i(e){e.preventDefault()}a.forEach(function(e){t.addEventListener(e,i)}),window.addEventListener("error",r),window.addEventListener("unhandledrejection",r);var s="",l="";function u(e){document.webkitCurrentFullScreenElement===t?t.style.width&&(s=t.style.width,l=t.style.height,t.style.width="100%",t.style.height="100%"):s&&(t.style.width=s,t.style.height=l,l=s="")}document.addEventListener("webkitfullscreenchange",u),m.deinitializers.push(function(){for(var e in m.disableAccessToMediaDevices(),a.forEach(function(e){t.removeEventListener(e,i)}),window.removeEventListener("error",r),window.removeEventListener("unhandledrejection",r),document.removeEventListener("webkitfullscreenchange",u),m.intervals)window.clearInterval(e);m.intervals={}}),m.QuitCleanup=function(){for(var e=0;e<m.deinitializers.length;e++)m.deinitializers[e]();m.deinitializers=[],"function"==typeof m.onQuit&&m.onQuit()};var h,f,p,g,b,w,y,v,S,C={Module:m,SetFullscreen:function(){if(m.SetFullscreen)return m.SetFullscreen.apply(m,arguments);m.print("Failed to set Fullscreen mode: Player not loaded yet.")},SendMessage:function(){if(m.SendMessage)return m.SendMessage.apply(m,arguments);m.print("Failed to execute SendMessage: Player not loaded yet.")},Quit:function(){return new Promise(function(e,t){m.shouldQuit=!0,m.onQuit=e})},GetMetricsInfo:function(){var e=Number(m._getMetricsInfo())>>>0,t=4+e,n=4+t,r=8+n,o=8+r,a=4+o,i=4+a,s=8+i,d=8+s,c=4+d,l=4+c,u=4+l;return{totalWASMHeapSize:m.HEAPU32[e>>2],usedWASMHeapSize:m.HEAPU32[t>>2],totalJSHeapSize:m.HEAPF64[n>>3],usedJSHeapSize:m.HEAPF64[r>>3],pageLoadTime:m.HEAPU32[o>>2],pageLoadTimeToFrame1:m.HEAPU32[a>>2],fps:m.HEAPF64[i>>3],movingAverageFps:m.HEAPF64[s>>3],assetLoadTime:m.HEAPU32[d>>2],webAssemblyStartupTime:m.HEAPU32[c>>2]-(m.webAssemblyTimeStart||0),codeDownloadTime:m.HEAPU32[l>>2],gameStartupTime:m.HEAPU32[u>>2],numJankedFrames:m.HEAPU32[4+u>>2]}}};function P(e,t,n){-1==e.indexOf("fullscreen error")&&(m.startupErrorHandler?m.startupErrorHandler(e,t,n):m.errorHandler&&m.errorHandler(e,t,n)||(console.log("Invoking error handler due to\n"+e),"function"==typeof dump&&dump("Invoking error handler due to\n"+e),P.didShowErrorMessage||(-1!=(e="An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:\n"+e).indexOf("DISABLE_EXCEPTION_CATCHING")?e="An exception has occurred, but exception handling has been disabled in this build. If you are the developer of this content, enable exceptions in your project WebGL player settings to be able to catch the exception or see the stack trace.":-1!=e.indexOf("Cannot enlarge memory arrays")?e="Out of memory. If you are the developer of this content, try allocating more memory to your WebGL build in the WebGL player settings.":-1==e.indexOf("Invalid array buffer length")&&-1==e.indexOf("Invalid typed array length")&&-1==e.indexOf("out of memory")&&-1==e.indexOf("could not allocate memory")||(e="The browser could not allocate enough memory for the WebGL content. If you are the developer of this content, try allocating less memory to your WebGL build in the WebGL player settings."),alert(e),P.didShowErrorMessage=!0)))}function T(e,t){var n="(wasm-function\\[)(\\d+)(\\])",r=new RegExp(n);return e.replace(new RegExp(n,"g"),function(e){e=e.match(r);return e[1]+(t[e[2]]?t[e[2]]+"@":"")+e[2]+e[3]})}function E(r,o,a){m.symbols?P(T(r,m.symbols),o,a):m.symbolsUrl?W("symbolsUrl").then(function(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);m.symbols=JSON.parse(t),P(T(r,m.symbols),o,a)}).catch(function(e){P(r,o,a)}):P(r,o,a)}function U(e,t){if("symbolsUrl"!=e){var n=m.downloadProgress[e],r=(n=n||(m.downloadProgress[e]={started:!1,finished:!1,lengthComputable:!1,total:0,loaded:0}),"object"!=typeof t||"progress"!=t.type&&"load"!=t.type||(n.started||(n.started=!0,n.lengthComputable=t.lengthComputable),n.total=t.total,n.loaded=t.loaded,"load"==t.type&&(n.finished=!0)),0),o=0,a=0,i=0,s=0;for(e in m.downloadProgress){if(!(n=m.downloadProgress[e]).started)return;a++,n.lengthComputable?(r+=n.loaded,o+=n.total,i++):n.finished||s++}d(.9*(a?(a-s-(o?i*(o-r)/o:0))/a:0))}}function k(){var e=this;this.isConnected=this.connect().then(function(){return e.cleanUpCache()}),this.isConnected.catch(function(e){e="Error when initializing cache: "+e,console.log("[UnityCache] "+e)})}function A(e){console.log("[UnityCache] "+e)}function D(e){return D.link=D.link||document.createElement("a"),D.link.href=e,D.link.href}m.SystemInfo=function(){var e,t,n,r,o,a=navigator.userAgent+" ",i=[["Firefox","Firefox"],["OPR","Opera"],["Edg","Edge"],["SamsungBrowser","Samsung Browser"],["Trident","Internet Explorer"],["MSIE","Internet Explorer"],["Chrome","Chrome"],["CriOS","Chrome on iOS Safari"],["FxiOS","Firefox on iOS Safari"],["Safari","Safari"]];function s(e,t,n){return(e=RegExp(e,"i").exec(t))&&e[n]}for(var d=0;d<i.length;++d)if(t=s(i[d][0]+"[/ ](.*?)[ \\)]",a,1)){e=i[d][1];break}"Safari"==e&&(t=s("Version/(.*?) ",a,1)),"Internet Explorer"==e&&(t=s("rv:(.*?)\\)? ",a,1)||t);for(var c=[["Windows (.*?)[;)]","Windows"],["Android ([0-9_.]+)","Android"],["iPhone OS ([0-9_.]+)","iPhoneOS"],["iPad.*? OS ([0-9_.]+)","iPadOS"],["FreeBSD( )","FreeBSD"],["OpenBSD( )","OpenBSD"],["Linux|X11()","Linux"],["Mac OS X ([0-9_\\.]+)","MacOS"],["bot|google|baidu|bing|msn|teoma|slurp|yandex","Search Bot"]],l=0;l<c.length;++l)if(r=s(c[l][0],a,1)){n=c[l][1],r=r.replace(/_/g,".");break}var u;function h(){try{return window.WebAssembly?WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,13,1,11,0,65,0,65,0,65,1,252,11,0,11]))?WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,11,1,9,1,1,125,32,0,252,0,26,11]))?WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,10,1,8,1,1,126,32,0,194,26,11]))?WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11]))?!!WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,10,1,8,0,6,64,1,25,1,11,11]))||"wasm-exceptions":"wasm-simd128":"sign-extend":"non-trapping fp-to-int":"bulk-memory":"WebAssembly"}catch(e){return"Exception: "+e}}r={"NT 5.0":"2000","NT 5.1":"XP","NT 5.2":"Server 2003","NT 6.0":"Vista","NT 6.1":"7","NT 6.2":"8","NT 6.3":"8.1","NT 10.0":"10"}[r]||r,webgpuVersion=0,(f=document.createElement("canvas"))&&(u=(p=f.getContext("webgl2"))?2:0,p||(p=f&&f.getContext("webgl"))&&(u=1),p&&(o=p.getExtension("WEBGL_debug_renderer_info")&&p.getParameter(37446)||p.getParameter(7937)),webgpuVersion=navigator.gpu?1:0);var f="undefined"!=typeof SharedArrayBuffer,p="object"==typeof WebAssembly&&"function"==typeof WebAssembly.compile,m=p&&!0===h();return{width:screen.width,height:screen.height,userAgent:a.trim(),browser:e||"Unknown browser",browserVersion:t||"Unknown version",mobile:/Mobile|Android|iP(ad|hone)/.test(navigator.appVersion),os:n||"Unknown OS",osVersion:r||"Unknown OS Version",gpu:o||"Unknown GPU",language:navigator.userLanguage||navigator.language,hasWebGL:u,hasWebGPU:webgpuVersion,hasCursorLock:!!document.body.requestPointerLock,hasFullscreen:!!document.body.requestFullscreen||!!document.body.webkitRequestFullscreen,hasThreads:f,hasWasm:p,hasWasm2023:m,missingWasm2023Feature:m?null:h(),hasWasmThreads:!1}}(),m.abortHandler=function(e){return E(e,"",0),!0},Error.stackTraceLimit=Math.max(Error.stackTraceLimit||0,50),m.readBodyWithProgress=function(a,i,s){var e=a.body?a.body.getReader():void 0,d=void 0!==a.headers.get("Content-Length"),c=function(e,t){if(!t)return 0;var t=e.headers.get("Content-Encoding"),n=parseInt(e.headers.get("Content-Length")),r=536870912;switch(t){case"br":return Math.min(Math.round(2*n),r);case"gzip":return Math.min(Math.round(1.6*n),r);default:return n}}(a,d),l=new Uint8Array(c),u=[],h=0,f=0;return d||console.warn("[UnityCache] Response is served without Content-Length header. Please reconfigure server to include valid Content-Length for better download performance."),function o(){return void 0===e?a.arrayBuffer().then(function(e){var t=new Uint8Array(e);return i({type:"progress",response:a,total:e.length,loaded:0,lengthComputable:d,chunk:s?t:null}),t}):e.read().then(function(e){if(e.done){if(h===c)return l;if(h<c)return l.slice(0,h);for(var t=new Uint8Array(h),n=(t.set(l,0),f),r=0;r<u.length;++r)t.set(u[r],n),n+=u[r].length;return t}return h+e.value.length<=l.length?(l.set(e.value,h),f=h+e.value.length):u.push(e.value),h+=e.value.length,i({type:"progress",response:a,total:Math.max(c,h),loaded:h,lengthComputable:d,chunk:s?e.value:null}),o()})}().then(function(e){return i({type:"load",response:a,total:e.length,loaded:e.length,lengthComputable:d,chunk:null}),a.parsedBody=e,a})},m.fetchWithProgress=function(e,t){var n=function(){};return t&&t.onProgress&&(n=t.onProgress),fetch(e,t).then(function(e){return m.readBodyWithProgress(e,n,t.enableStreamingDownload)})},m.UnityCache=(h={name:"UnityCache",version:4},f={name:"RequestMetaDataStore",version:1},p="RequestStore",g="WebAssembly",b=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,w=null,k.getInstance=function(){return w=w||new k},k.destroyInstance=function(){return w?w.close().then(function(){w=null}):Promise.resolve()},k.prototype.clearCache=function(){var r=this;return this.isConnected.then(function(){return r.execute(f.name,"clear",[])}).then(function(){return r.cache.keys()}).then(function e(t){var n;return 0===t.length?Promise.resolve():(n=t.pop(),r.cache.delete(n).then(function(){return e(t)}))})},k.UnityCacheDatabase=h,k.RequestMetaDataStore=f,k.MaximumCacheSize=1073741824,k.prototype.loadRequest=function(e){var t=this;return t.isConnected.then(function(){return Promise.all([t.cache.match(e),t.loadRequestMetaData(e)])}).then(function(e){if(void 0!==e[0]&&void 0!==e[1])return{response:e[0],metaData:e[1]}})},k.prototype.loadRequestMetaData=function(e){e="string"==typeof e?e:e.url;return this.execute(f.name,"get",[e])},k.prototype.updateRequestMetaData=function(e){return this.execute(f.name,"put",[e])},k.prototype.storeRequest=function(e,t){var n=this;return n.isConnected.then(function(){return n.cache.put(e,t)})},k.prototype.close=function(){return this.isConnected.then(function(){this.database&&(this.database.close(),this.database=null),this.cache&&(this.cache=null)}.bind(this))},k.prototype.connect=function(){var o=this;return void 0===b?Promise.reject(new Error("Could not connect to cache: IndexedDB is not supported.")):void 0===window.caches?Promise.reject(new Error("Could not connect to cache: Cache API is not supported.")):new Promise(function(t,n){try{function r(){o.openDBTimeout&&(clearTimeout(o.openDBTimeout),o.openDBTimeout=null)}o.openDBTimeout=setTimeout(function(){void 0===o.database&&n(new Error("Could not connect to cache: Database timeout."))},2e4);var e=b.open(h.name,h.version);e.onupgradeneeded=o.upgradeDatabase.bind(o),e.onsuccess=function(e){r(),o.database=e.target.result,t()},e.onerror=function(e){r(),o.database=null,n(new Error("Could not connect to database."))}}catch(e){r(),o.database=null,o.cache=null,n(new Error("Could not connect to cache: Could not connect to database."))}}).then(function(){var e=h.name+"_"+m.companyName+"_"+m.productName;return caches.open(e)}).then(function(e){o.cache=e})},k.prototype.upgradeDatabase=function(e){var t,e=e.target.result;e.objectStoreNames.contains(f.name)||(t=e.createObjectStore(f.name,{keyPath:"url"}),["accessedAt","updatedAt"].forEach(function(e){t.createIndex(e,e)})),e.objectStoreNames.contains(p)&&e.deleteObjectStore(p),e.objectStoreNames.contains(g)&&e.deleteObjectStore(g)},k.prototype.execute=function(a,i,s){return this.isConnected.then(function(){return new Promise(function(t,n){try{var e,r,o;null===this.database?n(new Error("indexedDB access denied")):(e=-1!=["put","delete","clear"].indexOf(i)?"readwrite":"readonly",r=this.database.transaction([a],e).objectStore(a),"openKeyCursor"==i&&(r=r.index(s[0]),s=s.slice(1)),(o=r[i].apply(r,s)).onsuccess=function(e){t(e.target.result)},o.onerror=function(e){n(e)})}catch(e){n(e)}}.bind(this))}.bind(this))},k.prototype.getMetaDataEntries=function(){var r=this,o=0,a=[];return new Promise(function(t,n){var e=r.database.transaction([f.name],"readonly").objectStore(f.name).openCursor();e.onsuccess=function(e){e=e.target.result;e?(o+=e.value.size,a.push(e.value),e.continue()):t({metaDataEntries:a,cacheSize:o})},e.onerror=function(e){n(e)}})},k.prototype.cleanUpCache=function(){var i=this;return this.getMetaDataEntries().then(function(e){for(var t=e.metaDataEntries,n=e.cacheSize,r=[],o=[],a=0;a<t.length;++a)t[a].version==m.productVersion?o.push(t[a]):(r.push(t[a]),n-=t[a].size);o.sort(function(e,t){return e.accessedAt-t.accessedAt});for(a=0;a<o.length&&!(n<k.MaximumCacheSize);++a)r.push(o[a]),n-=o[a].size;return function e(){var t;return 0===r.length?Promise.resolve():(t=r.pop(),i.cache.delete(t.url).then(function(e){if(e)return r=t.url,new Promise(function(e,t){var n=i.database.transaction([f.name],"readwrite");n.objectStore(f.name).delete(r),n.oncomplete=e,n.onerror=t});var r}).then(e))}()})},k),m.cachedFetch=(y=m.UnityCache,v=m.fetchWithProgress,S=m.readBodyWithProgress,function(o,a){var e,t,i=y.getInstance(),s=D("string"==typeof o?o:o.url),d={enabled:(e=s,(!(t=a)||!t.method||"GET"===t.method)&&((!t||-1!=["must-revalidate","immutable"].indexOf(t.control))&&!!e.match("^https?://")))};function c(n,r){return fetch(n,r).then(function(e){var t;return!d.enabled||d.revalidated?e:304===e.status?(d.revalidated=!0,i.updateRequestMetaData(d.metaData).then(function(){A("'"+d.metaData.url+"' successfully revalidated and served from the browser cache")}).catch(function(e){A("'"+d.metaData.url+"' successfully revalidated but not stored in the browser cache due to the error: "+e)}),S(d.response,r.onProgress,r.enableStreamingDownload)):200==e.status?(d.response=e,d.metaData.updatedAt=d.metaData.accessedAt,d.revalidated=!0,t=e.clone(),S(e,r.onProgress,r.enableStreamingDownload).then(function(e){return d.metaData.size=e.parsedBody.length,Promise.all([i.storeRequest(n,t),i.updateRequestMetaData(d.metaData)]).then(function(){A("'"+s+"' successfully downloaded and stored in the browser cache")}).catch(function(e){A("'"+s+"' successfully downloaded but not stored in the browser cache due to the error: "+e)}),e})):(A("'"+s+"' request failed with status: "+e.status+" "+e.statusText),S(e,r.onProgress,r.enableStreamingDownload))})}return a&&(d.control=a.control,d.companyName=a.companyName,d.productName=a.productName,d.productVersion=a.productVersion),d.revalidated=!1,d.metaData={url:s,accessedAt:Date.now(),version:d.productVersion},d.response=null,d.enabled?i.loadRequest(s).then(function(e){var n,r,t;return e?(n=e.response,r=e.metaData,d.response=n,d.metaData.size=r.size,d.metaData.updatedAt=r.updatedAt,"immutable"==d.control?(d.revalidated=!0,i.updateRequestMetaData(r).then(function(){A("'"+d.metaData.url+"' served from the browser cache without revalidation")}),S(n,a.onProgress,a.enableStreamingDownload)):(e=s,(t=window.location.href.match(/^[a-z]+:\/\/[^\/]+/))&&!e.lastIndexOf(t[0],0)||!n.headers.get("Last-Modified")&&!n.headers.get("ETag")?(e=(a=a||{}).headers||{},a.headers=e,n.headers.get("Last-Modified")?(e["If-Modified-Since"]=n.headers.get("Last-Modified"),e["Cache-Control"]="no-cache"):n.headers.get("ETag")&&(e["If-None-Match"]=n.headers.get("ETag"),e["Cache-Control"]="no-cache"),c(o,a)):fetch(s,{method:"HEAD"}).then(function(t){return d.revalidated=["Last-Modified","ETag"].every(function(e){return!n.headers.get(e)||n.headers.get(e)==t.headers.get(e)}),d.revalidated?(i.updateRequestMetaData(r).then(function(){A("'"+d.metaData.url+"' successfully revalidated and served from the browser cache")}),S(d.response,a.onProgress,a.enableStreamingDownload)):c(o,a)}))):c(o,a)}).catch(function(e){return A("Failed to load '"+d.metaData.url+"' from browser cache due to the error: "+e),v(o,a)}):v(o,a)});var x={gzip:{hasUnityMarker:function(e){var t=10,n="UnityWeb Compressed Content (gzip)";if(t>e.length||31!=e[0]||139!=e[1])return!1;var r=e[3];if(4&r){if(t+2>e.length)return!1;if((t+=2+e[t]+(e[t+1]<<8))>e.length)return!1}if(8&r){for(;t<e.length&&e[t];)t++;if(t+1>e.length)return!1;t++}return 16&r&&String.fromCharCode.apply(null,e.subarray(t,t+n.length+1))==n+"\0"}},br:{hasUnityMarker:function(e){var t="UnityWeb Compressed Content (brotli)";if(!e.length)return!1;var n=1&e[0]?14&e[0]?4:7:1,r=e[0]&(1<<n)-1,o=1+(Math.log(t.length-1)/Math.log(2)>>3);if(commentOffset=1+n+2+1+2+(o<<3)+7>>3,17==r||commentOffset>e.length)return!1;for(var a=r+(6+(o<<4)+(t.length-1<<6)<<n),i=0;i<commentOffset;i++,a>>>=8)if(e[i]!=(255&a))return!1;return String.fromCharCode.apply(null,e.subarray(commentOffset,commentOffset+t.length))==t}}};function W(t){U(t);var e=m.cacheControl(m[t]),n=m.companyName&&m.productName?m.cachedFetch:m.fetchWithProgress,s=m[t],r=/file:\/\//.exec(s)?"same-origin":void 0;return n(m[t],{method:"GET",companyName:m.companyName,productName:m.productName,productVersion:m.productVersion,control:e,mode:r,onProgress:function(e){U(t,e)}}).then(function(e){var t,n,r,o,a,i;return x.gzip.hasUnityMarker(e.parsedBody)&&(t=["gzip","gzip"]),(t=x.br.hasUnityMarker(e.parsedBody)?["brotli","br"]:t)&&(n=e.headers.get("Content-Type"),r=e.headers.get("Content-Encoding"),a=0<(o=e.headers.get("Content-Length"))&&e.parsedBody.length!=o,i=0<o&&e.parsedBody.length==o,r!=t[1]?c("Failed to parse binary data file "+s+' (with "Content-Type: '+n+'"), because it is still '+t[0]+'-compressed. It should have been uncompressed by the browser, but it was unable to do so since the web server provided the compressed content without specifying the HTTP Response Header "Content-Encoding: '+t[1]+'" that would have informed the browser that decompression is needed. Please verify your web server hosting configuration to add the missing "Content-Encoding: '+t[1]+'" HTTP Response Header.',"error"):c(a?"Web server configuration error: it looks like the web server has been misconfigured to double-compress the data file "+s+"! That is, it looks like the web browser has decompressed the file, but it is still in compressed form, suggesting that an already compressed file was compressed a second time. (Content-Length: "+o+", obtained length: "+e.parsedBody.length+")":i?/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&"gzip"==r&&"application/octet-stream"==n?"Unable to load content due to Apple Safari bug https://bugs.webkit.org/show_bug.cgi?id=247421 . To work around this issue, please reconfigure your web server to serve "+s+" with Content-Type: application/gzip instead of Content-Type: application/octet-stream":"Malformed binary data? Received compressed data file "+s+', with "Content-Type: '+n+'", "Content-Encoding: '+t[1]+'", "Content-Length: '+o+'", which the web browser should have decompressed, but it seemingly did not (received file size is the same as compressed file size was). Double check that the integrity of the file is intact.':"Malformed binary data URL "+s+'. No "Content-Length" HTTP Response header present. Check browser console for more information.',"error"),console.error("Malformed data? Downloaded binary data file "+s+" (ArrayBuffer size: "+e.parsedBody.length+") and browser should have decompressed it, but it might have not. Dumping raw HTTP Response Headers if it might help debug:"),e.headers.forEach(function(e,t){console.error(t+": "+e)})),e.parsedBody}).catch(function(e){var t="Failed to download file "+s;"file:"==location.protocol?c(t+". Loading web pages via a file:// URL without a web server is not supported by this browser. Please use a local development web server to host Unity content, or use the Unity Build and Run option.","error"):console.error(t)})}function M(){var t=performance.now(),p=(new Promise(function(a,e){var i=document.createElement("script");i.src=m.frameworkUrl,i.onload=function(){if("undefined"==typeof unityFramework||!unityFramework){var e,t=[["br","br"],["gz","gzip"]];for(e in t){var n,r=t[e];if(m.frameworkUrl.endsWith("."+r[0]))return n="Unable to parse "+m.frameworkUrl+"!","file:"==location.protocol?void c(n+" Loading pre-compressed (brotli or gzip) content via a file:// URL without a web server is not supported by this browser. Please use a local development web server to host compressed Unity content, or use the Unity Build and Run option.","error"):(n+=' This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header "Content-Encoding: '+r[1]+'" present. Check browser Console and Devtools Network tab to debug.',"br"==r[0]&&"http:"==location.protocol&&(r=-1!=["localhost","127.0.0.1"].indexOf(location.hostname)?"":"Migrate your server to use HTTPS.",n=/Firefox/.test(navigator.userAgent)?"Unable to parse "+m.frameworkUrl+'!<br>If using custom web server, verify that web server is sending .br files with HTTP Response Header "Content-Encoding: br". Brotli compression may not be supported in Firefox over HTTP connections. '+r+' See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1670675">https://bugzilla.mozilla.org/show_bug.cgi?id=1670675</a> for more information.':"Unable to parse "+m.frameworkUrl+'!<br>If using custom web server, verify that web server is sending .br files with HTTP Response Header "Content-Encoding: br". Brotli compression may not be supported over HTTP connections. Migrate your server to use HTTPS.'),void c(n,"error"))}c("Unable to parse "+m.frameworkUrl+"! The file is corrupt, or compression was misconfigured? (check Content-Encoding HTTP Response Header on web server)","error")}var o=unityFramework;unityFramework=null,i.onload=null,a(o)},i.onerror=function(e){c("Unable to load file "+m.frameworkUrl+"! Check that the file exists on the remote server. (also check browser Console and Devtools Network tab to debug)","error")},document.body.appendChild(i),m.deinitializers.push(function(){document.body.removeChild(i)})}).then(function(e){m.webAssemblyTimeStart=performance.now(),e(m),m.codeDownloadTimeEnd=performance.now()-t}),performance.now()),e=W("dataUrl");m.preRun.push(function(){m.addRunDependency("dataUrl"),e.then(function(t){var e=new TextDecoder("utf-8"),n=0;function r(){var e=(t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24)>>>0;return n+=4,e}function o(e){if(x.gzip.hasUnityMarker(t))throw e+'. Failed to parse binary data file, because it is still gzip-compressed and should have been uncompressed by the browser. Web server has likely provided gzip-compressed data without specifying the HTTP Response Header "Content-Encoding: gzip" with it to instruct the browser to decompress it. Please verify your web server hosting configuration.';if(x.br.hasUnityMarker(t))throw e+'. Failed to parse binary data file, because it is still brotli-compressed and should have been uncompressed by the browser. Web server has likely provided brotli-compressed data without specifying the HTTP Response Header "Content-Encoding: br" with it to instruct the browser to decompress it. Please verify your web server hosting configuration.';throw e}var a="UnityWebData1.0\0",i=e.decode(t.subarray(0,a.length)),s=(i!=a&&o('Unknown data format (id="'+i+'")'),n+=a.length,r());for(n+s>t.length&&o("Invalid binary data file header! (pos="+n+", headerSize="+s+", file length="+t.length+")");n<s;){var d=r(),c=r(),l=(d+c>t.length&&o("Invalid binary data file size! (offset="+d+", size="+c+", file length="+t.length+")"),r()),u=(n+l>t.length&&o("Invalid binary data file path name! (pos="+n+", length="+l+", file length="+t.length+")"),e.decode(t.subarray(n,n+l)));n+=l;for(var h=0,f=u.indexOf("/",h)+1;0<f;h=f,f=u.indexOf("/",h)+1)m.FS_createPath(u.substring(0,h),u.substring(h,f-1),!0,!0);m.FS_createDataFile(u,null,t.subarray(d,d+c),!0,!0,!0)}m.removeRunDependency("dataUrl"),m.dataUrlLoadEndTime=performance.now()-p})})}return new Promise(function(e,t){var n;m.SystemInfo.hasWebGL?1==m.SystemInfo.hasWebGL?(n='Your browser does not support graphics API "WebGL 2" which is required for this content.',"Safari"==m.SystemInfo.browser&&parseInt(m.SystemInfo.browserVersion)<15&&(m.SystemInfo.mobile||1<navigator.maxTouchPoints?n+="\nUpgrade to iOS 15 or later.":n+="\nUpgrade to Safari 15 or later."),t(n)):m.SystemInfo.hasWasm?m.SystemInfo.hasWasm2023?(m.startupErrorHandler=t,d(0),m.postRun.push(function(){d(1),m.WebPlayer.WaitForInitialization().then(function(){delete m.startupErrorHandler,e(C),m.pageStartupTime=performance.now()})}),new Promise(function(t,e){navigator.gpu?navigator.gpu.requestAdapter().then(function(e){m.SystemInfo.hasWebGPU=!!e,t(m.SystemInfo.hasWebGPU)}):t(!1)}).then(function(){M()})):t("Your browser does not support WebAssembly 2023. Please update to Chrome \u2265 91 (May 2021), Firefox \u2265 89 (June 2021) or Safari \u2265 16.4 (March 2023). (failed "+m.SystemInfo.missingWasm2023Feature+")"):t("Your browser does not support WebAssembly."):t("Your browser does not support WebGL.")})}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|