@dcl/sdk 7.0.0-2740047851.commit-db29ac2 → 7.0.0-2781674220.commit-d772e02
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ecs7/index.d.ts +7 -0
- package/dist/ecs7/index.js +78 -9
- package/dist/ecs7/index.min.js +1 -1
- package/dist/ecs7/index.min.js.map +1 -1
- package/package.json +4 -4
- package/types/ecs7/index.d.ts +7 -0
package/dist/ecs7/index.min.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
(function(exports){"use strict";var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},dist$1={},Quaternion={},Vector3$1={},hasRequiredVector3;function requireVector3(){return hasRequiredVector3||(hasRequiredVector3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Vector3=void 0,function(e){function t(e=0,t=0,r=0){return{x:e,y:t,z:r}}function r(e,t){t.x=e.x,t.y=e.y,t.z=e.z}function n(e){return Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z)}function i(e,t,r){r.x=e.x*t,r.y=e.y*t,r.z=e.z*t}function o(e,r){const n=t(0,0,0);return a(e,r,n),n}function a(e,t,n){0!==t&&1!==t?i(e,1/t,n):r(e,n)}function s(e,t,r,n){n.x=e.x+(t.x-e.x)*r,n.y=e.y+(t.y-e.y)*r,n.z=e.z+(t.z-e.z)*r}e.create=t,e.add=function(e,t){return{x:e.x+t.x,y:e.y+t.y,z:e.z+t.z}},e.subtract=function(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}},e.subtractToRef=function(e,t,r){r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z},e.opposite=function(e){return{x:-e.x,y:-e.y,z:-e.z}},e.copy=r,e.clone=function(e){return Object.assign({},e)},e.length=n,e.lengthSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},e.scaleToRef=i,e.scale=function(e,r){return t(e.x*r,e.y*r,e.z*r)},e.normalizeFromLength=o,e.normalizeFromLengthToRef=a,e.normalize=function(e){return o(e,n(e))},e.normalizeToRef=function(e,t){a(e,n(e),t)},e.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},e.rotate=function(e,t){const{x:r,y:n,z:i}=e,{x:o,y:a,z:s,w:u}=t,c=u*r+a*i-s*n,l=u*n+s*r-o*i,f=u*i+o*n-a*r,d=-o*r-a*n-s*i;return{x:c*u+d*-o+l*-s-f*-a,y:l*u+d*-a+f*-o-c*-s,z:f*u+d*-s+c*-a-l*-o}},e.lerp=function(e,r,n){const i=t(0,0,0);return s(e,r,n,i),i},e.lerpToRef=s,e.cross=function(t,r){const n=e.Zero();return e.crossToRef(t,r,n),n},e.crossToRef=function(e,t,r){r.x=e.y*t.z-e.z*t.y,r.y=e.z*t.x-e.x*t.z,r.z=e.x*t.y-e.y*t.x},e.Zero=function(){return t(0,0,0)},e.One=function(){return t(1,1,1)},e.Up=function(){return t(0,1,0)},e.Down=function(){return t(0,-1,0)},e.Forward=function(){return t(0,0,1)},e.Backward=function(){return t(0,0,-1)},e.Right=function(){return t(1,0,0)},e.Left=function(){return t(-1,0,0)}}(e.Vector3||(e.Vector3={}))}(Vector3$1)),Vector3$1}var Scalar={},hasRequiredScalar;function requireScalar(){if(hasRequiredScalar)return Scalar;hasRequiredScalar=1,Object.defineProperty(Scalar,"__esModule",{value:!0}),Scalar.Scalar=void 0;const e=2*Math.PI;function t(e){const t=+e;return 0===t||isNaN(t)?t:t>0?1:-1}function r(e,t=0,r=1){return Math.min(r,Math.max(t,e))}function n(e,t){return e-Math.floor(e/t)*t}function i(e,t){let r=n(t-e,360);return r>180&&(r-=360),r}function o(e,r,n){let i=0;return i=Math.abs(r-e)<=n?r:e+t(r-e)*n,i}return Scalar.Scalar={withinEpsilon:function(e,t,r=1401298e-51){const n=e-t;return-r<=n&&n<=r},toHex:function(e){const t=e.toString(16);return e<=15?("0"+t).toUpperCase():t.toUpperCase()},sign:t,clamp:r,log2:function(e){return Math.log(e)*Math.LOG2E},repeat:n,normalize:function(e,t,r){return(e-t)/(r-t)},denormalize:function(e,t,r){return e*(r-t)+t},deltaAngle:i,pingPong:function(e,t){const r=n(e,2*t);return t-Math.abs(r-t)},smoothStep:function(e,t,n){let i=r(n);return i=-2*i*i*i+3*i*i,t*i+e*(1-i)},moveTowards:o,moveTowardsAngle:function(e,t,r){const n=i(e,t);let a=0;return a=-r<n&&n<r?t:o(e,e+n,r),a},lerp:function(e,t,r){return e+(t-e)*r},lerpAngle:function(e,t,i){let o=n(t-e,360);return o>180&&(o-=360),e+o*r(i)},inverseLerp:function(e,t,n){let i=0;return i=e!==t?r((n-e)/(t-e)):0,i},hermite:function(e,t,r,n,i){const o=i*i,a=i*o;return e*(2*a-3*o+1)+r*(-2*a+3*o)+t*(a-2*o+i)+n*(a-o)},randomRange:function(e,t){return e===t?e:Math.random()*(t-e)+e},rangeToPercent:function(e,t,r){return(e-t)/(r-t)},percentToRange:function(e,t,r){return(r-t)*e+t},normalizeRadians:function(t){return t-e*Math.floor((t+Math.PI)/e)},TwoPi:e},Scalar}var types$1={},hasRequiredTypes$1,hasRequiredQuaternion,hasRequiredDist$1;function requireTypes$1(){return hasRequiredTypes$1||(hasRequiredTypes$1=1,function(e){var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.RAD2DEG=e.DEG2RAD=e.Epsilon=e.ToLinearSpace=e.ToGammaSpace=e.Space=e.Orientation=void 0,(t=e.Orientation||(e.Orientation={}))[t.CW=0]="CW",t[t.CCW=1]="CCW",(r=e.Space||(e.Space={}))[r.LOCAL=0]="LOCAL",r[r.WORLD=1]="WORLD",r[r.BONE=2]="BONE",e.ToGammaSpace=1/2.2,e.ToLinearSpace=2.2,e.Epsilon=1e-6,e.DEG2RAD=Math.PI/180,e.RAD2DEG=360/(2*Math.PI)}(types$1)),types$1}function requireQuaternion(){return hasRequiredQuaternion||(hasRequiredQuaternion=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Quaternion=void 0;const t=requireVector3(),r=requireScalar(),n=requireTypes$1();!function(e){function i(e=0,t=0,r=0,n=1){return{x:e,y:t,z:r,w:n}}function o(e,t,r){const n=.5*t,o=.5*e,a=.5*r,s=Math.cos(n),u=Math.cos(o),c=Math.cos(a),l=Math.sin(n),f=Math.sin(o),d=Math.sin(a);return i(u*l*c+f*s*d,f*s*c-u*l*d,u*s*d-f*l*c,u*s*c+f*l*d)}function a(e){return Math.sqrt(s(e))}function s(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w}function u(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w}function c(e,t){const r=u(e,t);return 2*Math.acos(Math.min(Math.abs(r),1))*n.RAD2DEG}function l(e){const t=1/a(e);return i(e.x*t,e.y*t,e.z*t,e.w*t)}function f(){return i(0,0,0,1)}function d(t,r,n){const i=e.Identity();return e.slerpToRef(t,r,n,i),i}function p(e,t,r){r.x=e.x*t.w+e.y*t.z-e.z*t.y+e.w*t.x,r.y=-e.x*t.z+e.y*t.w+e.z*t.x+e.w*t.y,r.z=e.x*t.y-e.y*t.x+e.z*t.w+e.w*t.z,r.w=-e.x*t.x-e.y*t.y-e.z*t.z+e.w*t.w}e.create=i,e.add=function(e,t){return{x:e.x+t.x,y:e.y+t.y,z:e.z+t.z,w:e.w+t.w}},e.rotationYawPitchRoll=o,e.euler=function(e,t,r){return o(t*n.DEG2RAD,e*n.DEG2RAD,r*n.DEG2RAD)},e.length=a,e.lengthSquared=s,e.dot=u,e.angle=c,e.rotateTowards=function(e,t,r){const n=c(e,t);return 0===n?t:d(e,t,Math.min(1,r/n))},e.lookRotation=function(e,r={x:0,y:1,z:0}){const n=t.Vector3.normalize(e),o=t.Vector3.normalize(t.Vector3.cross(r,n)),a=t.Vector3.cross(n,o),s=o.x,u=o.y,c=o.z,l=a.x,f=a.y,d=a.z,p=n.x,h=n.y,m=n.z,y=s+f+m,E=i();if(y>0){let e=Math.sqrt(y+1);return E.w=.5*e,e=.5/e,E.x=(d-h)*e,E.y=(p-c)*e,E.z=(u-l)*e,E}if(s>=f&&s>=m){const e=Math.sqrt(1+s-f-m),t=.5/e;return E.x=.5*e,E.y=(u+l)*t,E.z=(c+p)*t,E.w=(d-h)*t,E}if(f>m){const e=Math.sqrt(1+f-s-m),t=.5/e;return E.x=(l+u)*t,E.y=.5*e,E.z=(h+d)*t,E.w=(p-c)*t,E}const g=Math.sqrt(1+m-s-f),b=.5/g;return E.x=(p+c)*b,E.y=(h+d)*b,E.z=.5*g,E.w=(u-l)*b,E},e.normalize=l,e.fromToRotation=function(e,r,n=t.Vector3.Up()){const o=t.Vector3.normalize(e),a=t.Vector3.normalize(r),s=t.Vector3.cross(o,a),u=Math.sqrt(t.Vector3.lengthSquared(o)*t.Vector3.lengthSquared(a))+t.Vector3.dot(o,a);return t.Vector3.lengthSquared(s)<1e-4?Math.abs(u)<1e-4?l(i(n.x,n.y,n.z,0)):f():l(i(s.x,s.y,s.z,u))},e.Identity=f,e.eulerAngles=function(e){const i=t.Vector3.create(),o=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w,a=e.x*e.w-e.y*e.z;return a>.4995*o?(i.x=Math.PI/2,i.y=2*Math.atan2(e.y,e.x),i.z=0):a<-.4995*o?(i.x=-Math.PI/2,i.y=-2*Math.atan2(e.y,e.x),i.z=0):(i.x=Math.asin(2*(e.w*e.x-e.y*e.z)),i.y=Math.atan2(2*e.w*e.y+2*e.z*e.x,1-2*(e.x*e.x+e.y*e.y)),i.z=Math.atan2(2*e.w*e.z+2*e.x*e.y,1-2*(e.z*e.z+e.x*e.x))),i.x*=n.RAD2DEG,i.y*=n.RAD2DEG,i.z*=n.RAD2DEG,i.x=r.Scalar.repeat(i.x,360),i.y=r.Scalar.repeat(i.y,360),i.z=r.Scalar.repeat(i.z,360),i},e.rotationYawPitchRollToRef=function(e,t,r,n){const i=.5*t,o=.5*e,a=.5*r,s=Math.cos(i),u=Math.cos(o),c=Math.cos(a),l=Math.sin(i),f=Math.sin(o),d=Math.sin(a);n.x=u*l*c+f*s*d,n.y=f*s*c-u*l*d,n.z=u*s*d-f*l*c,n.w=u*s*c+f*l*d},e.fromRotationMatrixToRef=function(e,t){const r=e._m,n=r[0],i=r[4],o=r[8],a=r[1],s=r[5],u=r[9],c=r[2],l=r[6],f=r[10],d=n+s+f;let p;d>0?(p=.5/Math.sqrt(d+1),t.w=.25/p,t.x=(l-u)*p,t.y=(o-c)*p,t.z=(a-i)*p):n>s&&n>f?(p=2*Math.sqrt(1+n-s-f),t.w=(l-u)/p,t.x=.25*p,t.y=(i+a)/p,t.z=(o+c)/p):s>f?(p=2*Math.sqrt(1+s-n-f),t.w=(o-c)/p,t.x=(i+a)/p,t.y=.25*p,t.z=(u+l)/p):(p=2*Math.sqrt(1+f-n-s),t.w=(a-i)/p,t.x=(o+c)/p,t.y=(u+l)/p,t.z=.25*p)},e.slerp=d,e.slerpToRef=function(e,t,r,n){let i,o,a=e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w,s=!1;if(a<0&&(s=!0,a=-a),a>.999999)o=1-r,i=s?-r:r;else{const e=Math.acos(a),t=1/Math.sin(e);o=Math.sin((1-r)*e)*t,i=s?-Math.sin(r*e)*t:Math.sin(r*e)*t}n.x=o*e.x+i*t.x,n.y=o*e.y+i*t.y,n.z=o*e.z+i*t.z,n.w=o*e.w+i*t.w},e.multiply=function(e,t){const r=i(0,0,0,1);return p(e,t,r),r},e.multiplyToRef=p,e.angleAxis=function(r,i){if(0===t.Vector3.lengthSquared(i))return e.Identity();const o=f();let a=r*n.DEG2RAD;a*=.5;const s=t.Vector3.normalize(i);return t.Vector3.scaleToRef(s,Math.sin(a),s),o.x=s.x,o.y=s.y,o.z=s.z,o.w=Math.cos(a),l(o)},e.Zero=function(){return i(0,0,0,0)}}(e.Quaternion||(e.Quaternion={}))}(Quaternion)),Quaternion}function requireDist$1(){return hasRequiredDist$1||(hasRequiredDist$1=1,function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(requireQuaternion(),e),r(requireVector3(),e),r(requireTypes$1(),e),r(requireDist$1(),e)}(dist$1)),dist$1}var distExports$1=requireDist$1(),minimal$1={exports:{}},indexMinimal={},minimal={},aspromise,hasRequiredAspromise;function requireAspromise(){if(hasRequiredAspromise)return aspromise;return hasRequiredAspromise=1,aspromise=function(e,t){var r=new Array(arguments.length-1),n=0,i=2,o=!0;for(;i<arguments.length;)r[n++]=arguments[i++];return new Promise((function(i,a){r[n]=function(e){if(o)if(o=!1,e)a(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];i.apply(null,t)}};try{e.apply(t||null,r)}catch(e){o&&(o=!1,a(e))}}))}}var base64={},hasRequiredBase64,eventemitter,hasRequiredEventemitter,float,hasRequiredFloat,inquire_1,hasRequiredInquire;function requireBase64(){return hasRequiredBase64||(hasRequiredBase64=1,function(e){var t=e;t.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var r=new Array(64),n=new Array(123),i=0;i<64;)n[r[i]=i<26?i+65:i<52?i+71:i<62?i-4:i-59|43]=i++;t.encode=function(e,t,n){for(var i,o=null,a=[],s=0,u=0;t<n;){var c=e[t++];switch(u){case 0:a[s++]=r[c>>2],i=(3&c)<<4,u=1;break;case 1:a[s++]=r[i|c>>4],i=(15&c)<<2,u=2;break;case 2:a[s++]=r[i|c>>6],a[s++]=r[63&c],u=0}s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,a)),s=0)}return u&&(a[s++]=r[i],a[s++]=61,1===u&&(a[s++]=61)),o?(s&&o.push(String.fromCharCode.apply(String,a.slice(0,s))),o.join("")):String.fromCharCode.apply(String,a.slice(0,s))};var o="invalid encoding";t.decode=function(e,t,r){for(var i,a=r,s=0,u=0;u<e.length;){var c=e.charCodeAt(u++);if(61===c&&s>1)break;if(void 0===(c=n[c]))throw Error(o);switch(s){case 0:i=c,s=1;break;case 1:t[r++]=i<<2|(48&c)>>4,i=c,s=2;break;case 2:t[r++]=(15&i)<<4|(60&c)>>2,i=c,s=3;break;case 3:t[r++]=(3&i)<<6|c,s=0}}if(1===s)throw Error(o);return r-a},t.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}}(base64)),base64}function requireEventemitter(){if(hasRequiredEventemitter)return eventemitter;function e(){this._listeners={}}return hasRequiredEventemitter=1,eventemitter=e,e.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},e.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},e.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this},eventemitter}function requireFloat(){if(hasRequiredFloat)return float;function e(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3]}function o(e,n,i){t[0]=e,n[i]=r[3],n[i+1]=r[2],n[i+2]=r[1],n[i+3]=r[0]}function a(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function s(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?i:o,e.writeFloatBE=n?o:i,e.readFloatLE=n?a:s,e.readFloatBE=n?s:a}():function(){function o(e,t,r,n){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var o=Math.floor(Math.log(t)/Math.LN2);e((i<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,r,n)}}function a(e,t,r){var n=e(t,r),i=2*(n>>31)+1,o=n>>>23&255,a=8388607&n;return 255===o?a?NaN:i*(1/0):0===o?1401298464324817e-60*i*a:i*Math.pow(2,o-150)*(a+8388608)}e.writeFloatLE=o.bind(null,t),e.writeFloatBE=o.bind(null,r),e.readFloatLE=a.bind(null,n),e.readFloatBE=a.bind(null,i)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3],n[i+4]=r[4],n[i+5]=r[5],n[i+6]=r[6],n[i+7]=r[7]}function o(e,n,i){t[0]=e,n[i]=r[7],n[i+1]=r[6],n[i+2]=r[5],n[i+3]=r[4],n[i+4]=r[3],n[i+5]=r[2],n[i+6]=r[1],n[i+7]=r[0]}function a(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function s(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?i:o,e.writeDoubleBE=n?o:i,e.readDoubleLE=n?a:s,e.readDoubleBE=n?s:a}():function(){function o(e,t,r,n,i,o){var a=n<0?1:0;if(a&&(n=-n),0===n)e(0,i,o+t),e(1/n>0?0:2147483648,i,o+r);else if(isNaN(n))e(0,i,o+t),e(2146959360,i,o+r);else if(n>17976931348623157e292)e(0,i,o+t),e((a<<31|2146435072)>>>0,i,o+r);else{var s;if(n<22250738585072014e-324)e((s=n/5e-324)>>>0,i,o+t),e((a<<31|s/4294967296)>>>0,i,o+r);else{var u=Math.floor(Math.log(n)/Math.LN2);1024===u&&(u=1023),e(4503599627370496*(s=n*Math.pow(2,-u))>>>0,i,o+t),e((a<<31|u+1023<<20|1048576*s&1048575)>>>0,i,o+r)}}}function a(e,t,r,n,i){var o=e(n,i+t),a=e(n,i+r),s=2*(a>>31)+1,u=a>>>20&2047,c=4294967296*(1048575&a)+o;return 2047===u?c?NaN:s*(1/0):0===u?5e-324*s*c:s*Math.pow(2,u-1075)*(c+4503599627370496)}e.writeDoubleLE=o.bind(null,t,0,4),e.writeDoubleBE=o.bind(null,r,4,0),e.readDoubleLE=a.bind(null,n,0,4),e.readDoubleBE=a.bind(null,i,4,0)}(),e}function t(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function r(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function n(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function i(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}return hasRequiredFloat=1,float=e(e)}function requireInquire(){if(hasRequiredInquire)return inquire_1;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}return hasRequiredInquire=1,inquire_1=inquire,inquire_1}var utf8={},hasRequiredUtf8,pool_1,hasRequiredPool,longbits,hasRequiredLongbits,hasRequiredMinimal$1,writer,hasRequiredWriter,writer_buffer,hasRequiredWriter_buffer,reader,hasRequiredReader,reader_buffer,hasRequiredReader_buffer;function requireUtf8(){return hasRequiredUtf8||(hasRequiredUtf8=1,function(e){var t=e;t.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)(r=e.charCodeAt(n))<128?t+=1:r<2048?t+=2:55296==(64512&r)&&56320==(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},t.read=function(e,t,r){if(r-t<1)return"";for(var n,i=null,o=[],a=0;t<r;)(n=e[t++])<128?o[a++]=n:n>191&&n<224?o[a++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[a++]=55296+(n>>10),o[a++]=56320+(1023&n)):o[a++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),a=0);return i?(a&&i.push(String.fromCharCode.apply(String,o.slice(0,a))),i.join("")):String.fromCharCode.apply(String,o.slice(0,a))},t.write=function(e,t,r){for(var n,i,o=r,a=0;a<e.length;++a)(n=e.charCodeAt(a))<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296==(64512&n)&&56320==(64512&(i=e.charCodeAt(a+1)))?(n=65536+((1023&n)<<10)+(1023&i),++a,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-o}}(utf8)),utf8}function requirePool(){if(hasRequiredPool)return pool_1;return hasRequiredPool=1,pool_1=function(e,t,r){var n=r||8192,i=n>>>1,o=null,a=n;return function(r){if(r<1||r>i)return e(r);a+r>n&&(o=e(n),a=0);var s=t.call(o,a,a+=r);return 7&a&&(a=1+(7|a)),s}}}function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=t;var e=requireMinimal$1();function t(e,t){this.lo=e>>>0,this.hi=t>>>0}var r=t.zero=new t(0,0);r.toNumber=function(){return 0},r.zzEncode=r.zzDecode=function(){return this},r.length=function(){return 1};var n=t.zeroHash="\0\0\0\0\0\0\0\0";t.fromNumber=function(e){if(0===e)return r;var n=e<0;n&&(e=-e);var i=e>>>0,o=(e-i)/4294967296>>>0;return n&&(o=~o>>>0,i=~i>>>0,++i>4294967295&&(i=0,++o>4294967295&&(o=0))),new t(i,o)},t.from=function(n){if("number"==typeof n)return t.fromNumber(n);if(e.isString(n)){if(!e.Long)return t.fromNumber(parseInt(n,10));n=e.Long.fromString(n)}return n.low||n.high?new t(n.low>>>0,n.high>>>0):r},t.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},t.prototype.toLong=function(t){return e.Long?new e.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}};var i=String.prototype.charCodeAt;return t.fromHash=function(e){return e===n?r:new t((i.call(e,0)|i.call(e,1)<<8|i.call(e,2)<<16|i.call(e,3)<<24)>>>0,(i.call(e,4)|i.call(e,5)<<8|i.call(e,6)<<16|i.call(e,7)<<24)>>>0)},t.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},t.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},t.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},t.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10},longbits}function requireMinimal$1(){return hasRequiredMinimal$1||(hasRequiredMinimal$1=1,function(e){var t=e;function r(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function n(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&r(this,n)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}t.asPromise=requireAspromise(),t.base64=requireBase64(),t.EventEmitter=requireEventemitter(),t.float=requireFloat(),t.inquire=requireInquire(),t.utf8=requireUtf8(),t.pool=requirePool(),t.LongBits=requireLongbits(),t.isNode=Boolean(void 0!==commonjsGlobal&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),t.global=t.isNode&&commonjsGlobal||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||commonjsGlobal,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},t.isString=function(e){return"string"==typeof e||e instanceof String},t.isObject=function(e){return e&&"object"==typeof e},t.isset=t.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},t.Buffer=function(){try{var e=t.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(e){return"number"==typeof e?t.Buffer?t._Buffer_allocUnsafe(e):new t.Array(e):t.Buffer?t._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},t.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(e){return e?t.LongBits.from(e).toHash():t.LongBits.zeroHash},t.longFromHash=function(e,r){var n=t.LongBits.fromHash(e);return t.Long?t.Long.fromBits(n.lo,n.hi,r):n.toNumber(Boolean(r))},t.merge=r,t.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},t.newError=n,t.ProtocolError=n("ProtocolError"),t.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},t.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var e=t.Buffer;e?(t._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},t._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):t._Buffer_from=t._Buffer_allocUnsafe=null}}(minimal)),minimal}function requireWriter(){if(hasRequiredWriter)return writer;hasRequiredWriter=1,writer=u;var e,t=requireMinimal$1(),r=t.LongBits,n=t.base64,i=t.utf8;function o(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function a(){}function s(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function u(){this.len=0,this.head=new o(a,0,0),this.tail=this.head,this.states=null}var c=function(){return t.Buffer?function(){return(u.create=function(){return new e})()}:function(){return new u}};function l(e,t,r){t[r]=255&e}function f(e,t){this.len=e,this.next=void 0,this.val=t}function d(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function p(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}u.create=c(),u.alloc=function(e){return new t.Array(e)},t.Array!==Array&&(u.alloc=t.pool(u.alloc,t.Array.prototype.subarray)),u.prototype._push=function(e,t,r){return this.tail=this.tail.next=new o(e,t,r),this.len+=t,this},f.prototype=Object.create(o.prototype),f.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},u.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new f((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},u.prototype.int32=function(e){return e<0?this._push(d,10,r.fromNumber(e)):this.uint32(e)},u.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},u.prototype.uint64=function(e){var t=r.from(e);return this._push(d,t.length(),t)},u.prototype.int64=u.prototype.uint64,u.prototype.sint64=function(e){var t=r.from(e).zzEncode();return this._push(d,t.length(),t)},u.prototype.bool=function(e){return this._push(l,1,e?1:0)},u.prototype.fixed32=function(e){return this._push(p,4,e>>>0)},u.prototype.sfixed32=u.prototype.fixed32,u.prototype.fixed64=function(e){var t=r.from(e);return this._push(p,4,t.lo)._push(p,4,t.hi)},u.prototype.sfixed64=u.prototype.fixed64,u.prototype.float=function(e){return this._push(t.float.writeFloatLE,4,e)},u.prototype.double=function(e){return this._push(t.float.writeDoubleLE,8,e)};var h=t.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};return u.prototype.bytes=function(e){var r=e.length>>>0;if(!r)return this._push(l,1,0);if(t.isString(e)){var i=u.alloc(r=n.length(e));n.decode(e,i,0),e=i}return this.uint32(r)._push(h,r,e)},u.prototype.string=function(e){var t=i.length(e);return t?this.uint32(t)._push(i.write,t,e):this._push(l,1,0)},u.prototype.fork=function(){return this.states=new s(this),this.head=this.tail=new o(a,0,0),this.len=0,this},u.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new o(a,0,0),this.len=0),this},u.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},u.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},u._configure=function(t){e=t,u.create=c(),e._configure()},writer}function requireWriter_buffer(){if(hasRequiredWriter_buffer)return writer_buffer;hasRequiredWriter_buffer=1,writer_buffer=r;var e=requireWriter();(r.prototype=Object.create(e.prototype)).constructor=r;var t=requireMinimal$1();function r(){e.call(this)}function n(e,r,n){e.length<40?t.utf8.write(e,r,n):r.utf8Write?r.utf8Write(e,n):r.write(e,n)}return r._configure=function(){r.alloc=t._Buffer_allocUnsafe,r.writeBytesBuffer=t.Buffer&&t.Buffer.prototype instanceof Uint8Array&&"set"===t.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},r.prototype.bytes=function(e){t.isString(e)&&(e=t._Buffer_from(e,"base64"));var n=e.length>>>0;return this.uint32(n),n&&this._push(r.writeBytesBuffer,n,e),this},r.prototype.string=function(e){var r=t.Buffer.byteLength(e);return this.uint32(r),r&&this._push(n,r,e),this},r._configure(),writer_buffer}function requireReader(){if(hasRequiredReader)return reader;hasRequiredReader=1,reader=o;var e,t=requireMinimal$1(),r=t.LongBits,n=t.utf8;function i(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function o(e){this.buf=e,this.pos=0,this.len=e.length}var a,s="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new o(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new o(e);throw Error("illegal buffer")},u=function(){return t.Buffer?function(r){return(o.create=function(r){return t.Buffer.isBuffer(r)?new e(r):s(r)})(r)}:s};function c(){var e=new r(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw i(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw i(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function l(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw i(this,8);return new r(l(this.buf,this.pos+=4),l(this.buf,this.pos+=4))}return o.create=u(),o.prototype._slice=t.Array.prototype.subarray||t.Array.prototype.slice,o.prototype.uint32=(a=4294967295,function(){if(a=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return a;if(a=(a|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return a;if(a=(a|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return a;if(a=(a|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return a;if(a=(a|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return a;if((this.pos+=5)>this.len)throw this.pos=this.len,i(this,10);return a}),o.prototype.int32=function(){return 0|this.uint32()},o.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},o.prototype.bool=function(){return 0!==this.uint32()},o.prototype.fixed32=function(){if(this.pos+4>this.len)throw i(this,4);return l(this.buf,this.pos+=4)},o.prototype.sfixed32=function(){if(this.pos+4>this.len)throw i(this,4);return 0|l(this.buf,this.pos+=4)},o.prototype.float=function(){if(this.pos+4>this.len)throw i(this,4);var e=t.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},o.prototype.double=function(){if(this.pos+8>this.len)throw i(this,4);var e=t.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},o.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw i(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},o.prototype.string=function(){var e=this.bytes();return n.read(e,0,e.length)},o.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw i(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw i(this)}while(128&this.buf[this.pos++]);return this},o.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},o._configure=function(r){e=r,o.create=u(),e._configure();var n=t.Long?"toLong":"toNumber";t.merge(o.prototype,{int64:function(){return c.call(this)[n](!1)},uint64:function(){return c.call(this)[n](!0)},sint64:function(){return c.call(this).zzDecode()[n](!1)},fixed64:function(){return f.call(this)[n](!0)},sfixed64:function(){return f.call(this)[n](!1)}})},reader}function requireReader_buffer(){if(hasRequiredReader_buffer)return reader_buffer;hasRequiredReader_buffer=1,reader_buffer=r;var e=requireReader();(r.prototype=Object.create(e.prototype)).constructor=r;var t=requireMinimal$1();function r(t){e.call(this,t)}return r._configure=function(){t.Buffer&&(r.prototype._slice=t.Buffer.prototype.slice)},r.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},r._configure(),reader_buffer}var rpc={},service,hasRequiredService,hasRequiredRpc,roots,hasRequiredRoots,hasRequiredIndexMinimal,hasRequiredMinimal;function requireService(){if(hasRequiredService)return service;hasRequiredService=1,service=t;var e=requireMinimal$1();function t(t,r,n){if("function"!=typeof t)throw TypeError("rpcImpl must be a function");e.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=Boolean(r),this.responseDelimited=Boolean(n)}return(t.prototype=Object.create(e.EventEmitter.prototype)).constructor=t,t.prototype.rpcCall=function t(r,n,i,o,a){if(!o)throw TypeError("request must be specified");var s=this;if(!a)return e.asPromise(t,s,r,n,i,o);if(s.rpcImpl)try{return s.rpcImpl(r,n[s.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,t){if(e)return s.emit("error",e,r),a(e);if(null!==t){if(!(t instanceof i))try{t=i[s.responseDelimited?"decodeDelimited":"decode"](t)}catch(e){return s.emit("error",e,r),a(e)}return s.emit("data",t,r),a(null,t)}s.end(!0)}))}catch(e){return s.emit("error",e,r),void setTimeout((function(){a(e)}),0)}else setTimeout((function(){a(Error("already ended"))}),0)},t.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},service}function requireRpc(){return hasRequiredRpc||(hasRequiredRpc=1,function(e){e.Service=requireService()}(rpc)),rpc}function requireRoots(){return hasRequiredRoots?roots:(hasRequiredRoots=1,roots={})}function requireIndexMinimal(){return hasRequiredIndexMinimal||(hasRequiredIndexMinimal=1,function(e){var t=e;function r(){t.util._configure(),t.Writer._configure(t.BufferWriter),t.Reader._configure(t.BufferReader)}t.build="minimal",t.Writer=requireWriter(),t.BufferWriter=requireWriter_buffer(),t.Reader=requireReader(),t.BufferReader=requireReader_buffer(),t.util=requireMinimal$1(),t.rpc=requireRpc(),t.roots=requireRoots(),t.configure=r,r()}(indexMinimal)),indexMinimal}function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,minimal$1.exports=requireIndexMinimal()),minimal$1.exports}var minimalExports=requireMinimal();function createBasePBAnimator(){return{states:[]}}const PBAnimator={encode(e,t=minimalExports.Writer.create()){for(const r of e.states)PBAnimationState.encode(r,t.uint32(10).fork()).ldelim();return t},decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBAnimator();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.states.push(PBAnimationState.decode(r,r.uint32()));break;default:r.skipType(7&e)}}return i}};function createBasePBAnimationState(){return{name:"",clip:"",playing:!1,weight:0,speed:0,loop:!1,shouldReset:!1}}const PBAnimationState={encode:(e,t=minimalExports.Writer.create())=>(""!==e.name&&t.uint32(10).string(e.name),""!==e.clip&&t.uint32(18).string(e.clip),!0===e.playing&&t.uint32(24).bool(e.playing),0!==e.weight&&t.uint32(37).float(e.weight),0!==e.speed&&t.uint32(45).float(e.speed),!0===e.loop&&t.uint32(48).bool(e.loop),!0===e.shouldReset&&t.uint32(56).bool(e.shouldReset),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBAnimationState();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.name=r.string();break;case 2:i.clip=r.string();break;case 3:i.playing=r.bool();break;case 4:i.weight=r.float();break;case 5:i.speed=r.float();break;case 6:i.loop=r.bool();break;case 7:i.shouldReset=r.bool();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$g=1042,Animator={serialize(e,t){const r=PBAnimator.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBAnimator.decode(e.buffer(),e.remainingBytes()),create:()=>PBAnimator.decode(new Uint8Array)};function createBasePBAudioSource(){return{playing:!1,volume:0,loop:!1,pitch:0,audioClipUrl:""}}const PBAudioSource={encode:(e,t=minimalExports.Writer.create())=>(!0===e.playing&&t.uint32(8).bool(e.playing),0!==e.volume&&t.uint32(21).float(e.volume),!0===e.loop&&t.uint32(24).bool(e.loop),0!==e.pitch&&t.uint32(37).float(e.pitch),""!==e.audioClipUrl&&t.uint32(42).string(e.audioClipUrl),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBAudioSource();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.playing=r.bool();break;case 2:i.volume=r.float();break;case 3:i.loop=r.bool();break;case 4:i.pitch=r.float();break;case 5:i.audioClipUrl=r.string();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$f=1020,AudioSource={serialize(e,t){const r=PBAudioSource.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBAudioSource.decode(e.buffer(),e.remainingBytes()),create:()=>PBAudioSource.decode(new Uint8Array)};function createBasePBAvatarAttach(){return{avatarId:"",anchorPointId:0}}const PBAvatarAttach={encode:(e,t=minimalExports.Writer.create())=>(""!==e.avatarId&&t.uint32(10).string(e.avatarId),0!==e.anchorPointId&&t.uint32(16).int32(e.anchorPointId),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBAvatarAttach();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.avatarId=r.string();break;case 2:i.anchorPointId=r.int32();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$e=1073,AvatarAttach={serialize(e,t){const r=PBAvatarAttach.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBAvatarAttach.decode(e.buffer(),e.remainingBytes()),create:()=>PBAvatarAttach.decode(new Uint8Array)};function createBaseColor3(){return{r:0,g:0,b:0}}const Color3={encode:(e,t=minimalExports.Writer.create())=>(0!==e.r&&t.uint32(13).float(e.r),0!==e.g&&t.uint32(21).float(e.g),0!==e.b&&t.uint32(29).float(e.b),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBaseColor3();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.r=r.float();break;case 2:i.g=r.float();break;case 3:i.b=r.float();break;default:r.skipType(7&e)}}return i}};function createBasePBAvatarShape(){return{id:"",name:"",bodyShape:"",skinColor:void 0,hairColor:void 0,eyeColor:void 0,wearables:[],expressionTriggerId:"",expressionTriggerTimestamp:0,stickerTriggerId:"",stickerTriggerTimestamp:0,talking:!1}}const PBAvatarShape={encode(e,t=minimalExports.Writer.create()){""!==e.id&&t.uint32(10).string(e.id),""!==e.name&&t.uint32(18).string(e.name),""!==e.bodyShape&&t.uint32(26).string(e.bodyShape),void 0!==e.skinColor&&Color3.encode(e.skinColor,t.uint32(34).fork()).ldelim(),void 0!==e.hairColor&&Color3.encode(e.hairColor,t.uint32(42).fork()).ldelim(),void 0!==e.eyeColor&&Color3.encode(e.eyeColor,t.uint32(50).fork()).ldelim();for(const r of e.wearables)t.uint32(58).string(r);return""!==e.expressionTriggerId&&t.uint32(66).string(e.expressionTriggerId),0!==e.expressionTriggerTimestamp&&t.uint32(72).int64(e.expressionTriggerTimestamp),""!==e.stickerTriggerId&&t.uint32(82).string(e.stickerTriggerId),0!==e.stickerTriggerTimestamp&&t.uint32(88).int64(e.stickerTriggerTimestamp),!0===e.talking&&t.uint32(96).bool(e.talking),t},decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBAvatarShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.id=r.string();break;case 2:i.name=r.string();break;case 3:i.bodyShape=r.string();break;case 4:i.skinColor=Color3.decode(r,r.uint32());break;case 5:i.hairColor=Color3.decode(r,r.uint32());break;case 6:i.eyeColor=Color3.decode(r,r.uint32());break;case 7:i.wearables.push(r.string());break;case 8:i.expressionTriggerId=r.string();break;case 9:i.expressionTriggerTimestamp=longToNumber(r.int64());break;case 10:i.stickerTriggerId=r.string();break;case 11:i.stickerTriggerTimestamp=longToNumber(r.int64());break;case 12:i.talking=r.bool();break;default:r.skipType(7&e)}}return i}};var globalThis$1=(()=>{if(void 0!==globalThis$1)return globalThis$1;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw"Unable to locate global object"})();function longToNumber(e){if(e.gt(Number.MAX_SAFE_INTEGER))throw new globalThis$1.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}const COMPONENT_ID$d=1080,AvatarShape={serialize(e,t){const r=PBAvatarShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBAvatarShape.decode(e.buffer(),e.remainingBytes()),create:()=>PBAvatarShape.decode(new Uint8Array)};function createBasePBBoxShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1,uvs:[]}}const PBBoxShape={encode(e,t=minimalExports.Writer.create()){!0===e.withCollisions&&t.uint32(8).bool(e.withCollisions),!0===e.isPointerBlocker&&t.uint32(16).bool(e.isPointerBlocker),!0===e.visible&&t.uint32(24).bool(e.visible),t.uint32(34).fork();for(const r of e.uvs)t.float(r);return t.ldelim(),t},decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBBoxShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.withCollisions=r.bool();break;case 2:i.isPointerBlocker=r.bool();break;case 3:i.visible=r.bool();break;case 4:if(2==(7&e)){const e=r.uint32()+r.pos;for(;r.pos<e;)i.uvs.push(r.float())}else i.uvs.push(r.float());break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$c=1013,BoxShape={serialize(e,t){const r=PBBoxShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBBoxShape.decode(e.buffer(),e.remainingBytes()),create:()=>PBBoxShape.decode(new Uint8Array)};function createBaseVector3(){return{x:0,y:0,z:0}}const Vector3={encode:(e,t=minimalExports.Writer.create())=>(0!==e.x&&t.uint32(13).float(e.x),0!==e.y&&t.uint32(21).float(e.y),0!==e.z&&t.uint32(29).float(e.z),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBaseVector3();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.x=r.float();break;case 2:i.y=r.float();break;case 3:i.z=r.float();break;default:r.skipType(7&e)}}return i}};var CameraMode;function createBasePBCameraModeArea(){return{area:void 0,mode:0}}!function(e){e[e.FIRST_PERSON=0]="FIRST_PERSON",e[e.THIRD_PERSON=1]="THIRD_PERSON",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(CameraMode||(CameraMode={}));const PBCameraModeArea={encode:(e,t=minimalExports.Writer.create())=>(void 0!==e.area&&Vector3.encode(e.area,t.uint32(10).fork()).ldelim(),0!==e.mode&&t.uint32(16).int32(e.mode),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBCameraModeArea();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.area=Vector3.decode(r,r.uint32());break;case 2:i.mode=r.int32();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$b=1071,CameraModeArea={serialize(e,t){const r=PBCameraModeArea.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBCameraModeArea.decode(e.buffer(),e.remainingBytes()),create:()=>PBCameraModeArea.decode(new Uint8Array)};function createBasePBCylinderShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1,radiusTop:0,radiusBottom:0}}const PBCylinderShape={encode:(e,t=minimalExports.Writer.create())=>(!0===e.withCollisions&&t.uint32(8).bool(e.withCollisions),!0===e.isPointerBlocker&&t.uint32(16).bool(e.isPointerBlocker),!0===e.visible&&t.uint32(24).bool(e.visible),0!==e.radiusTop&&t.uint32(37).float(e.radiusTop),0!==e.radiusBottom&&t.uint32(45).float(e.radiusBottom),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBCylinderShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.withCollisions=r.bool();break;case 2:i.isPointerBlocker=r.bool();break;case 3:i.visible=r.bool();break;case 4:i.radiusTop=r.float();break;case 5:i.radiusBottom=r.float();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$a=1016,CylinderShape={serialize(e,t){const r=PBCylinderShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBCylinderShape.decode(e.buffer(),e.remainingBytes()),create:()=>PBCylinderShape.decode(new Uint8Array)};function createBasePBGLTFShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1,src:""}}const PBGLTFShape={encode:(e,t=minimalExports.Writer.create())=>(!0===e.withCollisions&&t.uint32(8).bool(e.withCollisions),!0===e.isPointerBlocker&&t.uint32(16).bool(e.isPointerBlocker),!0===e.visible&&t.uint32(24).bool(e.visible),""!==e.src&&t.uint32(34).string(e.src),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBGLTFShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.withCollisions=r.bool();break;case 2:i.isPointerBlocker=r.bool();break;case 3:i.visible=r.bool();break;case 4:i.src=r.string();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$9=1041,GLTFShape={serialize(e,t){const r=PBGLTFShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBGLTFShape.decode(e.buffer(),e.remainingBytes()),create:()=>PBGLTFShape.decode(new Uint8Array)};function createBasePBNFTShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1,src:"",assetId:"",style:0,color:void 0}}const PBNFTShape={encode:(e,t=minimalExports.Writer.create())=>(!0===e.withCollisions&&t.uint32(8).bool(e.withCollisions),!0===e.isPointerBlocker&&t.uint32(16).bool(e.isPointerBlocker),!0===e.visible&&t.uint32(24).bool(e.visible),""!==e.src&&t.uint32(34).string(e.src),""!==e.assetId&&t.uint32(42).string(e.assetId),0!==e.style&&t.uint32(48).int32(e.style),void 0!==e.color&&Color3.encode(e.color,t.uint32(58).fork()).ldelim(),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBNFTShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.withCollisions=r.bool();break;case 2:i.isPointerBlocker=r.bool();break;case 3:i.visible=r.bool();break;case 4:i.src=r.string();break;case 5:i.assetId=r.string();break;case 6:i.style=r.int32();break;case 7:i.color=Color3.decode(r,r.uint32());break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$8=1040,NFTShape={serialize(e,t){const r=PBNFTShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBNFTShape.decode(e.buffer(),e.remainingBytes()),create:()=>PBNFTShape.decode(new Uint8Array)};function createBasePBOnPointerDown(){return{button:0,hoverText:"",distance:0,showFeedback:!1}}const PBOnPointerDown={encode:(e,t=minimalExports.Writer.create())=>(0!==e.button&&t.uint32(8).int32(e.button),""!==e.hoverText&&t.uint32(18).string(e.hoverText),0!==e.distance&&t.uint32(29).float(e.distance),!0===e.showFeedback&&t.uint32(32).bool(e.showFeedback),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBOnPointerDown();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.button=r.int32();break;case 2:i.hoverText=r.string();break;case 3:i.distance=r.float();break;case 4:i.showFeedback=r.bool();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$7=1060,OnPointerDown={serialize(e,t){const r=PBOnPointerDown.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBOnPointerDown.decode(e.buffer(),e.remainingBytes()),create:()=>PBOnPointerDown.decode(new Uint8Array)};function createBasePBOnPointerDownResult(){return{button:0,meshName:"",origin:void 0,direction:void 0,point:void 0,normal:void 0,distance:0,timestamp:0}}const PBOnPointerDownResult={encode:(e,t=minimalExports.Writer.create())=>(0!==e.button&&t.uint32(16).int32(e.button),""!==e.meshName&&t.uint32(26).string(e.meshName),void 0!==e.origin&&Vector3.encode(e.origin,t.uint32(34).fork()).ldelim(),void 0!==e.direction&&Vector3.encode(e.direction,t.uint32(42).fork()).ldelim(),void 0!==e.point&&Vector3.encode(e.point,t.uint32(50).fork()).ldelim(),void 0!==e.normal&&Vector3.encode(e.normal,t.uint32(58).fork()).ldelim(),0!==e.distance&&t.uint32(69).float(e.distance),0!==e.timestamp&&t.uint32(72).int32(e.timestamp),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBOnPointerDownResult();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 2:i.button=r.int32();break;case 3:i.meshName=r.string();break;case 4:i.origin=Vector3.decode(r,r.uint32());break;case 5:i.direction=Vector3.decode(r,r.uint32());break;case 6:i.point=Vector3.decode(r,r.uint32());break;case 7:i.normal=Vector3.decode(r,r.uint32());break;case 8:i.distance=r.float();break;case 9:i.timestamp=r.int32();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$6=1066,OnPointerDownResult={serialize(e,t){const r=PBOnPointerDownResult.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBOnPointerDownResult.decode(e.buffer(),e.remainingBytes()),create:()=>PBOnPointerDownResult.decode(new Uint8Array)};function createBasePBOnPointerUp(){return{button:0,hoverText:"",distance:0,showFeedback:!1}}const PBOnPointerUp={encode:(e,t=minimalExports.Writer.create())=>(0!==e.button&&t.uint32(8).int32(e.button),""!==e.hoverText&&t.uint32(18).string(e.hoverText),0!==e.distance&&t.uint32(29).float(e.distance),!0===e.showFeedback&&t.uint32(32).bool(e.showFeedback),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBOnPointerUp();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.button=r.int32();break;case 2:i.hoverText=r.string();break;case 3:i.distance=r.float();break;case 4:i.showFeedback=r.bool();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$5=1061,OnPointerUp={serialize(e,t){const r=PBOnPointerUp.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBOnPointerUp.decode(e.buffer(),e.remainingBytes()),create:()=>PBOnPointerUp.decode(new Uint8Array)};function createBasePBOnPointerUpResult(){return{button:0,meshName:"",origin:void 0,direction:void 0,point:void 0,normal:void 0,distance:0,timestamp:0}}const PBOnPointerUpResult={encode:(e,t=minimalExports.Writer.create())=>(0!==e.button&&t.uint32(16).int32(e.button),""!==e.meshName&&t.uint32(26).string(e.meshName),void 0!==e.origin&&Vector3.encode(e.origin,t.uint32(34).fork()).ldelim(),void 0!==e.direction&&Vector3.encode(e.direction,t.uint32(42).fork()).ldelim(),void 0!==e.point&&Vector3.encode(e.point,t.uint32(50).fork()).ldelim(),void 0!==e.normal&&Vector3.encode(e.normal,t.uint32(58).fork()).ldelim(),0!==e.distance&&t.uint32(69).float(e.distance),0!==e.timestamp&&t.uint32(72).int32(e.timestamp),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBOnPointerUpResult();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 2:i.button=r.int32();break;case 3:i.meshName=r.string();break;case 4:i.origin=Vector3.decode(r,r.uint32());break;case 5:i.direction=Vector3.decode(r,r.uint32());break;case 6:i.point=Vector3.decode(r,r.uint32());break;case 7:i.normal=Vector3.decode(r,r.uint32());break;case 8:i.distance=r.float();break;case 9:i.timestamp=r.int32();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$4=1065,OnPointerUpResult={serialize(e,t){const r=PBOnPointerUpResult.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBOnPointerUpResult.decode(e.buffer(),e.remainingBytes()),create:()=>PBOnPointerUpResult.decode(new Uint8Array)};function createBasePBPlaneShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1,uvs:[]}}const PBPlaneShape={encode(e,t=minimalExports.Writer.create()){!0===e.withCollisions&&t.uint32(8).bool(e.withCollisions),!0===e.isPointerBlocker&&t.uint32(16).bool(e.isPointerBlocker),!0===e.visible&&t.uint32(24).bool(e.visible),t.uint32(34).fork();for(const r of e.uvs)t.float(r);return t.ldelim(),t},decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBPlaneShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.withCollisions=r.bool();break;case 2:i.isPointerBlocker=r.bool();break;case 3:i.visible=r.bool();break;case 4:if(2==(7&e)){const e=r.uint32()+r.pos;for(;r.pos<e;)i.uvs.push(r.float())}else i.uvs.push(r.float());break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$3=1014,PlaneShape={serialize(e,t){const r=PBPlaneShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBPlaneShape.decode(e.buffer(),e.remainingBytes()),create:()=>PBPlaneShape.decode(new Uint8Array)};function createBasePBSphereShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1}}const PBSphereShape={encode:(e,t=minimalExports.Writer.create())=>(!0===e.withCollisions&&t.uint32(8).bool(e.withCollisions),!0===e.isPointerBlocker&&t.uint32(16).bool(e.isPointerBlocker),!0===e.visible&&t.uint32(24).bool(e.visible),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBSphereShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.withCollisions=r.bool();break;case 2:i.isPointerBlocker=r.bool();break;case 3:i.visible=r.bool();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$2=1015,SphereShape={serialize(e,t){const r=PBSphereShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBSphereShape.decode(e.buffer(),e.remainingBytes()),create:()=>PBSphereShape.decode(new Uint8Array)};function createBasePBTextShape(){return{text:"",visible:!1,font:"",opacity:0,fontSize:0,fontAutoSize:!1,hTextAlign:"",vTextAlign:"",width:0,height:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,lineSpacing:0,lineCount:0,textWrapping:!1,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,outlineWidth:0,shadowColor:void 0,outlineColor:void 0,textColor:void 0}}const PBTextShape={encode:(e,t=minimalExports.Writer.create())=>(""!==e.text&&t.uint32(10).string(e.text),!0===e.visible&&t.uint32(16).bool(e.visible),""!==e.font&&t.uint32(26).string(e.font),0!==e.opacity&&t.uint32(37).float(e.opacity),0!==e.fontSize&&t.uint32(45).float(e.fontSize),!0===e.fontAutoSize&&t.uint32(48).bool(e.fontAutoSize),""!==e.hTextAlign&&t.uint32(58).string(e.hTextAlign),""!==e.vTextAlign&&t.uint32(66).string(e.vTextAlign),0!==e.width&&t.uint32(77).float(e.width),0!==e.height&&t.uint32(85).float(e.height),0!==e.paddingTop&&t.uint32(93).float(e.paddingTop),0!==e.paddingRight&&t.uint32(101).float(e.paddingRight),0!==e.paddingBottom&&t.uint32(109).float(e.paddingBottom),0!==e.paddingLeft&&t.uint32(117).float(e.paddingLeft),0!==e.lineSpacing&&t.uint32(125).float(e.lineSpacing),0!==e.lineCount&&t.uint32(128).int32(e.lineCount),!0===e.textWrapping&&t.uint32(136).bool(e.textWrapping),0!==e.shadowBlur&&t.uint32(149).float(e.shadowBlur),0!==e.shadowOffsetX&&t.uint32(157).float(e.shadowOffsetX),0!==e.shadowOffsetY&&t.uint32(165).float(e.shadowOffsetY),0!==e.outlineWidth&&t.uint32(173).float(e.outlineWidth),void 0!==e.shadowColor&&Color3.encode(e.shadowColor,t.uint32(178).fork()).ldelim(),void 0!==e.outlineColor&&Color3.encode(e.outlineColor,t.uint32(186).fork()).ldelim(),void 0!==e.textColor&&Color3.encode(e.textColor,t.uint32(194).fork()).ldelim(),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBTextShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.text=r.string();break;case 2:i.visible=r.bool();break;case 3:i.font=r.string();break;case 4:i.opacity=r.float();break;case 5:i.fontSize=r.float();break;case 6:i.fontAutoSize=r.bool();break;case 7:i.hTextAlign=r.string();break;case 8:i.vTextAlign=r.string();break;case 9:i.width=r.float();break;case 10:i.height=r.float();break;case 11:i.paddingTop=r.float();break;case 12:i.paddingRight=r.float();break;case 13:i.paddingBottom=r.float();break;case 14:i.paddingLeft=r.float();break;case 15:i.lineSpacing=r.float();break;case 16:i.lineCount=r.int32();break;case 17:i.textWrapping=r.bool();break;case 18:i.shadowBlur=r.float();break;case 19:i.shadowOffsetX=r.float();break;case 20:i.shadowOffsetY=r.float();break;case 21:i.outlineWidth=r.float();break;case 22:i.shadowColor=Color3.decode(r,r.uint32());break;case 23:i.outlineColor=Color3.decode(r,r.uint32());break;case 24:i.textColor=Color3.decode(r,r.uint32());break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$1=1030,TextShape={serialize(e,t){const r=PBTextShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBTextShape.decode(e.buffer(),e.remainingBytes()),create:()=>PBTextShape.decode(new Uint8Array)};var ComponentIds;function defineProtocolBufferComponents({defineComponent:e}){return{Animator:e(COMPONENT_ID$g,Animator),AudioSource:e(COMPONENT_ID$f,AudioSource),AvatarAttach:e(COMPONENT_ID$e,AvatarAttach),AvatarShape:e(COMPONENT_ID$d,AvatarShape),BoxShape:e(COMPONENT_ID$c,BoxShape),CameraModeArea:e(COMPONENT_ID$b,CameraModeArea),CylinderShape:e(COMPONENT_ID$a,CylinderShape),GLTFShape:e(COMPONENT_ID$9,GLTFShape),NFTShape:e(COMPONENT_ID$8,NFTShape),OnPointerDown:e(COMPONENT_ID$7,OnPointerDown),OnPointerDownResult:e(COMPONENT_ID$6,OnPointerDownResult),OnPointerUp:e(COMPONENT_ID$5,OnPointerUp),OnPointerUpResult:e(COMPONENT_ID$4,OnPointerUpResult),PlaneShape:e(COMPONENT_ID$3,PlaneShape),SphereShape:e(COMPONENT_ID$2,SphereShape),TextShape:e(COMPONENT_ID$1,TextShape)}}!function(e){e[e.Animator=1042]="Animator",e[e.AudioSource=1020]="AudioSource",e[e.AvatarAttach=1073]="AvatarAttach",e[e.AvatarShape=1080]="AvatarShape",e[e.BoxShape=1013]="BoxShape",e[e.CameraModeArea=1071]="CameraModeArea",e[e.CylinderShape=1016]="CylinderShape",e[e.GLTFShape=1041]="GLTFShape",e[e.NFTShape=1040]="NFTShape",e[e.OnPointerDown=1060]="OnPointerDown",e[e.OnPointerDownResult=1066]="OnPointerDownResult",e[e.OnPointerUp=1061]="OnPointerUp",e[e.OnPointerUpResult=1065]="OnPointerUpResult",e[e.PlaneShape=1014]="PlaneShape",e[e.SphereShape=1015]="SphereShape",e[e.TextShape=1030]="TextShape"}(ComponentIds||(ComponentIds={}));const TRANSFORM_LENGTH=44,Transform={serialize(e,t){const r=t.incrementWriteOffset(TRANSFORM_LENGTH);t.setFloat32(r,e.position.x),t.setFloat32(r+4,e.position.y),t.setFloat32(r+8,e.position.z),t.setFloat32(r+12,e.rotation.x),t.setFloat32(r+16,e.rotation.y),t.setFloat32(r+20,e.rotation.z),t.setFloat32(r+24,e.rotation.w),t.setFloat32(r+28,e.scale.x),t.setFloat32(r+32,e.scale.y),t.setFloat32(r+36,e.scale.z),t.setUint32(r+40,e.parent||0)},deserialize(e){const t=e.incrementReadOffset(TRANSFORM_LENGTH);return{position:distExports$1.Vector3.create(e.getFloat32(t),e.getFloat32(t+4),e.getFloat32(t+8)),rotation:distExports$1.Quaternion.create(e.getFloat32(t+12),e.getFloat32(t+16),e.getFloat32(t+20),e.getFloat32(t+24)),scale:distExports$1.Vector3.create(e.getFloat32(t+28),e.getFloat32(t+32),e.getFloat32(t+36)),parent:e.getUint32(t+40)}},create:()=>({position:{x:0,y:0,z:0},scale:{x:1,y:1,z:1},rotation:{x:0,y:0,z:0,w:1},parent:void 0})};var LEGACY_COMPONENT_ID,COMPONENT_ID;function defineLegacyComponents({defineComponent:e}){return{Transform:e(LEGACY_COMPONENT_ID.TRANSFORM,Transform),...defineProtocolBufferComponents({defineComponent:e})}}function defineSdkComponents(e){return{...defineLegacyComponents(e)}}!function(e){e[e.TRANSFORM=1]="TRANSFORM",e[e.UUID_CALLBACK=8]="UUID_CALLBACK",e[e.BOX_SHAPE=16]="BOX_SHAPE",e[e.SPHERE_SHAPE=17]="SPHERE_SHAPE",e[e.PLANE_SHAPE=18]="PLANE_SHAPE",e[e.CONE_SHAPE=19]="CONE_SHAPE",e[e.CYLINDER_SHAPE=20]="CYLINDER_SHAPE",e[e.TEXT_SHAPE=21]="TEXT_SHAPE",e[e.NFT_SHAPE=22]="NFT_SHAPE",e[e.UI_WORLD_SPACE_SHAPE=23]="UI_WORLD_SPACE_SHAPE",e[e.UI_SCREEN_SPACE_SHAPE=24]="UI_SCREEN_SPACE_SHAPE",e[e.UI_CONTAINER_RECT=25]="UI_CONTAINER_RECT",e[e.UI_CONTAINER_STACK=26]="UI_CONTAINER_STACK",e[e.UI_TEXT_SHAPE=27]="UI_TEXT_SHAPE",e[e.UI_INPUT_TEXT_SHAPE=28]="UI_INPUT_TEXT_SHAPE",e[e.UI_IMAGE_SHAPE=29]="UI_IMAGE_SHAPE",e[e.UI_SLIDER_SHAPE=30]="UI_SLIDER_SHAPE",e[e.CIRCLE_SHAPE=31]="CIRCLE_SHAPE",e[e.BILLBOARD=32]="BILLBOARD",e[e.ANIMATION=33]="ANIMATION",e[e.FONT=34]="FONT",e[e.UI_FULLSCREEN_SHAPE=40]="UI_FULLSCREEN_SHAPE",e[e.UI_BUTTON_SHAPE=41]="UI_BUTTON_SHAPE",e[e.GLTF_SHAPE=54]="GLTF_SHAPE",e[e.OBJ_SHAPE=55]="OBJ_SHAPE",e[e.AVATAR_SHAPE=56]="AVATAR_SHAPE",e[e.BASIC_MATERIAL=64]="BASIC_MATERIAL",e[e.PBR_MATERIAL=65]="PBR_MATERIAL",e[e.HIGHLIGHT_ENTITY=66]="HIGHLIGHT_ENTITY",e[e.SOUND=67]="SOUND",e[e.TEXTURE=68]="TEXTURE",e[e.VIDEO_CLIP=70]="VIDEO_CLIP",e[e.VIDEO_TEXTURE=71]="VIDEO_TEXTURE",e[e.AVATAR_TEXTURE=72]="AVATAR_TEXTURE",e[e.AUDIO_CLIP=200]="AUDIO_CLIP",e[e.AUDIO_SOURCE=201]="AUDIO_SOURCE",e[e.AUDIO_STREAM=202]="AUDIO_STREAM",e[e.GIZMOS=203]="GIZMOS",e[e.SMART_ITEM=204]="SMART_ITEM",e[e.AVATAR_MODIFIER_AREA=205]="AVATAR_MODIFIER_AREA",e[e.AVATAR_ATTACH=206]="AVATAR_ATTACH",e[e.CAMERA_MODE_AREA=207]="CAMERA_MODE_AREA",e[e.NAME=300]="NAME",e[e.LOCKED_ON_EDIT=301]="LOCKED_ON_EDIT",e[e.VISIBLE_ON_EDIT=302]="VISIBLE_ON_EDIT"}(LEGACY_COMPONENT_ID||(LEGACY_COMPONENT_ID={})),function(e){e[e.SYNC=1e3]="SYNC"}(COMPONENT_ID||(COMPONENT_ID={}));var dist={},types={},hasRequiredTypes,hasRequiredDist;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,Object.defineProperty(types,"__esModule",{value:!0})),types}function requireDist(){return hasRequiredDist||(hasRequiredDist=1,function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};function n(e,t){if(e===t)return!0;if(e instanceof Uint8Array&&t instanceof Uint8Array){if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}return!!(globalThis.Buffer&&e instanceof Buffer&&t instanceof Buffer)&&e.equals(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.crdtProtocol=e.sameData=void 0,r(requireTypes(),e),e.sameData=n,e.crdtProtocol=function(){const e={};function t(t,r,n){const i=Math.max(n,e[t]?.timestamp||0);return e[t]={timestamp:i,data:r}}return{createEvent:function(r,n){const i=(e[r]?.timestamp||0)+1;return t(r,n,i),{key:r,data:n,timestamp:i}},processMessage:function(r){const{key:i,data:o,timestamp:a}=r,s=e[i];return!s||s.timestamp<a?(t(i,o,a),r):s.timestamp>a?{key:i,data:s.data,timestamp:s.timestamp}:n(s.data,o)?r:function(e,t){return e>t}(s.data,o)?{key:i,data:s.data,timestamp:s.timestamp}:(t(i,o,a).data,r)},getState:function(){return{...e}}}}}(dist)),dist}var distExports=requireDist();function getNextSize(e,t){const r=Math.max(e,t)+1024;return 1024*Math.ceil(r/1024)}const defaultInitialCapacity=10240;function createByteBuffer(e={}){var t;const r=(null===(t=e.reading)||void 0===t?void 0:t.currentOffset)||0;let n=null,i=0;e.writing?(n=e.writing.buffer,e.writing.currentOffset&&(i=e.writing.currentOffset)):e.reading?(n=e.reading.buffer,i=e.reading.length||e.reading.buffer.length):n=new Uint8Array(e.initialCapacity||defaultInitialCapacity);let o=n,a=new DataView(o.buffer,o.byteOffset),s=i,u=r;const c=e=>{if(s+e>o.byteLength){const t=getNextSize(o.byteLength,s+e),r=new Uint8Array(t);r.set(o),o=r,a=new DataView(o.buffer)}return s+=e,s-e},l=e=>{if(u+e>s)throw new Error("Outside of the bounds of writen data.");return u+=e,u-e};return{buffer:()=>o,bufferLength:()=>o.length,resetBuffer(){u=0,s=0},currentReadOffset:()=>u,currentWriteOffset:()=>s,incrementReadOffset:e=>l(e),remainingBytes:()=>s-u,readFloat32:()=>a.getFloat32(l(4)),readFloat64:()=>a.getFloat64(l(8)),readInt8:()=>a.getInt8(l(1)),readInt16:()=>a.getInt16(l(2)),readInt32:()=>a.getInt32(l(4)),readInt64:()=>a.getBigInt64(l(8)),readUint8:()=>a.getUint8(l(1)),readUint16:()=>a.getUint16(l(2)),readUint32:()=>a.getUint32(l(4)),readUint64:()=>a.getBigUint64(l(8)),readBuffer(){const e=a.getUint32(l(4));return o.subarray(l(e),l(0))},incrementWriteOffset:e=>c(e),size:()=>s,toBinary:()=>o.subarray(0,s),toCopiedBinary(){return new Uint8Array(this.toBinary())},writeBuffer(e,t=!0){t&&this.writeUint32(e.byteLength);const r=c(e.byteLength);o.set(e,r)},writeFloat32(e){const t=c(4);a.setFloat32(t,e)},writeFloat64(e){const t=c(8);a.setFloat64(t,e)},writeInt8(e){const t=c(1);a.setInt8(t,e)},writeInt16(e){const t=c(2);a.setInt16(t,e)},writeInt32(e){const t=c(4);a.setInt32(t,e)},writeInt64(e){const t=c(8);a.setBigInt64(t,e)},writeUint8(e){const t=c(1);a.setUint8(t,e)},writeUint16(e){const t=c(2);a.setUint16(t,e)},writeUint32(e){const t=c(4);a.setUint32(t,e)},writeUint64(e){const t=c(8);a.setBigUint64(t,e)},getFloat32:e=>a.getFloat32(e),getFloat64:e=>a.getFloat64(e),getInt8:e=>a.getInt8(e),getInt16:e=>a.getInt16(e),getInt32:e=>a.getInt32(e),getInt64:e=>a.getBigInt64(e),getUint8:e=>a.getUint8(e),getUint16:e=>a.getUint16(e),getUint32:e=>a.getUint32(e),getUint64:e=>a.getBigUint64(e),setFloat32(e,t){a.setFloat32(e,t)},setFloat64(e,t){a.setFloat64(e,t)},setInt8(e,t){a.setInt8(e,t)},setInt16(e,t){a.setInt16(e,t)},setInt32(e,t){a.setInt32(e,t)},setInt64(e,t){a.setBigInt64(e,t)},setUint8(e,t){a.setUint8(e,t)},setUint16(e,t){a.setUint16(e,t)},setUint32(e,t){a.setUint32(e,t)},setUint64(e,t){a.setBigUint64(e,t)}}}var WireMessage;!function(e){function t(t){const r=t.remainingBytes();if(r<e.HEADER_LENGTH)return!1;return!(r<t.getUint32(t.currentReadOffset()))}!function(e){e[e.RESERVED=0]="RESERVED",e[e.PUT_COMPONENT=1]="PUT_COMPONENT",e[e.DELETE_COMPONENT=2]="DELETE_COMPONENT",e[e.MAX_MESSAGE_TYPE=3]="MAX_MESSAGE_TYPE"}(e.Enum||(e.Enum={})),e.HEADER_LENGTH=8,e.validate=t,e.readHeader=function(e){return t(e)?{length:e.readUint32(),type:e.readUint32()}:null}}(WireMessage||(WireMessage={}));var WireMessage$1=WireMessage,ComponentOperation,CrdtUtils;!function(e){e.MESSAGE_HEADER_LENGTH=20,e.write=function(t,r,n,i,o){const a=o.incrementWriteOffset(WireMessage$1.HEADER_LENGTH+e.MESSAGE_HEADER_LENGTH);t===WireMessage$1.Enum.PUT_COMPONENT&&i.writeToByteBuffer(r,o);const s=o.size()-a;o.setUint32(a,s),o.setUint32(a+4,t),o.setUint32(a+8,r),o.setUint32(a+12,i._id),o.setUint64(a+16,BigInt(n)),o.setUint32(a+24,s-e.MESSAGE_HEADER_LENGTH-WireMessage$1.HEADER_LENGTH)},e.read=function(e){const t=WireMessage$1.readHeader(e);if(!t)return null;const r={...t,entity:e.readUint32(),componentId:e.readInt32(),timestamp:Number(e.readUint64())};return t.type===WireMessage$1.Enum.DELETE_COMPONENT?r:{...r,data:e.readBuffer()}}}(ComponentOperation||(ComponentOperation={})),function(e){var t;e.getKey=function(e,t){return`${e}.${t}`},(t=e.SynchronizedEntityType||(e.SynchronizedEntityType={}))[t.NETWORKED=0]="NETWORKED",t[t.RENDERER=1]="RENDERER"}(CrdtUtils||(CrdtUtils={}));var CrdtUtils$1=CrdtUtils,EntityUtils;function crdtSceneSystem({engine:e,transports:t}){const r=distExports.crdtProtocol(),n=[],i=[];function o(e){const t=Array.from(e);return e.length=0,t}return t.forEach((e=>{return e.onmessage=(t=e.type,function(e){const r=createByteBuffer({reading:{buffer:e,currentOffset:0}});for(;WireMessage$1.validate(r);){const e=r.currentReadOffset(),i=ComponentOperation.read(r),{type:o,entity:a,componentId:s,data:u,timestamp:c}=i;n.push({type:o,entity:a,componentId:s,data:u,timestamp:c,transportType:t,messageBuffer:r.buffer().subarray(e,r.currentReadOffset())})}});var t})),{createMessages:function(n){const a=o(i),s=createByteBuffer();for(const[i,o]of n)for(const n of o){const o=e.getComponent(n),u=o.has(i)?o.toBinary(i).toBinary():null,c=r.createEvent(CrdtUtils$1.getKey(i,n),u),l=s.currentWriteOffset(),f=o.has(i)?WireMessage$1.Enum.PUT_COMPONENT:WireMessage$1.Enum.DELETE_COMPONENT,d={type:f,componentId:n,entity:i,timestamp:c.timestamp};t.some((e=>e.filter(d)))&&(ComponentOperation.write(f,i,c.timestamp,o,s),a.push({...d,messageBuffer:s.buffer().subarray(l,s.currentWriteOffset())}))}const u=createByteBuffer();for(const e of t){u.resetBuffer();for(const t of a)e.filter(t)&&u.writeBuffer(t.messageBuffer,!1);u.size()&&e.send(u.toBinary())}},receiveMessages:function(){const a=o(n);for(const n of t){const t=createByteBuffer();for(const n of a){const{data:o,timestamp:a,componentId:s,entity:u,type:c}=n,l={key:CrdtUtils$1.getKey(u,s),data:o||null,timestamp:a},f=e.getComponent(s),d=r.processMessage(l);if(l!==d){const e=f.has(u)?WireMessage$1.Enum.PUT_COMPONENT:WireMessage$1.Enum.DELETE_COMPONENT;ComponentOperation.write(e,u,d.timestamp,f,t)}else{if(c===WireMessage$1.Enum.DELETE_COMPONENT)f.deleteFrom(u);else{const e=createByteBuffer({reading:{buffer:n.data,currentOffset:0}});f.upsertFromBinary(n.entity,e),f.clearDirty()}i.push(n)}}t.size()&&n.send(t.toBinary())}}}}function EntityContainer(){const e=Entity(EntityUtils.STATIC_ENTITIES_RANGE),t=Entity(EntityUtils.DYNAMIC_ENTITIES_RANGE);return{generateEntity:(r=!1)=>r?t.generateEntity():e.generateEntity(),removeEntity:r=>e.removeEntity(r)||t.removeEntity(r),isEntityExists:r=>EntityUtils.isReservedEntity(r)||e.getExistingEntities().has(r)||t.getExistingEntities().has(r),getExistingEntities:()=>new Set([...e.getExistingEntities(),...t.getExistingEntities()])}}function Entity(e){let t=e[0];const r=new Set;return{getExistingEntities:()=>new Set(r),generateEntity:function(){if(t>=e[1])throw new Error(`It fails trying to generate an entity out of range [${e[0]}, ${e[1]}].`);const n=t;return t++,r.add(n),n},removeEntity:function(e){return r.delete(e)}}}function deepReadonly(e){return Object.freeze({...e})}function defineComponent(e,t){const r=new Map,n=new Set;return{_id:e,isDirty:function(e){return n.has(e)},has:function(e){return r.has(e)},deleteFrom:function(e){const t=r.get(e);return r.delete(e),n.add(e),t||null},getOrNull:function(e){const t=r.get(e);return t?deepReadonly(t):null},getFrom:function(t){const n=r.get(t);if(!n)throw new Error(`[getFrom] Component ${e} for ${t} not found`);return deepReadonly(n)},create:function(i,o){if(r.get(i))throw new Error(`[create] Component ${e} for ${i} already exists`);const a=void 0===o?t.create():o;return r.set(i,a),n.add(i),a},createOrReplace:function(e,i){const o=void 0===i?t.create():i;return r.set(e,o),n.add(e),o},mutable:function(t){const i=r.get(t);if(!i)throw new Error(`[mutable] Component ${e} for ${t} not found`);return n.add(t),i},iterator:function*(){for(const[e,t]of r)yield[e,t]},dirtyIterator:function*(){for(const e of n)yield e},toBinary(n){const i=r.get(n);if(!i)throw new Error(`[toBinary] Component ${e} for ${n} not found`);const o=createByteBuffer();return t.serialize(i,o),o},writeToByteBuffer(n,i){const o=r.get(n);if(!o)throw new Error(`[writeToByteBuffer] Component ${e} for ${n} not found`);t.serialize(o,i)},updateFromBinary(t,n){if(!r.get(t))throw new Error(`[updateFromBinary] Component ${e} for ${t} not found`);return this.upsertFromBinary(t,n)},upsertFromBinary(e,i){const o=t.deserialize(i);return r.set(e,o),n.add(e),o},clearDirty:function(){n.clear()}}}!function(e){function t(e,t){return e>=t[0]&&e<=t[1]}e.MAX_ENTITIES=4294967295,e.DYNAMIC_ENTITIES_START_AT=1e5,e.RESERVED_STATIC_ENTITIES=512,e.RESERVED_ENTITIES_RANGE=[0,e.RESERVED_STATIC_ENTITIES-1],e.STATIC_ENTITIES_RANGE=[e.RESERVED_STATIC_ENTITIES,e.DYNAMIC_ENTITIES_START_AT-1],e.DYNAMIC_ENTITIES_RANGE=[e.DYNAMIC_ENTITIES_START_AT,e.MAX_ENTITIES],e.isDynamicEntity=function(r){return t(r,e.DYNAMIC_ENTITIES_RANGE)},e.isStaticEntity=function(r){return t(r,e.STATIC_ENTITIES_RANGE)},e.isReservedEntity=function(r){return t(r,e.RESERVED_ENTITIES_RANGE)}}(EntityUtils||(EntityUtils={}));const SYSTEMS_REGULAR_PRIORITY=1e5;function SystemContainer(){const e=[];function t(){e.sort(((e,t)=>t.priority-e.priority))}return{add:function(r,n,i){if(e.find((e=>e.fn===r)))throw new Error("System already added");if(i&&e.find((e=>e.name===i)))throw new Error("System name already used");e.push({fn:r,priority:n,name:i}),t()},remove:function(r){let n=-1;return n="string"==typeof r?e.findIndex((e=>e.name===r)):e.findIndex((e=>e.fn===r)),-1!==n&&(e.splice(n,1),t(),!0)},getSystems:()=>e}}function preEngine(){const e=EntityContainer(),t=new Map,r=new Map,n=SystemContainer();function i(t=!1){return e.generateEntity(t)}function*o(...e){const[t,...r]=e;for(const[n]of t.iterator()){let t=!0;for(const e of r)if(!e.has(n)){t=!1;break}t&&(yield[n,...e])}}return{entitiesComponent:r,componentsDefinition:t,addEntity:i,addDynamicEntity:function(){return i(!0)},removeEntity:function(r){for(const[,e]of t)e.has(r)&&e.deleteFrom(r);return e.removeEntity(r)},addSystem:function(e,t=SYSTEMS_REGULAR_PRIORITY,r){n.add(e,t,r)},getSystems:function(){return n.getSystems()},removeSystem:function(e){return n.remove(e)},defineComponent:function(e,r){if(t.get(e))throw new Error(`Component ${e} already declared`);const n=defineComponent(e,r);return t.set(e,n),n},mutableGroupOf:function*(...e){for(const[t,...r]of o(...e))yield[t,...r.map((e=>e.mutable(t)))]},groupOf:function*(...e){for(const[t,...r]of o(...e))yield[t,...r.map((e=>e.getFrom(t)))]},getComponent:function(e){const r=t.get(e);if(!r)throw new Error("Component not found. You need to declare the components at the beginnig of the engine declaration");return r}}}function Engine({transports:e}={}){const t=preEngine(),r=crdtSceneSystem({engine:t,transports:e||[]}),n=defineSdkComponents(t);return{addEntity:t.addEntity,addDynamicEntity:t.addDynamicEntity,removeEntity:t.removeEntity,addSystem:t.addSystem,removeSystem:t.removeSystem,defineComponent:t.defineComponent,mutableGroupOf:t.mutableGroupOf,groupOf:t.groupOf,getComponent:t.getComponent,update:function(e){r.receiveMessages();for(const r of t.getSystems())r.fn(e);const i=[n.OnPointerDownResult,n.OnPointerUpResult],o=i.map((e=>e._id));for(const e of i)for(const[r]of t.groupOf(e))e.deleteFrom(r);const a=new Map;for(const[e,r]of t.componentsDefinition)if(!o.includes(e))for(const t of r.dirtyIterator())a.has(t)||a.set(t,new Set),a.get(t).add(e);r.createMessages(a);for(const[e,r]of t.componentsDefinition)r.clearDirty()},baseComponents:n}}function MapType(e){return{serialize(t,r){for(const n in e)e[n].serialize(t[n],r)},deserialize(t){const r={};for(const n in e)r[n]=e[n].deserialize(t);return r},create(){const t={};for(const r in e)t[r]=e[r].create();return t}}}function ArrayType(e){return{serialize(t,r){r.writeUint32(t.length);for(const n of t)e.serialize(n,r)},deserialize(t){const r=[],n=t.readUint32();for(let i=0;i<n;i++)r.push(e.deserialize(t));return r},create:()=>[]}}function Optional(e){return{serialize(t,r){t?(r.writeInt8(1),e.serialize(t,r)):r.writeInt8(0)},deserialize(t){if(t.readInt8())return e.deserialize(t)},create(){}}}const Int64={serialize(e,t){t.writeInt64(BigInt(e))},deserialize:e=>Number(e.readInt64()),create:()=>0},Int32={serialize(e,t){t.writeInt32(e)},deserialize:e=>e.readInt32(),create:()=>0},Int16={serialize(e,t){t.writeInt16(e)},deserialize:e=>e.readInt16(),create:()=>0},Int8={serialize(e,t){t.writeInt8(e)},deserialize:e=>e.readInt8(),create:()=>0},Float32={serialize(e,t){t.writeFloat32(e)},deserialize:e=>e.readFloat32(),create:()=>0},Float64={serialize(e,t){t.writeFloat64(e)},deserialize:e=>e.readFloat64(),create:()=>0},FlatString={serialize(e,t){t.writeBuffer((new TextEncoder).encode(e))},deserialize:e=>(new TextDecoder).decode(e.readBuffer()),create:()=>""},EcsString=FlatString;function Enum(e){return{serialize(t,r){e.serialize(t,r)},deserialize:t=>e.deserialize(t),create:()=>e.create()}}const EcsBoolean={serialize(e,t){t.writeInt8(e?1:0)},deserialize:e=>1===e.readInt8(),create:()=>!1},componentIds=Object.values(ComponentIds).filter((e=>"number"==typeof e)).map(Number),rendererComponentIds=componentIds.concat(LEGACY_COMPONENT_ID.TRANSFORM);function createRendererTransport(){const e="renderer";return{type:e,send(e){dcl.callRpc("@decentraland/ExperimentalAPI","sendToRenderer",[{data:new Uint8Array(e)}]).catch(dcl.error)},filter:t=>t.transportType!==e&&(!!rendererComponentIds.includes(t.componentId)&&!!t)}}function createNetworkTransport(){const e="network-transport";return{send:function(...e){},type:e,filter:t=>t.transportType!==e&&!!t}}const rendererTransport=createRendererTransport(),engine=Engine({transports:[rendererTransport,createNetworkTransport()]});if(dcl){async function pullRendererMessages(){var e;const t=await dcl.callRpc("@decentraland/ExperimentalAPI","messageFromRenderer",[]);if((null===(e=t.data)||void 0===e?void 0:e.length)&&rendererTransport.onmessage)for(const e of t.data)rendererTransport.onmessage(e)}dcl.loadModule("@decentraland/ExperimentalAPI",{}).catch(dcl.error),dcl.onUpdate((e=>{pullRendererMessages().catch(dcl.error).finally((()=>engine.update(e)))}))}exports.ArrayType=ArrayType,exports.DEG2RAD=distExports$1.DEG2RAD,exports.EcsBoolean=EcsBoolean,exports.EcsString=EcsString,exports.Engine=Engine,exports.Enum=Enum,exports.Epsilon=distExports$1.Epsilon,exports.FlatString=FlatString,exports.Float32=Float32,exports.Float64=Float64,exports.Int16=Int16,exports.Int32=Int32,exports.Int64=Int64,exports.Int8=Int8,exports.MapType=MapType,exports.Optional=Optional,exports.Orientation=distExports$1.Orientation,exports.Quaternion=distExports$1.Quaternion,exports.RAD2DEG=distExports$1.RAD2DEG,exports.Space=distExports$1.Space,exports.ToGammaSpace=distExports$1.ToGammaSpace,exports.ToLinearSpace=distExports$1.ToLinearSpace,exports.Vector3=distExports$1.Vector3,exports.engine=engine,Object.defineProperty(exports,"__esModule",{value:!0})})(this.self=this.self||{});
|
1
|
+
(function(exports){"use strict";var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},dist$1={},Quaternion={},Vector3$1={},hasRequiredVector3;function requireVector3(){return hasRequiredVector3||(hasRequiredVector3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Vector3=void 0,function(e){function t(e=0,t=0,r=0){return{x:e,y:t,z:r}}function r(e,t){t.x=e.x,t.y=e.y,t.z=e.z}function n(e){return Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z)}function i(e,t,r){r.x=e.x*t,r.y=e.y*t,r.z=e.z*t}function o(e,r){const n=t(0,0,0);return a(e,r,n),n}function a(e,t,n){0!==t&&1!==t?i(e,1/t,n):r(e,n)}function s(e,t,r,n){n.x=e.x+(t.x-e.x)*r,n.y=e.y+(t.y-e.y)*r,n.z=e.z+(t.z-e.z)*r}e.create=t,e.add=function(e,t){return{x:e.x+t.x,y:e.y+t.y,z:e.z+t.z}},e.subtract=function(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}},e.subtractToRef=function(e,t,r){r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z},e.opposite=function(e){return{x:-e.x,y:-e.y,z:-e.z}},e.copy=r,e.clone=function(e){return Object.assign({},e)},e.length=n,e.lengthSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},e.scaleToRef=i,e.scale=function(e,r){return t(e.x*r,e.y*r,e.z*r)},e.normalizeFromLength=o,e.normalizeFromLengthToRef=a,e.normalize=function(e){return o(e,n(e))},e.normalizeToRef=function(e,t){a(e,n(e),t)},e.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},e.rotate=function(e,t){const{x:r,y:n,z:i}=e,{x:o,y:a,z:s,w:u}=t,c=u*r+a*i-s*n,l=u*n+s*r-o*i,f=u*i+o*n-a*r,d=-o*r-a*n-s*i;return{x:c*u+d*-o+l*-s-f*-a,y:l*u+d*-a+f*-o-c*-s,z:f*u+d*-s+c*-a-l*-o}},e.lerp=function(e,r,n){const i=t(0,0,0);return s(e,r,n,i),i},e.lerpToRef=s,e.cross=function(t,r){const n=e.Zero();return e.crossToRef(t,r,n),n},e.crossToRef=function(e,t,r){r.x=e.y*t.z-e.z*t.y,r.y=e.z*t.x-e.x*t.z,r.z=e.x*t.y-e.y*t.x},e.Zero=function(){return t(0,0,0)},e.One=function(){return t(1,1,1)},e.Up=function(){return t(0,1,0)},e.Down=function(){return t(0,-1,0)},e.Forward=function(){return t(0,0,1)},e.Backward=function(){return t(0,0,-1)},e.Right=function(){return t(1,0,0)},e.Left=function(){return t(-1,0,0)}}(e.Vector3||(e.Vector3={}))}(Vector3$1)),Vector3$1}var Scalar={},hasRequiredScalar;function requireScalar(){if(hasRequiredScalar)return Scalar;hasRequiredScalar=1,Object.defineProperty(Scalar,"__esModule",{value:!0}),Scalar.Scalar=void 0;const e=2*Math.PI;function t(e){const t=+e;return 0===t||isNaN(t)?t:t>0?1:-1}function r(e,t=0,r=1){return Math.min(r,Math.max(t,e))}function n(e,t){return e-Math.floor(e/t)*t}function i(e,t){let r=n(t-e,360);return r>180&&(r-=360),r}function o(e,r,n){let i=0;return i=Math.abs(r-e)<=n?r:e+t(r-e)*n,i}return Scalar.Scalar={withinEpsilon:function(e,t,r=1401298e-51){const n=e-t;return-r<=n&&n<=r},toHex:function(e){const t=e.toString(16);return e<=15?("0"+t).toUpperCase():t.toUpperCase()},sign:t,clamp:r,log2:function(e){return Math.log(e)*Math.LOG2E},repeat:n,normalize:function(e,t,r){return(e-t)/(r-t)},denormalize:function(e,t,r){return e*(r-t)+t},deltaAngle:i,pingPong:function(e,t){const r=n(e,2*t);return t-Math.abs(r-t)},smoothStep:function(e,t,n){let i=r(n);return i=-2*i*i*i+3*i*i,t*i+e*(1-i)},moveTowards:o,moveTowardsAngle:function(e,t,r){const n=i(e,t);let a=0;return a=-r<n&&n<r?t:o(e,e+n,r),a},lerp:function(e,t,r){return e+(t-e)*r},lerpAngle:function(e,t,i){let o=n(t-e,360);return o>180&&(o-=360),e+o*r(i)},inverseLerp:function(e,t,n){let i=0;return i=e!==t?r((n-e)/(t-e)):0,i},hermite:function(e,t,r,n,i){const o=i*i,a=i*o;return e*(2*a-3*o+1)+r*(-2*a+3*o)+t*(a-2*o+i)+n*(a-o)},randomRange:function(e,t){return e===t?e:Math.random()*(t-e)+e},rangeToPercent:function(e,t,r){return(e-t)/(r-t)},percentToRange:function(e,t,r){return(r-t)*e+t},normalizeRadians:function(t){return t-e*Math.floor((t+Math.PI)/e)},TwoPi:e},Scalar}var types$1={},hasRequiredTypes$1,hasRequiredQuaternion,hasRequiredDist$1;function requireTypes$1(){return hasRequiredTypes$1||(hasRequiredTypes$1=1,function(e){var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.RAD2DEG=e.DEG2RAD=e.Epsilon=e.ToLinearSpace=e.ToGammaSpace=e.Space=e.Orientation=void 0,(t=e.Orientation||(e.Orientation={}))[t.CW=0]="CW",t[t.CCW=1]="CCW",(r=e.Space||(e.Space={}))[r.LOCAL=0]="LOCAL",r[r.WORLD=1]="WORLD",r[r.BONE=2]="BONE",e.ToGammaSpace=1/2.2,e.ToLinearSpace=2.2,e.Epsilon=1e-6,e.DEG2RAD=Math.PI/180,e.RAD2DEG=360/(2*Math.PI)}(types$1)),types$1}function requireQuaternion(){return hasRequiredQuaternion||(hasRequiredQuaternion=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Quaternion=void 0;const t=requireVector3(),r=requireScalar(),n=requireTypes$1();!function(e){function i(e=0,t=0,r=0,n=1){return{x:e,y:t,z:r,w:n}}function o(e,t,r){const n=.5*t,o=.5*e,a=.5*r,s=Math.cos(n),u=Math.cos(o),c=Math.cos(a),l=Math.sin(n),f=Math.sin(o),d=Math.sin(a);return i(u*l*c+f*s*d,f*s*c-u*l*d,u*s*d-f*l*c,u*s*c+f*l*d)}function a(e){return Math.sqrt(s(e))}function s(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w}function u(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w}function c(e,t){const r=u(e,t);return 2*Math.acos(Math.min(Math.abs(r),1))*n.RAD2DEG}function l(e){const t=1/a(e);return i(e.x*t,e.y*t,e.z*t,e.w*t)}function f(){return i(0,0,0,1)}function d(t,r,n){const i=e.Identity();return e.slerpToRef(t,r,n,i),i}function p(e,t,r){r.x=e.x*t.w+e.y*t.z-e.z*t.y+e.w*t.x,r.y=-e.x*t.z+e.y*t.w+e.z*t.x+e.w*t.y,r.z=e.x*t.y-e.y*t.x+e.z*t.w+e.w*t.z,r.w=-e.x*t.x-e.y*t.y-e.z*t.z+e.w*t.w}e.create=i,e.add=function(e,t){return{x:e.x+t.x,y:e.y+t.y,z:e.z+t.z,w:e.w+t.w}},e.rotationYawPitchRoll=o,e.euler=function(e,t,r){return o(t*n.DEG2RAD,e*n.DEG2RAD,r*n.DEG2RAD)},e.length=a,e.lengthSquared=s,e.dot=u,e.angle=c,e.rotateTowards=function(e,t,r){const n=c(e,t);return 0===n?t:d(e,t,Math.min(1,r/n))},e.lookRotation=function(e,r={x:0,y:1,z:0}){const n=t.Vector3.normalize(e),o=t.Vector3.normalize(t.Vector3.cross(r,n)),a=t.Vector3.cross(n,o),s=o.x,u=o.y,c=o.z,l=a.x,f=a.y,d=a.z,p=n.x,h=n.y,m=n.z,y=s+f+m,E=i();if(y>0){let e=Math.sqrt(y+1);return E.w=.5*e,e=.5/e,E.x=(d-h)*e,E.y=(p-c)*e,E.z=(u-l)*e,E}if(s>=f&&s>=m){const e=Math.sqrt(1+s-f-m),t=.5/e;return E.x=.5*e,E.y=(u+l)*t,E.z=(c+p)*t,E.w=(d-h)*t,E}if(f>m){const e=Math.sqrt(1+f-s-m),t=.5/e;return E.x=(l+u)*t,E.y=.5*e,E.z=(h+d)*t,E.w=(p-c)*t,E}const g=Math.sqrt(1+m-s-f),b=.5/g;return E.x=(p+c)*b,E.y=(h+d)*b,E.z=.5*g,E.w=(u-l)*b,E},e.normalize=l,e.fromToRotation=function(e,r,n=t.Vector3.Up()){const o=t.Vector3.normalize(e),a=t.Vector3.normalize(r),s=t.Vector3.cross(o,a),u=Math.sqrt(t.Vector3.lengthSquared(o)*t.Vector3.lengthSquared(a))+t.Vector3.dot(o,a);return t.Vector3.lengthSquared(s)<1e-4?Math.abs(u)<1e-4?l(i(n.x,n.y,n.z,0)):f():l(i(s.x,s.y,s.z,u))},e.Identity=f,e.eulerAngles=function(e){const i=t.Vector3.create(),o=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w,a=e.x*e.w-e.y*e.z;return a>.4995*o?(i.x=Math.PI/2,i.y=2*Math.atan2(e.y,e.x),i.z=0):a<-.4995*o?(i.x=-Math.PI/2,i.y=-2*Math.atan2(e.y,e.x),i.z=0):(i.x=Math.asin(2*(e.w*e.x-e.y*e.z)),i.y=Math.atan2(2*e.w*e.y+2*e.z*e.x,1-2*(e.x*e.x+e.y*e.y)),i.z=Math.atan2(2*e.w*e.z+2*e.x*e.y,1-2*(e.z*e.z+e.x*e.x))),i.x*=n.RAD2DEG,i.y*=n.RAD2DEG,i.z*=n.RAD2DEG,i.x=r.Scalar.repeat(i.x,360),i.y=r.Scalar.repeat(i.y,360),i.z=r.Scalar.repeat(i.z,360),i},e.rotationYawPitchRollToRef=function(e,t,r,n){const i=.5*t,o=.5*e,a=.5*r,s=Math.cos(i),u=Math.cos(o),c=Math.cos(a),l=Math.sin(i),f=Math.sin(o),d=Math.sin(a);n.x=u*l*c+f*s*d,n.y=f*s*c-u*l*d,n.z=u*s*d-f*l*c,n.w=u*s*c+f*l*d},e.fromRotationMatrixToRef=function(e,t){const r=e._m,n=r[0],i=r[4],o=r[8],a=r[1],s=r[5],u=r[9],c=r[2],l=r[6],f=r[10],d=n+s+f;let p;d>0?(p=.5/Math.sqrt(d+1),t.w=.25/p,t.x=(l-u)*p,t.y=(o-c)*p,t.z=(a-i)*p):n>s&&n>f?(p=2*Math.sqrt(1+n-s-f),t.w=(l-u)/p,t.x=.25*p,t.y=(i+a)/p,t.z=(o+c)/p):s>f?(p=2*Math.sqrt(1+s-n-f),t.w=(o-c)/p,t.x=(i+a)/p,t.y=.25*p,t.z=(u+l)/p):(p=2*Math.sqrt(1+f-n-s),t.w=(a-i)/p,t.x=(o+c)/p,t.y=(u+l)/p,t.z=.25*p)},e.slerp=d,e.slerpToRef=function(e,t,r,n){let i,o,a=e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w,s=!1;if(a<0&&(s=!0,a=-a),a>.999999)o=1-r,i=s?-r:r;else{const e=Math.acos(a),t=1/Math.sin(e);o=Math.sin((1-r)*e)*t,i=s?-Math.sin(r*e)*t:Math.sin(r*e)*t}n.x=o*e.x+i*t.x,n.y=o*e.y+i*t.y,n.z=o*e.z+i*t.z,n.w=o*e.w+i*t.w},e.multiply=function(e,t){const r=i(0,0,0,1);return p(e,t,r),r},e.multiplyToRef=p,e.angleAxis=function(r,i){if(0===t.Vector3.lengthSquared(i))return e.Identity();const o=f();let a=r*n.DEG2RAD;a*=.5;const s=t.Vector3.normalize(i);return t.Vector3.scaleToRef(s,Math.sin(a),s),o.x=s.x,o.y=s.y,o.z=s.z,o.w=Math.cos(a),l(o)},e.Zero=function(){return i(0,0,0,0)}}(e.Quaternion||(e.Quaternion={}))}(Quaternion)),Quaternion}function requireDist$1(){return hasRequiredDist$1||(hasRequiredDist$1=1,function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(requireQuaternion(),e),r(requireVector3(),e),r(requireTypes$1(),e),r(requireDist$1(),e)}(dist$1)),dist$1}var distExports$1=requireDist$1(),minimal$1={exports:{}},indexMinimal={},minimal={},aspromise,hasRequiredAspromise;function requireAspromise(){if(hasRequiredAspromise)return aspromise;return hasRequiredAspromise=1,aspromise=function(e,t){var r=new Array(arguments.length-1),n=0,i=2,o=!0;for(;i<arguments.length;)r[n++]=arguments[i++];return new Promise((function(i,a){r[n]=function(e){if(o)if(o=!1,e)a(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];i.apply(null,t)}};try{e.apply(t||null,r)}catch(e){o&&(o=!1,a(e))}}))}}var base64={},hasRequiredBase64,eventemitter,hasRequiredEventemitter,float,hasRequiredFloat,inquire_1,hasRequiredInquire;function requireBase64(){return hasRequiredBase64||(hasRequiredBase64=1,function(e){var t=e;t.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var r=new Array(64),n=new Array(123),i=0;i<64;)n[r[i]=i<26?i+65:i<52?i+71:i<62?i-4:i-59|43]=i++;t.encode=function(e,t,n){for(var i,o=null,a=[],s=0,u=0;t<n;){var c=e[t++];switch(u){case 0:a[s++]=r[c>>2],i=(3&c)<<4,u=1;break;case 1:a[s++]=r[i|c>>4],i=(15&c)<<2,u=2;break;case 2:a[s++]=r[i|c>>6],a[s++]=r[63&c],u=0}s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,a)),s=0)}return u&&(a[s++]=r[i],a[s++]=61,1===u&&(a[s++]=61)),o?(s&&o.push(String.fromCharCode.apply(String,a.slice(0,s))),o.join("")):String.fromCharCode.apply(String,a.slice(0,s))};var o="invalid encoding";t.decode=function(e,t,r){for(var i,a=r,s=0,u=0;u<e.length;){var c=e.charCodeAt(u++);if(61===c&&s>1)break;if(void 0===(c=n[c]))throw Error(o);switch(s){case 0:i=c,s=1;break;case 1:t[r++]=i<<2|(48&c)>>4,i=c,s=2;break;case 2:t[r++]=(15&i)<<4|(60&c)>>2,i=c,s=3;break;case 3:t[r++]=(3&i)<<6|c,s=0}}if(1===s)throw Error(o);return r-a},t.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}}(base64)),base64}function requireEventemitter(){if(hasRequiredEventemitter)return eventemitter;function e(){this._listeners={}}return hasRequiredEventemitter=1,eventemitter=e,e.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},e.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},e.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this},eventemitter}function requireFloat(){if(hasRequiredFloat)return float;function e(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3]}function o(e,n,i){t[0]=e,n[i]=r[3],n[i+1]=r[2],n[i+2]=r[1],n[i+3]=r[0]}function a(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function s(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?i:o,e.writeFloatBE=n?o:i,e.readFloatLE=n?a:s,e.readFloatBE=n?s:a}():function(){function o(e,t,r,n){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var o=Math.floor(Math.log(t)/Math.LN2);e((i<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,r,n)}}function a(e,t,r){var n=e(t,r),i=2*(n>>31)+1,o=n>>>23&255,a=8388607&n;return 255===o?a?NaN:i*(1/0):0===o?1401298464324817e-60*i*a:i*Math.pow(2,o-150)*(a+8388608)}e.writeFloatLE=o.bind(null,t),e.writeFloatBE=o.bind(null,r),e.readFloatLE=a.bind(null,n),e.readFloatBE=a.bind(null,i)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3],n[i+4]=r[4],n[i+5]=r[5],n[i+6]=r[6],n[i+7]=r[7]}function o(e,n,i){t[0]=e,n[i]=r[7],n[i+1]=r[6],n[i+2]=r[5],n[i+3]=r[4],n[i+4]=r[3],n[i+5]=r[2],n[i+6]=r[1],n[i+7]=r[0]}function a(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function s(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?i:o,e.writeDoubleBE=n?o:i,e.readDoubleLE=n?a:s,e.readDoubleBE=n?s:a}():function(){function o(e,t,r,n,i,o){var a=n<0?1:0;if(a&&(n=-n),0===n)e(0,i,o+t),e(1/n>0?0:2147483648,i,o+r);else if(isNaN(n))e(0,i,o+t),e(2146959360,i,o+r);else if(n>17976931348623157e292)e(0,i,o+t),e((a<<31|2146435072)>>>0,i,o+r);else{var s;if(n<22250738585072014e-324)e((s=n/5e-324)>>>0,i,o+t),e((a<<31|s/4294967296)>>>0,i,o+r);else{var u=Math.floor(Math.log(n)/Math.LN2);1024===u&&(u=1023),e(4503599627370496*(s=n*Math.pow(2,-u))>>>0,i,o+t),e((a<<31|u+1023<<20|1048576*s&1048575)>>>0,i,o+r)}}}function a(e,t,r,n,i){var o=e(n,i+t),a=e(n,i+r),s=2*(a>>31)+1,u=a>>>20&2047,c=4294967296*(1048575&a)+o;return 2047===u?c?NaN:s*(1/0):0===u?5e-324*s*c:s*Math.pow(2,u-1075)*(c+4503599627370496)}e.writeDoubleLE=o.bind(null,t,0,4),e.writeDoubleBE=o.bind(null,r,4,0),e.readDoubleLE=a.bind(null,n,0,4),e.readDoubleBE=a.bind(null,i,4,0)}(),e}function t(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function r(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function n(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function i(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}return hasRequiredFloat=1,float=e(e)}function requireInquire(){if(hasRequiredInquire)return inquire_1;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}return hasRequiredInquire=1,inquire_1=inquire,inquire_1}var utf8={},hasRequiredUtf8,pool_1,hasRequiredPool,longbits,hasRequiredLongbits,hasRequiredMinimal$1,writer,hasRequiredWriter,writer_buffer,hasRequiredWriter_buffer,reader,hasRequiredReader,reader_buffer,hasRequiredReader_buffer;function requireUtf8(){return hasRequiredUtf8||(hasRequiredUtf8=1,function(e){var t=e;t.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)(r=e.charCodeAt(n))<128?t+=1:r<2048?t+=2:55296==(64512&r)&&56320==(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},t.read=function(e,t,r){if(r-t<1)return"";for(var n,i=null,o=[],a=0;t<r;)(n=e[t++])<128?o[a++]=n:n>191&&n<224?o[a++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[a++]=55296+(n>>10),o[a++]=56320+(1023&n)):o[a++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),a=0);return i?(a&&i.push(String.fromCharCode.apply(String,o.slice(0,a))),i.join("")):String.fromCharCode.apply(String,o.slice(0,a))},t.write=function(e,t,r){for(var n,i,o=r,a=0;a<e.length;++a)(n=e.charCodeAt(a))<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296==(64512&n)&&56320==(64512&(i=e.charCodeAt(a+1)))?(n=65536+((1023&n)<<10)+(1023&i),++a,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-o}}(utf8)),utf8}function requirePool(){if(hasRequiredPool)return pool_1;return hasRequiredPool=1,pool_1=function(e,t,r){var n=r||8192,i=n>>>1,o=null,a=n;return function(r){if(r<1||r>i)return e(r);a+r>n&&(o=e(n),a=0);var s=t.call(o,a,a+=r);return 7&a&&(a=1+(7|a)),s}}}function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=t;var e=requireMinimal$1();function t(e,t){this.lo=e>>>0,this.hi=t>>>0}var r=t.zero=new t(0,0);r.toNumber=function(){return 0},r.zzEncode=r.zzDecode=function(){return this},r.length=function(){return 1};var n=t.zeroHash="\0\0\0\0\0\0\0\0";t.fromNumber=function(e){if(0===e)return r;var n=e<0;n&&(e=-e);var i=e>>>0,o=(e-i)/4294967296>>>0;return n&&(o=~o>>>0,i=~i>>>0,++i>4294967295&&(i=0,++o>4294967295&&(o=0))),new t(i,o)},t.from=function(n){if("number"==typeof n)return t.fromNumber(n);if(e.isString(n)){if(!e.Long)return t.fromNumber(parseInt(n,10));n=e.Long.fromString(n)}return n.low||n.high?new t(n.low>>>0,n.high>>>0):r},t.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},t.prototype.toLong=function(t){return e.Long?new e.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}};var i=String.prototype.charCodeAt;return t.fromHash=function(e){return e===n?r:new t((i.call(e,0)|i.call(e,1)<<8|i.call(e,2)<<16|i.call(e,3)<<24)>>>0,(i.call(e,4)|i.call(e,5)<<8|i.call(e,6)<<16|i.call(e,7)<<24)>>>0)},t.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},t.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},t.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},t.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10},longbits}function requireMinimal$1(){return hasRequiredMinimal$1||(hasRequiredMinimal$1=1,function(e){var t=e;function r(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function n(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&r(this,n)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}t.asPromise=requireAspromise(),t.base64=requireBase64(),t.EventEmitter=requireEventemitter(),t.float=requireFloat(),t.inquire=requireInquire(),t.utf8=requireUtf8(),t.pool=requirePool(),t.LongBits=requireLongbits(),t.isNode=Boolean(void 0!==commonjsGlobal&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),t.global=t.isNode&&commonjsGlobal||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||commonjsGlobal,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},t.isString=function(e){return"string"==typeof e||e instanceof String},t.isObject=function(e){return e&&"object"==typeof e},t.isset=t.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},t.Buffer=function(){try{var e=t.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(e){return"number"==typeof e?t.Buffer?t._Buffer_allocUnsafe(e):new t.Array(e):t.Buffer?t._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},t.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(e){return e?t.LongBits.from(e).toHash():t.LongBits.zeroHash},t.longFromHash=function(e,r){var n=t.LongBits.fromHash(e);return t.Long?t.Long.fromBits(n.lo,n.hi,r):n.toNumber(Boolean(r))},t.merge=r,t.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},t.newError=n,t.ProtocolError=n("ProtocolError"),t.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},t.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var e=t.Buffer;e?(t._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},t._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):t._Buffer_from=t._Buffer_allocUnsafe=null}}(minimal)),minimal}function requireWriter(){if(hasRequiredWriter)return writer;hasRequiredWriter=1,writer=u;var e,t=requireMinimal$1(),r=t.LongBits,n=t.base64,i=t.utf8;function o(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function a(){}function s(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function u(){this.len=0,this.head=new o(a,0,0),this.tail=this.head,this.states=null}var c=function(){return t.Buffer?function(){return(u.create=function(){return new e})()}:function(){return new u}};function l(e,t,r){t[r]=255&e}function f(e,t){this.len=e,this.next=void 0,this.val=t}function d(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function p(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}u.create=c(),u.alloc=function(e){return new t.Array(e)},t.Array!==Array&&(u.alloc=t.pool(u.alloc,t.Array.prototype.subarray)),u.prototype._push=function(e,t,r){return this.tail=this.tail.next=new o(e,t,r),this.len+=t,this},f.prototype=Object.create(o.prototype),f.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},u.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new f((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},u.prototype.int32=function(e){return e<0?this._push(d,10,r.fromNumber(e)):this.uint32(e)},u.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},u.prototype.uint64=function(e){var t=r.from(e);return this._push(d,t.length(),t)},u.prototype.int64=u.prototype.uint64,u.prototype.sint64=function(e){var t=r.from(e).zzEncode();return this._push(d,t.length(),t)},u.prototype.bool=function(e){return this._push(l,1,e?1:0)},u.prototype.fixed32=function(e){return this._push(p,4,e>>>0)},u.prototype.sfixed32=u.prototype.fixed32,u.prototype.fixed64=function(e){var t=r.from(e);return this._push(p,4,t.lo)._push(p,4,t.hi)},u.prototype.sfixed64=u.prototype.fixed64,u.prototype.float=function(e){return this._push(t.float.writeFloatLE,4,e)},u.prototype.double=function(e){return this._push(t.float.writeDoubleLE,8,e)};var h=t.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};return u.prototype.bytes=function(e){var r=e.length>>>0;if(!r)return this._push(l,1,0);if(t.isString(e)){var i=u.alloc(r=n.length(e));n.decode(e,i,0),e=i}return this.uint32(r)._push(h,r,e)},u.prototype.string=function(e){var t=i.length(e);return t?this.uint32(t)._push(i.write,t,e):this._push(l,1,0)},u.prototype.fork=function(){return this.states=new s(this),this.head=this.tail=new o(a,0,0),this.len=0,this},u.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new o(a,0,0),this.len=0),this},u.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},u.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},u._configure=function(t){e=t,u.create=c(),e._configure()},writer}function requireWriter_buffer(){if(hasRequiredWriter_buffer)return writer_buffer;hasRequiredWriter_buffer=1,writer_buffer=r;var e=requireWriter();(r.prototype=Object.create(e.prototype)).constructor=r;var t=requireMinimal$1();function r(){e.call(this)}function n(e,r,n){e.length<40?t.utf8.write(e,r,n):r.utf8Write?r.utf8Write(e,n):r.write(e,n)}return r._configure=function(){r.alloc=t._Buffer_allocUnsafe,r.writeBytesBuffer=t.Buffer&&t.Buffer.prototype instanceof Uint8Array&&"set"===t.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},r.prototype.bytes=function(e){t.isString(e)&&(e=t._Buffer_from(e,"base64"));var n=e.length>>>0;return this.uint32(n),n&&this._push(r.writeBytesBuffer,n,e),this},r.prototype.string=function(e){var r=t.Buffer.byteLength(e);return this.uint32(r),r&&this._push(n,r,e),this},r._configure(),writer_buffer}function requireReader(){if(hasRequiredReader)return reader;hasRequiredReader=1,reader=o;var e,t=requireMinimal$1(),r=t.LongBits,n=t.utf8;function i(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function o(e){this.buf=e,this.pos=0,this.len=e.length}var a,s="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new o(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new o(e);throw Error("illegal buffer")},u=function(){return t.Buffer?function(r){return(o.create=function(r){return t.Buffer.isBuffer(r)?new e(r):s(r)})(r)}:s};function c(){var e=new r(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw i(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw i(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function l(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw i(this,8);return new r(l(this.buf,this.pos+=4),l(this.buf,this.pos+=4))}return o.create=u(),o.prototype._slice=t.Array.prototype.subarray||t.Array.prototype.slice,o.prototype.uint32=(a=4294967295,function(){if(a=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return a;if(a=(a|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return a;if(a=(a|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return a;if(a=(a|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return a;if(a=(a|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return a;if((this.pos+=5)>this.len)throw this.pos=this.len,i(this,10);return a}),o.prototype.int32=function(){return 0|this.uint32()},o.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},o.prototype.bool=function(){return 0!==this.uint32()},o.prototype.fixed32=function(){if(this.pos+4>this.len)throw i(this,4);return l(this.buf,this.pos+=4)},o.prototype.sfixed32=function(){if(this.pos+4>this.len)throw i(this,4);return 0|l(this.buf,this.pos+=4)},o.prototype.float=function(){if(this.pos+4>this.len)throw i(this,4);var e=t.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},o.prototype.double=function(){if(this.pos+8>this.len)throw i(this,4);var e=t.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},o.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw i(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},o.prototype.string=function(){var e=this.bytes();return n.read(e,0,e.length)},o.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw i(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw i(this)}while(128&this.buf[this.pos++]);return this},o.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},o._configure=function(r){e=r,o.create=u(),e._configure();var n=t.Long?"toLong":"toNumber";t.merge(o.prototype,{int64:function(){return c.call(this)[n](!1)},uint64:function(){return c.call(this)[n](!0)},sint64:function(){return c.call(this).zzDecode()[n](!1)},fixed64:function(){return f.call(this)[n](!0)},sfixed64:function(){return f.call(this)[n](!1)}})},reader}function requireReader_buffer(){if(hasRequiredReader_buffer)return reader_buffer;hasRequiredReader_buffer=1,reader_buffer=r;var e=requireReader();(r.prototype=Object.create(e.prototype)).constructor=r;var t=requireMinimal$1();function r(t){e.call(this,t)}return r._configure=function(){t.Buffer&&(r.prototype._slice=t.Buffer.prototype.slice)},r.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},r._configure(),reader_buffer}var rpc={},service,hasRequiredService,hasRequiredRpc,roots,hasRequiredRoots,hasRequiredIndexMinimal,hasRequiredMinimal;function requireService(){if(hasRequiredService)return service;hasRequiredService=1,service=t;var e=requireMinimal$1();function t(t,r,n){if("function"!=typeof t)throw TypeError("rpcImpl must be a function");e.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=Boolean(r),this.responseDelimited=Boolean(n)}return(t.prototype=Object.create(e.EventEmitter.prototype)).constructor=t,t.prototype.rpcCall=function t(r,n,i,o,a){if(!o)throw TypeError("request must be specified");var s=this;if(!a)return e.asPromise(t,s,r,n,i,o);if(s.rpcImpl)try{return s.rpcImpl(r,n[s.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,t){if(e)return s.emit("error",e,r),a(e);if(null!==t){if(!(t instanceof i))try{t=i[s.responseDelimited?"decodeDelimited":"decode"](t)}catch(e){return s.emit("error",e,r),a(e)}return s.emit("data",t,r),a(null,t)}s.end(!0)}))}catch(e){return s.emit("error",e,r),void setTimeout((function(){a(e)}),0)}else setTimeout((function(){a(Error("already ended"))}),0)},t.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},service}function requireRpc(){return hasRequiredRpc||(hasRequiredRpc=1,function(e){e.Service=requireService()}(rpc)),rpc}function requireRoots(){return hasRequiredRoots?roots:(hasRequiredRoots=1,roots={})}function requireIndexMinimal(){return hasRequiredIndexMinimal||(hasRequiredIndexMinimal=1,function(e){var t=e;function r(){t.util._configure(),t.Writer._configure(t.BufferWriter),t.Reader._configure(t.BufferReader)}t.build="minimal",t.Writer=requireWriter(),t.BufferWriter=requireWriter_buffer(),t.Reader=requireReader(),t.BufferReader=requireReader_buffer(),t.util=requireMinimal$1(),t.rpc=requireRpc(),t.roots=requireRoots(),t.configure=r,r()}(indexMinimal)),indexMinimal}function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,minimal$1.exports=requireIndexMinimal()),minimal$1.exports}var minimalExports=requireMinimal();function createBasePBAnimator(){return{states:[]}}const PBAnimator={encode(e,t=minimalExports.Writer.create()){for(const r of e.states)PBAnimationState.encode(r,t.uint32(10).fork()).ldelim();return t},decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBAnimator();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.states.push(PBAnimationState.decode(r,r.uint32()));break;default:r.skipType(7&e)}}return i}};function createBasePBAnimationState(){return{name:"",clip:"",playing:!1,weight:0,speed:0,loop:!1,shouldReset:!1}}const PBAnimationState={encode:(e,t=minimalExports.Writer.create())=>(""!==e.name&&t.uint32(10).string(e.name),""!==e.clip&&t.uint32(18).string(e.clip),!0===e.playing&&t.uint32(24).bool(e.playing),0!==e.weight&&t.uint32(37).float(e.weight),0!==e.speed&&t.uint32(45).float(e.speed),!0===e.loop&&t.uint32(48).bool(e.loop),!0===e.shouldReset&&t.uint32(56).bool(e.shouldReset),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBAnimationState();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.name=r.string();break;case 2:i.clip=r.string();break;case 3:i.playing=r.bool();break;case 4:i.weight=r.float();break;case 5:i.speed=r.float();break;case 6:i.loop=r.bool();break;case 7:i.shouldReset=r.bool();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$h=1042,Animator={serialize(e,t){const r=PBAnimator.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBAnimator.decode(e.buffer(),e.remainingBytes()),create:()=>PBAnimator.decode(new Uint8Array)};function createBasePBAudioSource(){return{playing:!1,volume:0,loop:!1,pitch:0,audioClipUrl:""}}const PBAudioSource={encode:(e,t=minimalExports.Writer.create())=>(!0===e.playing&&t.uint32(8).bool(e.playing),0!==e.volume&&t.uint32(21).float(e.volume),!0===e.loop&&t.uint32(24).bool(e.loop),0!==e.pitch&&t.uint32(37).float(e.pitch),""!==e.audioClipUrl&&t.uint32(42).string(e.audioClipUrl),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBAudioSource();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.playing=r.bool();break;case 2:i.volume=r.float();break;case 3:i.loop=r.bool();break;case 4:i.pitch=r.float();break;case 5:i.audioClipUrl=r.string();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$g=1020,AudioSource={serialize(e,t){const r=PBAudioSource.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBAudioSource.decode(e.buffer(),e.remainingBytes()),create:()=>PBAudioSource.decode(new Uint8Array)};function createBasePBAvatarAttach(){return{avatarId:"",anchorPointId:0}}const PBAvatarAttach={encode:(e,t=minimalExports.Writer.create())=>(""!==e.avatarId&&t.uint32(10).string(e.avatarId),0!==e.anchorPointId&&t.uint32(16).int32(e.anchorPointId),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBAvatarAttach();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.avatarId=r.string();break;case 2:i.anchorPointId=r.int32();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$f=1073,AvatarAttach={serialize(e,t){const r=PBAvatarAttach.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBAvatarAttach.decode(e.buffer(),e.remainingBytes()),create:()=>PBAvatarAttach.decode(new Uint8Array)};function createBaseColor3(){return{r:0,g:0,b:0}}const Color3={encode:(e,t=minimalExports.Writer.create())=>(0!==e.r&&t.uint32(13).float(e.r),0!==e.g&&t.uint32(21).float(e.g),0!==e.b&&t.uint32(29).float(e.b),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBaseColor3();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.r=r.float();break;case 2:i.g=r.float();break;case 3:i.b=r.float();break;default:r.skipType(7&e)}}return i}};function createBasePBAvatarShape(){return{id:"",name:"",bodyShape:"",skinColor:void 0,hairColor:void 0,eyeColor:void 0,wearables:[],expressionTriggerId:"",expressionTriggerTimestamp:0,stickerTriggerId:"",stickerTriggerTimestamp:0,talking:!1}}const PBAvatarShape={encode(e,t=minimalExports.Writer.create()){""!==e.id&&t.uint32(10).string(e.id),""!==e.name&&t.uint32(18).string(e.name),""!==e.bodyShape&&t.uint32(26).string(e.bodyShape),void 0!==e.skinColor&&Color3.encode(e.skinColor,t.uint32(34).fork()).ldelim(),void 0!==e.hairColor&&Color3.encode(e.hairColor,t.uint32(42).fork()).ldelim(),void 0!==e.eyeColor&&Color3.encode(e.eyeColor,t.uint32(50).fork()).ldelim();for(const r of e.wearables)t.uint32(58).string(r);return""!==e.expressionTriggerId&&t.uint32(66).string(e.expressionTriggerId),0!==e.expressionTriggerTimestamp&&t.uint32(72).int64(e.expressionTriggerTimestamp),""!==e.stickerTriggerId&&t.uint32(82).string(e.stickerTriggerId),0!==e.stickerTriggerTimestamp&&t.uint32(88).int64(e.stickerTriggerTimestamp),!0===e.talking&&t.uint32(96).bool(e.talking),t},decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBAvatarShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.id=r.string();break;case 2:i.name=r.string();break;case 3:i.bodyShape=r.string();break;case 4:i.skinColor=Color3.decode(r,r.uint32());break;case 5:i.hairColor=Color3.decode(r,r.uint32());break;case 6:i.eyeColor=Color3.decode(r,r.uint32());break;case 7:i.wearables.push(r.string());break;case 8:i.expressionTriggerId=r.string();break;case 9:i.expressionTriggerTimestamp=longToNumber(r.int64());break;case 10:i.stickerTriggerId=r.string();break;case 11:i.stickerTriggerTimestamp=longToNumber(r.int64());break;case 12:i.talking=r.bool();break;default:r.skipType(7&e)}}return i}};var globalThis$1=(()=>{if(void 0!==globalThis$1)return globalThis$1;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw"Unable to locate global object"})();function longToNumber(e){if(e.gt(Number.MAX_SAFE_INTEGER))throw new globalThis$1.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}const COMPONENT_ID$e=1080,AvatarShape={serialize(e,t){const r=PBAvatarShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBAvatarShape.decode(e.buffer(),e.remainingBytes()),create:()=>PBAvatarShape.decode(new Uint8Array)};function createBasePBBillboard(){return{x:!1,y:!1,z:!1}}const PBBillboard={encode:(e,t=minimalExports.Writer.create())=>(!0===e.x&&t.uint32(8).bool(e.x),!0===e.y&&t.uint32(16).bool(e.y),!0===e.z&&t.uint32(24).bool(e.z),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBBillboard();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.x=r.bool();break;case 2:i.y=r.bool();break;case 3:i.z=r.bool();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$d=1090,Billboard={serialize(e,t){const r=PBBillboard.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBBillboard.decode(e.buffer(),e.remainingBytes()),create:()=>PBBillboard.decode(new Uint8Array)};function createBasePBBoxShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1,uvs:[]}}const PBBoxShape={encode(e,t=minimalExports.Writer.create()){!0===e.withCollisions&&t.uint32(8).bool(e.withCollisions),!0===e.isPointerBlocker&&t.uint32(16).bool(e.isPointerBlocker),!0===e.visible&&t.uint32(24).bool(e.visible),t.uint32(34).fork();for(const r of e.uvs)t.float(r);return t.ldelim(),t},decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBBoxShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.withCollisions=r.bool();break;case 2:i.isPointerBlocker=r.bool();break;case 3:i.visible=r.bool();break;case 4:if(2==(7&e)){const e=r.uint32()+r.pos;for(;r.pos<e;)i.uvs.push(r.float())}else i.uvs.push(r.float());break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$c=1013,BoxShape={serialize(e,t){const r=PBBoxShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBBoxShape.decode(e.buffer(),e.remainingBytes()),create:()=>PBBoxShape.decode(new Uint8Array)};function createBaseVector3(){return{x:0,y:0,z:0}}const Vector3={encode:(e,t=minimalExports.Writer.create())=>(0!==e.x&&t.uint32(13).float(e.x),0!==e.y&&t.uint32(21).float(e.y),0!==e.z&&t.uint32(29).float(e.z),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBaseVector3();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.x=r.float();break;case 2:i.y=r.float();break;case 3:i.z=r.float();break;default:r.skipType(7&e)}}return i}};var CameraMode;function createBasePBCameraModeArea(){return{area:void 0,mode:0}}!function(e){e[e.FIRST_PERSON=0]="FIRST_PERSON",e[e.THIRD_PERSON=1]="THIRD_PERSON",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(CameraMode||(CameraMode={}));const PBCameraModeArea={encode:(e,t=minimalExports.Writer.create())=>(void 0!==e.area&&Vector3.encode(e.area,t.uint32(10).fork()).ldelim(),0!==e.mode&&t.uint32(16).int32(e.mode),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBCameraModeArea();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.area=Vector3.decode(r,r.uint32());break;case 2:i.mode=r.int32();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$b=1071,CameraModeArea={serialize(e,t){const r=PBCameraModeArea.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBCameraModeArea.decode(e.buffer(),e.remainingBytes()),create:()=>PBCameraModeArea.decode(new Uint8Array)};function createBasePBCylinderShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1,radiusTop:0,radiusBottom:0}}const PBCylinderShape={encode:(e,t=minimalExports.Writer.create())=>(!0===e.withCollisions&&t.uint32(8).bool(e.withCollisions),!0===e.isPointerBlocker&&t.uint32(16).bool(e.isPointerBlocker),!0===e.visible&&t.uint32(24).bool(e.visible),0!==e.radiusTop&&t.uint32(37).float(e.radiusTop),0!==e.radiusBottom&&t.uint32(45).float(e.radiusBottom),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBCylinderShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.withCollisions=r.bool();break;case 2:i.isPointerBlocker=r.bool();break;case 3:i.visible=r.bool();break;case 4:i.radiusTop=r.float();break;case 5:i.radiusBottom=r.float();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$a=1016,CylinderShape={serialize(e,t){const r=PBCylinderShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBCylinderShape.decode(e.buffer(),e.remainingBytes()),create:()=>PBCylinderShape.decode(new Uint8Array)};function createBasePBGLTFShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1,src:""}}const PBGLTFShape={encode:(e,t=minimalExports.Writer.create())=>(!0===e.withCollisions&&t.uint32(8).bool(e.withCollisions),!0===e.isPointerBlocker&&t.uint32(16).bool(e.isPointerBlocker),!0===e.visible&&t.uint32(24).bool(e.visible),""!==e.src&&t.uint32(34).string(e.src),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBGLTFShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.withCollisions=r.bool();break;case 2:i.isPointerBlocker=r.bool();break;case 3:i.visible=r.bool();break;case 4:i.src=r.string();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$9=1041,GLTFShape={serialize(e,t){const r=PBGLTFShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBGLTFShape.decode(e.buffer(),e.remainingBytes()),create:()=>PBGLTFShape.decode(new Uint8Array)};function createBasePBNFTShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1,src:"",assetId:"",style:0,color:void 0}}const PBNFTShape={encode:(e,t=minimalExports.Writer.create())=>(!0===e.withCollisions&&t.uint32(8).bool(e.withCollisions),!0===e.isPointerBlocker&&t.uint32(16).bool(e.isPointerBlocker),!0===e.visible&&t.uint32(24).bool(e.visible),""!==e.src&&t.uint32(34).string(e.src),""!==e.assetId&&t.uint32(42).string(e.assetId),0!==e.style&&t.uint32(48).int32(e.style),void 0!==e.color&&Color3.encode(e.color,t.uint32(58).fork()).ldelim(),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBNFTShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.withCollisions=r.bool();break;case 2:i.isPointerBlocker=r.bool();break;case 3:i.visible=r.bool();break;case 4:i.src=r.string();break;case 5:i.assetId=r.string();break;case 6:i.style=r.int32();break;case 7:i.color=Color3.decode(r,r.uint32());break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$8=1040,NFTShape={serialize(e,t){const r=PBNFTShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBNFTShape.decode(e.buffer(),e.remainingBytes()),create:()=>PBNFTShape.decode(new Uint8Array)};function createBasePBOnPointerDown(){return{button:0,hoverText:"",distance:0,showFeedback:!1}}const PBOnPointerDown={encode:(e,t=minimalExports.Writer.create())=>(0!==e.button&&t.uint32(8).int32(e.button),""!==e.hoverText&&t.uint32(18).string(e.hoverText),0!==e.distance&&t.uint32(29).float(e.distance),!0===e.showFeedback&&t.uint32(32).bool(e.showFeedback),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBOnPointerDown();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.button=r.int32();break;case 2:i.hoverText=r.string();break;case 3:i.distance=r.float();break;case 4:i.showFeedback=r.bool();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$7=1060,OnPointerDown={serialize(e,t){const r=PBOnPointerDown.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBOnPointerDown.decode(e.buffer(),e.remainingBytes()),create:()=>PBOnPointerDown.decode(new Uint8Array)};function createBasePBOnPointerDownResult(){return{button:0,meshName:"",origin:void 0,direction:void 0,point:void 0,normal:void 0,distance:0,timestamp:0}}const PBOnPointerDownResult={encode:(e,t=minimalExports.Writer.create())=>(0!==e.button&&t.uint32(16).int32(e.button),""!==e.meshName&&t.uint32(26).string(e.meshName),void 0!==e.origin&&Vector3.encode(e.origin,t.uint32(34).fork()).ldelim(),void 0!==e.direction&&Vector3.encode(e.direction,t.uint32(42).fork()).ldelim(),void 0!==e.point&&Vector3.encode(e.point,t.uint32(50).fork()).ldelim(),void 0!==e.normal&&Vector3.encode(e.normal,t.uint32(58).fork()).ldelim(),0!==e.distance&&t.uint32(69).float(e.distance),0!==e.timestamp&&t.uint32(72).int32(e.timestamp),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBOnPointerDownResult();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 2:i.button=r.int32();break;case 3:i.meshName=r.string();break;case 4:i.origin=Vector3.decode(r,r.uint32());break;case 5:i.direction=Vector3.decode(r,r.uint32());break;case 6:i.point=Vector3.decode(r,r.uint32());break;case 7:i.normal=Vector3.decode(r,r.uint32());break;case 8:i.distance=r.float();break;case 9:i.timestamp=r.int32();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$6=1066,OnPointerDownResult={serialize(e,t){const r=PBOnPointerDownResult.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBOnPointerDownResult.decode(e.buffer(),e.remainingBytes()),create:()=>PBOnPointerDownResult.decode(new Uint8Array)};function createBasePBOnPointerUp(){return{button:0,hoverText:"",distance:0,showFeedback:!1}}const PBOnPointerUp={encode:(e,t=minimalExports.Writer.create())=>(0!==e.button&&t.uint32(8).int32(e.button),""!==e.hoverText&&t.uint32(18).string(e.hoverText),0!==e.distance&&t.uint32(29).float(e.distance),!0===e.showFeedback&&t.uint32(32).bool(e.showFeedback),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBOnPointerUp();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.button=r.int32();break;case 2:i.hoverText=r.string();break;case 3:i.distance=r.float();break;case 4:i.showFeedback=r.bool();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$5=1061,OnPointerUp={serialize(e,t){const r=PBOnPointerUp.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBOnPointerUp.decode(e.buffer(),e.remainingBytes()),create:()=>PBOnPointerUp.decode(new Uint8Array)};function createBasePBOnPointerUpResult(){return{button:0,meshName:"",origin:void 0,direction:void 0,point:void 0,normal:void 0,distance:0,timestamp:0}}const PBOnPointerUpResult={encode:(e,t=minimalExports.Writer.create())=>(0!==e.button&&t.uint32(16).int32(e.button),""!==e.meshName&&t.uint32(26).string(e.meshName),void 0!==e.origin&&Vector3.encode(e.origin,t.uint32(34).fork()).ldelim(),void 0!==e.direction&&Vector3.encode(e.direction,t.uint32(42).fork()).ldelim(),void 0!==e.point&&Vector3.encode(e.point,t.uint32(50).fork()).ldelim(),void 0!==e.normal&&Vector3.encode(e.normal,t.uint32(58).fork()).ldelim(),0!==e.distance&&t.uint32(69).float(e.distance),0!==e.timestamp&&t.uint32(72).int32(e.timestamp),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBOnPointerUpResult();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 2:i.button=r.int32();break;case 3:i.meshName=r.string();break;case 4:i.origin=Vector3.decode(r,r.uint32());break;case 5:i.direction=Vector3.decode(r,r.uint32());break;case 6:i.point=Vector3.decode(r,r.uint32());break;case 7:i.normal=Vector3.decode(r,r.uint32());break;case 8:i.distance=r.float();break;case 9:i.timestamp=r.int32();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$4=1065,OnPointerUpResult={serialize(e,t){const r=PBOnPointerUpResult.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBOnPointerUpResult.decode(e.buffer(),e.remainingBytes()),create:()=>PBOnPointerUpResult.decode(new Uint8Array)};function createBasePBPlaneShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1,uvs:[]}}const PBPlaneShape={encode(e,t=minimalExports.Writer.create()){!0===e.withCollisions&&t.uint32(8).bool(e.withCollisions),!0===e.isPointerBlocker&&t.uint32(16).bool(e.isPointerBlocker),!0===e.visible&&t.uint32(24).bool(e.visible),t.uint32(34).fork();for(const r of e.uvs)t.float(r);return t.ldelim(),t},decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBPlaneShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.withCollisions=r.bool();break;case 2:i.isPointerBlocker=r.bool();break;case 3:i.visible=r.bool();break;case 4:if(2==(7&e)){const e=r.uint32()+r.pos;for(;r.pos<e;)i.uvs.push(r.float())}else i.uvs.push(r.float());break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$3=1014,PlaneShape={serialize(e,t){const r=PBPlaneShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBPlaneShape.decode(e.buffer(),e.remainingBytes()),create:()=>PBPlaneShape.decode(new Uint8Array)};function createBasePBSphereShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1}}const PBSphereShape={encode:(e,t=minimalExports.Writer.create())=>(!0===e.withCollisions&&t.uint32(8).bool(e.withCollisions),!0===e.isPointerBlocker&&t.uint32(16).bool(e.isPointerBlocker),!0===e.visible&&t.uint32(24).bool(e.visible),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBSphereShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.withCollisions=r.bool();break;case 2:i.isPointerBlocker=r.bool();break;case 3:i.visible=r.bool();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$2=1015,SphereShape={serialize(e,t){const r=PBSphereShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBSphereShape.decode(e.buffer(),e.remainingBytes()),create:()=>PBSphereShape.decode(new Uint8Array)};function createBasePBTextShape(){return{text:"",visible:!1,font:"",opacity:0,fontSize:0,fontAutoSize:!1,hTextAlign:"",vTextAlign:"",width:0,height:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,lineSpacing:0,lineCount:0,textWrapping:!1,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,outlineWidth:0,shadowColor:void 0,outlineColor:void 0,textColor:void 0}}const PBTextShape={encode:(e,t=minimalExports.Writer.create())=>(""!==e.text&&t.uint32(10).string(e.text),!0===e.visible&&t.uint32(16).bool(e.visible),""!==e.font&&t.uint32(26).string(e.font),0!==e.opacity&&t.uint32(37).float(e.opacity),0!==e.fontSize&&t.uint32(45).float(e.fontSize),!0===e.fontAutoSize&&t.uint32(48).bool(e.fontAutoSize),""!==e.hTextAlign&&t.uint32(58).string(e.hTextAlign),""!==e.vTextAlign&&t.uint32(66).string(e.vTextAlign),0!==e.width&&t.uint32(77).float(e.width),0!==e.height&&t.uint32(85).float(e.height),0!==e.paddingTop&&t.uint32(93).float(e.paddingTop),0!==e.paddingRight&&t.uint32(101).float(e.paddingRight),0!==e.paddingBottom&&t.uint32(109).float(e.paddingBottom),0!==e.paddingLeft&&t.uint32(117).float(e.paddingLeft),0!==e.lineSpacing&&t.uint32(125).float(e.lineSpacing),0!==e.lineCount&&t.uint32(128).int32(e.lineCount),!0===e.textWrapping&&t.uint32(136).bool(e.textWrapping),0!==e.shadowBlur&&t.uint32(149).float(e.shadowBlur),0!==e.shadowOffsetX&&t.uint32(157).float(e.shadowOffsetX),0!==e.shadowOffsetY&&t.uint32(165).float(e.shadowOffsetY),0!==e.outlineWidth&&t.uint32(173).float(e.outlineWidth),void 0!==e.shadowColor&&Color3.encode(e.shadowColor,t.uint32(178).fork()).ldelim(),void 0!==e.outlineColor&&Color3.encode(e.outlineColor,t.uint32(186).fork()).ldelim(),void 0!==e.textColor&&Color3.encode(e.textColor,t.uint32(194).fork()).ldelim(),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBTextShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.text=r.string();break;case 2:i.visible=r.bool();break;case 3:i.font=r.string();break;case 4:i.opacity=r.float();break;case 5:i.fontSize=r.float();break;case 6:i.fontAutoSize=r.bool();break;case 7:i.hTextAlign=r.string();break;case 8:i.vTextAlign=r.string();break;case 9:i.width=r.float();break;case 10:i.height=r.float();break;case 11:i.paddingTop=r.float();break;case 12:i.paddingRight=r.float();break;case 13:i.paddingBottom=r.float();break;case 14:i.paddingLeft=r.float();break;case 15:i.lineSpacing=r.float();break;case 16:i.lineCount=r.int32();break;case 17:i.textWrapping=r.bool();break;case 18:i.shadowBlur=r.float();break;case 19:i.shadowOffsetX=r.float();break;case 20:i.shadowOffsetY=r.float();break;case 21:i.outlineWidth=r.float();break;case 22:i.shadowColor=Color3.decode(r,r.uint32());break;case 23:i.outlineColor=Color3.decode(r,r.uint32());break;case 24:i.textColor=Color3.decode(r,r.uint32());break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$1=1030,TextShape={serialize(e,t){const r=PBTextShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n,!1)},deserialize:e=>PBTextShape.decode(e.buffer(),e.remainingBytes()),create:()=>PBTextShape.decode(new Uint8Array)};var ComponentIds;function defineProtocolBufferComponents({defineComponent:e}){return{Animator:e(COMPONENT_ID$h,Animator),AudioSource:e(COMPONENT_ID$g,AudioSource),AvatarAttach:e(COMPONENT_ID$f,AvatarAttach),AvatarShape:e(COMPONENT_ID$e,AvatarShape),Billboard:e(COMPONENT_ID$d,Billboard),BoxShape:e(COMPONENT_ID$c,BoxShape),CameraModeArea:e(COMPONENT_ID$b,CameraModeArea),CylinderShape:e(COMPONENT_ID$a,CylinderShape),GLTFShape:e(COMPONENT_ID$9,GLTFShape),NFTShape:e(COMPONENT_ID$8,NFTShape),OnPointerDown:e(COMPONENT_ID$7,OnPointerDown),OnPointerDownResult:e(COMPONENT_ID$6,OnPointerDownResult),OnPointerUp:e(COMPONENT_ID$5,OnPointerUp),OnPointerUpResult:e(COMPONENT_ID$4,OnPointerUpResult),PlaneShape:e(COMPONENT_ID$3,PlaneShape),SphereShape:e(COMPONENT_ID$2,SphereShape),TextShape:e(COMPONENT_ID$1,TextShape)}}!function(e){e[e.Animator=1042]="Animator",e[e.AudioSource=1020]="AudioSource",e[e.AvatarAttach=1073]="AvatarAttach",e[e.AvatarShape=1080]="AvatarShape",e[e.Billboard=1090]="Billboard",e[e.BoxShape=1013]="BoxShape",e[e.CameraModeArea=1071]="CameraModeArea",e[e.CylinderShape=1016]="CylinderShape",e[e.GLTFShape=1041]="GLTFShape",e[e.NFTShape=1040]="NFTShape",e[e.OnPointerDown=1060]="OnPointerDown",e[e.OnPointerDownResult=1066]="OnPointerDownResult",e[e.OnPointerUp=1061]="OnPointerUp",e[e.OnPointerUpResult=1065]="OnPointerUpResult",e[e.PlaneShape=1014]="PlaneShape",e[e.SphereShape=1015]="SphereShape",e[e.TextShape=1030]="TextShape"}(ComponentIds||(ComponentIds={}));const TRANSFORM_LENGTH=44,Transform={serialize(e,t){const r=t.incrementWriteOffset(TRANSFORM_LENGTH);t.setFloat32(r,e.position.x),t.setFloat32(r+4,e.position.y),t.setFloat32(r+8,e.position.z),t.setFloat32(r+12,e.rotation.x),t.setFloat32(r+16,e.rotation.y),t.setFloat32(r+20,e.rotation.z),t.setFloat32(r+24,e.rotation.w),t.setFloat32(r+28,e.scale.x),t.setFloat32(r+32,e.scale.y),t.setFloat32(r+36,e.scale.z),t.setUint32(r+40,e.parent||0)},deserialize(e){const t=e.incrementReadOffset(TRANSFORM_LENGTH);return{position:distExports$1.Vector3.create(e.getFloat32(t),e.getFloat32(t+4),e.getFloat32(t+8)),rotation:distExports$1.Quaternion.create(e.getFloat32(t+12),e.getFloat32(t+16),e.getFloat32(t+20),e.getFloat32(t+24)),scale:distExports$1.Vector3.create(e.getFloat32(t+28),e.getFloat32(t+32),e.getFloat32(t+36)),parent:e.getUint32(t+40)}},create:()=>({position:{x:0,y:0,z:0},scale:{x:1,y:1,z:1},rotation:{x:0,y:0,z:0,w:1},parent:void 0})};var LEGACY_COMPONENT_ID,COMPONENT_ID;function defineLegacyComponents({defineComponent:e}){return{Transform:e(LEGACY_COMPONENT_ID.TRANSFORM,Transform),...defineProtocolBufferComponents({defineComponent:e})}}function defineSdkComponents(e){return{...defineLegacyComponents(e)}}!function(e){e[e.TRANSFORM=1]="TRANSFORM",e[e.UUID_CALLBACK=8]="UUID_CALLBACK",e[e.BOX_SHAPE=16]="BOX_SHAPE",e[e.SPHERE_SHAPE=17]="SPHERE_SHAPE",e[e.PLANE_SHAPE=18]="PLANE_SHAPE",e[e.CONE_SHAPE=19]="CONE_SHAPE",e[e.CYLINDER_SHAPE=20]="CYLINDER_SHAPE",e[e.TEXT_SHAPE=21]="TEXT_SHAPE",e[e.NFT_SHAPE=22]="NFT_SHAPE",e[e.UI_WORLD_SPACE_SHAPE=23]="UI_WORLD_SPACE_SHAPE",e[e.UI_SCREEN_SPACE_SHAPE=24]="UI_SCREEN_SPACE_SHAPE",e[e.UI_CONTAINER_RECT=25]="UI_CONTAINER_RECT",e[e.UI_CONTAINER_STACK=26]="UI_CONTAINER_STACK",e[e.UI_TEXT_SHAPE=27]="UI_TEXT_SHAPE",e[e.UI_INPUT_TEXT_SHAPE=28]="UI_INPUT_TEXT_SHAPE",e[e.UI_IMAGE_SHAPE=29]="UI_IMAGE_SHAPE",e[e.UI_SLIDER_SHAPE=30]="UI_SLIDER_SHAPE",e[e.CIRCLE_SHAPE=31]="CIRCLE_SHAPE",e[e.BILLBOARD=32]="BILLBOARD",e[e.ANIMATION=33]="ANIMATION",e[e.FONT=34]="FONT",e[e.UI_FULLSCREEN_SHAPE=40]="UI_FULLSCREEN_SHAPE",e[e.UI_BUTTON_SHAPE=41]="UI_BUTTON_SHAPE",e[e.GLTF_SHAPE=54]="GLTF_SHAPE",e[e.OBJ_SHAPE=55]="OBJ_SHAPE",e[e.AVATAR_SHAPE=56]="AVATAR_SHAPE",e[e.BASIC_MATERIAL=64]="BASIC_MATERIAL",e[e.PBR_MATERIAL=65]="PBR_MATERIAL",e[e.HIGHLIGHT_ENTITY=66]="HIGHLIGHT_ENTITY",e[e.SOUND=67]="SOUND",e[e.TEXTURE=68]="TEXTURE",e[e.VIDEO_CLIP=70]="VIDEO_CLIP",e[e.VIDEO_TEXTURE=71]="VIDEO_TEXTURE",e[e.AVATAR_TEXTURE=72]="AVATAR_TEXTURE",e[e.AUDIO_CLIP=200]="AUDIO_CLIP",e[e.AUDIO_SOURCE=201]="AUDIO_SOURCE",e[e.AUDIO_STREAM=202]="AUDIO_STREAM",e[e.GIZMOS=203]="GIZMOS",e[e.SMART_ITEM=204]="SMART_ITEM",e[e.AVATAR_MODIFIER_AREA=205]="AVATAR_MODIFIER_AREA",e[e.AVATAR_ATTACH=206]="AVATAR_ATTACH",e[e.CAMERA_MODE_AREA=207]="CAMERA_MODE_AREA",e[e.NAME=300]="NAME",e[e.LOCKED_ON_EDIT=301]="LOCKED_ON_EDIT",e[e.VISIBLE_ON_EDIT=302]="VISIBLE_ON_EDIT"}(LEGACY_COMPONENT_ID||(LEGACY_COMPONENT_ID={})),function(e){e[e.SYNC=1e3]="SYNC"}(COMPONENT_ID||(COMPONENT_ID={}));var dist={},types={},hasRequiredTypes,hasRequiredDist;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,Object.defineProperty(types,"__esModule",{value:!0})),types}function requireDist(){return hasRequiredDist||(hasRequiredDist=1,function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};function n(e,t){if(e===t)return!0;if(e instanceof Uint8Array&&t instanceof Uint8Array){if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}return!!(globalThis.Buffer&&e instanceof Buffer&&t instanceof Buffer)&&e.equals(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.crdtProtocol=e.sameData=void 0,r(requireTypes(),e),e.sameData=n,e.crdtProtocol=function(){const e={};function t(t,r,n){const i=Math.max(n,e[t]?.timestamp||0);return e[t]={timestamp:i,data:r}}return{createEvent:function(r,n){const i=(e[r]?.timestamp||0)+1;return t(r,n,i),{key:r,data:n,timestamp:i}},processMessage:function(r){const{key:i,data:o,timestamp:a}=r,s=e[i];return!s||s.timestamp<a?(t(i,o,a),r):s.timestamp>a?{key:i,data:s.data,timestamp:s.timestamp}:n(s.data,o)?r:function(e,t){return e>t}(s.data,o)?{key:i,data:s.data,timestamp:s.timestamp}:(t(i,o,a).data,r)},getState:function(){return{...e}}}}}(dist)),dist}var distExports=requireDist();function getNextSize(e,t){const r=Math.max(e,t)+1024;return 1024*Math.ceil(r/1024)}const defaultInitialCapacity=10240;function createByteBuffer(e={}){var t;const r=(null===(t=e.reading)||void 0===t?void 0:t.currentOffset)||0;let n=null,i=0;e.writing?(n=e.writing.buffer,e.writing.currentOffset&&(i=e.writing.currentOffset)):e.reading?(n=e.reading.buffer,i=e.reading.length||e.reading.buffer.length):n=new Uint8Array(e.initialCapacity||defaultInitialCapacity);let o=n,a=new DataView(o.buffer,o.byteOffset),s=i,u=r;const c=e=>{if(s+e>o.byteLength){const t=getNextSize(o.byteLength,s+e),r=new Uint8Array(t);r.set(o),o=r,a=new DataView(o.buffer)}return s+=e,s-e},l=e=>{if(u+e>s)throw new Error("Outside of the bounds of writen data.");return u+=e,u-e};return{buffer:()=>o,bufferLength:()=>o.length,resetBuffer(){u=0,s=0},currentReadOffset:()=>u,currentWriteOffset:()=>s,incrementReadOffset:e=>l(e),remainingBytes:()=>s-u,readFloat32:()=>a.getFloat32(l(4)),readFloat64:()=>a.getFloat64(l(8)),readInt8:()=>a.getInt8(l(1)),readInt16:()=>a.getInt16(l(2)),readInt32:()=>a.getInt32(l(4)),readInt64:()=>a.getBigInt64(l(8)),readUint8:()=>a.getUint8(l(1)),readUint16:()=>a.getUint16(l(2)),readUint32:()=>a.getUint32(l(4)),readUint64:()=>a.getBigUint64(l(8)),readBuffer(){const e=a.getUint32(l(4));return o.subarray(l(e),l(0))},incrementWriteOffset:e=>c(e),size:()=>s,toBinary:()=>o.subarray(0,s),toCopiedBinary(){return new Uint8Array(this.toBinary())},writeBuffer(e,t=!0){t&&this.writeUint32(e.byteLength);const r=c(e.byteLength);o.set(e,r)},writeFloat32(e){const t=c(4);a.setFloat32(t,e)},writeFloat64(e){const t=c(8);a.setFloat64(t,e)},writeInt8(e){const t=c(1);a.setInt8(t,e)},writeInt16(e){const t=c(2);a.setInt16(t,e)},writeInt32(e){const t=c(4);a.setInt32(t,e)},writeInt64(e){const t=c(8);a.setBigInt64(t,e)},writeUint8(e){const t=c(1);a.setUint8(t,e)},writeUint16(e){const t=c(2);a.setUint16(t,e)},writeUint32(e){const t=c(4);a.setUint32(t,e)},writeUint64(e){const t=c(8);a.setBigUint64(t,e)},getFloat32:e=>a.getFloat32(e),getFloat64:e=>a.getFloat64(e),getInt8:e=>a.getInt8(e),getInt16:e=>a.getInt16(e),getInt32:e=>a.getInt32(e),getInt64:e=>a.getBigInt64(e),getUint8:e=>a.getUint8(e),getUint16:e=>a.getUint16(e),getUint32:e=>a.getUint32(e),getUint64:e=>a.getBigUint64(e),setFloat32(e,t){a.setFloat32(e,t)},setFloat64(e,t){a.setFloat64(e,t)},setInt8(e,t){a.setInt8(e,t)},setInt16(e,t){a.setInt16(e,t)},setInt32(e,t){a.setInt32(e,t)},setInt64(e,t){a.setBigInt64(e,t)},setUint8(e,t){a.setUint8(e,t)},setUint16(e,t){a.setUint16(e,t)},setUint32(e,t){a.setUint32(e,t)},setUint64(e,t){a.setBigUint64(e,t)}}}var WireMessage;!function(e){function t(t){const r=t.remainingBytes();if(r<e.HEADER_LENGTH)return!1;return!(r<t.getUint32(t.currentReadOffset()))}!function(e){e[e.RESERVED=0]="RESERVED",e[e.PUT_COMPONENT=1]="PUT_COMPONENT",e[e.DELETE_COMPONENT=2]="DELETE_COMPONENT",e[e.MAX_MESSAGE_TYPE=3]="MAX_MESSAGE_TYPE"}(e.Enum||(e.Enum={})),e.HEADER_LENGTH=8,e.validate=t,e.readHeader=function(e){return t(e)?{length:e.readUint32(),type:e.readUint32()}:null}}(WireMessage||(WireMessage={}));var WireMessage$1=WireMessage,ComponentOperation,CrdtUtils;!function(e){e.MESSAGE_HEADER_LENGTH=20,e.write=function(t,r,n,i,o){const a=o.incrementWriteOffset(WireMessage$1.HEADER_LENGTH+e.MESSAGE_HEADER_LENGTH);t===WireMessage$1.Enum.PUT_COMPONENT&&i.writeToByteBuffer(r,o);const s=o.size()-a;o.setUint32(a,s),o.setUint32(a+4,t),o.setUint32(a+8,r),o.setUint32(a+12,i._id),o.setUint64(a+16,BigInt(n)),o.setUint32(a+24,s-e.MESSAGE_HEADER_LENGTH-WireMessage$1.HEADER_LENGTH)},e.read=function(e){const t=WireMessage$1.readHeader(e);if(!t)return null;const r={...t,entity:e.readUint32(),componentId:e.readInt32(),timestamp:Number(e.readUint64())};return t.type===WireMessage$1.Enum.DELETE_COMPONENT?r:{...r,data:e.readBuffer()}}}(ComponentOperation||(ComponentOperation={})),function(e){var t;e.getKey=function(e,t){return`${e}.${t}`},(t=e.SynchronizedEntityType||(e.SynchronizedEntityType={}))[t.NETWORKED=0]="NETWORKED",t[t.RENDERER=1]="RENDERER"}(CrdtUtils||(CrdtUtils={}));var CrdtUtils$1=CrdtUtils,EntityUtils;function crdtSceneSystem({engine:e,transports:t}){const r=distExports.crdtProtocol(),n=[],i=[];function o(e){const t=Array.from(e);return e.length=0,t}return t.forEach((e=>{return e.onmessage=(t=e.type,function(e){const r=createByteBuffer({reading:{buffer:e,currentOffset:0}});for(;WireMessage$1.validate(r);){const e=r.currentReadOffset(),i=ComponentOperation.read(r),{type:o,entity:a,componentId:s,data:u,timestamp:c}=i;n.push({type:o,entity:a,componentId:s,data:u,timestamp:c,transportType:t,messageBuffer:r.buffer().subarray(e,r.currentReadOffset())})}});var t})),{createMessages:function(n){const a=o(i),s=createByteBuffer();for(const[i,o]of n)for(const n of o){const o=e.getComponent(n),u=o.has(i)?o.toBinary(i).toBinary():null,c=r.createEvent(CrdtUtils$1.getKey(i,n),u),l=s.currentWriteOffset(),f=o.has(i)?WireMessage$1.Enum.PUT_COMPONENT:WireMessage$1.Enum.DELETE_COMPONENT,d={type:f,componentId:n,entity:i,timestamp:c.timestamp};t.some((e=>e.filter(d)))&&(ComponentOperation.write(f,i,c.timestamp,o,s),a.push({...d,messageBuffer:s.buffer().subarray(l,s.currentWriteOffset())}))}const u=createByteBuffer();for(const e of t){u.resetBuffer();for(const t of a)e.filter(t)&&u.writeBuffer(t.messageBuffer,!1);u.size()&&e.send(u.toBinary())}},receiveMessages:function(){const a=o(n);for(const n of t){const t=createByteBuffer();for(const n of a){const{data:o,timestamp:a,componentId:s,entity:u,type:c}=n,l={key:CrdtUtils$1.getKey(u,s),data:o||null,timestamp:a},f=e.getComponent(s),d=r.processMessage(l);if(l!==d){const e=f.has(u)?WireMessage$1.Enum.PUT_COMPONENT:WireMessage$1.Enum.DELETE_COMPONENT;ComponentOperation.write(e,u,d.timestamp,f,t)}else{if(c===WireMessage$1.Enum.DELETE_COMPONENT)f.deleteFrom(u);else{const e=createByteBuffer({reading:{buffer:n.data,currentOffset:0}});f.upsertFromBinary(n.entity,e),f.clearDirty()}i.push(n)}}t.size()&&n.send(t.toBinary())}}}}function EntityContainer(){const e=Entity(EntityUtils.STATIC_ENTITIES_RANGE),t=Entity(EntityUtils.DYNAMIC_ENTITIES_RANGE);return{generateEntity:(r=!1)=>r?t.generateEntity():e.generateEntity(),removeEntity:r=>e.removeEntity(r)||t.removeEntity(r),isEntityExists:r=>EntityUtils.isReservedEntity(r)||e.getExistingEntities().has(r)||t.getExistingEntities().has(r),getExistingEntities:()=>new Set([...e.getExistingEntities(),...t.getExistingEntities()])}}function Entity(e){let t=e[0];const r=new Set;return{getExistingEntities:()=>new Set(r),generateEntity:function(){if(t>=e[1])throw new Error(`It fails trying to generate an entity out of range [${e[0]}, ${e[1]}].`);const n=t;return t++,r.add(n),n},removeEntity:function(e){return r.delete(e)}}}function deepReadonly(e){return Object.freeze({...e})}function defineComponent(e,t){const r=new Map,n=new Set;return{_id:e,isDirty:function(e){return n.has(e)},has:function(e){return r.has(e)},deleteFrom:function(e){const t=r.get(e);return r.delete(e),n.add(e),t||null},getOrNull:function(e){const t=r.get(e);return t?deepReadonly(t):null},getFrom:function(t){const n=r.get(t);if(!n)throw new Error(`[getFrom] Component ${e} for ${t} not found`);return deepReadonly(n)},create:function(i,o){if(r.get(i))throw new Error(`[create] Component ${e} for ${i} already exists`);const a=void 0===o?t.create():o;return r.set(i,a),n.add(i),a},createOrReplace:function(e,i){const o=void 0===i?t.create():i;return r.set(e,o),n.add(e),o},mutable:function(t){const i=r.get(t);if(!i)throw new Error(`[mutable] Component ${e} for ${t} not found`);return n.add(t),i},iterator:function*(){for(const[e,t]of r)yield[e,t]},dirtyIterator:function*(){for(const e of n)yield e},toBinary(n){const i=r.get(n);if(!i)throw new Error(`[toBinary] Component ${e} for ${n} not found`);const o=createByteBuffer();return t.serialize(i,o),o},writeToByteBuffer(n,i){const o=r.get(n);if(!o)throw new Error(`[writeToByteBuffer] Component ${e} for ${n} not found`);t.serialize(o,i)},updateFromBinary(t,n){if(!r.get(t))throw new Error(`[updateFromBinary] Component ${e} for ${t} not found`);return this.upsertFromBinary(t,n)},upsertFromBinary(e,i){const o=t.deserialize(i);return r.set(e,o),n.add(e),o},clearDirty:function(){n.clear()}}}!function(e){function t(e,t){return e>=t[0]&&e<=t[1]}e.MAX_ENTITIES=4294967295,e.DYNAMIC_ENTITIES_START_AT=1e5,e.RESERVED_STATIC_ENTITIES=512,e.RESERVED_ENTITIES_RANGE=[0,e.RESERVED_STATIC_ENTITIES-1],e.STATIC_ENTITIES_RANGE=[e.RESERVED_STATIC_ENTITIES,e.DYNAMIC_ENTITIES_START_AT-1],e.DYNAMIC_ENTITIES_RANGE=[e.DYNAMIC_ENTITIES_START_AT,e.MAX_ENTITIES],e.isDynamicEntity=function(r){return t(r,e.DYNAMIC_ENTITIES_RANGE)},e.isStaticEntity=function(r){return t(r,e.STATIC_ENTITIES_RANGE)},e.isReservedEntity=function(r){return t(r,e.RESERVED_ENTITIES_RANGE)}}(EntityUtils||(EntityUtils={}));const SYSTEMS_REGULAR_PRIORITY=1e5;function SystemContainer(){const e=[];function t(){e.sort(((e,t)=>t.priority-e.priority))}return{add:function(r,n,i){if(e.find((e=>e.fn===r)))throw new Error("System already added");if(i&&e.find((e=>e.name===i)))throw new Error("System name already used");e.push({fn:r,priority:n,name:i}),t()},remove:function(r){let n=-1;return n="string"==typeof r?e.findIndex((e=>e.name===r)):e.findIndex((e=>e.fn===r)),-1!==n&&(e.splice(n,1),t(),!0)},getSystems:()=>e}}function preEngine(){const e=EntityContainer(),t=new Map,r=new Map,n=SystemContainer();function i(t=!1){return e.generateEntity(t)}function*o(...e){const[t,...r]=e;for(const[n]of t.iterator()){let t=!0;for(const e of r)if(!e.has(n)){t=!1;break}t&&(yield[n,...e])}}return{entitiesComponent:r,componentsDefinition:t,addEntity:i,addDynamicEntity:function(){return i(!0)},removeEntity:function(r){for(const[,e]of t)e.has(r)&&e.deleteFrom(r);return e.removeEntity(r)},addSystem:function(e,t=SYSTEMS_REGULAR_PRIORITY,r){n.add(e,t,r)},getSystems:function(){return n.getSystems()},removeSystem:function(e){return n.remove(e)},defineComponent:function(e,r){if(t.get(e))throw new Error(`Component ${e} already declared`);const n=defineComponent(e,r);return t.set(e,n),n},mutableGroupOf:function*(...e){for(const[t,...r]of o(...e))yield[t,...r.map((e=>e.mutable(t)))]},groupOf:function*(...e){for(const[t,...r]of o(...e))yield[t,...r.map((e=>e.getFrom(t)))]},getComponent:function(e){const r=t.get(e);if(!r)throw new Error("Component not found. You need to declare the components at the beginnig of the engine declaration");return r}}}function Engine({transports:e}={}){const t=preEngine(),r=crdtSceneSystem({engine:t,transports:e||[]}),n=defineSdkComponents(t);return{addEntity:t.addEntity,addDynamicEntity:t.addDynamicEntity,removeEntity:t.removeEntity,addSystem:t.addSystem,removeSystem:t.removeSystem,defineComponent:t.defineComponent,mutableGroupOf:t.mutableGroupOf,groupOf:t.groupOf,getComponent:t.getComponent,update:function(e){r.receiveMessages();for(const r of t.getSystems())r.fn(e);const i=[n.OnPointerDownResult,n.OnPointerUpResult],o=i.map((e=>e._id));for(const e of i)for(const[r]of t.groupOf(e))e.deleteFrom(r);const a=new Map;for(const[e,r]of t.componentsDefinition)if(!o.includes(e))for(const t of r.dirtyIterator())a.has(t)||a.set(t,new Set),a.get(t).add(e);r.createMessages(a);for(const[e,r]of t.componentsDefinition)r.clearDirty()},baseComponents:n}}function MapType(e){return{serialize(t,r){for(const n in e)e[n].serialize(t[n],r)},deserialize(t){const r={};for(const n in e)r[n]=e[n].deserialize(t);return r},create(){const t={};for(const r in e)t[r]=e[r].create();return t}}}function ArrayType(e){return{serialize(t,r){r.writeUint32(t.length);for(const n of t)e.serialize(n,r)},deserialize(t){const r=[],n=t.readUint32();for(let i=0;i<n;i++)r.push(e.deserialize(t));return r},create:()=>[]}}function Optional(e){return{serialize(t,r){t?(r.writeInt8(1),e.serialize(t,r)):r.writeInt8(0)},deserialize(t){if(t.readInt8())return e.deserialize(t)},create(){}}}const Int64={serialize(e,t){t.writeInt64(BigInt(e))},deserialize:e=>Number(e.readInt64()),create:()=>0},Int32={serialize(e,t){t.writeInt32(e)},deserialize:e=>e.readInt32(),create:()=>0},Int16={serialize(e,t){t.writeInt16(e)},deserialize:e=>e.readInt16(),create:()=>0},Int8={serialize(e,t){t.writeInt8(e)},deserialize:e=>e.readInt8(),create:()=>0},Float32={serialize(e,t){t.writeFloat32(e)},deserialize:e=>e.readFloat32(),create:()=>0},Float64={serialize(e,t){t.writeFloat64(e)},deserialize:e=>e.readFloat64(),create:()=>0},FlatString={serialize(e,t){t.writeBuffer((new TextEncoder).encode(e))},deserialize:e=>(new TextDecoder).decode(e.readBuffer()),create:()=>""},EcsString=FlatString;function Enum(e){return{serialize(t,r){e.serialize(t,r)},deserialize:t=>e.deserialize(t),create:()=>e.create()}}const EcsBoolean={serialize(e,t){t.writeInt8(e?1:0)},deserialize:e=>1===e.readInt8(),create:()=>!1},componentIds=Object.values(ComponentIds).filter((e=>"number"==typeof e)).map(Number),rendererComponentIds=componentIds.concat(LEGACY_COMPONENT_ID.TRANSFORM);function createRendererTransport(){const e="renderer";return{type:e,send(e){dcl.callRpc("@decentraland/ExperimentalAPI","sendToRenderer",[{data:new Uint8Array(e)}]).catch(dcl.error)},filter:t=>t.transportType!==e&&(!!rendererComponentIds.includes(t.componentId)&&!!t)}}function createNetworkTransport(){const e="network-transport";return{send:function(...e){},type:e,filter:t=>t.transportType!==e&&!!t}}const rendererTransport=createRendererTransport(),engine=Engine({transports:[rendererTransport,createNetworkTransport()]});if(dcl){async function pullRendererMessages(){var e;const t=await dcl.callRpc("@decentraland/ExperimentalAPI","messageFromRenderer",[]);if((null===(e=t.data)||void 0===e?void 0:e.length)&&rendererTransport.onmessage)for(const e of t.data)rendererTransport.onmessage(e)}dcl.loadModule("@decentraland/ExperimentalAPI",{}).catch(dcl.error),dcl.onUpdate((e=>{pullRendererMessages().catch(dcl.error).finally((()=>engine.update(e)))}))}exports.ArrayType=ArrayType,exports.DEG2RAD=distExports$1.DEG2RAD,exports.EcsBoolean=EcsBoolean,exports.EcsString=EcsString,exports.Engine=Engine,exports.Enum=Enum,exports.Epsilon=distExports$1.Epsilon,exports.FlatString=FlatString,exports.Float32=Float32,exports.Float64=Float64,exports.Int16=Int16,exports.Int32=Int32,exports.Int64=Int64,exports.Int8=Int8,exports.MapType=MapType,exports.Optional=Optional,exports.Orientation=distExports$1.Orientation,exports.Quaternion=distExports$1.Quaternion,exports.RAD2DEG=distExports$1.RAD2DEG,exports.Space=distExports$1.Space,exports.ToGammaSpace=distExports$1.ToGammaSpace,exports.ToLinearSpace=distExports$1.ToLinearSpace,exports.Vector3=distExports$1.Vector3,exports.engine=engine,Object.defineProperty(exports,"__esModule",{value:!0})})(this.self=this.self||{});
|