UNPKG

@aladas-org/cryptoshape

Version:

Generates a representation of a Bip39 seed phrase as a 3D scene

1 lines 5.95 MB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("babylonjs",[],t):"object"==typeof exports?exports.babylonjs=t():e.BABYLON=t()}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(()=>(()=>{"use strict";var e={82966:(e,t,n)=>{n.d(t,{G:()=>i});var r=n(81152),i=function(){function e(){this.hoverCursor="",this.actions=[],this.isRecursive=!1,this.disposeWhenUnowned=!0}return Object.defineProperty(e,"HasTriggers",{get:function(){for(var t in e.Triggers)if(Object.prototype.hasOwnProperty.call(e.Triggers,t))return!0;return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e,"HasPickTriggers",{get:function(){for(var t in e.Triggers)if(Object.prototype.hasOwnProperty.call(e.Triggers,t)){var n=parseInt(t);if(n>=r.Y.ACTION_OnPickTrigger&&n<=r.Y.ACTION_OnPickUpTrigger)return!0}return!1},enumerable:!1,configurable:!0}),e.HasSpecificTrigger=function(t){for(var n in e.Triggers)if(Object.prototype.hasOwnProperty.call(e.Triggers,n)&&parseInt(n)===t)return!0;return!1},e.Triggers={},e}()},35747:(e,t,n)=>{n.d(t,{X:()=>r});var r=function(){function e(e,t,n,r,i,o){this.source=e,this.pointerX=t,this.pointerY=n,this.meshUnderPointer=r,this.sourceEvent=i,this.additionalData=o}return e.CreateNew=function(t,n,r){var i=t.getScene();return new e(t,i.pointerX,i.pointerY,i.meshUnderPointer||t,n,r)},e.CreateNewFromSprite=function(t,n,r,i){return new e(t,n.pointerX,n.pointerY,n.meshUnderPointer,r,i)},e.CreateNewFromScene=function(t,n){return new e(null,t.pointerX,t.pointerY,t.meshUnderPointer,n)},e.CreateNewFromPrimitive=function(t,n,r,i){return new e(t,n.x,n.y,null,r,i)},e}()},62623:(e,t,n)=>{n.d(t,{R:()=>s,h:()=>a});var r=n(37943),i=n(7164),o=n(81152),a=function(){function e(e,t,n,i,o,a,s,l,c){void 0===i&&(i=0),void 0===o&&(o=!1),void 0===a&&(a=!1),void 0===s&&(s=!1),this._isAlreadyOwned=!1,this._isDisposed=!1,e&&e.getScene?this._engine=e.getScene().getEngine():this._engine=e,this._updatable=n,this._instanced=a,this._divisor=l||1,this._label=c,t instanceof r.n?(this._data=null,this._buffer=t):(this._data=t,this._buffer=null),this.byteStride=s?i:i*Float32Array.BYTES_PER_ELEMENT,o||this.create()}return Object.defineProperty(e.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!1,configurable:!0}),e.prototype.createVertexBuffer=function(e,t,n,r,i,o,a){void 0===o&&(o=!1);var l=o?t:t*Float32Array.BYTES_PER_ELEMENT,c=r?o?r:r*Float32Array.BYTES_PER_ELEMENT:this.byteStride;return new s(this._engine,this,e,this._updatable,!0,c,void 0===i?this._instanced:i,l,n,void 0,void 0,!0,this._divisor||a)},e.prototype.isUpdatable=function(){return this._updatable},e.prototype.getData=function(){return this._data},e.prototype.getBuffer=function(){return this._buffer},e.prototype.getStrideSize=function(){return this.byteStride/Float32Array.BYTES_PER_ELEMENT},e.prototype.create=function(e){void 0===e&&(e=null),!e&&this._buffer||(e=e||this._data)&&(this._buffer?this._updatable&&(this._engine.updateDynamicVertexBuffer(this._buffer,e),this._data=e):this._updatable?(this._buffer=this._engine.createDynamicVertexBuffer(e,this._label),this._data=e):this._buffer=this._engine.createVertexBuffer(e,void 0,this._label))},e.prototype._rebuild=function(){if(this._data)this._buffer=null,this.create(this._data);else{if(!this._buffer)return;if(this._buffer.capacity>0)return void(this._updatable?this._buffer=this._engine.createDynamicVertexBuffer(this._buffer.capacity,this._label):this._buffer=this._engine.createVertexBuffer(this._buffer.capacity,void 0,this._label));i.V.Warn('Missing data for buffer "'.concat(this._label,'" ').concat(this._buffer?"(uniqueId: "+this._buffer.uniqueId+")":"",". Buffer reconstruction failed.")),this._buffer=null}},e.prototype.update=function(e){this.create(e)},e.prototype.updateDirectly=function(e,t,n,r){void 0===r&&(r=!1),this._buffer&&this._updatable&&(this._engine.updateDynamicVertexBuffer(this._buffer,e,r?t:t*Float32Array.BYTES_PER_ELEMENT,n?n*this.byteStride:void 0),this._data=0===t&&void 0===n?e:null)},e.prototype._increaseReferences=function(){this._buffer&&(this._isAlreadyOwned?this._buffer.references++:this._isAlreadyOwned=!0)},e.prototype.dispose=function(){this._buffer&&this._engine._releaseBuffer(this._buffer)&&(this._isDisposed=!0,this._data=null,this._buffer=null)},e}(),s=function(){function e(t,n,r,i,o,s,l,c,u,h,d,f,p,_){var m,g,v,y,b;void 0===d&&(d=!1),void 0===f&&(f=!1),void 0===p&&(p=1),void 0===_&&(_=!1),this._isDisposed=!1;var S=!1;if(this.engine=t,"object"==typeof i&&null!==i?(S=null!==(m=i.updatable)&&void 0!==m&&m,o=i.postponeInternalCreation,s=i.stride,l=i.instanced,c=i.offset,u=i.size,h=i.type,d=null!==(g=i.normalized)&&void 0!==g&&g,f=null!==(v=i.useBytes)&&void 0!==v&&v,p=null!==(y=i.divisor)&&void 0!==y?y:1,_=null!==(b=i.takeBufferOwnership)&&void 0!==b&&b,this._label=i.label):S=!!i,n instanceof a?(this._buffer=n,this._ownsBuffer=_):(this._buffer=new a(t,n,S,s,o,l,f,p,this._label),this._ownsBuffer=!0),this.uniqueId=e._Counter++,this._kind=r,void 0===h){var T=this.getData();this.type=T?e.GetDataType(T):e.FLOAT}else this.type=h;var E=e.GetTypeByteLength(this.type);f?(this._size=u||(s?s/E:e.DeduceStride(r)),this.byteStride=s||this._buffer.byteStride||this._size*E,this.byteOffset=c||0):(this._size=u||s||e.DeduceStride(r),this.byteStride=s?s*E:this._buffer.byteStride||this._size*E,this.byteOffset=(c||0)*E),this.normalized=d,this._instanced=void 0!==l&&l,this._instanceDivisor=l?p:0,this._alignBuffer(),this._computeHashCode()}return Object.defineProperty(e.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"instanceDivisor",{get:function(){return this._instanceDivisor},set:function(e){var t=0!=e;this._instanceDivisor=e,t!==this._instanced&&(this._instanced=t,this._computeHashCode())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_maxVerticesCount",{get:function(){var e=this.getData();return e?Array.isArray(e)?e.length/(this.byteStride/4)-this.byteOffset/4:(e.byteLength-this.byteOffset)/this.byteStride:0},enumerable:!1,configurable:!0}),e.prototype._computeHashCode=function(){this.hashCode=(this.type-5120|0)+((this.normalized?1:0)<<3)+(this._size<<4)+((this._instanced?1:0)<<6)+(this.byteStride<<12)},e.prototype._rebuild=function(){var e;null===(e=this._buffer)||void 0===e||e._rebuild()},e.prototype.getKind=function(){return this._kind},e.prototype.isUpdatable=function(){return this._buffer.isUpdatable()},e.prototype.getData=function(){return this._buffer.getData()},e.prototype.getFloatData=function(t,n){var r=this.getData();return r?e.GetFloatData(r,this._size,this.type,this.byteOffset,this.byteStride,this.normalized,t,n):null},e.prototype.getBuffer=function(){return this._buffer.getBuffer()},e.prototype.getWrapperBuffer=function(){return this._buffer},e.prototype.getStrideSize=function(){return this.byteStride/e.GetTypeByteLength(this.type)},e.prototype.getOffset=function(){return this.byteOffset/e.GetTypeByteLength(this.type)},e.prototype.getSize=function(t){return void 0===t&&(t=!1),t?this._size*e.GetTypeByteLength(this.type):this._size},e.prototype.getIsInstanced=function(){return this._instanced},e.prototype.getInstanceDivisor=function(){return this._instanceDivisor},e.prototype.create=function(e){this._buffer.create(e),this._alignBuffer()},e.prototype.update=function(e){this._buffer.update(e),this._alignBuffer()},e.prototype.updateDirectly=function(e,t,n){void 0===n&&(n=!1),this._buffer.updateDirectly(e,t,void 0,n),this._alignBuffer()},e.prototype.dispose=function(){this._ownsBuffer&&this._buffer.dispose(),this._isDisposed=!0},e.prototype.forEach=function(t,n){e.ForEach(this._buffer.getData(),this.byteOffset,this.byteStride,this._size,this.type,t,this.normalized,n)},e.prototype._alignBuffer=function(){},e.DeduceStride=function(t){switch(t){case e.UVKind:case e.UV2Kind:case e.UV3Kind:case e.UV4Kind:case e.UV5Kind:case e.UV6Kind:return 2;case e.NormalKind:case e.PositionKind:return 3;case e.ColorKind:case e.ColorInstanceKind:case e.MatricesIndicesKind:case e.MatricesIndicesExtraKind:case e.MatricesWeightsKind:case e.MatricesWeightsExtraKind:case e.TangentKind:return 4;default:throw new Error("Invalid kind '"+t+"'")}},e.GetDataType=function(t){return t instanceof Int8Array?e.BYTE:t instanceof Uint8Array?e.UNSIGNED_BYTE:t instanceof Int16Array?e.SHORT:t instanceof Uint16Array?e.UNSIGNED_SHORT:t instanceof Int32Array?e.INT:t instanceof Uint32Array?e.UNSIGNED_INT:e.FLOAT},e.GetTypeByteLength=function(t){switch(t){case e.BYTE:case e.UNSIGNED_BYTE:return 1;case e.SHORT:case e.UNSIGNED_SHORT:return 2;case e.INT:case e.UNSIGNED_INT:case e.FLOAT:return 4;default:throw new Error("Invalid type '".concat(t,"'"))}},e.ForEach=function(t,n,r,i,o,a,s,l){if(t instanceof Array)for(var c=n/4,u=r/4,h=0;h<a;h+=i){for(var d=0;d<i;d++)l(t[c+d],h+d);c+=u}else{var f=t instanceof ArrayBuffer?new DataView(t):new DataView(t.buffer,t.byteOffset,t.byteLength),p=e.GetTypeByteLength(o);for(h=0;h<a;h+=i){var _=n;for(d=0;d<i;d++)l(e._GetFloatValue(f,o,_,s),h+d),_+=p;n+=r}}},e._GetFloatValue=function(t,n,r,i){switch(n){case e.BYTE:var o=t.getInt8(r);return i&&(o=Math.max(o/127,-1)),o;case e.UNSIGNED_BYTE:return o=t.getUint8(r),i&&(o/=255),o;case e.SHORT:return o=t.getInt16(r,!0),i&&(o=Math.max(o/32767,-1)),o;case e.UNSIGNED_SHORT:return o=t.getUint16(r,!0),i&&(o/=65535),o;case e.INT:return t.getInt32(r,!0);case e.UNSIGNED_INT:return t.getUint32(r,!0);case e.FLOAT:return t.getFloat32(r,!0);default:throw new Error("Invalid component type ".concat(n))}},e.GetFloatData=function(t,n,r,o,a,s,l,c){var u=n*e.GetTypeByteLength(r),h=l*n;if(r!==e.FLOAT||a!==u){var d=new Float32Array(h);return e.ForEach(t,o,a,n,r,h,s,(function(e,t){return d[t]=e})),d}if(!(t instanceof Array||t instanceof Float32Array)||0!==o||t.length!==h){if(t instanceof Array){var f=o/4;return t.slice(f,f+h)}if(t instanceof ArrayBuffer)return new Float32Array(t,o,h);if(3&(f=t.byteOffset+o)&&(i.V.Warn("Float array must be aligned to 4-bytes border"),c=!0),c){var p=new Uint8Array(h*Float32Array.BYTES_PER_ELEMENT),_=new Uint8Array(t.buffer,f,p.length);return p.set(_),new Float32Array(p.buffer)}return new Float32Array(t.buffer,f,h)}return c?t.slice():t},e._Counter=0,e.BYTE=o.Y.BYTE,e.UNSIGNED_BYTE=o.Y.UNSIGNED_BYTE,e.SHORT=o.Y.SHORT,e.UNSIGNED_SHORT=o.Y.UNSIGNED_SHORT,e.INT=o.Y.INT,e.UNSIGNED_INT=o.Y.UNSIGNED_INT,e.FLOAT=o.Y.FLOAT,e.PositionKind=o.Y.PositionKind,e.NormalKind=o.Y.NormalKind,e.TangentKind=o.Y.TangentKind,e.UVKind=o.Y.UVKind,e.UV2Kind=o.Y.UV2Kind,e.UV3Kind=o.Y.UV3Kind,e.UV4Kind=o.Y.UV4Kind,e.UV5Kind=o.Y.UV5Kind,e.UV6Kind=o.Y.UV6Kind,e.ColorKind=o.Y.ColorKind,e.ColorInstanceKind=o.Y.ColorInstanceKind,e.MatricesIndicesKind=o.Y.MatricesIndicesKind,e.MatricesWeightsKind=o.Y.MatricesWeightsKind,e.MatricesIndicesExtraKind=o.Y.MatricesIndicesExtraKind,e.MatricesWeightsExtraKind=o.Y.MatricesWeightsExtraKind,e}()},37943:(e,t,n)=>{n.d(t,{n:()=>r});var r=function(){function e(){this.references=0,this.capacity=0,this.is32Bits=!1,this.uniqueId=e._Counter++}return Object.defineProperty(e.prototype,"underlyingResource",{get:function(){return null},enumerable:!1,configurable:!0}),e._Counter=0,e}()},1554:(e,t,n)=>{n.d(t,{K:()=>i});var r=n(81152),i=function(){function e(e,t,n,i){void 0===n&&(n=r.Y.BUFFER_CREATIONFLAG_READWRITE),this._engine=e,this._label=i,this._engine._storageBuffers.push(this),this._create(t,n)}return e.prototype._create=function(e,t){this._bufferSize=e,this._creationFlags=t,this._buffer=this._engine.createStorageBuffer(e,t,this._label)},e.prototype._rebuild=function(){this._create(this._bufferSize,this._creationFlags)},e.prototype.getBuffer=function(){return this._buffer},e.prototype.update=function(e,t,n){this._buffer&&this._engine.updateStorageBuffer(this._buffer,e,t,n)},e.prototype.read=function(e,t,n,r){return this._engine.readFromStorageBuffer(this._buffer,e,t,n,r)},e.prototype.dispose=function(){var e=this._engine._storageBuffers,t=e.indexOf(this);-1!==t&&(e[t]=e[e.length-1],e.pop()),this._engine._releaseBuffer(this._buffer),this._buffer=null},e}()},8004:(e,t,n)=>{n.d(t,{G:()=>o});var r=n(8046),i=n(62623),o=function(){function e(){this.hit=!1,this.distance=0,this.pickedPoint=null,this.pickedMesh=null,this.bu=0,this.bv=0,this.faceId=-1,this.subMeshFaceId=-1,this.subMeshId=0,this.pickedSprite=null,this.thinInstanceIndex=-1,this.ray=null,this.originMesh=null,this.aimTransform=null,this.gripTransform=null}return e.prototype.getNormal=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!0),!this.pickedMesh||t&&!this.pickedMesh.isVerticesDataPresent(i.R.NormalKind))return null;var n,o=this.pickedMesh.getIndices();0===(null==o?void 0:o.length)&&(o=null);var a=r.AA.Vector3[0],s=r.AA.Vector3[1],l=r.AA.Vector3[2];if(t){var c=this.pickedMesh.getVerticesData(i.R.NormalKind),u=o?r.Pq.FromArrayToRef(c,3*o[3*this.faceId],a):a.copyFromFloats(c[3*this.faceId*3],c[3*this.faceId*3+1],c[3*this.faceId*3+2]),h=o?r.Pq.FromArrayToRef(c,3*o[3*this.faceId+1],s):s.copyFromFloats(c[3*(3*this.faceId+1)],c[3*(3*this.faceId+1)+1],c[3*(3*this.faceId+1)+2]),d=o?r.Pq.FromArrayToRef(c,3*o[3*this.faceId+2],l):l.copyFromFloats(c[3*(3*this.faceId+2)],c[3*(3*this.faceId+2)+1],c[3*(3*this.faceId+2)+2]);u=u.scale(this.bu),h=h.scale(this.bv),d=d.scale(1-this.bu-this.bv),n=new r.Pq(u.x+h.x+d.x,u.y+h.y+d.y,u.z+h.z+d.z)}else{var f=this.pickedMesh.getVerticesData(i.R.PositionKind),p=o?r.Pq.FromArrayToRef(f,3*o[3*this.faceId],a):a.copyFromFloats(f[3*this.faceId*3],f[3*this.faceId*3+1],f[3*this.faceId*3+2]),_=o?r.Pq.FromArrayToRef(f,3*o[3*this.faceId+1],s):s.copyFromFloats(f[3*(3*this.faceId+1)],f[3*(3*this.faceId+1)+1],f[3*(3*this.faceId+1)+2]),m=o?r.Pq.FromArrayToRef(f,3*o[3*this.faceId+2],l):l.copyFromFloats(f[3*(3*this.faceId+2)],f[3*(3*this.faceId+2)+1],f[3*(3*this.faceId+2)+2]),g=p.subtract(_),v=m.subtract(_);n=r.Pq.Cross(g,v)}var y=function(e,t){var n=e.getWorldMatrix();e.nonUniformScaling&&(r.AA.Matrix[0].copyFrom(n),(n=r.AA.Matrix[0]).setTranslationFromFloats(0,0,0),n.invert(),n.transposeToRef(r.AA.Matrix[1]),n=r.AA.Matrix[1]),r.Pq.TransformNormalToRef(t,n,t)};if(e&&y(this.pickedMesh,n),this.ray){var b=r.AA.Vector3[0].copyFrom(n);e||y(this.pickedMesh,b),r.Pq.Dot(b,this.ray.direction)>0&&n.negateInPlace()}return n.normalize(),n},e.prototype.getTextureCoordinates=function(e){if(void 0===e&&(e=i.R.UVKind),!this.pickedMesh||!this.pickedMesh.isVerticesDataPresent(e))return null;var t=this.pickedMesh.getIndices();if(!t)return null;var n=this.pickedMesh.getVerticesData(e);if(!n)return null;var o=r.I9.FromArray(n,2*t[3*this.faceId]),a=r.I9.FromArray(n,2*t[3*this.faceId+1]),s=r.I9.FromArray(n,2*t[3*this.faceId+2]);return o=o.scale(this.bu),a=a.scale(this.bv),s=s.scale(1-this.bu-this.bv),new r.I9(o.x+a.x+s.x,o.y+a.y+s.y)},e}()},51956:(e,t,n)=>{n.d(t,{p9:()=>i,rX:()=>r});var r=!1,i={get UseOpenGLOrientationForUV(){return r},set UseOpenGLOrientationForUV(e){r=e}}},75227:(e,t,n)=>{n.d(t,{H:()=>d});var r=n(78322),i=n(6174),o=n(12028),a=n(34623),s=n(50582),l=n(62273),c=n(7164),u=n(55204),h=n(37411),d=function(){function e(e,t,n,i){void 0===i&&(i={}),this._bindings={},this._samplers={},this._contextIsDirty=!1,this.fastMode=!1,this.onCompiled=null,this.onError=null,this.name=e,this._engine=t,this.uniqueId=l.K.UniqueId,t.enableGPUTimingMeasurements&&(this.gpuTimeInFrame=new h.e),this._engine.getCaps().supportComputeShaders?i.bindingsMapping?(this._context=t.createComputeContext(),this._shaderPath=n,this._options=(0,r.Cl)({bindingsMapping:{},defines:[]},i)):c.V.Error("You must provide the binding mappings as browsers don't support reflection for wgsl shaders yet!"):c.V.Error("This engine does not support compute shaders!")}return Object.defineProperty(e.prototype,"options",{get:function(){return this._options},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shaderPath",{get:function(){return this._shaderPath},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"ComputeShader"},e.prototype.setTexture=function(e,t,n){void 0===n&&(n=!0);var r=this._bindings[e];this._bindings[e]={type:n?0:4,object:t,indexInGroupEntries:null==r?void 0:r.indexInGroupEntries},this._contextIsDirty||(this._contextIsDirty=!r||r.object!==t||r.type!==this._bindings[e].type)},e.prototype.setStorageTexture=function(e,t){var n=this._bindings[e];this._contextIsDirty||(this._contextIsDirty=!n||n.object!==t),this._bindings[e]={type:1,object:t,indexInGroupEntries:null==n?void 0:n.indexInGroupEntries}},e.prototype.setExternalTexture=function(e,t){var n=this._bindings[e];this._contextIsDirty||(this._contextIsDirty=!n||n.object!==t),this._bindings[e]={type:6,object:t,indexInGroupEntries:null==n?void 0:n.indexInGroupEntries}},e.prototype.setVideoTexture=function(e,t){return!!t.externalTexture&&(this.setExternalTexture(e,t.externalTexture),!0)},e.prototype.setUniformBuffer=function(t,n){var r=this._bindings[t];this._contextIsDirty||(this._contextIsDirty=!r||r.object!==n),this._bindings[t]={type:e._BufferIsDataBuffer(n)?7:2,object:n,indexInGroupEntries:null==r?void 0:r.indexInGroupEntries}},e.prototype.setStorageBuffer=function(t,n){var r=this._bindings[t];this._contextIsDirty||(this._contextIsDirty=!r||r.object!==n),this._bindings[t]={type:e._BufferIsDataBuffer(n)?7:3,object:n,indexInGroupEntries:null==r?void 0:r.indexInGroupEntries}},e.prototype.setTextureSampler=function(e,t){var n=this._bindings[e];this._contextIsDirty||(this._contextIsDirty=!n||!t.compareSampler(n.object)),this._bindings[e]={type:5,object:t,indexInGroupEntries:null==n?void 0:n.indexInGroupEntries}},e.prototype.isReady=function(){var e=this._effect;for(var t in this._bindings){var n=this._bindings[t],r=n.type,i=n.object;switch(r){case 0:case 4:case 1:case 6:if(!i.isReady())return!1}}var o=[],a=this._shaderPath;if(this._options.defines)for(var s=0;s<this._options.defines.length;s++)o.push(this._options.defines[s]);var l=o.join("\n");return this._cachedDefines!==l&&(this._cachedDefines=l,e=this._engine.createComputeEffect(a,{defines:l,entryPoint:this._options.entryPoint,onCompiled:this.onCompiled,onError:this.onError}),this._effect=e),!!e.isReady()},e.prototype.dispatch=function(e,t,n){return!(!this.fastMode&&!this._checkContext()||(this._engine.computeDispatch(this._effect,this._context,this._bindings,e,t,n,this._options.bindingsMapping,this.gpuTimeInFrame),0))},e.prototype.dispatchIndirect=function(t,n){if(void 0===n&&(n=0),!this.fastMode&&!this._checkContext())return!1;var r=e._BufferIsDataBuffer(t)?t:t.getBuffer();return this._engine.computeDispatchIndirect(this._effect,this._context,this._bindings,r,n,this._options.bindingsMapping,this.gpuTimeInFrame),!0},e.prototype._checkContext=function(){var e;if(!this.isReady())return!1;for(var t in this._bindings){var n=this._bindings[t];if(!this._options.bindingsMapping[t])throw new Error("ComputeShader ('"+this.name+"'): No binding mapping has been provided for the property '"+t+"'");switch(n.type){case 0:var r=this._samplers[t],i=n.object;r&&i._texture&&r.compareSampler(i._texture)||(this._samplers[t]=(new u.u).setParameters(i.wrapU,i.wrapV,i.wrapR,i.anisotropicFilteringLevel,i._texture.samplingMode,null===(e=i._texture)||void 0===e?void 0:e._comparisonFunction),this._contextIsDirty=!0);break;case 6:this._contextIsDirty=!0;break;case 2:var o=n.object;o.getBuffer()!==n.buffer&&(n.buffer=o.getBuffer(),this._contextIsDirty=!0)}}return this._contextIsDirty&&(this._contextIsDirty=!1,this._context.clear()),!0},e.prototype.dispatchWhenReady=function(e,t,n,r){var i=this;return void 0===r&&(r=10),new Promise((function(o){var a=function(){i.dispatch(e,t,n)?o():setTimeout(a,r)};a()}))},e.prototype.serialize=function(){var e=o.p.Serialize(this);for(var t in e.options=this._options,e.shaderPath=this._shaderPath,e.bindings={},e.textures={},this._bindings){var n=this._bindings[t],r=n.object;switch(n.type){case 0:case 4:case 1:var i=r.serialize();i&&(e.textures[t]=i,e.bindings[t]={type:n.type})}}return e},e.Parse=function(t,n,r){var i=o.p.Parse((function(){return new e(t.name,n.getEngine(),t.shaderPath,t.options)}),t,n,r);for(var a in t.textures){var l=t.bindings[a],c=s.g.Parse(t.textures[a],n,r);0===l.type?i.setTexture(a,c):4===l.type?i.setTexture(a,c,!1):i.setStorageTexture(a,c)}return i},e._BufferIsDataBuffer=function(e){return void 0!==e.underlyingResource},(0,r.Cg)([(0,i.lK)()],e.prototype,"name",void 0),(0,r.Cg)([(0,i.lK)()],e.prototype,"fastMode",void 0),e}();(0,a.Y5)("BABYLON.ComputeShader",d)},18149:(e,t,n)=>{n.r(t),n.d(t,{ComputeShaderBoundingHelper:()=>c});var r=n(78322),i=n(75227),o=n(1554),a=n(62623),s=n(8046),l=n(75482);n(98519).l.ShadersStoreWGSL.boundingInfoComputeShader="struct Results {minX : atomic<i32>,\nminY : atomic<i32>,\nminZ : atomic<i32>,\nmaxX : atomic<i32>,\nmaxY : atomic<i32>,\nmaxZ : atomic<i32>,\ndummy1 : i32,\ndummy2 : i32,};fn floatToBits(value: f32)->i32 {return bitcast<i32>(value);}\nfn bitsToFloat(value: i32)->f32 {return bitcast<f32>(value);}\nfn atomicMinFloat(atomicVar: ptr<storage,atomic<i32>,read_write>,value: f32) {let intValue=floatToBits(value);loop {let oldIntValue=atomicLoad(atomicVar);let oldValue=bitsToFloat(oldIntValue);if (value>=oldValue) {break;}\nif (atomicCompareExchangeWeak(atomicVar,oldIntValue,intValue).old_value==oldIntValue) {break;}}}\nfn atomicMaxFloat(atomicVar: ptr<storage,atomic<i32>,read_write>,value: f32) {let intValue=floatToBits(value);loop {let oldIntValue=atomicLoad(atomicVar);let oldValue=bitsToFloat(oldIntValue);if (value<=oldValue) {break;}\nif (atomicCompareExchangeWeak(atomicVar,oldIntValue,intValue).old_value==oldIntValue) {break;}}}\nfn readMatrixFromRawSampler(smp : texture_2d<f32>,index : f32)->mat4x4<f32>\n{let offset=i32(index) *4; \nlet m0=textureLoad(smp,vec2<i32>(offset+0,0),0);let m1=textureLoad(smp,vec2<i32>(offset+1,0),0);let m2=textureLoad(smp,vec2<i32>(offset+2,0),0);let m3=textureLoad(smp,vec2<i32>(offset+3,0),0);return mat4x4<f32>(m0,m1,m2,m3);}\nconst identity=mat4x4f(\nvec4f(1.0,0.0,0.0,0.0),\nvec4f(0.0,1.0,0.0,0.0),\nvec4f(0.0,0.0,1.0,0.0),\nvec4f(0.0,0.0,0.0,1.0)\n);struct Settings {morphTargetTextureInfo: vec3f,\nmorphTargetCount: i32,\nindexResult : u32,};@group(0) @binding(0) var<storage,read> positionBuffer : array<f32>;@group(0) @binding(1) var<storage,read_write> resultBuffer : array<Results>;@group(0) @binding(7) var<uniform> settings : Settings;\n#if NUM_BONE_INFLUENCERS>0\n@group(0) @binding(2) var boneSampler : texture_2d<f32>;@group(0) @binding(3) var<storage,read> indexBuffer : array<vec4f>;@group(0) @binding(4) var<storage,read> weightBuffer : array<vec4f>;\n#if NUM_BONE_INFLUENCERS>4\n@group(0) @binding(5) var<storage,read> indexExtraBuffer : array<vec4f>;@group(0) @binding(6) var<storage,read> weightExtraBuffer : array<vec4f>;\n#endif\n#endif\n#ifdef MORPHTARGETS\n@group(0) @binding(8) var morphTargets : texture_2d_array<f32>;@group(0) @binding(9) var<storage,read> morphTargetInfluences : array<f32>;@group(0) @binding(10) var<storage,read> morphTargetTextureIndices : array<f32>;\n#endif\n#ifdef MORPHTARGETS\nfn readVector3FromRawSampler(targetIndex : i32,vertexIndex : u32)->vec3f\n{ \nlet vertexID=f32(vertexIndex)*settings.morphTargetTextureInfo.x;let y=floor(vertexID/settings.morphTargetTextureInfo.y);let x=vertexID-y*settings.morphTargetTextureInfo.y;let textureUV=vec2<i32>(i32(x),i32(y));return textureLoad(morphTargets,textureUV,i32(morphTargetTextureIndices[targetIndex]),0).xyz;}\n#endif\n@compute @workgroup_size(256,1,1)\nfn main(@builtin(global_invocation_id) global_id : vec3<u32>) {let index=global_id.x;if (index>=arrayLength(&positionBuffer)/3) {return;}\nlet position=vec3f(positionBuffer[index*3],positionBuffer[index*3+1],positionBuffer[index*3+2]);var finalWorld=identity;var positionUpdated=position;\n#if NUM_BONE_INFLUENCERS>0\nvar influence : mat4x4<f32>;let matricesIndices=indexBuffer[index];let matricesWeights=weightBuffer[index];influence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1];\n#endif \n#if NUM_BONE_INFLUENCERS>2\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2];\n#endif \n#if NUM_BONE_INFLUENCERS>3\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3];\n#endif \n#if NUM_BONE_INFLUENCERS>4\nlet matricesIndicesExtra=indexExtraBuffer[index];let matricesWeightsExtra=weightExtraBuffer[index];influence=influence+readMatrixFromRawSampler(boneSampler,matricesIndicesExtra.x)*matricesWeightsExtra.x;\n#if NUM_BONE_INFLUENCERS>5\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndicesExtra.y)*matricesWeightsExtra.y;\n#endif \n#if NUM_BONE_INFLUENCERS>6\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndicesExtra.z)*matricesWeightsExtra.z;\n#endif \n#if NUM_BONE_INFLUENCERS>7\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndicesExtra.w)*matricesWeightsExtra.w;\n#endif \n#endif \nfinalWorld=finalWorld*influence;\n#endif\n#ifdef MORPHTARGETS\nfor (var i=0; i<NUM_MORPH_INFLUENCERS; i=i+1) {if (i>=settings.morphTargetCount) {break;}\npositionUpdated=positionUpdated+(readVector3FromRawSampler(i,index)-position)*morphTargetInfluences[i];}\n#endif\nvar worldPos=finalWorld*vec4f(positionUpdated.x,positionUpdated.y,positionUpdated.z,1.0);atomicMinFloat(&resultBuffer[settings.indexResult].minX,worldPos.x);atomicMinFloat(&resultBuffer[settings.indexResult].minY,worldPos.y);atomicMinFloat(&resultBuffer[settings.indexResult].minZ,worldPos.z);atomicMaxFloat(&resultBuffer[settings.indexResult].maxX,worldPos.x);atomicMaxFloat(&resultBuffer[settings.indexResult].maxY,worldPos.y);atomicMaxFloat(&resultBuffer[settings.indexResult].maxZ,worldPos.z);}\n";var c=function(){function e(e){this._computeShadersCache={},this._positionBuffers={},this._indexBuffers={},this._weightBuffers={},this._indexExtraBuffers={},this._weightExtraBuffers={},this._morphTargetInfluenceBuffers={},this._morphTargetTextureIndexBuffers={},this._ubos=[],this._uboIndex=0,this._processedMeshes=[],this._computeShaders=[],this._uniqueComputeShaders=new Set,this._resultBuffers=[],this._engine=e}return e.prototype._getComputeShader=function(e,t,n){var r,o=e.join("\n");if(this._computeShadersCache[o])r=this._computeShadersCache[o];else{var a={positionBuffer:{group:0,binding:0},resultBuffer:{group:0,binding:1},settings:{group:0,binding:7}};t&&(a.boneSampler={group:0,binding:2},a.indexBuffer={group:0,binding:3},a.weightBuffer={group:0,binding:4},a.indexExtraBuffer={group:0,binding:5},a.weightExtraBuffer={group:0,binding:6}),n&&(a.morphTargets={group:0,binding:8},a.morphTargetInfluences={group:0,binding:9},a.morphTargetTextureIndices={group:0,binding:10}),r=new i.H("boundingInfoCompute".concat(t?"_bones":"").concat(n?"_morphs":""),this._engine,"boundingInfo",{bindingsMapping:a,defines:e}),this._computeShadersCache[o]=r}return r},e.prototype._getUBO=function(){if(this._uboIndex>=this._ubos.length){var e=new l.D(this._engine);e.addFloat3("morphTargetTextureInfo",0,0,0),e.addUniform("morphTargetCount",1),e.addUniform("indexResult",1),this._ubos.push(e)}return this._ubos[this._uboIndex++]},e.prototype._extractDataAndLink=function(e,t,n,r,i,a){var s,l,c=t.getTotalVertices();if(a[t.uniqueId])l=a[t.uniqueId];else{var u=null===(s=t.getVertexBuffer(n))||void 0===s?void 0:s.getFloatData(c);(l=new o.K(this._engine,Float32Array.BYTES_PER_ELEMENT*c*r)).update(u),a[t.uniqueId]=l}e.setStorageBuffer(i,l)},e.prototype._prepareStorage=function(e,t,n,r,i,a){var s;r[n]?s=r[n]:(s=new o.K(this._engine,Float32Array.BYTES_PER_ELEMENT*i),r[n]=s),s.update(a),e.setStorageBuffer(t,s)},e.prototype.processAsync=function(e){return(0,r.sH)(this,void 0,void 0,(function(){return(0,r.YH)(this,(function(t){switch(t.label){case 0:return[4,this.registerMeshListAsync(e)];case 1:return t.sent(),this.processMeshList(),[4,this.fetchResultsForMeshListAsync()];case 2:return t.sent(),[2]}}))}))},e.prototype.registerMeshListAsync=function(e){var t=this;this._disposeForMeshList(),Array.isArray(e)||(e=[e]);for(var n=0,r=0;r<e.length;r++)0!==(i=e[r]).getTotalVertices()&&i.getVertexBuffer&&i.getVertexBuffer(a.R.PositionKind)&&(this._processedMeshes.push(i),(l=i.morphTargetManager)&&(n=Math.max(n,l.numTargets)));for(r=0;r<this._processedMeshes.length;r++){var i,o=[""],s=!1;(i=this._processedMeshes[r])&&i.useBones&&i.computeBonesUsingShaders&&i.skeleton&&(o.push("#define NUM_BONE_INFLUENCERS "+i.numBoneInfluencers),s=!0);var l,c=this._getComputeShader(o,s,!1);if(this._uniqueComputeShaders.add(c),l=i.morphTargetManager){(o=o.slice()).push("#define MORPHTARGETS"),o.push("#define NUM_MORPH_INFLUENCERS "+n);var u=this._getComputeShader(o,s,!0);this._uniqueComputeShaders.add(u),this._computeShaders.push([c,u])}else this._computeShaders.push([c,c]);var h=this._getUBO();h.updateUInt("indexResult",r),h.update()}return new Promise((function(e){var n=function(){for(var r=t._uniqueComputeShaders.keys(),i=r.next();!0!==i.done;i=r.next())if(!i.value.isReady())return void setTimeout(n,10);e()};n()}))},e.prototype.processMeshList=function(){if(0!==this._processedMeshes.length){this._uboIndex=0;var e=8*this._processedMeshes.length,t=new Float32Array(e),n=new o.K(this._engine,Float32Array.BYTES_PER_ELEMENT*e);this._resultBuffers.push(n);for(var r=0;r<this._processedMeshes.length;r++)t[8*r+0]=Number.POSITIVE_INFINITY,t[8*r+1]=Number.POSITIVE_INFINITY,t[8*r+2]=Number.POSITIVE_INFINITY,t[8*r+3]=Number.NEGATIVE_INFINITY,t[8*r+4]=Number.NEGATIVE_INFINITY,t[8*r+5]=Number.NEGATIVE_INFINITY;for(n.update(t),r=0;r<this._processedMeshes.length;r++){var i=this._processedMeshes[r],s=i.getTotalVertices(),l=this._computeShaders[r],c=l[0],u=l[1],h=i.morphTargetManager,d=h&&h.numInfluencers>0,f=d?u:c;if(this._extractDataAndLink(f,i,a.R.PositionKind,3,"positionBuffer",this._positionBuffers),i&&i.useBones&&i.computeBonesUsingShaders&&i.skeleton&&i.skeleton.useTextureToStoreBoneMatrices){this._extractDataAndLink(f,i,a.R.MatricesIndicesKind,4,"indexBuffer",this._indexBuffers),this._extractDataAndLink(f,i,a.R.MatricesWeightsKind,4,"weightBuffer",this._weightBuffers);var p=i.skeleton.getTransformMatrixTexture(i);f.setTexture("boneSampler",p,!1),i.numBoneInfluencers>4&&(this._extractDataAndLink(f,i,a.R.MatricesIndicesExtraKind,4,"indexExtraBuffer",this._indexExtraBuffers),this._extractDataAndLink(f,i,a.R.MatricesWeightsExtraKind,4,"weightExtraBuffer",this._weightExtraBuffers))}var _=this._getUBO();if(d){var m=h._targetStoreTexture;f.setTexture("morphTargets",m,!1),this._prepareStorage(f,"morphTargetInfluences",i.uniqueId,this._morphTargetInfluenceBuffers,h.numInfluencers,h.influences),this._prepareStorage(f,"morphTargetTextureIndices",i.uniqueId,this._morphTargetTextureIndexBuffers,h.numInfluencers,h._morphTargetTextureIndices),_.updateFloat3("morphTargetTextureInfo",h._textureVertexStride,h._textureWidth,h._textureHeight),_.updateInt("morphTargetCount",h.numInfluencers),_.update()}f.setStorageBuffer("resultBuffer",n),f.setUniformBuffer("settings",_),f.dispatch(Math.ceil(s/256)),this._engine.flushFramebuffer()}}},e.prototype.fetchResultsForMeshListAsync=function(){var e=this;return new Promise((function(t){for(var n=[],r=0,i=0;i<e._resultBuffers.length;i++){var o=e._resultBuffers[i].getBuffer();n.push(o),r+=o.capacity}var a=new Float32Array(r/Float32Array.BYTES_PER_ELEMENT),l=s.Pq.Zero(),c=s.Pq.Zero(),u={minimum:l,maximum:c};e._engine.readFromMultipleStorageBuffers(n,0,void 0,a,!0).then((function(){for(var n=0,r=0;r<e._resultBuffers.length;r++){for(var i=0;i<e._processedMeshes.length;i++){var o=e._processedMeshes[i];s.Pq.FromArrayToRef(a,n+8*i,l),s.Pq.FromArrayToRef(a,n+8*i+3,c),r>0&&(l.minimizeInPlace(o.getBoundingInfo().minimum),c.maximizeInPlace(o.getBoundingInfo().maximum)),o._refreshBoundingInfoDirect(u)}n+=8*e._processedMeshes.length}for(var h=0,d=e._resultBuffers;h<d.length;h++)d[h].dispose();e._resultBuffers=[],e._uboIndex=0,t()}))}))},e.prototype._disposeCache=function(e){for(var t in e)e[t].dispose()},e.prototype._disposeForMeshList=function(){for(var e=0,t=this._resultBuffers;e<t.length;e++)t[e].dispose();this._resultBuffers=[],this._processedMeshes=[],this._computeShaders=[],this._uniqueComputeShaders=new Set},e.prototype.dispose=function(){this._disposeCache(this._positionBuffers),this._positionBuffers={},this._disposeCache(this._indexBuffers),this._indexBuffers={},this._disposeCache(this._weightBuffers),this._weightBuffers={},this._disposeCache(this._morphTargetInfluenceBuffers),this._morphTargetInfluenceBuffers={},this._disposeCache(this._morphTargetTextureIndexBuffers),this._morphTargetTextureIndexBuffers={};for(var e=0,t=this._ubos;e<t.length;e++)t[e].dispose();this._ubos=[],this._computeShadersCache={},this._engine=void 0,this._disposeForMeshList()},e}()},37904:(e,t,n)=>{n.r(t),n.d(t,{TransformFeedbackBoundingHelper:()=>u});var r=n(62623),i=n(81152),o=n(85096),a=n(47424),s=n(8046),l=n(98519),c=(n(36470),n(64400),n(24444),n(67369),n(58266),n(84589),n(76898),n(49334),"gpuTransformVertexShader");l.l.ShadersStore[c]="attribute vec3 position;\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\nout vec3 outPosition;const mat4 identity=mat4(\nvec4(1.0,0.0,0.0,0.0),\nvec4(0.0,1.0,0.0,0.0),\nvec4(0.0,0.0,1.0,0.0),\nvec4(0.0,0.0,0.0,1.0)\n);void main(void) {vec3 positionUpdated=position;\n#include<morphTargetsVertexGlobal>\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\nmat4 finalWorld=identity;\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);outPosition=worldPos.xyz;}";l.l.ShadersStore.gpuTransformPixelShader="#version 300 es\nvoid main() {discard;}\n";var u=function(){function e(e){this._buffers={},this._effects={},this._meshListCounter=0,this._engine=e}return e.prototype.processAsync=function(e){return Array.isArray(e)||(e=[e]),this._meshListCounter=0,this._processMeshList(e),Promise.resolve()},e.prototype._processMeshList=function(e){var t=this._engine.getCaps().parallelShaderCompile;this._engine.getCaps().parallelShaderCompile=void 0;for(var n=0;n<e.length;++n){var i=e[n];if(0!==i.getTotalVertices()&&i.getVertexBuffer&&i.getVertexBuffer(r.R.PositionKind)){var a=void 0,s=0,l=[],c=[],u=[r.R.PositionKind],h=[];if(i&&i.useBones&&i.computeBonesUsingShaders&&i.skeleton){u.push(r.R.MatricesIndicesKind),u.push(r.R.MatricesWeightsKind),i.numBoneInfluencers>4&&(u.push(r.R.MatricesIndicesExtraKind),u.push(r.R.MatricesWeightsExtraKind));var d=i.skeleton;l.push("#define NUM_BONE_INFLUENCERS "+i.numBoneInfluencers),d.isUsingTextureForMatrices?(l.push("#define BONETEXTURE"),-1===c.indexOf("boneTextureWidth")&&c.push("boneTextureWidth"),-1===h.indexOf("boneSampler")&&h.push("boneSampler")):(l.push("#define BonesPerMesh "+(d.bones.length+1)),-1===c.indexOf("mBones")&&c.push("mBones"))}else l.push("#define NUM_BONE_INFLUENCERS 0");var f=i?i.morphTargetManager:null;if(f){(s=f.numMaxInfluencers||f.numInfluencers)>0&&l.push("#define MORPHTARGETS"),f.isUsingTextureForTargets&&(l.push("#define MORPHTARGETS_TEXTURE"),-1===c.indexOf("morphTargetTextureIndices")&&c.push("morphTargetTextureIndices"),-1===h.indexOf("morphTargets")&&h.push("morphTargets")),l.push("#define NUM_MORPH_INFLUENCERS "+s);for(var p=0;p<s;p++)u.push(r.R.PositionKind+p);s>0&&((c=c.slice()).push("morphTargetInfluences"),c.push("morphTargetCount"),c.push("morphTargetTextureInfo"),c.push("morphTargetTextureIndices"))}var _=i.bakedVertexAnimationManager;_&&_.isEnabled&&(l.push("#define BAKED_VERTEX_ANIMATION_TEXTURE"),-1===c.indexOf("bakedVertexAnimationSettings")&&c.push("bakedVertexAnimationSettings"),-1===c.indexOf("bakedVertexAnimationTextureSizeInverted")&&c.push("bakedVertexAnimationTextureSizeInverted"),-1===c.indexOf("bakedVertexAnimationTime")&&c.push("bakedVertexAnimationTime"),-1===h.indexOf("bakedVertexAnimationTexture")&&h.push("bakedVertexAnimationTexture"),(0,o.J2)(u,i,l));var m=l.join("\n");if(this._effects[m])a=this._effects[m];else{var g={attributes:u,uniformsNames:c,uniformBuffersNames:[],samplers:h,defines:m,fallbacks:null,onCompiled:null,onError:null,indexParameters:{maxSimultaneousMorphTargets:s},maxSimultaneousLights:0,transformFeedbackVaryings:["outPosition"]};a=this._engine.createEffect("gpuTransform",g,this._engine),this._effects[m]=a}this._compute(i,a)}}this._engine.getCaps().parallelShaderCompile=t},e.prototype._compute=function(t,n){var s,l,c=this._engine,u=t.getTotalVertices();if(this._buffers[t.uniqueId])l=this._buffers[t.uniqueId];else{var h=new Float32Array(3*u);l=new r.h(t.getEngine(),h,!0,3),this._buffers[t.uniqueId]=l}n.getEngine().enableEffect(n),t._bindDirect(n,null,!0),(0,o.f$)(t,n);var d=t.morphTargetManager;d&&d.numInfluencers>0&&(0,o.nR)(t,n);var f=t.bakedVertexAnimationManager;f&&f.isEnabled&&(null===(s=t.bakedVertexAnimationManager)||void 0===s||s.bind(n,!1));var p=l.getData();if(c.bindTransformFeedbackBuffer(l.getBuffer()),c.setRasterizerState(!1),c.beginTransformFeedback(!0),c.drawArraysType(i.Y.MATERIAL_PointFillMode,0,u),c.endTransformFeedback(),c.setRasterizerState(!0),c.readTransformFeedbackBuffer(p),c.bindTransformFeedbackBuffer(null),0===this._meshListCounter)t._refreshBoundingInfo(p,null);else{var _=t.getBoundingInfo().boundingBox,m=(0,a.b)(p,0,u);e._Min.copyFrom(_.minimum).minimizeInPlace(m.minimum),e._Max.copyFrom(_.maximum).maximizeInPlace(m.maximum),t._refreshBoundingInfoDirect({minimum:e._Min,maximum:e._Max})}},e.prototype.registerMeshListAsync=function(e){return Array.isArray(e)||(e=[e]),this._meshList=e,this._meshListCounter=0,Promise.resolve()},e.prototype.processMeshList=function(){0!==this._meshList.length&&(this._processMeshList(this._meshList),this._meshListCounter++)},e.prototype.fetchResultsForMeshListAsync=function(){return this._meshListCounter=0,Promise.resolve()},e.prototype.dispose=function(){for(var e in this._buffers)this._buffers[e].dispose();this._buffers={},this._effects={},this._engine=null},e._Min=new s.Pq,e._Max=new s.Pq,e}()},45158:(e,t,n)=>{var r,i,o,a,s,l,c;n.d(t,{ST:()=>i,Ze:()=>o,bq:()=>r,dR:()=>c,h8:()=>a,pI:()=>s,sZ:()=>l}),function(e){e[e.Generic=0]="Generic",e[e.Keyboard=1]="Keyboard",e[e.Mouse=2]="Mouse",e[e.Touch=3]="Touch",e[e.DualShock=4]="DualShock",e[e.Xbox=5]="Xbox",e[e.Switch=6]="Switch",e[e.DualSense=7]="DualSense"}(r||(r={})),function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e[e.LeftClick=2]="LeftClick",e[e.MiddleClick=3]="MiddleClick",e[e.RightClick=4]="RightClick",e[e.BrowserBack=5]="BrowserBack",e[e.BrowserForward=6]="BrowserForward",e[e.MouseWheelX=7]="MouseWheelX",e[e.MouseWheelY=8]="MouseWheelY",e[e.MouseWheelZ=9]="MouseWheelZ",e[e.Move=12]="Move"}(i||(i={})),function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e[e.LeftClick=2]="LeftClick",e[e.MiddleClick=3]="MiddleClick",e[e.RightClick=4]="RightClick",e[e.BrowserBack=5]="BrowserBack",e[e.BrowserForward=6]="BrowserForward",e[e.MouseWheelX=7]="MouseWheelX",e[e.MouseWheelY=8]="MouseWheelY",e[e.MouseWheelZ=9]="MouseWheelZ",e[e.DeltaHorizontal=10]="DeltaHorizontal",e[e.DeltaVertical=11]="DeltaVertical"}(o||(o={})),function(e){e[e.Cross=0]="Cross",e[e.Circle=1]="Circle",e[e.Square=2]="Square",e[e.Triangle=3]="Triangle",e[e.L1=4]="L1",e[e.R1=5]="R1",e[e.L2=6]="L2",e[e.R2=7]="R2",e[e.Share=8]="Share",e[e.Options=9]="Options",e[e.L3=10]="L3",e[e.R3=11]="R3",e[e.DPadUp=12]="DPadUp",e[e.DPadDown=13]="DPadDown",e[e.DPadLeft=14]="DPadLeft",e[e.DPadRight=15]="DPadRight",e[e.Home=16]="Home",e[e.TouchPad=17]="TouchPad",e[e.LStickXAxis=18]="LStickXAxis",e[e.LStickYAxis=19]="LStickYAxis",e[e.RStickXAxis=20]="RStickXAxis",e[e.RStickYAxis=21]="RStickYAxis"}(a||(a={})),function(e){e[e.Cross=0]="Cross",e[e.Circle=1]="Circle",e[e.Square=2]="Square",e[e.Triangle=3]="Triangle",e[e.L1=4]="L1",e[e.R1=5]="R1",e[e.L2=6]="L2",e[e.R2=7]="R2",e[e.Create=8]="Create",e[e.Options=9]="Options",e[e.L3=10]="L3",e[e.R3=11]="R3",e[e.DPadUp=12]="DPadUp",e[e.DPadDown=13]="DPadDown",e[e.DPadLeft=14]="DPadLeft",e[e.DPadRight=15]="DPadRight",e[e.Home=16]="Home",e[e.TouchPad=17]="TouchPad",e[e.LStickXAxis=18]="LStickXAxis",e[e.LStickYAxis=19]="LStickYAxis",e[e.RStickXAxis=20]="RStickXAxis",e[e.RStickYAxis=21]="RStickYAxis"}(s||(s={})),function(e){e[e.A=0]="A",e[e.B=1]="B",e[e.X=2]="X",e[e.Y=3]="Y",e[e.LB=4]="LB",e[e.RB=5]="RB",e[e.LT=6]="LT",e[e.RT=7]="RT",e[e.Back=8]="Back",e[e.Start=9]="Start",e[e.LS=10]="LS",e[e.RS=11]="RS",e[e.DPadUp=12]="DPadUp",e[e.DPadDown=13]="DPadDown",e[e.DPadLeft=14]="DPadLeft",e[e.DPadRight=15]="DPadRight",e[e.Home=16]="Home",e[e.LStickXAxis=17]="LStickXAxis",e[e.LStickYAxis=18]="LStickYAxis",e[e.RStickXAxis=19]="RStickXAxis",e[e.RStickYAxis=20]="RStickYAxis"}(l||(l={})),function(e){e[e.B=0]="B",e[e.A=1]="A",e[e.Y=2]="Y",e[e.X=3]="X",e[e.L=4]="L",e[e.R=5]="R",e[e.ZL=6]="ZL",e[e.ZR=7]="ZR",e[e.Minus=8]="Minus",e[e.Plus=9]="Plus",e[e.LS=10]="LS",e[e.RS=11]="RS",e[e.DPadUp=12]="DPadUp",e[e.DPadDown=13]="DPadDown",e[e.DPadLeft=14]="DPadLeft",e[e.DPadRight=15]="DPadRight",e[e.Home=16]="Home",e[e.Capture=17]="Capture",e[e.LStickXAxis=18]="LStickXAxis",e[e.LStickYAxis=19]="LStickYAxis",e[e.RStickXAxis=20]="RStickXAxis",e[e.RStickYAxis=21]="RStickYAxis"}(c||(c={}))},84163:(e,t,n)=>{n.d(t,{c:()=>i});var r=n(66377),i=function(){function e(e,t,n){void 0===n&&(n=0),this.deviceType=t,this.deviceSlot=n,this.onInputChangedObservable=new r.cP,this._deviceInputSystem=e}return e.prototype.getInput=function(e){return this._deviceInputSystem.pollInput(this.deviceType,this.deviceSlot,e)},e}()},67925:(e,t,n)=>{n.d(t,{Z:()=>_});var r=n(45158),i=n(66377),o=n(81152),a=n(50712),s=function(){function e(){}return e.CreateDeviceEvent=function(e,t,n,i,o,a,s){switch(e){case r.bq.Keyboard:return this._CreateKeyboardEvent(n,i,o,a);case r.bq.Mouse:if(n===r.ST.MouseWheelX||n===r.ST.MouseWheelY||n===r.ST.MouseWheelZ)return this._CreateWheelEvent(e,t,n,i,o,a);case r.bq.Touch:return this._CreatePointerEvent(e,t,n,i,o,a,s);default:throw"Unable to generate event for device ".concat(r.bq[e])}},e._CreatePointerEvent=function(e,t,n,i,o,a,s){var l=this._CreateMouseEvent(e,t,n,i,o,a);e===r.bq.Mouse?(l.deviceType=r.bq.Mouse,l.pointerId=1,l.pointerType="mouse"):(l.deviceType=r.bq.Touch,l.pointerId=null!=s?s:t,l.pointerType="touch");var c=0;return c+=o.pollInput(e,t,r.ST.LeftClick),c+=2*o.pollInput(e,t,r.ST.RightClick),c+=4*o.pollInput(e,t,r.ST.MiddleClick),l.buttons=c,n===r.ST.Move?l.type="pointermove":n>=r.ST.LeftClick&&n<=r.ST.RightClick&&(l.type=1===i?"pointerdown":"pointerup",l.button=n-2),l},e._CreateWheelEvent=function(e,t,n,i,o,s){var l=this._CreateMouseEvent(e,t,n,i,o,s);switch(l.pointerId=1,l.type="wheel",l.deltaMode=a.s.DOM_DELTA_PIXEL,l.deltaX=0,l.deltaY=0,l.deltaZ=0,n){case r.ST.MouseWheelX:l.deltaX=i;break;case r.ST.MouseWheelY:l.deltaY=i;break;case r.ST.MouseWheelZ:l.deltaZ=i}return l},e._CreateMouseEvent=function(e,t,n,i,o,a){var s=this._CreateEvent(a),l=o.pollInput(e,t,r.ST.Horizontal),c=o.pollInput(e,t,r.ST.Vertical);return a?(s.movementX=0,s.movementY=0,s.offsetX=s.movementX-a.getBoundingClientRect().x,s.offsetY=s.movementY-a.getBoundingClientRect().y):(s.movementX=o.pollInput(e,t,10),s.movementY=o.pollInput(e,t,11),s.offsetX=0,s.offsetY=0),this._CheckNonCharacterKeys(s,o),s.clientX=l,s.clientY=c,s.x=l,s.y=c,s.deviceType=e,s.deviceSlot=t,s.inputIndex=n,s},e._CreateKeyboardEvent=function(e,t,n,i){var o=this._CreateEvent(i);return this._CheckNonCharacterKeys(o,n),o.deviceType=r.bq.Keyboard,o.deviceSlot=0,o.inputIndex=e,o.type=1===t?"keydown":"keyup",o.key=String.fromCharCode(e),o.keyCode=e,o},e._CheckNonCharacterKeys=function(e,t){var n=t.isDeviceAvailable(r.bq.Keyboard),i=n&&1===t.pollInput(r.bq.Keyboard,0,o.Y.INPUT_ALT_KEY),a=n&&1===t.pollInput(r.bq.Keyboard,0,o.Y.INPUT_CTRL_KEY),s=n&&(1===t.pollInput(r.bq.Keyboard,0,o.Y.INPUT_META_KEY1)||1===t.pollInput(r.bq.Keyboard,0,o.Y.INPUT_META_KEY2)||1===t.pollInput(r.bq.Keyboard,0,o.Y.INPUT_META_KEY3)),l=n&&1===t.pollInput(r.bq.Keyboard,0,o.Y.INPUT_SHIFT_KEY);e.altKey=i,e.ctrlKey=a,e.metaKey=s,e.shiftKey=l},e._CreateEvent=function(e){var t={preventDefault:function(){}};return t.target=e,t},e}(),l=function(){function e(e,t,n){var r=this;this._nativeInput=_native.DeviceInputSystem?new _native.DeviceInputSystem(e,t,(function(e,t,i,o){var a=s.CreateDeviceEvent(e,t,i,o,r);n(e,t,a)})):this._createDummyNativeInput()}return e.prototype.pollInput=function(e,t,n){return this._nativeInput.pollInput(e,t,n)},e.prototype.isDeviceAvailable=function(e){return e===r.bq.Mouse||e===r.bq.Touch},e.prototype.dispose=function(){this._nativeInput.dispose()},e.prototype._createDummyNativeInput=function(){return{pollInput:function(){return 0},isDeviceAvailable:function(){return!1},dispose:function(){}}},e}(),c=n(5153),u=n(44957),h=Object.keys(r.ST).length/2,d=function(){function e(e,t,n,r){var i=this;this._inputs=[],this._keyboardActive=!1,this._pointerActive=!1,this._usingSafari=u.S0.IsSafari(),this._usingMacOS=(0,c.XD)()&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),this._keyboardDownEvent=function(e){},this._keyboardUpEvent=function(e){},this._keyboardBlurEvent=function(e){},this._pointerMoveEvent=function(e){},this._pointerDownEvent=function(e){},this._pointerUpEvent=function(e){},this._pointerCancelEvent=function(e){},this._pointerWheelEvent=function(e){},this._pointerBlurEvent=function(e){},this._pointerMacOSChromeOutEvent=function(e){},this._eventsAttached=!1,this._mouseId=-1,this._isUsingFirefox=(0,c.XD)()&&navigator.userAgent&&-1!==navigator.userAgent.indexOf("Firefox"),this._isUsingChromium=(0,c.XD)()&&navigator.userAgent&&-1!==navigator.userAgent.indexOf("Chrome"),this._maxTouchPoints=0,this._pointerInputClearObserver=null,this._gamepadConnectedEvent=function(e){},this._gamepadDisconnectedEvent=function(e){},this._eventPrefix=u.S0.GetPointerPrefix(e),this._engine=e,this._onDeviceConnected=t,this._onDeviceDisconnected=n,this._onInputChanged=r,this._mouseId=this._isUsingFirefox?0:1,this._enableEvents(),this._usingMacOS&&(this._metaKeys=[]),this._engine._onEngineViewChanged||(this._engine._onEngineViewChanged=function(){i._enableEvents()})}return e.prototype.pollInput=function(e,t,n){var i=this._inputs[e][t];if(!i)throw"Unable to find device ".concat(r.bq[e]);e>=r.bq.DualShock&&e<=r.bq.DualSense&&this._updateDevice(e,t,n);var o=i[n];if(void 0===o)throw"Unable to find input ".concat(n," for device ").concat(r.bq[e]," in slot ").concat(t);return n===r.ST.Move&&u.S0.Warn("Unable to provide information for PointerInput.Move. Try using PointerInput.Horizontal or PointerInput.Vertical for move data."),o},e.prototype.isDeviceAvailable=function(e){return void 0!==this._inputs[e]},e.prototype.dispose=function(){this._onDeviceConnected=function(){},this._onDeviceDisconnected=function(){},this._onInputChanged=function(){},delete this._engine._onEngineViewChanged,this._elementToAttachTo&&this._disableEvents()},e.prototype._enableEvents=function(){var e=null==this?void 0:this._engine.getInputElement();if(e&&(!this._eventsAttached||this._elementToAttachTo!==e)){if(this._disableEvents(),this._inputs)for(var t=0,n=this._inputs;t<n.length;t++){var r=n[t];if(r)for(var i in r){var o=r[+i];if(o)for(var a=0;a<o.length;a++)o[a]=0}}this._elementToAttachTo=e,this._elementToAttachTo.tabIndex=-1!==this._elementToAttachTo.tabIndex?this._elementToAttachTo.tabIndex:this._engine.canvasTabIndex,this._handleKeyActions(),this._handlePointerActions(),this._handleGamepadActions(),this._eventsAttached=!0,this._checkForConnectedDevices()}},e.prototype._disableEvents=function(){this._elementToAttachTo&&(this._elementToAttachTo.removeEventListener("blur",this._keyboardBlurEvent),this._elementToAttachTo.removeEventListener("blur",this._pointerBlurEvent),this._elementToAttachTo.removeEventListener("keydown",this._keyboardDownEvent),this._elementToAttachTo.removeEventListener("keyup",this._keyboardUpEvent),this._elementToAttachTo.removeEventListener(this._eventPrefix+"move",this._pointerMoveEvent),this._elementToAttachTo.removeEventListener(this._eventPrefix+"down",this._pointerDownEvent),this._elementToAttachTo.removeEventListener(this._eventPrefix+"up",this._pointerUpEvent),this._elementToAttachTo.removeEventListener(this._eventPrefix+"cancel",this._pointerCancelEvent),this._elementToAttachTo.removeEventListener(this._wheelEventName,this._pointerWheelEvent),this._usingMacOS&&this._isUsingChromium&&this._elementToAttachTo.removeEventListener("lostpointercapture",this._pointerMacOSChromeOutEvent),window.removeEventListener("gamepadconnected",this._gamepadConnectedEvent),window.removeEventListener("gamepaddisconnected",this._gamepadDisconnectedEvent)),this._pointerInputClearObserver&&this._engine.onEndFrameObservable.remove(this._pointerInputClearObserver),this._eventsAttached=!1},e.prototype._checkForConnectedDevices=function(){if(navigator.getGamepads)for(var e=0,t=navigator.getGamepads();e<t.length;e++){var n=t[e];n&&this._addGamePad(n)}"function"==typeof matchMedia&&matchMedia("(pointer:fine)").matches&&this._addPointerDevice(r.bq.Mouse,0,0,0)},e.prototype._addGamePad=function(e){var t=this._getGamepadDeviceType(e.id),n=e.index;this._gamepads=this._gamepads||new Array(e.index+1),this._registerDevice(t,n,e.buttons.length+e.axes.length),this._gamepads[n]=t},e.prototype._addPointerDevice=function(e,t,n,r){this._pointerActive||(this._pointerActive=!0),this._registerDevice(e,t,h);var i=this._inputs[e][t];i[0]=n,i[1]=r},e.prototype._registerDevice=function(e,t,n){if(void 0===t)throw"Unable to register device ".concat(r.bq[e]," to undefined slot.");if(this._inputs[e]||(this._inputs[e]={}),!this._inputs[e][t]){var i=new Array(n);i.fill(0),this._inputs[e][t]=i,this._onDeviceConnected(e,t)}},e.prototype._unregisterDevice=function(e,t){this._inputs[e][t]&&(delete this._inputs[e][t],this._onDeviceDisconnected(e,t))},e.prototype._handleKeyActions=function(){var e=this;this._keyboar